aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornobody <nobody@localhost>2002-04-19 06:37:58 +0800
committernobody <nobody@localhost>2002-04-19 06:37:58 +0800
commit48b1ba672761c629ada7cc633d2685948bc126ea (patch)
treee5248cbdfefeb2c2b0849b77ed85e813386b8375
parent7397bc24b8b776af4c46d13d2ac77d0e063bc853 (diff)
downloadgsoc2013-evolution-EVOLUTION_1_0_4.tar
gsoc2013-evolution-EVOLUTION_1_0_4.tar.gz
gsoc2013-evolution-EVOLUTION_1_0_4.tar.bz2
gsoc2013-evolution-EVOLUTION_1_0_4.tar.lz
gsoc2013-evolution-EVOLUTION_1_0_4.tar.xz
gsoc2013-evolution-EVOLUTION_1_0_4.tar.zst
gsoc2013-evolution-EVOLUTION_1_0_4.zip
This commit was manufactured by cvs2svn to create tagEVOLUTION_1_0_4
'EVOLUTION_1_0_4'. svn path=/tags/EVOLUTION_1_0_4/; revision=16528
-rw-r--r--ChangeLog207
-rw-r--r--HACKING82
-rw-r--r--NEWS411
-rw-r--r--README12
-rw-r--r--acconfig.h9
-rw-r--r--addressbook/ChangeLog931
-rw-r--r--addressbook/backend/ebook/e-book-listener.c2
-rw-r--r--addressbook/backend/ebook/e-book-types.h1
-rw-r--r--addressbook/backend/ebook/e-book-util.c108
-rw-r--r--addressbook/backend/ebook/e-book-util.h68
-rw-r--r--addressbook/backend/ebook/e-book.c5
-rw-r--r--addressbook/backend/ebook/e-card.c1698
-rw-r--r--addressbook/backend/ebook/e-destination.c575
-rw-r--r--addressbook/backend/ebook/test-client.c1
-rw-r--r--addressbook/backend/idl/addressbook.idl3
-rw-r--r--addressbook/backend/pas/evolutionperson.schema2
-rw-r--r--addressbook/backend/pas/pas-backend-card-sexp.c49
-rw-r--r--addressbook/backend/pas/pas-backend-file.c107
-rw-r--r--addressbook/backend/pas/pas-backend-ldap.c1764
-rw-r--r--addressbook/backend/pas/pas-book.c87
-rw-r--r--addressbook/backend/pas/pas-book.h74
-rw-r--r--addressbook/conduit/address-conduit-config.h128
-rw-r--r--addressbook/conduit/address-conduit.c456
-rw-r--r--addressbook/gui/component/addressbook-config.c530
-rw-r--r--addressbook/gui/component/addressbook-config.glade1134
-rw-r--r--addressbook/gui/component/addressbook-factory.c4
-rw-r--r--addressbook/gui/component/addressbook-storage.c108
-rw-r--r--addressbook/gui/component/addressbook-storage.h16
-rw-r--r--addressbook/gui/component/addressbook.c221
-rw-r--r--addressbook/gui/component/select-names/e-select-names-bonobo.c52
-rw-r--r--addressbook/gui/component/select-names/e-select-names-completion.c21
-rw-r--r--addressbook/gui/component/select-names/e-select-names-manager.c839
-rw-r--r--addressbook/gui/component/select-names/e-select-names.c143
-rw-r--r--addressbook/gui/component/select-names/select-names.glade43
-rw-r--r--addressbook/gui/contact-editor/contact-editor.glade1
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor-address.c286
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.c146
-rw-r--r--addressbook/gui/contact-editor/fulladdr.glade236
-rw-r--r--addressbook/gui/widgets/e-addressbook-model.c1
-rw-r--r--addressbook/gui/widgets/e-addressbook-view.c754
-rw-r--r--addressbook/gui/widgets/e-minicard-view-widget.c54
-rw-r--r--art/ChangeLog76
-rw-r--r--art/about-box.pngbin51416 -> 45746 bytes
-rw-r--r--art/splash.pngbin31187 -> 85301 bytes
-rw-r--r--calendar/ChangeLog711
-rw-r--r--calendar/cal-client/Makefile.am15
-rw-r--r--calendar/cal-client/cal-client.c25
-rw-r--r--calendar/conduits/calendar/calendar-conduit-config.h135
-rw-r--r--calendar/conduits/calendar/calendar-conduit.c328
-rw-r--r--calendar/conduits/todo/todo-conduit-config.h129
-rw-r--r--calendar/conduits/todo/todo-conduit.c399
-rw-r--r--calendar/gui/Makefile.am19
-rw-r--r--calendar/gui/cal-search-bar.c32
-rw-r--r--calendar/gui/calendar-commands.c90
-rw-r--r--calendar/gui/calendar-config.c119
-rw-r--r--calendar/gui/calendar-model.c5
-rw-r--r--calendar/gui/control-factory.c61
-rw-r--r--calendar/gui/dialogs/comp-editor.c198
-rw-r--r--calendar/gui/dialogs/event-editor.c21
-rw-r--r--calendar/gui/dialogs/meeting-page.c11
-rw-r--r--calendar/gui/dialogs/task-editor.c41
-rw-r--r--calendar/gui/e-day-view.c346
-rw-r--r--calendar/gui/e-itip-control.c2
-rw-r--r--calendar/gui/e-meeting-model.c40
-rw-r--r--calendar/gui/e-tasks.c231
-rw-r--r--calendar/gui/e-week-view.c315
-rw-r--r--calendar/gui/gnome-cal.c156
-rw-r--r--calendar/gui/main.c5
-rw-r--r--calendar/gui/tasks-control.c298
-rw-r--r--calendar/idl/evolution-calendar.idl8
-rw-r--r--calendar/importers/GNOME_Evolution_Calendar_Importer.oaf.in24
-rw-r--r--calendar/pcs/cal-backend-file.c17
-rw-r--r--calendar/pcs/cal-backend.c27
-rw-r--r--calendar/pcs/cal-backend.h8
-rw-r--r--calendar/pcs/cal.c2
-rw-r--r--camel/ChangeLog1477
-rw-r--r--camel/Makefile.am75
-rw-r--r--camel/camel-charset-map-private.h296
-rw-r--r--camel/camel-charset-map.c63
-rw-r--r--camel/camel-folder-search.c320
-rw-r--r--camel/camel-folder-summary.c246
-rw-r--r--camel/camel-mime-filter-basic.c65
-rw-r--r--camel/camel-mime-filter-charset.c6
-rw-r--r--camel/camel-mime-message.c13
-rw-r--r--camel/camel-mime-part-utils.c193
-rw-r--r--camel/camel-mime-part.c142
-rw-r--r--camel/camel-mime-utils.c370
-rw-r--r--camel/camel-mime-utils.h35
-rw-r--r--camel/camel-pgp-context.c142
-rw-r--r--camel/camel-pgp-mime.c102
-rw-r--r--camel/camel-private.h34
-rw-r--r--camel/camel-service.c127
-rw-r--r--camel/camel-store.c2
-rw-r--r--camel/camel-tcp-stream-raw.c36
-rw-r--r--camel/camel-tcp-stream-ssl.c287
-rw-r--r--camel/camel-vee-folder.c10
-rw-r--r--camel/providers/imap/Makefile.am2
-rw-r--r--camel/providers/imap/camel-imap-command.c49
-rw-r--r--camel/providers/imap/camel-imap-folder.c386
-rw-r--r--camel/providers/imap/camel-imap-store.h1
-rw-r--r--camel/providers/imap/camel-imap-utils.c357
-rw-r--r--camel/providers/local/Makefile.am8
-rw-r--r--camel/providers/local/camel-local-folder.c35
-rw-r--r--camel/providers/local/camel-spool-summary.c5
-rw-r--r--camel/providers/nntp/Makefile.am27
-rw-r--r--camel/providers/pop3/Makefile.am7
-rw-r--r--camel/providers/pop3/camel-pop3-store.c753
-rw-r--r--camel/providers/sendmail/Makefile.am2
-rw-r--r--camel/providers/smtp/Makefile.am2
-rw-r--r--camel/providers/smtp/camel-smtp-transport.c585
-rw-r--r--composer/ChangeLog229
-rw-r--r--composer/e-msg-composer-attachment-bar.c16
-rw-r--r--composer/e-msg-composer-attachment.c4
-rw-r--r--composer/e-msg-composer-hdrs.c318
-rw-r--r--composer/e-msg-composer.c918
-rw-r--r--composer/e-msg-composer.h156
-rw-r--r--configure.in588
-rw-r--r--doc/devel/ChangeLog13
-rw-r--r--doc/devel/calendar/cal-client/Makefile.am18
-rw-r--r--doc/devel/calendar/cal-client/evolution-cal-client-decl.txt226
-rw-r--r--doc/devel/executive-summary/evolution-services.hierarchy7
-rw-r--r--doc/devel/importer/evolution-shell-importer.hierarchy7
-rw-r--r--e-util/ChangeLog90
-rw-r--r--e-util/e-bit-array.c429
-rw-r--r--e-util/e-bit-array.h104
-rw-r--r--e-util/e-i18n.h84
-rw-r--r--e-util/e-iconv.c478
-rw-r--r--e-util/e-iconv.h44
-rw-r--r--e-util/e-sorter-array.c292
-rw-r--r--e-util/e-sorter-array.h78
-rw-r--r--e-util/e-sorter.c156
-rw-r--r--e-util/e-sorter.h81
-rw-r--r--e-util/e-text-event-processor-emacs-like.c508
-rw-r--r--e-util/e-text-event-processor-emacs-like.h70
-rw-r--r--e-util/e-text-event-processor-types.h136
-rw-r--r--e-util/e-text-event-processor.c149
-rw-r--r--e-util/e-text-event-processor.h78
-rw-r--r--e-util/e-util.c1620
-rw-r--r--e-util/e-util.h327
-rw-r--r--e-util/e-xml-utils.c423
-rw-r--r--e-util/e-xml-utils.h100
-rw-r--r--filter/ChangeLog138
-rw-r--r--filter/filter-folder.c124
-rw-r--r--filter/filtertypes.xml90
-rw-r--r--filter/libfilter-i18n.h45
-rw-r--r--filter/rule-editor.c25
-rw-r--r--filter/vfolder-rule.c14
-rw-r--r--help/C/Makefile.am6
-rw-r--r--help/C/apx-gloss.sgml10
-rw-r--r--help/C/evolution-C.omf2
-rw-r--r--help/C/usage-calendar.sgml24
-rw-r--r--help/C/usage-exchange.sgml73
-rw-r--r--help/C/usage-mail-org.sgml57
-rw-r--r--help/C/usage-mail.sgml470
-rw-r--r--help/C/usage-mainwindow.sgml53
-rw-r--r--help/C/usage-print.sgml16
-rw-r--r--help/ChangeLog206
-rw-r--r--help/devel/executive-summary/evolution-services.hierarchy7
-rw-r--r--help/devel/importer/evolution-shell-importer.hierarchy7
-rw-r--r--help/no/config-encryption.sgml166
-rw-r--r--help/no/config-prefs.sgml48
-rw-r--r--help/no/evolution-no.omf2
-rw-r--r--help/no/preface.sgml82
-rw-r--r--help/zh_CN/apx-authors.sgml100
-rw-r--r--help/zh_CN/apx-bugs.sgml36
-rw-r--r--help/zh_CN/apx-gloss.sgml437
-rw-r--r--help/zh_CN/config-prefs.sgml744
-rw-r--r--help/zh_CN/config-sync.sgml133
-rw-r--r--help/zh_CN/evolution.sgml138
-rw-r--r--help/zh_CN/menuref.sgml421
-rw-r--r--help/zh_CN/preface.sgml83
-rw-r--r--help/zh_CN/usage-calendar.sgml561
-rw-r--r--help/zh_CN/usage-contact.sgml609
-rw-r--r--help/zh_CN/usage-mail.sgml2005
-rw-r--r--help/zh_CN/usage-mainwindow.sgml1174
-rw-r--r--help/zh_CN/usage-notes.sgml49
-rw-r--r--help/zh_CN/usage-print.sgml115
-rw-r--r--help/zh_CN/usage-sync.sgml39
-rw-r--r--libical/ChangeLog55
-rw-r--r--libical/configure.in1
-rw-r--r--libical/design-data/parameters.csv2
-rw-r--r--libical/src/Makefile.am2
-rw-r--r--libical/src/libical/icalyacc.y2
-rw-r--r--libical/src/libicalvcal/Makefile.am25
-rw-r--r--libical/src/libicalvcal/vcc.y27
-rw-r--r--mail/ChangeLog1547
-rw-r--r--mail/Makefile.am25
-rw-r--r--mail/folder-browser-ui.c173
-rw-r--r--mail/folder-browser.c661
-rw-r--r--mail/mail-account-gui.c928
-rw-r--r--mail/mail-accounts.c1163
-rw-r--r--mail/mail-callbacks.c1427
-rw-r--r--mail/mail-callbacks.h39
-rw-r--r--mail/mail-config.c994
-rw-r--r--mail/mail-display.c589
-rw-r--r--mail/mail-folder-cache.c11
-rw-r--r--mail/mail-format.c766
-rw-r--r--mail/mail-ops.c118
-rw-r--r--mail/mail-send-recv.c33
-rw-r--r--mail/mail-send-recv.h2
-rw-r--r--mail/mail-tools.c1
-rw-r--r--mail/mail-vfolder.c5
-rw-r--r--mail/main.c11
-rw-r--r--mail/message-list.c424
-rw-r--r--my-evolution/ChangeLog306
-rw-r--r--my-evolution/Locations147
-rw-r--r--my-evolution/Locations.h13
-rw-r--r--my-evolution/Makefile.am146
-rw-r--r--my-evolution/e-summary-calendar.c133
-rw-r--r--my-evolution/e-summary-factory.c10
-rw-r--r--my-evolution/e-summary-mail.c595
-rw-r--r--my-evolution/e-summary-preferences.c1072
-rw-r--r--my-evolution/e-summary-rdf.c167
-rw-r--r--my-evolution/e-summary-tasks.c34
-rw-r--r--my-evolution/e-summary.c207
-rw-r--r--my-evolution/main.c3
-rw-r--r--shell/ChangeLog920
-rw-r--r--shell/Makefile.am73
-rw-r--r--shell/e-setup.c43
-rw-r--r--shell/e-shell-about-box.c7
-rw-r--r--shell/e-shell-folder-commands.c12
-rw-r--r--shell/e-shell-folder-creation-dialog.c15
-rw-r--r--shell/e-shell-importer.c2
-rw-r--r--shell/e-shell-startup-wizard.c14
-rw-r--r--shell/e-shell-view-menu.c78
-rw-r--r--shell/e-shell-view.c360
-rw-r--r--shell/e-shell.c375
-rw-r--r--shell/e-splash.c1
-rw-r--r--shell/main.c60
-rw-r--r--tools/.cvsignore2
-rw-r--r--tools/Makefile.am36
-rw-r--r--widgets/ChangeLog26
-rw-r--r--widgets/e-timezone-dialog/e-timezone-dialog.c2
-rw-r--r--widgets/menus/gal-define-views-dialog.c335
-rw-r--r--widgets/menus/gal-define-views-dialog.h78
-rw-r--r--widgets/menus/gal-define-views-model.c335
-rw-r--r--widgets/menus/gal-define-views-model.h72
-rw-r--r--widgets/menus/gal-define-views.glade311
-rw-r--r--widgets/menus/gal-view-collection.c816
-rw-r--r--widgets/menus/gal-view-collection.h148
-rw-r--r--widgets/menus/gal-view-etable.c321
-rw-r--r--widgets/menus/gal-view-etable.h78
-rw-r--r--widgets/menus/gal-view-factory-etable.c143
-rw-r--r--widgets/menus/gal-view-factory-etable.h61
-rw-r--r--widgets/menus/gal-view-factory.c126
-rw-r--r--widgets/menus/gal-view-factory.h78
-rw-r--r--widgets/menus/gal-view-new-dialog.c224
-rw-r--r--widgets/menus/gal-view-new-dialog.glade220
-rw-r--r--widgets/menus/gal-view-new-dialog.h79
-rw-r--r--widgets/menus/gal-view.c225
-rw-r--r--widgets/menus/gal-view.h96
-rw-r--r--widgets/misc/ChangeLog273
-rw-r--r--widgets/misc/e-canvas-utils.c172
-rw-r--r--widgets/misc/e-canvas-utils.h57
-rw-r--r--widgets/misc/e-canvas-vbox.c376
-rw-r--r--widgets/misc/e-canvas-vbox.h93
-rw-r--r--widgets/misc/e-canvas.c1083
-rw-r--r--widgets/misc/e-canvas.h132
-rw-r--r--widgets/misc/e-colors.c99
-rw-r--r--widgets/misc/e-colors.h44
-rw-r--r--widgets/misc/e-cursors.c153
-rw-r--r--widgets/misc/e-cursors.h68
-rw-r--r--widgets/misc/e-filter-bar.c20
-rw-r--r--widgets/misc/e-gui-utils.c262
-rw-r--r--widgets/misc/e-gui-utils.h62
-rw-r--r--widgets/misc/e-hsv-utils.c178
-rw-r--r--widgets/misc/e-hsv-utils.h53
-rw-r--r--widgets/misc/e-popup-menu.c182
-rw-r--r--widgets/misc/e-popup-menu.h107
-rw-r--r--widgets/misc/e-printable.c221
-rw-r--r--widgets/misc/e-printable.h91
-rw-r--r--widgets/misc/e-reflow-model.c303
-rw-r--r--widgets/misc/e-reflow-model.h105
-rw-r--r--widgets/misc/e-reflow.c1378
-rw-r--r--widgets/misc/e-reflow.h139
-rw-r--r--widgets/misc/e-search-bar.c406
-rw-r--r--widgets/misc/e-search-bar.h79
-rw-r--r--widgets/misc/e-selection-model-array.c550
-rw-r--r--widgets/misc/e-selection-model-array.h95
-rw-r--r--widgets/misc/e-selection-model-simple.c117
-rw-r--r--widgets/misc/e-selection-model-simple.h70
-rw-r--r--widgets/misc/e-selection-model.c661
-rw-r--r--widgets/misc/e-selection-model.h169
-rw-r--r--widgets/misc/e-unicode.c3125
-rw-r--r--widgets/misc/e-unicode.h135
-rw-r--r--widgets/misc/gal-categories.glade197
-rw-r--r--widgets/misc/pixmaps/.cvsignore2
-rw-r--r--widgets/misc/pixmaps/cursor_cross.xpm38
-rw-r--r--widgets/misc/pixmaps/cursor_hand_closed.xpm38
-rw-r--r--widgets/misc/pixmaps/cursor_hand_open.xpm38
-rw-r--r--widgets/misc/pixmaps/cursor_zoom_in.xpm37
-rw-r--r--widgets/misc/pixmaps/cursor_zoom_out.xpm37
-rw-r--r--widgets/misc/test-color.c69
-rw-r--r--widgets/table/.cvsignore13
-rw-r--r--widgets/table/add-col.xpm22
-rw-r--r--widgets/table/arrow-down.xpm21
-rw-r--r--widgets/table/arrow-up.xpm21
-rw-r--r--widgets/table/check-empty.xpm21
-rw-r--r--widgets/table/check-filled.xpm21
-rw-r--r--widgets/table/clip.pngbin192 -> 0 bytes
-rw-r--r--widgets/table/e-cell-checkbox.c67
-rw-r--r--widgets/table/e-cell-checkbox.h51
-rw-r--r--widgets/table/e-cell-combo.c656
-rw-r--r--widgets/table/e-cell-combo.h63
-rw-r--r--widgets/table/e-cell-date.c182
-rw-r--r--widgets/table/e-cell-date.h50
-rw-r--r--widgets/table/e-cell-float.c93
-rw-r--r--widgets/table/e-cell-float.h54
-rw-r--r--widgets/table/e-cell-number.c85
-rw-r--r--widgets/table/e-cell-number.h50
-rw-r--r--widgets/table/e-cell-pixbuf.c344
-rw-r--r--widgets/table/e-cell-pixbuf.h53
-rw-r--r--widgets/table/e-cell-popup.c528
-rw-r--r--widgets/table/e-cell-popup.h97
-rw-r--r--widgets/table/e-cell-progress.c450
-rw-r--r--widgets/table/e-cell-progress.h74
-rw-r--r--widgets/table/e-cell-size.c108
-rw-r--r--widgets/table/e-cell-size.h50
-rw-r--r--widgets/table/e-cell-spin-button.c674
-rw-r--r--widgets/table/e-cell-spin-button.h103
-rw-r--r--widgets/table/e-cell-text.c2670
-rw-r--r--widgets/table/e-cell-text.h108
-rw-r--r--widgets/table/e-cell-toggle.c441
-rw-r--r--widgets/table/e-cell-toggle.h63
-rw-r--r--widgets/table/e-cell-tree.c767
-rw-r--r--widgets/table/e-cell-tree.h76
-rw-r--r--widgets/table/e-cell-vbox.c489
-rw-r--r--widgets/table/e-cell-vbox.h68
-rw-r--r--widgets/table/e-cell.c499
-rw-r--r--widgets/table/e-cell.h222
-rw-r--r--widgets/table/e-table-click-to-add.c550
-rw-r--r--widgets/table/e-table-click-to-add.h78
-rw-r--r--widgets/table/e-table-col-dnd.h39
-rw-r--r--widgets/table/e-table-col.c227
-rw-r--r--widgets/table/e-table-col.h106
-rw-r--r--widgets/table/e-table-column-specification.c144
-rw-r--r--widgets/table/e-table-column-specification.h76
-rw-r--r--widgets/table/e-table-column.c308
-rw-r--r--widgets/table/e-table-config-field.c292
-rw-r--r--widgets/table/e-table-config-field.h70
-rw-r--r--widgets/table/e-table-config-no-group.glade1761
-rw-r--r--widgets/table/e-table-config.c1137
-rw-r--r--widgets/table/e-table-config.glade1841
-rw-r--r--widgets/table/e-table-config.h111
-rw-r--r--widgets/table/e-table-defines.h45
-rw-r--r--widgets/table/e-table-example-1.c308
-rw-r--r--widgets/table/e-table-example-2.c350
-rw-r--r--widgets/table/e-table-extras.c249
-rw-r--r--widgets/table/e-table-extras.h82
-rw-r--r--widgets/table/e-table-field-chooser-dialog.c219
-rw-r--r--widgets/table/e-table-field-chooser-dialog.h79
-rw-r--r--widgets/table/e-table-field-chooser-item.c691
-rw-r--r--widgets/table/e-table-field-chooser-item.h76
-rw-r--r--widgets/table/e-table-field-chooser.c275
-rw-r--r--widgets/table/e-table-field-chooser.glade129
-rw-r--r--widgets/table/e-table-field-chooser.h84
-rw-r--r--widgets/table/e-table-group-container.c1449
-rw-r--r--widgets/table/e-table-group-container.h99
-rw-r--r--widgets/table/e-table-group-leaf.c633
-rw-r--r--widgets/table/e-table-group-leaf.h91
-rw-r--r--widgets/table/e-table-group.c702
-rw-r--r--widgets/table/e-table-group.glade206
-rw-r--r--widgets/table/e-table-group.h179
-rw-r--r--widgets/table/e-table-header-item.c1801
-rw-r--r--widgets/table/e-table-header-item.h115
-rw-r--r--widgets/table/e-table-header-utils.c467
-rw-r--r--widgets/table/e-table-header-utils.h66
-rw-r--r--widgets/table/e-table-header.c931
-rw-r--r--widgets/table/e-table-header.h120
-rw-r--r--widgets/table/e-table-item.c3513
-rw-r--r--widgets/table/e-table-item.h225
-rw-r--r--widgets/table/e-table-memory-callbacks.c265
-rw-r--r--widgets/table/e-table-memory-callbacks.h94
-rw-r--r--widgets/table/e-table-memory-store.c412
-rw-r--r--widgets/table/e-table-memory-store.h118
-rw-r--r--widgets/table/e-table-memory.c295
-rw-r--r--widgets/table/e-table-memory.h80
-rw-r--r--widgets/table/e-table-model.c593
-rw-r--r--widgets/table/e-table-model.h173
-rw-r--r--widgets/table/e-table-one.c254
-rw-r--r--widgets/table/e-table-one.h61
-rw-r--r--widgets/table/e-table-scrolled.c224
-rw-r--r--widgets/table/e-table-scrolled.h77
-rw-r--r--widgets/table/e-table-search.c242
-rw-r--r--widgets/table/e-table-search.h72
-rw-r--r--widgets/table/e-table-selection-model.c338
-rw-r--r--widgets/table/e-table-selection-model.h76
-rw-r--r--widgets/table/e-table-simple.c313
-rw-r--r--widgets/table/e-table-simple.h123
-rw-r--r--widgets/table/e-table-size-test.c308
-rw-r--r--widgets/table/e-table-sort-info.c488
-rw-r--r--widgets/table/e-table-sort-info.h110
-rw-r--r--widgets/table/e-table-sorted-variable.c224
-rw-r--r--widgets/table/e-table-sorted-variable.h68
-rw-r--r--widgets/table/e-table-sorted.c310
-rw-r--r--widgets/table/e-table-sorted.h68
-rw-r--r--widgets/table/e-table-sorter.c445
-rw-r--r--widgets/table/e-table-sorter.h75
-rw-r--r--widgets/table/e-table-sorting-utils.c349
-rw-r--r--widgets/table/e-table-sorting-utils.h83
-rw-r--r--widgets/table/e-table-specification.c401
-rw-r--r--widgets/table/e-table-specification.h91
-rw-r--r--widgets/table/e-table-state.c261
-rw-r--r--widgets/table/e-table-state.h76
-rw-r--r--widgets/table/e-table-subset-variable.c256
-rw-r--r--widgets/table/e-table-subset-variable.h86
-rw-r--r--widgets/table/e-table-subset.c461
-rw-r--r--widgets/table/e-table-subset.h92
-rw-r--r--widgets/table/e-table-tooltip.h45
-rw-r--r--widgets/table/e-table-tree.h49
-rw-r--r--widgets/table/e-table-utils.c131
-rw-r--r--widgets/table/e-table-utils.h45
-rw-r--r--widgets/table/e-table-without.c395
-rw-r--r--widgets/table/e-table-without.h90
-rw-r--r--widgets/table/e-table.c3147
-rw-r--r--widgets/table/e-table.diabin4514 -> 0 bytes
-rw-r--r--widgets/table/e-table.h355
-rw-r--r--widgets/table/e-tree-memory-callbacks.c275
-rw-r--r--widgets/table/e-tree-memory-callbacks.h119
-rw-r--r--widgets/table/e-tree-memory.c725
-rw-r--r--widgets/table/e-tree-memory.h105
-rw-r--r--widgets/table/e-tree-model.c1082
-rw-r--r--widgets/table/e-tree-model.h225
-rw-r--r--widgets/table/e-tree-scrolled.c223
-rw-r--r--widgets/table/e-tree-scrolled.h77
-rw-r--r--widgets/table/e-tree-selection-model.c1393
-rw-r--r--widgets/table/e-tree-selection-model.h77
-rw-r--r--widgets/table/e-tree-simple.c213
-rw-r--r--widgets/table/e-tree-simple.h88
-rw-r--r--widgets/table/e-tree-sorted-variable.c472
-rw-r--r--widgets/table/e-tree-sorted-variable.h85
-rw-r--r--widgets/table/e-tree-sorted.c1408
-rw-r--r--widgets/table/e-tree-sorted.h87
-rw-r--r--widgets/table/e-tree-table-adapter.c1134
-rw-r--r--widgets/table/e-tree-table-adapter.h87
-rw-r--r--widgets/table/e-tree.c3148
-rw-r--r--widgets/table/e-tree.h304
-rw-r--r--widgets/table/image1.pngbin1858 -> 0 bytes
-rw-r--r--widgets/table/image2.pngbin1987 -> 0 bytes
-rw-r--r--widgets/table/image3.pngbin2051 -> 0 bytes
-rw-r--r--widgets/table/remove-col.xpm22
-rw-r--r--widgets/table/sample.table45
-rw-r--r--widgets/table/spec.xml21
-rw-r--r--widgets/table/table-test.c62
-rw-r--r--widgets/table/table-test.h27
-rw-r--r--widgets/table/test-check.c222
-rw-r--r--widgets/table/test-cols.c266
-rw-r--r--widgets/table/test-table.c478
-rw-r--r--widgets/table/tree-expanded.xpm23
-rw-r--r--widgets/table/tree-unexpanded.xpm23
-rw-r--r--widgets/text/.cvsignore11
-rw-r--r--widgets/text/e-completion-match.c186
-rw-r--r--widgets/text/e-completion-match.h69
-rw-r--r--widgets/text/e-completion-test.c220
-rw-r--r--widgets/text/e-completion-view.c932
-rw-r--r--widgets/text/e-completion-view.h103
-rw-r--r--widgets/text/e-completion.c644
-rw-r--r--widgets/text/e-completion.h103
-rw-r--r--widgets/text/e-entry-test.c83
-rw-r--r--widgets/text/e-entry.c1355
-rw-r--r--widgets/text/e-entry.h89
-rw-r--r--widgets/text/e-table-text-model.c246
-rw-r--r--widgets/text/e-table-text-model.h66
-rw-r--r--widgets/text/e-text-model-repos.c87
-rw-r--r--widgets/text/e-text-model-repos.h69
-rw-r--r--widgets/text/e-text-model-test.c93
-rw-r--r--widgets/text/e-text-model-uri.c359
-rw-r--r--widgets/text/e-text-model-uri.h57
-rw-r--r--widgets/text/e-text-model.c645
-rw-r--r--widgets/text/e-text-model.h119
-rw-r--r--widgets/text/e-text-test.c171
-rw-r--r--widgets/text/e-text.c4214
-rw-r--r--widgets/text/e-text.h273
473 files changed, 21626 insertions, 109410 deletions
diff --git a/ChangeLog b/ChangeLog
index d2aff80878..c43e20afc1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,177 +1,85 @@
-2002-04-17 Ettore Perazzoli <ettore@ximian.com>
+== Version 1.0.4. ==
- * configure.in: Require GAL 0.19.99.13.
+2002-04-18 Ettore Perazzoli <ettore@ximian.com>
-2002-04-17 Christopher James Lahey <clahey@ximian.com>
-
- * configure.in: Bumped required gal version number to 0.19.99.12.
-
-2002-04-17 Christopher James Lahey <clahey@ximian.com>
-
- * configure.in: Bumped required gal version number to 0.19.99.11.
-
-2002-04-16 Jeffrey Stedfast <fejj@ximian.com>
-
- * configure.in: Add checks for gethostbyaddr_r
-
-2002-04-14 Jeffrey Stedfast <fejj@ximian.com>
-
- * configure.in: Check for socklen_t and if it doesn't exist,
- define it as unsigned int.
+ * configure.in: Version 1.0.4.
2002-04-04 JP Rosevear <jpr@ximian.com>
* configure.in: Fix static linking on solaris which doesn't have a
- static libresolv.
-
-2002-04-01 Chris Toshok <toshok@ximian.com>
-
- * libversit/vobject.c (newStrItem): only include if USE_STRTBL is
- defined.
- (deleteStrItem): same.
- (hashStr): same.
- (lookupStr): if USE_STRTBL is defined, use existing behavior. if
- not defined, just dup the string.
- (unUseStr): if USE_STRTBL is defined, use existing behavior. if
- not defined, just free the string.
-
-2002-04-01 Dan Winship <danw@ximian.com>
-
- Darwin/OS X portability from Max Horn <max@quendi.de>
-
- * libversit/vcc.y: Remove #include <malloc.h>.
-
- * libversit/vobject.c: Likewise, and #include <stdlib.h>
-
-2002-03-30 Ettore Perazzoli <ettore@ximian.com>
-
- * configure.in: Add argument `--enable-shlib-components'. New
- substitutions OAF_SHLIB_LOCATION, OAF_SHLIB_PREFIX,
- OAF_SHLIB_SUFFIX.
-
-2002-03-29 Ettore Perazzoli <ettore@ximian.com>
-
- * configure.in: Check for GConf. Add gthreads to LIBIBEX_CFLAGS
- and LIBIBEX_LIBS.
-
-2002-03-28 Christopher James Lahey <clahey@ximian.com>
-
- * configure.in: Bumped the required version of gal to 0.19.99.10.
-
-2002-03-24 Peter Williams <peterw@ximian.com>
-
- * tools/killev: Change the OAFIID for the GtkHTML editor to
- have :1.1 at the end.
-
-2002-03-19 Dan Winship <danw@ximian.com>
-
- * tools/Makefile.am (evolution_addressbook_import_LDADD):
- s/libversit.la/libversit.a/
-
-2002-03-13 Chris Toshok <toshok@ximian.com>
-
- * configure.in (EVOLUTION_ADDRESSBOOK_DEPS): add gal.
-
-2002-03-12 Christopher James Lahey <clahey@ximian.com>
-
- * configure.in: Bumped the required version of gal.
-
-2002-03-06 Jeffrey Stedfast <fejj@ximian.com>
-
- * configure.in: Allow the user to enable OpenSSL over Mozilla NSS
- using --enable-openssl or --disable-nss.
-
-2002-02-24 jacob berkman <jacob@ximian.com>
+ static libresolv. Fixes 21033.
- * sounds/Makefile.am (EXTRA_DIST): add $(sounds_DATA)
+2002-03-20 Ettore Perazzoli <ettore@ximian.com>
-2002-02-22 Larry Ewing <lewing@ximian.com>
+ * configure.in: Up to version 1.0.3.99.
- * configure.in: add libglade the to the E_UTIL flags.
+== Version 1.0.3. ==
-2002-02-13 Christopher James Lahey <clahey@ximian.com>
+2002-03-19 Ettore Perazzoli <ettore@ximian.com>
- * configure.in: Bumped the required version of gal.
+ * configure.in: Version 1.0.3.
-2002-02-12 Tõivo Leedjärv <leedjarv@interest.ee>
+2002-03-04 JP Rosevear <jpr@ximian.com>
- * configure.in: Added et to ALL_LINGUAS.
+ * NEWS: Update calendar news
-2002-02-09 JP Rosevear <jpr@ximian.com>
+2002-02-02 Ettore Perazzoli <ettore@ximian.com>
- * configure.in: make sure PISOCK cflags are added where
- appropriate
+ * configure.in: 1.0.2.99, Preview Release.
-2002-02-08 Damon Chaplin <damon@ximian.com>
+== Version 1.0.2. ==
- * Makefile.am (SUBDIRS): added sounds.
+2002-01-24 Ettore Perazzoli <ettore@ximian.com>
- * configure.in (AC_OUTPUT): added sounds/Makefile.
+ * configure.in: Not a Preview Release anymore. Set VERSION to
+ 1.0.2.
- * sounds/Makefile.am: new file.
- * sounds/default_alarm.wav: default alarm sound, currently only used
- when vCalendar files are imported with audio alarms. We need a better
- sound.
+2002-01-24 Ettore Perazzoli <ettore@ximian.com>
-2002-02-07 Christopher James Lahey <clahey@ximian.com>
+ * NEWS: Update.
- * configure.in: Bumped the required version of gal.
+2001-12-18 Ettore Perazzoli <ettore@ximian.com>
-2002-01-28 Radek Doulik <rodo@ximian.com>
+ * configure.in: Set VERSION_COMMENT say "Preview Release".
- * configure.in: added bonobo to filter flags to avoid compile
- error
+2001-12-18 Ettore Perazzoli <ettore@ximian.com>
-2002-01-27 Ettore Perazzoli <ettore@ximian.com>
+ * configure.in: Set VERSION to 1.0.1.99.
- * tools/Makefile.am: Use GNOME_FULL_LIBS and GNOME_FULL_CFLAGS.
+== Version 1.0.1. ==
- * configure.in: Define the CAMEL_{CFLAGS,LIBS} using
- EVO_SET_COMPILE_FLAGS. Likewise define E_UTIL_{CFLAGS,LIBS},
- E_NAME_{CFLAGS,LIBS}, SHELL_{CFLAGS,LIBS},
- IMPORTERS_{CFLAGS,LIBS}, WOMBAT_{CFLAGS,LIBS} and
- E_WIDGETS_{CFLAGS,LIBS}, LIBFILTER_{CFLAGS,LIBS}. Remove
- GAL_{LIBS,CFLAGS}. Add GNOME_FULL_{CFLAGS,LIBS}. Also, move all
- this stuff after OpenSSL check so they benefit from all the
- cflags/ldflags discoveries for the support libraries.
+2001-12-18 Ettore Perazzoli <ettore@ximian.com>
-2002-01-25 Ettore Perazzoli <ettore@ximian.com>
-
- * configure.in: Require gal 0.19.99.1.
+ * configure.in: Define `VERSION_COMMENT' to be the empty string.
+ Up version number to 1.0.1. Require GAL 0.19 or later and gtkhtml
+ 1.0.1 or later.
-2002-01-24 Ettore Perazzoli <ettore@ximian.com>
+2001-12-17 JP Rosevear <jpr@ximian.com>
- * configure.in: Define a new macro EVO_SET_COMPILE_FLAGS. Define
- EVOLUTION_ADDRESSBOOK_CFLAGS, EVOLUTION_ADDRESSBOOK_LIBS,
- EVOLUTION_ADDRESSBOOK_CONDUIT_CFLAGS,
- EVOLUTION_ADDRESSBOOK_CONDUIT_LIBS, EVOLUTION_SUMMARY_LIBS,
- EVOLUTION_SUMMARY_CFLAGS, EVOLUTION_CALENDAR_LIBS,
- EVOLUTION_CALENDAR_CFLAGS, EVOLUTION_CALENDAR_CONDUIT_LIBS,
- EVOLUTION_CALENDAR_CONDUIT_CFLAGS through it. Remove SOUP_CFLAGS
- and SOUP_LIBS.
+ * NEWS: Update
-2002-01-15 Iain Holmes <iain@ximian.com>
+2001-12-17 Dan Winship <danw@ximian.com>
- * configure.in: Add a check for libsoup. Define SOUP_CFLAGS and
- SOUP_LIBS
+ * configure.in (camel_providerdir): Define this here, using only
+ EVOLUTION_MAJOR_VERSION and EVOLUTION_MINOR_VERSION (and not MICRO
+ and NANO).
- * README: Update to include the SOUP dependancy.
+2001-12-17 Ettore Perazzoli <ettore@ximian.com>
-2002-01-04 Pablo Saratxaga <pablo@mandrakesoft.com>
+ * NEWS: Tidied up a bit.
- * configure.in: Added "eu" to ALL_LINGUAS
+2001-12-17 Ettore Perazzoli <ettore@ximian.com>
-2001-12-17 Dan Winship <danw@ximian.com>
+ * tools/Makefile.am (bin_SCRIPTS): Add `csv2vcard'.
- * configure.in (camel_providerdir): Define this here, using only
- EVOLUTION_MAJOR_VERSION and EVOLUTION_MINOR_VERSION (and not MICRO
- and NANO).
+ * csv2vcard: New file; script by Michael MacDonald to convert CSV
+ files into VCard files.
-2001-12-13 Chris Toshok <toshok@ximian.com>
+2001-12-17 Iain Holmes <iain@ximian.com>
- * configure.in: check for alloca.h.
+ * NEWS: Updated for summary
-2001-12-12 Ettore Perazzoli <ettore@ximian.com>
+2001-12-11 Ettore Perazzoli <ettore@ximian.com>
[Fix #16358, No man page for Evolution.]
@@ -180,27 +88,33 @@
* data/evolution.1: New man page for Evolution.
2001-12-10 JP Rosevear <jpr@ximian.com>
-
+
* configure.in: use UTF-8 as the char set when testing pilot link
-
-2001-12-11 Ettore Perazzoli <ettore@ximian.com>
- * data/evolution.desktop.in (_Name): "Ximian Evolution", not
- "Evolution".
+2001-12-10 Ettore Perazzoli <ettore@ximian.com>
-2001-12-11 Ettore Perazzoli <ettore@ximian.com>
+ * NEWS: Added 1.0 changes, massaged a little bit.
- * configure.in: Up VERSION to 1.1.0.99.
+ * HACKING: Remove Dan Winship from the mailer core team listing.
2001-12-06 Jeffrey Stedfast <fejj@ximian.com>
- * configure.in: s/PREVIEW_VERSION/VERSION_COMMENT
+ * configure.in: s/PREVIEW_RELEASE/VERSION_COMMENT
2001-12-04 Jeffrey Stedfast <fejj@ximian.com>
* configure.in: Add a AC_DEFINE for PREVIEW_RELEASE which is a
string that will be appended to the X-Mailer header.
+2001-12-05 Ettore Perazzoli <ettore@ximian.com>
+
+ * HACKING: Put the patch review policy here.
+
+2001-12-04 Ettore Perazzoli <ettore@ximian.com>
+
+ * configure.in: Update version number to 1.0.0.99 for snapshot
+ purposes.
+
2001-11-21 Jeffrey Stedfast <fejj@ximian.com>
* README: Updated. Don't say that the user needs to copy their
@@ -212,6 +126,13 @@
* configure.in: Remove checks for OpenSSL libraries.
+2001-11-21 Ettore Perazzoli <ettore@ximian.com>
+
+ * configure.in: Version 1.0. Require GtkHTML 1.0.
+
+ * data/evolution.desktop.in: Say "Ximian Evolution", not
+ "Evolution".
+
2001-11-20 Wang Jian <lark@linux.net.cn>
* configure.in(ALL_LINGUAS): Re-Added zh_CN. It is checked
diff --git a/HACKING b/HACKING
index e69de29bb2..70c119d7bc 100644
--- a/HACKING
+++ b/HACKING
@@ -0,0 +1,82 @@
+ This is the stable branch of Evolution. As a consequence, any
+commit to this branch is subject to a patch review mechanism, as
+defined by the following rules:
+
+ 1. Every patch will be sent to evolution-patches@ximian.com in the
+ form of a unified diff (cvs diff -u).
+
+ 2. Every patch will have to be on the list for at least 24 hours
+ before being committed. A week-end (Saturday+Sunday) counts as
+ a single 24-hour day.
+
+ If a patch is by one of the core contributors of the module the
+ patch refers to and no-one speaks up against it in the 24 hour
+ period, the author can go ahead and commit the patch.
+
+ On the other hand, patches by people who are not core
+ contributors of the module being patched will always have to be
+ confirmed as safe by one of the core contributors first.
+
+ 3. As an exception to rule 2, if the patch gets approved by all
+ the core developers of the module before the 24-hour period, it
+ may get committed immediately. This doesn't apply to the
+ modules that have only one core maintainer though (e.g. the
+ shell); in that case, the patch will have to be approved by at
+ least one core developer of another module in order to be
+ committed before the 24-hour period.
+
+ 4. Core contributors are required to give their opinion on the bug
+ in the 24 hour period.
+
+ 5. Core module members are defined as follows:
+
+ Addressbook:
+ Chris Lahey <clahey@ximian.com>
+ Chris Toshok <toshok@ximian.com>
+ Jon Trowbridge <trow@ximian.com>
+
+ Calendar:
+ JP Rosevear <jpr@ximian.com>
+ Damon Chaplin <damon@ximian.com>
+ Rodrigo Moya <rodrigo@ximian.com>
+
+ GAL:
+ ETable:
+ Chris Lahey <clahey@ximian.com>
+ Shortcut bar:
+ Damon Chaplin <damon@ximian.com>
+ Other GAL widgets:
+ Respective authors.
+
+ GtkHTML:
+ Radek Doulik <rodo@ximian.com>
+ Larry Ewing <lewing@ximian.com>
+
+ Importers:
+ Iain Holmes <iain@ximian.com>
+
+ Mailer:
+ Jeffrey Stedfast <fejj@ximian.com>
+ Michael Zucchi <notzed@ximian.com>
+
+ Shell:
+ Ettore Perazzoli <ettore@ximian.com>
+
+ Summary:
+ Iain Holmes <iain@ximian.com>
+
+ 6. Patches must be attached to bugs that are actually on the
+ Bugzilla, and the bug # must be specified when sending the patch
+ to the list.
+
+ 7. Once the patch has been committed, it is the author's
+ responsibility to:
+
+ - Close the corresponding bug on Bugzilla.
+
+ - Write to the mailing list, replying to the original message
+ containing the patch to inform the other hackers that the
+ patch has been committed.
+
+ - Update NEWS with a listing of the changes applied and
+ corresponding Ximian Bugzilla bug numbers.
diff --git a/NEWS b/NEWS
index c9e577e07a..ecd92c6e1b 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,413 @@
-*** SOMEONE SHOULD MERGE NEWS FROM THE 1-0 BRANCH HERE ***
+Evolution 1.0.4, 18-04-2002
+---------------------------
+Bugzilla Bugs Fixed (see http://bugzilla.ximian.com/show_bug.cgi):
+
+ * Addressbook
+
+ #22965 -- Comply with RFC 2739 for calCalURI and calFBURL. (Toshok)
+
+ * Calendar
+
+ #22624 -- Unable to accept meeting request that doesn't list user
+ as attendee. (JP)
+
+ * Startup Wizard
+
+ #22047 -- Crash after closing the start-up wizard. (Ettore)
+
+ * Mailer
+
+ #8214 -- "Error Synchronizing Folder" on incoming mail spool.
+ (Michael)
+ #18929 -- If we get multiple Content-Type header values, change
+ subsequent headers to X-Invalid-Content-Type so it doesn't
+ wreck processing. (Michael)
+ #22363 -- Problems resyncing IMAP folders when going Online. (Jeff)
+ #21716 -- Fixes to decoding illegally rfc2047 encoded words. (Michael)
+ #22657 -- Fixes printing for some localizations (Radek)
+
+
+Other fixes:
+
+ * Calendar
+
+ - Use default tasks folder in calendar view. (Rodrigo)
+ - Added getQuery method to CalBackend to allow custom queries for
+ each calendar backend. (Rodrigo)
+
+ * Mailer
+
+ - Fixed Daylight-Savings-Time calculations on systems that use
+ tm.tm_gmtoff rather than 'timezone' (affects BSD systems). (Jeff)
+ - Fixed the annoying EINPROGRESS error dialogs when connecting
+ to IMAP/SMTP/POP via SSL. (Jeff)
+ - Changed the date format used in From-lines in mbox spools to be
+ the same as those used by Pine to fix interoperability issues.
+ (Michael)
+ - Fixed some filtertypes.xml typos. (Michael)
+
+ * Summary
+
+ - Change the dot.kde.org url.
+
+Updated translations:
+
+ - fi (Sami Pesonen)
+ - fr (Christophe Merlet, Frederic Riss)
+ - ko (Young-Ho Cha)
+ - nl (Tino Meinen)
+ - no (Kjartan Maraas)
+ - pt_BR (Gustavo Maciel Dias Vieira)
+
+
+Evolution 1.0.3, 19-03-2002
+---------------------------
+
+Bugzilla Bugs Fixed (see http://bugzilla.ximian.com/show_bug.cgi):
+
+ * Addressbook
+
+ #16097 -- Need a way to let the user specify the DN to
+ authenticate against. (Toshok)
+ #16680 -- LDAP performance problem. (Toshok)
+ #16968 -- Changing search type immediately requeries. (Toshok)
+ #20089 -- Cannot copy contacts with comma from "Contacts" to LDAP.
+ (Toshok)
+ #20690 -- LDAP contacts dont show when using letter shortcuts.
+ (Toshok)
+ #20740 -- LDAP performance problem. (Toshok)
+ #20871 -- SelectNames dialog needs search feedback. (Toshok)
+
+ * Calendar
+
+ #14705 -- iMIP compatibility with versions of Outlook. (Better fix
+ for the pseudo-fix in 1.0.1). We now support Outlook in
+ both Workgroup and Internet-Only modes. (Dan)
+ #19054 -- Minimum number of alarm repetitions should be
+ 1. (Federico)
+ #19234 -- BYMONTH off-by-one in RRULE:FREQ=YEARLY. (Damon)
+ #20510 -- Load free busy info as attendees are added. (JP)
+ #20022 -- Itip addresses are case sensitive. (JP)
+ #20226 -- Timezone data missing from some itip replies. (JP)
+ #20346 -- Calendar should indicate if backend dies. (Rodrigo)
+ #20780 -- Better subjects in iMIP messages. (Dan)
+ #20787 -- Accepted/declined messages aren't always clear. (JP)
+ #20800 -- Sorting of free busy information in schedule page does
+ not work. (JP)
+ #20783 -- Accepting updated meeting request doesn't work. (Rodrigo)
+ #21198 -- Outlook didn't recognize Evolution's acceptance of an
+ updated meeting request. (Dan)
+ #21240 -- Calendar Reminders don't appear for appointments in remote
+ servers. (Rodrigo)
+
+ * Mailer
+
+ #19564 -- Don't crash when changing to disconnected mode. (Michael)
+ #20779 -- Set a 'name' parameter in the Content-Type header
+ since Outlook doesn't seem to check the filename
+ parameter on the Content-Disposition header. (Jeff)
+
+ * Shell
+
+ #20234 -- Deleting folder gratuitiously causes /local to open.
+ (Ettore)
+ #20237 -- Shell silently drops xfer errors. (Ettore)
+ #20311 -- New window from shortcuts should not show the folder
+ bar and the shortcut bar. (Ettore)
+
+ * Summary
+
+ #18025 -- Summary crash upon switching to offline mode. (Ettore)
+
+Other fixes:
+
+ * Calendar
+
+ - Show more descriptive messages on opening errors. (Rodrigo)
+ - Remove $filename.ics from remote URIs. (Rodrigo)
+
+ * Addressbook
+
+ - Fix search weirdness in local addressbooks. (Toshok)
+ - Let backends return general error status from load_uri instead
+ of just TRUE/FALSE. (Toshok)
+ - EBook(View) handling fixes in ESelectNames and
+ EAddressbookModel. (Clahey)
+ - Rethink (and change) some of the default queries to ones that
+ are at the same time useful and more easily implemented
+ efficiently by the backends, in both the component's view and in
+ the select-names dialog. (Toshok)
+ - Change the "beginswith" query implementation on the name field
+ to search both first and last name, so it's a little more useful
+ in the general case. (Toshok)
+
+Updated translations:
+
+ - es (Carlos Perelló Marín)
+ - fr (Christophe Merlet)
+ - jp (Akira TAGOH)
+ - nl (Vincent van Adrighem)
+ - nn (Roy-Magne Mo)
+ - no (Kjartan Maraas)
+ - pt_BR (Gustavo Maciel Dias Vieira)
+
+
+Evolution 1.0.2, 01-24-2002
+---------------------------
+
+Bugzilla Bugs Fixed (see http://bugzilla.ximian.com/show_bug.cgi):
+
+ * Addressbook
+
+ #17725 -- Non-ASCII letter headings are black when printing
+ (Zbigniew Chyla)
+
+ * Calendar
+
+ #6544 -- Make Timezone names translatable (Damon)
+ #18801 -- Alarms with specific trigger times are not shown (Damon)
+
+ * Importers
+
+ #16864 -- LDIF importer chokes on long description field (Toshok)
+ #17441 -- Crash trying to import VCards file into an LDAP folder
+ (Ettore)
+
+ * Mail
+
+ #6896 -- message_list_select() with wraparound won't select very
+ first message (Jeff)
+ #11499 -- All recovered Composer windows have HTML enabled (Jeff)
+ #16947 -- Crash while setting up a new mail account (Jeff)
+ #17205 -- Crash of evolution-mail on start-up (Jeff)
+ #17634 -- Marking a message as unread should undelete it, as well
+ (Jeff)
+ #17694 -- Exchange 5.5 reporting 2 messages as having the same UID
+ breaks Evolution (Jeff)
+ #17759 -- Cancelling Send/Receive can lose mail for local case
+ (Jeff)
+ #18142 -- Mailer crash when trying to send an email (Jeff)
+
+Other fixes:
+
+ * Summary
+
+ - Change the list of items in the mail preferences (Iain)
+
+ * Calendar
+
+ - Make Tasks default to public as in Outlook (Rodrigo)
+
+ * Importers
+
+ - Make the druid as a transient window for the main shell (Iain)
+
+ * Mail
+
+ - Follow symlinks for mbox files (Jeff)
+ - Fixed copy/paste problems in mail-account-gui.c (Ian Goldberg,
+ Jeff)
+ - Make Vfolders work with add-on storages (Dan)
+
+ * Shell
+
+ - Don't crash on missing icon on start-up (Michael Meeks)
+ - Change activation/deactivation order for views in order to
+ reduce flicker in the toolbars (Michael Meeks)
+
+Updated translations:
+
+ - bg (Alexander Shopov)
+ - el (Nick Niktaris, Panayotis Pakos, Simos Xenitellis)
+ - fr (Christophe Merlet)
+ - hu (Andras Timar)
+ - it (Clara Tattoni, Ettore)
+ - lv (Peteris Krisjanis)
+ - nn (Roy-Magne Mo)
+ - no (Kjartan Maraas)
+ - sk (Stanislav Visnovsky)
+ - sv (Christian Rose)
+
+
+Evolution 1.0.1, 12-18-2001
+---------------------------
+
+New features:
+
+ * csv2vcard script to convert CSV addressbook files from Outlook
+ into VCard files that the Evolution importer can understand (by
+ Michael MacDonald).
+
+ * Alarms are now properly synced in the calendar conduit.
+
+Bugs fixed:
+
+ * Addressbook
+
+ #10114 -- No icon for Delete in the New Contact List editor
+ #10241 -- Occasional address completion flakiness
+ #10910 -- "Save" in list editor vs. "Save and Close" in contact editor
+ #11776 -- Email addresses are case sensitive
+ #13751 -- AddressBook address entry form usability problem
+ #14002 -- Select names dialog stays up after composer is closed
+ #14074 -- Editing fields under the "Collaboration" LDAP contact
+ #14715 -- Wombat gets locked up when LDAP server is down
+ #14876 -- Modifying LDAP contacts destroys existing objectclass entries
+ #15379 -- Printing from the addressbook totally broken
+ #16156 -- "Save As", "Send As", "Send To" not available in list editor
+ #16176 -- Tab order starts wrong
+ #16510 -- Small contact editor fixes
+ #16744 -- Crash
+ #16852 -- Crash closing empty mail
+ #16910 -- Crashed addressbook when selecting addresses
+ #17109 -- Crashed when editing a contact
+ #17126 -- Adding some addresses does not work
+
+ * Calendar
+
+ #7641 -- Crash in EMap widget when used in Evolution
+ #8993 -- Attendees not stripped properly from itip replies
+ #13843 -- Deleting tasks causes crash
+ #13952 -- Notifier repeatedly gives alarm after appointment ended
+ #14087 -- Daily repeat event with end-date misses one day
+ #14489 -- UI bug in Calendar Settings
+ #14699 -- gtk_signal_disconnect_by_data warning
+ #14705 -- iMIP compatibility with versions of Outlook. (We now support
+ Outlook in an Exchange environment by default, but the old
+ behavior can be turned on with the environment variable
+ EVOLUTION_SEND_IMIP_AS_ATTACHMENT. This will be fixed better
+ later.)
+ #15401 -- Use UTF-8-aware gnome-print calls
+ #15456 -- Typo in translatable string
+ #15774 -- Crashed by selecting "decline" in meeting request
+ #15941 -- Location missing for the calendar
+ #15749 -- Empty end time in all-day-event crashes calendar.
+ #15774 -- Selecting decline in schedule meeting request makes evo crash
+ #15798 -- Calendar Date Never Updates
+ #16232 -- e-itip-control.c - init() doing odd stuff
+ #16359 -- Calendar Crash
+ #16460 -- Changing a meeting doesn't always offer to send an update
+ #16571 -- Weird URI in meeting request email
+ #16910 -- Crashed when entering a completion percentage
+ #16224 -- remove unsupported columns from Tasks view
+ #16880 -- Cannot import ical (ics) even its own
+ #17344 -- iCalendar should not be translated
+ #17526 -- Refreshing request does not show relevant information
+ #17527 -- Refresh requests have wrong menu
+ #17531 -- libical does not build with bison 1.30
+ #17606 -- libical does not build with autoconf 2.52
+ (none) -- Scheduling page did not accurately display no information range
+
+ * Conduits
+
+ #1183 -- Handle alarms in conduits
+ #14452 -- Converting names wrong from Palm
+ #15810 -- Crashed during EAddress sync
+ #15922 -- Crash
+ #16460 -- Changing a meeting doesn't always offer to send an
+ update
+ #16997 -- Pilot compilation with libiconv
+ #17230 -- Custom data on Pilot being over written
+
+ * Importers
+
+ #14701 -- Importing locks up Evolution
+
+ * Mail
+
+ #2233 -- Don't show RTF attachments inline
+ #5547 -- Crash: Error closing a HTML-mail
+ #12062 -- Can't use 'n' to skip to next unread if multiple messages
+ are selected
+ #13898 -- Crash: Cannot create emails in evolution
+ #14127 -- Wrong error message
+ #14348 -- Some things that need open messages...
+ #14517 -- "Clear" needed twice for non-body+subject searches
+ #14662 -- GPG signature showing as attachment
+ #14678 -- Timestamp on outgoing mail incorrect on FreeBSD
+ #14734 -- Evolution-mail crashes while accessing imap servers
+ #14770 -- Appending messages to other IMAP folder can cause INBOX to
+ stop updating
+ #14838 -- Saving passwords doesn't work
+ #14848 -- Forwarding wrong email due to next/prev
+ #14965 -- Message copy fails with space in folder names
+ #14976 -- Crash when reading a message from an IMAP server
+ #15264 -- Crash: evolution-mail seg fault on exit
+ #15374 -- "___" in autogenerated name of vfolder created by sender of
+ #15415 -- Virtual Folders Editor: display of non-ascii symbols is broken
+ #15449 -- `N' wraps `P' doesn't
+ #15451 -- Crash when pressing stop during "going offline"
+ #15489 -- Evolution crashed while deleting my IMAP mail account
+ #15491 -- Evolution crashes/becomes unusable if ppp connection is lost
+ #15498 -- Crash: Faulty vFolder editor
+ #15512 -- Hangs while scanning for changed messages on S/IMAP+Exchange
+ #15552 -- Crash
+ #15608 -- RCPT TO: response error: Success
+ #15647 -- Composer "send" button has wrong tooltip when offline
+ #15657 -- Empty recipients
+ #15693 -- Crash: Loading message contents from IMAP and close application
+ #15745 -- Search edit window widgets disabled. / Mail component crash.
+ #15813 -- Decrypting cuts off initial text
+ #15843 -- Attachments inside attachments
+ #15946 -- Opening IMAP mailbox made it crash
+ #15952 -- Mailer crashed after hitting page down key
+ #16227 -- "Body contains" seems to want a regexp
+ #16254 -- Add Sender to Addressbook missing from menus
+ #16284 -- Evolution-mail crashed selecting "create vfolder on subject"
+ #16371 -- Corrupt Email crashes Mail component
+ #16416 -- X-Mailer says "Preview Release"
+ #16501 -- Crash while creating new account
+ #16520 -- Crash
+ #16559 -- Race-condition in the Camel type system
+ #16669 -- Camel 64-bit badness
+ #16695 -- A few dialogs are missing sensible titles
+ #16698 -- Crash: Can't empty trash; segfault when I try to exit
+ #16722 -- Attachment properties dialog crash
+ #16903 -- Crash: segv retrieving mail
+ #16924 -- Crash on a particular spam message
+ #16936 -- Crash when opening a specific message
+ #16947 -- Crash: Trouble Setting up a new mail account
+ #17085 -- Bad encoding for subject
+ #17386 -- Crash when reading a specific message
+
+ * Shell
+
+ #7827 -- Switching desktops leaves the folder bar popped up
+ #14518 -- Crashed when starting the program
+ #14701 -- Importing locks up Evolution
+ #15435 -- "Rename folder" dialog: non-ASCII folder names are displayed
+ #16507 -- Right Click -> View does nothing
+ #16693 -- Crash when creating a new folder
+ #17258 -- Shell displays splash even if Evolution is already running
+
+ * Summary
+
+ #8029 -- Locations.h file for translators
+ #11212 -- Degree symbol in weather
+ #14483 -- "Hello"?
+ #14996 -- All-day appointments are displayed incorrectly in the
+ summary view
+ #16417 -- Have a better default than CNN headlines
+ #16772 -- Summary crashes on startup
+ #17249 -- Crash going offline
+
+ * Misc
+
+ #16358 -- Evolution doesn't have a man page
+ #17377 -- Evolution doesn't work on multi-visual displays
+
+
+Evolution 1.0, 2001-11-14
+-------------------------
+
+Misc:
+ Removed OpenSSL support.
+
+Mailer:
+ #14893 -- Mailer hanging if you specify an invalid password
+
+
Evolution 0.99.2 (Release Candidate 2), 2001-11-14
--------------------------------------------------
@@ -61,7 +469,6 @@ Addressbook:
#14646 -- Doesn't handle failure in default_book case
#14743 -- Contacts crashes when saving a List
#14780 -- Pushing categories in Contact editor crashes Contacts
- #17355 -- e-select-names/completion from arbitrary storages
Pilot conduits:
diff --git a/README b/README
index daa5653e93..7a252ace7d 100644
--- a/README
+++ b/README
@@ -143,8 +143,6 @@ and -devel packages for each library.
- gtkhtml - later than 0.16.1
- - SOUP: later than 0.6.99
-
Other non-GNOME Dependencies:
- Berkeley's libdb - 3.1.17
@@ -211,16 +209,6 @@ in your evolution source directory do:
--with-nspr-libs=<nspr-libs-prefix> --with-nss-includes=<nss-includes-prefix>
--with-nss-libs=<nss-libs-prefix>
-You'll need to `cp ~/.mozilla/default/*.db ~/evolution` on you've
-installed Evolution in order to get a functional SSL-enabled
-Evolution.
-
-WARNING: Evolution also comes with OpenSSL support
-(--with-openssl-libs and --with-openssl-includes), but it's not very
-well tested, and quite unstable at this point. It is recommended that
-you use the NSPR-based SSL support instead.
-
-
NEWSGROUP (NNTP) SUPPORT
------------------------
diff --git a/acconfig.h b/acconfig.h
index e4aed8a2d6..d5403163e6 100644
--- a/acconfig.h
+++ b/acconfig.h
@@ -16,7 +16,6 @@
#undef NEED_KRB_SENDAUTH_PROTO
#undef HAVE_KRB5
#undef HAVE_NSS
-#undef HAVE_OPENSSL
#undef HAVE_SSL
#undef USE_DOT
#undef USE_FCNTL
@@ -34,7 +33,7 @@
/* Sub-version identification string. */
#undef SUB_VERSION
-/* Preview-release string */
+/* Prewview-release string */
#undef VERSION_COMMENT
/* Define if ctime_r takes three arguments */
@@ -42,9 +41,3 @@
/* Define if gethostbyname_r takes five arguments */
#undef GETHOSTBYNAME_R_FIVE_ARGS
-
-/* Define if gethostbyaddr_r takes seven arguments */
-#undef GETHOSTBYADDR_R_SEVEN_ARGS
-
-/* Define to `int' if your system doesn't have `socklen_t'. */
-#undef socklen_t
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 7b151d6ebc..c67eb47a9e 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,253 +1,13 @@
-2002-04-18 Chris Toshok <toshok@ximian.com>
+2002-04-02 Chris Toshok <toshok@ximian.com>
- * backend/pas/pas-backend-ldap.c (get_ldap_library_info): fix
- memory leaks.
+ * backend/pas/evolutionperson.schema: deprecate freeBusyURI
+ and calendarURI.
- * gui/component/GNOME_Evolution_Addressbook.oaf.in: remove the
- Addressbook_ConfigControl stuff to LDAP_ConfigControl.
-
- * gui/component/Makefile.am (evolution_addressbook_SOURCES):
- remove addressbook-config.* and add ldap-config.*
- (glade_DATA): same.
- (evolution_addressbook_LDADD): add LDAP_LIBS.
-
- * gui/component/addressbook-component.c (owner_set_cb):
- addressbook_config_register_factory =>
- ldap_config_register_factory.
-
- * gui/component/addressbook.c (book_open_cb): remove source->type
- check - they're always LDAP.
- (load_uri_cb): same.
-
- * gui/component/addressbook-storage.c (ldap_unparse_ssl): new
- function.
- (ldap_parse_ssl): new function.
- (addressbook_storage_init_source_uri): use a more flexible scheme
- to build up the uri's, and add in the ssl parameter.
- (load_source_data): fill in source->ssl, and remove source->type
- assignment.
- (addressbook_source_copy): copy source->ssl, and remove
- source->type copy.
- (create_ldap_folder): addressbook_create_new_source =>
- ldap_config_create_new_source.
-
- * gui/component/addressbook-storage.h: remove
- AddressbookSourceType (it was always LDAP), and add
- AddressbookLDAPSSLType.
-
-2002-04-18 Dan Winship <danw@ximian.com>
-
- * backend/ebook/e-book-util.c (e_book_load_default_book): Append
- /addressbook.db to the end of the default URI if it starts with
- file:
-
- * backend/ebook/e-book.c (e_book_load_uri_step): Fix this to not
- loop forever if you have more than one backend.
-
-2002-04-17 Christopher James Lahey <clahey@ximian.com>
-
- * gui/component/select-names/e-select-names.c
- (e_select_names_create_categories): Changed this to use
- ECategoriesMasterListOptionMenu.
-
- * gui/component/select-names/e-select-names.c
- (section_right_click_cb),
- gui/widgets/e-addressbook-reflow-adapter.c,
- gui/widgets/e-addressbook-view.c: Updated these to match the new
- EPopupMenu.
-
-2002-04-11 Christopher James Lahey <clahey@ximian.com>
-
- * gui/component/addressbook-component.c: Include
- addressbook-config.h here as this file uses it.
-
- * gui/component/select-names/e-select-names.c (SPEC, SPEC2): Made
- this dialog searchable by typing in the ETable.
-
- * gui/widgets/e-addressbook-model.c: Include e-addressbook-util.h
- here.
-
- * gui/widgets/e-addressbook-reflow-adapter.c
- (e_addressbook_reflow_adapter_right_click),
- gui/widgets/e-addressbook-view.c (table_right_click): Fixed a
- memory leak here by using "selection-done" signal.
-
- * gui/widgets/e-addressbook-reflow-adapter.c,
- gui/widgets/e-addressbook-reflow-adapter.h,
- gui/widgets/e-addressbook-view.c, gui/widgets/e-minicard-view.c:
- Added a right click menu for areas that aren't cards.
-
-2002-04-09 Dan Winship <danw@ximian.com>
-
- * backend/ebook/e-book-util.c (e_book_load_default_book): Update
- for new-and-improved consistent default folder uri.
-
- * gui/component/addressbook.c (addressbook_load_default_book): Use
- e_book_load_default_book rather than duplicating most of its logic
- here.
- (load_uri_cb): Modify to work as a callback for
- addressbook_load_default_book as well as addressbook_load_uri.
-
-2002-04-08 Dan Winship <danw@ximian.com>
-
- * gui/component/addressbook-component.c (create_view): Add
- view_info arg, but don't do anything with it.
-
-2002-04-06 JP Rosevear <jpr@ximian.com>
-
- * gui/component/GNOME_Evolution_Addressbook.oaf.in: add
- config_item:type
-
-2002-04-04 JP Rosevear <jpr@ximian.com>
-
- * conduit/Makefile.am: link to the static libversit
-
-2002-04-04 Dan Winship <danw@ximian.com>
-
- * gui/widgets/e-addressbook-util.c (e_addressbook_transfer_cards):
- Update for evolution_shell_client_user_select_folder API change.
-
-2002-04-04 Ettore Perazzoli <ettore@ximian.com>
-
- * gui/component/addressbook.c: Remove AddressbookConfig,
- ContactNew, ContactNewList EPixmap entries.
-
- * gui/component/addressbook-factory.c (main): Print out a
- debugging message just before the main loop starts, for debugging
- purposes.
-
-2002-04-02 Dan Winship <danw@ximian.com>
-
- * backend/ebook/e-card-simple.h: Fix spelling of
- E_CARD_SIMPLE_PHONE_ID_TTYTDD and E_CARD_SIMPLE_FIELD_PHONE_TTYTDD
- (they previously ended with "TTD" instead of "TDD")
-
- * backend/ebook/e-card-simple.c: Update for spelling fix.
-
- * backend/pas/pas-backend-ldap.c: Likewise
-
-2002-04-01 Dan Winship <danw@ximian.com>
-
- * gui/component/select-names/e-select-names-text-model.c:
- parent_class should be static. (From Max Horn <max@quendi.de>)
-
-2002-03-29 Ettore Perazzoli <ettore@ximian.com>
-
- * gui/component/GNOME_Evolution_Addressbook.oaf.in: Add priority
- for the config page. Renamed to "Directory Servers".
-
-2002-03-27 Chris Toshok <toshok@ximian.com>
-
- * backend/pas/pas-backend-file.c
- (pas_backend_file_process_create_card): don't free req->vcard.
- it's freed in pas_book_free_request.
- (pas_backend_file_process_remove_card): don't free req->id for the
- same reason.
- (pas_backend_file_process_modify_card): don't free req->vcard for
- the same reason.
- (pas_backend_file_process_get_changes): don't free req->change_id
- or release_unref the listener for the same reason.
-
-2002-03-27 Chris Toshok <toshok@ximian.com>
-
- * backend/pas/pas-backend-ldap.c (check_schema_support): make sure
- to call ldap_value_free (values);, and ldap_msgfree (resp).
- (get_ldap_library_info): don't ask me why, but it appears we have
- to free each extension char*.
- (query_ldap_root_dse): make sure to free values in the
- subschemaSubentry code before overwriting it, and call
- ldap_msgfree(resp) when we're all done.
- (build_card_from_entry): don't leak the DN, ldap attributes, or
- the berval the ldap_*_attribute calls use to step through the
- attributes. the docs say this berval is freed when
- ldap_next_attribute returns NULL, but if we don't free it it leaks
- a substantial amount of memory.
- (pas_backend_ldap_search): make sure to only allocate *op once,
- and fix the g_warning since op isn't valid in its scope anymore.
-
-2002-03-19 Dan Winship <danw@ximian.com>
-
- * backend/ebook/Makefile.am: Update for libversit change: Use .a
- rather than .la now.
-
- * printing/Makefile.am: Likewise
-
- * gui/component/Makefile.am: Likewise
-
-2002-03-18 Ettore Perazzoli <ettore@ximian.com>
-
- * gui/component/addressbook.c (addressbook_menu_activated):
- Removed.
- (addressbook_factory_new_control): Don't connect anymore, as this
- signal has been removed from the ESearchBar.
- (addressbook_factory_new_control): No more custom menu items here.
-
-2002-03-15 Jeffrey Stedfast <fejj@ximian.com>
-
- * gui/widgets/e-addressbook-view.c (table_right_click): Update to
- use new EPopupMenu API.
-
- * gui/widgets/e-addressbook-reflow-adapter.c
- (e_addressbook_reflow_adapter_right_click): Update to use new
- EPopupMenu API.
-
- * gui/component/select-names/e-select-names.c
- (section_right_click_cb): Update to match new EPopupMenu api.
-
-2002-03-15 Ettore Perazzoli <ettore@ximian.com>
-
- * gui/component/addressbook.c: Remove the
- `addressbook_search_menu_items'.
- (addressbook_menu_activated): Removed.
- (addressbook_factory_new_control): Don't connect. No menu items.
-
-2002-03-15 Ettore Perazzoli <ettore@ximian.com>
-
- * gui/component/addressbook.c (control_activate): Call
- `e_search_bar_set_ui_component()' to set the BonoboUIComponent for
- the search bar.
-
- * gui/component/GNOME_Evolution_Addressbook.oaf.in: Add an icon
- for the LDAP sources configuration control.
-
-2002-03-12 Ettore Perazzoli <ettore@ximian.com>
-
- * gui/component/addressbook.c: Remove verb "AddressbookConfig".
- (config_cb): Removed.
-
- * gui/component/addressbook-config.c: Remove `dialog' member from
- `AddresbookDialog'. Instead, add a `config_control' member.
- (config_control_new): New.
- (addressbook_config): Removed.
- (addressbook_config_register_factory): New.
- (config_control_factory_fn): New, factory function for the
- ConfigControl page.
- (addressbook_source_edit_changed): Don't change the sensitivity of
- the dialog. Rather, invoke ::changed on the ConfigPage.
- (auth_checkbutton_changed): No need to manually change the
- sensitiviness of the buttons here either.
- (add_source_clicked): Likewise, just invoke
- evolution_config_control_changed().
- (edit_source_clicked): Likewise.
- (addressbook_dialog_close): Removed.
- (config_control_destroy_callback): New, callback for when the
- config control gets destroyed.
- (addressbook_dialog_apply): Removed.
- (config_control_apply_callback): New callback for
- EvolutionConfigControl::apply.
- (addressbook_dialog_ok): Removed.
- (addressbook_config_control_new): Set up ->config_control and
- connect the signals.
-
- * gui/component/addressbook-config.glade: Call the main hbox in
- the addressbook_sources dialog `addressbook_sources_main_hbox'.
-
- * gui/component/addressbook-component.c (owner_set_cb): Call
- `addresbook_config_register_factory'.
-
- * gui/component/GNOME_Evolution_Addressbook.oaf.in: Add items for
- OAFIID:GNOME_Evolution_Addresbook_ConfigControl and
- OAFIID:GNOME_Evolution_Addressbook_ConfigControlFactory.
+ * backend/pas/pas-backend-ldap.c: (ugh) change the CALURI and
+ FBURL ecard attributes to map to the RFC 2739 specified
+ attributes.
+ (check_schema_support): check to see if calEntry is supported.
+ (add_objectclass_mod): insert calEntry if it's supported.
2002-03-11 Chris Toshok <toshok@ximian.com>
@@ -258,29 +18,6 @@
2002-03-09 Chris Toshok <toshok@ximian.com>
- * backend/idl/addressbook.idl: add TLSNotAvailable to
- BookLister_CallStatus.
-
- * backend/ebook/e-book-types.h: add TLS_NOT_AVAILABLE to the EBookStatus enum.
-
- * backend/ebook/e-book-listener.c
- (e_book_listener_convert_status): add TLS_NOT_AVAILABLE to the
- switch.
-
- * backend/pas/pas-backend-ldap.c
- (pas_backend_ldap_get_static_capabilities): fix name.
- (pas_backend_ldap_class_init): fix name.
- (pas_backend_ldap_connect): change return type to CallStatus so we
- can return different errors from here. Also, do STARTTLS if the
- user has asked for it and the connection supports it, returning
- TLSNotAvailable (and close the connection) if they chose to
- require it.
- (pas_backend_ldap_load_uri): return pas_backend_ldap_connect.
- (func_beginswith): pull in change from evolution-1-0-branch to
- make full_name beginswith search both cn and sn.
-
-2002-03-09 Chris Toshok <toshok@ximian.com>
-
* gui/widgets/e-addressbook-view.c (jump_to_letter): since I've
gone ahead and made the file backend (by way of
pas-backend-card-sexp.c) use case insensitive searches for
@@ -294,6 +31,9 @@
(addressbook_search_activated): change FULL_NAME to beginswith,
and change EMAIL to is to match the labels.
+ * backend/pas/pas-backend-ldap.c (func_beginswith): search both cn
+ and sn for beginswith.
+
* backend/pas/pas-backend-card-sexp.c (compare_name): new
function, so we can compare both full and family names (so
beginswith can operate on them both.)
@@ -303,55 +43,11 @@
2002-03-06 Chris Toshok <toshok@ximian.com>
- * backend/pas/pas-book.c (pas_book_queue_create_card): track
- union/struct change.
- (pas_book_queue_remove_card): same.
- (pas_book_queue_modify_card): same.
- (pas_book_queue_get_cursor): same.
- (pas_book_queue_get_vcard): same.
- (pas_book_queue_authenticate_user): same.
- (pas_book_queue_get_book_view): same.
- (pas_book_queue_get_changes): same.
- (pas_book_free_request): new function - free everything we need to
- for each type of request.
- (pas_book_destroy): call pas_book_free_request here instead of
- just freeing 3 elements of the old struct. yay plugging memleaks.
-
- * backend/pas/pas-book.h: make PASRequest a union and split out
- members into structs, so it's a little clearer which fields are
- used by which requests. Also, add prototype for
- pas_book_free_request so backends can just free everything at once
- (usually in their requests_queued signal func.)
-
- * backend/pas/pas-backend-file.c
- (pas_backend_file_process_create_card): track struct/union change.
- (pas_backend_file_process_remove_card): same.
- (pas_backend_file_process_modify_card): same.
- (pas_backend_file_build_cards_list): same.
- (pas_backend_file_process_get_vcard): same.
- (pas_backend_file_process_get_cursor): same.
- (pas_backend_file_process_get_book_view): same.
- (pas_backend_file_process_get_changes): same.
- (pas_backend_file_process_check_connection): same.
- (pas_backend_file_process_authenticate_user): same.
- (pas_backend_file_process_get_supported_fields): same.
- (pas_backend_file_process_client_requests): case the union to the
- specific struct and pass it to the process_* functions. also,
- call pas_book_free_request here, instead of relying on each of the
- functions to free their stuff.
-
-2002-03-07 Dan Winship <danw@ximian.com>
-
- * gui/component/addressbook-storage.c
- (addressbook_get_other_contact_storage): Update for
- evolution_storage_new() change.
-
-2002-03-05 Chris Toshok <toshok@ximian.com>
-
- * gui/widgets/e-minicard-view-widget.c
- (e_minicard_view_widget_realize): don't set "editable" here, as
- the way things work the backend isn't able to override a setting
- from the UI, so writable books never show up as writable.
+ * backend/pas/pas-backend-ldap.c (ldap_search_handler): only ask
+ for the attributes we can handle.
+ (pas_backend_ldap_destroy): free our list of search attributes.
+ (pas_backend_ldap_init): fill in the search_attr array from
+ prop_info (use the ldap_attrs.)
2002-03-04 Chris Toshok <toshok@ximian.com>
@@ -417,15 +113,63 @@
(addressbook_factory_new_control): hook up "search_activated" to
addressbook_search_activated.
-2002-02-24 Chris Toshok <toshok@ximian.com>
+2002-02-23 Chris Toshok <toshok@ximian.com>
- * gui/component/addressbook-config.c
- (addressbook_source_dialog_set_source): make the right auth page
- start up open.
+ [ backport fix for bug 16097 from HEAD ]
+ * gui/component/addressbook-config.glade: gui love for the new
+ auth stuff.
- * gui/component/addressbook-storage.c (addressbook_source_free):
- free the binddn.
- (addressbook_source_copy): copy the binddn;
+ * gui/component/addressbook.c (load_uri_cb): track change to auth,
+ and offer up different prompt strings depending on which method
+ (binddn or email) we're using.
+
+ * gui/component/addressbook-storage.c (ldap_unparse_auth): use the
+ new auth types for ldap.
+ (ldap_parse_auth): same.
+ (addressbook_storage_auth_type_to_string): new function.
+ (load_source_data): get the binddn too.
+ (ldap_source_foreach): store out binddn or emailaddr, depending on
+ the auth type chosen.
+
+ * gui/component/addressbook-storage.h: add the more detailed auth
+ types, add "binddn" to the source structure, and add a prototype
+ for addressbook_storage_auth_type_to_string.
+
+ * gui/component/addressbook-config.c (auth_checkbutton_changed):
+ set the auth stuff (in)sensitive.
+ (auth_optionmenu_activated): new function.
+ (addressbook_source_dialog_set_source): track UI change.
+ (addressbook_source_dialog_get_source): same.
+ (add_scope_activate_cb): rename add_activate_cb to this to
+ distinguish it from the auth stuff.
+ (add_auth_activate_cb): new function.
+ (addressbook_source_dialog): track change to auth UI stuff.
+ (addressbook_storage_auth_type_to_string): new function.
+
+ * backend/ebook/e-book.h: add auth_method arg to
+ e_book_authenticate_user.
+
+ * backend/ebook/e-book.c (e_book_authenticate_user): track change
+ to prototype - add auth_method arg, and pass it along to the CORBA
+ call.
+
+ * backend/ebook/test-client.c (book_open_cb): track api change -
+ keep this building.
+
+ * backend/pas/pas-book.h: add auth_method slot in PASRequest.
+
+ * backend/pas/pas-book.c (pas_book_queue_authenticate_user): add
+ auth_method arg and add it to the PASRequest.
+ (impl_GNOME_Evolution_Addressbook_Book_authenticateUser): track
+ idl change, add auth_method and pass it along to
+ pas_book_queue_authenticate_user.
+
+ * backend/pas/pas-backend-ldap.c
+ (pas_backend_ldap_process_authenticate_user): support both
+ "ldap/simple-email" and "ldap/simple-binddn" auth methods.
+
+ * backend/idl/addressbook.idl: add "in string authMethod" to
+ authenticateUser.
2002-02-22 Chris Toshok <toshok@ximian.com>
@@ -469,15 +213,6 @@
further behind the ldap backend, which is merrily spewing updates
at the gui.
-2002-02-21 Ettore Perazzoli <ettore@ximian.com>
-
- * gui/component/Makefile.am: Define $(iconsdir).
-
- * gui/component/addressbook-component.c (add_creatable_item): New
- helper function.
- (create_component): Add the icons for the user creatable items as
- well.
-
2002-02-20 Chris Toshok <toshok@ximian.com>
* backend/pas/pas-backend-file.c (pas_backend_file_load_uri):
@@ -524,12 +259,7 @@
(rfc2254_escape): just use sprintf and %02X instead.
2002-02-13 Christopher James Lahey <clahey@ximian.com>
-
- * gui/component/select-names/e-select-names.c (set_book): Keep a
- ref of the model in this case as well.
-
-2002-02-13 Christopher James Lahey <clahey@ximian.com>
-
+
* gui/component/select-names/e-select-names.c (set_book): Make
sure to only set the query once when creating a new book and not
at all on addressbook model creation. This prevents an accidental
@@ -544,280 +274,6 @@
(e_addressbook_model_set_arg): When setting the book, set
first_get_view to TRUE.
-2002-02-13 Christopher James Lahey <clahey@ximian.com>
-
- * gui/widgets/e-addressbook-view.c (display_view): Attach to the
- emvw instead of the emv here.
-
- * gui/widgets/e-minicard-view-widget.c, e-minicard-view-widget.h:
- Made this object have a "column_width" argument and a
- "column_width_changed" signal which are a simple layer down to the
- EMinicardView contained within.
-
- * gui/widgets/gal-view-minicard.c, gui/widgets/gal-view-minicard.h
- (gal_view_minicard_attach): Made this attach to an
- EMinicardViewWidget instead of a EMinicardView.
-
-2002-02-13 Christopher James Lahey <clahey@ximian.com>
-
- * backend/ebook/e-book-util.c, backend/ebook/e-book-util.h
- (e_book_expand_uri, e_book_load_address_book_by_uri,
- e_book_use_address_book_by_uri): New functions that take a file://
- url ending in the directory name and automatically append the
- addressbook.db and do the appropriate thing.
-
- * backend/pas/pas-backend-card-sexp.c,
- backend/pas/pas-backend-card-sexp.h: Added copyright notice here.
-
- * gui/component/addressbook-component.c
- (destination_folder_handle_drop), gui/component/addressbook.c
- (set_prop): Use e_book_expand_uri instead of
- addressbook_expand_uri.
-
- * gui/component/addressbook-storage.c: Fixed the fcntl include
- here.
-
- * gui/component/addressbook.c (ContactsCopyToFolder,
- ContactsMoveToFolder): Added handlers for these two verbs.
-
- * gui/component/addressbook.h: Removed addressbook_expand_uri in
- favor of e_book_expand_uri.
-
- * gui/widgets/e-addressbook-reflow-adapter.c (transfer_cards):
- Added code to handle Move to and Copy to right click menu items.
-
- * gui/widgets/e-addressbook-util.c,
- gui/widgets/e-addressbook-util.h (e_addressbook_transfer_cards):
- New function to pop up a dialog and transfer a set of cards to the
- given folder.
-
- * gui/widgets/e-addressbook-view.c,
- gui/widgets/e-addressbook-view.h (display_view): Don't attach to
- the view if it doesn't exist yet. We have to make this then
- attach later.
- (e_addressbook_view_copy_to_folder,
- e_addressbook_view_move_to_folder): New functions utilizing
- e_addressbook_transfer_cards.
- (table_right_click): Add copy_to_folder and move_to_folder to the
- right click menu for tables here.
- (e_addressbook_view_discard_menus): Handle menu unmerging here.
-
- * gui/widgets/e-minicard-view-widget.h (struct
- _EMinicardViewWidget): Removed unused field.
-
-2002-02-13 Christopher James Lahey <clahey@ximian.com>
-
- * gui/widgets/e-addressbook-view.c (display_view): Attach the
- GalViewMinicard to the EMinicardView here.
-
- * gui/widgets/gal-view-minicard.c, gui/widgets/gal-view-minicard.h
- (gal_view_minicard_load, gal_view_minicard_save): Made these save
- the column width of the view.
- (gal_view_minicard_attach, gal_view_minicard_detach): Added these
- functions to allow the GalViewMinicard to set the column width of
- a EMinicardView and to monitor its changes.
-
-2002-02-12 Christopher James Lahey <clahey@ximian.com>
-
- * gui/widgets/e-addressbook-reflow-adapter.c
- (addressbook_get_arg): Added an argument to get the model.
-
- * gui/widgets/e-addressbook-view.c (writable_status): Don't bother
- connecting to the writable_status callback on the book, simply
- rely on the writable_status callback on the addressbook model.
-
- * gui/widgets/e-minicard-view.c, gui/widgets/e-minicard-view.h
- (set_empty_message): Handle the case of a read only view here.
-
-2002-02-07 JP Rosevear <jpr@ximian.com>
-
- * gui/component/addressbook-component.c (create_component): remove
- "New" from user creatable menu items
-
-2002-02-07 Christopher James Lahey <clahey@ximian.com>
-
- * gui/widgets/e-addressbook-view.c,
- gui/widgets/e-addressbook-view.h
- (e_addressbook_view_setup_menus): Changed this function to use the
- new GalViewMenus which takes a GalViewInstance, instead of a
- GalViewCollection.
-
-2002-02-04 JP Rosevear <jpr@ximian.com>
-
- * gui/contact-editor/e-contact-editor.c (find_address_mailing): tidy
-
- * conduit/address-conduit.c (addrconduit_load_configuration): load
- default address setting
- (addrconduit_save_configuration): save default address setting
- (e_addr_gui_new): new gui routine for conduit settings
- (e_addr_gui_fill_widgets): ditto
- (e_addr_gui_fill_config): ditto
- (e_addr_gui_destroy): ditto
- (e_addr_context_destroy): destroy the gui and new_cfg
- (local_record_from_ecard): reinstate commented out bits, determine
- which address to sync to pilot
- (ecard_from_remote_record): determine which address to sync from
- pilot
- (fill_widgets): put the gui widgets in
- (create_settings_window): create gui
- (save_settings): fill gui
-
-2002-02-04 JP Rosevear <jpr@ximian.com>
-
- * gui/contact-editor/e-contact-editor.c (address_text_changed): if
- the shown address in the mailing address or there is no mailing
- address, set the default flag and make sure the button is checked
- (address_mailing_changed): set the flags properly when the mailing
- address changes
- (e_contact_editor_init): listen for the check button being toggled
- (find_address_mailing): find the address (if any) with the default
- flag
- (set_address_field): set the mailing address button appropriately
- (fill_in_info): find the mailing address
-
- * gui/contact-editor/e-contact-editor.h: add new class data member
-
- * gui/contact-editor/contact-editor.glade: show mailing address
- check button
-
-2002-02-01 Jeffrey Stedfast <fejj@ximian.com>
-
- * backend/ebook/e-destination.c (e_destination_is_auto_recipient):
- New function to find out if a destination was one which was
- auto-matically set by Evolution.
- (e_destination_set_auto_recipient): Set whether or not the dest is
- an auto-recipient.
- (e_destination_touch): Don't touch the address if it is an
- auto_recipient.
- (e_destination_list_to_vector_sized): New function to avoid having
- to calculate the length of the list ourselves. Allows for a bit of
- optimization if our caller knows the length of the list.
- (e_destination_xml_encode): Encode the auto_recipient bit.
- (e_destination_xml_decode): Decode the auto_recipient bit.
-
-2002-02-01 Christopher James Lahey <clahey@ximian.com>
-
- * backend/ebook/e-card-simple.c (e_card_simple_sync_card): Made
- this preserve addressbook flags other than the first three.
-
- * backend/ebook/e-card-types.h: Added E_CARD_ADDR_MASK and
- E_CARD_ADDR_DEFAULT.
-
- * backend/ebook/e-card.c (get_address_flags): Added "PREF" to
- E_CARD_ADDR_DEFAULT mapping.
-
- * backend/ebook/test-client.c: Added #include "e-book-util.h".
-
-2002-01-30 Chris Toshok <toshok@ximian.com>
-
- * backend/pas/pas-backend-file.c (pas_backend_file_changes):
- compute the change db filename based on our contact db filename.
- (pas_backend_file_load_uri): store the filename in
- bf->priv->filename.
- (pas_backend_file_destroy): free the filename, and (!) free
- bf->priv too.
-
-2002-01-28 Jeffrey Stedfast <fejj@ximian.com>
-
- * backend/ebook/e-destination.c (e_destination_is_valid): Revert
- my previous change as trow says this will break auto-completion
- stuff.
-
-2002-01-27 Ettore Perazzoli <ettore@ximian.com>
-
- * gui/contact-editor/Makefile.am: Use EVOLUTION_ADDRESSBOOK_CFLAGS.
- * gui/contact-list-editor/Makefile.am: Likewise.
- * gui/merging/Makefile.am: Likewise.
- * gui/search/Makefile.am: Likewise.
- * gui/component/select-names/Makefile.am: Likewise.
-
-2002-01-25 Jeffrey Stedfast <fejj@ximian.com>
-
- * backend/ebook/e-destination.c (e_destination_is_valid): Don't
- check for an @ in the email address. This is to fix bug #10960.
-
-2002-01-24 Chris Toshok <toshok@ximian.com>
-
- [ fixes bug 16097 ]
- * gui/component/addressbook-config.glade: gui love for the new
- auth stuff.
-
- * gui/component/addressbook.c (load_uri_cb): track change to auth,
- and offer up different prompt strings depending on which method
- (binddn or email) we're using.
-
- * gui/component/addressbook-storage.c (ldap_unparse_auth): use the
- new auth types for ldap.
- (ldap_parse_auth): same.
- (addressbook_storage_auth_type_to_string): new function.
- (load_source_data): get the binddn too.
- (ldap_source_foreach): store out binddn or emailaddr, depending on
- the auth type chosen.
-
- * gui/component/addressbook-storage.h: add the more detailed auth
- types, add "binddn" to the source structure, and add a prototype
- for addressbook_storage_auth_type_to_string.
-
- * gui/component/addressbook-config.c (auth_checkbutton_changed):
- set the auth stuff (in)sensitive.
- (auth_optionmenu_activated): new function.
- (addressbook_source_dialog_set_source): track UI change.
- (addressbook_source_dialog_get_source): same.
- (add_scope_activate_cb): rename add_activate_cb to this to
- distinguish it from the auth stuff.
- (add_auth_activate_cb): new function.
- (addressbook_source_dialog): track change to auth UI stuff.
- (addressbook_storage_auth_type_to_string): new function.
-
- * backend/ebook/e-book.h: add auth_method arg to
- e_book_authenticate_user.
-
- * backend/ebook/e-book.c (e_book_authenticate_user): track change
- to prototype - add auth_method arg, and pass it along to the CORBA
- call.
-
- * backend/ebook/test-client.c (book_open_cb): track api change -
- keep this building.
-
- * backend/pas/pas-book.h: add auth_method slot in PASRequest.
-
- * backend/pas/pas-book.c (pas_book_queue_authenticate_user): add
- auth_method arg and add it to the PASRequest.
- (impl_GNOME_Evolution_Addressbook_Book_authenticateUser): track
- idl change, add auth_method and pass it along to
- pas_book_queue_authenticate_user.
-
- * backend/pas/pas-backend-ldap.c
- (pas_backend_ldap_process_authenticate_user): support both
- "ldap/simple-email" and "ldap/simple-binddn" auth methods.
-
- * backend/idl/addressbook.idl: add "in string authMethod" to
- authenticateUser.
-
-2002-01-24 Ettore Perazzoli <ettore@ximian.com>
-
- * conduit/Makefile.am: Use EVOLUTION_ADDRESSBOOK_CONDUIT_CFLAGS
- and EVOLUTION_ADDRESSBOOK_CONDUIT_LIBS and remove unused flags
-
- * gui/component/Makefile.am: Use EVOLUTION_ADDRESSBOOK_CFLAGS and
- EVOLUTION_ADDRESSBOOK_LIBS and remove unused flags.
- * backend/pas/Makefile.am: Likewise.
- * backend/ebook/Makefile.am: Likewise.
- * printing/Makefile.am: Likewise.
- * backend/ebook/Makefile.am: Likewise.
- * gui/widgets/Makefile.am (INCLUDES): Likewise.
-
-2002-01-23 Ettore Perazzoli <ettore@ximian.com>
-
- * gui/component/addressbook-component.c (create_component): Pass a
- NULL @icon to
- `evolution_shell_component_add_user_creatable_item()'.
-
-2002-01-23 Ettore Perazzoli <ettore@ximian.com>
-
- * gui/contact-editor/e-contact-editor-address.c: #include
- <locale.h>.
-
2002-01-22 Chris Toshok <toshok@ximian.com>
[ fixes bug # 16864 ]
@@ -825,225 +281,12 @@
return a GString here, instead of writing to a fixed size buffer.
(parseLine): use a GString here instead of a fixed size buffer.
-2002-01-21 Christopher James Lahey <clahey@ximian.com>
-
- * backend/pas/pas-backend-ldap.c (ldap_search_handler): Set the
- number of cards to return to the value specified in the ldap uri,
- leaving the default at 100. Fixes Ximian bug #13953.
-
- * gui/component/addressbook-config.c (addressbook_source_dialog),
- gui/component/addressbook-config.glade: Added a limit entry here
- to edit the limit field of the source.
-
- * gui/component/addressbook-storage.c,
- gui/component/addressbook-storage.h
- (addressbook_storage_init_source_uri): Added a limit field to this
- class and pass that value through in the uri that's generated.
-
-2002-01-18 Christopher James Lahey <clahey@ximian.com>
-
- * backend/ebook/e-card-compare.c: Made username match with no
- domain match be vague instead of partial. Fixes Ximian bug
- #13612.
-
-2002-01-18 Christopher James Lahey <clahey@ximian.com>
-
- * gui/component/addressbook.c (view_contact_cb): New verb to open
- a bunch of cards.
-
- * gui/widgets/e-addressbook-reflow-adapter.c (open_card): Call
- e_addressbook_show_multiple_cards instead of doing this ourselves.
-
- * gui/widgets/e-addressbook-util.c,
- gui/widgets/e-addressbook-util.h
- (e_addressbook_show_multiple_cards): Added this function to show a
- bunch of cards, including a dialog if lots of windows are going to
- appear.
-
- * gui/widgets/e-addressbook-view.c (e_addressbook_view_view,
- e_addressbook_view_can_view): e_addressbook_view_view calls
- e_addressbook_show_multiple_cards on the appropriate list of
- cards.
-
-2002-01-18 Christopher James Lahey <clahey@ximian.com>
-
- * gui/contact-editor/e-contact-editor-address.c
- (fill_in_countries), gui/contact-editor/fulladdr.glade: Sort
- country list. Country list moves from fulladdr.glade to
- e-contact-editor-address.c, but only a few country names have
- actually changed. Fixes Ximian bug #16545.
-
2001-12-20 Zbigniew Chyla <cyba@gnome.pl>
- Fixes #17725
-
* evolution/addressbook/printing/e-contact-print.c (complete_sequence):
Do not assume that the first byte of file_as is the first letter, use
utf8 functions instead.
-2002-01-16 JP Rosevear <jpr@ximian.com>
-
- * conduit/address-conduit.c: move all functions here, get rid of
- header files, use e-pilot-settings to display gui
-
-2002-01-15 JP Rosevear <jpr@ximian.com>
-
- * gui/component/select-names/select-names.glade: remove misleading
- title and fix spacing
-
-2002-01-11 Christopher James Lahey <clahey@ximian.com>
-
- * gui/component/addressbook.c (alphabet_state_changed): Handle
- setting the search bar to "Advanced..." when the alphabet buttons
- are pushed and back when they're cleared. Fixes Ximian bug
- #12904.
- (addressbook_menu_activated): When the user calls Search->clear,
- set the search to ESB_ANY and "", don't just set the text. This
- is especially useful when it's set to ESB_ADVANCED.
-
- * gui/widgets/e-addressbook-view.c,
- gui/widgets/e-addressbook-view.h (alphabet_state_change): Added
- this signal which gets emitted when the alphabet buttons are
- pushed.
- (command_state_change): Removed the ref pair here. It's not
- necessary. gtk_signal_emit refs the object itself.
-
-2002-01-11 Christopher James Lahey <clahey@ximian.com>
-
- * backend/ebook/e-card-compare.c (name_synonyms): Added a couple
- of names here.
-
- * gui/component/select-names/e-select-names-text-model.c
- (e_select_names_text_model_get_nth_obj): Removed an unused
- variable.
-
-2002-01-11 Christopher James Lahey <clahey@ximian.com>
-
- * gui/widgets/e-addressbook-view.c,
- gui/widgets/e-addressbook-view.h (create_alphabet): Use toggle
- buttons here. Fixes Ximian bug #10734.
-
-2002-01-09 Christopher James Lahey <clahey@ximian.com>
-
- * gui/contact-editor/e-contact-editor.c (set_fields): Choose the
- first filled in address field here. Fixes Ximian bug #2222.
-
-2002-01-03 Joe Shaw <joe@ximian.com>
-
- * backend/ebook/test-card.c: Add a test for getting arbitrary
- fields.
-
- * backend/pas/pas-backend-card-sexp.c (compare_arbitrary): Added.
- (prop_info_table): Add a LIST_PROP for arbitrary fields.
-
-2002-01-03 Nat Friedman <nat@ximian.com>
-
- * backend/ebook/e-book.c (activate_factories_for_uri): Free the
- query if the oaf response is of zero length.
-
-2001-12-27 Jon Trowbridge <trow@ximian.com>
-
- * gui/component/select-names/e-select-names.c
- (real_add_address_cb): When we clean, don't clean the model's last
- element. This helps keep things working properly when we have
- signal-character separators.
- (section_right_click_cb): Changed to work properly with our
- EText-emitted popup signal.
- (e_select_names_add_section): Use ETexts for the recipient
- sections, rather than tables. This lets us make them directly
- editable. (Bug #1721)
-
- * gui/component/select-names/e-select-names-popup.c
- (popup_info_new): Pass in a ESelectNamesTextModel, not a
- ESelectNamesModel.
- (e_select_names_popup): Adjust for the new signature for
- e_select_names_model_text_pos.
-
- * gui/component/select-names/e-select-names-manager.c
- (focus_out_cb): Schedule a cleaning when we focus out.
- (focus_in_cb): Cancel pending cleaning when we get focus. This
- helps us avoid bad things happening during the fast focus out/ins
- that happen when the completion dropdown appears.
- (completion_handler): Adjust for new signatures of
- e_select_names_model_text_pos and e_select_names_model_name_pos.
- (e_select_names_manager_entry_new): Pass in our
- ESelectNamesTextModel when constructing the
- ESelectNamesCompletion.
- (e_select_names_manager_entry_free): Cancel any pending clean-ups.
-
- * gui/component/select-names/e-select-names-bonobo.c
- (entry_get_property_fn): Get the text off of the text model.
- Which is the only way that really makes sense when you think about
- it.
-
- * gui/component/select-names/e-select-names-completion.c: Added a
- copy of the associated ESelectNamesTextModel to
- ESelectNamesCompletionPrivate. This replaces the
- ESelectNamesModel.
- (e_select_names_completion_destroy): Unref ->text_model.
- (e_select_names_completion_handle_request): Pass in our text
- model's separator info when calling e_select_names_model_text_pos.
- (e_select_names_completion_new): Pass in the text model as an arg
- instead of the model, and ref it as needed.
-
- * gui/component/select-names/e-select-names-text-model.c
- (e_select_names_text_model_init): Set separator as either ", " or
- ",", depending on the value of the EVOLUTION_DISABLE_MAGIC_COMMA
- environment variable.
- (e_select_names_text_model_destroy): Free the separator.
- (changed_cb): Flush our cached text on changed.
- (e_select_names_text_model_set_source): Use our own changed_cb
- callback on changed, rather than just connecting up
- e_text_model_changed.
- (e_select_names_text_model_set_separator): Added. Lets the
- separator between recipients be specified.
- (e_select_names_text_model_get_text): Cache the text we get from
- calling e_select_names_model_get_textification.
- (e_select_names_text_model_insert_length): A bunch of small
- changes to properly support generic separators, rather than
- (implicit and explicitly) assuming ", ".
- (e_select_names_text_model_delete): More small tweaks to handle
- generic separators.
- (e_select_names_text_model_get_nth_obj): Use new signature when
- calling e_select_names_model_name_pos, and use our cached text.
-
- * gui/component/select-names/e-select-names-model.c
- (e_select_names_model_destroy): We don't cache the text or
- addr_text anymore, so no need to free them here.
- (e_select_names_model_changed): ...and no need to reset our text
- and addr_text caches here.
- (e_select_names_model_get_textification): Take a separator as an
- arg, rather than just using ", ". Also, no caching.
- (e_select_names_model_get_address_text): Take a separator as an
- arg, rather than just using ", ". And no caching here either.
- (e_select_names_model_clean): Add arg that give us control over
- whether or not the last entry should get cleaned. We need this
- when using a one-character separator, so that new destinations
- that get tacked onto the end don't get immediately cleaned away
- for being empty.
- (e_select_names_model_name_pos): Take the separator length as an
- argument, remove implicit assumption of length 2.
- (e_select_names_model_text_pos): Take the separator length as an
- argument, remove implicit assumption of length 2.
-
-2001-12-20 Ettore Perazzoli <ettore@ximian.com>
-
- [Fix #17377, Evolution doesn't work on multi-depth displays.]
-
- * gui/component/addressbook-factory.c (main): Push GdkRGB visual
- and colormap.
-
-2001-12-19 Jon Trowbridge <trow@ximian.com>
-
- * gui/widgets/e-addressbook-reflow-adapter.c
- (e_addressbook_reflow_adapter_right_click): Add cut/copy/paste to
- right-click menu.
-
- * gui/widgets/e-addressbook-view.c (table_right_click): Add
- cut/copy/paste to right-click menu. (Fixes bug #14528.) Also,
- disable some right-click options if our addressbook isn't
- editable.
-
2001-12-18 JP Rosevear <jpr@ximian.com>
* conduit/address-conduit.c (check_for_slow_setting): go slow and
@@ -1074,7 +317,7 @@
* conduit/address-conduit.c (start_addressbook_server): use
e_book_load_default_book here.
-
+
2001-12-17 Chris Toshok <toshok@ximian.com>
[ fixes bug 17355 ]
@@ -1094,6 +337,13 @@
(e_minicard_view_widget_realize): Use an #ECanvasBackground here
instead of a #GnomeCanvasRect.
+2001-12-17 Ettore Perazzoli <ettore@ximian.com>
+
+ [Fixes #17377, Evolution doesn't work on multi-depth displays.]
+
+ * gui/component/addressbook-factory.c (main): Push GdkRGB visual
+ and colormap.
+
2001-12-16 Jon Trowbridge <trow@ximian.com>
* gui/component/select-names/e-select-names-completion.c: Added
@@ -1105,6 +355,12 @@
(e_select_names_completion_do_query): Only reuse cached cards
if cache_complete is TRUE. (Fixes bug #10241)
+ * gui/component/select-names/e-select-names-bonobo.c
+ (impl_destroy): Disconnect from manager's 'changed' and 'ok'
+ signals.
+ (init): Store the handles when we connect to the 'changed' and
+ 'ok' signals. (Fixed bug #16852)
+
2001-12-15 JP Rosevear <jpr@ximian.com>
* conduit/address-conduit.c (e_addr_context_destroy): don't free
@@ -1125,21 +381,6 @@
g_strdup_printf to dup a string. Doh! Changed to g_strdup.
(Bug #17126)
-2001-12-07 Jon Trowbridge <trow@ximian.com>
-
- * gui/component/select-names/e-select-names-manager.c
- (e_select_names_manager_entry_new): Remove a reference to code
- I don't want to commit yet. :-)
-
- * gui/component/select-names/e-select-names-manager.c: Extensively
- refactored -- this code had gotten _really_ ugly. Untangle things
- to the point where our reference counting problems are fixable.
-
- * gui/component/select-names/e-select-names-bonobo.c
- (impl_destroy): Remove all of the ugly hacks to work around our
- memory management problems, and just unref the manager.
- (Fixes #14412)
-
2001-12-05 Chris Toshok <toshok@ximian.com>
* backend/pas/pas-backend-ldap.c
diff --git a/addressbook/backend/ebook/e-book-listener.c b/addressbook/backend/ebook/e-book-listener.c
index ce85ed75ba..139eb849fa 100644
--- a/addressbook/backend/ebook/e-book-listener.c
+++ b/addressbook/backend/ebook/e-book-listener.c
@@ -630,8 +630,6 @@ e_book_listener_convert_status (const GNOME_Evolution_Addressbook_BookListener_C
return E_BOOK_STATUS_CARD_ID_ALREADY_EXISTS;
case GNOME_Evolution_Addressbook_BookListener_ProtocolNotSupported:
return E_BOOK_STATUS_PROTOCOL_NOT_SUPPORTED;
- case GNOME_Evolution_Addressbook_BookListener_TLSNotAvailable:
- return E_BOOK_STATUS_TLS_NOT_AVAILABLE;
case GNOME_Evolution_Addressbook_BookListener_OtherError:
return E_BOOK_STATUS_OTHER_ERROR;
default:
diff --git a/addressbook/backend/ebook/e-book-types.h b/addressbook/backend/ebook/e-book-types.h
index 398e46d74c..9ce3323bdf 100644
--- a/addressbook/backend/ebook/e-book-types.h
+++ b/addressbook/backend/ebook/e-book-types.h
@@ -26,7 +26,6 @@ typedef enum {
E_BOOK_STATUS_PROTOCOL_NOT_SUPPORTED,
E_BOOK_STATUS_CANCELLED,
E_BOOK_STATUS_AUTHENTICATION_FAILED,
- E_BOOK_STATUS_TLS_NOT_AVAILABLE,
E_BOOK_STATUS_OTHER_ERROR
} EBookStatus;
diff --git a/addressbook/backend/ebook/e-book-util.c b/addressbook/backend/ebook/e-book-util.c
index d3de9840f8..04f8a88131 100644
--- a/addressbook/backend/ebook/e-book-util.c
+++ b/addressbook/backend/ebook/e-book-util.c
@@ -33,93 +33,6 @@
#include <libgnome/gnome-util.h>
#include "e-card-compare.h"
-typedef struct _CommonBookInfo CommonBookInfo;
-struct _CommonBookInfo {
- EBookCommonCallback cb;
- gpointer closure;
-};
-
-char *
-e_book_expand_uri (const char *uri)
-{
- char *new_uri;
-
- if (!strncmp (uri, "file:", 5)) {
- if (strlen (uri + 7) > 3
- && !strcmp (uri + strlen(uri) - 3, ".db")) {
- /* it's a .db file */
- new_uri = g_strdup (uri);
- }
- else {
- char *file_name;
- /* we assume it's a dir and glom addressbook.db onto the end. */
- file_name = g_concat_dir_and_file(uri + 7, "addressbook.db");
- new_uri = g_strdup_printf("file://%s", file_name);
- g_free(file_name);
- }
- }
- else {
- new_uri = g_strdup (uri);
- }
-
- return new_uri;
-}
-
-static void
-got_uri_book_cb (EBook *book, EBookStatus status, gpointer closure)
-{
- CommonBookInfo *info = (CommonBookInfo *) closure;
-
- if (status == E_BOOK_STATUS_SUCCESS) {
- info->cb (book, info->closure);
- } else {
- info->cb (NULL, info->closure);
- }
- g_free (info);
-}
-
-gboolean
-e_book_load_address_book_by_uri (EBook *book, const char *uri, EBookCallback open_response, gpointer closure)
-{
- gboolean rv;
- char *real_uri;
-
- g_return_val_if_fail (book != NULL, FALSE);
- g_return_val_if_fail (E_IS_BOOK (book), FALSE);
- g_return_val_if_fail (open_response != NULL, FALSE);
-
- real_uri = e_book_expand_uri (uri);
-
- rv = e_book_load_uri (book, real_uri, open_response, closure);
-
- if (!rv) {
- g_warning ("Couldn't load addressbook %s", real_uri);
- }
-
- g_free (real_uri);
-
- return rv;
-}
-
-void
-e_book_use_address_book_by_uri (const char *uri, EBookCommonCallback cb, gpointer closure)
-{
- EBook *book;
- CommonBookInfo *info;
-
- g_return_if_fail (cb != NULL);
-
- info = g_new0 (CommonBookInfo, 1);
- info->cb = cb;
- info->closure = closure;
-
- book = e_book_new ();
- if (! e_book_load_address_book_by_uri (book, uri, got_uri_book_cb, info)) {
- gtk_object_unref (GTK_OBJECT (book));
- g_free (info);
- }
-}
-
Bonobo_ConfigDatabase
e_book_get_config_database (CORBA_Environment *ev)
{
@@ -130,7 +43,7 @@ e_book_get_config_database (CORBA_Environment *ev)
return config_db;
}
-
+
gboolean
e_book_load_local_address_book (EBook *book, EBookCallback open_response, gpointer closure)
{
@@ -159,6 +72,12 @@ e_book_load_local_address_book (EBook *book, EBookCallback open_response, gpoint
static EBook *common_local_book = NULL;
+typedef struct _CommonBookInfo CommonBookInfo;
+struct _CommonBookInfo {
+ EBookCommonCallback cb;
+ gpointer closure;
+};
+
static void
got_local_book_cb (EBook *book, EBookStatus status, gpointer closure)
{
@@ -242,7 +161,7 @@ e_book_default_book_open (EBook *book, EBookStatus status, gpointer closure)
gboolean
e_book_load_default_book (EBook *book, EBookCallback open_response, gpointer closure)
{
- char *val, *uri;
+ char *val;
gboolean rv;
CORBA_Environment ev;
Bonobo_ConfigDatabase config_db;
@@ -253,22 +172,15 @@ e_book_load_default_book (EBook *book, EBookCallback open_response, gpointer clo
CORBA_exception_init (&ev);
config_db = e_book_get_config_database (&ev);
- val = bonobo_config_get_string (config_db, "/DefaultFolders/contacts_uri", &ev);
+ val = bonobo_config_get_string (config_db, "/Addressbook/default_book_uri", &ev);
CORBA_exception_free (&ev);
if (val) {
DefaultBookClosure *default_book_closure = g_new (DefaultBookClosure, 1);
default_book_closure->closure = closure;
default_book_closure->open_response = open_response;
-
- /* Sigh. FIXME. */
- if (!strncmp (val, "file:", 5))
- uri = g_strconcat (val, "/addressbook.db", NULL);
- else
- uri = g_strdup (val);
- rv = e_book_load_uri (book, uri,
+ rv = e_book_load_uri (book, val,
e_book_default_book_open, default_book_closure);
- g_free (uri);
g_free (val);
}
else {
diff --git a/addressbook/backend/ebook/e-book-util.h b/addressbook/backend/ebook/e-book-util.h
index 33f90c399f..39e32e633d 100644
--- a/addressbook/backend/ebook/e-book-util.h
+++ b/addressbook/backend/ebook/e-book-util.h
@@ -40,52 +40,46 @@ typedef void (*EBookCommonCallback) (EBook *book, gpointer closure);
typedef void (*EBookSimpleQueryCallback) (EBook *book, EBookSimpleQueryStatus status, const GList *cards, gpointer closure);
typedef void (*EBookHaveAddressCallback) (EBook *book, const gchar *addr, ECard *card, gpointer closure);
-/* expand file:///foo/foo/ to file:///foo/foo/addressbook.db */
-char *e_book_expand_uri (const char *uri);
-gboolean e_book_load_address_book_by_uri (EBook *book,
- const char *uri,
- EBookCallback open_response,
- gpointer closure);
-void e_book_use_address_book_by_uri (const char *uri,
- EBookCommonCallback cb,
- gpointer closure);
-
-gboolean e_book_load_local_address_book (EBook *book,
- EBookCallback open_response,
- gpointer closure);
-void e_book_use_local_address_book (EBookCommonCallback cb,
- gpointer closure);
-gboolean e_book_load_default_book (EBook *book,
- EBookCallback open_response,
- gpointer closure);
+gboolean e_book_load_local_address_book (EBook *book,
+ EBookCallback open_response,
+ gpointer closure);
+
+void e_book_use_local_address_book (EBookCommonCallback cb, gpointer closure);
+
+gboolean e_book_load_default_book (EBook *book,
+ EBookCallback open_response,
+ gpointer closure);
/* Bonoboconf database interface. */
-Bonobo_ConfigDatabase e_book_get_config_database (CORBA_Environment *ev);
+Bonobo_ConfigDatabase e_book_get_config_database (CORBA_Environment *ev);
/* Simple Query Interface. */
-guint e_book_simple_query (EBook *book,
- const char *query,
- EBookSimpleQueryCallback cb,
- gpointer closure);
-void e_book_simple_query_cancel (EBook *book,
- guint tag);
+
+guint e_book_simple_query (EBook *book,
+ const char *query,
+ EBookSimpleQueryCallback cb,
+ gpointer closure);
+void e_book_simple_query_cancel (EBook *book,
+ guint tag);
/* Specialized Name/Email Queries */
-guint e_book_name_and_email_query (EBook *book,
- const char *name,
- const char *email,
- EBookSimpleQueryCallback cb,
- gpointer closure);
-guint e_book_nickname_query (EBook *book,
- const char *nickname,
- EBookSimpleQueryCallback cb,
- gpointer closure);
+
+guint e_book_name_and_email_query (EBook *book,
+ const char *name,
+ const char *email,
+ EBookSimpleQueryCallback cb,
+ gpointer closure);
+
+guint e_book_nickname_query (EBook *book,
+ const char *nickname,
+ EBookSimpleQueryCallback cb,
+ gpointer closure);
/* Returns the ECard associated to email in the callback,
or NULL if no match is found in the local address book. */
-void e_book_query_address_locally (const gchar *email,
- EBookHaveAddressCallback cb,
- gpointer closure);
+void e_book_query_address_locally (const gchar *email,
+ EBookHaveAddressCallback cb,
+ gpointer closure);
END_GNOME_DECLS
diff --git a/addressbook/backend/ebook/e-book.c b/addressbook/backend/ebook/e-book.c
index 61930fc4d6..2fb8a6b2d1 100644
--- a/addressbook/backend/ebook/e-book.c
+++ b/addressbook/backend/ebook/e-book.c
@@ -547,7 +547,7 @@ e_book_load_uri_step (EBook *book, EBookStatus status, EBookLoadURIData *data)
{
/* iterate to the next possible CardFactory, or fail
if it's the last one */
- book->priv->iter = book->priv->iter->next;
+ book->priv->iter = book->priv->book_factories->next;
if (book->priv->iter) {
GNOME_Evolution_Addressbook_BookFactory factory = book->priv->iter->data;
e_book_load_uri_from_factory (book, factory, data);
@@ -643,8 +643,6 @@ activate_factories_for_uri (EBook *book, const char *uri)
if (info_list->_length == 0) {
g_warning ("Can't find installed BookFactory that handles protocol '%s'.", protocol);
- g_free (protocol);
- g_free (query);
CORBA_exception_free (&ev);
goto shutdown;
}
@@ -768,6 +766,7 @@ e_book_unload_uri (EBook *book)
CORBA_exception_init (&ev);
bonobo_object_release_unref (book->priv->corba_book, &ev);
+
if (ev._major != CORBA_NO_EXCEPTION) {
g_warning ("e_book_unload_uri: Exception releasing "
"remote book interface!\n");
diff --git a/addressbook/backend/ebook/e-card.c b/addressbook/backend/ebook/e-card.c
index b3beecbc7e..d7f5457326 100644
--- a/addressbook/backend/ebook/e-card.c
+++ b/addressbook/backend/ebook/e-card.c
@@ -81,6 +81,9 @@ enum {
ARG_USE_SCORE,
};
+#if 0
+static VObject *card_convert_to_vobject (ECard *crd);
+#endif
static void parse(ECard *card, VObject *vobj, char *default_charset);
static void e_card_init (ECard *card);
static void e_card_class_init (ECardClass *klass);
@@ -727,6 +730,70 @@ e_card_get_vobject (const ECard *card, gboolean assumeUTF8)
addPropValueQP (vobj, VCUniqueStringProp, (card->id ? card->id : ""));
+#if 0
+ 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->xtension.l) {
+ GList *node;
+
+ for (node = crd->xtension.l; node; node = node->next) {
+ CardXProperty *xp = (CardXProperty *) node->data;
+ ADD_PROP_VALUE (vobj, xp->name, xp->data);
+ add_CardProperty (vobj, &xp->prop);
+ }
+ }
+
+ if (crd->timezn.prop.used) {
+ char *str;
+
+ str = card_timezn_str (crd->timezn);
+ vprop = ADD_PROP_VALUE (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 = ADD_PROP_VALUE (vobj, VCGeoLocationProp, str);
+ free (str);
+ add_CardProperty (vprop, &crd->geopos.prop);
+ }
+
+ 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->sound.prop.used) {
+ if (crd->sound.type != SOUND_PHONETIC)
+ vprop = addPropSizedValue (vobj, VCPronunciationProp,
+ crd->sound.data, crd->sound.size);
+ else
+ vprop = ADD_PROP_VALUE (vobj, VCPronunciationProp,
+ crd->sound.data);
+
+ add_SoundType (vprop, crd->sound.type);
+ add_CardProperty (vprop, &crd->sound.prop);
+ }
+
+ if (crd->key.prop.used) {
+ vprop = ADD_PROP_VALUE (vobj, VCPublicKeyProp, crd->key.data);
+ add_KeyType (vprop, crd->key.type);
+ add_CardProperty (vprop, &crd->key.prop);
+ }
+#endif
return vobj;
}
@@ -2202,40 +2269,91 @@ e_card_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
static void
e_card_init (ECard *card)
{
- card->id = g_strdup("");
-
- card->file_as = NULL;
- card->fname = NULL;
- card->name = NULL;
- card->bday = NULL;
- card->email = NULL;
- card->phone = NULL;
- card->address = NULL;
- card->address_label = NULL;
- card->url = NULL;
- card->org = NULL;
- card->org_unit = NULL;
- card->office = NULL;
- card->title = NULL;
- card->role = NULL;
- card->manager = NULL;
- card->assistant = NULL;
- card->nickname = NULL;
- card->spouse = NULL;
- card->anniversary = NULL;
- card->mailer = NULL;
- card->caluri = NULL;
- card->fburl = NULL;
- card->note = NULL;
- card->related_contacts = NULL;
- card->categories = NULL;
- card->wants_html = FALSE;
- card->wants_html_set = FALSE;
- card->list = FALSE;
+ card->id = g_strdup("");
+
+ card->file_as = NULL;
+ card->fname = NULL;
+ card->name = NULL;
+ card->bday = NULL;
+ card->email = NULL;
+ card->phone = NULL;
+ card->address = NULL;
+ card->address_label = NULL;
+ card->url = NULL;
+ card->org = NULL;
+ card->org_unit = NULL;
+ card->office = NULL;
+ card->title = NULL;
+ card->role = NULL;
+ card->manager = NULL;
+ card->assistant = NULL;
+ card->nickname = NULL;
+ card->spouse = NULL;
+ card->anniversary = NULL;
+ card->mailer = NULL;
+ card->caluri = NULL;
+ card->fburl = NULL;
+ card->note = NULL;
+ card->related_contacts = NULL;
+ card->categories = NULL;
+ card->wants_html = FALSE;
+ card->wants_html_set = FALSE;
+ card->list = FALSE;
card->list_show_addresses = FALSE;
- card->arbitrary = NULL;
- card->last_use = NULL;
- card->raw_use_score = 0;
+ card->arbitrary = NULL;
+ card->last_use = NULL;
+ card->raw_use_score = 0;
+#if 0
+
+ c = g_new0 (ECard, 1);
+
+ c->fname =
+ c->mailer =
+ c->role =
+ c->comment =
+ c->categories =
+ 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->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->uid.prop.type = PROP_UID;
+ c->key.prop.type = PROP_KEY;
+
+ return c;
+#endif
}
GList *
@@ -2366,6 +2484,1411 @@ assign_string(VObject *vobj, char *default_charset, char **string)
}
}
+#if 0
+static void
+e_card_str_free (CardStrProperty *sp)
+{
+ g_free (sp->str);
+
+ e_card_prop_free (sp->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->role);
+ e_card_prop_str_free (& card->categories);
+ e_card_prop_str_free (& card->comment);
+ 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 (ECardProperty 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 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;
+ 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 = e_card_name_new ();
+
+ 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 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_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_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_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_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 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, N_("\nName: "));
+ add_strProp_to_string (string, N_("\n Prefix: "), crd->name.prefix);
+ add_strProp_to_string (string, N_("\n Given: "), crd->name.given);
+ add_strProp_to_string (string, N_("\n Additional: "), crd->name.additional);
+ add_strProp_to_string (string, N_("\n Family: "), crd->name.family);
+ add_strProp_to_string (string, N_("\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, N_("\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, N_("\nAddress:"));
+ add_strAddrType (string, deladdr->type);
+ add_strProp_to_string (string, N_("\n Postal Box: "), deladdr->po);
+ add_strProp_to_string (string, N_("\n Ext: "), deladdr->ext);
+ add_strProp_to_string (string, N_("\n Street: "), deladdr->street);
+ add_strProp_to_string (string, N_("\n City: "), deladdr->city);
+ add_strProp_to_string (string, N_("\n Region: "), deladdr->region);
+ add_strProp_to_string (string, N_("\n Postal Code: "), deladdr->code);
+ add_strProp_to_string (string, N_("\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, N_("\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, N_("\nTelephones:\n"));
+ } else {
+ sep = " ";
+ g_string_append (string, N_("\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, N_("\nE-mail:\n"));
+ } else {
+ sep = " ";
+ g_string_append (string, N_("\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, N_("\nMailer: "), &crd->mailer);
+
+ if (crd->timezn.prop.used) {
+ char *str;
+
+ str = card_timezn_str (crd->timezn);
+ add_strProp_to_string (string, N_("\nTime Zone: "), str);
+ free (str);
+ }
+
+ if (crd->geopos.prop.used) {
+ char *str;
+
+ str = card_geopos_str (crd->geopos);
+ add_strProp_to_string (string, N_("\nGeo Location: "), str);
+ free (str);
+ }
+
+ add_CardStrProperty_to_string (string, N_("\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, N_("\nOrg: "));
+ add_strProp_to_string (string, N_("\n Name: "), crd->org.name);
+ add_strProp_to_string (string, N_("\n Unit: "), crd->org.unit1);
+ add_strProp_to_string (string, N_("\n Unit2: "), crd->org.unit2);
+ add_strProp_to_string (string, N_("\n Unit3: "), crd->org.unit3);
+ add_strProp_to_string (string, N_("\n Unit4: "), crd->org.unit4);
+ g_string_append_c (string, '\n');
+ }
+
+ add_CardStrProperty_to_string (string, N_("\nCategories: "), &crd->categories);
+ add_CardStrProperty_to_string (string, N_("\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, N_("\nUnique String: "), &crd->uid);
+
+ if (crd->key.prop.used) {
+ add_strProp_to_string (string, N_("\nPublic Key: "), crd->key.data);
+ add_strKeyType (string, crd->key.type);
+ }
+
+ ret = g_strdup (string->str);
+ g_string_free (string, TRUE);
+
+ return ret;
+}
+#endif
ECardDate
e_card_date_from_string (const char *str)
@@ -2427,36 +3950,36 @@ e_v_object_get_child_value(VObject *vobj, char *name, char *default_charset)
return NULL;
}
-static struct {
- char *id;
- ECardPhoneFlags flag;
-} phone_pairs[] = {
- { VCPreferredProp, E_CARD_PHONE_PREF },
- { VCWorkProp, E_CARD_PHONE_WORK },
- { VCHomeProp, E_CARD_PHONE_HOME },
- { VCVoiceProp, E_CARD_PHONE_VOICE },
- { VCFaxProp, E_CARD_PHONE_FAX },
- { VCMessageProp, E_CARD_PHONE_MSG },
- { VCCellularProp, E_CARD_PHONE_CELL },
- { VCPagerProp, E_CARD_PHONE_PAGER },
- { VCBBSProp, E_CARD_PHONE_BBS },
- { VCModemProp, E_CARD_PHONE_MODEM },
- { VCCarProp, E_CARD_PHONE_CAR },
- { VCISDNProp, E_CARD_PHONE_ISDN },
- { VCVideoProp, E_CARD_PHONE_VIDEO },
- { "X-EVOLUTION-ASSISTANT", E_CARD_PHONE_ASSISTANT },
- { "X-EVOLUTION-CALLBACK", E_CARD_PHONE_CALLBACK },
- { "X-EVOLUTION-RADIO", E_CARD_PHONE_RADIO },
- { "X-EVOLUTION-TELEX", E_CARD_PHONE_TELEX },
- { "X-EVOLUTION-TTYTDD", E_CARD_PHONE_TTYTDD },
-};
-
static ECardPhoneFlags
get_phone_flags (VObject *vobj)
{
ECardPhoneFlags ret = 0;
int i;
+ struct {
+ char *id;
+ ECardPhoneFlags flag;
+ } phone_pairs[] = {
+ { VCPreferredProp, E_CARD_PHONE_PREF },
+ { VCWorkProp, E_CARD_PHONE_WORK },
+ { VCHomeProp, E_CARD_PHONE_HOME },
+ { VCVoiceProp, E_CARD_PHONE_VOICE },
+ { VCFaxProp, E_CARD_PHONE_FAX },
+ { VCMessageProp, E_CARD_PHONE_MSG },
+ { VCCellularProp, E_CARD_PHONE_CELL },
+ { VCPagerProp, E_CARD_PHONE_PAGER },
+ { VCBBSProp, E_CARD_PHONE_BBS },
+ { VCModemProp, E_CARD_PHONE_MODEM },
+ { VCCarProp, E_CARD_PHONE_CAR },
+ { VCISDNProp, E_CARD_PHONE_ISDN },
+ { VCVideoProp, E_CARD_PHONE_VIDEO },
+ { "X-EVOLUTION-ASSISTANT", E_CARD_PHONE_ASSISTANT },
+ { "X-EVOLUTION-CALLBACK", E_CARD_PHONE_CALLBACK },
+ { "X-EVOLUTION-RADIO", E_CARD_PHONE_RADIO },
+ { "X-EVOLUTION-TELEX", E_CARD_PHONE_TELEX },
+ { "X-EVOLUTION-TTYTDD", E_CARD_PHONE_TTYTDD },
+ };
+
for (i = 0; i < sizeof(phone_pairs) / sizeof(phone_pairs[0]); i++) {
if (isAPropertyOf (vobj, phone_pairs[i].id)) {
ret |= phone_pairs[i].flag;
@@ -2471,6 +3994,30 @@ set_phone_flags (VObject *vobj, ECardPhoneFlags flags)
{
int i;
+ struct {
+ char *id;
+ ECardPhoneFlags flag;
+ } phone_pairs[] = {
+ { VCPreferredProp, E_CARD_PHONE_PREF },
+ { VCWorkProp, E_CARD_PHONE_WORK },
+ { VCHomeProp, E_CARD_PHONE_HOME },
+ { VCVoiceProp, E_CARD_PHONE_VOICE },
+ { VCFaxProp, E_CARD_PHONE_FAX },
+ { VCMessageProp, E_CARD_PHONE_MSG },
+ { VCCellularProp, E_CARD_PHONE_CELL },
+ { VCPagerProp, E_CARD_PHONE_PAGER },
+ { VCBBSProp, E_CARD_PHONE_BBS },
+ { VCModemProp, E_CARD_PHONE_MODEM },
+ { VCCarProp, E_CARD_PHONE_CAR },
+ { VCISDNProp, E_CARD_PHONE_ISDN },
+ { VCVideoProp, E_CARD_PHONE_VIDEO },
+ { "X-EVOLUTION-ASSISTANT", E_CARD_PHONE_ASSISTANT },
+ { "X-EVOLUTION-CALLBACK", E_CARD_PHONE_CALLBACK },
+ { "X-EVOLUTION-RADIO", E_CARD_PHONE_RADIO },
+ { "X-EVOLUTION-TELEX", E_CARD_PHONE_TELEX },
+ { "X-EVOLUTION-TTYTDD", E_CARD_PHONE_TTYTDD },
+ };
+
for (i = 0; i < sizeof(phone_pairs) / sizeof(phone_pairs[0]); i++) {
if (flags & phone_pairs[i].flag) {
addProp (vobj, phone_pairs[i].id);
@@ -2478,24 +4025,23 @@ set_phone_flags (VObject *vobj, ECardPhoneFlags flags)
}
}
-static struct {
- char *id;
- ECardAddressFlags flag;
-} addr_pairs[] = {
- { VCDomesticProp, E_CARD_ADDR_DOM },
- { VCInternationalProp, E_CARD_ADDR_INTL },
- { VCPostalProp, E_CARD_ADDR_POSTAL },
- { VCParcelProp, E_CARD_ADDR_PARCEL },
- { VCHomeProp, E_CARD_ADDR_HOME },
- { VCWorkProp, E_CARD_ADDR_WORK },
- { "PREF", E_CARD_ADDR_DEFAULT },
-};
-
static ECardAddressFlags
get_address_flags (VObject *vobj)
{
ECardAddressFlags ret = 0;
int i;
+
+ struct {
+ char *id;
+ ECardAddressFlags flag;
+ } addr_pairs[] = {
+ { VCDomesticProp, E_CARD_ADDR_DOM },
+ { VCInternationalProp, E_CARD_ADDR_INTL },
+ { VCPostalProp, E_CARD_ADDR_POSTAL },
+ { VCParcelProp, E_CARD_ADDR_PARCEL },
+ { VCHomeProp, E_CARD_ADDR_HOME },
+ { VCWorkProp, E_CARD_ADDR_WORK },
+ };
for (i = 0; i < sizeof(addr_pairs) / sizeof(addr_pairs[0]); i++) {
if (isAPropertyOf (vobj, addr_pairs[i].id)) {
@@ -2510,6 +4056,18 @@ static void
set_address_flags (VObject *vobj, ECardAddressFlags flags)
{
int i;
+
+ struct {
+ char *id;
+ ECardAddressFlags flag;
+ } addr_pairs[] = {
+ { VCDomesticProp, E_CARD_ADDR_DOM },
+ { VCInternationalProp, E_CARD_ADDR_INTL },
+ { VCPostalProp, E_CARD_ADDR_POSTAL },
+ { VCParcelProp, E_CARD_ADDR_PARCEL },
+ { VCHomeProp, E_CARD_ADDR_HOME },
+ { VCWorkProp, E_CARD_ADDR_WORK },
+ };
for (i = 0; i < sizeof(addr_pairs) / sizeof(addr_pairs[0]); i++) {
if (flags & addr_pairs[i].flag) {
diff --git a/addressbook/backend/ebook/e-destination.c b/addressbook/backend/ebook/e-destination.c
index 5cb5fa859f..b82e616601 100644
--- a/addressbook/backend/ebook/e-destination.c
+++ b/addressbook/backend/ebook/e-destination.c
@@ -41,8 +41,6 @@
#include <gnome-xml/xmlmemory.h>
#include <camel/camel-internet-address.h>
-#define d(x) x
-
enum {
CHANGED,
CARDIFIED,
@@ -52,6 +50,7 @@ enum {
guint e_destination_signals[LAST_SIGNAL] = { 0 };
struct _EDestinationPrivate {
+
gchar *raw;
gchar *book_uri;
@@ -78,7 +77,6 @@ struct _EDestinationPrivate {
guint has_been_cardified : 1;
guint allow_cardify : 1;
guint cannot_cardify : 1;
- guint auto_recipient : 1;
guint pending_cardification;
guint pending_change : 1;
@@ -149,7 +147,6 @@ e_destination_init (EDestination *dest)
dest->priv->allow_cardify = TRUE;
dest->priv->cannot_cardify = FALSE;
- dest->priv->auto_recipient = FALSE;
dest->priv->pending_cardification = 0;
}
@@ -186,8 +183,7 @@ e_destination_freeze (EDestination *dest)
{
g_return_if_fail (E_IS_DESTINATION (dest));
g_return_if_fail (dest->priv->freeze_count >= 0);
-
- dest->priv->freeze_count++;
+ ++dest->priv->freeze_count;
}
static void
@@ -195,8 +191,7 @@ e_destination_thaw (EDestination *dest)
{
g_return_if_fail (E_IS_DESTINATION (dest));
g_return_if_fail (dest->priv->freeze_count > 0);
-
- dest->priv->freeze_count--;
+ --dest->priv->freeze_count;
if (dest->priv->freeze_count == 0 && dest->priv->pending_change)
e_destination_changed (dest);
}
@@ -256,33 +251,34 @@ static void
e_destination_clear_card (EDestination *dest)
{
if (dest->priv->card) {
+
if (dest->priv->old_card)
gtk_object_unref (GTK_OBJECT (dest->priv->old_card));
-
+
dest->priv->old_card = dest->priv->card;
dest->priv->old_card_email_num = dest->priv->card_email_num;
-
+
g_free (dest->priv->old_textrep);
dest->priv->old_textrep = g_strdup (e_destination_get_textrep (dest));
}
-
+
g_free (dest->priv->book_uri);
dest->priv->book_uri = NULL;
g_free (dest->priv->card_uid);
dest->priv->card_uid = NULL;
-
+
dest->priv->card = NULL;
dest->priv->card_email_num = -1;
-
+
g_list_foreach (dest->priv->list_dests, (GFunc) gtk_object_unref, NULL);
g_list_free (dest->priv->list_dests);
dest->priv->list_dests = NULL;
-
+
dest->priv->allow_cardify = TRUE;
dest->priv->cannot_cardify = FALSE;
-
+
e_destination_cancel_cardify (dest);
-
+
e_destination_changed (dest);
}
@@ -291,19 +287,19 @@ e_destination_clear_strings (EDestination *dest)
{
g_free (dest->priv->raw);
dest->priv->raw = NULL;
-
+
g_free (dest->priv->name);
dest->priv->name = NULL;
-
+
g_free (dest->priv->email);
dest->priv->email = NULL;
-
+
g_free (dest->priv->addr);
dest->priv->addr = NULL;
-
+
g_free (dest->priv->textrep);
dest->priv->textrep = NULL;
-
+
e_destination_changed (dest);
}
@@ -311,12 +307,12 @@ void
e_destination_clear (EDestination *dest)
{
g_return_if_fail (dest && E_IS_DESTINATION (dest));
-
+
e_destination_freeze (dest);
-
+
e_destination_clear_card (dest);
e_destination_clear_strings (dest);
-
+
e_destination_thaw (dest);
}
@@ -326,7 +322,7 @@ nonempty (const gchar *s)
gunichar c;
while (*s) {
c = g_utf8_get_char (s);
- if (!g_unichar_isspace (c))
+ if (! g_unichar_isspace (c))
return TRUE;
s = g_utf8_next_char (s);
}
@@ -338,9 +334,7 @@ e_destination_is_empty (const EDestination *dest)
{
struct _EDestinationPrivate *p;
-
g_return_val_if_fail (E_IS_DESTINATION (dest), TRUE);
-
p = dest->priv;
return !(p->card != NULL
@@ -356,19 +350,14 @@ e_destination_is_empty (const EDestination *dest)
gboolean
e_destination_is_valid (const EDestination *dest)
{
- const char *email;
-
+ const gchar *email;
+
g_return_val_if_fail (E_IS_DESTINATION (dest), FALSE);
-
+
if (e_destination_from_card (dest))
return TRUE;
-
+
email = e_destination_get_email (dest);
-
- /* FIXME: if we really wanted to get fancy here, we could
- check to make sure that the address was valid according to
- rfc822's addr-spec grammar. */
-
return email && *email && strchr (email, '@');
}
@@ -376,25 +365,25 @@ gboolean
e_destination_equal (const EDestination *a, const EDestination *b)
{
const struct _EDestinationPrivate *pa, *pb;
- const char *na, *nb;
-
+ const gchar *na, *nb;
+
g_return_val_if_fail (E_IS_DESTINATION (a), FALSE);
g_return_val_if_fail (E_IS_DESTINATION (b), FALSE);
-
+
if (a == b)
return TRUE;
-
+
pa = a->priv;
pb = b->priv;
-
+
/* Check equality of cards. */
if (pa->card || pb->card) {
if (! (pa->card && pb->card))
return FALSE;
-
+
if (pa->card == pb->card || !strcmp (e_card_get_id (pa->card), e_card_get_id (pb->card)))
return TRUE;
-
+
return FALSE;
}
@@ -415,19 +404,20 @@ e_destination_set_card (EDestination *dest, ECard *card, gint email_num)
{
g_return_if_fail (dest && E_IS_DESTINATION (dest));
g_return_if_fail (card && E_IS_CARD (card));
-
+
if (dest->priv->card != card || dest->priv->card_email_num != email_num) {
+
/* We have to freeze/thaw around these operations so that the 'changed'
signals don't cause the EDestination's internal state to be altered
before we can finish setting ->card && ->card_email_num. */
e_destination_freeze (dest);
e_destination_clear (dest);
-
+
dest->priv->card = card;
gtk_object_ref (GTK_OBJECT (dest->priv->card));
-
+
dest->priv->card_email_num = email_num;
-
+
e_destination_changed (dest);
e_destination_thaw (dest);
}
@@ -438,11 +428,13 @@ e_destination_set_book_uri (EDestination *dest, const gchar *uri)
{
g_return_if_fail (dest && E_IS_DESTINATION (dest));
g_return_if_fail (uri != NULL);
+
+ if (dest->priv->book_uri == NULL
+ || strcmp (dest->priv->book_uri, uri)) {
- if (dest->priv->book_uri == NULL || strcmp (dest->priv->book_uri, uri)) {
g_free (dest->priv->book_uri);
dest->priv->book_uri = g_strdup (uri);
-
+
/* If we already have a card, remove it unless it's uri matches the one
we just set. */
if (dest->priv->card) {
@@ -452,7 +444,7 @@ e_destination_set_book_uri (EDestination *dest, const gchar *uri)
dest->priv->card = NULL;
}
}
-
+
e_destination_changed (dest);
}
}
@@ -462,22 +454,22 @@ e_destination_set_card_uid (EDestination *dest, const gchar *uid, gint email_num
{
g_return_if_fail (dest && E_IS_DESTINATION (dest));
g_return_if_fail (uid != NULL);
-
+
if (dest->priv->card_uid == NULL
|| strcmp (dest->priv->card_uid, uid)
|| dest->priv->card_email_num != email_num) {
-
+
g_free (dest->priv->card_uid);
dest->priv->card_uid = g_strdup (uid);
dest->priv->card_email_num = email_num;
-
+
/* If we already have a card, remove it unless it's uri matches the one
we just set. */
if (dest->priv->card && strcmp (uid, e_card_get_id (dest->priv->card))) {
gtk_object_unref (GTK_OBJECT (dest->priv->card));
dest->priv->card = NULL;
}
-
+
e_destination_changed (dest);
}
}
@@ -486,9 +478,9 @@ void
e_destination_set_name (EDestination *dest, const gchar *name)
{
gboolean changed = FALSE;
-
+
g_return_if_fail (E_IS_DESTINATION (dest));
-
+
if (name == NULL) {
if (dest->priv->name != NULL) {
g_free (dest->priv->name);
@@ -500,7 +492,7 @@ e_destination_set_name (EDestination *dest, const gchar *name)
dest->priv->name = g_strdup (name);
changed = TRUE;
}
-
+
if (changed) {
g_free (dest->priv->addr);
dest->priv->addr = NULL;
@@ -514,20 +506,22 @@ void
e_destination_set_email (EDestination *dest, const gchar *email)
{
gboolean changed = FALSE;
-
+
g_return_if_fail (E_IS_DESTINATION (dest));
-
+
if (email == NULL) {
if (dest->priv->email != NULL) {
g_free (dest->priv->addr);
dest->priv->addr = NULL;
changed = TRUE;
}
- } else if (dest->priv->email == NULL || strcmp (dest->priv->email, email)) {
+ } else if (dest->priv->email == NULL || strcmp (dest->priv->email, email)) {
+
g_free (dest->priv->email);
dest->priv->email = g_strdup (email);
changed = TRUE;
}
+
if (changed) {
g_free (dest->priv->addr);
@@ -564,21 +558,6 @@ e_destination_from_card (const EDestination *dest)
return dest->priv->card != NULL || dest->priv->book_uri != NULL || dest->priv->card_uid != NULL;
}
-gboolean
-e_destination_is_auto_recipient (const EDestination *dest)
-{
- g_return_val_if_fail (dest && E_IS_DESTINATION (dest), FALSE);
-
- return dest->priv->auto_recipient;
-}
-
-void
-e_destination_set_auto_recipient (EDestination *dest, gboolean value)
-{
- g_return_if_fail (dest && E_IS_DESTINATION (dest));
-
- dest->priv->auto_recipient = value;
-}
typedef struct _UseCard UseCard;
struct _UseCard {
@@ -591,17 +570,19 @@ static void
use_card_cb (ECard *card, gpointer closure)
{
UseCard *uc = (UseCard *) closure;
-
+
if (card != NULL && uc->dest->priv->card == NULL) {
+
uc->dest->priv->card = card;
gtk_object_ref (GTK_OBJECT (uc->dest->priv->card));
e_destination_changed (uc->dest);
+
}
-
+
if (uc->cb) {
uc->cb (uc->dest, uc->dest->priv->card, uc->closure);
}
-
+
/* We held a copy of the destination during the callback. */
gtk_object_unref (GTK_OBJECT (uc->dest));
g_free (uc);
@@ -611,13 +592,13 @@ void
e_destination_use_card (EDestination *dest, EDestinationCardCallback cb, gpointer closure)
{
g_return_if_fail (dest && E_IS_DESTINATION (dest));
-
+
if (dest->priv->card != NULL) {
if (cb)
cb (dest, dest->priv->card, closure);
} else if (dest->priv->book_uri != NULL && dest->priv->card_uid != NULL) {
+
UseCard *uc = g_new (UseCard, 1);
-
uc->dest = dest;
/* Hold a reference to the destination during the callback. */
gtk_object_ref (GTK_OBJECT (uc->dest));
@@ -634,7 +615,7 @@ ECard *
e_destination_get_card (const EDestination *dest)
{
g_return_val_if_fail (dest && E_IS_DESTINATION (dest), NULL);
-
+
return dest->priv->card;
}
@@ -648,7 +629,7 @@ e_destination_get_card_uid (const EDestination *dest)
if (dest->priv->card)
return e_card_get_id (dest->priv->card);
-
+
return NULL;
}
@@ -662,12 +643,11 @@ e_destination_get_book_uri (const EDestination *dest)
if (dest->priv->card) {
EBook *book = e_card_get_book (dest->priv->card);
-
if (book) {
return e_book_get_uri (book);
}
}
-
+
return NULL;
}
@@ -675,10 +655,10 @@ gint
e_destination_get_email_num (const EDestination *dest)
{
g_return_val_if_fail (dest && E_IS_DESTINATION (dest), -1);
-
+
if (dest->priv->card == NULL && (dest->priv->book_uri == NULL || dest->priv->card_uid == NULL))
return -1;
-
+
return dest->priv->card_email_num;
}
@@ -686,34 +666,36 @@ const gchar *
e_destination_get_name (const EDestination *dest)
{
struct _EDestinationPrivate *priv;
-
g_return_val_if_fail (dest && E_IS_DESTINATION (dest), NULL);
-
+
priv = (struct _EDestinationPrivate *)dest->priv; /* cast out const */
if (priv->name == NULL) {
+
if (priv->card != NULL) {
+
priv->name = e_card_name_to_string (priv->card->name);
-
+
if (priv->name == NULL || *priv->name == '\0') {
g_free (priv->name);
priv->name = g_strdup (priv->card->file_as);
}
-
+
if (priv->name == NULL || *priv->name == '\0') {
g_free (priv->name);
priv->name = g_strdup (e_destination_get_email (dest));
}
+
} else if (priv->raw != NULL) {
+
CamelInternetAddress *addr = camel_internet_address_new ();
-
+
if (camel_address_unformat (CAMEL_ADDRESS (addr), priv->raw)) {
- const char *camel_name = NULL;
-
+ const gchar *camel_name = NULL;
camel_internet_address_get (addr, 0, &camel_name, NULL);
priv->name = g_strdup (camel_name);
}
-
+
camel_object_unref (CAMEL_OBJECT (addr));
}
}
@@ -726,33 +708,37 @@ const gchar *
e_destination_get_email (const EDestination *dest)
{
struct _EDestinationPrivate *priv;
-
+
g_return_val_if_fail (dest && E_IS_DESTINATION (dest), NULL);
-
+
priv = (struct _EDestinationPrivate *)dest->priv; /* cast out const */
if (priv->email == NULL) {
- if (priv->card != NULL) {
- /* Pull the address out of the card. */
+
+ if (priv->card != NULL) { /* Pull the address out of the card. */
+
if (priv->card->email) {
EIterator *iter = e_list_get_iterator (priv->card->email);
- int n = priv->card_email_num;
-
+ gint n = priv->card_email_num;
+
if (n >= 0) {
while (n > 0) {
e_iterator_next (iter);
- n--;
+ --n;
}
-
+
if (e_iterator_is_valid (iter)) {
gconstpointer ptr = e_iterator_get (iter);
- priv->email = g_strdup ((char *) ptr);
+ priv->email = g_strdup ((gchar *) ptr);
}
}
+
}
+
} else if (priv->raw != NULL) {
+
CamelInternetAddress *addr = camel_internet_address_new ();
-
+
if (camel_address_unformat (CAMEL_ADDRESS (addr), priv->raw)) {
const gchar *camel_email = NULL;
camel_internet_address_get (addr, 0, NULL, &camel_email);
@@ -767,7 +753,7 @@ e_destination_get_email (const EDestination *dest)
priv->email = g_strdup ("");
}
}
-
+
return priv->email;
}
@@ -779,16 +765,15 @@ e_destination_get_address (const EDestination *dest)
g_return_val_if_fail (dest && E_IS_DESTINATION (dest), NULL);
priv = (struct _EDestinationPrivate *)dest->priv; /* cast out const */
-
+
if (priv->addr == NULL) {
CamelInternetAddress *addr = camel_internet_address_new ();
-
+
if (e_destination_is_evolution_list (dest)) {
GList *iter = dest->priv->list_dests;
while (iter) {
EDestination *list_dest = E_DESTINATION (iter->data);
-
if (!e_destination_is_empty (list_dest)) {
camel_internet_address_add (addr,
e_destination_get_name (list_dest),
@@ -798,22 +783,25 @@ e_destination_get_address (const EDestination *dest)
}
priv->addr = camel_address_encode (CAMEL_ADDRESS (addr));
+
} else if (priv->raw) {
if (camel_address_unformat (CAMEL_ADDRESS (addr), priv->raw)) {
priv->addr = camel_address_encode (CAMEL_ADDRESS (addr));
}
+
} else {
+
camel_internet_address_add (addr,
e_destination_get_name (dest),
e_destination_get_email (dest));
-
+
priv->addr = camel_address_encode (CAMEL_ADDRESS (addr));
}
-
+
camel_object_unref (CAMEL_OBJECT (addr));
}
-
+
return priv->addr;
}
@@ -822,14 +810,15 @@ e_destination_set_raw (EDestination *dest, const gchar *raw)
{
g_return_if_fail (E_IS_DESTINATION (dest));
g_return_if_fail (raw != NULL);
-
+
if (dest->priv->raw == NULL || strcmp (dest->priv->raw, raw)) {
+
e_destination_freeze (dest);
-
+
e_destination_clear (dest);
dest->priv->raw = g_strdup (raw);
e_destination_changed (dest);
-
+
e_destination_thaw (dest);
}
}
@@ -837,35 +826,34 @@ e_destination_set_raw (EDestination *dest, const gchar *raw)
const gchar *
e_destination_get_textrep (const EDestination *dest)
{
- const char *name, *email;
-
+ const gchar *name, *email;
+
g_return_val_if_fail (dest && E_IS_DESTINATION (dest), NULL);
-
+
if (dest->priv->raw)
return dest->priv->raw;
-
+
name = e_destination_get_name (dest);
email = e_destination_get_email (dest);
-
+
if (e_destination_from_card (dest) && name != NULL)
return name;
-
+
/* Make sure that our address gets quoted properly */
if (name && email && dest->priv->textrep == NULL) {
CamelInternetAddress *addr = camel_internet_address_new ();
-
camel_internet_address_add (addr, name, email);
g_free (dest->priv->textrep);
dest->priv->textrep = camel_address_format (CAMEL_ADDRESS (addr));
camel_object_unref (CAMEL_OBJECT (addr));
}
-
+
if (dest->priv->textrep != NULL)
return dest->priv->textrep;
if (email)
return email;
-
+
return "";
}
@@ -873,25 +861,23 @@ gboolean
e_destination_is_evolution_list (const EDestination *dest)
{
g_return_val_if_fail (dest && E_IS_DESTINATION (dest), FALSE);
-
+
if (dest->priv->list_dests == NULL
&& dest->priv->card != NULL
&& dest->priv->card->email != NULL
&& e_card_evolution_list (dest->priv->card)) {
-
+
EIterator *iter = e_list_get_iterator (dest->priv->card->email);
-
e_iterator_reset (iter);
while (e_iterator_is_valid (iter)) {
- const char *dest_xml = (const char *) e_iterator_get (iter);
+ const gchar *dest_xml = (const gchar *) e_iterator_get (iter);
EDestination *list_dest = e_destination_import (dest_xml);
-
if (list_dest)
dest->priv->list_dests = g_list_append (dest->priv->list_dests, list_dest);
e_iterator_next (iter);
}
}
-
+
return dest->priv->list_dests != NULL;
}
@@ -899,10 +885,10 @@ gboolean
e_destination_list_show_addresses (const EDestination *dest)
{
g_return_val_if_fail (E_IS_DESTINATION (dest), FALSE);
-
+
if (dest->priv->card != NULL)
return e_card_evolution_list_show_addresses (dest->priv->card);
-
+
return dest->priv->show_addresses;
}
@@ -910,10 +896,10 @@ gboolean
e_destination_get_html_mail_pref (const EDestination *dest)
{
g_return_val_if_fail (dest && E_IS_DESTINATION (dest), FALSE);
-
+
if (dest->priv->html_mail_override || dest->priv->card == NULL)
return dest->priv->wants_html_mail;
-
+
return dest->priv->card->wants_html;
}
@@ -921,7 +907,7 @@ gboolean
e_destination_allow_cardification (const EDestination *dest)
{
g_return_val_if_fail (E_IS_DESTINATION (dest), FALSE);
-
+
return dest->priv->allow_cardify;
}
@@ -941,7 +927,7 @@ set_cardify_book (EDestination *dest, EBook *book)
}
dest->priv->cardify_book = book;
-
+
if (book)
gtk_object_ref (GTK_OBJECT (book));
}
@@ -950,32 +936,32 @@ static void
name_and_email_simple_query_cb (EBook *book, EBookSimpleQueryStatus status, const GList *cards, gpointer closure)
{
EDestination *dest = E_DESTINATION (closure);
-
+
if (status == E_BOOK_SIMPLE_QUERY_STATUS_SUCCESS && g_list_length ((GList *) cards) == 1) {
ECard *card = E_CARD (cards->data);
- const char *email = e_destination_get_email (dest);
- int email_num = 0;
-
+ const gchar *email = e_destination_get_email (dest);
+ gint email_num = 0;
+
if (e_destination_is_valid (dest) && email && *email) {
email_num = e_card_email_find_number (card, e_destination_get_email (dest));
}
-
+
if (email_num >= 0) {
const char *book_uri;
-
+
book_uri = e_book_get_uri (book);
-
+
dest->priv->has_been_cardified = TRUE;
e_destination_set_card (dest, card, email_num);
e_destination_set_book_uri (dest, book_uri);
gtk_signal_emit (GTK_OBJECT (dest), e_destination_signals[CARDIFIED]);
}
}
-
+
if (!dest->priv->has_been_cardified) {
dest->priv->cannot_cardify = TRUE;
}
-
+
gtk_object_unref (GTK_OBJECT (dest)); /* drop the reference held by the query */
}
@@ -984,13 +970,14 @@ static void
nickname_simple_query_cb (EBook *book, EBookSimpleQueryStatus status, const GList *cards, gpointer closure)
{
EDestination *dest = E_DESTINATION (closure);
-
+
if (status == E_BOOK_SIMPLE_QUERY_STATUS_SUCCESS) {
+
if (g_list_length ((GList *) cards) == 1) {
const char *book_uri;
-
+
book_uri = e_book_get_uri (book);
-
+
dest->priv->has_been_cardified = TRUE;
e_destination_set_card (dest, E_CARD (cards->data), 0); /* Uses primary e-mail by default. */
e_destination_set_book_uri (dest, book_uri);
@@ -999,9 +986,10 @@ nickname_simple_query_cb (EBook *book, EBookSimpleQueryStatus status, const GLis
gtk_object_unref (GTK_OBJECT (dest)); /* drop the reference held by the query */
} else {
+
/* We can only end up here if we don't look at all like an e-mail address, so
we do a name-only query on the textrep */
-
+
e_book_name_and_email_query (book,
e_destination_get_textrep (dest),
NULL,
@@ -1018,6 +1006,7 @@ static void
launch_cardify_query (EDestination *dest)
{
if (! e_destination_is_valid (dest)) {
+
/* If it doesn't look like an e-mail address, see if it is a nickname. */
e_book_nickname_query (dest->priv->cardify_book,
e_destination_get_textrep (dest),
@@ -1025,6 +1014,7 @@ launch_cardify_query (EDestination *dest)
dest);
} else {
+
e_book_name_and_email_query (dest->priv->cardify_book,
e_destination_get_name (dest),
e_destination_get_email (dest),
@@ -1041,7 +1031,7 @@ use_local_book_cb (EBook *book, gpointer closure)
dest->priv->cardify_book = book;
gtk_object_ref (GTK_OBJECT (book));
}
-
+
launch_cardify_query (dest);
}
@@ -1049,21 +1039,21 @@ use_local_book_cb (EBook *book, gpointer closure)
static gboolean
e_destination_reverting_is_a_good_idea (EDestination *dest)
{
- const char *textrep;
- int len, old_len;
-
+ const gchar *textrep;
+ gint len, old_len;
+
g_return_val_if_fail (E_IS_DESTINATION (dest), FALSE);
if (dest->priv->old_textrep == NULL)
return FALSE;
-
+
textrep = e_destination_get_textrep (dest);
-
+
len = g_utf8_strlen (textrep, -1);
old_len = g_utf8_strlen (dest->priv->old_textrep, -1);
-
+
if (len <= old_len/2)
return FALSE;
-
+
return TRUE;
}
@@ -1072,30 +1062,30 @@ e_destination_cardify (EDestination *dest, EBook *book)
{
g_return_if_fail (E_IS_DESTINATION (dest));
g_return_if_fail (book == NULL || E_IS_BOOK (book));
-
+
if (e_destination_is_evolution_list (dest))
return;
-
+
if (e_destination_contains_card (dest))
return;
-
+
if (!dest->priv->allow_cardify)
return;
-
+
if (dest->priv->cannot_cardify)
return;
-
+
e_destination_cancel_cardify (dest);
-
+
/* In some cases, we can revert to the previous card. */
if (!e_destination_is_valid (dest)
&& e_destination_reverting_is_a_good_idea (dest)
&& e_destination_revert (dest)) {
return;
}
-
+
set_cardify_book (dest, book);
-
+
/* Handle the case of an EDestination containing a card URL */
if (e_destination_contains_card (dest)) {
e_destination_use_card (dest, NULL, NULL);
@@ -1112,11 +1102,10 @@ e_destination_cardify (EDestination *dest, EBook *book)
}
}
-static int
+static gint
do_cardify_delayed (gpointer ptr)
{
EDestination *dest = E_DESTINATION (ptr);
-
e_destination_cardify (dest, dest->priv->cardify_book);
return FALSE;
}
@@ -1126,14 +1115,14 @@ e_destination_cardify_delayed (EDestination *dest, EBook *book, gint delay)
{
g_return_if_fail (E_IS_DESTINATION (dest));
g_return_if_fail (book == NULL || E_IS_BOOK (book));
-
+
if (delay < 0)
delay = 500;
-
+
e_destination_cancel_cardify (dest);
-
+
set_cardify_book (dest, book);
-
+
dest->priv->pending_cardification = gtk_timeout_add (delay, do_cardify_delayed, dest);
}
@@ -1141,7 +1130,7 @@ void
e_destination_cancel_cardify (EDestination *dest)
{
g_return_if_fail (E_IS_DESTINATION (dest));
-
+
if (dest->priv->pending_cardification) {
gtk_timeout_remove (dest->priv->pending_cardification);
dest->priv->pending_cardification = 0;
@@ -1151,24 +1140,24 @@ e_destination_cancel_cardify (EDestination *dest)
gboolean
e_destination_uncardify (EDestination *dest)
{
- char *email;
-
+ gchar *email;
+
g_return_val_if_fail (E_IS_DESTINATION (dest), FALSE);
-
- if (!e_destination_contains_card (dest))
+
+ if (! e_destination_contains_card (dest))
return FALSE;
-
+
email = g_strdup (e_destination_get_email (dest));
-
+
if (email == NULL)
return FALSE;
-
+
e_destination_freeze (dest);
e_destination_clear (dest);
e_destination_set_raw (dest, email);
g_free (email);
e_destination_thaw (dest);
-
+
return TRUE;
}
@@ -1176,26 +1165,26 @@ gboolean
e_destination_revert (EDestination *dest)
{
g_return_val_if_fail (E_IS_DESTINATION (dest), FALSE);
-
+
if (dest->priv->old_card) {
ECard *card;
- int card_email_num;
-
+ gint card_email_num;
+
card = dest->priv->old_card;
card_email_num = dest->priv->old_card_email_num;
-
+
dest->priv->old_card = NULL;
g_free (dest->priv->old_textrep);
dest->priv->old_textrep = NULL;
-
+
e_destination_freeze (dest);
e_destination_clear (dest);
e_destination_set_card (dest, card, card_email_num);
e_destination_thaw (dest);
-
+
return TRUE;
}
-
+
return FALSE;
}
@@ -1206,29 +1195,29 @@ e_destination_revert (EDestination *dest)
gchar *
e_destination_get_address_textv (EDestination **destv)
{
- int i, j, len = 0;
- char **strv;
- char *str;
+ gint i, j, len = 0;
+ gchar **strv;
+ gchar *str;
g_return_val_if_fail (destv, NULL);
-
+
/* Q: Please tell me this is only for assertion
reasons. If this is considered to be ok behavior then you
shouldn't use g_return's. Just a reminder ;-)
-
+
A: Yes, this is just an assertion. (Though it does find the
length of the vector in the process...)
*/
while (destv[len]) {
g_return_val_if_fail (E_IS_DESTINATION (destv[len]), NULL);
- len++;
+ ++len;
}
- strv = g_new0 (char *, len + 1);
+ strv = g_new0 (gchar *, len+1);
for (i = 0, j = 0; destv[i]; i++) {
if (!e_destination_is_empty (destv[i])) {
- const char *addr = e_destination_get_address (destv[i]);
- strv[j++] = addr ? (char *) addr : "";
+ const gchar *addr = e_destination_get_address (destv[i]);
+ strv[j++] = addr ? (gchar *) addr : "";
}
}
@@ -1243,17 +1232,17 @@ xmlNodePtr
e_destination_xml_encode (const EDestination *dest)
{
xmlNodePtr dest_node;
- const char *str;
-
+ const gchar *str;
+
g_return_val_if_fail (dest && E_IS_DESTINATION (dest), NULL);
-
+
dest_node = xmlNewNode (NULL, "destination");
-
+
str = e_destination_get_name (dest);
if (str)
xmlNewTextChild (dest_node, NULL, "name", str);
-
- if (!e_destination_is_evolution_list (dest)) {
+
+ if (! e_destination_is_evolution_list (dest)) {
str = e_destination_get_email (dest);
if (str)
xmlNewTextChild (dest_node, NULL, "email", str);
@@ -1271,48 +1260,44 @@ e_destination_xml_encode (const EDestination *dest)
str = e_destination_get_email (list_dest);
if (str)
xmlNewTextChild (list_node, NULL, "email", str);
-
+
xmlAddChild (dest_node, list_node);
iter = g_list_next (iter);
}
-
+
xmlNewProp (dest_node, "is_list", "yes");
xmlNewProp (dest_node, "show_addresses",
e_destination_list_show_addresses (dest) ? "yes" : "no");
}
-
+
str = e_destination_get_book_uri (dest);
if (str) {
xmlNewTextChild (dest_node, NULL, "book_uri", str);
}
-
+
str = e_destination_get_card_uid (dest);
if (str) {
- char buf[16];
-
+ gchar buf[16];
xmlNodePtr uri_node = xmlNewTextChild (dest_node, NULL, "card_uid", str);
g_snprintf (buf, 16, "%d", e_destination_get_email_num (dest));
xmlNewProp (uri_node, "email_num", buf);
}
-
+
xmlNewProp (dest_node, "html_mail", e_destination_get_html_mail_pref (dest) ? "yes" : "no");
-
- xmlNewProp (dest_node, "auto_recipient",
- e_destination_is_auto_recipient (dest) ? "yes" : "no");
-
+
return dest_node;
}
gboolean
e_destination_xml_decode (EDestination *dest, xmlNodePtr node)
{
- char *name = NULL, *email = NULL, *book_uri = NULL, *card_uid = NULL;
- gboolean is_list = FALSE, show_addr = FALSE, auto_recip = FALSE;
+ gchar *name = NULL, *email = NULL, *book_uri = NULL, *card_uid = NULL;
+ gint email_num = -1;
gboolean html_mail = FALSE;
+ gboolean is_list = FALSE, show_addr = FALSE;
+ gchar *tmp;
GList *list_dests = NULL;
- int email_num = -1;
- char *tmp;
g_return_val_if_fail (dest && E_IS_DESTINATION (dest), FALSE);
g_return_val_if_fail (node != NULL, FALSE);
@@ -1338,12 +1323,6 @@ e_destination_xml_decode (EDestination *dest, xmlNodePtr node)
xmlFree (tmp);
}
- tmp = xmlGetProp (node, "auto_recipient");
- if (tmp) {
- auto_recip = !strcmp (tmp, "yes");
- xmlFree (tmp);
- }
-
node = node->xmlChildrenNode;
while (node) {
if (!strcmp (node->name, "name")) {
@@ -1358,7 +1337,7 @@ e_destination_xml_decode (EDestination *dest, xmlNodePtr node)
xmlFree (tmp);
} else if (is_list && !strcmp (node->name, "list_entry")) {
xmlNodePtr subnode = node->xmlChildrenNode;
- char *list_name = NULL, *list_email = NULL;
+ gchar *list_name = NULL, *list_email = NULL;
while (subnode) {
if (!strcmp (subnode->name, "name")) {
@@ -1378,7 +1357,6 @@ e_destination_xml_decode (EDestination *dest, xmlNodePtr node)
if (list_name || list_email) {
EDestination *list_dest = e_destination_new ();
-
if (list_name)
e_destination_set_name (list_dest, list_name);
if (list_email)
@@ -1386,7 +1364,7 @@ e_destination_xml_decode (EDestination *dest, xmlNodePtr node)
g_free (list_name);
g_free (list_email);
-
+
list_dests = g_list_append (list_dests, list_dest);
}
} else if (!strcmp (node->name, "book_uri")) {
@@ -1407,7 +1385,7 @@ e_destination_xml_decode (EDestination *dest, xmlNodePtr node)
node = node->next;
}
-
+
e_destination_freeze (dest);
e_destination_clear (dest);
@@ -1430,14 +1408,12 @@ e_destination_xml_decode (EDestination *dest, xmlNodePtr node)
}
if (list_dests)
dest->priv->list_dests = list_dests;
-
+
dest->priv->html_mail_override = TRUE;
dest->priv->wants_html_mail = html_mail;
-
+
dest->priv->show_addresses = show_addr;
-
- dest->priv->auto_recipient = auto_recip;
-
+
e_destination_thaw (dest);
return TRUE;
@@ -1447,33 +1423,34 @@ e_destination_xml_decode (EDestination *dest, xmlNodePtr node)
static gchar *
null_terminate_and_remove_extra_whitespace (xmlChar *xml_in, gint size)
{
+ gchar *xml;
+ gchar *r, *w;
gboolean skip_white = FALSE;
- char *xml, *r, *w;
-
+
if (xml_in == NULL || size <= 0)
return NULL;
-
+
xml = g_strndup (xml_in, size);
r = w = xml;
-
+
while (*r) {
if (*r == '\n' || *r == '\r') {
skip_white = TRUE;
} else {
gboolean is_space = isspace (*r);
-
+
*w = *r;
-
- if (!(skip_white && is_space))
- w++;
- if (!is_space)
+
+ if (! (skip_white && is_space))
+ ++w;
+ if (! is_space)
skip_white = FALSE;
}
- r++;
+ ++r;
}
-
+
*w = '\0';
-
+
return xml;
}
@@ -1481,26 +1458,26 @@ gchar *
e_destination_export (const EDestination *dest)
{
xmlNodePtr dest_node;
- xmlDocPtr dest_doc;
- xmlChar *buffer = NULL;
- int size = -1;
- char *str;
+ xmlDocPtr dest_doc;
+ xmlChar *buffer = NULL;
+ gint size = -1;
+ gchar *str;
g_return_val_if_fail (dest && E_IS_DESTINATION (dest), NULL);
-
+
dest_node = e_destination_xml_encode (dest);
if (dest_node == NULL)
return NULL;
-
+
dest_doc = xmlNewDoc (XML_DEFAULT_VERSION);
xmlDocSetRootElement (dest_doc, dest_node);
-
+
xmlDocDumpMemory (dest_doc, &buffer, &size);
xmlFreeDoc (dest_doc);
-
+
str = null_terminate_and_remove_extra_whitespace (buffer, size);
xmlFree (buffer);
-
+
return str;
}
@@ -1509,11 +1486,11 @@ e_destination_import (const gchar *str)
{
EDestination *dest = NULL;
xmlDocPtr dest_doc;
-
- if (!(str && *str))
+
+ if (! (str && *str))
return NULL;
-
- dest_doc = xmlParseMemory ((char *) str, strlen (str));
+
+ dest_doc = xmlParseMemory ((gchar *) str, strlen (str));
if (dest_doc && dest_doc->xmlRootNode) {
dest = e_destination_new ();
if (! e_destination_xml_decode (dest, dest_doc->xmlRootNode)) {
@@ -1522,40 +1499,41 @@ e_destination_import (const gchar *str)
}
}
xmlFreeDoc (dest_doc);
-
+
return dest;
}
gchar *
e_destination_exportv (EDestination **destv)
{
- xmlDocPtr destv_doc;
- xmlNodePtr destv_node;
- xmlChar *buffer = NULL;
- int i, size = -1;
- char *str;
-
+ xmlDocPtr destv_doc;
+ xmlNodePtr destv_node;
+ xmlChar *buffer = NULL;
+ gint size = -1;
+ gchar *str;
+ gint i;
+
if (destv == NULL || *destv == NULL)
return NULL;
-
+
destv_doc = xmlNewDoc (XML_DEFAULT_VERSION);
destv_node = xmlNewNode (NULL, "destinations");
xmlDocSetRootElement (destv_doc, destv_node);
-
- for (i = 0; destv[i]; i++) {
+
+ for (i=0; destv[i]; ++i) {
if (! e_destination_is_empty (destv[i])) {
xmlNodePtr dest_node = e_destination_xml_encode (destv[i]);
if (dest_node)
xmlAddChild (destv_node, dest_node);
}
}
-
+
xmlDocDumpMemory (destv_doc, &buffer, &size);
xmlFreeDoc (destv_doc);
-
+
str = null_terminate_and_remove_extra_whitespace (buffer, size);
xmlFree (buffer);
-
+
return str;
}
@@ -1570,10 +1548,10 @@ e_destination_importv (const gchar *str)
if (!(str && *str))
return NULL;
- destv_doc = xmlParseMemory ((char *)str, strlen (str));
+ destv_doc = xmlParseMemory ((gchar *)str, strlen (str));
if (destv_doc == NULL)
return NULL;
-
+
node = destv_doc->xmlRootNode;
if (strcmp (node->name, "destinations"))
@@ -1609,40 +1587,32 @@ e_destination_importv (const gchar *str)
}
EDestination **
-e_destination_list_to_vector_sized (GList *list, int n)
+e_destination_list_to_vector (GList *list)
{
+ gint N = g_list_length (list);
EDestination **destv;
- int i = 0;
-
- if (n == -1)
- n = g_list_length (list);
-
- if (n == 0)
+ gint i = 0;
+
+ if (N == 0)
return NULL;
- destv = g_new (EDestination *, n + 1);
- while (list != NULL && i < n) {
+ destv = g_new (EDestination *, N+1);
+ while (list != NULL) {
destv[i] = E_DESTINATION (list->data);
list->data = NULL;
- i++;
+ ++i;
list = g_list_next (list);
}
- destv[i] = NULL;
-
- return destv;
-}
+ destv[N] = NULL;
-EDestination **
-e_destination_list_to_vector (GList *list)
-{
- return e_destination_list_to_vector_sized (list, -1);
+ return destv;
}
void
e_destination_freev (EDestination **destv)
{
- int i;
-
+ gint i;
+
if (destv) {
for (i = 0; destv[i] != NULL; ++i) {
gtk_object_unref (GTK_OBJECT (destv[i]));
@@ -1657,7 +1627,7 @@ touch_cb (EBook *book, const gchar *addr, ECard *card, gpointer closure)
{
if (book != NULL && card != NULL) {
e_card_touch (card);
- d(g_message ("Use score for \"%s\" is now %f", addr, e_card_get_use_score (card)));
+ g_message ("Use score for \"%s\" is now %f", addr, e_card_get_use_score (card));
e_book_commit_card (book, card, NULL, NULL);
}
}
@@ -1665,25 +1635,24 @@ touch_cb (EBook *book, const gchar *addr, ECard *card, gpointer closure)
void
e_destination_touch (EDestination *dest)
{
- const char *email;
-
+ const gchar *email;
+
g_return_if_fail (dest && E_IS_DESTINATION (dest));
-
- if (!e_destination_is_auto_recipient (dest)) {
- email = e_destination_get_email (dest);
-
- if (email)
- e_book_query_address_locally (email, touch_cb, NULL);
+
+ email = e_destination_get_email (dest);
+
+ if (email) {
+ e_book_query_address_locally (email, touch_cb, NULL);
}
}
void
e_destination_touchv (EDestination **destv)
{
- int i;
-
+ gint i;
+
g_return_if_fail (destv != NULL);
-
+
for (i = 0; destv[i] != NULL; ++i) {
e_destination_touch (destv[i]);
}
diff --git a/addressbook/backend/ebook/test-client.c b/addressbook/backend/ebook/test-client.c
index 04f2c5b0e3..900edcd024 100644
--- a/addressbook/backend/ebook/test-client.c
+++ b/addressbook/backend/ebook/test-client.c
@@ -9,7 +9,6 @@
#include <liboaf/liboaf.h>
#include "e-book.h"
-#include "e-book-util.h"
#define TEST_VCARD \
"BEGIN:VCARD
diff --git a/addressbook/backend/idl/addressbook.idl b/addressbook/backend/idl/addressbook.idl
index fe2870fcde..21479d1de2 100644
--- a/addressbook/backend/idl/addressbook.idl
+++ b/addressbook/backend/idl/addressbook.idl
@@ -99,9 +99,6 @@ module Addressbook {
AuthenticationFailed,
AuthenticationRequired,
UnsupportedField,
-
- TLSNotAvailable,
-
OtherError
};
diff --git a/addressbook/backend/pas/evolutionperson.schema b/addressbook/backend/pas/evolutionperson.schema
index f0f3a394df..4b64b3b7e4 100644
--- a/addressbook/backend/pas/evolutionperson.schema
+++ b/addressbook/backend/pas/evolutionperson.schema
@@ -167,12 +167,14 @@ attributetype ( 1.3.6.1.4.1.8506.1.2.25
SUP name
SINGLE-VALUE )
+# deprecated - use calEntry and its attributes from RFC 2739
attributetype ( 1.3.6.1.4.1.8506.1.2.26
NAME 'calendarURI'
EQUALITY caseExactIA5Match
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
SINGLE-VALUE )
+# deprecated - use calEntry and its attributes from RFC 2739
attributetype ( 1.3.6.1.4.1.8506.1.2.27
NAME 'freeBusyURI'
EQUALITY caseExactIA5Match
diff --git a/addressbook/backend/pas/pas-backend-card-sexp.c b/addressbook/backend/pas/pas-backend-card-sexp.c
index ea217fa052..139672ceaf 100644
--- a/addressbook/backend/pas/pas-backend-card-sexp.c
+++ b/addressbook/backend/pas/pas-backend-card-sexp.c
@@ -1,22 +1,4 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * pas-backend-card-sexp.c
- * Copyright 1999, 2000, 2001, Ximian, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
#include "pas-backend-card-sexp.h"
@@ -125,36 +107,6 @@ compare_category (ECardSimple *card, const char *str,
return ret_val;
}
-static gboolean
-compare_arbitrary (ECardSimple *card, const char *str,
- char *(*compare)(const char*, const char*))
-{
- EList *list;
- EIterator *iterator;
- ECard *ecard;
- gboolean ret_val = FALSE;
-
- gtk_object_get (GTK_OBJECT (card),
- "card", &ecard,
- NULL);
- gtk_object_get (GTK_OBJECT (ecard),
- "arbitrary", &list,
- NULL);
-
- for (iterator = e_list_get_iterator(list); e_iterator_is_valid (iterator); e_iterator_next (iterator)) {
- const ECardArbitrary *arbitrary = e_iterator_get (iterator);
-
- if (compare(arbitrary->key, str)) {
- ret_val = TRUE;
- break;
- }
- }
-
- gtk_object_unref (GTK_OBJECT (iterator));
- e_card_free_empty_lists (ecard);
- return ret_val;
-}
-
static struct prop_info {
ECardSimpleField field_id;
const char *query_prop;
@@ -192,7 +144,6 @@ static struct prop_info {
LIST_PROP ( "phone", "phone", compare_phone ),
LIST_PROP ( "address", "address", compare_address ),
LIST_PROP ( "category", "category", compare_category ),
- LIST_PROP ( "arbitrary", "arbitrary", compare_arbitrary )
};
static int num_prop_infos = sizeof(prop_info_table) / sizeof(prop_info_table[0]);
diff --git a/addressbook/backend/pas/pas-backend-file.c b/addressbook/backend/pas/pas-backend-file.c
index 2848fcda71..3daed9d7c6 100644
--- a/addressbook/backend/pas/pas-backend-file.c
+++ b/addressbook/backend/pas/pas-backend-file.c
@@ -54,11 +54,9 @@ struct _PASBackendFilePrivate {
GList *clients;
gboolean loaded;
char *uri;
- char *filename;
DB *file_db;
EList *book_views;
gboolean writable;
- GHashTable *address_lists;
};
struct _PASBackendFileCursorPrivate {
@@ -370,7 +368,6 @@ pas_backend_file_changes (PASBackendFile *bf,
DBC *dbc;
PASBackendFileBookView *view = (PASBackendFileBookView *)cnstview;
PASBackendFileChangeContext *ctx = cnstview->change_context;
- char *dirname, *slash;
memset (&id_dbt, 0, sizeof (id_dbt));
memset (&vcard_dbt, 0, sizeof (vcard_dbt));
@@ -378,16 +375,11 @@ pas_backend_file_changes (PASBackendFile *bf,
if (!bf->priv->loaded)
return;
- /* Find the changed ids */
- dirname = g_strdup (bf->priv->filename);
- slash = strrchr (dirname, '/');
- *slash = '\0';
-
- filename = g_strdup_printf ("%s/%s.db", dirname, view->change_id);
+ /* Find the changed ids - FIX ME, path should not be hard coded */
+ filename = g_strdup_printf ("%s/evolution/local/Contacts/%s.db", g_get_home_dir (), view->change_id);
ehash = e_dbhash_new (filename);
g_free (filename);
- g_free (dirname);
-
+
db_error = db->cursor (db, NULL, &dbc, 0);
if (db_error != 0) {
@@ -535,7 +527,7 @@ do_create(PASBackend *backend,
static void
pas_backend_file_process_create_card (PASBackend *backend,
PASBook *book,
- PASCreateCardRequest *req)
+ PASRequest *req)
{
char *id;
char *vcard;
@@ -570,12 +562,14 @@ pas_backend_file_process_create_card (PASBackend *backend,
GNOME_Evolution_Addressbook_BookListener_CardNotFound,
"");
}
+
+ g_free(req->vcard);
}
static void
pas_backend_file_process_remove_card (PASBackend *backend,
PASBook *book,
- PASRemoveCardRequest *req)
+ PASRequest *req)
{
PASBackendFile *bf = PAS_BACKEND_FILE (backend);
DB *db = bf->priv->file_db;
@@ -594,6 +588,7 @@ pas_backend_file_process_remove_card (PASBackend *backend,
pas_book_respond_remove (
book,
GNOME_Evolution_Addressbook_BookListener_CardNotFound);
+ g_free (req->id);
return;
}
@@ -602,6 +597,7 @@ pas_backend_file_process_remove_card (PASBackend *backend,
pas_book_respond_remove (
book,
GNOME_Evolution_Addressbook_BookListener_CardNotFound);
+ g_free (req->id);
return;
}
@@ -625,12 +621,14 @@ pas_backend_file_process_remove_card (PASBackend *backend,
pas_book_respond_remove (
book,
GNOME_Evolution_Addressbook_BookListener_Success);
+
+ g_free (req->id);
}
static void
pas_backend_file_process_modify_card (PASBackend *backend,
PASBook *book,
- PASModifyCardRequest *req)
+ PASRequest *req)
{
PASBackendFile *bf = PAS_BACKEND_FILE (backend);
DB *db = bf->priv->file_db;
@@ -665,6 +663,7 @@ pas_backend_file_process_modify_card (PASBackend *backend,
pas_book_respond_modify (
book,
GNOME_Evolution_Addressbook_BookListener_CardNotFound);
+ g_free (req->id);
return;
}
old_vcard_string = g_strdup(vcard_dbt.data);
@@ -695,12 +694,10 @@ pas_backend_file_process_modify_card (PASBackend *backend,
pas_book_view_notify_add_1 (view->book_view, req->vcard);
else /* if (old_match) */
pas_book_view_notify_remove (view->book_view, id);
-
pas_book_view_notify_complete (view->book_view);
bonobo_object_release_unref(bonobo_object_corba_objref(BONOBO_OBJECT(view->book_view)), &ev);
}
-
gtk_object_unref(GTK_OBJECT(iterator));
pas_book_respond_modify (
@@ -716,12 +713,13 @@ pas_backend_file_process_modify_card (PASBackend *backend,
g_free(old_vcard_string);
gtk_object_unref(GTK_OBJECT(card));
+ g_free (req->vcard);
}
static void
pas_backend_file_build_cards_list(PASBackend *backend,
- PASBackendFileCursorPrivate *cursor_data,
- char *search)
+ PASBackendFileCursorPrivate *cursor_data,
+ char *search)
{
PASBackendFile *bf = PAS_BACKEND_FILE (backend);
DB *db = bf->priv->file_db;
@@ -780,7 +778,7 @@ pas_backend_file_build_cards_list(PASBackend *backend,
static void
pas_backend_file_process_get_vcard (PASBackend *backend,
PASBook *book,
- PASGetVCardRequest *req)
+ PASRequest *req)
{
PASBackendFile *bf;
DB *db;
@@ -813,7 +811,7 @@ pas_backend_file_process_get_vcard (PASBackend *backend,
static void
pas_backend_file_process_get_cursor (PASBackend *backend,
PASBook *book,
- PASGetCursorRequest *req)
+ PASRequest *req)
{
/*
PASBackendFile *bf = PAS_BACKEND_FILE (backend);
@@ -863,9 +861,10 @@ pas_backend_file_process_get_cursor (PASBackend *backend,
static void
pas_backend_file_process_get_book_view (PASBackend *backend,
PASBook *book,
- PASGetBookViewRequest *req)
+ PASRequest *req)
{
PASBackendFile *bf = PAS_BACKEND_FILE (backend);
+ CORBA_Environment ev;
PASBookView *book_view;
PASBackendFileBookView view;
EIterator *iterator;
@@ -880,7 +879,7 @@ pas_backend_file_process_get_book_view (PASBackend *backend,
GTK_SIGNAL_FUNC(view_destroy), book);
view.book_view = book_view;
- view.search = g_strdup (req->search);
+ view.search = req->search;
view.card_sexp = NULL;
view.change_id = NULL;
view.change_context = NULL;
@@ -897,14 +896,28 @@ pas_backend_file_process_get_book_view (PASBackend *backend,
e_iterator_last(iterator);
pas_backend_file_search (bf, book, e_iterator_get(iterator));
gtk_object_unref(GTK_OBJECT(iterator));
+
+ g_free(req->search);
+ CORBA_exception_init(&ev);
+
+ bonobo_object_unref (BONOBO_OBJECT (book_view));
+ bonobo_object_release_unref (req->listener, &ev);
+
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ g_warning("pas_backend_file_process_get_book_view: Exception unreffing "
+ "listener.\n");
+ }
+
+ CORBA_exception_free(&ev);
}
static void
pas_backend_file_process_get_changes (PASBackend *backend,
PASBook *book,
- PASGetChangesRequest *req)
+ PASRequest *req)
{
PASBackendFile *bf = PAS_BACKEND_FILE (backend);
+ CORBA_Environment ev;
PASBookView *book_view;
PASBackendFileBookView view;
PASBackendFileChangeContext ctx;
@@ -943,12 +956,23 @@ pas_backend_file_process_get_changes (PASBackend *backend,
e_iterator_last(iterator);
pas_backend_file_changes (bf, book, e_iterator_get(iterator));
gtk_object_unref(GTK_OBJECT(iterator));
+
+ g_free(req->search);
+ CORBA_exception_init(&ev);
+ bonobo_object_release_unref (req->listener, &ev);
+
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ g_warning("pas_backend_file_process_get_changed: Exception unreffing "
+ "listener.\n");
+ }
+
+ CORBA_exception_free(&ev);
}
static void
pas_backend_file_process_check_connection (PASBackend *backend,
PASBook *book,
- PASCheckConnectionRequest *req)
+ PASRequest *req)
{
PASBackendFile *bf = PAS_BACKEND_FILE (backend);
@@ -966,7 +990,7 @@ pas_backend_file_extract_path_from_uri (const char *uri)
static void
pas_backend_file_process_authenticate_user (PASBackend *backend,
PASBook *book,
- PASAuthenticateUserRequest *req)
+ PASRequest *req)
{
pas_book_respond_authenticate_user (book,
GNOME_Evolution_Addressbook_BookListener_Success);
@@ -975,7 +999,7 @@ pas_backend_file_process_authenticate_user (PASBackend *backend,
static void
pas_backend_file_process_get_supported_fields (PASBackend *backend,
PASBook *book,
- PASGetSupportedFieldsRequest *req)
+ PASRequest *req)
{
EList *fields = e_list_new ((EListCopyFunc)g_strdup, (EListFreeFunc)g_free, NULL);
ECardSimple *simple;
@@ -1013,47 +1037,47 @@ pas_backend_file_process_client_requests (PASBook *book)
switch (req->op) {
case CreateCard:
- pas_backend_file_process_create_card (backend, book, (PASCreateCardRequest*)req);
+ pas_backend_file_process_create_card (backend, book, req);
break;
case RemoveCard:
- pas_backend_file_process_remove_card (backend, book, (PASRemoveCardRequest*)req);
+ pas_backend_file_process_remove_card (backend, book, req);
break;
case ModifyCard:
- pas_backend_file_process_modify_card (backend, book, (PASModifyCardRequest*)req);
+ pas_backend_file_process_modify_card (backend, book, req);
break;
case CheckConnection:
- pas_backend_file_process_check_connection (backend, book, (PASCheckConnectionRequest*)req);
+ pas_backend_file_process_check_connection (backend, book, req);
break;
case GetVCard:
- pas_backend_file_process_get_vcard (backend, book, (PASGetVCardRequest*)req);
+ pas_backend_file_process_get_vcard (backend, book, req);
break;
case GetCursor:
- pas_backend_file_process_get_cursor (backend, book, (PASGetCursorRequest*)req);
+ pas_backend_file_process_get_cursor (backend, book, req);
break;
case GetBookView:
- pas_backend_file_process_get_book_view (backend, book, (PASGetBookViewRequest*)req);
+ pas_backend_file_process_get_book_view (backend, book, req);
break;
case GetChanges:
- pas_backend_file_process_get_changes (backend, book, (PASGetChangesRequest*)req);
+ pas_backend_file_process_get_changes (backend, book, req);
break;
case AuthenticateUser:
- pas_backend_file_process_authenticate_user (backend, book, (PASAuthenticateUserRequest*)req);
+ pas_backend_file_process_authenticate_user (backend, book, req);
break;
case GetSupportedFields:
- pas_backend_file_process_get_supported_fields (backend, book, (PASGetSupportedFieldsRequest*)req);
+ pas_backend_file_process_get_supported_fields (backend, book, req);
break;
}
- pas_book_free_request (req);
+ g_free (req);
}
static void
@@ -1278,6 +1302,9 @@ pas_backend_file_load_uri (PASBackend *backend,
}
}
+ g_free (filename);
+
+
if (db_error != 0) {
bf->priv->file_db = NULL;
return GNOME_Evolution_Addressbook_BookListener_OtherError;
@@ -1297,9 +1324,6 @@ pas_backend_file_load_uri (PASBackend *backend,
g_free(bf->priv->uri);
bf->priv->uri = g_strdup (uri);
- g_free (bf->priv->filename);
- bf->priv->filename = filename;
-
return GNOME_Evolution_Addressbook_BookListener_Success;
}
@@ -1446,9 +1470,6 @@ pas_backend_file_destroy (GtkObject *object)
gtk_object_unref(GTK_OBJECT(bf->priv->book_views));
g_free (bf->priv->uri);
- g_free (bf->priv->filename);
-
- g_free (bf->priv);
GTK_OBJECT_CLASS (pas_backend_file_parent_class)->destroy (object);
}
diff --git a/addressbook/backend/pas/pas-backend-ldap.c b/addressbook/backend/pas/pas-backend-ldap.c
index 9af0a8c1a4..a268e9342b 100644
--- a/addressbook/backend/pas/pas-backend-ldap.c
+++ b/addressbook/backend/pas/pas-backend-ldap.c
@@ -10,6 +10,8 @@
#include "config.h"
#include <fcntl.h>
+#include <time.h>
+#include <lber.h>
#include <gtk/gtksignal.h>
#include <libgnome/gnome-defs.h>
@@ -31,7 +33,7 @@
#endif
#ifdef OPENLDAP2
-#include <ldap_schema.h>
+#include "ldap_schema.h"
#endif
#include <sys/time.h>
@@ -44,13 +46,8 @@
#include "pas-book.h"
#include "pas-card-cursor.h"
-#include <stdlib.h>
-typedef enum {
- PAS_BACKEND_LDAP_TLS_NO,
- PAS_BACKEND_LDAP_TLS_ALWAYS,
- PAS_BACKEND_LDAP_TLS_WHEN_POSSIBLE,
-} PASBackendLDAPUseTLS;
+#define LDAP_MAX_SEARCH_RESPONSES 100
/* interval for our poll_ldap timeout */
#define LDAP_POLL_INTERVAL 20
@@ -73,6 +70,7 @@ typedef enum {
#define PERSON "person"
#define ORGANIZATIONALPERSON "organizationalPerson"
#define INETORGPERSON "inetOrgPerson"
+#define CALENTRY "calEntry"
#define EVOLUTIONPERSON "evolutionPerson"
static gchar *query_prop_to_ldap(gchar *query_prop);
@@ -82,26 +80,14 @@ typedef struct _PASBackendLDAPCursorPrivate PASBackendLDAPCursorPrivate;
typedef struct _PASBackendLDAPBookView PASBackendLDAPBookView;
typedef struct LDAPOp LDAPOp;
-
struct _PASBackendLDAPPrivate {
char *uri;
gboolean connected;
GList *clients;
-
- gchar *ldap_host; /* the hostname of the server */
- int ldap_port; /* the port of the server */
- char *schema_dn; /* the base dn for schema information */
- gchar *ldap_rootdn; /* the base dn of our searches */
- int ldap_scope; /* the scope used for searches */
- int ldap_limit; /* the search limit */
-
- gboolean ldap_v3; /* TRUE if the server supports protocol
- revision 3 (necessary for TLS) */
- gboolean starttls; /* TRUE if the *library* supports
- starttls. will be false if openssl
- was not built into openldap. */
- PASBackendLDAPUseTLS use_tls;
-
+ gchar *ldap_host;
+ gchar *ldap_rootdn;
+ int ldap_port;
+ int ldap_scope;
GList *book_views;
LDAP *ldap;
@@ -111,14 +97,17 @@ struct _PASBackendLDAPPrivate {
/* whether or not there's support for the objectclass we need
to store all our additional fields */
gboolean evolutionPersonSupported;
- gboolean schema_checked;
+ gboolean calEntrySupported;
+ gboolean evolutionPersonChecked;
gboolean writable;
- /* our operations */
- GHashTable *id_to_op;
- int active_ops;
- int poll_timeout;
+ char **search_attrs;
+
+ /* whether or not there's a request in process on our LDAP* */
+ LDAPOp *current_op;
+ GList *pending_ops;
+ int op_idle;
};
struct _PASBackendLDAPCursorPrivate {
@@ -134,12 +123,25 @@ struct _PASBackendLDAPBookView {
PASBackendLDAPPrivate *blpriv;
gchar *search;
PASBackendCardSExp *card_sexp;
-
+ int search_timeout;
+ int search_msgid;
LDAPOp *search_op;
+
+ /* grouping stuff */
+
+ GList *pending_adds; /* the cards we're sending */
+ int num_pending_adds; /* the number waiting to be sent */
+ int target_pending_adds; /* the cutoff that forces a flush to the client, if it happens before the timeout */
+ int num_sent_this_time; /* the number of cards we sent to the client before the most recent timeout */
+ int num_sent_last_time; /* the number of cards we sent to the client before the previous timeout */
+ glong grouping_time_start;
+
+ /* used by poll_ldap to only send the status messages once */
+ gboolean notified_receiving_results;
};
-typedef void (*LDAPOpHandler)(LDAPOp *op, LDAPMessage *res);
-typedef void (*LDAPOpDtor)(LDAPOp *op);
+typedef gboolean (*LDAPOpHandler)(PASBackend *backend, LDAPOp *op);
+typedef void (*LDAPOpDtor)(PASBackend *backend, LDAPOp *op);
struct LDAPOp {
LDAPOpHandler handler;
@@ -147,17 +149,15 @@ struct LDAPOp {
PASBackend *backend;
PASBook *book;
PASBookView *view;
- int id;
};
-static void ldap_op_add (LDAPOp *op, PASBackend *backend, PASBook *book,
- PASBookView *view, int id, LDAPOpHandler handler, LDAPOpDtor dtor);
+static void ldap_op_init (LDAPOp *op, PASBackend *backend, PASBook *book, PASBookView *view, LDAPOpHandler handler, LDAPOpDtor dtor);
+static void ldap_op_process_current (PASBackend *backend);
+static void ldap_op_process (LDAPOp *op);
+static void ldap_op_restart (LDAPOp *op);
+static gboolean ldap_op_process_on_idle (PASBackend *backend);
static void ldap_op_finished (LDAPOp *op);
-static void ldap_search_op_timeout (LDAPOp *op, glong cur_millis);
-
-static gboolean poll_ldap (PASBackendLDAP *bl);
-
static ECardSimple *build_card_from_entry (LDAP *ldap, LDAPMessage *e, GList **existing_objectclasses);
static void email_populate (ECardSimple *card, char **values);
@@ -231,7 +231,7 @@ struct prop_info {
E_STRING_PROP (E_CARD_SIMPLE_FIELD_PHONE_ASSISTANT, "assistant_phone", "assistantPhone"),
E_STRING_PROP (E_CARD_SIMPLE_FIELD_PHONE_COMPANY, "company_phone", "companyPhone"),
E_STRING_PROP (E_CARD_SIMPLE_FIELD_PHONE_CALLBACK, "callback_phone", "callbackPhone"),
- E_STRING_PROP (E_CARD_SIMPLE_FIELD_PHONE_TTYTDD, "tty", "tty"),
+ E_STRING_PROP (E_CARD_SIMPLE_FIELD_PHONE_TTYTTD, "tty", "tty"),
/* org information */
STRING_PROP (E_CARD_SIMPLE_FIELD_ORG, "org", "o"),
@@ -260,8 +260,8 @@ struct prop_info {
E_STRING_PROP (E_CARD_SIMPLE_FIELD_FILE_AS, "file_as", "fileAs"),
E_STRING_PROP (E_CARD_SIMPLE_FIELD_CATEGORIES, "categories", "categories"),
- E_STRING_PROP (E_CARD_SIMPLE_FIELD_CALURI, "caluri", "calendarURI"),
- E_STRING_PROP (E_CARD_SIMPLE_FIELD_FBURL, "fburl", "freeBusyURI")
+ STRING_PROP (E_CARD_SIMPLE_FIELD_CALURI, "caluri", "calCalURI"),
+ STRING_PROP (E_CARD_SIMPLE_FIELD_FBURL, "fburl", "calFBURL"),
/* E_CARD_SIMPLE_FIELD_NAME_OR_ORG, */
@@ -275,13 +275,6 @@ struct prop_info {
static int num_prop_infos = sizeof(prop_info) / sizeof(prop_info[0]);
static void
-remove_view (int msgid, LDAPOp *op, PASBookView *view)
-{
- if (op->view == view)
- op->view = NULL;
-}
-
-static void
view_destroy(GtkObject *object, gpointer data)
{
CORBA_Environment ev;
@@ -294,13 +287,26 @@ view_destroy(GtkObject *object, gpointer data)
for (list = bl->priv->book_views; list; list = g_list_next(list)) {
PASBackendLDAPBookView *view = list->data;
if (view->book_view == PAS_BOOK_VIEW(object)) {
- /* if we have an active search, interrupt it */
- if (view->search_op)
- ldap_op_finished (view->search_op);
- /* and remove us as the view for any other
- operations that might be using us to spew
- status messages to the gui */
- g_hash_table_foreach (bl->priv->id_to_op, (GHFunc)remove_view, view->book_view);
+ if (view->search_timeout != 0) {
+ /* we have a search running on the
+ ldap connection. remove the timeout
+ handler and anbandon the msg id */
+ g_source_remove(view->search_timeout);
+ if (view->search_msgid != -1)
+ ldap_abandon (bl->priv->ldap, view->search_msgid);
+
+ /* if the search op is the current op,
+ finish it. else, remove it from the
+ list and nuke it ourselves. */
+ if (view->search_op == bl->priv->current_op)
+ ldap_op_finished (view->search_op);
+ else {
+ bl->priv->pending_ops = g_list_remove (bl->priv->pending_ops,
+ view->search_op);
+ view->search_op->dtor (view->search_op->backend,
+ view->search_op);
+ }
+ }
g_free (view->search);
gtk_object_unref (GTK_OBJECT (view->card_sexp));
g_free (view);
@@ -374,15 +380,12 @@ check_schema_support (PASBackendLDAP *bl)
LDAPMessage *resp;
LDAP *ldap = bl->priv->ldap;
- if (!bl->priv->schema_dn)
- return;
-
- bl->priv->schema_checked = TRUE;
+ bl->priv->evolutionPersonChecked = TRUE;
attrs[0] = "objectClasses";
attrs[1] = NULL;
- if (ldap_search_ext_s (ldap, bl->priv->schema_dn, LDAP_SCOPE_BASE,
+ if (ldap_search_ext_s (ldap, "cn=Subschema", LDAP_SCOPE_BASE,
"(objectClass=subschema)", attrs, 0,
NULL, NULL, NULL, 0, &resp) == LDAP_SUCCESS) {
char **values;
@@ -407,6 +410,11 @@ check_schema_support (PASBackendLDAP *bl)
add_oc_attributes_to_supported_fields (bl, oc);
}
+ else if (!g_strcasecmp (oc->oc_names[j], CALENTRY)) {
+ g_print ("support found on ldap server for objectclass calEntry\n");
+ bl->priv->calEntrySupported = TRUE;
+ add_oc_attributes_to_supported_fields (bl, oc);
+ }
else if (!g_strcasecmp (oc->oc_names[j], INETORGPERSON)
|| !g_strcasecmp (oc->oc_names[j], ORGANIZATIONALPERSON)
|| !g_strcasecmp (oc->oc_names[j], PERSON)) {
@@ -415,136 +423,11 @@ check_schema_support (PASBackendLDAP *bl)
ldap_objectclass_free (oc);
}
-
- ldap_value_free (values);
}
-
- ldap_msgfree (resp);
}
}
static void
-get_ldap_library_info ()
-{
- LDAPAPIInfo info;
- LDAP *ldap;
-
- if (LDAP_SUCCESS != ldap_create (&ldap)) {
- g_warning ("couldn't create LDAP* for getting at the client lib api info");
- return;
- }
-
- info.ldapai_info_version = LDAP_API_INFO_VERSION;
-
- if (LDAP_OPT_SUCCESS != ldap_get_option (ldap, LDAP_OPT_API_INFO, &info)) {
- g_warning ("couldn't get ldap api info");
- }
- else {
- int i;
- g_message ("libldap vendor/version: %s %2d.%02d.%02d",
- info.ldapai_vendor_name,
- info.ldapai_vendor_version / 10000,
- (info.ldapai_vendor_version % 10000) / 1000,
- info.ldapai_vendor_version % 1000);
-
- g_message ("extensions present:");
- /* yuck. we have to free these? */
- for (i = 0; info.ldapai_extensions[i]; i++) {
- char *extension = info.ldapai_extensions[i];
- g_message (extension);
- ldap_memfree (extension);
- }
- ldap_memfree (info.ldapai_extensions);
- ldap_memfree (info.ldapai_vendor_name);
- }
-
- ldap_unbind_ext_s (ldap, NULL, NULL);
-}
-
-static void
-query_ldap_root_dse (PASBackendLDAP *bl)
-{
-#define MAX_DSE_ATTRS 20
- LDAP *ldap = bl->priv->ldap;
- LDAPMessage *resp;
- int ldap_error;
- char *attrs[MAX_DSE_ATTRS], **values;
- int i = 0;
- struct timeval timeout;
-
- attrs[i++] = "supportedControl";
- attrs[i++] = "supportedExtension";
- attrs[i++] = "supportedFeatures";
- attrs[i++] = "supportedSASLMechanisms";
- attrs[i++] = "supportedLDAPVersion";
- attrs[i++] = "subschemaSubentry"; /* OpenLDAP's dn for schema information */
- attrs[i++] = "schemaNamingContext"; /* Active directory's dn for schema information */
- attrs[i] = NULL;
-
- timeout.tv_sec = 0;
- timeout.tv_usec = LDAP_RESULT_TIMEOUT_MILLIS * 1000;
-
- ldap_error = ldap_search_ext_s (ldap,
- LDAP_ROOT_DSE, LDAP_SCOPE_BASE,
- "(objectclass=*)",
- attrs, 0, NULL, NULL, NULL, 0, &resp);
- if (ldap_error != LDAP_SUCCESS) {
- g_warning ("could not perform query on Root DSE");
- return;
- }
-
- values = ldap_get_values (ldap, resp, "supportedControl");
- if (values) {
- for (i = 0; values[i]; i++)
- g_message ("supported server control: %s", values[i]);
- ldap_value_free (values);
- }
-
- values = ldap_get_values (ldap, resp, "supportedExtension");
- if (values) {
- for (i = 0; values[i]; i++) {
- g_message ("supported server extension: %s", values[i]);
- if (!strcmp (values[i], LDAP_EXOP_START_TLS)) {
- g_message ("server reports LDAP_EXOP_START_TLS");
- }
- }
- ldap_value_free (values);
- }
-
- values = ldap_get_values (ldap, resp, "supportedSASLMechanisms");
- if (values) {
- for (i = 0; values[i]; i++)
- g_message ("supported SASL mechanism: %s", values[i]);
- ldap_value_free (values);
- }
-
-
- values = ldap_get_values (ldap, resp, "supportedLDAPVersion");
- if (values) {
- for (i = 0; values[i]; i++)
- if (LDAP_VERSION3 == atoi (values[i]))
- bl->priv->ldap_v3 = TRUE;
- ldap_value_free (values);
- }
-
- values = ldap_get_values (ldap, resp, "subschemaSubentry");
- if (!values || !values[0]) {
- if (values) ldap_value_free (values);
- values = ldap_get_values (ldap, resp, "schemaNamingContext");
- }
- if (values && values[0]) {
- bl->priv->schema_dn = g_strdup (values[0]);
- }
- else {
- g_warning ("could not determine location of schema information on LDAP server");
- }
- if (values)
- ldap_value_free (values);
-
- ldap_msgfree (resp);
-}
-
-static GNOME_Evolution_Addressbook_BookListener_CallStatus
pas_backend_ldap_connect (PASBackendLDAP *bl)
{
PASBackendLDAPPrivate *blpriv = bl->priv;
@@ -554,61 +437,22 @@ pas_backend_ldap_connect (PASBackendLDAP *bl)
ldap_unbind (blpriv->ldap);
blpriv->ldap = ldap_init (blpriv->ldap_host, blpriv->ldap_port);
-#if defined (DEBUG) && defined (LDAP_OPT_DEBUG_LEVEL)
+#ifdef DEBUG
{
- int debug_level = 4;
+ int debug_level = ~0;
ldap_set_option (blpriv->ldap, LDAP_OPT_DEBUG_LEVEL, &debug_level);
}
#endif
if (NULL != blpriv->ldap) {
- int ldap_error;
- query_ldap_root_dse (bl);
-
- if (bl->priv->ldap_v3) {
- int protocol_version = LDAP_VERSION3;
- ldap_error = ldap_set_option (blpriv->ldap, LDAP_OPT_PROTOCOL_VERSION, &protocol_version);
- if (LDAP_OPT_SUCCESS != ldap_error) {
- g_warning ("failed to set protocol version to LDAPv3");
- bl->priv->ldap_v3 = FALSE;
- }
- }
-
- if (bl->priv->use_tls) {
- if (bl->priv->ldap_v3 /* the server supports v3 */) {
- ldap_error = ldap_start_tls_s (blpriv->ldap, NULL, NULL);
- if (LDAP_SUCCESS != ldap_error) {
- if (bl->priv->use_tls == PAS_BACKEND_LDAP_TLS_ALWAYS) {
- g_message ("TLS not available (fatal version), (ldap_error 0x%02x)", ldap_error);
- ldap_unbind (blpriv->ldap);
- blpriv->ldap = NULL;
- return GNOME_Evolution_Addressbook_BookListener_TLSNotAvailable;
- }
- else {
- g_message ("TLS not available (ldap_error 0x%02x)", ldap_error);
- }
- }
- else
- g_message ("TLS active");
- }
- else {
- g_warning ("user wants to use TLS, but server doesn't support LDAPv3");
- if (bl->priv->use_tls == PAS_BACKEND_LDAP_TLS_ALWAYS) {
- ldap_unbind (blpriv->ldap);
- blpriv->ldap = NULL;
- return GNOME_Evolution_Addressbook_BookListener_TLSNotAvailable;
- }
- }
- }
-
+ ldap_simple_bind_s(blpriv->ldap,
+ NULL /*binddn*/, NULL /*passwd*/);
blpriv->connected = TRUE;
/* check to see if evolutionPerson is supported, if we can (me
might not be able to if we can't authenticate. if we
can't, try again in auth_user.) */
check_schema_support (bl);
-
- return GNOME_Evolution_Addressbook_BookListener_Success;
}
else {
g_warning ("pas_backend_ldap_connect failed for "
@@ -617,69 +461,142 @@ pas_backend_ldap_connect (PASBackendLDAP *bl)
blpriv->ldap_port,
blpriv->ldap_rootdn ? blpriv->ldap_rootdn : "");
blpriv->connected = FALSE;
- return GNOME_Evolution_Addressbook_BookListener_RepositoryOffline;
}
+
}
-static void
-ldap_op_add (LDAPOp *op, PASBackend *backend,
- PASBook *book, PASBookView *view,
- int id,
- LDAPOpHandler handler, LDAPOpDtor dtor)
+static ECardSimple *
+search_for_dn_with_objectclasses (PASBackendLDAP *bl, const char *dn, GList **existing_objectclasses)
{
- PASBackendLDAP *bl = PAS_BACKEND_LDAP (backend);
+ LDAP *ldap = bl->priv->ldap;
+ LDAPMessage *res, *e;
+ ECardSimple *result = NULL;
+
+ if (ldap_search_s (ldap,
+ dn,
+ LDAP_SCOPE_BASE,
+ "(objectclass=*)",
+ NULL, 0, &res) == LDAP_SUCCESS) {
+ e = ldap_first_entry (ldap, res);
+ while (NULL != e) {
+ if (!strcmp (ldap_get_dn (ldap, e), dn)) {
+ printf ("found it\n");
+ result = build_card_from_entry (ldap, e, existing_objectclasses);
+ break;
+ }
+ e = ldap_next_entry (ldap, e);
+ }
+ ldap_msgfree(res);
+ }
+
+ return result;
+}
+
+static ECardSimple *
+search_for_dn (PASBackendLDAP *bl, const char *dn)
+{
+ return search_for_dn_with_objectclasses (bl, dn, NULL);
+}
+
+static void
+ldap_op_init (LDAPOp *op, PASBackend *backend,
+ PASBook *book, PASBookView *view,
+ LDAPOpHandler handler, LDAPOpDtor dtor)
+{
op->backend = backend;
op->book = book;
op->view = view;
- op->id = id;
op->handler = handler;
op->dtor = dtor;
+}
+
+static void
+ldap_op_process_current (PASBackend *backend)
+{
+ PASBackendLDAP *bl = PAS_BACKEND_LDAP (backend);
+ LDAPOp *op = bl->priv->current_op;
- g_hash_table_insert (bl->priv->id_to_op,
- &op->id, op);
+ if (!bl->priv->connected) {
+ if (op->view)
+ pas_book_view_notify_status_message (op->view, _("Connecting to LDAP server..."));
+ pas_backend_ldap_connect(bl);
+ }
- bl->priv->active_ops ++;
+ if (bl->priv->connected) {
+ if (op->handler (backend, op))
+ ldap_op_finished (op);
+ }
+ else {
+ if (op->view) {
+ pas_book_view_notify_status_message (op->view, _("Unable to connect to LDAP server."));
+ pas_book_view_notify_complete (op->view);
+ }
- if (bl->priv->poll_timeout == -1)
- bl->priv->poll_timeout = g_timeout_add (LDAP_POLL_INTERVAL,
- (GSourceFunc) poll_ldap,
- bl);
+ ldap_op_finished (op);
+ }
}
static void
-ldap_op_finished (LDAPOp *op)
+ldap_op_process (LDAPOp *op)
+{
+ PASBackendLDAP *bl = PAS_BACKEND_LDAP (op->backend);
+
+ if (bl->priv->current_op) {
+ /* operation in progress. queue this op for later and return. */
+ if (op->view)
+ pas_book_view_notify_status_message (op->view, _("Waiting for connection to LDAP server..."));
+ bl->priv->pending_ops = g_list_append (bl->priv->pending_ops, op);
+ }
+ else {
+ /* nothing going on, do this op now */
+ bl->priv->current_op = op;
+ ldap_op_process_current (op->backend);
+ }
+}
+
+static gboolean
+ldap_op_process_on_idle (PASBackend *backend)
{
- PASBackend *backend = op->backend;
PASBackendLDAP *bl = PAS_BACKEND_LDAP (backend);
- g_hash_table_remove (bl->priv->id_to_op, &op->id);
+ bl->priv->op_idle = 0;
- /* should handle errors here */
- ldap_abandon (bl->priv->ldap, op->id);
+ ldap_op_process_current (backend);
- op->dtor (op);
+ return FALSE;
+}
- bl->priv->active_ops--;
- if (bl->priv->active_ops == 0) {
- if (bl->priv->poll_timeout != -1)
- g_source_remove (bl->priv->poll_timeout);
- bl->priv->poll_timeout = -1;
- }
+static void
+ldap_op_restart (LDAPOp *op)
+{
+ PASBackend *backend = op->backend;
+ PASBackendLDAP *bl = PAS_BACKEND_LDAP (backend);
+
+ g_return_if_fail (op == bl->priv->current_op);
+
+ bl->priv->op_idle = g_idle_add((GSourceFunc)ldap_op_process_on_idle, backend);
}
static void
-ldap_op_change_id (LDAPOp *op, int msg_id)
+ldap_op_finished (LDAPOp *op)
{
PASBackend *backend = op->backend;
PASBackendLDAP *bl = PAS_BACKEND_LDAP (backend);
- g_hash_table_remove (bl->priv->id_to_op, &op->id);
+ g_return_if_fail (op == bl->priv->current_op);
- op->id = msg_id;
+ op->dtor (backend, op);
- g_hash_table_insert (bl->priv->id_to_op,
- &op->id, op);
+ if (bl->priv->pending_ops) {
+ bl->priv->current_op = bl->priv->pending_ops->data;
+ bl->priv->pending_ops = g_list_remove_link (bl->priv->pending_ops, bl->priv->pending_ops);
+
+ bl->priv->op_idle = g_idle_add((GSourceFunc)ldap_op_process_on_idle, backend);
+ }
+ else {
+ bl->priv->current_op = NULL;
+ }
}
static int
@@ -900,184 +817,110 @@ build_mods_from_ecards (PASBackendLDAP *bl, ECardSimple *current, ECardSimple *n
static void
add_objectclass_mod (PASBackendLDAP *bl, GPtrArray *mod_array, GList *existing_objectclasses)
{
+#define FIND_INSERT(oc) \
+ if (!g_list_find_custom (existing_objectclasses, (oc), (GCompareFunc)g_strcasecmp)) \
+ g_ptr_array_add (objectclasses, g_strdup ((oc)))
+#define INSERT(oc) \
+ g_ptr_array_add (objectclasses, g_strdup ((oc)))
+
LDAPMod *objectclass_mod;
+ GPtrArray *objectclasses = g_ptr_array_new();
if (existing_objectclasses) {
- int i = 0;
-
objectclass_mod = g_new (LDAPMod, 1);
objectclass_mod->mod_op = LDAP_MOD_ADD;
objectclass_mod->mod_type = g_strdup ("objectClass");
- objectclass_mod->mod_values = g_new (char*, bl->priv->evolutionPersonSupported ? 6 : 5);
/* yes, this is a linear search for each of our
objectclasses, but really, how many objectclasses
are there going to be in any sane ldap entry? */
-#define FIND_INSERT(oc) \
- if (!g_list_find_custom (existing_objectclasses, (oc), (GCompareFunc)g_strcasecmp)) \
- objectclass_mod->mod_values[i++] = g_strdup ((oc));
-
FIND_INSERT (TOP);
FIND_INSERT (PERSON);
FIND_INSERT (ORGANIZATIONALPERSON);
FIND_INSERT (INETORGPERSON);
+ if (bl->priv->calEntrySupported)
+ FIND_INSERT (CALENTRY);
if (bl->priv->evolutionPersonSupported)
FIND_INSERT (EVOLUTIONPERSON);
- objectclass_mod->mod_values[i] = NULL;
- if (i) {
+ if (objectclasses->len) {
+ g_ptr_array_add (objectclasses, NULL);
+ objectclass_mod->mod_values = (char**)objectclasses->pdata;
g_ptr_array_add (mod_array, objectclass_mod);
+ g_ptr_array_free (objectclasses, FALSE);
}
else {
+ g_ptr_array_free (objectclasses, TRUE);
g_free (objectclass_mod->mod_type);
- g_free (objectclass_mod->mod_values);
g_free (objectclass_mod);
}
+
}
else {
objectclass_mod = g_new (LDAPMod, 1);
objectclass_mod->mod_op = LDAP_MOD_ADD;
objectclass_mod->mod_type = g_strdup ("objectClass");
- objectclass_mod->mod_values = g_new (char*, bl->priv->evolutionPersonSupported ? 6 : 5);
- objectclass_mod->mod_values[0] = g_strdup (TOP);
- objectclass_mod->mod_values[1] = g_strdup (PERSON);
- objectclass_mod->mod_values[2] = g_strdup (ORGANIZATIONALPERSON);
- objectclass_mod->mod_values[3] = g_strdup (INETORGPERSON);
- if (bl->priv->evolutionPersonSupported) {
- objectclass_mod->mod_values[4] = g_strdup (EVOLUTIONPERSON);
- objectclass_mod->mod_values[5] = NULL;
- }
- else {
- objectclass_mod->mod_values[4] = NULL;
- }
+
+ INSERT(TOP);
+ INSERT(PERSON);
+ INSERT(ORGANIZATIONALPERSON);
+ INSERT(INETORGPERSON);
+ if (bl->priv->calEntrySupported)
+ INSERT(CALENTRY);
+ if (bl->priv->evolutionPersonSupported)
+ INSERT(EVOLUTIONPERSON);
+ g_ptr_array_add (objectclasses, NULL);
+ objectclass_mod->mod_values = (char**)objectclasses->pdata;
g_ptr_array_add (mod_array, objectclass_mod);
+ g_ptr_array_free (objectclasses, FALSE);
}
}
typedef struct {
LDAPOp op;
- char *dn;
- ECardSimple *new_card;
+ char *vcard;
} LDAPCreateOp;
-static void
-create_card_handler (LDAPOp *op, LDAPMessage *res)
-{
- LDAPCreateOp *create_op = (LDAPCreateOp*)op;
- PASBackendLDAP *bl = PAS_BACKEND_LDAP (op->backend);
- LDAP *ldap = bl->priv->ldap;
- int ldap_error;
- int response;
-
- if (LDAP_RES_ADD != ldap_msgtype (res)) {
- g_warning ("incorrect msg type %d passed to create_card_handler", ldap_msgtype (res));
- pas_book_respond_create (op->book,
- GNOME_Evolution_Addressbook_BookListener_OtherError,
- create_op->dn);
- ldap_op_finished (op);
- return;
- }
-
- ldap_parse_result (ldap, res, &ldap_error,
- NULL, NULL, NULL, NULL, 0);
-
- if (ldap_error == LDAP_SUCCESS) {
- /* the card was created, let's let the views know about it */
- GList *l;
- for (l = bl->priv->book_views; l; l = l->next) {
- CORBA_Environment ev;
- gboolean match;
- PASBackendLDAPBookView *view = l->data;
-
- CORBA_exception_init(&ev);
-
- bonobo_object_dup_ref(bonobo_object_corba_objref(BONOBO_OBJECT(view->book_view)), &ev);
-
- match = pas_backend_card_sexp_match_vcard (view->card_sexp,
- e_card_simple_get_vcard_assume_utf8 (create_op->new_card));
- if (match) {
- char *vcard = e_card_simple_get_vcard_assume_utf8 (create_op->new_card);
- pas_book_view_notify_add_1 (view->book_view,
- vcard);
- g_free (vcard);
- }
- pas_book_view_notify_complete (view->book_view);
-
- bonobo_object_release_unref(bonobo_object_corba_objref(BONOBO_OBJECT(view->book_view)), &ev);
- }
- }
- else {
- ldap_perror (ldap, "create_card");
- }
-
- if (op->view)
- pas_book_view_notify_complete (op->view);
-
- /* and lastly respond */
- response = ldap_error_to_response (ldap_error);
- pas_book_respond_create (op->book,
- response,
- create_op->dn);
-
- ldap_op_finished (op);
-}
-
-static void
-create_card_dtor (LDAPOp *op)
+static gboolean
+create_card_handler (PASBackend *backend, LDAPOp *op)
{
LDAPCreateOp *create_op = (LDAPCreateOp*)op;
-
- g_free (create_op->dn);
- gtk_object_unref (GTK_OBJECT (create_op->new_card));
- g_free (create_op);
-}
-
-static void
-pas_backend_ldap_process_create_card (PASBackend *backend,
- PASBook *book,
- PASRequest *req)
-{
- LDAPCreateOp *create_op = g_new (LDAPCreateOp, 1);
PASBackendLDAP *bl = PAS_BACKEND_LDAP (backend);
- PASBookView *book_view = NULL;
- int create_card_msgid;
ECard *new_ecard;
+ ECardSimple *new_card;
+ char *dn;
int response;
- int err;
+ int ldap_error;
GPtrArray *mod_array;
LDAPMod **ldap_mods;
LDAP *ldap;
- if (bl->priv->book_views) {
- PASBackendLDAPBookView *v = bl->priv->book_views->data;
- book_view = v->book_view;
- }
-
- printf ("vcard = %s\n", req->create.vcard);
+ printf ("vcard = %s\n", create_op->vcard);
- new_ecard = e_card_new (req->create.vcard);
- create_op->new_card = e_card_simple_new (new_ecard);
+ new_ecard = e_card_new (create_op->vcard);
+ new_card = e_card_simple_new (new_ecard);
- create_op->dn = create_dn_from_ecard (create_op->new_card, bl->priv->ldap_rootdn);
- e_card_simple_set_id (create_op->new_card, create_op->dn); /* for the notification code below */
+ dn = create_dn_from_ecard (new_card, bl->priv->ldap_rootdn);
+ e_card_simple_set_id (new_card, dn); /* for the notification code below */
ldap = bl->priv->ldap;
/* build our mods */
- mod_array = build_mods_from_ecards (bl, NULL, create_op->new_card, NULL);
+ mod_array = build_mods_from_ecards (bl, NULL, new_card, NULL);
#if 0
if (!mod_array) {
/* there's an illegal field in there. report
UnsupportedAttribute back */
- pas_book_respond_create (book,
+ g_free (dn);
+
+ gtk_object_unref (GTK_OBJECT(new_card));
+
+ pas_book_respond_create (create_op->op.book,
GNOME_Evolution_Addressbook_BookListener_UnsupportedField,
- create_op->dn);
+ dn);
- g_free (create_op->dn);
- gtk_object_unref (GTK_OBJECT(create_op->new_card));
- g_free (create_op);
- return;
+ return TRUE;
}
#endif
@@ -1127,29 +970,90 @@ pas_backend_ldap_process_create_card (PASBackend *backend,
ldap_mods = (LDAPMod**)mod_array->pdata;
- if (book_view)
- pas_book_view_notify_status_message (book_view, _("Adding card to LDAP server..."));
+ if (op->view)
+ pas_book_view_notify_status_message (op->view, _("Adding card to LDAP server..."));
- err = ldap_add_ext (ldap, create_op->dn, ldap_mods,
- NULL, NULL, &create_card_msgid);
+ /* actually perform the ldap add */
+ ldap_error = ldap_add_s (ldap, dn, ldap_mods);
- /* and clean up */
- free_mods (mod_array);
+ if (ldap_error == LDAP_SUCCESS) {
+ /* the card was created, let's let the views know about it */
+ GList *l;
+ for (l = bl->priv->book_views; l; l = l->next) {
+ CORBA_Environment ev;
+ gboolean match;
+ PASBackendLDAPBookView *view = l->data;
+
+ CORBA_exception_init(&ev);
- if (LDAP_SUCCESS != err) {
- response = ldap_error_to_response (err);
- pas_book_respond_create (create_op->op.book,
- response,
- create_op->dn);
- create_card_dtor ((LDAPOp*)create_op);
- return;
+ bonobo_object_dup_ref(bonobo_object_corba_objref(BONOBO_OBJECT(view->book_view)), &ev);
+
+ match = pas_backend_card_sexp_match_vcard (view->card_sexp,
+ e_card_simple_get_vcard_assume_utf8 (new_card));
+ if (match)
+ pas_book_view_notify_add_1 (view->book_view, e_card_simple_get_vcard_assume_utf8 (new_card));
+ pas_book_view_notify_complete (view->book_view);
+
+ bonobo_object_release_unref(bonobo_object_corba_objref(BONOBO_OBJECT(view->book_view)), &ev);
+ }
}
else {
- g_print ("ldap_add_ext returned %d\n", err);
- ldap_op_add ((LDAPOp*)create_op, backend, book,
- book_view, create_card_msgid,
- create_card_handler, create_card_dtor);
+ ldap_perror (ldap, "ldap_add_s");
}
+
+ if (op->view)
+ pas_book_view_notify_complete (op->view);
+
+ /* and clean up */
+ free_mods (mod_array);
+ g_free (dn);
+
+ gtk_object_unref (GTK_OBJECT(new_card));
+
+ /* and lastly respond */
+ response = ldap_error_to_response (ldap_error);
+ pas_book_respond_create (create_op->op.book,
+ response,
+ dn);
+
+ /* we're synchronous */
+ return TRUE;
+}
+
+static void
+create_card_dtor (PASBackend *backend, LDAPOp *op)
+{
+ LDAPCreateOp *create_op = (LDAPCreateOp*)op;
+
+ if (op->view)
+ bonobo_object_release_unref(bonobo_object_corba_objref(BONOBO_OBJECT(op->view)), NULL);
+
+ g_free (create_op->vcard);
+ g_free (create_op);
+}
+
+static void
+pas_backend_ldap_process_create_card (PASBackend *backend,
+ PASBook *book,
+ PASRequest *req)
+{
+ LDAPCreateOp *create_op = g_new (LDAPCreateOp, 1);
+ PASBackendLDAP *bl = PAS_BACKEND_LDAP (backend);
+ PASBookView *book_view = NULL;
+
+ if (bl->priv->book_views) {
+ PASBackendLDAPBookView *v = bl->priv->book_views->data;
+ book_view = v->book_view;
+ bonobo_object_dup_ref(bonobo_object_corba_objref(BONOBO_OBJECT(book_view)), NULL);
+ }
+
+ ldap_op_init ((LDAPOp*)create_op, backend, book,
+ book_view,
+ create_card_handler, create_card_dtor);
+
+ create_op->vcard = req->vcard;
+
+ ldap_op_process ((LDAPOp*)create_op);
}
@@ -1158,56 +1062,71 @@ typedef struct {
char *id;
} LDAPRemoveOp;
-static void
-remove_card_handler (LDAPOp *op, LDAPMessage *res)
+static gboolean
+remove_card_handler (PASBackend *backend, LDAPOp *op)
{
LDAPRemoveOp *remove_op = (LDAPRemoveOp*)op;
- PASBackendLDAP *bl = PAS_BACKEND_LDAP (op->backend);
+ PASBackendLDAP *bl = PAS_BACKEND_LDAP (backend);
+ int response;
int ldap_error;
+ ECardSimple *simple;
- if (LDAP_RES_DELETE != ldap_msgtype (res)) {
- g_warning ("incorrect msg type %d passed to remove_card_handler", ldap_msgtype (res));
- pas_book_respond_remove (op->book,
- GNOME_Evolution_Addressbook_BookListener_OtherError);
- ldap_op_finished (op);
- return;
- }
+ if (op->view)
+ pas_book_view_notify_status_message (op->view, _("Removing card from LDAP server..."));
- ldap_parse_result (bl->priv->ldap, res, &ldap_error,
- NULL, NULL, NULL, NULL, 0);
+ simple = search_for_dn (bl, remove_op->id);
- if (ldap_error == LDAP_SUCCESS) {
- /* the card was removed, let's let the views know about it */
- GList *l;
- for (l = bl->priv->book_views; l; l = l->next) {
- CORBA_Environment ev;
- PASBackendLDAPBookView *view = l->data;
+ if (simple) {
+ ldap_error = ldap_delete_s (bl->priv->ldap, remove_op->id);
+
+ if (ldap_error == LDAP_SUCCESS) {
+ /* the card was removed, let's let the views know about it */
+ GList *l;
+ for (l = bl->priv->book_views; l; l = l->next) {
+ CORBA_Environment ev;
+ gboolean match;
+ PASBackendLDAPBookView *view = l->data;
- CORBA_exception_init(&ev);
+ CORBA_exception_init(&ev);
- bonobo_object_dup_ref(bonobo_object_corba_objref(BONOBO_OBJECT(view->book_view)), &ev);
+ bonobo_object_dup_ref(bonobo_object_corba_objref(BONOBO_OBJECT(view->book_view)), &ev);
- pas_book_view_notify_remove (view->book_view, remove_op->id);
+ match = pas_backend_card_sexp_match_vcard (view->card_sexp,
+ e_card_simple_get_vcard_assume_utf8 (simple));
+ if (match)
+ pas_book_view_notify_remove (view->book_view, remove_op->id);
+ pas_book_view_notify_complete (view->book_view);
- bonobo_object_release_unref(bonobo_object_corba_objref(BONOBO_OBJECT(view->book_view)), &ev);
+ bonobo_object_release_unref(bonobo_object_corba_objref(BONOBO_OBJECT(view->book_view)), &ev);
+ }
}
+ else {
+ ldap_perror (bl->priv->ldap, "ldap_delete_s");
+ }
+
+ response = ldap_error_to_response (ldap_error);
}
- else {
- ldap_perror (bl->priv->ldap, "remove_card");
- }
+ else
+ response = GNOME_Evolution_Addressbook_BookListener_CardNotFound;
pas_book_respond_remove (remove_op->op.book,
- ldap_error_to_response (ldap_error));
+ response);
if (op->view)
pas_book_view_notify_complete (op->view);
+
+ /* we're synchronous */
+ return TRUE;
}
static void
-remove_card_dtor (LDAPOp *op)
+remove_card_dtor (PASBackend *backend, LDAPOp *op)
{
LDAPRemoveOp *remove_op = (LDAPRemoveOp*)op;
+ if (op->view)
+ bonobo_object_release_unref(bonobo_object_corba_objref(BONOBO_OBJECT(op->view)), NULL);
+
g_free (remove_op->id);
g_free (remove_op);
}
@@ -1220,175 +1139,67 @@ pas_backend_ldap_process_remove_card (PASBackend *backend,
LDAPRemoveOp *remove_op = g_new (LDAPRemoveOp, 1);
PASBackendLDAP *bl = PAS_BACKEND_LDAP (backend);
PASBookView *book_view = NULL;
- int remove_msgid;
- int ldap_error;
if (bl->priv->book_views) {
PASBackendLDAPBookView *v = bl->priv->book_views->data;
book_view = v->book_view;
+ bonobo_object_dup_ref(bonobo_object_corba_objref(BONOBO_OBJECT(book_view)), NULL);
}
- remove_op->id = g_strdup (req->remove.id);
-
- if (book_view)
- pas_book_view_notify_status_message (book_view, _("Removing card from LDAP server..."));
+ ldap_op_init ((LDAPOp*)remove_op, backend, book,
+ book_view,
+ remove_card_handler, remove_card_dtor);
- ldap_error = ldap_delete_ext (bl->priv->ldap,
- remove_op->id,
- NULL, NULL, &remove_msgid);
+ remove_op->id = req->id;
- if (ldap_error != LDAP_SUCCESS) {
- pas_book_respond_remove (remove_op->op.book,
- ldap_error_to_response (ldap_error));
- remove_card_dtor ((LDAPOp*)remove_op);
- return;
- }
- else {
- g_print ("ldap_delete_ext returned %d\n", ldap_error);
- ldap_op_add ((LDAPOp*)remove_op, backend, book,
- book_view, remove_msgid,
- remove_card_handler, remove_card_dtor);
- }
+ ldap_op_process ((LDAPOp*)remove_op);
}
-/*
-** MODIFY
-**
-** The modification request is actually composed of 2 separate
-** requests. Since we need to get a list of theexisting objectclasses
-** used by the ldap server for the entry, and since the UI only sends
-** us the current card, we need to query the ldap server for the
-** existing card.
-**
-*/
-
typedef struct {
LDAPOp op;
- const char *id; /* the id of the card we're modifying */
- char *current_vcard; /* current in the LDAP db */
- ECardSimple *current_card;
- char *vcard; /* the VCard we want to store */
- ECardSimple *card;
- GList *existing_objectclasses;
+ char *vcard;
} LDAPModifyOp;
-static void
-modify_card_modify_handler (LDAPOp *op, LDAPMessage *res)
+static gboolean
+modify_card_handler (PASBackend *backend, LDAPOp *op)
{
LDAPModifyOp *modify_op = (LDAPModifyOp*)op;
- PASBackendLDAP *bl = PAS_BACKEND_LDAP (op->backend);
- LDAP *ldap = bl->priv->ldap;
- int ldap_error;
-
- if (LDAP_RES_MODIFY != ldap_msgtype (res)) {
- g_warning ("incorrect msg type %d passed to modify_card_handler", ldap_msgtype (res));
- pas_book_respond_modify (op->book,
- GNOME_Evolution_Addressbook_BookListener_OtherError);
- ldap_op_finished (op);
- return;
- }
-
- ldap_parse_result (ldap, res, &ldap_error,
- NULL, NULL, NULL, NULL, 0);
-
- if (ldap_error == LDAP_SUCCESS) {
- /* the card was modified, let's let the views know about it */
- GList *l;
- for (l = bl->priv->book_views; l; l = l->next) {
- CORBA_Environment ev;
- gboolean old_match, new_match;
- PASBackendLDAPBookView *view = l->data;
-
- CORBA_exception_init(&ev);
-
- bonobo_object_dup_ref(bonobo_object_corba_objref(BONOBO_OBJECT(view->book_view)), &ev);
-
- old_match = pas_backend_card_sexp_match_vcard (view->card_sexp,
- modify_op->current_vcard);
- new_match = pas_backend_card_sexp_match_vcard (view->card_sexp,
- modify_op->vcard);
- if (old_match && new_match)
- pas_book_view_notify_change_1 (view->book_view, modify_op->vcard);
- else if (new_match)
- pas_book_view_notify_add_1 (view->book_view, modify_op->vcard);
- else /* if (old_match) */
- pas_book_view_notify_remove (view->book_view, e_card_simple_get_id (modify_op->card));
- pas_book_view_notify_complete (view->book_view);
-
- bonobo_object_release_unref(bonobo_object_corba_objref(BONOBO_OBJECT(view->book_view)), &ev);
- }
- }
- else {
- ldap_perror (ldap, "ldap_modify_s");
- }
-
- /* and lastly respond */
- pas_book_respond_modify (op->book,
- ldap_error_to_response (ldap_error));
- ldap_op_finished (op);
-}
+ PASBackendLDAP *bl = PAS_BACKEND_LDAP (backend);
+ ECard *new_ecard;
+ const char *id;
+ int response;
+ int ldap_error = LDAP_SUCCESS;
+ GPtrArray *mod_array;
+ LDAPMod **ldap_mods;
+ LDAP *ldap;
+ ECardSimple *current_card;
+ GList *existing_objectclasses = NULL;
-static void
-modify_card_search_handler (LDAPOp *op, LDAPMessage *res)
-{
- LDAPModifyOp *modify_op = (LDAPModifyOp*)op;
- PASBackendLDAP *bl = PAS_BACKEND_LDAP (op->backend);
- LDAP *ldap = bl->priv->ldap;
- int msg_type;
+ new_ecard = e_card_new (modify_op->vcard);
+ id = e_card_get_id(new_ecard);
- /* if it's successful, we should get called with a
- RES_SEARCH_ENTRY and a RES_SEARCH_RESULT. if it's
- unsuccessful, we should only see a RES_SEARCH_RESULT */
+ ldap = bl->priv->ldap;
- msg_type = ldap_msgtype (res);
- if (msg_type == LDAP_RES_SEARCH_ENTRY) {
- LDAPMessage *e = ldap_first_entry(ldap, res);
+ if (op->view)
+ pas_book_view_notify_status_message (op->view, _("Modifying card from LDAP server..."));
- if (!e) {
- g_warning ("uh, this shouldn't happen");
- pas_book_respond_modify (op->book,
- GNOME_Evolution_Addressbook_BookListener_OtherError);
- ldap_op_finished (op);
- return;
- }
+ current_card = search_for_dn_with_objectclasses (bl, id, &existing_objectclasses);
- modify_op->current_card = build_card_from_entry (ldap, e,
- &modify_op->existing_objectclasses);
- modify_op->current_vcard = e_card_simple_get_vcard_assume_utf8 (modify_op->current_card);
- }
- else if (msg_type == LDAP_RES_SEARCH_RESULT) {
- int ldap_error;
- LDAPMod **ldap_mods;
- GPtrArray *mod_array;
- gboolean differences;
+ if (current_card) {
+ ECardSimple *new_card = e_card_simple_new (new_ecard);
gboolean need_new_dn;
- int modify_card_msgid;
-
- /* grab the result code, and set up the actual modify
- if it was successful */
- ldap_parse_result (bl->priv->ldap, res, &ldap_error,
- NULL, NULL, NULL, NULL, 0);
-
- if (ldap_error != LDAP_SUCCESS) {
- /* more here i'm sure */
- pas_book_respond_modify (op->book,
- ldap_error_to_response (ldap_error));
- ldap_op_finished (op);
- return;
- }
/* build our mods */
- mod_array = build_mods_from_ecards (bl, modify_op->current_card, modify_op->card, &need_new_dn);
- differences = mod_array->len > 0;
+ mod_array = build_mods_from_ecards (bl, current_card, new_card, &need_new_dn);
+ if (mod_array->len > 0) {
- if (differences) {
/* remove the NULL at the end */
g_ptr_array_remove (mod_array, NULL);
/* add our objectclass(es), making sure
- evolutionPerson is there if it's supported */
- add_objectclass_mod (bl, mod_array, modify_op->existing_objectclasses);
+ evolutionPerson is there if it's supported */
+ add_objectclass_mod (bl, mod_array, existing_objectclasses);
/* then put the NULL back */
g_ptr_array_add (mod_array, NULL);
@@ -1396,47 +1207,74 @@ modify_card_search_handler (LDAPOp *op, LDAPMessage *res)
ldap_mods = (LDAPMod**)mod_array->pdata;
/* actually perform the ldap modify */
- ldap_error = ldap_modify_ext (ldap, modify_op->id, ldap_mods,
- NULL, NULL, &modify_card_msgid);
-
+ ldap_error = ldap_modify_ext_s (ldap, id, ldap_mods, NULL, NULL);
if (ldap_error == LDAP_SUCCESS) {
- op->handler = modify_card_modify_handler;
- ldap_op_change_id ((LDAPOp*)modify_op,
- modify_card_msgid);
+
+ /* the card was modified, let's let the views know about it */
+ GList *l;
+ for (l = bl->priv->book_views; l; l = l->next) {
+ CORBA_Environment ev;
+ gboolean old_match, new_match;
+ PASBackendLDAPBookView *view = l->data;
+
+ CORBA_exception_init(&ev);
+
+ bonobo_object_dup_ref(bonobo_object_corba_objref(BONOBO_OBJECT(view->book_view)), &ev);
+
+ old_match = pas_backend_card_sexp_match_vcard (view->card_sexp,
+ e_card_simple_get_vcard_assume_utf8 (current_card));
+ new_match = pas_backend_card_sexp_match_vcard (view->card_sexp,
+ modify_op->vcard);
+ if (old_match && new_match)
+ pas_book_view_notify_change_1 (view->book_view, modify_op->vcard);
+ else if (new_match)
+ pas_book_view_notify_add_1 (view->book_view, modify_op->vcard);
+ else /* if (old_match) */
+ pas_book_view_notify_remove (view->book_view, e_card_simple_get_id (new_card));
+ pas_book_view_notify_complete (view->book_view);
+
+ bonobo_object_release_unref(bonobo_object_corba_objref(BONOBO_OBJECT(view->book_view)), &ev);
+ }
}
else {
- g_warning ("ldap_modify_ext returned %d\n", ldap_error);
- pas_book_respond_modify (op->book,
- ldap_error_to_response (ldap_error));
- ldap_op_finished (op);
- return;
+ ldap_perror (ldap, "ldap_modify_s");
}
}
+ else {
+ g_print ("modify list empty. no modification sent\n");
+ }
/* and clean up */
free_mods (mod_array);
+ g_list_foreach (existing_objectclasses, (GFunc)g_free, NULL);
+ g_list_free (existing_objectclasses);
+ gtk_object_unref (GTK_OBJECT(new_card));
+ gtk_object_unref (GTK_OBJECT(current_card));
}
else {
- g_warning ("unhandled result type %d returned", msg_type);
- pas_book_respond_modify (op->book,
- GNOME_Evolution_Addressbook_BookListener_OtherError);
- ldap_op_finished (op);
+ g_print ("didn't find original card\n");
}
+
+ response = ldap_error_to_response (ldap_error);
+ pas_book_respond_modify (modify_op->op.book,
+ response);
+
+ if (op->view)
+ pas_book_view_notify_complete (op->view);
+
+ /* we're synchronous */
+ return TRUE;
}
static void
-modify_card_dtor (LDAPOp *op)
+modify_card_dtor (PASBackend *backend, LDAPOp *op)
{
LDAPModifyOp *modify_op = (LDAPModifyOp*)op;
- g_list_foreach (modify_op->existing_objectclasses, (GFunc)g_free, NULL);
- g_list_free (modify_op->existing_objectclasses);
- g_free (modify_op->current_vcard);
- if (modify_op->current_card)
- gtk_object_unref (GTK_OBJECT (modify_op->current_card));
+ if (op->view)
+ bonobo_object_release_unref(bonobo_object_corba_objref(BONOBO_OBJECT(op->view)), NULL);
+
g_free (modify_op->vcard);
- if (modify_op->card)
- gtk_object_unref (GTK_OBJECT (modify_op->card));
g_free (modify_op);
}
@@ -1445,154 +1283,55 @@ pas_backend_ldap_process_modify_card (PASBackend *backend,
PASBook *book,
PASRequest *req)
{
- LDAPModifyOp *modify_op = g_new0 (LDAPModifyOp, 1);
+ LDAPModifyOp *modify_op = g_new (LDAPModifyOp, 1);
PASBackendLDAP *bl = PAS_BACKEND_LDAP (backend);
- ECard *new_ecard;
- int ldap_error;
- LDAP *ldap;
- int modify_card_msgid;
PASBookView *book_view = NULL;
if (bl->priv->book_views) {
PASBackendLDAPBookView *v = bl->priv->book_views->data;
book_view = v->book_view;
+ bonobo_object_dup_ref(bonobo_object_corba_objref(BONOBO_OBJECT(book_view)), NULL);
}
- modify_op->vcard = g_strdup (req->modify.vcard);
- new_ecard = e_card_new (modify_op->vcard);
- modify_op->card = e_card_simple_new (new_ecard);
- gtk_object_unref (GTK_OBJECT (new_ecard));
- modify_op->id = e_card_simple_get_id(modify_op->card);
-
- ldap = bl->priv->ldap;
+ ldap_op_init ((LDAPOp*)modify_op, backend, book,
+ book_view,
+ modify_card_handler, modify_card_dtor);
- if (book_view)
- pas_book_view_notify_status_message (book_view, _("Modifying card from LDAP server..."));
+ modify_op->vcard = req->vcard;
- ldap_error = ldap_search_ext (ldap, modify_op->id,
- LDAP_SCOPE_BASE,
- "(objectclass=*)",
- NULL, 0, NULL, NULL,
- NULL, /* XXX timeout */
- 1, &modify_card_msgid);
-
- if (ldap_error == LDAP_SUCCESS) {
- ldap_op_add ((LDAPOp*)modify_op, backend, book,
- book_view, modify_card_msgid,
- modify_card_search_handler, modify_card_dtor);
- }
- else {
- g_warning ("ldap_search_ext returned %d\n", ldap_error);
- pas_book_respond_modify (book,
- GNOME_Evolution_Addressbook_BookListener_OtherError);
- modify_card_dtor ((LDAPOp*)modify_op);
- }
+ ldap_op_process ((LDAPOp*)modify_op);
}
-typedef struct {
- LDAPOp op;
-} LDAPGetVCardOp;
-
-static void
-get_vcard_handler (LDAPOp *op, LDAPMessage *res)
-{
- PASBackendLDAP *bl = PAS_BACKEND_LDAP (op->backend);
- int msg_type;
-
- /* the msg_type will be either SEARCH_ENTRY (if we're
- successful) or SEARCH_RESULT (if we're not), so we finish
- the op after either */
- msg_type = ldap_msgtype (res);
- if (msg_type == LDAP_RES_SEARCH_ENTRY) {
- LDAPMessage *e = ldap_first_entry(bl->priv->ldap, res);
- ECardSimple *simple;
- char *vcard;
-
- if (!e) {
- g_warning ("uh, this shouldn't happen");
- pas_book_respond_get_vcard (op->book,
- GNOME_Evolution_Addressbook_BookListener_OtherError,
- "");
- ldap_op_finished (op);
- return;
- }
-
- simple = build_card_from_entry (bl->priv->ldap, e, NULL);
- vcard = e_card_simple_get_vcard_assume_utf8 (simple);
- pas_book_respond_get_vcard (op->book,
- GNOME_Evolution_Addressbook_BookListener_Success,
- vcard);
- g_free (vcard);
- gtk_object_unref (GTK_OBJECT (simple));
- ldap_op_finished (op);
- }
- else if (msg_type == LDAP_RES_SEARCH_RESULT) {
- int ldap_error;
- ldap_parse_result (bl->priv->ldap, res, &ldap_error,
- NULL, NULL, NULL, NULL, 0);
- pas_book_respond_get_vcard (op->book, ldap_error_to_response (ldap_error), "");
- ldap_op_finished (op);
- }
- else {
- g_warning ("unhandled result type %d returned", msg_type);
- pas_book_respond_get_vcard (op->book, GNOME_Evolution_Addressbook_BookListener_OtherError,
- "");
- ldap_op_finished (op);
- }
-
-}
-
-static void
-get_vcard_dtor (LDAPOp *op)
-{
- LDAPGetVCardOp *get_vcard_op = (LDAPGetVCardOp*)op;
-
- g_free (get_vcard_op);
-}
-
static void
pas_backend_ldap_process_get_vcard (PASBackend *backend,
PASBook *book,
PASRequest *req)
{
- LDAPGetVCardOp *get_vcard_op = g_new0 (LDAPGetVCardOp, 1);
- PASBackendLDAP *bl = PAS_BACKEND_LDAP (backend);
- LDAP *ldap = bl->priv->ldap;
- int get_vcard_msgid;
- PASBookView *book_view = NULL;
- int ldap_error;
+ PASBackendLDAP *bl;
+ ECardSimple *simple;
- if (bl->priv->book_views) {
- PASBackendLDAPBookView *v = bl->priv->book_views->data;
- book_view = v->book_view;
- }
-
- ldap_error = ldap_search_ext (ldap, req->get_vcard.id,
- LDAP_SCOPE_BASE,
- "(objectclass=*)",
- NULL, 0, NULL, NULL,
- NULL, /* XXX timeout */
- 1, &get_vcard_msgid);
+ bl = PAS_BACKEND_LDAP (pas_book_get_backend (book));
- if (ldap_error == LDAP_SUCCESS) {
- ldap_op_add ((LDAPOp*)get_vcard_op, backend, book,
- book_view, get_vcard_msgid,
- get_vcard_handler, get_vcard_dtor);
+ simple = search_for_dn (bl, req->id);
+
+ if (simple) {
+ pas_book_respond_get_vcard (book,
+ GNOME_Evolution_Addressbook_BookListener_Success,
+ e_card_simple_get_vcard_assume_utf8 (simple));
+ gtk_object_unref (GTK_OBJECT (simple));
}
else {
pas_book_respond_get_vcard (book,
- ldap_error_to_response (ldap_error),
+ GNOME_Evolution_Addressbook_BookListener_CardNotFound,
"");
- get_vcard_dtor ((LDAPOp*)get_vcard_op);
}
}
typedef struct {
LDAPOp op;
- PASBackendLDAPCursorPrivate *cursor_data;
- gboolean responded; /* if FALSE, we need to free cursor_data in the dtor */
+ PASBook *book;
} LDAPGetCursorOp;
static long
@@ -1616,26 +1355,23 @@ get_nth(PASCardCursor *cursor, long n, gpointer data)
static void
cursor_destroy(GtkObject *object, gpointer data)
{
+ CORBA_Environment ev;
+ GNOME_Evolution_Addressbook_Book corba_book;
PASBackendLDAPCursorPrivate *cursor_data = (PASBackendLDAPCursorPrivate *) data;
- if (cursor_data->book) {
- CORBA_Environment ev;
- GNOME_Evolution_Addressbook_Book corba_book;
-
- corba_book = bonobo_object_corba_objref(BONOBO_OBJECT(cursor_data->book));
+ corba_book = bonobo_object_corba_objref(BONOBO_OBJECT(cursor_data->book));
- CORBA_exception_init(&ev);
+ CORBA_exception_init(&ev);
- GNOME_Evolution_Addressbook_Book_unref(corba_book, &ev);
+ GNOME_Evolution_Addressbook_Book_unref(corba_book, &ev);
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning("cursor_destroy: Exception unreffing "
- "corba book.\n");
- }
-
- CORBA_exception_free(&ev);
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ g_warning("cursor_destroy: Exception unreffing "
+ "corba book.\n");
}
+ CORBA_exception_free(&ev);
+
/* free the ldap specific cursor information */
g_list_foreach (cursor_data->elements, (GFunc)g_free, NULL);
g_list_free (cursor_data->elements);
@@ -1644,72 +1380,97 @@ cursor_destroy(GtkObject *object, gpointer data)
}
static void
-get_cursor_handler (LDAPOp *op, LDAPMessage *res)
+pas_backend_ldap_build_all_cards_list(PASBackend *backend,
+ PASBackendLDAPCursorPrivate *cursor_data)
{
- LDAPGetCursorOp *cursor_op = (LDAPGetCursorOp*)op;
- PASBackendLDAP *bl = PAS_BACKEND_LDAP (op->backend);
- LDAP *ldap = bl->priv->ldap;
- int msg_type;
-
- msg_type = ldap_msgtype (res);
- if (msg_type == LDAP_RES_SEARCH_ENTRY) {
- LDAPMessage *e;
+ PASBackendLDAP *bl = PAS_BACKEND_LDAP (backend);
+ LDAP *ldap = bl->priv->ldap;
+ int ldap_error;
+ LDAPMessage *res, *e;
- e = ldap_first_entry (ldap, res);
- while (e) {
- ECardSimple *simple;
-
- simple = build_card_from_entry (ldap, e, NULL);
- if (simple) {
- char *vcard = e_card_simple_get_vcard_assume_utf8 (simple);
- cursor_op->cursor_data->num_elements ++;
- cursor_op->cursor_data->elements = g_list_prepend (cursor_op->cursor_data->elements,
- vcard);
- gtk_object_unref (GTK_OBJECT (simple));
- }
- }
+ if ((ldap_error = ldap_search_s (ldap,
+ bl->priv->ldap_rootdn,
+ bl->priv->ldap_scope,
+ "(objectclass=*)",
+ NULL, 0, &res)) != LDAP_SUCCESS) {
+ g_warning ("ldap error '%s' in "
+ "pas_backend_ldap_build_all_cards_list\n",
+ ldap_err2string(ldap_error));
}
- else if (msg_type == LDAP_RES_SEARCH_RESULT) {
- PASCardCursor *cursor = CORBA_OBJECT_NIL;
- int ldap_error;
- ldap_parse_result (bl->priv->ldap, res, &ldap_error,
- NULL, NULL, NULL, NULL, 0);
- if (ldap_error == LDAP_SUCCESS) {
- cursor = pas_card_cursor_new(get_length,
- get_nth,
- cursor_op->cursor_data);
+ cursor_data->elements = NULL;
- gtk_signal_connect(GTK_OBJECT(cursor), "destroy",
- GTK_SIGNAL_FUNC(cursor_destroy), cursor_op->cursor_data);
+ cursor_data->num_elements = ldap_count_entries (ldap, res);
- cursor_op->responded = TRUE;
- }
+ e = ldap_first_entry(ldap, res);
- pas_book_respond_get_cursor (cursor_op->cursor_data->book,
- ldap_error_to_response (ldap_error),
- cursor);
+ while (NULL != e) {
- ldap_op_finished (op);
- }
- else {
- g_warning ("unhandled result type %d returned", msg_type);
- pas_book_respond_get_cursor (op->book,
- GNOME_Evolution_Addressbook_BookListener_OtherError,
- CORBA_OBJECT_NIL);
- ldap_op_finished (op);
+ /* for now just make a list of the dn's */
+#if 0
+ for ( a = ldap_first_attribute( ldap, e, &ber ); a != NULL;
+ a = ldap_next_attribute( ldap, e, ber ) ) {
+ }
+#else
+ cursor_data->elements = g_list_prepend(cursor_data->elements,
+ g_strdup(ldap_get_dn(ldap, e)));
+#endif
+
+ e = ldap_next_entry(ldap, e);
}
+
+ ldap_msgfree(res);
}
-static void
-get_cursor_dtor (LDAPOp *op)
+
+static gboolean
+get_cursor_handler (PASBackend *backend, LDAPOp *op)
{
LDAPGetCursorOp *cursor_op = (LDAPGetCursorOp*)op;
+ CORBA_Environment ev;
+ int ldap_error = 0;
+ PASCardCursor *cursor;
+ GNOME_Evolution_Addressbook_Book corba_book;
+ PASBackendLDAPCursorPrivate *cursor_data;
+ PASBook *book = cursor_op->book;
+
+ cursor_data = g_new(PASBackendLDAPCursorPrivate, 1);
+ cursor_data->backend = backend;
+ cursor_data->book = book;
+
+ pas_backend_ldap_build_all_cards_list(backend, cursor_data);
+
+ corba_book = bonobo_object_corba_objref(BONOBO_OBJECT(book));
+
+ CORBA_exception_init(&ev);
- if (!cursor_op->responded) {
- cursor_destroy (NULL, cursor_op->cursor_data);
+ GNOME_Evolution_Addressbook_Book_ref(corba_book, &ev);
+
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ g_warning("pas_backend_file_process_get_cursor: Exception reffing "
+ "corba book.\n");
}
+ CORBA_exception_free(&ev);
+
+ cursor = pas_card_cursor_new(get_length,
+ get_nth,
+ cursor_data);
+
+ gtk_signal_connect(GTK_OBJECT(cursor), "destroy",
+ GTK_SIGNAL_FUNC(cursor_destroy), cursor_data);
+
+ pas_book_respond_get_cursor (book,
+ ldap_error_to_response (ldap_error),
+ cursor);
+
+ /* we're synchronous */
+ return TRUE;
+}
+
+static void
+get_cursor_dtor (PASBackend *backend, LDAPOp *op)
+{
g_free (op);
}
@@ -1718,53 +1479,11 @@ pas_backend_ldap_process_get_cursor (PASBackend *backend,
PASBook *book,
PASRequest *req)
{
- PASBackendLDAP *bl = PAS_BACKEND_LDAP (backend);
- LDAP *ldap = bl->priv->ldap;
- int ldap_error;
- int get_cursor_msgid;
- LDAPGetCursorOp *cursor_op;
-
- cursor_op = g_new0 (LDAPGetCursorOp, 1);
- cursor_op->cursor_data = g_new0 (PASBackendLDAPCursorPrivate, 1);
-
- ldap_error = ldap_search_ext (ldap,
- bl->priv->ldap_rootdn,
- bl->priv->ldap_scope,
- "(objectclass=*)",
- NULL, 0,
- NULL, NULL, NULL, /* timeout */
- bl->priv->ldap_limit, &get_cursor_msgid);
-
- if (ldap_error == LDAP_SUCCESS) {
- CORBA_Environment ev;
- GNOME_Evolution_Addressbook_Book corba_book;
-
- corba_book = bonobo_object_corba_objref(BONOBO_OBJECT(book));
+ LDAPGetCursorOp *op = g_new (LDAPGetCursorOp, 1);
- CORBA_exception_init(&ev);
+ ldap_op_init ((LDAPOp*)op, backend, book, NULL, get_cursor_handler, get_cursor_dtor);
- GNOME_Evolution_Addressbook_Book_ref(corba_book, &ev);
-
- cursor_op->cursor_data->backend = backend;
- cursor_op->cursor_data->book = book;
-
- if (ev._major != CORBA_NO_EXCEPTION) {
- g_warning("pas_backend_ldap_process_get_cursor: Exception reffing "
- "corba book.\n");
- }
-
- CORBA_exception_free(&ev);
-
-
- ldap_op_add ((LDAPOp*)cursor_op, backend, book,
- NULL, get_cursor_msgid, get_cursor_handler, get_cursor_dtor);
- }
- else {
- pas_book_respond_get_cursor (book,
- ldap_error_to_response (ldap_error),
- CORBA_OBJECT_NIL);
- get_cursor_dtor ((LDAPOp*)cursor_op);
- }
+ ldap_op_process ((LDAPOp*)op);
}
@@ -2489,18 +2208,9 @@ query_prop_to_ldap(gchar *query_prop)
typedef struct {
LDAPOp op;
+ char *ldap_query;
+ PASBackendLDAP *bl;
PASBackendLDAPBookView *view;
-
- /* grouping stuff */
- GList *pending_adds; /* the cards we're sending */
- int num_pending_adds; /* the number waiting to be sent */
- int target_pending_adds; /* the cutoff that forces a flush to the client, if it happens before the timeout */
- int num_sent_this_time; /* the number of cards we sent to the client before the most recent timeout */
- int num_sent_last_time; /* the number of cards we sent to the client before the previous timeout */
- glong grouping_time_start;
-
- /* used by search_handler to only send the status messages once */
- gboolean notified_receiving_results;
} LDAPSearchOp;
static ECardSimple *
@@ -2508,13 +2218,12 @@ build_card_from_entry (LDAP *ldap, LDAPMessage *e, GList **existing_objectclasse
{
ECard *ecard = E_CARD(gtk_type_new(e_card_get_type()));
ECardSimple *card = e_card_simple_new (ecard);
- char *dn;
+ char *dn = ldap_get_dn(ldap, e);
char *attr;
BerElement *ber = NULL;
- dn = ldap_get_dn(ldap, e);
+ // g_print ("build_card_from_entry, dn = %s\n", dn);
e_card_simple_set_id (card, dn);
- ldap_memfree (dn);
for (attr = ldap_first_attribute (ldap, e, &ber); attr;
attr = ldap_next_attribute (ldap, e, ber)) {
@@ -2554,17 +2263,15 @@ build_card_from_entry (LDAP *ldap, LDAPMessage *e, GList **existing_objectclasse
}
}
}
-
- ldap_memfree (attr);
}
- /* XXX the openldap man page for
- ldap_first_attribute/ldap_next_attribute says that the ber
- is freed if there are no more attributes
- (ldap_next_attribute returns NULL), but this seems to not
- be the case (as of openldap-2.0.23), so free it here. */
- if (ber)
+#ifndef OPENLDAP2
+ /* if ldap->ld_errno == LDAP_DECODING_ERROR there was an
+ error decoding an attribute, and we shouldn't free ber,
+ since the ldap library already did it. */
+ if (ldap->ld_errno != LDAP_DECODING_ERROR && ber)
ber_free (ber, 0);
+#endif
e_card_simple_sync_card (card);
@@ -2573,13 +2280,25 @@ build_card_from_entry (LDAP *ldap, LDAPMessage *e, GList **existing_objectclasse
return card;
}
+static void
+send_pending_adds (PASBackendLDAPBookView *view)
+{
+ view->num_sent_this_time += view->num_pending_adds;
+ pas_book_view_notify_add (view->book_view, view->pending_adds);
+ g_list_foreach (view->pending_adds, (GFunc)g_free, NULL);
+ view->pending_adds = NULL;
+ view->num_pending_adds = 0;
+}
+
static gboolean
-poll_ldap (PASBackendLDAP *bl)
+poll_ldap (LDAPSearchOp *op)
{
- GList *list;
+ PASBackendLDAPBookView *view = op->view;
+ PASBackendLDAP *bl = op->bl;
LDAP *ldap = bl->priv->ldap;
int rc;
- LDAPMessage *res;
+ LDAPMessage *res, *e;
+ static int received = 0;
GTimeVal cur_time;
glong cur_millis;
struct timeval timeout;
@@ -2587,9 +2306,13 @@ poll_ldap (PASBackendLDAP *bl)
timeout.tv_sec = 0;
timeout.tv_usec = LDAP_RESULT_TIMEOUT_MILLIS * 1000;
- rc = ldap_result (ldap, LDAP_RES_ANY, 0, &timeout, &res);
+ if (!view->notified_receiving_results) {
+ view->notified_receiving_results = TRUE;
+ pas_book_view_notify_status_message (view->book_view, _("Receiving LDAP search results..."));
+ }
+
+ rc = ldap_result (ldap, view->search_msgid, 0, &timeout, &res);
if (rc != 0) {/* rc == 0 means timeout exceeded */
-#if 0
if (rc == -1 && received == 0) {
pas_book_view_notify_status_message (view->book_view, _("Restarting search."));
/* connection went down and we never got any. */
@@ -2599,134 +2322,138 @@ poll_ldap (PASBackendLDAP *bl)
ldap_op_restart ((LDAPOp*)op);
return FALSE;
}
-#endif
- if (rc == -1) {
- g_warning ("ldap_result returned -1");
+
+ if (rc != LDAP_RES_SEARCH_ENTRY) {
+ view->search_timeout = 0;
+ if (view->num_pending_adds)
+ send_pending_adds (view);
+ pas_book_view_notify_complete (view->book_view);
+ ldap_op_finished ((LDAPOp*)op);
+ received = 0;
+ return FALSE;
}
- else {
- int msgid = ldap_msgid (res);
- LDAPOp *op;
- op = g_hash_table_lookup (bl->priv->id_to_op, &msgid);
- if (!op)
- g_error ("unknown operation, msgid = %d", msgid);
+ received = 1;
+
+ e = ldap_first_entry(ldap, res);
- op->handler (op, res);
+ while (NULL != e) {
+ ECardSimple *card = build_card_from_entry (ldap, e, NULL);
+
+ view->pending_adds = g_list_append (view->pending_adds,
+ e_card_simple_get_vcard_assume_utf8 (card));
+ view->num_pending_adds ++;
+
+ gtk_object_unref (GTK_OBJECT(card));
- ldap_msgfree(res);
+ e = ldap_next_entry(ldap, e);
}
+
+ ldap_msgfree(res);
}
g_get_current_time (&cur_time);
cur_millis = TV_TO_MILLIS (cur_time);
-
- for (list = bl->priv->book_views; list; list = g_list_next(list)) {
- PASBackendLDAPBookView *view = list->data;
- if (view->search_op)
- ldap_search_op_timeout (view->search_op, cur_millis);
- }
- return TRUE;
-}
+ if (cur_millis - view->grouping_time_start > GROUPING_MINIMUM_WAIT) {
-static void
-send_pending_adds (LDAPSearchOp *search_op)
-{
- search_op->num_sent_this_time += search_op->num_pending_adds;
- pas_book_view_notify_add (search_op->op.view, search_op->pending_adds);
- g_list_foreach (search_op->pending_adds, (GFunc)g_free, NULL);
- search_op->pending_adds = NULL;
- search_op->num_pending_adds = 0;
-}
+ if (view->num_pending_adds >= view->target_pending_adds)
+ send_pending_adds (view);
-static void
-ldap_search_op_timeout (LDAPOp *op, glong cur_millis)
-{
- LDAPSearchOp *search_op = (LDAPSearchOp*)op;
-
- if (cur_millis - search_op->grouping_time_start > GROUPING_MINIMUM_WAIT) {
-
- if (search_op->num_pending_adds >= search_op->target_pending_adds)
- send_pending_adds (search_op);
-
- if (cur_millis - search_op->grouping_time_start > GROUPING_MAXIMUM_WAIT) {
+ if (cur_millis - view->grouping_time_start > GROUPING_MAXIMUM_WAIT) {
GTimeVal new_start;
- if (search_op->num_pending_adds)
- send_pending_adds (search_op);
- search_op->target_pending_adds = MIN (GROUPING_MAXIMUM_SIZE,
- (search_op->num_sent_this_time + search_op->num_sent_last_time) / 2);
- search_op->target_pending_adds = MAX (search_op->target_pending_adds, 1);
+ if (view->num_pending_adds)
+ send_pending_adds (view);
+ view->target_pending_adds = MIN (GROUPING_MAXIMUM_SIZE,
+ (view->num_sent_this_time + view->num_sent_last_time) / 2);
+ view->target_pending_adds = MAX (view->target_pending_adds, 1);
#ifdef PERFORMANCE_SPEW
printf ("num sent this time %d, last time %d, target pending adds set to %d\n",
- search_op->num_sent_this_time,
- search_op->num_sent_last_time,
- search_op->target_pending_adds);
+ view->num_sent_this_time,
+ view->num_sent_last_time,
+ view->target_pending_adds);
#endif
g_get_current_time (&new_start);
- search_op->grouping_time_start = TV_TO_MILLIS (new_start);
- search_op->num_sent_last_time = search_op->num_sent_this_time;
- search_op->num_sent_this_time = 0;
+ view->grouping_time_start = TV_TO_MILLIS (new_start);
+ view->num_sent_last_time = view->num_sent_this_time;
+ view->num_sent_this_time = 0;
}
}
+
+ return TRUE;
}
-static void
-ldap_search_handler (LDAPOp *op, LDAPMessage *res)
+static gboolean
+ldap_search_handler (PASBackend *backend, LDAPOp *op)
{
- LDAPSearchOp *search_op = (LDAPSearchOp*)op;
- PASBackendLDAP *bl = PAS_BACKEND_LDAP (op->backend);
- LDAP *ldap = bl->priv->ldap;
- LDAPMessage *e;
- int msg_type;
+ LDAPSearchOp *search_op = (LDAPSearchOp*) op;
- if (!search_op->notified_receiving_results) {
- search_op->notified_receiving_results = TRUE;
- pas_book_view_notify_status_message (op->view, _("Receiving LDAP search results..."));
- }
+ if (op->view)
+ pas_book_view_notify_status_message (op->view, _("Searching..."));
- msg_type = ldap_msgtype (res);
- if (msg_type == LDAP_RES_SEARCH_ENTRY) {
- e = ldap_first_entry(ldap, res);
+ /* it might not be NULL if we've been restarted */
+ if (search_op->ldap_query == NULL)
+ search_op->ldap_query = pas_backend_ldap_build_query(PAS_BACKEND_LDAP (backend), search_op->view->search);
- while (NULL != e) {
- ECardSimple *card = build_card_from_entry (ldap, e, NULL);
+ if (search_op->ldap_query != NULL) {
+ PASBackendLDAP *bl = PAS_BACKEND_LDAP (backend);
+ PASBackendLDAPBookView *view = search_op->view;
+ LDAP *ldap = bl->priv->ldap;
+ int ldap_err;
+ GTimeVal search_start;
- search_op->pending_adds = g_list_append (search_op->pending_adds,
- e_card_simple_get_vcard_assume_utf8 (card));
- search_op->num_pending_adds ++;
+ view->pending_adds = NULL;
+ view->num_pending_adds = 0;
+ view->target_pending_adds = GROUPING_INITIAL_SIZE;
- gtk_object_unref (GTK_OBJECT(card));
+ g_get_current_time (&search_start);
+ view->grouping_time_start = TV_TO_MILLIS (search_start);
+ view->num_sent_last_time = 0;
+ view->num_sent_this_time = 0;
+ view->notified_receiving_results = FALSE;
- e = ldap_next_entry(ldap, e);
+ ldap_err = ldap_search_ext (ldap, bl->priv->ldap_rootdn,
+ bl->priv->ldap_scope,
+ search_op->ldap_query,
+ bl->priv->search_attrs, 0,
+ NULL, NULL,
+ NULL,
+ LDAP_MAX_SEARCH_RESPONSES, &view->search_msgid);
+
+ if (ldap_err != LDAP_SUCCESS) {
+ pas_book_view_notify_status_message (view->book_view, ldap_err2string(ldap_err));
+ return TRUE; /* act synchronous in this case */
}
- }
- else if (msg_type == LDAP_RES_SEARCH_RESULT) {
- /* the entry that marks the end of our search */
- if (search_op->num_pending_adds)
- send_pending_adds (search_op);
- pas_book_view_notify_complete (search_op->op.view);
- ldap_op_finished (op);
+
+ if (view->search_msgid == -1) {
+ pas_book_view_notify_status_message (view->book_view, ldap_err2string(ldap_err));
+ return TRUE; /* act synchronous in this case */
+ }
+ else {
+ view->search_timeout = g_timeout_add (LDAP_POLL_INTERVAL,
+ (GSourceFunc) poll_ldap,
+ search_op);
+ }
+
+ /* we're async */
+ return FALSE;
}
else {
- g_warning ("unhandled search result type %d returned", msg_type);
- if (search_op->num_pending_adds)
- send_pending_adds (search_op);
- pas_book_view_notify_complete (search_op->op.view);
- ldap_op_finished (op);
+ /* error doing the conversion to an ldap query, let's
+ end this now by acting like we're synchronous. */
+ g_warning ("LDAP problem converting search query %s\n", search_op->view->search);
+ return TRUE;
}
}
static void
-ldap_search_dtor (LDAPOp *op)
+ldap_search_dtor (PASBackend *backend, LDAPOp *op)
{
LDAPSearchOp *search_op = (LDAPSearchOp*) op;
- /* unhook us from our PASBackendLDAPBookView */
- if (search_op->view)
- search_op->view->search_op = NULL;
-
+ g_free (search_op->ldap_query);
g_free (search_op);
}
@@ -2735,63 +2462,19 @@ pas_backend_ldap_search (PASBackendLDAP *bl,
PASBook *book,
PASBackendLDAPBookView *view)
{
- char *ldap_query;
+ LDAPSearchOp *op = g_new (LDAPSearchOp, 1);
- pas_book_view_notify_status_message (view->book_view, _("Searching..."));
+ ldap_op_init ((LDAPOp*)op, PAS_BACKEND(bl), book, view->book_view, ldap_search_handler, ldap_search_dtor);
- ldap_query = pas_backend_ldap_build_query(bl, view->search);
-
- if (ldap_query != NULL) {
- LDAP *ldap = bl->priv->ldap;
- int ldap_err;
- GTimeVal search_start;
- int search_msgid;
-
- ldap_err = ldap_search_ext (ldap, bl->priv->ldap_rootdn,
- bl->priv->ldap_scope,
- ldap_query,
- NULL, 0,
- NULL, /* XXX */
- NULL, /* XXX */
- NULL, /* XXX timeout */
- bl->priv->ldap_limit, &search_msgid);
-
- g_free (ldap_query);
-
- if (ldap_err != LDAP_SUCCESS) {
- pas_book_view_notify_status_message (view->book_view, ldap_err2string(ldap_err));
- return;
- }
- else if (search_msgid == -1) {
- pas_book_view_notify_status_message (view->book_view,
- _("Error performing search"));
- return;
- }
- else {
- LDAPSearchOp *op = g_new0 (LDAPSearchOp, 1);
-
- op->target_pending_adds = GROUPING_INITIAL_SIZE;
-
- g_get_current_time (&search_start);
- op->grouping_time_start = TV_TO_MILLIS (search_start);
-
- op->view = view;
-
- view->search_op = (LDAPOp*)op;
+ op->ldap_query = NULL;
+ op->view = view;
+ op->bl = bl;
- ldap_op_add ((LDAPOp*)op, PAS_BACKEND(bl), book, view->book_view,
- search_msgid,
- ldap_search_handler, ldap_search_dtor);
-
- }
- return;
- }
- else {
- g_warning ("LDAP problem converting search query %s\n", view->search);
- pas_book_view_notify_status_message (view->book_view, _("Could not parse query string"));
- return;
- }
+ /* keep track of the search op so we can delete it from the
+ list if the view is destroyed */
+ view->search_op = (LDAPOp*)op;
+ ldap_op_process ((LDAPOp*)op);
}
static void
@@ -2800,12 +2483,13 @@ pas_backend_ldap_process_get_book_view (PASBackend *backend,
PASRequest *req)
{
PASBackendLDAP *bl = PAS_BACKEND_LDAP (backend);
+ CORBA_Environment ev;
PASBookView *book_view;
PASBackendLDAPBookView *view;
- g_return_if_fail (req->get_book_view.listener != NULL);
+ g_return_if_fail (req->listener != NULL);
- book_view = pas_book_view_new (req->get_book_view.listener);
+ book_view = pas_book_view_new (req->listener);
bonobo_object_ref(BONOBO_OBJECT(book));
gtk_signal_connect(GTK_OBJECT(book_view), "destroy",
@@ -2813,7 +2497,7 @@ pas_backend_ldap_process_get_book_view (PASBackend *backend,
view = g_new0(PASBackendLDAPBookView, 1);
view->book_view = book_view;
- view->search = g_strdup(req->get_book_view.search);
+ view->search = g_strdup(req->search);
view->card_sexp = pas_backend_card_sexp_new (view->search);
view->blpriv = bl->priv;
@@ -2827,7 +2511,18 @@ pas_backend_ldap_process_get_book_view (PASBackend *backend,
pas_backend_ldap_search (bl, book, view);
+ g_free (req->search);
+ CORBA_exception_init(&ev);
+
bonobo_object_unref (BONOBO_OBJECT (book_view));
+ bonobo_object_release_unref(req->listener, &ev);
+
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ g_warning("pas_backend_file_process_get_book_view: Exception reffing "
+ "corba book.\n");
+ }
+ CORBA_exception_free(&ev);
+
}
static void
@@ -2849,9 +2544,9 @@ pas_backend_ldap_process_authenticate_user (PASBackend *backend,
int ldap_error;
char *dn = NULL;
- if (!strcmp (req->auth_user.auth_method, "ldap/simple-email")) {
+ if (!strcmp (req->auth_method, "ldap/simple-email")) {
LDAPMessage *res, *e;
- char *query = g_strdup_printf ("(mail=%s)", req->auth_user.user);
+ char *query = g_strdup_printf ("(mail=%s)", req->user);
ldap_error = ldap_search_s (bl->priv->ldap,
bl->priv->ldap_rootdn,
@@ -2871,15 +2566,15 @@ pas_backend_ldap_process_authenticate_user (PASBackend *backend,
return;
}
}
- else if (!strcmp (req->auth_user.auth_method, "ldap/simple-binddn")) {
- dn = g_strdup (req->auth_user.user);
+ else {
+ dn = g_strdup (req->user);
}
/* now authenticate against the DN we were either supplied or queried for */
printf ("authenticating as %s\n", dn);
ldap_error = ldap_simple_bind_s(bl->priv->ldap,
dn,
- req->auth_user.passwd);
+ req->passwd);
g_free (dn);
pas_book_respond_authenticate_user (book,
@@ -2887,7 +2582,7 @@ pas_backend_ldap_process_authenticate_user (PASBackend *backend,
bl->priv->writable = (ldap_error == LDAP_SUCCESS);
- if (!bl->priv->schema_checked)
+ if (!bl->priv->evolutionPersonChecked)
check_schema_support (bl);
pas_book_report_writable (book, bl->priv->writable);
@@ -2960,7 +2655,7 @@ pas_backend_ldap_process_client_requests (PASBook *book)
break;
}
- pas_book_free_request (req);
+ g_free (req);
}
static void
@@ -2980,55 +2675,10 @@ pas_backend_ldap_load_uri (PASBackend *backend,
PASBackendLDAP *bl = PAS_BACKEND_LDAP (backend);
LDAPURLDesc *lud;
int ldap_error;
- char **attributes;
- int i;
- int limit = 100;
g_assert (bl->priv->connected == FALSE);
- attributes = g_strsplit (uri, ";", 0);
-
- if (attributes[0] == NULL)
- return FALSE;
-
- for (i = 1; attributes[i]; i++) {
- char *equals;
- char *value;
- int key_length;
- equals = strchr (attributes[i], '=');
- if (equals) {
- key_length = equals - attributes[i];
- value = equals + 1;
- } else {
- key_length = strlen (attributes[i]);
- value = NULL;
- }
-
- if (key_length == strlen("limit") && !strncmp (attributes[i], "limit", key_length)) {
- if (value)
- limit = atoi(value);
- }
- else if (key_length == strlen("use_tls") && !strncmp (attributes[i], "use_tls", key_length)) {
- if (value) {
- if (!strncmp (value, "always", 6)) {
- bl->priv->use_tls = PAS_BACKEND_LDAP_TLS_ALWAYS;
- }
- else if (!strncmp (value, "when-possible", 3)) {
- bl->priv->use_tls = PAS_BACKEND_LDAP_TLS_WHEN_POSSIBLE;
- }
- else {
- g_warning ("unhandled value for use_tls, not using it");
- }
- }
- else {
- bl->priv->use_tls = PAS_BACKEND_LDAP_TLS_WHEN_POSSIBLE;
- }
- }
- }
-
- ldap_error = ldap_url_parse ((char*)attributes[0], &lud);
- g_strfreev (attributes);
-
+ ldap_error = ldap_url_parse ((char*)uri, &lud);
if (ldap_error == LDAP_SUCCESS) {
g_free(bl->priv->uri);
bl->priv->uri = g_strdup (uri);
@@ -3038,12 +2688,15 @@ pas_backend_ldap_load_uri (PASBackend *backend,
if (bl->priv->ldap_port == 0)
bl->priv->ldap_port = LDAP_PORT;
bl->priv->ldap_rootdn = g_strdup(lud->lud_dn);
- bl->priv->ldap_limit = limit;
bl->priv->ldap_scope = lud->lud_scope;
ldap_free_urldesc(lud);
- return pas_backend_ldap_connect (bl);
+ pas_backend_ldap_connect (bl);
+ if (bl->priv->ldap == NULL)
+ return GNOME_Evolution_Addressbook_BookListener_RepositoryOffline;
+ else
+ return GNOME_Evolution_Addressbook_BookListener_Success;
} else
return GNOME_Evolution_Addressbook_BookListener_OtherError;
}
@@ -3142,7 +2795,7 @@ pas_backend_ldap_remove_client (PASBackend *backend,
}
static char *
-pas_backend_ldap_get_static_capabilities (PASBackend *backend)
+pas_backend_ldap_get_static_capabilites (PASBackend *backend)
{
return g_strdup("net");
}
@@ -3178,14 +2831,10 @@ pas_backend_ldap_new (void)
return PAS_BACKEND (backend);
}
-static gboolean
-call_dtor (int msgid, LDAPOp *op, gpointer data)
+static void
+call_dtor (LDAPOp *op, gpointer data)
{
- ldap_abandon (PAS_BACKEND_LDAP(op->backend)->priv->ldap, op->id);
-
- op->dtor (op);
-
- return TRUE;
+ op->dtor (op->backend, op);
}
static void
@@ -3195,15 +2844,13 @@ pas_backend_ldap_destroy (GtkObject *object)
bl = PAS_BACKEND_LDAP (object);
- g_hash_table_foreach_remove (bl->priv->id_to_op, (GHRFunc)call_dtor, NULL);
- g_hash_table_destroy (bl->priv->id_to_op);
-
- if (bl->priv->poll_timeout != -1)
- g_source_remove (bl->priv->poll_timeout);
+ g_list_foreach (bl->priv->pending_ops, (GFunc)call_dtor, NULL);
+ g_list_free (bl->priv->pending_ops);
if (bl->priv->supported_fields)
gtk_object_unref (GTK_OBJECT (bl->priv->supported_fields));
+ g_free (bl->priv->search_attrs);
g_free (bl->priv->uri);
GTK_OBJECT_CLASS (pas_backend_ldap_parent_class)->destroy (object);
@@ -3215,9 +2862,6 @@ pas_backend_ldap_class_init (PASBackendLDAPClass *klass)
GtkObjectClass *object_class = (GtkObjectClass *) klass;
PASBackendClass *parent_class;
- /* get client side information (extensions present in the library) */
- get_ldap_library_info ();
-
pas_backend_ldap_parent_class = gtk_type_class (pas_backend_get_type ());
parent_class = PAS_BACKEND_CLASS (klass);
@@ -3227,7 +2871,7 @@ pas_backend_ldap_class_init (PASBackendLDAPClass *klass)
parent_class->get_uri = pas_backend_ldap_get_uri;
parent_class->add_client = pas_backend_ldap_add_client;
parent_class->remove_client = pas_backend_ldap_remove_client;
- parent_class->get_static_capabilities = pas_backend_ldap_get_static_capabilities;
+ parent_class->get_static_capabilities = pas_backend_ldap_get_static_capabilites;
object_class->destroy = pas_backend_ldap_destroy;
}
@@ -3236,13 +2880,17 @@ static void
pas_backend_ldap_init (PASBackendLDAP *backend)
{
PASBackendLDAPPrivate *priv;
+ int i;
priv = g_new0 (PASBackendLDAPPrivate, 1);
priv->supported_fields = e_list_new ((EListCopyFunc)g_strdup, (EListFreeFunc)g_free, NULL);
- priv->ldap_limit = 100;
- priv->id_to_op = g_hash_table_new (g_int_hash, g_int_equal);
- priv->poll_timeout = -1;
+ priv->search_attrs = g_new (char*, num_prop_infos+1);
+ for (i = 0; i < num_prop_infos; i ++) {
+ priv->search_attrs[i] = prop_info[i].ldap_attr;
+ }
+ priv->search_attrs[num_prop_infos] = NULL;
+
backend->priv = priv;
}
diff --git a/addressbook/backend/pas/pas-book.c b/addressbook/backend/pas/pas-book.c
index 9bb2cd348e..b0b35b2c0f 100644
--- a/addressbook/backend/pas/pas-book.c
+++ b/addressbook/backend/pas/pas-book.c
@@ -74,7 +74,7 @@ pas_book_queue_create_card (PASBook *book, const char *vcard)
req = g_new0 (PASRequest, 1);
req->op = CreateCard;
- req->create.vcard = g_strdup (vcard);
+ req->vcard = g_strdup (vcard);
pas_book_queue_request (book, req);
}
@@ -86,7 +86,7 @@ pas_book_queue_remove_card (PASBook *book, const char *id)
req = g_new0 (PASRequest, 1);
req->op = RemoveCard;
- req->remove.id = g_strdup (id);
+ req->id = g_strdup (id);
pas_book_queue_request (book, req);
}
@@ -98,7 +98,7 @@ pas_book_queue_modify_card (PASBook *book, const char *vcard)
req = g_new0 (PASRequest, 1);
req->op = ModifyCard;
- req->modify.vcard = g_strdup (vcard);
+ req->vcard = g_strdup (vcard);
pas_book_queue_request (book, req);
}
@@ -110,7 +110,7 @@ pas_book_queue_get_cursor (PASBook *book, const char *search)
req = g_new0 (PASRequest, 1);
req->op = GetCursor;
- req->get_cursor.search = g_strdup(search);
+ req->search = g_strdup(search);
pas_book_queue_request (book, req);
}
@@ -122,7 +122,7 @@ pas_book_queue_get_vcard (PASBook *book, const char *id)
req = g_new0 (PASRequest, 1);
req->op = GetVCard;
- req->get_vcard.id = g_strdup(id);
+ req->id = g_strdup(id);
pas_book_queue_request (book, req);
}
@@ -135,9 +135,9 @@ pas_book_queue_authenticate_user (PASBook *book,
req = g_new0 (PASRequest, 1);
req->op = AuthenticateUser;
- req->auth_user.user = g_strdup(user);
- req->auth_user.passwd = g_strdup(passwd);
- req->auth_user.auth_method = g_strdup(auth_method);
+ req->user = g_strdup(user);
+ req->passwd = g_strdup(passwd);
+ req->auth_method = g_strdup(auth_method);
pas_book_queue_request (book, req);
}
@@ -162,11 +162,11 @@ pas_book_queue_get_book_view (PASBook *book, const GNOME_Evolution_Addressbook_B
req = g_new0 (PASRequest, 1);
req->op = GetBookView;
- req->get_book_view.search = g_strdup(search);
+ req->search = g_strdup(search);
CORBA_exception_init (&ev);
- req->get_book_view.listener = bonobo_object_dup_ref(listener, &ev);
+ req->listener = bonobo_object_dup_ref(listener, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
g_warning ("pas_book_queue_get_book_view: Exception "
@@ -186,11 +186,11 @@ pas_book_queue_get_changes (PASBook *book, const GNOME_Evolution_Addressbook_Boo
req = g_new0 (PASRequest, 1);
req->op = GetChanges;
- req->get_changes.change_id= g_strdup(change_id);
+ req->change_id= g_strdup(change_id);
CORBA_exception_init (&ev);
- req->get_changes.listener = bonobo_object_dup_ref(listener, &ev);
+ req->listener = bonobo_object_dup_ref(listener, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
g_warning ("pas_book_queue_get_changes: Exception "
@@ -766,63 +766,6 @@ pas_book_new (PASBackend *backend,
return book;
}
-void
-pas_book_free_request (PASRequest *req)
-{
- CORBA_Environment ev;
- switch (req->op) {
- case CreateCard:
- g_free (req->create.id);
- g_free (req->create.vcard);
- break;
- case RemoveCard:
- g_free (req->remove.id);
- break;
- case ModifyCard:
- g_free (req->modify.vcard);
- break;
- case GetVCard:
- g_free (req->get_vcard.id);
- break;
- case GetCursor:
- g_free (req->get_cursor.search);
- break;
- case GetBookView:
- g_free (req->get_book_view.search);
- CORBA_exception_init (&ev);
- bonobo_object_release_unref (req->get_book_view.listener, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION)
- g_message ("pas_book_free_request(GetBookView): could not release the listener");
-
- CORBA_exception_free (&ev);
- break;
- case GetChanges:
- g_free (req->get_changes.change_id);
- CORBA_exception_init (&ev);
- bonobo_object_release_unref (req->get_changes.listener, &ev);
-
- if (ev._major != CORBA_NO_EXCEPTION)
- g_message ("pas_book_free_request(GetChanges): could not release the listener");
-
- CORBA_exception_free (&ev);
- break;
- case CheckConnection:
- /* nothing to free */
- break;
- case AuthenticateUser:
- g_free (req->auth_user.user);
- g_free (req->auth_user.passwd);
- g_free (req->auth_user.auth_method);
- break;
- case GetSupportedFields:
- /* nothing to free */
- break;
- }
-
- g_free (req);
-}
-
static void
pas_book_destroy (GtkObject *object)
{
@@ -831,7 +774,11 @@ pas_book_destroy (GtkObject *object)
CORBA_Environment ev;
for (l = book->priv->request_queue; l != NULL; l = l->next) {
- pas_book_free_request ((PASRequest *)l->data);
+ PASRequest *req = l->data;
+
+ g_free (req->id);
+ g_free (req->vcard);
+ g_free (req);
}
g_list_free (book->priv->request_queue);
diff --git a/addressbook/backend/pas/pas-book.h b/addressbook/backend/pas/pas-book.h
index a6f2fda3cc..8afba26b45 100644
--- a/addressbook/backend/pas/pas-book.h
+++ b/addressbook/backend/pas/pas-book.h
@@ -38,71 +38,16 @@ typedef enum {
} PASOperation;
typedef struct {
- PASOperation op;
- char *id;
- char *vcard;
-} PASCreateCardRequest;
-
-typedef struct {
- PASOperation op;
- char *id;
-} PASRemoveCardRequest;
-
-typedef struct {
- PASOperation op;
- char *vcard;
-} PASModifyCardRequest;
-
-typedef struct {
- PASOperation op;
- char *id;
-} PASGetVCardRequest;
-
-typedef struct {
- PASOperation op;
- char *search;
-} PASGetCursorRequest;
-
-typedef struct {
- PASOperation op;
- char *search;
- GNOME_Evolution_Addressbook_BookViewListener listener;
-} PASGetBookViewRequest;
-
-typedef struct {
- PASOperation op;
- char *change_id;
- GNOME_Evolution_Addressbook_BookViewListener listener;
-} PASGetChangesRequest;
-
-typedef struct {
- PASOperation op;
-} PASCheckConnectionRequest;
-
-typedef struct {
- PASOperation op;
- char *user;
- char *passwd;
- char *auth_method;
-} PASAuthenticateUserRequest;
-
-typedef struct {
- PASOperation op;
-} PASGetSupportedFieldsRequest;
-
-typedef union {
PASOperation op;
-
- PASCreateCardRequest create;
- PASRemoveCardRequest remove;
- PASModifyCardRequest modify;
- PASGetVCardRequest get_vcard;
- PASGetCursorRequest get_cursor;
- PASGetBookViewRequest get_book_view;
- PASGetChangesRequest get_changes;
- PASCheckConnectionRequest check_connection;
- PASAuthenticateUserRequest auth_user;
- PASGetSupportedFieldsRequest get_supported_fields;
+ char *id;
+ char *vcard;
+ char *search;
+ char *change_id;
+ char *user;
+ char *passwd;
+ char *auth_method;
+ GNOME_Evolution_Addressbook_BookViewListener listener;
+ GNOME_Evolution_Addressbook_stringlist fields;
} PASRequest;
struct _PASBook {
@@ -126,7 +71,6 @@ PASBackend *pas_book_get_backend (PASBook
GNOME_Evolution_Addressbook_BookListener pas_book_get_listener (PASBook *book);
int pas_book_check_pending (PASBook *book);
PASRequest *pas_book_pop_request (PASBook *book);
-void pas_book_free_request (PASRequest *request);
void pas_book_respond_open (PASBook *book,
GNOME_Evolution_Addressbook_BookListener_CallStatus status);
void pas_book_respond_create (PASBook *book,
diff --git a/addressbook/conduit/address-conduit-config.h b/addressbook/conduit/address-conduit-config.h
new file mode 100644
index 0000000000..2387f67ef3
--- /dev/null
+++ b/addressbook/conduit/address-conduit-config.h
@@ -0,0 +1,128 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* Evolution addressbook - Addressbook Conduit Configuration
+ *
+ * Copyright (C) 1998 Free Software Foundation
+ * Copyright (C) 2000 Ximian, Inc.
+ *
+ * Authors: Eskil Heyn Olsen <deity@eskil.dk>
+ * JP Rosevear <jpr@ximian.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public 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 __ADDR_CONDUIT_CONFIG_H__
+#define __ADDR_CONDUIT_CONFIG_H__
+
+#include <gnome.h>
+#include <libgpilotdCM/gnome-pilot-conduit-management.h>
+#include <gpilotd/gnome-pilot-conduit.h>
+#include <libgpilotdCM/gnome-pilot-conduit-config.h>
+
+/* Configuration info */
+typedef struct _EAddrConduitCfg EAddrConduitCfg;
+struct _EAddrConduitCfg {
+ guint32 pilot_id;
+ GnomePilotConduitSyncType sync_type;
+
+ gboolean open_secret;
+ gchar *last_uri;
+};
+
+#ifdef ADDR_CONFIG_LOAD
+/* Loads the configuration data */
+static void
+addrconduit_load_configuration (EAddrConduitCfg **c, guint32 pilot_id)
+{
+ GnomePilotConduitManagement *management;
+ GnomePilotConduitConfig *config;
+ gchar prefix[256];
+ g_snprintf (prefix, 255, "/gnome-pilot.d/e-address-conduit/Pilot_%u/",
+ pilot_id);
+
+ *c = g_new0 (EAddrConduitCfg,1);
+ g_assert (*c != NULL);
+
+ (*c)->pilot_id = pilot_id;
+ management = gnome_pilot_conduit_management_new ("e_address_conduit", GNOME_PILOT_CONDUIT_MGMT_ID);
+ config = gnome_pilot_conduit_config_new (management, pilot_id);
+ if (!gnome_pilot_conduit_config_is_enabled (config, &(*c)->sync_type))
+ (*c)->sync_type = GnomePilotConduitSyncTypeNotSet;
+ gtk_object_unref (GTK_OBJECT (config));
+ gtk_object_unref (GTK_OBJECT (management));
+
+ /* Custom settings */
+ gnome_config_push_prefix (prefix);
+
+ (*c)->open_secret = gnome_config_get_bool ("open_secret=FALSE");
+ (*c)->last_uri = gnome_config_get_string ("last_uri");
+
+ gnome_config_pop_prefix ();
+}
+#endif
+
+#ifdef ADDR_CONFIG_SAVE
+/* Saves the configuration data. */
+static void
+addrconduit_save_configuration (EAddrConduitCfg *c)
+{
+ gchar prefix[256];
+
+ g_snprintf (prefix, 255, "/gnome-pilot.d/e-address-conduit/Pilot_%u/",
+ c->pilot_id);
+
+ gnome_config_push_prefix (prefix);
+ gnome_config_set_bool ("open_secret", c->open_secret);
+ gnome_config_set_string ("last_uri", c->last_uri);
+ gnome_config_pop_prefix ();
+
+ gnome_config_sync ();
+ gnome_config_drop_all ();
+}
+#endif
+
+#ifdef ADDR_CONFIG_DUPE
+/* Creates a duplicate of the configuration data */
+static EAddrConduitCfg*
+addrconduit_dupe_configuration (EAddrConduitCfg *c)
+{
+ EAddrConduitCfg *retval;
+
+ g_return_val_if_fail (c != NULL, NULL);
+
+ retval = g_new0 (EAddrConduitCfg, 1);
+ retval->sync_type = c->sync_type;
+ retval->open_secret = c->open_secret;
+
+ retval->pilot_id = c->pilot_id;
+ retval->last_uri = g_strdup (c->last_uri);
+
+ return retval;
+}
+#endif
+
+#ifdef ADDR_CONFIG_DESTROY
+/* Destroy a configuration */
+static void
+addrconduit_destroy_configuration (EAddrConduitCfg **c)
+{
+ g_return_if_fail (c != NULL);
+ g_return_if_fail (*c != NULL);
+
+ g_free ((*c)->last_uri);
+ g_free (*c);
+ *c = NULL;
+}
+#endif
+
+#endif /* __ADDR_CONDUIT_CONFIG_H__ */
diff --git a/addressbook/conduit/address-conduit.c b/addressbook/conduit/address-conduit.c
index 48f3fa03d8..3d6e3eca1f 100644
--- a/addressbook/conduit/address-conduit.c
+++ b/addressbook/conduit/address-conduit.c
@@ -28,23 +28,27 @@
#include <gnome-xml/parser.h>
#include <pi-source.h>
#include <pi-socket.h>
+#include <pi-file.h>
#include <pi-dlp.h>
-#include <pi-address.h>
#include <ebook/e-book.h>
#include <ebook/e-book-util.h>
#include <ebook/e-card-types.h>
#include <ebook/e-card-cursor.h>
#include <ebook/e-card.h>
#include <ebook/e-card-simple.h>
-#include <gpilotd/gnome-pilot-conduit.h>
-#include <gpilotd/gnome-pilot-conduit-sync-abs.h>
-#include <libgpilotdCM/gnome-pilot-conduit-management.h>
-#include <libgpilotdCM/gnome-pilot-conduit-config.h>
-#include <e-dialog-widgets.h>
-#include <e-pilot-map.h>
-#include <e-pilot-settings.h>
#include <e-pilot-util.h>
+#define ADDR_CONFIG_LOAD 1
+#define ADDR_CONFIG_SAVE 1
+#define ADDR_CONFIG_DESTROY 1
+#include "address-conduit-config.h"
+#undef ADDR_CONFIG_LOAD
+#undef ADDR_CONFIG_SAVE
+#undef ADDR_CONFIG_DESTROY
+
+#include "address-conduit.h"
+
+static void free_local (EAddrLocalRecord *local);
GnomePilotConduit * conduit_get_gpilot_conduit (guint32);
void conduit_destroy_gpilot_conduit (GnomePilotConduit*);
@@ -130,254 +134,65 @@ static int priority_label [] = {
-1
};
-typedef struct _EAddrLocalRecord EAddrLocalRecord;
-typedef struct _EAddrConduitCfg EAddrConduitCfg;
-typedef struct _EAddrConduitGui EAddrConduitGui;
-typedef struct _EAddrConduitContext EAddrConduitContext;
-
-/* Local Record */
-struct _EAddrLocalRecord {
- /* 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.
- */
- GnomePilotDesktopRecord local;
-
- /* The corresponding ECard object */
- ECard *ecard;
-
- /* pilot-link address structure, used for implementing Transmit. */
- struct Address *addr;
-};
-
-
-static void
-addrconduit_destroy_record (EAddrLocalRecord *local)
-{
- gtk_object_unref (GTK_OBJECT (local->ecard));
- free_Address (local->addr);
- g_free (local->addr);
- g_free (local);
-}
-
-/* Configuration */
-struct _EAddrConduitCfg {
- guint32 pilot_id;
- GnomePilotConduitSyncType sync_type;
-
- gboolean secret;
- ECardSimpleAddressId default_address;
-
- gchar *last_uri;
-};
-
-static EAddrConduitCfg *
-addrconduit_load_configuration (guint32 pilot_id)
-{
- EAddrConduitCfg *c;
- GnomePilotConduitManagement *management;
- GnomePilotConduitConfig *config;
- gchar *address, prefix[256];
- g_snprintf (prefix, 255, "/gnome-pilot.d/e-address-conduit/Pilot_%u/",
- pilot_id);
-
- c = g_new0 (EAddrConduitCfg,1);
- g_assert (c != NULL);
-
- c->pilot_id = pilot_id;
- management = gnome_pilot_conduit_management_new ("e_address_conduit", GNOME_PILOT_CONDUIT_MGMT_ID);
- config = gnome_pilot_conduit_config_new (management, pilot_id);
- if (!gnome_pilot_conduit_config_is_enabled (config, &c->sync_type))
- c->sync_type = GnomePilotConduitSyncTypeNotSet;
- gtk_object_unref (GTK_OBJECT (config));
- gtk_object_unref (GTK_OBJECT (management));
-
- /* Custom settings */
- gnome_config_push_prefix (prefix);
-
- c->secret = gnome_config_get_bool ("secret=FALSE");
- address = gnome_config_get_string ("default_address=business");
- if (!strcmp (address, "business"))
- c->default_address = E_CARD_SIMPLE_ADDRESS_ID_BUSINESS;
- else if (!strcmp (address, "home"))
- c->default_address = E_CARD_SIMPLE_ADDRESS_ID_HOME;
- else if (!strcmp (address, "other"))
- c->default_address = E_CARD_SIMPLE_ADDRESS_ID_OTHER;
- g_free (address);
- c->last_uri = gnome_config_get_string ("last_uri");
-
- gnome_config_pop_prefix ();
-
- return c;
-}
-
-static void
-addrconduit_save_configuration (EAddrConduitCfg *c)
+/* Debug routines */
+static char *
+print_local (EAddrLocalRecord *local)
{
- gchar prefix[256];
-
- g_snprintf (prefix, 255, "/gnome-pilot.d/e-address-conduit/Pilot_%u/",
- c->pilot_id);
+ static char buff[ 4096 ];
- gnome_config_push_prefix (prefix);
- gnome_config_set_bool ("secret", c->secret);
- switch (c->default_address) {
- case E_CARD_SIMPLE_ADDRESS_ID_BUSINESS:
- gnome_config_set_string ("default_address", "business");
- break;
- case E_CARD_SIMPLE_ADDRESS_ID_HOME:
- gnome_config_set_string ("default_address", "home");
- break;
- case E_CARD_SIMPLE_ADDRESS_ID_OTHER:
- gnome_config_set_string ("default_address", "other");
- break;
- default:
- g_warning ("Unknown default_address value");
+ if (local == NULL) {
+ sprintf (buff, "[NULL]");
+ return buff;
}
- gnome_config_set_string ("last_uri", c->last_uri);
- gnome_config_pop_prefix ();
-
- gnome_config_sync ();
- gnome_config_drop_all ();
-}
-static EAddrConduitCfg*
-addrconduit_dupe_configuration (EAddrConduitCfg *c)
-{
- EAddrConduitCfg *retval;
-
- g_return_val_if_fail (c != NULL, NULL);
-
- retval = g_new0 (EAddrConduitCfg, 1);
- retval->sync_type = c->sync_type;
- retval->pilot_id = c->pilot_id;
-
- retval->secret = c->secret;
- retval->default_address = c->default_address;
- retval->last_uri = g_strdup (c->last_uri);
-
- return retval;
-}
-
-static void
-addrconduit_destroy_configuration (EAddrConduitCfg *c)
-{
- g_return_if_fail (c != NULL);
+ if (local->addr) {
+ g_snprintf (buff, 4096, "['%s' '%s' '%s']",
+ local->addr->entry[entryLastname] ?
+ local->addr->entry[entryLastname] : "",
+ local->addr->entry[entryFirstname] ?
+ local->addr->entry[entryFirstname] : "",
+ local->addr->entry[entryCompany] ?
+ local->addr->entry[entryCompany] : "");
+ return buff;
+ }
- g_free (c->last_uri);
- g_free (c);
+ return "";
}
-/* Gui */
-struct _EAddrConduitGui {
- GtkWidget *default_address;
-};
-
-static EAddrConduitGui *
-e_addr_gui_new (EPilotSettings *ps)
+static char *print_remote (GnomePilotRecord *remote)
{
- EAddrConduitGui *gui;
- GtkWidget *lbl, *menu;
- gint rows, i;
- static const char *items[] = {"Business", "Home", "Other", NULL};
-
- g_return_val_if_fail (ps != NULL, NULL);
- g_return_val_if_fail (E_IS_PILOT_SETTINGS (ps), NULL);
-
- gtk_table_resize (GTK_TABLE (ps), E_PILOT_SETTINGS_TABLE_ROWS + 1,
- E_PILOT_SETTINGS_TABLE_COLS);
-
- gui = g_new0 (EAddrConduitGui, 1);
-
- rows = E_PILOT_SETTINGS_TABLE_ROWS;
- lbl = gtk_label_new (_("Default Sync Address:"));
- gtk_misc_set_alignment (GTK_MISC (lbl), 0.0, 0.5);
- gui->default_address = gtk_option_menu_new ();
- menu = gtk_menu_new ();
- for (i = 0; items[i] != NULL; i++) {
- GtkWidget *item;
+ static char buff[ 4096 ];
+ struct Address addr;
- item = gtk_menu_item_new_with_label (items[i]);
- gtk_widget_show (item);
-
- gtk_menu_append (GTK_MENU (menu), item);
+ if (remote == NULL) {
+ sprintf (buff, "[NULL]");
+ return buff;
}
- gtk_widget_show (menu);
- gtk_option_menu_set_menu (GTK_OPTION_MENU (gui->default_address), menu);
- gtk_table_attach_defaults (GTK_TABLE (ps), lbl, 0, 1, rows, rows + 1);
- gtk_table_attach_defaults (GTK_TABLE (ps), gui->default_address, 1, 2, rows, rows + 1);
- gtk_widget_show (lbl);
- gtk_widget_show (gui->default_address);
-
- return gui;
-}
-
-static const int default_address_map[] = {
- E_CARD_SIMPLE_ADDRESS_ID_BUSINESS,
- E_CARD_SIMPLE_ADDRESS_ID_HOME,
- E_CARD_SIMPLE_ADDRESS_ID_OTHER,
- -1
-};
-static void
-e_addr_gui_fill_widgets (EAddrConduitGui *gui, EAddrConduitCfg *cfg)
-{
- g_return_if_fail (gui != NULL);
- g_return_if_fail (cfg != NULL);
-
- e_dialog_option_menu_set (gui->default_address,
- cfg->default_address,
- default_address_map);
-}
+ memset (&addr, 0, sizeof (struct Address));
+ unpack_Address (&addr, remote->record, remote->length);
-static void
-e_addr_gui_fill_config (EAddrConduitGui *gui, EAddrConduitCfg *cfg)
-{
- g_return_if_fail (gui != NULL);
- g_return_if_fail (cfg != NULL);
+ g_snprintf (buff, 4096, "['%s' '%s' '%s']",
+ addr.entry[entryLastname] ?
+ addr.entry[entryLastname] : "",
+ addr.entry[entryFirstname] ?
+ addr.entry[entryFirstname] : "",
+ addr.entry[entryCompany] ?
+ addr.entry[entryCompany] : "");
- cfg->default_address = e_dialog_option_menu_get (gui->default_address,
- default_address_map);
-}
+ free_Address (&addr);
-static void
-e_addr_gui_destroy (EAddrConduitGui *gui)
-{
- g_free (gui);
+ return buff;
}
-/* Context */
-struct _EAddrConduitContext {
- GnomePilotDBInfo *dbi;
-
- EAddrConduitCfg *cfg;
- EAddrConduitCfg *new_cfg;
- EAddrConduitGui *gui;
- GtkWidget *ps;
-
- struct AddressAppInfo ai;
-
- EBook *ebook;
- GList *cards;
- GList *changed;
- GHashTable *changed_hash;
- GList *locals;
-
- gboolean address_load_tried;
- gboolean address_load_success;
-
- EPilotMap *map;
-};
-
+/* Context Routines */
static EAddrConduitContext *
e_addr_context_new (guint32 pilot_id)
{
EAddrConduitContext *ctxt = g_new0 (EAddrConduitContext, 1);
- ctxt->cfg = addrconduit_load_configuration (pilot_id);
- ctxt->new_cfg = addrconduit_dupe_configuration (ctxt->cfg);
- ctxt->gui = NULL;
- ctxt->ps = NULL;
+ addrconduit_load_configuration (&ctxt->cfg, pilot_id);
+
ctxt->ebook = NULL;
ctxt->cards = NULL;
ctxt->changed_hash = NULL;
@@ -396,12 +211,8 @@ e_addr_context_destroy (EAddrConduitContext *ctxt)
g_return_if_fail (ctxt != NULL);
if (ctxt->cfg != NULL)
- addrconduit_destroy_configuration (ctxt->cfg);
- if (ctxt->new_cfg != NULL)
- addrconduit_destroy_configuration (ctxt->new_cfg);
- if (ctxt->gui != NULL)
- e_addr_gui_destroy (ctxt->gui);
-
+ addrconduit_destroy_configuration (&ctxt->cfg);
+
if (ctxt->ebook != NULL)
gtk_object_unref (GTK_OBJECT (ctxt->ebook));
@@ -428,7 +239,7 @@ e_addr_context_destroy (EAddrConduitContext *ctxt)
if (ctxt->locals != NULL) {
for (l = ctxt->locals; l != NULL; l = l->next)
- addrconduit_destroy_record (l->data);
+ free_local (l->data);
g_list_free (ctxt->locals);
}
@@ -438,57 +249,6 @@ e_addr_context_destroy (EAddrConduitContext *ctxt)
g_free (ctxt);
}
-/* Debug routines */
-static char *
-print_local (EAddrLocalRecord *local)
-{
- static char buff[ 4096 ];
-
- if (local == NULL) {
- sprintf (buff, "[NULL]");
- return buff;
- }
-
- if (local->addr) {
- g_snprintf (buff, 4096, "['%s' '%s' '%s']",
- local->addr->entry[entryLastname] ?
- local->addr->entry[entryLastname] : "",
- local->addr->entry[entryFirstname] ?
- local->addr->entry[entryFirstname] : "",
- local->addr->entry[entryCompany] ?
- local->addr->entry[entryCompany] : "");
- return buff;
- }
-
- return "";
-}
-
-static char *print_remote (GnomePilotRecord *remote)
-{
- static char buff[ 4096 ];
- struct Address addr;
-
- if (remote == NULL) {
- sprintf (buff, "[NULL]");
- return buff;
- }
-
- memset (&addr, 0, sizeof (struct Address));
- unpack_Address (&addr, remote->record, remote->length);
-
- g_snprintf (buff, 4096, "['%s' '%s' '%s']",
- addr.entry[entryLastname] ?
- addr.entry[entryLastname] : "",
- addr.entry[entryFirstname] ?
- addr.entry[entryFirstname] : "",
- addr.entry[entryCompany] ?
- addr.entry[entryCompany] : "");
-
- free_Address (&addr);
-
- return buff;
-}
-
/* Addressbok Server routines */
static void
add_card_cb (EBook *ebook, EBookStatus status, const char *id, gpointer closure)
@@ -857,6 +617,15 @@ compute_status (EAddrConduitContext *ctxt, EAddrLocalRecord *local, const char *
}
}
+static void
+free_local (EAddrLocalRecord *local)
+{
+ gtk_object_unref (GTK_OBJECT (local->ecard));
+ free_Address (local->addr);
+ g_free (local->addr);
+ g_free (local);
+}
+
static GnomePilotRecord
local_record_to_pilot_record (EAddrLocalRecord *local,
EAddrConduitContext *ctxt)
@@ -886,7 +655,6 @@ local_record_from_ecard (EAddrLocalRecord *local, ECard *ecard, EAddrConduitCont
{
ECardSimple *simple;
const ECardDeliveryAddress *delivery;
- ECardSimpleAddressId mailing_address;
int phone = entryPhone1;
gboolean syncable;
@@ -944,18 +712,7 @@ local_record_from_ecard (EAddrLocalRecord *local, ECard *ecard, EAddrConduitCont
local->addr->entry[entryCompany] = e_pilot_utf8_to_pchar (ecard->org);
local->addr->entry[entryTitle] = e_pilot_utf8_to_pchar (ecard->title);
- mailing_address = -1;
- for (i = 0; i < E_CARD_SIMPLE_ADDRESS_ID_LAST; i++) {
- const ECardAddrLabel *address;
-
- address = e_card_simple_get_address(simple, i);
- if (address && (address->flags & E_CARD_ADDR_DEFAULT))
- mailing_address = i;
- }
- if (mailing_address == -1)
- mailing_address = ctxt->cfg->default_address;
-
- delivery = e_card_simple_get_delivery_address (simple, mailing_address);
+ delivery = e_card_simple_get_delivery_address (simple, E_CARD_SIMPLE_ADDRESS_ID_BUSINESS);
if (delivery) {
local->addr->entry[entryAddress] = e_pilot_utf8_to_pchar (delivery->street);
local->addr->entry[entryCity] = e_pilot_utf8_to_pchar (delivery->city);
@@ -1080,7 +837,6 @@ ecard_from_remote_record(EAddrConduitContext *ctxt,
ECardName *name;
ECardDeliveryAddress *delivery;
ECardAddrLabel *label;
- ECardSimpleAddressId mailing_address;
char *txt;
ECardSimpleField next_mail, next_home, next_work, next_fax;
ECardSimpleField next_other, next_main, next_pager, next_mobile;
@@ -1123,19 +879,8 @@ ecard_from_remote_record(EAddrConduitContext *ctxt,
g_free (txt);
/* Address */
- mailing_address = -1;
- for (i = 0; i < E_CARD_SIMPLE_ADDRESS_ID_LAST; i++) {
- const ECardAddrLabel *addr;
-
- addr = e_card_simple_get_address(simple, i);
- if (addr && (addr->flags & E_CARD_ADDR_DEFAULT))
- mailing_address = i;
- }
- if (mailing_address == -1)
- mailing_address = ctxt->cfg->default_address;
-
delivery = e_card_delivery_address_new ();
- delivery->flags |= E_CARD_ADDR_DEFAULT;
+ delivery->flags = E_CARD_ADDR_WORK;
delivery->street = get_entry_text (address, entryAddress);
delivery->city = get_entry_text (address, entryCity);
delivery->region = get_entry_text (address, entryState);
@@ -1143,12 +888,12 @@ ecard_from_remote_record(EAddrConduitContext *ctxt,
delivery->code = get_entry_text (address, entryZip);
label = e_card_address_label_new ();
- label->flags |= E_CARD_ADDR_DEFAULT;
+ label->flags = E_CARD_ADDR_WORK;
label->data = e_card_delivery_address_to_string (delivery);
- e_card_simple_set_address (simple, mailing_address, label);
- e_card_simple_set_delivery_address (simple, mailing_address, delivery);
-
+ e_card_simple_set_address (simple, E_CARD_SIMPLE_ADDRESS_ID_BUSINESS, label);
+ e_card_simple_set_delivery_address (simple, E_CARD_SIMPLE_ADDRESS_ID_BUSINESS, delivery);
+
e_card_delivery_address_unref (delivery);
e_card_address_label_unref (label);
@@ -1754,7 +1499,7 @@ free_match (GnomePilotConduitSyncAbs *conduit,
g_return_val_if_fail (local != NULL, -1);
- addrconduit_destroy_record (local);
+ free_local (local);
return 0;
}
@@ -1772,63 +1517,6 @@ prepare (GnomePilotConduitSyncAbs *conduit,
return 0;
}
-/* Pilot Settings Callbacks */
-static void
-fill_widgets (EAddrConduitContext *ctxt)
-{
- e_pilot_settings_set_secret (E_PILOT_SETTINGS (ctxt->ps),
- ctxt->cfg->secret);
-
- e_addr_gui_fill_widgets (ctxt->gui, ctxt->cfg);
-}
-
-static gint
-create_settings_window (GnomePilotConduit *conduit,
- GtkWidget *parent,
- EAddrConduitContext *ctxt)
-{
- LOG ("create_settings_window");
-
- ctxt->ps = e_pilot_settings_new ();
- ctxt->gui = e_addr_gui_new (E_PILOT_SETTINGS (ctxt->ps));
-
- gtk_container_add (GTK_CONTAINER (parent), ctxt->ps);
- gtk_widget_show (ctxt->ps);
-
- fill_widgets (ctxt);
-
- return 0;
-}
-static void
-display_settings (GnomePilotConduit *conduit, EAddrConduitContext *ctxt)
-{
- LOG ("display_settings");
-
- fill_widgets (ctxt);
-}
-
-static void
-save_settings (GnomePilotConduit *conduit, EAddrConduitContext *ctxt)
-{
- LOG ("save_settings");
-
- ctxt->new_cfg->secret =
- e_pilot_settings_get_secret (E_PILOT_SETTINGS (ctxt->ps));
- e_addr_gui_fill_config (ctxt->gui, ctxt->new_cfg);
-
- addrconduit_save_configuration (ctxt->new_cfg);
-}
-
-static void
-revert_settings (GnomePilotConduit *conduit, EAddrConduitContext *ctxt)
-{
- LOG ("revert_settings");
-
- addrconduit_save_configuration (ctxt->cfg);
- addrconduit_destroy_configuration (ctxt->new_cfg);
- ctxt->new_cfg = addrconduit_dupe_configuration (ctxt->cfg);
-}
-
static ORBit_MessageValidationResult
accept_all_cookies (CORBA_unsigned_long request_id,
CORBA_Principal *principal,
@@ -1888,12 +1576,6 @@ conduit_get_gpilot_conduit (guint32 pilot_id)
gtk_signal_connect (retval, "prepare", (GtkSignalFunc) prepare, ctxt);
- /* Gui Settings */
- gtk_signal_connect (retval, "create_settings_window", (GtkSignalFunc) create_settings_window, ctxt);
- gtk_signal_connect (retval, "display_settings", (GtkSignalFunc) display_settings, ctxt);
- gtk_signal_connect (retval, "save_settings", (GtkSignalFunc) save_settings, ctxt);
- gtk_signal_connect (retval, "revert_settings", (GtkSignalFunc) revert_settings, ctxt);
-
return GNOME_PILOT_CONDUIT (retval);
}
diff --git a/addressbook/gui/component/addressbook-config.c b/addressbook/gui/component/addressbook-config.c
new file mode 100644
index 0000000000..8dfed83c59
--- /dev/null
+++ b/addressbook/gui/component/addressbook-config.c
@@ -0,0 +1,530 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+
+#include <config.h>
+
+#include <glib.h>
+#include <libgnome/gnome-defs.h>
+#include <libgnome/gnome-i18n.h>
+#include <libgnomeui/gnome-dialog.h>
+#include <libgnomeui/gnome-stock.h>
+#include <glade/glade.h>
+#include <gal/widgets/e-unicode.h>
+#include <gtkhtml/gtkhtml.h>
+#include <e-util/e-html-utils.h>
+#include "addressbook-config.h"
+#include "addressbook-storage.h"
+
+typedef struct _AddressbookSourceDialog AddressbookSourceDialog;
+typedef struct _AddressbookSourcePageItem AddressbookSourcePageItem;
+
+struct _AddressbookSourceDialog {
+ GladeXML *gui;
+
+ GtkWidget *dialog;
+
+ GtkWidget *notebook;
+ GtkWidget *basic_notebook;
+ GtkWidget *advanced_notebook;
+
+ GtkWidget *name;
+ GtkWidget *host;
+
+ GtkWidget *auth_checkbutton;
+ GtkWidget *auth_optionmenu;
+ GtkWidget *auth_notebook;
+ GtkWidget *email;
+ GtkWidget *binddn;
+ int auth;
+
+ GtkWidget *port;
+ GtkWidget *rootdn;
+ GtkWidget *scope_optionmenu;
+ AddressbookLDAPScopeType ldap_scope;
+
+ gint id; /* button we closed the dialog with */
+
+ AddressbookSource *source; /* our result if the Ok button was clicked */
+};
+
+static void
+addressbook_source_edit_changed (GtkWidget *item, AddressbookSourceDialog *dialog)
+{
+ char *data;
+ gboolean complete = TRUE;
+
+ if (complete) {
+ data = e_utf8_gtk_editable_get_chars (GTK_EDITABLE (dialog->name), 0, -1);
+ if (!data || !*data)
+ complete = FALSE;
+ g_free (data);
+ }
+
+ if (complete) {
+ if (complete) {
+ data = e_utf8_gtk_editable_get_chars (GTK_EDITABLE (dialog->host), 0, -1);
+ if (!data || !*data)
+ complete = FALSE;
+ g_free (data);
+ }
+
+ if (complete) {
+ data = e_utf8_gtk_editable_get_chars (GTK_EDITABLE (dialog->port), 0, -1);
+ if (!data || !*data)
+ complete = FALSE;
+ /* XXX more validation on port here */
+ g_free (data);
+ }
+ }
+
+ gnome_dialog_set_sensitive (GNOME_DIALOG (dialog->dialog), 0, complete);
+}
+
+static void
+auth_checkbutton_changed (GtkWidget *item, AddressbookSourceDialog *dialog)
+{
+ /* make sure the change is reflected by the state of the dialog's OK button */
+ addressbook_source_edit_changed (item, dialog);
+
+ gtk_widget_set_sensitive (dialog->auth_optionmenu,
+ gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(dialog->auth_checkbutton)));
+ gtk_widget_set_sensitive (dialog->auth_notebook,
+ gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(dialog->auth_checkbutton)));
+}
+
+static void
+scope_optionmenu_activated (GtkWidget *item, AddressbookSourceDialog *dialog)
+{
+ /* make sure the change is reflected by the state of the dialog's OK button */
+ addressbook_source_edit_changed (item, dialog);
+
+ dialog->ldap_scope = g_list_index (gtk_container_children (GTK_CONTAINER (item->parent)),
+ item);
+}
+
+static void
+auth_optionmenu_activated (GtkWidget *item, AddressbookSourceDialog *dialog)
+{
+ /* make sure the change is reflected by the state of the dialog's OK button */
+ addressbook_source_edit_changed (item, dialog);
+
+ dialog->auth = g_list_index (gtk_container_children (GTK_CONTAINER (item->parent)),
+ item) + 1;
+
+ gtk_notebook_set_page (GTK_NOTEBOOK(dialog->auth_notebook), dialog->auth - 1);
+}
+
+typedef struct {
+ GtkWidget *notebook;
+ int page_num;
+} FocusHelpClosure;
+
+static void
+focus_help (GtkWidget *w, GdkEventFocus *event, FocusHelpClosure *closure)
+{
+ gtk_notebook_set_page (GTK_NOTEBOOK(closure->notebook), closure->page_num);
+}
+
+static void
+add_focus_handler (GtkWidget *widget, GtkWidget *notebook, int page_num)
+{
+ FocusHelpClosure *focus_closure = g_new0 (FocusHelpClosure, 1);
+ focus_closure->notebook = notebook;
+ focus_closure->page_num = page_num;
+
+ gtk_signal_connect_full (GTK_OBJECT (widget),
+ "focus_in_event" /* XXX */,
+ (GtkSignalFunc) focus_help, NULL,
+ focus_closure,
+ (GtkDestroyNotify) g_free,
+ FALSE, FALSE);
+}
+
+static void
+addressbook_source_dialog_set_source (AddressbookSourceDialog *dialog, AddressbookSource *source)
+{
+ e_utf8_gtk_entry_set_text (GTK_ENTRY (dialog->name), source ? source->name : "");
+ e_utf8_gtk_entry_set_text (GTK_ENTRY (dialog->host), source ? source->host : "");
+ e_utf8_gtk_entry_set_text (GTK_ENTRY (dialog->email), source ? source->email_addr : "");
+ e_utf8_gtk_entry_set_text (GTK_ENTRY (dialog->binddn), source ? source->binddn : "");
+ e_utf8_gtk_entry_set_text (GTK_ENTRY (dialog->port), source ? source->port : "389");
+ e_utf8_gtk_entry_set_text (GTK_ENTRY (dialog->rootdn), source ? source->rootdn : "");
+
+ gtk_option_menu_set_history (GTK_OPTION_MENU(dialog->scope_optionmenu), source ? source->scope : ADDRESSBOOK_LDAP_SCOPE_ONELEVEL);
+ dialog->auth = source ? source->auth : ADDRESSBOOK_LDAP_AUTH_NONE;
+ if (dialog->auth != ADDRESSBOOK_LDAP_AUTH_NONE) {
+ gtk_option_menu_set_history (GTK_OPTION_MENU(dialog->auth_optionmenu), dialog->auth - 1);
+ gtk_notebook_set_page (GTK_NOTEBOOK(dialog->auth_notebook), dialog->auth - 1);
+ }
+
+ dialog->ldap_scope = source ? source->scope : ADDRESSBOOK_LDAP_SCOPE_ONELEVEL;
+ gtk_option_menu_set_history (GTK_OPTION_MENU(dialog->scope_optionmenu), dialog->ldap_scope);
+
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(dialog->auth_checkbutton), source && source->auth != ADDRESSBOOK_LDAP_AUTH_NONE);
+ gtk_widget_set_sensitive (dialog->auth_optionmenu, source && source->auth != ADDRESSBOOK_LDAP_AUTH_NONE);
+ gtk_widget_set_sensitive (dialog->auth_notebook, source && source->auth != ADDRESSBOOK_LDAP_AUTH_NONE);
+}
+
+static AddressbookSource *
+addressbook_source_dialog_get_source (AddressbookSourceDialog *dialog)
+{
+ AddressbookSource *source = g_new0 (AddressbookSource, 1);
+
+ source->name = e_utf8_gtk_entry_get_text (GTK_ENTRY (dialog->name));
+ source->host = e_utf8_gtk_entry_get_text (GTK_ENTRY (dialog->host));
+ source->email_addr = e_utf8_gtk_entry_get_text (GTK_ENTRY (dialog->email));
+ source->binddn = e_utf8_gtk_entry_get_text (GTK_ENTRY (dialog->binddn));
+ source->port = e_utf8_gtk_entry_get_text (GTK_ENTRY (dialog->port));
+ source->rootdn = e_utf8_gtk_entry_get_text (GTK_ENTRY (dialog->rootdn));
+ source->scope = dialog->ldap_scope;
+ source->auth = dialog->auth;
+
+ addressbook_storage_init_source_uri (source);
+
+ return source;
+}
+
+static void
+addressbook_source_dialog_ok_clicked (GtkWidget *widget, AddressbookSourceDialog *dialog)
+{
+ dialog->source = addressbook_source_dialog_get_source (dialog);
+}
+
+static void
+add_scope_activate_cb (GtkWidget *item, AddressbookSourceDialog *dialog)
+{
+ gtk_signal_connect (GTK_OBJECT (item), "activate",
+ GTK_SIGNAL_FUNC (scope_optionmenu_activated), dialog);
+}
+
+static void
+add_auth_activate_cb (GtkWidget *item, AddressbookSourceDialog *dialog)
+{
+ gtk_signal_connect (GTK_OBJECT (item), "activate",
+ GTK_SIGNAL_FUNC (auth_optionmenu_activated), dialog);
+}
+
+
+static AddressbookSourceDialog*
+addressbook_source_dialog (GladeXML *gui, AddressbookSource *source, GtkWidget *parent)
+{
+ AddressbookSourceDialog *dialog = g_new0 (AddressbookSourceDialog, 1);
+ GtkWidget *menu;
+
+ dialog->gui = gui;
+
+ dialog->dialog = glade_xml_get_widget (gui, "add_addressbook");
+
+ if (source)
+ gtk_window_set_title (GTK_WINDOW (dialog->dialog), _("Edit Addressbook"));
+
+ gtk_window_set_modal (GTK_WINDOW (dialog->dialog), TRUE);
+ gtk_window_set_policy (GTK_WINDOW (dialog->dialog),
+ FALSE, TRUE, FALSE);
+
+ gnome_dialog_set_parent (GNOME_DIALOG (dialog->dialog),
+ GTK_WINDOW (parent));
+
+ dialog->notebook = glade_xml_get_widget (gui, "add-addressbook-notebook");
+ dialog->basic_notebook = glade_xml_get_widget (gui, "basic-notebook");
+ dialog->advanced_notebook = glade_xml_get_widget (gui, "advanced-notebook");
+
+ /* BASIC STUFF */
+ dialog->name = glade_xml_get_widget (gui, "account-name-entry");
+ gtk_signal_connect (GTK_OBJECT (dialog->name), "changed",
+ GTK_SIGNAL_FUNC (addressbook_source_edit_changed), dialog);
+ add_focus_handler (dialog->name, dialog->basic_notebook, 0);
+
+ dialog->host = glade_xml_get_widget (gui, "server-name-entry");
+ gtk_signal_connect (GTK_OBJECT (dialog->host), "changed",
+ GTK_SIGNAL_FUNC (addressbook_source_edit_changed), dialog);
+ add_focus_handler (dialog->host, dialog->basic_notebook, 1);
+
+ /* BASIC -> AUTH STUFF */
+ dialog->auth_notebook = glade_xml_get_widget (gui, "auth-notebook");
+
+ dialog->auth_checkbutton = glade_xml_get_widget (gui, "auth-checkbutton");
+ add_focus_handler (dialog->auth_checkbutton, dialog->basic_notebook, 2);
+ gtk_signal_connect (GTK_OBJECT (dialog->auth_checkbutton), "toggled",
+ GTK_SIGNAL_FUNC (auth_checkbutton_changed), dialog);
+
+ dialog->auth_optionmenu = glade_xml_get_widget (gui, "auth-optionmenu");
+ menu = gtk_option_menu_get_menu (GTK_OPTION_MENU(dialog->auth_optionmenu));
+ gtk_container_foreach (GTK_CONTAINER (menu), (GtkCallback)add_auth_activate_cb, dialog);
+ add_focus_handler (dialog->auth_optionmenu, dialog->basic_notebook, 3);
+
+ dialog->email = glade_xml_get_widget (gui, "email-entry");
+ gtk_signal_connect (GTK_OBJECT (dialog->email), "changed",
+ GTK_SIGNAL_FUNC (addressbook_source_edit_changed), dialog);
+ add_focus_handler (dialog->email, dialog->basic_notebook, 4);
+
+ dialog->binddn = glade_xml_get_widget (gui, "dn-entry");
+ gtk_signal_connect (GTK_OBJECT (dialog->binddn), "changed",
+ GTK_SIGNAL_FUNC (addressbook_source_edit_changed), dialog);
+ add_focus_handler (dialog->binddn, dialog->basic_notebook, 5);
+
+ /* ADVANCED STUFF */
+ dialog->port = glade_xml_get_widget (gui, "port-entry");
+ gtk_signal_connect (GTK_OBJECT (dialog->port), "changed",
+ GTK_SIGNAL_FUNC (addressbook_source_edit_changed), dialog);
+ add_focus_handler (dialog->port, dialog->advanced_notebook, 0);
+
+ dialog->rootdn = glade_xml_get_widget (gui, "rootdn-entry");
+ gtk_signal_connect (GTK_OBJECT (dialog->rootdn), "changed",
+ GTK_SIGNAL_FUNC (addressbook_source_edit_changed), dialog);
+ add_focus_handler (dialog->rootdn, dialog->advanced_notebook, 1);
+
+ dialog->scope_optionmenu = glade_xml_get_widget (gui, "scope-optionmenu");
+ add_focus_handler (dialog->scope_optionmenu, dialog->advanced_notebook, 2);
+ menu = gtk_option_menu_get_menu (GTK_OPTION_MENU(dialog->scope_optionmenu));
+ gtk_container_foreach (GTK_CONTAINER (menu), (GtkCallback)add_scope_activate_cb, dialog);
+
+ /* fill in source info if there is some */
+ addressbook_source_dialog_set_source (dialog, source);
+
+ /* always start out on the first page. */
+ gtk_notebook_set_page (GTK_NOTEBOOK (dialog->notebook), 0);
+
+ gnome_dialog_set_sensitive (GNOME_DIALOG (dialog->dialog), 0, FALSE);
+
+ gnome_dialog_button_connect( GNOME_DIALOG (dialog->dialog), 0,
+ GTK_SIGNAL_FUNC (addressbook_source_dialog_ok_clicked),
+ dialog);
+
+ /* and set focus to be the Account field (the first editable
+ field on the first page) */
+ gtk_widget_grab_focus (dialog->name);
+
+ return dialog;
+}
+
+static AddressbookSourceDialog *
+addressbook_config_source_with_gui (GladeXML *gui, AddressbookSource *source, GtkWidget *parent)
+{
+ AddressbookSourceDialog* dialog;
+
+ dialog = addressbook_source_dialog (gui, source, parent);
+
+ gnome_dialog_close_hides (GNOME_DIALOG(dialog->dialog), TRUE);
+
+ dialog->id = gnome_dialog_run_and_close (GNOME_DIALOG (dialog->dialog));
+
+ return dialog;
+}
+
+void
+addressbook_create_new_source (const char *new_source, GtkWidget *parent)
+{
+ AddressbookSourceDialog *dialog;
+ GladeXML *gui;
+
+ gui = glade_xml_new (EVOLUTION_GLADEDIR "/addressbook-config.glade", NULL);
+
+ dialog = addressbook_source_dialog (gui, NULL, parent);
+
+ e_utf8_gtk_entry_set_text (GTK_ENTRY (dialog->name), new_source);
+
+ gnome_dialog_close_hides (GNOME_DIALOG(dialog->dialog), TRUE);
+
+ dialog->id = gnome_dialog_run_and_close (GNOME_DIALOG (dialog->dialog));
+
+ gtk_object_unref (GTK_OBJECT (dialog->gui));
+
+ if (dialog->id == 0) {
+ /* Ok was clicked */
+ addressbook_storage_add_source (addressbook_source_copy(dialog->source));
+ addressbook_storage_write_sources();
+ }
+}
+
+
+
+typedef struct {
+ GladeXML *gui;
+ GNOME_Evolution_Shell shell;
+ GtkWidget *dialog;
+ GtkWidget *clistSources;
+ GtkWidget *addSource;
+ GtkWidget *editSource;
+ GtkWidget *deleteSource;
+ gint source_row;
+} AddressbookDialog;
+
+static void
+update_sensitivity (AddressbookDialog *dialog)
+{
+ gboolean sensitive = dialog->source_row != -1;
+
+ gtk_widget_set_sensitive (dialog->editSource, sensitive);
+ gtk_widget_set_sensitive (dialog->deleteSource, sensitive);
+}
+
+static void
+add_source_clicked (GtkWidget *widget, AddressbookDialog *dialog)
+{
+ AddressbookSourceDialog *sdialog;
+
+ sdialog = addressbook_config_source_with_gui (dialog->gui, NULL, dialog->dialog);
+ if (sdialog->id == 0) {
+ /* Ok was clicked */
+ AddressbookSource *source = addressbook_source_copy(sdialog->source);
+ gint row;
+ gchar *text[2];
+
+ text[0] = source->name;
+ text[1] = source->host;
+
+ row = e_utf8_gtk_clist_append (GTK_CLIST(dialog->clistSources), text);
+ gtk_clist_set_row_data_full (GTK_CLIST(dialog->clistSources), row, source, (GtkDestroyNotify) addressbook_source_free);
+ gnome_dialog_set_sensitive (GNOME_DIALOG(dialog->dialog), 0, TRUE);
+ gnome_dialog_set_sensitive (GNOME_DIALOG(dialog->dialog), 1, TRUE);
+ update_sensitivity (dialog);
+ }
+}
+
+static void
+edit_source_clicked (GtkWidget *widget, AddressbookDialog *dialog)
+{
+ AddressbookSource *source;
+ AddressbookSourceDialog *sdialog;
+
+ source = gtk_clist_get_row_data (GTK_CLIST (dialog->clistSources), dialog->source_row);
+
+ sdialog = addressbook_config_source_with_gui (dialog->gui, source, dialog->dialog);
+ if (sdialog->id == 0) {
+ /* Ok was clicked */
+ source = addressbook_source_copy(sdialog->source);
+
+ e_utf8_gtk_clist_set_text (GTK_CLIST (dialog->clistSources), dialog->source_row, 0, source->name);
+ e_utf8_gtk_clist_set_text (GTK_CLIST (dialog->clistSources), dialog->source_row, 1, source->host);
+ gtk_clist_set_row_data (GTK_CLIST (dialog->clistSources), dialog->source_row, source);
+ gnome_dialog_set_sensitive (GNOME_DIALOG(dialog->dialog), 0, TRUE);
+ gnome_dialog_set_sensitive (GNOME_DIALOG(dialog->dialog), 1, TRUE);
+ update_sensitivity (dialog);
+ }
+}
+
+static void
+delete_source_clicked (GtkWidget *widget, AddressbookDialog *dialog)
+{
+ gtk_clist_remove (GTK_CLIST (dialog->clistSources), dialog->source_row);
+ dialog->source_row = -1;
+ gnome_dialog_set_sensitive (GNOME_DIALOG(dialog->dialog), 0, TRUE);
+ gnome_dialog_set_sensitive (GNOME_DIALOG(dialog->dialog), 1, TRUE);
+ update_sensitivity (dialog);
+}
+
+static void
+sources_select_row (GtkWidget *widget, gint row, gint column,
+ GdkEventButton *event, AddressbookDialog *dialog)
+{
+ dialog->source_row = row;
+
+ update_sensitivity (dialog);
+}
+
+static void
+addressbook_dialog_close (GtkWidget *w, AddressbookDialog *dialog)
+{
+ gtk_widget_destroy (dialog->dialog);
+ gtk_object_unref (GTK_OBJECT (dialog->gui));
+ g_free (dialog);
+}
+
+static void
+addressbook_dialog_apply (GtkWidget *w, AddressbookDialog *dialog)
+{
+ int i;
+
+ addressbook_storage_clear_sources();
+
+ for (i = 0; i < GTK_CLIST(dialog->clistSources)->rows; i ++) {
+ AddressbookSource *source = (AddressbookSource*)gtk_clist_get_row_data (GTK_CLIST (dialog->clistSources), i);
+ addressbook_storage_add_source (addressbook_source_copy (source));
+ }
+
+ addressbook_storage_write_sources();
+
+ gnome_dialog_set_sensitive (GNOME_DIALOG(dialog->dialog), 0, FALSE);
+ gnome_dialog_set_sensitive (GNOME_DIALOG(dialog->dialog), 1, FALSE);
+}
+
+static void
+addressbook_dialog_ok (GtkWidget *w, AddressbookDialog *dialog)
+{
+ addressbook_dialog_apply(w, dialog);
+ addressbook_dialog_close(w, dialog);
+}
+
+void
+addressbook_config (GNOME_Evolution_Shell shell)
+{
+ AddressbookDialog *dialog;
+ GladeXML *gui;
+ GtkWidget *clist;
+ GList *l;
+
+ dialog = g_new0 (AddressbookDialog, 1);
+
+ dialog->source_row = -1;
+
+ gui = glade_xml_new (EVOLUTION_GLADEDIR "/addressbook-config.glade", NULL);
+ dialog->gui = gui;
+ dialog->shell = shell;
+
+ dialog->dialog = glade_xml_get_widget (gui, "addressbook_sources");
+
+ clist = glade_xml_get_widget (gui, "clistSources");
+ dialog->clistSources = clist;
+
+ gtk_clist_column_titles_passive (GTK_CLIST (clist));
+ gtk_clist_set_column_width (GTK_CLIST (clist), 0, 80);
+
+ dialog->addSource = glade_xml_get_widget (gui, "addSource");
+ gtk_signal_connect (GTK_OBJECT(dialog->addSource), "clicked",
+ GTK_SIGNAL_FUNC (add_source_clicked),
+ dialog);
+
+ dialog->editSource = glade_xml_get_widget (gui, "editSource");
+ gtk_signal_connect (GTK_OBJECT(dialog->editSource), "clicked",
+ GTK_SIGNAL_FUNC (edit_source_clicked),
+ dialog);
+
+ dialog->deleteSource = glade_xml_get_widget (gui, "deleteSource");
+ gtk_signal_connect (GTK_OBJECT(dialog->deleteSource), "clicked",
+ GTK_SIGNAL_FUNC (delete_source_clicked),
+ dialog);
+
+ gnome_dialog_set_sensitive (GNOME_DIALOG(dialog->dialog), 0, FALSE);
+ gnome_dialog_set_sensitive (GNOME_DIALOG(dialog->dialog), 1, FALSE);
+ update_sensitivity (dialog);
+
+ l = addressbook_storage_get_sources ();
+ for (; l != NULL; l = l->next) {
+ AddressbookSource *source;
+ gint row;
+ gchar *text[2];
+
+ source = addressbook_source_copy ((AddressbookSource*)l->data);
+
+ text[0] = source->name;
+ text[1] = source->host;
+
+ row = e_utf8_gtk_clist_append (GTK_CLIST(clist), text);
+ gtk_clist_set_row_data_full (GTK_CLIST(clist), row, source, (GtkDestroyNotify) addressbook_source_free);
+ }
+
+ gtk_signal_connect (GTK_OBJECT (clist), "select_row",
+ GTK_SIGNAL_FUNC (sources_select_row),
+ dialog);
+
+ gnome_dialog_button_connect (GNOME_DIALOG(dialog->dialog),
+ 0 /* OK */, addressbook_dialog_ok, dialog);
+
+ gnome_dialog_button_connect (GNOME_DIALOG(dialog->dialog),
+ 1 /* APPLY */, addressbook_dialog_apply, dialog);
+
+ gnome_dialog_button_connect (GNOME_DIALOG(dialog->dialog),
+ 2 /* CLOSE */, addressbook_dialog_close, dialog);
+
+ gnome_dialog_run (GNOME_DIALOG(dialog->dialog));
+}
diff --git a/addressbook/gui/component/addressbook-config.glade b/addressbook/gui/component/addressbook-config.glade
new file mode 100644
index 0000000000..be48bbb891
--- /dev/null
+++ b/addressbook/gui/component/addressbook-config.glade
@@ -0,0 +1,1134 @@
+<?xml version="1.0"?>
+<GTK-Interface>
+
+<project>
+ <name>addressbook-config-mockup</name>
+ <program_name>addressbook-config-mockup</program_name>
+ <directory></directory>
+ <source_directory>src</source_directory>
+ <pixmaps_directory>pixmaps</pixmaps_directory>
+ <language>C</language>
+ <gnome_support>True</gnome_support>
+ <gettext_support>True</gettext_support>
+</project>
+
+<widget>
+ <class>GnomeDialog</class>
+ <name>add_addressbook</name>
+ <visible>False</visible>
+ <title>Add Addressbook</title>
+ <type>GTK_WINDOW_TOPLEVEL</type>
+ <position>GTK_WIN_POS_NONE</position>
+ <modal>False</modal>
+ <default_width>417</default_width>
+ <default_height>332</default_height>
+ <allow_shrink>False</allow_shrink>
+ <allow_grow>True</allow_grow>
+ <auto_shrink>False</auto_shrink>
+ <auto_close>False</auto_close>
+ <hide_on_close>False</hide_on_close>
+
+ <widget>
+ <class>GtkVBox</class>
+ <child_name>GnomeDialog:vbox</child_name>
+ <name>dialog-vbox1</name>
+ <homogeneous>False</homogeneous>
+ <spacing>8</spacing>
+ <child>
+ <padding>4</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkHButtonBox</class>
+ <child_name>GnomeDialog:action_area</child_name>
+ <name>dialog-action_area1</name>
+ <layout_style>GTK_BUTTONBOX_END</layout_style>
+ <spacing>8</spacing>
+ <child_min_width>85</child_min_width>
+ <child_min_height>27</child_min_height>
+ <child_ipad_x>7</child_ipad_x>
+ <child_ipad_y>0</child_ipad_y>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>True</fill>
+ <pack>GTK_PACK_END</pack>
+ </child>
+
+ <widget>
+ <class>GtkButton</class>
+ <name>button1</name>
+ <can_default>True</can_default>
+ <can_focus>True</can_focus>
+ <stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
+ </widget>
+
+ <widget>
+ <class>GtkButton</class>
+ <name>button3</name>
+ <can_default>True</can_default>
+ <can_focus>True</can_focus>
+ <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkNotebook</class>
+ <name>notebook2</name>
+ <can_focus>True</can_focus>
+ <show_tabs>True</show_tabs>
+ <show_border>True</show_border>
+ <tab_pos>GTK_POS_TOP</tab_pos>
+ <scrollable>False</scrollable>
+ <tab_hborder>2</tab_hborder>
+ <tab_vborder>2</tab_vborder>
+ <popup_enable>False</popup_enable>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkVBox</class>
+ <name>vbox1</name>
+ <border_width>3</border_width>
+ <homogeneous>False</homogeneous>
+ <spacing>3</spacing>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label29</name>
+ <label>The information below is required in order to add an addressbook. </label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>True</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkTable</class>
+ <name>table1</name>
+ <border_width>3</border_width>
+ <rows>2</rows>
+ <columns>2</columns>
+ <homogeneous>False</homogeneous>
+ <row_spacing>3</row_spacing>
+ <column_spacing>3</column_spacing>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label15</name>
+ <label>_Account name:</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <default_focus_target>account-name-entry</default_focus_target>
+ <child>
+ <left_attach>0</left_attach>
+ <right_attach>1</right_attach>
+ <top_attach>0</top_attach>
+ <bottom_attach>1</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>False</yfill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkEntry</class>
+ <name>account-name-entry</name>
+ <can_focus>True</can_focus>
+ <editable>True</editable>
+ <text_visible>True</text_visible>
+ <text_max_length>0</text_max_length>
+ <text></text>
+ <child>
+ <left_attach>1</left_attach>
+ <right_attach>2</right_attach>
+ <top_attach>0</top_attach>
+ <bottom_attach>1</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>True</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>False</yfill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label16</name>
+ <label>_Server name:</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <default_focus_target>server-name-entry</default_focus_target>
+ <child>
+ <left_attach>0</left_attach>
+ <right_attach>1</right_attach>
+ <top_attach>1</top_attach>
+ <bottom_attach>2</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>False</yfill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkEntry</class>
+ <name>server-name-entry</name>
+ <can_focus>True</can_focus>
+ <editable>True</editable>
+ <text_visible>True</text_visible>
+ <text_max_length>0</text_max_length>
+ <text></text>
+ <child>
+ <left_attach>1</left_attach>
+ <right_attach>2</right_attach>
+ <top_attach>1</top_attach>
+ <bottom_attach>2</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>True</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>False</yfill>
+ </child>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkAlignment</class>
+ <name>alignment2</name>
+ <xalign>0</xalign>
+ <yalign>0.5</yalign>
+ <xscale>1</xscale>
+ <yscale>1</yscale>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+
+ <widget>
+ <class>GtkVBox</class>
+ <name>auth-vbox</name>
+ <homogeneous>False</homogeneous>
+ <spacing>3</spacing>
+
+ <widget>
+ <class>GtkHBox</class>
+ <name>hbox9</name>
+ <homogeneous>False</homogeneous>
+ <spacing>0</spacing>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+
+ <widget>
+ <class>GtkCheckButton</class>
+ <name>auth-checkbutton</name>
+ <can_focus>True</can_focus>
+ <label>A_uthenticate with server using:</label>
+ <active>False</active>
+ <draw_indicator>True</draw_indicator>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkHBox</class>
+ <name>hbox10</name>
+ <homogeneous>False</homogeneous>
+ <spacing>3</spacing>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkOptionMenu</class>
+ <name>auth-optionmenu</name>
+ <can_focus>True</can_focus>
+ <items>Email address
+Distinguished name (DN)
+</items>
+ <initial_choice>0</initial_choice>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkNotebook</class>
+ <name>auth-notebook</name>
+ <show_tabs>False</show_tabs>
+ <show_border>False</show_border>
+ <tab_pos>GTK_POS_TOP</tab_pos>
+ <scrollable>False</scrollable>
+ <tab_hborder>2</tab_hborder>
+ <tab_vborder>2</tab_vborder>
+ <popup_enable>False</popup_enable>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkHBox</class>
+ <name>hbox5</name>
+ <border_width>3</border_width>
+ <homogeneous>False</homogeneous>
+ <spacing>3</spacing>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>email-label</name>
+ <label>_Email address:</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <default_focus_target>email-entry</default_focus_target>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkEntry</class>
+ <name>email-entry</name>
+ <can_focus>True</can_focus>
+ <editable>True</editable>
+ <text_visible>True</text_visible>
+ <text_max_length>0</text_max_length>
+ <text></text>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <child_name>Notebook:tab</child_name>
+ <name>label52</name>
+ <label>label52</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ </widget>
+
+ <widget>
+ <class>GtkHBox</class>
+ <name>hbox6</name>
+ <homogeneous>False</homogeneous>
+ <spacing>3</spacing>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>dn-label</name>
+ <label>_Distinguished Name:</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <default_focus_target>dn-entry</default_focus_target>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkEntry</class>
+ <name>dn-entry</name>
+ <can_focus>True</can_focus>
+ <editable>True</editable>
+ <text_visible>True</text_visible>
+ <text_max_length>0</text_max_length>
+ <text></text>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <child_name>Notebook:tab</child_name>
+ <name>label53</name>
+ <label>label53</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ </widget>
+ </widget>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkNotebook</class>
+ <name>basic-notebook</name>
+ <show_tabs>False</show_tabs>
+ <show_border>False</show_border>
+ <tab_pos>GTK_POS_TOP</tab_pos>
+ <scrollable>False</scrollable>
+ <tab_hborder>2</tab_hborder>
+ <tab_vborder>2</tab_vborder>
+ <popup_enable>False</popup_enable>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label28</name>
+ <label>This name will be used to identify your account. It is for display purposes only.</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>True</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <child_name>Notebook:tab</child_name>
+ <name>label18</name>
+ <label>label18</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label31</name>
+ <label>This is the name of the server where your addressbook is located.</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>True</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <child_name>Notebook:tab</child_name>
+ <name>label19</name>
+ <label>label19</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label57</name>
+ <label>Check this if the server requires you to authenticate.</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>True</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <child_name>Notebook:tab</child_name>
+ <name>label56</name>
+ <label>label56</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label61</name>
+ <label>This is the method evolution will use to authenticate you. Note that setting this to &quot;Email Address&quot; requires anonymous access to your ldap server.</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>True</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <child_name>Notebook:tab</child_name>
+ <name>label60</name>
+ <label>label60</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label48</name>
+ <label>Evolution will use this email address to authenticate you with the server</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>True</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <child_name>Notebook:tab</child_name>
+ <name>label47</name>
+ <label>label47</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label59</name>
+ <label>Evolution will use this Distinquished Name (DN) to authenticate you with the server</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>True</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <child_name>Notebook:tab</child_name>
+ <name>label58</name>
+ <label>label58</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ </widget>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <child_name>Notebook:tab</child_name>
+ <name>label12</name>
+ <label>Basic</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ </widget>
+
+ <widget>
+ <class>GtkVBox</class>
+ <name>vbox2</name>
+ <border_width>3</border_width>
+ <homogeneous>False</homogeneous>
+ <spacing>3</spacing>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label30</name>
+ <label>This information is not required for most ldap servers. </label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>True</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkTable</class>
+ <name>table2</name>
+ <border_width>3</border_width>
+ <rows>3</rows>
+ <columns>2</columns>
+ <homogeneous>False</homogeneous>
+ <row_spacing>3</row_spacing>
+ <column_spacing>3</column_spacing>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label22</name>
+ <label>_Port:</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <default_focus_target>port-entry</default_focus_target>
+ <child>
+ <left_attach>0</left_attach>
+ <right_attach>1</right_attach>
+ <top_attach>0</top_attach>
+ <bottom_attach>1</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>False</yfill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkEntry</class>
+ <name>port-entry</name>
+ <can_focus>True</can_focus>
+ <editable>True</editable>
+ <text_visible>True</text_visible>
+ <text_max_length>0</text_max_length>
+ <text>389</text>
+ <child>
+ <left_attach>1</left_attach>
+ <right_attach>2</right_attach>
+ <top_attach>0</top_attach>
+ <bottom_attach>1</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>True</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>False</yfill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label23</name>
+ <label>Search _base:</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <default_focus_target>rootdn-entry</default_focus_target>
+ <child>
+ <left_attach>0</left_attach>
+ <right_attach>1</right_attach>
+ <top_attach>1</top_attach>
+ <bottom_attach>2</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>False</yfill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkEntry</class>
+ <name>rootdn-entry</name>
+ <can_focus>True</can_focus>
+ <editable>True</editable>
+ <text_visible>True</text_visible>
+ <text_max_length>0</text_max_length>
+ <text></text>
+ <child>
+ <left_attach>1</left_attach>
+ <right_attach>2</right_attach>
+ <top_attach>1</top_attach>
+ <bottom_attach>2</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>True</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>False</yfill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label24</name>
+ <label>Search s_cope: </label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <child>
+ <left_attach>0</left_attach>
+ <right_attach>1</right_attach>
+ <top_attach>2</top_attach>
+ <bottom_attach>3</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>False</yfill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkAlignment</class>
+ <name>alignment1</name>
+ <xalign>7.45058e-09</xalign>
+ <yalign>7.45058e-09</yalign>
+ <xscale>0</xscale>
+ <yscale>1</yscale>
+ <child>
+ <left_attach>1</left_attach>
+ <right_attach>2</right_attach>
+ <top_attach>2</top_attach>
+ <bottom_attach>3</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>True</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>False</yfill>
+ </child>
+
+ <widget>
+ <class>GtkOptionMenu</class>
+ <name>scope-optionmenu</name>
+ <can_focus>True</can_focus>
+ <items>One
+Base
+Sub
+</items>
+ <initial_choice>0</initial_choice>
+ </widget>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkNotebook</class>
+ <name>advanced-notebook</name>
+ <show_tabs>False</show_tabs>
+ <show_border>False</show_border>
+ <tab_pos>GTK_POS_TOP</tab_pos>
+ <scrollable>False</scrollable>
+ <tab_hborder>2</tab_hborder>
+ <tab_vborder>2</tab_vborder>
+ <popup_enable>False</popup_enable>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label35</name>
+ <label>This is the port that your ldap server uses.</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>True</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <child_name>Notebook:tab</child_name>
+ <name>label25</name>
+ <label>label18</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label36</name>
+ <label>This is the base node for all your searches on the ldap server. Contact your server administrator for more information.</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>True</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <child_name>Notebook:tab</child_name>
+ <name>label26</name>
+ <label>label19</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label37</name>
+ <label>This information is used by your ldap server to specify which nodes are used in a search. Contact your server administrator for more information.</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>True</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <child_name>Notebook:tab</child_name>
+ <name>label27</name>
+ <label>label20</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ </widget>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <child_name>Notebook:tab</child_name>
+ <name>label13</name>
+ <label>Advanced</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ </widget>
+ </widget>
+ </widget>
+</widget>
+
+<widget>
+ <class>GnomeDialog</class>
+ <name>addressbook_sources</name>
+ <visible>False</visible>
+ <title>Addressbook Sources</title>
+ <type>GTK_WINDOW_TOPLEVEL</type>
+ <position>GTK_WIN_POS_NONE</position>
+ <modal>False</modal>
+ <default_width>355</default_width>
+ <default_height>285</default_height>
+ <allow_shrink>True</allow_shrink>
+ <allow_grow>True</allow_grow>
+ <auto_shrink>False</auto_shrink>
+ <auto_close>False</auto_close>
+ <hide_on_close>False</hide_on_close>
+
+ <widget>
+ <class>GtkVBox</class>
+ <child_name>GnomeDialog:vbox</child_name>
+ <name>dialog-vbox2</name>
+ <homogeneous>False</homogeneous>
+ <spacing>8</spacing>
+ <child>
+ <padding>4</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkHButtonBox</class>
+ <child_name>GnomeDialog:action_area</child_name>
+ <name>dialog-action_area2</name>
+ <layout_style>GTK_BUTTONBOX_END</layout_style>
+ <spacing>8</spacing>
+ <child_min_width>85</child_min_width>
+ <child_min_height>27</child_min_height>
+ <child_ipad_x>7</child_ipad_x>
+ <child_ipad_y>0</child_ipad_y>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>True</fill>
+ <pack>GTK_PACK_END</pack>
+ </child>
+
+ <widget>
+ <class>GtkButton</class>
+ <name>button7</name>
+ <can_default>True</can_default>
+ <can_focus>True</can_focus>
+ <stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
+ </widget>
+
+ <widget>
+ <class>GtkButton</class>
+ <name>button8</name>
+ <can_default>True</can_default>
+ <can_focus>True</can_focus>
+ <stock_button>GNOME_STOCK_BUTTON_APPLY</stock_button>
+ </widget>
+
+ <widget>
+ <class>GtkButton</class>
+ <name>button9</name>
+ <can_default>True</can_default>
+ <can_focus>True</can_focus>
+ <stock_button>GNOME_STOCK_BUTTON_CLOSE</stock_button>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkHBox</class>
+ <name>hbox3</name>
+ <homogeneous>False</homogeneous>
+ <spacing>0</spacing>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkScrolledWindow</class>
+ <name>scrolledwindow2</name>
+ <hscrollbar_policy>GTK_POLICY_AUTOMATIC</hscrollbar_policy>
+ <vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy>
+ <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
+ <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkCList</class>
+ <name>clistSources</name>
+ <can_focus>True</can_focus>
+ <columns>2</columns>
+ <column_widths>100,80</column_widths>
+ <selection_mode>GTK_SELECTION_SINGLE</selection_mode>
+ <show_titles>True</show_titles>
+ <shadow_type>GTK_SHADOW_IN</shadow_type>
+
+ <widget>
+ <class>GtkLabel</class>
+ <child_name>CList:title</child_name>
+ <name>label43</name>
+ <label>Account Name</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <child_name>CList:title</child_name>
+ <name>label44</name>
+ <label>Server Name</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ </widget>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkVBox</class>
+ <name>vbox4</name>
+ <homogeneous>False</homogeneous>
+ <spacing>0</spacing>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label45</name>
+ <label>
+</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkVButtonBox</class>
+ <name>vbuttonbox3</name>
+ <layout_style>GTK_BUTTONBOX_START</layout_style>
+ <spacing>0</spacing>
+ <child_min_width>85</child_min_width>
+ <child_min_height>27</child_min_height>
+ <child_ipad_x>7</child_ipad_x>
+ <child_ipad_y>0</child_ipad_y>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkButton</class>
+ <name>addSource</name>
+ <can_default>True</can_default>
+ <can_focus>True</can_focus>
+ <label>_Add</label>
+ <relief>GTK_RELIEF_NORMAL</relief>
+ </widget>
+
+ <widget>
+ <class>GtkButton</class>
+ <name>editSource</name>
+ <can_default>True</can_default>
+ <can_focus>True</can_focus>
+ <label>_Edit</label>
+ <relief>GTK_RELIEF_NORMAL</relief>
+ </widget>
+
+ <widget>
+ <class>GtkButton</class>
+ <name>deleteSource</name>
+ <can_default>True</can_default>
+ <can_focus>True</can_focus>
+ <label>De_lete</label>
+ <relief>GTK_RELIEF_NORMAL</relief>
+ </widget>
+ </widget>
+ </widget>
+ </widget>
+ </widget>
+</widget>
+
+</GTK-Interface>
diff --git a/addressbook/gui/component/addressbook-factory.c b/addressbook/gui/component/addressbook-factory.c
index 6f675894e0..a5467d1309 100644
--- a/addressbook/gui/component/addressbook-factory.c
+++ b/addressbook/gui/component/addressbook-factory.c
@@ -61,8 +61,6 @@ main (int argc, char **argv)
{
bindtextdomain (PACKAGE, EVOLUTION_LOCALEDIR);
textdomain (PACKAGE);
-
- free (malloc (5));
init_corba (&argc, argv);
@@ -100,8 +98,6 @@ main (int argc, char **argv)
gtk_widget_push_visual (gdk_rgb_get_visual ());
gtk_widget_push_colormap (gdk_rgb_get_cmap ());
- g_print ("Evolution Addressbook up and running\n");
-
bonobo_main ();
return 0;
diff --git a/addressbook/gui/component/addressbook-storage.c b/addressbook/gui/component/addressbook-storage.c
index 2b54c5019e..31e07919ab 100644
--- a/addressbook/gui/component/addressbook-storage.c
+++ b/addressbook/gui/component/addressbook-storage.c
@@ -31,7 +31,6 @@
<rootdn></rootdn>
<authmethod>simple</authmethod>
<emailaddr>toshok@blubag.com</emailaddr>
- <limit>100</limit>
<rememberpass/>
</contactserver>
</addressbooks>
@@ -44,7 +43,7 @@
#include "addressbook-storage.h"
#include <sys/types.h>
-#include <fcntl.h>
+#include <sys/fcntl.h>
#include <sys/stat.h>
#include <errno.h>
@@ -65,7 +64,7 @@
#include "evolution-shell-component.h"
-#include "ldap-config.h"
+#include "addressbook-config.h"
#define ADDRESSBOOK_SOURCES_XML "addressbook-sources.xml"
@@ -151,7 +150,7 @@ create_ldap_folder (EvolutionStorage *storage, const Bonobo_Listener listener,
notify_listener (listener, GNOME_Evolution_Storage_INVALID_URI);
return;
}
- ldap_config_create_new_source (path + 1, NULL);
+ addressbook_create_new_source (path + 1, NULL);
notify_listener (listener, GNOME_Evolution_Storage_OK);
}
@@ -165,7 +164,7 @@ addressbook_get_other_contact_storage (void)
EvolutionStorageResult result;
if (storage == NULL) {
- storage = evolution_storage_new (U_("Other Contacts"));
+ storage = evolution_storage_new (U_("Other Contacts"), NULL, NULL);
gtk_signal_connect (GTK_OBJECT (storage),
"remove_folder",
GTK_SIGNAL_FUNC(remove_ldap_folder), NULL);
@@ -232,30 +231,6 @@ get_string_value (xmlNode *node,
return retval;
}
-
-static int
-get_integer_value (xmlNode *node,
- const char *name,
- int defval)
-{
- xmlNode *p;
- xmlChar *xml_string;
- int retval;
-
- p = e_xml_get_child_by_name (node, (xmlChar *) name);
- if (p == NULL)
- return defval;
-
- p = e_xml_get_child_by_name (p, (xmlChar *) "text");
- if (p == NULL) /* there's no text between the tags, return the default */
- return defval;
-
- xml_string = xmlNodeListGetString (node->doc, p, 1);
- retval = atoi (xml_string);
- xmlFree (xml_string);
-
- return retval;
-}
#endif
static char *
@@ -322,38 +297,6 @@ ldap_parse_scope (const char *scope)
}
#endif
-static char *
-ldap_unparse_ssl (AddressbookLDAPSSLType ssl_type)
-{
- switch (ssl_type) {
- case ADDRESSBOOK_LDAP_SSL_NEVER:
- return "never";
- case ADDRESSBOOK_LDAP_SSL_WHENEVER_POSSIBLE:
- return "whenever_possible";
- case ADDRESSBOOK_LDAP_SSL_ALWAYS:
- return "always";
- default:
- g_assert(0);
- return "";
- }
-}
-
-#ifdef HAVE_LDAP
-static AddressbookLDAPSSLType
-ldap_parse_ssl (const char *ssl)
-{
- if (!ssl)
- return ADDRESSBOOK_LDAP_SSL_WHENEVER_POSSIBLE; /* XXX good default? */
-
- if (!strcmp (ssl, "always"))
- return ADDRESSBOOK_LDAP_SSL_ALWAYS;
- else if (!strcmp (ssl, "never"))
- return ADDRESSBOOK_LDAP_SSL_NEVER;
- else
- return ADDRESSBOOK_LDAP_SSL_WHENEVER_POSSIBLE;
-}
-#endif
-
const char*
addressbook_storage_auth_type_to_string (AddressbookLDAPAuthType auth_type)
{
@@ -363,27 +306,12 @@ addressbook_storage_auth_type_to_string (AddressbookLDAPAuthType auth_type)
void
addressbook_storage_init_source_uri (AddressbookSource *source)
{
- GString *str;
-
if (source->uri)
g_free (source->uri);
- str = g_string_new ("ldap://");
-
- g_string_sprintfa (str, "%s:%s/%s?"/*trigraph prevention*/"?%s",
- source->host, source->port, source->rootdn, ldap_unparse_scope (source->scope));
-
- if (source->limit != 100)
- g_string_sprintfa (str, ";limit=%d", source->limit);
-
- if (source->ssl != ADDRESSBOOK_LDAP_SSL_WHENEVER_POSSIBLE)
- g_string_sprintfa (str, ";ssl=%s", ldap_unparse_ssl (source->ssl));
-
- /* XXX need to do timeout info */
-
- source->uri = str->str;
-
- g_string_free (str, FALSE);
+ source->uri = g_strdup_printf ("ldap://%s:%s/%s??%s",
+ source->host, source->port,
+ source->rootdn, ldap_unparse_scope(source->scope));
}
#ifdef HAVE_LDAP
@@ -412,7 +340,7 @@ load_source_data (const char *file_path)
if (rv < 0) {
g_error ("Failed to rename %s: %s\n",
- file_path,
+ ADDRESSBOOK_SOURCES_XML,
strerror(errno));
return FALSE;
} else
@@ -436,15 +364,14 @@ load_source_data (const char *file_path)
source = g_new0 (AddressbookSource, 1);
if (!strcmp (child->name, "contactserver")) {
+ source->type = ADDRESSBOOK_SOURCE_LDAP;
source->port = get_string_value (child, "port");
source->host = get_string_value (child, "host");
source->rootdn = get_string_value (child, "rootdn");
source->scope = ldap_parse_scope (get_string_value (child, "scope"));
source->auth = ldap_parse_auth (get_string_value (child, "authmethod"));
- source->ssl = ldap_parse_ssl (get_string_value (child, "ssl"));
source->email_addr = get_string_value (child, "emailaddr");
source->binddn = get_string_value (child, "binddn");
- source->limit = get_integer_value (child, "limit", 100);
}
else {
g_warning ("unknown node '%s' in %s", child->name, file_path);
@@ -499,14 +426,6 @@ ldap_source_foreach(AddressbookSource *source, xmlNode *root)
xmlNewChild (source_root, NULL, (xmlChar *) "authmethod",
(xmlChar *) ldap_unparse_auth(source->auth));
- if (source->limit != 100) {
- char *string;
- string = g_strdup_printf ("%d", source->limit);
- xmlNewChild (source_root, NULL, (xmlChar *) "limit",
- (xmlChar *) string);
- g_free (string);
- }
-
if (source->auth != ADDRESSBOOK_LDAP_AUTH_NONE) {
if (source->auth == ADDRESSBOOK_LDAP_AUTH_SIMPLE_BINDDN)
xmlNewChild (source_root, NULL, (xmlChar *) "binddn",
@@ -543,7 +462,7 @@ save_source_data (const char *file_path)
xmlDocDumpMemory (doc, &buf, &buf_size);
if (buf == NULL) {
- g_error ("Failed to write %s: xmlBufferCreate() == NULL", file_path);
+ g_error ("Failed to write %s: xmlBufferCreate() == NULL", ADDRESSBOOK_SOURCES_XML);
return FALSE;
}
@@ -552,13 +471,13 @@ save_source_data (const char *file_path)
close (fd);
if (0 > rv) {
- g_error ("Failed to write new %s: %s\n", file_path, strerror(errno));
+ g_error ("Failed to write new %s: %s\n", ADDRESSBOOK_SOURCES_XML, strerror(errno));
unlink (new_path);
return FALSE;
}
else {
if (0 > rename (new_path, file_path)) {
- g_error ("Failed to rename %s: %s\n", file_path, strerror(errno));
+ g_error ("Failed to rename %s: %s\n", ADDRESSBOOK_SOURCES_XML, strerror(errno));
unlink (new_path);
return FALSE;
}
@@ -686,6 +605,7 @@ addressbook_source_copy (const AddressbookSource *source)
copy = g_new0 (AddressbookSource, 1);
copy->name = g_strdup (source->name);
copy->description = g_strdup (source->description);
+ copy->type = source->type;
copy->uri = g_strdup (source->uri);
copy->host = g_strdup (source->host);
@@ -693,11 +613,9 @@ addressbook_source_copy (const AddressbookSource *source)
copy->rootdn = g_strdup (source->rootdn);
copy->scope = source->scope;
copy->auth = source->auth;
- copy->ssl = source->ssl;
copy->email_addr = g_strdup (source->email_addr);
copy->binddn = g_strdup (source->binddn);
copy->remember_passwd = source->remember_passwd;
- copy->limit = source->limit;
return copy;
}
diff --git a/addressbook/gui/component/addressbook-storage.h b/addressbook/gui/component/addressbook-storage.h
index edaa5cfb83..ffe8e30515 100644
--- a/addressbook/gui/component/addressbook-storage.h
+++ b/addressbook/gui/component/addressbook-storage.h
@@ -27,6 +27,12 @@
#include "evolution-storage.h"
typedef enum {
+ ADDRESSBOOK_SOURCE_LDAP,
+ ADDRESSBOOK_SOURCE_FILE,
+ ADDRESSBOOK_SOURCE_LAST
+} AddressbookSourceType;
+
+typedef enum {
ADDRESSBOOK_LDAP_AUTH_NONE,
ADDRESSBOOK_LDAP_AUTH_SIMPLE_EMAIL,
ADDRESSBOOK_LDAP_AUTH_SIMPLE_BINDDN,
@@ -39,13 +45,8 @@ typedef enum {
ADDRESSBOOK_LDAP_SCOPE_LAST
} AddressbookLDAPScopeType;
-typedef enum {
- ADDRESSBOOK_LDAP_SSL_NEVER,
- ADDRESSBOOK_LDAP_SSL_WHENEVER_POSSIBLE,
- ADDRESSBOOK_LDAP_SSL_ALWAYS
-} AddressbookLDAPSSLType;
-
typedef struct {
+ AddressbookSourceType type;
char *name;
char *description;
char *host;
@@ -53,12 +54,9 @@ typedef struct {
char *rootdn;
AddressbookLDAPScopeType scope;
AddressbookLDAPAuthType auth;
- AddressbookLDAPSSLType ssl;
char *email_addr; /* used in AUTH_SIMPLE_EMAIL */
char *binddn; /* used in AUTH_SIMPLE_BINDDN */
gboolean remember_passwd;
- int limit;
-
char *uri; /* filled in from the above */
} AddressbookSource;
diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c
index 99ba3b9521..17acb9b6b6 100644
--- a/addressbook/gui/component/addressbook.c
+++ b/addressbook/gui/component/addressbook.c
@@ -32,7 +32,7 @@
#include "evolution-activity-client.h"
#include "e-contact-editor.h"
#include "e-contact-save-as.h"
-#include "ldap-config.h"
+#include "addressbook-config.h"
#include "addressbook.h"
#include "addressbook-component.h"
#include "addressbook/gui/search/e-addressbook-search-dialog.h"
@@ -66,7 +66,6 @@ typedef struct {
BonoboPropertyBag *properties;
char *uri;
char *passwd;
- gboolean ignore_search_changes;
} AddressbookView;
static void addressbook_view_ref (AddressbookView *);
@@ -115,11 +114,9 @@ save_contact_cb (BonoboUIComponent *uih, void *user_data, const char *path)
}
static void
-view_contact_cb (BonoboUIComponent *uih, void *user_data, const char *path)
+config_cb (BonoboUIComponent *uih, void *user_data, const char *path)
{
- AddressbookView *view = (AddressbookView *) user_data;
- if (view->view)
- e_addressbook_view_view(view->view);
+ addressbook_config (NULL /* XXX */);
}
static void
@@ -212,22 +209,6 @@ send_contact_to_cb (BonoboUIComponent *uih, void *user_data, const char *path)
}
static void
-copy_contact_to_cb (BonoboUIComponent *uih, void *user_data, const char *path)
-{
- AddressbookView *view = (AddressbookView *) user_data;
- if (view->view)
- e_addressbook_view_copy_to_folder (view->view);
-}
-
-static void
-move_contact_to_cb (BonoboUIComponent *uih, void *user_data, const char *path)
-{
- AddressbookView *view = (AddressbookView *) user_data;
- if (view->view)
- e_addressbook_view_move_to_folder (view->view);
-}
-
-static void
forget_passwords_cb (BonoboUIComponent *uih, void *user_data, const char *path)
{
e_passwords_forget_passwords();
@@ -244,7 +225,7 @@ update_command_state (EAddressbookView *eav, AddressbookView *view)
addressbook_view_ref (view);
uic = bonobo_control_get_ui_component (view->control);
-
+
if (bonobo_ui_component_get_container (uic) != CORBA_OBJECT_NIL) {
/* New Contact */
@@ -256,34 +237,30 @@ update_command_state (EAddressbookView *eav, AddressbookView *view)
"/commands/ContactNewList",
"sensitive",
e_addressbook_view_can_create (view->view) ? "1" : "0", NULL);
-
+
bonobo_ui_component_set_prop (uic,
"/commands/ContactsSaveAsVCard",
"sensitive",
e_addressbook_view_can_save_as (view->view) ? "1" : "0", NULL);
- bonobo_ui_component_set_prop (uic,
- "/commands/ContactsView",
- "sensitive",
- e_addressbook_view_can_view (view->view) ? "1" : "0", NULL);
-
+
/* Print Contact */
bonobo_ui_component_set_prop (uic,
"/commands/ContactsPrint",
"sensitive",
e_addressbook_view_can_print (view->view) ? "1" : "0", NULL);
-
+
/* Print Contact */
bonobo_ui_component_set_prop (uic,
"/commands/ContactsPrintPreview",
"sensitive",
e_addressbook_view_can_print (view->view) ? "1" : "0", NULL);
-
+
/* Delete Contact */
bonobo_ui_component_set_prop (uic,
"/commands/ContactDelete",
"sensitive",
e_addressbook_view_can_delete (view->view) ? "1" : "0", NULL);
-
+
bonobo_ui_component_set_prop (uic,
"/commands/ContactsCut",
"sensitive",
@@ -300,31 +277,24 @@ update_command_state (EAddressbookView *eav, AddressbookView *view)
"/commands/ContactsSelectAll",
"sensitive",
e_addressbook_view_can_select_all (view->view) ? "1" : "0", NULL);
-
+
bonobo_ui_component_set_prop (uic,
"/commands/ContactsSendContactToOther",
"sensitive",
e_addressbook_view_can_send (view->view) ? "1" : "0", NULL);
-
+
bonobo_ui_component_set_prop (uic,
"/commands/ContactsSendMessageToContact",
"sensitive",
e_addressbook_view_can_send_to (view->view) ? "1" : "0", NULL);
-
- bonobo_ui_component_set_prop (uic,
- "/commands/ContactsMoveToFolder",
- "sensitive",
- e_addressbook_view_can_move_to_folder (view->view) ? "1" : "0", NULL);
- bonobo_ui_component_set_prop (uic,
- "/commands/ContactsCopyToFolder",
- "sensitive",
- e_addressbook_view_can_copy_to_folder (view->view) ? "1" : "0", NULL);
-
+
+
/* Stop */
bonobo_ui_component_set_prop (uic,
"/commands/ContactStop",
"sensitive",
e_addressbook_view_can_stop (view->view) ? "1" : "0", NULL);
+
}
addressbook_view_unref (view);
@@ -340,9 +310,10 @@ static BonoboUIVerb verbs [] = {
BONOBO_UI_UNSAFE_VERB ("ContactsPrint", print_cb),
BONOBO_UI_UNSAFE_VERB ("ContactsPrintPreview", print_preview_cb),
BONOBO_UI_UNSAFE_VERB ("ContactsSaveAsVCard", save_contact_cb),
- BONOBO_UI_UNSAFE_VERB ("ContactsView", view_contact_cb),
BONOBO_UI_UNSAFE_VERB ("ToolSearch", search_cb),
+ BONOBO_UI_UNSAFE_VERB ("AddressbookConfig", config_cb),
+
BONOBO_UI_UNSAFE_VERB ("ContactNew", new_contact_cb),
BONOBO_UI_UNSAFE_VERB ("ContactNewList", new_contact_list_cb),
BONOBO_UI_UNSAFE_VERB ("ContactDelete", delete_contact_cb),
@@ -355,8 +326,6 @@ static BonoboUIVerb verbs [] = {
BONOBO_UI_UNSAFE_VERB ("ContactsSendContactToOther", send_contact_cb),
BONOBO_UI_UNSAFE_VERB ("ContactsSendMessageToContact", send_contact_to_cb),
- BONOBO_UI_UNSAFE_VERB ("ContactsMoveToFolder", move_contact_to_cb),
- BONOBO_UI_UNSAFE_VERB ("ContactsCopyToFolder", copy_contact_to_cb),
BONOBO_UI_UNSAFE_VERB ("ContactsForgetPasswords", forget_passwords_cb),
BONOBO_UI_VERB_END
@@ -374,7 +343,10 @@ static EPixmap pixmaps [] = {
E_PIXMAP ("/menu/EditPlaceholder/Edit/ContactDelete", "evolution-trash-mini.png"),
E_PIXMAP ("/menu/Tools/ComponentPlaceholder/ToolSearch", "search-16.png"),
+ E_PIXMAP ("/menu/Tools/ComponentPlaceholder/AddressbookConfig", "configure_16_addressbook.xpm"),
+ E_PIXMAP ("/Toolbar/ContactNew", "new_contact.xpm"),
+ E_PIXMAP ("/Toolbar/ContactNewList", "all_contacts.xpm"),
E_PIXMAP ("/Toolbar/ContactsPrint", "buttons/print.png"),
E_PIXMAP ("/Toolbar/ContactDelete", "buttons/delete-message.png"),
@@ -392,8 +364,6 @@ control_activate (BonoboControl *control,
bonobo_ui_component_set_container (uic, remote_ui_container);
bonobo_object_release_unref (remote_ui_container, NULL);
- e_search_bar_set_ui_component (view->search, uic);
-
bonobo_ui_component_add_verb_list_with_data (
uic, verbs, view);
@@ -446,9 +416,8 @@ addressbook_view_unref (AddressbookView *view)
{
g_assert (view->refs > 0);
--view->refs;
- if (view->refs == 0) {
+ if (view->refs == 0)
g_free (view);
- }
}
static ECategoriesMasterList *
@@ -519,7 +488,7 @@ book_open_cb (EBook *book, EBookStatus status, gpointer closure)
source = addressbook_storage_get_source_by_uri (view->uri);
- if (source) {
+ if (source && source->type == ADDRESSBOOK_SOURCE_LDAP) {
#if HAVE_LDAP
label = gtk_label_new (
_("We were unable to open this addressbook. This either\n"
@@ -596,7 +565,34 @@ get_prop (BonoboPropertyBag *bag,
}
}
+char *
+addressbook_expand_uri (const char *uri)
+{
+ char *new_uri;
+
+ if (!strncmp (uri, "file:", 5)) {
+ if (strlen (uri + 7) > 3
+ && !strcmp (uri + strlen(uri) - 3, ".db")) {
+ /* it's a .db file */
+ new_uri = g_strdup (uri);
+ }
+ else {
+ char *file_name;
+ /* we assume it's a dir and glom addressbook.db onto the end. */
+ file_name = g_concat_dir_and_file(uri + 7, "addressbook.db");
+ new_uri = g_strdup_printf("file://%s", file_name);
+ g_free(file_name);
+ }
+ }
+ else {
+ new_uri = g_strdup (uri);
+ }
+
+ return new_uri;
+}
+
typedef struct {
+ char *uri;
EBookCallback cb;
gpointer closure;
} LoadUriData;
@@ -613,6 +609,7 @@ load_uri_auth_cb (EBook *book, EBookStatus status, gpointer closure)
data->cb (book, status, data->closure);
+ g_free (data->uri);
g_free (data);
}
@@ -623,17 +620,18 @@ load_uri_cb (EBook *book, EBookStatus status, gpointer closure)
AddressbookSource *source;
LoadUriData *load_uri_data = closure;
- source = addressbook_storage_get_source_by_uri (e_book_get_uri (book));
+ source = addressbook_storage_get_source_by_uri (load_uri_data->uri);
if (status == E_BOOK_STATUS_SUCCESS) {
/* check if the addressbook needs authentication */
if (source &&
+ source->type == ADDRESSBOOK_SOURCE_LDAP &&
source->auth != ADDRESSBOOK_LDAP_AUTH_NONE) {
const char *password;
char *pass_dup = NULL;
- password = e_passwords_get_password (e_book_get_uri (book));
+ password = e_passwords_get_password(load_uri_data->uri);
if (!password) {
char *prompt;
@@ -647,7 +645,7 @@ load_uri_cb (EBook *book, EBookStatus status, gpointer closure)
source->name, source->email_addr);
remember = source->remember_passwd;
pass_dup = e_passwords_ask_password (
- prompt, e_book_get_uri (book), prompt, TRUE,
+ prompt, load_uri_data->uri, prompt, TRUE,
E_PASSWORDS_REMEMBER_FOREVER, &remember,
NULL);
if (remember != source->remember_passwd) {
@@ -676,6 +674,7 @@ load_uri_cb (EBook *book, EBookStatus status, gpointer closure)
}
load_uri_data->cb (book, status, load_uri_data->closure);
+ g_free (load_uri_data->uri);
g_free (load_uri_data);
}
@@ -686,30 +685,79 @@ addressbook_load_uri (EBook *book, const char *uri,
LoadUriData *load_uri_data = g_new (LoadUriData, 1);
gboolean rv;
+ load_uri_data->uri = g_strdup (uri);
load_uri_data->cb = cb;
load_uri_data->closure = closure;
rv = e_book_load_uri (book, uri, load_uri_cb, load_uri_data);
- if (!rv)
+ if (!rv) {
+ g_free (load_uri_data->uri);
g_free (load_uri_data);
+ }
return rv;
}
+typedef struct {
+ gpointer closure;
+ EBookCallback open_response;
+} DefaultBookClosure;
+
+static void
+addressbook_default_book_open (EBook *book, EBookStatus status, gpointer closure)
+{
+ DefaultBookClosure *default_book_closure = closure;
+ gpointer user_closure = default_book_closure->closure;
+ EBookCallback user_response = default_book_closure->open_response;
+
+ g_free (default_book_closure);
+
+ /* special case the protocol not supported error, since we
+ really only want to failover to the local book in the case
+ where there's no installed backend for that protocol. all
+ other errors (failure to connect, etc.) should get reported
+ to the caller as normal. */
+ if (status == E_BOOK_STATUS_PROTOCOL_NOT_SUPPORTED) {
+ e_book_load_local_address_book (book, user_response, user_closure);
+ }
+ else {
+ user_response (book, status, user_closure);
+ }
+}
+
gboolean
-addressbook_load_default_book (EBook *book, EBookCallback cb, gpointer closure)
+addressbook_load_default_book (EBook *book, EBookCallback open_response, gpointer closure)
{
- LoadUriData *load_uri_data = g_new (LoadUriData, 1);
+ char *val;
gboolean rv;
+ CORBA_Environment ev;
+ Bonobo_ConfigDatabase config_db;
- load_uri_data->cb = cb;
- load_uri_data->closure = closure;
+ g_return_val_if_fail (book != NULL, FALSE);
+ g_return_val_if_fail (E_IS_BOOK (book), FALSE);
+ g_return_val_if_fail (open_response != NULL, FALSE);
- rv = e_book_load_default_book (book, load_uri_cb, load_uri_data);
+ CORBA_exception_init (&ev);
+ config_db = addressbook_config_database (&ev);
+ val = bonobo_config_get_string (config_db, "/Addressbook/default_book_uri", &ev);
+ CORBA_exception_free (&ev);
- if (!rv)
- g_free (load_uri_data);
+ if (val) {
+ DefaultBookClosure *default_book_closure = g_new (DefaultBookClosure, 1);
+ default_book_closure->closure = closure;
+ default_book_closure->open_response = open_response;
+ rv = addressbook_load_uri (book, val,
+ addressbook_default_book_open, default_book_closure);
+ g_free (val);
+ }
+ else {
+ rv = e_book_load_local_address_book (book, open_response, closure);
+ }
+
+ if (!rv) {
+ g_warning ("Couldn't load default addressbook");
+ }
return rv;
}
@@ -742,7 +790,7 @@ set_prop (BonoboPropertyBag *bag,
view->uri = g_strdup(BONOBO_ARG_GET_STRING (arg));
- uri_data = e_book_expand_uri (view->uri);
+ uri_data = addressbook_expand_uri (view->uri);
if (! addressbook_load_uri (book, uri_data, book_open_cb, view))
printf ("error calling load_uri!\n");
@@ -757,6 +805,11 @@ set_prop (BonoboPropertyBag *bag,
}
}
+static ESearchBarItem addressbook_search_menu_items[] = {
+ E_FILTERBAR_RESET,
+ { NULL, -1, NULL },
+};
+
enum {
ESB_FULL_NAME,
ESB_EMAIL,
@@ -775,16 +828,25 @@ static ESearchBarItem addressbook_search_option_items[] = {
};
static void
-alphabet_state_changed (EAddressbookView *eav, gunichar letter, AddressbookView *view)
+addressbook_menu_activated (ESearchBar *esb, int id, AddressbookView *view)
{
- view->ignore_search_changes = TRUE;
- if (letter == 0) {
- e_search_bar_set_item_id (view->search, ESB_ANY);
- e_search_bar_set_text (view->search, "");
- } else {
- e_search_bar_set_item_id (view->search, ESB_ADVANCED);
+ switch (id) {
+ case E_FILTERBAR_RESET_ID:
+ /* e_addressbook_view_show_all(view->view); */
+
+ /* Fix option menu if we are using "Category is" */
+ if (e_search_bar_get_item_id (esb) == ESB_CATEGORY) {
+
+ e_search_bar_set_subitem_id (esb, G_MAXINT);
+
+ } else {
+
+ e_search_bar_set_text (esb, "");
+
+ }
+
+ break;
}
- view->ignore_search_changes = FALSE;
}
static void
@@ -795,10 +857,6 @@ addressbook_search_activated (ESearchBar *esb, AddressbookView *view)
const char *category_name;
int search_type, subid;
- if (view->ignore_search_changes) {
- return;
- }
-
gtk_object_get(GTK_OBJECT(esb),
"text", &search_word,
"item_id", &search_type,
@@ -1041,7 +1099,6 @@ addressbook_factory_new_control (void)
view = g_new0 (AddressbookView, 1);
view->refs = 1;
- view->ignore_search_changes = FALSE;
view->vbox = gtk_vbox_new (FALSE, 0);
@@ -1052,7 +1109,8 @@ addressbook_factory_new_control (void)
/* Create the control. */
view->control = bonobo_control_new (view->vbox);
- view->search = E_SEARCH_BAR (e_search_bar_new (NULL, addressbook_search_option_items));
+ view->search = E_SEARCH_BAR(e_search_bar_new(addressbook_search_menu_items,
+ addressbook_search_option_items));
make_suboptions (view);
connect_master_list_changed (view);
@@ -1062,6 +1120,8 @@ addressbook_factory_new_control (void)
GTK_SIGNAL_FUNC (addressbook_query_changed), view);
gtk_signal_connect (GTK_OBJECT (view->search), "search_activated",
GTK_SIGNAL_FUNC (addressbook_search_activated), view);
+ gtk_signal_connect (GTK_OBJECT (view->search), "menu_activated",
+ GTK_SIGNAL_FUNC (addressbook_menu_activated), view);
view->view = E_ADDRESSBOOK_VIEW(e_addressbook_view_new());
gtk_container_add (GTK_CONTAINER (frame), GTK_WIDGET (view->view));
@@ -1100,11 +1160,6 @@ addressbook_factory_new_control (void)
GTK_SIGNAL_FUNC(update_command_state),
view);
- gtk_signal_connect (GTK_OBJECT (view->view),
- "alphabet_state_change",
- GTK_SIGNAL_FUNC(alphabet_state_changed),
- view);
-
view->uri = NULL;
gtk_signal_connect (GTK_OBJECT (view->control), "activate",
diff --git a/addressbook/gui/component/select-names/e-select-names-bonobo.c b/addressbook/gui/component/select-names/e-select-names-bonobo.c
index b2c791f259..3398882181 100644
--- a/addressbook/gui/component/select-names/e-select-names-bonobo.c
+++ b/addressbook/gui/component/select-names/e-select-names-bonobo.c
@@ -48,6 +48,8 @@ static BonoboObjectClass *parent_class = NULL;
struct _ESelectNamesBonoboPrivate {
ESelectNamesManager *manager;
BonoboEventSource *event_source;
+ guint manager_changed_tag;
+ guint manager_ok_tag;
};
enum _EntryPropertyID {
@@ -75,11 +77,11 @@ entry_get_property_fn (BonoboPropertyBag *bag,
switch (arg_id) {
case ENTRY_PROPERTY_ID_TEXT:
{
- ETextModel *text_model;
- text_model = E_TEXT_MODEL (gtk_object_get_data (GTK_OBJECT (w), "select_names_text_model"));
- g_assert (text_model != NULL);
+ ESelectNamesModel *model;
+ model = E_SELECT_NAMES_MODEL (gtk_object_get_data (GTK_OBJECT (w), "select_names_model"));
+ g_assert (model != NULL);
- BONOBO_ARG_SET_STRING (arg, e_text_model_get_text (text_model));
+ BONOBO_ARG_SET_STRING (arg, e_select_names_model_get_textification (model));
break;
}
@@ -348,21 +350,41 @@ impl_SelectNames_activate_dialog (PortableServer_Servant servant,
/* GtkObject methods. */
+/* ACK! */
+typedef struct {
+ char *id;
+ EEntry *entry;
+} ESelectNamesManagerEntry;
+
static void
impl_destroy (GtkObject *object)
{
ESelectNamesBonobo *select_names;
ESelectNamesBonoboPrivate *priv;
+ EIterator *iterator;
select_names = E_SELECT_NAMES_BONOBO (object);
priv = select_names->priv;
+ gtk_signal_disconnect (GTK_OBJECT (priv->manager), priv->manager_changed_tag);
+ gtk_signal_disconnect (GTK_OBJECT (priv->manager), priv->manager_ok_tag);
+
if (priv->manager->names) {
gtk_widget_destroy (GTK_WIDGET (priv->manager->names));
priv->manager->names = NULL;
}
- gtk_object_unref (GTK_OBJECT (priv->manager));
+ /* More suckage */
+ iterator = e_list_get_iterator (priv->manager->entries);
+ for (e_iterator_reset (iterator); e_iterator_is_valid (iterator); e_iterator_next (iterator)) {
+ ESelectNamesManagerEntry *entry = (ESelectNamesManagerEntry *)e_iterator_get (iterator);
+ if (entry && entry->entry)
+ gtk_widget_destroy (GTK_WIDGET (entry->entry));
+ }
+ gtk_object_unref (GTK_OBJECT (iterator));
+
+ /* FIXME: We leak on purpose. This sucks. */
+ /* gtk_object_unref (GTK_OBJECT (priv->manager)); */
g_free (priv);
}
@@ -414,15 +436,17 @@ init (ESelectNamesBonobo *select_names)
priv->manager = e_select_names_manager_new ();
priv->event_source = NULL;
- gtk_signal_connect (GTK_OBJECT (priv->manager),
- "changed",
- GTK_SIGNAL_FUNC (manager_changed_cb),
- select_names);
-
- gtk_signal_connect (GTK_OBJECT (priv->manager),
- "ok",
- GTK_SIGNAL_FUNC (manager_ok_cb),
- select_names);
+ priv->manager_changed_tag =
+ gtk_signal_connect (GTK_OBJECT (priv->manager),
+ "changed",
+ GTK_SIGNAL_FUNC (manager_changed_cb),
+ select_names);
+
+ priv->manager_ok_tag =
+ gtk_signal_connect (GTK_OBJECT (priv->manager),
+ "ok",
+ GTK_SIGNAL_FUNC (manager_ok_cb),
+ select_names);
select_names->priv = priv;
}
diff --git a/addressbook/gui/component/select-names/e-select-names-completion.c b/addressbook/gui/component/select-names/e-select-names-completion.c
index cbfc1d56c6..eb15c4f232 100644
--- a/addressbook/gui/component/select-names/e-select-names-completion.c
+++ b/addressbook/gui/component/select-names/e-select-names-completion.c
@@ -55,7 +55,7 @@ typedef struct {
struct _ESelectNamesCompletionPrivate {
- ESelectNamesTextModel *text_model;
+ ESelectNamesModel *model;
GList *book_data;
gint books_not_ready;
@@ -739,8 +739,8 @@ e_select_names_completion_destroy (GtkObject *object)
ESelectNamesCompletion *comp = E_SELECT_NAMES_COMPLETION (object);
GList *l;
- if (comp->priv->text_model)
- gtk_object_unref (GTK_OBJECT (comp->priv->text_model));
+ if (comp->priv->model)
+ gtk_object_unref (GTK_OBJECT (comp->priv->model));
for (l = comp->priv->book_data; l; l = l->next) {
ESelectNamesCompletionBookData *book_data = l->data;
@@ -1142,10 +1142,8 @@ e_select_names_completion_handle_request (ECompletion *comp, const gchar *text,
fprintf (out, "text=\"%s\" pos=%d limit=%d\n", text, pos, limit);
}
- e_select_names_model_text_pos (selcomp->priv->text_model->source,
- selcomp->priv->text_model->seplen,
- pos, &index, NULL, NULL);
- str = index >= 0 ? e_select_names_model_get_string (selcomp->priv->text_model->source, index) : NULL;
+ e_select_names_model_text_pos (selcomp->priv->model, pos, &index, NULL, NULL);
+ str = index >= 0 ? e_select_names_model_get_string (selcomp->priv->model, index) : NULL;
if (out)
fprintf (out, "index=%d str=\"%s\"\n", index, str);
@@ -1227,12 +1225,13 @@ e_select_names_completion_book_ready (EBook *book, EBookStatus status, ESelectNa
*/
ECompletion *
-e_select_names_completion_new (EBook *book, ESelectNamesTextModel *text_model)
+e_select_names_completion_new (EBook *book, ESelectNamesModel *model)
{
ESelectNamesCompletion *comp;
g_return_val_if_fail (book == NULL || E_IS_BOOK (book), NULL);
- g_return_val_if_fail (E_IS_SELECT_NAMES_TEXT_MODEL (text_model), NULL);
+ g_return_val_if_fail (model, NULL);
+ g_return_val_if_fail (E_IS_SELECT_NAMES_MODEL (model), NULL);
comp = (ESelectNamesCompletion *) gtk_type_new (e_select_names_completion_get_type ());
@@ -1254,8 +1253,8 @@ e_select_names_completion_new (EBook *book, ESelectNamesTextModel *text_model)
e_select_names_completion_add_book (comp, book);
}
- comp->priv->text_model = text_model;
- gtk_object_ref (GTK_OBJECT (text_model));
+ comp->priv->model = model;
+ gtk_object_ref (GTK_OBJECT (model));
return E_COMPLETION (comp);
}
diff --git a/addressbook/gui/component/select-names/e-select-names-manager.c b/addressbook/gui/component/select-names/e-select-names-manager.c
index 53978ac502..e2b0238123 100644
--- a/addressbook/gui/component/select-names/e-select-names-manager.c
+++ b/addressbook/gui/component/select-names/e-select-names-manager.c
@@ -2,9 +2,8 @@
/*
* Authors:
* Chris Lahey <clahey@ximian.com>
- * Jon Trowbridge <trow@ximian.com.
*
- * Copyright (C) 2000, 2001 Ximian, Inc.
+ * Copyright (C) 2000 Ximian, Inc.
*/
#include <config.h>
@@ -27,10 +26,15 @@
#include <bonobo/bonobo-object.h>
#include <bonobo/bonobo-moniker-util.h>
+/* Object argument IDs */
+enum {
+ ARG_0,
+ ARG_CARD,
+};
+
enum {
CHANGED,
OK,
- CANCEL,
LAST_SIGNAL
};
@@ -43,442 +47,489 @@ typedef struct {
ESelectNamesModel *model;
ESelectNamesModel *original_model;
ESelectNamesManager *manager;
- guint changed_tag;
+ guint changed_handler;
} ESelectNamesManagerSection;
typedef struct {
char *id;
EEntry *entry;
- ESelectNamesManager *manager;
- ESelectNamesModel *model;
- guint cleaning_tag;
} ESelectNamesManagerEntry;
static void e_select_names_manager_init (ESelectNamesManager *manager);
static void e_select_names_manager_class_init (ESelectNamesManagerClass *klass);
static void e_select_names_manager_destroy (GtkObject *object);
+static void e_select_names_manager_set_arg (GtkObject *object, GtkArg *arg, guint arg_id);
+static void e_select_names_manager_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
-/* ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** */
+/**
+ * e_select_names_manager_get_type:
+ * @void:
+ *
+ * Registers the &ESelectNamesManager class if necessary, and returns the type ID
+ * associated to it.
+ *
+ * Return value: The type ID of the &ESelectNamesManager class.
+ **/
+GtkType
+e_select_names_manager_get_type (void)
+{
+ static GtkType manager_type = 0;
-/* ESelectNamesManagerSection routines */
+ if (!manager_type) {
+ GtkTypeInfo manager_info = {
+ "ESelectNamesManager",
+ sizeof (ESelectNamesManager),
+ sizeof (ESelectNamesManagerClass),
+ (GtkClassInitFunc) e_select_names_manager_class_init,
+ (GtkObjectInitFunc) e_select_names_manager_init,
+ NULL, /* reserved_1 */
+ NULL, /* reserved_2 */
+ (GtkClassInitFunc) NULL
+ };
+
+ manager_type = gtk_type_unique (gtk_object_get_type (), &manager_info);
+ }
+
+ return manager_type;
+}
static void
-section_model_changed_cb (ESelectNamesModel *model, gpointer closure)
+open_book_cb (EBook *book, EBookStatus status, ESelectNamesManager *manager)
{
- ESelectNamesManagerSection *section = closure;
- gtk_signal_emit (GTK_OBJECT (section->manager),
- e_select_names_manager_signals[CHANGED],
- section->id,
- FALSE);
+ if (status != E_BOOK_STATUS_SUCCESS) {
+ gtk_object_unref (GTK_OBJECT (book));
+ manager->completion_book = NULL;
+ }
+
+ gtk_object_unref (GTK_OBJECT (manager)); /* unref ourself (matches ref before the load_uri call below) */
}
-static ESelectNamesManagerSection *
-e_select_names_manager_section_new (ESelectNamesManager *manager,
- const gchar *id,
- const gchar *title,
- ESelectNamesModel *model)
+/**
+ * e_select_names_manager_new:
+ * @VCard: a string in vCard format
+ *
+ * Returns: a new #ESelectNamesManager that wraps the @VCard.
+ */
+ESelectNamesManager *
+e_select_names_manager_new (void)
{
- ESelectNamesManagerSection *section;
+ ESelectNamesManager *manager = E_SELECT_NAMES_MANAGER(gtk_type_new(e_select_names_manager_get_type()));
+ Bonobo_ConfigDatabase db;
+ CORBA_Environment ev;
+ char *val;
- g_return_val_if_fail (E_IS_SELECT_NAMES_MANAGER (manager), NULL);
- g_return_val_if_fail (E_IS_SELECT_NAMES_MODEL (model), NULL);
+ CORBA_exception_init (&ev);
- section = g_new0 (ESelectNamesManagerSection, 1);
+ db = addressbook_config_database (&ev);
- section->id = g_strdup (id);
- section->title = g_strdup (title);
+ val = bonobo_config_get_string (db, "/Addressbook/Completion/uri", &ev);
- section->manager = manager;
+ CORBA_exception_free (&ev);
- section->model = model;
- gtk_object_ref (GTK_OBJECT (section->model));
- section->changed_tag =
- gtk_signal_connect (GTK_OBJECT (section->model),
- "changed",
- GTK_SIGNAL_FUNC (section_model_changed_cb),
- section);
+ if (val) {
+ manager->completion_book = e_book_new ();
+ gtk_object_ref (GTK_OBJECT (manager)); /* ref ourself before our async call */
+ addressbook_load_uri (manager->completion_book, val, (EBookCallback)open_book_cb, manager);
+ g_free (val);
+ }
+ else
+ manager->completion_book = NULL;
- return section;
+ return manager;
}
static void
-e_select_names_manager_section_free (ESelectNamesManagerSection *section)
+e_select_names_manager_class_init (ESelectNamesManagerClass *klass)
{
- if (section == NULL)
- return;
-
- g_free (section->id);
- g_free (section->title);
+ GtkObjectClass *object_class;
- if (section->model) {
- gtk_signal_disconnect (GTK_OBJECT (section->model), section->changed_tag);
- gtk_object_unref (GTK_OBJECT (section->model));
- }
+ object_class = GTK_OBJECT_CLASS(klass);
- if (section->original_model) {
- gtk_object_unref (GTK_OBJECT (section->original_model));
- }
+ gtk_object_add_arg_type ("ESelectNamesManager::card",
+ GTK_TYPE_OBJECT, GTK_ARG_READWRITE, ARG_CARD);
- g_free (section);
-}
+ object_class->destroy = e_select_names_manager_destroy;
+ object_class->get_arg = e_select_names_manager_get_arg;
+ object_class->set_arg = e_select_names_manager_set_arg;
-/* ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** */
+ e_select_names_manager_signals[CHANGED] =
+ gtk_signal_new ("changed",
+ GTK_RUN_LAST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (ESelectNamesManagerClass, changed),
+ gtk_marshal_NONE__POINTER_INT,
+ GTK_TYPE_NONE, 2,
+ GTK_TYPE_POINTER,
+ GTK_TYPE_INT);
-/* ESelectNamesManagerEntry routines */
+ e_select_names_manager_signals[OK] =
+ gtk_signal_new ("ok",
+ GTK_RUN_LAST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (ESelectNamesManagerClass, ok),
+ gtk_marshal_NONE__NONE,
+ GTK_TYPE_NONE, 0);
-static ESelectNamesManagerEntry *
-get_entry_info (EEntry *entry)
-{
- g_return_val_if_fail (E_IS_ENTRY (entry), NULL);
- return (ESelectNamesManagerEntry *) gtk_object_get_data (GTK_OBJECT (entry), "entry_info");
+ gtk_object_class_add_signals (object_class, e_select_names_manager_signals, LAST_SIGNAL);
}
+/*
+ * ESelectNamesManager lifecycle management and vcard loading/saving.
+ */
+
static void
-popup_cb (EEntry *eentry, GdkEventButton *ev, gint pos, gpointer user_data)
+e_select_names_manager_destroy (GtkObject *object)
{
- ESelectNamesTextModel *text_model;
+ ESelectNamesManager *manager;
+
+ manager = E_SELECT_NAMES_MANAGER (object);
- gtk_object_get (GTK_OBJECT (eentry),
- "model", &text_model,
- NULL);
- g_assert (E_IS_SELECT_NAMES_TEXT_MODEL (text_model));
+ gtk_object_unref(GTK_OBJECT(manager->sections));
+ gtk_object_unref(GTK_OBJECT(manager->entries));
- e_select_names_popup (text_model, ev, pos);
+ if (manager->names) {
+ gtk_widget_destroy (GTK_WIDGET (manager->names));
+ manager->names = NULL;
+ }
}
-static gboolean
-clean_cb (gpointer ptr)
-{
- ESelectNamesManagerEntry *entry = ptr;
-
- e_select_names_model_clean (entry->model, TRUE);
- entry->cleaning_tag = 0;
- return FALSE;
-}
-static gint
-focus_in_cb (GtkWidget *w, GdkEventFocus *ev, gpointer user_data)
+/* Set_arg handler for the manager */
+static void
+e_select_names_manager_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
{
- ESelectNamesManagerEntry *entry = user_data;
+ ESelectNamesManager *manager;
+
+ manager = E_SELECT_NAMES_MANAGER (object);
- if (entry->cleaning_tag) {
- gtk_timeout_remove (entry->cleaning_tag);
- entry->cleaning_tag = 0;
+ switch (arg_id) {
+ case ARG_CARD:
+ break;
+ default:
+ return;
}
-
- e_select_names_model_cancel_cardify_all (entry->model);
-
- return FALSE;
}
-static gint
-focus_out_cb (GtkWidget *w, GdkEventFocus *ev, gpointer user_data)
+/* Get_arg handler for the manager */
+static void
+e_select_names_manager_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
{
- ESelectNamesManagerEntry *entry = user_data;
- gboolean visible = e_entry_completion_popup_is_visible (entry->entry);
+ ESelectNamesManager *manager;
- if (! visible) {
- e_select_names_model_cardify_all (entry->model, entry->manager->completion_book, 100);
- if (entry->cleaning_tag == 0)
- entry->cleaning_tag = gtk_timeout_add (100, clean_cb, entry);
- }
+ manager = E_SELECT_NAMES_MANAGER (object);
- return FALSE;
+ switch (arg_id) {
+ case ARG_CARD:
+ break;
+ default:
+ arg->type = GTK_TYPE_INVALID;
+ break;
+ }
}
-static void
-completion_popup_cb (EEntry *w, gint visible, gpointer user_data)
+static void *
+section_copy(const void *sec, void *data)
{
- ESelectNamesManagerEntry *entry = user_data;
-
- if (!visible && !GTK_WIDGET_HAS_FOCUS (GTK_WIDGET (entry->entry->canvas)))
- e_select_names_model_cardify_all (entry->model, entry->manager->completion_book, 0);
+ const ESelectNamesManagerSection *section = sec;
+ ESelectNamesManagerSection *newsec;
+
+ static void section_model_changed_cb (ESelectNamesModel *, gpointer);
+
+ newsec = g_new(ESelectNamesManagerSection, 1);
+ newsec->id = g_strdup(section->id);
+ newsec->title = g_strdup(section->title);
+ newsec->model = section->model;
+ newsec->original_model = section->original_model;
+ newsec->manager = section->manager;
+ newsec->changed_handler = gtk_signal_connect (GTK_OBJECT (newsec->model),
+ "changed",
+ GTK_SIGNAL_FUNC (section_model_changed_cb),
+ newsec);
+
+ if (newsec->model)
+ gtk_object_ref(GTK_OBJECT(newsec->model));
+ if (newsec->original_model)
+ gtk_object_ref(GTK_OBJECT(newsec->original_model));
+
+ return newsec;
}
static void
-completion_handler (EEntry *entry, ECompletionMatch *match)
+section_free(void *sec, void *data)
{
- ESelectNamesManagerEntry *mgr_entry;
- ESelectNamesTextModel *text_model;
- EDestination *dest;
- gint i, pos, start_pos, len;
-
- if (match == NULL || match->user_data == NULL)
- return;
-
- mgr_entry = get_entry_info (entry);
- dest = E_DESTINATION (match->user_data);
-
- /* Sometimes I really long for garbage collection. Reference
- counting makes you feel 31337, but sometimes it is just a
- bitch. */
- gtk_object_ref (GTK_OBJECT (dest));
-
- gtk_object_get (GTK_OBJECT (entry),
- "model", &text_model,
- NULL);
- g_assert (E_IS_SELECT_NAMES_TEXT_MODEL (text_model));
+ ESelectNamesManagerSection *section = sec;
+ if (section->manager && section->changed_handler) {
+ gtk_signal_disconnect (GTK_OBJECT (section->model), section->changed_handler);
+ }
+ g_free(section->id);
+ g_free(section->title);
+ if (section->model)
+ gtk_object_unref (GTK_OBJECT(section->model));
+ if (section->original_model)
+ gtk_object_unref (GTK_OBJECT (section->original_model));
- pos = e_entry_get_position (entry);
- e_select_names_model_text_pos (mgr_entry->model, text_model->seplen, pos, &i, NULL, NULL);
- e_select_names_model_replace (mgr_entry->model, i, dest);
- e_select_names_model_name_pos (mgr_entry->model, text_model->seplen, i, &start_pos, &len);
- e_entry_set_position (entry, start_pos+len);
+ g_free(section);
}
-static ESelectNamesManagerEntry *
-e_select_names_manager_entry_new (ESelectNamesManager *manager, ESelectNamesModel *model, const gchar *id)
+static void *
+entry_copy(const void *ent, void *data)
{
- ESelectNamesManagerEntry *entry;
- ETextModel *text_model;
- ECompletion *comp;
-
- g_return_val_if_fail (E_IS_SELECT_NAMES_MANAGER (manager), NULL);
- g_return_val_if_fail (E_IS_SELECT_NAMES_MODEL (model), NULL);
-
- entry = g_new0 (ESelectNamesManagerEntry, 1);
-
- entry->id = g_strdup (id);
-
- entry->entry = E_ENTRY (e_entry_new ());
- text_model = e_select_names_text_model_new (model);
- gtk_object_set(GTK_OBJECT(entry->entry),
- "model", text_model, /* The entry takes ownership of the text model */
- "editable", TRUE,
- "use_ellipsis", TRUE,
- "allow_newlines", FALSE,
- NULL);
-
- gtk_object_ref (GTK_OBJECT (entry->entry));
-
- comp = e_select_names_completion_new (NULL, E_SELECT_NAMES_TEXT_MODEL (text_model));
- if (manager->completion_book)
- e_select_names_completion_add_book (E_SELECT_NAMES_COMPLETION (comp),
- manager->completion_book);
-
- e_entry_enable_completion_full (entry->entry, comp, 50, completion_handler);
-
- entry->manager = manager;
-
- entry->model = model;
- gtk_object_ref (GTK_OBJECT (model));
-
- gtk_signal_connect (GTK_OBJECT (entry->entry),
- "popup",
- GTK_SIGNAL_FUNC (popup_cb),
- entry);
-
- gtk_signal_connect (GTK_OBJECT (entry->entry->canvas),
- "focus_in_event",
- GTK_SIGNAL_FUNC (focus_in_cb),
- entry);
+ const ESelectNamesManagerEntry *entry = ent;
+ ESelectNamesManagerEntry *newent;
- gtk_signal_connect (GTK_OBJECT (entry->entry->canvas),
- "focus_out_event",
- GTK_SIGNAL_FUNC (focus_out_cb),
- entry);
-
- gtk_signal_connect (GTK_OBJECT (entry->entry),
- "completion_popup",
- GTK_SIGNAL_FUNC (completion_popup_cb),
- entry);
-
- gtk_object_set_data (GTK_OBJECT (entry->entry), "entry_info", entry);
- gtk_object_set_data (GTK_OBJECT (entry->entry), "select_names_model", model);
- gtk_object_set_data (GTK_OBJECT (entry->entry), "select_names_text_model", text_model);
- gtk_object_set_data (GTK_OBJECT (entry->entry), "completion_handler", comp);
-
- return entry;
+ newent = g_new(ESelectNamesManagerEntry, 1);
+ newent->id = g_strdup(entry->id);
+ newent->entry = entry->entry;
+ if (newent->entry)
+ gtk_object_ref(GTK_OBJECT(newent->entry));
+ return newent;
}
static void
-e_select_names_manager_entry_free (ESelectNamesManagerEntry *entry)
+entry_free(void *ent, void *data)
{
- if (entry == NULL)
- return;
+ ESelectNamesManagerEntry *entry = ent;
+ g_free(entry->id);
+ if (entry->entry)
+ gtk_object_unref(GTK_OBJECT(entry->entry));
+ g_free(entry);
+}
- g_free (entry->id);
- gtk_object_unref (GTK_OBJECT (entry->model));
- gtk_object_unref (GTK_OBJECT (entry->entry));
+/**
+ * e_select_names_manager_init:
+ */
+static void
+e_select_names_manager_init (ESelectNamesManager *manager)
+{
+ manager->sections = e_list_new(section_copy, section_free, manager);
+ manager->entries = e_list_new(entry_copy, entry_free, manager);
+}
- if (entry->cleaning_tag)
- gtk_timeout_remove (entry->cleaning_tag);
+static void
+section_model_changed_cb (ESelectNamesModel *model, gpointer closure)
+{
+ ESelectNamesManagerSection *section = closure;
+ gtk_signal_emit (GTK_OBJECT (section->manager),
+ e_select_names_manager_signals[CHANGED],
+ section->id,
+ FALSE);
+}
- g_free (entry);
+static void
+section_model_working_copy_changed_cb (ESelectNamesModel *model, gpointer closure)
+{
+ ESelectNamesManagerSection *section = closure;
+ gtk_signal_emit (GTK_OBJECT (section->manager),
+ e_select_names_manager_signals[CHANGED],
+ section->id,
+ TRUE);
}
-/* ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** */
+void
+e_select_names_manager_add_section (ESelectNamesManager *manager,
+ const char *id,
+ const char *title)
+{
+ e_select_names_manager_add_section_with_limit (manager, id, title, -1);
+}
-static void
-e_select_names_manager_save_models (ESelectNamesManager *manager)
+void
+e_select_names_manager_add_section_with_limit (ESelectNamesManager *manager,
+ const char *id,
+ const char *title,
+ gint limit)
{
- GList *iter;
+ ESelectNamesManagerSection *section;
- for (iter = manager->sections; iter != NULL; iter = g_list_next (iter)) {
- ESelectNamesManagerSection *section = iter->data;
+ section = g_new(ESelectNamesManagerSection, 1);
+ section->id = g_strdup(id);
+ section->title = g_strdup(title);
- if (section->original_model == NULL && section->model != NULL)
- section->original_model = e_select_names_model_duplicate (section->model);
+ section->model = e_select_names_model_new();
+ e_select_names_model_set_limit (section->model, limit);
- }
-}
+ section->original_model = NULL;
-static void
-e_select_names_manager_revert_to_saved_models (ESelectNamesManager *manager)
-{
- GList *iter;
+ section->manager = manager;
- for (iter = manager->sections; iter != NULL; iter = g_list_next (iter)) {
- ESelectNamesManagerSection *section = iter->data;
- if (section->model && section->original_model) {
- e_select_names_model_overwrite_copy (section->model, section->original_model);
- gtk_object_unref (GTK_OBJECT (section->original_model));
- section->original_model = NULL;
- }
- }
+ section->changed_handler = gtk_signal_connect (GTK_OBJECT (section->model),
+ "changed",
+ GTK_SIGNAL_FUNC (section_model_changed_cb),
+ section);
+
+ e_list_append(manager->sections, section);
+ section_free(section, manager);
}
-static void
-e_select_names_manager_discard_saved_models (ESelectNamesManager *manager)
+ESelectNamesModel *
+e_select_names_manager_get_source (ESelectNamesManager *manager, const char *id)
{
- GList *iter;
+ EIterator *iterator;
- for (iter = manager->sections; iter != NULL; iter = g_list_next (iter)) {
- ESelectNamesManagerSection *section = iter->data;
- if (section->original_model) {
- gtk_object_unref (GTK_OBJECT (section->original_model));
- section->original_model = NULL;
+ g_return_val_if_fail (manager && E_IS_SELECT_NAMES_MANAGER (manager), NULL);
+ g_return_val_if_fail (id, NULL);
+
+ iterator = e_list_get_iterator (manager->sections);
+ for (e_iterator_reset (iterator); e_iterator_is_valid (iterator); e_iterator_next (iterator)) {
+ const ESelectNamesManagerSection *section = e_iterator_get (iterator);
+ if (!strcmp (section->id, id)) {
+ return section->model;
}
}
-}
-
-/* ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** */
+ return NULL;
+}
static void
-open_book_cb (EBook *book, EBookStatus status, ESelectNamesManager *manager)
+entry_destroyed(EEntry *entry, ESelectNamesManager *manager)
{
- if (status != E_BOOK_STATUS_SUCCESS) {
- gtk_object_unref (GTK_OBJECT (book));
- manager->completion_book = NULL;
+ if(!GTK_OBJECT_DESTROYED(manager)) {
+ EIterator *iterator = e_list_get_iterator(manager->entries);
+ for (e_iterator_reset(iterator); e_iterator_is_valid(iterator); e_iterator_next(iterator)) {
+ const ESelectNamesManagerEntry *this_entry = e_iterator_get(iterator);
+ if(entry == this_entry->entry) {
+ e_iterator_delete(iterator);
+ break;
+ }
+ }
}
-
- gtk_object_unref (GTK_OBJECT (manager)); /* unref ourself (matches ref before the load_uri call below) */
}
-/**
- * e_select_names_manager_new:
- * @VCard: a string in vCard format
- *
- * Returns: a new #ESelectNamesManager that wraps the @VCard.
- */
-ESelectNamesManager *
-e_select_names_manager_new (void)
+static void
+completion_handler (EEntry *entry, ECompletionMatch *match)
{
- ESelectNamesManager *manager = E_SELECT_NAMES_MANAGER(gtk_type_new(e_select_names_manager_get_type()));
- Bonobo_ConfigDatabase db;
- CORBA_Environment ev;
- char *val;
-
- CORBA_exception_init (&ev);
+ ESelectNamesModel *snm;
+ EDestination *dest;
+ gint i, pos, start_pos, len;
- db = addressbook_config_database (&ev);
+ if (match == NULL || match->user_data == NULL)
+ return;
- val = bonobo_config_get_string (db, "/Addressbook/Completion/uri", &ev);
- CORBA_exception_free (&ev);
+ snm = E_SELECT_NAMES_MODEL (gtk_object_get_data (GTK_OBJECT (entry), "select_names_model"));
+ dest = E_DESTINATION (match->user_data);
- if (val) {
- manager->completion_book = e_book_new ();
- gtk_object_ref (GTK_OBJECT (manager)); /* ref ourself before our async call */
- addressbook_load_uri (manager->completion_book, val, (EBookCallback)open_book_cb, manager);
- g_free (val);
- }
- else
- manager->completion_book = NULL;
+ /* Sometimes I really long for garbage collection. Reference
+ counting makes you feel 31337, but sometimes it is just a
+ bitch. */
+ gtk_object_ref (GTK_OBJECT (dest));
- return manager;
+ pos = e_entry_get_position (entry);
+ e_select_names_model_text_pos (snm, pos, &i, NULL, NULL);
+ e_select_names_model_replace (snm, i, dest);
+ e_select_names_model_name_pos (snm, i, &start_pos, &len);
+ e_entry_set_position (entry, start_pos+len);
}
+static void
+popup_cb (EEntry *entry, GdkEventButton *ev, gint pos, ESelectNamesModel *model)
+{
+ e_select_names_popup (model, ev, pos);
+}
-/*
- * ESelectNamesManager lifecycle management and vcard loading/saving.
- */
+static gint
+focus_in_cb (GtkWidget *w, GdkEventFocus *ev, gpointer user_data)
+{
+ EEntry *entry = E_ENTRY (user_data);
+ ESelectNamesModel *model = E_SELECT_NAMES_MODEL (gtk_object_get_data (GTK_OBJECT (entry), "select_names_model"));
+ e_select_names_model_cancel_cardify_all (model);
-void
-e_select_names_manager_add_section (ESelectNamesManager *manager,
- const char *id,
- const char *title)
-{
- g_return_if_fail (E_IS_SELECT_NAMES_MANAGER (manager));
- g_return_if_fail (id != NULL);
- g_return_if_fail (title != NULL);
-
- e_select_names_manager_add_section_with_limit (manager, id, title, -1);
+ return FALSE;
}
-void
-e_select_names_manager_add_section_with_limit (ESelectNamesManager *manager,
- const char *id,
- const char *title,
- gint limit)
+static gint
+focus_out_cb (GtkWidget *w, GdkEventFocus *ev, gpointer user_data)
{
- ESelectNamesManagerSection *section;
- ESelectNamesModel *model;
+ EEntry *entry = E_ENTRY (user_data);
+ ESelectNamesModel *model = E_SELECT_NAMES_MODEL (gtk_object_get_data (GTK_OBJECT (entry), "select_names_model"));
+ ESelectNamesManager *manager = E_SELECT_NAMES_MANAGER (gtk_object_get_data (GTK_OBJECT (entry), "select_names_manager"));
- g_return_if_fail (E_IS_SELECT_NAMES_MANAGER (manager));
- g_return_if_fail (id != NULL);
- g_return_if_fail (title != NULL);
-
- model = e_select_names_model_new ();
- e_select_names_model_set_limit (model, limit);
-
- section = e_select_names_manager_section_new (manager, id, title, model);
+ e_select_names_model_clean (model);
- manager->sections = g_list_append (manager->sections, section);
+ if (!e_entry_completion_popup_is_visible (entry))
+ e_select_names_model_cardify_all (model, manager->completion_book, 100);
- gtk_object_unref (GTK_OBJECT (model));
+ return FALSE;
}
-ESelectNamesModel *
-e_select_names_manager_get_source (ESelectNamesManager *manager,
- const char *id)
+static void
+completion_popup_cb (EEntry *entry, gint visible, gpointer user_data)
{
- GList *iter;
+ ESelectNamesModel *model = E_SELECT_NAMES_MODEL (gtk_object_get_data (GTK_OBJECT (entry), "select_names_model"));
+ ESelectNamesManager *manager = E_SELECT_NAMES_MANAGER (gtk_object_get_data (GTK_OBJECT (entry), "select_names_manager"));
- g_return_val_if_fail (E_IS_SELECT_NAMES_MANAGER (manager), NULL);
- g_return_val_if_fail (id != NULL, NULL);
-
- for (iter = manager->sections; iter != NULL; iter = g_list_next (iter)) {
- ESelectNamesManagerSection *section = iter->data;
- if (!strcmp (section->id, id))
- return section->model;
- }
- return NULL;
+ if (!visible && !GTK_WIDGET_HAS_FOCUS (GTK_WIDGET (entry->canvas)))
+ e_select_names_model_cardify_all (model, manager->completion_book, 0);
}
GtkWidget *
e_select_names_manager_create_entry (ESelectNamesManager *manager, const char *id)
{
- GList *iter;
-
- g_return_val_if_fail (E_IS_SELECT_NAMES_MANAGER (manager), NULL);
- g_return_val_if_fail (id != NULL, NULL);
-
- for (iter = manager->sections; iter != NULL; iter = g_list_next (iter)) {
- ESelectNamesManagerSection *section = iter->data;
+ ETextModel *model;
+ EIterator *iterator;
+ iterator = e_list_get_iterator(manager->sections);
+ for (e_iterator_reset(iterator); e_iterator_is_valid(iterator); e_iterator_next(iterator)) {
+ const ESelectNamesManagerSection *section = e_iterator_get(iterator);
if (!strcmp(section->id, id)) {
ESelectNamesManagerEntry *entry;
+ EEntry *eentry;
+ ECompletion *comp;
- entry = e_select_names_manager_entry_new (manager, section->model, section->id);
- manager->entries = g_list_append (manager->entries, entry);
+ eentry = E_ENTRY (e_entry_new ());
+ gtk_object_set_data (GTK_OBJECT (eentry), "select_names_model", section->model);
+ gtk_object_set_data (GTK_OBJECT (eentry), "select_names_manager", manager);
- return GTK_WIDGET(entry->entry);
+ gtk_signal_connect (GTK_OBJECT (eentry),
+ "popup",
+ GTK_SIGNAL_FUNC (popup_cb),
+ section->model);
+
+ gtk_signal_connect (GTK_OBJECT (eentry->canvas),
+ "focus_in_event",
+ GTK_SIGNAL_FUNC (focus_in_cb),
+ eentry);
+ gtk_signal_connect (GTK_OBJECT (eentry->canvas),
+ "focus_out_event",
+ GTK_SIGNAL_FUNC (focus_out_cb),
+ eentry);
+ gtk_signal_connect (GTK_OBJECT (eentry),
+ "completion_popup",
+ GTK_SIGNAL_FUNC (completion_popup_cb),
+ NULL);
+
+ entry = g_new (ESelectNamesManagerEntry, 1);
+ entry->entry = eentry;
+ entry->id = (char *)id;
+
+ gtk_object_ref (GTK_OBJECT (entry->entry));
+
+ model = e_select_names_text_model_new (section->model);
+ e_list_append (manager->entries, entry);
+ g_free(entry);
+
+ comp = e_select_names_completion_new (NULL, section->model);
+ if (manager->completion_book)
+ e_select_names_completion_add_book (E_SELECT_NAMES_COMPLETION (comp),
+ manager->completion_book);
+ e_entry_enable_completion_full (eentry, comp, 50, completion_handler);
+
+ gtk_object_set_data (GTK_OBJECT (eentry), "completion_handler", comp);
+
+ gtk_object_set(GTK_OBJECT(eentry),
+ "model", model,
+ "editable", TRUE,
+ "use_ellipsis", TRUE,
+ "allow_newlines", FALSE,
+ NULL);
+
+ gtk_signal_connect(GTK_OBJECT(eentry), "destroy",
+ GTK_SIGNAL_FUNC(entry_destroyed), manager);
+
+ return GTK_WIDGET(eentry);
}
}
-
return NULL;
}
@@ -489,159 +540,59 @@ e_select_names_clicked(ESelectNames *dialog, gint button, ESelectNamesManager *m
switch(button) {
case 0:
- e_select_names_manager_discard_saved_models (manager);
+ /* We don't need to do much if they click on OK */
+
gtk_signal_emit (GTK_OBJECT (manager), e_select_names_manager_signals[OK]);
break;
- case 1:
- e_select_names_manager_revert_to_saved_models (manager);
- gtk_signal_emit (GTK_OBJECT (manager), e_select_names_manager_signals[CANCEL]);
+ case 1: {
+ EList *list = manager->sections;
+ EIterator *iterator = e_list_get_iterator(list);
+
+ for (e_iterator_reset(iterator); e_iterator_is_valid(iterator); e_iterator_next(iterator)) {
+ ESelectNamesManagerSection *section = (void *) e_iterator_get(iterator);
+ e_select_names_model_overwrite_copy (section->model, section->original_model);
+ }
+
+ gtk_object_unref(GTK_OBJECT(iterator));
break;
}
+ }
}
void
e_select_names_manager_activate_dialog (ESelectNamesManager *manager,
const char *id)
{
- g_return_if_fail (E_IS_SELECT_NAMES_MANAGER (manager));
- g_return_if_fail (id != NULL);
-
+ EIterator *iterator;
+
if (manager->names) {
-
g_assert (GTK_WIDGET_REALIZED (GTK_WIDGET (manager->names)));
- e_select_names_set_default (manager->names, id);
+ e_select_names_set_default(manager->names, id);
gdk_window_show (GTK_WIDGET (manager->names)->window);
gdk_window_raise (GTK_WIDGET (manager->names)->window);
-
} else {
-
- GList *iter;
-
manager->names = E_SELECT_NAMES (e_select_names_new ());
- for (iter = manager->sections; iter != NULL; iter = g_list_next (iter)) {
- ESelectNamesManagerSection *section = iter->data;
+ iterator = e_list_get_iterator(manager->sections);
+ for (e_iterator_reset(iterator); e_iterator_is_valid(iterator); e_iterator_next(iterator)) {
+ ESelectNamesManagerSection *section = (ESelectNamesManagerSection *) e_iterator_get(iterator);
+ if (section->original_model != NULL)
+ gtk_object_unref (GTK_OBJECT (section->original_model));
+ section->original_model = e_select_names_model_duplicate (section->model);
e_select_names_add_section (manager->names, section->id, section->title, section->model);
+ gtk_signal_connect (GTK_OBJECT (section->model),
+ "changed",
+ GTK_SIGNAL_FUNC (section_model_working_copy_changed_cb),
+ (gpointer)section); /* casting out const to avoid compiler warning */
}
-
- e_select_names_set_default (manager->names, id);
-
- gtk_signal_connect(GTK_OBJECT(manager->names),
- "clicked",
- GTK_SIGNAL_FUNC(e_select_names_clicked),
- manager);
-
- gtk_signal_connect(GTK_OBJECT(manager->names),
- "destroy",
+ e_select_names_set_default(manager->names, id);
+ gtk_signal_connect(GTK_OBJECT(manager->names), "clicked",
+ GTK_SIGNAL_FUNC(e_select_names_clicked), manager);
+ gtk_signal_connect(GTK_OBJECT(manager->names), "destroy",
GTK_SIGNAL_FUNC(gtk_widget_destroyed),
&manager->names);
-
gtk_widget_show(GTK_WIDGET(manager->names));
}
-
- e_select_names_manager_save_models (manager);
-}
-
-/* ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** */
-
-static void
-e_select_names_manager_init (ESelectNamesManager *manager)
-{
- manager->sections = NULL;
- manager->entries = NULL;
}
-static void
-e_select_names_manager_destroy (GtkObject *object)
-{
- ESelectNamesManager *manager;
-
- manager = E_SELECT_NAMES_MANAGER (object);
-
- if (manager->names) {
- gtk_widget_destroy (GTK_WIDGET (manager->names));
- manager->names = NULL;
- }
-
- g_list_foreach (manager->sections, (GFunc) e_select_names_manager_section_free, NULL);
- g_list_free (manager->sections);
- manager->sections = NULL;
-
- g_list_foreach (manager->entries, (GFunc) e_select_names_manager_entry_free, NULL);
- g_list_free (manager->entries);
- manager->entries = NULL;
-}
-
-static void
-e_select_names_manager_class_init (ESelectNamesManagerClass *klass)
-{
- GtkObjectClass *object_class;
-
- object_class = GTK_OBJECT_CLASS(klass);
-
- object_class->destroy = e_select_names_manager_destroy;
-
- e_select_names_manager_signals[CHANGED] =
- gtk_signal_new ("changed",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (ESelectNamesManagerClass, changed),
- gtk_marshal_NONE__POINTER_INT,
- GTK_TYPE_NONE, 2,
- GTK_TYPE_POINTER,
- GTK_TYPE_INT);
-
- e_select_names_manager_signals[OK] =
- gtk_signal_new ("ok",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (ESelectNamesManagerClass, ok),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- e_select_names_manager_signals[CANCEL] =
- gtk_signal_new ("cancel",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (ESelectNamesManagerClass, cancel),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- gtk_object_class_add_signals (object_class, e_select_names_manager_signals, LAST_SIGNAL);
-}
-
-/**
- * e_select_names_manager_get_type:
- * @void:
- *
- * Registers the &ESelectNamesManager class if necessary, and returns the type ID
- * associated to it.
- *
- * Return value: The type ID of the &ESelectNamesManager class.
- **/
-GtkType
-e_select_names_manager_get_type (void)
-{
- static GtkType manager_type = 0;
-
- if (!manager_type) {
- GtkTypeInfo manager_info = {
- "ESelectNamesManager",
- sizeof (ESelectNamesManager),
- sizeof (ESelectNamesManagerClass),
- (GtkClassInitFunc) e_select_names_manager_class_init,
- (GtkObjectInitFunc) e_select_names_manager_init,
- NULL, /* reserved_1 */
- NULL, /* reserved_2 */
- (GtkClassInitFunc) NULL
- };
-
- manager_type = gtk_type_unique (gtk_object_get_type (), &manager_info);
- }
-
- return manager_type;
-}
-
-
-
diff --git a/addressbook/gui/component/select-names/e-select-names.c b/addressbook/gui/component/select-names/e-select-names.c
index b3d3891595..84df861b1f 100644
--- a/addressbook/gui/component/select-names/e-select-names.c
+++ b/addressbook/gui/component/select-names/e-select-names.c
@@ -42,8 +42,8 @@
#include "e-select-names.h"
#include <addressbook/backend/ebook/e-card-simple.h>
-#include "e-select-names-text-model.h"
-#include <gal/widgets/e-categories-master-list-option-menu.h>
+#include "e-select-names-table-model.h"
+#include <gal/widgets/e-categories-master-list-combo.h>
#include <gal/widgets/e-unicode.h>
#include <gal/e-text/e-entry.h>
#include <e-util/e-categories-master-list-wombat.h>
@@ -53,7 +53,7 @@ static void e_select_names_class_init (ESelectNamesClass *klass);
static void e_select_names_set_arg (GtkObject *o, GtkArg *arg, guint arg_id);
static void e_select_names_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
static void e_select_names_destroy (GtkObject *object);
-static void update_query (GtkWidget *widget, ESelectNames *e_select_names);
+static void update_query (GtkWidget *button, ESelectNames *e_select_names);
static GnomeDialogClass *parent_class = NULL;
#define PARENT_TYPE gnome_dialog_get_type()
@@ -64,12 +64,11 @@ enum {
};
typedef struct {
- char *title;
- ETableModel *model;
- ESelectNamesModel *source;
- ESelectNamesTextModel *text_model;
- ESelectNames *names;
- GtkWidget *label;
+ char *title;
+ ETableModel *model;
+ ESelectNamesModel *source;
+ ESelectNames *names;
+ GtkWidget *label;
} ESelectNamesChild;
GtkType
@@ -111,7 +110,7 @@ e_select_names_class_init (ESelectNamesClass *klass)
}
#define SPEC "<ETableSpecification no-headers=\"true\" cursor-mode=\"line\"> \
- <ETableColumn model_col= \"%d\" _title=\"Name\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"string\" compare=\"string\" search=\"string\"/> \
+ <ETableColumn model_col= \"%d\" _title=\"Name\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
<ETableState> \
<column source=\"0\"/> \
<grouping> <leaf column=\"0\" ascending=\"true\"/> </grouping> \
@@ -119,7 +118,7 @@ e_select_names_class_init (ESelectNamesClass *klass)
</ETableSpecification>"
#define SPEC2 "<ETableSpecification no-headers=\"true\" cursor-mode=\"line\"> \
- <ETableColumn model_col= \"0\" _title=\"Name\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"string\" compare=\"string\" search=\"string\"/> \
+ <ETableColumn model_col= \"0\" _title=\"Name\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
<ETableState> \
<column source=\"0\"/> \
<grouping> <leaf column=\"0\" ascending=\"true\"/> </grouping> \
@@ -236,7 +235,7 @@ real_add_address_cb (int model_row, gpointer closure)
e_destination_set_card (dest, card, 0);
e_select_names_model_append (child->source, dest);
- e_select_names_model_clean (child->source, FALSE);
+ e_select_names_model_clean (child->source);
gtk_object_unref(GTK_OBJECT(card));
}
@@ -465,15 +464,15 @@ removed_folder (EvolutionStorageListener *storage_listener,
}
static void
-update_query (GtkWidget *widget, ESelectNames *e_select_names)
+update_query (GtkWidget *button, ESelectNames *e_select_names)
{
char *category = "";
char *search = "";
char *query;
char *q_array[4];
int i;
- if (e_select_names->categories) {
- category = e_categories_master_list_option_menu_get_category (E_CATEGORIES_MASTER_LIST_OPTION_MENU (e_select_names->categories));
+ if (e_select_names->categories_entry) {
+ category = gtk_entry_get_text (GTK_ENTRY (e_select_names->categories_entry));
}
if (e_select_names->search_entry) {
search = gtk_entry_get_text (GTK_ENTRY (e_select_names->search_entry));
@@ -505,9 +504,12 @@ update_query (GtkWidget *widget, ESelectNames *e_select_names)
}
static void
-categories_changed (GtkWidget *widget, gint value, ESelectNames *e_select_names)
+status_message (EAddressbookModel *model, const gchar *message, ESelectNames *e_select_names)
{
- update_query (widget, e_select_names);
+ if (message == NULL)
+ gtk_label_set_text (GTK_LABEL (e_select_names->status_message), "");
+ else
+ gtk_label_set_text (GTK_LABEL (e_select_names->status_message), message);
}
static void
@@ -542,11 +544,10 @@ add_additional_select_names_uris (ESelectNames *e_select_names, CORBA_Environmen
Bonobo_ConfigDatabase config_db;
guint32 num_additional_uris;
int i;
- gboolean flag;
config_db = addressbook_config_database (ev);
- num_additional_uris = bonobo_config_get_ulong_with_default (config_db, "/Addressbook/additional_select_names_folders/num", 0, &flag);
+ num_additional_uris = bonobo_config_get_ulong_with_default (config_db, "/Addressbook/additional_select_names_folders/num", 0, ev);
for (i = 0; i < num_additional_uris; i ++) {
ESelectNamesFolder *e_folder;
char *config_path;
@@ -659,13 +660,13 @@ e_select_names_create_categories (gchar *name,
gint int1, gint int2)
{
ECategoriesMasterList *ecml;
- GtkWidget *option_menu;
+ GtkWidget *combo;
ecml = e_categories_master_list_wombat_new ();
- option_menu = e_categories_master_list_option_menu_new (ecml);
+ combo = e_categories_master_list_combo_new (ecml);
gtk_object_unref (GTK_OBJECT (ecml));
- return option_menu;
+ return combo;
}
static void
@@ -704,18 +705,29 @@ e_select_names_init (ESelectNames *e_select_names)
e_select_names->adapter = gtk_object_get_data(GTK_OBJECT(e_select_names->table), "adapter");
e_select_names->without = gtk_object_get_data(GTK_OBJECT(e_select_names->table), "without");
+ e_select_names->status_message = glade_xml_get_widget (gui, "status-message");
+ if (e_select_names->status_message && !GTK_IS_LABEL (e_select_names->status_message))
+ e_select_names->status_message = NULL;
+ if (e_select_names->status_message)
+ gtk_signal_connect (GTK_OBJECT (e_select_names->model), "status_message",
+ GTK_SIGNAL_FUNC (status_message), e_select_names);
+
e_select_names->categories = glade_xml_get_widget (gui, "custom-categories");
- if (e_select_names->categories && !E_IS_CATEGORIES_MASTER_LIST_OPTION_MENU (e_select_names->categories))
+ if (e_select_names->categories && !GTK_IS_COMBO (e_select_names->categories))
e_select_names->categories = NULL;
+ if (e_select_names->categories) {
+ e_select_names->categories_entry = GTK_COMBO (e_select_names->categories)->entry;
+ } else
+ e_select_names->categories_entry = NULL;
e_select_names->search_entry = glade_xml_get_widget (gui, "entry-find");
if (e_select_names->search_entry && !GTK_IS_ENTRY (e_select_names->search_entry))
e_select_names->search_entry = NULL;
if (e_select_names->search_entry)
gtk_signal_connect(GTK_OBJECT(e_select_names->search_entry), "activate",
GTK_SIGNAL_FUNC(update_query), e_select_names);
- if (e_select_names->categories)
- gtk_signal_connect(GTK_OBJECT(e_select_names->categories), "changed",
- GTK_SIGNAL_FUNC(categories_changed), e_select_names);
+ if (e_select_names->categories_entry)
+ gtk_signal_connect(GTK_OBJECT(e_select_names->categories_entry), "changed",
+ GTK_SIGNAL_FUNC(update_query), e_select_names);
button = glade_xml_get_widget (gui, "button-find");
if (button)
@@ -801,21 +813,18 @@ button_clicked(GtkWidget *button, ESelectNamesChild *child)
real_add_address(child->names, child);
}
-#if 0
static void
remove_address(ETable *table, int row, int col, GdkEvent *event, ESelectNamesChild *child)
{
e_select_names_model_delete (child->source, row);
}
-#endif
struct _RightClickData {
+ ETable *table;
ESelectNamesChild *child;
- int index;
};
typedef struct _RightClickData RightClickData;
-#if 0
static GSList *selected_rows = NULL;
static void
@@ -834,37 +843,47 @@ selected_rows_foreach_cb (void *row, void *data)
remove_address (NULL, GPOINTER_TO_INT (row), 0, NULL, child);
}
-#endif
static void
remove_cb (GtkWidget *widget, void *data)
{
RightClickData *rcdata = (RightClickData *)data;
- e_select_names_model_delete (rcdata->child->source, rcdata->index);
+ e_select_names_model_freeze (rcdata->child->source);
+
+ /* Build a list of selected rows */
+ e_table_selected_row_foreach (rcdata->table,
+ etable_selection_foreach_cb,
+ rcdata->child);
+
+ /* Now process the list we made, removing each selected row */
+ g_slist_foreach (selected_rows,
+ (GFunc)selected_rows_foreach_cb,
+ rcdata->child);
+
+ e_select_names_model_thaw (rcdata->child->source);
/* Free everything we've created */
g_free (rcdata);
+ g_slist_free (selected_rows);
+ selected_rows = NULL;
}
static void
-section_right_click_cb (EText *text, GdkEventButton *ev, gint pos, ESelectNamesChild *child)
+section_right_click_cb (ETable *table, gint row, gint col, GdkEvent *event, ESelectNamesChild *child)
{
EPopupMenu right_click_menu[] = {
- E_POPUP_ITEM (N_("Remove"), GTK_SIGNAL_FUNC (remove_cb), 0),
- E_POPUP_TERMINATOR
+ { N_("Remove"), NULL,
+ GTK_SIGNAL_FUNC (remove_cb), NULL, 0 },
+ { NULL, NULL, NULL, 0 }
};
- gint index;
-
- e_select_names_model_text_pos (child->source, child->text_model->seplen, pos, &index, NULL, NULL);
- if (index != -1) {
- RightClickData *rcdata = g_new0 (RightClickData, 1);
- rcdata->index = index;
- rcdata->child = child;
+ RightClickData *rcdata = g_new0 (RightClickData, 1);
+ rcdata->table = table;
+ rcdata->child = child;
- e_popup_menu_run (right_click_menu, (GdkEvent *)ev, 0, 0, rcdata);
- }
+ e_popup_menu_run (right_click_menu, event, 0, 0,
+ rcdata);
}
void
@@ -877,8 +896,8 @@ e_select_names_add_section(ESelectNames *e_select_names, char *name, char *id, E
GtkTable *table;
char *label_text;
- GtkWidget *sw;
- GtkWidget *recipient_table;
+ ETableModel *model;
+ GtkWidget *etable;
if (g_hash_table_lookup(e_select_names->children, id)) {
return;
@@ -891,12 +910,6 @@ e_select_names_add_section(ESelectNames *e_select_names, char *name, char *id, E
child->names = e_select_names;
child->title = e_utf8_from_locale_string(_(name));
- child->text_model = (ESelectNamesTextModel *) e_select_names_text_model_new (source);
- e_select_names_text_model_set_separator (child->text_model, "\n");
-
- child->source = source;
- gtk_object_ref(GTK_OBJECT(child->source));
-
e_select_names->child_count++;
alignment = gtk_alignment_new(0, 0, 1, 0);
@@ -933,38 +946,28 @@ e_select_names_add_section(ESelectNames *e_select_names, char *name, char *id, E
e_select_names->child_count + 1,
GTK_FILL, GTK_FILL,
0, 0);
-
- sw = gtk_scrolled_window_new (NULL, NULL);
- recipient_table = e_entry_new ();
- gtk_object_set (GTK_OBJECT (recipient_table),
- "model", child->text_model,
- "allow_newlines", TRUE,
- NULL);
+ model = e_select_names_table_model_new(source);
+ etable = e_table_scrolled_new (model, NULL, SPEC2, NULL);
- gtk_signal_connect (GTK_OBJECT (recipient_table),
- "popup",
- GTK_SIGNAL_FUNC (section_right_click_cb),
- child);
-
- gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (sw), recipient_table);
-
-#if 0
gtk_signal_connect(GTK_OBJECT(e_table_scrolled_get_table(E_TABLE_SCROLLED(etable))), "right_click",
GTK_SIGNAL_FUNC(section_right_click_cb), child);
gtk_signal_connect(GTK_OBJECT(e_table_scrolled_get_table(E_TABLE_SCROLLED(etable))), "double_click",
GTK_SIGNAL_FUNC(remove_address), child);
-#endif
+ child->model = model;
+ child->source = source;
+ gtk_object_ref(GTK_OBJECT(child->model));
+ gtk_object_ref(GTK_OBJECT(child->source));
gtk_signal_connect (GTK_OBJECT (child->source),
"changed",
GTK_SIGNAL_FUNC (sync_table_and_models),
e_select_names);
- gtk_widget_show_all (sw);
+ gtk_widget_show(etable);
- gtk_table_attach(table, sw,
+ gtk_table_attach(table, etable,
1, 2,
e_select_names->child_count,
e_select_names->child_count + 1,
diff --git a/addressbook/gui/component/select-names/select-names.glade b/addressbook/gui/component/select-names/select-names.glade
index 47d178735a..2826062053 100644
--- a/addressbook/gui/component/select-names/select-names.glade
+++ b/addressbook/gui/component/select-names/select-names.glade
@@ -147,6 +147,32 @@
<xfill>True</xfill>
<yfill>True</yfill>
</child>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label20</name>
+ <label>_Message Recipients:</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <child>
+ <left_attach>1</left_attach>
+ <right_attach>2</right_attach>
+ <top_attach>0</top_attach>
+ <bottom_attach>1</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>False</yfill>
+ </child>
+ </widget>
</widget>
<widget>
@@ -170,6 +196,23 @@
</child>
<widget>
+ <class>GtkLabel</class>
+ <name>label22</name>
+ <label>Co_ntacts:</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+
+ <widget>
<class>Custom</class>
<name>table-source</name>
<creation_function>e_addressbook_create_ebook_table</creation_function>
diff --git a/addressbook/gui/contact-editor/contact-editor.glade b/addressbook/gui/contact-editor/contact-editor.glade
index c8c880fa0c..6e554c36ea 100644
--- a/addressbook/gui/contact-editor/contact-editor.glade
+++ b/addressbook/gui/contact-editor/contact-editor.glade
@@ -1174,6 +1174,7 @@
<widget>
<class>GtkCheckButton</class>
<name>checkbutton-mailingaddress</name>
+ <visible>False</visible>
<label>This is the _mailing address</label>
<active>False</active>
<draw_indicator>True</draw_indicator>
diff --git a/addressbook/gui/contact-editor/e-contact-editor-address.c b/addressbook/gui/contact-editor/e-contact-editor-address.c
index dfd89fc75d..a826849f2f 100644
--- a/addressbook/gui/contact-editor/e-contact-editor-address.c
+++ b/addressbook/gui/contact-editor/e-contact-editor-address.c
@@ -20,19 +20,11 @@
*/
#include <config.h>
-
-#include <e-contact-editor-address.h>
-
-#include <glib.h>
-#include <libgnome/gnome-defs.h>
-#include <libgnome/gnome-i18n.h>
#include <libgnomeui/gnome-stock.h>
#include <gal/widgets/e-unicode.h>
#include <gal/widgets/e-gui-utils.h>
+#include <e-contact-editor-address.h>
#include <gtk/gtkcombo.h>
-#include <string.h>
-#include <stdlib.h>
-#include <locale.h>
static void e_contact_editor_address_init (EContactEditorAddress *card);
static void e_contact_editor_address_class_init (EContactEditorAddressClass *klass);
@@ -124,281 +116,6 @@ setup_tab_order(GladeXML *gui)
}
}
-static char * countries [] = {
- N_("United States"),
- N_("Afghanistan"),
- N_("Albania"),
- N_("Algeria"),
- N_("American Samoa"),
- N_("Andorra"),
- N_("Angola"),
- N_("Anguilla"),
- N_("Antarctica"),
- N_("Antigua And Barbuda"),
- N_("Argentina"),
- N_("Armenia"),
- N_("Aruba"),
- N_("Australia"),
- N_("Austria"),
- N_("Azerbaijan"),
- N_("Bahamas"),
- N_("Bahrain"),
- N_("Bangladesh"),
- N_("Barbados"),
- N_("Belarus"),
- N_("Belgium"),
- N_("Belize"),
- N_("Benin"),
- N_("Bermuda"),
- N_("Bhutan"),
- N_("Bolivia"),
- N_("Bosnia And Herzegowina"),
- N_("Botswana"),
- N_("Bouvet Island"),
- N_("Brazil"),
- N_("British Indian Ocean Territory"),
- N_("Brunei Darussalam"),
- N_("Bulgaria"),
- N_("Burkina Faso"),
- N_("Burundi"),
- N_("Cambodia"),
- N_("Cameroon"),
- N_("Canada"),
- N_("Cape Verde"),
- N_("Cayman Islands"),
- N_("Central African Republic"),
- N_("Chad"),
- N_("Chile"),
- N_("China"),
- N_("Christmas Island"),
- N_("Cocos (Keeling) Islands"),
- N_("Colombia"),
- N_("Comoros"),
- N_("Congo"),
- N_("Congo"),
- N_("Cook Islands"),
- N_("Costa Rica"),
- N_("Cote d'Ivoire"),
- N_("Croatia"),
- N_("Cuba"),
- N_("Cyprus"),
- N_("Czech Republic"),
- N_("Denmark"),
- N_("Djibouti"),
- N_("Dominica"),
- N_("Dominican Republic"),
- N_("East Timor"),
- N_("Ecuador"),
- N_("Egypt"),
- N_("El Salvador"),
- N_("Equatorial Guinea"),
- N_("Eritrea"),
- N_("Estonia"),
- N_("Ethiopia"),
- N_("Falkland Islands"),
- N_("Faroe Islands"),
- N_("Fiji"),
- N_("Finland"),
- N_("France"),
- N_("French Guiana"),
- N_("French Polynesia"),
- N_("French Southern Territories"),
- N_("Gabon"),
- N_("Gambia"),
- N_("Georgia"),
- N_("Germany"),
- N_("Ghana"),
- N_("Gibraltar"),
- N_("Greece"),
- N_("Greenland"),
- N_("Grenada"),
- N_("Guadeloupe"),
- N_("Guam"),
- N_("Guatemala"),
- N_("Guinea"),
- N_("Guinea-bissau"),
- N_("Guyana"),
- N_("Haiti"),
- N_("Heard And McDonald Islands"),
- N_("Holy See"),
- N_("Honduras"),
- N_("Hong Kong"),
- N_("Hungary"),
- N_("Iceland"),
- N_("India"),
- N_("Indonesia"),
- N_("Ireland"),
- N_("Israel"),
- N_("Italy"),
- N_("Jamaica"),
- N_("Japan"),
- N_("Jordan"),
- N_("Kazakhstan"),
- N_("Kenya"),
- N_("Kiribati"),
- N_("Korea, Republic Of"),
- N_("Kuwait"),
- N_("Kyrgyzstan"),
- N_("Laos"),
- N_("Latvia"),
- N_("Lebanon"),
- N_("Lesotho"),
- N_("Liberia"),
- N_("Liechtenstein"),
- N_("Lithuania"),
- N_("Luxembourg"),
- N_("Macau"),
- N_("Macedonia"),
- N_("Madagascar"),
- N_("Malawi"),
- N_("Malaysia"),
- N_("Maldives"),
- N_("Mali"),
- N_("Malta"),
- N_("Marshall Islands"),
- N_("Martinique"),
- N_("Mauritania"),
- N_("Mauritius"),
- N_("Mayotte"),
- N_("Mexico"),
- N_("Micronesia"),
- N_("Moldova, Republic Of"),
- N_("Monaco"),
- N_("Mongolia"),
- N_("Montserrat"),
- N_("Morocco"),
- N_("Mozambique"),
- N_("Myanmar"),
- N_("Namibia"),
- N_("Nauru"),
- N_("Nepal"),
- N_("Netherlands"),
- N_("Netherlands Antilles"),
- N_("New Caledonia"),
- N_("New Zealand"),
- N_("Nicaragua"),
- N_("Niger"),
- N_("Nigeria"),
- N_("Niue"),
- N_("Norfolk Island"),
- N_("Northern Mariana Islands"),
- N_("Norway"),
- N_("Oman"),
- N_("Pakistan"),
- N_("Palau"),
- N_("Palestinian Territory"),
- N_("Panama"),
- N_("Papua New Guinea"),
- N_("Paraguay"),
- N_("Peru"),
- N_("Philippines"),
- N_("Pitcairn"),
- N_("Poland"),
- N_("Portugal"),
- N_("Puerto Rico"),
- N_("Qatar"),
- N_("Reunion"),
- N_("Romania"),
- N_("Russian Federation"),
- N_("Rwanda"),
- N_("Saint Kitts And Nevis"),
- N_("Saint Lucia"),
- N_("Saint Vincent And The Grena-dines"),
- N_("Samoa"),
- N_("San Marino"),
- N_("Sao Tome And Principe"),
- N_("Saudi Arabia"),
- N_("Senegal"),
- N_("Seychelles"),
- N_("Sierra Leone"),
- N_("Singapore"),
- N_("Slovakia"),
- N_("Slovenia"),
- N_("Solomon Islands"),
- N_("Somalia"),
- N_("South Africa"),
- N_("South Georgia And The South Sandwich Islands"),
- N_("Spain"),
- N_("Sri Lanka"),
- N_("St. Helena"),
- N_("St. Pierre And Miquelon"),
- N_("Sudan"),
- N_("Suriname"),
- N_("Svalbard And Jan Mayen Islands"),
- N_("Swaziland"),
- N_("Sweden"),
- N_("Switzerland"),
- N_("Taiwan"),
- N_("Tajikistan"),
- N_("Tanzania, United Republic Of"),
- N_("Thailand"),
- N_("Togo"),
- N_("Tokelau"),
- N_("Tonga"),
- N_("Trinidad And Tobago"),
- N_("Tunisia"),
- N_("Turkey"),
- N_("Turkmenistan"),
- N_("Turks And Caicos Islands"),
- N_("Tuvalu"),
- N_("Uganda"),
- N_("Ukraine"),
- N_("United Arab Emirates"),
- N_("United Kingdom"),
- N_("United States Minor Outlying Islands"),
- N_("Uruguay"),
- N_("Uzbekistan"),
- N_("Vanuatu"),
- N_("Venezuela"),
- N_("Viet Nam"),
- N_("Virgin Islands, British"),
- N_("Virgin Islands, U.S."),
- N_("Wallis And Futuna Islands"),
- N_("Western Sahara"),
- N_("Yemen"),
- N_("Yugoslavia"),
- N_("Zambia"),
- N_("Zimbabwe"),
- NULL
-};
-
-static int
-compare_func (const void *voida, const void *voidb)
-{
- char * const *stringa = voida, * const *stringb = voidb;
-
- return strcoll (*stringa, *stringb);
-}
-
-static void
-fill_in_countries (GladeXML *gui)
-{
- GtkCombo *combo;
- combo = (GtkCombo *) glade_xml_get_widget(gui, "combo-country");
- if (combo && GTK_IS_COMBO (combo)) {
- static gboolean sorted = FALSE;
- static GList *country_list;
- if (!sorted) {
- int i;
- char *locale;
-
- for (i = 0; countries[i]; i++) {
- countries[i] = _(countries[i]);
- }
-
- locale = setlocale (LC_COLLATE, NULL);
- qsort (countries + 1, i - 1, sizeof (countries[0]), compare_func);
- country_list = NULL;
- for (i = 0; countries[i]; i++) {
- country_list = g_list_prepend (country_list, countries[i]);
- }
- country_list = g_list_reverse (country_list);
- sorted = TRUE;
- }
- gtk_combo_set_popdown_strings (combo, country_list);
- }
-}
-
static void
e_contact_editor_address_init (EContactEditorAddress *e_contact_editor_address)
{
@@ -419,7 +136,6 @@ e_contact_editor_address_init (EContactEditorAddress *e_contact_editor_address)
e_contact_editor_address->gui = gui;
setup_tab_order (gui);
- fill_in_countries (gui);
widget = glade_xml_get_widget(gui, "table-checkaddress");
gtk_widget_ref(widget);
diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c
index 58d3a32be6..ea28563cc1 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.c
+++ b/addressbook/gui/contact-editor/e-contact-editor.c
@@ -78,7 +78,6 @@ static GtkWidget *e_contact_editor_build_dialog(EContactEditor *editor, gchar *e
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 void find_address_mailing (EContactEditor *editor);
static void enable_writable_fields(EContactEditor *editor);
static void set_editable(EContactEditor *editor);
static void fill_in_info(EContactEditor *editor);
@@ -314,19 +313,6 @@ address_text_changed (GtkWidget *widget, EContactEditor *editor)
address = e_card_address_label_new();
- if (editor->address_mailing == editor->address_choice || editor->address_mailing == -1) {
- GtkWidget *check;
-
- address->flags |= E_CARD_ADDR_DEFAULT;
-
- check = glade_xml_get_widget(editor->gui, "checkbutton-mailingaddress");
- if (check && GTK_IS_CHECK_BUTTON (check)) {
- gtk_signal_handler_block_by_data (GTK_OBJECT (check), editor);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), TRUE);
- gtk_signal_handler_unblock_by_data (GTK_OBJECT (check), editor);
- }
- }
-
address->data = e_utf8_gtk_editable_get_chars(editable, 0, -1);
e_card_simple_set_address(editor->simple, editor->address_choice, address);
@@ -335,58 +321,6 @@ address_text_changed (GtkWidget *widget, EContactEditor *editor)
widget_changed (widget, editor);
}
-
-static void
-address_mailing_changed (GtkWidget *widget, EContactEditor *editor)
-{
- ECardAddrLabel *address;
- GtkWidget *text;
- gboolean mailing_address;
-
- if (editor->address_choice == -1)
- return;
-
- mailing_address = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget));
-
- /* Mark the current address as the mailing address */
- text = glade_xml_get_widget(editor->gui, "text-address");
- if (text && GTK_IS_TEXT(text)) {
-
- address = e_card_address_label_new();
-
- if (mailing_address)
- address->flags |= E_CARD_ADDR_DEFAULT;
- else
- address->flags &= ~E_CARD_ADDR_DEFAULT;
- address->data = e_utf8_gtk_editable_get_chars(GTK_EDITABLE (text), 0, -1);
-
- e_card_simple_set_address(editor->simple, editor->address_choice, address);
- e_card_address_label_unref(address);
- }
-
- /* Unset the previous mailing address flag */
- if (mailing_address && editor->address_mailing != -1) {
- const ECardAddrLabel *curr;
-
- curr = e_card_simple_get_address(editor->simple,
- editor->address_mailing);
- address = e_card_address_label_copy (curr);
- address->flags &= ~E_CARD_ADDR_DEFAULT;
- e_card_simple_set_address(editor->simple,
- editor->address_mailing,
- address);
- }
-
- /* Remember the new mailing address */
- if (mailing_address)
- editor->address_mailing = editor->address_choice;
- else
- editor->address_mailing = -1;
-
- widget_changed (widget, editor);
-}
-
-
/* This function tells you whether name_to_style will make sense. */
static gboolean
style_makes_sense(const ECardName *name, char *company, int style)
@@ -1304,7 +1238,6 @@ e_contact_editor_init (EContactEditor *e_contact_editor)
e_contact_editor->phone_choice[2] = E_CARD_SIMPLE_PHONE_ID_BUSINESS_FAX;
e_contact_editor->phone_choice[3] = E_CARD_SIMPLE_PHONE_ID_MOBILE;
e_contact_editor->address_choice = 0;
- e_contact_editor->address_mailing = -1;
e_contact_editor->arbitrary_fields = NULL;
@@ -1334,11 +1267,6 @@ e_contact_editor_init (EContactEditor *e_contact_editor)
if (wants_html && GTK_IS_TOGGLE_BUTTON(wants_html))
gtk_signal_connect(GTK_OBJECT(wants_html), "toggled",
wants_html_changed, e_contact_editor);
-
- widget = glade_xml_get_widget(e_contact_editor->gui, "checkbutton-mailingaddress");
- if (widget && GTK_IS_TOGGLE_BUTTON(widget))
- gtk_signal_connect(GTK_OBJECT(widget), "toggled",
- address_mailing_changed, e_contact_editor);
widget = glade_xml_get_widget(e_contact_editor->gui, "button-fullname");
if (widget && GTK_IS_BUTTON(widget))
@@ -1980,7 +1908,7 @@ _address_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEdito
gtk_check_menu_item_set_show_toggle(GTK_CHECK_MENU_ITEM(editor->address_info[i].widget),
TRUE);
}
-
+
result = _arrow_pressed (widget, button, editor, editor->address_popup, &editor->address_list, &editor->address_info, "label-address", "text-address", "Add new Address type");
if (result != -1) {
@@ -1993,30 +1921,6 @@ _address_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEdito
}
static void
-find_address_mailing (EContactEditor *editor)
-{
- const ECardAddrLabel *address;
- int i;
-
- editor->address_mailing = -1;
- for (i = 0; i < E_CARD_SIMPLE_ADDRESS_ID_LAST; i++) {
- address = e_card_simple_get_address(editor->simple, i);
- if (address && (address->flags & E_CARD_ADDR_DEFAULT)) {
- if (editor->address_mailing == -1) {
- editor->address_mailing = i;
- } else {
- ECardAddrLabel *new;
-
- new = e_card_address_label_copy (address);
- new->flags &= ~E_CARD_ADDR_DEFAULT;
- e_card_simple_set_address(editor->simple, i, new);
- e_card_address_label_unref (new);
- }
- }
- }
-}
-
-static void
set_field(GtkEntry *entry, const char *string)
{
char *oldstring = e_utf8_gtk_entry_get_text(entry);
@@ -2037,8 +1941,6 @@ static void
set_fields(EContactEditor *editor)
{
GtkWidget *entry;
- GtkWidget *label_widget;
- int i;
entry = glade_xml_get_widget(editor->gui, "entry-phone1");
if (entry && GTK_IS_ENTRY(entry))
@@ -2059,38 +1961,18 @@ set_fields(EContactEditor *editor)
entry = glade_xml_get_widget(editor->gui, "entry-email1");
if (entry && GTK_IS_ENTRY(entry))
set_field(GTK_ENTRY(entry), e_card_simple_get_email(editor->simple, editor->email_choice));
-
-
-
- e_contact_editor_build_address_ui (editor);
-
- for (i = 0; i < E_CARD_SIMPLE_ADDRESS_ID_LAST; i++) {
- const ECardAddrLabel *address = e_card_simple_get_address(editor->simple, i);
-
- if (address && address->data && *address->data)
- break;
- }
- if (i == E_CARD_SIMPLE_ADDRESS_ID_LAST)
- i = 0;
-
- label_widget = glade_xml_get_widget(editor->gui, "label-address");
- if (label_widget && GTK_IS_LABEL(label_widget)) {
- gtk_object_set(GTK_OBJECT(label_widget),
- "label", _(g_list_nth_data(editor->address_list, i)),
- NULL);
- }
-
- set_address_field(editor, i);
+
+ set_address_field(editor, -1);
}
static void
set_address_field(EContactEditor *editor, int result)
{
- GtkWidget *text, *check;
+ GtkWidget *widget;
- text = glade_xml_get_widget(editor->gui, "text-address");
+ widget = glade_xml_get_widget(editor->gui, "text-address");
- if (text && GTK_IS_TEXT(text)) {
+ if (widget && GTK_IS_TEXT(widget)) {
int position;
GtkEditable *editable;
const ECardAddrLabel *address;
@@ -2100,8 +1982,7 @@ set_address_field(EContactEditor *editor, int result)
editor->address_choice = -1;
position = 0;
- editable = GTK_EDITABLE(text);
-
+ editable = GTK_EDITABLE(widget);
gtk_editable_delete_text(editable, 0, -1);
address = e_card_simple_get_address(editor->simple, result);
if (address && address->data) {
@@ -2110,15 +1991,6 @@ set_address_field(EContactEditor *editor, int result)
g_free (u);
}
- check = glade_xml_get_widget(editor->gui, "checkbutton-mailingaddress");
- if (check && GTK_IS_CHECK_BUTTON (check)) {
- if (address && address->data)
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check),
- address->flags & E_CARD_ADDR_DEFAULT);
- else
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), FALSE);
- }
-
editor->address_choice = result;
}
}
@@ -2347,7 +2219,7 @@ enable_writable_fields(EContactEditor *editor)
/* disable the label widgets for the dropdowns (4 phone, 1
email and the toggle button, and 1 address and one for
- the full address button */
+ the full adress button */
for (i = 0; i < 4; i ++) {
widget_name = g_strdup_printf ("label-phone%d", i+1);
enable_widget (glade_xml_get_widget (editor->gui, widget_name), FALSE);
@@ -2499,8 +2371,6 @@ fill_in_info(EContactEditor *editor)
fill_in_single_field(editor, list->data);
}
- find_address_mailing (editor);
-
if (wants_html_set) {
GtkWidget *widget = glade_xml_get_widget(editor->gui, "checkbutton-htmlmail");
if (widget && GTK_IS_CHECK_BUTTON(widget)) {
diff --git a/addressbook/gui/contact-editor/fulladdr.glade b/addressbook/gui/contact-editor/fulladdr.glade
index d66b9163e8..432e081c60 100644
--- a/addressbook/gui/contact-editor/fulladdr.glade
+++ b/addressbook/gui/contact-editor/fulladdr.glade
@@ -360,7 +360,241 @@
<case_sensitive>False</case_sensitive>
<use_arrows>True</use_arrows>
<use_arrows_always>False</use_arrows_always>
- <items></items>
+ <items>United States
+Afghanistan
+Albania
+Algeria
+American Samoa
+Andorra
+Angola
+Anguilla
+Antarctica
+Antigua And Barbuda
+Argentina
+Armenia
+Aruba
+Australia
+Austria
+Azerbaijan
+Bahamas
+Bahrain
+Bangladesh
+Barbados
+Belarus
+Belgium
+Belize
+Benin
+Bermuda
+Bhutan
+Bolivia
+Bosnia And Herzegowina
+Botswana
+Bouvet Island
+Brazil
+British Indian Ocean Territory
+Brunei Darussalam
+Bulgaria
+Burkina Faso
+Burundi
+Cambodia
+Cameroon
+Canada
+Cape Verde
+Cayman Islands
+Central African Republic
+Chad
+Chile
+China
+Christmas Island
+Cocos (Keeling) Islands
+Colombia
+Comoros
+Congo
+Congo
+Cook Islands
+Costa Rica
+Cote d'Ivoire
+Croatia
+Cuba
+Cyprus
+Czech Republic
+Denmark
+Djibouti
+Dominica
+Dominican Republic
+East Timor
+Ecuador
+Egypt
+El Salvador
+Equatorial Guinea
+Eritrea
+Estonia
+Ethiopia
+Falkland Islands
+Faroe Islands
+Fiji
+Finland
+France
+French Guiana
+French Polynesia
+French Southern Territories
+Gabon
+Gambia
+Georgia
+Germany
+Ghana
+Gibraltar
+Greece
+Greenland
+Grenada
+Guadeloupe
+Guam
+Guatemala
+Guinea
+Guinea-bissau
+Guyana
+Haiti
+Heard And McDonald Islands
+Holy See
+Honduras
+Hong Kong
+Hungary
+Iceland
+India
+Indonesia
+Ireland
+Israel
+Italy
+Jamaica
+Japan
+Jordan
+Kazakhstan
+Kenya
+Kiribati
+Republic Of Korea
+Kuwait
+Kyrgyzstan
+Laos
+Latvia
+Lebanon
+Lesotho
+Liberia
+Liechtenstein
+Lithuania
+Luxembourg
+Macau
+Macedonia
+Madagascar
+Malawi
+Malaysia
+Maldives
+Mali
+Malta
+Marshall Islands
+Martinique
+Mauritania
+Mauritius
+Mayotte
+Mexico
+Micronesia
+Republic Of Moldova
+Monaco
+Mongolia
+Montserrat
+Morocco
+Mozambique
+Myanmar
+Namibia
+Nauru
+Nepal
+Netherlands
+Netherlands Antilles
+New Caledonia
+New Zealand
+Nicaragua
+Niger
+Nigeria
+Niue
+Norfolk Island
+Northern Mariana Islands
+Norway
+Oman
+Pakistan
+Palau
+Palestinian Territory
+Panama
+Papua New Guinea
+Paraguay
+Peru
+Philippines
+Pitcairn
+Poland
+Portugal
+Puerto Rico
+Qatar
+Reunion
+Romania
+Russian Federation
+Rwanda
+Saint Kitts And Nevis
+Saint Lucia
+Saint Vincent And The Grena-dines
+Samoa
+San Marino
+Sao Tome And Principe
+Saudi Arabia
+Senegal
+Seychelles
+Sierra Leone
+Singapore
+Slovakia
+Slovenia
+Solomon Islands
+Somalia
+South Africa
+South Georgia And The South Sandwich Islands
+Spain
+Sri Lanka
+St. Helena
+St. Pierre And Miquelon
+Sudan
+Suriname
+Svalbard And Jan Mayen Islands
+Swaziland
+Sweden
+Switzerland
+Taiwan
+Tajikistan
+United Republic Of Tanzania
+Thailand
+Togo
+Tokelau
+Tonga
+Trinidad And Tobago
+Tunisia
+Turkey
+Turkmenistan
+Turks And Caicos Islands
+Tuvalu
+Uganda
+Ukraine
+United Arab Emirates
+United Kingdom
+United States Minor Outlying Islands
+Uruguay
+Uzbekistan
+Vanuatu
+Venezuela
+Viet Nam
+British Virgin Islands
+U.S. Virgin Islands
+Wallis And Futuna Islands
+Western Sahara
+Yemen
+Yugoslavia
+Zambia
+Zimbabwe
+</items>
<child>
<left_attach>3</left_attach>
<right_attach>4</right_attach>
diff --git a/addressbook/gui/widgets/e-addressbook-model.c b/addressbook/gui/widgets/e-addressbook-model.c
index 320c0c4ad2..0f63c48936 100644
--- a/addressbook/gui/widgets/e-addressbook-model.c
+++ b/addressbook/gui/widgets/e-addressbook-model.c
@@ -14,7 +14,6 @@
#include <gnome-xml/xmlmemory.h>
#include <gnome.h>
#include <gal/widgets/e-gui-utils.h>
-#include "e-addressbook-util.h"
#define PARENT_TYPE gtk_object_get_type()
GtkObjectClass *parent_class;
diff --git a/addressbook/gui/widgets/e-addressbook-view.c b/addressbook/gui/widgets/e-addressbook-view.c
index 070e1b49e0..3837cd4674 100644
--- a/addressbook/gui/widgets/e-addressbook-view.c
+++ b/addressbook/gui/widgets/e-addressbook-view.c
@@ -30,15 +30,12 @@
#include <gal/e-table/e-table-model.h>
#include <gal/widgets/e-scroll-frame.h>
#include <gal/widgets/e-popup-menu.h>
-#include <gal/widgets/e-gui-utils.h>
#include <gal/widgets/e-unicode.h>
#include <gal/menus/gal-view-factory-etable.h>
#include <gal/menus/gal-view-etable.h>
#include <gal/util/e-unicode-i18n.h>
-#include <gal/util/e-xml-utils.h>
#include <gal/unicode/gunicode.h>
#include <libgnomeui/gnome-dialog-util.h>
-#include <libgnomeui/gnome-stock.h>
#include <libgnomeprint/gnome-print.h>
#include <libgnomeprint/gnome-print-dialog.h>
@@ -64,13 +61,6 @@
#include <gdk/gdkkeysyms.h>
#include <ctype.h>
-#include <gnome-xml/tree.h>
-#include <gnome-xml/parser.h>
-
-#define SHOW_ALL_SEARCH "(contains \"x-evolution-any-field\" \"\")"
-
-#define d(x)
-
static void e_addressbook_view_init (EAddressbookView *card);
static void e_addressbook_view_class_init (EAddressbookViewClass *klass);
static void e_addressbook_view_set_arg (GtkObject *o, GtkArg *arg, guint arg_id);
@@ -83,7 +73,6 @@ static void folder_bar_message (GtkObject *object, const gchar *status, EAddress
static void stop_state_changed (GtkObject *object, EAddressbookView *eav);
static void writable_status (GtkObject *object, gboolean writable, EAddressbookView *eav);
static void command_state_change (EAddressbookView *eav);
-static void alphabet_state_change (EAddressbookView *eav, gunichar letter);
static void selection_clear_event (GtkWidget *invisible, GdkEventSelection *event,
EAddressbookView *view);
@@ -107,7 +96,6 @@ enum {
STATUS_MESSAGE,
FOLDER_BAR_MESSAGE,
COMMAND_STATE_CHANGE,
- ALPHABET_STATE_CHANGE,
LAST_SIGNAL
};
@@ -124,8 +112,6 @@ static guint e_addressbook_view_signals [LAST_SIGNAL] = {0, };
static GdkAtom clipboard_atom = GDK_NONE;
-static GalViewCollection *collection = NULL;
-
GtkType
e_addressbook_view_get_type (void)
{
@@ -196,14 +182,6 @@ e_addressbook_view_class_init (EAddressbookViewClass *klass)
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
- e_addressbook_view_signals [ALPHABET_STATE_CHANGE] =
- gtk_signal_new ("alphabet_state_change",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EAddressbookViewClass, alphabet_state_change),
- gtk_marshal_NONE__UINT,
- GTK_TYPE_NONE, 1, GTK_TYPE_UINT);
-
gtk_object_class_add_signals (object_class, e_addressbook_view_signals, LAST_SIGNAL);
if (!clipboard_atom)
@@ -239,15 +217,13 @@ e_addressbook_view_init (EAddressbookView *eav)
eav->editable = FALSE;
eav->book = NULL;
- eav->query = g_strdup (SHOW_ALL_SEARCH);
+ eav->query = g_strdup("(contains \"x-evolution-any-field\" \"\")");
eav->object = NULL;
eav->widget = NULL;
- eav->view_instance = NULL;
+ eav->view_collection = NULL;
eav->view_menus = NULL;
- eav->uic = NULL;
- eav->current_alphabet_widget = NULL;
eav->invisible = gtk_invisible_new ();
@@ -288,11 +264,9 @@ e_addressbook_view_destroy (GtkObject *object)
g_free(eav->query);
eav->query = NULL;
- eav->uic = NULL;
-
- if (eav->view_instance) {
- gtk_object_unref (GTK_OBJECT (eav->view_instance));
- eav->view_instance = NULL;
+ if (eav->view_collection) {
+ gtk_object_unref (GTK_OBJECT (eav->view_collection));
+ eav->view_collection = NULL;
}
if (eav->view_menus) {
@@ -323,176 +297,13 @@ e_addressbook_view_new (void)
}
static void
-writable_status (GtkObject *object, gboolean writable, EAddressbookView *eav)
+book_writable_cb (EBook *book, gboolean writable, EAddressbookView *eav)
{
eav->editable = writable;
- command_state_change (eav);
-}
-
-#ifdef JUST_FOR_TRANSLATORS
-static char *list [] = {
- N_("* Click here to add a contact *"),
- N_("File As"),
- N_("Full Name"),
- N_("Email"),
- N_("Primary Phone"),
- N_("Assistant Phone"),
- N_("Business Phone"),
- N_("Callback Phone"),
- N_("Company Phone"),
- N_("Home Phone"),
- N_("Organization"),
- N_("Business Address"),
- N_("Home Address"),
- N_("Mobile Phone"),
- N_("Car Phone"),
- N_("Business Fax"),
- N_("Home Fax"),
- N_("Business Phone 2"),
- N_("Home Phone 2"),
- N_("ISDN"),
- N_("Other Phone"),
- N_("Other Fax"),
- N_("Pager"),
- N_("Radio"),
- N_("Telex"),
- N_("TTY"),
- N_("Other Address"),
- N_("Email 2"),
- N_("Email 3"),
- N_("Web Site"),
- N_("Department"),
- N_("Office"),
- N_("Title"),
- N_("Profession"),
- N_("Manager"),
- N_("Assistant"),
- N_("Nickname"),
- N_("Spouse"),
- N_("Note"),
- N_("Free-busy URL"),
-};
-#endif
-
-#define SPEC "<?xml version=\"1.0\"?> \
-<ETableSpecification click-to-add=\"true\" draw-grid=\"true\" _click-to-add-message=\"* Click here to add a contact *\"> \
- <ETableColumn model_col= \"0\" _title=\"File As\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col= \"1\" _title=\"Full Name\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col= \"2\" _title=\"Email\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col= \"3\" _title=\"Primary Phone\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col= \"4\" _title=\"Assistant Phone\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col= \"5\" _title=\"Business Phone\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col= \"6\" _title=\"Callback Phone\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col= \"7\" _title=\"Company Phone\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col= \"8\" _title=\"Home Phone\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col= \"9\" _title=\"Organization\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"10\" _title=\"Business Address\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"11\" _title=\"Home Address\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"12\" _title=\"Mobile Phone\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"13\" _title=\"Car Phone\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"14\" _title=\"Business Fax\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"15\" _title=\"Home Fax\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"16\" _title=\"Business Phone 2\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"17\" _title=\"Home Phone 2\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"18\" _title=\"ISDN\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"19\" _title=\"Other Phone\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"20\" _title=\"Other Fax\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"21\" _title=\"Pager\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"22\" _title=\"Radio\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"23\" _title=\"Telex\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"24\" _title=\"TTY\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"25\" _title=\"Other Address\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"26\" _title=\"Email 2\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"27\" _title=\"Email 3\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"28\" _title=\"Web Site\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"29\" _title=\"Department\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"30\" _title=\"Office\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"31\" _title=\"Title\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"32\" _title=\"Profession\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"33\" _title=\"Manager\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"34\" _title=\"Assistant\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"35\" _title=\"Nickname\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"36\" _title=\"Spouse\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"37\" _title=\"Note\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableColumn model_col=\"38\" _title=\"Free-busy URL\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableState> \
- <column source=\"0\"/> \
- <column source=\"1\"/> \
- <column source=\"5\"/> \
- <column source=\"2\"/> \
- <column source=\"3\"/> \
- <grouping> \
- <leaf column=\"0\" ascending=\"true\"/> \
- </grouping> \
- </ETableState> \
-</ETableSpecification>"
-
-static void
-init_collection (void)
-{
- GalViewFactory *factory;
- ETableSpecification *spec;
- char *galview;
-
- if (collection == NULL) {
- collection = gal_view_collection_new();
-
- galview = gnome_util_prepend_user_home("/evolution/views/addressbook/");
- gal_view_collection_set_storage_directories
- (collection,
- EVOLUTION_DATADIR "/evolution/views/addressbook/",
- galview);
- g_free(galview);
-
- spec = e_table_specification_new();
- e_table_specification_load_from_string(spec, SPEC);
-
- factory = gal_view_factory_etable_new (spec);
- gtk_object_unref (GTK_OBJECT (spec));
- gal_view_collection_add_factory (collection, factory);
- gtk_object_unref (GTK_OBJECT (factory));
-
- factory = gal_view_factory_minicard_new ();
- gal_view_collection_add_factory (collection, factory);
- gtk_object_unref (GTK_OBJECT (factory));
-
- gal_view_collection_load(collection);
- }
-}
-
-static void
-display_view(GalViewInstance *instance,
- GalView *view,
- gpointer data)
-{
- EAddressbookView *address_view = data;
- if (GAL_IS_VIEW_ETABLE(view)) {
- change_view_type (address_view, E_ADDRESSBOOK_VIEW_TABLE);
- gal_view_etable_attach_table (GAL_VIEW_ETABLE(view), e_table_scrolled_get_table(E_TABLE_SCROLLED(address_view->widget)));
- } else if (GAL_IS_VIEW_MINICARD(view)) {
- change_view_type (address_view, E_ADDRESSBOOK_VIEW_MINICARD);
- gal_view_minicard_attach (GAL_VIEW_MINICARD(view), E_MINICARD_VIEW_WIDGET (address_view->object));
- }
- address_view->current_view = view;
-}
-
-static void
-setup_menus (EAddressbookView *view)
-{
- if (view->book && view->view_instance == NULL) {
- init_collection ();
- view->view_instance = gal_view_instance_new (collection, e_book_get_uri (view->book));
- }
-
- if (view->view_instance && view->uic) {
- view->view_menus = gal_view_menus_new(view->view_instance);
- gal_view_menus_apply(view->view_menus, view->uic, NULL);
-
- display_view (view->view_instance, gal_view_instance_get_current_view (view->view_instance), view);
-
- gtk_signal_connect(GTK_OBJECT(view->view_instance), "display_view",
- display_view, view);
- }
+ gtk_object_set (GTK_OBJECT (eav->model),
+ "editable", eav->editable,
+ NULL);
+ writable_status (GTK_OBJECT(book), writable, eav);
}
static void
@@ -508,41 +319,25 @@ e_addressbook_view_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
if (GTK_VALUE_OBJECT(*arg)) {
eav->book = E_BOOK(GTK_VALUE_OBJECT(*arg));
gtk_object_ref(GTK_OBJECT(eav->book));
+ gtk_signal_connect (GTK_OBJECT (eav->book),
+ "writable_status",
+ book_writable_cb, eav);
}
else
eav->book = NULL;
-
- if (eav->view_instance) {
- gtk_object_unref (GTK_OBJECT (eav->view_instance));
- eav->view_instance = NULL;
- }
-
gtk_object_set(GTK_OBJECT(eav->model),
"book", eav->book,
NULL);
- setup_menus (eav);
-
break;
case ARG_QUERY:
-#if 0 /* This code will mess up ldap a bit. We need to think about the ramifications of this more. */
- if ((GTK_VALUE_STRING (*arg) == NULL && !strcmp (eav->query, SHOW_ALL_SEARCH)) ||
- (GTK_VALUE_STRING (*arg) != NULL && !strcmp (eav->query, GTK_VALUE_STRING (*arg))))
- break;
-#endif
g_free(eav->query);
eav->query = g_strdup(GTK_VALUE_STRING(*arg));
if (!eav->query)
- eav->query = g_strdup (SHOW_ALL_SEARCH);
+ eav->query = g_strdup("(contains \"x-evolution-any-field\" \"\")");
gtk_object_set(GTK_OBJECT(eav->model),
"query", eav->query,
NULL);
- if (eav->current_alphabet_widget != NULL) {
- GtkWidget *current = eav->current_alphabet_widget;
-
- eav->current_alphabet_widget = NULL;
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (current), FALSE);
- }
break;
case ARG_TYPE:
change_view_type(eav, GTK_VALUE_ENUM(*arg));
@@ -589,8 +384,6 @@ const char *button_letters = N_(",0,a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,
typedef struct {
EAddressbookView *view;
- GtkWidget *button;
- GtkWidget *vbox;
gunichar letter;
} LetterClosure;
@@ -637,11 +430,11 @@ e_utf8_split (const char *utf8_str, gunichar delim)
}
static void
-jump_to_letter(EAddressbookView *view, gunichar letter)
+jump_to_letter(GtkWidget *button, LetterClosure *closure)
{
char *query;
- if (g_unichar_isdigit (letter)) {
+ if (g_unichar_isdigit (closure->letter)) {
const char *letters = U_(button_letters);
char **letter_v;
GString *gstr;
@@ -661,48 +454,18 @@ jump_to_letter(EAddressbookView *view, gunichar letter)
} else {
char s[6 + 1];
- s [g_unichar_to_utf8 (letter, s)] = '\0';
+ s [g_unichar_to_utf8 (closure->letter, s)] = '\0';
query = g_strdup_printf ("(beginswith \"file_as\" \"%s\")", s);
}
- gtk_object_set (GTK_OBJECT (view),
+ gtk_object_set (GTK_OBJECT (closure->view),
"query", query,
NULL);
g_free (query);
}
static void
-button_toggled(GtkWidget *button, LetterClosure *closure)
-{
- EAddressbookView *view = closure->view;
-
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button))) {
- GtkWidget *current = view->current_alphabet_widget;
-
- view->current_alphabet_widget = NULL;
- if (current && current != button)
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (current), FALSE);
- jump_to_letter (view, closure->letter);
- view->current_alphabet_widget = button;
- alphabet_state_change (view, closure->letter);
- } else {
- if (view->current_alphabet_widget != NULL &&
- view->current_alphabet_widget == button) {
- view->current_alphabet_widget = NULL;
- gtk_object_set (GTK_OBJECT (view),
- "query", NULL,
- NULL);
- alphabet_state_change (view, 0);
- }
- }
-}
-
-static void
free_closure(GtkWidget *button, LetterClosure *closure)
{
- if (button != NULL &&
- button == closure->view->current_alphabet_widget) {
- closure->view->current_alphabet_widget = NULL;
- }
g_free(closure);
}
@@ -741,17 +504,15 @@ create_alphabet (EAddressbookView *view)
char *label;
label = e_utf8_to_locale_string (*pl);
- button = gtk_toggle_button_new_with_label (label);
+ button = gtk_button_new_with_label (label);
g_free (label);
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
closure = g_new (LetterClosure, 1);
closure->view = view;
closure->letter = g_utf8_get_char (*pc);
- closure->button = button;
- closure->vbox = vbox;
- gtk_signal_connect(GTK_OBJECT(button), "toggled",
- GTK_SIGNAL_FUNC (button_toggled), closure);
+ gtk_signal_connect(GTK_OBJECT(button), "clicked",
+ GTK_SIGNAL_FUNC (jump_to_letter), closure);
gtk_signal_connect(GTK_OBJECT(button), "destroy",
GTK_SIGNAL_FUNC (free_closure), closure);
@@ -771,12 +532,6 @@ minicard_selection_change (EMinicardViewWidget *widget, EAddressbookView *view)
}
static void
-minicard_button_press (GtkWidget *widget, GdkEventButton *event, EAddressbookView *view)
-{
- d(g_print ("Button %d pressed with event type %d\n", event->button, event->type));
-}
-
-static void
create_minicard_view (EAddressbookView *view)
{
GtkWidget *scrollframe;
@@ -793,15 +548,9 @@ create_minicard_view (EAddressbookView *view)
adapter = E_ADDRESSBOOK_REFLOW_ADAPTER(e_addressbook_reflow_adapter_new (view->model));
minicard_view = e_minicard_view_widget_new(adapter);
- /* A hack */
- gtk_object_set_data (GTK_OBJECT (adapter), "view", view);
-
gtk_signal_connect(GTK_OBJECT(minicard_view), "selection_change",
GTK_SIGNAL_FUNC(minicard_selection_change), view);
- gtk_signal_connect(GTK_OBJECT(minicard_view), "button_press_event",
- GTK_SIGNAL_FUNC(minicard_button_press), view);
-
view->object = GTK_OBJECT(minicard_view);
view->widget = minicard_hbox;
@@ -912,12 +661,14 @@ static void
save_as (GtkWidget *widget, CardAndBook *card_and_book)
{
e_contact_save_as(_("Save as VCard"), card_and_book->card);
+ card_and_book_free(card_and_book);
}
static void
send_as (GtkWidget *widget, CardAndBook *card_and_book)
{
e_card_send(card_and_book->card, E_CARD_DISPOSITION_AS_ATTACHMENT);
+ card_and_book_free(card_and_book);
}
static void
@@ -925,12 +676,14 @@ send_to (GtkWidget *widget, CardAndBook *card_and_book)
{
e_card_send(card_and_book->card, E_CARD_DISPOSITION_AS_TO);
+ card_and_book_free(card_and_book);
}
static void
print (GtkWidget *widget, CardAndBook *card_and_book)
{
gtk_widget_show(e_contact_print_card_dialog_new(card_and_book->card));
+ card_and_book_free(card_and_book);
}
#if 0 /* Envelope printing is disabled for Evolution 1.0. */
@@ -938,44 +691,11 @@ static void
print_envelope (GtkWidget *widget, CardAndBook *card_and_book)
{
gtk_widget_show(e_contact_print_envelope_dialog_new(card_and_book->card));
+ card_and_book_free(card_and_book);
}
#endif
static void
-copy (GtkWidget *widget, CardAndBook *card_and_book)
-{
-#if 0
- card_and_book->view->clipboard_cards = g_list_append (NULL, card_and_book->card);
- gtk_object_ref (GTK_OBJECT (card_and_book->card));
- gtk_selection_owner_set (card_and_book->view->invisible, clipboard_atom, GDK_CURRENT_TIME);
-#endif
-
- e_addressbook_view_copy (card_and_book->view);
-}
-
-static void
-paste (GtkWidget *widget, CardAndBook *card_and_book)
-{
- e_addressbook_view_paste (card_and_book->view);
-}
-
-static void
-cut (GtkWidget *widget, CardAndBook *card_and_book)
-{
-#if 0
- /* copy */
- card_and_book->view->clipboard_cards = g_list_append (NULL, card_and_book->card);
- gtk_object_ref (GTK_OBJECT (card_and_book->card));
- gtk_selection_owner_set (card_and_book->view->invisible, clipboard_atom, GDK_CURRENT_TIME);
-
- /* delete */
- e_book_remove_card (card_and_book->book, card_and_book->card, NULL, NULL);
-#endif
-
- e_addressbook_view_cut (card_and_book->view);
-}
-
-static void
delete (GtkWidget *widget, CardAndBook *card_and_book)
{
if (e_contact_editor_confirm_delete(GTK_WINDOW(gtk_widget_get_toplevel(card_and_book->widget)))) {
@@ -991,54 +711,26 @@ delete (GtkWidget *widget, CardAndBook *card_and_book)
}
e_free_object_list(list);
}
+ card_and_book_free(card_and_book);
}
-static void
-copy_to_folder (GtkWidget *widget, CardAndBook *card_and_book)
-{
- e_addressbook_view_copy_to_folder (card_and_book->view);
-}
-
-static void
-move_to_folder (GtkWidget *widget, CardAndBook *card_and_book)
-{
- e_addressbook_view_move_to_folder (card_and_book->view);
-}
-
-static void
-free_popup_info (GtkWidget *w, CardAndBook *card_and_book)
-{
- card_and_book_free (card_and_book);
-}
-
-#define POPUP_READONLY_MASK 0x1
static gint
table_right_click(ETableScrolled *table, gint row, gint col, GdkEvent *event, EAddressbookView *view)
{
if (E_IS_ADDRESSBOOK_TABLE_ADAPTER(view->object)) {
EAddressbookModel *model = view->model;
CardAndBook *card_and_book;
- GtkMenu *popup;
EPopupMenu menu[] = {
- E_POPUP_ITEM (N_("Save as VCard"), GTK_SIGNAL_FUNC(save_as), 0),
- E_POPUP_ITEM (N_("Forward Contact"), GTK_SIGNAL_FUNC(send_as), 0),
- E_POPUP_ITEM (N_("Send Message to Contact"), GTK_SIGNAL_FUNC(send_to), 0),
- E_POPUP_ITEM (N_("Print"), GTK_SIGNAL_FUNC(print), 0),
+ {N_("Save as VCard"), NULL, GTK_SIGNAL_FUNC(save_as), NULL, 0},
+ {N_("Forward Contact"), NULL, GTK_SIGNAL_FUNC(send_as), NULL, 0},
+ {N_("Send Message to Contact"), NULL, GTK_SIGNAL_FUNC(send_to), NULL, 0},
+ {N_("Print"), NULL, GTK_SIGNAL_FUNC(print), NULL, 0},
#if 0 /* Envelope printing is disabled for Evolution 1.0. */
- E_POPUP_ITEM (N_("Print Envelope"), GTK_SIGNAL_FUNC(print_envelope), 0),
+ {N_("Print Envelope"), NULL, GTK_SIGNAL_FUNC(print_envelope), NULL, 0},
#endif
- E_POPUP_SEPARATOR,
-
- E_POPUP_ITEM (N_("Copy to folder..."), GTK_SIGNAL_FUNC(copy_to_folder), 0),
- E_POPUP_ITEM (N_("Move to folder..."), GTK_SIGNAL_FUNC(move_to_folder), POPUP_READONLY_MASK),
- E_POPUP_SEPARATOR,
-
- E_POPUP_ITEM (N_("Cut"), GTK_SIGNAL_FUNC (cut), POPUP_READONLY_MASK),
- E_POPUP_ITEM (N_("Copy"), GTK_SIGNAL_FUNC (copy), 0),
- E_POPUP_ITEM (N_("Paste"), GTK_SIGNAL_FUNC (paste), POPUP_READONLY_MASK),
- E_POPUP_ITEM (N_("Delete"), GTK_SIGNAL_FUNC(delete), POPUP_READONLY_MASK),
- E_POPUP_TERMINATOR
+ {N_("Delete"), NULL, GTK_SIGNAL_FUNC(delete), NULL, 0},
+ {NULL, NULL, NULL, NULL, 0}
};
card_and_book = g_new(CardAndBook, 1);
@@ -1052,74 +744,13 @@ table_right_click(ETableScrolled *table, gint row, gint col, GdkEvent *event, EA
gtk_object_ref(GTK_OBJECT(card_and_book->book));
gtk_object_ref(GTK_OBJECT(card_and_book->view));
- popup = e_popup_menu_create (menu,
- e_addressbook_model_editable (model) ? 0 : POPUP_READONLY_MASK,
- 0, card_and_book);
-
- gtk_signal_connect (GTK_OBJECT (popup), "selection-done",
- GTK_SIGNAL_FUNC (free_popup_info), card_and_book);
- e_popup_menu (popup, event);
-
+ e_popup_menu_run (menu, event, 0, 0, card_and_book);
return TRUE;
} else
return FALSE;
}
static void
-new_card (GtkWidget *widget, CardAndBook *card_and_book)
-{
- e_addressbook_show_contact_editor (card_and_book->book, e_card_new(""), TRUE, TRUE);
-}
-
-static void
-new_list (GtkWidget *widget, CardAndBook *card_and_book)
-{
- e_addressbook_show_contact_list_editor (card_and_book->book, e_card_new(""), TRUE, TRUE);
-}
-
-static gint
-table_white_space_event(ETableScrolled *table, GdkEvent *event, EAddressbookView *view)
-{
- if (event->type == GDK_BUTTON_PRESS && ((GdkEventButton *)event)->button == 3 &&
- E_IS_ADDRESSBOOK_TABLE_ADAPTER(view->object)) {
- EAddressbookModel *model = view->model;
- CardAndBook *card_and_book;
- GtkMenu *popup;
-
- EPopupMenu menu[] = {
- E_POPUP_ITEM (N_("New Contact..."), GTK_SIGNAL_FUNC(new_card), POPUP_READONLY_MASK),
- E_POPUP_ITEM (N_("New Contact List..."), GTK_SIGNAL_FUNC(new_list), POPUP_READONLY_MASK),
- E_POPUP_SEPARATOR,
- E_POPUP_ITEM (N_("Paste"), GTK_SIGNAL_FUNC (paste), POPUP_READONLY_MASK),
- E_POPUP_TERMINATOR
- };
-
- card_and_book = g_new(CardAndBook, 1);
- card_and_book->card = NULL;
- card_and_book->widget = GTK_WIDGET(table);
- card_and_book->view = view;
- gtk_object_get(GTK_OBJECT(model),
- "book", &(card_and_book->book),
- NULL);
-
- gtk_object_ref(GTK_OBJECT(card_and_book->book));
- gtk_object_ref(GTK_OBJECT(card_and_book->view));
-
- popup = e_popup_menu_create (menu,
- e_addressbook_model_editable (model) ? 0 : POPUP_READONLY_MASK,
- 0, card_and_book);
-
- gtk_signal_connect (GTK_OBJECT (popup), "selection-done",
- GTK_SIGNAL_FUNC (free_popup_info), card_and_book);
- e_popup_menu (popup, event);
-
- return TRUE;
- } else {
- return FALSE;
- }
-}
-
-static void
table_selection_change(ETableScrolled *table, EAddressbookView *view)
{
command_state_change (view);
@@ -1191,18 +822,117 @@ stop_state_changed (GtkObject *object, EAddressbookView *eav)
}
static void
-command_state_change (EAddressbookView *eav)
+writable_status (GtkObject *object, gboolean writable, EAddressbookView *eav)
{
- /* Reffing during emission is unnecessary. Gtk automatically refs during an emission. */
- gtk_signal_emit (GTK_OBJECT (eav), e_addressbook_view_signals [COMMAND_STATE_CHANGE]);
+ command_state_change (eav);
}
static void
-alphabet_state_change (EAddressbookView *eav, gunichar letter)
+command_state_change (EAddressbookView *eav)
{
- gtk_signal_emit (GTK_OBJECT (eav), e_addressbook_view_signals [ALPHABET_STATE_CHANGE], letter);
+ gtk_object_ref (GTK_OBJECT (eav)); /* who knows what might happen during this emission? */
+ gtk_signal_emit (GTK_OBJECT (eav), e_addressbook_view_signals [COMMAND_STATE_CHANGE]);
+ gtk_object_unref (GTK_OBJECT (eav));
}
+#ifdef JUST_FOR_TRANSLATORS
+static char *list [] = {
+ N_("* Click here to add a contact *"),
+ N_("File As"),
+ N_("Full Name"),
+ N_("Email"),
+ N_("Primary Phone"),
+ N_("Assistant Phone"),
+ N_("Business Phone"),
+ N_("Callback Phone"),
+ N_("Company Phone"),
+ N_("Home Phone"),
+ N_("Organization"),
+ N_("Business Address"),
+ N_("Home Address"),
+ N_("Mobile Phone"),
+ N_("Car Phone"),
+ N_("Business Fax"),
+ N_("Home Fax"),
+ N_("Business Phone 2"),
+ N_("Home Phone 2"),
+ N_("ISDN"),
+ N_("Other Phone"),
+ N_("Other Fax"),
+ N_("Pager"),
+ N_("Radio"),
+ N_("Telex"),
+ N_("TTY"),
+ N_("Other Address"),
+ N_("Email 2"),
+ N_("Email 3"),
+ N_("Web Site"),
+ N_("Department"),
+ N_("Office"),
+ N_("Title"),
+ N_("Profession"),
+ N_("Manager"),
+ N_("Assistant"),
+ N_("Nickname"),
+ N_("Spouse"),
+ N_("Note"),
+ N_("Free-busy URL"),
+};
+#endif
+
+#define SPEC "<?xml version=\"1.0\"?> \
+<ETableSpecification click-to-add=\"true\" draw-grid=\"true\" _click-to-add-message=\"* Click here to add a contact *\"> \
+ <ETableColumn model_col= \"0\" _title=\"File As\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
+ <ETableColumn model_col= \"1\" _title=\"Full Name\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
+ <ETableColumn model_col= \"2\" _title=\"Email\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
+ <ETableColumn model_col= \"3\" _title=\"Primary Phone\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
+ <ETableColumn model_col= \"4\" _title=\"Assistant Phone\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
+ <ETableColumn model_col= \"5\" _title=\"Business Phone\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
+ <ETableColumn model_col= \"6\" _title=\"Callback Phone\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
+ <ETableColumn model_col= \"7\" _title=\"Company Phone\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
+ <ETableColumn model_col= \"8\" _title=\"Home Phone\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
+ <ETableColumn model_col= \"9\" _title=\"Organization\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
+ <ETableColumn model_col=\"10\" _title=\"Business Address\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
+ <ETableColumn model_col=\"11\" _title=\"Home Address\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
+ <ETableColumn model_col=\"12\" _title=\"Mobile Phone\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
+ <ETableColumn model_col=\"13\" _title=\"Car Phone\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
+ <ETableColumn model_col=\"14\" _title=\"Business Fax\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
+ <ETableColumn model_col=\"15\" _title=\"Home Fax\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
+ <ETableColumn model_col=\"16\" _title=\"Business Phone 2\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
+ <ETableColumn model_col=\"17\" _title=\"Home Phone 2\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
+ <ETableColumn model_col=\"18\" _title=\"ISDN\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
+ <ETableColumn model_col=\"19\" _title=\"Other Phone\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
+ <ETableColumn model_col=\"20\" _title=\"Other Fax\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
+ <ETableColumn model_col=\"21\" _title=\"Pager\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
+ <ETableColumn model_col=\"22\" _title=\"Radio\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
+ <ETableColumn model_col=\"23\" _title=\"Telex\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
+ <ETableColumn model_col=\"24\" _title=\"TTY\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
+ <ETableColumn model_col=\"25\" _title=\"Other Address\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
+ <ETableColumn model_col=\"26\" _title=\"Email 2\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
+ <ETableColumn model_col=\"27\" _title=\"Email 3\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
+ <ETableColumn model_col=\"28\" _title=\"Web Site\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
+ <ETableColumn model_col=\"29\" _title=\"Department\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
+ <ETableColumn model_col=\"30\" _title=\"Office\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
+ <ETableColumn model_col=\"31\" _title=\"Title\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
+ <ETableColumn model_col=\"32\" _title=\"Profession\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
+ <ETableColumn model_col=\"33\" _title=\"Manager\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
+ <ETableColumn model_col=\"34\" _title=\"Assistant\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
+ <ETableColumn model_col=\"35\" _title=\"Nickname\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
+ <ETableColumn model_col=\"36\" _title=\"Spouse\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
+ <ETableColumn model_col=\"37\" _title=\"Note\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
+ <ETableColumn model_col=\"38\" _title=\"Free-busy URL\" expansion=\"1.0\" minimum_width=\"75\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
+ <ETableState> \
+ <column source=\"0\"/> \
+ <column source=\"1\"/> \
+ <column source=\"5\"/> \
+ <column source=\"2\"/> \
+ <column source=\"3\"/> \
+ <grouping> \
+ <leaf column=\"0\" ascending=\"true\"/> \
+ </grouping> \
+ </ETableState> \
+</ETableSpecification>"
+
static void
create_table_view (EAddressbookView *view)
{
@@ -1226,8 +956,6 @@ create_table_view (EAddressbookView *view)
GTK_SIGNAL_FUNC(table_double_click), view);
gtk_signal_connect(GTK_OBJECT(e_table_scrolled_get_table(E_TABLE_SCROLLED(table))), "right_click",
GTK_SIGNAL_FUNC(table_right_click), view);
- gtk_signal_connect(GTK_OBJECT(e_table_scrolled_get_table(E_TABLE_SCROLLED(table))), "white_space_event",
- GTK_SIGNAL_FUNC(table_white_space_event), view);
gtk_signal_connect(GTK_OBJECT(e_table_scrolled_get_table(E_TABLE_SCROLLED(table))), "selection_change",
GTK_SIGNAL_FUNC(table_selection_change), view);
@@ -1352,28 +1080,70 @@ e_contact_print_button(GnomeDialog *dialog, gint button, gpointer data)
}
}
+static void
+display_view(GalViewCollection *collection,
+ GalView *view,
+ gpointer data)
+{
+ EAddressbookView *address_view = data;
+ if (GAL_IS_VIEW_ETABLE(view)) {
+ change_view_type (address_view, E_ADDRESSBOOK_VIEW_TABLE);
+ e_table_set_state_object(e_table_scrolled_get_table(E_TABLE_SCROLLED(address_view->widget)), GAL_VIEW_ETABLE(view)->state);
+ } else if (GAL_IS_VIEW_MINICARD(view)) {
+ change_view_type (address_view, E_ADDRESSBOOK_VIEW_MINICARD);
+ }
+}
+
void
e_addressbook_view_setup_menus (EAddressbookView *view,
BonoboUIComponent *uic)
{
+ GalViewFactory *factory;
+ ETableSpecification *spec;
+ char *galview;
g_return_if_fail (view != NULL);
g_return_if_fail (E_IS_ADDRESSBOOK_VIEW (view));
g_return_if_fail (uic != NULL);
g_return_if_fail (BONOBO_IS_UI_COMPONENT (uic));
+ g_return_if_fail (view->view_collection == NULL);
- init_collection ();
+ g_assert (view->view_collection == NULL);
+ g_assert (view->view_menus == NULL);
- view->uic = uic;
+ view->view_collection = gal_view_collection_new();
- setup_menus (view);
+ galview = gnome_util_prepend_user_home("/evolution/views/addressbook/");
+ gal_view_collection_set_storage_directories(view->view_collection,
+ EVOLUTION_DATADIR "/evolution/views/addressbook/",
+ galview);
+ g_free(galview);
+
+ spec = e_table_specification_new();
+ e_table_specification_load_from_string(spec, SPEC);
+
+ factory = gal_view_factory_etable_new (spec);
+ gtk_object_unref (GTK_OBJECT (spec));
+ gal_view_collection_add_factory (view->view_collection, factory);
+ gtk_object_unref (GTK_OBJECT (factory));
+
+ factory = gal_view_factory_minicard_new ();
+ gal_view_collection_add_factory (view->view_collection, factory);
+ gtk_object_unref (GTK_OBJECT (factory));
+
+ gal_view_collection_load(view->view_collection);
+
+ view->view_menus = gal_view_menus_new(view->view_collection);
+ gal_view_menus_apply(view->view_menus, uic, NULL);
+ gtk_signal_connect(GTK_OBJECT(view->view_collection), "display_view",
+ display_view, view);
}
/**
* e_addressbook_view_discard_menus:
* @view: An addressbook view.
*
- * Makes an addressbook view discard its GAL view menus and its views instance
+ * Makes an addressbook view discard its GAL view menus and its views collection
* objects. This should be called when the corresponding Bonobo component is
* deactivated.
**/
@@ -1382,21 +1152,16 @@ e_addressbook_view_discard_menus (EAddressbookView *view)
{
g_return_if_fail (view != NULL);
g_return_if_fail (E_IS_ADDRESSBOOK_VIEW (view));
- g_return_if_fail (view->view_instance);
-
- if (view->view_menus) {
- gal_view_menus_unmerge (view->view_menus, NULL);
+ g_return_if_fail (view->view_collection);
- gtk_object_unref (GTK_OBJECT (view->view_menus));
- view->view_menus = NULL;
- }
+ g_assert (view->view_collection != NULL);
+ g_assert (view->view_menus != NULL);
- if (view->view_instance) {
- gtk_object_unref (GTK_OBJECT (view->view_instance));
- view->view_instance = NULL;
- }
+ gtk_object_unref (GTK_OBJECT (view->view_collection));
+ view->view_collection = NULL;
- view->uic = NULL;
+ gtk_object_unref (GTK_OBJECT (view->view_menus));
+ view->view_menus = NULL;
}
static ESelectionModel*
@@ -1624,96 +1389,13 @@ get_selected_cards (EAddressbookView *view)
return list;
}
-#if 0
-void
-e_addressbook_view_save_state (EAddressbookView *view, const char *filename)
-{
- xmlDoc *doc;
- xmlNode *node;
-
- doc = xmlNewDoc ("1.0");
- node = xmlNewDocNode (doc, NULL, "addressbook-view", NULL);
- xmlDocSetRootElement (doc, node);
-
- switch (view->view_type) {
- case E_ADDRESSBOOK_VIEW_MINICARD: {
- int column_width;
- e_xml_set_string_prop_by_name (node, "style", "minicard");
- gtk_object_get (GTK_OBJECT (view->object),
- "column_width", &column_width,
- NULL);
- e_xml_set_integer_prop_by_name (node, "column-width", column_width);
- break;
- }
- case E_ADDRESSBOOK_VIEW_TABLE: {
- ETableState *state;
- state = e_table_get_state_object (E_TABLE (view->widget));
-
- e_xml_set_string_prop_by_name (node, "style", "table");
- e_table_state_save_to_node (state, node);
- gtk_object_unref (GTK_OBJECT (state));
- break;
- }
- default:
- xmlFreeDoc(doc);
- return;
- }
- xmlSaveFile (filename, doc);
- xmlFreeDoc(doc);
-}
-
-void
-e_addressbook_view_load_state (EAddressbookView *view, const char *filename)
-{
- xmlDoc *doc;
-
- doc = xmlParseFile (filename);
- if (doc) {
- xmlNode *node;
- char *type;
-
- node = xmlDocGetRootElement (doc);
- type = e_xml_get_string_prop_by_name (node, "style");
-
- if (!strcmp (type, "minicard")) {
- int column_width;
-
- change_view_type (view, E_ADDRESSBOOK_VIEW_MINICARD);
-
- column_width = e_xml_get_integer_prop_by_name (node, "column-width");
- gtk_object_set (GTK_OBJECT (view->object),
- "column_width", column_width,
- NULL);
- } else if (!strcmp (type, "table")) {
- ETableState *state;
-
- change_view_type (view, E_ADDRESSBOOK_VIEW_TABLE);
-
- state = e_table_state_new();
- e_table_state_load_from_node (state, node->xmlChildrenNode);
- e_table_set_state_object (E_TABLE (view->widget), state);
- gtk_object_unref (GTK_OBJECT (state));
- }
- xmlFreeDoc(doc);
- }
-}
-#endif
-
void
e_addressbook_view_save_as (EAddressbookView *view)
{
GList *list = get_selected_cards (view);
if (list)
e_contact_list_save_as (_("Save as VCard"), list);
- e_free_object_list(list);
-}
-
-void
-e_addressbook_view_view (EAddressbookView *view)
-{
- GList *list = get_selected_cards (view);
- e_addressbook_show_multiple_cards (view->book, list, view->editable);
- e_free_object_list(list);
+ g_list_free (list);
}
void
@@ -1722,7 +1404,7 @@ e_addressbook_view_send (EAddressbookView *view)
GList *list = get_selected_cards (view);
if (list)
e_card_list_send (list, E_CARD_DISPOSITION_AS_ATTACHMENT);
- e_free_object_list(list);
+ g_list_free (list);
}
void
@@ -1731,7 +1413,7 @@ e_addressbook_view_send_to (EAddressbookView *view)
GList *list = get_selected_cards (view);
if (list)
e_card_list_send (list, E_CARD_DISPOSITION_AS_TO);
- e_free_object_list(list);
+ g_list_free (list);
}
void
@@ -1782,35 +1464,6 @@ e_addressbook_view_stop(EAddressbookView *view)
e_addressbook_model_stop (view->model);
}
-static void
-view_transfer_cards (EAddressbookView *view, gboolean delete_from_source)
-{
- EBook *book;
- GList *cards;
- GtkWindow *parent_window;
-
- gtk_object_get(GTK_OBJECT(view->model),
- "book", &book,
- NULL);
- cards = get_selected_cards (view);
- parent_window = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (view)));
-
- e_addressbook_transfer_cards (book, cards, delete_from_source, parent_window);
-}
-
-void
-e_addressbook_view_copy_to_folder (EAddressbookView *view)
-{
- view_transfer_cards (view, FALSE);
-}
-
-void
-e_addressbook_view_move_to_folder (EAddressbookView *view)
-{
- view_transfer_cards (view, TRUE);
-}
-
-
static gboolean
e_addressbook_view_selection_nonempty (EAddressbookView *view)
{
@@ -1841,12 +1494,6 @@ e_addressbook_view_can_save_as (EAddressbookView *view)
return view ? e_addressbook_view_selection_nonempty (view) : FALSE;
}
-gboolean
-e_addressbook_view_can_view (EAddressbookView *view)
-{
- return view ? e_addressbook_view_selection_nonempty (view) : FALSE;
-}
-
gboolean
e_addressbook_view_can_send (EAddressbookView *view)
{
@@ -1895,14 +1542,3 @@ e_addressbook_view_can_stop (EAddressbookView *view)
return view ? e_addressbook_model_can_stop (view->model) : FALSE;
}
-gboolean
-e_addressbook_view_can_copy_to_folder (EAddressbookView *view)
-{
- return view ? e_addressbook_view_selection_nonempty (view) : FALSE;
-}
-
-gboolean
-e_addressbook_view_can_move_to_folder (EAddressbookView *view)
-{
- return view ? e_addressbook_view_selection_nonempty (view) && e_addressbook_model_editable (view->model) : FALSE;
-}
diff --git a/addressbook/gui/widgets/e-minicard-view-widget.c b/addressbook/gui/widgets/e-minicard-view-widget.c
index 2f58db4882..145c5cecce 100644
--- a/addressbook/gui/widgets/e-minicard-view-widget.c
+++ b/addressbook/gui/widgets/e-minicard-view-widget.c
@@ -37,7 +37,6 @@ static void e_minicard_view_widget_size_allocate (GtkWidget *widget, GtkAllocati
static void e_minicard_view_widget_realize (GtkWidget *widget);
static void selection_change (ESelectionModel *esm, EMinicardViewWidget *widget);
-static void column_width_changed (ESelectionModel *esm, double width, EMinicardViewWidget *widget);
static ECanvasClass *parent_class = NULL;
@@ -46,13 +45,11 @@ enum {
ARG_0,
ARG_BOOK,
ARG_QUERY,
- ARG_EDITABLE,
- ARG_COLUMN_WIDTH
+ ARG_EDITABLE
};
enum {
SELECTION_CHANGE,
- COLUMN_WIDTH_CHANGED,
LAST_SIGNAL
};
@@ -102,8 +99,6 @@ e_minicard_view_widget_class_init (EMinicardViewWidgetClass *klass)
GTK_ARG_READWRITE, ARG_QUERY);
gtk_object_add_arg_type ("EMinicardViewWidget::editable", GTK_TYPE_BOOL,
GTK_ARG_READWRITE, ARG_EDITABLE);
- gtk_object_add_arg_type ("EMinicardViewWidget::column_width", GTK_TYPE_INT,
- GTK_ARG_READWRITE, ARG_COLUMN_WIDTH);
e_minicard_view_widget_signals [SELECTION_CHANGE] =
gtk_signal_new ("selection_change",
@@ -113,14 +108,6 @@ e_minicard_view_widget_class_init (EMinicardViewWidgetClass *klass)
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
- e_minicard_view_widget_signals [COLUMN_WIDTH_CHANGED] =
- gtk_signal_new ("column_width_changed",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EMinicardViewWidgetClass, column_width_changed),
- e_marshal_NONE__DOUBLE,
- GTK_TYPE_NONE, 1, GTK_TYPE_DOUBLE);
-
gtk_object_class_add_signals (object_class, e_minicard_view_widget_signals, LAST_SIGNAL);
object_class->set_arg = e_minicard_view_widget_set_arg;
@@ -131,9 +118,6 @@ e_minicard_view_widget_class_init (EMinicardViewWidgetClass *klass)
widget_class->size_allocate = e_minicard_view_widget_size_allocate;
canvas_class->reflow = e_minicard_view_widget_reflow;
-
- klass->selection_change = NULL;
- klass->column_width_changed = NULL;
}
static void
@@ -144,7 +128,6 @@ e_minicard_view_widget_init (EMinicardViewWidget *view)
view->book = NULL;
view->query = NULL;
view->editable = FALSE;
- view->column_width = 150;
}
GtkWidget *
@@ -190,17 +173,9 @@ e_minicard_view_widget_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
case ARG_EDITABLE:
emvw->editable = GTK_VALUE_BOOL(*arg);
if (emvw->emv)
- gtk_object_set (GTK_OBJECT(emvw->emv),
- "editable", emvw->editable,
- NULL);
- break;
- case ARG_COLUMN_WIDTH:
- emvw->column_width = GTK_VALUE_INT (*arg);
- if (emvw->emv) {
- gtk_object_set (GTK_OBJECT(emvw->emv),
- "column_width", (int) emvw->column_width,
- NULL);
- }
+ gtk_object_set (GTK_OBJECT(emvw->emv),
+ "editable", emvw->editable,
+ NULL);
break;
}
}
@@ -222,9 +197,6 @@ e_minicard_view_widget_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
case ARG_EDITABLE:
GTK_VALUE_BOOL (*arg) = emvw->editable;
break;
- case ARG_COLUMN_WIDTH:
- GTK_VALUE_INT (*arg) = emvw->column_width;
- break;
default:
arg->type = GTK_TYPE_INVALID;
break;
@@ -260,16 +232,15 @@ e_minicard_view_widget_realize (GtkWidget *widget)
e_minicard_view_get_type(),
"height", (double) 100,
"minimum_width", (double) 100,
- "adapter", view->adapter,
- "column_width", (int) view->column_width,
NULL );
+ gtk_object_set(GTK_OBJECT(view->emv),
+ "adapter", view->adapter,
+ NULL);
+
gtk_signal_connect (GTK_OBJECT (E_REFLOW(view->emv)->selection),
"selection_changed",
selection_change, view);
- gtk_signal_connect (GTK_OBJECT (view->emv),
- "column_width_changed",
- column_width_changed, view);
if (GTK_WIDGET_CLASS(parent_class)->realize)
GTK_WIDGET_CLASS(parent_class)->realize (widget);
@@ -319,14 +290,7 @@ static void
selection_change (ESelectionModel *esm, EMinicardViewWidget *widget)
{
gtk_signal_emit (GTK_OBJECT(widget),
- e_minicard_view_widget_signals [SELECTION_CHANGE]);
-}
-
-static void
-column_width_changed (ESelectionModel *esm, double width, EMinicardViewWidget *widget)
-{
- gtk_signal_emit (GTK_OBJECT(widget),
- e_minicard_view_widget_signals [COLUMN_WIDTH_CHANGED], width);
+ e_minicard_view_widget_signals [SELECTION_CHANGE], widget);
}
gint
diff --git a/art/ChangeLog b/art/ChangeLog
index ef4280f5c8..a3578da576 100644
--- a/art/ChangeLog
+++ b/art/ChangeLog
@@ -1,78 +1,22 @@
-2002-04-17 Dan Winship <danw@ximian.com>
+2002-04-18 Ettore Perazzoli <ettore@ximian.com>
- * monkey-16.png: Replace with an antialiased version
+ * about-box, splash.png: New artwork for 1.0.4.
-2002-04-10 Dan Winship <danw@ximian.com>
+2002-02-27 Ettore Perazzoli <ettore@ximian.com>
- * Makefile.am (images_DATA), folder-settings.png: Add. (Copied
- from Unscalable Gorilla because it was handy. Will probably get
- changed to something else...)
+ * about-box, splash.png: New artwork for 1.0.3.
-2002-03-28 Ettore Perazzoli <ettore@ximian.com>
+2002-01-24 Ettore Perazzoli <ettore@ximian.com>
- * calendar-and-tasks-settings.png: New.
- * composer-settings.png: New.
- * ldap-settings.png: New.
- * mail-accounts-settings.png: New.
- * summary-settings.png: New.
+ * about-box, splash.png: New artwork for 1.0.2.
-2002-03-25 Dan Winship <danw@ximian.com>
+2001-12-18 Ettore Perazzoli <ettore@ximian.com>
- * Makefile.am (images_DATA): Add working-16.png (the GNOME2 stock
- "wait" icon, from Jakub)
+ * about-box.png, splash.png: New artwork for 1.0.1.
-2002-03-04 Jeffrey Stedfast <fejj@ximian.com>
+2001-11-21 Ettore Perazzoli <ettore@ximian.com>
- * forward.xpm, reply.xpm, reply_to_all.xpm: Rename the internal
- structure to coincide with the filenames.
-
-2002-02-29 Ettore Perazzoli <ettore@ximian.com>
-
- * about-box.png, splash.png: New cool artwork from Jakub.
-
-2002-02-22 Jeffrey Stedfast <fejj@ximian.com>
-
- * Makefile.am: Remove meeting_widget.png from the build since it
- doesn't seem to be in cvs?
-
-2002-02-20 Jakub Steiner <jimmac@ximian.com>
-
- * summary_preferences-16.png: menu icon for summary preferences
- * Makefile.am: added the icon
-
-2002-02-13 Jeffrey Stedfast <fejj@ximian.com>
-
- * flag-for-followup.xpm:
- * flag-for-followup-16.png:
- * flag-for-followup-48.png: New icons.
-
- * Makefile.am: Added the new icons...
-
-2002-02-12 Jeffrey Stedfast <fejj@ximian.com>
-
- * Makefile.am: Install mail-new.xpm, mail-read.xpm and
- priority-high.xpm in the same place as other bonobo-ui menu
- pixmaps so we can use these in menus too.
-
-2002-02-08 JP Rosevear <jpr@ximian.com>
-
- * connect_to_url-16.xpm: new icon
-
- * new_all_day_event.png: ditto
-
- * Makefile.am: install and dist new images
-
-2001-12-11 Jon Trowbridge <trow@ximian.com>
-
- * mail-need-reply.xpm: A new icon that sucks less. We still need
- some Tuomas-love.
-
-2001-12-09 Jon Trowbridge <trow@ximian.com>
-
- * mail-need-reply.xpm: Added a really, really ugly and
- awful icon to symbolize "message needs a reply".
-
- * Makefile.am (EXTRA_DIST): Added mail-need-reply.xpm.
+ * about-box.png, splash.png: New artwork for 1.0.
2001-11-06 Ettore Perazzoli <ettore@ximian.com>
diff --git a/art/about-box.png b/art/about-box.png
index 721cdb8a51..3313164c1d 100644
--- a/art/about-box.png
+++ b/art/about-box.png
Binary files differ
diff --git a/art/splash.png b/art/splash.png
index 530e0f743c..1bdf50adb3 100644
--- a/art/splash.png
+++ b/art/splash.png
Binary files differ
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index e4e6e8c6c8..7d684ea617 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,39 +1,10 @@
-2002-04-18 JP Rosevear <jpr@ximian.com>
-
- * gui/dialogs/recurrence-page.c (simple_recur_to_comp): properly
- handle -ve recurrence values
- (month_num_submenu_selection_done_cb): track the current date in
- use
- (make_recur_month_num_submenu): make a submenu of dates
- (make_recur_month_num_menu): make the date/relation option menu
- (month_num_menu_selection_done_cb): update the date properly and
- keep both option menus consistent
- (month_day_menu_selection_done_cb): keep both option menus
- consistent
- (make_monthly_special): listen for selection done signal
- (make_recurrence_special): destroy old month_num_menu
- (recurrence_page_fill_widgets): properly handle -ve recurrence
- values
-
-2002-04-18 JP Rosevear <jpr@ximian.com>
-
- * gui/e-day-view.c (e_day_view_on_settings): show the settings
-
- * gui/e-week-view.c (e_week_view_on_settings): ditto
-
- * gui/calendar-commands.c (control_util_show_settings): show the
- settings dialog
-
- * gui/calendar-commands.h: new proto
-
- * gui/control-factory.c (control_factory_new_control): set the
- control as object data on the calendar
-
-2002-04-17 Christopher James Lahey <clahey@ximian.com>
+2002-04-17 Rodrigo Moya <rodrigo@ximian.com>
- * gui/e-calendar-table.c, gui/e-day-view.c, gui/e-week-view.c,
- gui/dialogs/meeting-page.c: Updated these to match the new
- EPopupMenu.
+ * pcs/cal-backend.[ch]:
+ * pcs/cal-backend-file.c:
+ * pcs/cal.c: reverted my getQuery change, since it will break
+ compatibility with evolution 1.0.3, and, for the time being, we
+ only want this on HEAD.
2002-04-05 Rodrigo Moya <rodrigo@ximian.com>
@@ -46,64 +17,13 @@
* pcs/query.[ch]: fixed headers.
-2002-04-10 Dan Winship <danw@ximian.com>
-
- * gui/gnome-cal.c (gnome_calendar_open): Fix this: Rodrigo's patch
- used one of the functions I just removed. :)
-
-2002-04-10 Rodrigo Moya <rodrigo@ximian.com>
+2002-04-01 Rodrigo Moya <rodrigo@ximian.com>
* gui/gnome-cal.c (gnome_calendar_open): use the default uri for
tasks (as stored in the configuration) when the calendar URI is not
a local one (connector, etc).
-2002-04-10 Dan Winship <danw@ximian.com>
-
- * cal-client/cal-client.c (get_default_uri): Use new-and-improved
- default folder URI config paths.
-
- * gui/calendar-config.c (calendar_config_{get,set}_default_uri,
- calendar_config_{get,set}_default_tasks_uri): Remove these. The
- shell owns this information now. (Weren't being used anyway.)
-
- * gui/component-factory.c (get_data_uri): Fix another place that
- hardcoded tacking foo.ics on to the end of URLs.
-
-2002-04-08 Dan Winship <danw@ximian.com>
-
- * gui/component-factory.c (create_view): Add view_info arg. If the
- view_info is non-empty and this is a calendar folder, set the
- "view" property on the control's propertybag.
-
- * gui/control-factory.c (calendar_properties_init): Set up the
- "view" property.
- (get_prop, set_prop): handle the "view" property by
- getting/setting the GnomeCalendar's view. Unfortunately, this
- doesn't actually work. See #23208.
-
- * gui/calendar-commands.c (calendar_control_activate): Set the UI
- component's container before calling
- gnome_calendar_set_ui_component so that the search bar
- initialization will work.
-
-2002-04-06 JP Rosevear <jpr@ximian.com>
-
- * pcs/cal-backend-db.[hc]: Remove dead files.
-
-2002-04-06 JP Rosevear <jpr@ximian.com>
-
- * gui/GNOME_Evolution_Calendar.oaf.in: add config_item:type
-
-2002-04-01 Kjartan Maraas <kmaraas@gnome.org>
-
- * gui/e-itip-control.c: Fix a string.
-
-2002-04-01 Rodrigo Moya <rodrigo@ximian.com>
-
- * pcs/cal-backend-db.c: simple fix for DB3 header inclusion in
- Mac OS X, by Max Horn <max@quendi.de>
-
-2002-03-31 JP Rosevear <jpr@ximian.com>
+2002-03-28 JP Rosevear <jpr@ximian.com>
* gui/e-itip-control.c (clean_up): free the my_address member
(find_my_address): fall back on a CN match if possible
@@ -114,166 +34,6 @@
the attendee any how (as an optional participant)
(ok_clicked_cb): if we are suppose to rsvp and the status was ok,
but the attendee address is not known, find it
-
-2002-03-29 Ettore Perazzoli <ettore@ximian.com>
-
- * gui/GNOME_Evolution_Calendar.oaf.in: Set a priority for the
- config item. Rename to "Calendar and Tasks".
-
-2002-03-29 JP Rosevear <jpr@ximian.com>
-
- * conduits/calendar/Makefile.am: s/libversit.la/libversit.a/
-
- * conduits/todo/Makefile.am: ditto
-
-2002-03-29 JP Rosevear <jpr@ximian.com>
-
- * gui/e-calendar-table.c: implement new pop up menu items for
- "Save as", "Print", "Assign Task", "Forward as iCalendar"
-
- * gui/e-day-view.c: similarly, also "Publish Free/Busy
- Information" and "New Meeting" and "New Task"
-
- * gui/e-week-view.c: ditto
-
- * gui/dialogs/task-editor.c (show_assignment): move the assignment
- page stuff here
- (task_editor_show_assignment): use it
- (assign_task_cmd): ditto
-
- * gui/dialogs/task-editor.h: new proto
-
- * gui/dialogs/comp-editor.c (save_as_cmd): use new e-util file
- selector function
-
- * meeting-mockup.glade: Remove old file
-
- * topic.dat
-
-2002-03-19 Dan Winship <danw@ximian.com>
-
- * cal-util/Makefile.am: s/libversit.la/libversit.a/
-
- * cal-client/Makefile.am: Likewise
-
- * gui/Makefile.am: Likewise
-
-2002-03-18 Ettore Perazzoli <ettore@ximian.com>
-
- * gui/cal-search-bar.c: Removed `search_menu_items'.
- (cal_search_bar_menu_activated): Removed.
- (cal_search_bar_class_init): Don't install.
- (cal_search_bar_construct): No menu items here.
-
-2002-03-15 Jeffrey Stedfast <fejj@ximian.com>
-
- * gui/e-day-view.c: Updated to use new EPopupMenu API.
-
- * gui/e-week-view.c: Updated to use new EPopupMenu API.
-
- * gui/e-calendar-table.c: Updated to use new EPopupMenu API.
-
-2002-03-15 Ettore Perazzoli <ettore@ximian.com>
-
- * gui/tasks-control.c (tasks_control_activate): Call
- `e_tasks_set_ui_component()' here to give it the
- BonoboUIComponent.
- (tasks_control_deactivate): Likewise, call it here to unset the
- BonoboUIComponent.
-
- * gui/e-tasks.c (e_tasks_set_ui_component): New.
-
- * gui/calendar-commands.c (calendar_control_activate): Call
- gnome_calendar_set_ui_component() here.
- (calendar_control_deactivate): ...And here, with a NULL
- BonoboUIComponent.
-
- * gui/gnome-cal.c (gnome_calendar_set_ui_component): New.
-
-2002-03-15 JP Rosevear <jpr@ximian.com>
-
- * gui/main.c: use bonobo exception macros to tidy
-
- * gui/itip-control-factory.c: ditto
-
- * gui/gnome-cal.c: ditto
-
- * gui/comp-editor-factory.c: ditto
-
- * gui/calendar-commands.c: ditto
-
-2002-03-14 JP Rosevear <jpr@ximian.com>
-
- * idl/evolution-calendar.idl: add all day event editor mode
-
- * gui/component-factory.c: clean up exception handling
- (sc_user_create_new_item_cb): support the all day event id
- (create_object): add a user creatable all day appointment item
-
- * gui/comp-editor-factory.c (get_default_event): get a default
- event either all day or starting at the top of the hour
- (get_default_task): get a default task
- (edit_new): support the all day event mode
-
- * gui/calendar-commands.c: remove unused functions/verbs
-
-2002-03-13 Ettore Perazzoli <ettore@ximian.com>
-
- * gui/GNOME_Evolution_Calendar.oaf.in: Add an
- "evolution:config_item:icon_path" attribute so we get an icon for
- the calendar preferences.
-
-2002-03-12 Ettore Perazzoli <ettore@ximian.com>
-
- * gui/dialogs/cal-prefs-dialog.glade: Add <visible>False</visible>
- to cal-prefs-dialog so it doesn't get shown when we load the Glade
- file with libglade.
-
- * gui/component-factory.c (owner_set_cb): Register the
- ConfigControl factory.
-
- * gui/tasks-control.c: Removed verb "TaskSettings".
- (tasks_control_settings_cmd): Removed.
-
- * gui/calendar-commands.c: Removed verb "CalendarSettings".
- (settings_cmd): Removed.
-
- * gui/dialogs/cal-prefs-dialog.c: Renamed `CalPrefsDialogPrivate'
- to `DialogData'. Replace `dialog' member with a `page' member.
- Remove `toplevel_notebook' member.
- (init_widgets): Renamed from `cal_prefs_dialog_init_widgets'.
- Just get a DialogData.
- (get_widgets): Get a DialogData pointer.
- (cal_prefs_dialog_destroy): Removed.
- (config_control_destroy_callback): New, signal handler for
- ::destroy for ConfigControl.
- (cal_prefs_dialog_new): Create a new DialogData, connect all the
- signal handlers.
- (create_time_edit): Renamed from
- `cal_prefs_dialog_create_time_edit'.
- (cal_prefs_dialog_show): Removed.
- (cal_prefs_dialog_button_clicked): Removed.
- (show_task_list_config): Get a DialogData.
- (show_config): Renamed from `cal_prefs_dialog_show_config'.
- Likewise.
- (update_task_list_config): Likewise.
- (update_config): Renamed from
- `cal_prefs_dialog_update_config'. Likewise.
- (color_set_callback): New callback, makes the dialog report
- changes when the setting in any of the color widgets is changed.
- (widget_changed_callback): New callback, makes the dialog report
- changes when any of the widgets changes status.
- (connect_changed): New utility function to connect this callback
- to all the widgets.
- (setup_widgets): Connect all the widgets.
- (cal_prefs_dialog_new): Call `setup_widgets'.
-
- * gui/config-control-factory.c: New.
- * gui/config-control-factory.h: New.
-
- * gui/GNOME_Evolution_Calendar.oaf.in: Add
- OAFIID:GNOME_Evolution_Calendar_ConfigControl and
- OAFIID:GNOME_Evolution_Calendar_ConfigControlFactory.
2002-03-06 Rodrigo Moya <rodrigo@ximian.com>
@@ -298,7 +58,7 @@
particular iCalendar representation of the object was created.)
Fixes #21198.
-2002-03-05 JP Rosevear <jpr@ximian.com>
+2002-03-04 JP Rosevear <jpr@ximian.com>
* gui/print.c: remove unneeded parameter from print_text_size
everywhere
@@ -308,29 +68,6 @@
(print_text_size): use get_font_for_size
(print_day_background): use get_font_for_size
-2002-03-05 JP Rosevear <jpr@ximian.com>
-
- * gui/e-meeting-time-sel-item.c
- (e_meeting_time_selector_item_draw): pass the real table
- to e_meeting_model_etable_view_to_model_row
- (e_meeting_time_selector_item_paint_busy_periods): ditto
-
- * gui/dialogs/meeting-page.c (right_click_cb): ditto
-
- * gui/e-meeting-model.h: update protos
-
- * gui/e-meeting-model.c
- (e_meeting_model_etable_model_to_view_row): take in to account the
- fact the table used the without model
- (e_meeting_model_etable_view_to_model_row): ditto
-
-2002-03-04 Damon Chaplin <damon@ximian.com>
-
- * gui/tasks-control.c: added support for printing the Tasks table.
- I hacked it a bit so the user could choose portrait or landscape mode.
- This is bug #9677. ETable printing has a few issues, though, and it
- isn't very pretty.
-
2002-03-04 Dan Winship <danw@ximian.com>
* gui/itip-utils.c (comp_subject): Prefix the subject with an
@@ -338,6 +75,11 @@
action is, since Outlook doesn't display any of that information
inline like we do. (20780)
+2002-03-01 JP Rosevear <jpr@ximian.com>
+
+ * gui/e-itip-control.c (write_html): if this is a reply, print the
+ attendee status
+
2002-02-28 Rodrigo Moya <rodrigo@ximian.com>
* calendar/gui/e-itip-control.c (e_itip_control_set_data): added the
@@ -359,6 +101,22 @@
(comp_content_type): Include the filename here since we can't add
a Content-Disposition now.
+2002-02-24 JP Rosevear <jpr@ximian.com>
+
+ * gui/e-meeting-time-sel-item.c
+ (e_meeting_time_selector_item_draw): pass the real table
+ to e_meeting_model_etable_view_to_model_row
+ (e_meeting_time_selector_item_paint_busy_periods): ditto
+
+ * gui/dialogs/meeting-page.c (right_click_cb): ditto
+
+ * gui/e-meeting-model.h: update protos
+
+ * gui/e-meeting-model.c
+ (e_meeting_model_etable_model_to_view_row): take in to account the
+ fact the table used the without model
+ (e_meeting_model_etable_view_to_model_row): ditto
+
2002-02-24 Chris Toshok <toshok@ximian.com>
* gui/cal-search-bar.c (cal_search_bar_class_init): change
@@ -366,19 +124,13 @@
(cal_search_bar_search_activated): rename
cal_search_bar_query_changed to this.
-2002-02-21 Ettore Perazzoli <ettore@ximian.com>
-
- * gui/component-factory.c (add_creatable_item): New helper
- function.
- (create_object): Add icons for the various user creatable items.
-
2002-02-19 JP Rosevear <jpr@ximian.com>
* gui/e-itip-control.c (send_item): pass extra itip_send_comp
- params
+ params
(send_freebusy): ditto
(ok_clicked_cb): ditto, including the timezones culled from the
- component
+ component
* gui/e-week-view.c: pass extra itip_send_comp params
@@ -450,10 +202,10 @@
comparison function
* gui/Makefile.am: compile new files
-
+
2002-02-13 Rodrigo Moya <rodrigo@ximian.com>
- * gui/control-factory.c (set_prop): don't append 'calendar.ics'
+ * gui/control-factory.c (set_prop): don't append 'calendar.ics'
to the URI.
(get_prop): finished.
@@ -465,173 +217,18 @@
* gui/e-tasks.c (e_tasks_open): append $filename.ics to the uri to be
opened if the uri is local. Leave intact in other cases.
-2002-02-08 Damon Chaplin <damon@ximian.com>
-
- * gui/comp-util.c (cal_comp_util_compare_event_timezones): check if
- the CalComponentDateTime values are set before trying to use them.
- Possibly fixes bug #18529.
-
- * importers/icalendar-importer.c: added vCalendar importer and
- intelligent GnomeCalendar importer code here, as it shares a lot of
- code with the iCalendar importer.
-
- NOTE: check_folder_type() needs to be finished at some point.
- It needs a new shell Corba call so it can decide whether to import
- events or tasks into the folder. Currently it just imports both.
-
- * importers/main.c (importer_factory_fn): create vCalendar importer
- or GnomeCalendar importer if required.
-
- * importers/evolution-calendar-importer.h: added declarations for
- creating a vCalendar importer and intelligent Gnome Calendar importer.
-
- * importers/Makefile.am: added -DEVOLUTION_SOUNDDIR so the importer
- knows what filename to use for audio alarms in vCalendar files.
- Added libicalvcal-evolution to LDADD.
-
- * importers/GNOME_Evolution_Calendar_Importer.oaf.in: added vCalendar
- importer and intelligent Gnome Calendar importer.
-
- * gui/comp-util.c (cal_comp_util_compare_event_timezones): return TRUE
- if the event uses UTC. We don't want to flag all events from Outlook,
- which use UTC.
-
-2002-02-08 JP Rosevear <jpr@ximian.com>
-
- * gui/dialogs/task-details-page.glade: change custom widget
- creator to e_url_entry_new
-
- * gui/dialogs/task-details-page.c (get_widgets): get the url entry
- and its entry
-
-2002-02-08 JP Rosevear <jpr@ximian.com>
-
- * gui/dialogs/task-details-page.glade: add a custom widget created
- with e_url_button_new
-
- * gui/dialogs/task-details-page.c (task_details_page_init): init
- url_button member to NULL
- (init_widgets): set the url button entry
- (get_widgets): get the url button
-
- * gui/calendar-commands.c (pixmaps): use new all day event icon
-
-2002-02-07 JP Rosevear <jpr@ximian.com>
-
- * gui/e-day-view.c: pass meeting boolean for
- gnome_calendar_edit_object and gnome_calendar_new_appointment_for
-
- * gui/e-week-view-event-item.c: ditto
-
- * gui/e-week-view.c: ditto
-
- * gui/tasks-control.c (confirm_expunge): kill warning
-
- * gui/calendar-commands.c (new_meeting_cb): show a new meeting
- dialog
- (new_event_cb): pass new param
-
- * gui/gnome-cal.c (gnome_calendar_edit_object): take meeting
- boolean and show meeting page if true
- (gnome_calendar_new_appointment_for): takeing meeting param and
- pass to above
- (gnome_calendar_new_appointment): add new param
-
- * gui/gnome-cal.h: update proto
-
- * gui/component-factory.c (create_component): take a comp editor
- mode, determine vtype
- (sc_user_create_new_item_cb): check for meeting user creatable
- item
- (create_object): add meeting as user creatable item
-
- * gui/comp-editor-factory.c (edit_new): get a comp editor mode
- now, determine vtype and show meeting page if required
- (queue_edit_new): get comp editor mode
- (impl_editNew): ditto, plus queue the mode directly instead of
- determining the vtype
-
- * gui/dialogs/event-editor.c (show_meeting): new internal util
- function to show meeting page
- (event_editor_show_meeting): show the meeting
- (schedule_meeting_cmd): use show_meeting
-
- * gui/dialogs/event-editor.h: new proto
-
- * idl/evolution-calendar.idl: editNew takes a mode rather than a
- type now
-
- * cal-util/Makefile.am: fix includes
-
-2002-02-07 Christopher James Lahey <clahey@ximian.com>
-
- * gui/e-tasks.c (e_tasks_setup_view_menus), gui/gnome-cal.c
- (gnome_calendar_setup_view_menus): Made these use the new
- GalViewMenus stuff.
-
2002-02-06 Damon Chaplin <damon@ximian.com>
* cal-util/cal-recur.c (cal_recur_from_icalproperty): convert months
from 1-12 to 0-11. Fixes bug #19235.
-2002-02-04 JP Rosevear <jpr@ximian.com>
-
- * conduits/todo/todo-conduit.c (e_todo_gui_new): new gui routines
- for conduit settings
- (e_todo_gui_fill_config): ditto
- (e_todo_gui_fill_widgets): ditto
- (e_todo_gui_destroy): ditto
- (e_todo_context_destroy): destroy new_cfg and gui properly
- (local_record_from_comp): set the priority to the default setting
- if none is set on the icalendar object
- (fill_widgets): fill gui widgets
- (create_settings_window): create gui
-
-2002-01-30 JP Rosevear <jpr@ximian.com>
-
- * gui/e-itip-control.c (write_html): if this is a reply, print the
- attendee status
-
-2002-01-25 Federico Mena Quintero <federico@ximian.com>
+2002-01-22 Federico Mena Quintero <federico@ximian.com>
* gui/dialogs/alarm-options.glade: Use 1 instead of zero as the
minimum value for the repetitions spin button as we use a check
box to specify whether the alarm has repetitions or not. Fixes
bug #19054.
-2002-01-24 Ettore Perazzoli <ettore@ximian.com>
-
- * importers/Makefile.am (evolution_calendar_importer_LDADD):
- Ooops. Forgot to use EVOLUTION_CALENDAR_LIBS here.
-
-2002-01-24 Ettore Perazzoli <ettore@ximian.com>
-
- * conduits/calendar/Makefile.am: Use
- EVOLUTION_CALENDAR_CONDUIT_LIBS and
- EVOLUTION_CALENDAR_CONDUIT_CFLAGS.
- * conduits/todo/Makefile.am: Likewise.
-
- * cal-client/Makefile.am: Use EVOLUTION_CALENDAR_LIBS and
- EVOLUTION_CALENDAR_CFLAGS.
- * cal-util/Makefile.am: Likewise.
- * gui/alarm-notify/Makefile.am: Likewise.
- * gui/Makefile.am: Likewise.
-
-2002-01-23 Ettore Perazzoli <ettore@ximian.com>
-
- * gui/component-factory.c (create_object): Pass a NULL @icon to
- `evolution_shell_component_add_user_creatable_item()'.
-
-2002-01-21 JP Rosevear <jpr@ximian.com>
-
- * conduits/todo/todo-conduit.c (todoconduit_load_configuration):
- return a new configuration struct, load default priority setting
- (todoconduit_save_configuration): save default priority setting
- (e_todo_context_new): dupe configuration
-
- * conduits/calendar/calendar-conduit.c (e_calendar_context_new):
- set ps to NULL
-
2002-01-17 Damon Chaplin <damon@ximian.com>
* gui/dialogs/alarm-page.c (get_alarm_string): save the alarm string
@@ -643,39 +240,6 @@
* gui/dialogs/task-page.c (task_page_fill_widgets): default component
classification to PUBLIC. Fixes internal bug #1066
-2002-01-14 JP Rosevear <jpr@ximian.com>
-
- * conduits/calendar/calendar-conduit.c: move all functions here,
- get rid of header files, use e-pilot-settings to display gui
-
- * conduits/todo/todo-conduit.c: as above
-
-2002-01-14 JP Rosevear <jpr@ximian.com>
-
- * gui/gnome-cal.c (get_current_time): use icaltimetype_to_tm
-
-2002-01-14 JP Rosevear <jpr@ximian.com>
-
- * gui/e-week-view-main-item.c (e_week_view_main_item_draw_day):
- figure out when today is and highlight if it is not selected
-
- * gui/e-week-view.h: enum the "today" color
-
- * gui/e-week-view.c (e_week_view_realize): init the "today" color
-
-2002-01-13 JP Rosevear <jpr@ximian.com>
-
- * gui/alarm-notify/save.h: add protos
-
- * gui/alarm-notify/save.c (save_blessed_program): records a
- program as blessed
- (is_blessed_program): checks to see if a program is blessed
-
- * gui/alarm-notify/alarm-queue.c (procedure_notification_dialog):
- popup a dialog notifying the user that is a program and let them
- not see the dialog about this program again
- (procedure_notification): use above
-
2002-01-11 Damon Chaplin <damon@ximian.com>
* gui/e-timezone-entry.c:
@@ -683,110 +247,7 @@
* gui/calendar-config.c (on_timezone_set): translate timezone names
when displayed. Fixes bug #6544.
-2002-01-03 JP Rosevear <jpr@ximian.com>
-
- * gui/tasks-control.c (tasks_control_complete_cmd): new verb
- callback
- (sensitize_commands): set sensitivity of mark complete command
-
- * gui/e-tasks.h: new proto
-
- * gui/e-tasks.c (e_tasks_complete_selected): mark selected tasks
- in the table as complete
-
- * gui/e-calendar-table.h: new proto
-
- * gui/e-calendar-table.c (e_calendar_table_complete_selected):
- mark selected rows as complete
-
-2002-01-03 JP Rosevear <jpr@ximian.com>
-
- * gui/tasks-control.c (confirm_expunge): only need one warning
- message now
-
- * gui/e-tasks.c (create_sexp): change the logic to expunge all
- completed tasks not just hidden ones
-
-2002-01-03 JP Rosevear <jpr@ximian.com>
-
- * gui/tasks-control.c (confirm_expunge): confirm expunging of the
- tasks
- (tasks_control_expunge_cmd): verb callback
-
- * gui/calendar-config.c (config_read): read confirm expunge value
- (calendar_config_write): write confirm expunge value
- (calendar_config_write_on_exit): ditto
- (calendar_config_get_confirm_expunge): get value
- (calendar_config_set_confirm_expunge): set value
-
- * gui/calendar-config.h: new proto
-
- * gui/e-itip-control.c (start_calendar_server): kill warning
-
- * gui/e-tasks.c (e_tasks_init): init query member to NULL
- (set_status_message): util function to set status message
- (e_tasks_open): use above
- (cal_opened_cb): ditto
- (create_sexp): create sexp of items to be deleted
- (query_obj_updated_cb): remove any items found
- (query_eval_error_cb): bail out on error
- (query_query_done_cb): tidy when done
- (e_tasks_delete_completed): set up query
-
- * gui/e-tasks.h: new proto
-
- * gui/calendar-model.c (query_query_done_cb): use g_warning
- instead of printing to stderr
- (query_eval_error_cb): ditto
- (update_query): clear the status message if we can't create the
- query
-
- * gui/tag-calendar.c (resolve_tzid_cb): make this static
-
-2001-12-21 JP Rosevear <jpr@ximian.com>
-
- * gui/dialogs/comp-editor.c: remove needs send signal related
- cruft
- (save_comp_with_send): with send_component_dialog, indicate if the
- meeting info is newly created or not
- (real_edit_comp): remember if the dialog initially needs a send
-
- * gui/dialogs/send-comp.c (send_component_dialog): take a "new"
- parameter indicating whether the dialog should intimate if the
- component to be sent is a new meeting or not
-
- * gui/dialogs/send-comp.h: update proto
-
- * gui/dialogs/comp-editor.c: remove no longer used needs_send
- notification and signal
-
- * gui/dialogs/comp-editor.h: remove proto
-
- * gui/e-day-view.c (e_day_view_on_main_canvas_drag_data_received): add new
- param to send_component_dialog
- (e_day_view_finish_long_event_resize): ditto
- (e_day_view_finish_resize): ditto
- (e_day_view_on_editing_stopped): ditto
- (e_day_view_on_top_canvas_drag_data_received): ditto
-
- * gui/e-week-view.c (e_week_view_on_editing_stopped): add new
- param to send_component_dialog
-
-2001-12-21 JP Rosevear <jpr@ximian.com>
-
- * gui/dialogs/comp-editor.h: inherit from bonobo window
-
- * gui/dialogs/comp-editor.c: inherit from bonobo window
- (comp_editor_key_press_event): Look for an escape key press and
- close the window if found
-
-2001-12-20 Ettore Perazzoli <ettore@ximian.com>
-
- [Fixes #17377, Evolution doesn't work on multi-depth displays.]
-
- * gui/main.c (main): Push GdkRGB visual and colormap.
-
-2001-12-19 JP Rosevear <jpr@ximian.com>
+2001-12-18 JP Rosevear <jpr@ximian.com>
* conduits/calendar/calendar-conduit.c (check_for_slow_setting):
go slow and clear the map if the last uri and the current uri do
@@ -821,7 +282,20 @@
(cal_client_open_default_calendar): open the default uri or the
fallback if the method is unsupported
(cal_client_open_default_tasks): same for tasks
-
+
+2001-12-18 Dan Winship <danw@ximian.com>
+
+ * gui/itip-utils.c (itip_send_comp): Unfortunate hack to make this
+ work with Outlook 2000 in an Exchange environment (at the expense
+ of making it break with O2k in a POP/IMAP environment, unless you
+ set EVOLUTION_SEND_IMIP_AS_ATTACHMENT.) Fails to adequately fix
+ #14705, but it's the best we can do for 1.0.1.
+
+2001-12-17 JP Rosevear <jpr@ximian.com>
+
+ * gui/e-meeting-model.c (process_free_busy): indicate the meeting
+ attendee has calendar info
+
2001-12-17 JP Rosevear <jpr@ximian.com>
* gui/e-itip-control.c (send_item): use get_real_item
@@ -835,22 +309,28 @@
(send_item): use get_real_item
2001-12-17 JP Rosevear <jpr@ximian.com>
+
+ * gui/itip-utils.c (comp_limit_attendees): can't remove properties
+ in an iteration loop, so remove them outside the loop
+ (comp_minimal): don't set a recurid if there isn't one, add the x
+ properties to the clone
+ (comp_compliant): unref the clone for DECLINECOUNTER
+
+ * gui/e-itip-control.c (get_refresh_options): make function
+ available again
+ (show_current_event): use it here
+ (ok_clicked_cb): can't remove properties in an iteration loop, so
+ remove them outside the loop
+
+ * cal-util/cal-component.c (free_icalcomponent): properly free the
+ attendee list
+ (cal_component_rescan): don't destroy the alarm hash
- * gui/itip-utils.c (comp_limit_attendees): can't remove properties
- in an iteration loop, so remove them outside the loop
- (comp_minimal): don't set a recurid if there isn't one, add the x
- properties to the clone
- (comp_compliant): unref the clone for DECLINECOUNTER
+2001-12-14 Ettore Perazzoli <ettore@ximian.com>
- * gui/e-itip-control.c (get_refresh_options): make function
- available again
- (show_current_event): use it here
- (ok_clicked_cb): can't remove properties in an iteration loop, so
- remove them outside the loop
+ [Fixes #17377, Evolution doesn't work on multi-depth displays.]
- * cal-util/cal-component.c (free_icalcomponent): properly free the
- attendee list
- (cal_component_rescan): don't destroy the alarm hash
+ * gui/main.c (main): Push GdkRGB visual and colormap.
2001-12-13 Damon Chaplin <damon@ximian.com>
@@ -858,11 +338,11 @@
We won't be using the translations in 1.0.1, but it gives translators
time before we do use them in 1.0.2.
- * Makefile.am: added zones.h to EXTRA_DIST.
+ * Makefile.am (CONDUIT_DIR): added zones.h to EXTRA_DIST.
2001-12-12 JP Rosevear <jpr@ximian.com>
- * gui/e-day-view.c (e_day_view_on_top_canvas_button_release):
+ * gui/e-day-view.c (e_day_view_on_top_canvas_button_release):
ungrab the pointer before calling
e_day_view_finish_long_event_resize
(e_day_view_on_main_canvas_button_release): ditto
@@ -872,7 +352,10 @@
(e_day_view_on_editing_stopped): ditto
(e_day_view_on_top_canvas_drag_data_received): ditto
(e_day_view_on_main_canvas_drag_data_received): ditto
-
+
+ * gui/e-week-view.c (e_week_view_on_editing_stopped): ask if the
+ meeting should be sent if
+
2001-12-11 JP Rosevear <jpr@ximian.com>
* gui/e-meeting-model.c (process_free_busy_comp): properly convert
@@ -908,22 +391,6 @@
* importers/GNOME_Evolution_Calendar_Importer.oaf.in: fixed executable
name. Fixes bug #16880.
-2001-12-08 JP Rosevear <jpr@ximian.com>
-
- * conduits/calendar/calendar-conduit.c (local_record_from_comp):
- if we have an alarm that can be represented on the pilot, set the
- appointment fields appropriately, if the duration has values for
- minutes and/or hours and/or days, use the lowest common
- denominator
- (comp_from_remote_record): if the appointment on the pilot has an
- alarm, find the first alarm an item currently had that is relative
- to the start and with a negative duration and update it (or create
- a new one if no valid ones exist)
-
- * cal-util/cal-component.c (cal_component_get_alarm_uids): build
- list in the order they appear in the component so we get
- consisting order for the gui and for the pilot
-
2001-12-08 Rodrigo Moya <rodrigo@ximian.com>
* gui/calendar-config.c (calendar_config_get_default_uri):
@@ -959,6 +426,22 @@
(start_query_cb): Set the state to QUERY_IN_PROGRESS here instead
of in populate_query().
+2001-12-07 JP Rosevear <jpr@ximian.com>
+
+ * conduits/calendar/calendar-conduit.c (local_record_from_comp):
+ if we have an alarm that can be represented on the pilot, set the
+ appointment fields appropriately, if the duration has values for
+ minutes and/or hours and/or days, use the lowest common
+ denominator
+ (comp_from_remote_record): if the appointment on the pilot has an
+ alarm, find the first alarm an item currently had that is relative
+ to the start and with a negative duration and update it (or create
+ a new one if no valid ones exist)
+
+ * cal-util/cal-component.c (cal_component_get_alarm_uids): build
+ list in the order they appear in the component so we get
+ consisting order for the gui and for the pilot
+
2001-12-07 Rodrigo Moya <rodrigo@ximian.com>
* gui/calendar-config.c (calendar_config_get_default_uri):
@@ -973,18 +456,18 @@
2001-12-06 Jon Trowbridge <trow@ximian.com>
- * gui/dialogs/event-editor.c (event_editor_destroy): Explicitly
+ * gui/dialogs/event-editor.c (event_editor_destroy): Explicitly
destroy the EMeetingModel. This is a hack to work around problems
with the reference counting; we are still leaking the
EMeetingModels.
- * gui/e-meeting-time-sel.c
- (e_meeting_time_selector_construct): Ref our EMeetingModel.
- (e_meeting_time_selector_destroy): Unref the model.
+ * gui/e-meeting-time-sel.c (e_meeting_time_selector_construct):
+ Ref our EMeetingModel.
+ (e_meeting_time_selector_destroy): Unref the model.
- * gui/e-meeting-model.c (destroy): Properly destroy
+ * gui/e-meeting-model.c (destroy): Properly destroy
corba_select_names with a call to bonobo_object_release_unref.
- (Fixes 14002)
+ (Fixes 14002)
2001-12-05 Rodrigo Moya <rodrigo@ximian.com>
diff --git a/calendar/cal-client/Makefile.am b/calendar/cal-client/Makefile.am
index de4b85e51f..a87805002b 100644
--- a/calendar/cal-client/Makefile.am
+++ b/calendar/cal-client/Makefile.am
@@ -30,7 +30,8 @@ INCLUDES = \
-I$(top_srcdir)/libical/src/libical \
-I$(top_builddir)/libwombat \
-I$(top_srcdir)/libwombat \
- $(EVOLUTION_CALENDAR_CFLAGS)
+ $(BONOBO_GNOME_CFLAGS) \
+ $(BONOBO_CONF_CFLAGS)
lib_LTLIBRARIES = libcal-client.la
@@ -75,12 +76,14 @@ client_test_INCLUDES = \
$(INCLUDES) \
-DG_LOG_DOMAIN=\"client-test\"
-client_test_LDADD = \
- $(EVOLUTION_CALENDAR_LIBS) \
- $(top_builddir)/calendar/cal-util/libcal-util.la \
- $(top_builddir)/libversit/libversit.a \
+client_test_LDADD = \
+ $(BONOBO_VFS_GNOME_LIBS) \
+ $(EXTRA_GNOME_LIBS) \
+ $(BONOBO_CONF_LIBS) \
+ $(top_builddir)/calendar/cal-util/libcal-util.la \
+ $(top_builddir)/libversit/libversit.la \
$(top_builddir)/libical/src/libical/libical-evolution.la \
- $(top_builddir)/libwombat/libwombat.la \
+ $(top_builddir)/libwombat/libwombat.la \
libcal-client.la
BUILT_SOURCES = $(CORBA_GENERATED)
diff --git a/calendar/cal-client/cal-client.c b/calendar/cal-client/cal-client.c
index 60063a72b2..d30e13089e 100644
--- a/calendar/cal-client/cal-client.c
+++ b/calendar/cal-client/cal-client.c
@@ -796,7 +796,7 @@ static char *
get_default_uri (gboolean tasks)
{
Bonobo_ConfigDatabase db;
- char *uri, *file_uri;
+ char *uri, *fall_back = NULL;
CORBA_Environment ev;
CORBA_exception_init (&ev);
@@ -808,24 +808,19 @@ get_default_uri (gboolean tasks)
return NULL;
}
+ CORBA_exception_free (&ev);
+
+ fall_back = get_fall_back_uri (tasks);
if (tasks)
- uri = bonobo_config_get_string (db, "/DefaultFolders/tasks_uri", &ev);
+ uri = bonobo_config_get_string_with_default (db, "/Calendar/DefaultTasksUri",
+ fall_back, NULL);
else
- uri = bonobo_config_get_string (db, "/DefaultFolders/calendar_uri", &ev);
+ uri = bonobo_config_get_string_with_default (db, "/Calendar/DefaultUri",
+ fall_back, NULL);
+ g_free (fall_back);
+
bonobo_object_release_unref (db, NULL);
- if (BONOBO_EX (&ev)) {
- CORBA_exception_free (&ev);
- uri = get_fall_back_uri (tasks);
- } else if (!strncmp (uri, "file:", 5)) {
- for (file_uri = uri + 5; *file_uri == '/'; file_uri++)
- ;
- file_uri = g_strdup_printf ("/%s/%s.ics", file_uri,
- tasks ? "tasks" : "calendar");
- g_free (uri);
- uri = file_uri;
- }
-
return uri;
}
diff --git a/calendar/conduits/calendar/calendar-conduit-config.h b/calendar/conduits/calendar/calendar-conduit-config.h
new file mode 100644
index 0000000000..4521612034
--- /dev/null
+++ b/calendar/conduits/calendar/calendar-conduit-config.h
@@ -0,0 +1,135 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* Evolution calendar - Calendar Conduit Configuration
+ *
+ * Copyright (C) 1998 Free Software Foundation
+ * Copyright (C) 2000 Ximian, Inc.
+ *
+ * Authors: Eskil Heyn Olsen <deity@eskil.dk>
+ * JP Rosevear <jpr@ximian.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public 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_CONDUIT_CONFIG_H__
+#define __CAL_CONDUIT_CONFIG_H__
+
+#include <gnome.h>
+#include <libgpilotdCM/gnome-pilot-conduit-management.h>
+#include <libgpilotdCM/gnome-pilot-conduit-config.h>
+
+/* Configuration info */
+typedef struct _ECalConduitCfg ECalConduitCfg;
+struct _ECalConduitCfg {
+ guint32 pilot_id;
+ GnomePilotConduitSyncType sync_type;
+
+ gboolean open_secret;
+ gchar *last_uri;
+};
+
+#ifdef CAL_CONFIG_LOAD
+/* Loads the configuration data */
+static void
+calconduit_load_configuration (ECalConduitCfg **c, guint32 pilot_id)
+{
+ GnomePilotConduitManagement *management;
+ GnomePilotConduitConfig *config;
+ gchar prefix[256];
+ g_snprintf (prefix, 255, "/gnome-pilot.d/e-calendar-conduit/Pilot_%u/",
+ pilot_id);
+
+ *c = g_new0 (ECalConduitCfg,1);
+ g_assert (*c != NULL);
+
+ (*c)->pilot_id = pilot_id;
+
+ management = gnome_pilot_conduit_management_new ("e_calendar_conduit", GNOME_PILOT_CONDUIT_MGMT_ID);
+ config = gnome_pilot_conduit_config_new (management, pilot_id);
+ if (!gnome_pilot_conduit_config_is_enabled (config, &(*c)->sync_type))
+ (*c)->sync_type = GnomePilotConduitSyncTypeNotSet;
+ gtk_object_unref (GTK_OBJECT (config));
+ gtk_object_unref (GTK_OBJECT (management));
+
+ /* Custom settings */
+ gnome_config_push_prefix (prefix);
+
+ (*c)->open_secret = gnome_config_get_bool ("open_secret=FALSE");
+ (*c)->last_uri = gnome_config_get_string ("last_uri");
+
+ gnome_config_pop_prefix ();
+}
+#endif
+
+#ifdef CAL_CONFIG_SAVE
+/* Saves the configuration data. */
+static void
+calconduit_save_configuration (ECalConduitCfg *c)
+{
+ gchar prefix[256];
+
+ g_snprintf (prefix, 255, "/gnome-pilot.d/e-calendar-conduit/Pilot_%u/",
+ c->pilot_id);
+
+ gnome_config_push_prefix (prefix);
+ gnome_config_set_bool ("open_secret", c->open_secret);
+ gnome_config_set_string ("last_uri", c->last_uri);
+ gnome_config_pop_prefix ();
+
+ gnome_config_sync ();
+ gnome_config_drop_all ();
+}
+#endif
+
+#ifdef CAL_CONFIG_DUPE
+/* Creates a duplicate of the configuration data */
+static ECalConduitCfg*
+calconduit_dupe_configuration (ECalConduitCfg *c)
+{
+ ECalConduitCfg *retval;
+
+ g_return_val_if_fail (c != NULL, NULL);
+
+ retval = g_new0 (ECalConduitCfg, 1);
+ retval->sync_type = c->sync_type;
+ retval->pilot_id = c->pilot_id;
+
+ retval->open_secret = c->open_secret;
+ retval->last_uri = g_strdup (c->last_uri);
+
+ return retval;
+}
+#endif
+
+#ifdef CAL_CONFIG_DESTROY
+/* Destroy a configuration */
+static void
+calconduit_destroy_configuration (ECalConduitCfg **c)
+{
+ g_return_if_fail (c != NULL);
+ g_return_if_fail (*c != NULL);
+
+ g_free ((*c)->last_uri);
+ g_free (*c);
+ *c = NULL;
+}
+#endif
+
+#endif /* __CAL_CONDUIT_CONFIG_H__ */
+
+
+
+
+
+
+
diff --git a/calendar/conduits/calendar/calendar-conduit.c b/calendar/conduits/calendar/calendar-conduit.c
index f86e753232..a320e9bb8d 100644
--- a/calendar/conduits/calendar/calendar-conduit.c
+++ b/calendar/conduits/calendar/calendar-conduit.c
@@ -23,6 +23,7 @@
#include <config.h>
+#include <liboaf/liboaf.h>
#include <bonobo.h>
#include <bonobo-conf/bonobo-config-database.h>
#include <cal-client/cal-client-types.h>
@@ -30,16 +31,22 @@
#include <cal-util/timeutil.h>
#include <pi-source.h>
#include <pi-socket.h>
+#include <pi-file.h>
#include <pi-dlp.h>
-#include <pi-datebook.h>
-#include <gpilotd/gnome-pilot-conduit.h>
-#include <gpilotd/gnome-pilot-conduit-sync-abs.h>
-#include <libgpilotdCM/gnome-pilot-conduit-management.h>
-#include <libgpilotdCM/gnome-pilot-conduit-config.h>
-#include <e-pilot-map.h>
-#include <e-pilot-settings.h>
+#include <libical/src/libical/icaltypes.h>
#include <e-pilot-util.h>
+#define CAL_CONFIG_LOAD 1
+#define CAL_CONFIG_SAVE 1
+#define CAL_CONFIG_DESTROY 1
+#include <calendar-conduit-config.h>
+#undef CAL_CONFIG_LOAD
+#undef CAL_CONFIG_SAVE
+#undef CAL_CONFIG_DESTROY
+
+#include <calendar-conduit.h>
+
+static void free_local (ECalLocalRecord *local);
GnomePilotConduit * conduit_get_gpilot_conduit (guint32);
void conduit_destroy_gpilot_conduit (GnomePilotConduit*);
@@ -63,157 +70,69 @@ void conduit_destroy_gpilot_conduit (GnomePilotConduit*);
#define PILOT_MAX_ADVANCE 99
-typedef struct _ECalLocalRecord ECalLocalRecord;
-typedef struct _ECalConduitCfg ECalConduitCfg;
-typedef struct _ECalConduitContext ECalConduitContext;
-
-/* Local Record */
-struct _ECalLocalRecord {
- /* 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.
- */
- GnomePilotDesktopRecord local;
-
- /* The corresponding Comp object */
- CalComponent *comp;
-
- /* pilot-link appointment structure */
- struct Appointment *appt;
-};
-
-static void
-calconduit_destroy_record (ECalLocalRecord *local)
-{
- gtk_object_unref (GTK_OBJECT (local->comp));
- free_Appointment (local->appt);
- g_free (local->appt);
- g_free (local);
-}
-
-/* Configuration */
-struct _ECalConduitCfg {
- guint32 pilot_id;
- GnomePilotConduitSyncType sync_type;
-
- gboolean secret;
- gchar *last_uri;
-};
-
-static ECalConduitCfg *
-calconduit_load_configuration (guint32 pilot_id)
+/* Debug routines */
+static char *
+print_local (ECalLocalRecord *local)
{
- ECalConduitCfg *c;
- GnomePilotConduitManagement *management;
- GnomePilotConduitConfig *config;
- gchar prefix[256];
-
- c = g_new0 (ECalConduitCfg, 1);
- g_assert (c != NULL);
-
- /* Pilot ID */
- c->pilot_id = pilot_id;
-
- /* Sync Type */
- management = gnome_pilot_conduit_management_new ("e_calendar_conduit", GNOME_PILOT_CONDUIT_MGMT_ID);
- config = gnome_pilot_conduit_config_new (management, pilot_id);
- if (!gnome_pilot_conduit_config_is_enabled (config, &c->sync_type))
- c->sync_type = GnomePilotConduitSyncTypeNotSet;
- gtk_object_unref (GTK_OBJECT (config));
- gtk_object_unref (GTK_OBJECT (management));
-
- /* Custom settings */
- g_snprintf (prefix, 255, "/gnome-pilot.d/e-calendar-conduit/Pilot_%u/", pilot_id);
- gnome_config_push_prefix (prefix);
+ static char buff[ 4096 ];
- c->secret = gnome_config_get_bool ("secret=FALSE");
- c->last_uri = gnome_config_get_string ("last_uri");
+ if (local == NULL) {
+ sprintf (buff, "[NULL]");
+ return buff;
+ }
- gnome_config_pop_prefix ();
+ if (local->appt && local->appt->description) {
+ g_snprintf (buff, 4096, "[%ld %ld '%s' '%s']",
+ mktime (&local->appt->begin),
+ mktime (&local->appt->end),
+ local->appt->description ?
+ local->appt->description : "",
+ local->appt->note ?
+ local->appt->note : "");
+ return buff;
+ }
- return c;
+ return "";
}
-static void
-calconduit_save_configuration (ECalConduitCfg *c)
+static char *print_remote (GnomePilotRecord *remote)
{
- gchar prefix[256];
-
- g_snprintf (prefix, 255, "/gnome-pilot.d/e-calendar-conduit/Pilot_%u/", c->pilot_id);
- gnome_config_push_prefix (prefix);
-
- gnome_config_set_bool ("secret", c->secret);
- gnome_config_set_string ("last_uri", c->last_uri);
-
- gnome_config_pop_prefix ();
-
- gnome_config_sync ();
- gnome_config_drop_all ();
-}
+ static char buff[ 4096 ];
+ struct Appointment appt;
-static ECalConduitCfg*
-calconduit_dupe_configuration (ECalConduitCfg *c)
-{
- ECalConduitCfg *retval;
+ if (remote == NULL) {
+ sprintf (buff, "[NULL]");
+ return buff;
+ }
- g_return_val_if_fail (c != NULL, NULL);
+ memset (&appt, 0, sizeof (struct Appointment));
+ unpack_Appointment (&appt, remote->record, remote->length);
- retval = g_new0 (ECalConduitCfg, 1);
- retval->pilot_id = c->pilot_id;
- retval->sync_type = c->sync_type;
- retval->secret = c->secret;
- retval->last_uri = g_strdup (c->last_uri);
-
- return retval;
-}
+ g_snprintf (buff, 4096, "[%ld %ld '%s' '%s']",
+ mktime (&appt.begin),
+ mktime (&appt.end),
+ appt.description ?
+ appt.description : "",
+ appt.note ?
+ appt.note : "");
-static void
-calconduit_destroy_configuration (ECalConduitCfg *c)
-{
- g_return_if_fail (c != NULL);
+ free_Appointment (&appt);
- g_free (c->last_uri);
- g_free (c);
+ return buff;
}
-/* Context */
-struct _ECalConduitContext {
- ECalConduitCfg *cfg;
- GnomePilotDBInfo *dbi;
-
- ECalConduitCfg *new_cfg;
- GtkWidget *ps;
-
- struct AppointmentAppInfo ai;
-
- CalClient *client;
-
- icaltimezone *timezone;
- GList *uids;
- GList *changed;
- GHashTable *changed_hash;
- GList *locals;
-
- EPilotMap *map;
-};
-
+/* Context Routines */
static ECalConduitContext *
e_calendar_context_new (guint32 pilot_id)
{
- ECalConduitContext *ctxt;
+ ECalConduitContext *ctxt = g_new0 (ECalConduitContext, 1);
+
+ calconduit_load_configuration (&ctxt->cfg, pilot_id);
- ctxt = g_new0 (ECalConduitContext, 1);
- g_assert (ctxt != NULL);
-
- ctxt->cfg = calconduit_load_configuration (pilot_id);
- ctxt->new_cfg = calconduit_dupe_configuration (ctxt->cfg);
- ctxt->ps = NULL;
- ctxt->dbi = NULL;
ctxt->client = NULL;
- ctxt->timezone = NULL;
ctxt->uids = NULL;
- ctxt->changed = NULL;
ctxt->changed_hash = NULL;
+ ctxt->changed = NULL;
ctxt->locals = NULL;
ctxt->map = NULL;
@@ -236,17 +155,14 @@ e_calendar_context_destroy (ECalConduitContext *ctxt)
g_return_if_fail (ctxt != NULL);
if (ctxt->cfg != NULL)
- calconduit_destroy_configuration (ctxt->cfg);
+ calconduit_destroy_configuration (&ctxt->cfg);
if (ctxt->client != NULL)
gtk_object_unref (GTK_OBJECT (ctxt->client));
-
+
if (ctxt->uids != NULL)
cal_obj_uid_list_free (ctxt->uids);
-
- if (ctxt->changed != NULL)
- cal_client_change_list_free (ctxt->changed);
-
+
if (ctxt->changed_hash != NULL) {
g_hash_table_foreach_remove (ctxt->changed_hash, e_calendar_context_foreach_change, NULL);
g_hash_table_destroy (ctxt->changed_hash);
@@ -254,63 +170,17 @@ e_calendar_context_destroy (ECalConduitContext *ctxt)
if (ctxt->locals != NULL) {
for (l = ctxt->locals; l != NULL; l = l->next)
- calconduit_destroy_record (l->data);
+ free_local (l->data);
g_list_free (ctxt->locals);
}
+
+ if (ctxt->changed != NULL)
+ cal_client_change_list_free (ctxt->changed);
if (ctxt->map != NULL)
e_pilot_map_destroy (ctxt->map);
-}
-
-/* Debug routines */
-static char *
-print_local (ECalLocalRecord *local)
-{
- static char buff[ 4096 ];
-
- if (local == NULL) {
- sprintf (buff, "[NULL]");
- return buff;
- }
-
- if (local->appt && local->appt->description) {
- g_snprintf (buff, 4096, "[%ld %ld '%s' '%s']",
- mktime (&local->appt->begin),
- mktime (&local->appt->end),
- local->appt->description ?
- local->appt->description : "",
- local->appt->note ?
- local->appt->note : "");
- return buff;
- }
-
- return "";
-}
-
-static char *print_remote (GnomePilotRecord *remote)
-{
- static char buff[ 4096 ];
- struct Appointment appt;
-
- if (remote == NULL) {
- sprintf (buff, "[NULL]");
- return buff;
- }
-
- memset (&appt, 0, sizeof (struct Appointment));
- unpack_Appointment (&appt, remote->record, remote->length);
-
- g_snprintf (buff, 4096, "[%ld %ld '%s' '%s']",
- mktime (&appt.begin),
- mktime (&appt.end),
- appt.description ?
- appt.description : "",
- appt.note ?
- appt.note : "");
-
- free_Appointment (&appt);
- return buff;
+ g_free (ctxt);
}
/* Calendar Server routines */
@@ -635,6 +505,15 @@ compute_status (ECalConduitContext *ctxt, ECalLocalRecord *local, const char *ui
}
}
+static void
+free_local (ECalLocalRecord *local)
+{
+ gtk_object_unref (GTK_OBJECT (local->comp));
+ free_Appointment (local->appt);
+ g_free (local->appt);
+ g_free (local);
+}
+
static GnomePilotRecord
local_record_to_pilot_record (ECalLocalRecord *local,
ECalConduitContext *ctxt)
@@ -1626,7 +1505,7 @@ free_match (GnomePilotConduitSyncAbs *conduit,
g_return_val_if_fail (local != NULL, -1);
- calconduit_destroy_record (local);
+ free_local (local);
return 0;
}
@@ -1644,58 +1523,6 @@ prepare (GnomePilotConduitSyncAbs *conduit,
return 0;
}
-/* Pilot Settings Callbacks */
-static void
-fill_widgets (ECalConduitContext *ctxt)
-{
- e_pilot_settings_set_secret (E_PILOT_SETTINGS (ctxt->ps),
- ctxt->cfg->secret);
-}
-
-static gint
-create_settings_window (GnomePilotConduit *conduit,
- GtkWidget *parent,
- ECalConduitContext *ctxt)
-{
- LOG ("create_settings_window");
-
- ctxt->ps = e_pilot_settings_new ();
- gtk_container_add (GTK_CONTAINER (parent), ctxt->ps);
- gtk_widget_show (ctxt->ps);
-
- fill_widgets (ctxt);
-
- return 0;
-}
-static void
-display_settings (GnomePilotConduit *conduit, ECalConduitContext *ctxt)
-{
- LOG ("display_settings");
-
- fill_widgets (ctxt);
-}
-
-static void
-save_settings (GnomePilotConduit *conduit, ECalConduitContext *ctxt)
-{
- LOG ("save_settings");
-
- ctxt->new_cfg->secret =
- e_pilot_settings_get_secret (E_PILOT_SETTINGS (ctxt->ps));
-
- calconduit_save_configuration (ctxt->new_cfg);
-}
-
-static void
-revert_settings (GnomePilotConduit *conduit, ECalConduitContext *ctxt)
-{
- LOG ("revert_settings");
-
- calconduit_save_configuration (ctxt->cfg);
- calconduit_destroy_configuration (ctxt->new_cfg);
- ctxt->new_cfg = calconduit_dupe_configuration (ctxt->cfg);
-}
-
static ORBit_MessageValidationResult
accept_all_cookies (CORBA_unsigned_long request_id,
CORBA_Principal *principal,
@@ -1735,7 +1562,6 @@ conduit_get_gpilot_conduit (guint32 pilot_id)
ctxt = e_calendar_context_new (pilot_id);
gtk_object_set_data (GTK_OBJECT (retval), "calconduit_context", ctxt);
- /* Sync signals */
gtk_signal_connect (retval, "pre_sync", (GtkSignalFunc) pre_sync, ctxt);
gtk_signal_connect (retval, "post_sync", (GtkSignalFunc) post_sync, ctxt);
@@ -1756,12 +1582,6 @@ conduit_get_gpilot_conduit (guint32 pilot_id)
gtk_signal_connect (retval, "prepare", (GtkSignalFunc) prepare, ctxt);
- /* Gui Settings */
- gtk_signal_connect (retval, "create_settings_window", (GtkSignalFunc) create_settings_window, ctxt);
- gtk_signal_connect (retval, "display_settings", (GtkSignalFunc) display_settings, ctxt);
- gtk_signal_connect (retval, "save_settings", (GtkSignalFunc) save_settings, ctxt);
- gtk_signal_connect (retval, "revert_settings", (GtkSignalFunc) revert_settings, ctxt);
-
return GNOME_PILOT_CONDUIT (retval);
}
diff --git a/calendar/conduits/todo/todo-conduit-config.h b/calendar/conduits/todo/todo-conduit-config.h
new file mode 100644
index 0000000000..3296cd47e3
--- /dev/null
+++ b/calendar/conduits/todo/todo-conduit-config.h
@@ -0,0 +1,129 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/* Evolution calendar - ToDo Conduit Configuration
+ *
+ * Copyright (C) 1998 Free Software Foundation
+ * Copyright (C) 2000 Ximian, Inc.
+ *
+ * Authors: Eskil Heyn Olsen <deity@eskil.dk>
+ * JP Rosevear <jpr@ximian.com>
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public 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 __TODO_CONDUIT_CONFIG_H__
+#define __TODO_CONDUIT_CONFIG_H__
+
+#include <gnome.h>
+#include <libgpilotdCM/gnome-pilot-conduit-management.h>
+#include <libgpilotdCM/gnome-pilot-conduit-config.h>
+
+/* Configuration info */
+typedef struct _EToDoConduitCfg EToDoConduitCfg;
+struct _EToDoConduitCfg {
+ guint32 pilot_id;
+ GnomePilotConduitSyncType sync_type; /* only used by capplet */
+
+ gboolean open_secret;
+ gchar *last_uri;
+};
+
+#ifdef TODO_CONFIG_LOAD
+/* Load the configuration data */
+static void
+todoconduit_load_configuration (EToDoConduitCfg **c, guint32 pilot_id)
+{
+ GnomePilotConduitManagement *management;
+ GnomePilotConduitConfig *config;
+ gchar prefix[256];
+ g_snprintf (prefix, 255, "/gnome-pilot.d/e-todo-conduit/Pilot_%u/",
+ pilot_id);
+
+ *c = g_new0 (EToDoConduitCfg,1);
+ g_assert (*c != NULL);
+
+ (*c)->pilot_id = pilot_id;
+
+ management = gnome_pilot_conduit_management_new ("e_todo_conduit", GNOME_PILOT_CONDUIT_MGMT_ID);
+ config = gnome_pilot_conduit_config_new (management, pilot_id);
+ if (!gnome_pilot_conduit_config_is_enabled (config, &(*c)->sync_type))
+ (*c)->sync_type = GnomePilotConduitSyncTypeNotSet;
+ gtk_object_unref (GTK_OBJECT (config));
+ gtk_object_unref (GTK_OBJECT (management));
+
+ /* Custom settings */
+ gnome_config_push_prefix (prefix);
+
+ (*c)->open_secret = gnome_config_get_bool ("open_secret=FALSE");
+ (*c)->last_uri = gnome_config_get_string ("last_uri");
+
+ gnome_config_pop_prefix ();
+}
+#endif
+
+#ifdef TODO_CONFIG_SAVE
+/* Saves the configuration data. */
+static void
+todoconduit_save_configuration (EToDoConduitCfg *c)
+{
+ gchar prefix[256];
+
+ g_snprintf (prefix, 255, "/gnome-pilot.d/e-todo-conduit/Pilot_%u/",
+ c->pilot_id);
+
+ gnome_config_push_prefix (prefix);
+ gnome_config_set_bool ("open_secret", c->open_secret);
+ gnome_config_set_string ("last_uri", c->last_uri);
+ gnome_config_pop_prefix ();
+
+ gnome_config_sync ();
+ gnome_config_drop_all ();
+}
+#endif
+
+#ifdef TODO_CONFIG_DUPE
+/* Creates a duplicate of the configuration data */
+static EToDoConduitCfg*
+todoconduit_dupe_configuration (EToDoConduitCfg *c)
+{
+ EToDoConduitCfg *retval;
+
+ g_return_val_if_fail (c != NULL, NULL);
+
+ retval = g_new0 (EToDoConduitCfg, 1);
+ retval->sync_type = c->sync_type;
+ retval->pilot_id = c->pilot_id;
+
+ retval->open_secret = c->open_secret;
+ retval->last_uri = g_strdup (c->last_uri);
+
+ return retval;
+}
+#endif
+
+#ifdef TODO_CONFIG_DESTROY
+/* Destroy a configuration */
+static void
+todoconduit_destroy_configuration (EToDoConduitCfg **c)
+{
+ g_return_if_fail (c != NULL);
+ g_return_if_fail (*c != NULL);
+
+ g_free ((*c)->last_uri);
+ g_free (*c);
+ *c = NULL;
+}
+#endif
+
+#endif /* __TODO_CONDUIT_CONFIG_H__ */
+
diff --git a/calendar/conduits/todo/todo-conduit.c b/calendar/conduits/todo/todo-conduit.c
index a460bd6ebc..8b68110847 100644
--- a/calendar/conduits/todo/todo-conduit.c
+++ b/calendar/conduits/todo/todo-conduit.c
@@ -31,17 +31,22 @@
#include <cal-util/timeutil.h>
#include <pi-source.h>
#include <pi-socket.h>
+#include <pi-file.h>
#include <pi-dlp.h>
-#include <pi-todo.h>
#include <libical/src/libical/icaltypes.h>
-#include <gpilotd/gnome-pilot-conduit.h>
-#include <gpilotd/gnome-pilot-conduit-sync-abs.h>
-#include <libgpilotdCM/gnome-pilot-conduit-management.h>
-#include <libgpilotdCM/gnome-pilot-conduit-config.h>
-#include <e-pilot-map.h>
-#include <e-pilot-settings.h>
#include <e-pilot-util.h>
+#define TODO_CONFIG_LOAD 1
+#define TODO_CONFIG_SAVE 1
+#define TODO_CONFIG_DESTROY 1
+#include <todo-conduit-config.h>
+#undef TODO_CONFIG_LOAD
+#undef TODO_CONFIG_SAVE
+#undef TODO_CONFIG_DESTROY
+
+#include <todo-conduit.h>
+
+static void free_local (EToDoLocalRecord *local);
GnomePilotConduit * conduit_get_gpilot_conduit (guint32);
void conduit_destroy_gpilot_conduit (GnomePilotConduit*);
@@ -51,10 +56,10 @@ void conduit_destroy_gpilot_conduit (GnomePilotConduit*);
#endif
#define G_LOG_DOMAIN "etodoconduit"
-#define DEBUG_TODOCONDUIT 1
-/* #undef DEBUG_TODOCONDUIT */
+#define DEBUG_CALCONDUIT 1
+/* #undef DEBUG_CALCONDUIT */
-#ifdef DEBUG_TODOCONDUIT
+#ifdef DEBUG_CALCONDUIT
#define LOG(e...) g_log (G_LOG_DOMAIN, G_LOG_LEVEL_MESSAGE, e)
#else
#define LOG(e...)
@@ -63,214 +68,69 @@ void conduit_destroy_gpilot_conduit (GnomePilotConduit*);
#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)
-typedef struct _EToDoLocalRecord EToDoLocalRecord;
-typedef struct _EToDoConduitCfg EToDoConduitCfg;
-typedef struct _EToDoConduitGui EToDoConduitGui;
-typedef struct _EToDoConduitContext EToDoConduitContext;
-
-/* Local Record */
-struct _EToDoLocalRecord {
- /* 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.
- */
- GnomePilotDesktopRecord local;
-
- /* The corresponding Comp object */
- CalComponent *comp;
-
- /* pilot-link todo structure */
- struct ToDo *todo;
-};
-
-static void
-todoconduit_destroy_record (EToDoLocalRecord *local)
-{
- gtk_object_unref (GTK_OBJECT (local->comp));
- free_ToDo (local->todo);
- g_free (local->todo);
- g_free (local);
-}
-
-/* Configuration */
-struct _EToDoConduitCfg {
- guint32 pilot_id;
- GnomePilotConduitSyncType sync_type;
-
- gboolean secret;
- gint priority;
-
- gchar *last_uri;
-};
-
-static EToDoConduitCfg *
-todoconduit_load_configuration (guint32 pilot_id)
-{
- EToDoConduitCfg *c;
- GnomePilotConduitManagement *management;
- GnomePilotConduitConfig *config;
- gchar prefix[256];
- g_snprintf (prefix, 255, "/gnome-pilot.d/e-todo-conduit/Pilot_%u/",
- pilot_id);
-
- c = g_new0 (EToDoConduitCfg,1);
- g_assert (c != NULL);
-
- c->pilot_id = pilot_id;
-
- management = gnome_pilot_conduit_management_new ("e_todo_conduit", GNOME_PILOT_CONDUIT_MGMT_ID);
- config = gnome_pilot_conduit_config_new (management, pilot_id);
- if (!gnome_pilot_conduit_config_is_enabled (config, &c->sync_type))
- c->sync_type = GnomePilotConduitSyncTypeNotSet;
- gtk_object_unref (GTK_OBJECT (config));
- gtk_object_unref (GTK_OBJECT (management));
-
- /* Custom settings */
- gnome_config_push_prefix (prefix);
-
- c->secret = gnome_config_get_bool ("secret=FALSE");
- c->priority = gnome_config_get_int ("priority=3");
- c->last_uri = gnome_config_get_string ("last_uri");
-
- gnome_config_pop_prefix ();
-
- return c;
-}
-
-static void
-todoconduit_save_configuration (EToDoConduitCfg *c)
+/* Debug routines */
+static char *
+print_local (EToDoLocalRecord *local)
{
- gchar prefix[256];
+ static char buff[ 4096 ];
- g_snprintf (prefix, 255, "/gnome-pilot.d/e-todo-conduit/Pilot_%u/",
- c->pilot_id);
+ if (local == NULL) {
+ sprintf (buff, "[NULL]");
+ return buff;
+ }
- gnome_config_push_prefix (prefix);
- gnome_config_set_bool ("secret", c->secret);
- gnome_config_set_int ("priority", c->priority);
- gnome_config_set_string ("last_uri", c->last_uri);
- gnome_config_pop_prefix ();
+ if (local->todo && local->todo->description) {
+ g_snprintf (buff, 4096, "[%d %ld %d %d '%s' '%s']",
+ local->todo->indefinite,
+ mktime (& local->todo->due),
+ local->todo->priority,
+ local->todo->complete,
+ local->todo->description ?
+ local->todo->description : "",
+ local->todo->note ?
+ local->todo->note : "");
+ return buff;
+ }
- gnome_config_sync ();
- gnome_config_drop_all ();
+ return "";
}
-static EToDoConduitCfg*
-todoconduit_dupe_configuration (EToDoConduitCfg *c)
+static char *print_remote (GnomePilotRecord *remote)
{
- EToDoConduitCfg *retval;
-
- g_return_val_if_fail (c != NULL, NULL);
-
- retval = g_new0 (EToDoConduitCfg, 1);
- retval->sync_type = c->sync_type;
- retval->pilot_id = c->pilot_id;
-
- retval->secret = c->secret;
- retval->priority = c->priority;
- retval->last_uri = g_strdup (c->last_uri);
-
- return retval;
-}
+ static char buff[ 4096 ];
+ struct ToDo todo;
-static void
-todoconduit_destroy_configuration (EToDoConduitCfg *c)
-{
- g_return_if_fail (c != NULL);
+ if (remote == NULL) {
+ sprintf (buff, "[NULL]");
+ return buff;
+ }
- g_free (c->last_uri);
- g_free (c);
-}
+ memset (&todo, 0, sizeof (struct ToDo));
+ unpack_ToDo (&todo, remote->record, remote->length);
-/* Gui */
-struct _EToDoConduitGui {
- GtkWidget *priority;
-};
+ g_snprintf (buff, 4096, "[%d %ld %d %d '%s' '%s']",
+ todo.indefinite,
+ mktime (&todo.due),
+ todo.priority,
+ todo.complete,
+ todo.description ?
+ todo.description : "",
+ todo.note ?
+ todo.note : "");
-static EToDoConduitGui *
-e_todo_gui_new (EPilotSettings *ps)
-{
- EToDoConduitGui *gui;
- GtkWidget *lbl;
- GtkObject *adj;
- gint rows;
-
- g_return_val_if_fail (ps != NULL, NULL);
- g_return_val_if_fail (E_IS_PILOT_SETTINGS (ps), NULL);
-
- gtk_table_resize (GTK_TABLE (ps), E_PILOT_SETTINGS_TABLE_ROWS + 1, E_PILOT_SETTINGS_TABLE_COLS);
-
- gui = g_new0 (EToDoConduitGui, 1);
-
- rows = E_PILOT_SETTINGS_TABLE_ROWS;
- lbl = gtk_label_new (_("Default Priority:"));
- gtk_misc_set_alignment (GTK_MISC (lbl), 0.0, 0.5);
- adj = gtk_adjustment_new (1, 1, 5, 1, 5, 5);
- gui->priority = gtk_spin_button_new (GTK_ADJUSTMENT (adj), 1.0, 0);
- gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (gui->priority), TRUE);
- gtk_table_attach_defaults (GTK_TABLE (ps), lbl, 0, 1, rows, rows + 1);
- gtk_table_attach_defaults (GTK_TABLE (ps), gui->priority, 1, 2, rows, rows + 1);
- gtk_widget_show (lbl);
- gtk_widget_show (gui->priority);
+ free_ToDo (&todo);
- return gui;
-}
-
-static void
-e_todo_gui_fill_widgets (EToDoConduitGui *gui, EToDoConduitCfg *cfg)
-{
- g_return_if_fail (gui != NULL);
- g_return_if_fail (cfg != NULL);
-
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (gui->priority), cfg->priority);
-}
-
-static void
-e_todo_gui_fill_config (EToDoConduitGui *gui, EToDoConduitCfg *cfg)
-{
- g_return_if_fail (gui != NULL);
- g_return_if_fail (cfg != NULL);
-
- cfg->priority = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (gui->priority));
-}
-
-static void
-e_todo_gui_destroy (EToDoConduitGui *gui)
-{
- g_free (gui);
+ return buff;
}
-/* Context */
-struct _EToDoConduitContext {
- GnomePilotDBInfo *dbi;
-
- EToDoConduitCfg *cfg;
- EToDoConduitCfg *new_cfg;
- EToDoConduitGui *gui;
- GtkWidget *ps;
-
- struct ToDoAppInfo ai;
-
- CalClient *client;
-
- icaltimezone *timezone;
- GList *uids;
- GList *changed;
- GHashTable *changed_hash;
- GList *locals;
-
- EPilotMap *map;
-};
-
+/* Context Routines */
static EToDoConduitContext *
e_todo_context_new (guint32 pilot_id)
{
EToDoConduitContext *ctxt = g_new0 (EToDoConduitContext, 1);
- ctxt->cfg = todoconduit_load_configuration (pilot_id);
- ctxt->new_cfg = todoconduit_dupe_configuration (ctxt->cfg);
- ctxt->gui = NULL;
- ctxt->ps = NULL;
+ todoconduit_load_configuration (&ctxt->cfg, pilot_id);
+
ctxt->client = NULL;
ctxt->uids = NULL;
ctxt->changed_hash = NULL;
@@ -297,12 +157,8 @@ e_todo_context_destroy (EToDoConduitContext *ctxt)
g_return_if_fail (ctxt != NULL);
if (ctxt->cfg != NULL)
- todoconduit_destroy_configuration (ctxt->cfg);
- if (ctxt->new_cfg != NULL)
- todoconduit_destroy_configuration (ctxt->new_cfg);
- if (ctxt->gui != NULL)
- e_todo_gui_destroy (ctxt->gui);
-
+ todoconduit_destroy_configuration (&ctxt->cfg);
+
if (ctxt->client != NULL)
gtk_object_unref (GTK_OBJECT (ctxt->client));
@@ -316,7 +172,7 @@ e_todo_context_destroy (EToDoConduitContext *ctxt)
if (ctxt->locals != NULL) {
for (l = ctxt->locals; l != NULL; l = l->next)
- todoconduit_destroy_record (l->data);
+ free_local (l->data);
g_list_free (ctxt->locals);
}
@@ -329,62 +185,6 @@ e_todo_context_destroy (EToDoConduitContext *ctxt)
g_free (ctxt);
}
-/* Debug routines */
-static char *
-print_local (EToDoLocalRecord *local)
-{
- static char buff[ 4096 ];
-
- if (local == NULL) {
- sprintf (buff, "[NULL]");
- return buff;
- }
-
- if (local->todo && local->todo->description) {
- g_snprintf (buff, 4096, "[%d %ld %d %d '%s' '%s']",
- local->todo->indefinite,
- mktime (& local->todo->due),
- local->todo->priority,
- local->todo->complete,
- local->todo->description ?
- local->todo->description : "",
- local->todo->note ?
- local->todo->note : "");
- return buff;
- }
-
- return "";
-}
-
-static char *print_remote (GnomePilotRecord *remote)
-{
- static char buff[ 4096 ];
- struct ToDo todo;
-
- if (remote == NULL) {
- sprintf (buff, "[NULL]");
- return buff;
- }
-
- memset (&todo, 0, sizeof (struct ToDo));
- unpack_ToDo (&todo, remote->record, remote->length);
-
- g_snprintf (buff, 4096, "[%d %ld %d %d '%s' '%s']",
- todo.indefinite,
- mktime (&todo.due),
- todo.priority,
- todo.complete,
- todo.description ?
- todo.description : "",
- todo.note ?
- todo.note : "");
-
- free_ToDo (&todo);
-
- return buff;
-}
-
-
/* Calendar Server routines */
static void
start_calendar_server_cb (CalClient *cal_client,
@@ -542,6 +342,15 @@ compute_status (EToDoConduitContext *ctxt, EToDoLocalRecord *local, const char *
}
}
+static void
+free_local (EToDoLocalRecord *local)
+{
+ gtk_object_unref (GTK_OBJECT (local->comp));
+ free_ToDo (local->todo);
+ g_free (local->todo);
+ g_free (local);
+}
+
static GnomePilotRecord
local_record_to_pilot_record (EToDoLocalRecord *local,
EToDoConduitContext *ctxt)
@@ -661,7 +470,7 @@ local_record_from_comp (EToDoLocalRecord *local, CalComponent *comp, EToDoCondui
cal_component_free_priority (priority);
} else {
- local->todo->priority = ctxt->cfg->priority;
+ local->todo->priority = 3;
}
cal_component_get_classification (comp, &classif);
@@ -1280,7 +1089,7 @@ free_match (GnomePilotConduitSyncAbs *conduit,
g_return_val_if_fail (local != NULL, -1);
- todoconduit_destroy_record (local);
+ free_local (local);
return 0;
}
@@ -1298,62 +1107,6 @@ prepare (GnomePilotConduitSyncAbs *conduit,
return 0;
}
-/* Pilot Settings Callbacks */
-static void
-fill_widgets (EToDoConduitContext *ctxt)
-{
- e_pilot_settings_set_secret (E_PILOT_SETTINGS (ctxt->ps),
- ctxt->cfg->secret);
-
- e_todo_gui_fill_widgets (ctxt->gui, ctxt->cfg);
-}
-
-static gint
-create_settings_window (GnomePilotConduit *conduit,
- GtkWidget *parent,
- EToDoConduitContext *ctxt)
-{
- LOG ("create_settings_window");
-
- ctxt->ps = e_pilot_settings_new ();
- ctxt->gui = e_todo_gui_new (E_PILOT_SETTINGS (ctxt->ps));
-
- gtk_container_add (GTK_CONTAINER (parent), ctxt->ps);
- gtk_widget_show (ctxt->ps);
-
- fill_widgets (ctxt);
-
- return 0;
-}
-static void
-display_settings (GnomePilotConduit *conduit, EToDoConduitContext *ctxt)
-{
- LOG ("display_settings");
-
- fill_widgets (ctxt);
-}
-
-static void
-save_settings (GnomePilotConduit *conduit, EToDoConduitContext *ctxt)
-{
- LOG ("save_settings");
-
- ctxt->new_cfg->secret = e_pilot_settings_get_secret (E_PILOT_SETTINGS (ctxt->ps));
- e_todo_gui_fill_config (ctxt->gui, ctxt->new_cfg);
-
- todoconduit_save_configuration (ctxt->new_cfg);
-}
-
-static void
-revert_settings (GnomePilotConduit *conduit, EToDoConduitContext *ctxt)
-{
- LOG ("revert_settings");
-
- todoconduit_save_configuration (ctxt->cfg);
- todoconduit_destroy_configuration (ctxt->new_cfg);
- ctxt->new_cfg = todoconduit_dupe_configuration (ctxt->cfg);
-}
-
static ORBit_MessageValidationResult
accept_all_cookies (CORBA_unsigned_long request_id,
CORBA_Principal *principal,
@@ -1413,12 +1166,6 @@ conduit_get_gpilot_conduit (guint32 pilot_id)
gtk_signal_connect (retval, "prepare", (GtkSignalFunc) prepare, ctxt);
- /* Gui Settings */
- gtk_signal_connect (retval, "create_settings_window", (GtkSignalFunc) create_settings_window, ctxt);
- gtk_signal_connect (retval, "display_settings", (GtkSignalFunc) display_settings, ctxt);
- gtk_signal_connect (retval, "save_settings", (GtkSignalFunc) save_settings, ctxt);
- gtk_signal_connect (retval, "revert_settings", (GtkSignalFunc) revert_settings, ctxt);
-
return GNOME_PILOT_CONDUIT (retval);
}
diff --git a/calendar/gui/Makefile.am b/calendar/gui/Makefile.am
index c58149c43d..1a7699b8d6 100644
--- a/calendar/gui/Makefile.am
+++ b/calendar/gui/Makefile.am
@@ -49,13 +49,16 @@ INCLUDES = \
-I$(top_builddir)/addressbook/backend/ebook \
-I$(top_srcdir)/widgets \
-I$(includedir) \
+ $(BONOBO_HTML_GNOME_CFLAGS) \
+ $(GNOME_VFS_CFLAGS) \
+ $(GAL_CFLAGS) \
+ $(BONOBO_CONF_CFLAGS) \
-DEVOLUTION_DATADIR=\""$(datadir)"\" \
-DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \
-DEVOLUTION_ETSPECDIR=\""$(etspecdir)"\" \
-DEVOLUTION_ICONSDIR=\""$(iconsdir)"\" \
-DEVOLUTION_LOCALEDIR=\""$(localedir)"\" \
- -DEVOLUTION_IMAGESDIR=\""$(datadir)"/images/evolution\" \
- $(EVOLUTION_CALENDAR_CFLAGS)
+ -DEVOLUTION_IMAGESDIR=\""$(datadir)"/images/evolution\"
iconsdir = $(datadir)/images/evolution
@@ -87,8 +90,6 @@ evolution_calendar_SOURCES = \
comp-editor-factory.h \
comp-util.c \
comp-util.h \
- config-control-factory.c \
- config-control-factory.h \
control-factory.c \
control-factory.h \
component-factory.c \
@@ -166,17 +167,23 @@ evolution_calendar_LDADD = \
$(top_builddir)/calendar/cal-client/libcal-client.la \
$(top_builddir)/calendar/cal-util/libcal-util.la \
$(top_builddir)/e-util/libeutil.la \
+ $(top_builddir)/libversit/libversit.la \
$(top_builddir)/libical/src/libical/libical-evolution.la \
$(top_builddir)/libwombat/libwombat.la \
$(top_builddir)/addressbook/backend/ebook/libebook.la \
$(top_builddir)/camel/libcamel.la \
$(top_builddir)/libibex/libibex.la \
- $(top_builddir)/libversit/libversit.a \
+ $(top_builddir)/libversit/libversit.la \
$(top_builddir)/e-util/ename/libename.la \
dialogs/libcal-dialogs.a \
$(top_builddir)/widgets/e-timezone-dialog/libetimezonedialog.a \
$(top_builddir)/widgets/misc/libemiscwidgets.a \
- $(EVOLUTION_CALENDAR_LIBS)
+ $(EXTRA_GNOME_LIBS) \
+ $(BONOBO_HTML_GNOME_LIBS) \
+ $(GNOME_VFS_LIBS) \
+ $(BONOBO_CONF_LIBS) \
+ $(GAL_LIBS) \
+ $(INTLLIBS)
evolution_calendar_LDFLAGS = -export-dynamic
diff --git a/calendar/gui/cal-search-bar.c b/calendar/gui/cal-search-bar.c
index 2483b2b126..329795c518 100644
--- a/calendar/gui/cal-search-bar.c
+++ b/calendar/gui/cal-search-bar.c
@@ -36,6 +36,12 @@
+/* Menu items for the ESearchBar */
+static ESearchBarItem search_menu_items[] = {
+ E_FILTERBAR_RESET,
+ { NULL, -1, NULL }
+};
+
/* IDs and option items for the ESearchBar */
enum {
SEARCH_ANY_FIELD_CONTAINS,
@@ -72,6 +78,7 @@ static void cal_search_bar_init (CalSearchBar *cal_search);
static void cal_search_bar_destroy (GtkObject *object);
static void cal_search_bar_search_activated (ESearchBar *search);
+static void cal_search_bar_menu_activated (ESearchBar *search, int item);
static ESearchBarClass *parent_class = NULL;
@@ -153,6 +160,7 @@ cal_search_bar_class_init (CalSearchBarClass *class)
class->category_changed = NULL;
e_search_bar_class->search_activated = cal_search_bar_search_activated;
+ e_search_bar_class->menu_activated = cal_search_bar_menu_activated;
object_class->destroy = cal_search_bar_destroy;
}
@@ -360,6 +368,28 @@ cal_search_bar_search_activated (ESearchBar *search)
regen_query (cal_search);
}
+/* menu_activated handler for the calendar search bar */
+static void
+cal_search_bar_menu_activated (ESearchBar *search, int item)
+{
+ CalSearchBar *cal_search;
+
+ cal_search = CAL_SEARCH_BAR (search);
+
+ switch (item) {
+ case E_FILTERBAR_RESET_ID:
+ notify_sexp_changed (cal_search, "#t"); /* match all */
+ /* FIXME: should we change the rest of the search bar so that
+ * the user sees that he selected "show all" instead of some
+ * type/text search combination?
+ */
+ break;
+
+ default:
+ g_assert_not_reached ();
+ }
+}
+
/* Creates the suboptions menu for the ESearchBar with the list of categories */
@@ -434,7 +464,7 @@ cal_search_bar_construct (CalSearchBar *cal_search)
g_return_val_if_fail (cal_search != NULL, NULL);
g_return_val_if_fail (IS_CAL_SEARCH_BAR (cal_search), NULL);
- e_search_bar_construct (E_SEARCH_BAR (cal_search), NULL, search_option_items);
+ e_search_bar_construct (E_SEARCH_BAR (cal_search), search_menu_items, search_option_items);
make_suboptions (cal_search);
e_search_bar_set_ids (E_SEARCH_BAR (cal_search), SEARCH_CATEGORY_IS, CATEGORIES_ALL);
diff --git a/calendar/gui/calendar-commands.c b/calendar/gui/calendar-commands.c
index 30a1654f1b..446c32a8a3 100644
--- a/calendar/gui/calendar-commands.c
+++ b/calendar/gui/calendar-commands.c
@@ -45,7 +45,6 @@
#include <libgnome/gnome-util.h>
#include <libgnome/gnome-i18n.h>
#include <bonobo/bonobo-ui-util.h>
-#include <bonobo/bonobo-exception.h>
#include <cal-util/timeutil.h>
#include "shell/Evolution.h"
#include "calendar-commands.h"
@@ -60,6 +59,9 @@
/* A list of all of the calendars started */
static GList *all_calendars = NULL;
+/* We have one global preferences dialog. */
+static CalPrefsDialog *preferences_dialog = NULL;
+
/* Focusing information for the calendar view. We have to keep track of this
* ourselves because with Bonobo controls, we may get unpaired focus_out events.
*/
@@ -68,6 +70,36 @@ typedef struct {
guint taskpad_focused : 1;
} FocusData;
+/* Callback for the new appointment command */
+static void
+new_appointment_cb (BonoboUIComponent *uic, gpointer data, const char *path)
+{
+ GnomeCalendar *gcal;
+
+ gcal = GNOME_CALENDAR (data);
+ gnome_calendar_new_appointment (gcal);
+}
+
+static void
+new_event_cb (BonoboUIComponent *uic, gpointer data, const char *path)
+{
+ GnomeCalendar *gcal;
+ time_t dtstart, dtend;
+
+ gcal = GNOME_CALENDAR (data);
+ gnome_calendar_get_current_time_range (gcal, &dtstart, &dtend);
+ gnome_calendar_new_appointment_for (gcal, dtstart, dtend, TRUE);
+}
+
+static void
+new_task_cb (BonoboUIComponent *uic, gpointer data, const char *path)
+{
+ GnomeCalendar *gcal;
+
+ gcal = GNOME_CALENDAR (data);
+ gnome_calendar_new_task (gcal);
+}
+
/* Prints the calendar at its current view and time range */
static void
print (GnomeCalendar *gcal, gboolean preview)
@@ -247,6 +279,15 @@ show_month_view_clicked (BonoboUIComponent *uic, gpointer data, const char *path
static void
+settings_cmd (BonoboUIComponent *uic, gpointer data, const char *path)
+{
+ if (!preferences_dialog)
+ preferences_dialog = cal_prefs_dialog_new (CAL_PREFS_DIALOG_PAGE_CALENDAR);
+ else
+ cal_prefs_dialog_show (preferences_dialog, CAL_PREFS_DIALOG_PAGE_CALENDAR);
+}
+
+static void
cut_cmd (BonoboUIComponent *uic, gpointer data, const gchar *path)
{
GnomeCalendar *gcal;
@@ -340,7 +381,7 @@ get_shell_view_interface (BonoboControl *control)
shell_view = Bonobo_Unknown_queryInterface (control_frame,
"IDL:GNOME/Evolution/ShellView:1.0",
&ev);
- if (BONOBO_EX (&ev)) {
+ if (ev._major != CORBA_NO_EXCEPTION) {
g_message ("get_shell_view_interface(): "
"Could not queryInterface() on the control frame");
shell_view = CORBA_OBJECT_NIL;
@@ -465,37 +506,12 @@ control_util_set_folder_bar_label (BonoboControl *control, char *label)
CORBA_exception_init (&ev);
GNOME_Evolution_ShellView_setFolderBarLabel (shell_view, label, &ev);
- if (BONOBO_EX (&ev))
+ if (ev._major != CORBA_NO_EXCEPTION)
g_message ("control_util_set_folder_bar_label(): Could not set the folder bar label");
CORBA_exception_free (&ev);
}
-void
-control_util_show_settings (GnomeCalendar *gcal)
-{
- BonoboControl *control;
- GNOME_Evolution_ShellView shell_view;
- CORBA_Environment ev;
-
- control = gtk_object_get_data (GTK_OBJECT (gcal), "control");
- if (control == NULL)
- return;
-
- shell_view = get_shell_view_interface (control);
- if (shell_view == CORBA_OBJECT_NIL)
- return;
-
- CORBA_exception_init (&ev);
-
- GNOME_Evolution_ShellView_showSettings (shell_view, &ev);
-
- if (BONOBO_EX (&ev))
- g_message ("control_util_show_settings(): Could not show settings");
-
- CORBA_exception_free (&ev);
-}
-
/* Sensitizes the UI Component menu/toolbar calendar commands based on the
* number of selected events. (This will always be 0 or 1 currently.) If enable
* is FALSE, all will be disabled. Otherwise, the currently-selected number of
@@ -652,6 +668,12 @@ static BonoboUIVerb verbs [] = {
BONOBO_UI_VERB ("CalendarPrint", file_print_cb),
BONOBO_UI_VERB ("CalendarPrintPreview", file_print_preview_cb),
+ BONOBO_UI_VERB ("CalendarNewAppointment", new_appointment_cb),
+ BONOBO_UI_VERB ("CalendarNewEvent", new_event_cb),
+ BONOBO_UI_VERB ("CalendarNewTask", new_task_cb),
+
+ BONOBO_UI_VERB ("CalendarSettings", settings_cmd),
+
BONOBO_UI_VERB ("Cut", cut_cmd),
BONOBO_UI_VERB ("Copy", copy_cmd),
BONOBO_UI_VERB ("Paste", paste_cmd),
@@ -675,7 +697,6 @@ static BonoboUIVerb verbs [] = {
static EPixmap pixmaps [] =
{
E_PIXMAP ("/menu/File/New/NewFirstItem/NewAppointment", "new_appointment.xpm"),
- E_PIXMAP ("/menu/File/New/NewFirstItem/NewMeeting", "meeting.xpm"),
E_PIXMAP ("/menu/File/New/NewFirstItem/NewTask", "new_task-16.png"),
E_PIXMAP ("/menu/EditPlaceholder/Edit/Cut", "16_cut.png"),
E_PIXMAP ("/menu/EditPlaceholder/Edit/Copy", "16_copy.png"),
@@ -683,6 +704,10 @@ static EPixmap pixmaps [] =
E_PIXMAP ("/menu/EditPlaceholder/Edit/Delete", "evolution-trash-mini.png"),
E_PIXMAP ("/menu/File/Print/Print", "print.xpm"),
E_PIXMAP ("/menu/File/Print/PrintPreview", "print-preview.xpm"),
+ E_PIXMAP ("/menu/ComponentActionsPlaceholder/Actions/NewAppointment", "new_appointment.xpm"),
+ E_PIXMAP ("/menu/ComponentActionsPlaceholder/Actions/NewEvent", "new_appointment.xpm"),
+ E_PIXMAP ("/menu/ComponentActionsPlaceholder/Actions/NewTask", "new_task-16.png"),
+ E_PIXMAP ("/menu/Tools/ComponentPlaceholder/CalendarSettings", "configure_16_calendar.xpm"),
E_PIXMAP ("/menu/View/ViewBegin/Goto", "goto-16.png"),
E_PIXMAP ("/Toolbar/New", "buttons/new_appointment.png"),
@@ -715,8 +740,6 @@ calendar_control_activate (BonoboControl *control,
bonobo_ui_component_set_container (uic, remote_uih);
bonobo_object_release_unref (remote_uih, NULL);
- gnome_calendar_set_ui_component (gcal, uic);
-
bonobo_ui_component_add_verb_list_with_data (uic, verbs, gcal);
bonobo_ui_component_freeze (uic, NULL);
@@ -762,13 +785,10 @@ void
calendar_control_deactivate (BonoboControl *control, GnomeCalendar *gcal)
{
FocusData *focus;
- BonoboUIComponent *uic;
- uic = bonobo_control_get_ui_component (control);
+ BonoboUIComponent *uic = bonobo_control_get_ui_component (control);
g_assert (uic != NULL);
- gnome_calendar_set_ui_component (gcal, uic);
-
focus = gtk_object_get_data (GTK_OBJECT (control), "focus_data");
g_assert (focus != NULL);
diff --git a/calendar/gui/calendar-config.c b/calendar/gui/calendar-config.c
index 0237766ea8..b2b7514b0a 100644
--- a/calendar/gui/calendar-config.c
+++ b/calendar/gui/calendar-config.c
@@ -45,6 +45,8 @@
typedef struct
{
+ gchar *default_uri;
+ gchar *default_tasks_uri;
gchar *timezone;
CalWeekdays working_days;
gboolean use_24_hour_format;
@@ -68,7 +70,6 @@ typedef struct
CalUnits hide_completed_tasks_units;
gint hide_completed_tasks_value;
gboolean confirm_delete;
- gboolean confirm_expunge;
gboolean use_default_reminder;
int default_reminder_interval;
CalUnits default_reminder_units;
@@ -127,6 +128,26 @@ config_read (void)
CORBA_exception_free (&ev);
+ CORBA_exception_init (&ev);
+ config->default_uri = bonobo_config_get_string (db,
+ "/Calendar/DefaultUri", &ev);
+ if (BONOBO_USER_EX (&ev, ex_Bonobo_ConfigDatabase_NotFound))
+ config->default_uri = NULL;
+ else if (BONOBO_EX (&ev))
+ g_message ("config_read(): Could not get the /Calendar/DefaultUri");
+
+ CORBA_exception_free (&ev);
+
+ CORBA_exception_init (&ev);
+ config->default_tasks_uri = bonobo_config_get_string (db,
+ "/Calendar/DefaultTasksUri", &ev);
+ if (BONOBO_USER_EX (&ev, ex_Bonobo_ConfigDatabase_NotFound))
+ config->default_tasks_uri = NULL;
+ else if (BONOBO_EX (&ev))
+ g_message ("config_read(): Could not get the /Calendar/DefaultTasksUri");
+
+ CORBA_exception_free (&ev);
+
/* Default to UTC if the timezone is not set or is "". */
config->timezone = bonobo_config_get_string_with_default (db,
"/Calendar/Display/Timezone", "UTC", NULL);
@@ -225,8 +246,6 @@ config_read (void)
/* Confirmation */
config->confirm_delete = bonobo_config_get_boolean_with_default (
db, "/Calendar/Other/ConfirmDelete", TRUE, NULL);
- config->confirm_expunge = bonobo_config_get_boolean_with_default (
- db, "/Calendar/Other/ConfirmExpunge", TRUE, NULL);
/* Default reminders */
config->use_default_reminder = bonobo_config_get_boolean_with_default (
@@ -287,6 +306,14 @@ calendar_config_write (void)
return;
}
+ if (config->default_uri)
+ bonobo_config_set_string (db, "/Calendar/DefaultUri",
+ config->default_uri, NULL);
+
+ if (config->default_tasks_uri)
+ bonobo_config_set_string (db, "/Calendar/DefaultTasksUri",
+ config->default_tasks_uri, NULL);
+
if (config->timezone)
bonobo_config_set_string (db, "/Calendar/Display/Timezone",
config->timezone, NULL);
@@ -331,7 +358,6 @@ calendar_config_write (void)
config->hide_completed_tasks_value, NULL);
bonobo_config_set_boolean (db, "/Calendar/Other/ConfirmDelete", config->confirm_delete, NULL);
- bonobo_config_set_boolean (db, "/Calendar/Other/ConfirmExpunge", config->confirm_expunge, NULL);
bonobo_config_set_boolean (db, "/Calendar/Other/UseDefaultReminder",
config->use_default_reminder, NULL);
@@ -377,9 +403,6 @@ calendar_config_write_on_exit (void)
bonobo_config_set_float (db, "/Calendar/Display/MonthVPanePosition",
config->month_vpane_pos, NULL);
- bonobo_config_set_boolean (db, "/Calendar/Other/ConfirmExpunge",
- config->confirm_expunge, NULL);
-
Bonobo_ConfigDatabase_sync (db, &ev);
bonobo_object_release_unref (db, NULL);
@@ -392,6 +415,62 @@ calendar_config_write_on_exit (void)
* Calendar Settings.
*/
+/* The default URI is the one that will be used in places where there
+ might be some action on a calendar from outside, such as adding
+ a meeting request. */
+gchar *
+calendar_config_get_default_uri (void)
+{
+ static gchar *default_uri = NULL;
+
+ if (config->default_uri)
+ return config->default_uri;
+
+ if (!default_uri)
+ default_uri = g_strdup_printf ("%s/evolution/local/Calendar/calendar.ics",
+ g_get_home_dir ());
+
+ return default_uri;
+}
+
+/* Sets the default calendar URI */
+void
+calendar_config_set_default_uri (gchar *default_uri)
+{
+ g_free (config->default_uri);
+
+ if (default_uri && default_uri[0])
+ config->default_uri = g_strdup (default_uri);
+ else
+ config->default_uri = NULL;
+}
+
+gchar *
+calendar_config_get_default_tasks_uri (void)
+{
+ static gchar *default_tasks_uri = NULL;
+
+ if (config->default_tasks_uri)
+ return config->default_tasks_uri;
+
+ if (!default_tasks_uri)
+ default_tasks_uri = g_strdup_printf ("%s/evolution/local/Tasks/tasks.ics",
+ g_get_home_dir ());
+
+ return default_tasks_uri;
+}
+
+void
+calendar_config_set_default_tasks_uri (gchar *default_tasks_uri)
+{
+ g_free (config->default_tasks_uri);
+
+ if (default_tasks_uri && default_tasks_uri[0])
+ config->default_tasks_uri = g_strdup (default_tasks_uri);
+ else
+ config->default_tasks_uri = NULL;
+}
+
/* The current timezone, e.g. "Europe/London". It may be NULL, in which case
you should assume UTC (though Evolution will show the timezone-setting
dialog the next time a calendar or task folder is selected). */
@@ -719,32 +798,6 @@ calendar_config_set_confirm_delete (gboolean confirm)
config->confirm_delete = confirm;
}
-/**
- * calendar_config_get_confirm_expunge:
- *
- * Queries the configuration value for whether a confirmation dialog is
- * presented when expunging calendar/tasks items.
- *
- * Return value: Whether confirmation is required when expunging items.
- **/
-gboolean
-calendar_config_get_confirm_expunge (void)
-{
- return config->confirm_expunge;
-}
-
-/**
- * calendar_config_set_confirm_expunge:
- * @confirm: Whether confirmation is required when expunging items.
- *
- * Sets the configuration value for whether a confirmation dialog is presented
- * when expunging calendar/tasks items.
- **/
-void
-calendar_config_set_confirm_expunge (gboolean confirm)
-{
- config->confirm_expunge = confirm;
-}
/* This sets all the common config settings for an ECalendar widget.
These are the week start day, and whether we show week numbers. */
diff --git a/calendar/gui/calendar-model.c b/calendar/gui/calendar-model.c
index e8317402ac..f2b9d8b428 100644
--- a/calendar/gui/calendar-model.c
+++ b/calendar/gui/calendar-model.c
@@ -1891,7 +1891,7 @@ query_query_done_cb (CalQuery *query, CalQueryDoneStatus status, const char *err
calendar_model_set_status_message (model, NULL);
if (status != CAL_QUERY_DONE_SUCCESS)
- g_warning ("query done: %s\n", error_str);
+ fprintf (stderr, "query done: %s\n", error_str);
}
/* Callback used when an evaluation error occurs when running a query */
@@ -1906,7 +1906,7 @@ query_eval_error_cb (CalQuery *query, const char *error_str, gpointer data)
calendar_model_set_status_message (model, NULL);
- g_warning ("eval error: %s\n", error_str);
+ fprintf (stderr, "eval error: %s\n", error_str);
}
/* Builds a complete query sexp for the calendar model by adding the predicates
@@ -1987,7 +1987,6 @@ update_query (CalendarModel *model)
if (!priv->query) {
g_message ("update_query(): Could not create the query");
- calendar_model_set_status_message (model, NULL);
return;
}
diff --git a/calendar/gui/control-factory.c b/calendar/gui/control-factory.c
index a17790f197..9f0a17c999 100644
--- a/calendar/gui/control-factory.c
+++ b/calendar/gui/control-factory.c
@@ -37,11 +37,9 @@
#include "control-factory.h"
-#define PROPERTY_CALENDAR_URI "folder_uri"
-#define PROPERTY_CALENDAR_URI_IDX 1
+#define PROPERTY_CALENDAR_URI "folder_uri"
-#define PROPERTY_CALENDAR_VIEW "view"
-#define PROPERTY_CALENDAR_VIEW_IDX 2
+#define PROPERTY_CALENDAR_URI_IDX 1
#define CONTROL_FACTORY_ID "OAFIID:GNOME_Evolution_Calendar_ControlFactory"
@@ -71,7 +69,7 @@ get_prop (BonoboPropertyBag *bag,
gpointer user_data)
{
GnomeCalendar *gcal = user_data;
- const char *uri;
+ char *uri;
switch (arg_id) {
@@ -80,23 +78,6 @@ get_prop (BonoboPropertyBag *bag,
BONOBO_ARG_SET_STRING (arg, uri);
break;
- case PROPERTY_CALENDAR_VIEW_IDX:
- switch (gnome_calendar_get_view (gcal)) {
- case GNOME_CAL_DAY_VIEW:
- BONOBO_ARG_SET_STRING (arg, "day");
- break;
- case GNOME_CAL_WEEK_VIEW:
- BONOBO_ARG_SET_STRING (arg, "week");
- break;
- case GNOME_CAL_WORK_WEEK_VIEW:
- BONOBO_ARG_SET_STRING (arg, "workweek");
- break;
- case GNOME_CAL_MONTH_VIEW:
- BONOBO_ARG_SET_STRING (arg, "month");
- break;
- }
- break;
-
default:
g_warning ("Unhandled arg %d\n", arg_id);
}
@@ -111,16 +92,15 @@ set_prop (BonoboPropertyBag *bag,
gpointer user_data)
{
GnomeCalendar *gcal = user_data;
- char *string;
- GnomeCalendarViewType view;
+ char *uri;
switch (arg_id) {
case PROPERTY_CALENDAR_URI_IDX:
- string = BONOBO_ARG_GET_STRING (arg);
- if (!gnome_calendar_open (gcal, string)) {
+ uri = BONOBO_ARG_GET_STRING (arg);
+ if (!gnome_calendar_open (gcal, uri)) {
char *msg;
- msg = g_strdup_printf (_("Could not open the folder in '%s'"), string);
+ msg = g_strdup_printf (_("Could not open the folder in '%s'"), uri);
gnome_error_dialog_parented (
msg,
GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (gcal))));
@@ -128,23 +108,6 @@ set_prop (BonoboPropertyBag *bag,
}
break;
- case PROPERTY_CALENDAR_VIEW_IDX:
- string = BONOBO_ARG_GET_STRING (arg);
- if (!g_strcasecmp (string, "week"))
- view = GNOME_CAL_WEEK_VIEW;
- else if (!g_strcasecmp (string, "workweek"))
- view = GNOME_CAL_WORK_WEEK_VIEW;
- else if (!g_strcasecmp (string, "month"))
- view = GNOME_CAL_MONTH_VIEW;
- else
- view = GNOME_CAL_DAY_VIEW;
-
- /* This doesn't actually work, because the GalView
- * comes along and resets the view. FIXME.
- */
- gnome_calendar_set_view (gcal, view, FALSE, TRUE);
- break;
-
default:
g_warning ("Unhandled arg %d\n", arg_id);
break;
@@ -166,13 +129,6 @@ calendar_properties_init (GnomeCalendar *gcal, BonoboControl *control)
NULL,
_("The URI that the calendar will display"),
0);
- bonobo_property_bag_add (pbag,
- PROPERTY_CALENDAR_VIEW,
- PROPERTY_CALENDAR_VIEW_IDX,
- BONOBO_ARG_STRING,
- NULL,
- _("The type of view to show"),
- 0);
bonobo_control_set_properties (control, pbag);
bonobo_object_unref (BONOBO_OBJECT (pbag));
@@ -203,7 +159,7 @@ control_factory_init (void)
factory = bonobo_generic_factory_new (CONTROL_FACTORY_ID, control_factory_fn, NULL);
bonobo_running_context_auto_exit_unref (BONOBO_OBJECT (factory));
-
+
if (factory == NULL)
g_error ("I could not register a Calendar control factory.");
}
@@ -253,7 +209,6 @@ control_factory_new_control (void)
g_message ("control_factory_fn(): could not create the control!");
return NULL;
}
- gtk_object_set_data (GTK_OBJECT (gcal), "control", control);
calendar_properties_init (gcal, control);
#if 0
diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c
index cad55ebf08..00584c51de 100644
--- a/calendar/gui/dialogs/comp-editor.c
+++ b/calendar/gui/dialogs/comp-editor.c
@@ -26,19 +26,15 @@
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
-#include <glib.h>
-#include <gdk/gdkkeysyms.h>
-#include <libgnome/gnome-defs.h>
-#include <libgnome/gnome-i18n.h>
-#include <libgnomeui/gnome-uidefs.h>
-#include <libgnomeui/gnome-dialog.h>
-#include <libgnomeui/gnome-dialog-util.h>
-#include <libgnomeui/gnome-stock.h>
-#include <libgnomeui/gnome-window-icon.h>
+#include <gnome.h>
+#include <bonobo/bonobo-win.h>
+#include <bonobo/bonobo-ui-component.h>
#include <bonobo/bonobo-ui-container.h>
#include <bonobo/bonobo-ui-util.h>
#include <gal/widgets/e-unicode.h>
-#include <e-util/e-dialog-utils.h>
+#include <libgnomeui/gnome-dialog.h>
+#include <libgnomeui/gnome-dialog-util.h>
+#include <libgnomeui/gnome-window-icon.h>
#include <evolution-shell-component-utils.h>
#include "../print.h"
#include "save-comp.h"
@@ -60,7 +56,8 @@ struct _CompEditorPrivate {
/* The pages we have */
GList *pages;
- /* UI Component for the dialog */
+ /* Toplevel window for the dialog */
+ GtkWidget *window;
BonoboUIComponent *uic;
/* Notebook to hold the pages */
@@ -70,7 +67,6 @@ struct _CompEditorPrivate {
gboolean changed;
gboolean needs_send;
- gboolean needs_send_new;
gboolean updating;
};
@@ -78,17 +74,16 @@ struct _CompEditorPrivate {
static void comp_editor_class_init (CompEditorClass *class);
static void comp_editor_init (CompEditor *editor);
-static gint comp_editor_key_press_event (GtkWidget *d, GdkEventKey *e);
static void comp_editor_destroy (GtkObject *object);
static void real_set_cal_client (CompEditor *editor, CalClient *client);
static void real_edit_comp (CompEditor *editor, CalComponent *comp);
static void real_send_comp (CompEditor *editor, CalComponentItipMethod method);
-static gboolean prompt_to_save_changes (CompEditor *editor, gboolean send);
static void delete_comp (CompEditor *editor);
static void close_dialog (CompEditor *editor);
static void page_changed_cb (GtkObject *obj, gpointer data);
+static void page_needs_send_cb (GtkObject *obj, gpointer data);
static void page_summary_changed_cb (GtkObject *obj, const char *summary, gpointer data);
static void page_dates_changed_cb (GtkObject *obj, CompEditorPageDates *dates, gpointer data);
@@ -137,6 +132,8 @@ static BonoboUIVerb verbs [] = {
BONOBO_UI_VERB_END
};
+#define CLASS(page) (COMP_EDITOR_CLASS (GTK_OBJECT (page)->klass))
+
static GtkObjectClass *parent_class;
@@ -158,7 +155,7 @@ comp_editor_get_type (void)
(GtkClassInitFunc) NULL
};
- comp_editor_type = gtk_type_unique (BONOBO_TYPE_WINDOW,
+ comp_editor_type = gtk_type_unique (GTK_TYPE_OBJECT,
&comp_editor_info);
}
@@ -170,18 +167,15 @@ static void
comp_editor_class_init (CompEditorClass *klass)
{
GtkObjectClass *object_class;
- GtkWidgetClass *widget_class;
- object_class = GTK_OBJECT_CLASS (klass);
- widget_class = GTK_WIDGET_CLASS (klass);
+ object_class = (GtkObjectClass *) klass;
- parent_class = gtk_type_class (BONOBO_TYPE_WINDOW);
+ parent_class = gtk_type_class (GTK_TYPE_OBJECT);
klass->set_cal_client = real_set_cal_client;
klass->edit_comp = real_edit_comp;
klass->send_comp = real_send_comp;
- widget_class->key_press_event = comp_editor_key_press_event;
object_class->destroy = comp_editor_destroy;
}
@@ -196,16 +190,15 @@ setup_widgets (CompEditor *editor)
priv = editor->priv;
/* Window and basic vbox */
- bonobo_window_construct (BONOBO_WINDOW (editor),
- "event-editor", "iCalendar Editor");
- gtk_signal_connect (GTK_OBJECT (editor), "delete_event",
+ priv->window = bonobo_window_new ("event-editor", "iCalendar Editor");
+ gtk_signal_connect (GTK_OBJECT (priv->window), "delete_event",
GTK_SIGNAL_FUNC (delete_event_cb), editor);
priv->uic = bonobo_ui_component_new_default ();
container = bonobo_ui_container_new ();
- bonobo_ui_container_set_win (container, BONOBO_WINDOW (editor));
+ bonobo_ui_container_set_win (container, BONOBO_WINDOW (priv->window));
bonobo_ui_component_set_container (priv->uic, BONOBO_OBJREF (container));
- bonobo_ui_engine_config_set_path (bonobo_window_get_ui_engine (BONOBO_WINDOW (editor)),
+ bonobo_ui_engine_config_set_path (bonobo_window_get_ui_engine (BONOBO_WINDOW (priv->window)),
"/evolution/UIConf/kvps");
bonobo_ui_component_add_verb_list_with_data (priv->uic, verbs, editor);
@@ -217,7 +210,7 @@ setup_widgets (CompEditor *editor)
vbox = gtk_vbox_new (FALSE, GNOME_PAD_SMALL);
gtk_widget_show (vbox);
gtk_container_set_border_width (GTK_CONTAINER (vbox), GNOME_PAD_SMALL);
- bonobo_window_set_contents (BONOBO_WINDOW (editor), vbox);
+ bonobo_window_set_contents (BONOBO_WINDOW (priv->window), vbox);
/* Notebook */
priv->notebook = GTK_NOTEBOOK (gtk_notebook_new ());
@@ -240,23 +233,6 @@ comp_editor_init (CompEditor *editor)
priv->pages = NULL;
priv->changed = FALSE;
priv->needs_send = FALSE;
- priv->needs_send_new = FALSE;
-}
-
-
-static gint
-comp_editor_key_press_event (GtkWidget *d, GdkEventKey *e)
-{
- if (e->keyval == GDK_Escape) {
- if (prompt_to_save_changes (COMP_EDITOR (d), TRUE))
- close_dialog (COMP_EDITOR (d));
- return TRUE;
- }
-
- if (GTK_WIDGET_CLASS (parent_class)->key_press_event)
- return (* GTK_WIDGET_CLASS (parent_class)->key_press_event) (d, e);
-
- return FALSE;
}
/* Destroy handler for the calendar component editor */
@@ -272,6 +248,11 @@ comp_editor_destroy (GtkObject *object)
gtk_signal_disconnect_by_data (GTK_OBJECT (priv->client), editor);
+ if (priv->window) {
+ gtk_widget_destroy (priv->window);
+ priv->window = NULL;
+ }
+
/* We want to destroy the pages after the widgets get destroyed,
since they have lots of signal handlers connected to the widgets
with the pages as the data. */
@@ -345,7 +326,7 @@ save_comp_with_send (CompEditor *editor)
if (!save_comp (editor))
return FALSE;
- if (send && send_component_dialog (priv->comp, priv->needs_send_new))
+ if (send && send_component_dialog (priv->comp))
comp_editor_send_comp (editor, CAL_COMPONENT_METHOD_REQUEST);
return TRUE;
@@ -376,7 +357,7 @@ prompt_to_save_changes (CompEditor *editor, gboolean send)
if (!priv->changed)
return TRUE;
- switch (save_component_dialog (GTK_WINDOW (editor))) {
+ switch (save_component_dialog (GTK_WINDOW (priv->window))) {
case 0: /* Save */
if (send && save_comp_with_send (editor))
return TRUE;
@@ -400,6 +381,8 @@ close_dialog (CompEditor *editor)
priv = editor->priv;
+ g_assert (priv->window != NULL);
+
gtk_object_destroy (GTK_OBJECT (editor));
}
@@ -555,6 +538,8 @@ comp_editor_append_page (CompEditor *editor,
gtk_notebook_append_page (priv->notebook, page_widget, label_widget);
/* Listen for things happening on the page */
+ gtk_signal_connect (GTK_OBJECT (page), "needs_send",
+ GTK_SIGNAL_FUNC (page_needs_send_cb), editor);
gtk_signal_connect (GTK_OBJECT (page), "changed",
GTK_SIGNAL_FUNC (page_changed_cb), editor);
gtk_signal_connect (GTK_OBJECT (page), "summary_changed",
@@ -750,7 +735,7 @@ set_title_from_comp (CompEditor *editor)
priv = editor->priv;
title = make_title_from_comp (priv->comp);
- gtk_window_set_title (GTK_WINDOW (editor), title);
+ gtk_window_set_title (GTK_WINDOW (priv->window), title);
g_free (title);
}
@@ -762,7 +747,7 @@ set_icon_from_comp (CompEditor *editor)
priv = editor->priv;
file = make_icon_from_comp (priv->comp);
- gnome_window_icon_set_from_file (GTK_WINDOW (editor), file);
+ gnome_window_icon_set_from_file (GTK_WINDOW (priv->window), file);
}
static void
@@ -835,8 +820,6 @@ real_edit_comp (CompEditor *editor, CalComponent *comp)
if (comp)
priv->comp = cal_component_clone (comp);
- priv->needs_send_new = !priv->needs_send;
-
set_title_from_comp (editor);
set_icon_from_comp (editor);
fill_widgets (editor);
@@ -1019,8 +1002,8 @@ comp_editor_focus (CompEditor *editor)
priv = editor->priv;
- gtk_widget_show (GTK_WIDGET (editor));
- raise_and_focus (GTK_WIDGET (editor));
+ gtk_widget_show (priv->window);
+ raise_and_focus (priv->window);
}
/* This sets the focus to the toplevel, so any field being edited is committed.
@@ -1033,7 +1016,7 @@ commit_all_fields (CompEditor *editor)
priv = editor->priv;
- gtk_window_set_focus (GTK_WINDOW (editor), NULL);
+ gtk_window_set_focus (GTK_WINDOW (priv->window), NULL);
}
/* Menu Commands */
@@ -1059,37 +1042,89 @@ save_close_cmd (GtkWidget *widget, gpointer data)
}
static void
-save_as_cmd (GtkWidget *widget, gpointer data)
+save_as_ok (GtkWidget *widget, gpointer data)
{
CompEditor *editor = COMP_EDITOR (data);
CompEditorPrivate *priv;
- char *filename;
- char *ical_string;
- FILE *file;
-
+ struct stat s;
+ char *path;
+ int ret = 0;
+
priv = editor->priv;
- commit_all_fields (editor);
+ path = gtk_file_selection_get_filename (GTK_FILE_SELECTION (priv->filesel));
- filename = e_file_dialog_save (_("Save as..."));
- if (filename == NULL)
- return;
-
- ical_string = cal_client_get_component_as_string (priv->client, priv->comp);
- if (ical_string == NULL) {
- g_warning ("Couldn't convert item to a string");
- return;
+ if (stat (path, &s) == 0) {
+ GtkWidget *dlg;
+ GtkWidget *text;
+
+ dlg = gnome_dialog_new (_("Overwrite file?"),
+ GNOME_STOCK_BUTTON_YES,
+ GNOME_STOCK_BUTTON_NO,
+ NULL);
+ text = gtk_label_new (_("A file by that name already exists.\nOverwrite it?"));
+ gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dlg)->vbox), text, TRUE, TRUE, 4);
+ gtk_window_set_policy (GTK_WINDOW (dlg), FALSE, TRUE, FALSE);
+ gtk_widget_show (text);
+
+ ret = gnome_dialog_run_and_close (GNOME_DIALOG (dlg));
}
-
- file = fopen (filename, "w");
- if (file == NULL) {
- g_warning ("Couldn't save item");
- return;
+
+ if (ret == 0) {
+ FILE *file;
+ gchar *ical_string;
+
+ ical_string = cal_client_get_component_as_string (priv->client, priv->comp);
+ if (ical_string == NULL) {
+ g_warning ("Couldn't convert item to a string");
+ gtk_main_quit ();
+ return;
+ }
+
+ file = fopen (path, "w");
+ if (file == NULL) {
+ g_warning ("Couldn't save item");
+ gtk_main_quit ();
+ return;
+ }
+
+ fprintf (file, ical_string);
+ g_free (ical_string);
+ fclose (file);
+
+ gtk_main_quit ();
}
-
- fprintf (file, ical_string);
- g_free (ical_string);
- fclose (file);
+}
+
+static void
+save_as_cmd (GtkWidget *widget, gpointer data)
+{
+ CompEditor *editor = COMP_EDITOR (data);
+ CompEditorPrivate *priv;
+ GtkFileSelection *fs;
+ char *path;
+
+ priv = editor->priv;
+
+ commit_all_fields (editor);
+
+ fs = GTK_FILE_SELECTION (gtk_file_selection_new (_("Save As...")));
+ path = g_strdup_printf ("%s/", g_get_home_dir ());
+ gtk_file_selection_set_filename (fs, path);
+ g_free (path);
+
+ gtk_signal_connect (GTK_OBJECT (fs->ok_button), "clicked",
+ GTK_SIGNAL_FUNC (save_as_ok), editor);
+ gtk_signal_connect (GTK_OBJECT (fs->cancel_button), "clicked",
+ GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
+
+ priv->filesel = GTK_WIDGET (fs);
+ gtk_widget_show (priv->filesel);
+ gtk_grab_add (priv->filesel);
+ gtk_main ();
+
+ gtk_widget_destroy (priv->filesel);
+ priv->filesel = NULL;
}
static void
@@ -1103,7 +1138,7 @@ delete_cmd (GtkWidget *widget, gpointer data)
vtype = cal_component_get_vtype (priv->comp);
- if (delete_component_dialog (priv->comp, FALSE, 1, vtype, GTK_WIDGET (editor)))
+ if (delete_component_dialog (priv->comp, FALSE, 1, vtype, priv->window))
delete_comp (editor);
}
@@ -1166,6 +1201,17 @@ page_changed_cb (GtkObject *obj, gpointer data)
priv->changed = TRUE;
}
+static void
+page_needs_send_cb (GtkObject *obj, gpointer data)
+{
+ CompEditor *editor = COMP_EDITOR (data);
+ CompEditorPrivate *priv;
+
+ priv = editor->priv;
+
+ priv->needs_send = TRUE;
+}
+
/* Page signal callbacks */
static void
page_summary_changed_cb (GtkObject *obj, const char *summary, gpointer data)
diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c
index 4c0862c9f7..3531ac02d3 100644
--- a/calendar/gui/dialogs/event-editor.c
+++ b/calendar/gui/dialogs/event-editor.c
@@ -353,8 +353,9 @@ event_editor_new (void)
}
static void
-show_meeting (EventEditor *ee)
+schedule_meeting_cmd (GtkWidget *widget, gpointer data)
{
+ EventEditor *ee = EVENT_EDITOR (data);
EventEditorPrivate *priv;
priv = ee->priv;
@@ -377,24 +378,6 @@ show_meeting (EventEditor *ee)
COMP_EDITOR_PAGE (priv->meet_page));
}
-void
-event_editor_show_meeting (EventEditor *ee)
-{
- g_return_if_fail (ee != NULL);
- g_return_if_fail (IS_EVENT_EDITOR (ee));
-
-
- show_meeting (ee);
-}
-
-static void
-schedule_meeting_cmd (GtkWidget *widget, gpointer data)
-{
- EventEditor *ee = EVENT_EDITOR (data);
-
- show_meeting (ee);
-}
-
static void
refresh_meeting_cmd (GtkWidget *widget, gpointer data)
{
diff --git a/calendar/gui/dialogs/meeting-page.c b/calendar/gui/dialogs/meeting-page.c
index 2504ed3993..7333380195 100644
--- a/calendar/gui/dialogs/meeting-page.c
+++ b/calendar/gui/dialogs/meeting-page.c
@@ -698,12 +698,14 @@ enum {
static EPopupMenu context_menu[] = {
#if 0
- E_POPUP_ITEM (N_("_Delegate To..."), GTK_SIGNAL_FUNC (popup_delegate_cb), CAN_DELEGATE),
+ { N_("_Delegate To..."), NULL,
+ GTK_SIGNAL_FUNC (popup_delegate_cb),NULL, CAN_DELEGATE },
E_POPUP_SEPARATOR,
#endif
- E_POPUP_ITEM (N_("_Delete"), GTK_SIGNAL_FUNC (popup_delete_cb), CAN_DELETE),
+ { N_("_Delete"), GNOME_STOCK_MENU_TRASH,
+ GTK_SIGNAL_FUNC (popup_delete_cb), NULL, CAN_DELETE },
E_POPUP_TERMINATOR
};
@@ -721,10 +723,7 @@ right_click_cb (ETable *etable, gint row, gint col, GdkEvent *event, gpointer da
view_row = e_table_model_to_view_row (etable, row);
priv->row = e_meeting_model_etable_view_to_model_row (etable, priv->model, view_row);
-
- /* FIXME: if you enable Delegate, then change index to '1' */
- context_menu[0].pixmap_widget = gnome_stock_new_with_icon (GNOME_STOCK_MENU_TRASH);
-
+
menu = e_popup_menu_create (context_menu, enable_mask, hide_mask, data);
e_auto_kill_popup_menu_on_hide (menu);
diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c
index 1ede12fff3..c5c4d61826 100644
--- a/calendar/gui/dialogs/task-editor.c
+++ b/calendar/gui/dialogs/task-editor.c
@@ -42,7 +42,7 @@ struct _TaskEditorPrivate {
EMeetingModel *model;
- gboolean assignment_shown;
+ gboolean meeting_shown;
gboolean existing_org;
gboolean updating;
};
@@ -134,7 +134,7 @@ set_menu_sens (TaskEditor *te)
priv = te->priv;
- sens = priv->assignment_shown;
+ sens = priv->meeting_shown;
comp_editor_set_ui_prop (COMP_EDITOR (te),
"/commands/ActionAssignTask",
"sensitive", sens ? "0" : "1");
@@ -191,7 +191,7 @@ task_editor_init (TaskEditor *te)
comp_editor_merge_ui (COMP_EDITOR (te), "evolution-task-editor.xml", verbs);
- priv->assignment_shown = TRUE;
+ priv->meeting_shown = TRUE;
priv->existing_org = FALSE;
priv->updating = FALSE;
@@ -217,11 +217,11 @@ task_editor_edit_comp (CompEditor *editor, CalComponent *comp)
e_meeting_model_remove_all_attendees (priv->model);
if (attendees == NULL) {
comp_editor_remove_page (editor, COMP_EDITOR_PAGE (priv->meet_page));
- priv->assignment_shown = FALSE;
+ priv->meeting_shown = FALSE;
} else {
GSList *l;
- if (!priv->assignment_shown)
+ if (!priv->meeting_shown)
comp_editor_append_page (COMP_EDITOR (te),
COMP_EDITOR_PAGE (priv->meet_page),
_("Assignment"));
@@ -233,12 +233,12 @@ task_editor_edit_comp (CompEditor *editor, CalComponent *comp)
e_meeting_model_add_attendee (priv->model, ia);
gtk_object_unref (GTK_OBJECT (ia));
}
- priv->assignment_shown = TRUE;
+ priv->meeting_shown = TRUE;
}
cal_component_free_attendee_list (attendees);
set_menu_sens (te);
- comp_editor_set_needs_send (COMP_EDITOR (te), priv->assignment_shown);
+ comp_editor_set_needs_send (COMP_EDITOR (te), priv->meeting_shown);
priv->updating = FALSE;
@@ -312,44 +312,27 @@ task_editor_new (void)
}
static void
-show_assignment (TaskEditor *te)
+assign_task_cmd (GtkWidget *widget, gpointer data)
{
+ TaskEditor *te = TASK_EDITOR (data);
TaskEditorPrivate *priv;
priv = te->priv;
- if (!priv->assignment_shown) {
+ if (!priv->meeting_shown) {
comp_editor_append_page (COMP_EDITOR (te),
COMP_EDITOR_PAGE (priv->meet_page),
_("Assignment"));
- priv->assignment_shown = TRUE;
+ priv->meeting_shown = TRUE;
set_menu_sens (te);
- comp_editor_set_needs_send (COMP_EDITOR (te), priv->assignment_shown);
- comp_editor_set_changed (COMP_EDITOR (te), TRUE);
+ comp_editor_set_needs_send (COMP_EDITOR (te), priv->meeting_shown);
}
comp_editor_show_page (COMP_EDITOR (te),
COMP_EDITOR_PAGE (priv->meet_page));
}
-void
-task_editor_show_assignment (TaskEditor *te)
-{
- g_return_if_fail (te != NULL);
- g_return_if_fail (IS_TASK_EDITOR (te));
-
- show_assignment (te);
-}
-
-static void
-assign_task_cmd (GtkWidget *widget, gpointer data)
-{
- TaskEditor *te = TASK_EDITOR (data);
-
- show_assignment (te);
-}
-
static void
refresh_task_cmd (GtkWidget *widget, gpointer data)
{
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index 4f73dccd55..fc03a044c1 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -46,12 +46,10 @@
#include <gal/widgets/e-unicode.h>
#include <libgnomeui/gnome-canvas-rect-ellipse.h>
#include <libgnome/gnome-i18n.h>
-#include <e-util/e-dialog-utils.h>
#include "cal-util/timeutil.h"
#include "dialogs/delete-comp.h"
#include "dialogs/send-comp.h"
-#include "print.h"
#include "comp-util.h"
#include "itip-utils.h"
#include "calendar-commands.h"
@@ -333,30 +331,12 @@ static void e_day_view_on_new_appointment (GtkWidget *widget,
gpointer data);
static void e_day_view_on_new_event (GtkWidget *widget,
gpointer data);
-static void e_day_view_on_new_meeting (GtkWidget *widget,
- gpointer data);
-static void e_day_view_on_new_task (GtkWidget *widget,
- gpointer data);
static void e_day_view_on_goto_today (GtkWidget *widget,
gpointer data);
static void e_day_view_on_goto_date (GtkWidget *widget,
gpointer data);
static void e_day_view_on_edit_appointment (GtkWidget *widget,
gpointer data);
-static void e_day_view_on_save_as (GtkWidget *widget,
- gpointer data);
-static void e_day_view_on_print (GtkWidget *widget,
- gpointer data);
-static void e_day_view_on_print_event (GtkWidget *widget,
- gpointer data);
-static void e_day_view_on_meeting (GtkWidget *widget,
- gpointer data);
-static void e_day_view_on_forward (GtkWidget *widget,
- gpointer data);
-static void e_day_view_on_publish (GtkWidget *widget,
- gpointer data);
-static void e_day_view_on_settings (GtkWidget *widget,
- gpointer data);
static void e_day_view_on_delete_occurrence (GtkWidget *widget,
gpointer data);
static void e_day_view_on_delete_appointment (GtkWidget *widget,
@@ -2941,7 +2921,7 @@ e_day_view_on_top_canvas_button_press (GtkWidget *widget,
&dtend);
gnome_calendar_new_appointment_for (day_view->calendar,
dtstart, dtend,
- TRUE, FALSE);
+ TRUE);
return TRUE;
}
@@ -3075,7 +3055,7 @@ e_day_view_on_main_canvas_button_press (GtkWidget *widget,
&dtend);
gnome_calendar_new_appointment_for (day_view->calendar,
dtstart, dtend,
- FALSE, FALSE);
+ FALSE);
return TRUE;
}
@@ -3511,7 +3491,7 @@ e_day_view_on_event_double_click (EDayView *day_view,
gtk_signal_disconnect (GTK_OBJECT (event->comp), id);
if (day_view->calendar)
- gnome_calendar_edit_object (day_view->calendar, event->comp, FALSE);
+ gnome_calendar_edit_object (day_view->calendar, event->comp);
else
g_warning ("Calendar not set");
}
@@ -3541,88 +3521,57 @@ enum {
MASK_EDITING = 8
};
-#if 0
-static EPopupMenu view_items [] = {
- E_POPUP_RADIO_ITEM (N_("Day View"), e_day_view_on_goto_date, 0, 0),
- E_POPUP_RADIO_ITEM (N_("Work Week View"), e_day_view_on_goto_date, 0, 0),
- E_POPUP_RADIO_ITEM (N_("Week View"), e_day_view_on_goto_date, 0, 0),
- E_POPUP_RADIO_ITEM (N_("Month View"), e_day_view_on_goto_date, 0, 0),
-
- E_POPUP_TERMINATOR
-};
-#endif
-
static EPopupMenu main_items [] = {
- E_POPUP_ITEM (N_("New _Appointment"),
- e_day_view_on_new_appointment, 0),
- E_POPUP_ITEM (N_("New All Day _Event"),
- e_day_view_on_new_event, 0),
- E_POPUP_ITEM (N_("New Meeting"),
- e_day_view_on_new_meeting, 0),
- E_POPUP_ITEM (N_("New Task"),
- e_day_view_on_new_task, 0),
-
- E_POPUP_SEPARATOR,
-
- E_POPUP_ITEM (N_("Print..."),
- e_day_view_on_print, 0),
-
- E_POPUP_SEPARATOR,
-
- E_POPUP_ITEM (N_("_Paste"),
- e_day_view_on_paste, 0),
-
- E_POPUP_SEPARATOR,
-
-#if 0
- E_POPUP_SUBMENU (N_("Current View"),
- view_items, 0),
-#endif
-
- E_POPUP_ITEM (N_("Go to _Today"),
- e_day_view_on_goto_today, 0),
- E_POPUP_ITEM (N_("_Go to Date..."),
- e_day_view_on_goto_date, 0),
+ { N_("New _Appointment"), NULL,
+ e_day_view_on_new_appointment, NULL, 0 },
+ { N_("New All Day _Event"), NULL,
+ e_day_view_on_new_event, NULL, 0 },
- E_POPUP_SEPARATOR,
+ { "", NULL, NULL, NULL, 0 },
- E_POPUP_ITEM (N_("_Publish Free/Busy Information"),
- e_day_view_on_publish, 0),
+ { N_("_Paste"), NULL,
+ e_day_view_on_paste, NULL, 0 },
- E_POPUP_SEPARATOR,
+ { "", NULL, NULL, NULL, 0 },
- E_POPUP_ITEM (N_("_Configure..."),
- e_day_view_on_settings, 0),
+ { N_("Go to _Today"), NULL,
+ e_day_view_on_goto_today, NULL, 0 },
+ { N_("_Go to Date..."), NULL,
+ e_day_view_on_goto_date, NULL, 0 },
- E_POPUP_TERMINATOR
+ { NULL, NULL, NULL, NULL, 0 }
};
static EPopupMenu child_items [] = {
-
- E_POPUP_ITEM (N_("_Open"), e_day_view_on_edit_appointment, MASK_EDITABLE | MASK_EDITING),
- E_POPUP_ITEM (N_("_Save As..."), e_day_view_on_save_as, MASK_EDITABLE | MASK_EDITING),
- E_POPUP_ITEM (N_("_Print..."), e_day_view_on_print_event, MASK_EDITABLE | MASK_EDITING),
+ { N_("_Open"), NULL,
+ e_day_view_on_edit_appointment, NULL, MASK_EDITABLE | MASK_EDITING },
+ { N_("_Delete this Appointment"), NULL,
+ e_day_view_on_delete_appointment, NULL, MASK_EDITABLE | MASK_SINGLE | MASK_EDITING },
/* Only show this separator if one of the above is shown. */
- E_POPUP_SEPARATOR,
-
- E_POPUP_ITEM (N_("C_ut"), e_day_view_on_cut, MASK_EDITABLE | MASK_EDITING),
- E_POPUP_ITEM (N_("_Copy"), e_day_view_on_copy, 0),
- E_POPUP_ITEM (N_("_Paste"), e_day_view_on_paste, 0),
+ { "", NULL, NULL, NULL, MASK_EDITABLE | MASK_EDITING },
- E_POPUP_SEPARATOR,
- E_POPUP_ITEM (N_("_Schedule Meeting..."), e_day_view_on_meeting, MASK_EDITABLE | MASK_SINGLE | MASK_EDITING),
- E_POPUP_ITEM (N_("_Forward as iCalendar..."), e_day_view_on_forward, MASK_EDITABLE | MASK_SINGLE | MASK_EDITING),
-
- E_POPUP_SEPARATOR,
+ { N_("C_ut"), NULL,
+ e_day_view_on_cut, NULL, MASK_EDITABLE | MASK_EDITING },
+ { N_("_Copy"), NULL,
+ e_day_view_on_copy, NULL, 0 },
+ { N_("_Paste"), NULL,
+ e_day_view_on_paste, NULL, 0 },
- E_POPUP_ITEM (N_("_Delete"), e_day_view_on_delete_appointment, MASK_EDITABLE | MASK_SINGLE | MASK_EDITING),
- E_POPUP_ITEM (N_("Make this Occurrence _Movable"), e_day_view_on_unrecur_appointment, MASK_RECURRING | MASK_EDITING),
- E_POPUP_ITEM (N_("Delete this _Occurrence"), e_day_view_on_delete_occurrence, MASK_RECURRING | MASK_EDITING),
- E_POPUP_ITEM (N_("Delete _All Occurrences"), e_day_view_on_delete_appointment, MASK_RECURRING | MASK_EDITING),
- E_POPUP_TERMINATOR
+ /*
+ * The following are only shown if this is a recurring event
+ */
+ { "", NULL, NULL, NULL, MASK_RECURRING | MASK_EDITING },
+ { N_("Make this Occurrence _Movable"), NULL,
+ e_day_view_on_unrecur_appointment, NULL, MASK_RECURRING | MASK_EDITING },
+ { N_("Delete this _Occurrence"), NULL,
+ e_day_view_on_delete_occurrence, NULL, MASK_RECURRING | MASK_EDITING },
+ { N_("Delete _All Occurrences"), NULL,
+ e_day_view_on_delete_appointment, NULL, MASK_RECURRING | MASK_EDITING },
+
+ { NULL, NULL, NULL, NULL, 0 }
};
static void
@@ -3704,7 +3653,7 @@ e_day_view_on_new_appointment (GtkWidget *widget, gpointer data)
}
gnome_calendar_new_appointment_for (
- day_view->calendar, dtstart, dtend, FALSE, FALSE);
+ day_view->calendar, dtstart, dtend, FALSE);
}
static void
@@ -3715,45 +3664,7 @@ e_day_view_on_new_event (GtkWidget *widget, gpointer data)
e_day_view_get_selected_time_range (day_view, &dtstart, &dtend);
gnome_calendar_new_appointment_for (
- day_view->calendar, dtstart, dtend, TRUE, FALSE);
-}
-
-static void
-e_day_view_on_new_meeting (GtkWidget *widget, gpointer data)
-{
- EDayView *day_view = E_DAY_VIEW (data);
- time_t dtstart, dtend;
- struct icaltimetype itt;
-
- /* Edit a new event. If only one day is selected in the top canvas,
- we set the time to the first 1/2-hour of the working day. */
- if (day_view->selection_in_top_canvas
- && day_view->selection_start_day != -1
- && day_view->selection_start_day == day_view->selection_end_day) {
- dtstart = day_view->day_starts[day_view->selection_start_day];
- itt = icaltime_from_timet_with_zone (dtstart, FALSE,
- day_view->zone);
- itt.hour = calendar_config_get_day_start_hour ();
- itt.minute = calendar_config_get_day_start_minute ();
- dtstart = icaltime_as_timet_with_zone (itt, day_view->zone);
-
- icaltime_adjust (&itt, 0, 0, 30, 0);
- dtend = icaltime_as_timet_with_zone (itt, day_view->zone);
- } else {
- e_day_view_get_selected_time_range (day_view, &dtstart,
- &dtend);
- }
-
- gnome_calendar_new_appointment_for (
- day_view->calendar, dtstart, dtend, FALSE, TRUE);
-}
-
-static void
-e_day_view_on_new_task (GtkWidget *widget, gpointer data)
-{
- EDayView *day_view = E_DAY_VIEW (data);
-
- gnome_calendar_new_task (day_view->calendar);
+ day_view->calendar, dtstart, dtend, TRUE);
}
static void
@@ -3785,165 +3696,11 @@ e_day_view_on_edit_appointment (GtkWidget *widget, gpointer data)
return;
if (day_view->calendar)
- gnome_calendar_edit_object (day_view->calendar, event->comp, FALSE);
- else
- g_warning ("Calendar not set");
-}
-
-static void
-e_day_view_on_save_as (GtkWidget *widget, gpointer data)
-{
- EDayView *day_view;
- EDayViewEvent *event;
- char *filename;
- char *ical_string;
- FILE *file;
-
- day_view = E_DAY_VIEW (data);
-
- event = e_day_view_get_popup_menu_event (day_view);
- if (event == NULL)
- return;
-
- filename = e_file_dialog_save (_("Save as..."));
- if (filename == NULL)
- return;
-
- ical_string = cal_client_get_component_as_string (day_view->client, event->comp);
- if (ical_string == NULL) {
- g_warning ("Couldn't convert item to a string");
- return;
- }
-
- file = fopen (filename, "w");
- if (file == NULL) {
- g_warning ("Couldn't save item");
- return;
- }
-
- fprintf (file, ical_string);
- g_free (ical_string);
- fclose (file);
-}
-
-static void
-e_day_view_on_print (GtkWidget *widget, gpointer data)
-{
- EDayView *day_view;
- time_t start;
- GnomeCalendarViewType view_type;
- PrintView print_view;
-
- day_view = E_DAY_VIEW (data);
-
- gnome_calendar_get_current_time_range (day_view->calendar, &start, NULL);
- view_type = gnome_calendar_get_view (day_view->calendar);
-
- switch (view_type) {
- case GNOME_CAL_DAY_VIEW:
- print_view = PRINT_VIEW_DAY;
- break;
-
- case GNOME_CAL_WORK_WEEK_VIEW:
- print_view = PRINT_VIEW_WEEK;
- break;
-
- default:
- g_assert_not_reached ();
- return;
- }
-
- print_calendar (day_view->calendar, FALSE, start, print_view);
-}
-
-static void
-e_day_view_on_print_event (GtkWidget *widget, gpointer data)
-{
- EDayView *day_view;
- EDayViewEvent *event;
-
- day_view = E_DAY_VIEW (data);
-
- event = e_day_view_get_popup_menu_event (day_view);
- if (event == NULL)
- return;
-
- print_comp (event->comp, day_view->client, FALSE);
-}
-
-static void
-e_day_view_on_meeting (GtkWidget *widget, gpointer data)
-{
- EDayView *day_view;
- EDayViewEvent *event;
-
- day_view = E_DAY_VIEW (data);
-
- event = e_day_view_get_popup_menu_event (day_view);
- if (event == NULL)
- return;
-
- if (day_view->calendar)
- gnome_calendar_edit_object (day_view->calendar, event->comp, TRUE);
+ gnome_calendar_edit_object (day_view->calendar, event->comp);
else
g_warning ("Calendar not set");
}
-static void
-e_day_view_on_forward (GtkWidget *widget, gpointer data)
-{
- EDayView *day_view;
- EDayViewEvent *event;
-
- day_view = E_DAY_VIEW (data);
-
- event = e_day_view_get_popup_menu_event (day_view);
- if (event == NULL)
- return;
-
- itip_send_comp (CAL_COMPONENT_METHOD_PUBLISH, event->comp,
- day_view->client, NULL);
-}
-
-static void
-e_day_view_on_publish (GtkWidget *widget, gpointer data)
-{
- EDayView *day_view;
- icaltimezone *utc;
- time_t start = time (NULL), end;
- GList *comp_list;
-
- day_view = E_DAY_VIEW (data);
-
- utc = icaltimezone_get_utc_timezone ();
- start = time_day_begin_with_zone (start, utc);
- end = time_add_week_with_zone (start, 6, utc);
-
- comp_list = cal_client_get_free_busy (day_view->client, NULL, start, end);
- if (comp_list) {
- GList *l;
-
- for (l = comp_list; l; l = l->next) {
- CalComponent *comp = CAL_COMPONENT (l->data);
- itip_send_comp (CAL_COMPONENT_METHOD_PUBLISH, comp,
- day_view->client, NULL);
-
- gtk_object_unref (GTK_OBJECT (comp));
- }
-
- g_list_free (comp_list);
- }
-}
-
-static void
-e_day_view_on_settings (GtkWidget *widget, gpointer data)
-{
- EDayView *day_view;
-
- day_view = E_DAY_VIEW (data);
-
- control_util_show_settings (day_view->calendar);
-}
static void
e_day_view_on_delete_occurrence (GtkWidget *widget, gpointer data)
@@ -4680,7 +4437,7 @@ e_day_view_finish_long_event_resize (EDayView *day_view)
day_view->resize_drag_pos = E_DAY_VIEW_POS_NONE;
if (cal_client_update_object (day_view->client, comp)) {
- if (cal_component_has_attendees (comp) && send_component_dialog (comp, FALSE))
+ if (cal_component_has_attendees (comp) && send_component_dialog (comp))
itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, day_view->client, NULL);
} else {
g_message ("e_day_view_finish_long_event_resize(): Could not update the object!");
@@ -4741,7 +4498,7 @@ e_day_view_finish_resize (EDayView *day_view)
day_view->resize_drag_pos = E_DAY_VIEW_POS_NONE;
if (cal_client_update_object (day_view->client, comp)) {
- if (cal_component_has_attendees (comp) && send_component_dialog (comp, FALSE))
+ if (cal_component_has_attendees (comp) && send_component_dialog (comp))
itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, day_view->client, NULL);
} else {
g_message ("e_day_view_finish_resize(): Could not update the object!");
@@ -6084,9 +5841,8 @@ e_day_view_on_editing_stopped (EDayView *day_view,
cal_component_set_summary (event->comp, &summary);
if (cal_client_update_object (day_view->client, event->comp)) {
- if (cal_component_has_attendees (event->comp) && send_component_dialog (event->comp, FALSE))
- itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, event->comp,
- day_view->client, NULL);
+ if (cal_component_has_attendees (event->comp) && send_component_dialog (event->comp))
+ itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, event->comp, day_view->client, NULL);
} else {
g_message ("e_day_view_on_editing_stopped(): Could not update the object!");
}
@@ -7133,9 +6889,8 @@ e_day_view_on_top_canvas_drag_data_received (GtkWidget *widget,
gnome_canvas_item_show (event->canvas_item);
if (cal_client_update_object (day_view->client, comp)) {
- if (cal_component_has_attendees (comp) && send_component_dialog (comp, FALSE))
- itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp,
- day_view->client, NULL);
+ if (cal_component_has_attendees (comp) && send_component_dialog (comp))
+ itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, day_view->client, NULL);
} else {
g_message ("e_day_view_on_top_canvas_drag_data_received(): Could "
"not update the object!");
@@ -7246,9 +7001,8 @@ e_day_view_on_main_canvas_drag_data_received (GtkWidget *widget,
gnome_canvas_item_show (event->canvas_item);
if (cal_client_update_object (day_view->client, comp)) {
- if (cal_component_has_attendees (comp) && send_component_dialog (comp, FALSE))
- itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp,
- day_view->client, NULL);
+ if (cal_component_has_attendees (comp) && send_component_dialog (comp))
+ itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, day_view->client, NULL);
} else {
g_message ("e_day_view_on_main_canvas_drag_data_received(): "
"Could not update the object!");
diff --git a/calendar/gui/e-itip-control.c b/calendar/gui/e-itip-control.c
index 85052a09a1..73b7bdff04 100644
--- a/calendar/gui/e-itip-control.c
+++ b/calendar/gui/e-itip-control.c
@@ -1443,7 +1443,7 @@ update_attendee_status (EItipControl *itip)
itip_strip_mailto (a->value));
if (prop == NULL) {
- dialog = gnome_question_dialog_modal (_("This response is not from a current "
+ dialog = gnome_question_dialog_modal (_("This response is not from a current"
"attendee. Add as an attendee?"),
NULL, NULL);
if (gnome_dialog_run_and_close (GNOME_DIALOG (dialog)) == GNOME_YES) {
diff --git a/calendar/gui/e-meeting-model.c b/calendar/gui/e-meeting-model.c
index 6adfb9c1c9..d9f648879d 100644
--- a/calendar/gui/e-meeting-model.c
+++ b/calendar/gui/e-meeting-model.c
@@ -690,23 +690,23 @@ destroy (GtkObject *obj)
gtk_object_unref (GTK_OBJECT (priv->client));
if (priv->ebook != NULL)
- gtk_object_unref (GTK_OBJECT (priv->ebook));
+ gtk_object_unref (GTK_OBJECT (priv->ebook));
if (priv->corba_select_names != CORBA_OBJECT_NIL) {
- CORBA_Environment ev;
+ CORBA_Environment ev;
CORBA_exception_init (&ev);
bonobo_object_release_unref (priv->corba_select_names, &ev);
CORBA_exception_free (&ev);
- }
+ }
- while (priv->refresh_queue->len > 0)
- refresh_queue_remove (im, g_ptr_array_index (priv->refresh_queue, 0));
- g_ptr_array_free (priv->refresh_queue, TRUE);
- g_hash_table_destroy (priv->refresh_data);
-
- if (priv->refresh_idle_id)
- g_source_remove (priv->refresh_idle_id);
-
+ while (priv->refresh_queue->len > 0)
+ refresh_queue_remove (im, g_ptr_array_index (priv->refresh_queue, 0));
+ g_ptr_array_free (priv->refresh_queue, TRUE);
+ g_hash_table_destroy (priv->refresh_data);
+
+ if (priv->refresh_idle_id)
+ g_source_remove (priv->refresh_idle_id);
+
g_free (priv);
}
@@ -1252,20 +1252,22 @@ process_free_busy_comp (EMeetingAttendee *ia,
static void
process_free_busy (EMeetingModelQueueData *qdata, char *text)
{
- EMeetingModel *im = qdata->im;
- EMeetingModelPrivate *priv;
- EMeetingAttendee *ia = qdata->ia;
+ EMeetingModel *im = qdata->im;
+ EMeetingModelPrivate *priv;
+ EMeetingAttendee *ia = qdata->ia;
icalcomponent *main_comp;
icalcomponent_kind kind = ICAL_NO_COMPONENT;
priv = im->priv;
main_comp = icalparser_parse_string (text);
- if (main_comp == NULL) {
- process_callbacks (qdata);
- return;
- }
-
+ if (main_comp == NULL) {
+ process_callbacks (qdata);
+ return;
+ }
+
+ e_meeting_attendee_set_has_calendar_info (ia, TRUE);
+
kind = icalcomponent_isa (main_comp);
if (kind == ICAL_VCALENDAR_COMPONENT) {
icalcompiter iter;
diff --git a/calendar/gui/e-tasks.c b/calendar/gui/e-tasks.c
index d98bdfea9c..7510ef897f 100644
--- a/calendar/gui/e-tasks.c
+++ b/calendar/gui/e-tasks.c
@@ -26,7 +26,7 @@
#include <gnome.h>
#include <gal/util/e-util.h>
#include <gal/e-table/e-table-scrolled.h>
-#include <gal/menus/gal-view-instance.h>
+#include <gal/menus/gal-view-collection.h>
#include <gal/menus/gal-view-factory-etable.h>
#include <gal/menus/gal-view-etable.h>
#include "e-util/e-url.h"
@@ -47,16 +47,15 @@ static GList *all_tasks = NULL;
struct _ETasksPrivate {
/* The calendar client object we monitor */
CalClient *client;
- CalQuery *query;
-
+
/* The ECalendarTable showing the tasks. */
GtkWidget *tasks_view;
/* Calendar search bar for tasks */
GtkWidget *search_bar;
- /* View instance and the view menus handler */
- GalViewInstance *view_instance;
+ /* View collection and the view menus handler */
+ GalViewCollection *view_collection;
GalViewMenus *view_menus;
};
@@ -121,10 +120,10 @@ e_tasks_init (ETasks *tasks)
priv = g_new0 (ETasksPrivate, 1);
tasks->priv = priv;
- priv->client = NULL;
- priv->query = NULL;
- priv->view_instance = NULL;
+ priv->view_collection = NULL;
priv->view_menus = NULL;
+
+ setup_widgets (tasks);
}
/* Callback used when the selection changes in the table. */
@@ -242,8 +241,6 @@ e_tasks_construct (ETasks *tasks)
priv = tasks->priv;
- setup_widgets (tasks);
-
priv->client = cal_client_new ();
if (!priv->client)
return NULL;
@@ -281,17 +278,6 @@ e_tasks_new (void)
}
-void
-e_tasks_set_ui_component (ETasks *tasks,
- BonoboUIComponent *ui_component)
-{
- g_return_if_fail (E_IS_TASKS (tasks));
- g_return_if_fail (ui_component == NULL || BONOBO_IS_UI_COMPONENT (ui_component));
-
- e_search_bar_set_ui_component (E_SEARCH_BAR (tasks->priv->search_bar), ui_component);
-}
-
-
static void
e_tasks_destroy (GtkObject *object)
{
@@ -325,17 +311,6 @@ e_tasks_destroy (GtkObject *object)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}
-static void
-set_status_message (ETasks *tasks, const char *message)
-{
- ETasksPrivate *priv;
- CalendarModel *model;
-
- priv = tasks->priv;
-
- model = e_calendar_table_get_model (E_CALENDAR_TABLE (priv->tasks_view));
- calendar_model_set_status_message (model, message);
-}
gboolean
e_tasks_open (ETasks *tasks,
@@ -360,7 +335,9 @@ e_tasks_open (ETasks *tasks,
real_uri = g_strdup (file);
message = g_strdup_printf (_("Opening tasks at %s"), real_uri);
- set_status_message (tasks, message);
+ calendar_model_set_status_message (
+ e_calendar_table_get_model (E_CALENDAR_TABLE (priv->tasks_view)),
+ message);
g_free (message);
if (!cal_client_open_calendar (priv->client, real_uri, FALSE)) {
@@ -420,7 +397,8 @@ cal_opened_cb (CalClient *client,
tasks = E_TASKS (data);
priv = tasks->priv;
- set_status_message (tasks, NULL);
+ calendar_model_set_status_message (
+ e_calendar_table_get_model (E_CALENDAR_TABLE (priv->tasks_view)), NULL);
switch (status) {
case CAL_CLIENT_OPEN_SUCCESS:
@@ -522,27 +500,6 @@ e_tasks_new_task (ETasks *tasks)
}
/**
- * e_tasks_complete_selected:
- * @tasks: A tasks control widget
- *
- * Marks the selected tasks complete
- **/
-void
-e_tasks_complete_selected (ETasks *tasks)
-{
- ETasksPrivate *priv;
- ECalendarTable *cal_table;
-
- g_return_if_fail (tasks != NULL);
- g_return_if_fail (E_IS_TASKS (tasks));
-
- priv = tasks->priv;
-
- cal_table = E_CALENDAR_TABLE (priv->tasks_view);
- e_calendar_table_complete_selected (cal_table);
-}
-
-/**
* e_tasks_delete_selected:
* @tasks: A tasks control widget.
*
@@ -563,115 +520,9 @@ e_tasks_delete_selected (ETasks *tasks)
e_calendar_table_delete_selected (cal_table);
}
-static char *
-create_sexp (void)
-{
- char *sexp;
-
- sexp = g_strdup ("(and (= (get-vtype) \"VTODO\") (is-completed?))");
-#if 0
- g_print ("Calendar model sexp:\n%s\n", sexp);
-#endif
-
- return sexp;
-}
-
-/* Callback used when a component is updated in the live query */
-static void
-query_obj_updated_cb (CalQuery *query, const char *uid,
- gboolean query_in_progress, int n_scanned, int total,
- gpointer data)
-{
- ETasks *tasks;
- ETasksPrivate *priv;
-
- tasks = E_TASKS (data);
- priv = tasks->priv;
-
- cal_client_remove_object (priv->client, uid);
-}
-
-/* Callback used when an evaluation error occurs when running a query */
-static void
-query_eval_error_cb (CalQuery *query, const char *error_str, gpointer data)
-{
- ETasks *tasks;
- ETasksPrivate *priv;
-
- tasks = E_TASKS (data);
- priv = tasks->priv;
-
- g_warning ("eval error: %s\n", error_str);
-
- set_status_message (tasks, NULL);
-
- gtk_signal_disconnect_by_data (GTK_OBJECT (priv->query), tasks);
- gtk_object_unref (GTK_OBJECT (priv->query));
- priv->query = NULL;
-}
-
-static void
-query_query_done_cb (CalQuery *query, CalQueryDoneStatus status, const char *error_str, gpointer data)
-{
- ETasks *tasks;
- ETasksPrivate *priv;
-
- tasks = E_TASKS (data);
- priv = tasks->priv;
-
- if (status != CAL_QUERY_DONE_SUCCESS)
- g_warning ("query done: %s\n", error_str);
-
- set_status_message (tasks, NULL);
-
- gtk_signal_disconnect_by_data (GTK_OBJECT (priv->query), tasks);
- gtk_object_unref (GTK_OBJECT (priv->query));
- priv->query = NULL;
-}
-/**
- * e_tasks_expunge:
- * @tasks: A tasks control widget
- *
- * Removes all tasks marked as completed
- **/
-void
-e_tasks_delete_completed (ETasks *tasks)
-{
- ETasksPrivate *priv;
- char *sexp;
-
- g_return_if_fail (tasks != NULL);
- g_return_if_fail (E_IS_TASKS (tasks));
-
- priv = tasks->priv;
-
- /* If we have a query, we are already expunging */
- if (priv->query)
- return;
-
- sexp = create_sexp ();
-
- set_status_message (tasks, _("Expunging"));
- priv->query = cal_client_get_query (priv->client, sexp);
- g_free (sexp);
-
- if (!priv->query) {
- set_status_message (tasks, NULL);
- g_message ("update_query(): Could not create the query");
- return;
- }
-
- gtk_signal_connect (GTK_OBJECT (priv->query), "obj_updated",
- GTK_SIGNAL_FUNC (query_obj_updated_cb), tasks);
- gtk_signal_connect (GTK_OBJECT (priv->query), "query_done",
- GTK_SIGNAL_FUNC (query_query_done_cb), tasks);
- gtk_signal_connect (GTK_OBJECT (priv->query), "eval_error",
- GTK_SIGNAL_FUNC (query_eval_error_cb), tasks);
-}
-
/* Callback used from the view collection when we need to display a new view */
static void
-display_view_cb (GalViewInstance *instance, GalView *view, gpointer data)
+display_view_cb (GalViewCollection *collection, GalView *view, gpointer data)
{
ETasks *tasks;
@@ -699,7 +550,6 @@ e_tasks_setup_view_menus (ETasks *tasks, BonoboUIComponent *uic)
GalViewFactory *factory;
ETableSpecification *spec;
char *dir;
- static GalViewCollection *collection = NULL;
g_return_if_fail (tasks != NULL);
g_return_if_fail (E_IS_TASKS (tasks));
@@ -708,45 +558,40 @@ e_tasks_setup_view_menus (ETasks *tasks, BonoboUIComponent *uic)
priv = tasks->priv;
- g_return_if_fail (priv->view_instance == NULL);
+ g_return_if_fail (priv->view_collection == NULL);
- g_assert (priv->view_instance == NULL);
+ g_assert (priv->view_collection == NULL);
g_assert (priv->view_menus == NULL);
- /* Create the view instance */
-
- if (collection == NULL) {
- collection = gal_view_collection_new ();
+ /* Create the view collection */
- dir = gnome_util_prepend_user_home ("/evolution/views/tasks/");
- gal_view_collection_set_storage_directories (collection,
- EVOLUTION_DATADIR "/evolution/views/tasks/",
- dir);
- g_free (dir);
+ priv->view_collection = gal_view_collection_new ();
- /* Create the views */
+ dir = gnome_util_prepend_user_home ("/evolution/views/tasks/");
+ gal_view_collection_set_storage_directories (priv->view_collection,
+ EVOLUTION_DATADIR "/evolution/views/tasks/",
+ dir);
+ g_free (dir);
- spec = e_table_specification_new ();
- e_table_specification_load_from_file (spec,
- EVOLUTION_ETSPECDIR "/e-calendar-table.etspec");
+ /* Create the views */
- factory = gal_view_factory_etable_new (spec);
- gtk_object_unref (GTK_OBJECT (spec));
- gal_view_collection_add_factory (collection, factory);
- gtk_object_unref (GTK_OBJECT (factory));
+ spec = e_table_specification_new ();
+ e_table_specification_load_from_file (spec,
+ EVOLUTION_ETSPECDIR "/e-calendar-table.etspec");
- /* Load the collection and create the menus */
+ factory = gal_view_factory_etable_new (spec);
+ gtk_object_unref (GTK_OBJECT (spec));
+ gal_view_collection_add_factory (priv->view_collection, factory);
+ gtk_object_unref (GTK_OBJECT (factory));
- gal_view_collection_load (collection);
- }
+ /* Load the collection and create the menus */
- priv->view_instance = gal_view_instance_new (collection, cal_client_get_uri (priv->client));
+ gal_view_collection_load (priv->view_collection);
- priv->view_menus = gal_view_menus_new (priv->view_instance);
+ priv->view_menus = gal_view_menus_new (priv->view_collection);
gal_view_menus_apply (priv->view_menus, uic, NULL);
- gtk_signal_connect (GTK_OBJECT (priv->view_instance), "display_view",
+ gtk_signal_connect (GTK_OBJECT (priv->view_collection), "display_view",
GTK_SIGNAL_FUNC (display_view_cb), tasks);
- display_view_cb (priv->view_instance, gal_view_instance_get_current_view (priv->view_instance), tasks);
}
/**
@@ -767,13 +612,13 @@ e_tasks_discard_view_menus (ETasks *tasks)
priv = tasks->priv;
- g_return_if_fail (priv->view_instance != NULL);
+ g_return_if_fail (priv->view_collection != NULL);
- g_assert (priv->view_instance != NULL);
+ g_assert (priv->view_collection != NULL);
g_assert (priv->view_menus != NULL);
- gtk_object_unref (GTK_OBJECT (priv->view_instance));
- priv->view_instance = NULL;
+ gtk_object_unref (GTK_OBJECT (priv->view_collection));
+ priv->view_collection = NULL;
gtk_object_unref (GTK_OBJECT (priv->view_menus));
priv->view_menus = NULL;
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c
index 3ebc5f9ac0..797e277827 100644
--- a/calendar/gui/e-week-view.c
+++ b/calendar/gui/e-week-view.c
@@ -47,7 +47,6 @@
#include <gal/widgets/e-popup-menu.h>
#include <gal/widgets/e-canvas-utils.h>
#include <gal/widgets/e-unicode.h>
-#include <e-util/e-dialog-utils.h>
#include "dialogs/delete-comp.h"
#include "dialogs/send-comp.h"
#include "comp-util.h"
@@ -55,7 +54,6 @@
#include "cal-util/timeutil.h"
#include "calendar-commands.h"
#include "calendar-config.h"
-#include "print.h"
#include "goto.h"
#include "e-week-view-event-item.h"
#include "e-week-view-layout.h"
@@ -176,30 +174,12 @@ static void e_week_view_on_new_appointment (GtkWidget *widget,
gpointer data);
static void e_week_view_on_new_event (GtkWidget *widget,
gpointer data);
-static void e_week_view_on_new_meeting (GtkWidget *widget,
- gpointer data);
-static void e_week_view_on_new_task (GtkWidget *widget,
- gpointer data);
static void e_week_view_on_goto_today (GtkWidget *widget,
gpointer data);
static void e_week_view_on_goto_date (GtkWidget *widget,
gpointer data);
static void e_week_view_on_edit_appointment (GtkWidget *widget,
gpointer data);
-static void e_week_view_on_save_as (GtkWidget *widget,
- gpointer data);
-static void e_week_view_on_print (GtkWidget *widget,
- gpointer data);
-static void e_week_view_on_print_event (GtkWidget *widget,
- gpointer data);
-static void e_week_view_on_meeting (GtkWidget *widget,
- gpointer data);
-static void e_week_view_on_forward (GtkWidget *widget,
- gpointer data);
-static void e_week_view_on_publish (GtkWidget *widget,
- gpointer data);
-static void e_week_view_on_settings (GtkWidget *widget,
- gpointer data);
static void e_week_view_on_delete_occurrence (GtkWidget *widget,
gpointer data);
static void e_week_view_on_delete_appointment (GtkWidget *widget,
@@ -613,10 +593,6 @@ e_week_view_realize (GtkWidget *widget)
week_view->colors[E_WEEK_VIEW_COLOR_DATES_SELECTED].green = 65535;
week_view->colors[E_WEEK_VIEW_COLOR_DATES_SELECTED].blue = 65535;
- week_view->colors[E_WEEK_VIEW_COLOR_TODAY].red = 65535;
- week_view->colors[E_WEEK_VIEW_COLOR_TODAY].green = 0;
- week_view->colors[E_WEEK_VIEW_COLOR_TODAY].blue = 0;
-
nfailed = gdk_colormap_alloc_colors (colormap, week_view->colors,
E_WEEK_VIEW_COLOR_LAST, FALSE,
TRUE, success);
@@ -2157,7 +2133,7 @@ e_week_view_on_button_press (GtkWidget *widget,
dtend = week_view->day_starts[day + 1];
gnome_calendar_new_appointment_for (week_view->calendar,
dtstart, dtend,
- TRUE, FALSE);
+ TRUE);
return TRUE;
}
@@ -2993,7 +2969,7 @@ e_week_view_on_text_item_event (GnomeCanvasItem *item,
if (week_view->calendar)
gnome_calendar_edit_object (week_view->calendar,
- event->comp, FALSE);
+ event->comp);
else
g_warning ("Calendar not set");
@@ -3212,9 +3188,8 @@ e_week_view_on_editing_stopped (EWeekView *week_view,
cal_component_set_summary (event->comp, &summary);
if (cal_client_update_object (week_view->client, event->comp)) {
- if (cal_component_has_attendees (event->comp) && send_component_dialog (event->comp, FALSE))
- itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, event->comp,
- week_view->client, NULL);
+ if (cal_component_has_attendees (event->comp) && send_component_dialog (event->comp))
+ itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, event->comp, week_view->client, NULL);
} else {
g_message ("e_week_view_on_editing_stopped(): Could not update the object!");
}
@@ -3430,60 +3405,61 @@ enum {
};
static EPopupMenu main_items [] = {
- E_POPUP_ITEM (N_("New _Appointment..."), e_week_view_on_new_appointment, 0),
- E_POPUP_ITEM (N_("New All Day _Event"), e_week_view_on_new_event, 0),
- E_POPUP_ITEM (N_("New Meeting"), e_week_view_on_new_meeting, 0),
- E_POPUP_ITEM (N_("New Task"), e_week_view_on_new_task, 0),
-
- E_POPUP_SEPARATOR,
-
- E_POPUP_ITEM (N_("_Print..."), e_week_view_on_print, 0),
-
- E_POPUP_SEPARATOR,
-
- E_POPUP_ITEM (N_("_Paste"), e_week_view_on_paste, 0),
+ { N_("New _Appointment..."), NULL,
+ e_week_view_on_new_appointment, NULL, 0 },
+ { N_("New All Day _Event"), NULL,
+ e_week_view_on_new_event, NULL, 0 },
- E_POPUP_SEPARATOR,
-
- E_POPUP_ITEM (N_("Go to _Today"), e_week_view_on_goto_today, 0),
- E_POPUP_ITEM (N_("_Go to Date..."), e_week_view_on_goto_date, 0),
+ { "", NULL, NULL, NULL, 0 },
- E_POPUP_SEPARATOR,
+ { N_("_Paste"), NULL,
+ e_week_view_on_paste, NULL, 0 },
- E_POPUP_ITEM (N_("_Publish Free/Busy Information"), e_week_view_on_publish, 0),
+ { "", NULL, NULL, NULL, 0 },
- E_POPUP_SEPARATOR,
-
- E_POPUP_ITEM (N_("_Configure..."), e_week_view_on_settings, 0),
-
- E_POPUP_TERMINATOR
+ { N_("Go to _Today"), NULL,
+ e_week_view_on_goto_today, NULL, 0 },
+ { N_("_Go to Date..."), NULL,
+ e_week_view_on_goto_date, NULL, 0 },
+ { NULL, NULL, NULL, NULL, 0 }
};
static EPopupMenu child_items [] = {
- E_POPUP_ITEM (N_("_Open"), e_week_view_on_edit_appointment, MASK_EDITABLE | MASK_EDITING),
- E_POPUP_ITEM (N_("_Save As..."), e_week_view_on_save_as, MASK_EDITABLE | MASK_EDITING),
- E_POPUP_ITEM (N_("_Print..."), e_week_view_on_print_event, MASK_EDITABLE | MASK_EDITING),
+ { N_("_Open"), NULL,
+ e_week_view_on_edit_appointment, NULL, MASK_EDITABLE | MASK_EDITING },
+ { N_("_Delete this Appointment"), NULL,
+ e_week_view_on_delete_appointment, NULL, MASK_EDITABLE | MASK_SINGLE | MASK_EDITING },
/* Only show this separator if one of the above is shown. */
- E_POPUP_SEPARATOR,
+ { "", NULL, NULL, NULL, MASK_EDITABLE | MASK_EDITING },
- E_POPUP_ITEM (N_("C_ut"), e_week_view_on_cut, MASK_EDITING | MASK_EDITABLE),
- E_POPUP_ITEM (N_("_Copy"), e_week_view_on_copy, MASK_EDITING | MASK_EDITABLE),
- E_POPUP_ITEM (N_("_Paste"), e_week_view_on_paste, 0),
- E_POPUP_SEPARATOR,
+ { N_("C_ut"), NULL,
+ e_week_view_on_cut, NULL, MASK_EDITING | MASK_EDITABLE },
+ { N_("_Copy"), NULL,
+ e_week_view_on_copy, NULL, MASK_EDITING | MASK_EDITABLE },
+ { N_("_Paste"), NULL,
+ e_week_view_on_paste, NULL, 0 },
- E_POPUP_ITEM (N_("_Schedule Meeting..."), e_week_view_on_meeting, MASK_EDITABLE | MASK_SINGLE | MASK_EDITING),
- E_POPUP_ITEM (N_("_Forward as iCalendar..."), e_week_view_on_forward, MASK_EDITABLE | MASK_SINGLE | MASK_EDITING),
+ { "", NULL, NULL, NULL, 0},
- E_POPUP_SEPARATOR,
+ { N_("New _Appointment..."), NULL,
+ e_week_view_on_new_appointment, NULL, 0 },
- E_POPUP_ITEM (N_("_Delete this Appointment"), e_week_view_on_delete_appointment, MASK_EDITABLE | MASK_SINGLE | MASK_EDITING),
- E_POPUP_ITEM (N_("Make this Occurrence _Movable"), e_week_view_on_unrecur_appointment, MASK_RECURRING | MASK_EDITING),
- E_POPUP_ITEM (N_("Delete this _Occurrence"), e_week_view_on_delete_occurrence, MASK_RECURRING | MASK_EDITING),
- E_POPUP_ITEM (N_("Delete _All Occurrences"), e_week_view_on_delete_appointment, MASK_RECURRING | MASK_EDITING),
+ { "", NULL, NULL, NULL, MASK_SINGLE },
- E_POPUP_TERMINATOR
+ /*
+ * The following are only shown if this is a recurring event
+ */
+ { "", NULL, NULL, NULL, MASK_SINGLE},
+ { N_("Make this Occurrence _Movable"), NULL,
+ e_week_view_on_unrecur_appointment, NULL, MASK_RECURRING | MASK_EDITING },
+ { N_("Delete this _Occurrence"), NULL,
+ e_week_view_on_delete_occurrence, NULL, MASK_RECURRING | MASK_EDITING },
+ { N_("Delete _All Occurrences"), NULL,
+ e_week_view_on_delete_appointment, NULL, MASK_RECURRING | MASK_EDITING },
+
+ { NULL, NULL, NULL, NULL, 0 }
};
void
@@ -3551,7 +3527,7 @@ e_week_view_on_new_appointment (GtkWidget *widget, gpointer data)
}
gnome_calendar_new_appointment_for (
- week_view->calendar, dtstart, dtend, FALSE, FALSE);
+ week_view->calendar, dtstart, dtend, FALSE);
}
static void
@@ -3563,41 +3539,7 @@ e_week_view_on_new_event (GtkWidget *widget, gpointer data)
dtstart = week_view->day_starts[week_view->selection_start_day];
dtend = week_view->day_starts[week_view->selection_end_day + 1];
gnome_calendar_new_appointment_for (
- week_view->calendar, dtstart, dtend, TRUE, FALSE);
-}
-
-static void
-e_week_view_on_new_meeting (GtkWidget *widget, gpointer data)
-{
- EWeekView *week_view = E_WEEK_VIEW (data);
- time_t dtstart, dtend;
- struct icaltimetype itt;
-
- if (week_view->selection_start_day == week_view->selection_end_day) {
- dtstart = week_view->day_starts[week_view->selection_start_day];
- itt = icaltime_from_timet_with_zone (dtstart, FALSE,
- week_view->zone);
- itt.hour = calendar_config_get_day_start_hour ();
- itt.minute = calendar_config_get_day_start_minute ();
- dtstart = icaltime_as_timet_with_zone (itt, week_view->zone);
-
- icaltime_adjust (&itt, 0, 0, 30, 0);
- dtend = icaltime_as_timet_with_zone (itt, week_view->zone);
- } else {
- dtstart = week_view->day_starts[week_view->selection_start_day];
- dtend = week_view->day_starts[week_view->selection_end_day + 1];
- }
-
- gnome_calendar_new_appointment_for (
- week_view->calendar, dtstart, dtend, FALSE, TRUE);
-}
-
-static void
-e_week_view_on_new_task (GtkWidget *widget, gpointer data)
-{
- EWeekView *week_view = E_WEEK_VIEW (data);
-
- gnome_calendar_new_task (week_view->calendar);
+ week_view->calendar, dtstart, dtend, TRUE);
}
static void
@@ -3631,174 +3573,11 @@ e_week_view_on_edit_appointment (GtkWidget *widget, gpointer data)
week_view->popup_event_num);
if (week_view->calendar)
- gnome_calendar_edit_object (week_view->calendar, event->comp,
- FALSE);
- else
- g_warning ("Calendar not set");
-}
-
-static void
-e_week_view_on_print (GtkWidget *widget, gpointer data)
-{
- EWeekView *week_view;
- time_t start;
- GnomeCalendarViewType view_type;
- PrintView print_view;
-
- week_view = E_WEEK_VIEW (data);
-
- gnome_calendar_get_current_time_range (week_view->calendar, &start, NULL);
- view_type = gnome_calendar_get_view (week_view->calendar);
-
- switch (view_type) {
- case GNOME_CAL_WEEK_VIEW:
- print_view = PRINT_VIEW_WEEK;
- break;
-
- case GNOME_CAL_MONTH_VIEW:
- print_view = PRINT_VIEW_MONTH;
- break;
-
- default:
- g_assert_not_reached ();
- return;
- }
-
- print_calendar (week_view->calendar, FALSE, start, print_view);
-}
-
-static void
-e_week_view_on_save_as (GtkWidget *widget, gpointer data)
-{
- EWeekView *week_view;
- EWeekViewEvent *event;
- char *filename;
- char *ical_string;
- FILE *file;
-
- week_view = E_WEEK_VIEW (data);
-
- if (week_view->popup_event_num == -1)
- return;
-
- event = &g_array_index (week_view->events, EWeekViewEvent,
- week_view->popup_event_num);
-
- filename = e_file_dialog_save (_("Save as..."));
- if (filename == NULL)
- return;
-
- ical_string = cal_client_get_component_as_string (week_view->client, event->comp);
- if (ical_string == NULL) {
- g_warning ("Couldn't convert item to a string");
- return;
- }
-
- file = fopen (filename, "w");
- if (file == NULL) {
- g_warning ("Couldn't save item");
- return;
- }
-
- fprintf (file, ical_string);
- g_free (ical_string);
- fclose (file);
-}
-
-static void
-e_week_view_on_print_event (GtkWidget *widget, gpointer data)
-{
- EWeekView *week_view;
- EWeekViewEvent *event;
-
- week_view = E_WEEK_VIEW (data);
-
- if (week_view->popup_event_num == -1)
- return;
-
- event = &g_array_index (week_view->events, EWeekViewEvent,
- week_view->popup_event_num);
-
- print_comp (event->comp, week_view->client, FALSE);
-}
-
-static void
-e_week_view_on_meeting (GtkWidget *widget, gpointer data)
-{
- EWeekView *week_view;
- EWeekViewEvent *event;
-
- week_view = E_WEEK_VIEW (data);
-
- if (week_view->popup_event_num == -1)
- return;
-
- event = &g_array_index (week_view->events, EWeekViewEvent,
- week_view->popup_event_num);
-
- if (week_view->calendar)
- gnome_calendar_edit_object (week_view->calendar, event->comp, TRUE);
+ gnome_calendar_edit_object (week_view->calendar, event->comp);
else
g_warning ("Calendar not set");
}
-static void
-e_week_view_on_forward (GtkWidget *widget, gpointer data)
-{
- EWeekView *week_view;
- EWeekViewEvent *event;
-
- week_view = E_WEEK_VIEW (data);
-
- if (week_view->popup_event_num == -1)
- return;
-
- event = &g_array_index (week_view->events, EWeekViewEvent,
- week_view->popup_event_num);
-
- itip_send_comp (CAL_COMPONENT_METHOD_PUBLISH, event->comp,
- week_view->client, NULL);
-}
-
-static void
-e_week_view_on_publish (GtkWidget *widget, gpointer data)
-{
- EWeekView *week_view;
- icaltimezone *utc;
- time_t start = time (NULL), end;
- GList *comp_list;
-
- week_view = E_WEEK_VIEW (data);
-
- utc = icaltimezone_get_utc_timezone ();
- start = time_day_begin_with_zone (start, utc);
- end = time_add_week_with_zone (start, 6, utc);
-
- comp_list = cal_client_get_free_busy (week_view->client, NULL, start, end);
- if (comp_list) {
- GList *l;
-
- for (l = comp_list; l; l = l->next) {
- CalComponent *comp = CAL_COMPONENT (l->data);
- itip_send_comp (CAL_COMPONENT_METHOD_PUBLISH, comp,
- week_view->client, NULL);
-
- gtk_object_unref (GTK_OBJECT (comp));
- }
-
- g_list_free (comp_list);
- }
-}
-
-static void
-e_week_view_on_settings (GtkWidget *widget, gpointer data)
-{
- EWeekView *week_view;
-
- week_view = E_WEEK_VIEW (data);
-
- control_util_show_settings (week_view->calendar);
-}
static void
e_week_view_on_delete_occurrence (GtkWidget *widget, gpointer data)
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 809e3588e3..44e3b2b840 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -35,7 +35,6 @@
#include <libgnomeui/gnome-dialog.h>
#include <libgnomeui/gnome-dialog-util.h>
#include <liboaf/liboaf.h>
-#include <bonobo/bonobo-exception.h>
#include <gal/e-paned/e-hpaned.h>
#include <gal/e-paned/e-vpaned.h>
#include "e-util/e-url.h"
@@ -130,8 +129,8 @@ struct _GnomeCalendarPrivate {
/* The signal handler id for our GtkCalendar "day_selected" handler. */
guint day_selected_id;
- /* View instance and menus for the control */
- GalViewInstance *view_instance;
+ /* View collection and menus for the control */
+ GalViewCollection *view_collection;
GalViewMenus *view_menus;
/* Whether we are being destroyed and should not mess with the object
@@ -643,7 +642,13 @@ get_current_time (ECalendarItem *calitem, gpointer data)
cal->priv->zone);
/* Now copy it to the struct tm and return it. */
- tmp_tm = icaltimetype_to_tm (&tt);
+ tmp_tm.tm_year = tt.year - 1900;
+ tmp_tm.tm_mon = tt.month - 1;
+ tmp_tm.tm_mday = tt.day;
+ tmp_tm.tm_hour = tt.hour;
+ tmp_tm.tm_min = tt.minute;
+ tmp_tm.tm_sec = tt.second;
+ tmp_tm.tm_isdst = -1;
return tmp_tm;
}
@@ -910,6 +915,7 @@ gnome_calendar_init (GnomeCalendar *gcal)
priv->current_view_type = GNOME_CAL_DAY_VIEW;
priv->range_selected = FALSE;
+ setup_widgets (gcal);
priv->dn_query = NULL;
priv->sexp = g_strdup ("#t"); /* Match all */
@@ -917,7 +923,7 @@ gnome_calendar_init (GnomeCalendar *gcal)
priv->zone);
priv->selection_end_time = time_add_day_with_zone (priv->selection_start_time, 1, priv->zone);
- priv->view_instance = NULL;
+ priv->view_collection = NULL;
priv->view_menus = NULL;
priv->visible_start = -1;
@@ -999,9 +1005,9 @@ gnome_calendar_destroy (GtkObject *object)
g_hash_table_destroy (priv->object_editor_hash);
priv->object_editor_hash = NULL;
- if (priv->view_instance) {
- gtk_object_unref (GTK_OBJECT (priv->view_instance));
- priv->view_instance = NULL;
+ if (priv->view_collection) {
+ gtk_object_unref (GTK_OBJECT (priv->view_collection));
+ priv->view_collection = NULL;
}
if (priv->view_menus) {
@@ -1325,7 +1331,7 @@ gnome_calendar_set_view (GnomeCalendar *gcal, GnomeCalendarViewType view_type,
/* Callback used when the view collection asks us to display a particular view */
static void
-display_view_cb (GalViewInstance *view_instance, GalView *view, gpointer data)
+display_view_cb (GalViewCollection *view_collection, GalView *view, gpointer data)
{
GnomeCalendar *gcal;
CalendarView *cal_view;
@@ -1355,7 +1361,6 @@ gnome_calendar_setup_view_menus (GnomeCalendar *gcal, BonoboUIComponent *uic)
GnomeCalendarPrivate *priv;
char *path;
CalendarViewFactory *factory;
- static GalViewCollection *collection = NULL;
g_return_if_fail (gcal != NULL);
g_return_if_fail (GNOME_IS_CALENDAR (gcal));
@@ -1364,52 +1369,47 @@ gnome_calendar_setup_view_menus (GnomeCalendar *gcal, BonoboUIComponent *uic)
priv = gcal->priv;
- g_return_if_fail (priv->view_instance == NULL);
+ g_return_if_fail (priv->view_collection == NULL);
- g_assert (priv->view_instance == NULL);
+ g_assert (priv->view_collection == NULL);
g_assert (priv->view_menus == NULL);
- /* Create the view instance */
-
- if (collection == NULL) {
- collection = gal_view_collection_new ();
+ /* Create the view collection */
- path = gnome_util_prepend_user_home ("/evolution/views/calendar/");
- gal_view_collection_set_storage_directories (collection,
- EVOLUTION_DATADIR "/evolution/views/calendar/",
- path);
- g_free (path);
+ priv->view_collection = gal_view_collection_new ();
- /* Create the views */
+ path = gnome_util_prepend_user_home ("/evolution/views/calendar/");
+ gal_view_collection_set_storage_directories (priv->view_collection,
+ EVOLUTION_DATADIR "/evolution/views/calendar/",
+ path);
+ g_free (path);
- factory = calendar_view_factory_new (GNOME_CAL_DAY_VIEW);
- gal_view_collection_add_factory (collection, GAL_VIEW_FACTORY (factory));
- gtk_object_unref (GTK_OBJECT (factory));
+ /* Create the views */
- factory = calendar_view_factory_new (GNOME_CAL_WORK_WEEK_VIEW);
- gal_view_collection_add_factory (collection, GAL_VIEW_FACTORY (factory));
- gtk_object_unref (GTK_OBJECT (factory));
+ factory = calendar_view_factory_new (GNOME_CAL_DAY_VIEW);
+ gal_view_collection_add_factory (priv->view_collection, GAL_VIEW_FACTORY (factory));
+ gtk_object_unref (GTK_OBJECT (factory));
- factory = calendar_view_factory_new (GNOME_CAL_WEEK_VIEW);
- gal_view_collection_add_factory (collection, GAL_VIEW_FACTORY (factory));
- gtk_object_unref (GTK_OBJECT (factory));
+ factory = calendar_view_factory_new (GNOME_CAL_WORK_WEEK_VIEW);
+ gal_view_collection_add_factory (priv->view_collection, GAL_VIEW_FACTORY (factory));
+ gtk_object_unref (GTK_OBJECT (factory));
- factory = calendar_view_factory_new (GNOME_CAL_MONTH_VIEW);
- gal_view_collection_add_factory (collection, GAL_VIEW_FACTORY (factory));
- gtk_object_unref (GTK_OBJECT (factory));
+ factory = calendar_view_factory_new (GNOME_CAL_WEEK_VIEW);
+ gal_view_collection_add_factory (priv->view_collection, GAL_VIEW_FACTORY (factory));
+ gtk_object_unref (GTK_OBJECT (factory));
- /* Load the collection and create the menus */
+ factory = calendar_view_factory_new (GNOME_CAL_MONTH_VIEW);
+ gal_view_collection_add_factory (priv->view_collection, GAL_VIEW_FACTORY (factory));
+ gtk_object_unref (GTK_OBJECT (factory));
- gal_view_collection_load (collection);
- }
+ /* Load the collection and create the menus */
- priv->view_instance = gal_view_instance_new (collection, cal_client_get_uri (priv->client));
+ gal_view_collection_load (priv->view_collection);
- priv->view_menus = gal_view_menus_new (priv->view_instance);
+ priv->view_menus = gal_view_menus_new (priv->view_collection);
gal_view_menus_apply (priv->view_menus, uic, NULL);
- gtk_signal_connect (GTK_OBJECT (priv->view_instance), "display_view",
+ gtk_signal_connect (GTK_OBJECT (priv->view_collection), "display_view",
GTK_SIGNAL_FUNC (display_view_cb), gcal);
- display_view_cb (priv->view_instance, gal_view_instance_get_current_view (priv->view_instance), gcal);
}
/**
@@ -1429,13 +1429,13 @@ gnome_calendar_discard_view_menus (GnomeCalendar *gcal)
priv = gcal->priv;
- g_return_if_fail (priv->view_instance != NULL);
+ g_return_if_fail (priv->view_collection != NULL);
- g_assert (priv->view_instance != NULL);
+ g_assert (priv->view_collection != NULL);
g_assert (priv->view_menus != NULL);
- gtk_object_unref (GTK_OBJECT (priv->view_instance));
- priv->view_instance = NULL;
+ gtk_object_unref (GTK_OBJECT (priv->view_collection));
+ priv->view_collection = NULL;
gtk_object_unref (GTK_OBJECT (priv->view_menus));
priv->view_menus = NULL;
@@ -1682,8 +1682,6 @@ gnome_calendar_construct (GnomeCalendar *gcal)
priv = gcal->priv;
- setup_widgets (gcal);
-
/*
* Calendar Folder Client.
*/
@@ -1748,16 +1746,6 @@ gnome_calendar_new (void)
return GTK_WIDGET (gcal);
}
-void
-gnome_calendar_set_ui_component (GnomeCalendar *gcal,
- BonoboUIComponent *ui_component)
-{
- g_return_if_fail (GNOME_IS_CALENDAR (gcal));
- g_return_if_fail (ui_component == NULL || BONOBO_IS_UI_COMPONENT (ui_component));
-
- e_search_bar_set_ui_component (E_SEARCH_BAR (gcal->priv->search_bar), ui_component);
-}
-
/**
* gnome_calendar_get_cal_client:
* @gcal: A calendar view.
@@ -1813,7 +1801,7 @@ add_alarms (const char *uri)
CORBA_exception_init (&ev);
an = oaf_activate_from_id ("OAFIID:GNOME_Evolution_Calendar_AlarmNotify", 0, NULL, &ev);
- if (BONOBO_EX (&ev)) {
+ if (ev._major != CORBA_NO_EXCEPTION) {
g_message ("add_alarms(): Could not activate the alarm notification service");
CORBA_exception_free (&ev);
return;
@@ -1825,13 +1813,18 @@ add_alarms (const char *uri)
CORBA_exception_init (&ev);
GNOME_Evolution_Calendar_AlarmNotify_addCalendar (an, uri, &ev);
- if (BONOBO_USER_EX (&ev, ex_GNOME_Evolution_Calendar_AlarmNotify_InvalidURI))
- g_message ("add_calendar(): Invalid URI reported from the "
- "alarm notification service");
- else if (BONOBO_USER_EX (&ev, ex_GNOME_Evolution_Calendar_AlarmNotify_BackendContactError))
- g_message ("add_calendar(): The alarm notification service could "
- "not contact the backend");
- else if (BONOBO_EX (&ev))
+ if (ev._major == CORBA_USER_EXCEPTION) {
+ char *ex_id;
+
+ ex_id = CORBA_exception_id (&ev);
+ if (strcmp (ex_id, ex_GNOME_Evolution_Calendar_AlarmNotify_InvalidURI) == 0)
+ g_message ("add_calendar(): Invalid URI reported from the "
+ "alarm notification service");
+ else if (strcmp (ex_id,
+ ex_GNOME_Evolution_Calendar_AlarmNotify_BackendContactError) == 0)
+ g_message ("add_calendar(): The alarm notification service could "
+ "not contact the backend");
+ } else if (ev._major != CORBA_NO_EXCEPTION)
g_message ("add_calendar(): Could not issue the addCalendar request");
CORBA_exception_free (&ev);
@@ -1840,7 +1833,7 @@ add_alarms (const char *uri)
CORBA_exception_init (&ev);
bonobo_object_release_unref (an, &ev);
- if (BONOBO_EX (&ev))
+ if (ev._major != CORBA_NO_EXCEPTION)
g_message ("add_alarms(): Could not unref the alarm notification service");
CORBA_exception_free (&ev);
@@ -1895,25 +1888,31 @@ gnome_calendar_open (GnomeCalendar *gcal, const char *str_uri)
if (!uri) {
tasks_uri = g_strdup_printf ("%s/local/Tasks/tasks.ics", evolution_dir);
success = cal_client_open_calendar (priv->task_pad_client, tasks_uri, FALSE);
+
+ add_alarms (tasks_uri);
g_free (tasks_uri);
}
else {
if (!g_strncasecmp (uri->protocol, "file", 4)) {
tasks_uri = g_strdup_printf ("%s/local/Tasks/tasks.ics", evolution_dir);
- success = cal_client_open_calendar (priv->task_pad_client, tasks_uri, FALSE);
- g_free (tasks_uri);
}
else {
- success = cal_client_open_default_tasks (priv->task_pad_client, FALSE);
+ /* we use the default uri for tasks */
+ tasks_uri = calendar_config_get_default_tasks_uri ();
+ if (!tasks_uri)
+ tasks_uri = g_strdup_printf ("%s/local/Tasks/tasks.ics", evolution_dir);
}
+
+ success = cal_client_open_calendar (priv->task_pad_client, tasks_uri, FALSE);
+ add_alarms (tasks_uri);
+ g_free (tasks_uri);
+
}
g_free (real_uri);
e_uri_free (uri);
- if (success)
- add_alarms (cal_client_get_uri (priv->task_pad_client));
- else {
+ if (!success) {
g_message ("gnome_calendar_open(): Could not issue the request");
return FALSE;
}
@@ -2121,8 +2120,7 @@ editor_closed_cb (GtkWidget *widget, gpointer data)
}
void
-gnome_calendar_edit_object (GnomeCalendar *gcal, CalComponent *comp,
- gboolean meeting)
+gnome_calendar_edit_object (GnomeCalendar *gcal, CalComponent *comp)
{
GnomeCalendarPrivate *priv;
EventEditor *ee;
@@ -2146,6 +2144,7 @@ gnome_calendar_edit_object (GnomeCalendar *gcal, CalComponent *comp,
g_message ("gnome_calendar_edit_object(): Could not create the event editor");
return;
}
+
ec->gcal = gcal;
ec->uid = g_strdup (uid);
@@ -2157,8 +2156,6 @@ gnome_calendar_edit_object (GnomeCalendar *gcal, CalComponent *comp,
comp_editor_set_cal_client (COMP_EDITOR (ee), priv->client);
comp_editor_edit_comp (COMP_EDITOR (ee), comp);
- if (meeting)
- event_editor_show_meeting (ee);
}
comp_editor_focus (COMP_EDITOR (ee));
@@ -2178,8 +2175,7 @@ gnome_calendar_edit_object (GnomeCalendar *gcal, CalComponent *comp,
void
gnome_calendar_new_appointment_for (GnomeCalendar *cal,
time_t dtstart, time_t dtend,
- gboolean all_day,
- gboolean meeting)
+ gboolean all_day)
{
GnomeCalendarPrivate *priv;
struct icaltimetype itt;
@@ -2236,7 +2232,7 @@ gnome_calendar_new_appointment_for (GnomeCalendar *cal,
cal_component_commit_sequence (comp);
- gnome_calendar_edit_object (cal, comp, meeting);
+ gnome_calendar_edit_object (cal, comp);
gtk_object_unref (GTK_OBJECT (comp));
}
@@ -2257,7 +2253,7 @@ gnome_calendar_new_appointment (GnomeCalendar *gcal)
g_return_if_fail (GNOME_IS_CALENDAR (gcal));
gnome_calendar_get_current_time_range (gcal, &dtstart, &dtend);
- gnome_calendar_new_appointment_for (gcal, dtstart, dtend, FALSE, FALSE);
+ gnome_calendar_new_appointment_for (gcal, dtstart, dtend, FALSE);
}
/**
diff --git a/calendar/gui/main.c b/calendar/gui/main.c
index 5c7a2bc08f..b74b1040cd 100644
--- a/calendar/gui/main.c
+++ b/calendar/gui/main.c
@@ -34,7 +34,6 @@
#include <liboaf/liboaf.h>
#include <bonobo/bonobo-main.h>
#include <bonobo/bonobo-generic-factory.h>
-#include <bonobo/bonobo-exception.h>
#include <gal/widgets/e-cursors.h>
@@ -104,7 +103,7 @@ launch_alarm_daemon (void)
CORBA_exception_init (&ev);
an = oaf_activate_from_id ("OAFIID:GNOME_Evolution_Calendar_AlarmNotify", 0, NULL, &ev);
- if (BONOBO_EX (&ev)) {
+ if (ev._major != CORBA_NO_EXCEPTION) {
g_message ("add_alarms(): Could not activate the alarm notification service");
CORBA_exception_free (&ev);
return;
@@ -115,7 +114,7 @@ launch_alarm_daemon (void)
CORBA_exception_init (&ev);
bonobo_object_release_unref (an, &ev);
- if (BONOBO_EX (&ev))
+ if (ev._major != CORBA_NO_EXCEPTION)
g_message ("add_alarms(): Could not unref the alarm notification service");
CORBA_exception_free (&ev);
diff --git a/calendar/gui/tasks-control.c b/calendar/gui/tasks-control.c
index 53e3eb239f..1a1321b130 100644
--- a/calendar/gui/tasks-control.c
+++ b/calendar/gui/tasks-control.c
@@ -25,21 +25,9 @@
#include <gtk/gtksignal.h>
#include <libgnome/gnome-defs.h>
#include <libgnome/gnome-i18n.h>
-#include <libgnome/gnome-paper.h>
#include <libgnome/gnome-util.h>
-#include <libgnomeui/gnome-dialog.h>
-#include <libgnomeui/gnome-dialog-util.h>
-#include <libgnomeui/gnome-stock.h>
-#include <libgnomeprint/gnome-print.h>
-#include <libgnomeprint/gnome-print-copies.h>
-#include <libgnomeprint/gnome-print-master.h>
-#include <libgnomeprint/gnome-print-master-preview.h>
-#include <libgnomeprint/gnome-print-preview.h>
-#include <libgnomeprint/gnome-printer-dialog.h>
#include <bonobo/bonobo-control.h>
#include <bonobo/bonobo-ui-util.h>
-#include <gal/widgets/e-gui-utils.h>
-#include <e-util/e-dialog-utils.h>
#include "dialogs/cal-prefs-dialog.h"
#include "calendar-config.h"
#include "calendar-commands.h"
@@ -86,22 +74,13 @@ static void tasks_control_paste_cmd (BonoboUIComponent *uic,
static void tasks_control_delete_cmd (BonoboUIComponent *uic,
gpointer data,
const char *path);
-static void tasks_control_complete_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path);
-static void tasks_control_expunge_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path);
-static void tasks_control_print_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path);
-static void tasks_control_print_preview_cmd (BonoboUIComponent *uic,
+static void tasks_control_settings_cmd (BonoboUIComponent *uic,
gpointer data,
const char *path);
BonoboControl *
-tasks_control_new (void)
+tasks_control_new (void)
{
BonoboControl *control;
GtkWidget *tasks;
@@ -109,11 +88,11 @@ tasks_control_new (void)
tasks = e_tasks_new ();
if (!tasks)
return NULL;
+
gtk_widget_show (tasks);
control = bonobo_control_new (tasks);
if (!control) {
- gtk_widget_destroy (tasks);
g_message ("control_factory_fn(): could not create the control!");
return NULL;
}
@@ -243,9 +222,6 @@ sensitize_commands (ETasks *tasks, BonoboControl *control, int n_selected)
bonobo_ui_component_set_prop (uic, "/commands/TasksDelete", "sensitive",
n_selected == 0 ? "0" : "1",
NULL);
- bonobo_ui_component_set_prop (uic, "/commands/TasksMarkComplete", "sensitive",
- n_selected == 0 ? "0" : "1",
- NULL);
}
/* Callback used when the selection in the table changes */
@@ -265,18 +241,13 @@ static BonoboUIVerb verbs [] = {
BONOBO_UI_VERB ("TasksCopy", tasks_control_copy_cmd),
BONOBO_UI_VERB ("TasksPaste", tasks_control_paste_cmd),
BONOBO_UI_VERB ("TasksDelete", tasks_control_delete_cmd),
- BONOBO_UI_VERB ("TasksMarkComplete", tasks_control_complete_cmd),
- BONOBO_UI_VERB ("TasksExpunge", tasks_control_expunge_cmd),
- BONOBO_UI_VERB ("TasksPrint", tasks_control_print_cmd),
- BONOBO_UI_VERB ("TasksPrintPreview", tasks_control_print_preview_cmd),
+ BONOBO_UI_VERB ("TasksSettings", tasks_control_settings_cmd),
BONOBO_UI_VERB_END
};
static EPixmap pixmaps [] = {
E_PIXMAP ("/menu/File/New/NewFirstItem/NewTask", "new_task-16.png"),
- E_PIXMAP ("/menu/File/Print/Print", "print.xpm"),
- E_PIXMAP ("/menu/File/Print/PrintPreview", "print-preview.xpm"),
E_PIXMAP ("/menu/EditPlaceholder/Edit/TasksCut", "16_cut.png"),
E_PIXMAP ("/menu/EditPlaceholder/Edit/TasksCopy", "16_copy.png"),
E_PIXMAP ("/menu/EditPlaceholder/Edit/TasksPaste", "16_paste.png"),
@@ -287,7 +258,6 @@ static EPixmap pixmaps [] = {
E_PIXMAP ("/Toolbar/Copy", "buttons/copy.png"),
E_PIXMAP ("/Toolbar/Paste", "buttons/paste.png"),
E_PIXMAP ("/Toolbar/Delete", "buttons/delete-message.png"),
- E_PIXMAP ("/Toolbar/Print", "buttons/print.png"),
E_PIXMAP_END
};
@@ -303,8 +273,6 @@ tasks_control_activate (BonoboControl *control, ETasks *tasks)
uic = bonobo_control_get_ui_component (control);
g_assert (uic != NULL);
- e_tasks_set_ui_component (tasks, uic);
-
remote_uih = bonobo_control_get_remote_ui_container (control);
bonobo_ui_component_set_container (uic, remote_uih);
bonobo_object_release_unref (remote_uih, NULL);
@@ -349,11 +317,8 @@ static void
tasks_control_deactivate (BonoboControl *control, ETasks *tasks)
{
BonoboUIComponent *uic = bonobo_control_get_ui_component (control);
-
g_assert (uic != NULL);
- e_tasks_set_ui_component (tasks, NULL);
-
e_tasks_discard_view_menus (tasks);
/* Stop monitoring the "selection_changed" signal */
@@ -425,260 +390,17 @@ tasks_control_delete_cmd (BonoboUIComponent *uic,
e_tasks_delete_selected (tasks);
}
+/* Callback used for the tasks settings command */
static void
-tasks_control_complete_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path)
+tasks_control_settings_cmd (BonoboUIComponent *uic, gpointer data, const char *path)
{
ETasks *tasks;
+ static CalPrefsDialog *prefs_dialog = NULL;
tasks = E_TASKS (data);
- e_tasks_complete_selected (tasks);
-}
-static gboolean
-confirm_expunge (ETasks *tasks)
-{
- GtkWidget *dialog, *label, *checkbox;
- int button;
-
- if (!calendar_config_get_confirm_expunge ())
- return TRUE;
-
- dialog = gnome_dialog_new (_("Warning"),
- GNOME_STOCK_BUTTON_YES,
- GNOME_STOCK_BUTTON_NO,
- NULL);
- e_gnome_dialog_set_parent (GNOME_DIALOG (dialog),
- GTK_WINDOW (gtk_widget_get_ancestor (GTK_WIDGET (tasks),
- GTK_TYPE_WINDOW)));
-
- label = gtk_label_new (_("This operation will permanently erase all tasks marked as completed. If you continue, you will not be able to recover these tasks.\n\nReally erase these tasks?"));
-
- gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
- gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
- gtk_widget_show (label);
- gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), label, TRUE, TRUE, 4);
-
- checkbox = gtk_check_button_new_with_label (_("Do not ask me again."));
- gtk_widget_show (checkbox);
- gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), checkbox, TRUE, TRUE, 4);
-
- button = gnome_dialog_run (GNOME_DIALOG (dialog));
- if (button == 0 && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbox)))
- calendar_config_set_confirm_expunge (FALSE);
- gnome_dialog_close (GNOME_DIALOG (dialog));
-
- if (button == 0)
- return TRUE;
+ if (!prefs_dialog)
+ prefs_dialog = cal_prefs_dialog_new (CAL_PREFS_DIALOG_PAGE_TASKS);
else
- return FALSE;
-}
-
-static void
-tasks_control_expunge_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path)
-{
- ETasks *tasks;
-
- tasks = E_TASKS (data);
-
- if (confirm_expunge (tasks))
- e_tasks_delete_completed (tasks);
-}
-
-
-static void
-print_title (GnomePrintContext *pc,
- double page_width, double page_height)
-{
- GnomeFont *font;
- char *text;
- double w, x, y;
-
- font = gnome_font_new_closest ("Times", GNOME_FONT_BOLD, 0, 18);
-
- text = _("Tasks");
- w = gnome_font_get_width_utf8 (font, text);
-
- x = (page_width - w) / 2;
- y = page_height - gnome_font_get_ascender (font);
-
- gnome_print_moveto (pc, x, y);
- gnome_print_setfont (pc, font);
- gnome_print_setrgbcolor (pc, 0, 0, 0);
- gnome_print_show (pc, text);
-
- gtk_object_unref (GTK_OBJECT (font));
+ cal_prefs_dialog_show (prefs_dialog, CAL_PREFS_DIALOG_PAGE_TASKS);
}
-
-
-static void
-print_tasks (ETasks *tasks, gboolean preview, gboolean landscape,
- int copies, gboolean collate)
-{
- ECalendarTable *cal_table;
- EPrintable *printable;
- ETable *etable;
- GnomePrintMaster *master;
- GnomePrintContext *pc;
- const GnomePaper *paper_info;
- double l, r, t, b, page_width, page_height, left_margin, bottom_margin;
-
- cal_table = e_tasks_get_calendar_table (tasks);
- etable = e_calendar_table_get_table (E_CALENDAR_TABLE (cal_table));
- printable = e_table_get_printable (etable);
-
- master = gnome_print_master_new ();
-
- paper_info = gnome_paper_with_name (gnome_paper_name_default ());
- gnome_print_master_set_paper (master, paper_info);
-
- gnome_print_master_set_copies (master, copies, collate);
- pc = gnome_print_master_get_context (master);
- e_printable_reset (printable);
-
- l = gnome_paper_lmargin (paper_info);
- r = gnome_paper_pswidth (paper_info)
- - gnome_paper_rmargin (paper_info);
- t = gnome_paper_psheight (paper_info)
- - gnome_paper_tmargin (paper_info);
- b = gnome_paper_bmargin (paper_info);
-
- if (landscape) {
- page_width = t - b;
- page_height = r - l;
- left_margin = b;
- bottom_margin = gnome_paper_rmargin (paper_info);
- } else {
- page_width = r - l;
- page_height = t - b;
- left_margin = l;
- bottom_margin = b;
- }
-
- while (e_printable_data_left (printable)) {
- gnome_print_beginpage (pc, "Tasks");
- gnome_print_gsave (pc);
- if (landscape) {
- gnome_print_rotate (pc, 90);
- gnome_print_translate (pc, 0, -gnome_paper_pswidth (paper_info));
- }
-
- gnome_print_translate (pc, left_margin, bottom_margin);
-
- print_title (pc, page_width, page_height);
-
- e_printable_print_page (printable, pc,
- page_width, page_height - 24, TRUE);
-
- gnome_print_grestore (pc);
- gnome_print_showpage (pc);
- }
- gnome_print_master_close (master);
-
- if (preview) {
- GnomePrintMasterPreview *gpmp;
- gpmp = gnome_print_master_preview_new_with_orientation (master, _("Print Preview"), landscape);
- gtk_widget_show (GTK_WIDGET (gpmp));
- } else {
- gnome_print_master_print (master);
- }
-
- gtk_object_unref (GTK_OBJECT (master));
- gtk_object_unref (GTK_OBJECT (printable));
-}
-
-
-/* File/Print callback */
-static void
-tasks_control_print_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path)
-{
- ETasks *tasks;
- GtkWidget *gpd, *mode_box, *portrait_radio, *landscape_radio;
- GtkWidget *dialog_vbox, *dialog_hbox, *mode_frame;
- GList *children;
- GSList *group;
- gboolean preview = FALSE, landscape = FALSE;
- GnomePrinter *printer;
- int copies;
- gboolean collate;
-
- tasks = E_TASKS (data);
-
- gpd = gnome_print_dialog_new (_("Print Tasks"),
- GNOME_PRINT_DIALOG_COPIES);
-
- mode_frame = gtk_frame_new (_("Orientation"));
-
- mode_box = gtk_vbox_new (FALSE, 4);
- gtk_container_add (GTK_CONTAINER (mode_frame), mode_box);
-
- /* Portrait */
- portrait_radio = gtk_radio_button_new_with_label (NULL, _("Portrait"));
- group = gtk_radio_button_group (GTK_RADIO_BUTTON (portrait_radio));
- gtk_box_pack_start (GTK_BOX (mode_box), portrait_radio,
- FALSE, FALSE, 0);
-
- /* Landscape */
- landscape_radio = gtk_radio_button_new_with_label (group,
- _("Landscape"));
- gtk_box_pack_start (GTK_BOX (mode_box), landscape_radio,
- FALSE, FALSE, 0);
-
- gtk_widget_show_all (mode_frame);
-
- /* A bit of a hack to insert our own Orientation option. */
- dialog_vbox = GNOME_DIALOG (gpd)->vbox;
- children = gtk_container_children (GTK_CONTAINER (dialog_vbox));
- dialog_hbox = children->next->data;
- g_list_free (children);
- gtk_box_pack_start (GTK_BOX (dialog_hbox), mode_frame,
- FALSE, FALSE, 3);
-
- gnome_dialog_set_default (GNOME_DIALOG (gpd), GNOME_PRINT_PRINT);
-
- /* Run dialog */
- switch (gnome_dialog_run (GNOME_DIALOG (gpd))) {
- case GNOME_PRINT_PRINT:
- break;
-
- case GNOME_PRINT_PREVIEW:
- preview = TRUE;
- break;
-
- case -1:
- return;
-
- default:
- gnome_dialog_close (GNOME_DIALOG (gpd));
- return;
- }
-
- gnome_print_dialog_get_copies (GNOME_PRINT_DIALOG (gpd),
- &copies, &collate);
- if (GTK_TOGGLE_BUTTON (landscape_radio)->active)
- landscape = TRUE;
-
- printer = gnome_print_dialog_get_printer (GNOME_PRINT_DIALOG (gpd));
-
- gnome_dialog_close (GNOME_DIALOG (gpd));
-
- print_tasks (tasks, preview, landscape, copies, collate);
-}
-
-static void
-tasks_control_print_preview_cmd (BonoboUIComponent *uic,
- gpointer data,
- const char *path)
-{
- ETasks *tasks;
-
- tasks = E_TASKS (data);
-
- print_tasks (tasks, TRUE, FALSE, 1, FALSE);
-}
-
diff --git a/calendar/idl/evolution-calendar.idl b/calendar/idl/evolution-calendar.idl
index 7ad011aecf..d400f13c01 100644
--- a/calendar/idl/evolution-calendar.idl
+++ b/calendar/idl/evolution-calendar.idl
@@ -328,18 +328,12 @@ module Calendar {
exception BackendContactError {};
exception UnsupportedType {};
- typedef long CompEditorMode;
- const CompEditorMode EDITOR_MODE_EVENT = 1 << 0;
- const CompEditorMode EDITOR_MODE_ALLDAY_EVENT = 1 << 1;
- const CompEditorMode EDITOR_MODE_MEETING = 1 << 2;
- const CompEditorMode EDITOR_MODE_TODO = 1 << 3;
-
/* Loads a calendar and opens an editor for the specified object */
void editExisting (in string uri, in CalObjUID uid)
raises (InvalidURI, BackendContactError);
/* Loads a calendar and creates a new component of the specified type */
- void editNew (in string uri, in CompEditorMode mode)
+ void editNew (in string uri, in CalObjType type)
raises (InvalidURI, BackendContactError, UnsupportedType);
};
};
diff --git a/calendar/importers/GNOME_Evolution_Calendar_Importer.oaf.in b/calendar/importers/GNOME_Evolution_Calendar_Importer.oaf.in
index 710567dbc0..0460bf471f 100644
--- a/calendar/importers/GNOME_Evolution_Calendar_Importer.oaf.in
+++ b/calendar/importers/GNOME_Evolution_Calendar_Importer.oaf.in
@@ -24,28 +24,4 @@
_value="Imports iCalendar files into Evolution"/>
</oaf_server>
-
-<oaf_server iid="OAFIID:GNOME_Evolution_Calendar_vCalendar_Importer"
- type="factory"
- location="OAFIID:GNOME_Evolution_Calendar_ImporterFactory">
-
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME/Evolution/Importer:1.0"/>
- </oaf_attribute>
- <oaf_attribute name="evolution:menu-name" type="string"
- value="vCalendar files (.vcf)"/>
- <oaf_attribute name="description" type="string"
- _value="Imports vCalendar files into Evolution"/>
-
-</oaf_server>
-
-<oaf_server iid="OAFIID:GNOME_Evolution_Gnome_Calendar_Intelligent_Importer"
- type="factory"
- location="OAFIID:GNOME_Evolution_Calendar_ImporterFactory">
-
- <oaf_attribute name="repo_ids" type="stringv">
- <item value="IDL:GNOME/Evolution/IntelligentImporter:1.0"/>
- </oaf_attribute>
-
-</oaf_server>
</oaf_info>
diff --git a/calendar/pcs/cal-backend-file.c b/calendar/pcs/cal-backend-file.c
index 5ca5a06f0e..424912e87b 100644
--- a/calendar/pcs/cal-backend-file.c
+++ b/calendar/pcs/cal-backend-file.c
@@ -95,9 +95,6 @@ static CalBackendOpenStatus cal_backend_file_open (CalBackend *backend,
const char *uristr,
gboolean only_if_exists);
static gboolean cal_backend_file_is_loaded (CalBackend *backend);
-static Query *cal_backend_file_get_query (CalBackend *backend,
- GNOME_Evolution_Calendar_QueryListener ql,
- const char *sexp);
static CalMode cal_backend_file_get_mode (CalBackend *backend);
static void cal_backend_file_set_mode (CalBackend *backend, CalMode mode);
@@ -183,7 +180,6 @@ cal_backend_file_class_init (CalBackendFileClass *class)
backend_class->get_uri = cal_backend_file_get_uri;
backend_class->open = cal_backend_file_open;
backend_class->is_loaded = cal_backend_file_is_loaded;
- backend_class->get_query = cal_backend_file_get_query;
backend_class->get_mode = cal_backend_file_get_mode;
backend_class->set_mode = cal_backend_file_set_mode;
backend_class->get_n_objects = cal_backend_file_get_n_objects;
@@ -914,19 +910,6 @@ cal_backend_file_is_loaded (CalBackend *backend)
return (priv->icalcomp != NULL);
}
-/* get_query handler for the file backend */
-static Query *
-cal_backend_file_get_query (CalBackend *backend,
- GNOME_Evolution_Calendar_QueryListener ql,
- const char *sexp)
-{
- CalBackendFile *cbfile;
-
- cbfile = CAL_BACKEND_FILE (backend);
-
- return query_new (backend, ql, sexp);
-}
-
/* is_remote handler for the file backend */
static CalMode
cal_backend_file_get_mode (CalBackend *backend)
diff --git a/calendar/pcs/cal-backend.c b/calendar/pcs/cal-backend.c
index 95dc9957e6..e0dd3a713b 100644
--- a/calendar/pcs/cal-backend.c
+++ b/calendar/pcs/cal-backend.c
@@ -143,7 +143,6 @@ cal_backend_class_init (CalBackendClass *class)
class->get_uri = NULL;
class->open = NULL;
class->is_loaded = NULL;
- class->get_query = NULL;
class->get_mode = NULL;
class->set_mode = NULL;
class->get_n_objects = NULL;
@@ -298,32 +297,6 @@ cal_backend_is_loaded (CalBackend *backend)
}
/**
- * cal_backend_get_query:
- * @backend: A calendar backend.
- * @ql: The query listener.
- * @sexp: Search expression.
- *
- * Create a query object for this backend.
- */
-Query *
-cal_backend_get_query (CalBackend *backend,
- GNOME_Evolution_Calendar_QueryListener ql,
- const char *sexp)
-{
- Query *result;
-
- g_return_val_if_fail (backend != NULL, FALSE);
- g_return_val_if_fail (IS_CAL_BACKEND (backend), FALSE);
-
- if (CLASS (backend)->get_query != NULL)
- result = (* CLASS (backend)->get_query) (backend, ql, sexp);
- else
- result = query_new (backend, ql, sexp);
-
- return result;
-}
-
-/**
* cal_backend_get_mode:
* @backend: A calendar backend.
*
diff --git a/calendar/pcs/cal-backend.h b/calendar/pcs/cal-backend.h
index 4fd0a42bd0..7e9418d72e 100644
--- a/calendar/pcs/cal-backend.h
+++ b/calendar/pcs/cal-backend.h
@@ -81,10 +81,6 @@ struct _CalBackendClass {
gboolean (* is_loaded) (CalBackend *backend);
- Query *(* get_query) (CalBackend *backend,
- GNOME_Evolution_Calendar_QueryListener ql,
- const char *sexp);
-
/* Mode relate virtual methods */
CalMode (* get_mode) (CalBackend *backend);
void (* set_mode) (CalBackend *backend, CalMode mode);
@@ -132,10 +128,6 @@ CalBackendOpenStatus cal_backend_open (CalBackend *backend, const char *uristr,
gboolean cal_backend_is_loaded (CalBackend *backend);
-Query *cal_backend_get_query (CalBackend *backend,
- GNOME_Evolution_Calendar_QueryListener ql,
- const char *sexp);
-
CalMode cal_backend_get_mode (CalBackend *backend);
void cal_backend_set_mode (CalBackend *backend, CalMode mode);
diff --git a/calendar/pcs/cal.c b/calendar/pcs/cal.c
index 2944563163..ef0790f940 100644
--- a/calendar/pcs/cal.c
+++ b/calendar/pcs/cal.c
@@ -428,7 +428,7 @@ impl_Cal_get_query (PortableServer_Servant servant,
cal = CAL (bonobo_object_from_servant (servant));
priv = cal->priv;
- query = cal_backend_get_query (priv->backend, ql, sexp);
+ query = query_new (priv->backend, ql, sexp);
if (!query) {
bonobo_exception_set (ev, ex_GNOME_Evolution_Calendar_Cal_CouldNotCreate);
return CORBA_OBJECT_NIL;
diff --git a/camel/ChangeLog b/camel/ChangeLog
index c2b7d9d9c3..1ffcbf38d3 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,139 +1,31 @@
-2002-04-18 Not Zed <NotZed@Ximian.com>
-
- * providers/local/camel-local-store.c (rename_folder): If we get a
- failure, make sure we set an exception.
-
- * camel-text-index.c (camel_text_index_rename): If the file
- doesn't exist, just assume it never did, dont return failure.
- (text_index_rename): Add '.index' to the path name we're using,
- since we dont get it passed in.
-
- * camel-folder-search.c (check_header): When doing a contains
- match, split the words and perform an and on it.
- (match_words_messages): If we have an index, but were forced to do
- a full search, first lookup a subset of messages using
- the index and a simplified word set. Only do a manual search of
- this subset.
-
-2002-04-17 Not Zed <NotZed@Ximian.com>
-
- * camel-folder-search.c (match_message_index): Changed to take a
- utf8 string not a regex pattern.
- (match_words_index): Matches against a camel_search_words list.
- (match_words_1message): Matches a single message against a
- camel_search_words list.
- (match_words_message): Same, but gets the message from the folder
- for you.
- (match_words_messages): Matches a list of messages against a words
- list.
- (search_body_contains): Rewritten to handle multiple word
- searches. For #23371.
-
- * providers/imap/camel-imap-search.c (sync_match): Split words
- when searching, to support multiple search words. Also, try
- searching specifying charset of utf8 if we can, if that fails,
- fall back to not specifying charset. TODO: It should translate
- the strings into the locale default charset?
-
- * providers/imap/camel-imap-store.c (connect_to_server): Added new
- cap - utf8_search, if set, we tell the server we're searching
- using utf8, otherwise we dont (incorrectly, since we always use
- utf8 to search).
-
- * camel-search-private.c (camel_ustrstrcase): Make this class public.
- (camel_search_words_split): Split a word into multiple words based
- on whitespace, and keep track of whether the word is simple
- (indexable directly), or not.
- (camel_search_words_free): Free 'em.
-
-2002-04-17 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-vee-folder.c (vee_search_by_expression): If the vee-folder
- is the unmatched, we don't have our own expression so we cannot
- merge them. Instead, just use the expression passed in. This fixes
- a Null-Pointer-Read crash on Solaris systems at least.
-
-2002-04-16 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-filter-driver.c (camel_filter_driver_filter_folder): Get
- rid of an unused variable.
-
- * providers/smtp/camel-smtp-transport.c (smtp_helo): Use
- camel_gethostbyaddr since gethostbyaddr is not reentrant.
-
- * camel-http-stream.c (http_connect): Updated after the rename of
- camel_get_host_byname.
-
- * camel-service.c (camel_gethostbyname): Renamed.
- (camel_gethostbyaddr): New cancellable/reentrant version of
- gethostbyaddr.
-
-2002-04-14 Jeffrey Stedfast <fejj@ximian.com>
-
- * providers/local/camel-spoold-store.c: Added #include
- <sys/types.h> for dirent.h which needs it on MacOS X.
-
- * providers/local/camel-maildir-store.c: Same.
-
- * providers/nntp/camel-nntp-store.c: Same.
-
- * providers/imap/camel-imap-message-cache.c: Same.
-
- * camel-provider.c: Same.
-
- * camel-data-cache.c: Same.
-
-2002-04-12 Jeffrey Stedfast <fejj@ximian.com>
-
- * broken-date-parser.c (datetok): Treat commas as token
- delimeters.
- (WEEKDAY_CHARS): Use full weekday names in case the broken mailer
- used the full names.
- (MONTH_CHARS): Same as above but for months.
-
-2002-04-11 Not Zed <NotZed@Ximian.com>
+2002-04-16 Not Zed <NotZed@Ximian.com>
* providers/local/camel-spool-summary.c (spool_summary_sync_full):
- If the last message(s) were deleted, and we had any messages
- output, account for the lost \n of the following From line by
- adding an extra \n. fix for #8214.
-
-2002-04-10 Not Zed <NotZed@Ximian.com>
-
- * camel-mime-part-utils.c (convert_buffer): If we get a 0 length
- input, return a 0 lenght output as valid - fixes bugs with some
- iconv impl and its simpler anyway.
-
-2002-04-11 Jeffrey Stedfast <fejj@ximian.com>
-
- * providers/imap/camel-imap-folder.c: Set the UID_SET_LIMIT value
- to 4096. I ran into an issue tonight where apparently the IMAP
- server changed the UIDVALIDITY and so Evo needed to re-fetch all
- headers and it was trying to send a uid set of some 25k (yes, I
- have a very large INBOX). Anyways, it was set to unlimited
- before. Courier IMAPd can safely handle up to ~16k per token, but
- UW IMAPd can only handle 8k per command-line, so I set it to 4k
- just to be safe.
-
-2002-04-10 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-mime-part-utils.c (convert_buffer): Fixed a bug that would
- miscalculate how much data to copy into the GByteArray (negative
- value) thus causing a segfault. Also optimized it while I was at
- it.
+ Backport from head. If the last message(s) were deleted, and we
+ had any messages output, account for the lost \n of the following
+ From line by adding an extra \n. fix for #8214.
+ (camel_spool_summary_build_from): Backport from head. The day
+ number has to be 2 chars wide, space filled to work properly with
+ pine, etc.
2002-04-09 Jeffrey Stedfast <fejj@ximian.com>
* camel-store.c (camel_store_init): Make the folder_lock
recursive. See bug #22363 for details. Basically,
get_folder_info() is requesting a diary folder which in turn
- connects which requests then calls get_folder() but deadlocks
- because get_folder_info already holds the lock.
+ connects which then calls get_folder() but deadlocks because
+ get_folder_info already holds the lock.
* camel-mime-message.c (camel_mime_message_set_date): Don't adjust
the timezone offset if we used tm.tm_gmtoff because it is already
adjusted.
+2002-04-09 Jeffrey Stedfast <fejj@ximian.com>
+
+ * camel-tcp-stream-ssl.c (stream_connect): Backport non-blocking
+ connect code. Hopefully this fixes the Operation In Progress
+ errors.
+
2002-04-09 Not Zed <NotZed@Ximian.com>
* camel-mime-part.c (construct_from_parser): If we get multiple
@@ -144,13 +36,6 @@
2002-04-08 Not Zed <NotZed@Ximian.com>
- * camel-vtrash-folder.c (vtrash_move_messages_to): If we find
- we're moving from the vtrash to another folder, we need to convert
- the uid from a vfolder uid to the source uid (+8). Fix for
- #20886. Also changed to batch multiple moves to different folders
- so they are done as efficiently as possible rather than one at a
- time.
-
* camel-mime-utils.c (base64_decode_step): If we only get passed
'=', we back track only if we actually output any data. Fix for
#21716.
@@ -160,1058 +45,36 @@
unsigned. This is only an internal func.
(quoted_encode): Return size_t just for consistency.
- * camel-block-file.c (block_file_validate_root): Comment out the
- debug and move it into a warning when the validation fails.
-
-2002-04-08 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-mime-utils.c (uuencode_close): Don't count our filler when
- encoding our line-length octet.
-
-2002-04-05 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-http-stream.c (http_get_headers): Don't get the statuscode
- here anymore.
- (http_method_invoke): Use a User-Agent header and do basic proxy
- authentication.
- (stream_read): Handle redirects.
- (camel_http_stream_set_user_agent): New function to allow client
- to set the User-Agent string.
- (camel_http_stream_set_proxy): New function for setting the proxy
- server.
- (camel_http_stream_set_proxy_authrealm): New function for setting
- the proxy auth realm.
- (camel_http_stream_set_proxy_authpass): New function for setting
- the proxy auth password.
-
-2002-04-04 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-folder-summary.c (message_info_new): Simplified since we
- can now decode in-reply-to without getting extra cruft. Get rid of
- the FIXME about having to check scan->id because of the
- possibility of it being NULL, this can no longer happen.
-
- * camel-mime-utils.c (header_references_inreplyto_decode): New
- function to decode in-reply-to headers. Only grabs the first thing
- that looks like a message-id and then returns.
- (header_references_decode): Loop calling
- header_references_decode_single (a new internal function).
-
-2002-04-04 Not Zed <NotZed@Ximian.com>
-
- * providers/imap/camel-imap-search.c (imap_body_contains): If
- (body-contains) is not passed any arguments, return empty/false.
- Fixes a crash exposed by #15001.
-
- * camel-remote-store.c (remote_connect): Reset the keepalive
- timeout to 10 minutes rather than the 30 seconds I was using for
- testing.
-
-2002-04-03 Dan Winship <danw@ximian.com>
-
- * camel-provider.h (CamelProvider): make service_cache be an array
- of CAMEL_NUM_PROVIDER_TYPES elements so you can have a single
- provider offer both stores and transports. (Eg, Exchange, NNTP)
-
- * providers/imap/camel-imap-provider.c: Don't initialize
- service_cache here. (The session code can do it itself since the
- url_hash and url_equal functions are stored as part of the
- provider.)
-
- * providers/nntp/camel-nntp-provider.c: Likewise.
-
- * providers/local/camel-local-provider.c: Likewise.
-
- * providers/pop3/camel-pop3-provider.c: Likewise.
-
- * providers/sendmail/camel-sendmail-provider.c: Likewise.
-
- * providers/smtp/camel-smtp-provider.c: Likewise.
-
- * camel-session.c (register_provider): Initialize the provider's
- service cache(s) here.
- (camel_session_class_init): Don't initialize.
- vee_provider.service_cache here.
- (camel_session_destroy_provider): Update to destroy multiple
- service_caches.
- (service_cache_remove, get_service): Tweak these a bit to deal
- with multiple service_caches.
-
-2002-04-02 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-tcp-stream-ssl.c (set_errno): Handle a ton more nspr i/o
- errno's.
- (stream_connect): Act as if we are doing a non-blocking
- connect. This is to try and work around bug #15120 where users get
- an EINPROGRESS error. Maybe importing a PRFileDesc into SSL mode
- automagically makes it non-blocking? I dunno.
-
-2002-04-01 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-folder-summary.c (message_info_new): Updated the
- construction of the references to match JWZ's updated algorithm
- initialization (ie, append any In-Reply-To reference onto any
- References header and never take more than a single message-id
- from the In-Reply-To header since anything after the first will
- probably just be email addresses). Fixes bug #1336.
-
-2002-04-03 Not Zed <NotZed@Ximian.com>
-
- * providers/local/camel-local-folder.c
- (camel_local_folder_construct): Turn indexing back on, fingers
- crossed ...
-
- * camel-block-file.c (sync_nolock): #!@$@$#@~#$
- DF@#$!Q@$#!@$#!#%. Well it helps if we're iterating a list to
- iterate the node pointer ...
-
- * camel-text-index.c (text_index_sync): Sync the key tables
- explcitly.
- (text_index_sync): Debug out frag info.
- (camel_text_index_dump): Added a (rather large, but optional) raw
- dumping mode for debugging purposes.
-
- * camel-partition-table.c (camel_key_table_finalise): Sync root
- block when done.
- (camel_key_table_sync): New function, sync key table (root) explicitly.
- (camel_partition_table_sync): Method to explicitly sync the
- partition table.
-
-2002-04-02 Not Zed <NotZed@Ximian.com>
-
- * camel-block-file.c (camel_block_file_free_block): Mark root
- block dirty when we change it (this function isn't used yet
- anyway).
-
- * camel-text-index.c (text_index_add_name_to_word): Touch the root
- block when we modify the counts. Also, abort processing on any
- errors.
- (text_index_sync): Fix typo in comments. Sync the block file
- inside the lock.
- (text_index_compress_nosync): Lock the old index while we're
- compressing.
- (text_index_compress_nosync): Remove the bogus while() at the end
- of the while() loops! Also plug a memleak - records weren't
- freed.
- (text_index_rename): Lock around rename op.
- (text_index_add_name): More typos.
- (text_index_sync): Touch root when changing it.
- (text_index_add_name): "
- (text_index_delete_name): "
- (camel_text_index_new): Touch root if we change it.
- (text_index_cursor_reset): Make sure we NULL pointers after we
- free them (nothing uses this yet).
-
- * camel-partition-table.c (hash_key): Remove some debug
- accidentally left in.
- (camel_partition_table_add): When linking in the next block list,
- set the right previous pointer.
- (camel_key_table_add): Simplify the 'left' calculation (it was
- already ok though).
- (camel_key_table_next): Initialise returns before processing.
- Broaden the lock slightly, and simplify validity calculations.
-
- * providers/imap/camel-imap-store.c (imap_keepalive): Put back in
- the exception setup stuff i disabled for debugging.
-
- * providers/local/camel-local-folder.c
- (camel_local_folder_construct): Temporarily disable indexing.
-
-2002-03-28 Not Zed <NotZed@Ximian.com>
-
- * camel-partition-table.c (camel_key_table_lookup): Change range
- checking assert to a warning.
-
- * providers/pop3/camel-pop3-folder.c (pop3_finalize): Make sure we
- flush out all outstanding commands before finalising, stops being
- finalised while outsanding requests are processed by the store
- finalise.
- (pop3_get_message): Instead of pre-fetching all messages, just
- pre-fetch a maxiumum number at any one time, stops us running out
- of cache fd's.
-
- * providers/nntp/camel-nntp-folder.c (nntp_folder_init/finalise):
- Setup priv data + locks, & free.
-
- * providers/imap/camel-imap-folder.c (imap_rescan): Batch all
- message_chagned events into a single folder_changed event
- (otherwise updates can be >>> expensive, like >5 hours for 80K
- messages changing!). Alternately it could use folder
- freeze/unfreeze perhaps.
-
-2002-03-27 Not Zed <NotZed@Ximian.com>
-
- * providers/imap/camel-imap-store.c (imap_keepalive): Pass an
- exception to called code so it behaves properly since it uses the
- passed exception to check returns.
-
-2002-04-01 Dan Winship <danw@ximian.com>
-
- * providers/imap/Makefile.am (libcamelimap_la_LDFLAGS): Use
- -avoid-version instead of -version-info 0:0:0, and specify
- -module. (From Max Horn <max@quendi.de>).
-
- * providers/local/Makefile.am (libcamellocal_la_LDFLAGS): Likewise.
-
- * providers/nntp/Makefile.am (libcamelnntp_la_LDFLAGS): Likewise.
-
- * providers/sendmail/Makefile.am (libcamelsendmail_la_LDFLAGS):
- Likewise.
-
- * providers/smtp/Makefile.am (libcamelsmtp_la_LDFLAGS): Likewise.
-
- * providers/pop3/Makefile.am (libcamelpop3_la_LDFLAGS): Likewise.
- Also remove $(KRB4_LDFLAGS) since KPOP is gone.
- (INCLUDES): and $(KRB4_CFLAGS)
-
-2002-03-28 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-filter-driver.c (do_copy): We now have to check to make
- sure that p->message is non-NULL because we only load the message
- when we have to.
- (do_move): Same here.
-
-2002-03-28 Dan Winship <danw@ximian.com>
-
- * camel-transport.c (camel_transport_send_to): Change the message
- arg to a CamelMimeMessage instead of a CamelMedium. Even the NNTP
- provider returns CamelMimeMessages, and we're never going to
- support anything more exotic than that. Also do a few more
- g_return_if_fails here instead of in the providers.
- (camel_transport_can_send): No longer needed.
- (camel_transport_send): Remove this too. It wasn't being used any
- more, and it doesn't behave exactly the same in sendmail and smtp.
-
- * providers/smtp/camel-smtp-transport.c (smtp_send,
- smtp_can_send): Gone.
- (smtp_send_to): Update for arg change.
- (smtp_data): Make this take a CamelMimeMessage too.
-
- * providers/sendmail/camel-sendmail-transport.c (sendmail_send,
- sendmail_can_send): Gone.
- (sendmail_send_to): Update for arg change, and merge in the part
- that used to be shared with sendmail_send.
-
-2002-03-27 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-filter-driver.c (camel_filter_driver_filter_folder):
- Construct the source_url the right way. The previous way was
- generating urls like pop://fejj@ximian.com;keep_on_server/inbox
- which is wrong.
-
-2002-03-26 Not Zed <NotZed@Ximian.com>
-
- * camel-text-index.c (text_index_normalise): Changed to use just
- g_utf8_strdown instead of utf8_normalise, to match the indexing
- code. utf8_normalise is just far too expensive (saves approx 25%
- total processing).
-
-2002-03-25 Not Zed <NotZed@Ximian.com>
-
- * camel-text-index.c (text_index_add_name): When we add a new
- name, up all of the cache limits, because we're probably going to
- be adding more.
- (text_index_sync): Drop the cache limits back down again, we dont
- need them when looking words up.
-
- ** MERGE camel_index branch.
-
- * camel-text-index.[ch]: Added files i forgot to add (eep nearly
- lost all this work!)
-
- * camel-block-file.c (sync_nolock): Fix an infinite loop in syncing.
-
-2002-03-21 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-folder-summary.c (camel_message_info_new_from_header): Use
- the date in the received header for the received_date.
-
-2002-03-22 Not Zed <NotZed@Ximian.com>
-
- * providers/local/camel-local-folder.c
- (camel_local_folder_construct): Use the right option to remove the
- index file and reset the index file on creation.
- (camel_local_folder_construct): Remove any existing '.ibex' files
- - these are the old format index files.
-
- * camel-block-file.c (camel_block_file_rename): Lock io lock while
- renaming.
- (camel_key_file_rename): Lock around rename.
- (block_file_validate_root): Implement sync flag checking.
- (camel_block_file_touch_block): Turn off the sync flag if we're
- touching any non-root block and write it to disk. Shoudl this
- fsync()?
- (sync_nolock): sync the root block only if we need to.
-
- * providers/local/camel-local-store.c (rename_folder): Re-enable
- index rename code. Not sure how race-free it is though.
- (delete_folder): Delete the index file properly.
-
- * camel-partition-table.c (camel_key_table_lookup): Initialise
- output values to 0 before doing anything.
- (camel_key_table_add): Do some range-checking on values.
-
- * camel-text-index.c (text_index_compress): Changed to call sync here.
- (text_index_compress_nolock): and not here - stops a recursive
- sync call when sync performs a compress also.
- (text_index_compress_nolock): Change to _nosync, since the locking
- is irrelevent (recursive lock). Fixed callers.
- (text_index_add_name_to_word): If we get a failure with key table
- ops, fail immediately.
- (text_index_compress_nosync): Likewise.
- (text_index_write_name): If the nameid is 0, do nothing.
- (text_index_add_name): If we can't get a keyid, dont add it to the
- partition table.
- (camel_text_index_remove): Function to delete an index file.
- (text_index_compress_nosync): Clean up temp files when done.
-
- * camel-folder-search.c (match_messages_index): New function,
- split from body_contains, matches a regex against all words in an
- index.
- (match_message_index): Similar to above but matches against an
- individual message.
- (search_body_contains): Changed to use above functions for
- matching - substring matches should now work on indexed data.
-
-2002-03-21 Not Zed <NotZed@Ximian.com>
-
- * camel-index.c (camel_index_words/names): New virtual
- methods/stubs to get a cursor of all words and names.
-
- * camel-text-index.c (text_index_compress_nolock): Split from
- text_index_compress, so we can call the compressor while locked
- also, removed lock calls.
- (text_index_compress): Changed to stub which calls
- text_index_compress_nolock.
- (camel_text_index_key_cursor_new): New object to iterate through
- a key table.
- (text_index_words, text_index_names): Implement virtual functions
- for iterating through all words or names.
-
- * camel-block-file.c: Turn off some debug.
-
-2002-03-20 Not Zed <NotZed@Ximian.com>
-
- ** New body index implementation.
-
- * camel-index*: Code for camel index, a new class to replace ibex.
-
- * camel-block-file.[ch]: block-based and link based
- filesystem-in-a-file classes.
-
- * camel-partition-table.[ch]: An implementation of a partition
- table (automatically extending on-disk hash-table using ideal
- hash), and a key-table, a key<>name mapping table. Used by
- camelindex.
-
- * providers/local/*, camel-folder-summary.[ch]: Changed to use
- camel-index interface rather than ibex.
-
-2002-03-05 Not Zed <NotZed@Ximian.com>
-
- * providers/local/camel-maildir-summary.c (maildir_summary_check):
- Do progress reporting of operations.
- (maildir_summary_sync): Same here.
-
-2002-03-04 Not Zed <NotZed@Ximian.com>
-
- * providers/local/camel-spoold-store.c (scan_dir): Kill a warning
- with a cast.
-
- * providers/local/camel-*.c: Changed for ibex->camelindex.
-
- * camel-folder-search.c (camel_folder_search_set_summary): Init
- summary_hash to point to 'static' uid strings.
- (search_body_contains): Use the static uid memory to return
- results rather than the values from the index library.
-
- * camel-folder-search.[ch]: Changed to use camelindex object.
-
- * camel-folder-summary.c (summary_build_content_info_message):
- Use a stream to index content, also filter html mail first.
- (camel_folder_summary_info_new_from_message): Use a stream
- filtered to index content.
- (main): Removed the test main code. Added headers for open call
- (ibex must've had them before).
-
- * camel-folder-summary.[ch]: Changed from ibex to CamelIndex.
-
- * camel-mime-filter-index.c (camel_mime_filter_index_finalize):
- Unref index.
-
- * camel-mime-filter-index.[ch]: Changed from ibex to CamelIndex.
-
-2002-03-19 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-mime-utils.c (header_encode_param): Fix this to work
- right. We need to convert the input buffer to the charset we claim
- in the encoded param (duh).
-
-2002-03-18 Jeffrey Stedfast <fejj@ximian.com>
-
- * providers/smtp/camel-smtp-transport.c
- (connect_to_server_wrapper): Updated to use the same logic as the
- POP code.
-
- * providers/pop3/camel-pop3-store.c (connect_to_server): No longer
- takes a stls_supported argument since we no longer need it with
- the new logic.
- (connect_to_server_wrapper): New logic: First try connecting to
- the SSL port (995 by default), if that fails with
- SERVICE_UNAVAILABLE, then we attempt to connect (to port 110 by
- default) and try to use STARTTLS.
-
-2002-03-15 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-folder.h:
-
- * camel-private.h: Don't allow any empty structs. If
- !ENABLE_THREADS, provide a gpointer dummy member. Fixes bug #6382.
-
-2002-03-13 Jeffrey Stedfast <fejj@ximian.com>
-
- * providers/smtp/camel-smtp-transport.c (smtp_auth): Added a
- work-around for SMTP servers that can't read the RFCs and thus
- implement SASL incorrectly. Oh well, that's life in the world of
- mail clients I guess.
-
-2002-03-12 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-digest-store.c (camel_digest_store_new): Now takes a url
- argument.
-
- * camel-digest-folder.c (digest_add_multipart): Fixed some memory
- corruption and also modified to use CAMEL_IS_MIME_MESSAGE() rather
- than comparing content-type strings.
- (digest_get_message): Fixed a logic blooper.
-
- * camel-folder-summary.c (camel_message_info_new_from_header): Set
- the date fields of the CamelMessageInfo as well. This may even fix
- some filter-related bugs where the user was trying to compare
- dates.
-
-2002-03-11 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-digest-store.c: A pretty empty store implementation to be
- the parent store of a CamelDigestFolder.
-
- * camel-digest-folder.c: Updated to reference it's parent store.
-
-2002-03-11 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-digest-folder.c (camel_digest_folder_new): Allow any leaf
- part to be a message/rfc822 part.
- (digest_get_uids): Recurse the mime structure and add all
- message/rfc822 parts and use a uid scheme similar to IMAP's mime
- part naming convention.
- (digest_get_message): Decode the uid to get the correct mime part.
-
-2002-03-11 Ettore Perazzoli <ettore@ximian.com>
-
- * camel-mime-utils.c: Change the order of the mailing list magic
- patterns so that the more mailing-list specific ones are on the
- top.
-
-2002-03-11 Jeffrey Stedfast <fejj@ximian.com>
-
- These fixes should fix bug #21737.
-
- * providers/smtp/camel-smtp-transport.c
- (connect_to_server_wrapper): Same as with the POP code.
-
- * providers/pop3/camel-pop3-store.c (connect_to_server_wrapper):
- Slight restructuring of the if-statements for the USE_SSL_ALWAYS
- case so that we can't possibly return TRUE unless we really did
- connect successfully.
-
-2002-03-10 Dan Winship <danw@ximian.com>
-
- Rename the OpenSSL implementation of things to match the NSS
- implementation so that callers don't need to care which one is
- being used.
-
- * camel-tcp-stream-openssl.c: Implement CamelTcpStreamSSL, not
- CamelTcpStreamOpenSSL. Rename methods as well. Replace the
- camel-tcp-stream-openssl.h include with camel-tcp-stream-ssl.h.
-
- * camel-tcp-stream-openssl.h: Gone.
-
- * camel-tcp-stream-ssl.c: Add a note explaining that this
- implementation is only used for NSS, and that OpenSSL's
- implementation is in another file. (Should probably do some CVS
- renaming magic at some point.)
-
- * camel-http-stream.c (http_connect): Remove OpenSSL refs; the
- previously-NSS-specific code works for both now.
-
- * camel-remote-store.c: Likewise.
-
- * providers/smtp/camel-smtp-transport.c: Likewise.
-
- * providers/pop3/camel-pop3-store.c: Likewise.
-
- * Makefile.am (libcamelinclude_HEADERS): Remove
- camel-tcp-stream-openssl.h
-
-2002-03-10 Dan Winship <danw@ximian.com>
-
- * camel-tcp-stream.c (camel_tcp_stream_get_socket): Remove this:
- it couldn't be generically used, because different subclasses
- returned entirely different types of data.
- (camel_tcp_stream_get_local_address,
- camel_tcp_stream_get_remote_address): Add these to replace what
- get_socket was being used for.
- (camel_tcp_address_new, camel_tcp_address_free): Utility functions
- for get_{local,remote}_address.
-
- * providers/smtp/camel-smtp-transport.c: Change localaddr to a
- CamelTcpAddress *.
- (connect_to_server): Call camel_tcp_stream_get_local_address to
- get the local IP address.
- (smtp_disconnect): free localaddr.
- (smtp_helo): Update for localaddr change.
-
- * camel-tcp-stream-raw.c (stream_get_socket): Remove
- (stream_get_local_address, stream_get_remote_address): Implement.
-
- * camel-tcp-stream-ssl.c (stream_get_socket): Remove
- (stream_get_local_address, stream_get_remote_address): Implement.
-
- * camel-tcp-stream-openssl.c (stream_get_socket): Remove
- (stream_get_local_address, stream_get_remote_address): Implement.
-
-2002-03-08 Jeffrey Stedfast <fejj@ximian.com>
-
- * providers/pop3/camel-pop3-provider.c
- (camel_provider_module_init): Don't call
- camel_remote_store_get_authtypes since we no longer subclass
- camel-remote-store.
-
- * providers/pop3/camel-pop3-engine.c: Added STARTTLS to the
- capabilities to look for.
- (camel_pop3_engine_reget_capabilities): New function to re-get
- capabilities.
-
- * providers/pop3/camel-pop3-store.c: Updated to not subclass
- CamelRemoteStore.
- (connect_to_server): Rewritten to not depend on CamelRemoteStore's
- connect implementation. Also added support for STLS (aka
- STARTTLS).
-
-2002-03-07 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-pgp-mime.c (camel_pgp_mime_part_sign): Add support for
- hash type RIPEMD160.
-
- * camel-cipher-context.h: Add RIPEMD160 hash type.
-
- * camel-pgp-context.c (pgp_sign): Updated to consider hash
- function for pgp5 and pgp6.
- (pgp_clearsign): Same.
-
- * camel-tcp-stream-openssl.c (stream_read): Add a timeout on the
- select.
- (stream_write): Same.
-
-2002-03-06 Jeffrey Stedfast <fejj@ximian.com>
-
- * providers/smtp/camel-smtp-transport.c (connect_to_server): Fix
- to work with OpenSSL.
-
- * camel-tcp-stream-openssl.c: compile fixes.
- (camel_tcp_stream_openssl_enable_ssl): Check to make sure that the
- sockfd != -1, it's not enough to check that it is non-zero. Also
- set the sockfd to -1 on fail (open_ssl_connection will close the
- sockfd on fail).
-
-2002-03-06 Dan Winship <danw@ximian.com>
-
- * providers/smtp/camel-smtp-transport.c (smtp_construct): Make
- this compile.
-
-2002-03-05 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-tcp-stream-ssl.c (save_ssl_cert): Removed. Glory glory
- hallelujah!
- (ssl_bad_cert): No longer calls ssl_save_cert or
- ssl_cert_is_saved.
-
-2002-03-05 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-tcp-stream-openssl.c (camel_tcp_stream_openssl_new_raw):
- Start the ssl stream off in non-ssl mode (useful for STARTTLS).
- (camel_tcp_stream_openssl_enable_ssl): New function to toggle an
- ssl stream into ssl mode.
- (open_ssl_connection): Close the sockfd on fail so our caller
- doesn't have to - this also allows us to save the original errno.
- (stream_connect): If we want ssl mode, do our ssl stuff.
- (camel_tcp_stream_openssl_class_init): Init some SSL stuff here
- instead of in open_ssl_connection since these only ever need to be
- called once.
- (stream_read): Only use SSL_read if we are in ssl mode.
- (stream_write): Only use SSL_write if we are in ssl mode.
-
- * providers/smtp/camel-smtp-transport.c (smtp_helo): Check for the
- STARTTLS extension.
- (connect_to_server): Try to use STARTTLS whenever possible rather
- than the old way of doing things.
- (connect_to_server_wrapper): Wrapper around connect_to_server() to
- first try STARTTLS and then attempt normal SSL mode if we can't
- connect via STARTTLS.
-
- * camel-tcp-stream-ssl.c (camel_tcp_stream_ssl_enable_ssl): New
- function to toggle an ssl stream into ssl mode.
- (camel_tcp_stream_ssl_new_raw): Start the ssl stream off in
- non-ssl mode (useful for STARTTLS).
- (stream_connect): Only connect in SSL mode if required.
-
-2002-03-01 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-vtrash-folder.h:
- * camel-vee-store.h:
- * camel-vee-folder.h:
- * camel-stream-null.h:
- * camel-stream-filter.h:
- * camel-store-summary.h:
- * camel-news-address.h:
- * camel-mime-utils.h:
- * camel-mime-parser.h:
- * camel-mime-filter-save.h:
- * camel-mime-filter-linewrap.h:
- * camel-mime-filter-index.h:
- * camel-mime-filter-html.h:
- * camel-mime-filter.h:
- * camel-mime-filter-from.h:
- * camel-mime-filter-crlf.h:
- * camel-mime-filter-chomp.h:
- * camel-mime-filter-charset.h:
- * camel-mime-filter-bestenc.h:
- * camel-mime-filter-basic.h:
- * camel-internet-address.h:
- * camel-folder-thread.h:
- * camel-folder-summary.h:
- * camel-folder-search.h:
- * camel-filter-driver.h:
- * camel-charset-map.h:
- * camel-address.h: Add c++ armoring.
-
- * camel-object.h: s/class/klass
-
-2002-03-01 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-mime-part-utils.c
- (camel_mime_part_construct_content_from_parser): Reverted my
- pgp/mime fixes here too.
-
- * camel-mime-part.c (write_to_stream): Removed my pgp/mime raw
- stream hack, this is causing problems such as some messages to not
- displaying, view->source not working at all, etc.
-
-2002-02-28 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-mime-parser.c: Changed offset variables from int's to
- off_t's since the system may support large files.
-
- * camel-mime-part-utils.c
- (camel_mime_part_construct_content_from_parser): Rearrange the
- save filter stuff so that we save raw streams for all mime
- parts. If the mime part turns out to be a multupart, then don't
- bother saving the raw stream, we only need to save the raw stream
- for leaf parts.
-
-2002-02-27 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-folder-summary.h: Don't #include camel-mime-filter-save.h,
- we don't use it.
-
- * camel-file-utils.c: Fixed a few 'might be used uninitialized'
- warnings which were real problems.
-
- * camel-mime-part-utils.c
- (camel_mime_part_construct_content_from_parser): Save the raw mime
- stream for any/all signed parts.
-
- * camel-mime-part.c (camel_mime_part_init): Initialize our raw
- stream to NULL.
- (camel_mime_part_finalize): Unref our raw stream, if we have one.
- (write_to_stream): If we have a raw stream, write that out instead
- of re-encoding.
-
- * camel-mime-filter-save.[c,h]: Rewritten to save to a stream
- rather than a file.
-
-2002-02-28 Not Zed <NotZed@Ximian.com>
-
- * camel-mime-utils.c (header_fold): Use the FOLD_SIZE as a
- recommended folding size, but add a new FOLD_MAX_SIZE (=998, the
- smtp max line size) as the hard limit for any output.
-
-2002-02-27 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-mime-filter-chomp.c (camel_mime_filter_chomp_new): New
- stream filter that chomps excess trailing whitespace from the end
- of the stream. This is needed to update the PGP/MIME code to
- comply with rfc3156.
-
- * camel-pgp-mime.c (camel_pgp_mime_part_verify): Don't attach a
- from filter, if it ain't from-filtered already, then we'll just be
- breaking stuff. To become rfc3156 compliant, add a chomp filter
- here.
- (camel_pgp_mime_part_sign): Add a chomp filter here too.
-
-2002-02-27 Not Zed <NotZed@Ximian.com>
-
- * camel-mime-part.c (init_header_name_table): Changed header
- formatted table to contain a pointer to an output function, and
- added in-reply-to and references headers.
- (write_references): New function to write out references header,
- folded properly. It only approximates based on the last >, but it
- should be adequate and will also handle invalid headers.
- (write_fold): Function to write out headers folded. Since this is
- the default it isn't required.
- (write_raw): Write out an already formatted header, e.g. most of
- the rest.
- (write_to_stream): Lookup header output function, if we have one,
- use that, otherwise fold header using basic (dumb) function.
-
- This is all for #14779. A better fix is probably do have the
- headers always stored formatted, but that can wait.
-
-2002-02-25 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-digest-folder.c (camel_digest_folder_new): Allow all
- multiparts that contain message/rfc822 attachments.
- (digest_get_uids): Only assign uids to message parts.
-
2002-02-22 Jeffrey Stedfast <fejj@ximian.com>
* camel-mime-part.c (camel_mime_part_set_filename): Set the 'name'
parameter on the Content-Type too. Fixes bug #20779.
-2002-02-14 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-pgp-context.c (pgp_sign): Pass --always-trust to gpg
- (requested by users).
- (pgp_clearsign): Same.
- (pgp_encrypt): Here too.
-
-2002-02-12 Jeffrey Stedfast <fejj@ximian.com>
-
- * providers/smtp/camel-smtp-transport.c (smtp_helo): Since the
- AUTH token sometimes uses '=' instead of whitespace, don't use
- smtp_token_next here.
-
-2002-02-09 Not Zed <NotZed@Ximian.com>
-
- * providers/pop3/camel-pop3-engine.c (get_capabilities): Duh, when
- we grab the apop stamp it needs to include the <> as well, I even
- read the rfc, silly me.
-
- * providers/pop3/camel-pop3-store.c (pop3_try_authenticate): Doh,
- when iterating the authtype list, it helps to goto the next node.
- Found with help from miles.
-
-2002-02-08 Not Zed <NotZed@Ximian.com>
-
- * providers/local/camel-spool-summary.c
- (camel_spool_summary_build_from): The day number has to be 2 chars
- wide, space filled to work properly with pine, etc.
-
- * providers/local/camel-spoold-store.[ch]: new type of provider
- 'spool directory', which lets you view external mbox dirs without
- adding any extra cruft. Perhaps it should use . files to store
- summaries? Still a bit experimental, there's a warning when you
- select it in the account editor. Finished off most of #1185.
- Can't rename or move folders.
-
- * camel-mime-utils.c (header_decode_date): If the date is
- 100->1900 then we actually want to use it as the year in the tm
- struct, not year+100. e.g. year 102 -> 2002, not 2102.
-
-2002-02-07 Not Zed <NotZed@Ximian.com>
-
- * providers/local/camel-spool-store.c (get_folder): Pass path into
- spool_folder_new.
-
- * providers/local/camel-spool-folder.c (camel_spool_folder_new):
- (camel_spool_folder_construct): Take the full path to the folder
- and use that as the file path, independent of the full_name we
- use.
-
-2002-02-07 Not Zed <NotZed@Ximian.com>
-
- * providers/local/camel-local-provider.c: Added new type, spoold
- provider, spoold: for local directories.
-
- * providers/imap/camel-imap-store.c (get_one_folder_offline):
- Create offline uri's in a compatible manner to online ones.
-
-2002-02-07 Dan Winship <danw@ximian.com>
+2002-03-13 Ettore Perazzoli <ettore@ximian.com>
- * camel-sasl-ntlm.c: Implementation of NTLM (aka "Secure Password
- Authentication") auth, taken from soup.
+ [Unfix #21655.]
- * Makefile.am (libcamel_la_SOURCES, libcamel_la_HEADERS): Add
- camel-sasl-ntlm.
-
- * camel-sasl.c: Add refs to camel-sasl-ntlm.
-
- * providers/imap/camel-imap-store.c (try_auth): Use
- imap_next_word() to skip over the "+ " of the continuation rather
- than just "resp + 2" since Exchange (incorrectly) returns "+"
- instead of "+ " for an empty continuation response.
-
-2002-02-06 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-folder-summary.h: Remove the CAMEL_MESSAGE_NEEDS_REPLY
- flag, we no longer will be using this.
-
-2002-02-04 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-http-stream.c (stream_read): Use camel_mime_parser_read to
- read internal parser data.
- (camel_http_stream_get_content_type): Implemented.
- (http_method_invoke): Use HTTP/1.0 instead of 1.1
-
- * camel-mime-utils.c (header_decode_int): Made public.
-
- * camel-http-stream.[c,h]: Added. New stream for HTTP requests
- (currently supported are GET and HEAD).
-
- * camel-tcp-stream-ssl.c (stream_connect): Call set_errno
- appropriately.
-
-2002-01-31 Not Zed <NotZed@Ximian.com>
-
- * camel-mime-utils.c (header_decode_domain): Oops, this was
- converting foo@[blah] to foo@[ blah ], fixed.
-
-2002-01-30 Jeffrey Stedfast <fejj@ximian.com>
-
- * providers/pop3/camel-pop3-provider.c: Use "pop" instead of
- "pop3" so current configurations continue to work.
-
-2002-01-30 Not Zed <NotZed@Ximian.com>
-
- * camel-sasl-login.c: Changed name from "NT Login" to simply
- "Login".
-
- * providers/pop3/*: Entirely new pop implmentation, supporting
- pipelining.
-
-2002-01-29 Not Zed <NotZed@Ximian.com>
-
- * camel-data-cache.c (free_busy): We dont want to unref the
- stream, instead, stop listening to the finalised events, and free
- the path only.
-
-2002-01-25 Not Zed <NotZed@Ximian.com>
-
- * camel-data-cache.c (stream_finalised): Remove the object from
- the busy_stream hashtable, not the busy_path hashtable.
-
-2002-01-29 Jeffrey Stedfast <fejj@ximian.com>
-
- * providers/imap/camel-imap-folder.c (imap_update_summary): Added
- more kludge to an existing Exchange IMAP 5.5 kludge to work around
- it returning multiple messages with the same UIDs.
-
-2002-01-28 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-mime-message.c (process_header): Handle Resent headers
- too.
+ * camel-mime-utils.c: Revert to the old order, as the new one
+ could break mailing list names for existing users.
- * camel-mime-message.h: Added Resent-* #defines.
-
- * camel-filter-driver.c (camel_filter_driver_remove_rule_by_name):
- Use while (node->next) instead of while (node)
-
- * providers/smtp/camel-smtp-transport.c (smtp_decode_status_code):
- New function to decode an enhanced status code.
- (smtp_set_exception): Sets an exception based on the
- Enhanced-Status-Code.
- (esmtp_get_authtypes): Don't diplicate the key in the hash since
- the key and value are the same.
- (smtp_rcpt): Include the failed recipient in the error message to
- be more helpful to the user.
-
- * camel-mime-utils.c (hex_decode): Make sure to allocate enough
- for the NUL byte.
-
-2002-01-28 Jeffrey Stedfast <fejj@ximian.com>
-
- * providers/smtp/camel-smtp-transport.c (smtp_construct):
- (connect_to_server): Use flags rather than a bunch of gboolean
- variables.
- (smtp_connect): Same.
- (smtp_mail): Here too. Use the enhanced status codes if available.
- (smtp_data): And again here.
- (smtp_helo): Finally here. Also detect the ENHANCEDSTATUSCODES
- extension.
- (smtp_rcpt): Use the enhanced status codes if available.
- (smtp_rset): Here too.
- (smtp_quit): And finally here.
-
- * camel-transport.h: Removed gboolean supports_8bit since this is
- pretty local to only SMTP for now.
-
-2002-01-24 Ettore Perazzoli <ettore@ximian.com>
-
- * Makefile.am: Remove some old cruft.
-
-2002-01-24 Ettore Perazzoli <ettore@ximian.com>
-
- * tests/folder/Makefile.am: s/MAILER_LIBS/EVOLUTION_MAIL_LIBS/.
- * tests/message/Makefile.am: Likewise.
- * tests/mime-filter/Makefile.am: Likewise.
- * tests/misc/Makefile.am: Likewise.
- * tests/smime/Makefile.am: Likewise.
- * tests/stream/Makefile.am: Likewise.
-
-2002-01-24 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-filter-driver.c (do_beep): Call the beep callback
- function.
- (camel_filter_driver_set_system_beep_func): New function to set
- the beep callback.
-
-2002-01-22 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-filter-driver.c (camel_filter_driver_remove_rule_by_name):
- New function to remove a filter rule by name.
-
-2002-01-21 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-filter-driver.c (do_beep): As a temporary solution, just
- printf ("\a"); to make a beep :-)
-
- * providers/imap/camel-imap-command.c
- (imap_command_strdup_vprintf): Encode the mailbox to UTF-7 here.
-
- * providers/imap/camel-imap-utils.c (imap_parse_list_response):
- Decode the mailbox name as we parse the list response.
- (imap_mailbox_decode): It's only an illegal mailbox name if it
- didn't switch back to US-ASCII mode.
-
-2002-01-18 Jeffrey Stedfast <fejj@ximian.com>
-
- * providers/imap/camel-imap-utils.c (imap_mailbox_decode): New
- function to decode an IMAP mailbox name from modified UTF-7
- encoding to UTF-8.
- (imap_mailbox_encode): New function to convert a mailbox name from
- UTF-8 to IMAP's modified UTF-7 encoding.
-
-2002-01-17 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-mime-filter-basic.c (filter): Stop uudecoding once the
- CAMEL_UUDECODE_STATE_END state bit gets set. Set the
- CAMEL_UUDECODE_STATE_BEGIN state bit once we find the begin line.
- (reset): No longer have uu_begin or uulen state variables, these
- are now stuffed into a single state variable.
-
- * camel-mime-utils.c (uudecode_step): No longer needs a uulen
- argument and also keeps track of whether or not the end of the
- encoded data has been found in 'state'.
- (uuencode_step): Now stuffs uulen into state so that the uulen
- argument is no longer needed.
- (uuencode_close): Same.
-
-2002-01-16 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-mime-filter-basic.c (filter): If we don't want to corrupt
- the uuencoded data by overwriting it with base64 decoded data
- afterward, we need to add a break statement!
-
- * camel-folder-summary.c (summary_build_content_info): Add code to
- add a uu filter.
- (camel_folder_summary_finalize): Unref the uuencode filter.
-
-2002-01-16 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-mime-filter-basic.c (filter): Fixed slight logic error to
- find the uuencode begin line. Fixes bug #18754.
-
-2002-01-15 Jeffrey Stedfast <fejj@ximian.com>
-
- * providers/smtp/camel-smtp-transport.c (smtp_send_to): Updated to
- match the new send_to API.
- (smtp_send): Get the from address and pass that along to
- smtp_send_to().
-
- * providers/sendmail/camel-sendmail-transport.c
- (sendmail_send_to): Updated to match the new send_to API.
-
- * camel-transport.c (camel_transport_send_to): Now takes a from
- argument too.
-
- * providers/imap/camel-imap-folder.c (imap_update_summary): Sort
- the needheaders UID array and fixed to respect the
- UID_SET_LIMIT. This should now finish the fixification of bug
- #2529. There's still the possible issue that a command-line (The
- only command-line I can think of that can still be too long is a
- SEARCH command, but this can't possibly be fixed until we rewrite
- the imap code to use Zucchi's ImapEngine idea).
-
-2002-01-14 Jeffrey Stedfast <fejj@ximian.com>
-
- * providers/imap/camel-imap-folder.c (imap_expunge_uids_online):
- Move the command-lock outside the loop.
-
-2002-01-14 Jeffrey Stedfast <fejj@ximian.com>
-
- * providers/imap/camel-imap-folder.c (imap_expunge_uids_online):
- Updated to use the new imap_uid_array_to_set() interface.
- (imap_expunge_uids_resyncing): Same.
- (do_copy): Here too.
- (imap_update_summary): Added a FIXME comment to rewrite allowing
- for a uid-set limitation.
- (get_matching): Copy some of the logic over from
- imap_uid_adday_to_set() to limit the length of the uid-set string.
- (imap_sync_online): Added a comment to explain what is going on
- with get_matching() since the behavior has changed slightly.
-
- * providers/imap/camel-imap-utils.c (imap_uid_array_to_set):
- Modify the interface so that we can limit the size of the uid set
- string returned.
-
-2002-01-14 Not Zed <NotZed@Ximian.com>
+2002-03-11 Ettore Perazzoli <ettore@ximian.com>
- * providers/imap/camel-imap-search.c (imap_body_contains):
- Rewritten to use a cache for body searches when online. Will need
- some heavy testing but so far seems to be beneficial.
+ [Fix #21655.]
- * providers/imap/camel-imap-folder.c (imap_search_by_expression,
- search_by_uids): dont initialise search object here.
- (camel_imap_folder_new): Setup search object here with pointer to
- cache dir.
+ * camel-mime-utils.c: Change the order of the mailing list magic
+ patterns so that the more mailing-list specific ones are on the
+ top.
-2001-12-01 Not Zed <NotZed@Ximian.com>
+2002-02-06 Not Zed <NotZed@Ximian.com>
- * camel-store-summary.[ch]: New class to store a store's folder
- list in. Not yet completed.
+ * camel-service.c (camel_service_connect): Always set the
+ connect_op to NULL when we're done with it. Fix for #19564.
2002-01-11 Jeffrey Stedfast <fejj@ximian.com>
* providers/imap/camel-imap-folder.c (imap_update_summary): Kludge
around a bug in Exchange 5.5 that reports 2 messages with the same
- UID. Fixes bug #17694. Replaces the fix from yesterday.
-
-2002-01-10 Jeffrey Stedfast <fejj@ximian.com>
-
- * providers/local/camel-local-folder.c: If PATH_MAX doesn't exist,
- use _POSIX_PATH_MAX.
-
- * providers/imap/camel-imap-folder.c (imap_update_summary): If mi
- is NULL, don't bother updating it. Should fix bug #17694.
-
-2002-01-10 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel.h: #include camel-mime-filter-tohtml.h
-
- * providers/imap/camel-imap-folder.c (imap_update_summary): Kludge
- around Microsoft Exchange 5.5 (bug #5348) by forgetting our
- currently selected folder and re-SELECTing it so that the Exchange
- server has a chance to realise it has new messages.
+ UID. Fixes bug #17694.
2002-01-09 Jeffrey Stedfast <fejj@ximian.com>
@@ -1221,60 +84,10 @@
rewrite the mbox later without worrying about clobbering the
symlink.
-2002-01-08 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-filter-search.c (TODO): There are a few sexp callbacks
- that could be modified to use fms->info rather than using a
- message object (like date and possibly mlist stuff) but *only* if
- the date exists on the CamelMessageInfo object (since it may be
- blank except for message flags).
- (camel_filter_search_get_message): New internal convenience
- function to make sure that the FilterMessageSearch has loaded the
- message (and to load the message if this isn't the case).
- (check_header): Call camel_filter_search_get_message().
- (header_exists): Same.
- (header_regex): Here too.
- (header_full_regex): And here.
- (body_contains): Again here.
- (body_regex): Here too.
- (get_sent_date): Here also.
- (get_received_date): Same.
- (get_source): Here if we need to.
- (camel_filter_search_match): Now takes a callback function/data
- pair for on-demand message loading so that we don't necessarily
- have to load the message if the defined filter rules don't require
- it.
-
- * camel-filter-driver.c (camel_filter_driver_filter_folder): Don't
- bother fetching the message here, let
- camel_filter_driver_filter_message() worry about this.
- (get_message_cb): New utility callback to fetch a message.
- (camel_filter_driver_filter_message): Only fetch the message if we
- absolutely need it to get a CamelMessageInfo. Instead of passing a
- message object to camel_filter_search_match(), pass get_message_cb
- and some user_data so that the matching code can fetch the message
- on demand.
-
-2002-01-07 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-folder.c (filter_filter): Flush the only-once actions.
-
- * camel-filter-driver.c (camel_filter_driver_filter_message):
- Don't increment a filtered_count here any longer.
- (camel_filter_driver_reset_filtered_count): Removed.
- (camel_filter_driver_get_filtered_count): Removed.
- (do_beep): New action.
- (play_sound): New action to play a sound
- (do_only_once): Another new action.
- (camel_filter_driver_finalise): Free the only_once hash if the
- driver has not been "flushed".
- (camel_filter_driver_flush): Flush all of the only-once actions.
-
- * camel-charset-map.c: Moved windows-1251 to the end of the list
- since it contains the euro and we'd prefer to use iso-8859-15 when
- the euro is requested than a windows charset if possible.
+2001-12-11 Jeffrey Stedfast <fejj@ximian.com>
- * camel-charset-map-private.h: Regenerated.
+ * camel-service.c (camel_service_connect): Make sure that the
+ connect_op is non-NULL before unregistering/unreffing it.
2001-12-12 Jeffrey Stedfast <fejj@ximian.com>
@@ -1283,62 +96,6 @@
* camel-mime-utils.c (header_set_param): NULL-protection.
-2002-01-02 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-tcp-stream-ssl.c (ssl_bad_cert): Do more like what mutt
- does so hopefully this'll fix bug #16363 and #16300.
-
-2001-12-21 Jeffrey Stedfast <fejj@ximian.com>
-
- * broken-date-parser.c (parse_broken_date): Completely
- rewritten. It is now a load faster and a heck of a lot more
- accurate, also now returns a time_t and sets the saveoffset
- variable rather than returning a new char* buffer for the normal
- camel date parser to re-parse. This saves a fair number of cpu
- cycles :-)
-
- * camel-mime-utils.c (header_decode_date): Cleanup the broken date
- parsing code.
-
-2001-12-20 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-address.h: Change the prototype for camel_address_get_type
- to return a CamelType (since internally this is what it returns
- and also in case we decide to write a replacement for the current
- CamelObject it'd be easier to drop in).
-
- * camel-internet-address.h: Same but for
- camel_internet_address_get_type()
-
- * providers/smtp/camel-smtp-transport.c (smtp_send_to): Updated to
- use a CamelAddress of recipients.
- (smtp_send): Since smtp_send_to now takes a CamelAddress
- recipients argument, our lives have been simplified and we can now
- just concat To/Cc/Bcc into a recipients addr and send away.
-
- * providers/sendmail/camel-sendmail-transport.c
- (sendmail_send_to): Updated to use a CamelAddress of recipients.
-
- * camel-transport.c (camel_transport_send_to): Now takes a
- CamelAddress argument for the recipient list rather than a GList.
-
-2001-12-19 Jeffrey Stedfast <fejj@ximian.com>
-
- * providers/smtp/Makefile.am: Remove the providerdir variable.
-
- * providers/sendmail/Makefile.am: Same.
-
-2001-12-17 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-charset-map.c (camel_charset_iso_to_windows): New function
- to map ISO charsets to the Windows charsets.
-
- * camel-mime-part-utils.c (broken_windows_charset): Detect Windows
- charsets.
- (simple_data_wrapper_construct_from_parser): Simplify a tad and
- also check for iso-8859-* charsets that are really Windows
- charsets. Fixes bug #12631.
-
2001-12-17 Dan Winship <danw@ximian.com>
* Makefile.am (INCLUDES): define CAMEL_PROVIDERDIR to be the
@@ -1348,58 +105,13 @@
* providers/imap/Makefile.am (camel_provider_LTLIBRARIES,
camel_provider_DATA): renamed from provider_LTLIBRARIES,
- provider_DATA.
-
- * providers/local/Makefile.am: Likewise
-
- * providers/nntp/Makefile.am: Likewise
-
- * providers/pop3/Makefile.am: Likewise
-
- * providers/sendmail/Makefile.am: Likewise
-
+ provider_DATA.
+ * providers/local/Makefile.am: Likewise
+ * providers/nntp/Makefile.am: Likewise
+ * providers/pop3/Makefile.am: Likewise
+ * providers/sendmail/Makefile.am: Likewise
* providers/smtp/Makefile.am: Likewise
-2001-12-16 Jeffrey Stedfast <fejj@ximian.com>
-
- * providers/imap/camel-imap-folder.c (get_content): Reverted my
- previous changes here since it doesn't actually work afterall.
-
- * providers/imap/camel-imap-wrapper.c (imap_wrapper_hydrate):
- Update to do uudecoding when appropriate.
-
-2001-12-16 Jeffrey Stedfast <fejj@ximian.com>
-
- * providers/imap/camel-imap-folder.c (get_content): Try to use the
- original boundary so luis will stop bugging me about "data
- corruption". Also preserve other params in the multipart
- content-type by dumping it to a string and setting it on the mime
- part.
-
-2001-12-14 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-filter-driver.c
- (camel_filter_driver_reset_filtered_count): Reset the
- filtered_count to zero.
- (camel_filter_driver_get_filtered_count): Return the private
- filtered_count value.
- (camel_filter_driver_filter_message): Increment the
- filtered_count.
- (camel_filter_driver_set_shell_exec_func): New function to set the
- shell-exec func.
- (shell_exec): New ESExp filter action callback.
-
-2001-12-14 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-pgp-mime.c (camel_pgp_mime_part_verify): Removed
- x-inline-pgp-hack kludge because it doesn't work.
- (camel_pgp_mime_part_decrypt): Same.
-
-2001-12-13 Chris Toshok <toshok@ximian.com>
-
- * camel-data-cache.c: include stdlib.h (for alloca on freebsd) and
- only include alloca.h if HAVE_ALLOCA_H is defined.
-
2001-12-11 Zbigniew Chyla <cyba@gnome.pl>
Fixes #17085
@@ -1418,17 +130,6 @@
* camel-service.c (camel_service_connect): Make sure that the
connect_op is non-NULL before unregistering/unreffing it.
-2001-12-04 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-mime-utils.c (header_content_type_simple): Protect against
- either of the types being NULL.
-
-2001-12-05 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-mime-filter-basic.c (filter): If complete() allocates
- len+2 bytes for the out buffer, so should this. See bug #16371 for
- an example case.
-
2001-12-05 Jeffrey Stedfast <fejj@ximian.com>
* camel-sasl-digest-md5.c: iconv() returns a size_t, not an int.
@@ -1468,19 +169,23 @@
(rfc2184_decode): Use size_t's with iconv().
(header_decode_param): Same.
-2001-12-09 Jon Trowbridge <trow@ximian.com>
-
- * camel-folder-summary.c: Add "NeedsReply" to the flag_names array
- for CAMEL_MESSAGE_NEEDS_REPLY.
-
- * camel-folder-summary.h: Added CAMEL_MESSAGE_NEEDS_REPLY flag.
-
2001-12-07 Dan Winship <danw@ximian.com>
* camel-mime-message.c (camel_mime_message_set_date): Fix the
tm_gmtoff case (its sign is the opposite of "timezone"). Fixes
#14678
+2001-12-04 Jeffrey Stedfast <fejj@ximian.com>
+
+ * camel-mime-utils.c (header_content_type_simple): Protect against
+ either of the types being NULL.
+
+2001-12-05 Jeffrey Stedfast <fejj@ximian.com>
+
+ * camel-mime-filter-basic.c (filter): If complete() allocates
+ len+2 bytes for the out buffer, so should this. See bug #16371 for
+ an example case.
+
2001-11-29 Jeffrey Stedfast <fejj@ximian.com>
* camel-folder-search.c (search_body_contains): Don't use regex
@@ -1509,52 +214,12 @@
order, always summary_lock before ref_lock.
(camel_folder_summary_array): "
(camel_folder_summary_uid): "
- (camel_folder_summary_remove_uid): " Fixes a deadlock.
-
-2001-11-30 Not Zed <NotZed@Ximian.com>
-
- * providers/nntp/camel-nntp-*.c: Completely new implementation of
- NNTP.
-
- Doesn't support subscriptions yet (lists all folders), but should
- be more reliable (faster?), and has an integrated cache.
-
- * camel-exception.c (camel_exception_new): Use e_memchunks for
- exception blocks.
- (camel_exception_free): Same.
-
- * camel-data-cache.[ch]: New object for managing on-disk caches of
- anything that can be stored in a camel-stream.
-
- * camel-file-utils.c (camel_file_util_mkdir): New function, just a
- nicer place to put this (than camel-store), should be removed from
- camel-store.
- (camel_file_util_safe_filename): New function to url-encode a
- filename.
-
- * camel-mime-parser.c (drop_states): New func to drop the parser
- state to initial state.
- (folder_scan_init_with_fd):
- (folder_scan_init_with_stream): Call above func to reset state if
- the stream is changed on us so we can change streams to reuse a
- parser object.
+ (camel_folder_summary_remove_uid): " Fixes a deadlock.
-2001-11-25 Not Zed <NotZed@Ximian.com>
+2001-11-21 Jeffrey Stedfast <fejj@ximian.com>
- * providers/nntp/camel-nntp-folder.c (nntp_folder_get_message): If
- the uid doesn't have a ',' in it, fail to crash.
-
- * providers/nntp/camel-nntp-newsrc.c
- (camel_nntp_newsrc_article_is_read): check group != NULL before
- scanning.
- (camel_nntp_newsrc_get_highest_article_read): "
- (camel_nntp_newsrc_get_num_articles_read): "
- (camel_nntp_newsrc_mark_range_read): "
-
- * providers/nntp/camel-nntp-store.c
- (camel_nntp_store_get_overview_fmt): IF we dont have
- nntp_list_follows, dont try and get a list response.
- (nntp_store_get_folder_info): Set path part of folderinfo.
+ * Makefile.am: Remove OpenSSL library includes/LDFLAGS from the
+ build.
2001-11-20 Jeffrey Stedfast <fejj@ximian.com>
@@ -1562,48 +227,17 @@
Check to see that errno is non-zero before returning
g_strerror. If it's 0, then we have an unknown error.
-2001-11-26 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-mime-filter-basic.c: For the uudecoding mode, garble up
- the "begin <mode> <filename>" line before decoding.
-
- * camel-mime-part-utils.c
- (simple_data_wrapper_construct_from_parser): Add a uudecoder if
- the transfer encoding is x-uuencode.
-
- * camel-mime-part.c (write_to_stream): Handle x-uuencoded content
- too.
-
2001-11-19 Jeffrey Stedfast <fejj@ximian.com>
* camel-tcp-stream-ssl.c (stream_read): Added a check to see if
the operation has been cancelled.
(stream_write): Same.
-2001-11-19 Jeffrey Stedfast <fejj@ximian.com>
-
- Updates for compliance with rfc2231
-
- * camel-mime-utils.c (header_encode_param):
- camel_mime_special_table[c] & IS_ESAFE should have been
- !(camel_mime_special_table[c] & IS_ESAFE). Also added a few
- comments for how to improve the code at some future date.
- (header_decode_param): Now takes an argument rfc2184_part so our
- caller can get this information as well.
- (header_decode_param_list): Pass an rfc2184_part argument to
- header_decode_param and also added a few comments on where to
- improve on rfc2184/rfc2231 compliance.
- (rfc2047_decode_word): Updated to respect the updated ABNF syntax
- of rfc2047 encoded words, yay.
-
2001-11-16 Jeffrey Stedfast <fejj@ximian.com>
* providers/imap/camel-imap-utils.c (imap_parse_body): Abort if
body == NULL.
- * camel-mime-filter-tohtml.c (camel_mime_filter_tohtml_new): New
- mime filter to convert plain text to html.
-
2001-11-16 Jeffrey Stedfast <fejj@ximian.com>
Since some mail clients like Outlook are broken, we need to set a
@@ -1613,15 +247,6 @@
parameter.
(camel_pgp_mime_part_sign): Same.
-2001-11-14 Jeffrey Stedfast <fejj@ximian.com>
-
- * providers/imap/camel-imap-command.c
- (camel_imap_command_response): If we get a BYE response, call
- camel_service_disconnect() and set an exception. Also do the check
- for "* BYE" first instead of passing it off imap_read_untagged()
- since we'll just waste time in there mallocing left and right only
- to arrive at the single response line "* BYE" again :-)
-
2001-11-13 <NotZed@Ximian.com>
* camel-filter-search.c (get_source): If we have no source string,
diff --git a/camel/Makefile.am b/camel/Makefile.am
index d38787c218..c1a98a071a 100644
--- a/camel/Makefile.am
+++ b/camel/Makefile.am
@@ -4,29 +4,30 @@ SUBDIRS = providers tests
libcamelincludedir = $(includedir)/camel
-sbin_PROGRAMS = camel-lock-helper camel-index-control
+sbin_PROGRAMS = camel-lock-helper
lib_LTLIBRARIES = libcamel.la
noinst_LTLIBRARIES = libcamel-static.la
-INCLUDES = -I.. -I$(srcdir)/.. \
- -I$(top_srcdir)/intl \
- -I$(top_srcdir)/e-util \
- -DCAMEL_SBINDIR=\""$(sbindir)"\" \
- -DCAMEL_PROVIDERDIR=\""$(camel_providerdir)"\" \
- -DG_LOG_DOMAIN=\"camel\" \
- $(CAMEL_CFLAGS)
+INCLUDES = -I.. -I$(srcdir)/.. \
+ -I$(top_srcdir)/intl \
+ -I$(top_srcdir)/e-util \
+ $(CAMEL_CFLAGS) \
+ $(GNOME_INCLUDEDIR) \
+ $(KRB4_CFLAGS) \
+ $(NSPR_CFLAGS) \
+ $(NSS_CFLAGS) \
+ -DCAMEL_SBINDIR=\""$(sbindir)"\" \
+ -DCAMEL_PROVIDERDIR=\""$(camel_providerdir)"\" \
+ -DG_LOG_DOMAIN=\"camel\"
libcamel_la_SOURCES = \
broken-date-parser.c \
camel-address.c \
- camel-block-file.c \
camel-cipher-context.c \
camel-cms-context.c \
- camel-data-cache.c \
camel-data-wrapper.c \
camel-digest-folder.c \
- camel-digest-store.c \
camel-disco-diary.c \
camel-disco-folder.c \
camel-disco-store.c \
@@ -39,8 +40,6 @@ libcamel_la_SOURCES = \
camel-folder-thread.c \
camel-folder.c \
camel-html-parser.c \
- camel-http-stream.c \
- camel-index.c \
camel-internet-address.c \
camel-lock.c \
camel-lock-client.c \
@@ -48,11 +47,9 @@ libcamel_la_SOURCES = \
camel-mime-filter-bestenc.c \
camel-mime-filter-basic.c \
camel-mime-filter-charset.c \
- camel-mime-filter-chomp.c \
camel-mime-filter-crlf.c \
camel-mime-filter-from.c \
camel-mime-filter-html.c \
- camel-mime-filter-tohtml.c \
camel-mime-filter-index.c \
camel-mime-filter-linewrap.c \
camel-mime-filter-save.c \
@@ -66,7 +63,6 @@ libcamel_la_SOURCES = \
camel-multipart.c \
camel-object.c \
camel-operation.c \
- camel-partition-table.c \
camel-pgp-context.c \
camel-pgp-mime.c \
camel-smime-context.c \
@@ -79,7 +75,6 @@ libcamel_la_SOURCES = \
camel-sasl-digest-md5.c \
camel-sasl-kerberos4.c \
camel-sasl-login.c \
- camel-sasl-ntlm.c \
camel-sasl-plain.c \
camel-sasl-popb4smtp.c \
camel-search-private.c \
@@ -88,17 +83,14 @@ libcamel_la_SOURCES = \
camel-service.c \
camel-session.c \
camel-store.c \
- camel-store-summary.c \
camel-stream-buffer.c \
camel-stream-filter.c \
camel-stream-fs.c \
camel-stream-mem.c \
camel-stream-null.c \
camel-stream.c \
- camel-text-index.c \
camel-tcp-stream-raw.c \
camel-tcp-stream-ssl.c \
- camel-tcp-stream-openssl.c \
camel-tcp-stream.c \
camel-transport.c \
camel-uid-cache.c \
@@ -115,14 +107,11 @@ libcamel_la_SOURCES = \
libcamelinclude_HEADERS = \
broken-date-parser.h \
camel-address.h \
- camel-block-file.h \
camel-charset-map.h \
camel-cipher-context.h \
camel-cms-context.h \
- camel-data-cache.h \
camel-data-wrapper.h \
camel-digest-folder.h \
- camel-digest-store.h \
camel-disco-diary.h \
camel-disco-folder.h \
camel-disco-store.h \
@@ -135,8 +124,6 @@ libcamelinclude_HEADERS = \
camel-folder-summary.h \
camel-folder-thread.h \
camel-folder.h \
- camel-http-stream.h \
- camel-index.h \
camel-internet-address.h \
camel-lock.h \
camel-lock-client.h \
@@ -144,11 +131,9 @@ libcamelinclude_HEADERS = \
camel-mime-filter-bestenc.h \
camel-mime-filter-basic.h \
camel-mime-filter-charset.h \
- camel-mime-filter-chomp.h \
camel-mime-filter-crlf.h \
camel-mime-filter-from.h \
camel-mime-filter-html.h \
- camel-mime-filter-tohtml.h \
camel-mime-filter-index.h \
camel-mime-filter-linewrap.h \
camel-mime-filter-save.h \
@@ -162,7 +147,6 @@ libcamelinclude_HEADERS = \
camel-multipart.h \
camel-object.h \
camel-operation.h \
- camel-partition-table.h \
camel-pgp-context.h \
camel-pgp-mime.h \
camel-smime-context.h \
@@ -175,7 +159,6 @@ libcamelinclude_HEADERS = \
camel-sasl-digest-md5.h \
camel-sasl-kerberos4.h \
camel-sasl-login.h \
- camel-sasl-ntlm.h \
camel-sasl-plain.h \
camel-sasl-popb4smtp.h \
camel-seekable-stream.h \
@@ -183,14 +166,12 @@ libcamelinclude_HEADERS = \
camel-service.h \
camel-session.h \
camel-store.h \
- camel-store-summary.h \
camel-stream-buffer.h \
camel-stream-filter.h \
camel-stream-fs.h \
camel-stream-mem.h \
camel-stream-null.h \
camel-stream.h \
- camel-text-index.h \
camel-tcp-stream-raw.h \
camel-tcp-stream-ssl.h \
camel-tcp-stream.h \
@@ -208,9 +189,11 @@ libcamelinclude_HEADERS = \
libcamel_la_LDFLAGS = -version-info 0:0:0 -rpath $(libdir)
-libcamel_la_LIBADD = \
- $(top_builddir)/e-util/libeutil.la \
- $(CAMEL_LIBS)
+libcamel_la_LIBADD = $(top_builddir)/e-util/libeutil.la \
+ $(CAMEL_LIBS) \
+ $(KRB4_LDFLAGS) \
+ $(NSPR_LDFLAGS) \
+ $(NSS_LDFLAGS)
libcamel_static_la_SOURCES = $(libcamel_la_SOURCES)
libcamel_static_la_LIBADD = $(libcamel_la_LIBADD)
@@ -222,14 +205,6 @@ camel_lock_helper_SOURCES = \
camel-lock.c \
camel-lock.h
-camel_index_control_SOURCES = \
- camel-index-control.c
-
-camel_index_control_LDADD = \
- $(libcamel_la_LIBADD) \
- libcamel.la \
- $(EVOLUTION_MAIL_LIBS)
-
install-exec-hook:
@if test -n "$(CAMEL_LOCK_HELPER_USER)"; then \
if test `whoami` = root ; then \
@@ -270,3 +245,19 @@ noinst_HEADERS = \
EXTRA_DIST = \
README
+
+#noinst_PROGRAMS = \
+# camel-mime-filter-from
+#
+#camel_mime_filter_from_SOURCES = \
+# camel-mime-filter-from.c
+#
+#camel_mime_filter_from_LDADD = \
+# ../camel/libcamel.la \
+# ../e-util/libeutil.la \
+# ../libibex/libibex.la \
+# $(GNOME_LIBDIR) \
+# $(GNOMEUI_LIBS) \
+# $(INTLLIBS) \
+# $(PTHREAD_LIB) \
+# $(EXTRA_GNOME_LIBS)
diff --git a/camel/camel-charset-map-private.h b/camel/camel-charset-map-private.h
index 35556db87e..3348b0def3 100644
--- a/camel/camel-charset-map-private.h
+++ b/camel/camel-charset-map-private.h
@@ -12,54 +12,54 @@ static unsigned char m000[256] = {
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
- 0xff, 0xff, 0xff, 0xff, 0xbf, 0xbf, 0xbf, 0xbf,
- 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf,
- 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf,
- 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf,
- 0xbf, 0xbf, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f, 0x9f,
- 0xf3, 0xf3, 0xf3, 0xf3, 0xf3, 0xf3, 0xf3, 0xf3,
- 0xf3, 0xf3, 0xf3, 0xf3, 0xf3, 0xf3, 0xf3, 0xf3,
- 0xf3, 0xf3, 0xf3, 0xf3, 0xf3, 0xf3, 0xf3, 0xf3,
- 0xf3, 0xf3, 0xf3, 0xf3, 0xf3, 0xf3, 0xf3, 0xf3,
- 0xff, 0x80, 0xc0, 0xe0, 0xc3, 0xc0, 0xe0, 0xf3,
- 0xe3, 0xec, 0x80, 0xe0, 0xe0, 0xf3, 0xc0, 0xc2,
- 0xef, 0xe0, 0xec, 0xe0, 0xc3, 0xc0, 0xc0, 0xec,
- 0xc3, 0xc0, 0x80, 0xe0, 0xc0, 0xe0, 0xc0, 0x80,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff,
+ 0xff, 0xff, 0xbf, 0xbf, 0xbf, 0xbf, 0xbf, 0xb7,
+ 0xe3, 0xe3, 0xe3, 0xe3, 0xe3, 0xe3, 0xe3, 0xe3,
+ 0xe3, 0xe3, 0xe3, 0xe3, 0xe3, 0xe3, 0xe3, 0xe3,
+ 0xe3, 0xe3, 0xe3, 0xe3, 0xe3, 0xe3, 0xe3, 0xe3,
+ 0xe3, 0xe3, 0xe3, 0xe3, 0xe3, 0xe3, 0xe3, 0xe3,
+ 0xff, 0x80, 0x80, 0xc0, 0x8b, 0x80, 0xc8, 0xeb,
+ 0xc3, 0xdc, 0x80, 0xc8, 0xc8, 0xeb, 0x88, 0x82,
+ 0xdf, 0xc8, 0xd4, 0xc0, 0x83, 0x88, 0x88, 0xdc,
+ 0x83, 0x80, 0x80, 0xc8, 0x80, 0xc0, 0x80, 0x80,
0x80, 0x83, 0x83, 0x82, 0x83, 0x82, 0x82, 0x81,
0x80, 0x83, 0x80, 0x83, 0x80, 0x83, 0x83, 0x80,
- 0x00, 0x80, 0x80, 0x81, 0x83, 0x82, 0x83, 0xc3,
+ 0x00, 0x80, 0x80, 0x81, 0x83, 0x82, 0x83, 0x83,
0x82, 0x80, 0x83, 0x82, 0x83, 0x01, 0x00, 0x83,
0x80, 0x83, 0x83, 0x82, 0x83, 0x82, 0x82, 0x81,
0x80, 0x83, 0x80, 0x83, 0x80, 0x83, 0x83, 0x80,
- 0x00, 0x80, 0x80, 0x81, 0x83, 0x82, 0x83, 0xcf,
+ 0x00, 0x80, 0x80, 0x81, 0x83, 0x82, 0x83, 0x97,
0x82, 0x80, 0x83, 0x82, 0x83, 0x01, 0x00, 0x80,
};
static unsigned char m001[256] = {
- 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
- 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
- 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
- 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
- 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
- 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
- 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
- 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
- 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
- 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
- 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
- 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
- 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
- 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
- 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07,
- 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x03,
0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
- 0x07, 0x02, 0x03, 0x03, 0x05, 0x02, 0x05, 0x07,
- 0x00, 0x07, 0x02, 0x07, 0x07, 0x07, 0x07, 0x02,
- 0x07, 0x07, 0x03, 0x03, 0x00, 0x07, 0x07, 0x07,
- 0x00, 0x03, 0x02, 0x07, 0x01, 0x01, 0x01, 0x02,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03,
+ 0x03, 0x02, 0x03, 0x03, 0x01, 0x02, 0x01, 0x03,
+ 0x00, 0x03, 0x02, 0x03, 0x03, 0x03, 0x03, 0x02,
+ 0x03, 0x03, 0x03, 0x03, 0x00, 0x03, 0x03, 0x03,
+ 0x00, 0x03, 0x02, 0x03, 0x01, 0x01, 0x01, 0x02,
0x02, 0x02, 0x02, 0x02, 0x03, 0x03, 0x03, 0x02,
0x02, 0x03, 0x02, 0x02, 0x02, 0x02, 0x02, 0x02,
0x02, 0x02, 0x02, 0x03, 0x02, 0x03, 0x03, 0x03,
@@ -192,16 +192,16 @@ static unsigned char m030[256] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x20, 0x00,
- 0x20, 0x20, 0x20, 0x00, 0x20, 0x00, 0x20, 0x20,
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
- 0x20, 0x20, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20,
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20,
- 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x00,
+ 0x40, 0x40, 0x40, 0x00, 0x40, 0x00, 0x40, 0x40,
+ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
+ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
+ 0x40, 0x40, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40,
+ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
+ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
+ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
+ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
+ 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -211,86 +211,25 @@ static unsigned char m030[256] = {
};
static unsigned char m040[256] = {
- 0x00, 0x1c, 0x10, 0x10, 0x18, 0x10, 0x18, 0x18,
- 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x10, 0x10,
- 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c,
- 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c,
- 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c,
- 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c,
- 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c,
- 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c,
- 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c,
- 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c, 0x1c,
- 0x00, 0x1c, 0x10, 0x10, 0x18, 0x10, 0x18, 0x18,
- 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x10, 0x10,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m041[256] = {
- 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
- 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x04, 0x04,
- 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
- 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
- 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
- 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
- 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
- 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
- 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
- 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
- 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04,
- 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x04, 0x04,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m050[256] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x3c, 0x28, 0x28, 0x38, 0x28, 0x38, 0x38,
+ 0x28, 0x28, 0x28, 0x28, 0x28, 0x00, 0x28, 0x28,
+ 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c,
+ 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c,
+ 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c,
+ 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c,
+ 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c,
+ 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c,
+ 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c,
+ 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c, 0x3c,
+ 0x00, 0x3c, 0x28, 0x28, 0x38, 0x28, 0x38, 0x38,
+ 0x28, 0x28, 0x28, 0x28, 0x28, 0x00, 0x28, 0x28,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -304,27 +243,17 @@ static unsigned char m050[256] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
- 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
- 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40,
- 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
static unsigned char m200[256] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x40,
- 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x08, 0x08, 0x40, 0x00, 0x00,
+ 0x48, 0x48, 0x08, 0x00, 0x08, 0x08, 0x08, 0x00,
+ 0x08, 0x08, 0x08, 0x00, 0x00, 0x00, 0x08, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -338,6 +267,7 @@ static unsigned char m200[256] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -353,44 +283,8 @@ static unsigned char m200[256] = {
static unsigned char m201[256] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x04, 0x04, 0x00, 0x00, 0x00,
- 0x04, 0x05, 0x04, 0x00, 0x05, 0x05, 0x05, 0x00,
- 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x04, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
-};
-
-static unsigned char m210[256] = {
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x01, 0x00, 0x00, 0x01, 0x01, 0x01, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -408,6 +302,7 @@ static unsigned char m210[256] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -420,12 +315,12 @@ static unsigned char m210[256] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
-static unsigned char m211[256] = {
+static unsigned char m210[256] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -459,16 +354,16 @@ static unsigned char m220[256] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x0c, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x14, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x14, 0x14, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -495,7 +390,7 @@ static unsigned char m230[256] = {
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x0c, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -526,27 +421,27 @@ static unsigned char m230[256] = {
};
static unsigned char m250[256] = {
- 0x0c, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
- 0x0c, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
- 0x0c, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
- 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
+ 0x00, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x0c, 0x0c, 0x0c, 0x04, 0x0c, 0x04, 0x04, 0x0c,
- 0x0c, 0x0c, 0x0c, 0x0c, 0x04, 0x0c, 0x0c, 0x0c,
- 0x0c, 0x0c, 0x04, 0x0c, 0x04, 0x04, 0x0c, 0x0c,
- 0x0c, 0x0c, 0x0c, 0x04, 0x0c, 0x00, 0x00, 0x00,
+ 0x14, 0x14, 0x14, 0x04, 0x14, 0x04, 0x04, 0x14,
+ 0x14, 0x14, 0x14, 0x14, 0x04, 0x14, 0x14, 0x14,
+ 0x14, 0x14, 0x04, 0x14, 0x04, 0x04, 0x14, 0x14,
+ 0x14, 0x14, 0x14, 0x04, 0x14, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x0c, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
- 0x0c, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00,
- 0x0c, 0x0c, 0x0c, 0x0c, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x14, 0x00, 0x00, 0x00,
+ 0x14, 0x14, 0x14, 0x14, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
- 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+ 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
@@ -564,11 +459,11 @@ struct {
unsigned char *bits0;
unsigned char *bits1;
} camel_charmap[256] = {
- { m000, m001, }, { m010, m011, }, { m020, 0, }, { m030, 0, }, { m040, m041, }, { m050, 0, }, { 0, 0, }, { 0, 0, },
+ { m000, m001, }, { m010, m011, }, { m020, 0, }, { m030, 0, }, { m040, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, },
{ 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, },
{ 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, },
{ 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, },
- { m200, m201, }, { m210, m211, }, { m220, 0, }, { m230, 0, }, { 0, 0, }, { m250, 0, }, { 0, 0, }, { 0, 0, },
+ { m200, m201, }, { m210, 0, }, { m220, 0, }, { m230, 0, }, { 0, 0, }, { m250, 0, }, { 0, 0, }, { 0, 0, },
{ 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, },
{ 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, },
{ 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, }, { 0, 0, },
@@ -605,14 +500,13 @@ struct {
{ "iso-8859-2", 0x0001 },
{ "iso-8859-4", 0x0002 },
{ "koi8-r", 0x0004 },
- { "koi8-u", 0x0008 },
- { "iso-8859-5", 0x0010 },
- { "iso-8859-7", 0x0020 },
- { "iso-8859-8", 0x0040 },
+ { "windows-1251", 0x0008 },
+ { "koi8-u", 0x0010 },
+ { "iso-8859-5", 0x0020 },
+ { "iso-8859-7", 0x0040 },
{ "iso-8859-9", 0x0080 },
{ "iso-8859-13", 0x0100 },
{ "iso-8859-15", 0x0200 },
- { "windows-1251", 0x0400 },
};
#define charset_mask(x) \
diff --git a/camel/camel-charset-map.c b/camel/camel-charset-map.c
index 4368e52018..17962d74be 100644
--- a/camel/camel-charset-map.c
+++ b/camel/camel-charset-map.c
@@ -61,16 +61,15 @@ static struct {
{ "iso-8859-2", 0 }, /* Central/Eastern European */
{ "iso-8859-4", 0 }, /* Baltic */
{ "koi8-r", 0 }, /* Russian */
+ { "windows-1251", 0 }, /* Russian */
{ "koi8-u", 0 }, /* Ukranian */
{ "iso-8859-5", 0 }, /* Least-popular Russian encoding */
{ "iso-8859-7", 0 }, /* Greek */
- { "iso-8859-8", 0 }, /* Hebrew; Visual */
{ "iso-8859-9", 0 }, /* Turkish */
{ "iso-8859-13", 0 }, /* Baltic again */
{ "iso-8859-15", 0 }, /* New-and-improved iso-8859-1, but most
* programs that support this support UTF8
*/
- { "windows-1251", 0 }, /* Russian */
{ 0, 0 }
};
@@ -82,7 +81,7 @@ unsigned int encoding_map[256 * 256];
#define UCS "UCS-4LE"
#endif
-int main (void)
+void main(void)
{
int i, j;
int max, min;
@@ -191,8 +190,7 @@ int main (void)
printf("\t\\\n");
}
printf("\n\n");
-
- return 0;
+
}
#else
@@ -294,60 +292,5 @@ camel_charset_best (const char *in, int len)
return camel_charset_best_name (&charset);
}
-
-/**
- * camel_charset_iso_to_windows:
- * @isocharset: an ISO charset
- *
- * Returns the equivalent Windows charset.
- **/
-const char *
-camel_charset_iso_to_windows (const char *isocharset)
-{
- /* According to http://czyborra.com/charsets/codepages.html,
- * the charset mapping is as follows:
- *
- * iso-8859-1 maps to windows-cp1252
- * iso-8859-2 maps to windows-cp1250
- * iso-8859-3 maps to windows-cp????
- * iso-8859-4 maps to windows-cp????
- * iso-8859-5 maps to windows-cp1251
- * iso-8859-6 maps to windows-cp1256
- * iso-8859-7 maps to windows-cp1253
- * iso-8859-8 maps to windows-cp1255
- * iso-8859-9 maps to windows-cp1254
- * iso-8859-10 maps to windows-cp????
- * iso-8859-11 maps to windows-cp????
- * iso-8859-12 maps to windows-cp????
- * iso-8859-13 maps to windows-cp1257
- *
- * Assumptions:
- * - I'm going to assume that since iso-8859-4 and
- * iso-8859-13 are Baltic that it also maps to
- * windows-cp1257.
- */
-
- if (!strcasecmp (isocharset, "iso-8859-1"))
- return "windows-cp1252";
- else if (!strcasecmp (isocharset, "iso-8859-2"))
- return "windows-cp1250";
- else if (!strcasecmp (isocharset, "iso-8859-4"))
- return "windows-cp1257";
- else if (!strcasecmp (isocharset, "iso-8859-5"))
- return "windows-cp1251";
- else if (!strcasecmp (isocharset, "iso-8859-6"))
- return "windows-cp1256";
- else if (!strcasecmp (isocharset, "iso-8859-7"))
- return "windows-cp1253";
- else if (!strcasecmp (isocharset, "iso-8859-8"))
- return "windows-cp1255";
- else if (!strcasecmp (isocharset, "iso-8859-9"))
- return "windows-cp1254";
- else if (!strcasecmp (isocharset, "iso-8859-13"))
- return "windows-cp1257";
-
- return isocharset;
-}
-
#endif /* !BUILD_MAP */
diff --git a/camel/camel-folder-search.c b/camel/camel-folder-search.c
index d9702706f9..993de40801 100644
--- a/camel/camel-folder-search.c
+++ b/camel/camel-folder-search.c
@@ -275,14 +275,7 @@ camel_folder_search_set_folder(CamelFolderSearch *search, CamelFolder *folder)
void
camel_folder_search_set_summary(CamelFolderSearch *search, GPtrArray *summary)
{
- int i;
-
search->summary = summary;
- if (search->summary_hash)
- g_hash_table_destroy(search->summary_hash);
- search->summary_hash = g_hash_table_new(g_str_hash, g_str_equal);
- for (i=0;i<summary->len;i++)
- g_hash_table_insert(search->summary_hash, (char *)camel_message_info_uid(summary->pdata[i]), summary->pdata[i]);
}
/**
@@ -290,19 +283,15 @@ camel_folder_search_set_summary(CamelFolderSearch *search, GPtrArray *summary)
* @search:
* @index:
*
- * Set the index representing the contents of all messages
+ * Set the index (ibex) representing the contents of all messages
* in this folder. If this is not set, then the folder implementation
* should sub-class the CamelFolderSearch and provide its own
* body-contains function.
**/
void
-camel_folder_search_set_body_index(CamelFolderSearch *search, CamelIndex *index)
+camel_folder_search_set_body_index(CamelFolderSearch *search, ibex *index)
{
- if (search->body_index)
- camel_object_unref((CamelObject *)search->body_index);
search->body_index = index;
- if (index)
- camel_object_ref((CamelObject *)index);
}
/**
@@ -621,9 +610,8 @@ check_header(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolder
char *headername;
const char *header = NULL;
char strbuf[32];
- int i, j;
+ int i;
camel_search_t type = CAMEL_SEARCH_TYPE_ASIS;
- struct _camel_search_words *words;
/* only a subset of headers are supported .. */
headername = argv[0]->value.string;
@@ -653,21 +641,9 @@ check_header(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolder
if (header) {
/* performs an OR of all words */
for (i=1;i<argc && !truth;i++) {
- if (argv[i]->type == ESEXP_RES_STRING) {
- if (argv[i]->value.string[0] == 0) {
- truth = TRUE;
- } else if (how == CAMEL_SEARCH_MATCH_CONTAINS) {
- /* doesn't make sense to split words on anything but contains i.e. we can't have an ending match different words */
- words = camel_search_words_split(argv[i]->value.string);
- truth = TRUE;
- for (j=0;j<words->len && truth;j++) {
- truth = camel_search_header_match(header, words->words[j]->word, how, type, NULL);
- }
- camel_search_words_free(words);
- } else {
- truth = camel_search_header_match(header, argv[i]->value.string, how, type, NULL);
- }
- }
+ if (argv[i]->type == ESEXP_RES_STRING)
+ truth = camel_search_header_match(header, argv[i]->value.string,
+ how, type, NULL);
}
}
}
@@ -736,261 +712,111 @@ g_lib_sux_htor(char *key, int value, struct _glib_sux_donkeys *fuckup)
g_ptr_array_add(fuckup->uids, key);
}
-/* and, only store duplicates */
-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);
-}
-
static int
-match_message_index(CamelIndex *idx, const char *uid, const char *match, CamelException *ex)
-{
- CamelIndexCursor *wc, *nc;
- const char *word, *name;
- int truth = FALSE;
-
- wc = camel_index_words(idx);
- if (wc) {
- while (!truth && (word = camel_index_cursor_next(wc))) {
- if (camel_ustrstrcase(word,match) != NULL) {
- /* perf: could have the wc cursor return the name cursor */
- nc = camel_index_find(idx, word);
- if (nc) {
- while (!truth && (name = camel_index_cursor_next(nc)))
- truth = strcmp(name, uid) == 0;
- camel_object_unref((CamelObject *)nc);
- }
- }
- }
- camel_object_unref((CamelObject *)wc);
- }
-
- return truth;
-}
-
-/*
- "one two" "three" "four five"
-
- one and two
-or
- three
-or
- four and five
-*/
-
-/* returns messages which contain all words listed in words */
-static GPtrArray *
-match_words_index(CamelFolderSearch *search, struct _camel_search_words *words, CamelException *ex)
-{
- GPtrArray *result = g_ptr_array_new();
- GHashTable *ht = g_hash_table_new(g_str_hash, g_str_equal);
- struct _glib_sux_donkeys lambdafoo;
- CamelIndexCursor *wc, *nc;
- const char *word, *name;
- CamelMessageInfo *mi;
- int i;
-
- /* we can have a maximum of 32 words, as we use it as the AND mask */
-
- wc = camel_index_words(search->body_index);
- if (wc) {
- while ((word = camel_index_cursor_next(wc))) {
- for (i=0;i<words->len;i++) {
- if (camel_ustrstrcase(word, words->words[i]->word) != NULL) {
- /* perf: could have the wc cursor return the name cursor */
- nc = camel_index_find(search->body_index, word);
- if (nc) {
- while ((name = camel_index_cursor_next(nc))) {
- mi = g_hash_table_lookup(search->summary_hash, name);
- if (mi) {
- int mask;
- const char *uid = camel_message_info_uid(mi);
-
- mask = ((int)g_hash_table_lookup(ht, uid)) | (1<<i);
- g_hash_table_insert(ht, (char *)uid, (void *)mask);
- }
- }
- camel_object_unref((CamelObject *)nc);
- }
- }
- }
- }
- camel_object_unref((CamelObject *)wc);
-
- lambdafoo.uids = result;
- lambdafoo.count = (1<<words->len) - 1;
- g_hash_table_foreach(ht, (GHFunc)g_lib_sux_htand, &lambdafoo);
- g_hash_table_destroy(ht);
- }
-
- return result;
-}
-
-static gboolean
-match_words_1message (CamelDataWrapper *object, struct _camel_search_words *words, guint32 *mask)
+match_message(CamelFolder *folder, const char *uid, regex_t *pattern, CamelException *ex)
{
- CamelDataWrapper *containee;
- int truth = FALSE;
- int parts, i;
-
- containee = camel_medium_get_content_object (CAMEL_MEDIUM (object));
-
- if (containee == NULL)
- return FALSE;
-
- /* using the object types is more accurate than using the mime/types */
- if (CAMEL_IS_MULTIPART (containee)) {
- parts = camel_multipart_get_number (CAMEL_MULTIPART (containee));
- for (i = 0; i < parts && truth == FALSE; i++) {
- CamelDataWrapper *part = (CamelDataWrapper *)camel_multipart_get_part (CAMEL_MULTIPART (containee), i);
- if (part)
- truth = match_words_1message(part, words, mask);
- }
- } else if (CAMEL_IS_MIME_MESSAGE (containee)) {
- /* for messages we only look at its contents */
- truth = match_words_1message((CamelDataWrapper *)containee, words, mask);
- } else if (header_content_type_is(CAMEL_DATA_WRAPPER (containee)->mime_type, "text", "*")) {
- /* for all other text parts, we look inside, otherwise we dont care */
- CamelStreamMem *mem = (CamelStreamMem *)camel_stream_mem_new ();
-
- /* FIXME: The match should be part of a stream op */
- camel_data_wrapper_write_to_stream (containee, CAMEL_STREAM (mem));
- camel_stream_write (CAMEL_STREAM (mem), "", 1);
- for (i=0;i<words->len;i++) {
- /* FIXME: This is horridly slow, and should use a real search algorithm */
- if (camel_ustrstrcase(mem->buffer->data, words->words[i]->word) != NULL) {
- *mask |= (1<<i);
- /* shortcut a match */
- if (*mask == (1<<(words->len))-1)
- return TRUE;
- }
- }
- camel_object_unref (CAMEL_OBJECT (mem));
- }
-
- return truth;
-}
-
-static gboolean
-match_words_message(CamelFolder *folder, const char *uid, struct _camel_search_words *words, CamelException *ex)
-{
- guint32 mask;
CamelMimeMessage *msg;
- int truth;
+ int truth = FALSE;
msg = camel_folder_get_message(folder, uid, ex);
- if (msg) {
- mask = 0;
- truth = match_words_1message((CamelDataWrapper *)msg, words, &mask);
+ if (!camel_exception_is_set(ex) && msg!=NULL) {
+ truth = camel_search_message_body_contains((CamelDataWrapper *)msg, pattern);
camel_object_unref((CamelObject *)msg);
} else {
camel_exception_clear(ex);
- truth = FALSE;
}
-
return truth;
}
-static GPtrArray *
-match_words_messages(CamelFolderSearch *search, struct _camel_search_words *words, CamelException *ex)
-{
- int i;
- GPtrArray *matches = g_ptr_array_new();
-
- if (search->body_index) {
- GPtrArray *indexed;
- struct _camel_search_words *simple;
-
- simple = camel_search_words_simple(words);
- indexed = match_words_index(search, simple, ex);
- camel_search_words_free(simple);
-
- for (i=0;i<indexed->len;i++) {
- const char *uid = g_ptr_array_index(indexed, i);
-
- if (match_words_message(search->folder, uid, words, ex))
- g_ptr_array_add(matches, (char *)uid);
- }
-
- g_ptr_array_free(indexed, TRUE);
- } else {
- for (i=0;i<search->summary->len;i++) {
- CamelMessageInfo *info = g_ptr_array_index(search->summary, i);
- const char *uid = camel_message_info_uid(info);
-
- if (match_words_message(search->folder, uid, words, ex))
- g_ptr_array_add(matches, (char *)uid);
- }
- }
-
- return matches;
-}
-
static ESExpResult *
search_body_contains(struct _ESExp *f, int argc, struct _ESExpResult **argv, CamelFolderSearch *search)
{
- int i, j;
- CamelException *ex = search->priv->ex;
- struct _camel_search_words *words;
ESExpResult *r;
- struct _glib_sux_donkeys lambdafoo;
+ int i, j;
+ regex_t pattern;
- if (search->current) {
+ if (search->current) {
int truth = FALSE;
- if (argc == 1 && argv[0]->value.string[0] == 0) {
+ if (argc == 1 && argv[0]->value.string[0] == 0 && search->folder) {
truth = TRUE;
- } else {
+ } else if (search->body_index) {
for (i=0;i<argc && !truth;i++) {
if (argv[i]->type == ESEXP_RES_STRING) {
- words = camel_search_words_split(argv[i]->value.string);
- truth = TRUE;
- if ((words->type & CAMEL_SEARCH_WORD_COMPLEX) == 0 && search->body_index) {
- for (j=0;j<words->len && truth;j++)
- truth = match_message_index(search->body_index, camel_message_info_uid(search->current), words->words[j]->word, ex);
- } else {
- /* TODO: cache current message incase of multiple body search terms */
- truth = match_words_message(search->folder, camel_message_info_uid(search->current), words, ex);
- }
- camel_search_words_free(words);
+ truth = ibex_find_name(search->body_index, (char *)camel_message_info_uid(search->current),
+ argv[i]->value.string);
+ } else {
+ e_sexp_resultv_free(f, argc, argv);
+ e_sexp_fatal_error(f, _("Invalid type in body-contains, expecting string"));
}
}
+ } else if (search->folder) {
+ /* we do a 'slow' direct search */
+ if (camel_search_build_match_regex(&pattern, CAMEL_SEARCH_MATCH_ICASE, argc, argv, search->priv->ex) == 0) {
+ truth = match_message(search->folder, camel_message_info_uid(search->current), &pattern, search->priv->ex);
+ regfree(&pattern);
+ }
+ } else {
+ g_warning("Cannot perform indexed body query with no index or folder set");
}
r = e_sexp_result_new(f, ESEXP_RES_BOOL);
r->value.bool = truth;
} else {
r = e_sexp_result_new(f, ESEXP_RES_ARRAY_PTR);
- r->value.ptrarray = g_ptr_array_new();
- if (argc == 1 && argv[0]->value.string[0] == 0) {
+ if (argc == 1 && argv[0]->value.string[0] == 0 && search->folder) {
+ /* optimise the match "" case - match everything */
+ r->value.ptrarray = g_ptr_array_new();
for (i=0;i<search->summary->len;i++) {
CamelMessageInfo *info = g_ptr_array_index(search->summary, i);
-
g_ptr_array_add(r->value.ptrarray, (char *)camel_message_info_uid(info));
}
- } else {
- GHashTable *ht = g_hash_table_new(g_str_hash, g_str_equal);
- GPtrArray *matches;
-
- for (i=0;i<argc;i++) {
- if (argv[i]->type == ESEXP_RES_STRING) {
- words = camel_search_words_split(argv[i]->value.string);
- if ((words->type & CAMEL_SEARCH_WORD_COMPLEX) == 0 && search->body_index) {
- matches = match_words_index(search, words, ex);
+ } else if (search->body_index) {
+ if (argc==1) {
+ /* common case */
+ r->value.ptrarray = ibex_find(search->body_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;i<argc;i++) {
+ if (argv[i]->type == ESEXP_RES_STRING) {
+ pa = ibex_find(search->body_index, argv[i]->value.string);
+ for (j=0;j<pa->len;j++) {
+ g_hash_table_insert(ht, g_ptr_array_index(pa, j), (void *)1);
+ }
+ g_ptr_array_free(pa, FALSE);
} else {
- matches = match_words_messages(search, words, ex);
+ e_sexp_result_free(f, r);
+ e_sexp_resultv_free(f, argc, argv);
+ e_sexp_fatal_error(f, _("Invalid type in body-contains, expecting string"));
}
- for (j=0;j<matches->len;j++)
- g_hash_table_insert(ht, matches->pdata[j], matches->pdata[j]);
- g_ptr_array_free(matches, TRUE);
- camel_search_words_free(words);
}
+ lambdafoo.uids = g_ptr_array_new();
+ g_hash_table_foreach(ht, (GHFunc)g_lib_sux_htor, &lambdafoo);
+ r->value.ptrarray = lambdafoo.uids;
+ g_hash_table_destroy(ht);
+ }
+ } else if (search->folder) {
+ /* do a slow search */
+ r->value.ptrarray = g_ptr_array_new();
+ if (camel_search_build_match_regex(&pattern, CAMEL_SEARCH_MATCH_ICASE, argc, argv, search->priv->ex) == 0) {
+ if (search->summary) {
+ for (i=0;i<search->summary->len;i++) {
+ CamelMessageInfo *info = g_ptr_array_index(search->summary, i);
+
+ if (match_message(search->folder, camel_message_info_uid(info), &pattern, search->priv->ex))
+ g_ptr_array_add(r->value.ptrarray, (char *)camel_message_info_uid(info));
+ }
+ } /* else? we could always get the summary from the folder, but then
+ we need to free it later somehow */
+ regfree(&pattern);
}
- lambdafoo.uids = r->value.ptrarray;
- g_hash_table_foreach(ht, (GHFunc)g_lib_sux_htor, &lambdafoo);
- g_hash_table_destroy(ht);
+ } else {
+ g_warning("Cannot perform indexed body query with no index or folder set");
+ r->value.ptrarray = g_ptr_array_new();
}
}
diff --git a/camel/camel-folder-summary.c b/camel/camel-folder-summary.c
index 6dd0cddc20..65fdc76cb2 100644
--- a/camel/camel-folder-summary.c
+++ b/camel/camel-folder-summary.c
@@ -22,10 +22,6 @@
#include <config.h>
#endif
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
#include <unistd.h>
#include <ctype.h>
#include <string.h>
@@ -40,15 +36,13 @@
#include <camel/camel-mime-filter.h>
#include <camel/camel-mime-filter-index.h>
#include <camel/camel-mime-filter-charset.h>
+#include <camel/camel-mime-filter-save.h>
#include <camel/camel-mime-filter-basic.h>
#include <camel/camel-mime-filter-html.h>
#include <camel/camel-mime-message.h>
#include <camel/camel-multipart.h>
#include <camel/camel-stream-mem.h>
-#include <camel/camel-stream-null.h>
-#include <camel/camel-stream-filter.h>
-
#include "hash-table-utils.h"
#include "e-util/md5-utils.h"
#include "e-util/e-memory.h"
@@ -213,18 +207,11 @@ camel_folder_summary_finalize (CamelObject *obj)
camel_object_unref((CamelObject *)p->filter_64);
if (p->filter_qp)
camel_object_unref((CamelObject *)p->filter_qp);
- if (p->filter_uu)
- camel_object_unref((CamelObject *)p->filter_uu);
if (p->filter_save)
camel_object_unref((CamelObject *)p->filter_save);
if (p->filter_html)
camel_object_unref((CamelObject *)p->filter_html);
- if (p->filter_stream)
- camel_object_unref((CamelObject *)p->filter_stream);
- if (p->index)
- camel_object_unref((CamelObject *)p->index);
-
#ifdef ENABLE_THREADS
g_mutex_free(p->summary_lock);
g_mutex_free(p->io_lock);
@@ -295,16 +282,11 @@ void camel_folder_summary_set_filename(CamelFolderSummary *s, const char *name)
*
* Unlike earlier behaviour, build_content need not be set to perform indexing.
**/
-void camel_folder_summary_set_index(CamelFolderSummary *s, CamelIndex *index)
+void camel_folder_summary_set_index(CamelFolderSummary *s, ibex *index)
{
struct _CamelFolderSummaryPrivate *p = _PRIVATE(s);
- if (p->index)
- camel_object_unref((CamelObject *)p->index);
-
p->index = index;
- if (index)
- camel_object_ref((CamelObject *)index);
}
/**
@@ -870,7 +852,6 @@ CamelMessageInfo *camel_folder_summary_info_new_from_parser(CamelFolderSummary *
int len;
struct _CamelFolderSummaryPrivate *p = _PRIVATE(s);
off_t start;
- CamelIndexName *name = NULL;
/* should this check the parser is in the right state, or assume it is?? */
@@ -889,21 +870,15 @@ CamelMessageInfo *camel_folder_summary_info_new_from_parser(CamelFolderSummary *
if (p->index) {
if (p->filter_index == NULL)
- p->filter_index = camel_mime_filter_index_new_index(p->index);
- camel_index_delete_name(p->index, camel_message_info_uid(info));
- name = camel_index_add_name(p->index, camel_message_info_uid(info));
- camel_mime_filter_index_set_name(p->filter_index, name);
+ p->filter_index = camel_mime_filter_index_new_ibex(p->index);
+ camel_mime_filter_index_set_name(p->filter_index, (char *)camel_message_info_uid(info));
+ ibex_unindex(p->index, (char *)camel_message_info_uid(info));
+ ibex_index_buffer(p->index, (char *)camel_message_info_uid(info), "ibexindexed", strlen("ibexindexed"), NULL);
}
/* always scan the content info, even if we dont save it */
info->content = summary_build_content_info(s, info, mp);
- if (name) {
- camel_index_write_name(p->index, name);
- camel_object_unref((CamelObject *)name);
- camel_mime_filter_index_set_name(p->filter_index, NULL);
- }
-
CAMEL_SUMMARY_UNLOCK(s, filter_lock);
info->size = camel_mime_parser_tell(mp) - start;
@@ -924,7 +899,6 @@ CamelMessageInfo *camel_folder_summary_info_new_from_message(CamelFolderSummary
{
CamelMessageInfo *info;
struct _CamelFolderSummaryPrivate *p = _PRIVATE(s);
- CamelIndexName *name = NULL;
info = ((CamelFolderSummaryClass *)(CAMEL_OBJECT_GET_CLASS(s)))->message_info_new_from_message(s, msg);
@@ -932,33 +906,13 @@ CamelMessageInfo *camel_folder_summary_info_new_from_message(CamelFolderSummary
* know if we are going to store this in the summary, but no matter */
summary_assign_uid(s, info);
- CAMEL_SUMMARY_LOCK(s, filter_lock);
-
if (p->index) {
- if (p->filter_index == NULL)
- p->filter_index = camel_mime_filter_index_new_index(p->index);
- camel_index_delete_name(p->index, camel_message_info_uid(info));
- name = camel_index_add_name(p->index, camel_message_info_uid(info));
- camel_mime_filter_index_set_name(p->filter_index, name);
-
- if (p->filter_stream == NULL) {
- CamelStream *null = camel_stream_null_new();
-
- p->filter_stream = camel_stream_filter_new_with_stream(null);
- camel_object_unref((CamelObject *)null);
- }
+ ibex_unindex(p->index, (char *)camel_message_info_uid(info));
+ ibex_index_buffer(p->index, (char *)camel_message_info_uid(info), "ibexindexed", strlen("ibexindexed"), NULL);
}
info->content = summary_build_content_info_message(s, info, (CamelMimePart *)msg);
- if (name) {
- camel_index_write_name(p->index, name);
- camel_object_unref((CamelObject *)name);
- camel_mime_filter_index_set_name(p->filter_index, NULL);
- }
-
- CAMEL_SUMMARY_UNLOCK(s, filter_lock);
-
return info;
}
@@ -1522,7 +1476,7 @@ message_info_new(CamelFolderSummary *s, struct _header_raw *h)
CamelMessageInfo *mi;
const char *received;
guchar digest[16];
- struct _header_references *refs, *irt, *scan;
+ struct _header_references *refs, *scan;
char *msgid;
int count;
char *subject, *from, *to, *cc, *mlist;
@@ -1585,30 +1539,21 @@ message_info_new(CamelFolderSummary *s, struct _header_raw *h)
memcpy(mi->message_id.id.hash, digest, sizeof(mi->message_id.id.hash));
g_free(msgid);
}
-
- /* decode our references and in-reply-to headers */
- refs = header_references_decode (header_raw_find (&h, "references", NULL));
- irt = header_references_inreplyto_decode (header_raw_find (&h, "in-reply-to", NULL));
- if (refs || irt) {
- if (irt) {
- /* The References field is populated from the ``References'' and/or ``In-Reply-To''
- headers. If both headers exist, take the first thing in the In-Reply-To header
- that looks like a Message-ID, and append it to the References header. */
-
- if (refs)
- irt->next = refs;
-
- refs = irt;
- }
-
+ /* if we have a references, use that, otherwise, see if we have an in-reply-to
+ header, with parsable content, otherwise *shrug* */
+ if ((refs = header_references_decode(header_raw_find(&h, "references", NULL))) != NULL
+ || (refs = header_references_decode(header_raw_find(&h, "in-reply-to", NULL))) != NULL) {
count = header_references_list_size(&refs);
mi->references = g_malloc(sizeof(*mi->references) + ((count-1) * sizeof(mi->references->references[0])));
count = 0;
scan = refs;
while (scan) {
- md5_get_digest(scan->id, strlen(scan->id), digest);
- memcpy(mi->references->references[count].id.hash, digest, sizeof(mi->message_id.id.hash));
- count++;
+ /* FIXME: the id might be NULL because of a small bug in camel-mime-utils */
+ if (scan->id) {
+ md5_get_digest(scan->id, strlen(scan->id), digest);
+ memcpy(mi->references->references[count].id.hash, digest, sizeof(mi->message_id.id.hash));
+ count++;
+ }
scan = scan->next;
}
mi->references->size = count;
@@ -1959,13 +1904,6 @@ summary_build_content_info(CamelFolderSummary *s, CamelMessageInfo *msginfo, Cam
else
camel_mime_filter_reset((CamelMimeFilter *)p->filter_qp);
enc_id = camel_mime_parser_filter_add(mp, (CamelMimeFilter *)p->filter_qp);
- } else if (!strcasecmp (encoding, "x-uuencode")) {
- d(printf(" decoding x-uuencode\n"));
- if (p->filter_uu == NULL)
- p->filter_uu = camel_mime_filter_basic_new_type(CAMEL_MIME_FILTER_BASIC_UU_DEC);
- else
- camel_mime_filter_reset((CamelMimeFilter *)p->filter_uu);
- enc_id = camel_mime_parser_filter_add(mp, (CamelMimeFilter *)p->filter_uu);
} else {
d(printf(" ignoring encoding %s\n", encoding));
}
@@ -2054,7 +1992,7 @@ summary_build_content_info(CamelFolderSummary *s, CamelMessageInfo *msginfo, Cam
}
/* build the content-info, from a message */
-/* this needs the filter lock since it uses filters to perform indexing */
+/* this needs no lock, as we copy all data, and ibex is threadsafe */
static CamelMessageContentInfo *
summary_build_content_info_message(CamelFolderSummary *s, CamelMessageInfo *msginfo, CamelMimePart *object)
{
@@ -2100,25 +2038,14 @@ summary_build_content_info_message(CamelFolderSummary *s, CamelMessageInfo *msgi
child->parent = info;
my_list_append((struct _node **)&info->childs, (struct _node *)child);
}
- } else if (p->filter_stream
+ } else if (p->index
&& header_content_type_is(CAMEL_DATA_WRAPPER(containee)->mime_type, "text", "*")) {
- int html_id = -1, idx_id = -1;
-
- /* pre-attach html filter if required, otherwise just index filter */
- if (header_content_type_is(CAMEL_DATA_WRAPPER(containee)->mime_type, "text", "html")) {
- if (p->filter_html == NULL)
- p->filter_html = camel_mime_filter_html_new();
- else
- camel_mime_filter_reset((CamelMimeFilter *)p->filter_html);
- html_id = camel_stream_filter_add(p->filter_stream, (CamelMimeFilter *)p->filter_html);
- }
- idx_id = camel_stream_filter_add(p->filter_stream, (CamelMimeFilter *)p->filter_index);
+ /* index all text parts if we're indexing */
+ CamelStreamMem *mem = (CamelStreamMem *)camel_stream_mem_new();
- camel_data_wrapper_write_to_stream(containee, (CamelStream *)p->filter_stream);
- camel_stream_flush((CamelStream *)p->filter_stream);
-
- camel_stream_filter_remove(p->filter_stream, idx_id);
- camel_stream_filter_remove(p->filter_stream, html_id);
+ camel_data_wrapper_write_to_stream(containee, (CamelStream *)mem);
+ ibex_index_buffer(p->index, (char *)camel_message_info_uid(msginfo), mem->buffer->data, mem->buffer->len, NULL);
+ camel_object_unref((CamelObject *)mem);
}
return info;
@@ -2514,8 +2441,8 @@ camel_message_info_new_from_header (struct _header_raw *header)
CamelMessageInfo *info;
char *subject, *from, *to, *cc, *mlist;
struct _header_content_type *ct = NULL;
- const char *content, *date, *charset = NULL;
-
+ const char *content, *charset = NULL;
+
if ((content = header_raw_find(&header, "Content-Type", NULL))
&& (ct = header_content_type_decode(content))
&& (charset = header_content_type_param(ct, "charset"))
@@ -2528,7 +2455,6 @@ camel_message_info_new_from_header (struct _header_raw *header)
from = summary_format_address(header, "from");
to = summary_format_address(header, "to");
cc = summary_format_address(header, "cc");
- date = header_raw_find(&header, "date", NULL);
mlist = header_raw_check_mailing_list(&header);
if (ct)
@@ -2541,21 +2467,7 @@ camel_message_info_new_from_header (struct _header_raw *header)
camel_message_info_set_to(info, to);
camel_message_info_set_cc(info, cc);
camel_message_info_set_mlist(info, mlist);
-
- if (date)
- info->date_sent = header_decode_date (date, NULL);
- else
- info->date_sent = time (NULL);
-
- date = header_raw_find (&header, "received", NULL);
- if (date && (date = strrchr (date, ';')))
- date++;
-
- if (date)
- info->date_received = header_decode_date (date, NULL);
- else
- info->date_received = time (NULL);
-
+
return info;
}
@@ -2745,4 +2657,104 @@ message_info_dump(CamelMessageInfo *mi)
printf("Flags: %04x\n", mi->flags & 0xffff);
content_info_dump(mi->content, 0);
}
+
+int main(int argc, char **argv)
+{
+ CamelMimeParser *mp;
+ int fd;
+ CamelFolderSummary *s;
+ char *buffer;
+ int len;
+ int i;
+ ibex *index;
+
+ /*g_tk_init(&argc, &argv);*/
+
+#if 0
+ {
+ int i;
+ char *s;
+ char buf[1024];
+
+ for (i=0;i<434712;i++) {
+ memcpy(buf, " ", 50);
+ buf[50] = 0;
+#if 0
+ s = g_strdup(buf);
+ g_free(s);
+#endif
+ }
+ return 0;
+ }
+#endif
+
+ if (argc < 2 ) {
+ printf("usage: %s mbox\n", argv[0]);
+ return 1;
+ }
+
+ fd = open(argv[1], O_RDONLY);
+
+ index = ibex_open("index.ibex", O_CREAT|O_RDWR, 0600);
+
+ mp = camel_mime_parser_new();
+ camel_mime_parser_scan_from(mp, TRUE);
+/* camel_mime_parser_set_header_regex(mp, "^(content-[^:]*|subject|from|to|date):");*/
+ camel_mime_parser_init_with_fd(mp, fd);
+
+ s = camel_folder_summary_new();
+ camel_folder_summary_set_build_content(s, TRUE);
+/* camel_folder_summary_set_index(s, index);*/
+
+ while (camel_mime_parser_step(mp, &buffer, &len) == HSCAN_FROM) {
+ /*printf("Parsing message ...\n");*/
+ camel_folder_summary_add_from_parser(s, mp);
+ if (camel_mime_parser_step(mp, &buffer, &len) != HSCAN_FROM_END) {
+ g_warning("Uknown state encountered, excpecting %d, got %d\n", HSCAN_FROM_END, camel_mime_parser_state(mp));
+ break;
+ }
+ }
+
+ printf("Printing summary\n");
+ for (i=0;i<camel_folder_summary_count(s);i++) {
+ CamelMessageInfo *info = camel_folder_summary_index(s, i);
+ message_info_dump(info);
+ camel_folder_summary_info_free(info);
+ }
+
+ printf("Saivng summary\n");
+ camel_folder_summary_set_filename(s, "index.summary");
+ camel_folder_summary_save(s);
+
+ {
+ CamelFolderSummary *n;
+
+ printf("\nLoading summary\n");
+ n = camel_folder_summary_new();
+ camel_folder_summary_set_build_content(n, TRUE);
+ camel_folder_summary_set_filename(n, "index.summary");
+ camel_folder_summary_load(n);
+
+ printf("Printing summary\n");
+ for (i=0;i<camel_folder_summary_count(n);i++) {
+ CamelMessageInfo *info = camel_folder_summary_index(s, i);
+ message_info_dump(info);
+ camel_folder_summary_info_free(info);
+ }
+ camel_object_unref(n);
+ }
+
+
+ camel_object_unref(mp);
+ camel_object_unref(s);
+
+ printf("summarised %d messages\n", camel_folder_summary_count(s));
+#if 0
+ printf("g_strdup count = %d\n", strdup_count);
+ printf("g_malloc count = %d\n", malloc_count);
+ printf("g_free count = %d\n", free_count);
+#endif
+ return 0;
+}
+
#endif
diff --git a/camel/camel-mime-filter-basic.c b/camel/camel-mime-filter-basic.c
index efb9b9818e..6db8f30211 100644
--- a/camel/camel-mime-filter-basic.c
+++ b/camel/camel-mime-filter-basic.c
@@ -2,7 +2,6 @@
* Copyright (C) 2000 Ximian Inc.
*
* Authors: Michael Zucchi <notzed@ximian.com>
- * Jeffrey Stedfast <fejj@ximian.com>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
@@ -22,7 +21,6 @@
#include "camel-mime-filter-basic.h"
#include "camel-mime-utils.h"
-#include <string.h>
static void reset(CamelMimeFilter *mf);
static void complete(CamelMimeFilter *mf, char *in, size_t len,
@@ -80,7 +78,7 @@ static void
reset(CamelMimeFilter *mf)
{
CamelMimeFilterBasic *f = (CamelMimeFilterBasic *)mf;
-
+
switch(f->type) {
case CAMEL_MIME_FILTER_BASIC_QP_ENC:
f->state = -1;
@@ -113,7 +111,8 @@ complete(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out,
case CAMEL_MIME_FILTER_BASIC_UU_ENC:
/* won't go to more than 2 * (x + 2) + 62 */
camel_mime_filter_set_size (mf, (len + 2) * 2 + 62, FALSE);
- newlen = uuencode_close (in, len, mf->outbuf, f->uubuf, &f->state, &f->save);
+ newlen = uuencode_close (in, len, mf->outbuf, f->uubuf, &f->state,
+ &f->save, &f->uulen);
g_assert (newlen <= (len + 2) * 2 + 62);
break;
case CAMEL_MIME_FILTER_BASIC_BASE64_DEC:
@@ -129,13 +128,9 @@ complete(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out,
g_assert(newlen <= len+2);
break;
case CAMEL_MIME_FILTER_BASIC_UU_DEC:
- if ((f->state & CAMEL_UUDECODE_STATE_BEGIN) && !(f->state & CAMEL_UUDECODE_STATE_END)) {
- /* "begin <mode> <filename>\n" has been found, so we can now start decoding */
- camel_mime_filter_set_size (mf, len + 3, FALSE);
- newlen = uudecode_step (in, len, mf->outbuf, &f->state, &f->save);
- } else {
- newlen = 0;
- }
+ /* output can't possibly exceed the input size */
+ camel_mime_filter_set_size (mf, len, FALSE);
+ newlen = uudecode_step (in, len, mf->outbuf, &f->state, &f->save, &f->uulen);
break;
default:
g_warning("unknown type %d in CamelMimeFilterBasic", f->type);
@@ -176,9 +171,8 @@ filter(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out, s
case CAMEL_MIME_FILTER_BASIC_UU_ENC:
/* won't go to more than 2 * (x + 2) + 62 */
camel_mime_filter_set_size (mf, (len + 2) * 2 + 62, FALSE);
- newlen = uuencode_step (in, len, mf->outbuf, f->uubuf, &f->state, &f->save);
+ newlen = uuencode_step (in, len, mf->outbuf, f->uubuf, &f->state, &f->save, &f->uulen);
g_assert (newlen <= (len + 2) * 2 + 62);
- break;
case CAMEL_MIME_FILTER_BASIC_BASE64_DEC:
/* output can't possibly exceed the input size */
camel_mime_filter_set_size(mf, len+3, FALSE);
@@ -192,48 +186,9 @@ filter(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out, s
g_assert(newlen <= len + 2);
break;
case CAMEL_MIME_FILTER_BASIC_UU_DEC:
- if (!(f->state & CAMEL_UUDECODE_STATE_BEGIN)) {
- register char *inptr, *inend;
- size_t left;
-
- inptr = in;
- inend = inptr + len;
-
- while (inptr < inend) {
- left = inend - inptr;
- if (left < 6) {
- if (!strncmp (inptr, "begin ", left))
- camel_mime_filter_backup (mf, inptr, left);
- break;
- } else if (!strncmp (inptr, "begin ", 6)) {
- for (in = inptr; inptr < inend && *inptr != '\n'; inptr++);
- if (inptr < inend) {
- inptr++;
- f->state |= CAMEL_UUDECODE_STATE_BEGIN;
- /* we can start uudecoding... */
- in = inptr;
- len = inend - in;
- } else {
- camel_mime_filter_backup (mf, in, left);
- }
- break;
- }
-
- /* go to the next line */
- for ( ; inptr < inend && *inptr != '\n'; inptr++);
-
- if (inptr < inend)
- inptr++;
- }
- }
-
- if ((f->state & CAMEL_UUDECODE_STATE_BEGIN) && !(f->state & CAMEL_UUDECODE_STATE_END)) {
- /* "begin <mode> <filename>\n" has been found, so we can now start decoding */
- camel_mime_filter_set_size (mf, len + 3, FALSE);
- newlen = uudecode_step (in, len, mf->outbuf, &f->state, &f->save);
- } else {
- newlen = 0;
- }
+ /* output can't possibly exceed the input size */
+ camel_mime_filter_set_size (mf, len, FALSE);
+ newlen = uudecode_step (in, len, mf->outbuf, &f->state, &f->save, &f->uulen);
break;
default:
g_warning("unknown type %d in CamelMimeFilterBasic", f->type);
diff --git a/camel/camel-mime-filter-charset.c b/camel/camel-mime-filter-charset.c
index f30047c96a..d3a02ffd15 100644
--- a/camel/camel-mime-filter-charset.c
+++ b/camel/camel-mime-filter-charset.c
@@ -179,12 +179,6 @@ filter(CamelMimeFilter *mf, char *in, size_t len, size_t prespace, char **out, s
bytes for a multibyte sequence, if not, we're in trouble.
*/
- /* This is to fix a bug in at least 1 version of glibc iconv: we get EINVAL and
- it reads past the input and returns a converted length of -1 ... so discard
- any overruns as failed */
- if (((int)inlen) < 0)
- inlen = 0;
-
if (inlen>0) {
camel_mime_filter_backup(mf, inbuf, inlen);
}
diff --git a/camel/camel-mime-message.c b/camel/camel-mime-message.c
index fe62c84ed5..ef157b7df7 100644
--- a/camel/camel-mime-message.c
+++ b/camel/camel-mime-message.c
@@ -56,27 +56,23 @@ typedef enum {
HEADER_REPLY_TO,
HEADER_SUBJECT,
HEADER_TO,
- HEADER_RESENT_TO,
HEADER_CC,
- HEADER_RESENT_CC,
HEADER_BCC,
- HEADER_RESENT_BCC,
HEADER_DATE,
HEADER_MESSAGE_ID
} CamelHeaderType;
static char *header_names[] = {
/* dont include HEADER_UNKNOWN string */
- "From", "Reply-To", "Subject", "To", "Resent-To", "Cc", "Resent-Cc",
- "Bcc", "Resent-Bcc", "Date", "Message-Id", NULL
+ "From", "Reply-To", "Subject", "To", "Cc", "Bcc", "Date", "Message-Id", NULL
};
static GHashTable *header_name_table;
-static CamelMimePartClass *parent_class = NULL;
+static CamelMimePartClass *parent_class=NULL;
static char *recipient_names[] = {
- "To", "Cc", "Bcc", "Resent-To", "Resent-Cc", "Resent-Bcc", NULL
+ "To", "Cc", "Bcc", NULL
};
static int write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream);
@@ -562,9 +558,6 @@ process_header (CamelMedium *medium, const char *header_name, const char *header
case HEADER_TO:
case HEADER_CC:
case HEADER_BCC:
- case HEADER_RESENT_TO:
- case HEADER_RESENT_CC:
- case HEADER_RESENT_BCC:
addr = g_hash_table_lookup (message->recipients, header_name);
if (header_value)
camel_address_decode (CAMEL_ADDRESS (addr), header_value);
diff --git a/camel/camel-mime-part-utils.c b/camel/camel-mime-part-utils.c
index 987e5e77d7..fa644468b8 100644
--- a/camel/camel-mime-part-utils.c
+++ b/camel/camel-mime-part-utils.c
@@ -2,8 +2,7 @@
/* camel-mime-part-utils : Utility for mime parsing and so on
*
* Authors: Bertrand Guiheneuf <bertrand@helixcode.com>
- * Michael Zucchi <notzed@ximian.com>
- * Jeffrey Stedfast <fejj@ximian.com>
+ * Michael Zucchi <notzed@ximian.com>
*
* Copyright 1999, 2000 Ximian, Inc. (www.ximian.com)
*
@@ -45,7 +44,6 @@
#include "camel-mime-filter-basic.h"
#include "camel-mime-filter-charset.h"
#include "camel-mime-filter-crlf.h"
-#include "camel-mime-filter-save.h"
#include "camel-html-parser.h"
#include "camel-charset-map.h"
@@ -99,106 +97,61 @@ check_html_charset(char *buffer, int length)
return charset;
}
-static GByteArray *
-convert_buffer (GByteArray *in, const char *to, const char *from)
+static GByteArray *convert_buffer(GByteArray *in, const char *to, const char *from)
{
- size_t inleft, outleft, outlen, converted = 0;
+ iconv_t ic;
+ size_t inlen, outlen;
+ char *inbuf, *outbuf;
+ char *buffer;
GByteArray *out = NULL;
- const char *inbuf;
- char *outbuf;
- iconv_t cd;
-
- if (in->len == 0)
- return g_byte_array_new();
+ int i = 2;
d(printf("converting buffer from %s to %s: '%.*s'\n", from, to, (int)in->len, in->data));
-
- cd = e_iconv_open(to, from);
- if (cd == (iconv_t) -1) {
- g_warning ("Cannot convert from '%s' to '%s': %s", from, to, g_strerror (errno));
+
+ ic = e_iconv_open(to, from);
+ if (ic == (iconv_t) -1) {
+ g_warning("Cannot convert from '%s' to '%s': %s", from, to, strerror(errno));
return NULL;
}
-
- outlen = in->len * 2 + 16;
- out = g_byte_array_new ();
- g_byte_array_set_size (out, outlen);
-
- inbuf = in->data;
- inleft = in->len;
-
+
do {
- outbuf = out->data + converted;
- outleft = outlen - converted;
-
- converted = e_iconv (cd, &inbuf, &inleft, &outbuf, &outleft);
- if (converted == (size_t) -1) {
- if (errno != E2BIG && errno != EINVAL)
- goto fail;
- }
-
- /*
- * E2BIG There is not sufficient room at *outbuf.
- *
- * We just need to grow our outbuffer and try again.
- */
-
- converted = outlen - outleft;
- if (errno == E2BIG) {
- outlen += inleft * 2 + 16;
- out = g_byte_array_set_size (out, outlen);
- outbuf = out->data + converted;
- }
-
- } while (errno == E2BIG && inleft > 0);
-
- /*
- * EINVAL An incomplete multibyte sequence has been encoun­
- * tered in the input.
- *
- * We'll just have to ignore it...
- */
-
- /* flush the iconv conversion */
- e_iconv (cd, NULL, NULL, &outbuf, &outleft);
-
- /* now set the true length on the GByteArray */
- converted = outlen - outleft;
- g_byte_array_set_size (out, converted);
-
- e_iconv_close (cd);
-
- return out;
-
- fail:
- g_warning ("Cannot convert from '%s' to '%s': %s", from, to, g_strerror (errno));
-
- g_byte_array_free (out, TRUE);
-
- e_iconv_close (cd);
-
- return NULL;
-}
+ /* make plenty of space? */
+ outlen = in->len * i + 16;
+ buffer = g_malloc(outlen);
-/* We don't really use the charset argument except for debugging... */
-static gboolean
-broken_windows_charset (GByteArray *buffer, const char *charset)
-{
- register unsigned char *inptr;
- unsigned char *inend;
-
- inptr = buffer->data;
- inend = inptr + buffer->len;
-
- while (inptr < inend) {
- register unsigned char c = *inptr++;
-
- if (c >= 128 && c <= 159) {
- g_warning ("Encountered Windows charset parading as %s", charset);
- return TRUE;
+ inbuf = in->data;
+ inlen = in->len;
+ outbuf = buffer;
+
+ if (e_iconv(ic, (const char **)&inbuf, &inlen, &outbuf, &outlen) == (size_t) -1) {
+ g_free(buffer);
+ g_warning("conversion failed: %s", strerror(errno));
+ /* we didn't have enough space */
+ if (errno == E2BIG && i<6) {
+ i++;
+ continue;
+ }
+ break;
}
- }
-
- return FALSE;
+
+ out = g_byte_array_new();
+ g_byte_array_append(out, buffer, (in->len*i+16) - outlen);
+
+ /* close off the conversion */
+ outbuf = buffer;
+ outlen = in->len * i + 16;
+ if (e_iconv(ic, NULL, 0, &outbuf, &outlen) != (size_t) -1)
+ g_byte_array_append(out, buffer, (in->len*i+16) - outlen);
+ g_free(buffer);
+
+ d(printf("converted: '%.*s'\n", (int)out->len, out->data));
+
+ break;
+ } while (1);
+
+ e_iconv_close(ic);
+
+ return out;
}
static gboolean
@@ -218,31 +171,28 @@ static void
simple_data_wrapper_construct_from_parser (CamelDataWrapper *dw, CamelMimeParser *mp)
{
CamelMimeFilter *fdec = NULL, *fcrlf = NULL;
- CamelMimeFilterBasicType enctype = 0;
int len, decid = -1, crlfid = -1;
struct _header_content_type *ct;
- const char *charset = NULL;
GByteArray *buffer;
char *encoding, *buf;
+ const char *charset = NULL;
+ CamelMimeFilterBasicType enctype = 0;
CamelStream *mem;
-
- d(printf ("simple_data_wrapper_construct_from_parser()\n"));
+
+ d(printf("constructing data-wrapper\n"));
/* first, work out conversion, if any, required, we dont care about what we dont know about */
- encoding = header_content_encoding_decode (camel_mime_parser_header (mp, "Content-Transfer-Encoding", NULL));
+ encoding = header_content_encoding_decode(camel_mime_parser_header(mp, "content-transfer-encoding", NULL));
if (encoding) {
- if (!strcasecmp (encoding, "base64")) {
+ if (!strcasecmp(encoding, "base64")) {
d(printf("Adding base64 decoder ...\n"));
enctype = CAMEL_MIME_FILTER_BASIC_BASE64_DEC;
- } else if (!strcasecmp (encoding, "quoted-printable")) {
+ } else if (!strcasecmp(encoding, "quoted-printable")) {
d(printf("Adding quoted-printable decoder ...\n"));
enctype = CAMEL_MIME_FILTER_BASIC_QP_DEC;
- } else if (!strcasecmp (encoding, "x-uuencode")) {
- d(printf("Adding uudecoder ...\n"));
- enctype = CAMEL_MIME_FILTER_BASIC_UU_DEC;
}
g_free (encoding);
-
+
if (enctype != 0) {
fdec = (CamelMimeFilter *)camel_mime_filter_basic_new_type(enctype);
decid = camel_mime_parser_filter_add (mp, fdec);
@@ -275,32 +225,21 @@ simple_data_wrapper_construct_from_parser (CamelDataWrapper *dw, CamelMimeParser
charset = check_html_charset(buffer->data, buffer->len);
/* if we need to do charset conversion, see if we can/it works/etc */
- if (charset && !(strcasecmp (charset, "us-ascii") == 0
- || strcasecmp (charset, "utf-8") == 0
- || strncasecmp (charset, "x-", 2) == 0)) {
+ if (charset && !(strcasecmp(charset, "us-ascii") == 0
+ || strcasecmp(charset, "utf-8") == 0
+ || strncasecmp(charset, "x-", 2) == 0)) {
GByteArray *out;
- /* You often see Microsoft Windows users announcing their texts
- * as being in ISO-8859-1 even when in fact they contain funny
- * characters from the Windows-CP1252 superset.
- */
- if (!strncasecmp (charset, "iso-8859", 8)) {
- /* check for Windows-specific chars... */
- if (broken_windows_charset (buffer, charset)) {
- charset = camel_charset_iso_to_windows (charset);
- charset = e_iconv_charset_name (charset);
- }
- }
-
- out = convert_buffer (buffer, "UTF-8", charset);
+ out = convert_buffer(buffer, "UTF-8", charset);
if (out) {
/* converted ok, use this data instead */
g_byte_array_free(buffer, TRUE);
buffer = out;
} else {
- /* else failed to convert, leave as raw? */
g_warning("Storing text as raw, unknown charset '%s' or invalid format", charset);
+ /* else failed to convert, leave as raw? */
dw->rawtext = TRUE;
+ /* should we change the content-type header? */
}
} else if (header_content_type_is (ct, "text", "*")) {
if (charset == NULL) {
@@ -315,9 +254,10 @@ simple_data_wrapper_construct_from_parser (CamelDataWrapper *dw, CamelMimeParser
dw->rawtext = !g_utf8_validate (buffer->data, buffer->len, NULL);
}
}
-
+
+
d(printf("message part kept in memory!\n"));
-
+
mem = camel_stream_mem_new_with_byte_array(buffer);
camel_data_wrapper_construct_from_stream(dw, mem);
camel_object_unref((CamelObject *)mem);
@@ -353,12 +293,11 @@ camel_mime_part_construct_content_from_parser (CamelMimePart *dw, CamelMimeParse
case HSCAN_MULTIPART: {
struct _header_content_type *content_type;
CamelDataWrapper *bodypart;
-
+
/* FIXME: we should use a came-mime-mutlipart, not jsut a camel-multipart, but who cares */
d(printf("Creating multi-part\n"));
-
content = (CamelDataWrapper *)camel_multipart_new ();
-
+
content_type = camel_mime_parser_content_type (mp);
camel_multipart_set_boundary ((CamelMultipart *)content,
header_content_type_param (content_type, "boundary"));
diff --git a/camel/camel-mime-part.c b/camel/camel-mime-part.c
index e64fc94927..7cc3c71f4c 100644
--- a/camel/camel-mime-part.c
+++ b/camel/camel-mime-part.c
@@ -92,11 +92,6 @@ static int construct_from_parser (CamelMimePart *, CamelMi
/* forward references */
static void set_disposition (CamelMimePart *mime_part, const gchar *disposition);
-/* format output of headers */
-static int write_references(CamelStream *stream, struct _header_raw *h);
-static int write_fold(CamelStream *stream, struct _header_raw *h);
-static int write_raw(CamelStream *stream, struct _header_raw *h);
-
/* loads in a hash table the set of header names we */
/* recognize and associate them with a unique enum */
@@ -114,16 +109,14 @@ init_header_name_table()
g_hash_table_insert (header_name_table, "Content-Type", (gpointer)HEADER_CONTENT_TYPE);
header_formatted_table = g_hash_table_new(g_strcase_hash, g_strcase_equal);
- g_hash_table_insert(header_formatted_table, "Content-Type", write_raw);
- g_hash_table_insert(header_formatted_table, "Content-Disposition", write_raw);
- g_hash_table_insert(header_formatted_table, "To", write_raw);
- g_hash_table_insert(header_formatted_table, "From", write_raw);
- g_hash_table_insert(header_formatted_table, "Reply-To", write_raw);
- g_hash_table_insert(header_formatted_table, "Cc", write_raw);
- g_hash_table_insert(header_formatted_table, "Bcc", write_raw);
- g_hash_table_insert(header_formatted_table, "Message-ID", write_raw);
- g_hash_table_insert(header_formatted_table, "In-Reply-To", write_raw);
- g_hash_table_insert(header_formatted_table, "References", write_references);
+ g_hash_table_insert(header_formatted_table, "Content-Type", (void *)1);
+ g_hash_table_insert(header_formatted_table, "Content-Disposition", (void *)1);
+ g_hash_table_insert(header_formatted_table, "To", (void *)1);
+ g_hash_table_insert(header_formatted_table, "From", (void *)1);
+ g_hash_table_insert(header_formatted_table, "Reply-To", (void *)1);
+ g_hash_table_insert(header_formatted_table, "Cc", (void *)1);
+ g_hash_table_insert(header_formatted_table, "Bcc", (void *)1);
+ g_hash_table_insert(header_formatted_table, "Message-ID", (void *)1);
}
static void
@@ -170,7 +163,7 @@ static void
camel_mime_part_finalize (CamelObject *object)
{
CamelMimePart *mime_part = CAMEL_MIME_PART (object);
-
+
g_free (mime_part->description);
g_free (mime_part->content_id);
g_free (mime_part->content_MD5);
@@ -554,77 +547,10 @@ set_content_object (CamelMedium *medium, CamelDataWrapper *content)
/**********************************************************************/
static int
-write_references(CamelStream *stream, struct _header_raw *h)
-{
- int len, out, total;
- char *v, *ids, *ide;
-
- /* this is only approximate, based on the next >, this way it retains any content
- from the original which may not be properly formatted, etc. It also doesn't handle
- the case where an individual messageid is too long, however thats a bad mail to
- start with ... */
-
- v = h->value;
- len = strlen(h->name)+1;
- total = camel_stream_printf(stream, "%s%s", h->name, isspace(v[0])?":":": ");
- if (total == -1)
- return -1;
- while (*v) {
- ids = v;
- ide = strchr(ids+1, '>');
- if (ide)
- v = ++ide;
- else
- ide = v = strlen(ids)+ids;
-
- if (len>0 && len + (ide - ids) >= CAMEL_FOLD_SIZE) {
- out = camel_stream_printf(stream, "\n\t");
- if (out == -1)
- return -1;
- total += out;
- len = 0;
- }
- out = camel_stream_write(stream, ids, ide-ids);
- if (out == -1)
- return -1;
- len += out;
- total += out;
- }
- camel_stream_write(stream, "\n", 1);
-
- return total;
-}
-
-#if 0
-/* not needed - yet - handled by default case */
-static int
-write_fold(CamelStream *stream, struct _header_raw *h)
-{
- char *val;
- int count;
-
- val = header_fold(h->value, strlen(h->name));
- count = camel_stream_printf(stream, "%s%s%s\n", h->name, isspace(val[0]) ? ":" : ": ", val);
- g_free(val);
-
- return count;
-}
-#endif
-
-static int
-write_raw(CamelStream *stream, struct _header_raw *h)
-{
- char *val = h->value;
-
- return camel_stream_printf(stream, "%s%s%s\n", h->name, isspace(val[0]) ? ":" : ": ", val);
-}
-
-static int
write_to_stream(CamelDataWrapper *data_wrapper, CamelStream *stream)
{
CamelMimePart *mp = CAMEL_MIME_PART(data_wrapper);
CamelMedium *medium = CAMEL_MEDIUM(data_wrapper);
- CamelStream *ostream = stream;
CamelDataWrapper *content;
int total = 0;
int count;
@@ -636,12 +562,11 @@ write_to_stream(CamelDataWrapper *data_wrapper, CamelStream *stream)
#ifndef NO_WARNINGS
#warning content-languages should be stored as a header
#endif
-
+
if (mp->headers) {
struct _header_raw *h = mp->headers;
char *val;
- int (*writefn)(CamelStream *stream, struct _header_raw *);
-
+
/* fold/write the headers. But dont fold headers that are already formatted
(e.g. ones with parameter-lists, that we know about, and have created) */
while (h) {
@@ -649,12 +574,12 @@ write_to_stream(CamelDataWrapper *data_wrapper, CamelStream *stream)
if (val == NULL) {
g_warning("h->value is NULL here for %s", h->name);
count = 0;
- } else if ((writefn = g_hash_table_lookup(header_formatted_table, h->name)) == NULL) {
+ } else if (g_hash_table_lookup(header_formatted_table, h->name) == NULL) {
val = header_fold(val, strlen(h->name));
count = camel_stream_printf(stream, "%s%s%s\n", h->name, isspace(val[0]) ? ":" : ": ", val);
g_free(val);
} else {
- count = writefn(stream, h);
+ count = camel_stream_printf(stream, "%s%s%s\n", h->name, isspace(val[0]) ? ":" : ": ", val);
}
if (count == -1)
return -1;
@@ -662,12 +587,12 @@ write_to_stream(CamelDataWrapper *data_wrapper, CamelStream *stream)
h = h->next;
}
}
-
+
count = camel_stream_write(stream, "\n", 1);
if (count == -1)
return -1;
total += count;
-
+
content = camel_medium_get_content_object(medium);
if (content) {
/* I dont really like this here, but i dont know where else it might go ... */
@@ -676,24 +601,15 @@ write_to_stream(CamelDataWrapper *data_wrapper, CamelStream *stream)
CamelMimeFilter *filter = NULL;
CamelStreamFilter *filter_stream = NULL;
CamelMimeFilter *charenc = NULL;
- const char *filename;
const char *charset;
-
- switch (mp->encoding) {
+
+ switch(mp->encoding) {
case CAMEL_MIME_PART_ENCODING_BASE64:
filter = (CamelMimeFilter *)camel_mime_filter_basic_new_type(CAMEL_MIME_FILTER_BASIC_BASE64_ENC);
break;
case CAMEL_MIME_PART_ENCODING_QUOTEDPRINTABLE:
filter = (CamelMimeFilter *)camel_mime_filter_basic_new_type(CAMEL_MIME_FILTER_BASIC_QP_ENC);
break;
- case CAMEL_MIME_PART_ENCODING_UUENCODE:
- filename = camel_mime_part_get_filename (mp);
- count = camel_stream_printf (ostream, "begin 644 %s\n", filename ? filename : "untitled");
- if (count == -1)
- return -1;
- total += count;
- filter = (CamelMimeFilter *)camel_mime_filter_basic_new_type(CAMEL_MIME_FILTER_BASIC_UU_ENC);
- break;
default:
break;
}
@@ -707,34 +623,33 @@ write_to_stream(CamelDataWrapper *data_wrapper, CamelStream *stream)
if (filter || charenc) {
filter_stream = camel_stream_filter_new_with_stream(stream);
-
+
/* if we have a character encoder, add that always */
if (charenc) {
camel_stream_filter_add(filter_stream, charenc);
camel_object_unref((CamelObject *)charenc);
}
-
+
/* we only re-do crlf on encoded blocks */
if (filter && header_content_type_is(mp->content_type, "text", "*")) {
CamelMimeFilter *crlf = camel_mime_filter_crlf_new(CAMEL_MIME_FILTER_CRLF_ENCODE,
CAMEL_MIME_FILTER_CRLF_MODE_CRLF_ONLY);
-
+
camel_stream_filter_add(filter_stream, crlf);
camel_object_unref((CamelObject *)crlf);
+
}
-
+
if (filter) {
camel_stream_filter_add(filter_stream, filter);
camel_object_unref((CamelObject *)filter);
}
-
+
stream = (CamelStream *)filter_stream;
}
#endif
-
count = camel_data_wrapper_write_to_stream(content, stream);
-
if (filter_stream) {
camel_stream_flush((CamelStream *)filter_stream);
camel_object_unref((CamelObject *)filter_stream);
@@ -742,17 +657,9 @@ write_to_stream(CamelDataWrapper *data_wrapper, CamelStream *stream)
if (count == -1)
return -1;
total += count;
-
- if (mp->encoding == CAMEL_MIME_PART_ENCODING_UUENCODE) {
- count = camel_stream_write (ostream, "end\n", 4);
- if (count == -1)
- return -1;
- total += count;
- }
} else {
g_warning("No content for medium, nothing to write");
}
-
return total;
}
@@ -854,8 +761,7 @@ static const char *encodings[] = {
"8bit",
"base64",
"quoted-printable",
- "binary",
- "x-uuencode",
+ "binary"
};
const char *
diff --git a/camel/camel-mime-utils.c b/camel/camel-mime-utils.c
index 148eea9a80..8563a4f140 100644
--- a/camel/camel-mime-utils.c
+++ b/camel/camel-mime-utils.c
@@ -1,4 +1,3 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* Copyright (C) 2000 Ximian Inc.
*
@@ -417,35 +416,32 @@ base64_decode_simple (char *data, size_t len)
* @uubuf: temporary buffer of 60 bytes
* @state: holds the number of bits that are stored in @save
* @save: leftover bits that have not yet been encoded
+ * @uulen: holds the value of the length-char which is used to calculate
+ * how many more chars need to be decoded for that 'line'
*
* Returns the number of bytes encoded. Call this when finished
* encoding data with uuencode_step to flush off the last little
* bit.
**/
size_t
-uuencode_close (unsigned char *in, size_t len, unsigned char *out, unsigned char *uubuf, int *state, guint32 *save)
+uuencode_close (unsigned char *in, size_t len, unsigned char *out, unsigned char *uubuf, int *state, guint32 *save, char *uulen)
{
register unsigned char *outptr, *bufptr;
register guint32 saved;
- int uulen, uufill, i;
+ int i;
outptr = out;
if (len > 0)
- outptr += uuencode_step (in, len, out, uubuf, state, save);
-
- uufill = 0;
+ outptr += uuencode_step (in, len, out, uubuf, state, save, uulen);
+ bufptr = uubuf + ((*uulen / 3) * 4);
saved = *save;
- i = *state & 0xff;
- uulen = (*state >> 8) & 0xff;
-
- bufptr = uubuf + ((uulen / 3) * 4);
+ i = *state;
if (i > 0) {
while (i < 3) {
saved <<= 8 | 0;
- uufill++;
i++;
}
@@ -461,24 +457,20 @@ uuencode_close (unsigned char *in, size_t len, unsigned char *out, unsigned char
*bufptr++ = CAMEL_UUENCODE_CHAR (((b0 << 4) | ((b1 >> 4) & 0xf)) & 0x3f);
*bufptr++ = CAMEL_UUENCODE_CHAR (((b1 << 2) | ((b2 >> 6) & 0x3)) & 0x3f);
*bufptr++ = CAMEL_UUENCODE_CHAR (b2 & 0x3f);
-
- i = 0;
- saved = 0;
- uulen += 3;
}
}
- if (uulen > 0) {
- int cplen = ((uulen / 3) * 4);
+ if (*uulen || *state) {
+ int cplen = (((*uulen + (*state ? 3 : 0)) / 3) * 4);
- *outptr++ = CAMEL_UUENCODE_CHAR ((uulen - uufill) & 0xff);
+ *outptr++ = CAMEL_UUENCODE_CHAR (*uulen + *state);
memcpy (outptr, uubuf, cplen);
outptr += cplen;
*outptr++ = '\n';
- uulen = 0;
+ *uulen = 0;
}
- *outptr++ = CAMEL_UUENCODE_CHAR (uulen & 0xff);
+ *outptr++ = CAMEL_UUENCODE_CHAR (*uulen);
*outptr++ = '\n';
*save = 0;
@@ -496,6 +488,8 @@ uuencode_close (unsigned char *in, size_t len, unsigned char *out, unsigned char
* @uubuf: temporary buffer of 60 bytes
* @state: holds the number of bits that are stored in @save
* @save: leftover bits that have not yet been encoded
+ * @uulen: holds the value of the length-char which is used to calculate
+ * how many more chars need to be decoded for that 'line'
*
* Returns the number of bytes encoded. Performs an 'encode step',
* only encodes blocks of 45 characters to the output at a time, saves
@@ -503,26 +497,28 @@ uuencode_close (unsigned char *in, size_t len, unsigned char *out, unsigned char
* invocation).
**/
size_t
-uuencode_step (unsigned char *in, size_t len, unsigned char *out, unsigned char *uubuf, int *state, guint32 *save)
+uuencode_step (unsigned char *in, size_t len, unsigned char *out, unsigned char *uubuf, int *state, guint32 *save, char *uulen)
{
register unsigned char *inptr, *outptr, *bufptr;
unsigned char *inend;
register guint32 saved;
- int uulen, i;
+ int i;
- saved = *save;
- i = *state & 0xff;
- uulen = (*state >> 8) & 0xff;
+ if (*uulen <= 0)
+ *uulen = 0;
inptr = in;
inend = in + len;
outptr = out;
- bufptr = uubuf + ((uulen / 3) * 4);
+ bufptr = uubuf + ((*uulen / 3) * 4);
+
+ saved = *save;
+ i = *state;
while (inptr < inend) {
- while (uulen < 45 && inptr < inend) {
+ while (*uulen < 45 && inptr < inend) {
while (i < 3 && inptr < inend) {
saved = (saved << 8) | *inptr++;
i++;
@@ -543,22 +539,22 @@ uuencode_step (unsigned char *in, size_t len, unsigned char *out, unsigned char
i = 0;
saved = 0;
- uulen += 3;
+ *uulen += 3;
}
}
- if (uulen >= 45) {
- *outptr++ = CAMEL_UUENCODE_CHAR (uulen & 0xff);
- memcpy (outptr, uubuf, ((uulen / 3) * 4));
- outptr += ((uulen / 3) * 4);
+ if (*uulen >= 45) {
+ *outptr++ = CAMEL_UUENCODE_CHAR (*uulen);
+ memcpy (outptr, uubuf, ((*uulen / 3) * 4));
+ outptr += ((*uulen / 3) * 4);
*outptr++ = '\n';
- uulen = 0;
+ *uulen = 0;
bufptr = uubuf;
}
}
*save = saved;
- *state = ((uulen & 0xff) << 8) | (i & 0xff);
+ *state = i;
return outptr - out;
}
@@ -571,92 +567,85 @@ uuencode_step (unsigned char *in, size_t len, unsigned char *out, unsigned char
* @out: output stream
* @state: holds the number of bits that are stored in @save
* @save: leftover bits that have not yet been decoded
+ * @uulen: holds the value of the length-char which is used to calculate
+ * how many more chars need to be decoded for that 'line'
*
* Returns the number of bytes decoded. Performs a 'decode step' on
* a chunk of uuencoded data. Assumes the "begin <mode> <file name>"
* line has been stripped off.
**/
size_t
-uudecode_step (unsigned char *in, size_t len, unsigned char *out, int *state, guint32 *save)
+uudecode_step (unsigned char *in, size_t len, unsigned char *out, int *state, guint32 *save, char *uulen)
{
register unsigned char *inptr, *outptr;
unsigned char *inend, ch;
register guint32 saved;
gboolean last_was_eoln;
- int uulen, i;
-
- if (*state & CAMEL_UUDECODE_STATE_END)
- return 0;
-
- saved = *save;
- i = *state & 0xff;
- uulen = (*state >> 8) & 0xff;
- if (uulen == 0)
+ int i;
+
+ if (*uulen <= 0)
last_was_eoln = TRUE;
else
last_was_eoln = FALSE;
inend = in + len;
outptr = out;
-
+ saved = *save;
+ i = *state;
inptr = in;
- while (inptr < inend) {
+ while (inptr < inend && *inptr) {
if (*inptr == '\n' || last_was_eoln) {
- if (last_was_eoln && *inptr != '\n') {
- uulen = CAMEL_UUDECODE_CHAR (*inptr);
+ if (last_was_eoln) {
+ *uulen = CAMEL_UUDECODE_CHAR (*inptr);
last_was_eoln = FALSE;
- if (uulen == 0) {
- *state |= CAMEL_UUDECODE_STATE_END;
- break;
- }
} else {
last_was_eoln = TRUE;
}
-
+
inptr++;
continue;
}
-
+
ch = *inptr++;
- if (uulen > 0) {
+ if (*uulen > 0) {
/* save the byte */
saved = (saved << 8) | ch;
i++;
if (i == 4) {
/* convert 4 uuencoded bytes to 3 normal bytes */
unsigned char b0, b1, b2, b3;
-
+
b0 = saved >> 24;
b1 = saved >> 16 & 0xff;
b2 = saved >> 8 & 0xff;
b3 = saved & 0xff;
-
- if (uulen >= 3) {
+
+ if (*uulen >= 3) {
*outptr++ = CAMEL_UUDECODE_CHAR (b0) << 2 | CAMEL_UUDECODE_CHAR (b1) >> 4;
*outptr++ = CAMEL_UUDECODE_CHAR (b1) << 4 | CAMEL_UUDECODE_CHAR (b2) >> 2;
*outptr++ = CAMEL_UUDECODE_CHAR (b2) << 6 | CAMEL_UUDECODE_CHAR (b3);
} else {
- if (uulen >= 1) {
+ if (*uulen >= 1) {
*outptr++ = CAMEL_UUDECODE_CHAR (b0) << 2 | CAMEL_UUDECODE_CHAR (b1) >> 4;
}
- if (uulen >= 2) {
+ if (*uulen >= 2) {
*outptr++ = CAMEL_UUDECODE_CHAR (b1) << 4 | CAMEL_UUDECODE_CHAR (b2) >> 2;
}
}
-
+
i = 0;
saved = 0;
- uulen -= 3;
+ *uulen -= 3;
}
} else {
break;
}
}
-
+
*save = saved;
- *state = (*state & CAMEL_UUDECODE_STATE_MASK) | ((uulen & 0xff) << 8) | (i & 0xff);
-
+ *state = i;
+
return outptr - out;
}
@@ -987,7 +976,7 @@ rfc2047_decode_word(const char *in, size_t len)
const char *inend = in+len-2;
const char *inbuf;
const char *charset;
- char *encname, *p;
+ char *encname;
int tmplen;
size_t ret;
char *decword = NULL;
@@ -1037,18 +1026,6 @@ rfc2047_decode_word(const char *in, size_t len)
memcpy (encname, in + 2, tmplen);
encname[tmplen] = '\0';
- /* rfc2231 updates rfc2047 encoded words...
- * The ABNF given in RFC 2047 for encoded-words is:
- * encoded-word := "=?" charset "?" encoding "?" encoded-text "?="
- * This specification changes this ABNF to:
- * encoded-word := "=?" charset ["*" language] "?" encoding "?" encoded-text "?="
- */
-
- /* trim off the 'language' part if it's there... */
- p = strchr (encname, '*');
- if (p)
- *p = '\0';
-
charset = e_iconv_charset_name (encname);
inbuf = decword;
@@ -1226,7 +1203,7 @@ header_decode_string (const char *in, const char *default_charset)
static void
rfc2047_encode_word(GString *outstring, const char *in, size_t len, const char *type, unsigned short safemask)
{
- iconv_t ic = (iconv_t) -1;
+ iconv_t ic = (iconv_t *)-1;
char *buffer, *out, *ascii;
size_t inlen, outlen, enclen, bufflen;
const char *inptr, *p;
@@ -1371,6 +1348,7 @@ header_encode_string (const unsigned char *in)
inptr++;
continue;
}
+
if (g_unichar_isspace (c) && !last_was_space) {
/* we've reached the end of a 'word' */
@@ -1817,8 +1795,8 @@ header_decode_value(const char **in)
return NULL;
}
-/* should this return -1 for no int? */
-int
+/* shoudl this return -1 for no int? */
+static int
header_decode_int(const char **in)
{
const char *inptr = *in;
@@ -1842,9 +1820,9 @@ hex_decode (const char *in, size_t len)
unsigned char *inptr, *outptr;
char *outbuf;
- outptr = outbuf = g_malloc (len + 1);
+ outptr = outbuf = g_malloc (len);
- inptr = (unsigned char *) in;
+ inptr = (guchar *) in;
while (inptr < inend) {
if (*inptr == '%') {
if (isxdigit (inptr[1]) && isxdigit (inptr[2])) {
@@ -1896,7 +1874,7 @@ rfc2184_decode (const char *in, size_t len)
inbuf = decword = hex_decode (inptr, inend - inptr);
inlen = strlen (inbuf);
- ic = e_iconv_open ("UTF-8", charset);
+ ic = e_iconv_open("UTF-8", charset);
if (ic != (iconv_t) -1) {
size_t ret;
@@ -1911,7 +1889,7 @@ rfc2184_decode (const char *in, size_t len)
decoded = outbase;
}
- e_iconv_close (ic);
+ e_iconv_close(ic);
} else {
decoded = decword;
}
@@ -1935,14 +1913,14 @@ decode_param_token (const char **in)
inptr++;
if (inptr > start) {
*in = inptr;
- return g_strndup (start, inptr - start);
+ return g_strndup (start, inptr-start);
} else {
return NULL;
}
}
static gboolean
-header_decode_rfc2184_param (const char **in, char **paramp, gboolean *value_is_encoded, int *part)
+header_decode_rfc2184_param (const char **in, char **paramp, int *part, gboolean *value_is_encoded)
{
gboolean is_rfc2184 = FALSE;
const char *inptr = *in;
@@ -1986,17 +1964,18 @@ header_decode_rfc2184_param (const char **in, char **paramp, gboolean *value_is_
}
static int
-header_decode_param (const char **in, char **paramp, char **valuep, int *is_rfc2184_param, int *rfc2184_part)
+header_decode_param (const char **in, char **paramp, char **valuep, int *is_rfc2184_param)
{
gboolean is_rfc2184_encoded = FALSE;
gboolean is_rfc2184 = FALSE;
const char *inptr = *in;
char *param, *value = NULL;
+ int rfc2184_part = -1;
*is_rfc2184_param = FALSE;
- *rfc2184_part = -1;
- is_rfc2184 = header_decode_rfc2184_param (&inptr, &param, &is_rfc2184_encoded, rfc2184_part);
+ is_rfc2184 = header_decode_rfc2184_param (&inptr, &param, &rfc2184_part,
+ &is_rfc2184_encoded);
if (*inptr == '=') {
inptr++;
@@ -2005,7 +1984,7 @@ header_decode_param (const char **in, char **paramp, char **valuep, int *is_rfc2
if (is_rfc2184) {
/* We have ourselves an rfc2184 parameter */
- if (*rfc2184_part == -1) {
+ if (rfc2184_part == -1) {
/* rfc2184 allows the value to be broken into
* multiple parts - this isn't one of them so
* it is safe to decode it.
@@ -2050,7 +2029,7 @@ header_decode_param (const char **in, char **paramp, char **valuep, int *is_rfc2
inbuf = value;
inlen = strlen (inbuf);
- charset = e_iconv_locale_charset ();
+ charset = e_iconv_locale_charset();
ic = e_iconv_open ("UTF-8", charset ? charset : "ISO-8859-1");
if (ic != (iconv_t) -1) {
size_t ret;
@@ -2240,7 +2219,7 @@ header_decode_domain(const char **in)
header_decode_lwsp(&inptr);
while (go) {
if (*inptr == '[') { /* domain literal */
- domain = g_string_append_c(domain, '[');
+ domain = g_string_append(domain, "[ ");
inptr++;
header_decode_lwsp(&inptr);
start = inptr;
@@ -2249,7 +2228,7 @@ header_decode_domain(const char **in)
inptr++;
}
if (*inptr == ']') {
- domain = g_string_append_c(domain, ']');
+ domain = g_string_append(domain, " ]");
inptr++;
} else {
w(g_warning("closing ']' not found in domain: %s", *in));
@@ -2678,62 +2657,37 @@ header_references_list_clear(struct _header_references **list)
*list = NULL;
}
-static void
-header_references_decode_single (const char **in, struct _header_references **head)
+/* generate a list of references, from most recent up */
+struct _header_references *
+header_references_decode(const char *in)
{
- struct _header_references *ref;
- const char *inptr = *in;
+ const char *inptr = in;
+ struct _header_references *head = NULL, *node;
char *id, *word;
-
+
+ if (in == NULL || in[0] == '\0')
+ return NULL;
+
while (*inptr) {
- header_decode_lwsp (&inptr);
+ header_decode_lwsp(&inptr);
if (*inptr == '<') {
- id = header_msgid_decode_internal (&inptr);
+ id = header_msgid_decode_internal(&inptr);
if (id) {
- ref = g_malloc (sizeof (struct _header_references));
- ref->next = *head;
- ref->id = id;
- *head = ref;
- break;
+ node = g_malloc(sizeof(*node));
+ node->next = head;
+ head = node;
+ node->id = id;
}
} else {
- word = header_decode_word (&inptr);
+ word = header_decode_word(&inptr);
if (word)
g_free (word);
else if (*inptr != '\0')
inptr++; /* Stupid mailer tricks */
}
}
-
- *in = inptr;
-}
-struct _header_references *
-header_references_inreplyto_decode (const char *in)
-{
- struct _header_references *ref = NULL;
-
- if (in == NULL || in[0] == '\0')
- return NULL;
-
- header_references_decode_single (&in, &ref);
-
- return ref;
-}
-
-/* generate a list of references, from most recent up */
-struct _header_references *
-header_references_decode (const char *in)
-{
- struct _header_references *refs = NULL;
-
- if (in == NULL || in[0] == '\0')
- return NULL;
-
- while (*in)
- header_references_decode_single (&in, &refs);
-
- return refs;
+ return head;
}
struct _header_references *
@@ -2829,7 +2783,7 @@ header_mime_decode(const char *in, int *maj, int *min)
}
static struct _header_param *
-header_decode_param_list (const char **in)
+header_decode_param_list(const char **in)
{
const char *inptr = *in;
struct _header_param *head = NULL, *tail = NULL;
@@ -2841,11 +2795,10 @@ header_decode_param_list (const char **in)
while (*inptr == ';') {
struct _header_param *param;
char *name, *value;
- int rfc2184_part;
inptr++;
/* invalid format? */
- if (header_decode_param (&inptr, &name, &value, &is_rfc2184, &rfc2184_part) != 0)
+ if (header_decode_param (&inptr, &name, &value, &is_rfc2184) != 0)
break;
if (is_rfc2184 && tail && !strcasecmp (name, tail->name)) {
@@ -2853,7 +2806,6 @@ header_decode_param_list (const char **in)
* and it looks like we've found one. Append this value to the
* last value.
*/
- /* FIXME: we should be ordering these based on rfc2184_part id */
GString *gvalue;
gvalue = g_string_new (tail->value);
@@ -2921,15 +2873,12 @@ header_param_list_decode(const char *in)
return header_decode_param_list(&in);
}
-
+/* FIXME: I wrote this in a quick & dirty fasion - it may not be 100% correct */
static char *
header_encode_param (const unsigned char *in, gboolean *encoded)
{
- register const unsigned char *inptr = in;
- unsigned char *outbuf = NULL;
- iconv_t cd = (iconv_t) -1;
- const char *charset;
- char *outstr;
+ const unsigned char *inptr = in;
+ char *outstr, *charset;
int encoding;
GString *out;
@@ -2948,11 +2897,12 @@ header_encode_param (const unsigned char *in, gboolean *encoded)
if (*inptr == '\0')
return g_strdup (in);
+ out = g_string_new ("");
inptr = in;
encoding = 0;
while (inptr && *inptr) {
- const char *newinptr;
gunichar c;
+ const char *newinptr;
newinptr = g_utf8_next_char (inptr);
c = g_utf8_get_char (inptr);
@@ -2965,66 +2915,29 @@ header_encode_param (const unsigned char *in, gboolean *encoded)
if (c > 127 && c < 256) {
encoding = MAX (encoding, 1);
+ g_string_sprintfa (out, "%%%c%c", tohex[(c >> 4) & 0xf], tohex[c & 0xf]);
} else if (c >= 256) {
encoding = MAX (encoding, 2);
- }
-
- inptr = newinptr;
- }
-
- if (encoding == 2)
- charset = camel_charset_best (in, inptr - in);
- else
- charset = "iso-8859-1";
-
- if (strcasecmp (charset, "UTF-8") != 0)
- cd = e_iconv_open (charset, "UTF-8");
-
- if (cd == (iconv_t) -1) {
- charset = "UTF-8";
- inptr = in;
- } else {
- size_t inleft, outleft;
- const char *inbuf;
- char *outptr;
-
- inleft = (inptr - in);
- outleft = inleft * 6 + 16 + 1;
- outptr = outbuf = alloca (outleft);
- inbuf = in;
-
- if (e_iconv (cd, &inbuf, &inleft, &outptr, &outleft) == (size_t) -1) {
- w(g_warning ("Conversion problem: conversion truncated: %s" g_strerror (errno)));
- } else {
- e_iconv (cd, NULL, 0, &outptr, &outleft);
- }
-
- e_iconv_close (cd);
-
- *outptr = '\0';
-
- inptr = outbuf;
- }
-
- /* FIXME: set the 'language' as well, assuming we can get that info...? */
- out = g_string_new ("");
- g_string_sprintfa (out, "%s''", charset);
-
- while (inptr && *inptr) {
- unsigned char c = *inptr++;
-
- /* FIXME: make sure that '\'', '*', and ';' are also encoded */
-
- if (c > 127) {
g_string_sprintfa (out, "%%%c%c", tohex[(c >> 4) & 0xf], tohex[c & 0xf]);
- } else if (is_lwsp (c) || !(camel_mime_special_table[c] & IS_ESAFE)) {
+ } else if (is_lwsp (c) || camel_mime_special_table[c] & IS_ESAFE) {
g_string_sprintfa (out, "%%%c%c", tohex[(c >> 4) & 0xf], tohex[c & 0xf]);
} else {
g_string_append_c (out, c);
}
+
+ inptr = newinptr;
}
- g_free (outbuf);
+ switch (encoding) {
+ default:
+ g_string_prepend (out, "iso-8859-1''");
+ break;
+ case 2:
+ charset = g_strdup_printf ("%s''", camel_charset_best (in, inptr - in));
+ g_string_prepend (out, charset);
+ g_free (charset);
+ break;
+ }
outstr = out->str;
g_string_free (out, FALSE);
@@ -3399,12 +3312,21 @@ header_decode_date(const char *in, int *saveoffset)
inptr++;
} else {
#ifndef CLEAN_DATE
- return parse_broken_date (in, saveoffset);
-#else
+ char *newdate;
+
+ w(g_warning("day not followed by ',' it's probably a broken mail client, so we'll ignore its date entirely"));
+ w(printf ("Giving it one last chance...\n"));
+ newdate = parse_broken_date (in);
+ if (newdate) {
+ w(printf ("Got: %s\n", newdate));
+ t = header_decode_date (newdate, saveoffset);
+ g_free (newdate);
+ return t;
+ }
+#endif
if (saveoffset)
*saveoffset = 0;
return 0;
-#endif /* ! CLEAN_DATE */
}
}
}
@@ -3420,12 +3342,10 @@ header_decode_date(const char *in, int *saveoffset)
g_free(monthname);
}
year = header_decode_int(&inptr);
- if (year < 69) {
+ if (year < 69 || (year >= 100 && year < 1900)) {
tm.tm_year = 100 + year;
} else if (year < 100) {
tm.tm_year = year;
- } else if (year >= 100 && year < 1900) {
- tm.tm_year = year;
} else {
tm.tm_year = year - 1900;
}
@@ -3728,6 +3648,23 @@ static struct {
char *pattern;
regex_t regex;
} mail_list_magic[] = {
+ /* Sender: owner-gnome-hackers@gnome.org */
+ /* Sender: owner-gnome-hacekrs */
+ { "Sender", " *owner-([^@]+)@?([^ @\n\t\r>]*)" },
+ /* Sender: gnome-hackers-owner@gnome.org */
+ /* Sender: gnome-hackers-owner */
+ { "Sender", " *([^@]+)-owner@?([^ @\n\t\r>]*)" },
+ /* Sender: owner-gnome-hackers@gnome.org */
+ /* Sender: <owner-gnome-hackers@gnome.org> */
+ /* Sender: owner-gnome-hackers */
+ /* Sender: <owner-gnome-hackers> */
+ { "Return-Path", " <?owner-([^@>]+)@?([^ \n\t\r>]*)" },
+ /* X-BeenThere: gnome-hackers@gnome.org */
+ /* X-BeenThere: gnome-hackers */
+ { "X-BeenThere", " *([^@]+)@?([^ \n\t\r>]*)" },
+ /* Delivered-To: mailing list gnome-hackers@gnome.org */
+ /* Delivered-To: mailing list gnome-hackers */
+ { "Delivered-To", " *mailing list ([^@]+)@?([^ \n\t\r>]*)" },
/* X-Mailing-List: <gnome-hackers@gnome.org> arcive/latest/100 */
/* X-Mailing-List: gnome-hackers@gnome.org */
/* X-Mailing-List: gnome-hackers */
@@ -3750,23 +3687,6 @@ static struct {
/* X-List: gnome-hackers */
/* X-List: gnome-hackers@gnome.org */
{ "X-List", " *([^@]+)@?([^ \n\t\r>]*)" },
- /* Sender: owner-gnome-hackers@gnome.org */
- /* Sender: owner-gnome-hacekrs */
- { "Sender", " *owner-([^@]+)@?([^ @\n\t\r>]*)" },
- /* Sender: gnome-hackers-owner@gnome.org */
- /* Sender: gnome-hackers-owner */
- { "Sender", " *([^@]+)-owner@?([^ @\n\t\r>]*)" },
- /* Delivered-To: mailing list gnome-hackers@gnome.org */
- /* Delivered-To: mailing list gnome-hackers */
- { "Delivered-To", " *mailing list ([^@]+)@?([^ \n\t\r>]*)" },
- /* Sender: owner-gnome-hackers@gnome.org */
- /* Sender: <owner-gnome-hackers@gnome.org> */
- /* Sender: owner-gnome-hackers */
- /* Sender: <owner-gnome-hackers> */
- { "Return-Path", " <?owner-([^@>]+)@?([^ \n\t\r>]*)" },
- /* X-BeenThere: gnome-hackers@gnome.org */
- /* X-BeenThere: gnome-hackers */
- { "X-BeenThere", " *([^@]+)@?([^ \n\t\r>]*)" },
};
char *
@@ -4143,11 +4063,11 @@ header_fold(const char *in, size_t headerlen)
g_string_append(out, "\n\t");
outlen = 1;
/* check for very long words, just cut them up */
- while (outlen+len > CAMEL_FOLD_MAX_SIZE) {
- for (i=0;i<CAMEL_FOLD_MAX_SIZE-outlen;i++)
+ while (outlen+len > CAMEL_FOLD_SIZE) {
+ for (i=0;i<CAMEL_FOLD_SIZE-outlen;i++)
g_string_append_c(out, inptr[i]);
- inptr += CAMEL_FOLD_MAX_SIZE-outlen;
- len -= CAMEL_FOLD_MAX_SIZE-outlen;
+ inptr += CAMEL_FOLD_SIZE-outlen;
+ len -= CAMEL_FOLD_SIZE-outlen;
g_string_append(out, "\n\t");
outlen = 1;
}
diff --git a/camel/camel-mime-utils.h b/camel/camel-mime-utils.h
index 91d1d71553..fcd1a06fa5 100644
--- a/camel/camel-mime-utils.h
+++ b/camel/camel-mime-utils.h
@@ -1,4 +1,3 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* Copyright (C) 2000 Ximian Inc.
*
@@ -20,27 +19,14 @@
* Boston, MA 02111-1307, USA.
*/
-
#ifndef _CAMEL_MIME_UTILS_H
#define _CAMEL_MIME_UTILS_H
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
#include <time.h>
#include <glib.h>
-/* maximum recommended size of a line from header_fold() */
+/* maximum size of a line from header_fold() */
#define CAMEL_FOLD_SIZE (77)
-/* maximum hard size of a line from header_fold() */
-#define CAMEL_FOLD_MAX_SIZE (998)
-
-#define CAMEL_UUDECODE_STATE_INIT (0)
-#define CAMEL_UUDECODE_STATE_BEGIN (1 << 16)
-#define CAMEL_UUDECODE_STATE_END (1 << 17)
-#define CAMEL_UUDECODE_STATE_MASK (CAMEL_UUDECODE_STATE_BEGIN | CAMEL_UUDECODE_STATE_END)
/* a list of references for this message */
struct _header_references {
@@ -152,8 +138,8 @@ char *header_content_encoding_decode(const char *in);
/* raw headers */
void header_raw_append(struct _header_raw **list, const char *name, const char *value, int offset);
void header_raw_append_parse(struct _header_raw **list, const char *header, int offset);
-const char *header_raw_find(struct _header_raw **list, const char *name, int *offset);
-const char *header_raw_find_next(struct _header_raw **list, const char *name, int *offset, const char *last);
+const char *header_raw_find(struct _header_raw **list, const char *name, int *ofset);
+const char *header_raw_find_next(struct _header_raw **list, const char *name, int *ofset, const char *last);
void header_raw_replace(struct _header_raw **list, const char *name, const char *value, int offset);
void header_raw_remove(struct _header_raw **list, const char *name);
void header_raw_fold(struct _header_raw **list);
@@ -169,8 +155,6 @@ char *header_unfold (const char *in);
/* decode a header which is a simple token */
char *header_token_decode (const char *in);
-int header_decode_int (const char **in);
-
/* decode/encode a string type, like a subject line */
char *header_decode_string (const char *in, const char *default_charset);
char *header_encode_string (const unsigned char *in);
@@ -188,8 +172,7 @@ char *header_msgid_decode (const char *in);
/* generate msg id */
char *header_msgid_generate (void);
-/* decode a References or In-Reply-To header */
-struct _header_references *header_references_inreplyto_decode (const char *in);
+/* decode a References header */
struct _header_references *header_references_decode(const char *in);
void header_references_list_clear(struct _header_references **list);
void header_references_list_append_asis(struct _header_references **list, char *ref);
@@ -208,12 +191,12 @@ size_t base64_decode_step(unsigned char *in, size_t len, unsigned char *out, int
size_t base64_encode_step(unsigned char *in, size_t len, gboolean break_lines, unsigned char *out, int *state, int *save);
size_t base64_encode_close(unsigned char *in, size_t len, gboolean break_lines, unsigned char *out, int *state, int *save);
-size_t uudecode_step (unsigned char *in, size_t len, unsigned char *out, int *state, guint32 *save);
+size_t uudecode_step (unsigned char *in, size_t len, unsigned char *out, int *state, guint32 *save, char *uulen);
size_t uuencode_step (unsigned char *in, size_t len, unsigned char *out, unsigned char *uubuf, int *state,
- guint32 *save);
+ guint32 *save, char *uulen);
size_t uuencode_close (unsigned char *in, size_t len, unsigned char *out, unsigned char *uubuf, int *state,
- guint32 *save);
+ guint32 *save, char *uulen);
size_t quoted_decode_step(unsigned char *in, size_t len, unsigned char *out, int *savestate, int *saveme);
@@ -223,8 +206,4 @@ size_t quoted_encode_close(unsigned char *in, size_t len, unsigned char *out, in
char *base64_encode_simple (const char *data, size_t len);
size_t base64_decode_simple (char *data, size_t len);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
#endif /* ! _CAMEL_MIME_UTILS_H */
diff --git a/camel/camel-pgp-context.c b/camel/camel-pgp-context.c
index 29a948e881..16b3ea72b7 100644
--- a/camel/camel-pgp-context.c
+++ b/camel/camel-pgp-context.c
@@ -540,53 +540,6 @@ crypto_exec_with_passwd (const char *path, char *argv[], const char *input, int
* Public crypto functions
*----------------------------------------------------------------------*/
-static char *
-hash_string (CamelPgpContext *ctx, CamelCipherHash hash)
-{
- if (hash == CAMEL_CIPHER_HASH_DEFAULT)
- return NULL;
-
- switch (ctx->priv->type) {
- case CAMEL_PGP_TYPE_GPG:
- switch (hash) {
- case CAMEL_CIPHER_HASH_MD2:
- return "MD2";
- case CAMEL_CIPHER_HASH_MD5:
- return "MD5";
- case CAMEL_CIPHER_HASH_SHA1:
- return "SHA1";
- case CAMEL_CIPHER_HASH_RIPEMD160:
- return "RIPEMD160";
- default:
- g_assert_not_reached ();
- }
- break;
- case CAMEL_PGP_TYPE_PGP2:
- /* FIXME: find a way to specify a hash algorithm for pgp2 */
- return NULL;
- case CAMEL_PGP_TYPE_PGP5:
- case CAMEL_PGP_TYPE_PGP6:
- switch (hash) {
- case CAMEL_CIPHER_HASH_MD2:
- return "+hashnum=5";
- case CAMEL_CIPHER_HASH_MD5:
- return "+hashnum=1";
- case CAMEL_CIPHER_HASH_SHA1:
- return "+hashnum=2";
- case CAMEL_CIPHER_HASH_RIPEMD160:
- return "+hashnum=3";
- default:
- g_assert_not_reached ();
- }
- break;
- default:
- g_assert_not_reached ();
- break;
- }
-
- return NULL;
-}
-
static int
pgp_sign (CamelCipherContext *ctx, const char *userid, CamelCipherHash hash,
CamelStream *istream, CamelStream *ostream, CamelException *ex)
@@ -637,7 +590,20 @@ pgp_sign (CamelCipherContext *ctx, const char *userid, CamelCipherHash hash,
goto exception;
}
- hash_str = hash_string (context, hash);
+ switch (hash) {
+ case CAMEL_CIPHER_HASH_DEFAULT:
+ hash_str = NULL;
+ break;
+ case CAMEL_CIPHER_HASH_MD5:
+ hash_str = "MD5";
+ break;
+ case CAMEL_CIPHER_HASH_SHA1:
+ hash_str = "SHA1";
+ break;
+ default:
+ g_assert_not_reached ();
+ break;
+ }
i = 0;
switch (context->priv->type) {
@@ -660,7 +626,6 @@ pgp_sign (CamelCipherContext *ctx, const char *userid, CamelCipherHash hash,
argv[i++] = "--no-secmem-warning";
argv[i++] = "--no-greeting";
argv[i++] = "--yes";
- argv[i++] = "--always-trust";
argv[i++] = "--batch";
argv[i++] = "--armor";
@@ -673,44 +638,38 @@ pgp_sign (CamelCipherContext *ctx, const char *userid, CamelCipherHash hash,
argv[i++] = passwd_fd;
break;
case CAMEL_PGP_TYPE_PGP5:
+ /* FIXME: respect hash */
argv[i++] = "pgps";
- if (hash_str)
- argv[i++] = hash_str;
-
if (userid) {
argv[i++] = "-u";
argv[i++] = (char *) userid;
}
- argv[i++] = "-b"; /* -b means break off (detach) the signature */
- argv[i++] = "-f"; /* -f means act as a unix-style filter */
- argv[i++] = "-v"; /* -v means verbose diagnostic messages */
- argv[i++] = "-z"; /* FIXME: do we want this option!? */
- argv[i++] = "-a"; /* -a means ascii armor */
- argv[i++] = "-o"; /* -o specifies an output stream */
- argv[i++] = "-"; /* ...in this case, stdout */
+ argv[i++] = "-b";
+ argv[i++] = "-f";
+ argv[i++] = "-z";
+ argv[i++] = "-a";
+ argv[i++] = "-o";
+ argv[i++] = "-"; /* output to stdout */
sprintf (passwd_fd, "PGPPASSFD=%d", passwd_fds[0]);
putenv (passwd_fd);
break;
case CAMEL_PGP_TYPE_PGP2:
case CAMEL_PGP_TYPE_PGP6:
+ /* FIXME: respect hash */
argv[i++] = "pgp";
- if (hash_str)
- argv[i++] = hash_str;
-
if (userid) {
argv[i++] = "-u";
argv[i++] = (char *) userid;
}
- argv[i++] = "-f"; /* -f means act as a unix-style filter */
- argv[i++] = "-l"; /* -l means show longer more descriptive diagnostic messages */
- argv[i++] = "-a"; /* -a means ascii armor */
- argv[i++] = "-o"; /* -o specifies an output stream */
- argv[i++] = "-"; /* ...in this case, stdout */
+ argv[i++] = "-f";
+ argv[i++] = "-a";
+ argv[i++] = "-o";
+ argv[i++] = "-";
argv[i++] = "-sb"; /* create a detached signature */
sprintf (passwd_fd, "PGPPASSFD=%d", passwd_fds[0]);
@@ -768,7 +727,7 @@ pgp_clearsign (CamelCipherContext *ctx, const char *userid, CamelCipherHash hash
CamelPgpContext *context = CAMEL_PGP_CONTEXT (ctx);
GByteArray *plaintext;
CamelStream *stream;
- char *argv[20];
+ char *argv[15];
char *ciphertext = NULL;
char *diagnostics = NULL;
char *passphrase = NULL;
@@ -811,7 +770,20 @@ pgp_clearsign (CamelCipherContext *ctx, const char *userid, CamelCipherHash hash
goto exception;
}
- hash_str = hash_string (context, hash);
+ switch (hash) {
+ case CAMEL_CIPHER_HASH_DEFAULT:
+ hash_str = NULL;
+ break;
+ case CAMEL_CIPHER_HASH_MD5:
+ hash_str = "MD5";
+ break;
+ case CAMEL_CIPHER_HASH_SHA1:
+ hash_str = "SHA1";
+ break;
+ default:
+ g_assert_not_reached ();
+ break;
+ }
i = 0;
switch (context->priv->type) {
@@ -834,7 +806,6 @@ pgp_clearsign (CamelCipherContext *ctx, const char *userid, CamelCipherHash hash
argv[i++] = "--no-secmem-warning";
argv[i++] = "--no-greeting";
argv[i++] = "--yes";
- argv[i++] = "--always-trust";
argv[i++] = "--batch";
argv[i++] = "--armor";
@@ -847,43 +818,37 @@ pgp_clearsign (CamelCipherContext *ctx, const char *userid, CamelCipherHash hash
argv[i++] = passwd_fd;
break;
case CAMEL_PGP_TYPE_PGP5:
+ /* FIXME: modify to respect hash */
argv[i++] = "pgps";
- if (hash_str)
- argv[i++] = hash_str;
-
if (userid) {
argv[i++] = "-u";
argv[i++] = (char *) userid;
}
- argv[i++] = "-f"; /* -f means act as a unix-style filter */
- argv[i++] = "-v"; /* -v means verbose diagnostic messages */
- argv[i++] = "-z"; /* FIXME: do we want this option!? */
- argv[i++] = "-a"; /* -a means ascii armor */
- argv[i++] = "-o"; /* -o specifies an output stream */
- argv[i++] = "-"; /* ...in this case, stdout */
+ argv[i++] = "-f";
+ argv[i++] = "-z";
+ argv[i++] = "-a";
+ argv[i++] = "-o";
+ argv[i++] = "-"; /* output to stdout */
sprintf (passwd_fd, "PGPPASSFD=%d", passwd_fds[0]);
putenv (passwd_fd);
break;
case CAMEL_PGP_TYPE_PGP2:
case CAMEL_PGP_TYPE_PGP6:
+ /* FIXME: modify to respect hash */
argv[i++] = "pgp";
- if (hash_str)
- argv[i++] = hash_str;
-
if (userid) {
argv[i++] = "-u";
argv[i++] = (char *) userid;
}
- argv[i++] = "-f"; /* -f means act as a unix-style filter */
- argv[i++] = "-l"; /* -l means show longer more descriptive diagnostic messages */
- argv[i++] = "-a"; /* -a means ascii armor */
- argv[i++] = "-o"; /* -o specifies an output stream */
- argv[i++] = "-"; /* ...in this case, stdout */
+ argv[i++] = "-f";
+ argv[i++] = "-a";
+ argv[i++] = "-o";
+ argv[i++] = "-";
argv[i++] = "-st";
sprintf (passwd_fd, "PGPPASSFD=%d", passwd_fds[0]);
@@ -1216,7 +1181,6 @@ pgp_encrypt (CamelCipherContext *ctx, gboolean sign, const char *userid, GPtrArr
g_ptr_array_add (argv, "--no-secmem-warning");
g_ptr_array_add (argv, "--no-greeting");
g_ptr_array_add (argv, "--yes");
- g_ptr_array_add (argv, "--always-trust");
g_ptr_array_add (argv, "--batch");
g_ptr_array_add (argv, "--armor");
@@ -1416,7 +1380,6 @@ pgp_decrypt (CamelCipherContext *ctx, CamelStream *istream,
break;
case CAMEL_PGP_TYPE_PGP5:
argv[i++] = "pgpv";
-
argv[i++] = "-f";
argv[i++] = "+batchmode=1";
@@ -1426,7 +1389,6 @@ pgp_decrypt (CamelCipherContext *ctx, CamelStream *istream,
case CAMEL_PGP_TYPE_PGP2:
case CAMEL_PGP_TYPE_PGP6:
argv[i++] = "pgp";
-
argv[i++] = "-f";
sprintf (passwd_fd, "PGPPASSFD=%d", passwd_fds[0]);
diff --git a/camel/camel-pgp-mime.c b/camel/camel-pgp-mime.c
index 47458803a5..f90e67f8d0 100644
--- a/camel/camel-pgp-mime.c
+++ b/camel/camel-pgp-mime.c
@@ -30,7 +30,6 @@
#include "camel-mime-filter-from.h"
#include "camel-mime-filter-crlf.h"
#include "camel-mime-filter-charset.h"
-#include "camel-mime-filter-chomp.h"
#include "camel-stream-filter.h"
#include "camel-stream-mem.h"
#include "camel-stream-fs.h"
@@ -43,7 +42,7 @@
#define d(x) x
-/** rfc2015/rfc3156 stuff (aka PGP/MIME) *******************************/
+/** rfc2015 stuff (aka PGP/MIME) *******************************/
gboolean
camel_pgp_mime_is_rfc2015_signed (CamelMimePart *mime_part)
@@ -236,10 +235,10 @@ camel_pgp_mime_part_sign (CamelPgpContext *context, CamelMimePart **mime_part, c
CamelMultipart *multipart;
CamelContentType *mime_type;
CamelStreamFilter *filtered_stream;
- CamelMimeFilter *crlf_filter, *from_filter, *chomp_filter;
+ CamelMimeFilter *crlf_filter, *from_filter;
CamelStream *stream, *sigstream;
+ gchar *hash_type = NULL;
GSList *encodings = NULL;
- char *hash_type = NULL;
g_return_if_fail (*mime_part != NULL);
g_return_if_fail (CAMEL_IS_MIME_PART (*mime_part));
@@ -252,51 +251,30 @@ camel_pgp_mime_part_sign (CamelPgpContext *context, CamelMimePart **mime_part, c
/* get the cleartext */
stream = camel_stream_mem_new ();
- filtered_stream = camel_stream_filter_new_with_stream (stream);
-
- /* Note: see rfc3156, section 3 - second note */
- from_filter = CAMEL_MIME_FILTER (camel_mime_filter_from_new ());
- camel_stream_filter_add (filtered_stream, CAMEL_MIME_FILTER (from_filter));
- camel_object_unref (CAMEL_OBJECT (from_filter));
-
- /* Note: see rfc3156, section 5.4 (this is the big thing that changed between rfc2015 and rfc3156) */
- chomp_filter = camel_mime_filter_chomp_new ();
- camel_stream_filter_add (filtered_stream, CAMEL_MIME_FILTER (chomp_filter));
- camel_object_unref (CAMEL_OBJECT (chomp_filter));
-
- /* Note: see rfc2015 or rfc3156, section 5.1 */
crlf_filter = camel_mime_filter_crlf_new (CAMEL_MIME_FILTER_CRLF_ENCODE,
CAMEL_MIME_FILTER_CRLF_MODE_CRLF_ONLY);
+ from_filter = CAMEL_MIME_FILTER (camel_mime_filter_from_new ());
+ filtered_stream = camel_stream_filter_new_with_stream (stream);
camel_stream_filter_add (filtered_stream, CAMEL_MIME_FILTER (crlf_filter));
camel_object_unref (CAMEL_OBJECT (crlf_filter));
-
+ camel_stream_filter_add (filtered_stream, CAMEL_MIME_FILTER (from_filter));
+ camel_object_unref (CAMEL_OBJECT (from_filter));
camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (part), CAMEL_STREAM (filtered_stream));
- camel_stream_flush (CAMEL_STREAM (filtered_stream));
camel_object_unref (CAMEL_OBJECT (filtered_stream));
/* reset the stream */
camel_stream_reset (stream);
- printf ("attempting to sign data:\n----- BEGIN SIGNED PART -----\n%.*s----- END SIGNED PART -----\n",
- CAMEL_STREAM_MEM (stream)->buffer->len, CAMEL_STREAM_MEM (stream)->buffer->data);
-
/* construct the signature stream */
sigstream = camel_stream_mem_new ();
switch (hash) {
- case CAMEL_CIPHER_HASH_MD2:
- /* this is a new addition with rfc3156 */
- hash_type = "pgp-md2";
- break;
case CAMEL_CIPHER_HASH_MD5:
hash_type = "pgp-md5";
break;
case CAMEL_CIPHER_HASH_SHA1:
hash_type = "pgp-sha1";
break;
- case CAMEL_CIPHER_HASH_RIPEMD160:
- hash_type = "pgp-ripemd160";
- break;
default:
/* set a reasonable default */
hash = CAMEL_CIPHER_HASH_SHA1;
@@ -372,9 +350,10 @@ camel_pgp_mime_part_verify (CamelPgpContext *context, CamelMimePart *mime_part,
CamelMultipart *multipart;
CamelMimePart *part, *sigpart;
CamelStreamFilter *filtered_stream;
- CamelMimeFilter *crlf_filter, *chomp_filter;
+ CamelMimeFilter *crlf_filter, *from_filter;
CamelStream *stream, *sigstream;
CamelCipherValidity *valid;
+ CamelContentType *type;
g_return_val_if_fail (mime_part != NULL, NULL);
g_return_val_if_fail (CAMEL_IS_MIME_PART (mime_part), NULL);
@@ -388,22 +367,40 @@ camel_pgp_mime_part_verify (CamelPgpContext *context, CamelMimePart *mime_part,
/* get the plain part */
part = camel_multipart_get_part (multipart, 0);
stream = camel_stream_mem_new ();
- filtered_stream = camel_stream_filter_new_with_stream (stream);
-
- /* Note: see rfc3156, section 5.4 (this is the big thing that changed between rfc2015 and rfc3156) */
- chomp_filter = camel_mime_filter_chomp_new ();
- camel_stream_filter_add (filtered_stream, CAMEL_MIME_FILTER (chomp_filter));
- camel_object_unref (CAMEL_OBJECT (chomp_filter));
-
- /* Note: see rfc2015 or rfc3156, section 5.1 */
crlf_filter = camel_mime_filter_crlf_new (CAMEL_MIME_FILTER_CRLF_ENCODE,
CAMEL_MIME_FILTER_CRLF_MODE_CRLF_ONLY);
+ from_filter = CAMEL_MIME_FILTER (camel_mime_filter_from_new ());
+ filtered_stream = camel_stream_filter_new_with_stream (stream);
camel_stream_filter_add (filtered_stream, CAMEL_MIME_FILTER (crlf_filter));
camel_object_unref (CAMEL_OBJECT (crlf_filter));
+ camel_stream_filter_add (filtered_stream, CAMEL_MIME_FILTER (from_filter));
+ camel_object_unref (CAMEL_OBJECT (from_filter));
- wrapper = CAMEL_DATA_WRAPPER (part);
+ type = camel_mime_part_get_content_type (mime_part);
+ if (header_content_type_param (type, "x-inline-pgp-hack")) {
+ /* this is a kludge around inline pgp signatures - basically,
+ the multipart/signed is faked - the original part (aka part #1)
+ is the original mime part and the signature is a copy of the
+ signature in part #1 */
+ CamelMimeFilterCharset *charset_filter;
+ CamelContentType *content_type;
+ const char *charset;
+
+ content_type = camel_mime_part_get_content_type (part);
+ charset = header_content_type_param (content_type, "charset");
+ if (charset) {
+ charset_filter = camel_mime_filter_charset_new_convert ("utf-8", charset);
+ if (charset_filter) {
+ camel_stream_filter_add (filtered_stream,
+ CAMEL_MIME_FILTER (charset_filter));
+ camel_object_unref (CAMEL_OBJECT (charset_filter));
+ }
+ }
+
+ wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (part));
+ } else
+ wrapper = CAMEL_DATA_WRAPPER (part);
camel_data_wrapper_write_to_stream (wrapper, CAMEL_STREAM (filtered_stream));
- camel_stream_flush (CAMEL_STREAM (filtered_stream));
camel_object_unref (CAMEL_OBJECT (filtered_stream));
camel_stream_reset (stream);
@@ -417,9 +414,6 @@ camel_pgp_mime_part_verify (CamelPgpContext *context, CamelMimePart *mime_part,
/* verify */
valid = camel_pgp_verify (context, stream, sigstream, ex);
- printf ("attempted to verify data:\n----- BEGIN SIGNED PART -----\n%.*s----- END SIGNED PART -----\n",
- CAMEL_STREAM_MEM (stream)->buffer->len, CAMEL_STREAM_MEM (stream)->buffer->data);
-
camel_object_unref (CAMEL_OBJECT (sigstream));
camel_object_unref (CAMEL_OBJECT (stream));
@@ -488,6 +482,7 @@ camel_pgp_mime_part_encrypt (CamelPgpContext *context, CamelMimePart **mime_part
camel_mime_part_set_content (encrypted_part, CAMEL_STREAM_MEM (ciphertext)->buffer->data,
CAMEL_STREAM_MEM (ciphertext)->buffer->len,
"application/octet-stream; name=encrypted.asc");
+ camel_mime_part_set_description (encrypted_part, _("This is an encrypted message part"));
camel_object_unref (CAMEL_OBJECT (ciphertext));
camel_mime_part_set_encoding (encrypted_part, CAMEL_MIME_PART_ENCODING_7BIT);
@@ -567,6 +562,27 @@ camel_pgp_mime_part_decrypt (CamelPgpContext *context, CamelMimePart *mime_part,
camel_object_unref (CAMEL_OBJECT (ciphertext));
camel_stream_reset (stream);
+ mime_type = camel_mime_part_get_content_type (mime_part);
+ if (header_content_type_param (mime_type, "x-inline-pgp-hack")) {
+ /* this is a kludge around inline pgp encryption - basically,
+ the multipart/encrypted is fake - the original encrypted
+ content is not really an encrypted mime part so after
+ decrypting it, we have to fake some mime content headers */
+ CamelStream *hack;
+
+ hack = camel_stream_mem_new ();
+
+#define CONTENT_TYPE_TEXT_PLAIN "Content-Type: text/plain\r\n\r\n"
+ camel_stream_write (hack, CONTENT_TYPE_TEXT_PLAIN,
+ sizeof (CONTENT_TYPE_TEXT_PLAIN) - 1);
+
+ camel_stream_write_to_stream (stream, hack);
+ camel_stream_reset (hack);
+
+ camel_object_unref (CAMEL_OBJECT (stream));
+ stream = hack;
+ }
+
/* construct the new decrypted mime part from the stream */
part = camel_mime_part_new ();
diff --git a/camel/camel-private.h b/camel/camel-private.h
index 81cf2a4dad..6a95c4e04d 100644
--- a/camel/camel-private.h
+++ b/camel/camel-private.h
@@ -61,8 +61,6 @@ struct _CamelStorePrivate {
#ifdef ENABLE_THREADS
EMutex *folder_lock; /* for locking folder operations */
EMutex *cache_lock; /* for locking access to the cache */
-#else
- gpointer dummy;
#endif
};
@@ -77,8 +75,6 @@ struct _CamelStorePrivate {
struct _CamelTransportPrivate {
#ifdef ENABLE_THREADS
GMutex *send_lock; /* for locking send operations */
-#else
- gpointer dummy;
#endif
};
@@ -94,8 +90,6 @@ struct _CamelServicePrivate {
#ifdef ENABLE_THREADS
EMutex *connect_lock; /* for locking connection operations */
EMutex *connect_op_lock;/* for locking the connection_op */
-#else
- gpointer dummy;
#endif
};
@@ -115,8 +109,6 @@ struct _CamelSessionPrivate {
int thread_id;
GHashTable *thread_active;
EThread *thread_queue;
-#else
- gpointer dummy;
#endif
};
@@ -132,8 +124,6 @@ struct _CamelSessionPrivate {
struct _CamelRemoteStorePrivate {
#ifdef ENABLE_THREADS
EMutex *stream_lock; /* for locking stream operations */
-#else
- gpointer dummy;
#endif
};
@@ -152,13 +142,10 @@ struct _CamelFolderSummaryPrivate {
struct _CamelMimeFilterIndex *filter_index;
struct _CamelMimeFilterBasic *filter_64;
struct _CamelMimeFilterBasic *filter_qp;
- struct _CamelMimeFilterBasic *filter_uu;
struct _CamelMimeFilterSave *filter_save;
struct _CamelMimeFilterHTML *filter_html;
- struct _CamelStreamFilter *filter_stream;
-
- struct _CamelIndex *index;
+ struct ibex *index;
#ifdef ENABLE_THREADS
GMutex *summary_lock; /* for the summary hashtable/array */
@@ -177,25 +164,6 @@ struct _CamelFolderSummaryPrivate {
#define CAMEL_SUMMARY_UNLOCK(f, l)
#endif
-struct _CamelStoreSummaryPrivate {
-#ifdef ENABLE_THREADS
- GMutex *summary_lock; /* for the summary hashtable/array */
- GMutex *io_lock; /* load/save lock, for access to saved_count, etc */
- GMutex *alloc_lock; /* for setting up and using allocators */
- GMutex *ref_lock; /* for reffing/unreffing messageinfo's ALWAYS obtain before summary_lock */
-#else
- gpointer dummy;
-#endif
-};
-
-#ifdef ENABLE_THREADS
-#define CAMEL_STORE_SUMMARY_LOCK(f, l) (g_mutex_lock(((CamelStoreSummary *)f)->priv->l))
-#define CAMEL_STORE_SUMMARY_UNLOCK(f, l) (g_mutex_unlock(((CamelStoreSummary *)f)->priv->l))
-#else
-#define CAMEL_STORE_SUMMARY_LOCK(f, l)
-#define CAMEL_STORE_SUMMARY_UNLOCK(f, l)
-#endif
-
struct _CamelVeeFolderPrivate {
GList *folders; /* lock using subfolder_lock before changing/accessing */
GList *folders_changed; /* for list of folders that have changed between updates */
diff --git a/camel/camel-service.c b/camel/camel-service.c
index 502da90c5a..f2322c95c3 100644
--- a/camel/camel-service.c
+++ b/camel/camel-service.c
@@ -260,10 +260,10 @@ camel_service_connect (CamelService *service, CamelException *ex)
service->status = ret ? CAMEL_SERVICE_CONNECTED : CAMEL_SERVICE_DISCONNECTED;
CAMEL_SERVICE_LOCK (service, connect_op_lock);
+ /* its impossible this is null from this code, but we check anyway */
if (service->connect_op) {
if (unreg)
camel_operation_unregister (service->connect_op);
-
camel_operation_unref (service->connect_op);
service->connect_op = NULL;
}
@@ -554,7 +554,7 @@ camel_service_gethost (CamelService *service, CamelException *ex)
else
hostname = "localhost";
- return camel_gethostbyname (hostname, ex);
+ return camel_get_host_byname(hostname, ex);
}
#ifdef offsetof
@@ -568,8 +568,6 @@ struct _lookup_msg {
EMsg msg;
#endif
const char *name;
- int len;
- int type;
int result;
int herr;
struct hostent hostbuf;
@@ -578,7 +576,7 @@ struct _lookup_msg {
};
static void *
-get_hostbyname(void *data)
+get_host(void *data)
{
struct _lookup_msg *info = data;
@@ -599,8 +597,7 @@ get_hostbyname(void *data)
return NULL;
}
-struct hostent *
-camel_gethostbyname(const char *name, CamelException *ex)
+struct hostent *camel_get_host_byname(const char *name, CamelException *ex)
{
#ifdef ENABLE_THREADS
int fdmax, fd, cancel_fd;
@@ -625,7 +622,7 @@ camel_gethostbyname(const char *name, CamelException *ex)
cancel_fd = camel_operation_cancel_fd(NULL);
if (cancel_fd == -1) {
#endif
- get_hostbyname(msg);
+ get_host(msg);
#ifdef ENABLE_THREADS
} else {
EMsgPort *reply_port;
@@ -634,7 +631,7 @@ camel_gethostbyname(const char *name, CamelException *ex)
reply_port = msg->msg.reply_port = e_msgport_new();
fd = e_msgport_fd(msg->msg.reply_port);
- if (pthread_create(&id, NULL, get_hostbyname, msg) == 0) {
+ if (pthread_create(&id, NULL, get_host, msg) == 0) {
FD_ZERO(&rdset);
FD_SET(cancel_fd, &rdset);
FD_SET(fd, &rdset);
@@ -678,118 +675,6 @@ camel_gethostbyname(const char *name, CamelException *ex)
}
}
-
-static void *
-get_hostbyaddr (void *data)
-{
- struct _lookup_msg *info = data;
-
- while ((info->result = e_gethostbyaddr_r (info->name, info->len, info->type, &info->hostbuf,
- info->hostbufmem, info->hostbuflen, &info->herr)) == ERANGE) {
- d(printf ("gethostbyaddr fialed?\n"));
-#ifdef ENABLE_THREADS
- pthread_testcancel ();
-#endif
- info->hostbuflen *= 2;
- info->hostbufmem = g_realloc (info->hostbufmem, info->hostbuflen);
- }
-
- d(printf ("gethostbyaddr ok?\n"));
-
-#ifdef ENABLE_THREADS
- e_msgport_reply ((EMsg *) info);
-#endif
- return NULL;
-}
-
-
-struct hostent *
-camel_gethostbyaddr (const char *addr, int len, int type, CamelException *ex)
-{
-#ifdef ENABLE_THREADS
- int fdmax, fd, cancel_fd;
-#endif
- struct _lookup_msg *msg;
-
- g_return_val_if_fail (addr != NULL, NULL);
-
- if (camel_operation_cancel_check (NULL)) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_USER_CANCEL, _("Cancelled"));
- return NULL;
- }
-
- camel_operation_start_transient (NULL, _("Resolving address"));
-
- msg = g_malloc0 (sizeof (struct _lookup_msg));
- msg->hostbuflen = 1024;
- msg->hostbufmem = g_malloc (msg->hostbuflen);
- msg->name = addr;
- msg->len = len;
- msg->type = type;
-
-#ifdef ENABLE_THREADS
- cancel_fd = camel_operation_cancel_fd (NULL);
- if (cancel_fd == -1) {
-#endif
- get_hostbyaddr (msg);
-#ifdef ENABLE_THREADS
- } else {
- EMsgPort *reply_port;
- pthread_t id;
- fd_set rdset;
-
- reply_port = msg->msg.reply_port = e_msgport_new ();
- fd = e_msgport_fd (msg->msg.reply_port);
- if (pthread_create (&id, NULL, get_hostbyaddr, msg) == 0) {
- FD_ZERO(&rdset);
- FD_SET(cancel_fd, &rdset);
- FD_SET(fd, &rdset);
- fdmax = MAX(fd, cancel_fd) + 1;
- d(printf("waiting for name return/cancellation in main process\n"));
- if (select (fdmax, &rdset, NULL, 0, NULL) == -1) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Failure in name lookup: %s"), g_strerror (errno));
- d(printf ("Cancelling lookup thread\n"));
- pthread_cancel (id);
- } else if (FD_ISSET(cancel_fd, &rdset)) {
- d(printf ("Cancelling lookup thread\n"));
- camel_exception_setv (ex, CAMEL_EXCEPTION_USER_CANCEL, _("Cancelled"));
- pthread_cancel (id);
- } else {
- struct _lookup_msg *reply = (struct _lookup_msg *) e_msgport_get (reply_port);
-
- g_assert (reply == msg);
- }
-
- d(printf ("waiting for child to exit\n"));
- pthread_join (id, NULL);
- d(printf ("child done\n"));
- }
-
- e_msgport_destroy (reply_port);
- }
-#endif
-
- camel_operation_end (NULL);
-
- if (msg->herr) {
- if (!camel_exception_is_set (ex)) {
- if (msg->herr == HOST_NOT_FOUND || msg->herr == NO_DATA)
- camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Host lookup failed: host not found"));
- else
- camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Host lookup failed: unknown reason"));
- }
-
- g_free (msg->hostbufmem);
- g_free (msg);
- return NULL;
- } else {
- return &msg->hostbuf;
- }
-}
-
void camel_free_host(struct hostent *h)
{
struct _lookup_msg *msg;
diff --git a/camel/camel-store.c b/camel/camel-store.c
index d230ef3777..52e89fbbbf 100644
--- a/camel/camel-store.c
+++ b/camel/camel-store.c
@@ -27,8 +27,6 @@
#include <config.h>
#endif
-#include <sys/stat.h>
-#include <sys/types.h>
#include <string.h>
#include "camel-session.h"
diff --git a/camel/camel-tcp-stream-raw.c b/camel/camel-tcp-stream-raw.c
index d8aef35079..e7003ac53d 100644
--- a/camel/camel-tcp-stream-raw.c
+++ b/camel/camel-tcp-stream-raw.c
@@ -48,8 +48,7 @@ static int stream_close (CamelStream *stream);
static int stream_connect (CamelTcpStream *stream, struct hostent *host, int port);
static int stream_getsockopt (CamelTcpStream *stream, CamelSockOptData *data);
static int stream_setsockopt (CamelTcpStream *stream, const CamelSockOptData *data);
-static CamelTcpAddress *stream_get_local_address (CamelTcpStream *stream);
-static CamelTcpAddress *stream_get_remote_address (CamelTcpStream *stream);
+static gpointer stream_get_socket (CamelTcpStream *stream);
static void
camel_tcp_stream_raw_class_init (CamelTcpStreamRawClass *camel_tcp_stream_raw_class)
@@ -69,9 +68,8 @@ camel_tcp_stream_raw_class_init (CamelTcpStreamRawClass *camel_tcp_stream_raw_cl
camel_tcp_stream_class->connect = stream_connect;
camel_tcp_stream_class->getsockopt = stream_getsockopt;
- camel_tcp_stream_class->setsockopt = stream_setsockopt;
- camel_tcp_stream_class->get_local_address = stream_get_local_address;
- camel_tcp_stream_class->get_remote_address = stream_get_remote_address;
+ camel_tcp_stream_class->setsockopt = stream_setsockopt;
+ camel_tcp_stream_class->get_socket = stream_get_socket;
}
static void
@@ -567,30 +565,8 @@ stream_setsockopt (CamelTcpStream *stream, const CamelSockOptData *data)
sizeof (data->value));
}
-static CamelTcpAddress *
-stream_get_local_address (CamelTcpStream *stream)
+static gpointer
+stream_get_socket (CamelTcpStream *stream)
{
- struct sockaddr_in sin;
- socklen_t len;
-
- if (getsockname (CAMEL_TCP_STREAM_RAW (stream)->sockfd,
- (struct sockaddr *) &sin, &len) == -1)
- return NULL;
-
- return camel_tcp_address_new (CAMEL_TCP_ADDRESS_IPV4, sin.sin_port,
- 4, &sin.sin_addr);
-}
-
-static CamelTcpAddress *
-stream_get_remote_address (CamelTcpStream *stream)
-{
- struct sockaddr_in sin;
- socklen_t len;
-
- if (getpeername (CAMEL_TCP_STREAM_RAW (stream)->sockfd,
- (struct sockaddr *) &sin, &len) == -1)
- return NULL;
-
- return camel_tcp_address_new (CAMEL_TCP_ADDRESS_IPV4, sin.sin_port,
- 4, &sin.sin_addr);
+ return GINT_TO_POINTER (CAMEL_TCP_STREAM_RAW (stream)->sockfd);
}
diff --git a/camel/camel-tcp-stream-ssl.c b/camel/camel-tcp-stream-ssl.c
index a06fb93d1c..f5f507617d 100644
--- a/camel/camel-tcp-stream-ssl.c
+++ b/camel/camel-tcp-stream-ssl.c
@@ -20,13 +20,6 @@
*
*/
-/* NOTE: This is the default implementation of CamelTcpStreamSSL,
- * used when the Mozilla NSS libraries are used. If you configured
- * OpenSSL support instead, then this file won't be compiled and
- * the CamelTcpStreamSSL implementation in camel-tcp-stream-openssl.c
- * will be used instead.
- */
-
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
@@ -49,14 +42,9 @@
#include <certdb.h>
#include <pk11func.h>
-/* this is commented because otherwise we get an error about the
- redefinition of MD5Context...yay */
-/*#include <e-util/md5-utils.h>*/
-
#include "camel-tcp-stream-ssl.h"
#include "camel-session.h"
-
static CamelTcpStreamClass *parent_class = NULL;
/* Returns the class for a CamelTcpStreamSSL */
@@ -67,20 +55,16 @@ static ssize_t stream_write (CamelStream *stream, const char *buffer, size_t n);
static int stream_flush (CamelStream *stream);
static int stream_close (CamelStream *stream);
-static PRFileDesc *enable_ssl (CamelTcpStreamSSL *ssl, PRFileDesc *fd);
-
static int stream_connect (CamelTcpStream *stream, struct hostent *host, int port);
static int stream_getsockopt (CamelTcpStream *stream, CamelSockOptData *data);
static int stream_setsockopt (CamelTcpStream *stream, const CamelSockOptData *data);
-static CamelTcpAddress *stream_get_local_address (CamelTcpStream *stream);
-static CamelTcpAddress *stream_get_remote_address (CamelTcpStream *stream);
+static gpointer stream_get_socket (CamelTcpStream *stream);
struct _CamelTcpStreamSSLPrivate {
PRFileDesc *sockfd;
CamelService *service;
char *expected_host;
- gboolean ssl_mode;
};
static void
@@ -102,8 +86,7 @@ camel_tcp_stream_ssl_class_init (CamelTcpStreamSSLClass *camel_tcp_stream_ssl_cl
camel_tcp_stream_class->connect = stream_connect;
camel_tcp_stream_class->getsockopt = stream_getsockopt;
camel_tcp_stream_class->setsockopt = stream_setsockopt;
- camel_tcp_stream_class->get_local_address = stream_get_local_address;
- camel_tcp_stream_class->get_remote_address = stream_get_remote_address;
+ camel_tcp_stream_class->get_socket = stream_get_socket;
}
static void
@@ -147,7 +130,6 @@ camel_tcp_stream_ssl_get_type (void)
return type;
}
-
/**
* camel_tcp_stream_ssl_new:
* @service: camel service
@@ -157,7 +139,7 @@ camel_tcp_stream_ssl_get_type (void)
* user, a CamelService is needed. @expected_host is needed as a
* protection against an MITM attack.
*
- * Return value: a ssl stream (in ssl mode)
+ * Return value: a tcp stream
**/
CamelStream *
camel_tcp_stream_ssl_new (CamelService *service, const char *expected_host)
@@ -168,38 +150,10 @@ camel_tcp_stream_ssl_new (CamelService *service, const char *expected_host)
stream->priv->service = service;
stream->priv->expected_host = g_strdup (expected_host);
- stream->priv->ssl_mode = TRUE;
return CAMEL_STREAM (stream);
}
-
-/**
- * camel_tcp_stream_ssl_new_raw:
- * @service: camel service
- * @expected_host: host that the stream is expected to connect with.
- *
- * Since the SSL certificate authenticator may need to prompt the
- * user, a CamelService is needed. @expected_host is needed as a
- * protection against an MITM attack.
- *
- * Return value: a ssl-capable stream (in non ssl mode)
- **/
-CamelStream *
-camel_tcp_stream_ssl_new_raw (CamelService *service, const char *expected_host)
-{
- CamelTcpStreamSSL *stream;
-
- stream = CAMEL_TCP_STREAM_SSL (camel_object_new (camel_tcp_stream_ssl_get_type ()));
-
- stream->priv->service = service;
- stream->priv->expected_host = g_strdup (expected_host);
- stream->priv->ssl_mode = FALSE;
-
- return CAMEL_STREAM (stream);
-}
-
-
static void
set_errno (int code)
{
@@ -246,45 +200,6 @@ set_errno (int code)
}
}
-
-/**
- * camel_tcp_stream_ssl_enable_ssl:
- * @ssl: ssl stream
- *
- * Toggles an ssl-capable stream into ssl mode (if it isn't already).
- *
- * Returns 0 on success or -1 on fail.
- **/
-int
-camel_tcp_stream_ssl_enable_ssl (CamelTcpStreamSSL *ssl)
-{
- PRFileDesc *fd;
-
- g_return_val_if_fail (CAMEL_IS_TCP_STREAM_SSL (ssl), -1);
-
- if (ssl->priv->sockfd && !ssl->priv->ssl_mode) {
- fd = enable_ssl (ssl, NULL);
- if (fd == NULL) {
- int errnosave;
-
- set_errno (PR_GetError ());
- errnosave = errno;
- errno = errnosave;
-
- return -1;
- }
-
- SSL_ResetHandshake (fd, FALSE);
-
- ssl->priv->sockfd = fd;
- }
-
- ssl->priv->ssl_mode = TRUE;
-
- return 0;
-}
-
-
static ssize_t
stream_read (CamelStream *stream, char *buffer, size_t n)
{
@@ -362,8 +277,8 @@ ssl_get_client_auth (void *data, PRFileDesc *sockfd,
proto_win = SSL_RevealPinArg (sockfd);
- if ((char *) data) {
- cert = PK11_FindCertFromNickname ((char *) data, proto_win);
+ if ((char *)data) {
+ cert = PK11_FindCertFromNickname ((char *)data, proto_win);
if (cert) {
privKey = PK11_FindKeyByAnyCert (cert, proto_win);
if (privkey) {
@@ -383,6 +298,7 @@ ssl_get_client_auth (void *data, PRFileDesc *sockfd,
if (names != NULL) {
for (i = 0; i < names->numnicknames; i++) {
+
cert = PK11_FindCertFromNickname (names->nicknames[i],
proto_win);
if (!cert)
@@ -453,22 +369,67 @@ ssl_auth_cert (void *data, PRFileDesc *sockfd, PRBool checksig, PRBool is_server
}
if (host)
- PR_Free (host);
+ PR_Free (hostName);
return secStatus;
}
#endif
+static void
+save_ssl_cert (const char *certid)
+{
+ char *path, *filename;
+ struct stat st;
+ int fd;
+
+ path = g_strdup_printf ("%s/.camel_certs", getenv ("HOME"));
+ if (mkdir (path, 0700) == -1) {
+ if (errno != EEXIST)
+ return;
+
+ if (stat (path, &st) == -1)
+ return;
+
+ if (!S_ISDIR (st.st_mode))
+ return;
+ }
+
+ filename = g_strdup_printf ("%s/%s", path, certid);
+ g_free (path);
+
+ fd = open (filename, O_WRONLY | O_CREAT, 0600);
+ if (fd != -1)
+ close (fd);
+
+ g_free (filename);
+}
+
+static gboolean
+ssl_cert_is_saved (const char *certid)
+{
+ char *filename;
+ struct stat st;
+
+ filename = g_strdup_printf ("%s/.camel_certs/%s", getenv ("HOME"), certid);
+
+ if (stat (filename, &st) == -1) {
+ g_free (filename);
+ return FALSE;
+ }
+
+ g_free (filename);
+
+ return st.st_uid == getuid ();
+}
+
static SECStatus
ssl_bad_cert (void *data, PRFileDesc *sockfd)
{
- unsigned char md5sum[16], fingerprint[40], *f;
- gboolean accept, valid_cert;
- char *prompt, *cert_str;
CamelTcpStreamSSL *ssl;
CERTCertificate *cert;
CamelService *service;
- int i;
+ char *prompt, *cert_str;
+ gboolean accept;
g_return_val_if_fail (data != NULL, SECFailure);
g_return_val_if_fail (CAMEL_IS_TCP_STREAM_SSL (data), SECFailure);
@@ -476,28 +437,29 @@ ssl_bad_cert (void *data, PRFileDesc *sockfd)
ssl = CAMEL_TCP_STREAM_SSL (data);
service = ssl->priv->service;
- cert = SSL_PeerCertificate (sockfd);
-
- /* calculate the MD5 hash of the raw certificate */
- md5_get_digest (cert->derCert.data, cert->derCert.len, md5sum);
- /*HASH_HashBuf (HASH_AlgMD5, md5sum, cert->derCert.data, cert->derCert.len);*/
- for (i = 0, f = fingerprint; i < 16; i++, f += 3)
- sprintf (f, "%.2x%c", md5sum[i], i != 15 ? ':' : '\0');
+ /* this is part of a work-around hack */
+ if (ssl_cert_is_saved (ssl->priv->expected_host))
+ return SECSuccess;
- valid_cert = CERT_VerifyCertNow (CERT_GetDefaultCertDB (), cert, TRUE, certUsageSSLClient, NULL);
- /*issuer = CERT_FindCertByName (CERT_GetDefaultCertDB (), &cert->derIssuer);
- valid_cert = issuer && CERT_VerifySignedData (&cert->signatureWrap, issuer, PR_Now (), NULL);*/
+ cert = SSL_PeerCertificate (sockfd);
- cert_str = g_strdup_printf (_("Issuer: %s\n"
- "Subject: %s\n"
- "Fingerprint: %s\n"
- "Signature: %s"),
- CERT_NameToAscii (&cert->issuer),
- CERT_NameToAscii (&cert->subject),
- fingerprint, valid_cert ? _("GOOD") : _("BAD"));
+ cert_str = g_strdup_printf (_("EMail: %s\n"
+ "Common Name: %s\n"
+ "Organization Unit: %s\n"
+ "Organization: %s\n"
+ "Locality: %s\n"
+ "State: %s\n"
+ "Country: %s"),
+ cert->emailAddr ? cert->emailAddr : "",
+ CERT_GetCommonName (&cert->issuer) ? CERT_GetCommonName (&cert->issuer) : "",
+ CERT_GetOrgUnitName (&cert->issuer) ? CERT_GetOrgUnitName (&cert->issuer) : "",
+ CERT_GetOrgName (&cert->issuer) ? CERT_GetOrgName (&cert->issuer) : "",
+ CERT_GetLocalityName (&cert->issuer) ? CERT_GetLocalityName (&cert->issuer) : "",
+ CERT_GetStateName (&cert->issuer) ? CERT_GetStateName (&cert->issuer) : "",
+ CERT_GetCountryName (&cert->issuer) ? CERT_GetCountryName (&cert->issuer) : "");
/* construct our user prompt */
- prompt = g_strdup_printf (_("SSL Certificate check for %s:\n\n%s\n\nDo you wish to accept?"),
+ prompt = g_strdup_printf (_("Bad certificate from %s:\n\n%s\n\nDo you wish to accept anyway?"),
service->url->host, cert_str);
g_free (cert_str);
@@ -506,17 +468,6 @@ ssl_bad_cert (void *data, PRFileDesc *sockfd)
g_free (prompt);
if (accept) {
-#if 0
- /* this is how mutt does it but last time I tried to
- use CERT_AddTempCertToPerm() I got link errors and
- I have also been told by the nss devs that that
- function has been deprecated... */
- CERTCertTrust trust;
-
- CERT_DecodeTrustString (&trust, "P,,");
-
- CERT_AddTempCertToPerm (cert, NULL, &trust);
-#else
SECItem *certs[1];
if (!cert->trust)
@@ -528,41 +479,24 @@ ssl_bad_cert (void *data, PRFileDesc *sockfd)
CERT_ImportCerts (CERT_GetDefaultCertDB (), certUsageSSLServer, 1, certs,
NULL, TRUE, FALSE, cert->nickname);
-#endif
+
+ /* and since the above code doesn't seem to
+ work... time for a good ol' fashioned hack */
+ save_ssl_cert (ssl->priv->expected_host);
+
return SECSuccess;
}
return SECFailure;
}
-static PRFileDesc *
-enable_ssl (CamelTcpStreamSSL *ssl, PRFileDesc *fd)
-{
- PRFileDesc *ssl_fd;
-
- ssl_fd = SSL_ImportFD (NULL, fd ? fd : ssl->priv->sockfd);
- if (!ssl_fd)
- return NULL;
-
- SSL_OptionSet (ssl_fd, SSL_SECURITY, PR_TRUE);
- SSL_SetURL (ssl_fd, ssl->priv->expected_host);
-
- /*SSL_GetClientAuthDataHook (sslSocket, ssl_get_client_auth, (void *) certNickname);*/
- /*SSL_AuthCertificateHook (ssl_fd, ssl_auth_cert, (void *) CERT_GetDefaultCertDB ());*/
- SSL_BadCertHook (ssl_fd, ssl_bad_cert, ssl);
-
- ssl->priv->ssl_mode = TRUE;
-
- return ssl_fd;
-}
-
static int
stream_connect (CamelTcpStream *stream, struct hostent *host, int port)
{
CamelTcpStreamSSL *ssl = CAMEL_TCP_STREAM_SSL (stream);
PRIntervalTime timeout = PR_INTERVAL_MIN;
PRNetAddr netaddr;
- PRFileDesc *fd;
+ PRFileDesc *fd, *ssl_fd;
g_return_val_if_fail (host != NULL, -1);
@@ -580,25 +514,16 @@ stream_connect (CamelTcpStream *stream, struct hostent *host, int port)
return -1;
}
- if (ssl->priv->ssl_mode) {
- PRFileDesc *ssl_fd;
-
- ssl_fd = enable_ssl (ssl, fd);
- if (ssl_fd == NULL) {
- int errnosave;
-
- set_errno (PR_GetError ());
- errnosave = errno;
- PR_Close (fd);
- errno = errnosave;
-
- return -1;
- }
-
- fd = ssl_fd;
+ ssl_fd = SSL_ImportFD (NULL, fd);
+ if (ssl_fd == NULL) {
+ set_errno (PR_GetError ());
+ return -1;
}
- if (PR_Connect (fd, &netaddr, timeout) == PR_FAILURE) {
+ SSL_OptionSet (ssl_fd, SSL_SECURITY, PR_TRUE);
+ SSL_SetURL (ssl_fd, ssl->priv->expected_host);
+
+ if (PR_Connect (ssl_fd, &netaddr, timeout) == PR_FAILURE) {
int errnosave;
set_errno (PR_GetError ());
@@ -639,7 +564,11 @@ stream_connect (CamelTcpStream *stream, struct hostent *host, int port)
errno = 0;
}
- ssl->priv->sockfd = fd;
+ /*SSL_GetClientAuthDataHook (sslSocket, ssl_get_client_auth, (void *)certNickname);*/
+ /*SSL_AuthCertificateHook (ssl_fd, ssl_auth_cert, (void *) CERT_GetDefaultCertDB ());*/
+ SSL_BadCertHook (ssl_fd, ssl_bad_cert, ssl);
+
+ ssl->priv->sockfd = ssl_fd;
return 0;
}
@@ -675,32 +604,10 @@ stream_setsockopt (CamelTcpStream *stream, const CamelSockOptData *data)
return 0;
}
-static CamelTcpAddress *
-stream_get_local_address (CamelTcpStream *stream)
+static gpointer
+stream_get_socket (CamelTcpStream *stream)
{
- PRFileDesc *sockfd = CAMEL_TCP_STREAM_SSL (stream)->priv->sockfd;
- PRNetAddr addr;
-
- PR_GetSockName (sockfd, &addr);
- if (addr.inet.family != PR_AF_INET)
- return NULL;
-
- return camel_tcp_address_new (CAMEL_TCP_ADDRESS_IPV4, addr.inet.port,
- 4, &addr.inet.ip);
-}
-
-static CamelTcpAddress *
-stream_get_remote_address (CamelTcpStream *stream)
-{
- PRFileDesc *sockfd = CAMEL_TCP_STREAM_SSL (stream)->priv->sockfd;
- PRNetAddr addr;
-
- PR_GetPeerName (sockfd, &addr);
- if (addr.inet.family != PR_AF_INET)
- return NULL;
-
- return camel_tcp_address_new (CAMEL_TCP_ADDRESS_IPV4, addr.inet.port,
- 4, &addr.inet.ip);
+ return (gpointer) CAMEL_TCP_STREAM_SSL (stream)->priv->sockfd;
}
#endif /* HAVE_NSS */
diff --git a/camel/camel-vee-folder.c b/camel/camel-vee-folder.c
index ab5bcf3c18..c7f7be98f1 100644
--- a/camel/camel-vee-folder.c
+++ b/camel/camel-vee-folder.c
@@ -601,14 +601,10 @@ vee_search_by_expression(CamelFolder *folder, const char *expression, CamelExcep
CamelVeeFolder *vf = (CamelVeeFolder *)folder;
struct _CamelVeeFolderPrivate *p = _PRIVATE(vf);
GHashTable *searched = g_hash_table_new(NULL, NULL);
-
+
CAMEL_VEE_FOLDER_LOCK(vf, subfolder_lock);
-
- if (vf != folder_unmatched)
- expr = g_strdup_printf ("(and %s %s)", vf->expression, expression);
- else
- expr = g_strdup (expression);
-
+
+ expr = g_strdup_printf("(and %s %s)", vf->expression, expression);
node = p->folders;
while (node) {
CamelFolder *f = node->data;
diff --git a/camel/providers/imap/Makefile.am b/camel/providers/imap/Makefile.am
index 9f9d186e46..bf183aa3ce 100644
--- a/camel/providers/imap/Makefile.am
+++ b/camel/providers/imap/Makefile.am
@@ -40,7 +40,7 @@ libcamelimapinclude_HEADERS = \
camel-imap-utils.h \
camel-imap-wrapper.h
-libcamelimap_la_LDFLAGS = -avoid-version -module
+libcamelimap_la_LDFLAGS = -version-info 0:0:0
noinst_HEADERS = \
camel-imap-private.h
diff --git a/camel/providers/imap/camel-imap-command.c b/camel/providers/imap/camel-imap-command.c
index 6a2382b3c8..f6fb0dde8e 100644
--- a/camel/providers/imap/camel-imap-command.c
+++ b/camel/providers/imap/camel-imap-command.c
@@ -267,25 +267,18 @@ camel_imap_command_response (CamelImapStore *store, char **response,
switch (*respbuf) {
case '*':
- if (!g_strncasecmp (respbuf, "* BYE", 5)) {
+ type = CAMEL_IMAP_RESPONSE_UNTAGGED;
+
+ /* Read the rest of the response if it is multi-line. */
+ respbuf = imap_read_untagged (store, respbuf, ex);
+ if (!respbuf)
+ type = CAMEL_IMAP_RESPONSE_ERROR;
+ else if (!g_strncasecmp (respbuf, "* BYE", 5)) {
/* Connection was lost, no more data to fetch */
- camel_service_disconnect (CAMEL_SERVICE (store), FALSE, NULL);
- camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
- _("Server unexpectedly disconnected: %s"),
- _("Unknown error")); /* g_strerror (104)); FIXME after 1.0 is released */
store->connected = FALSE;
g_free (respbuf);
- respbuf = NULL;
type = CAMEL_IMAP_RESPONSE_ERROR;
- break;
}
-
- /* Read the rest of the response. */
- type = CAMEL_IMAP_RESPONSE_UNTAGGED;
- respbuf = imap_read_untagged (store, respbuf, ex);
- if (!respbuf)
- type = CAMEL_IMAP_RESPONSE_ERROR;
-
break;
case '+':
type = CAMEL_IMAP_RESPONSE_CONTINUATION;
@@ -299,7 +292,6 @@ camel_imap_command_response (CamelImapStore *store, char **response,
if (type == CAMEL_IMAP_RESPONSE_ERROR ||
type == CAMEL_IMAP_RESPONSE_TAGGED)
CAMEL_IMAP_STORE_UNLOCK (store, command_lock);
-
return type;
}
@@ -406,16 +398,17 @@ imap_read_untagged (CamelImapStore *store, char *line, CamelException *ex)
str->str + 1, length);
if (nread == -1) {
if (errno == EINTR)
- camel_exception_set (ex, CAMEL_EXCEPTION_USER_CANCEL, _("Operation cancelled"));
+ camel_exception_set(ex, CAMEL_EXCEPTION_USER_CANCEL, _("Operation cancelled"));
else
- camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE, g_strerror (errno));
+ camel_exception_set(ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE, strerror(errno));
camel_service_disconnect (CAMEL_SERVICE (store), FALSE, NULL);
goto lose;
}
if (nread < length) {
- camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
- _("Server response ended too soon."));
- camel_service_disconnect (CAMEL_SERVICE (store), FALSE, NULL);
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
+ _("Server response ended too soon."));
+ camel_service_disconnect (CAMEL_SERVICE (store),
+ FALSE, NULL);
goto lose;
}
str->str[length + 1] = '\0';
@@ -588,14 +581,12 @@ camel_imap_response_extract (CamelImapStore *store,
int len = strlen (type), i;
char *resp;
- len = strlen (type);
-
for (i = 0; i < response->untagged->len; i++) {
resp = response->untagged->pdata[i];
/* Skip "* ", and initial sequence number, if present */
strtoul (resp + 2, &resp, 10);
if (*resp == ' ')
- resp = (char *) imap_next_word (resp);
+ resp = imap_next_word (resp);
if (!g_strncasecmp (resp, type, len))
break;
@@ -702,7 +693,7 @@ imap_command_strdup_vprintf (CamelImapStore *store, const char *fmt,
len += arglen * 2;
start = p + 1;
break;
-
+
case '%':
start = p;
break;
@@ -743,14 +734,8 @@ imap_command_strdup_vprintf (CamelImapStore *store, const char *fmt,
case 'S':
case 'F':
string = args->pdata[i++];
- if (*p == 'F') {
- char *mailbox;
-
- mailbox = imap_namespace_concat (store, string);
- string = imap_mailbox_encode (mailbox, strlen (mailbox));
- g_free (mailbox);
- }
-
+ if (*p == 'F')
+ string = imap_namespace_concat (store, string);
if (store->capabilities & IMAP_CAPABILITY_LITERALPLUS) {
op += sprintf (op, "{%d+}\r\n%s",
strlen (string), string);
diff --git a/camel/providers/imap/camel-imap-folder.c b/camel/providers/imap/camel-imap-folder.c
index 811533d25a..45dad9f6b0 100644
--- a/camel/providers/imap/camel-imap-folder.c
+++ b/camel/providers/imap/camel-imap-folder.c
@@ -64,11 +64,6 @@
#include "camel-stream.h"
#include "string-utils.h"
-
-/* set to -1 for infinite size */
-#define UID_SET_LIMIT (4096)
-
-
#define CF_CLASS(o) (CAMEL_FOLDER_CLASS (CAMEL_OBJECT_GET_CLASS(o)))
static CamelDiscoFolderClass *disco_folder_class = NULL;
@@ -231,8 +226,6 @@ camel_imap_folder_new (CamelStore *parent, const char *folder_name,
!g_strcasecmp (folder_name, "INBOX"))
folder->folder_flags |= CAMEL_FOLDER_FILTER_RECENT;
- imap_folder->search = camel_imap_search_new(folder_dir);
-
return folder;
}
@@ -453,8 +446,7 @@ imap_rescan (CamelFolder *folder, int exists, CamelException *ex)
CamelImapMessageInfo *iinfo;
GArray *removed;
gboolean ok;
- CamelFolderChangeInfo *changes = NULL;
-
+
CAMEL_IMAP_STORE_ASSERT_LOCKED (store, command_lock);
imap_folder->need_rescan = FALSE;
@@ -544,20 +536,15 @@ imap_rescan (CamelFolder *folder, int exists, CamelException *ex)
info->flags = (info->flags | server_set) & ~server_cleared;
iinfo->server_flags = new[i].flags;
-
- if (changes == NULL)
- changes = camel_folder_change_info_new();
- camel_folder_change_info_change_uid(changes, new[i].uid);
+
+ camel_object_trigger_event (CAMEL_OBJECT (folder),
+ "message_changed",
+ new[i].uid);
}
camel_folder_summary_info_free (folder->summary, info);
g_free (new[i].uid);
}
-
- if (changes) {
- camel_object_trigger_event(CAMEL_OBJECT (folder), "folder_changed", changes);
- camel_folder_change_info_free(changes);
- }
seq = i + 1;
@@ -578,14 +565,11 @@ imap_rescan (CamelFolder *folder, int exists, CamelException *ex)
g_array_free (removed, TRUE);
}
-/* the max number of chars that an unsigned 32-bit int can be is 10 chars plus 1 for a possible : */
-#define UID_SET_FULL(setlen, maxlen) (maxlen > 0 ? setlen + 11 >= maxlen : FALSE)
-
/* Find all messages in @folder with flags matching @flags and @mask.
* If no messages match, returns %NULL. Otherwise, returns an array of
* CamelMessageInfo and sets *@set to a message set corresponding the
- * UIDs of the matched messages (up to @UID_SET_LIMIT bytes). The
- * caller must free the infos, the array, and the set string.
+ * UIDs of the matched messages. The caller must free the infos, the
+ * array, and the set string.
*/
static GPtrArray *
get_matching (CamelFolder *folder, guint32 flags, guint32 mask, char **set)
@@ -594,12 +578,12 @@ get_matching (CamelFolder *folder, guint32 flags, guint32 mask, char **set)
CamelMessageInfo *info;
int i, max, range;
GString *gset;
-
+
matches = g_ptr_array_new ();
gset = g_string_new ("");
max = camel_folder_summary_count (folder->summary);
range = -1;
- for (i = 0; i < max && !UID_SET_FULL (gset->len, UID_SET_LIMIT); i++) {
+ for (i = 0; i < max; i++) {
info = camel_folder_summary_index (folder->summary, i);
if (!info)
continue;
@@ -614,7 +598,7 @@ get_matching (CamelFolder *folder, guint32 flags, guint32 mask, char **set)
}
continue;
}
-
+
g_ptr_array_add (matches, info);
if (range != -1)
continue;
@@ -623,12 +607,11 @@ get_matching (CamelFolder *folder, guint32 flags, guint32 mask, char **set)
g_string_append_c (gset, ',');
g_string_sprintfa (gset, "%s", camel_message_info_uid (info));
}
-
if (range != -1 && range != max - 1) {
info = matches->pdata[matches->len - 1];
g_string_sprintfa (gset, ":%s", camel_message_info_uid (info));
}
-
+
if (matches->len) {
*set = gset->str;
g_string_free (gset, FALSE);
@@ -674,19 +657,14 @@ imap_sync_online (CamelFolder *folder, CamelException *ex)
}
/* Note: Cyrus is broken and will not accept an
- empty-set of flags so... if this is true then we
- want to unset the previously set flags.*/
+ empty-set of flags so... if this is true then we
+ want to unset the previously set flags.*/
unset = !(info->flags & CAMEL_IMAP_SERVER_FLAGS);
/* FIXME: since we don't know the previously set
- flags, if unset is TRUE then just unset all the flags? */
+ flags, if unset is TRUE then just unset all the flags? */
flaglist = imap_create_flag_list (unset ? CAMEL_IMAP_SERVER_FLAGS : info->flags);
- /* Note: get_matching() uses UID_SET_LIMIT to limit
- the size of the uid-set string. We don't have to
- loop here to flush all the matching uids because
- they will be scooped up later by our parent loop (I
- think?). -- Jeff */
matches = get_matching (folder, info->flags & (CAMEL_IMAP_SERVER_FLAGS | CAMEL_MESSAGE_FOLDER_FLAGGED),
CAMEL_IMAP_SERVER_FLAGS | CAMEL_MESSAGE_FOLDER_FLAGGED, &set);
camel_folder_summary_info_free (folder->summary, info);
@@ -751,34 +729,28 @@ imap_expunge_uids_online (CamelFolder *folder, GPtrArray *uids, CamelException *
{
CamelImapStore *store = CAMEL_IMAP_STORE (folder->parent_store);
CamelImapResponse *response;
- int uid = 0;
char *set;
+ set = imap_uid_array_to_set (folder->summary, uids);
CAMEL_IMAP_STORE_LOCK (store, command_lock);
-
- while (uid < uids->len) {
- set = imap_uid_array_to_set (folder->summary, uids, uid, UID_SET_LIMIT, &uid);
- response = camel_imap_command (store, folder, ex,
- "UID STORE %s +FLAGS.SILENT \\Deleted",
- set);
- if (response)
- camel_imap_response_free (store, response);
- if (camel_exception_is_set (ex)) {
- CAMEL_IMAP_STORE_UNLOCK (store, command_lock);
- g_free (set);
- return;
- }
-
- if (store->capabilities & IMAP_CAPABILITY_UIDPLUS) {
- response = camel_imap_command (store, folder, ex,
- "UID EXPUNGE %s", set);
- } else
- response = camel_imap_command (store, folder, ex, "EXPUNGE");
-
- if (response)
- camel_imap_response_free (store, response);
+ response = camel_imap_command (store, folder, ex,
+ "UID STORE %s +FLAGS.SILENT \\Deleted",
+ set);
+ if (response)
+ camel_imap_response_free (store, response);
+ if (camel_exception_is_set (ex)) {
+ CAMEL_IMAP_STORE_UNLOCK (store, command_lock);
+ g_free (set);
+ return;
}
+ if (store->capabilities & IMAP_CAPABILITY_UIDPLUS) {
+ response = camel_imap_command (store, folder, ex,
+ "UID EXPUNGE %s", set);
+ } else
+ response = camel_imap_command (store, folder, ex, "EXPUNGE");
+ if (response)
+ camel_imap_response_free (store, response);
CAMEL_IMAP_STORE_UNLOCK (store, command_lock);
}
@@ -802,21 +774,20 @@ static void
imap_expunge_uids_resyncing (CamelFolder *folder, GPtrArray *uids, CamelException *ex)
{
CamelImapStore *store = CAMEL_IMAP_STORE (folder->parent_store);
- GPtrArray *keep_uids, *mark_uids;
CamelImapResponse *response;
- char *result;
+ char *result, *keep_uidset, *mark_uidset;
if (store->capabilities & IMAP_CAPABILITY_UIDPLUS) {
imap_expunge_uids_online (folder, uids, ex);
return;
}
-
+
/* If we don't have UID EXPUNGE we need to avoid expunging any
* of the wrong messages. So we search for deleted messages,
* and any that aren't in our to-expunge list get temporarily
* marked un-deleted.
*/
-
+
CAMEL_IMAP_STORE_LOCK (store, command_lock);
response = camel_imap_command (store, folder, ex, "UID SEARCH DELETED");
if (!response) {
@@ -828,125 +799,100 @@ imap_expunge_uids_resyncing (CamelFolder *folder, GPtrArray *uids, CamelExceptio
CAMEL_IMAP_STORE_UNLOCK (store, command_lock);
return;
}
-
+
+ keep_uidset = mark_uidset = NULL;
if (result[8] == ' ') {
+ GPtrArray *keep_uids, *mark_uids;
char *uid, *lasts = NULL;
unsigned long euid, kuid;
int ei, ki;
-
+
keep_uids = g_ptr_array_new ();
mark_uids = g_ptr_array_new ();
-
+
/* Parse SEARCH response */
for (uid = strtok_r (result + 9, " ", &lasts); uid; uid = strtok_r (NULL, " ", &lasts))
g_ptr_array_add (keep_uids, uid);
qsort (keep_uids->pdata, keep_uids->len,
sizeof (void *), uid_compar);
-
+
/* Fill in "mark_uids", empty out "keep_uids" as needed */
for (ei = ki = 0; ei < uids->len; ei++) {
euid = strtoul (uids->pdata[ei], NULL, 10);
-
+
for (kuid = 0; ki < keep_uids->len; ki++) {
kuid = strtoul (keep_uids->pdata[ki], NULL, 10);
-
+
if (kuid >= euid)
break;
}
-
+
if (euid == kuid)
g_ptr_array_remove_index (keep_uids, ki);
else
g_ptr_array_add (mark_uids, uids->pdata[ei]);
}
+
+ if (keep_uids->len)
+ keep_uidset = imap_uid_array_to_set (folder->summary, keep_uids);
+ g_ptr_array_free (keep_uids, TRUE);
+
+ if (mark_uids->len)
+ mark_uidset = imap_uid_array_to_set (folder->summary, mark_uids);
+ g_ptr_array_free (mark_uids, TRUE);
} else {
/* Empty SEARCH result, meaning nothing is marked deleted
* on server.
*/
-
- keep_uids = NULL;
- mark_uids = NULL;
+ mark_uidset = imap_uid_array_to_set (folder->summary, uids);
}
-
g_free (result);
-
+
/* Unmark messages to be kept */
- if (keep_uids) {
- char *uidset;
- int uid = 0;
-
- while (uid < keep_uids->len) {
- uidset = imap_uid_array_to_set (folder->summary, keep_uids, uid, UID_SET_LIMIT, &uid);
-
- response = camel_imap_command (store, folder, ex,
- "UID STORE %s -FLAGS.SILENT \\Deleted",
- uidset);
-
- g_free (uidset);
-
- if (!response) {
- g_ptr_array_free (keep_uids, TRUE);
- g_ptr_array_free (mark_uids, TRUE);
- CAMEL_IMAP_STORE_UNLOCK (store, command_lock);
- return;
- }
- camel_imap_response_free (store, response);
+ if (keep_uidset) {
+ response = camel_imap_command (store, folder, ex,
+ "UID STORE %s -FLAGS.SILENT \\Deleted",
+ keep_uidset);
+ if (!response) {
+ g_free (keep_uidset);
+ g_free (mark_uidset);
+ CAMEL_IMAP_STORE_UNLOCK (store, command_lock);
+ return;
}
+ camel_imap_response_free (store, response);
}
-
+
/* Mark any messages that still need to be marked */
- if (mark_uids) {
- char *uidset;
- int uid = 0;
-
- while (uid < mark_uids->len) {
- uidset = imap_uid_array_to_set (folder->summary, mark_uids, uid, UID_SET_LIMIT, &uid);
-
- response = camel_imap_command (store, folder, ex,
- "UID STORE %s +FLAGS.SILENT \\Deleted",
- uidset);
-
- g_free (uidset);
-
- if (!response) {
- g_ptr_array_free (keep_uids, TRUE);
- g_ptr_array_free (mark_uids, TRUE);
- CAMEL_IMAP_STORE_UNLOCK (store, command_lock);
- return;
- }
- camel_imap_response_free (store, response);
+ if (mark_uidset) {
+ response = camel_imap_command (store, folder, ex,
+ "UID STORE %s +FLAGS.SILENT \\Deleted",
+ mark_uidset);
+ g_free (mark_uidset);
+ if (!response) {
+ g_free (keep_uidset);
+ CAMEL_IMAP_STORE_UNLOCK (store, command_lock);
+ return;
}
-
- g_ptr_array_free (mark_uids, TRUE);
+ camel_imap_response_free (store, response);
}
-
+
/* Do the actual expunging */
response = camel_imap_command (store, folder, ex, "EXPUNGE");
if (response)
camel_imap_response_free (store, response);
-
+
/* And fix the remaining messages if we mangled them */
- if (keep_uids) {
- char *uidset;
- int uid = 0;
-
- while (uid < keep_uids->len) {
- uidset = imap_uid_array_to_set (folder->summary, keep_uids, uid, UID_SET_LIMIT, &uid);
-
- /* Don't pass ex if it's already been set */
- response = camel_imap_command (store, folder,
- camel_exception_is_set (ex) ? NULL : ex,
- "UID STORE %s +FLAGS.SILENT \\Deleted",
- uidset);
-
- g_free (uidset);
- if (response)
- camel_imap_response_free (store, response);
- }
-
- g_ptr_array_free (keep_uids, TRUE);
+ if (keep_uidset) {
+ /* Don't pass ex if it's already been set */
+ response = camel_imap_command (store, folder,
+ camel_exception_is_set (ex) ? NULL : ex,
+ "UID STORE %s +FLAGS.SILENT \\Deleted",
+ keep_uidset);
+ g_free (keep_uidset);
+ if (response)
+ camel_imap_response_free (store, response);
}
-
+
CAMEL_IMAP_STORE_UNLOCK (store, command_lock);
}
@@ -1240,22 +1186,16 @@ do_copy (CamelFolder *source, GPtrArray *uids,
{
CamelImapStore *store = CAMEL_IMAP_STORE (source->parent_store);
CamelImapResponse *response;
- char *uidset;
- int uid = 0;
-
- while (uid < uids->len && !camel_exception_is_set (ex)) {
- uidset = imap_uid_array_to_set (source->summary, uids, uid, UID_SET_LIMIT, &uid);
-
- response = camel_imap_command (store, source, ex, "UID COPY %s %F",
- uidset, destination->full_name);
-
- g_free (uidset);
-
- if (response && (store->capabilities & IMAP_CAPABILITY_UIDPLUS))
- handle_copyuid (response, source, destination);
-
- camel_imap_response_free (store, response);
- }
+ char *set;
+
+ set = imap_uid_array_to_set (source->summary, uids);
+ response = camel_imap_command (store, source, ex, "UID COPY %s %F",
+ set, destination->full_name);
+ if (response && (store->capabilities & IMAP_CAPABILITY_UIDPLUS))
+ handle_copyuid (response, source, destination);
+
+ camel_imap_response_free (store, response);
+ g_free (set);
}
static void
@@ -1374,6 +1314,9 @@ imap_search_by_expression (CamelFolder *folder, const char *expression, CamelExc
command channel too */
CAMEL_IMAP_FOLDER_LOCK(folder, search_lock);
+ if (!imap_folder->search)
+ imap_folder->search = camel_imap_search_new ();
+
camel_folder_search_set_folder (imap_folder->search, folder);
summary = camel_folder_get_summary(folder);
camel_folder_search_set_summary(imap_folder->search, summary);
@@ -1410,6 +1353,9 @@ imap_search_by_uids(CamelFolder *folder, const char *expression, GPtrArray *uids
CAMEL_IMAP_FOLDER_LOCK(folder, search_lock);
+ if (imap_folder->search == NULL)
+ imap_folder->search = camel_imap_search_new();
+
camel_folder_search_set_folder(imap_folder->search, folder);
camel_folder_search_set_summary(imap_folder->search, summary);
@@ -1465,7 +1411,6 @@ get_content (CamelImapFolder *imap_folder, const char *uid,
body_mp = camel_multipart_new ();
camel_data_wrapper_set_mime_type_field (
CAMEL_DATA_WRAPPER (body_mp), ci->type);
-
camel_multipart_set_boundary (body_mp, NULL);
speclen = strlen (part_spec);
@@ -1505,7 +1450,7 @@ get_content (CamelImapFolder *imap_folder, const char *uid,
camel_object_unref (CAMEL_OBJECT (content));
camel_multipart_add_part (body_mp, part);
camel_object_unref (CAMEL_OBJECT (part));
-
+
ci = ci->next;
}
g_free (child_spec);
@@ -1731,7 +1676,7 @@ add_message_from_data (CamelFolder *folder, GPtrArray *messages,
if (seq - first >= messages->len)
g_ptr_array_set_size (messages, seq - first + 1);
-
+
msg = camel_mime_message_new ();
if (camel_data_wrapper_construct_from_stream (CAMEL_DATA_WRAPPER (msg), stream) == -1) {
camel_object_unref (CAMEL_OBJECT (msg));
@@ -1813,13 +1758,13 @@ imap_update_summary (CamelFolder *folder, int exists,
g_free (resp);
if (!data)
continue;
-
+
seq = GPOINTER_TO_INT (g_datalist_get_data (&data, "SEQUENCE"));
if (seq < first) {
g_datalist_clear (&data);
continue;
}
-
+
if (g_datalist_get_data (&data, "FLAGS"))
got += IMAP_PRETEND_SIZEOF_FLAGS;
if (g_datalist_get_data (&data, "RFC822.SIZE"))
@@ -1827,22 +1772,22 @@ imap_update_summary (CamelFolder *folder, int exists,
stream = g_datalist_get_data (&data, "BODY_PART_STREAM");
if (stream) {
got += IMAP_PRETEND_SIZEOF_HEADERS;
-
+
/* Use the stream now so we don't tie up many
* many fds if we're fetching many many messages.
*/
add_message_from_data (folder, messages, first, data);
g_datalist_set_data (&data, "BODY_PART_STREAM", NULL);
}
-
+
camel_operation_progress (NULL, got * 100 / size);
g_ptr_array_add (fetch_data, data);
}
camel_operation_end (NULL);
-
+
if (type == CAMEL_IMAP_RESPONSE_ERROR)
goto lose;
-
+
/* Figure out which headers we still need to fetch. */
needheaders = g_ptr_array_new ();
size = got = 0;
@@ -1850,67 +1795,55 @@ imap_update_summary (CamelFolder *folder, int exists,
data = fetch_data->pdata[i];
if (g_datalist_get_data (&data, "BODY_PART_LEN"))
continue;
-
+
uid = g_datalist_get_data (&data, "UID");
if (uid) {
g_ptr_array_add (needheaders, uid);
size += IMAP_PRETEND_SIZEOF_HEADERS;
}
}
-
+
/* And fetch them */
if (needheaders->len) {
- char *uidset;
- int uid = 0;
-
- qsort (needheaders->pdata, needheaders->len,
- sizeof (void *), uid_compar);
-
+ char *set;
+
+ /* FIXME: sort needheaders */
+ set = imap_uid_array_to_set (folder->summary, needheaders);
+ g_ptr_array_free (needheaders, TRUE);
+ if (!camel_imap_command_start (store, folder, ex,
+ "UID FETCH %s BODY.PEEK[%s]",
+ set, header_spec)) {
+ g_free (set);
+ goto lose;
+ }
+ g_free (set);
+
camel_operation_start (NULL, _("Fetching summary information for new messages"));
-
- while (uid < needheaders->len) {
- uidset = imap_uid_array_to_set (folder->summary, needheaders, uid, UID_SET_LIMIT, &uid);
- if (!camel_imap_command_start (store, folder, ex,
- "UID FETCH %s BODY.PEEK[%s]",
- uidset, header_spec)) {
- g_ptr_array_free (needheaders, TRUE);
- camel_operation_end (NULL);
- g_free (uidset);
- goto lose;
- }
- g_free (uidset);
-
- while ((type = camel_imap_command_response (store, &resp, ex))
- == CAMEL_IMAP_RESPONSE_UNTAGGED) {
- data = parse_fetch_response (imap_folder, resp);
- g_free (resp);
- if (!data)
- continue;
-
- stream = g_datalist_get_data (&data, "BODY_PART_STREAM");
- if (stream) {
- add_message_from_data (folder, messages, first, data);
- got += IMAP_PRETEND_SIZEOF_HEADERS;
- camel_operation_progress (NULL, got * 100 / size);
- }
- g_datalist_clear (&data);
- }
-
- if (type == CAMEL_IMAP_RESPONSE_ERROR) {
- g_ptr_array_free (needheaders, TRUE);
- camel_operation_end (NULL);
- goto lose;
+ while ((type = camel_imap_command_response (store, &resp, ex))
+ == CAMEL_IMAP_RESPONSE_UNTAGGED) {
+ data = parse_fetch_response (imap_folder, resp);
+ g_free (resp);
+ if (!data)
+ continue;
+
+ stream = g_datalist_get_data (&data, "BODY_PART_STREAM");
+ if (stream) {
+ add_message_from_data (folder, messages, first, data);
+ got += IMAP_PRETEND_SIZEOF_HEADERS;
+ camel_operation_progress (NULL, got * 100 / size);
}
+ g_datalist_clear (&data);
}
-
- g_ptr_array_free (needheaders, TRUE);
camel_operation_end (NULL);
+
+ if (type == CAMEL_IMAP_RESPONSE_ERROR)
+ goto lose;
}
-
+
/* Now finish up summary entries (fix UIDs, set flags and size) */
for (i = 0; i < fetch_data->len; i++) {
data = fetch_data->pdata[i];
-
+
seq = GPOINTER_TO_INT (g_datalist_get_data (&data, "SEQUENCE"));
if (seq >= first + messages->len) {
g_datalist_clear (&data);
@@ -1939,11 +1872,7 @@ imap_update_summary (CamelFolder *folder, int exists,
break;
}
- if (pmi == NULL) {
- /* Server response is *really* fucked up,
- I guess we just pretend it never happened? */
- continue;
- }
+ g_assert (pmi);
mi = camel_message_info_new ();
camel_message_info_dup_to (pmi, mi);
@@ -1963,11 +1892,11 @@ imap_update_summary (CamelFolder *folder, int exists,
size = GPOINTER_TO_INT (g_datalist_get_data (&data, "RFC822.SIZE"));
if (size)
mi->size = size;
-
+
g_datalist_clear (&data);
}
g_ptr_array_free (fetch_data, TRUE);
-
+
/* And add the entries to the summary, etc. */
for (i = 0; i < messages->len; i++) {
mi = messages->pdata[i];
@@ -1977,30 +1906,13 @@ imap_update_summary (CamelFolder *folder, int exists,
}
camel_folder_summary_add (folder->summary, mi);
camel_folder_change_info_add_uid (changes, camel_message_info_uid (mi));
-
+
if ((mi->flags & CAMEL_IMAP_MESSAGE_RECENT))
camel_folder_change_info_recent_uid(changes, camel_message_info_uid (mi));
}
g_ptr_array_free (messages, TRUE);
-
- /* Kludge around Microsoft Exchange 5.5 IMAP - See bug #5348 for details */
- if (camel_folder_summary_count (folder->summary) != exists) {
- CamelImapStore *imap_store = (CamelImapStore *) folder->parent_store;
- CamelImapResponse *response;
-
- /* forget the currently selected folder */
- if (imap_store->current_folder) {
- camel_object_unref (CAMEL_OBJECT (imap_store->current_folder));
- imap_store->current_folder = NULL;
- }
-
- /* now re-select it and process the EXISTS response */
- response = camel_imap_command (imap_store, folder, ex, NULL);
- camel_imap_response_free (imap_store, response);
- }
-
return;
-
+
lose:
if (fetch_data) {
for (i = 0; i < fetch_data->len; i++) {
@@ -2109,7 +2021,7 @@ camel_imap_folder_fetch_data (CamelImapFolder *imap_folder, const char *uid,
CAMEL_IMAP_FOLDER_UNLOCK (imap_folder, cache_lock);
CAMEL_IMAP_STORE_UNLOCK (store, command_lock);
return stream;
- }
+ }
if (camel_disco_store_status (CAMEL_DISCO_STORE (store)) == CAMEL_DISCO_STORE_OFFLINE) {
camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
diff --git a/camel/providers/imap/camel-imap-store.h b/camel/providers/imap/camel-imap-store.h
index 9a6c6655ad..43c9b8e1f0 100644
--- a/camel/providers/imap/camel-imap-store.h
+++ b/camel/providers/imap/camel-imap-store.h
@@ -71,7 +71,6 @@ typedef enum {
#define IMAP_CAPABILITY_UIDPLUS (1 << 4)
#define IMAP_CAPABILITY_LITERALPLUS (1 << 5)
#define IMAP_CAPABILITY_useful_lsub (1 << 6)
-#define IMAP_CAPABILITY_utf8_search (1 << 7)
#define IMAP_PARAM_OVERRIDE_NAMESPACE (1 << 0)
#define IMAP_PARAM_CHECK_ALL (1 << 1)
diff --git a/camel/providers/imap/camel-imap-utils.c b/camel/providers/imap/camel-imap-utils.c
index 91d2efb702..d5466bf9ac 100644
--- a/camel/providers/imap/camel-imap-utils.c
+++ b/camel/providers/imap/camel-imap-utils.c
@@ -24,7 +24,6 @@
#include <stdio.h>
#include <string.h>
#include <time.h>
-#include <iconv.h>
#include "camel-imap-utils.h"
#include "camel-imap-summary.h"
@@ -33,13 +32,13 @@
#define d(x) x
-const char *
+char *
imap_next_word (const char *buf)
{
- const char *word;
+ char *word;
/* skip over current word */
- for (word = buf; *word && *word != ' '; word++);
+ for (word = (char *)buf; *word && *word != ' '; word++);
/* skip over white space */
for ( ; *word && *word == ' '; word++);
@@ -63,8 +62,8 @@ imap_next_word (const char *buf)
gboolean
imap_parse_list_response (CamelImapStore *store, const char *buf, int *flags, char *sep, char **folder)
{
- const char *word;
- size_t len;
+ char *word;
+ int len;
if (*buf != '*')
return FALSE;
@@ -117,34 +116,22 @@ imap_parse_list_response (CamelImapStore *store, const char *buf, int *flags, ch
return FALSE;
if (folder) {
- char *astring, *mailbox;
- size_t nlen;
+ char *real_name;
+ int n_len;
/* get the folder name */
word = imap_next_word (word);
- astring = imap_parse_astring ((char **) &word, &len);
- if (!astring)
- return FALSE;
-
- mailbox = imap_mailbox_decode (astring, strlen (astring));
- g_free (astring);
- if (!mailbox)
- return FALSE;
-
- nlen = strlen (store->namespace);
-
- if (!strncmp (mailbox, store->namespace, nlen)) {
- /* strip off the namespace */
- if (nlen > 0)
- memmove (mailbox, mailbox + nlen, (len - nlen) + 1);
- *folder = mailbox;
- } else if (!g_strcasecmp (mailbox, "INBOX")) {
- *folder = mailbox;
+ real_name = imap_parse_astring (&word, &len);
+ n_len = strlen (store->namespace);
+ if (!strncmp (real_name, store->namespace, n_len))
+ *folder = g_strdup (real_name + n_len);
+ else if (!g_strcasecmp (real_name, "INBOX")) {
+ *folder = g_strdup (real_name);
} else {
- g_warning ("IMAP folder name \"%s\" does not begin with \"%s\"", mailbox, store->namespace);
- *folder = mailbox;
+ g_warning ("IMAP folder name \"%s\" does not begin with \"%s\"", real_name, store->namespace);
+ *folder = g_strdup (real_name);
}
-
+ g_free (real_name);
return *folder != NULL;
}
@@ -286,7 +273,7 @@ static char imap_atom_specials[128] = {
/**
* imap_parse_string_generic:
* @str_p: a pointer to a string
- * @len: a pointer to a size_t to return the length in
+ * @len: a pointer to an int to return the length in
* @type: type of string (#IMAP_STRING, #IMAP_ASTRING, or #IMAP_NSTRING)
* to parse.
*
@@ -305,7 +292,7 @@ static char imap_atom_specials[128] = {
* latter, it will point to the character after the NIL.)
**/
char *
-imap_parse_string_generic (char **str_p, size_t *len, int type)
+imap_parse_string_generic (char **str_p, int *len, int type)
{
char *str = *str_p;
char *out;
@@ -314,7 +301,7 @@ imap_parse_string_generic (char **str_p, size_t *len, int type)
return NULL;
else if (*str == '"') {
char *p;
- size_t size;
+ int size;
str++;
size = strcspn (str, "\"") + 1;
@@ -486,7 +473,7 @@ imap_parse_body (char **body_p, CamelFolder *folder,
char *body = *body_p;
CamelMessageContentInfo *child;
CamelContentType *type;
- size_t len;
+ int len;
if (!body || *body++ != '(') {
*body_p = NULL;
@@ -543,7 +530,7 @@ imap_parse_body (char **body_p, CamelFolder *folder,
/* single part */
char *main_type, *subtype;
char *id, *description, *encoding;
- guint32 size = 0;
+ guint32 size;
main_type = imap_parse_string (&body, &len);
skip_char (&body, ' ');
@@ -661,54 +648,44 @@ get_summary_uid_numeric (CamelFolderSummary *summary, int index)
return uid;
}
-/* the max number of chars that an unsigned 32-bit int can be is 10 chars plus 1 for a possible : */
-#define UID_SET_FULL(setlen, maxlen) (maxlen > 0 ? setlen + 11 >= maxlen : FALSE)
-
/**
* imap_uid_array_to_set:
* @summary: summary for the folder the UIDs come from
* @uids: a (sorted) array of UIDs
- * @uid: uid index to start at
- * @maxlen: max length of the set string (or -1 for infinite)
- * @lastuid: index offset of the last uid used
*
- * Creates an IMAP "set" up to @maxlen bytes long, covering the listed
- * UIDs starting at index @uid and not covering any UIDs that are in
- * @summary but not in @uids. It doesn't actually require that all (or
- * any) of the UIDs be in @summary.
- *
- * After calling, @lastuid will be set the index of the first uid
- * *not* included in the returned set string.
+ * Creates an IMAP "set" covering the listed UIDs and not covering
+ * any UIDs that are in @summary but not in @uids. It doesn't
+ * actually require that all (or any) of the UIDs be in @summary.
*
* Return value: the set, which the caller must free with g_free()
**/
char *
-imap_uid_array_to_set (CamelFolderSummary *summary, GPtrArray *uids, int uid, ssize_t maxlen, int *lastuid)
+imap_uid_array_to_set (CamelFolderSummary *summary, GPtrArray *uids)
{
+ int ui, si, scount;
unsigned long last_uid, next_summary_uid, this_uid;
gboolean range = FALSE;
- int si, scount;
GString *gset;
char *set;
- g_return_val_if_fail (uids->len > uid, NULL);
+ g_return_val_if_fail (uids->len > 0, NULL);
- gset = g_string_new (uids->pdata[uid]);
- last_uid = strtoul (uids->pdata[uid], NULL, 10);
+ gset = g_string_new (uids->pdata[0]);
+ last_uid = strtoul (uids->pdata[0], NULL, 10);
next_summary_uid = 0;
scount = camel_folder_summary_count (summary);
- for (uid++, si = 0; uid < uids->len && !UID_SET_FULL (gset->len, maxlen); uid++) {
+ for (ui = 1, si = 0; ui < uids->len; ui++) {
/* Find the next UID in the summary after the one we
* just wrote out.
*/
- for ( ; last_uid >= next_summary_uid && si < scount; si++)
+ for (; last_uid >= next_summary_uid && si < scount; si++)
next_summary_uid = get_summary_uid_numeric (summary, si);
if (last_uid >= next_summary_uid)
next_summary_uid = (unsigned long) -1;
/* Now get the next UID from @uids */
- this_uid = strtoul (uids->pdata[uid], NULL, 10);
+ this_uid = strtoul (uids->pdata[ui], NULL, 10);
if (this_uid == next_summary_uid || this_uid == last_uid + 1)
range = TRUE;
else {
@@ -725,8 +702,6 @@ imap_uid_array_to_set (CamelFolderSummary *summary, GPtrArray *uids, int uid, ss
if (range)
g_string_sprintfa (gset, ":%lu", last_uid);
- *lastuid = uid;
-
set = gset->str;
g_string_free (gset, FALSE);
@@ -825,7 +800,7 @@ imap_uid_array_free (GPtrArray *arr)
char *
imap_concat (CamelImapStore *imap_store, const char *prefix, const char *suffix)
{
- size_t len;
+ int len;
len = strlen (prefix);
if (len == 0 || prefix[len - 1] == imap_store->dir_sep)
@@ -843,7 +818,7 @@ imap_namespace_concat (CamelImapStore *store, const char *name)
else
return g_strdup ("");
}
-
+
if (!g_strcasecmp (name, "INBOX"))
return g_strdup ("INBOX");
@@ -851,268 +826,6 @@ imap_namespace_concat (CamelImapStore *store, const char *name)
g_warning ("Trying to concat NULL namespace to \"%s\"!", name);
return g_strdup (name);
}
-
- return imap_concat (store, store->namespace, name);
-}
-
-
-#define UTF8_TO_UTF7_LEN(len) ((len * 3) + 8)
-#define UTF7_TO_UTF8_LEN(len) (len)
-
-enum {
- MODE_USASCII,
- MODE_AMPERSAND,
- MODE_MODUTF7
-};
-
-#define is_usascii(c) (((c) >= 0x20 && (c) <= 0x25) || ((c) >= 0x27 && (c) <= 0x7e))
-#define encode_mode(c) (is_usascii (c) ? MODE_USASCII : (c) == '&' ? MODE_AMPERSAND : MODE_MODUTF7)
-
-char *
-imap_mailbox_encode (const unsigned char *in, size_t inlen)
-{
- const unsigned char *start, *inptr, *inend;
- unsigned char *mailbox, *m, *mend;
- size_t inleft, outleft, conv;
- char *inbuf, *outbuf;
- iconv_t cd;
- int mode;
-
- cd = (iconv_t) -1;
- m = mailbox = g_malloc (UTF8_TO_UTF7_LEN (inlen) + 1);
- mend = mailbox + UTF8_TO_UTF7_LEN (inlen);
-
- start = inptr = in;
- inend = in + inlen;
- mode = MODE_USASCII;
-
- while (inptr < inend) {
- int new_mode;
-
- new_mode = encode_mode (*inptr);
-
- if (new_mode != mode) {
- switch (mode) {
- case MODE_USASCII:
- memcpy (m, start, inptr - start);
- m += (inptr - start);
- break;
- case MODE_AMPERSAND:
- while (start < inptr) {
- *m++ = '&';
- *m++ = '-';
- start++;
- }
- break;
- case MODE_MODUTF7:
- inbuf = (char *) start;
- inleft = inptr - start;
- outbuf = (char *) m;
- outleft = mend - m;
-
- if (cd == (iconv_t) -1)
- cd = iconv_open ("UTF-7", "UTF-8");
-
- conv = iconv (cd, &inbuf, &inleft, &outbuf, &outleft);
- if (conv == (size_t) -1) {
- g_warning ("error converting mailbox to UTF-7!");
- }
- iconv (cd, NULL, NULL, &outbuf, &outleft);
-
- /* shift into modified UTF-7 mode (overwrite UTF-7's '+' shift)... */
- *m++ = '&';
-
- while (m < (unsigned char *) outbuf) {
- /* replace '/' with ',' */
- if (*m == '/')
- *m = ',';
-
- m++;
- }
-
- break;
- }
-
- mode = new_mode;
- start = inptr;
- }
-
- inptr++;
- }
-
- switch (mode) {
- case MODE_USASCII:
- memcpy (m, start, inptr - start);
- m += (inptr - start);
- break;
- case MODE_AMPERSAND:
- while (start < inptr) {
- *m++ = '&';
- *m++ = '-';
- start++;
- }
- break;
- case MODE_MODUTF7:
- inbuf = (char *) start;
- inleft = inptr - start;
- outbuf = (char *) m;
- outleft = mend - m;
-
- if (cd == (iconv_t) -1)
- cd = iconv_open ("UTF-7", "UTF-8");
-
- conv = iconv (cd, &inbuf, &inleft, &outbuf, &outleft);
- if (conv == (size_t) -1) {
- g_warning ("error converting mailbox to UTF-7!");
- }
- iconv (cd, NULL, NULL, &outbuf, &outleft);
-
- /* shift into modified UTF-7 mode (overwrite UTF-7's '+' shift)... */
- *m++ = '&';
-
- while (m < (unsigned char *) outbuf) {
- /* replace '/' with ',' */
- if (*m == '/')
- *m = ',';
-
- m++;
- }
-
- break;
- }
-
- *m = '\0';
-
- if (cd != (iconv_t) -1)
- iconv_close (cd);
-
- return mailbox;
-}
-
-char *
-imap_mailbox_decode (const unsigned char *in, size_t inlen)
-{
- const unsigned char *start, *inptr, *inend;
- unsigned char *mailbox, *m, *mend;
- unsigned char mode_switch;
- iconv_t cd;
-
- cd = (iconv_t) -1;
- m = mailbox = g_malloc (UTF7_TO_UTF8_LEN (inlen) + 1);
- mend = mailbox + UTF7_TO_UTF8_LEN (inlen);
-
- start = inptr = in;
- inend = in + inlen;
- mode_switch = '&';
-
- while (inptr < inend) {
- if (*inptr == mode_switch) {
- if (mode_switch == '&') {
- /* mode switch from US-ASCII to UTF-7 */
- mode_switch = '-';
- memcpy (m, start, inptr - start);
- m += (inptr - start);
- start = inptr;
- } else if (mode_switch == '-') {
- /* mode switch from UTF-7 to US-ASCII or an ampersand (&) */
- mode_switch = '&';
- start++;
- if (start == inptr) {
- /* we had the sequence "&-" which becomes "&" when decoded */
- *m++ = '&';
- } else {
- char *buffer, *inbuf, *outbuf;
- size_t buflen, outleft, conv;
-
- buflen = (inptr - start) + 2;
- inbuf = buffer = alloca (buflen);
- *inbuf++ = '+';
- while (start < inptr) {
- *inbuf++ = *start == ',' ? '/' : *start;
- start++;
- }
- *inbuf = '-';
-
- inbuf = buffer;
- outbuf = (char *) m;
- outleft = mend - m;
-
- if (cd == (iconv_t) -1)
- cd = iconv_open ("UTF-8", "UTF-7");
-
- conv = iconv (cd, &inbuf, &buflen, &outbuf, &outleft);
- if (conv == (size_t) -1) {
- g_warning ("error decoding mailbox: %.*s", inlen, in);
- }
- iconv (cd, NULL, NULL, NULL, NULL);
-
- m = (unsigned char *) outbuf;
- }
-
- /* point to the char after the '-' */
- start = inptr + 1;
- }
- }
-
- inptr++;
- }
-
- if (*inptr == mode_switch) {
- if (mode_switch == '&') {
- /* the remaining text is US-ASCII */
- memcpy (m, start, inptr - start);
- m += (inptr - start);
- start = inptr;
- } else if (mode_switch == '-') {
- /* We've got encoded UTF-7 or else an ampersand */
- start++;
- if (start == inptr) {
- /* we had the sequence "&-" which becomes "&" when decoded */
- *m++ = '&';
- } else {
- char *buffer, *inbuf, *outbuf;
- size_t buflen, outleft, conv;
-
- buflen = (inptr - start) + 2;
- inbuf = buffer = alloca (buflen);
- *inbuf++ = '+';
- while (start < inptr) {
- *inbuf++ = *start == ',' ? '/' : *start;
- start++;
- }
- *inbuf = '-';
-
- inbuf = buffer;
- outbuf = (char *) m;
- outleft = mend - m;
-
- if (cd == (iconv_t) -1)
- cd = iconv_open ("UTF-8", "UTF-7");
-
- conv = iconv (cd, &inbuf, &buflen, &outbuf, &outleft);
- if (conv == (size_t) -1) {
- g_warning ("error decoding mailbox: %.*s", inlen, in);
- }
- iconv (cd, NULL, NULL, NULL, NULL);
-
- m = (unsigned char *) outbuf;
- }
- }
- } else {
- if (mode_switch == '-') {
- /* illegal encoded mailbox... */
- g_warning ("illegal mailbox name encountered: %.*s", inlen, in);
- }
-
- memcpy (m, start, inptr - start);
- m += (inptr - start);
- }
-
- *m = '\0';
-
- if (cd != (iconv_t) -1)
- iconv_close (cd);
-
- return mailbox;
+ return imap_concat (store, store->namespace, name);
}
diff --git a/camel/providers/local/Makefile.am b/camel/providers/local/Makefile.am
index d619a0b169..f0ad0c7f6c 100644
--- a/camel/providers/local/Makefile.am
+++ b/camel/providers/local/Makefile.am
@@ -34,8 +34,7 @@ libcamellocal_la_SOURCES = \
camel-maildir-summary.c \
camel-spool-folder.c \
camel-spool-store.c \
- camel-spool-summary.c \
- camel-spoold-store.c
+ camel-spool-summary.c
libcamellocalinclude_HEADERS = \
camel-local-folder.h \
@@ -52,13 +51,12 @@ libcamellocalinclude_HEADERS = \
camel-maildir-summary.h \
camel-spool-folder.h \
camel-spool-store.h \
- camel-spool-summary.h \
- camel-spoold-store.h
+ camel-spool-summary.h
noinst_HEADERS = \
camel-local-private.h
-libcamellocal_la_LDFLAGS = -avoid-version -module
+libcamellocal_la_LDFLAGS = -version-info 0:0:0
libcamellocal_la_LIBADD = $(top_builddir)/e-util/libeutil.la $(top_builddir)/libibex/libibex.la
diff --git a/camel/providers/local/camel-local-folder.c b/camel/providers/local/camel-local-folder.c
index 3ae6c74873..caf79d90f5 100644
--- a/camel/providers/local/camel-local-folder.c
+++ b/camel/providers/local/camel-local-folder.c
@@ -50,8 +50,6 @@
#include "camel-local-private.h"
-#include "camel-text-index.h"
-
#define d(x) /*(printf("%s(%d): ", __FILE__, __LINE__),(x))*/
#ifndef PATH_MAX
@@ -140,8 +138,9 @@ local_finalize(CamelObject * object)
camel_object_unref((CamelObject *)local_folder->search);
}
+ /* must free index after summary, since it isn't refcounted */
if (local_folder->index)
- camel_object_unref((CamelObject *)local_folder->index);
+ ibex_close(local_folder->index);
while (local_folder->locked> 0)
camel_local_folder_unlock(local_folder);
@@ -212,20 +211,11 @@ camel_local_folder_construct(CamelLocalFolder *lf, CamelStore *parent_store, con
lf->changes = camel_folder_change_info_new();
- /* TODO: Remove the following line, it is a temporary workaround to remove
- the old-format 'ibex' files that might be lying around */
- unlink(lf->index_path);
-
-#if 0
- forceindex = FALSE;
-#else
- /* if we have no/invalid index file, force it */
- forceindex = camel_text_index_check(lf->index_path) == -1;
+ /* if we have no index file, force it */
+ forceindex = stat(lf->index_path, &st) == -1;
if (flags & CAMEL_STORE_FOLDER_BODY_INDEX) {
- int flag = O_RDWR|O_CREAT;
- if (forceindex)
- flag |= O_TRUNC;
- lf->index = (CamelIndex *)camel_text_index_new(lf->index_path, flag);
+
+ lf->index = ibex_open(lf->index_path, O_CREAT | O_RDWR, 0600);
if (lf->index == NULL) {
/* yes, this isn't fatal at all */
g_warning("Could not open/create index file: %s: indexing not performed", strerror(errno));
@@ -234,12 +224,13 @@ camel_local_folder_construct(CamelLocalFolder *lf, CamelStore *parent_store, con
flags &= ~CAMEL_STORE_FOLDER_BODY_INDEX;
}
} else {
- /* if we do have an index file, remove it (?) */
- if (forceindex == FALSE)
- camel_text_index_remove(lf->index_path);
+ /* if we do have an index file, remove it */
+ if (forceindex == FALSE) {
+ unlink(lf->index_path);
+ }
forceindex = FALSE;
}
-#endif
+
lf->flags = flags;
folder->summary = (CamelFolderSummary *)CLOCALF_CLASS(lf)->create_summary(lf->summary_path, lf->folder_path, lf->index);
@@ -247,9 +238,7 @@ camel_local_folder_construct(CamelLocalFolder *lf, CamelStore *parent_store, con
camel_exception_clear(ex);
}
- /*if (camel_local_summary_check((CamelLocalSummary *)folder->summary, lf->changes, ex) == -1) {*/
- /* we sync here so that any hard work setting up the folder isn't lost */
- if (camel_local_summary_sync((CamelLocalSummary *)folder->summary, FALSE, lf->changes, ex) == -1) {
+ if (camel_local_summary_check((CamelLocalSummary *)folder->summary, lf->changes, ex) == -1) {
camel_object_unref (CAMEL_OBJECT (folder));
return NULL;
}
diff --git a/camel/providers/local/camel-spool-summary.c b/camel/providers/local/camel-spool-summary.c
index ff8f6a85a9..109b4f230b 100644
--- a/camel/providers/local/camel-spool-summary.c
+++ b/camel/providers/local/camel-spool-summary.c
@@ -23,17 +23,14 @@
#include <config.h>
#endif
-#include <sys/types.h>
+#include <ctype.h>
#include <sys/stat.h>
-#include <fcntl.h>
#include <sys/uio.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
-#include <ctype.h>
-
#include "camel-spool-summary.h"
#include "camel-mime-message.h"
#include "camel-file-utils.h"
diff --git a/camel/providers/nntp/Makefile.am b/camel/providers/nntp/Makefile.am
index ef8306de93..7761440f5f 100644
--- a/camel/providers/nntp/Makefile.am
+++ b/camel/providers/nntp/Makefile.am
@@ -12,27 +12,28 @@ INCLUDES = -I../.. \
-I$(top_srcdir)/e-util \
-I$(top_srcdir) \
-I$(includedir) \
- $(CAMEL_CFLAGS) \
- $(GNOME_INCLUDEDIR) \
- $(GTK_INCLUDEDIR) \
+ $(EXTRA_GNOME_CFLAGS) \
-DG_LOG_DOMAIN=\"camel-nntp-provider\"
libcamelnntp_la_SOURCES = \
+ camel-nntp-auth.c \
+ camel-nntp-folder.c \
+ camel-nntp-grouplist.c \
+ camel-nntp-newsrc.c \
camel-nntp-provider.c \
camel-nntp-store.c \
- camel-nntp-folder.c \
- camel-nntp-stream.c \
- camel-nntp-summary.c
+ camel-nntp-utils.c
libcamelnntpinclude_HEADERS = \
- camel-nntp-store.h \
+ camel-nntp-auth.h \
camel-nntp-folder.h \
- camel-nntp-stream.h \
- camel-nntp-summary.h
-
-noinst_HEADERS = \
- camel-nntp-private.h
+ camel-nntp-grouplist.h \
+ camel-nntp-newsrc.h \
+ camel-nntp-resp-codes.h \
+ camel-nntp-store.h \
+ camel-nntp-types.h \
+ camel-nntp-utils.h
-libcamelnntp_la_LDFLAGS = -avoid-version -module
+libcamelnntp_la_LDFLAGS = -version-info 0:0:0
EXTRA_DIST = libcamelnntp.urls
diff --git a/camel/providers/pop3/Makefile.am b/camel/providers/pop3/Makefile.am
index 9e94c5c89a..cde7baf25a 100644
--- a/camel/providers/pop3/Makefile.am
+++ b/camel/providers/pop3/Makefile.am
@@ -15,24 +15,21 @@ INCLUDES = \
-I$(top_srcdir)/e-util \
$(CAMEL_CFLAGS) \
$(GNOME_INCLUDEDIR) \
+ $(KRB4_CFLAGS) \
$(GTK_INCLUDEDIR) \
-DG_LOG_DOMAIN=\"camel-pop3-provider\"
libcamelpop3_la_SOURCES = \
- camel-pop3-engine.c \
camel-pop3-folder.c \
camel-pop3-provider.c \
- camel-pop3-stream.c \
camel-pop3-store.c
libcamelpop3include_HEADERS = \
- camel-pop3-engine.h \
camel-pop3-folder.h \
- camel-pop3-stream.h \
camel-pop3-store.h
-libcamelpop3_la_LDFLAGS = -avoid-version -module
+libcamelpop3_la_LDFLAGS = $(KRB4_LDFLAGS) -version-info 0:0:0
libcamelpop3_la_LIBADD = $(top_builddir)/e-util/libeutil.la
diff --git a/camel/providers/pop3/camel-pop3-store.c b/camel/providers/pop3/camel-pop3-store.c
index dcdeefb392..6ff88d61c2 100644
--- a/camel/providers/pop3/camel-pop3-store.c
+++ b/camel/providers/pop3/camel-pop3-store.c
@@ -4,9 +4,8 @@
/*
* Authors:
* Dan Winship <danw@ximian.com>
- * Michael Zucchi <notzed@ximian.com>
*
- * Copyright (C) 2000-2002 Ximian, Inc. (www.ximian.com)
+ * Copyright (C) 2000 Ximian, Inc. (www.ximian.com)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
@@ -39,26 +38,36 @@
#include "camel-operation.h"
+#ifdef HAVE_KRB4
+/* Specified nowhere */
+#define KPOP_PORT 1109
+
+#include <krb.h>
+/* MIT krb4 des.h #defines _. Sigh. We don't need it. */
+#undef _
+
+#ifdef NEED_KRB_SENDAUTH_PROTO
+extern int krb_sendauth(long options, int fd, KTEXT ticket, char *service,
+ char *inst, char *realm, unsigned KRB4_32 checksum,
+ MSG_DAT *msg_data, CREDENTIALS *cred,
+ Key_schedule schedule, struct sockaddr_in *laddr,
+ struct sockaddr_in *faddr, char *version);
+#endif
+#endif
+
#include "camel-pop3-store.h"
#include "camel-pop3-folder.h"
#include "camel-stream-buffer.h"
+#include "camel-tcp-stream.h"
#include "camel-session.h"
#include "camel-exception.h"
#include "camel-url.h"
#include "e-util/md5-utils.h"
-#include "camel-pop3-engine.h"
-#include "camel-sasl.h"
-#include "camel-data-cache.h"
-#include "camel-tcp-stream.h"
-#include "camel-tcp-stream-raw.h"
-#ifdef HAVE_SSL
-#include "camel-tcp-stream-ssl.h"
-#endif
/* Specified in RFC 1939 */
#define POP3_PORT 110
-static CamelStoreClass *parent_class = NULL;
+static CamelRemoteStoreClass *parent_class = NULL;
static void finalize (CamelObject *object);
@@ -72,16 +81,20 @@ static CamelFolder *get_folder (CamelStore *store, const char *folder_name,
static void init_trash (CamelStore *store);
static CamelFolder *get_trash (CamelStore *store, CamelException *ex);
+static int pop3_get_response (CamelPop3Store *store, char **ret, CamelException *ex);
+
+
static void
-camel_pop3_store_class_init (CamelPOP3StoreClass *camel_pop3_store_class)
+camel_pop3_store_class_init (CamelPop3StoreClass *camel_pop3_store_class)
{
CamelServiceClass *camel_service_class =
CAMEL_SERVICE_CLASS (camel_pop3_store_class);
CamelStoreClass *camel_store_class =
CAMEL_STORE_CLASS (camel_pop3_store_class);
- parent_class = CAMEL_STORE_CLASS (camel_type_get_global_classfuncs (camel_store_get_type ()));
-
+ parent_class = CAMEL_REMOTE_STORE_CLASS(camel_type_get_global_classfuncs
+ (camel_remote_store_get_type ()));
+
/* virtual method overload */
camel_service_class->query_auth_types = query_auth_types;
camel_service_class->connect = pop3_connect;
@@ -97,7 +110,11 @@ camel_pop3_store_class_init (CamelPOP3StoreClass *camel_pop3_store_class)
static void
camel_pop3_store_init (gpointer object, gpointer klass)
{
- ;
+ CamelRemoteStore *remote_store = CAMEL_REMOTE_STORE (object);
+
+ remote_store->default_port = 110;
+ /* FIXME: what should this port be?? */
+ remote_store->default_ssl_port = 995;
}
CamelType
@@ -106,10 +123,9 @@ camel_pop3_store_get_type (void)
static CamelType camel_pop3_store_type = CAMEL_INVALID_TYPE;
if (!camel_pop3_store_type) {
- camel_pop3_store_type = camel_type_register (CAMEL_STORE_TYPE,
- "CamelPOP3Store",
- sizeof (CamelPOP3Store),
- sizeof (CamelPOP3StoreClass),
+ camel_pop3_store_type = camel_type_register (CAMEL_REMOTE_STORE_TYPE, "CamelPop3Store",
+ sizeof (CamelPop3Store),
+ sizeof (CamelPop3StoreClass),
(CamelObjectClassInitFunc) camel_pop3_store_class_init,
NULL,
(CamelObjectInitFunc) camel_pop3_store_init,
@@ -122,233 +138,189 @@ camel_pop3_store_get_type (void)
static void
finalize (CamelObject *object)
{
- CamelPOP3Store *pop3_store = CAMEL_POP3_STORE (object);
-
- /* force disconnect so we dont have it run later, after we've cleaned up some stuff */
- /* SIGH */
+ CamelPop3Store *pop3_store = CAMEL_POP3_STORE (object);
- camel_service_disconnect((CamelService *)pop3_store, TRUE, NULL);
-
- if (pop3_store->engine)
- camel_object_unref((CamelObject *)pop3_store->engine);
- if (pop3_store->cache)
- camel_object_unref((CamelObject *)pop3_store->cache);
+ if (pop3_store->apop_timestamp)
+ g_free (pop3_store->apop_timestamp);
+ if (pop3_store->implementation)
+ g_free (pop3_store->implementation);
}
-enum {
- USE_SSL_NEVER,
- USE_SSL_ALWAYS,
- USE_SSL_WHEN_POSSIBLE
-};
-
static gboolean
-connect_to_server (CamelService *service, int ssl_mode, int try_starttls, CamelException *ex)
+connect_to_server (CamelService *service, CamelException *ex)
{
- CamelPOP3Store *store = CAMEL_POP3_STORE (service);
- CamelStream *tcp_stream;
- CamelPOP3Command *pc;
- struct hostent *h;
- int clean_quit;
- int ret, port;
-
- h = camel_service_gethost (service, ex);
- if (!h)
- return FALSE;
-
- port = service->url->port ? service->url->port : 110;
-
-#ifdef HAVE_SSL
- if (camel_url_get_param (service->url, "use_ssl")) {
- if (try_starttls)
- tcp_stream = camel_tcp_stream_ssl_new_raw (service, service->url->host);
- else {
- port = service->url->port ? service->url->port : 995;
- tcp_stream = camel_tcp_stream_ssl_new (service, service->url->host);
- }
- } else {
- tcp_stream = camel_tcp_stream_raw_new ();
+ CamelPop3Store *store = CAMEL_POP3_STORE (service);
+ char *buf, *apoptime, *apopend;
+ int status;
+ gboolean result;
+
+#ifdef HAVE_KRB4
+ gboolean set_port = FALSE, kpop;
+
+ kpop = (service->url->authmech &&
+ !strcmp (service->url->authmech, "+KPOP"));
+
+ if (kpop && service->url->port == 0) {
+ set_port = TRUE;
+ service->url->port = KPOP_PORT;
}
-#else
- tcp_stream = camel_tcp_stream_raw_new ();
-#endif /* HAVE_SSL */
-
- ret = camel_tcp_stream_connect (CAMEL_TCP_STREAM (tcp_stream), h, port);
- camel_free_host (h);
- if (ret == -1) {
- if (errno == EINTR)
- camel_exception_set (ex, CAMEL_EXCEPTION_USER_CANCEL,
- _("Connection cancelled"));
- else
- camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
- _("Could not connect to %s (port %d): %s"),
- service->url->host, port, g_strerror (errno));
+#endif
+
+ result = CAMEL_SERVICE_CLASS (parent_class)->connect (service, ex);
+
+#ifdef HAVE_KRB4
+ if (set_port)
+ service->url->port = 0;
+#endif
+
+ if (result == FALSE)
return FALSE;
+
+#ifdef HAVE_KRB4
+ if (kpop) {
+ KTEXT_ST ticket_st;
+ MSG_DAT msg_data;
+ CREDENTIALS cred;
+ Key_schedule schedule;
+ struct hostent *h;
+ int fd;
+
+ h = camel_service_gethost (service, ex);
+
+ fd = GPOINTER_TO_INT (camel_tcp_stream_get_socket (CAMEL_TCP_STREAM (CAMEL_REMOTE_STORE (service)->ostream)));
+ status = krb_sendauth (0, fd, &ticket_st, "pop", h->h_name,
+ krb_realmofhost (h->h_name), 0,
+ &msg_data, &cred, schedule,
+ NULL, NULL, "KPOPV0.1");
+ camel_free_host (h);
+ if (status != KSUCCESS) {
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
+ _("Could not authenticate to "
+ "KPOP server: %s"),
+ krb_err_txt[status]);
+ return FALSE;
+ }
+
+ if (!service->url->passwd)
+ service->url->passwd = g_strdup (service->url->user);
}
-
- /* parent class connect initialization */
- if (CAMEL_SERVICE_CLASS (parent_class)->connect (service, ex) == FALSE) {
- camel_object_unref (CAMEL_OBJECT (tcp_stream));
+#endif /* HAVE_KRB4 */
+
+ /* Read the greeting, check status */
+ status = pop3_get_response (store, &buf, ex);
+ switch (status) {
+ case CAMEL_POP3_ERR:
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
+ _("Could not connect to server: %s"),
+ buf);
+ g_free (buf);
+ /* fall through */
+ case CAMEL_POP3_FAIL:
return FALSE;
}
-
- store->engine = camel_pop3_engine_new (tcp_stream);
-
-#ifdef HAVE_SSL
- if (store->engine) {
- if (ssl_mode == USE_SSL_WHEN_POSSIBLE) {
- if (store->engine->capa & CAMEL_POP3_CAP_STLS)
- goto starttls;
- } else if (ssl_mode == USE_SSL_ALWAYS) {
- if (try_starttls) {
- if (store->engine->capa & CAMEL_POP3_CAP_STLS) {
- /* attempt to toggle STARTTLS mode */
- goto starttls;
- } else {
- /* server doesn't support STARTTLS, abort */
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Failed to connect to POP server %s in secure mode: %s"),
- service->url->host, _("SSL/TLS extension not supported."));
- /* we have the possibility of quitting cleanly here */
- clean_quit = TRUE;
- goto stls_exception;
- }
- }
+
+ if (buf) {
+ apoptime = strchr (buf, '<');
+ apopend = apoptime ? strchr (apoptime, '>') : NULL;
+ if (apopend) {
+ store->apop_timestamp =
+ g_strndup (apoptime, apopend - apoptime + 1);
+ memmove (apoptime, apopend + 1, strlen (apopend + 1));
}
+ store->implementation = buf;
}
-#endif /* HAVE_SSL */
-
- camel_object_unref (CAMEL_OBJECT (tcp_stream));
-
- return store->engine != NULL;
-
-#ifdef HAVE_SSL
- starttls:
- /* as soon as we send a STLS command, all hope is lost of a clean QUIT if problems arise */
- clean_quit = FALSE;
-
- pc = camel_pop3_engine_command_new (store->engine, 0, NULL, NULL, "STLS\r\n");
- while (camel_pop3_engine_iterate (store->engine, NULL) > 0)
- ;
-
- ret = pc->state == CAMEL_POP3_COMMAND_OK;
- camel_pop3_engine_command_free (store->engine, pc);
-
- if (ret == FALSE) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Failed to connect to POP server %s in secure mode: %s"),
- service->url->host, store->engine->line);
- goto stls_exception;
- }
-
- /* Okay, now toggle SSL/TLS mode */
- ret = camel_tcp_stream_ssl_enable_ssl (CAMEL_TCP_STREAM_SSL (tcp_stream));
-
- camel_object_unref (CAMEL_OBJECT (tcp_stream));
-
- if (ret == -1) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Failed to connect to POP server %s in secure mode: %s"),
- service->url->host, _("SSL negotiations failed"));
- goto stls_exception;
- }
-
- /* rfc2595, section 4 states that after a successful STLS
- command, the client MUST discard prior CAPA responses */
- camel_pop3_engine_reget_capabilities (store->engine);
-
- return TRUE;
-
- stls_exception:
- if (clean_quit) {
- /* try to disconnect cleanly */
- pc = camel_pop3_engine_command_new (store->engine, 0, NULL, NULL, "QUIT\r\n");
- while (camel_pop3_engine_iterate (store->engine, NULL) > 0)
- ;
- camel_pop3_engine_command_free (store->engine, pc);
- }
-
- camel_object_unref (CAMEL_OBJECT (store->engine));
- camel_object_unref (CAMEL_OBJECT (tcp_stream));
- store->engine = NULL;
-
- return FALSE;
-#endif /* HAVE_SSL */
-}
-static struct {
- char *value;
- int mode;
-} ssl_options[] = {
- { "", USE_SSL_ALWAYS },
- { "always", USE_SSL_ALWAYS },
- { "when-possible", USE_SSL_WHEN_POSSIBLE },
- { "never", USE_SSL_NEVER },
- { NULL, USE_SSL_NEVER },
-};
+ /* Check extensions */
+ store->login_delay = -1;
+ store->supports_top = -1;
+ store->supports_uidl = -1;
+ store->expires = -1;
-static gboolean
-connect_to_server_wrapper (CamelService *service, CamelException *ex)
-{
-#ifdef HAVE_SSL
- const char *use_ssl;
- int i, ssl_mode;
-
- use_ssl = camel_url_get_param (service->url, "use_ssl");
- if (use_ssl) {
- for (i = 0; ssl_options[i].value; i++)
- if (!strcmp (ssl_options[i].value, use_ssl))
- break;
- ssl_mode = ssl_options[i].mode;
- } else
- ssl_mode = USE_SSL_NEVER;
-
- if (ssl_mode == USE_SSL_ALWAYS) {
- /* First try the ssl port */
- if (!connect_to_server (service, ssl_mode, FALSE, ex)) {
- if (camel_exception_get_id (ex) == CAMEL_EXCEPTION_SERVICE_UNAVAILABLE) {
- /* The ssl port seems to be unavailable, lets try STARTTLS */
- camel_exception_clear (ex);
- return connect_to_server (service, ssl_mode, TRUE, ex);
- } else {
- return FALSE;
- }
+ status = camel_pop3_command (store, NULL, ex, "CAPA");
+ if (status == CAMEL_POP3_OK) {
+ char *p;
+ int len;
+
+ buf = camel_pop3_command_get_additional_data (store, 0, ex);
+ if (camel_exception_is_set (ex))
+ return FALSE;
+
+ p = buf;
+ while (*p) {
+ len = strcspn (p, "\n");
+ if (!strncmp (p, "IMPLEMENTATION ", 15)) {
+ g_free (store->implementation);
+ store->implementation =
+ g_strndup (p + 15, len - 15);
+ } else if (len == 3 && !strncmp (p, "TOP", 3))
+ store->supports_top = TRUE;
+ else if (len == 4 && !strncmp (p, "UIDL", 4))
+ store->supports_uidl = TRUE;
+ else if (!strncmp (p, "LOGIN-DELAY ", 12))
+ store->login_delay = atoi (p + 12);
+ else if (!strncmp (p, "EXPIRE NEVER", 12))
+ store->expires = FALSE;
+ else if (!strncmp (p, "EXPIRE ", 7))
+ store->expires = TRUE;
+
+ p += len;
+ if (*p)
+ p++;
}
-
- return TRUE;
- } else if (ssl_mode == USE_SSL_WHEN_POSSIBLE) {
- /* If the server supports STARTTLS, use it */
- return connect_to_server (service, ssl_mode, TRUE, ex);
- } else {
- /* User doesn't care about SSL */
- return connect_to_server (service, ssl_mode, FALSE, ex);
+
+ g_free (buf);
}
-#else
- return connect_to_server (service, USE_SSL_NEVER, FALSE, ex);
-#endif
+
+ return TRUE;
}
extern CamelServiceAuthType camel_pop3_password_authtype;
extern CamelServiceAuthType camel_pop3_apop_authtype;
+#ifdef HAVE_KRB4
+extern CamelServiceAuthType camel_pop3_kpop_authtype;
+#endif
static GList *
query_auth_types (CamelService *service, CamelException *ex)
{
- CamelPOP3Store *store = CAMEL_POP3_STORE (service);
+ CamelPop3Store *store = CAMEL_POP3_STORE (service);
GList *types = NULL;
+ gboolean passwd = TRUE, apop = TRUE;
+#ifdef HAVE_KRB4
+ gboolean kpop;
+#endif
types = CAMEL_SERVICE_CLASS (parent_class)->query_auth_types (service, ex);
if (camel_exception_is_set (ex))
- return NULL;
+ return types;
- if (connect_to_server_wrapper (service, NULL)) {
- types = g_list_concat(types, g_list_copy(store->engine->auth));
+ passwd = connect_to_server (service, NULL);
+ apop = store->apop_timestamp != NULL;
+ if (passwd)
pop3_disconnect (service, TRUE, NULL);
- } else {
+
+#ifdef HAVE_KRB4
+ service->url->authmech = "+KPOP";
+ kpop = connect_to_server (service, NULL);
+ service->url->authmech = NULL;
+ if (kpop)
+ pop3_disconnect (service, TRUE, NULL);
+#endif
+
+ if (passwd)
+ types = g_list_append (types, &camel_pop3_password_authtype);
+ if (apop)
+ types = g_list_append (types, &camel_pop3_apop_authtype);
+#ifdef HAVE_KRB4
+ if (kpop)
+ types = g_list_append (types, &camel_pop3_kpop_authtype);
+#endif
+
+ if (!types) {
camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
- _("Could not connect to POP server on %s"),
- service->url->host);
+ _("Could not connect to POP server on "
+ "%s."), service->url->host);
}
-
return types;
}
@@ -362,95 +334,31 @@ query_auth_types (CamelService *service, CamelException *ex)
* reconnect.
**/
void
-camel_pop3_store_expunge (CamelPOP3Store *store, CamelException *ex)
+camel_pop3_store_expunge (CamelPop3Store *store, CamelException *ex)
{
- CamelPOP3Command *pc;
-
- pc = camel_pop3_engine_command_new(store->engine, 0, NULL, NULL, "QUIT\r\n");
- while (camel_pop3_engine_iterate(store->engine, NULL) > 0)
- ;
- camel_pop3_engine_command_free(store->engine, pc);
-
+ camel_pop3_command (store, NULL, ex, "QUIT");
camel_service_disconnect (CAMEL_SERVICE (store), FALSE, ex);
}
-static int
-try_sasl(CamelPOP3Store *store, const char *mech, CamelException *ex)
-{
- CamelPOP3Stream *stream = store->engine->stream;
- unsigned char *line, *resp;
- CamelSasl *sasl;
- unsigned int len;
- int ret;
-
- sasl = camel_sasl_new("pop3", mech, (CamelService *)store);
- if (sasl == NULL) {
- camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
- _("Unable to connect to POP server.\n"
- "No support for requested "
- "authentication mechanism."));
- return -1;
- }
-
- if (camel_stream_printf((CamelStream *)stream, "AUTH %s\r\n", mech) == -1)
- goto ioerror;
-
- while (1) {
- if (camel_pop3_stream_line(stream, &line, &len) == -1)
- goto ioerror;
- if (strncmp(line, "+OK", 3) == 0)
- break;
- if (strncmp(line, "-ERR", 4) == 0) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
- _("SASL `%s' Login failed: %s"), mech, line);
- goto done;
- }
- /* If we dont get continuation, or the sasl object's run out of work, or we dont get a challenge,
- its a protocol error, so fail, and try reset the server */
- if (strncmp(line, "+ ", 2) != 0
- || camel_sasl_authenticated(sasl)
- || (resp = camel_sasl_challenge_base64(sasl, line+2, ex)) == NULL) {
- camel_stream_printf((CamelStream *)stream, "*\r\n");
- camel_pop3_stream_line(stream, &line, &len);
- camel_exception_setv(ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
- _("SASL Protocol error"));
- goto done;
- }
-
- ret = camel_stream_printf((CamelStream *)stream, "%s\r\n", resp);
- g_free(resp);
- if (ret == -1)
- goto ioerror;
-
- }
- camel_object_unref((CamelObject *)sasl);
- return 0;
-
-ioerror:
- camel_exception_setv(ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
- _("I/O Error: %s"), strerror(errno));
-done:
- camel_object_unref((CamelObject *)sasl);
- return -1;
-}
static gboolean
pop3_try_authenticate (CamelService *service, const char *errmsg,
CamelException *ex)
{
- CamelPOP3Store *store = (CamelPOP3Store *)service;
+ CamelPop3Store *store = (CamelPop3Store *)service;
int status;
- CamelPOP3Command *pcu = NULL, *pcp = NULL;
-
- /* override, testing only */
- /*printf("Forcing authmech to 'login'\n");
- service->url->authmech = g_strdup("LOGIN");*/
-
+ char *msg;
+
+ /* The KPOP code will have set the password to be the username
+ * in connect_to_server. Password and APOP are the only other
+ * cases, and they both need a password. So if there's no
+ * password stored, query for it.
+ */
if (!service->url->passwd) {
char *prompt;
- prompt = g_strdup_printf (_("%sPlease enter the POP password for %s@%s"),
- errmsg ? errmsg : "",
+ prompt = g_strdup_printf (_("%sPlease enter the POP3 password "
+ "for %s@%s"), errmsg ? errmsg : "",
service->url->user,
service->url->host);
service->url->passwd = camel_session_get_password (camel_service_get_session (service),
@@ -459,56 +367,59 @@ pop3_try_authenticate (CamelService *service, const char *errmsg,
if (!service->url->passwd)
return FALSE;
}
-
- if (!service->url->authmech) {
- /* pop engine will take care of pipelining ability */
- pcu = camel_pop3_engine_command_new(store->engine, 0, NULL, NULL, "USER %s\r\n", service->url->user);
- pcp = camel_pop3_engine_command_new(store->engine, 0, NULL, NULL, "PASS %s\r\n", service->url->passwd);
- } else if (strcmp(service->url->authmech, "+APOP") == 0 && store->engine->apop) {
+
+ if (!service->url->authmech || !strcmp (service->url->authmech, "+KPOP")) {
+ status = camel_pop3_command (store, &msg, ex, "USER %s",
+ service->url->user);
+ switch (status) {
+ case CAMEL_POP3_ERR:
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
+ _("Unable to connect to POP "
+ "server.\nError sending "
+ "username: %s"),
+ msg ? msg : _("(Unknown)"));
+ g_free (msg);
+ /*fallll*/
+ case CAMEL_POP3_FAIL:
+ return FALSE;
+ }
+ g_free (msg);
+
+ status = camel_pop3_command (store, &msg, ex, "PASS %s",
+ service->url->passwd);
+ } else if (!strcmp (service->url->authmech, "+APOP")
+ && store->apop_timestamp) {
char *secret, md5asc[33], *d;
unsigned char md5sum[16], *s;
- secret = alloca(strlen(store->engine->apop)+strlen(service->url->passwd)+1);
- sprintf(secret, "%s%s", store->engine->apop, service->url->passwd);
- md5_get_digest(secret, strlen (secret), md5sum);
-
+ secret = g_strdup_printf ("%s%s", store->apop_timestamp,
+ service->url->passwd);
+ md5_get_digest (secret, strlen (secret), md5sum);
+ g_free (secret);
+
for (s = md5sum, d = md5asc; d < md5asc + 32; s++, d += 2)
sprintf (d, "%.2x", *s);
- pcp = camel_pop3_engine_command_new(store->engine, 0, NULL, NULL, "APOP %s %s\r\n", service->url->user, md5asc);
+ status = camel_pop3_command (store, &msg, ex, "APOP %s %s",
+ service->url->user, md5asc);
} else {
- CamelServiceAuthType *auth;
- GList *l;
-
- l = store->engine->auth;
- while (l) {
- auth = l->data;
- if (strcmp(auth->authproto, service->url->authmech) == 0)
- return try_sasl(store, service->url->authmech, ex) == -1;
- l = l->next;
- }
-
camel_exception_set (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
_("Unable to connect to POP server.\n"
"No support for requested "
"authentication mechanism."));
return FALSE;
}
-
- while (camel_pop3_engine_iterate(store->engine, pcp) > 0)
- ;
- status = pcp->state != CAMEL_POP3_COMMAND_OK;
- if (status) {
- camel_exception_setv(ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
- _("Unable to connect to POP server.\nError sending password: %s"),
- store->engine->line);
+
+ if (status == CAMEL_POP3_ERR) {
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
+ _("Unable to connect to POP server.\n"
+ "Error sending password: %s"),
+ msg ? msg : _("(Unknown)"));
}
- camel_pop3_engine_command_free(store->engine, pcp);
-
- if (pcu)
- camel_pop3_engine_command_free(store->engine, pcu);
-
- return status;
+
+ g_free (msg);
+
+ return status == CAMEL_POP3_ERR;
}
static gboolean
@@ -516,24 +427,8 @@ pop3_connect (CamelService *service, CamelException *ex)
{
char *errbuf = NULL;
gboolean tryagain;
- CamelPOP3Store *store = (CamelPOP3Store *)service;
-
- if (store->cache == NULL) {
- char *root;
-
- root = camel_session_get_storage_path(service->session, service, ex);
- if (root) {
- store->cache = camel_data_cache_new(root, 0, ex);
- g_free(root);
- if (store->cache) {
- /* Default cache expiry - 1 week or not visited in a day */
- camel_data_cache_set_expire_age(store->cache, 60*60*24*7);
- camel_data_cache_set_expire_access(store->cache, 60*60*24);
- }
- }
- }
- if (!connect_to_server_wrapper (service, ex))
+ if (!connect_to_server (service, ex))
return FALSE;
camel_exception_clear (ex);
@@ -565,30 +460,22 @@ pop3_connect (CamelService *service, CamelException *ex)
static gboolean
pop3_disconnect (CamelService *service, gboolean clean, CamelException *ex)
{
- CamelPOP3Store *store = CAMEL_POP3_STORE (service);
+ CamelPop3Store *store = CAMEL_POP3_STORE (service);
- if (clean) {
- CamelPOP3Command *pc;
-
- pc = camel_pop3_engine_command_new(store->engine, 0, NULL, NULL, "QUIT\r\n");
- while (camel_pop3_engine_iterate(store->engine, NULL) > 0)
- ;
- camel_pop3_engine_command_free(store->engine, pc);
- }
+ if (clean)
+ camel_pop3_command (store, NULL, ex, "QUIT");
if (!CAMEL_SERVICE_CLASS (parent_class)->disconnect (service, clean, ex))
return FALSE;
- camel_object_unref((CamelObject *)store->engine);
- store->engine = NULL;
-
return TRUE;
}
static CamelFolder *
-get_folder (CamelStore *store, const char *folder_name, guint32 flags, CamelException *ex)
+get_folder (CamelStore *store, const char *folder_name,
+ guint32 flags, CamelException *ex)
{
- if (strcasecmp (folder_name, "inbox") != 0) {
+ if (g_strcasecmp (folder_name, "inbox") != 0) {
camel_exception_setv (ex, CAMEL_EXCEPTION_FOLDER_INVALID,
_("No such folder `%s'."), folder_name);
return NULL;
@@ -609,3 +496,155 @@ get_trash (CamelStore *store, CamelException *ex)
/* no-op */
return NULL;
}
+
+
+/**
+ * camel_pop3_command: Send a command to a POP3 server.
+ * @store: the POP3 store
+ * @ret: a pointer to return the full server response in
+ * @fmt: a printf-style format string, followed by arguments
+ *
+ * This command sends the command specified by @fmt and the following
+ * arguments to the connected POP3 store specified by @store. It then
+ * reads the server's response and parses out the status code. If
+ * the caller passed a non-NULL pointer for @ret, camel_pop3_command
+ * will set it to point to an buffer containing the rest of the
+ * response from the POP3 server. (If @ret was passed but there was
+ * no extended response, @ret will be set to NULL.) The caller must
+ * free this buffer when it is done with it.
+ *
+ * Return value: one of CAMEL_POP3_OK (command executed successfully),
+ * CAMEL_POP3_ERR (command encounted an error), or CAMEL_POP3_FAIL
+ * (a protocol-level error occurred, and Camel is uncertain of the
+ * result of the command.) @ex will be set if the return value is
+ * CAMEL_POP3_FAIL, but *NOT* if it is CAMEL_POP3_ERR.
+ **/
+int
+camel_pop3_command (CamelPop3Store *store, char **ret, CamelException *ex, char *fmt, ...)
+{
+ char *cmdbuf;
+ va_list ap;
+
+ va_start (ap, fmt);
+ cmdbuf = g_strdup_vprintf (fmt, ap);
+ va_end (ap);
+
+ /* Send the command */
+ if (camel_remote_store_send_string (CAMEL_REMOTE_STORE (store), ex, "%s\r\n", cmdbuf) < 0) {
+ g_free (cmdbuf);
+ if (ret)
+ *ret = NULL;
+ return CAMEL_POP3_FAIL;
+ }
+ g_free (cmdbuf);
+
+ return pop3_get_response (store, ret, ex);
+}
+
+static int
+pop3_get_response (CamelPop3Store *store, char **ret, CamelException *ex)
+{
+ char *respbuf;
+ int status;
+
+ if (camel_remote_store_recv_line (CAMEL_REMOTE_STORE (store), &respbuf, ex) < 0) {
+ if (ret)
+ *ret = NULL;
+ return CAMEL_POP3_FAIL;
+ }
+
+ if (!strncmp (respbuf, "+OK", 3))
+ status = CAMEL_POP3_OK;
+ else if (!strncmp (respbuf, "-ERR", 4))
+ status = CAMEL_POP3_ERR;
+ else {
+ status = CAMEL_POP3_FAIL;
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
+ _("Unexpected response from POP server: %s"),
+ respbuf);
+ }
+
+ if (ret) {
+ if (status != CAMEL_POP3_FAIL) {
+ *ret = strchr (respbuf, ' ');
+ if (*ret)
+ *ret = g_strdup (*ret + 1);
+ } else
+ *ret = NULL;
+ }
+ g_free (respbuf);
+
+ return status;
+}
+
+/**
+ * camel_pop3_command_get_additional_data: get "additional data" from
+ * a POP3 command.
+ * @store: the POP3 store
+ * @total: Total bytes expected (for progress reporting), use 0 for 'unknown'.
+ *
+ * This command gets the additional data returned by "multi-line" POP
+ * commands, such as LIST, RETR, TOP, and UIDL. This command _must_
+ * be called after a successful (CAMEL_POP3_OK) call to
+ * camel_pop3_command for a command that has a multi-line response.
+ * The returned data is un-byte-stuffed, and has lines termined by
+ * newlines rather than CR/LF pairs.
+ *
+ * Return value: the data, which the caller must free.
+ **/
+char *
+camel_pop3_command_get_additional_data (CamelPop3Store *store, int total, CamelException *ex)
+{
+ GPtrArray *data;
+ char *buf, *p;
+ int i, len = 0, status = CAMEL_POP3_OK;
+ int pc = 0;
+
+ data = g_ptr_array_new ();
+ while (1) {
+ if (camel_remote_store_recv_line (CAMEL_REMOTE_STORE (store), &buf, ex) < 0) {
+ status = CAMEL_POP3_FAIL;
+ break;
+ }
+
+ if (!strcmp (buf, "."))
+ break;
+
+ g_ptr_array_add (data, buf);
+ len += strlen (buf) + 1;
+
+ if (total) {
+ pc = (len+1) * 100 / total;
+ camel_operation_progress(NULL, pc);
+ } else {
+ camel_operation_progress_count(NULL, len);
+ }
+ }
+
+ if (buf)
+ g_free (buf);
+
+ if (status == CAMEL_POP3_OK) {
+ buf = g_malloc0 (len + 1);
+
+ for (i = 0, p = buf; i < data->len; i++) {
+ char *ptr, *datap;
+
+ datap = (char *) data->pdata[i];
+ ptr = (*datap == '.') ? datap + 1 : datap;
+ len = strlen (ptr);
+ memcpy (p, ptr, len);
+ p += len;
+ *p++ = '\n';
+ }
+ *p = '\0';
+ } else
+ buf = NULL;
+
+ for (i = 0; i < data->len; i++)
+ g_free (data->pdata[i]);
+ g_ptr_array_free (data, TRUE);
+
+ return buf;
+}
+
diff --git a/camel/providers/sendmail/Makefile.am b/camel/providers/sendmail/Makefile.am
index 57834b9853..a6aeb09bf2 100644
--- a/camel/providers/sendmail/Makefile.am
+++ b/camel/providers/sendmail/Makefile.am
@@ -24,6 +24,6 @@ libcamelsendmail_la_SOURCES = \
libcamelsendmailinclude_HEADERS = \
camel-sendmail-transport.h
-libcamelsendmail_la_LDFLAGS = -avoid-version -module
+libcamelsendmail_la_LDFLAGS = -version-info 0:0:0
EXTRA_DIST = libcamelsendmail.urls
diff --git a/camel/providers/smtp/Makefile.am b/camel/providers/smtp/Makefile.am
index f70f19e56a..8bc666f1aa 100644
--- a/camel/providers/smtp/Makefile.am
+++ b/camel/providers/smtp/Makefile.am
@@ -29,7 +29,7 @@ libcamelsmtpinclude_HEADERS = \
camel-smtp-transport.h
-libcamelsmtp_la_LDFLAGS = -avoid-version -module
+libcamelsmtp_la_LDFLAGS = -version-info 0:0:0
libcamelsmtp_la_LIBADD = $(top_builddir)/e-util/libeutil.la
diff --git a/camel/providers/smtp/camel-smtp-transport.c b/camel/providers/smtp/camel-smtp-transport.c
index 2a5640d7ab..78509fad28 100644
--- a/camel/providers/smtp/camel-smtp-transport.c
+++ b/camel/providers/smtp/camel-smtp-transport.c
@@ -49,8 +49,12 @@
#include "camel-stream-buffer.h"
#include "camel-tcp-stream.h"
#include "camel-tcp-stream-raw.h"
-#ifdef HAVE_SSL
+#ifdef HAVE_NSS
#include "camel-tcp-stream-ssl.h"
+#include <prnetdb.h>
+#endif
+#ifdef HAVE_OPENSSL
+#include "camel-tcp-stream-openssl.h"
#endif
#include "camel-session.h"
#include "camel-exception.h"
@@ -63,8 +67,9 @@
#define SMTP_PORT 25
/* camel smtp transport class prototypes */
-static gboolean smtp_send_to (CamelTransport *transport, CamelMimeMessage *message,
- CamelAddress *from, CamelAddress *recipients, CamelException *ex);
+static gboolean smtp_can_send (CamelTransport *transport, CamelMedium *message);
+static gboolean smtp_send (CamelTransport *transport, CamelMedium *message, CamelException *ex);
+static gboolean smtp_send_to (CamelTransport *transport, CamelMedium *message, GList *recipients, CamelException *ex);
/* support prototypes */
static void smtp_construct (CamelService *service, CamelSession *session,
@@ -72,7 +77,7 @@ static void smtp_construct (CamelService *service, CamelSession *session,
CamelException *ex);
static gboolean smtp_connect (CamelService *service, CamelException *ex);
static gboolean smtp_disconnect (CamelService *service, gboolean clean, CamelException *ex);
-static GHashTable *esmtp_get_authtypes (const unsigned char *buffer);
+static GHashTable *esmtp_get_authtypes (gchar *buffer);
static GList *query_auth_types (CamelService *service, CamelException *ex);
static char *get_name (CamelService *service, gboolean brief);
@@ -81,14 +86,11 @@ static gboolean smtp_auth (CamelSmtpTransport *transport, const char *mech, Came
static gboolean smtp_mail (CamelSmtpTransport *transport, const char *sender,
gboolean has_8bit_parts, CamelException *ex);
static gboolean smtp_rcpt (CamelSmtpTransport *transport, const char *recipient, CamelException *ex);
-static gboolean smtp_data (CamelSmtpTransport *transport, CamelMimeMessage *message,
+static gboolean smtp_data (CamelSmtpTransport *transport, CamelMedium *message,
gboolean has_8bit_parts, CamelException *ex);
static gboolean smtp_rset (CamelSmtpTransport *transport, CamelException *ex);
static gboolean smtp_quit (CamelSmtpTransport *transport, CamelException *ex);
-static void smtp_set_exception (CamelSmtpTransport *transport, const char *respbuf,
- const char *message, CamelException *ex);
-
/* private data members */
static CamelTransportClass *parent_class = NULL;
@@ -109,24 +111,26 @@ camel_smtp_transport_class_init (CamelSmtpTransportClass *camel_smtp_transport_c
camel_service_class->query_auth_types = query_auth_types;
camel_service_class->get_name = get_name;
+ camel_transport_class->can_send = smtp_can_send;
+ camel_transport_class->send = smtp_send;
camel_transport_class->send_to = smtp_send_to;
}
static void
camel_smtp_transport_init (gpointer object)
{
- CamelSmtpTransport *smtp = CAMEL_SMTP_TRANSPORT (object);
+ CamelTransport *transport = CAMEL_TRANSPORT (object);
- smtp->flags = 0;
+ transport->supports_8bit = FALSE;
}
CamelType
camel_smtp_transport_get_type (void)
{
- static CamelType type = CAMEL_INVALID_TYPE;
+ static CamelType camel_smtp_transport_type = CAMEL_INVALID_TYPE;
- if (type == CAMEL_INVALID_TYPE) {
- type =
+ if (camel_smtp_transport_type == CAMEL_INVALID_TYPE) {
+ camel_smtp_transport_type =
camel_type_register (CAMEL_TRANSPORT_TYPE,
"CamelSmtpTransport",
sizeof (CamelSmtpTransport),
@@ -137,7 +141,7 @@ camel_smtp_transport_get_type (void)
NULL);
}
- return type;
+ return camel_smtp_transport_type;
}
static void
@@ -146,21 +150,15 @@ smtp_construct (CamelService *service, CamelSession *session,
CamelException *ex)
{
CamelSmtpTransport *smtp_transport = CAMEL_SMTP_TRANSPORT (service);
- const char *use_ssl;
CAMEL_SERVICE_CLASS (parent_class)->construct (service, session, provider, url, ex);
- if ((use_ssl = camel_url_get_param (url, "use_ssl"))) {
- /* Note: previous versions would use "" to toggle use_ssl to 'on' */
- if (!*use_ssl || !strcmp (use_ssl, "always"))
- smtp_transport->flags |= CAMEL_SMTP_TRANSPORT_USE_SSL_ALWAYS;
- else if (!strcmp (use_ssl, "when-possible"))
- smtp_transport->flags |= CAMEL_SMTP_TRANSPORT_USE_SSL_WHEN_POSSIBLE;
- }
+ if (camel_url_get_param (url, "use_ssl"))
+ smtp_transport->use_ssl = TRUE;
}
static const char *
-smtp_error_string (int error)
+get_smtp_error_string (int error)
{
/* SMTP error codes grabbed from rfc821 */
switch (error) {
@@ -229,14 +227,15 @@ smtp_error_string (int error)
}
static gboolean
-connect_to_server (CamelService *service, int try_starttls, CamelException *ex)
+connect_to_server (CamelService *service, CamelException *ex)
{
CamelSmtpTransport *transport = CAMEL_SMTP_TRANSPORT (service);
CamelStream *tcp_stream;
- char *respbuf = NULL;
+ gchar *respbuf = NULL;
struct hostent *h;
+ guint32 addrlen;
int port, ret;
-
+
if (!CAMEL_SERVICE_CLASS (parent_class)->connect (service, ex))
return FALSE;
@@ -245,32 +244,30 @@ connect_to_server (CamelService *service, int try_starttls, CamelException *ex)
return FALSE;
/* set some smtp transport defaults */
- transport->flags &= ~(CAMEL_SMTP_TRANSPORT_IS_ESMTP |
- CAMEL_SMTP_TRANSPORT_8BITMIME |
- CAMEL_SMTP_TRANSPORT_STARTTLS |
- CAMEL_SMTP_TRANSPORT_ENHANCEDSTATUSCODES);
-
+ transport->is_esmtp = FALSE;
transport->authtypes = NULL;
+ CAMEL_TRANSPORT (transport)->supports_8bit = FALSE;
port = service->url->port ? service->url->port : SMTP_PORT;
-#ifdef HAVE_SSL
- if (transport->flags & CAMEL_SMTP_TRANSPORT_USE_SSL) {
- if (try_starttls)
- tcp_stream = camel_tcp_stream_ssl_new_raw (service, service->url->host);
- else {
- port = service->url->port ? service->url->port : 465;
- tcp_stream = camel_tcp_stream_ssl_new (service, service->url->host);
- }
+#if defined(HAVE_NSS) || defined(HAVE_OPENSSL)
+ if (transport->use_ssl) {
+ port = service->url->port ? service->url->port : 465;
+#ifdef HAVE_NSS
+ /* use the preferred implementation - NSS */
+ tcp_stream = camel_tcp_stream_ssl_new (service, service->url->host);
+#else
+ tcp_stream = camel_tcp_stream_openssl_new (service, service->url->host);
+#endif /* HAVE_NSS */
} else {
tcp_stream = camel_tcp_stream_raw_new ();
}
#else
tcp_stream = camel_tcp_stream_raw_new ();
-#endif /* HAVE_SSL */
+#endif /* HAVE_NSS || HAVE_OPENSSL */
ret = camel_tcp_stream_connect (CAMEL_TCP_STREAM (tcp_stream), h, port);
- camel_free_host (h);
+ camel_free_host(h);
if (ret == -1) {
camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_UNAVAILABLE,
_("Could not connect to %s (port %d): %s"),
@@ -281,7 +278,27 @@ connect_to_server (CamelService *service, int try_starttls, CamelException *ex)
}
/* get the localaddr - needed later by smtp_helo */
- transport->localaddr = camel_tcp_stream_get_local_address (CAMEL_TCP_STREAM (tcp_stream));
+ addrlen = sizeof (transport->localaddr);
+#ifdef HAVE_NSS
+ if (transport->use_ssl) {
+ PRFileDesc *sockfd = camel_tcp_stream_get_socket (CAMEL_TCP_STREAM (tcp_stream));
+ PRNetAddr addr;
+ char hname[1024];
+
+ PR_GetSockName (sockfd, &addr);
+ memset (hname, 0, sizeof (hname));
+ PR_NetAddrToString (&addr, hname, 1023);
+
+ inet_aton (hname, (struct in_addr *)&transport->localaddr.sin_addr);
+ } else {
+ int sockfd = GPOINTER_TO_INT (camel_tcp_stream_get_socket (CAMEL_TCP_STREAM (tcp_stream)));
+
+ getsockname (sockfd, (struct sockaddr *)&transport->localaddr, &addrlen);
+ }
+#else
+ getsockname (CAMEL_TCP_STREAM_RAW (tcp_stream)->sockfd,
+ (struct sockaddr *)&transport->localaddr, &addrlen);
+#endif /* HAVE_NSS */
transport->ostream = tcp_stream;
transport->istream = camel_stream_buffer_new (tcp_stream, CAMEL_STREAM_BUFFER_READ);
@@ -298,21 +315,21 @@ connect_to_server (CamelService *service, int try_starttls, CamelException *ex)
g_free (respbuf);
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
_("Welcome response error: %s: possibly non-fatal"),
- smtp_error_string (error));
+ get_smtp_error_string (error));
return FALSE;
}
if (strstr (respbuf, "ESMTP"))
- transport->flags |= CAMEL_SMTP_TRANSPORT_IS_ESMTP;
+ transport->is_esmtp = TRUE;
} while (*(respbuf+3) == '-'); /* if we got "220-" then loop again */
g_free (respbuf);
/* send HELO (or EHLO, depending on the service type) */
- if (!(transport->flags & CAMEL_SMTP_TRANSPORT_IS_ESMTP)) {
+ if (!transport->is_esmtp) {
/* If we did not auto-detect ESMTP, we should still send EHLO */
- transport->flags |= CAMEL_SMTP_TRANSPORT_IS_ESMTP;
+ transport->is_esmtp = TRUE;
if (!smtp_helo (transport, NULL)) {
/* Okay, apprently this server doesn't support ESMTP */
- transport->flags &= ~CAMEL_SMTP_TRANSPORT_IS_ESMTP;
+ transport->is_esmtp = FALSE;
smtp_helo (transport, ex);
}
} else {
@@ -320,102 +337,7 @@ connect_to_server (CamelService *service, int try_starttls, CamelException *ex)
smtp_helo (transport, ex);
}
-#ifdef HAVE_SSL
- if (transport->flags & CAMEL_SMTP_TRANSPORT_USE_SSL_WHEN_POSSIBLE) {
- /* try_starttls is always TRUE here */
- if (transport->flags & CAMEL_SMTP_TRANSPORT_STARTTLS)
- goto starttls;
- } else if (transport->flags & CAMEL_SMTP_TRANSPORT_USE_SSL_ALWAYS) {
- if (try_starttls) {
- if (transport->flags & CAMEL_SMTP_TRANSPORT_STARTTLS) {
- goto starttls;
- } else {
- /* server doesn't support STARTTLS, abort */
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Failed to connect to SMTP server %s in secure mode: %s"),
- service->url->host, _("server does not appear to support SSL"));
- goto exception_cleanup;
- }
- }
- }
-#endif /* HAVE_SSL */
-
return TRUE;
-
-#ifdef HAVE_SSL
- starttls:
- d(fprintf (stderr, "sending : STARTTLS\r\n"));
- if (camel_stream_write (tcp_stream, "STARTTLS\r\n", 10) == -1) {
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("STARTTLS request timed out: %s"),
- g_strerror (errno));
- goto exception_cleanup;
- }
-
- respbuf = NULL;
-
- do {
- /* Check for "220 Ready for TLS" */
- g_free (respbuf);
- respbuf = camel_stream_buffer_read_line (CAMEL_STREAM_BUFFER (transport->istream));
-
- d(fprintf (stderr, "received: %s\n", respbuf ? respbuf : "(null)"));
-
- if (!respbuf || strncmp (respbuf, "220", 3)) {
- smtp_set_exception (transport, respbuf, _("STARTTLS response error"), ex);
- g_free (respbuf);
- goto exception_cleanup;
- }
- } while (*(respbuf+3) == '-'); /* if we got "220-" then loop again */
-
- /* Okay, now toggle SSL/TLS mode */
- ret = camel_tcp_stream_ssl_enable_ssl (CAMEL_TCP_STREAM_SSL (tcp_stream));
- if (ret != -1)
- return TRUE;
-
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Failed to connect to SMTP server %s in secure mode: %s"),
- service->url->host, g_strerror (errno));
-
- exception_cleanup:
- camel_object_unref (CAMEL_OBJECT (transport->istream));
- transport->istream = NULL;
- camel_object_unref (CAMEL_OBJECT (transport->ostream));
- transport->ostream = NULL;
-
- return FALSE;
-#endif /* HAVE_SSL */
-}
-
-static gboolean
-connect_to_server_wrapper (CamelService *service, CamelException *ex)
-{
-#ifdef HAVE_SSL
- CamelSmtpTransport *transport = (CamelSmtpTransport *) service;
-
- if (transport->flags & CAMEL_SMTP_TRANSPORT_USE_SSL_ALWAYS) {
- /* First try connecting to the SSL port */
- if (!connect_to_server (service, FALSE, ex)) {
- if (camel_exception_get_id (ex) == CAMEL_EXCEPTION_SERVICE_UNAVAILABLE) {
- /* Seems the SSL port is unavailable, lets try STARTTLS */
- camel_exception_clear (ex);
- return connect_to_server (service, TRUE, ex);
- } else {
- return FALSE;
- }
- }
-
- return TRUE;
- } else if (transport->flags & CAMEL_SMTP_TRANSPORT_USE_SSL_WHEN_POSSIBLE) {
- /* If the server supports STARTTLS, use it */
- return connect_to_server (service, TRUE, ex);
- } else {
- /* User doesn't care about SSL */
- return connect_to_server (service, FALSE, ex);
- }
-#else
- return connect_to_server (service, FALSE, ex);
-#endif
}
static gboolean
@@ -439,10 +361,10 @@ smtp_connect (CamelService *service, CamelException *ex)
if (!truth)
return FALSE;
- return connect_to_server_wrapper (service, ex);
+ return connect_to_server (service, ex);
}
- if (!connect_to_server_wrapper (service, ex))
+ if (!connect_to_server (service, ex))
return FALSE;
/* check to see if AUTH is required, if so...then AUTH ourselves */
@@ -452,8 +374,7 @@ smtp_connect (CamelService *service, CamelException *ex)
gboolean authenticated = FALSE;
char *errbuf = NULL;
- if (!(transport->flags & CAMEL_SMTP_TRANSPORT_IS_ESMTP) ||
- !g_hash_table_lookup (transport->authtypes, service->url->authmech)) {
+ if (!transport->is_esmtp || !g_hash_table_lookup (transport->authtypes, service->url->authmech)) {
camel_exception_setv (ex, CAMEL_EXCEPTION_SERVICE_CANT_AUTHENTICATE,
_("SMTP server %s does not support requested "
"authentication type %s"), service->url->host,
@@ -534,6 +455,7 @@ smtp_connect (CamelService *service, CamelException *ex)
static gboolean
authtypes_free (gpointer key, gpointer value, gpointer data)
{
+ g_free (key);
g_free (value);
return TRUE;
@@ -564,28 +486,23 @@ smtp_disconnect (CamelService *service, gboolean clean, CamelException *ex)
camel_object_unref (CAMEL_OBJECT (transport->ostream));
camel_object_unref (CAMEL_OBJECT (transport->istream));
+
transport->ostream = NULL;
transport->istream = NULL;
-
- camel_tcp_address_free (transport->localaddr);
- transport->localaddr = NULL;
return TRUE;
}
static GHashTable *
-esmtp_get_authtypes (const unsigned char *buffer)
+esmtp_get_authtypes (char *buffer)
{
- const unsigned char *start, *end;
GHashTable *table = NULL;
+ gchar *start, *end;
/* advance to the first token */
- start = buffer;
- while (isspace ((int) *start) || *start == '=')
- start++;
+ for (start = buffer; isspace (*start) || *start == '='; start++);
- if (!*start)
- return NULL;
+ if (!*start) return NULL;
table = g_hash_table_new (g_str_hash, g_str_equal);
@@ -593,17 +510,13 @@ esmtp_get_authtypes (const unsigned char *buffer)
char *type;
/* advance to the end of the token */
- end = start;
- while (*end && !isspace ((int) *end))
- end++;
+ for (end = start; *end && !isspace (*end); end++);
type = g_strndup (start, end - start);
- g_hash_table_insert (table, type, type);
+ g_hash_table_insert (table, g_strdup (type), type);
/* advance to the next token */
- start = end;
- while (isspace ((int) *start))
- start++;
+ for (start = end; isspace (*start); start++);
}
return table;
@@ -616,7 +529,7 @@ query_auth_types (CamelService *service, CamelException *ex)
CamelServiceAuthType *authtype;
GList *types, *t, *next;
- if (!connect_to_server_wrapper (service, ex))
+ if (!connect_to_server (service, ex))
return NULL;
types = g_list_copy (service->provider->authtypes);
@@ -631,7 +544,6 @@ query_auth_types (CamelService *service, CamelException *ex)
}
smtp_disconnect (service, TRUE, NULL);
-
return types;
}
@@ -647,17 +559,31 @@ get_name (CamelService *service, gboolean brief)
}
static gboolean
-smtp_send_to (CamelTransport *transport, CamelMimeMessage *message,
- CamelAddress *from, CamelAddress *recipients,
- CamelException *ex)
+smtp_can_send (CamelTransport *transport, CamelMedium *message)
+{
+ return CAMEL_IS_MIME_MESSAGE (message);
+}
+
+static gboolean
+smtp_send_to (CamelTransport *transport, CamelMedium *message,
+ GList *recipients, CamelException *ex)
{
CamelSmtpTransport *smtp_transport = CAMEL_SMTP_TRANSPORT (transport);
const CamelInternetAddress *cia;
- gboolean has_8bit_parts;
+ char *recipient;
const char *addr;
- int i, len;
+ gboolean has_8bit_parts;
+ GList *r;
- if (!camel_internet_address_get (CAMEL_INTERNET_ADDRESS (from), 0, NULL, &addr)) {
+ cia = camel_mime_message_get_from (CAMEL_MIME_MESSAGE (message));
+ if (!cia) {
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
+ _("Cannot send message: "
+ "sender address not defined."));
+ return FALSE;
+ }
+
+ if (!camel_internet_address_get (cia, 0, NULL, &addr)) {
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
_("Cannot send message: "
"sender address not valid."));
@@ -667,7 +593,7 @@ smtp_send_to (CamelTransport *transport, CamelMimeMessage *message,
camel_operation_start (NULL, _("Sending message"));
/* find out if the message has 8bit mime parts */
- has_8bit_parts = camel_mime_message_has_8bit_parts (message);
+ has_8bit_parts = camel_mime_message_has_8bit_parts (CAMEL_MIME_MESSAGE (message));
/* rfc1652 (8BITMIME) requires that you notify the ESMTP daemon that
you'll be sending an 8bit mime message at "MAIL FROM:" time. */
@@ -675,25 +601,20 @@ smtp_send_to (CamelTransport *transport, CamelMimeMessage *message,
if (!recipients) {
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Cannot send message: no recipients defined."));
- camel_operation_end (NULL);
+ _("Cannot send message: "
+ "no recipients defined."));
+ camel_operation_end(NULL);
return FALSE;
}
- len = camel_address_length (recipients);
- cia = CAMEL_INTERNET_ADDRESS (recipients);
- for (i = 0; i < len; i++) {
- if (!camel_internet_address_get (cia, i, NULL, &addr)) {
- camel_exception_set (ex, CAMEL_EXCEPTION_SYSTEM,
- _("Cannot send message: one or more invalid recipients"));
- camel_operation_end (NULL);
- return FALSE;
- }
-
- if (!smtp_rcpt (smtp_transport, addr, ex)) {
+ for (r = recipients; r; r = r->next) {
+ recipient = (char *) r->data;
+ if (!smtp_rcpt (smtp_transport, recipient, ex)) {
+ g_free (recipient);
camel_operation_end (NULL);
return FALSE;
}
+ g_free (recipient);
}
/* passing in has_8bit_parts saves time as we don't have to
@@ -712,156 +633,72 @@ smtp_send_to (CamelTransport *transport, CamelMimeMessage *message,
return TRUE;
}
-static const char *
-smtp_next_token (const char *buf)
-{
- const unsigned char *token;
-
- token = (const unsigned char *) buf;
- while (*token && !isspace ((int) *token))
- token++;
-
- while (*token && isspace ((int) *token))
- token++;
-
- return (const char *) token;
-}
-
-#define HEXVAL(c) (isdigit (c) ? (c) - '0' : (c) - 'A' + 10)
-
-/**
- * example (rfc2034):
- * 5.1.1 Mailbox "nosuchuser" does not exist
- *
- * The human-readable status code is what we want. Since this text
- * could possibly be encoded, we must decode it.
- *
- * "xtext" is formally defined as follows:
- *
- * xtext = *( xchar / hexchar / linear-white-space / comment )
- *
- * xchar = any ASCII CHAR between "!" (33) and "~" (126) inclusive,
- * except for "+", "\" and "(".
- *
- * "hexchar"s are intended to encode octets that cannot be represented
- * as plain text, either because they are reserved, or because they are
- * non-printable. However, any octet value may be represented by a
- * "hexchar".
- *
- * hexchar = ASCII "+" immediately followed by two upper case
- * hexadecimal digits
- **/
-static char *
-smtp_decode_status_code (const char *in, size_t len)
+static gboolean
+smtp_send (CamelTransport *transport, CamelMedium *message, CamelException *ex)
{
- unsigned char *inptr, *outptr;
- const unsigned char *inend;
- char *outbuf;
-
- outptr = outbuf = g_malloc (len + 1);
-
- inptr = (unsigned char *) in;
- inend = inptr + len;
- while (inptr < inend) {
- if (*inptr == '+') {
- if (isxdigit (inptr[1]) && isxdigit (inptr[2])) {
- *outptr++ = HEXVAL (inptr[1]) * 16 + HEXVAL (inptr[2]);
- inptr += 3;
- } else
- *outptr++ = *inptr++;
- } else
- *outptr++ = *inptr++;
+ const CamelInternetAddress *to, *cc, *bcc;
+ GList *recipients = NULL;
+ guint index, len;
+
+ to = camel_mime_message_get_recipients (CAMEL_MIME_MESSAGE (message), CAMEL_RECIPIENT_TYPE_TO);
+ cc = camel_mime_message_get_recipients (CAMEL_MIME_MESSAGE (message), CAMEL_RECIPIENT_TYPE_CC);
+ bcc = camel_mime_message_get_recipients (CAMEL_MIME_MESSAGE (message), CAMEL_RECIPIENT_TYPE_BCC);
+
+ /* get all of the To addresses into our recipient list */
+ len = camel_address_length (CAMEL_ADDRESS (to));
+ for (index = 0; index < len; index++) {
+ const char *addr;
+
+ if (camel_internet_address_get (to, index, NULL, &addr))
+ recipients = g_list_append (recipients, g_strdup (addr));
}
- *outptr = '\0';
-
- return outbuf;
-}
-
-static void
-smtp_set_exception (CamelSmtpTransport *transport, const char *respbuf, const char *message, CamelException *ex)
-{
- const char *token, *rbuf = respbuf;
- char *buffer = NULL;
- GString *string;
- int error;
-
- if (!respbuf || !(transport->flags & CAMEL_SMTP_TRANSPORT_ENHANCEDSTATUSCODES)) {
- fake_status_code:
- error = respbuf ? atoi (respbuf) : 0;
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- "%s: %s", message,
- smtp_error_string (error));
- } else {
- string = g_string_new ("");
- do {
- token = smtp_next_token (rbuf + 4);
- if (*token == '\0') {
- g_free (buffer);
- g_string_free (string, TRUE);
- goto fake_status_code;
- }
-
- g_string_append (string, token);
- if (*(rbuf + 3) == '-') {
- g_free (buffer);
- buffer = camel_stream_buffer_read_line (CAMEL_STREAM_BUFFER (transport->istream));
- } else {
- g_free (buffer);
- buffer = NULL;
- }
-
- rbuf = buffer;
- } while (rbuf);
-
- buffer = smtp_decode_status_code (string->str, string->len);
- g_string_free (string, TRUE);
- if (!buffer)
- goto fake_status_code;
+ /* get all of the Cc addresses into our recipient list */
+ len = camel_address_length (CAMEL_ADDRESS (cc));
+ for (index = 0; index < len; index++) {
+ const char *addr;
- camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
- "%s: %s", message, buffer);
+ if (camel_internet_address_get (cc, index, NULL, &addr))
+ recipients = g_list_append (recipients, g_strdup (addr));
+ }
+
+ /* get all of the Bcc addresses into our recipient list */
+ len = camel_address_length (CAMEL_ADDRESS (bcc));
+ for (index = 0; index < len; index++) {
+ const char *addr;
- g_free (buffer);
+ if (camel_internet_address_get (bcc, index, NULL, &addr))
+ recipients = g_list_append (recipients, g_strdup (addr));
}
+
+ return smtp_send_to (transport, message, recipients, ex);
}
static gboolean
smtp_helo (CamelSmtpTransport *transport, CamelException *ex)
{
/* say hello to the server */
- char *name, *cmdbuf, *respbuf = NULL;
+ gchar *cmdbuf, *respbuf = NULL;
struct hostent *host;
- CamelException err;
- const char *token;
camel_operation_start_transient (NULL, _("SMTP Greeting"));
/* get the local host name */
- camel_exception_init (&err);
- host = camel_gethostbyaddr ((char *) &transport->localaddr->address,
- transport->localaddr->length, AF_INET, &err);
- camel_exception_clear (&err);
+ host = gethostbyaddr ((gchar *)&transport->localaddr.sin_addr, sizeof (transport->localaddr.sin_addr), AF_INET);
- if (host && host->h_name) {
- name = g_strdup (host->h_name);
+ /* hiya server! how are you today? */
+ if (transport->is_esmtp) {
+ if (host && host->h_name)
+ cmdbuf = g_strdup_printf ("EHLO %s\r\n", host->h_name);
+ else
+ cmdbuf = g_strdup_printf ("EHLO [%s]\r\n", inet_ntoa (transport->localaddr.sin_addr));
} else {
- name = g_strdup_printf ("[%d.%d.%d.%d]",
- transport->localaddr->address[0],
- transport->localaddr->address[1],
- transport->localaddr->address[2],
- transport->localaddr->address[3]);
+ if (host && host->h_name)
+ cmdbuf = g_strdup_printf ("HELO %s\r\n", host->h_name);
+ else
+ cmdbuf = g_strdup_printf ("HELO [%s]\r\n", inet_ntoa (transport->localaddr.sin_addr));
}
- camel_free_host (host);
-
- /* hiya server! how are you today? */
- if (transport->flags & CAMEL_SMTP_TRANSPORT_IS_ESMTP)
- cmdbuf = g_strdup_printf ("EHLO %s\r\n", name);
- else
- cmdbuf = g_strdup_printf ("HELO %s\r\n", name);
- g_free (name);
-
d(fprintf (stderr, "sending : %s", cmdbuf));
if (camel_stream_write (transport->ostream, cmdbuf, strlen (cmdbuf)) == -1) {
g_free (cmdbuf);
@@ -887,37 +724,22 @@ smtp_helo (CamelSmtpTransport *transport, CamelException *ex)
g_free (respbuf);
camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
_("HELO response error: %s: non-fatal"),
- smtp_error_string (error));
+ get_smtp_error_string (error));
camel_operation_end (NULL);
return FALSE;
}
- token = respbuf + 4;
+ if (strstrcase (respbuf, "8BITMIME")) {
+ d(fprintf (stderr, "This server supports 8bit MIME\n"));
+ CAMEL_TRANSPORT (transport)->supports_8bit = TRUE;
+ }
- if (transport->flags & CAMEL_SMTP_TRANSPORT_IS_ESMTP) {
- if (!strncmp (token, "8BITMIME", 8)) {
- d(fprintf (stderr, "This server supports 8bit MIME\n"));
- transport->flags |= CAMEL_SMTP_TRANSPORT_8BITMIME;
- } else if (!strncmp (token, "ENHANCEDSTATUSCODES", 19)) {
- d(fprintf (stderr, "This server supports enhanced status codes\n"));
- transport->flags |= CAMEL_SMTP_TRANSPORT_ENHANCEDSTATUSCODES;
- } else if (!strncmp (token, "STARTTLS", 8)) {
- d(fprintf (stderr, "This server supports STARTTLS\n"));
- transport->flags |= CAMEL_SMTP_TRANSPORT_STARTTLS;
- } else if (!transport->authtypes && !strncmp (token, "AUTH", 4)) {
- /* Don't bother parsing any authtypes if we already have a list.
- * Some servers will list AUTH twice, once the standard way and
- * once the way Microsoft Outlook requires them to be:
- *
- * 250-AUTH LOGIN PLAIN DIGEST-MD5 CRAM-MD5
- * 250-AUTH=LOGIN PLAIN DIGEST-MD5 CRAM-MD5
- **/
-
- /* parse for supported AUTH types */
- token += 5;
-
- transport->authtypes = esmtp_get_authtypes (token);
- }
+ /* Only parse authtypes if we don't already have them */
+ if (transport->is_esmtp && strstr (respbuf, "AUTH") && !transport->authtypes) {
+ /* parse for supported AUTH types */
+ char *auths = strstr (respbuf, "AUTH") + 4;
+
+ transport->authtypes = esmtp_get_authtypes (auths);
}
} while (*(respbuf+3) == '-'); /* if we got "250-" then loop again */
g_free (respbuf);
@@ -930,8 +752,7 @@ smtp_helo (CamelSmtpTransport *transport, CamelException *ex)
static gboolean
smtp_auth (CamelSmtpTransport *transport, const char *mech, CamelException *ex)
{
- char *cmdbuf, *respbuf = NULL, *challenge;
- gboolean auth_challenge = FALSE;
+ gchar *cmdbuf, *respbuf = NULL, *challenge;
CamelSasl *sasl = NULL;
camel_operation_start_transient (NULL, _("SMTP Authentication"));
@@ -946,12 +767,10 @@ smtp_auth (CamelSmtpTransport *transport, const char *mech, CamelException *ex)
challenge = camel_sasl_challenge_base64 (sasl, NULL, ex);
if (challenge) {
- auth_challenge = TRUE;
cmdbuf = g_strdup_printf ("AUTH %s %s\r\n", mech, challenge);
g_free (challenge);
- } else {
+ } else
cmdbuf = g_strdup_printf ("AUTH %s\r\n", mech);
- }
d(fprintf (stderr, "sending : %s", cmdbuf));
if (camel_stream_write (transport->ostream, cmdbuf, strlen (cmdbuf)) == -1) {
@@ -982,15 +801,6 @@ smtp_auth (CamelSmtpTransport *transport, const char *mech, CamelException *ex)
goto lose;
}
- if (FALSE) {
- broken_smtp_server:
- d(fprintf (stderr, "Your SMTP server's implementation of the %s SASL\n"
- "authentication mechanism is broken. Please report this to the\n"
- "appropriate vendor and suggest that they re-read rfc2222 again\n"
- "for the first time (specifically Section 4, paragraph 2).\n",
- mech));
- }
-
/* eat whtspc */
for (challenge = respbuf + 4; isspace (*challenge); challenge++);
@@ -1016,10 +826,6 @@ smtp_auth (CamelSmtpTransport *transport, const char *mech, CamelException *ex)
/* check that the server says we are authenticated */
if (!respbuf || strncmp (respbuf, "235", 3)) {
- if (respbuf && auth_challenge && !strncmp (respbuf, "334", 3)) {
- /* broken server, but lets try and work around it anyway... */
- goto broken_smtp_server;
- }
g_free (respbuf);
goto lose;
}
@@ -1052,10 +858,10 @@ static gboolean
smtp_mail (CamelSmtpTransport *transport, const char *sender, gboolean has_8bit_parts, CamelException *ex)
{
/* we gotta tell the smtp server who we are. (our email addy) */
- char *cmdbuf, *respbuf = NULL;
+ gchar *cmdbuf, *respbuf = NULL;
/* enclose address in <>'s since some SMTP daemons *require* that */
- if (transport->flags & CAMEL_SMTP_TRANSPORT_8BITMIME && has_8bit_parts)
+ if (CAMEL_TRANSPORT (transport)->supports_8bit && has_8bit_parts)
cmdbuf = g_strdup_printf ("MAIL FROM: <%s> BODY=8BITMIME\r\n", sender);
else
cmdbuf = g_strdup_printf ("MAIL FROM: <%s>\r\n", sender);
@@ -1079,8 +885,13 @@ smtp_mail (CamelSmtpTransport *transport, const char *sender, gboolean has_8bit_
d(fprintf (stderr, "received: %s\n", respbuf ? respbuf : "(null)"));
if (!respbuf || strncmp (respbuf, "250", 3)) {
- smtp_set_exception (transport, respbuf, _("MAIL FROM response error"), ex);
+ int error;
+
+ error = respbuf ? atoi (respbuf) : 0;
g_free (respbuf);
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
+ _("MAIL FROM response error: %s: mail not sent"),
+ get_smtp_error_string (error));
return FALSE;
}
} while (*(respbuf+3) == '-'); /* if we got "250-" then loop again */
@@ -1094,7 +905,7 @@ smtp_rcpt (CamelSmtpTransport *transport, const char *recipient, CamelException
{
/* we gotta tell the smtp server who we are going to be sending
* our email to */
- char *cmdbuf, *respbuf = NULL;
+ gchar *cmdbuf, *respbuf = NULL;
/* enclose address in <>'s since some SMTP daemons *require* that */
cmdbuf = g_strdup_printf ("RCPT TO: <%s>\r\n", recipient);
@@ -1111,19 +922,20 @@ smtp_rcpt (CamelSmtpTransport *transport, const char *recipient, CamelException
g_free (cmdbuf);
do {
- /* Check for "250 Recipient OK..." */
+ /* Check for "250 Sender OK..." */
g_free (respbuf);
respbuf = camel_stream_buffer_read_line (CAMEL_STREAM_BUFFER (transport->istream));
d(fprintf (stderr, "received: %s\n", respbuf ? respbuf : "(null)"));
if (!respbuf || strncmp (respbuf, "250", 3)) {
- char *message;
+ int error;
- message = g_strdup_printf (_("RCPT TO <%s> failed"), recipient);
- smtp_set_exception (transport, respbuf, message, ex);
- g_free (message);
+ error = respbuf ? atoi (respbuf) : 0;
g_free (respbuf);
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
+ _("RCPT TO response error: %s: mail not sent"),
+ get_smtp_error_string (error));
return FALSE;
}
} while (*(respbuf+3) == '-'); /* if we got "250-" then loop again */
@@ -1133,7 +945,7 @@ smtp_rcpt (CamelSmtpTransport *transport, const char *recipient, CamelException
}
static gboolean
-smtp_data (CamelSmtpTransport *transport, CamelMimeMessage *message, gboolean has_8bit_parts, CamelException *ex)
+smtp_data (CamelSmtpTransport *transport, CamelMedium *message, gboolean has_8bit_parts, CamelException *ex)
{
/* now we can actually send what's important :p */
char *cmdbuf, *respbuf = NULL;
@@ -1146,8 +958,8 @@ smtp_data (CamelSmtpTransport *transport, CamelMimeMessage *message, gboolean ha
/* if the message contains 8bit mime parts and the server
doesn't support it, encode 8bit parts to the best
encoding. This will also enforce an encoding to keep the lines in limit */
- if (has_8bit_parts && !(transport->flags & CAMEL_SMTP_TRANSPORT_8BITMIME))
- camel_mime_message_encode_8bit_parts (message);
+ if (has_8bit_parts && !CAMEL_TRANSPORT (transport)->supports_8bit)
+ camel_mime_message_encode_8bit_parts (CAMEL_MIME_MESSAGE (message));
cmdbuf = g_strdup ("DATA\r\n");
@@ -1170,8 +982,13 @@ smtp_data (CamelSmtpTransport *transport, CamelMimeMessage *message, gboolean ha
/* we should have gotten instructions on how to use the DATA command:
* 354 Enter mail, end with "." on a line by itself
*/
- smtp_set_exception (transport, respbuf, _("DATA response error"), ex);
+ int error;
+
+ error = respbuf ? atoi (respbuf) : 0;
g_free (respbuf);
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
+ _("DATA response error: %s: mail not sent"),
+ get_smtp_error_string (error));
return FALSE;
}
@@ -1242,8 +1059,14 @@ smtp_data (CamelSmtpTransport *transport, CamelMimeMessage *message, gboolean ha
d(fprintf (stderr, "received: %s\n", respbuf ? respbuf : "(null)"));
if (!respbuf || strncmp (respbuf, "250", 3)) {
- smtp_set_exception (transport, respbuf, _("DATA termination response error"), ex);
+ int error;
+
+ error = respbuf ? atoi (respbuf) : 0;
g_free (respbuf);
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
+ _("DATA response error: message termination: "
+ "%s: mail not sent"),
+ get_smtp_error_string (error));
return FALSE;
}
} while (*(respbuf+3) == '-'); /* if we got "250-" then loop again */
@@ -1256,7 +1079,7 @@ static gboolean
smtp_rset (CamelSmtpTransport *transport, CamelException *ex)
{
/* we are going to reset the smtp server (just to be nice) */
- char *cmdbuf, *respbuf = NULL;
+ gchar *cmdbuf, *respbuf = NULL;
cmdbuf = g_strdup ("RSET\r\n");
@@ -1279,8 +1102,13 @@ smtp_rset (CamelSmtpTransport *transport, CamelException *ex)
d(fprintf (stderr, "received: %s\n", respbuf ? respbuf : "(null)"));
if (!respbuf || strncmp (respbuf, "250", 3)) {
- smtp_set_exception (transport, respbuf, _("RSET response error"), ex);
+ int error;
+
+ error = respbuf ? atoi (respbuf) : 0;
g_free (respbuf);
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
+ _("RSET response error: %s"),
+ get_smtp_error_string (error));
return FALSE;
}
} while (*(respbuf+3) == '-'); /* if we got "250-" then loop again */
@@ -1293,7 +1121,7 @@ static gboolean
smtp_quit (CamelSmtpTransport *transport, CamelException *ex)
{
/* we are going to reset the smtp server (just to be nice) */
- char *cmdbuf, *respbuf = NULL;
+ gchar *cmdbuf, *respbuf = NULL;
cmdbuf = g_strdup ("QUIT\r\n");
@@ -1316,8 +1144,13 @@ smtp_quit (CamelSmtpTransport *transport, CamelException *ex)
d(fprintf (stderr, "received: %s\n", respbuf ? respbuf : "(null)"));
if (!respbuf || strncmp (respbuf, "221", 3)) {
- smtp_set_exception (transport, respbuf, _("QUIT response error"), ex);
+ int error;
+
+ error = respbuf ? atoi (respbuf) : 0;
g_free (respbuf);
+ camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM,
+ _("QUIT response error: %s: non-fatal"),
+ get_smtp_error_string (error));
return FALSE;
}
} while (*(respbuf+3) == '-'); /* if we got "221-" then loop again */
diff --git a/composer/ChangeLog b/composer/ChangeLog
index 5fa8f387b7..288f4b8d24 100644
--- a/composer/ChangeLog
+++ b/composer/ChangeLog
@@ -1,60 +1,7 @@
-2002-04-16 Jeffrey Stedfast <fejj@ximian.com>
+2002-04-12 Not Zed <NotZed@Ximian.com>
- * e-msg-composer-hdrs.c (destroy): Unref the priv->tooltips object
- here.
-
- * e-msg-composer-attachment-bar.c (destroy): Free the priv struct.
-
- * e-msg-composer.c (set_editor_signature): We don't need a 'name'?
- So don't strdup it.
-
-2002-04-12 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-msg-composer-hdrs.c (from_changed): Change the Reply-To header
- contents.
- (e_msg_composer_hdrs_set_reply_to): The Reply-To entry was an
- EEntry, not a bonobo control so fix this to set the text using
- e_entry_set_text.
- (e_msg_composer_hdrs_get_reply_to): Use e_entry_get_text here for
- the same reason.
-
-2002-04-08 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-msg-composer.c (set_editor_text): No need to query for the
- persist-stream interface here, just re-use
- composer->persist_stream_interface - this might improve the speed
- at which a reply action brings up the composer.
-
-2002-04-09 Not Zed <NotZed@Ximian.com>
-
- * e-msg-composer-hdrs.c (set_recipients_from_destv): Use decode
- rather than unformat - the e_destination was changed (long time
- ago) to rfc2047 encode the addresses, so we should decode
- likewise. Should fix #16158.
-
- * e-msg-composer.c (next_word): g_utf8_next_char never returns
- NULL, it just skips to the next character. So like normal string
- code, we just check for a nul explicitly. Fixes a bug found while
- checking #16158.
-
-2002-04-05 Jeffrey Stedfast <fejj@ximian.com>
-
- Fixes bug #3980.
-
- * e-msg-composer-hdrs.c (e_msg_composer_hdrs_set_cc): If a Cc list
- is set to something non-empty, make sure to show the Cc widgets.
- (e_msg_composer_hdrs_set_bcc): Same but for Bcc.
- (e_msg_composer_hdrs_set_reply_to): And here.
-
-2002-03-28 Christopher James Lahey <clahey@ximian.com>
-
- * e-msg-composer-select-file.c: Switch to using EFileSelection
- here instead of GtkFileSelection.
-
-2002-03-27 Larry Ewing <lewing@ximian.com>
-
- * Makefile.am: fix for the changes to GTKHTML_DATADIR that include
- the release number.
+ * e-msg-composer-hdrs.c (set_recipients_from_destv): Change
+ address_unformat to address_decode. fixes #16158
2002-03-18 Dan Winship <danw@ximian.com>
@@ -69,22 +16,7 @@
(disable_editor): Common editor-disabling code - makes the editor
and attachment bar insensitive and disables any menu items that
could be used to modify them.
- (e_msg_composer_new_redirect): Use disable_editor here now.
-2002-03-15 Radek Doulik <rodo@ximian.com>
-
- * e-msg-composer.c: use gtkhtml editor API version 1.1
-
-2002-03-11 Dan Winship <danw@ximian.com>
-
- * listener.c (impl_event): Remove the extremely verbose printf
- here.
-
-2002-03-07 Radek Doulik <rodo@ximian.com>
-
- * e-msg-composer.c (destroy): ops, unregister and not register new
- one sig_event_client
-
2002-03-04 Dan Winship <danw@ximian.com>
* e-msg-composer.c (build_message): Fix a dumb bug in previous
@@ -112,119 +44,18 @@
the body and MIME type supplied to it rather than the contents of
the HTML editor.
-2002-02-14 Radek Doulik <rodo@ximian.com>
-
- * e-msg-composer.c (delete_old_signature): don't insert paragraph
- here, also delete paragraph where signature was
- (e_msg_composer_show_sig_file): test if we are in empty document
- and if so, insert new paragraph for signature
-
-2002-02-12 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-msg-composer.c (e_msg_composer_flush_pending_body): Use
- set_editor_text()
- (e_msg_composer_new_from_url): Same.
- (e_msg_composer_set_body_text): Re-Show the signature.
-
-2002-02-12 Radek Doulik <rodo@ximian.com>
-
- * e-msg-composer.c (e_msg_composer_is_dirty): reflect gtkhtml API
- change
-
-2002-02-11 Radek Doulik <rodo@ximian.com>
-
- * e-msg-composer.c (e_msg_composer_drop_editor_undo): new method,
- drops undo in editor and resets dirty flag in editor
- (do_exit): remove TRUE from condition as dirty flag in editor
- should work now
- (e_msg_composer_is_dirty): use new editor API for dirty flag
-
-2002-02-01 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-msg-composer.c (update_auto_recipients): Update the
- auto-cc/bcc recipients in the composer header fields to match the
- ones chosen in the account configuration.
-
-2002-01-31 Radek Doulik <rodo@ximian.com>
-
- * e-msg-composer.c (e_msg_composer_ignore): new method, tells
- composer to ignore all word in str string
- (next_word): helper function to get next word from s, saves rest
- of s to sr
-
-2002-01-29 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-msg-composer.c (build_message): If we are in redirect mode,
- use the original message and set the resent-* headers using
- e_msg_composer_hdrs_to_redirect() and then return.
- (destroy): Unref the redirected message if it exists.
-
- * e-msg-composer-hdrs.c (e_msg_composer_hdrs_to_redirect): New
- function for a composer in redirect mode.
-
-2002-01-27 Ettore Perazzoli <ettore@ximian.com>
-
- * Makefile.am: Use GNOME_FULL_CFLAGS.
-
-2002-01-10 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-msg-composer.c (get_file_content): Rewrote to use CamelStreams
- and also convert the file contents to UTF-8 (assums the file
- charset is the same charset that the composer is set to).
- (menu_file_insert_file_cb): Pass the composer into
- get_file_content().
- (e_msg_composer_get_sig_file_content): Pass NULL as the composer
- argument.
-
-2002-01-09 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-msg-composer.c (class_init): Fixed the setup of the
- "save-draft" signal so that it would actually work.
-
-2002-01-08 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-msg-composer.c (is_special_header): Greatly simplified. No
- need to have a list of headers to not accept - we can just refuse
- all headers that are not X-* headers (other than X-Evolution
- headers).
-
2002-01-07 Jeffrey Stedfast <fejj@ximian.com>
* e-msg-composer.c (e_msg_composer_get_message_draft): Set the
X-Evolution-Format header to text/plain if that is the editing
mode we are really in. This fixes bug #11499.
-2002-01-04 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-msg-composer.c (e_msg_composer_new_from_url): A few minor
- fixes to make it more compliant with rfc2368. Should now be fully
- rfc compliant as far as I can tell.
-
2002-01-03 Jeffrey Stedfast <fejj@ximian.com>
* e-msg-composer-attachment.c (e_msg_composer_attachment_edit):
Only connect to the parent's destroy/hide signals while the
attachment editor dialog is "alive".
-2001-12-21 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-msg-composer-select-file.c (composer_hide_cb): Only cancel the
- selection dialog if it is currently in use, otherwise we'll get an
- extra gtk_main_quit and the mailer will exit :-(
-
-2001-12-17 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-msg-composer.c (read_file_content): Don't block forever if we
- are reading a fifo with no data.
-
-2001-12-14 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-msg-composer.c (class_init): Setup the SAVE_DRAFT signal.
- (menu_file_save_draft_cb): Emit the SAVE_DRAFT signal.
- (exit_dialog_cb): Same here.
- (save_draft): Removed. This code is now a signal that
- mail-callbacks will connect to.
-
2001-12-11 Jeffrey Stedfast <fejj@ximian.com>
* e-msg-composer-attachment.c (e_msg_composer_attachment_edit):
@@ -236,60 +67,6 @@
* e-msg-composer.c (init): Default composer->enable_autosave to
TRUE.
-2001-12-11 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-msg-composer-select-file.c (confirm): If multiple-selection is
- enabled but nothing is slected, fall back to using the filename in
- the entry box as the "selected" file.
- (create_file_selection): If the composer gets hidden (ie it's
- being "sent") then cancel the file selection dialog.
-
-2001-12-11 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-msg-composer-select-file.c
- (file_selection_info_destroy_notify): If the widget is non-NULL,
- then gtk_widget_destroy that bad boy...
-
-2001-12-10 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-msg-composer-attachment-bar.c (add_from_user):
- select_file_attachments now returns a GPtrArray so handle that and
- loop until we've added all the attachment files.
-
- * e-msg-composer-select-file.c (confirm): Add an evil kludge to
- get a list of filenames from the GtkFileSelection widget based on
- the label in the history option menu item and the base filenames
- of the selected items in the filename clist.
- (create_file_selection): Setup the clist to allow multiple
- selection.
- (file_selection_info_destroy_notify): Destroy the GPtrArray
- containing the list of xselected files.
- (select_file_internal): Return a GPtrArray of files instead of a
- char *.
-
-2001-12-10 Jon Trowbridge <trow@ximian.com>
-
- * e-msg-composer.c (get_file_content): Only execute an executable
- sig file if a magic environment variable is set.
-
-2001-12-06 Jon Trowbridge <trow@ximian.com>
-
- * e-msg-composer.c (executed_file_output): Added. Executes the
- given file and returns its output as a string.
- (get_file_content): Stats the file to see if it is executable.
- If it is, execute it and return the string. If not, just read
- the file and return the contents.
-
-2001-11-30 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-msg-composer.c (setup_ui): Change the FileSend tooltip the be
- the same as the FileSendLater tooltip if we are in offline mode.
-
-2001-11-11 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-msg-composer.c (drag_data_received): Allow drag & drop for
- vcards.
-
2001-11-30 Jeffrey Stedfast <fejj@ximian.com>
* e-msg-composer.c (setup_ui): Change the FileSend tooltip the be
diff --git a/composer/e-msg-composer-attachment-bar.c b/composer/e-msg-composer-attachment-bar.c
index 6df2d65485..08be328e14 100644
--- a/composer/e-msg-composer-attachment-bar.c
+++ b/composer/e-msg-composer-attachment-bar.c
@@ -444,22 +444,18 @@ static void
add_from_user (EMsgComposerAttachmentBar *bar)
{
EMsgComposer *composer;
- GPtrArray *file_list;
+ char *file_name;
gboolean is_inline = FALSE;
- int i;
composer = E_MSG_COMPOSER (gtk_widget_get_toplevel (GTK_WIDGET (bar)));
- file_list = e_msg_composer_select_file_attachments (composer, &is_inline);
- if (!file_list)
+ file_name = e_msg_composer_select_file_attachment (composer, &is_inline);
+ if (!file_name)
return;
- for (i = 0; i < file_list->len; i++) {
- add_from_file (bar, file_list->pdata[i], is_inline ? "inline" : "attachment");
- g_free (file_list->pdata[i]);
- }
+ add_from_file (bar, file_name, is_inline ? "inline" : "attachment");
- g_ptr_array_free (file_list, TRUE);
+ g_free (file_name);
}
@@ -574,8 +570,6 @@ destroy (GtkObject *object)
free_attachment_list (bar);
- g_free (bar->priv);
-
if (GTK_OBJECT_CLASS (parent_class)->destroy != NULL)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}
diff --git a/composer/e-msg-composer-attachment.c b/composer/e-msg-composer-attachment.c
index ddb73f2f52..a33ee40ac9 100644
--- a/composer/e-msg-composer-attachment.c
+++ b/composer/e-msg-composer-attachment.c
@@ -158,7 +158,7 @@ e_msg_composer_attachment_new (const char *file_name,
CamelDataWrapper *wrapper;
CamelStream *stream;
struct stat statbuf;
- char *mime_type;
+ gchar *mime_type;
char *filename;
g_return_val_if_fail (file_name != NULL, NULL);
@@ -438,8 +438,8 @@ e_msg_composer_attachment_edit (EMsgComposerAttachment *attachment,
if (attachment != NULL) {
CamelContentType *content_type;
- const char *disposition;
char *type;
+ const char *disposition;
set_entry (editor_gui, "file_name_entry",
camel_mime_part_get_filename (attachment->body));
diff --git a/composer/e-msg-composer-hdrs.c b/composer/e-msg-composer-hdrs.c
index 9930ee3b1a..a5e92ad2d0 100644
--- a/composer/e-msg-composer-hdrs.c
+++ b/composer/e-msg-composer-hdrs.c
@@ -66,7 +66,7 @@ typedef struct {
struct _EMsgComposerHdrsPrivate {
GNOME_Evolution_Addressbook_SelectNames corba_select_names;
-
+
/* The tooltips. */
GtkTooltips *tooltips;
@@ -87,7 +87,7 @@ enum {
LAST_SIGNAL
};
-static int signals[LAST_SIGNAL];
+static gint signals[LAST_SIGNAL];
static gboolean
@@ -139,7 +139,7 @@ e_msg_composer_hdrs_and_string_create (EMsgComposerHdrs *hdrs, const char *strin
emchas->string = g_strdup (string);
if (emchas->hdrs)
gtk_object_ref (GTK_OBJECT (emchas->hdrs));
-
+
return emchas;
}
@@ -168,15 +168,8 @@ static void
from_changed (GtkWidget *item, gpointer data)
{
EMsgComposerHdrs *hdrs = E_MSG_COMPOSER_HDRS (data);
- const char *reply_to;
hdrs->account = gtk_object_get_data (GTK_OBJECT (item), "account");
-
- /* we do this rather than calling e_msg_composer_hdrs_set_reply_to()
- because we don't want to change the visibility of the header */
- reply_to = hdrs->account->id->reply_to;
- e_entry_set_text (E_ENTRY (hdrs->priv->reply_to.entry), reply_to ? reply_to : "");
-
gtk_signal_emit (GTK_OBJECT (hdrs), signals [FROM_CHANGED]);
}
@@ -209,6 +202,7 @@ create_from_optionmenu (EMsgComposerHdrs *hdrs)
}
if (account->id->address && *account->id->address) {
+
if (strcmp (account->name, account->id->address))
label = g_strdup_printf ("%s <%s> (%s)", account->id->name,
account->id->address, account->name);
@@ -234,7 +228,7 @@ create_from_optionmenu (EMsgComposerHdrs *hdrs)
gtk_menu_append (GTK_MENU (menu), item);
gtk_widget_show (item);
- i++;
+ ++i;
}
accounts = accounts->next;
@@ -258,7 +252,7 @@ addressbook_entry_changed (BonoboListener *listener,
gpointer user_data)
{
EMsgComposerHdrs *hdrs = E_MSG_COMPOSER_HDRS (user_data);
-
+
gtk_signal_emit (GTK_OBJECT (hdrs), signals[HDRS_CHANGED]);
}
@@ -273,41 +267,41 @@ create_addressbook_entry (EMsgComposerHdrs *hdrs,
CORBA_Environment ev;
BonoboControlFrame *cf;
Bonobo_PropertyBag pb = CORBA_OBJECT_NIL;
-
+
priv = hdrs->priv;
corba_select_names = priv->corba_select_names;
-
+
CORBA_exception_init (&ev);
-
+
GNOME_Evolution_Addressbook_SelectNames_addSection (
corba_select_names, name, name, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
CORBA_exception_free (&ev);
return NULL;
}
-
+
corba_control =
GNOME_Evolution_Addressbook_SelectNames_getEntryBySection (
corba_select_names, name, &ev);
-
+
if (ev._major != CORBA_NO_EXCEPTION) {
CORBA_exception_free (&ev);
return NULL;
}
-
+
CORBA_exception_free (&ev);
-
+
control_widget = bonobo_widget_new_control_from_objref (
corba_control, CORBA_OBJECT_NIL);
-
+
cf = bonobo_widget_get_control_frame (BONOBO_WIDGET (control_widget));
pb = bonobo_control_frame_get_control_property_bag (cf, NULL);
-
+
bonobo_event_source_client_add_listener (
pb, addressbook_entry_changed,
"Bonobo/Property:change:entry_changed",
NULL, hdrs);
-
+
return control_widget;
}
@@ -327,28 +321,29 @@ header_new_recipient (EMsgComposerHdrs *hdrs, const gchar *name, const gchar *ti
e_msg_composer_hdrs_and_string_create(hdrs, name),
(GtkDestroyNotify) e_msg_composer_hdrs_and_string_free,
FALSE, FALSE);
-
+
gtk_tooltips_set_tip (
hdrs->priv->tooltips, ret.label,
_("Click here for the address book"),
NULL);
-
+
ret.entry = create_addressbook_entry (hdrs, name);
-
+
return ret;
}
static void
entry_changed (GtkWidget *entry, EMsgComposerHdrs *hdrs)
{
- char *subject, *tmp;
-
+ gchar *tmp;
+ gchar *subject;
+
tmp = e_msg_composer_hdrs_get_subject (hdrs);
subject = e_utf8_to_gtk_string (GTK_WIDGET (entry), tmp);
-
+
gtk_signal_emit (GTK_OBJECT (hdrs), signals[SUBJECT_CHANGED], subject);
g_free (tmp);
-
+
gtk_signal_emit (GTK_OBJECT (hdrs), signals[HDRS_CHANGED]);
}
@@ -356,13 +351,13 @@ static void
create_headers (EMsgComposerHdrs *hdrs)
{
EMsgComposerHdrsPrivate *priv = hdrs->priv;
-
+
/*
* From:
*/
priv->from.label = gtk_label_new (_("From:"));
priv->from.entry = create_from_optionmenu (hdrs);
-
+
/*
* Reply-To:
*/
@@ -373,7 +368,7 @@ create_headers (EMsgComposerHdrs *hdrs)
"use_ellipsis", TRUE,
"allow_newlines", FALSE,
NULL);
-
+
/*
* Subject:
*/
@@ -386,18 +381,18 @@ create_headers (EMsgComposerHdrs *hdrs)
NULL);
gtk_signal_connect (GTK_OBJECT (priv->subject.entry), "changed",
GTK_SIGNAL_FUNC (entry_changed), hdrs);
-
+
/*
* To: CC: and Bcc:
*/
priv->to = header_new_recipient (
hdrs, _("To:"),
_("Enter the recipients of the message"));
-
+
priv->cc = header_new_recipient (
hdrs, _("Cc:"),
_("Enter the addresses that will receive a carbon copy of the message"));
-
+
priv->bcc = header_new_recipient (
hdrs, _("Bcc:"),
_("Enter the addresses that will receive a carbon copy of "
@@ -421,7 +416,7 @@ attach_couple (EMsgComposerHdrs *hdrs, EMsgComposerHdrPair *pair, int line)
pad = GNOME_PAD;
else
pad = 2;
-
+
gtk_table_attach (GTK_TABLE (hdrs),
pair->label, 0, 1,
line, line + 1,
@@ -437,7 +432,7 @@ static void
attach_headers (EMsgComposerHdrs *hdrs)
{
EMsgComposerHdrsPrivate *p = hdrs->priv;
-
+
attach_couple (hdrs, &p->from, LINE_FROM);
attach_couple (hdrs, &p->reply_to, LINE_REPLYTO);
attach_couple (hdrs, &p->to, LINE_TO);
@@ -459,10 +454,10 @@ set_pair_visibility (EMsgComposerHdrs *h, EMsgComposerHdrPair *pair, gboolean vi
}
static void
-headers_set_visibility (EMsgComposerHdrs *h, int visible_flags)
+headers_set_visibility (EMsgComposerHdrs *h, gint visible_flags)
{
EMsgComposerHdrsPrivate *p = h->priv;
-
+
set_pair_visibility (h, &p->from, visible_flags & E_MSG_COMPOSER_VISIBLE_FROM);
set_pair_visibility (h, &p->reply_to, visible_flags & E_MSG_COMPOSER_VISIBLE_REPLYTO);
set_pair_visibility (h, &p->cc, visible_flags & E_MSG_COMPOSER_VISIBLE_CC);
@@ -471,21 +466,21 @@ headers_set_visibility (EMsgComposerHdrs *h, int visible_flags)
}
void
-e_msg_composer_set_hdrs_visible (EMsgComposerHdrs *hdrs, int visible_flags)
+e_msg_composer_set_hdrs_visible (EMsgComposerHdrs *hdrs, gint visible_flags)
{
g_return_if_fail (hdrs != NULL);
g_return_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs));
-
+
headers_set_visibility (hdrs, visible_flags);
gtk_widget_queue_resize (GTK_WIDGET (hdrs));
}
static void
-setup_headers (EMsgComposerHdrs *hdrs, int visible_flags)
+setup_headers (EMsgComposerHdrs *hdrs, gint visible_flags)
{
create_headers (hdrs);
attach_headers (hdrs);
-
+
/*
* To: is always visible
*/
@@ -504,19 +499,18 @@ destroy (GtkObject *object)
EMsgComposerHdrs *hdrs;
EMsgComposerHdrsPrivate *priv;
GSList *l;
-
+
hdrs = E_MSG_COMPOSER_HDRS (object);
priv = hdrs->priv;
-
+
if (priv->corba_select_names != CORBA_OBJECT_NIL) {
CORBA_Environment ev;
CORBA_exception_init (&ev);
bonobo_object_release_unref (priv->corba_select_names, &ev);
CORBA_exception_free (&ev);
}
-
+
gtk_object_destroy (GTK_OBJECT (priv->tooltips));
- gtk_object_unref (GTK_OBJECT (priv->tooltips));
l = priv->from_options;
while (l) {
@@ -541,12 +535,12 @@ 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,
@@ -555,7 +549,7 @@ class_init (EMsgComposerHdrsClass *class)
show_address_dialog),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
-
+
signals[SUBJECT_CHANGED] =
gtk_signal_new ("subject_changed",
GTK_RUN_LAST,
@@ -565,7 +559,7 @@ class_init (EMsgComposerHdrsClass *class)
gtk_marshal_NONE__STRING,
GTK_TYPE_NONE,
1, GTK_TYPE_STRING);
-
+
signals[HDRS_CHANGED] =
gtk_signal_new ("hdrs_changed",
GTK_RUN_LAST,
@@ -574,7 +568,7 @@ class_init (EMsgComposerHdrsClass *class)
hdrs_changed),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
-
+
signals[FROM_CHANGED] =
gtk_signal_new ("from_changed",
GTK_RUN_LAST,
@@ -583,7 +577,7 @@ class_init (EMsgComposerHdrsClass *class)
from_changed),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
-
+
gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
}
@@ -591,11 +585,11 @@ static void
init (EMsgComposerHdrs *hdrs)
{
EMsgComposerHdrsPrivate *priv;
-
+
priv = g_new0 (EMsgComposerHdrsPrivate, 1);
-
+
priv->tooltips = gtk_tooltips_new ();
-
+
hdrs->priv = priv;
}
@@ -604,7 +598,7 @@ GtkType
e_msg_composer_hdrs_get_type (void)
{
static GtkType type = 0;
-
+
if (type == 0) {
static const GtkTypeInfo info = {
"EMsgComposerHdrs",
@@ -616,15 +610,15 @@ e_msg_composer_hdrs_get_type (void)
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
};
-
+
type = gtk_type_unique (gtk_table_get_type (), &info);
}
-
+
return type;
}
GtkWidget *
-e_msg_composer_hdrs_new (int visible_flags)
+e_msg_composer_hdrs_new (gint visible_flags)
{
EMsgComposerHdrs *new;
EMsgComposerHdrsPrivate *priv;
@@ -632,13 +626,13 @@ e_msg_composer_hdrs_new (int visible_flags)
new = gtk_type_new (e_msg_composer_hdrs_get_type ());
priv = new->priv;
- if (!setup_corba (new)) {
+ if (! setup_corba (new)) {
gtk_widget_destroy (GTK_WIDGET (new));
return NULL;
}
setup_headers (new, visible_flags);
-
+
return GTK_WIDGET (new);
}
@@ -646,26 +640,27 @@ static void
set_recipients_from_destv (CamelMimeMessage *msg,
EDestination **to_destv,
EDestination **cc_destv,
- EDestination **bcc_destv,
- gboolean redirect)
+ EDestination **bcc_destv)
{
CamelInternetAddress *to_addr;
CamelInternetAddress *cc_addr;
CamelInternetAddress *bcc_addr;
CamelInternetAddress *target;
- const char *text_addr, *header;
+ const gchar *text_addr;
+ gint i;
gboolean seen_hidden_list = FALSE;
- int i;
-
+
to_addr = camel_internet_address_new ();
cc_addr = camel_internet_address_new ();
bcc_addr = camel_internet_address_new ();
-
+
if (to_destv) {
for (i = 0; to_destv[i] != NULL; ++i) {
text_addr = e_destination_get_address (to_destv[i]);
-
+
+
if (text_addr && *text_addr) {
+
target = to_addr;
if (e_destination_is_evolution_list (to_destv[i])
&& !e_destination_list_show_addresses (to_destv[i])) {
@@ -677,11 +672,12 @@ set_recipients_from_destv (CamelMimeMessage *msg,
}
}
}
-
+
if (cc_destv) {
for (i = 0; cc_destv[i] != NULL; ++i) {
text_addr = e_destination_get_address (cc_destv[i]);
if (text_addr && *text_addr) {
+
target = cc_addr;
if (e_destination_is_evolution_list (cc_destv[i])
&& !e_destination_list_show_addresses (cc_destv[i])) {
@@ -693,45 +689,41 @@ set_recipients_from_destv (CamelMimeMessage *msg,
}
}
}
-
+
if (bcc_destv) {
for (i = 0; bcc_destv[i] != NULL; ++i) {
text_addr = e_destination_get_address (bcc_destv[i]);
- if (text_addr && *text_addr) {
+ if (text_addr && *text_addr) {
camel_address_decode (CAMEL_ADDRESS (bcc_addr), text_addr);
}
}
}
-
- header = redirect ? CAMEL_RECIPIENT_TYPE_RESENT_TO : CAMEL_RECIPIENT_TYPE_TO;
+
if (camel_address_length (CAMEL_ADDRESS (to_addr)) > 0) {
- camel_mime_message_set_recipients (msg, header, to_addr);
+ camel_mime_message_set_recipients (msg, CAMEL_RECIPIENT_TYPE_TO, to_addr);
} else if (seen_hidden_list) {
- camel_medium_set_header (CAMEL_MEDIUM (msg), header, "Undisclosed-Recipient:;");
+ camel_medium_set_header (CAMEL_MEDIUM (msg), CAMEL_RECIPIENT_TYPE_TO, "Undisclosed-Recipient:;");
}
-
- header = redirect ? CAMEL_RECIPIENT_TYPE_RESENT_CC : CAMEL_RECIPIENT_TYPE_CC;
+
if (camel_address_length (CAMEL_ADDRESS (cc_addr)) > 0) {
- camel_mime_message_set_recipients (msg, header, cc_addr);
+ camel_mime_message_set_recipients (msg, CAMEL_RECIPIENT_TYPE_CC, cc_addr);
}
-
- header = redirect ? CAMEL_RECIPIENT_TYPE_RESENT_BCC : CAMEL_RECIPIENT_TYPE_BCC;
+
if (camel_address_length (CAMEL_ADDRESS (bcc_addr)) > 0) {
- camel_mime_message_set_recipients (msg, header, bcc_addr);
+ camel_mime_message_set_recipients (msg, CAMEL_RECIPIENT_TYPE_BCC, bcc_addr);
}
-
+
camel_object_unref (CAMEL_OBJECT (to_addr));
camel_object_unref (CAMEL_OBJECT (cc_addr));
camel_object_unref (CAMEL_OBJECT (bcc_addr));
}
-static void
-e_msg_composer_hdrs_to_message_internal (EMsgComposerHdrs *hdrs,
- CamelMimeMessage *msg,
- gboolean redirect)
+void
+e_msg_composer_hdrs_to_message (EMsgComposerHdrs *hdrs,
+ CamelMimeMessage *msg)
{
CamelInternetAddress *addr;
- char *subject, *header;
+ gchar *subject;
EDestination **to_destv, **cc_destv, **bcc_destv;
g_return_if_fail (hdrs != NULL);
@@ -744,13 +736,7 @@ e_msg_composer_hdrs_to_message_internal (EMsgComposerHdrs *hdrs,
g_free (subject);
addr = e_msg_composer_hdrs_get_from (hdrs);
- if (redirect) {
- header = camel_address_format (CAMEL_ADDRESS (addr));
- camel_medium_set_header (CAMEL_MEDIUM (msg), "Resent-From", header);
- g_free (header);
- } else {
- camel_mime_message_set_from (msg, addr);
- }
+ camel_mime_message_set_from (msg, addr);
camel_object_unref (CAMEL_OBJECT (addr));
addr = e_msg_composer_hdrs_get_reply_to (hdrs);
@@ -758,36 +744,21 @@ e_msg_composer_hdrs_to_message_internal (EMsgComposerHdrs *hdrs,
camel_mime_message_set_reply_to (msg, addr);
camel_object_unref (CAMEL_OBJECT (addr));
}
-
+
to_destv = e_msg_composer_hdrs_get_to (hdrs);
cc_destv = e_msg_composer_hdrs_get_cc (hdrs);
bcc_destv = e_msg_composer_hdrs_get_bcc (hdrs);
-
+
/* Attach destinations to the message. */
-
- set_recipients_from_destv (msg, to_destv, cc_destv, bcc_destv, redirect);
-
+
+ set_recipients_from_destv (msg, to_destv, cc_destv, bcc_destv);
+
e_destination_freev (to_destv);
e_destination_freev (cc_destv);
e_destination_freev (bcc_destv);
}
-
-void
-e_msg_composer_hdrs_to_message (EMsgComposerHdrs *hdrs,
- CamelMimeMessage *msg)
-{
- e_msg_composer_hdrs_to_message_internal (hdrs, msg, FALSE);
-}
-
-
-void
-e_msg_composer_hdrs_to_redirect (EMsgComposerHdrs *hdrs,
- CamelMimeMessage *msg)
-{
- e_msg_composer_hdrs_to_message_internal (hdrs, msg, TRUE);
-}
-
+
/* FIXME: yea, this could be better... but it's doubtful it'll be used much */
void
@@ -836,22 +807,20 @@ void
e_msg_composer_hdrs_set_reply_to (EMsgComposerHdrs *hdrs,
const char *reply_to)
{
+ g_return_if_fail (hdrs != NULL);
g_return_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs));
- e_entry_set_text (E_ENTRY (hdrs->priv->reply_to.entry), reply_to ? reply_to : "");
-
- if (reply_to && *reply_to)
- set_pair_visibility (hdrs, &hdrs->priv->cc, TRUE);
+ bonobo_widget_set_property (BONOBO_WIDGET (hdrs->priv->reply_to.entry),
+ "text", reply_to, NULL);
}
void
e_msg_composer_hdrs_set_to (EMsgComposerHdrs *hdrs,
EDestination **to_destv)
{
- char *str;
-
+ gchar *str;
g_return_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs));
-
+
str = e_destination_exportv (to_destv);
bonobo_widget_set_property (BONOBO_WIDGET (hdrs->priv->to.entry), "destinations", str, NULL);
g_free (str);
@@ -861,14 +830,11 @@ void
e_msg_composer_hdrs_set_cc (EMsgComposerHdrs *hdrs,
EDestination **cc_destv)
{
- char *str;
-
+ gchar *str;
g_return_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs));
str = e_destination_exportv (cc_destv);
- bonobo_widget_set_property (BONOBO_WIDGET (hdrs->priv->cc.entry), "destinations", str, NULL);
- if (str && *str)
- set_pair_visibility (hdrs, &hdrs->priv->cc, TRUE);
+ bonobo_widget_set_property (BONOBO_WIDGET (hdrs->priv->cc.entry), "destinations", str, NULL);
g_free (str);
}
@@ -876,14 +842,11 @@ void
e_msg_composer_hdrs_set_bcc (EMsgComposerHdrs *hdrs,
EDestination **bcc_destv)
{
- char *str;
-
+ gchar *str;
g_return_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs));
-
+
str = e_destination_exportv (bcc_destv);
bonobo_widget_set_property (BONOBO_WIDGET (hdrs->priv->bcc.entry), "destinations", str, NULL);
- if (str && *str)
- set_pair_visibility (hdrs, &hdrs->priv->bcc, TRUE);
g_free (str);
}
@@ -926,34 +889,41 @@ CamelInternetAddress *
e_msg_composer_hdrs_get_reply_to (EMsgComposerHdrs *hdrs)
{
CamelInternetAddress *addr;
- const char *reply_to;
+ gchar *reply_to;
+ g_return_val_if_fail (hdrs != NULL, NULL);
g_return_val_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs), NULL);
- reply_to = e_entry_get_text (E_ENTRY (hdrs->priv->reply_to.entry));
+ gtk_object_get (GTK_OBJECT (hdrs->priv->reply_to.entry),
+ "text", &reply_to, NULL);
- if (!reply_to || *reply_to == '\0')
+ if (!reply_to || *reply_to == '\0') {
+ g_free (reply_to);
return NULL;
+ }
addr = camel_internet_address_new ();
if (camel_address_unformat (CAMEL_ADDRESS (addr), reply_to) == -1) {
+ g_free (reply_to);
camel_object_unref (CAMEL_OBJECT (addr));
return NULL;
}
+ g_free (reply_to);
+
return addr;
}
EDestination **
e_msg_composer_hdrs_get_to (EMsgComposerHdrs *hdrs)
{
- char *str = NULL;
+ gchar *str = NULL;
EDestination **destv = NULL;
-
+
g_return_val_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs), NULL);
-
+
bonobo_widget_get_property (BONOBO_WIDGET (hdrs->priv->to.entry), "destinations", &str, NULL);
-
+
if (str != NULL) {
destv = e_destination_importv (str);
g_free (str);
@@ -965,36 +935,36 @@ e_msg_composer_hdrs_get_to (EMsgComposerHdrs *hdrs)
EDestination **
e_msg_composer_hdrs_get_cc (EMsgComposerHdrs *hdrs)
{
- char *str = NULL;
+ gchar *str = NULL;
EDestination **destv = NULL;
-
+
g_return_val_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs), NULL);
-
+
bonobo_widget_get_property (BONOBO_WIDGET (hdrs->priv->cc.entry), "destinations", &str, NULL);
-
+
if (str != NULL) {
destv = e_destination_importv (str);
g_free (str);
}
-
+
return destv;
}
EDestination **
e_msg_composer_hdrs_get_bcc (EMsgComposerHdrs *hdrs)
{
- char *str = NULL;
+ gchar *str = NULL;
EDestination **destv = NULL;
-
+
g_return_val_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs), NULL);
-
+
bonobo_widget_get_property (BONOBO_WIDGET (hdrs->priv->bcc.entry), "destinations", &str, NULL);
-
+
if (str != NULL) {
destv = e_destination_importv (str);
g_free (str);
}
-
+
return destv;
}
@@ -1005,48 +975,48 @@ e_msg_composer_hdrs_get_recipients (EMsgComposerHdrs *hdrs)
EDestination **cc_destv;
EDestination **bcc_destv;
EDestination **recip_destv;
- int i, j, n;
+ gint i, j, n;
g_return_val_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs), NULL);
-
+
to_destv = e_msg_composer_hdrs_get_to (hdrs);
cc_destv = e_msg_composer_hdrs_get_cc (hdrs);
bcc_destv = e_msg_composer_hdrs_get_bcc (hdrs);
-
+
n = 0;
-
- for (i = 0; to_destv && to_destv[i] != NULL; i++, n++);
- for (i = 0; cc_destv && cc_destv[i] != NULL; i++, n++);
- for (i = 0; bcc_destv && bcc_destv[i] != NULL; i++, n++);
-
+
+ for (i = 0; to_destv && to_destv[i] != NULL; ++i, ++n);
+ for (i = 0; cc_destv && cc_destv[i] != NULL; ++i, ++n);
+ for (i = 0; bcc_destv && bcc_destv[i] != NULL; ++i, ++n);
+
if (n == 0)
return NULL;
-
- recip_destv = g_new (EDestination *, n + 1);
-
+
+ recip_destv = g_new (EDestination *, n+1);
+
j = 0;
-
- for (i = 0; to_destv && to_destv[i] != NULL; i++, j++)
+
+ for (i = 0; to_destv && to_destv[i] != NULL; ++i, ++j)
recip_destv[j] = to_destv[i];
- for (i = 0; cc_destv && cc_destv[i] != NULL; i++, j++)
+ for (i = 0; cc_destv && cc_destv[i] != NULL; ++i, ++j)
recip_destv[j] = cc_destv[i];
- for (i = 0; bcc_destv && bcc_destv[i] != NULL; i++, j++)
+ for (i = 0; bcc_destv && bcc_destv[i] != NULL; ++i, ++j)
recip_destv[j] = bcc_destv[i];
-
+
g_assert (j == n);
recip_destv[j] = NULL;
-
+
g_free (to_destv);
g_free (cc_destv);
g_free (bcc_destv);
-
+
return recip_destv;
}
char *
e_msg_composer_hdrs_get_subject (EMsgComposerHdrs *hdrs)
{
- char *subject;
+ gchar *subject;
g_return_val_if_fail (hdrs != NULL, NULL);
g_return_val_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs), NULL);
@@ -1063,7 +1033,7 @@ e_msg_composer_hdrs_get_reply_to_entry (EMsgComposerHdrs *hdrs)
{
g_return_val_if_fail (hdrs != NULL, NULL);
g_return_val_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs), NULL);
-
+
return hdrs->priv->reply_to.entry;
}
@@ -1072,7 +1042,7 @@ e_msg_composer_hdrs_get_to_entry (EMsgComposerHdrs *hdrs)
{
g_return_val_if_fail (hdrs != NULL, NULL);
g_return_val_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs), NULL);
-
+
return hdrs->priv->to.entry;
}
@@ -1090,7 +1060,7 @@ e_msg_composer_hdrs_get_bcc_entry (EMsgComposerHdrs *hdrs)
{
g_return_val_if_fail (hdrs != NULL, NULL);
g_return_val_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs), NULL);
-
+
return hdrs->priv->bcc.entry;
}
@@ -1099,6 +1069,6 @@ e_msg_composer_hdrs_get_subject_entry (EMsgComposerHdrs *hdrs)
{
g_return_val_if_fail (hdrs != NULL, NULL);
g_return_val_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs), NULL);
-
+
return hdrs->priv->subject.entry;
}
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index 178b867004..b0c3a4079b 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -22,7 +22,6 @@
* Ettore Perazzoli (ettore@ximian.com)
* Jeffrey Stedfast (fejj@ximian.com)
* Miguel de Icaza (miguel@ximian.com)
- * Radek Doulik (rodo@ximian.com)
*
*/
@@ -45,15 +44,7 @@
#include <ctype.h>
#include <stdlib.h>
#include <dirent.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <sys/wait.h>
-#include <unistd.h>
-#include <gal/unicode/gunicode.h>
-#include <gal/util/e-unicode-i18n.h>
#include <libgnome/gnome-defs.h>
-#include <libgnome/gnome-exec.h>
#include <libgnomeui/gnome-app.h>
#include <libgnomeui/gnome-uidefs.h>
#include <libgnomeui/gnome-dialog.h>
@@ -72,10 +63,8 @@
#include <gal/widgets/e-gui-utils.h>
#include <gal/widgets/e-scroll-frame.h>
#include <gal/e-text/e-entry.h>
+#include <gal/util/e-unicode-i18n.h>
#include <gtkhtml/gtkhtml.h>
-#include <gtkhtml/htmlselection.h>
-
-/*#include <addressbook/backend/ebook/e-card.h>*/
#include "widgets/misc/e-charset-picker.h"
@@ -102,9 +91,7 @@
#include "Editor.h"
#include "listener.h"
-#define GNOME_GTKHTML_EDITOR_CONTROL_ID "OAFIID:GNOME_GtkHTML_Editor:1.1"
-
-#define d(x) x
+#define GNOME_GTKHTML_EDITOR_CONTROL_ID "OAFIID:GNOME_GtkHTML_Editor"
#define DEFAULT_WIDTH 600
@@ -113,7 +100,6 @@
enum {
SEND,
POSTPONE,
- SAVE_DRAFT,
LAST_SIGNAL
};
@@ -122,13 +108,11 @@ static guint signals[LAST_SIGNAL] = { 0 };
enum {
DND_TYPE_MESSAGE_RFC822,
DND_TYPE_TEXT_URI_LIST,
- DND_TYPE_TEXT_VCARD,
};
static GtkTargetEntry drop_types[] = {
{ "message/rfc822", 0, DND_TYPE_MESSAGE_RFC822 },
{ "text/uri-list", 0, DND_TYPE_TEXT_URI_LIST },
- { "text/x-vcard", 0, DND_TYPE_TEXT_VCARD },
};
static const int num_drop_types = sizeof (drop_types) / sizeof (drop_types[0]);
@@ -149,7 +133,6 @@ static void handle_multipart_alternative (EMsgComposer *composer, CamelMultipart
static void handle_multipart (EMsgComposer *composer, CamelMultipart *multipart, int depth);
-static void set_editor_signature (EMsgComposer *composer);
@@ -328,13 +311,6 @@ build_message (EMsgComposer *composer)
if (composer->persist_stream_interface == CORBA_OBJECT_NIL)
return NULL;
- /* evil kludgy hack for Redirect */
- if (composer->redirect) {
- e_msg_composer_hdrs_to_redirect (hdrs, composer->redirect);
- camel_object_ref (CAMEL_OBJECT (composer->redirect));
- return composer->redirect;
- }
-
new = camel_mime_message_new ();
e_msg_composer_hdrs_to_message (hdrs, new);
for (i = 0; i < composer->extra_hdr_names->len; i++) {
@@ -697,60 +673,58 @@ build_message (EMsgComposer *composer)
return NULL;
}
-
static char *
-get_file_content (EMsgComposer *composer, const char *file_name, gboolean want_html, guint flags, gboolean warn)
+read_file_content (gint fd)
{
- CamelStreamFilter *filtered_stream;
- CamelStreamMem *memstream;
- CamelMimeFilter *html, *charenc;
- CamelStream *stream;
- GByteArray *buffer;
- const char *charset;
- char *content;
- int fd;
+ GByteArray *contents;
+ gchar buf[4096];
+ gint n;
+ gchar *body;
- fd = open (file_name, O_RDONLY | O_CREAT, 0644);
- if (fd == -1) {
- char *msg;
-
- if (warn) {
- msg = g_strdup_printf (_("Error while reading file %s:\n%s"),
- file_name, g_strerror (errno));
- gnome_error_dialog (msg);
- g_free (msg);
- }
- return g_strdup ("");
+ g_return_val_if_fail (fd > 0, NULL);
+
+ contents = g_byte_array_new ();
+ while ((n = read (fd, buf, 4096)) > 0) {
+ g_byte_array_append (contents, buf, n);
}
+ g_byte_array_append (contents, "\0", 1);
- stream = camel_stream_fs_new_with_fd (fd);
- filtered_stream = camel_stream_filter_new_with_stream (stream);
- camel_object_unref (CAMEL_OBJECT (stream));
+ body = (n < 0) ? NULL : (gchar *)contents->data;
+ g_byte_array_free (contents, (n < 0));
+
+ return body;
+}
+
+static char *
+get_file_content (const gchar *file_name, gboolean convert, guint flags)
+{
+ gint fd;
+ char *raw;
+ char *html;
- charset = composer ? composer->charset : mail_config_get_default_charset ();
- charenc = (CamelMimeFilter *) camel_mime_filter_charset_new_convert (charset, "utf-8");
- camel_stream_filter_add (filtered_stream, charenc);
- camel_object_unref (CAMEL_OBJECT (charenc));
+ fd = open (file_name, O_RDONLY | O_CREAT, 0775);
- if (want_html) {
- html = camel_mime_filter_tohtml_new (flags, 0);
- camel_stream_filter_add (filtered_stream, html);
- camel_object_unref (CAMEL_OBJECT (html));
- }
+ raw = read_file_content (fd);
- memstream = (CamelStreamMem *) camel_stream_mem_new ();
- buffer = g_byte_array_new ();
- camel_stream_mem_set_byte_array (memstream, buffer);
+ if (raw == NULL) {
+ char *msg;
+
+ msg = g_strdup_printf (_("Error while reading file %s:\n"
+ "%s"), file_name, g_strerror (errno));
+
+ gnome_error_dialog (msg);
+ g_free (msg);
+ close (fd);
+ return g_strdup ("");
+ }
+ close (fd);
- camel_stream_write_to_stream (CAMEL_STREAM (filtered_stream), CAMEL_STREAM (memstream));
- camel_object_unref (CAMEL_OBJECT (filtered_stream));
- camel_object_unref (CAMEL_OBJECT (memstream));
+ html = convert ? e_text_to_html (raw, flags) : raw;
- g_byte_array_append (buffer, "", 1);
- content = buffer->data;
- g_byte_array_free (buffer, FALSE);
+ if (convert)
+ g_free (raw);
- return content;
+ return html;
}
char *
@@ -760,7 +734,7 @@ e_msg_composer_get_sig_file_content (const char *sigfile, gboolean in_html)
return NULL;
}
- return get_file_content (NULL, sigfile, !in_html, 0, FALSE);
+ return get_file_content (sigfile, !in_html, 0);
}
static void
@@ -782,11 +756,10 @@ prepare_engine (EMsgComposer *composer)
composer->editor_listener = BONOBO_OBJECT (listener_new (composer));
if (composer->editor_listener != NULL)
GNOME_GtkHTML_Editor_Engine__set_listener (composer->editor_engine,
- (GNOME_GtkHTML_Editor_Listener)
- bonobo_object_dup_ref
- (bonobo_object_corba_objref (composer->editor_listener),
- &ev),
- &ev);
+ (GNOME_GtkHTML_Editor_Listener)
+ bonobo_object_dup_ref
+ (bonobo_object_corba_objref (composer->editor_listener), &ev),
+ &ev);
if ((ev._major != CORBA_NO_EXCEPTION) || (composer->editor_listener == NULL)) {
CORBA_Environment err_ev;
@@ -813,47 +786,26 @@ static gchar *
get_signature_html (EMsgComposer *composer)
{
gboolean format_html = FALSE;
- char *text, *html = NULL, *sig_file = NULL, *script = NULL;
- static gboolean random_initialized = FALSE;
-
- if (composer->signature) {
- sig_file = composer->signature->filename;
- format_html = composer->signature->html;
- script = composer->signature->script;
- } else if (composer->random_signature) {
- GList *l;
- gint pos;
-
- if (!random_initialized) {
- printf ("initialize random generator\n");
- srand (time (NULL));
- random_initialized = TRUE;
- }
- pos = (int) (((gdouble) mail_config_get_signatures_random ())*rand()/(RAND_MAX+1.0));
- printf ("using %d sig\n", pos);
-
- for (l = mail_config_get_signature_list (); l; l = l->next) {
- MailConfigSignature *sig = (MailConfigSignature *) l->data;
-
- if (sig->random) {
- if (pos == 0) {
- printf ("using %s\n", sig->name);
- sig_file = sig->filename;
- script = sig->script;
- format_html = sig->html;
- break;
- }
- pos --;
- }
- }
+ gchar *text, *html = NULL, *sig_file = NULL;
+
+ if (E_MSG_COMPOSER_HDRS (composer->hdrs)->account->id) {
+ MailConfigIdentity *id;
+
+ id = E_MSG_COMPOSER_HDRS (composer->hdrs)->account->id;
+ if (composer->send_html) {
+ if (id->has_html_signature) {
+ sig_file = id->html_signature;
+ format_html = TRUE;
+ } else
+ sig_file = id->signature;
+ } else
+ sig_file = id->signature;
}
+
if (!sig_file)
return NULL;
- printf ("sig file: %s\n", sig_file);
-
- mail_config_signature_run_script (script);
+
text = e_msg_composer_get_sig_file_content (sig_file, format_html);
- /* printf ("text: %s\n", text); */
if (text) {
/* The signature dash convention ("-- \n") is specified in the
* "Son of RFC 1036": http://www.chemie.fu-berlin.de/outerspace/netnews/son-of-1036.html,
@@ -881,29 +833,29 @@ set_editor_text (EMsgComposer *composer, const char *text)
BonoboStream *stream;
BonoboWidget *editor;
CORBA_Environment ev;
- Bonobo_Unknown object;
-
- g_return_if_fail (composer->persist_stream_interface != CORBA_OBJECT_NIL);
-
- persist = composer->persist_stream_interface;
editor = BONOBO_WIDGET (composer->editor);
CORBA_exception_init (&ev);
+ persist = (Bonobo_PersistStream) bonobo_object_client_query_interface (
+ bonobo_widget_get_server (editor), "IDL:Bonobo/PersistStream:1.0", &ev);
+
+ g_return_if_fail (persist != CORBA_OBJECT_NIL);
- stream = bonobo_stream_mem_create (text, strlen (text), TRUE, FALSE);
- object = bonobo_object_corba_objref (BONOBO_OBJECT (stream));
- Bonobo_PersistStream_load (persist, (Bonobo_Stream) object, "text/html", &ev);
+ stream = bonobo_stream_mem_create (text, strlen (text),
+ TRUE, FALSE);
+ Bonobo_PersistStream_load (persist, (Bonobo_Stream)bonobo_object_corba_objref (BONOBO_OBJECT (stream)),
+ "text/html", &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
/* FIXME. Some error message. */
- bonobo_object_unref (BONOBO_OBJECT (stream));
- CORBA_exception_free (&ev);
return;
}
+ if (ev._major != CORBA_SYSTEM_EXCEPTION)
+ CORBA_Object_release (persist, &ev);
+ Bonobo_Unknown_unref (persist, &ev);
CORBA_exception_free (&ev);
-
- bonobo_object_unref (BONOBO_OBJECT (stream));
+ bonobo_object_unref (BONOBO_OBJECT(stream));
}
static void
@@ -1014,6 +966,96 @@ load (EMsgComposer *composer, const char *file_name)
CORBA_exception_free (&ev);
}
+/* Exit dialog. (Displays a "Save composition to 'Drafts' before exiting?" warning before actually exiting.) */
+
+enum { REPLY_YES = 0, REPLY_NO, REPLY_CANCEL };
+
+struct _save_info {
+ EMsgComposer *composer;
+ int quitok;
+};
+
+static void
+save_done (CamelFolder *folder, CamelMimeMessage *msg, CamelMessageInfo *info, int ok, void *data)
+{
+ struct _save_info *si = data;
+
+ if (ok && si->quitok)
+ gtk_widget_destroy (GTK_WIDGET (si->composer));
+ else
+ gtk_object_unref (GTK_OBJECT (si->composer));
+
+ g_free (info);
+ g_free (si);
+}
+
+extern CamelFolder *drafts_folder;
+extern char *default_drafts_folder_uri;
+
+static void
+use_default_drafts_cb (gint reply, gpointer data)
+{
+ CamelFolder **folder = data;
+
+ if (reply == 0)
+ *folder = drafts_folder;
+}
+
+static void
+save_folder (char *uri, CamelFolder *folder, gpointer data)
+{
+ CamelFolder **save = data;
+
+ if (folder) {
+ *save = folder;
+ camel_object_ref (CAMEL_OBJECT (folder));
+ }
+}
+
+static void
+save_draft (EMsgComposer *composer, int quitok)
+{
+ CamelMimeMessage *msg;
+ CamelMessageInfo *info;
+ const MailConfigAccount *account;
+ struct _save_info *si;
+ CamelFolder *folder = NULL;
+
+ account = e_msg_composer_get_preferred_account (composer);
+ if (account && account->drafts_folder_uri &&
+ strcmp (account->drafts_folder_uri, default_drafts_folder_uri) != 0) {
+ int id;
+
+ id = mail_get_folder (account->drafts_folder_uri, 0, save_folder, &folder, mail_thread_new);
+ mail_msg_wait (id);
+
+ if (!folder) {
+ GtkWidget *dialog;
+
+ dialog = gnome_ok_cancel_dialog_parented (_("Unable to open the drafts folder for this account.\n"
+ "Would you like to use the default drafts folder?"),
+ use_default_drafts_cb, &folder, GTK_WINDOW (composer));
+ gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
+ if (!folder)
+ return;
+ }
+ } else
+ folder = drafts_folder;
+
+ msg = e_msg_composer_get_message_draft (composer);
+
+ info = g_new0 (CamelMessageInfo, 1);
+ info->flags = CAMEL_MESSAGE_DRAFT | CAMEL_MESSAGE_SEEN;
+
+ si = g_malloc (sizeof (*si));
+ si->composer = composer;
+ gtk_object_ref (GTK_OBJECT (composer));
+ si->quitok = quitok;
+
+ mail_append_mail (folder, msg, info, save_done, si);
+ camel_object_unref (CAMEL_OBJECT (msg));
+}
+
#define AUTOSAVE_SEED ".evolution-composer.autosave-XXXXXX"
#define AUTOSAVE_INTERVAL 60000
@@ -1226,7 +1268,6 @@ autosave_init_file (EMsgComposer *composer)
}
return FALSE;
}
-
static void
autosave_manager_start (AutosaveManager *am)
{
@@ -1300,20 +1341,17 @@ autosave_manager_unregister (AutosaveManager *am, EMsgComposer *composer)
static void
menu_file_save_draft_cb (BonoboUIComponent *uic, void *data, const char *path)
{
- gtk_signal_emit (GTK_OBJECT (data), signals[SAVE_DRAFT], FALSE);
+ save_draft (E_MSG_COMPOSER (data), FALSE);
e_msg_composer_unset_changed (E_MSG_COMPOSER (data));
}
-/* Exit dialog. (Displays a "Save composition to 'Drafts' before exiting?" warning before actually exiting.) */
-
-enum { REPLY_YES = 0, REPLY_NO, REPLY_CANCEL };
-
static void
exit_dialog_cb (int reply, EMsgComposer *composer)
{
switch (reply) {
case REPLY_YES:
- gtk_signal_emit (GTK_OBJECT (composer), signals[SAVE_DRAFT], TRUE);
+ /* this has to be done async */
+ save_draft (composer, TRUE);
e_msg_composer_unset_changed (composer);
break;
case REPLY_NO:
@@ -1330,7 +1368,7 @@ do_exit (EMsgComposer *composer)
GtkWidget *dialog;
gint button;
- if (e_msg_composer_is_dirty (composer)) {
+ if (TRUE || e_msg_composer_is_dirty (composer)) {
dialog = gnome_message_box_new (_("This message has not been sent.\n\nDo you wish to save your changes?"),
GNOME_MESSAGE_BOX_QUESTION,
GNOME_STOCK_BUTTON_YES, /* Save */
@@ -1459,7 +1497,7 @@ menu_edit_delete_all_cb (BonoboUIComponent *uic, void *data, const char *path)
composer = E_MSG_COMPOSER (data);
CORBA_exception_init (&ev);
- GNOME_GtkHTML_Editor_Engine_undoBegin (composer->editor_engine, "Delete all but signature", "Undelete all", &ev);
+ GNOME_GtkHTML_Editor_Engine_undo_begin (composer->editor_engine, "Delete all but signature", "Undelete all", &ev);
GNOME_GtkHTML_Editor_Engine_freeze (composer->editor_engine, &ev);
GNOME_GtkHTML_Editor_Engine_runCommand (composer->editor_engine, "disable-selection", &ev);
GNOME_GtkHTML_Editor_Engine_runCommand (composer->editor_engine, "text-default-color", &ev);
@@ -1474,7 +1512,7 @@ menu_edit_delete_all_cb (BonoboUIComponent *uic, void *data, const char *path)
e_msg_composer_show_sig_file (composer);
GNOME_GtkHTML_Editor_Engine_runCommand (composer->editor_engine, "style-normal", &ev);
GNOME_GtkHTML_Editor_Engine_thaw (composer->editor_engine, &ev);
- GNOME_GtkHTML_Editor_Engine_undoEnd (composer->editor_engine, &ev);
+ GNOME_GtkHTML_Editor_Engine_undo_end (composer->editor_engine, &ev);
CORBA_exception_free (&ev);
printf ("delete all\n");
@@ -1514,18 +1552,18 @@ menu_file_insert_file_cb (BonoboUIComponent *uic,
if (file_name == NULL)
return;
- html = get_file_content (composer, file_name, TRUE, E_TEXT_TO_HTML_PRE, TRUE);
+ html = get_file_content (file_name, TRUE, E_TEXT_TO_HTML_PRE);
if (html == NULL)
return;
CORBA_exception_init (&ev);
GNOME_GtkHTML_Editor_Engine_freeze (composer->editor_engine, &ev);
GNOME_GtkHTML_Editor_Engine_runCommand (composer->editor_engine, "cursor-position-save", &ev);
- GNOME_GtkHTML_Editor_Engine_undoBegin (composer->editor_engine, "Insert file", "Uninsert file", &ev);
+ GNOME_GtkHTML_Editor_Engine_undo_begin (composer->editor_engine, "Insert file", "Uninsert file", &ev);
if (!GNOME_GtkHTML_Editor_Engine_isParagraphEmpty (composer->editor_engine, &ev))
GNOME_GtkHTML_Editor_Engine_runCommand (composer->editor_engine, "insert-paragraph", &ev);
GNOME_GtkHTML_Editor_Engine_insertHTML (composer->editor_engine, html, &ev);
- GNOME_GtkHTML_Editor_Engine_undoEnd (composer->editor_engine, &ev);
+ GNOME_GtkHTML_Editor_Engine_undo_end (composer->editor_engine, &ev);
GNOME_GtkHTML_Editor_Engine_runCommand (composer->editor_engine, "cursor-position-restore", &ev);
GNOME_GtkHTML_Editor_Engine_thaw (composer->editor_engine, &ev);
CORBA_exception_free (&ev);
@@ -1707,153 +1745,6 @@ static EPixmap pixcache [] = {
};
static void
-signature_regenerate_cb (BonoboUIComponent *uic, gpointer user_data, const char *path)
-{
- printf ("signature_regenerate_cb: %s\n", path);
-
- e_msg_composer_show_sig_file (E_MSG_COMPOSER (user_data));
-}
-
-static void
-signature_cb (BonoboUIComponent *uic, const char *path, Bonobo_UIComponent_EventType type,
- const char *state, gpointer user_data)
-{
- EMsgComposer *composer = (EMsgComposer *) user_data;
-
- printf ("signature_cb: %s (%s)\n", path, state);
-
- if (state && *state == '1') {
- if (path && !strncmp (path, "Signature", 9)) {
- MailConfigSignature *old_sig;
- gboolean old_random;
-
- old_sig = composer->signature;
- old_random = composer->random_signature;
-
- printf ("I'm going to set signature (%d)\n", atoi (path + 9));
- if (path [9] == 'N') {
- composer->signature = NULL;
- composer->random_signature = FALSE;
- } else if (path [9] == 'R') {
- composer->signature = NULL;
- composer->random_signature = TRUE;
- } else {
- composer->signature = g_list_nth_data (mail_config_get_signature_list (), atoi (path + 9));
- composer->random_signature = FALSE;
- }
- if (old_sig != composer->signature || old_random != composer->random_signature)
- e_msg_composer_show_sig_file (composer);
- }
- }
-
- printf ("signature_cb end\n");
-}
-
-static void setup_signatures_menu (EMsgComposer *composer);
-
-static void
-remove_signature_list (EMsgComposer *composer)
-{
- gchar path [64];
- gint len = g_list_length (mail_config_get_signature_list ());
-
- bonobo_ui_component_rm (composer->uic, "/menu/Edit/EditMisc/EditSignaturesSubmenu/SeparatorList", NULL);
- bonobo_ui_component_rm (composer->uic, "/menu/Edit/EditMisc/EditSignaturesSubmenu/SeparatorRegenerate", NULL);
- bonobo_ui_component_rm (composer->uic, "/menu/Edit/EditMisc/EditSignaturesSubmenu/SignatureRegenerate", NULL);
- for (; len; len --) {
- g_snprintf (path, 64, "/menu/Edit/EditMisc/EditSignaturesSubmenu/Signature%d", len - 1);
- bonobo_ui_component_rm (composer->uic, path, NULL);
- }
-}
-
-static void
-sig_event_client (MailConfigSigEvent event, MailConfigSignature *sig, EMsgComposer *composer)
-{
- gchar *path;
-
- bonobo_ui_component_freeze (composer->uic, NULL);
- switch (event) {
- case MAIL_CONFIG_SIG_EVENT_DELETED:
- if (sig == composer->signature)
- composer->signature = NULL;
- path = g_strdup_printf ("/menu/Edit/EditMisc/EditSignaturesSubmenu/Signature%d",
- g_list_length (mail_config_get_signature_list ()));
- bonobo_ui_component_rm (composer->uic, path, NULL);
- g_free (path);
- setup_signatures_menu (composer);
- break;
- case MAIL_CONFIG_SIG_EVENT_RANDOM_OFF:
- composer->random_signature = FALSE;
- bonobo_ui_component_rm (composer->uic, "/menu/Edit/EditMisc/EditSignaturesSubmenu/SignatureRandom", NULL);
- bonobo_ui_component_rm (composer->uic, "/menu/Edit/EditMisc/EditSignaturesSubmenu/SeparatorRandom", NULL);
- setup_signatures_menu (composer);
- break;
- case MAIL_CONFIG_SIG_EVENT_RANDOM_ON:
- remove_signature_list (composer);
- setup_signatures_menu (composer);
- break;
- case MAIL_CONFIG_SIG_EVENT_ADDED:
- case MAIL_CONFIG_SIG_EVENT_NAME_CHANGED:
- setup_signatures_menu (composer);
- default:
- ;
- }
- bonobo_ui_component_thaw (composer->uic, NULL);
-}
-
-static void
-setup_signatures_menu (EMsgComposer *composer)
-{
- GList *l, *list;
- GString *str;
- gchar *line;
- gint i, len = 0;
-
- str = g_string_new ("<submenu name=\"EditSignaturesSubmenu\" _label=\"Signatures\">\n"
- "<menuitem name=\"SignatureNone\" _label=\"None\" verb=\"SignatureNone\""
- " type=\"radio\" group=\"signatures_group\"/>\n");
- if (mail_config_get_signatures_random ()) {
- g_string_append (str,
- "<separator name=\"SeparatorRandom\"/>\n"
- "<menuitem name=\"SignatureRandom\" _label=\"Random\" verb=\"SignatureRandom\""
- " type=\"radio\" group=\"signatures_group\"/>\n");
- }
-
- list = mail_config_get_signature_list ();
- if (list) {
-
- g_string_append (str, "<separator name=\"SeparatorList\"/>");
-
- for (l = list; l; len ++, l = l->next) {
- line = g_strdup_printf ("<menuitem name=\"Signature%d\" _label=\"%s\""
- " verb=\"Signature%d\" type=\"radio\" group=\"signatures_group\"/>\n",
- len, ((MailConfigSignature *)l->data)->name, len);
- g_string_append (str, line);
- g_free (line);
- }
- }
-
- g_string_append (str,
- "<separator name=\"SeparatorRegenerate\"/>\n"
- "<menuitem name=\"SignatureRegenerate\" _label=\"_Regenerate\""
- " verb=\"SignatureRegenerate\" accel=\"*Ctrl**Shift*G\"/>");
- g_string_append (str, "</submenu>\n");
-
- bonobo_ui_component_set_translate (composer->uic, "/menu/Edit/EditMisc/", str->str, NULL);
- bonobo_ui_component_set (composer->uic, "/menu/Edit/EditMisc/", "<separator/>", NULL);
-
- bonobo_ui_component_add_listener (composer->uic, "SignatureNone", signature_cb, composer);
- bonobo_ui_component_add_listener (composer->uic, "SignatureRandom", signature_cb, composer);
- bonobo_ui_component_add_verb (composer->uic, "SignatureRegenerate", signature_regenerate_cb, composer);
-
- for (i = 0; i < len; i ++) {
- g_string_sprintf (str, "Signature%d", i + 1);
- bonobo_ui_component_add_listener (composer->uic, str->str, signature_cb, composer);
- }
- g_string_free (str, TRUE);
-}
-
-static void
setup_ui (EMsgComposer *composer)
{
BonoboUIContainer *container;
@@ -2004,9 +1895,6 @@ setup_ui (EMsgComposer *composer)
bonobo_ui_component_add_listener (
composer->uic, "ViewAttach",
menu_view_attachments_activate_cb, composer);
-
- setup_signatures_menu (composer);
- mail_config_signature_register_client ((MailConfigSignatureClient) sig_event_client, composer);
bonobo_ui_component_thaw (composer->uic, NULL);
}
@@ -2062,110 +1950,6 @@ hdrs_changed_cb (EMsgComposerHdrs *hdrs,
e_msg_composer_set_changed (composer);
}
-enum {
- UPDATE_AUTO_CC,
- UPDATE_AUTO_BCC,
-};
-
-static void
-update_auto_recipients (EMsgComposerHdrs *hdrs, int mode, const char *auto_addrs)
-{
- EDestination *dest, **destv = NULL;
- CamelInternetAddress *iaddr;
- GList *list, *tail, *node;
- int i, n = 0;
-
- tail = list = NULL;
-
- if (auto_addrs) {
- iaddr = camel_internet_address_new ();
- if (camel_address_decode (CAMEL_ADDRESS (iaddr), auto_addrs) != -1) {
- for (i = 0; i < camel_address_length (CAMEL_ADDRESS (iaddr)); i++) {
- const char *name, *addr;
-
- if (!camel_internet_address_get (iaddr, i, &name, &addr))
- continue;
-
- dest = e_destination_new ();
- e_destination_set_auto_recipient (dest, TRUE);
-
- if (name)
- e_destination_set_name (dest, name);
-
- if (addr)
- e_destination_set_email (dest, addr);
-
- node = g_list_alloc ();
- node->data = dest;
- node->next = NULL;
-
- if (tail) {
- node->prev = tail;
- tail->next = node;
- } else {
- node->prev = NULL;
- list = node;
- }
-
- tail = node;
- n++;
- }
- }
-
- camel_object_unref (CAMEL_OBJECT (iaddr));
- }
-
- switch (mode) {
- case UPDATE_AUTO_CC:
- destv = e_msg_composer_hdrs_get_cc (hdrs);
- break;
- case UPDATE_AUTO_BCC:
- destv = e_msg_composer_hdrs_get_bcc (hdrs);
- break;
- default:
- g_assert_not_reached ();
- }
-
- if (destv) {
- for (i = 0; destv[i]; i++) {
- if (!e_destination_is_auto_recipient (destv[i])) {
- node = g_list_alloc ();
- node->data = e_destination_copy (destv[i]);
- node->next = NULL;
-
- if (tail) {
- node->prev = tail;
- tail->next = node;
- } else {
- node->prev = NULL;
- list = node;
- }
-
- tail = node;
- n++;
- }
- }
-
- e_destination_freev (destv);
- }
-
- destv = e_destination_list_to_vector_sized (list, n);
- g_list_free (list);
-
- switch (mode) {
- case UPDATE_AUTO_CC:
- e_msg_composer_hdrs_set_cc (hdrs, destv);
- break;
- case UPDATE_AUTO_BCC:
- e_msg_composer_hdrs_set_bcc (hdrs, destv);
- break;
- default:
- g_assert_not_reached ();
- }
-
- e_destination_freev (destv);
-}
-
static void
from_changed_cb (EMsgComposerHdrs *hdrs, void *data)
{
@@ -2174,18 +1958,10 @@ from_changed_cb (EMsgComposerHdrs *hdrs, void *data)
composer = E_MSG_COMPOSER (data);
if (hdrs->account) {
- const MailConfigAccount *account = hdrs->account;
-
- e_msg_composer_set_pgp_sign (composer, account->pgp_always_sign);
- e_msg_composer_set_smime_sign (composer, account->smime_always_sign);
- update_auto_recipients (hdrs, UPDATE_AUTO_CC, account->always_cc ? account->cc_addrs : NULL);
- update_auto_recipients (hdrs, UPDATE_AUTO_BCC, account->always_bcc ? account->bcc_addrs : NULL);
- } else {
- update_auto_recipients (hdrs, UPDATE_AUTO_CC, NULL);
- update_auto_recipients (hdrs, UPDATE_AUTO_BCC, NULL);
+ e_msg_composer_set_pgp_sign (composer, hdrs->account->pgp_always_sign);
+ e_msg_composer_set_smime_sign (composer, hdrs->account->smime_always_sign);
}
-
- set_editor_signature (composer);
+
e_msg_composer_show_sig_file (composer);
}
@@ -2212,8 +1988,6 @@ destroy (GtkObject *object)
composer = E_MSG_COMPOSER (object);
- mail_config_signature_unregister_client ((MailConfigSignatureClient) sig_event_client, composer);
-
CORBA_exception_init (&ev);
if (composer->config_db) {
@@ -2272,9 +2046,6 @@ destroy (GtkObject *object)
CORBA_exception_free (&ev);
- if (composer->redirect)
- camel_object_unref (CAMEL_OBJECT (composer->redirect));
-
if (composer->editor_listener)
bonobo_object_unref (composer->editor_listener);
@@ -2337,18 +2108,16 @@ message_rfc822_dnd (EMsgComposer *composer, CamelStream *stream)
static void
drag_data_received (EMsgComposer *composer, GdkDragContext *context,
- int x, int y, GtkSelectionData *selection,
+ gint x, gint y, GtkSelectionData *selection,
guint info, guint time)
{
- char *tmp, *filename, **filenames;
- CamelMimePart *mime_part;
+ gchar *tmp, *filename, **filenames;
CamelStream *stream;
CamelURL *url;
int i;
switch (info) {
case DND_TYPE_MESSAGE_RFC822:
- d(printf ("dropping a message/rfc822\n"));
/* write the message(s) out to a CamelStream so we can use it */
stream = camel_stream_mem_new ();
camel_stream_write (stream, selection->data, selection->length);
@@ -2358,7 +2127,6 @@ drag_data_received (EMsgComposer *composer, GdkDragContext *context,
camel_object_unref (CAMEL_OBJECT (stream));
break;
case DND_TYPE_TEXT_URI_LIST:
- d(printf ("dropping a text/uri-list\n"));
tmp = g_strndup (selection->data, selection->length);
filenames = g_strsplit (tmp, "\n", 0);
g_free (tmp);
@@ -2381,35 +2149,11 @@ drag_data_received (EMsgComposer *composer, GdkDragContext *context,
g_free (filenames);
break;
- case DND_TYPE_TEXT_VCARD:
- d(printf ("dropping a text/x-vcard\n"));
- mime_part = camel_mime_part_new ();
- camel_mime_part_set_content (mime_part, selection->data,
- selection->length, "text/x-vcard");
- camel_mime_part_set_disposition (mime_part, "inline");
-
- e_msg_composer_attachment_bar_attach_mime_part
- (E_MSG_COMPOSER_ATTACHMENT_BAR (composer->attachment_bar),
- mime_part);
-
- camel_object_unref (CAMEL_OBJECT (mime_part));
default:
- d(printf ("dropping an unknown\n"));
break;
}
}
-typedef void (*GtkSignal_NONE__NONE_INT) (GtkObject *, int, gpointer);
-
-static void marshal_NONE__NONE_INT (GtkObject *object, GtkSignalFunc func,
- gpointer func_data, GtkArg *args)
-{
- GtkSignal_NONE__NONE_INT rfunc;
-
- rfunc = (GtkSignal_NONE__NONE_INT) func;
- (*rfunc)(object, GTK_VALUE_INT (args[0]), func_data);
-}
-
static void
class_init (EMsgComposerClass *klass)
@@ -2443,14 +2187,6 @@ class_init (EMsgComposerClass *klass)
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
- signals[SAVE_DRAFT] =
- gtk_signal_new ("save-draft",
- GTK_RUN_LAST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EMsgComposerClass, save_draft),
- marshal_NONE__NONE_INT,
- GTK_TYPE_NONE, 1, GTK_TYPE_INT);
-
gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
}
@@ -2487,8 +2223,6 @@ init (EMsgComposer *composer)
composer->has_changed = FALSE;
- composer->redirect = FALSE;
-
composer->charset = NULL;
composer->enable_autosave = TRUE;
@@ -2599,14 +2333,14 @@ map_default_cb (EMsgComposer *composer, gpointer user_data)
pb = bonobo_control_frame_get_control_property_bag (cf, NULL);
text = bonobo_property_bag_client_get_value_string (pb, "text", NULL);
bonobo_object_release_unref (pb, NULL);
-
+
if (!text || text[0] == '\0') {
bonobo_control_frame_focus_child (cf, GTK_DIR_TAB_FORWARD);
g_free (text);
return;
}
g_free (text);
-
+
/* If not, check the subject field */
text = e_msg_composer_hdrs_get_subject (E_MSG_COMPOSER_HDRS (composer->hdrs));
@@ -2736,7 +2470,7 @@ create_composer (void)
gtk_widget_show (composer->editor);
e_msg_composer_show_attachments (composer, FALSE);
-
+
prepare_engine (composer);
if (composer->editor_engine == CORBA_OBJECT_NIL) {
e_activation_failure_dialog (GTK_WINDOW (composer),
@@ -2749,43 +2483,13 @@ create_composer (void)
}
gtk_signal_connect (GTK_OBJECT (composer), "map", map_default_cb, NULL);
-
+
if (am == NULL) {
am = autosave_manager_new ();
}
autosave_manager_register (am, composer);
-
- return composer;
-}
-static void
-set_editor_signature (EMsgComposer *composer)
-{
- printf ("set_editor_signature\n");
- if (E_MSG_COMPOSER_HDRS (composer->hdrs)->account->id) {
- MailConfigIdentity *id;
- char *verb;
-
- id = E_MSG_COMPOSER_HDRS (composer->hdrs)->account->id;
-
- composer->random_signature = composer->send_html ? id->html_random : id->text_random;
- if (composer->random_signature)
- composer->signature = NULL;
- else
- composer->signature = composer->send_html ? id->html_signature : id->text_signature;
-
- if (composer->random_signature) {
- verb = g_strdup ("/commands/SignatureRandom");
- } else if (composer->signature == NULL) {
- verb = g_strdup ("/commands/SignatureNone");
- } else {
- verb = g_strdup_printf ("/commands/Signature%d", composer->signature->id);
- }
-
- bonobo_ui_component_set_prop (composer->uic, verb, "state", "1", NULL);
- g_free (verb);
- }
- printf ("set_editor_signature end\n");
+ return composer;
}
/**
@@ -2804,26 +2508,52 @@ e_msg_composer_new (void)
if (new) {
e_msg_composer_set_send_html (new, mail_config_get_send_html ());
set_editor_text (new, "");
- set_editor_signature (new);
}
return new;
}
+
+/* FIXME: are there any other headers?? */
+/* This is a list of headers that we DO NOT want to append to the
+ * extra_hdr_* arrays.
+ *
+ * Note: a '*' char can be used for a simple wilcard match.
+ * is_special_header() will use g_strNcasecmp() with the first '*'
+ * char being the end of the match string. If no '*' is present, then
+ * it will be assumed that the header must be an exact match.
+ */
+static char *special_headers[] = {
+ "Subject",
+ "Date",
+ "From",
+ "To",
+ "Cc",
+ "Bcc",
+ "Received",
+ "Message-Id",
+ "X-Evolution*",
+ "Content-*",
+ "MIME-Version",
+ NULL
+};
+
static gboolean
is_special_header (const char *hdr_name)
{
- /* Note: a header is a "special header" if it has any meaning:
- 1. it's not a X-* header or
- 2. it's an X-Evolution* header
- */
- if (g_strncasecmp (hdr_name, "X-", 2))
- return TRUE;
-
- if (!g_strncasecmp (hdr_name, "X-Evolution", 11))
- return TRUE;
+ int i;
- /* we can keep all other X-* headers */
+ for (i = 0; special_headers[i]; i++) {
+ char *p;
+
+ if ((p = strchr (special_headers[i], '*'))) {
+ if (!g_strncasecmp (special_headers[i], hdr_name, p - special_headers[i]))
+ return TRUE;
+ } else {
+ if (!g_strcasecmp (special_headers[i], hdr_name))
+ return TRUE;
+ }
+ }
return FALSE;
}
@@ -2846,7 +2576,7 @@ e_msg_composer_flush_pending_body (EMsgComposer *composer, gboolean apply)
body = gtk_object_get_data (GTK_OBJECT (composer), "body:text");
if (body) {
if (apply)
- set_editor_text (composer, body);
+ e_msg_composer_set_body_text (composer, body);
gtk_object_set_data (GTK_OBJECT (composer), "body:text", NULL);
g_free (body);
@@ -3186,10 +2916,8 @@ e_msg_composer_new_with_message (CamelMimeMessage *message)
/* We wait until now to set the body text because we need to ensure that
* the attachment bar has all the attachments, before we request them.
- */
+ */
e_msg_composer_flush_pending_body (new, TRUE);
-
- set_editor_signature (new);
return new;
}
@@ -3205,35 +2933,29 @@ disable_editor (EMsgComposer *composer)
bonobo_ui_component_set_prop (composer->uic, "/menu/Insert", "sensitive", "0", NULL);
}
-/**
- * e_msg_composer_new_redirect:
- * @message: The message to use as the source
- *
- * Create a new message composer widget.
- *
- * Return value: A pointer to the newly created widget
- **/
-EMsgComposer *
-e_msg_composer_new_redirect (CamelMimeMessage *message, const char *resent_from)
+#if 0
+static GList *
+add_recipients (GList *list, const char *recips, gboolean decode)
{
- EMsgComposer *composer;
- const char *subject;
-
- g_return_val_if_fail (message != NULL, NULL);
-
- composer = e_msg_composer_new_with_message (message);
- subject = camel_mime_message_get_subject (message);
-
- composer->redirect = message;
- camel_object_ref (CAMEL_OBJECT (message));
+ int len;
+ char *addr;
- e_msg_composer_set_headers (composer, resent_from, NULL, NULL, NULL, subject);
-
- disable_editor (composer);
+ while (*recips) {
+ len = strcspn (recips, ",");
+ if (len) {
+ addr = g_strndup (recips, len);
+ if (decode)
+ camel_url_decode (addr);
+ list = g_list_append (list, addr);
+ }
+ recips += len;
+ if (*recips == ',')
+ recips++;
+ }
- return composer;
+ return list;
}
-
+#endif
static GList *
add_recipients (GList *list, const char *recips, gboolean decode)
@@ -3277,21 +2999,24 @@ e_msg_composer_new_from_url (const char *url_in)
EDestination **tov, **ccv, **bccv;
char *subject = NULL, *body = NULL;
const char *p, *header;
- char *content;
int len, clen;
+ char *url, *content;
+
g_return_val_if_fail (g_strncasecmp (url_in, "mailto:", 7) == 0, NULL);
composer = e_msg_composer_new ();
if (!composer)
return NULL;
-
- /* Parse recipients (everything after ':' until '?' or eos). */
- p = url_in + 7;
+
+ url = g_strdup (url_in);
+ camel_url_decode (url);
+
+ /* Parse recipients (everything after ':' until '?' or eos. */
+ p = url + 7;
len = strcspn (p, "?");
if (len) {
content = g_strndup (p, len);
- camel_url_decode (content);
to = add_recipients (to, content, FALSE);
g_free (content);
}
@@ -3311,29 +3036,21 @@ e_msg_composer_new_from_url (const char *url_in)
p += len + 1;
clen = strcspn (p, "&");
-
content = g_strndup (p, clen);
camel_url_decode (content);
-
- if (!g_strncasecmp (header, "to", len)) {
+
+ if (!g_strncasecmp (header, "to", len))
to = add_recipients (to, content, FALSE);
- } else if (!g_strncasecmp (header, "cc", len)) {
+ else if (!g_strncasecmp (header, "cc", len))
cc = add_recipients (cc, content, FALSE);
- } else if (!g_strncasecmp (header, "bcc", len)) {
+ else if (!g_strncasecmp (header, "bcc", len))
bcc = add_recipients (bcc, content, FALSE);
- } else if (!g_strncasecmp (header, "subject", len)) {
- g_free (subject);
+ else if (!g_strncasecmp (header, "subject", len))
subject = g_strdup (content);
- } else if (!g_strncasecmp (header, "body", len)) {
- g_free (body);
+ else if (!g_strncasecmp (header, "body", len))
body = g_strdup (content);
- } else {
- /* add an arbitrary header */
- e_msg_composer_add_header (composer, header, content);
- }
g_free (content);
-
p += clen;
if (*p == '&') {
p++;
@@ -3342,35 +3059,33 @@ e_msg_composer_new_from_url (const char *url_in)
}
}
}
-
+
tov = e_destination_list_to_vector (to);
ccv = e_destination_list_to_vector (cc);
bccv = e_destination_list_to_vector (bcc);
-
+
g_list_free (to);
g_list_free (cc);
g_list_free (bcc);
-
+
hdrs = E_MSG_COMPOSER_HDRS (composer->hdrs);
-
+
e_msg_composer_hdrs_set_to (hdrs, tov);
e_msg_composer_hdrs_set_cc (hdrs, ccv);
e_msg_composer_hdrs_set_bcc (hdrs, bccv);
-
+
e_destination_freev (tov);
e_destination_freev (ccv);
e_destination_freev (bccv);
-
+
if (subject) {
e_msg_composer_hdrs_set_subject (hdrs, subject);
g_free (subject);
}
if (body) {
- char *htmlbody;
-
- htmlbody = e_text_to_html (body, E_TEXT_TO_HTML_PRE);
- set_editor_text (composer, htmlbody);
+ char *htmlbody = e_text_to_html (body, E_TEXT_TO_HTML_PRE);
+ e_msg_composer_set_body_text (composer, htmlbody);
g_free (htmlbody);
}
@@ -3440,11 +3155,10 @@ e_msg_composer_set_body_text (EMsgComposer *composer, const char *text)
{
g_return_if_fail (E_IS_MSG_COMPOSER (composer));
- set_editor_text (composer, text);
+ printf ("setting as body text:\n-----\n%s\n-----\n", text);
+ fflush (stdout);
- /* set editor text unfortunately kills the signature so we
- have to re-show it */
- e_msg_composer_show_sig_file (composer);
+ set_editor_text (composer, text);
}
@@ -3687,8 +3401,8 @@ delete_old_signature (EMsgComposer *composer)
/* if (!rv)
break; */
GNOME_GtkHTML_Editor_Engine_setParagraphData (composer->editor_engine, "signature", "0", &ev);
- GNOME_GtkHTML_Editor_Engine_runCommand (composer->editor_engine, "delete-back", &ev);
- }
+ } else
+ GNOME_GtkHTML_Editor_Engine_runCommand (composer->editor_engine, "insert-paragraph", &ev);
CORBA_exception_free (&ev);
}
@@ -3707,38 +3421,30 @@ e_msg_composer_show_sig_file (EMsgComposer *composer)
g_return_if_fail (composer != NULL);
g_return_if_fail (E_IS_MSG_COMPOSER (composer));
- printf ("e_msg_composer_show_sig_file\n");
/* printf ("set sig '%s' '%s'\n", sig_file, composer->sig_file); */
composer->in_signature_insert = TRUE;
CORBA_exception_init (&ev);
GNOME_GtkHTML_Editor_Engine_freeze (composer->editor_engine, &ev);
GNOME_GtkHTML_Editor_Engine_runCommand (composer->editor_engine, "cursor-position-save", &ev);
- GNOME_GtkHTML_Editor_Engine_undoBegin (composer->editor_engine, "Set signature", "Reset signature", &ev);
+ GNOME_GtkHTML_Editor_Engine_undo_begin (composer->editor_engine, "Set signature", "Reset signature", &ev);
delete_old_signature (composer);
html = get_signature_html (composer);
if (html) {
if (!GNOME_GtkHTML_Editor_Engine_isParagraphEmpty (composer->editor_engine, &ev))
GNOME_GtkHTML_Editor_Engine_runCommand (composer->editor_engine, "insert-paragraph", &ev);
- if (!GNOME_GtkHTML_Editor_Engine_runCommand (composer->editor_engine, "cursor-backward", &ev))
- GNOME_GtkHTML_Editor_Engine_runCommand (composer->editor_engine, "insert-paragraph", &ev);
- else
- GNOME_GtkHTML_Editor_Engine_runCommand (composer->editor_engine, "cursor-forward", &ev);
/* printf ("insert %s\n", html); */
GNOME_GtkHTML_Editor_Engine_setParagraphData (composer->editor_engine, "orig", "0", &ev);
GNOME_GtkHTML_Editor_Engine_runCommand (composer->editor_engine, "indent-zero", &ev);
GNOME_GtkHTML_Editor_Engine_insertHTML (composer->editor_engine, html, &ev);
g_free (html);
}
-
- GNOME_GtkHTML_Editor_Engine_undoEnd (composer->editor_engine, &ev);
+ GNOME_GtkHTML_Editor_Engine_undo_end (composer->editor_engine, &ev);
GNOME_GtkHTML_Editor_Engine_runCommand (composer->editor_engine, "cursor-position-restore", &ev);
GNOME_GtkHTML_Editor_Engine_thaw (composer->editor_engine, &ev);
CORBA_exception_free (&ev);
composer->in_signature_insert = FALSE;
-
- printf ("e_msg_composer_show_sig_file end\n");
}
/**
@@ -3775,7 +3481,6 @@ e_msg_composer_set_send_html (EMsgComposer *composer,
composer->send_html, NULL);
set_config (composer, "FormatHTML", composer->send_html);
- set_editor_signature (composer);
e_msg_composer_show_sig_file (composer);
GNOME_GtkHTML_Editor_Engine_runCommand (composer->editor_engine, "unblock-redraw", &ev);
CORBA_exception_free (&ev);
@@ -4235,13 +3940,12 @@ gboolean
e_msg_composer_is_dirty (EMsgComposer *composer)
{
CORBA_Environment ev;
- gboolean rv;
-
+ gboolean dirty = composer->has_changed;
CORBA_exception_init (&ev);
- rv = composer->has_changed || GNOME_GtkHTML_Editor_Engine_hasUndo (composer->editor_engine, &ev);
- CORBA_exception_free (&ev);
-
- return rv;
+
+ dirty = dirty || Bonobo_PersistStream_isDirty (composer->persist_stream_interface, &ev);
+
+ return dirty;
}
void
@@ -4253,71 +3957,5 @@ e_msg_composer_set_enable_autosave (EMsgComposer *composer, gboolean enabled)
composer->enable_autosave = enabled;
}
-static gchar *
-next_word (const gchar *s, const gchar **sr)
-{
- if (!s || !*s)
- return NULL;
- else {
- const gchar *begin;
- gunichar uc;
- gboolean cited;
-
- do {
- begin = s;
- cited = FALSE;
- uc = g_utf8_get_char (s);
- if (uc == 0)
- return NULL;
- s = g_utf8_next_char (s);
- } while (!html_selection_spell_word (uc, &cited) && !cited && s);
-
- /* we are at beginning of word */
- if (s && *s) {
- gboolean cited_end;
-
- cited_end = FALSE;
- uc = g_utf8_get_char (s);
-
- /* go to end of word */
- while (html_selection_spell_word (uc, &cited_end) || (!cited && cited_end)) {
- cited_end = FALSE;
- s = g_utf8_next_char (s);
- uc = g_utf8_get_char (s);
- if (uc == 0)
- break;
- }
- *sr = s;
- return s ? g_strndup (begin, s - begin) : g_strdup (begin);
- } else
- return NULL;
- }
-}
-
-void
-e_msg_composer_ignore (EMsgComposer *composer, const gchar *str)
-{
- CORBA_Environment ev;
- gchar *word;
-
- if (!str)
- return;
-
- CORBA_exception_init (&ev);
- while ((word = next_word (str, &str))) {
- /* printf ("ignore word %s\n", word); */
- GNOME_GtkHTML_Editor_Engine_ignoreWord (composer->editor_engine, word, &ev);
- g_free (word);
- }
- CORBA_exception_free (&ev);
-}
-
-void
-e_msg_composer_drop_editor_undo (EMsgComposer *composer)
-{
- CORBA_Environment ev;
- CORBA_exception_init (&ev);
- GNOME_GtkHTML_Editor_Engine_dropUndo (composer->editor_engine, &ev);
- CORBA_exception_free (&ev);
-}
+
diff --git a/composer/e-msg-composer.h b/composer/e-msg-composer.h
index 921dfc2ee1..7b0abce536 100644
--- a/composer/e-msg-composer.h
+++ b/composer/e-msg-composer.h
@@ -72,7 +72,7 @@ struct _EMsgComposer {
BonoboObject *editor_listener;
GHashTable *inline_images, *inline_images_by_url;
GList *current_images;
-
+
Bonobo_ConfigDatabase config_db;
char *mime_type, *mime_body, *charset;
@@ -97,11 +97,6 @@ struct _EMsgComposer {
gboolean in_signature_insert : 1;
gboolean enable_autosave : 1;
-
- CamelMimeMessage *redirect;
-
- MailConfigSignature *signature;
- gboolean random_signature;
};
struct _EMsgComposerClass {
@@ -109,91 +104,90 @@ struct _EMsgComposerClass {
void (* send) (EMsgComposer *composer);
void (* postpone) (EMsgComposer *composer);
- void (* save_draft) (EMsgComposer *composer, int quit);
};
-GtkType e_msg_composer_get_type (void);
-EMsgComposer *e_msg_composer_new (void);
-EMsgComposer *e_msg_composer_new_with_message (CamelMimeMessage *msg);
-EMsgComposer *e_msg_composer_new_from_url (const char *url);
-EMsgComposer *e_msg_composer_new_redirect (CamelMimeMessage *message,
- const char *resent_from);
-void e_msg_composer_show_attachments (EMsgComposer *composer,
- gboolean show);
-void e_msg_composer_set_headers (EMsgComposer *composer,
- const char *from,
- EDestination **to,
- EDestination **cc,
- EDestination **bcc,
- const char *subject);
-void e_msg_composer_set_body_text (EMsgComposer *composer,
- const char *text);
-void e_msg_composer_set_body (EMsgComposer *composer,
- const char *body,
- const char *mime_type);
-void e_msg_composer_add_header (EMsgComposer *composer,
- const char *name,
- const char *value);
-void e_msg_composer_attach (EMsgComposer *composer,
- CamelMimePart *attachment);
-CamelMimePart *e_msg_composer_add_inline_image_from_file (EMsgComposer *composer,
- const char *filename);
-void e_msg_composer_add_inline_image_from_mime_part (EMsgComposer *composer,
- CamelMimePart *part);
-CamelMimeMessage *e_msg_composer_get_message (EMsgComposer *composer);
-CamelMimeMessage *e_msg_composer_get_message_draft (EMsgComposer *composer);
-void e_msg_composer_show_sig_file (EMsgComposer *composer);
-gboolean e_msg_composer_get_send_html (EMsgComposer *composer);
-void e_msg_composer_set_send_html (EMsgComposer *composer,
- gboolean send_html);
-gboolean e_msg_composer_get_view_from (EMsgComposer *composer);
-void e_msg_composer_set_view_from (EMsgComposer *composer,
- gboolean view_from);
-gboolean e_msg_composer_get_view_replyto (EMsgComposer *composer);
-void e_msg_composer_set_view_replyto (EMsgComposer *composer,
- gboolean view_replyto);
-gboolean e_msg_composer_get_view_bcc (EMsgComposer *composer);
-void e_msg_composer_set_view_bcc (EMsgComposer *composer,
- gboolean view_bcc);
-gboolean e_msg_composer_get_view_cc (EMsgComposer *composer);
-void e_msg_composer_set_view_cc (EMsgComposer *composer,
- gboolean view_cc);
+GtkType e_msg_composer_get_type (void);
+EMsgComposer *e_msg_composer_new (void);
+EMsgComposer *e_msg_composer_new_with_message (CamelMimeMessage *msg);
+EMsgComposer *e_msg_composer_new_from_url (const char *url);
+void e_msg_composer_show_attachments (EMsgComposer *composer,
+ gboolean show);
+void e_msg_composer_set_headers (EMsgComposer *composer,
+ const char *from,
+ EDestination **to,
+ EDestination **cc,
+ EDestination **bcc,
+ const char *subject);
+void e_msg_composer_set_body_text (EMsgComposer *composer,
+ const char *text);
+void e_msg_composer_set_body (EMsgComposer *composer,
+ const char *body,
+ const char *mime_type);
+void e_msg_composer_add_header (EMsgComposer *composer,
+ const char *name,
+ const char *value);
+void e_msg_composer_attach (EMsgComposer *composer,
+ CamelMimePart *attachment);
+CamelMimePart *e_msg_composer_add_inline_image_from_file (EMsgComposer *composer,
+ const char *filename);
+void e_msg_composer_add_inline_image_from_mime_part (EMsgComposer *composer,
+ CamelMimePart *part);
+CamelMimeMessage *e_msg_composer_get_message (EMsgComposer *composer);
+CamelMimeMessage *e_msg_composer_get_message_draft (EMsgComposer *composer);
+void e_msg_composer_show_sig_file (EMsgComposer *composer);
+gboolean e_msg_composer_get_send_html (EMsgComposer *composer);
+void e_msg_composer_set_send_html (EMsgComposer *composer,
+ gboolean send_html);
+gboolean e_msg_composer_get_view_from (EMsgComposer *composer);
+void e_msg_composer_set_view_from (EMsgComposer *composer,
+ gboolean view_from);
+
+gboolean e_msg_composer_get_view_replyto (EMsgComposer *composer);
+void e_msg_composer_set_view_replyto (EMsgComposer *composer,
+ gboolean view_replyto);
+
+gboolean e_msg_composer_get_view_bcc (EMsgComposer *composer);
+void e_msg_composer_set_view_bcc (EMsgComposer *composer,
+ gboolean view_bcc);
+gboolean e_msg_composer_get_view_cc (EMsgComposer *composer);
+void e_msg_composer_set_view_cc (EMsgComposer *composer,
+ gboolean view_cc);
EDestination **e_msg_composer_get_recipients (EMsgComposer *composer);
-const MailConfigAccount *e_msg_composer_get_preferred_account (EMsgComposer *composer);
-void e_msg_composer_clear_inlined_table (EMsgComposer *composer);
-gchar *e_msg_composer_guess_mime_type (const gchar *file_name);
-void e_msg_composer_set_changed (EMsgComposer *composer);
-void e_msg_composer_unset_changed (EMsgComposer *composer);
-gboolean e_msg_composer_is_dirty (EMsgComposer *composer);
-void e_msg_composer_set_enable_autosave (EMsgComposer *composer,
- gboolean enabled);
+const MailConfigAccount *e_msg_composer_get_preferred_account (EMsgComposer *composer);
+
+void e_msg_composer_clear_inlined_table (EMsgComposer *composer);
+gchar * e_msg_composer_guess_mime_type (const gchar *file_name);
+
+void e_msg_composer_set_changed (EMsgComposer *composer);
+void e_msg_composer_unset_changed (EMsgComposer *composer);
+gboolean e_msg_composer_is_dirty (EMsgComposer *composer);
+void e_msg_composer_set_enable_autosave (EMsgComposer *composer, gboolean enabled);
/* PGP */
-void e_msg_composer_set_pgp_sign (EMsgComposer *composer,
- gboolean pgp_sign);
-gboolean e_msg_composer_get_pgp_sign (EMsgComposer *composer);
-void e_msg_composer_set_pgp_encrypt (EMsgComposer *composer,
- gboolean pgp_encrypt);
-gboolean e_msg_composer_get_pgp_encrypt (EMsgComposer *composer);
+void e_msg_composer_set_pgp_sign (EMsgComposer *composer,
+ gboolean pgp_sign);
+gboolean e_msg_composer_get_pgp_sign (EMsgComposer *composer);
+void e_msg_composer_set_pgp_encrypt (EMsgComposer *composer,
+ gboolean pgp_encrypt);
+gboolean e_msg_composer_get_pgp_encrypt (EMsgComposer *composer);
/* S/MIME */
-void e_msg_composer_set_smime_sign (EMsgComposer *composer,
- gboolean smime_sign);
-gboolean e_msg_composer_get_smime_sign (EMsgComposer *composer);
-void e_msg_composer_set_smime_encrypt (EMsgComposer *composer,
- gboolean smime_encrypt);
-gboolean e_msg_composer_get_smime_encrypt (EMsgComposer *composer);
-gchar *e_msg_composer_get_sig_file_content (const char *sigfile,
- gboolean in_html);
-void e_msg_composer_add_message_attachments (EMsgComposer *composer,
- CamelMimeMessage *message,
- gboolean just_inlines);
-void e_msg_composer_ignore (EMsgComposer *composer,
- const gchar *str);
-void e_msg_composer_drop_editor_undo (EMsgComposer *composer);
+void e_msg_composer_set_smime_sign (EMsgComposer *composer,
+ gboolean smime_sign);
+gboolean e_msg_composer_get_smime_sign (EMsgComposer *composer);
+void e_msg_composer_set_smime_encrypt (EMsgComposer *composer,
+ gboolean smime_encrypt);
+gboolean e_msg_composer_get_smime_encrypt (EMsgComposer *composer);
+gchar * e_msg_composer_get_sig_file_content (const char *sigfile,
+ gboolean in_html);
+
+void e_msg_composer_add_message_attachments (EMsgComposer *composer,
+ CamelMimeMessage *message,
+ gboolean just_inlines);
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/configure.in b/configure.in
index 4f01f831ee..17fe4ab90c 100644
--- a/configure.in
+++ b/configure.in
@@ -3,10 +3,10 @@ AC_INIT(camel)
AM_CONFIG_HEADER(config.h)
EVOLUTION_MAJOR_VERSION=1
-EVOLUTION_MINOR_VERSION=1
-EVOLUTION_MICRO_VERSION=0
-EVOLUTION_NANO_VERSION=99
-VERSION=$EVOLUTION_MAJOR_VERSION.$EVOLUTION_MINOR_VERSION.$EVOLUTION_MICRO_VERSION.$EVOLUTION_NANO_VERSION
+EVOLUTION_MINOR_VERSION=0
+EVOLUTION_MICRO_VERSION=4
+EVOLUTION_NANO_VERSION=0
+VERSION=$EVOLUTION_MAJOR_VERSION.$EVOLUTION_MINOR_VERSION.$EVOLUTION_MICRO_VERSION
PACKAGE=evolution
AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
@@ -14,8 +14,8 @@ AC_SUBST(VERSION)
AC_CANONICAL_HOST
-AC_DEFINE_UNQUOTED(VERSION_COMMENT, "(Preview Release)")
-
+AC_DEFINE_UNQUOTED(VERSION_COMMENT, "")
+
AC_DEFUN(EVO_CHECK_LIB, [
dispname="$1"
pkgname="$2"
@@ -115,22 +115,8 @@ GNOME_INIT()
GNOME_COMPILE_WARNINGS
GNOME_X_CHECKS
EVO_CHECK_LIB(gnome-libs, gnome, 1.2.9)
-AC_CHECK_HEADERS(alloca.h)
-
-dnl check for socklen_t (in Unix98)
-AC_MSG_CHECKING(for socklen_t)
-AC_TRY_COMPILE([#include <sys/socket.h>
-socklen_t x;
-],[],[AC_MSG_RESULT(yes)],[
-AC_TRY_COMPILE([#include <sys/socket.h>
-int accept (int, struct sockaddr *, size_t *);
-],[],[
-AC_MSG_RESULT(size_t)
-AC_DEFINE(socklen_t,size_t)], [
-AC_MSG_RESULT(int)
-AC_DEFINE(socklen_t,int)])])
-
-ALL_LINGUAS="az bg ca cs da de el en_AU en_GB es et eu fi fr ga gl hu it ja ko lt lv nl nn no pl pt pt_BR ro ru sk sl sv tr uk zh_CN zh_TW"
+
+ALL_LINGUAS="az bg ca da de el en_AU en_GB es fi fr ga gl hu it ja ko lt lv nl nn no pl pt pt_BR ro ru sk sl sv tr uk zh_CN zh_TW"
AM_GNOME_GETTEXT
localedir='$(prefix)/$(DATADIRNAME)/locale'
AC_SUBST(localedir)
@@ -265,7 +251,7 @@ AC_CACHE_CHECK([if gethostbyname_r wants five arguments], ac_cv_gethostbyname_r_
int bufsize=BUFSIZE;
int h_errno;
- (void)gethostbyname_r ("www.ximian.com", &hent, buffer, bufsize, &h_errno);
+ (void)gethostbyname_r( "www.ximian.com", &hent, buffer, bufsize, &h_errno);
],[
ac_cv_gethostbyname_r_five_args=yes
],[
@@ -273,43 +259,10 @@ AC_CACHE_CHECK([if gethostbyname_r wants five arguments], ac_cv_gethostbyname_r_
])
])])
-if test "x$ac_cv_gethostbyname_r_five_args" = "xyes" ; then
+if test x"$ac_cv_gethostbyname_r_five_args" = xyes ; then
AC_DEFINE(GETHOSTBYNAME_R_FIVE_ARGS)
fi
-dnl **************************************************
-dnl gethostbyaddr_r prototype
-dnl **************************************************
-
-AC_CHECK_FUNCS(gethostbyaddr_r,[
-AC_CACHE_CHECK([if gethostbyaddr_r wants seven arguments], ac_cv_gethostbyaddr_r_seven_args,
-[
- AC_TRY_COMPILE([
- #include "confdefs.h"
- #include <sys/types.h>
- #include <sys/socket.h>
- #include <netinet/in.h>
- #include <netdb.h>
-
- #define BUFSIZE (sizeof(struct hostent)+10)
- ],[
- struct hostent hent;
- char buffer[BUFSIZE];
- int bufsize=BUFSIZE;
- int h_errno;
-
- (void)gethostbyaddr_r ("www.ximian.com", 14, AF_INET, &hent, buffer, bufsize, &h_errno);
- ],[
- ac_cv_gethostbyaddr_r_seven_args=yes
- ],[
- ac_cv_gethostbyaddr_r_seven_args=no
- ])
-])])
-
-if test "x$ac_cv_gethostbyaddr_r_seven_args" = "xyes" ; then
- AC_DEFINE(GETHOSTBYADDR_R_SEVEN_ARGS)
-fi
-
dnl ***********
dnl * db3 stuff
dnl ***********
@@ -625,30 +578,6 @@ fi
AC_MSG_RESULT($with_broken_spool)
-dnl ***************************************************************
-dnl Whether to build shlib components (instead of out-of-proc ones)
-dnl ***************************************************************
-
-AC_ARG_ENABLE(shlib-components,
- [ --enable-shlib-components Enable building of some of the components as shared libs],
- enable_shlib_components=yes,enable_shlib_components=no)
-
-AM_CONDITIONAL(ENABLE_SHLIB_COMPONENTS, test "x$enable_shlib_components" = "xyes")
-
-if test "x$enable_shlib_components" = "xyes" ; then
- OAF_SHLIB_TYPE="shlib"
- OAF_SHLIB_PREFIX="lib"
- OAF_SHLIB_SUFFIX=".so"
-else
- OAF_SHLIB_TYPE="exe"
- OAF_SHLIB_PREFIX=""
- OAF_SHLIB_SUFFIX=""
-fi
-
-AC_SUBST(OAF_SHLIB_TYPE)
-AC_SUBST(OAF_SHLIB_PREFIX)
-AC_SUBST(OAF_SHLIB_SUFFIX)
-
dnl ***************
dnl GNOME Libraries
dnl ***************
@@ -660,14 +589,82 @@ EVO_CHECK_LIB(GNOME-VFS, vfs, 1.0)
EVO_CHECK_LIB(libxml, xml, 1.8.10, 2.0)
EVO_CHECK_LIB(bonobo-conf, bonobo_conf, 0.11)
-EVO_CHECK_LIB(GAL, gal, 0.19.99.13)
-EVO_CHECK_LIB(GtkHTML, gtkhtml, 1.0)
-EVO_CHECK_LIB(Libsoup, soup, 0.6)
+EVO_CHECK_LIB(GAL, gal, 0.19.2)
+EVO_CHECK_LIB(GtkHTML, gtkhtml, 1.0.1)
-AM_PATH_GCONF(1.0)
-if test "x$GCONF_CFLAGS" = "x" ; then
- AC_MSG_ERROR(Evolution requires GConf to be installed)
-fi
+dnl *************************
+dnl CFLAGS and LIBS and stuff
+dnl *************************
+GLIB_CFLAGS="`$GLIB_CONFIG --cflags`"
+GLIB_LIBS="`$GLIB_CONFIG --libs`"
+AC_SUBST(GLIB_CFLAGS)
+AC_SUBST(GLIB_LIBS)
+
+GAL_CFLAGS="`gnome-config --cflags gal`"
+GAL_LIBS="`gnome-config --libs gal`"
+AC_SUBST(GAL_CFLAGS)
+AC_SUBST(GAL_LIBS)
+
+BONOBO_CONF_CFLAGS="`gnome-config --cflags bonobo_conf`"
+BONOBO_CONF_LIBS="`gnome-config --libs bonobo_conf`"
+AC_SUBST(BONOBO_CONF_CFLAGS)
+AC_SUBST(BONOBO_CONF_LIBS)
+
+EXTRA_GNOME_LIBS="`gnome-config --libs libglade gdk_pixbuf libart gnomecanvaspixbuf gnomeui gal` $THREADS_LIBS"
+EXTRA_GNOME_CFLAGS="`gnome-config --cflags libglade gdk_pixbuf libart gnomecanvaspixbuf gnomeui gal` $THREADS_CFLAGS"
+
+AC_SUBST(EXTRA_GNOME_LIBS)
+AC_SUBST(EXTRA_GNOME_CFLAGS)
+
+BONOBO_GNOME_LIBS="`gnome-config --libs oaf bonobox_print libglade gdk_pixbuf gnomecanvaspixbuf gnomeui` $OAF_LIBS"
+BONOBO_GNOME_CFLAGS="`gnome-config --cflags oaf bonobox_print libglade gdk_pixbuf gnomecanvaspixbuf gnomeui` $OAF_CFLAGS"
+AC_SUBST(BONOBO_GNOME_LIBS)
+AC_SUBST(BONOBO_GNOME_CFLAGS)
+
+BONOBO_HTML_GNOME_LIBS="`gnome-config --libs oaf bonobox_print libglade gdk_pixbuf gtkhtml gnomecanvaspixbuf gnomeui ` $THREAD_LIBS"
+BONOBO_HTML_GNOME_CFLAGS="`gnome-config --cflags oaf bonobox_print libglade gdk_pixbuf gtkhtml gnomecanvaspixbuf gnomeui ` $THREAD_CFLAGS"
+AC_SUBST(BONOBO_HTML_GNOME_LIBS)
+AC_SUBST(BONOBO_HTML_GNOME_CFLAGS)
+
+GNOME_PRINT_LIBS=`gnome-config --libs print`
+GNOME_PRINT_CFLAGS=`gnome-config --cflags print`
+AC_SUBST(GNOME_PRINT_LIBS)
+AC_SUBST(GNOME_PRINT_CFLAGS)
+
+BONOBO_CONF_CFLAGS="`gnome-config --cflags bonobo_conf`"
+BONOBO_CONF_LIBS="`gnome-config --libs bonobo_conf`"
+AC_SUBST(BONOBO_CONF_CFLAGS)
+AC_SUBST(BONOBO_CONF_LIBS)
+
+GTKHTML_CFLAGS="`gnome-config --cflags gtkhtml`"
+GTKHTML_LIBS="`gnome-config --libs gtkhtml`"
+GTKHTML_DATADIR=`gnome-config --moddatadir gtkhtml`
+AC_SUBST(GTKHTML_CFLAGS)
+AC_SUBST(GTKHTML_LIBS)
+AC_SUBST(GTKHTML_DATADIR)
+
+GNOME_VFS_LIBS="`gnome-config --libs vfs`"
+GNOME_VFS_CFLAGS="`gnome-config --cflags vfs`"
+AC_SUBST(GNOME_VFS_LIBS)
+AC_SUBST(GNOME_VFS_CFLAGS)
+
+BONOBO_VFS_GNOME_LIBS="`gnome-config --libs oaf bonobox libglade gdk_pixbuf gnomecanvaspixbuf vfs gnomeui `"
+BONOBO_VFS_GNOME_CFLAGS="`gnome-config --cflags oaf bonobox libglade gdk_pixbuf gnomecanvaspixbuf vfs gnomeui `"
+AC_SUBST(BONOBO_VFS_GNOME_LIBS)
+AC_SUBST(BONOBO_VFS_GNOME_CFLAGS)
+
+CAMEL_CFLAGS="`gnome-config --cflags gal xml` $THREADS_CFLAGS"
+CAMEL_LIBS="`gnome-config --libs gal xml` $THREADS_LIBS"
+AC_SUBST(CAMEL_CFLAGS)
+AC_SUBST(CAMEL_LIBS)
+
+camel_providerdir='$(libdir)/evolution/camel-providers/'$EVOLUTION_MAJOR_VERSION.$EVOLUTION_MINOR_VERSION
+AC_SUBST(camel_providerdir)
+
+MAILER_CFLAGS="`gnome-config --cflags gtkhtml libglade gdk_pixbuf gnomecanvaspixbuf gnomeui gal bonobo_conf bonobox bonobox_print vfs oaf` $THREADS_CFLAGS"
+MAILER_LIBS="`gnome-config --libs gtkhtml libglade gdk_pixbuf gnomecanvaspixbuf gnomeui gal bonobo_conf bonobox bonobox_print vfs oaf` $THREADS_LIBS"
+AC_SUBST(MAILER_CFLAGS)
+AC_SUBST(MAILER_LIBS)
dnl ******************************
dnl Pilot checking
@@ -783,8 +780,7 @@ if test x${with_krb4:=no} != xno; then
msg_krb4=yes
if test -f "$with_krb4/include/krb.h" -o -f "$with_krb4/include/port-sockets.h"; then
KRB4_CFLAGS="-I$with_krb4/include"
- fi
- if test -d "$with_krb4/include/kerberosIV"; then
+ else
KRB4_CFLAGS="-I$with_krb4/include/kerberosIV"
fi
KRB4_LDFLAGS="-L$with_krb4/lib $ac_cv_lib_kerberos4"
@@ -826,320 +822,125 @@ dnl
dnl The Evolution security extensions are only built if these libraries are found
dnl ********************************************************************************
msg_ssl=no
-
-dnl these 2 enable's are inverses of each other
-AC_ARG_ENABLE(nss, [ --enable-nss=[yes,no] Attempt to use Mozilla libnss for SSL support.],
- enable_nss="$enableval", enable_nss="yes")
-
-AC_ARG_ENABLE(openssl, [ --enable-openssl=[yes,no] Attempt to use OpenSSL for SSL support.],
- enable_openssl="$enableval", enable_openssl="auto")
-
-if test "x${enable_openssl}" = "xyes"; then
-dnl User wants to override nss with OpenSSL
- enable_nss="no"
-fi
-
-if test "x${enable_nss}" = "xyes"; then
- AC_ARG_WITH(nspr-includes, [ --with-nspr-includes=PREFIX Location of Mozilla nspr4 includes.],
- with_nspr_includes="$withval", with_nspr_includes="/usr/include/nspr")
- have_nspr_includes="no"
- if test "x${with_nspr_includes}" != "xno"; then
- CPPFLAGS_save="$CPPFLAGS"
-
- AC_MSG_CHECKING(for Mozilla nspr4 includes in $with_nspr_includes)
- AC_MSG_RESULT("")
-
- CPPFLAGS="$CPPFLAGS -I$with_nspr_includes"
- AC_CHECK_HEADERS(nspr.h prio.h, [ moz_nspr_includes="yes" ])
- CPPFLAGS="$CPPFLAGS_save"
-
- if test "x{$moz_nspr_includes}" != "xno" -a "x{$moz_nspr_includes}" != "x" ; then
- have_nspr_includes="yes"
- NSPR_CFLAGS="-I$with_nspr_includes"
- fi
- else
- AC_MSG_CHECKING(for Mozilla nspr4 includes)
- AC_MSG_RESULT(no)
- fi
+AC_ARG_WITH(nspr-includes, [ --with-nspr-includes=PREFIX Location of Mozilla nspr4 includes.],
+ with_nspr_includes="$withval", with_nspr_includes="/usr/include/nspr")
+have_nspr_includes="no"
+if test "x${with_nspr_includes}" != "xno"; then
+ CPPFLAGS_save="$CPPFLAGS"
- AC_ARG_WITH(nspr-libs, [ --with-nspr-libs=PREFIX Location of Mozilla nspr4 libs.],
- with_nspr_libs="$withval")
- have_nspr_libs="no"
- if test "x${with_nspr_libs}" != "xno" -a "x${have_nspr_includes}" != "xno"; then
- CFLAGS_save="$CFLAGS"
- LDFLAGS_save="$LDFLAGS"
-
- nsprlibs="-lplc4 -lplds4 -lnspr4 $PTHREAD_LIB"
- AC_CACHE_CHECK([for Mozilla nspr libraries], moz_nspr_libs,
- [
- CFLAGS="$CFLAGS $NSPR_CFLAGS"
-
- if test "x${with_nspr_libs}" != "x"; then
- LDFLAGS="$LDFLAGS -L$with_nspr_libs $nsprlibs"
- else
- LDFLAGS="$LDFLAGS $nsprlibs"
- fi
-
- AC_TRY_LINK_FUNC(PR_Init, moz_nspr_libs="yes", moz_nspr_libs="no")
- CFLAGS="$CFLAGS_save"
- LDFLAGS="$LDFLAGS_save"
- ])
- if test "x$moz_nspr_libs" != "xno"; then
- have_nspr_libs="yes"
- NSPR_LDFLAGS="-L$with_nspr_libs $nsprlibs"
- else
- NSPR_CLFAGS=""
- fi
- else
- AC_MSG_CHECKING(for Mozilla nspr4 libraries)
- AC_MSG_RESULT(no)
- fi
-
- AC_ARG_WITH(nss-includes, [ --with-nss-includes=PREFIX Location of Mozilla nss3 includes.],
- with_nss_includes="$withval", with_nss_includes="/usr/include/moznss")
- if test "x${with_nss_includes}" != "xno" -a "x${have_nspr_libs}" != "xno"; then
- CPPFLAGS_save="$CPPFLAGS"
-
- AC_MSG_CHECKING(for Mozilla nss3 includes in $with_nss_includes)
- AC_MSG_RESULT("")
-
- if test "x${with_nspr_includes}" != "x"; then
- CPPFLAGS="$CPPFLAGS -I$with_nspr_includes -I$with_nss_includes"
- else
- CPPFLAGS="$CPPFLAGS -I$with_nss_includes"
- fi
+ AC_MSG_CHECKING(for Mozilla nspr4 includes in $with_nspr_includes)
+ AC_MSG_RESULT("")
- AC_CHECK_HEADERS(nss.h ssl.h smime.h,
- [ have_nss_includes="yes" ],
- [ have_nss_includes="no" ])
+ CPPFLAGS="$CPPFLAGS -I$with_nspr_includes"
+ AC_CHECK_HEADERS(nspr.h prio.h, [ moz_nspr_includes="yes" ])
+ CPPFLAGS="$CPPFLAGS_save"
- CPPFLAGS="$CPPFLAGS_save"
-
- if test "x${have_nss_includes}" = xyes ; then
- have_nss_includes="yes"
- NSS_CFLAGS="-I$with_nss_includes"
- else
- NSPR_CFLAGS=""
- NSPR_LDFLAGS=""
- fi
- else
- AC_MSG_CHECKING(for Mozilla nss3 includes)
- AC_MSG_RESULT(no)
+ if test "x{$moz_nspr_includes}" != "xno" -a "x{$moz_nspr_includes}" != "x" ; then
+ have_nspr_includes="yes"
+ NSPR_CFLAGS="-I$with_nspr_includes"
fi
+else
+ AC_MSG_CHECKING(for Mozilla nspr4 includes)
+ AC_MSG_RESULT(no)
+fi
+
+AC_ARG_WITH(nspr-libs, [ --with-nspr-libs=PREFIX Location of Mozilla nspr4 libs.],
+ with_nspr_libs="$withval")
+have_nspr_libs="no"
+if test "x${with_nspr_libs}" != "xno" -a "x${have_nspr_includes}" != "xno"; then
+ CFLAGS_save="$CFLAGS"
+ LDFLAGS_save="$LDFLAGS"
- AC_ARG_WITH(nss-libs, [ --with-nss-libs=PREFIX Location of Mozilla nss3 libs.],
- with_nss_libs="$withval")
- if test "x${with_nss_libs}" != "xno" -a "x${have_nss_includes}" != "xno"; then
- LDFLAGS_save="$LDFLAGS"
+ nsprlibs="-lplc4 -lplds4 -lnspr4 $PTHREAD_LIB"
+ AC_CACHE_CHECK([for Mozilla nspr libraries], moz_nspr_libs,
+ [
+ CFLAGS="$CFLAGS $NSPR_CFLAGS"
- nsprlibs="-lplc4 -lplds4 -lnspr4 $PTHREAD_LIB"
- nsslibs="-lssl3 -lsmime3 -lnss3"
- AC_CACHE_CHECK([for Mozilla nss libraries], moz_nss_libs,
- [
- LDFLAGS="$LDFLAGS -L$with_nspr_libs $nsprlibs -L$with_nss_libs $nsslibs"
- AC_TRY_LINK_FUNC(NSS_Init, moz_nss_libs="yes", moz_nss_libs="no")
- LDFLAGS="$LDFLAGS_save"
- ])
- if test "$moz_nss_libs" != no; then
- AC_DEFINE(HAVE_NSS)
- AC_DEFINE(HAVE_SSL)
- msg_ssl="yes (Mozilla NSS)"
- NSS_LDFLAGS="-L$with_nss_libs $nsslibs"
+ if test "x${with_nspr_libs}" != "x"; then
+ LDFLAGS="$LDFLAGS -L$with_nspr_libs $nsprlibs"
else
- NSS_CFLAGS=""
- NSPR_CFLAGS=""
- NSPR_LDFLAGS=""
+ LDFLAGS="$LDFLAGS $nsprlibs"
fi
+
+ AC_TRY_LINK_FUNC(PR_Init, moz_nspr_libs="yes", moz_nspr_libs="no")
+ CFLAGS="$CFLAGS_save"
+ LDFLAGS="$LDFLAGS_save"
+ ])
+ if test "x$moz_nspr_libs" != "xno"; then
+ have_nspr_libs="yes"
+ NSPR_LDFLAGS="-L$with_nspr_libs $nsprlibs"
else
- AC_MSG_CHECKING(for Mozilla nss libraries)
- AC_MSG_RESULT(no)
+ NSPR_CLFAGS=""
fi
+else
+ AC_MSG_CHECKING(for Mozilla nspr4 libraries)
+ AC_MSG_RESULT(no)
fi
-AC_SUBST(NSPR_CFLAGS)
-AC_SUBST(NSPR_LDFLAGS)
-AC_SUBST(NSS_CFLAGS)
-AC_SUBST(NSS_LDFLAGS)
+AC_ARG_WITH(nss-includes, [ --with-nss-includes=PREFIX Location of Mozilla nss3 includes.],
+ with_nss_includes="$withval", with_nss_includes="/usr/include/moznss")
+if test "x${with_nss_includes}" != "xno" -a "x${have_nspr_libs}" != "xno"; then
+ CPPFLAGS_save="$CPPFLAGS"
+
+ AC_MSG_CHECKING(for Mozilla nss3 includes in $with_nss_includes)
+ AC_MSG_RESULT("")
-dnl ******************************
-dnl OpenSSL
-dnl ******************************
+ if test "x${with_nspr_includes}" != "x"; then
+ CPPFLAGS="$CPPFLAGS -I$with_nspr_includes -I$with_nss_includes"
+ else
+ CPPFLAGS="$CPPFLAGS -I$with_nss_includes"
+ fi
-dnl only continue detecting OpenSSL if we haven't already found all of the
-dnl Mozilla libnss includes/libraries and if user actually wants ssl support
-if test "$msg_ssl" = "no" -a "x${enable_openssl}" != "xno"; then
- AC_ARG_WITH(openssl-includes, [ --with-openssl-includes=PREFIX Location of OpenSSL includes.],
- with_openssl_includes="$withval", with_openssl_includes="/usr/include")
- have_openssl_includes="no"
- if test "x${with_openssl_includes}" != "xno"; then
- CPPFLAGS_save="$CPPFLAGS"
-
- AC_MSG_CHECKING(for OpenSSL includes)
- AC_MSG_RESULT("")
-
- CPPFLAGS="$CPPFLAGS -I$with_openssl_includes"
- AC_CHECK_HEADERS(openssl/ssl.h openssl/x509.h, [ openssl_includes="yes" ])
- CPPFLAGS="$CPPFLAGS_save"
-
- if test "x{$openssl_includes}" != "xno" -a "x{$openssl_includes}" != "x"; then
- have_openssl_includes="yes"
- OPENSSL_CFLAGS="-I$with_openssl_includes"
- else
- OPENSSL_CFLAGS=""
- fi
+ AC_CHECK_HEADERS(nss.h ssl.h smime.h,
+ [ have_nss_includes="yes" ],
+ [ have_nss_includes="no" ])
+
+ CPPFLAGS="$CPPFLAGS_save"
+
+ if test "x${have_nss_includes}" = xyes ; then
+ have_nss_includes="yes"
+ NSS_CFLAGS="-I$with_nss_includes"
else
- AC_MSG_CHECKING(for OpenSSL includes)
- AC_MSG_RESULT(no)
+ NSPR_CFLAGS=""
+ NSPR_LDFLAGS=""
fi
+else
+ AC_MSG_CHECKING(for Mozilla nss3 includes)
+ AC_MSG_RESULT(no)
+fi
+
+AC_ARG_WITH(nss-libs, [ --with-nss-libs=PREFIX Location of Mozilla nss3 libs.],
+ with_nss_libs="$withval")
+if test "x${with_nss_libs}" != "xno" -a "x${have_nss_includes}" != "xno"; then
+ LDFLAGS_save="$LDFLAGS"
- AC_ARG_WITH(openssl-libs, [ --with-openssl-libs=PREFIX Location of OpenSSL libs.],
- with_openssl_libs="$withval")
- if test "x${with_openssl_libs}" != "xno" -a "x${have_openssl_includes}" != "xno"; then
- LDFLAGS_save="$LDFLAGS"
-
- case $with_openssl_libs in
- ""|-L*) ;;
- *) with_openssl_libs="-L$with_openssl_libs" ;;
- esac
-
- AC_CHECK_LIB(dl, dlopen, DL_LDFLAGS="-ldl", DL_LDFLAGS="")
- AC_CACHE_CHECK([for OpenSSL libraries], openssl_libs,
- [
- LDFLAGS="$LDFLAGS $with_openssl_libs -lssl -lcrypto $DL_LDFLAGS"
- AC_TRY_LINK_FUNC(SSL_read, openssl_libs="yes", openssl_libs="no")
- LDFLAGS="$LDFLAGS_save"
- ])
- if test "x${openssl_libs}" != "xno"; then
- AC_DEFINE(HAVE_OPENSSL)
- AC_DEFINE(HAVE_SSL)
- msg_ssl="yes (OpenSSL)"
- OPENSSL_LDFLAGS="$with_openssl_libs -lssl -lcrypto $DL_LDFLAGS"
- else
- OPENSSL_CFLAGS=""
- OPENSSL_LDFLAGS=""
- fi
+ nsprlibs="-lplc4 -lplds4 -lnspr4 $PTHREAD_LIB"
+ nsslibs="-lssl3 -lsmime3 -lnss3"
+ AC_CACHE_CHECK([for Mozilla nss libraries], moz_nss_libs,
+ [
+ LDFLAGS="$LDFLAGS -L$with_nspr_libs $nsprlibs -L$with_nss_libs $nsslibs"
+ AC_TRY_LINK_FUNC(NSS_Init, moz_nss_libs="yes", moz_nss_libs="no")
+ LDFLAGS="$LDFLAGS_save"
+ ])
+ if test "$moz_nss_libs" != no; then
+ AC_DEFINE(HAVE_NSS)
+ AC_DEFINE(HAVE_SSL)
+ msg_ssl="yes (Mozilla NSS)"
+ NSS_LDFLAGS="-L$with_nss_libs $nsslibs"
else
- AC_MSG_CHECKING(for OpenSSL libraries)
- AC_MSG_RESULT(no)
+ NSS_CFLAGS=""
+ NSPR_CFLAGS=""
+ NSPR_LDFLAGS=""
fi
else
- OPENSSL_CFLAGS=""
- OPENSSL_LDFLAGS=""
+ AC_MSG_CHECKING(for Mozilla nss libraries)
+ AC_MSG_RESULT(no)
fi
-AC_SUBST(OPENSSL_CFLAGS)
-AC_SUBST(OPENSSL_LDFLAGS)
-
-dnl *************************
-dnl CFLAGS and LIBS and stuff
-dnl *************************
-
-AC_DEFUN(EVO_SET_COMPILE_FLAGS, [
- deps="$2"
- extra_cflags="$3"
- extra_libs="$4"
- $1_CFLAGS="`gnome-config --cflags $deps` $extra_cflags"
- $1_LIBS="`gnome-config --libs $deps` $extra_libs"
-])
-
-dnl --- Flags to get all the GNOME stuff
-
-FULL_GNOME_DEPS="bonobo_conf bonobox_print gal gdk_pixbuf gnomecanvaspixbuf gnomeui gtkhtml libglade oaf vfs"
-
-EVO_SET_COMPILE_FLAGS(GNOME_FULL, $FULL_GNOME_DEPS)
-AC_SUBST(GNOME_FULL_CFLAGS)
-AC_SUBST(GNOME_FULL_LIBS)
-
-dnl -- Find the directory where the GtkHTML editing component has its
-dnl IDL files
-
-GTKHTML_DATADIR=`gnome-config --moddatadir gtkhtml`
-AC_SUBST(GTKHTML_DATADIR)
-
-dnl --- Flags for the various libraries we build
-
-EVO_SET_COMPILE_FLAGS(CAMEL, gal xml,
- $THREADS_CFLAGS $KRB4_CFLAGS $NSPR_CFLAGS $NSS_CFLAGS $OPENSSL_CFLAGS,
- $THREADS_LIBS $KRB4_LDFLAGS $NSPR_LDFLAGS $NSS_LDFLAGS $OPENSSL_LDFLAGS)
-AC_SUBST(CAMEL_CFLAGS)
-AC_SUBST(CAMEL_LIBS)
-
-EVO_SET_COMPILE_FLAGS(E_NAME, bonobox gal oaf)
-AC_SUBST(E_NAME_CFLAGS)
-AC_SUBST(E_NAME_LIBS)
-
-EVO_SET_COMPILE_FLAGS(E_UTIL, bonobox gal oaf libglade)
-AC_SUBST(E_UTIL_CFLAGS)
-AC_SUBST(E_UTIL_LIBS)
-
-EVO_SET_COMPILE_FLAGS(E_WIDGETS, bonobo_conf bonobox_print gdk_pixbuf gnomecanvaspixbuf gnomeui libglade oaf vfs)
-AC_SUBST(E_WIDGETS_CFLAGS)
-AC_SUBST(E_WIDGETS_LIBS)
-
-EVO_SET_COMPILE_FLAGS(IMPORTERS, bonobo_conf bonobox_print gdk_pixbuf gnomecanvaspixbuf gnomeui libglade oaf vfs)
-AC_SUBST(IMPORTERS_CFLAGS)
-AC_SUBST(IMPORTERS_LIBS)
-
-EVO_SET_COMPILE_FLAGS(LIBIBEX, bonobo_conf bonobox_print gal gdk_pixbuf gnomecanvaspixbuf gnomeui libglade oaf vfs,
- $THREADS_CFLAGS, $THREADS_LIBS)
-AC_SUBST(LIBIBEX_CFLAGS)
-AC_SUBST(LIBIBEX_LIBS)
-
-EVO_SET_COMPILE_FLAGS(LIBFILTER, bonobo gal gdk_pixbuf gnomecanvaspixbuf gnomeui libglade)
-AC_SUBST(LIBFILTER_CFLAGS)
-AC_SUBST(LIBFILTER_LIBS)
-
-dnl --- evolution (shell) flags
-
-EVO_SET_COMPILE_FLAGS(SHELL, bonobo_conf bonobox_print gal gdk_pixbuf gnomecanvaspixbuf gnomeui gtkhtml libglade oaf vfs)
-AC_SUBST(SHELL_CFLAGS)
-AC_SUBST(SHELL_LIBS)
-
-dnl --- evolution-addressbook flags
-
-EVOLUTION_ADDRESSBOOK_DEPS="bonobo_conf bonobox_print gal gdk_pixbuf gnomecanvaspixbuf gnomeui gtkhtml libglade oaf vfs"
-
-EVO_SET_COMPILE_FLAGS(EVOLUTION_ADDRESSBOOK, $EVOLUTION_ADDRESSBOOK_DEPS)
-AC_SUBST(EVOLUTION_ADDRESSBOOK_CFLAGS)
-AC_SUBST(EVOLUTION_ADDRESSBOOK_LIBS)
-
-EVO_SET_COMPILE_FLAGS(EVOLUTION_ADDRESSBOOK_CONDUIT, gpilot $EVOLUTION_ADDRESSBOOK_DEPS, $PISOCK_CFLAGS)
-AC_SUBST(EVOLUTION_ADDRESSBOOK_CONDUIT_CFLAGS)
-AC_SUBST(EVOLUTION_ADDRESSBOOK_CONDUIT_LIBS)
-
-dnl -- evolution-executive-summary flags
-
-EVO_SET_COMPILE_FLAGS(EVOLUTION_EXECUTIVE_SUMMARY,
- bonobo_conf bonobox bonobox_print gal gdk_pixbuf gnomecanvaspixbuf gnomeui gtkhtml libglade oaf soup vfs)
-AC_SUBST(EVOLUTION_EXECUTIVE_SUMMARY_CFLAGS)
-AC_SUBST(EVOLUTION_EXECUTIVE_SUMMARY_LIBS)
-
-dnl --- evolution-calendar flags
-
-EVOLUTION_CALENDAR_DEPS="bonobo_conf bonobox bonobox_print gal gdk_pixbuf gnomecanvaspixbuf gnomeui gtkhtml libglade oaf vfs"
-
-EVO_SET_COMPILE_FLAGS(EVOLUTION_CALENDAR, $EVOLUTION_CALENDAR_DEPS)
-AC_SUBST(EVOLUTION_CALENDAR_CFLAGS)
-AC_SUBST(EVOLUTION_CALENDAR_LIBS)
-
-EVO_SET_COMPILE_FLAGS(EVOLUTION_CALENDAR_CONDUIT, gpilot $EVOLUTION_CALENDAR_DEPS, $PISOCK_CFLAGS)
-AC_SUBST(EVOLUTION_CALENDAR_CONDUIT_CFLAGS)
-AC_SUBST(EVOLUTION_CALENDAR_CONDUIT_LIBS)
-
-dnl --- evolution-mail flags
-
-camel_providerdir='$(libdir)/evolution/camel-providers/'$EVOLUTION_MAJOR_VERSION.$EVOLUTION_MINOR_VERSION
-AC_SUBST(camel_providerdir)
-
-EVO_SET_COMPILE_FLAGS(EVOLUTION_MAIL, $FULL_GNOME_DEPS, $GCONF_CFLAGS $THREADS_CFLAGS, $GCONF_LIBS $THREADS_LIBS)
-AC_SUBST(EVOLUTION_MAIL_CFLAGS)
-AC_SUBST(EVOLUTION_MAIL_LIBS)
-
-dnl -- wombat flags
-
-EVO_SET_COMPILE_FLAGS(WOMBAT, $FULL_GNOME_DEPS, $LDAP_CFLAGS, $LDAP_LIBS)
-AC_SUBST(WOMBAT_CFLAGS)
-AC_SUBST(WOMBAT_LIBS)
+AC_SUBST(NSPR_CFLAGS)
+AC_SUBST(NSPR_LDFLAGS)
+AC_SUBST(NSS_CFLAGS)
+AC_SUBST(NSS_LDFLAGS)
##################################################
# Check for gtk-doc.
@@ -1303,7 +1104,6 @@ po/Makefile.in
shell/Makefile
shell/glade/Makefile
shell/importer/Makefile
-sounds/Makefile
tools/Makefile
ui/Makefile
views/Makefile
@@ -1316,8 +1116,6 @@ widgets/e-timezone-dialog/Makefile
widgets/menus/Makefile
widgets/misc/Makefile
wombat/Makefile
-
-my-evolution/GNOME_Evolution_Summary.oaf.in
])
if test "x$with_sub_version" != "x"; then
@@ -1341,26 +1139,16 @@ echo "\
SSL support: $msg_ssl
Dot Locking: $msg_dot
File Locking: $msg_file
- Gtk-doc: $enable_gtk_doc
- Shlib components: $enable_shlib_components"
+ Gtk-doc: $enable_gtk_doc"
if test x$enable_gtk_doc = xyes; then
echo "
- Programming documentation files will be built automatically."
+ Programming documentation files will be built automatically.
+"
else
echo "
Programming documentation files will not be built.
You may want to install the gtk-doc package
- so that you will get the Evolution Developer's Guide."
-fi
-
-if test "x$enable_shlib_components" = "xyes" ; then
- echo "
- *** Warning, shlib components are currently broken.
- *** Enabling this option will probably cause Evolution to not
- *** work correctly.
+ so that you will get the Evolution Developer's Guide.
"
-else
- echo "
-"
-fi \ No newline at end of file
+fi
diff --git a/doc/devel/ChangeLog b/doc/devel/ChangeLog
index e4edcaaf77..1dba3346ef 100644
--- a/doc/devel/ChangeLog
+++ b/doc/devel/ChangeLog
@@ -1,16 +1,3 @@
-2002-03-19 Dan Winship <danw@ximian.com>
-
- * calendar/cal-util/Makefile.am (GTKDOC_LIBS): Update for
- libversit change.
-
- * calendar/cal-client/Makefile.am (GTKDOC_LIBS): Likewise
-
-2002-01-24 Ettore Perazzoli <ettore@ximian.com>
-
- * calendar/cal-client/Makefile.am: Use EVOLUTION_CALENDAR_CFLAGS
- and EVOLUTION_CALENDAR_LIBS.
- * calendar/cal-util/Makefile.am: Likewise.
-
2001-12-18 JP Rosevear <jpr@ximian.com>
* calendar/cal-client/Makefile.am: cal-client needs bonobo-conf
diff --git a/doc/devel/calendar/cal-client/Makefile.am b/doc/devel/calendar/cal-client/Makefile.am
index 0e097c701f..978e89ade4 100644
--- a/doc/devel/calendar/cal-client/Makefile.am
+++ b/doc/devel/calendar/cal-client/Makefile.am
@@ -50,14 +50,16 @@ GTKDOC_CFLAGS= \
-I$(top_builddir) \
-I$(top_builddir)/libical/src/libical \
-I$(top_srcdir)/libical/src/libical \
- $(EVOLUTION_CALENDAR_CFLAGS)
-
-GTKDOC_LIBS= \
- $(EVOLUTION_CALENDAR_LIBS) \
- $(top_builddir)/calendar/cal-client/.libs/libcal-client-static.al \
- $(top_builddir)/calendar/cal-util/.libs/libcal-util-static.al \
- $(top_builddir)/libical/src/libical/.libs/libical-static.al \
- $(top_builddir)/libversit/libversit.a \
+ $(BONOBO_VFS_GNOME_CFLAGS) \
+ $(BONOBO_CONF_CFLAGS)
+
+GTKDOC_LIBS= \
+ $(BONOBO_VFS_GNOME_LIBS) \
+ $(BONOBO_CONF_LIBS) \
+ $(top_builddir)/calendar/cal-client/.libs/libcal-client-static.al\
+ $(top_builddir)/calendar/cal-util/.libs/libcal-util-static.al \
+ $(top_builddir)/libical/src/libical/.libs/libical-static.al \
+ $(top_builddir)/libversit/.libs/libversit.al \
$(top_builddir)/libwombat/libwombat.la
GTKDOC_CC=$(LIBTOOL) --mode=compile $(CC)
diff --git a/doc/devel/calendar/cal-client/evolution-cal-client-decl.txt b/doc/devel/calendar/cal-client/evolution-cal-client-decl.txt
index 79d0fec3c6..ac7ea9587d 100644
--- a/doc/devel/calendar/cal-client/evolution-cal-client-decl.txt
+++ b/doc/devel/calendar/cal-client/evolution-cal-client-decl.txt
@@ -1,3 +1,116 @@
+<MACRO>
+<NAME>CAL_CLIENT_MULTI_TYPE</NAME>
+#define CAL_CLIENT_MULTI_TYPE (cal_client_multi_get_type ())
+</MACRO>
+<MACRO>
+<NAME>CAL_CLIENT_MULTI</NAME>
+#define CAL_CLIENT_MULTI(obj) (GTK_CHECK_CAST ((obj), CAL_CLIENT_MULTI_TYPE, CalClientMulti))
+</MACRO>
+<MACRO>
+<NAME>CAL_CLIENT_MULTI_CLASS</NAME>
+#define CAL_CLIENT_MULTI_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), CAL_CLIENT_MULTI_TYPE, CalClientMultiClass))
+</MACRO>
+<MACRO>
+<NAME>IS_CAL_CLIENT_MULTI</NAME>
+#define IS_CAL_CLIENT_MULTI(obj) (GTK_CHECK_TYPE ((obj), CAL_CLIENT_MULTI_TYPE))
+</MACRO>
+<MACRO>
+<NAME>IS_CAL_CLIENT_MULTI_CLASS</NAME>
+#define IS_CAL_CLIENT_MULTI_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), CAL_CLIENT_MULTI_TYPE))
+</MACRO>
+<STRUCT>
+<NAME>CalClientMulti</NAME>
+</STRUCT>
+<STRUCT>
+<NAME>CalClientMultiClass</NAME>
+</STRUCT>
+<STRUCT>
+<NAME>CalClientMultiPrivate</NAME>
+</STRUCT>
+<STRUCT>
+<NAME>CalClientMulti</NAME>
+struct CalClientMulti {
+ GtkObject object;
+
+ /* Private data */
+ CalClientMultiPrivate *priv;
+};
+</STRUCT>
+<FUNCTION>
+<NAME>cal_client_multi_get_type</NAME>
+<RETURNS>GtkType </RETURNS>
+void
+</FUNCTION>
+<FUNCTION>
+<NAME>cal_client_multi_new</NAME>
+<RETURNS>CalClientMulti *</RETURNS>
+void
+</FUNCTION>
+<FUNCTION>
+<NAME>cal_client_multi_add_client</NAME>
+<RETURNS>void </RETURNS>
+CalClientMulti *multi, CalClient *client
+</FUNCTION>
+<FUNCTION>
+<NAME>cal_client_multi_set_auth_func</NAME>
+<RETURNS>void </RETURNS>
+CalClientMulti *multi,CalClientAuthFunc func,gpointer user_data
+</FUNCTION>
+<FUNCTION>
+<NAME>cal_client_multi_open_calendar</NAME>
+<RETURNS>CalClient *</RETURNS>
+CalClientMulti *multi,const char *str_uri,gboolean only_if_exists
+</FUNCTION>
+<FUNCTION>
+<NAME>cal_client_multi_get_client_for_uri</NAME>
+<RETURNS>CalClient *</RETURNS>
+CalClientMulti *multi,const char *uri
+</FUNCTION>
+<FUNCTION>
+<NAME>cal_client_multi_get_n_objects</NAME>
+<RETURNS>int </RETURNS>
+CalClientMulti *multi, CalObjType type
+</FUNCTION>
+<FUNCTION>
+<NAME>cal_client_multi_get_object</NAME>
+<RETURNS>CalClientGetStatus </RETURNS>
+CalClientMulti *multi,const char *uid,CalComponent **comp
+</FUNCTION>
+<FUNCTION>
+<NAME>cal_client_multi_get_timezone</NAME>
+<RETURNS>CalClientGetStatus </RETURNS>
+CalClientMulti *multi,const char *tzid,icaltimezone **zone
+</FUNCTION>
+<FUNCTION>
+<NAME>cal_client_multi_get_uids</NAME>
+<RETURNS>GList *</RETURNS>
+CalClientMulti *multi, CalObjType type
+</FUNCTION>
+<FUNCTION>
+<NAME>cal_client_multi_get_changes</NAME>
+<RETURNS>GList *</RETURNS>
+CalClientMulti *multi,CalObjType type,const char *change_id
+</FUNCTION>
+<FUNCTION>
+<NAME>cal_client_multi_get_objects_in_range</NAME>
+<RETURNS>GList *</RETURNS>
+CalClientMulti *multi,CalObjType type,time_t start,time_t end
+</FUNCTION>
+<FUNCTION>
+<NAME>cal_client_multi_get_free_busy</NAME>
+<RETURNS>GList *</RETURNS>
+CalClientMulti *multi,GList *users,time_t start,time_t end
+</FUNCTION>
+<FUNCTION>
+<NAME>cal_client_multi_generate_instances</NAME>
+<RETURNS>void </RETURNS>
+CalClientMulti *multi,CalObjType type,time_t start,time_t end,CalRecurInstanceFn cb,gpointer cb_data
+</FUNCTION>
+<FUNCTION>
+<NAME>cal_client_multi_get_alarms_in_range</NAME>
+<RETURNS>GSList *</RETURNS>
+CalClientMulti *multi,time_t start, time_t end
+</FUNCTION>
<ENUM>
<NAME>CalClientChangeType</NAME>
typedef enum {
@@ -375,116 +488,3 @@ QueryListenerObjUpdatedFn obj_updated_fn,QueryListenerObjRemovedFn obj_removed_f
<RETURNS>void </RETURNS>
QueryListener *ql
</FUNCTION>
-<MACRO>
-<NAME>CAL_CLIENT_MULTI_TYPE</NAME>
-#define CAL_CLIENT_MULTI_TYPE (cal_client_multi_get_type ())
-</MACRO>
-<MACRO>
-<NAME>CAL_CLIENT_MULTI</NAME>
-#define CAL_CLIENT_MULTI(obj) (GTK_CHECK_CAST ((obj), CAL_CLIENT_MULTI_TYPE, CalClientMulti))
-</MACRO>
-<MACRO>
-<NAME>CAL_CLIENT_MULTI_CLASS</NAME>
-#define CAL_CLIENT_MULTI_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), CAL_CLIENT_MULTI_TYPE, CalClientMultiClass))
-</MACRO>
-<MACRO>
-<NAME>IS_CAL_CLIENT_MULTI</NAME>
-#define IS_CAL_CLIENT_MULTI(obj) (GTK_CHECK_TYPE ((obj), CAL_CLIENT_MULTI_TYPE))
-</MACRO>
-<MACRO>
-<NAME>IS_CAL_CLIENT_MULTI_CLASS</NAME>
-#define IS_CAL_CLIENT_MULTI_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), CAL_CLIENT_MULTI_TYPE))
-</MACRO>
-<STRUCT>
-<NAME>CalClientMulti</NAME>
-</STRUCT>
-<STRUCT>
-<NAME>CalClientMultiClass</NAME>
-</STRUCT>
-<STRUCT>
-<NAME>CalClientMultiPrivate</NAME>
-</STRUCT>
-<STRUCT>
-<NAME>CalClientMulti</NAME>
-struct CalClientMulti {
- GtkObject object;
-
- /* Private data */
- CalClientMultiPrivate *priv;
-};
-</STRUCT>
-<FUNCTION>
-<NAME>cal_client_multi_get_type</NAME>
-<RETURNS>GtkType </RETURNS>
-void
-</FUNCTION>
-<FUNCTION>
-<NAME>cal_client_multi_new</NAME>
-<RETURNS>CalClientMulti *</RETURNS>
-void
-</FUNCTION>
-<FUNCTION>
-<NAME>cal_client_multi_add_client</NAME>
-<RETURNS>void </RETURNS>
-CalClientMulti *multi, CalClient *client
-</FUNCTION>
-<FUNCTION>
-<NAME>cal_client_multi_set_auth_func</NAME>
-<RETURNS>void </RETURNS>
-CalClientMulti *multi,CalClientAuthFunc func,gpointer user_data
-</FUNCTION>
-<FUNCTION>
-<NAME>cal_client_multi_open_calendar</NAME>
-<RETURNS>CalClient *</RETURNS>
-CalClientMulti *multi,const char *str_uri,gboolean only_if_exists
-</FUNCTION>
-<FUNCTION>
-<NAME>cal_client_multi_get_client_for_uri</NAME>
-<RETURNS>CalClient *</RETURNS>
-CalClientMulti *multi,const char *uri
-</FUNCTION>
-<FUNCTION>
-<NAME>cal_client_multi_get_n_objects</NAME>
-<RETURNS>int </RETURNS>
-CalClientMulti *multi, CalObjType type
-</FUNCTION>
-<FUNCTION>
-<NAME>cal_client_multi_get_object</NAME>
-<RETURNS>CalClientGetStatus </RETURNS>
-CalClientMulti *multi,const char *uid,CalComponent **comp
-</FUNCTION>
-<FUNCTION>
-<NAME>cal_client_multi_get_timezone</NAME>
-<RETURNS>CalClientGetStatus </RETURNS>
-CalClientMulti *multi,const char *tzid,icaltimezone **zone
-</FUNCTION>
-<FUNCTION>
-<NAME>cal_client_multi_get_uids</NAME>
-<RETURNS>GList *</RETURNS>
-CalClientMulti *multi, CalObjType type
-</FUNCTION>
-<FUNCTION>
-<NAME>cal_client_multi_get_changes</NAME>
-<RETURNS>GList *</RETURNS>
-CalClientMulti *multi,CalObjType type,const char *change_id
-</FUNCTION>
-<FUNCTION>
-<NAME>cal_client_multi_get_objects_in_range</NAME>
-<RETURNS>GList *</RETURNS>
-CalClientMulti *multi,CalObjType type,time_t start,time_t end
-</FUNCTION>
-<FUNCTION>
-<NAME>cal_client_multi_get_free_busy</NAME>
-<RETURNS>GList *</RETURNS>
-CalClientMulti *multi,GList *users,time_t start,time_t end
-</FUNCTION>
-<FUNCTION>
-<NAME>cal_client_multi_generate_instances</NAME>
-<RETURNS>void </RETURNS>
-CalClientMulti *multi,CalObjType type,time_t start,time_t end,CalRecurInstanceFn cb,gpointer cb_data
-</FUNCTION>
-<FUNCTION>
-<NAME>cal_client_multi_get_alarms_in_range</NAME>
-<RETURNS>GSList *</RETURNS>
-CalClientMulti *multi,time_t start, time_t end
-</FUNCTION>
diff --git a/doc/devel/executive-summary/evolution-services.hierarchy b/doc/devel/executive-summary/evolution-services.hierarchy
deleted file mode 100644
index 37559d819d..0000000000
--- a/doc/devel/executive-summary/evolution-services.hierarchy
+++ /dev/null
@@ -1,7 +0,0 @@
-GtkObject
- BonoboObject
- ExecutiveSummaryComponent
- ExecutiveSummaryComponentFactory
- Handle to remote Bonobo::Unknown
- ExecutiveSummaryComponentFactoryClient
- ExecutiveSummaryHtmlView
diff --git a/doc/devel/importer/evolution-shell-importer.hierarchy b/doc/devel/importer/evolution-shell-importer.hierarchy
deleted file mode 100644
index c46ebdf782..0000000000
--- a/doc/devel/importer/evolution-shell-importer.hierarchy
+++ /dev/null
@@ -1,7 +0,0 @@
-GtkObject
- BonoboObject
- BonoboXObject
- EvolutionImporter
- EvolutionImporterListener
- Handle to remote Bonobo::Unknown
- EvolutionImporterClient
diff --git a/e-util/ChangeLog b/e-util/ChangeLog
index bdc2568c69..7b1a05c828 100644
--- a/e-util/ChangeLog
+++ b/e-util/ChangeLog
@@ -1,92 +1,4 @@
-2002-04-16 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-host-utils.c (e_gethostbyaddr_r): New wrapper around
- gethostbyaddr_r if the system has it, else a whole new
- implementation.
-
-2002-04-11 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-sexp.c (parse_value): Handle parsing negative integers.
-
-2002-03-29 JP Rosevear <jpr@ximian.com>
-
- * e-dialog-utils.c (e_file_dialog_save): open a file selection
- dialog with the given title and return the selected file name
- (save_ok): if the ok button is clicked, make sure the file doesn't
- already exist and if it does, see if the user wants to over write
- it
-
- * e-dialog-utils.h: new proto
-
-2002-03-22 Ettore Perazzoli <ettore@ximian.com>
-
- * e-lang-utils.c: New.
- * e-lang-utils.h: New.
-
-2002-03-22 Dan Winship <danw@ximian.com>
-
- * e-request.c (e_request_string): Document the fact that this
- takes two locale charset strings and one UTF8 string and returns a
- UTF8 string. (Huh.)
-
-2002-03-04 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-mktemp.c: #include <string.h> for strcmp.
-
-2002-02-22 Dan Winship <danw@ximian.com>
-
- * e-html-utils.c (e_text_to_html_full): Fix for if the buffer ends
- with an email address (and no newline).
-
-2002-02-09 JP Rosevear <jpr@ximian.com>
-
- * e-pilot-settings.h: add row and column defines
-
-2002-01-27 Ettore Perazzoli <ettore@ximian.com>
-
- * ename/Makefile.am: Use E_NAME_CFLAGS and E_NAME_LIBS.
-
- * Makefile.am: Use E_UTIL_CFLAGS and E_UTIL_LIBS.
-
-2002-01-14 JP Rosevear <jpr@ximian.com>
-
- * Makefile.am: compile new files
-
- * e-pilot-settings.[hc]: beginnings of a general conduit
- configuration gui
-
-2002-01-10 Christopher James Lahey <clahey@ximian.com>
-
- * ename/e-name-western.c (e_name_western_word_is_suffix): Allow
- for a period after suffixes. Fixes Ximian bug #17012.
-
-2002-01-04 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-memory.c (e_memchunk_clean): Prune free'd nodes from our free
- list otherwise we'll end up re-using free'd memory blocks and
- that's not a Good Thing (tm).
-
-2002-01-02 Jeffrey Stedfast <fejj@ximian.com>
-
- * md5-utils.h: Reverted.
-
-2002-01-02 Jeffrey Stedfast <fejj@ximian.com>
-
- * md5-utils.h: Move the struct into md5-utils.c - this is a
- kludgey hack around the fact that NSS also defines
- MD5Context. Besides, this should be a private struct anyway.
-
-2002-01-02 JP Rosevear <jpr@ximian.com>
-
- * e-dialog-utils.c (e_gnome_dialog_set_parent): util function
- moved from mail-callbacks, also destroys the dialog if the parent
- is destroyed
- (e_gnome_warning_dialog_parented): similarly
- (e_gnome_ok_cancel_dialog_parented): ditto
-
- * e-dialog-utils.h: new protos
-
-2001-12-17 JP Rosevear <jpr@ximian.com>
+2001-12-18 JP Rosevear <jpr@ximian.com>
* e-pilot-map.c (e_pilot_map_clear): clear all info from the map
diff --git a/e-util/e-bit-array.c b/e-util/e-bit-array.c
deleted file mode 100644
index 274ee32b09..0000000000
--- a/e-util/e-bit-array.c
+++ /dev/null
@@ -1,429 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-bit-array.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <gtk/gtksignal.h>
-#include "e-bit-array.h"
-#include "gal/util/e-util.h"
-
-#define EBA_CLASS(e) ((EBitArrayClass *)((GtkObject *)e)->klass)
-
-#define PARENT_TYPE (gtk_object_get_type ())
-
-#define ONES ((guint32) 0xffffffff)
-
-#define BOX(n) ((n) / 32)
-#define OFFSET(n) (31 - ((n) % 32))
-#define BITMASK(n) ((guint32)(((guint32) 0x1) << OFFSET((n))))
-#define BITMASK_LEFT(n) ((((n) % 32) == 0) ? 0 : (ONES << (32 - ((n) % 32))))
-#define BITMASK_RIGHT(n) ((guint32)(((guint32) ONES) >> ((n) % 32)))
-
-static GtkObjectClass *parent_class;
-
-static void
-e_bit_array_insert_real(EBitArray *eba, int row)
-{
- int box;
- int i;
- if(eba->bit_count >= 0) {
- /* Add another word if needed. */
- if ((eba->bit_count & 0x1f) == 0) {
- eba->data = g_renew(gint, eba->data, (eba->bit_count >> 5) + 1);
- eba->data[eba->bit_count >> 5] = 0;
- }
-
- /* The box is the word that our row is in. */
- box = BOX(row);
- /* Shift all words to the right of our box right one bit. */
- for (i = eba->bit_count >> 5; i > box; i--) {
- eba->data[i] = (eba->data[i] >> 1) | (eba->data[i - 1] << 31);
- }
-
- /* Shift right half of box one bit to the right. */
- eba->data[box] = (eba->data[box] & BITMASK_LEFT(row)) | ((eba->data[box] & BITMASK_RIGHT(row)) >> 1);
- eba->bit_count ++;
- }
-}
-
-static void
-e_bit_array_delete_real(EBitArray *eba, int row, gboolean move_selection_mode)
-{
- int box;
- int i;
- int last;
- int selected = FALSE;
- if(eba->bit_count >= 0) {
- guint32 bitmask;
- box = row >> 5;
- last = eba->bit_count >> 5;
-
- /* Build bitmasks for the left and right half of the box */
- bitmask = BITMASK_RIGHT(row) >> 1;
- if (move_selection_mode)
- selected = e_bit_array_value_at(eba, row);
- /* Shift right half of box one bit to the left. */
- eba->data[box] = (eba->data[box] & BITMASK_LEFT(row))| ((eba->data[box] & bitmask) << 1);
-
- /* Shift all words to the right of our box left one bit. */
- if (box < last) {
- eba->data[box] &= eba->data[box + 1] >> 31;
-
- for (i = box + 1; i < last; i++) {
- eba->data[i] = (eba->data[i] << 1) | (eba->data[i + 1] >> 31);
- }
- /* this over-runs our memory! */
- /*eba->data[i] = eba->data[i] << 1; */
- }
- eba->bit_count --;
- /* Remove the last word if not needed. */
- if ((eba->bit_count & 0x1f) == 0) {
- eba->data = g_renew(gint, eba->data, eba->bit_count >> 5);
- }
- if (move_selection_mode && selected) {
- e_bit_array_select_single_row (eba, row > 0 ? row - 1 : 0);
- }
- }
-}
-
-/* FIXME : Improve efficiency here. */
-void
-e_bit_array_delete(EBitArray *eba, int row, int count)
-{
- int i;
- for (i = 0; i < count; i++)
- e_bit_array_delete_real(eba, row, FALSE);
-}
-
-/* FIXME : Improve efficiency here. */
-void
-e_bit_array_delete_single_mode(EBitArray *eba, int row, int count)
-{
- int i;
- for (i = 0; i < count; i++)
- e_bit_array_delete_real(eba, row, TRUE);
-}
-
-/* FIXME : Improve efficiency here. */
-void
-e_bit_array_insert(EBitArray *eba, int row, int count)
-{
- int i;
- for (i = 0; i < count; i++)
- e_bit_array_insert_real(eba, row);
-}
-
-/* FIXME: Implement this more efficiently. */
-void
-e_bit_array_move_row(EBitArray *eba, int old_row, int new_row)
-{
- e_bit_array_delete_real(eba, old_row, FALSE);
- e_bit_array_insert_real(eba, new_row);
-}
-
-static void
-eba_destroy (GtkObject *object)
-{
- EBitArray *eba;
-
- eba = E_BIT_ARRAY (object);
-
- g_free(eba->data);
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-/**
- * e_selection_model_is_row_selected
- * @selection: #EBitArray to check
- * @n: The row to check
- *
- * This routine calculates whether the given row is selected.
- *
- * Returns: %TRUE if the given row is selected
- */
-gboolean
-e_bit_array_value_at (EBitArray *eba,
- gint n)
-{
- if (eba->bit_count < n || eba->bit_count == 0)
- return 0;
- else
- return (eba->data[BOX(n)] >> OFFSET(n)) & 0x1;
-}
-
-/**
- * e_selection_model_foreach
- * @selection: #EBitArray to traverse
- * @callback: The callback function to call back.
- * @closure: The closure
- *
- * This routine calls the given callback function once for each
- * selected row, passing closure as the closure.
- */
-void
-e_bit_array_foreach (EBitArray *eba,
- EForeachFunc callback,
- gpointer closure)
-{
- int i;
- int last = (eba->bit_count + 31) / 32;
- for (i = 0; i < last; i++) {
- if (eba->data[i]) {
- int j;
- guint32 value = eba->data[i];
- for (j = 0; j < 32; j++) {
- if (value & 0x80000000) {
- callback(i * 32 + j, closure);
- }
- value <<= 1;
- }
- }
- }
-}
-
-/**
- * e_selection_model_clear
- * @selection: #EBitArray to clear
- *
- * This routine clears the selection to no rows selected.
- */
-void
-e_bit_array_clear(EBitArray *eba)
-{
- g_free(eba->data);
- eba->data = NULL;
- eba->bit_count = 0;
-}
-
-#define PART(x,n) (((x) & (0x01010101 << n)) >> n)
-#define SECTION(x, n) (((x) >> (n * 8)) & 0xff)
-
-/**
- * e_selection_model_selected_count
- * @selection: #EBitArray to count
- *
- * This routine calculates the number of rows selected.
- *
- * Returns: The number of rows selected in the given model.
- */
-gint
-e_bit_array_selected_count (EBitArray *eba)
-{
- gint count;
- int i;
- int last;
-
- if (!eba->data)
- return 0;
-
- count = 0;
-
- last = BOX(eba->bit_count - 1);
-
- for (i = 0; i <= last; i++) {
- int j;
- guint32 thiscount = 0;
- for (j = 0; j < 8; j++)
- thiscount += PART(eba->data[i], j);
- for (j = 0; j < 4; j++)
- count += SECTION(thiscount, j);
- }
-
- return count;
-}
-
-/**
- * e_selection_model_select_all
- * @selection: #EBitArray to select all
- *
- * This routine selects all the rows in the given
- * #EBitArray.
- */
-void
-e_bit_array_select_all (EBitArray *eba)
-{
- int i;
-
- if (!eba->data)
- eba->data = g_new0 (gint, (eba->bit_count + 31) / 32);
-
- for (i = 0; i < (eba->bit_count + 31) / 32; i ++) {
- eba->data[i] = ONES;
- }
-
- /* need to zero out the bits corresponding to the rows not
- selected in the last full 32 bit mask */
- if (eba->bit_count % 32) {
- int unselected_mask = 0;
- int num_unselected_in_last_byte = 32 - eba->bit_count % 32;
-
- for (i = 0; i < num_unselected_in_last_byte; i ++)
- unselected_mask |= 1 << i;
-
- eba->data[(eba->bit_count + 31) / 32 - 1] &= ~unselected_mask;
- }
-}
-
-/**
- * e_selection_model_invert_selection
- * @selection: #EBitArray to invert
- *
- * This routine inverts all the rows in the given
- * #EBitArray.
- */
-void
-e_bit_array_invert_selection (EBitArray *eba)
-{
- int i;
-
- if (!eba->data)
- eba->data = g_new0 (gint, (eba->bit_count + 31) / 32);
-
- for (i = 0; i < (eba->bit_count + 31) / 32; i ++) {
- eba->data[i] = ~eba->data[i];
- }
-}
-
-int
-e_bit_array_bit_count (EBitArray *eba)
-{
- return eba->bit_count;
-}
-
-gboolean
-e_bit_array_cross_and (EBitArray *eba)
-{
- int i;
- for (i = 0; i < eba->bit_count / 32; i++) {
- if (eba->data[i] != ONES)
- return FALSE;
- }
- if ((eba->bit_count % 32) && ((eba->data[i] & BITMASK_LEFT(eba->bit_count)) != BITMASK_LEFT(eba->bit_count)))
- return FALSE;
- return TRUE;
-}
-
-gboolean
-e_bit_array_cross_or (EBitArray *eba)
-{
- int i;
- for (i = 0; i < eba->bit_count / 32; i++) {
- if (eba->data[i] != 0)
- return TRUE;
- }
- if ((eba->bit_count % 32) && ((eba->data[i] & BITMASK_LEFT(eba->bit_count)) != 0))
- return TRUE;
- return FALSE;
-}
-
-#define OPERATE(object, i,mask,grow) ((grow) ? (((object)->data[(i)]) |= ((guint32) ~(mask))) : (((object)->data[(i)]) &= (mask)))
-
-void
-e_bit_array_change_one_row(EBitArray *eba, int row, gboolean grow)
-{
- int i;
- i = BOX(row);
-
- OPERATE(eba, i, ~BITMASK(row), grow);
-}
-
-void
-e_bit_array_change_range(EBitArray *eba, int start, int end, gboolean grow)
-{
- int i, last;
- if (start != end) {
- i = BOX(start);
- last = BOX(end);
-
- if (i == last) {
- OPERATE(eba, i, BITMASK_LEFT(start) | BITMASK_RIGHT(end), grow);
- } else {
- OPERATE(eba, i, BITMASK_LEFT(start), grow);
- if (grow)
- for (i ++; i < last; i++)
- eba->data[i] = ONES;
- else
- for (i ++; i < last; i++)
- eba->data[i] = 0;
- OPERATE(eba, i, BITMASK_RIGHT(end), grow);
- }
- }
-}
-
-void
-e_bit_array_select_single_row (EBitArray *eba, int row)
-{
- int i;
- for (i = 0; i < ((eba->bit_count + 31) / 32); i++) {
- if (!((i == BOX(row) && eba->data[i] == BITMASK(row)) ||
- (i != BOX(row) && eba->data[i] == 0))) {
- g_free(eba->data);
- eba->data = g_new0(gint, (eba->bit_count + 31) / 32);
- eba->data[BOX(row)] = BITMASK(row);
-
- break;
- }
- }
-}
-
-void
-e_bit_array_toggle_single_row (EBitArray *eba, int row)
-{
- if (eba->data[BOX(row)] & BITMASK(row))
- eba->data[BOX(row)] &= ~BITMASK(row);
- else
- eba->data[BOX(row)] |= BITMASK(row);
-}
-
-
-static void
-e_bit_array_init (EBitArray *eba)
-{
- eba->data = NULL;
- eba->bit_count = 0;
-}
-
-static void
-e_bit_array_class_init (EBitArrayClass *klass)
-{
- GtkObjectClass *object_class;
-
- parent_class = gtk_type_class (PARENT_TYPE);
-
- object_class = GTK_OBJECT_CLASS(klass);
-
- object_class->destroy = eba_destroy;
-}
-
-E_MAKE_TYPE(e_bit_array, "EBitArray", EBitArray,
- e_bit_array_class_init, e_bit_array_init, PARENT_TYPE);
-
-EBitArray *
-e_bit_array_new (int count)
-{
- EBitArray *eba = gtk_type_new (e_bit_array_get_type ());
- eba->bit_count = count;
- eba->data = g_new0(gint, (eba->bit_count + 31) / 32);
- return eba;
-}
diff --git a/e-util/e-bit-array.h b/e-util/e-bit-array.h
deleted file mode 100644
index c06f405ede..0000000000
--- a/e-util/e-bit-array.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-bit-array.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_BIT_ARRAY_H_
-#define _E_BIT_ARRAY_H_
-
-#include <gtk/gtkobject.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#define E_BIT_ARRAY_TYPE (e_bit_array_get_type ())
-#define E_BIT_ARRAY(o) (GTK_CHECK_CAST ((o), E_BIT_ARRAY_TYPE, EBitArray))
-#define E_BIT_ARRAY_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_BIT_ARRAY_TYPE, EBitArrayClass))
-#define E_IS_BIT_ARRAY(o) (GTK_CHECK_TYPE ((o), E_BIT_ARRAY_TYPE))
-#define E_IS_BIT_ARRAY_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_BIT_ARRAY_TYPE))
-
-#ifndef _E_FOREACH_FUNC_H_
-#define _E_FOREACH_FUNC_H_
-typedef void (*EForeachFunc) (int model_row,
- gpointer closure);
-#endif
-
-typedef struct {
- GtkObject base;
-
- gint bit_count;
- guint32 *data;
-} EBitArray;
-
-typedef struct {
- GtkObjectClass parent_class;
-} EBitArrayClass;
-
-
-GtkType e_bit_array_get_type (void);
-EBitArray *e_bit_array_new (int count);
-
-gboolean e_bit_array_value_at (EBitArray *selection,
- gint n);
-void e_bit_array_foreach (EBitArray *selection,
- EForeachFunc callback,
- gpointer closure);
-void e_bit_array_clear (EBitArray *selection);
-gint e_bit_array_selected_count (EBitArray *selection);
-void e_bit_array_select_all (EBitArray *selection);
-void e_bit_array_invert_selection (EBitArray *selection);
-int e_bit_array_bit_count (EBitArray *selection);
-void e_bit_array_change_one_row (EBitArray *selection,
- int row,
- gboolean grow);
-void e_bit_array_change_range (EBitArray *selection,
- int start,
- int end,
- gboolean grow);
-void e_bit_array_select_single_row (EBitArray *eba,
- int row);
-void e_bit_array_toggle_single_row (EBitArray *eba,
- int row);
-
-void e_bit_array_insert (EBitArray *esm,
- int row,
- int count);
-void e_bit_array_delete (EBitArray *esm,
- int row,
- int count);
-void e_bit_array_delete_single_mode (EBitArray *esm,
- int row,
- int count);
-void e_bit_array_move_row (EBitArray *esm,
- int old_row,
- int new_row);
-gint e_bit_array_bit_count (EBitArray *esm);
-
-gboolean e_bit_array_cross_and (EBitArray *esm);
-gboolean e_bit_array_cross_or (EBitArray *esm);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* _E_BIT_ARRAY_H_ */
diff --git a/e-util/e-i18n.h b/e-util/e-i18n.h
deleted file mode 100644
index e10ad4fa2b..0000000000
--- a/e-util/e-i18n.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-i18n.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * Copied from gnome-i18nP.h, because this header is typically not installed
- *
- * This file has to be included before any file from the GNOME libraries
- * to have this override the definitions that are pulled from the gnome-i18n.h
- *
- * the difference is that gnome-i18n.h is used for applications, and this is
- * used by libraries (because libraries have to use dcgettext instead of
- * gettext and they need to provide the translation domain, unlike apps).
- *
- * So you can just put this after you include config.h
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef __E_I18N_H__
-#define __E_I18N_H__
-
-#include <glib.h>
-#include <libgnome/gnome-defs.h>
-
-BEGIN_GNOME_DECLS
-
-#ifdef ENABLE_NLS
-# include <libintl.h>
-# undef _
-# define _(String) dgettext (PACKAGE, String)
-# ifdef gettext_noop
-# define N_(String) gettext_noop (String)
-# else
-# define N_(String) (String)
-# endif
-#else
-/* Stubs that do something close enough. */
-# define textdomain(String) (String)
-# define gettext(String) (String)
-# define dgettext(Domain,Message) (Message)
-# define dcgettext(Domain,Message,Type) (Message)
-# define bindtextdomain(Domain,Directory) (Domain)
-# define _(String) (String)
-# define N_(String) (String)
-#endif
-
-/*
- * Do not remove the following define, nor do surround it with ifdefs.
- *
- * If you get any `redefined' errors, it means that you are including
- * -incorrectly- a header file provided by gnome-libs before this file.
- * To correctly solve this issue include this file before any libgnome/
- * libgnomeui headers
- */
-
-#define __GNOME_I18N_H__ 1
-
-
-/* This is copied staight out of the prototypes for gnome-i18n.h */
-const char *gnome_i18n_get_language(void);
-GList *gnome_i18n_get_language_list (const gchar *category_name);
-void gnome_i18n_set_preferred_language (const char *val);
-const char *gnome_i18n_get_preferred_language (void);
-void gnome_i18n_init (void);
-
-END_GNOME_DECLS
-
-#endif /* __E_I18N_H__ */
diff --git a/e-util/e-iconv.c b/e-util/e-iconv.c
deleted file mode 100644
index 7f18a5b43e..0000000000
--- a/e-util/e-iconv.c
+++ /dev/null
@@ -1,478 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-iconv.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Michael Zucchi <notzed@ximian.com>
- * Jeffery Stedfast <fejj@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <glib.h>
-#include "e-iconv.h"
-
-#include <locale.h>
-
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
-#endif
-
-#ifdef HAVE_CODESET
-#include <langinfo.h>
-#endif
-
-#include "iconv-detect.h"
-
-#define cd(x)
-
-#ifdef G_THREADS_ENABLED
-static GStaticMutex lock = G_STATIC_MUTEX_INIT;
-#define LOCK() g_static_mutex_lock(&lock)
-#define UNLOCK() g_static_mutex_unlock(&lock)
-#else
-#define LOCK()
-#define UNLOCK()
-#endif
-
-typedef struct _EDListNode {
- struct _EDListNode *next;
- struct _EDListNode *prev;
-} EDListNode;
-
-typedef struct _EDList {
- struct _EDListNode *head;
- struct _EDListNode *tail;
- struct _EDListNode *tailpred;
-} EDList;
-
-#define E_DLIST_INITIALISER(l) { (EDListNode *)&l.tail, 0, (EDListNode *)&l.head }
-
-struct _iconv_cache_node {
- struct _iconv_cache_node *next;
- struct _iconv_cache_node *prev;
-
- struct _iconv_cache *parent;
-
- int busy;
- iconv_t ip;
-};
-
-struct _iconv_cache {
- struct _iconv_cache *next;
- struct _iconv_cache *prev;
-
- char *conv;
-
- EDList open; /* stores iconv_cache_nodes, busy ones up front */
-};
-
-#define E_ICONV_CACHE_SIZE (16)
-
-static EDList iconv_cache_list;
-static GHashTable *iconv_cache;
-static GHashTable *iconv_cache_open;
-static unsigned int iconv_cache_size = 0;
-
-static GHashTable *iconv_charsets = NULL;
-static const char *locale_charset = NULL;
-
-struct {
- char *charset;
- char *iconv_name;
-} known_iconv_charsets[] = {
-#if 0
- /* charset name, iconv-friendly charset name */
- { "iso-8859-1", "iso-8859-1" },
- { "iso8859-1", "iso-8859-1" },
- /* the above mostly serves as an example for iso-style charsets,
- but we have code that will populate the iso-*'s if/when they
- show up in e_iconv_charset_name() so I'm
- not going to bother putting them all in here... */
- { "windows-cp1251", "cp1251" },
- { "windows-1251", "cp1251" },
- { "cp1251", "cp1251" },
- /* the above mostly serves as an example for windows-style
- charsets, but we have code that will parse and convert them
- to their cp#### equivalents if/when they show up in
- e_iconv_charset_name() so I'm not going to bother
- putting them all in here either... */
-#endif
- /* charset name (lowercase!), iconv-friendly name (sometimes case sensitive) */
- { "utf-8", "UTF-8" },
-
- /* 10646 is a special case, its usually UCS-2 big endian */
- /* This might need some checking but should be ok for solaris/linux */
- { "iso-10646-1", "UCS-2BE" },
- { "iso_10646-1", "UCS-2BE" },
- { "iso10646-1", "UCS-2BE" },
- { "iso-10646", "UCS-2BE" },
- { "iso_10646", "UCS-2BE" },
- { "iso10646", "UCS-2BE" },
-
- { "ks_c_5601-1987", "EUC-KR" },
-
- /* FIXME: Japanese/Korean/Chinese stuff needs checking */
- { "euckr-0", "EUC-KR" },
- { "big5-0", "BIG5" },
- { "big5.eten-0", "BIG5" },
- { "big5hkscs-0", "BIG5HKCS" },
- { "gb2312-0", "gb2312" },
- { "gb2312.1980-0", "gb2312" },
- { "gb18030-0", "gb18030" },
- { "gbk-0", "GBK" },
-
- { "eucjp-0", "eucJP" },
- { "ujis-0", "ujis" },
- { "jisx0208.1983-0","SJIS" },
- { "jisx0212.1990-0","SJIS" },
- { NULL, NULL }
-};
-
-
-
-/* Another copy of this trivial list implementation
- Why? This stuff gets called a lot (potentially), should run fast,
- and g_list's are f@@#$ed up to make this a hassle */
-static void e_dlist_init(EDList *v)
-{
- v->head = (EDListNode *)&v->tail;
- v->tail = 0;
- v->tailpred = (EDListNode *)&v->head;
-}
-
-static EDListNode *e_dlist_addhead(EDList *l, EDListNode *n)
-{
- n->next = l->head;
- n->prev = (EDListNode *)&l->head;
- l->head->prev = n;
- l->head = n;
- return n;
-}
-
-static EDListNode *e_dlist_addtail(EDList *l, EDListNode *n)
-{
- n->next = (EDListNode *)&l->tail;
- n->prev = l->tailpred;
- l->tailpred->next = n;
- l->tailpred = n;
- return n;
-}
-
-static EDListNode *e_dlist_remove(EDListNode *n)
-{
- n->next->prev = n->prev;
- n->prev->next = n->next;
- return n;
-}
-
-/* NOTE: Owns the lock on return if keep is TRUE ! */
-static void
-e_iconv_init(int keep)
-{
- char *from, *to, *locale;
- int i;
-
- LOCK();
-
- if (iconv_charsets != NULL) {
- if (!keep)
- UNLOCK();
- return;
- }
-
- iconv_charsets = g_hash_table_new(g_str_hash, g_str_equal);
-
- for (i = 0; known_iconv_charsets[i].charset != NULL; i++) {
- from = g_strdup(known_iconv_charsets[i].charset);
- to = g_strdup(known_iconv_charsets[i].iconv_name);
- g_strdown(from);
- g_hash_table_insert(iconv_charsets, from, to);
- }
-
- e_dlist_init(&iconv_cache_list);
- iconv_cache = g_hash_table_new(g_str_hash, g_str_equal);
- iconv_cache_open = g_hash_table_new(NULL, NULL);
-
- locale = setlocale (LC_ALL, NULL);
-
- if (!locale || !strcmp (locale, "C") || !strcmp (locale, "POSIX")) {
- /* The locale "C" or "POSIX" is a portable locale; its
- * LC_CTYPE part corresponds to the 7-bit ASCII character
- * set.
- */
-
- locale_charset = NULL;
- } else {
-#ifdef HAVE_CODESET
- locale_charset = g_strdup(nl_langinfo(CODESET));
- g_strdown((char *)locale_charset);
-#else
- /* A locale name is typically of the form language[_terri-
- * tory][.codeset][@modifier], where language is an ISO 639
- * language code, territory is an ISO 3166 country code, and
- * codeset is a character set or encoding identifier like
- * ISO-8859-1 or UTF-8.
- */
- char *codeset, *p;
-
- codeset = strchr (locale, '.');
- if (codeset) {
- codeset++;
-
- /* ; is a hack for debian systems and / is a hack for Solaris systems */
- for (p = codeset; *p && !strchr ("@;/", *p); p++);
- locale_charset = g_strndup (codeset, p - codeset);
- g_strdown (locale_charset);
- } else {
- /* charset unknown */
- locale_charset = NULL;
- }
-#endif
- }
-
- if (!keep)
- UNLOCK();
-}
-
-const char *e_iconv_charset_name(const char *charset)
-{
- char *name, *ret, *tmp;
-
- if (charset == NULL)
- return NULL;
-
- name = alloca(strlen(charset)+1);
- strcpy(name, charset);
- g_strdown(name);
-
- e_iconv_init(TRUE);
- ret = g_hash_table_lookup(iconv_charsets, name);
- if (ret != NULL) {
- UNLOCK();
- return ret;
- }
-
- /* Unknown, try canonicalise some basic charset types to something that should work */
- if (strncmp(name, "iso", 3) == 0) {
- /* Convert iso-nnnn-n or isonnnn-n or iso_nnnn-n to iso-nnnn-n or isonnnn-n */
- int iso, codepage;
- char *p;
-
- tmp = name + 3;
- if (*tmp == '-' || *tmp == '_')
- tmp++;
-
- iso = strtoul (tmp, &p, 10);
-
- if (iso == 10646) {
- /* they all become ICONV_10646 */
- ret = g_strdup (ICONV_10646);
- } else {
- tmp = p;
- if (*tmp == '-' || *tmp == '_')
- tmp++;
-
- codepage = strtoul (tmp, &p, 10);
-
- if (p > tmp) {
- /* codepage is numeric */
-#ifdef __aix__
- if (codepage == 13)
- ret = g_strdup ("IBM-921");
- else
-#endif /* __aix__ */
- ret = g_strdup_printf (ICONV_ISO_D_FORMAT, iso, codepage);
- } else {
- /* codepage is a string - probably iso-2022-jp or something */
- ret = g_strdup_printf (ICONV_ISO_S_FORMAT, iso, p);
- }
- }
- } else if (strncmp(name, "windows-", 8) == 0) {
- /* Convert windows-nnnnn or windows-cpnnnnn to cpnnnn */
- tmp = name+8;
- if (!strncmp(tmp, "cp", 2))
- tmp+=2;
- ret = g_strdup_printf("CP%s", tmp);
- } else if (strncmp(name, "microsoft-", 10) == 0) {
- /* Convert microsoft-nnnnn or microsoft-cpnnnnn to cpnnnn */
- tmp = name+10;
- if (!strncmp(tmp, "cp", 2))
- tmp+=2;
- ret = g_strdup_printf("CP%s", tmp);
- } else {
- /* Just assume its ok enough as is, case and all */
- ret = g_strdup(charset);
- }
-
- g_hash_table_insert(iconv_charsets, g_strdup(name), ret);
- UNLOCK();
-
- return ret;
-}
-
-static void
-flush_entry(struct _iconv_cache *ic)
-{
- struct _iconv_cache_node *in, *nn;
-
- in = (struct _iconv_cache_node *)ic->open.head;
- nn = in->next;
- while (nn) {
- if (in->ip != (iconv_t)-1) {
- g_hash_table_remove(iconv_cache_open, in->ip);
- iconv_close(in->ip);
- }
- g_free(in);
- in = nn;
- nn = in->next;
- }
- g_free(ic->conv);
- g_free(ic);
-}
-
-/* This should run pretty quick, its called a lot */
-iconv_t e_iconv_open(const char *oto, const char *ofrom)
-{
- const char *to, *from;
- char *tofrom;
- struct _iconv_cache *ic;
- struct _iconv_cache_node *in;
- iconv_t ip;
-
- if (oto == NULL || ofrom == NULL)
- return (iconv_t)-1;
-
- to = e_iconv_charset_name (oto);
- from = e_iconv_charset_name (ofrom);
- tofrom = alloca(strlen(to) +strlen(from) + 2);
- sprintf(tofrom, "%s%%%s", to, from);
-
- LOCK();
-
- ic = g_hash_table_lookup(iconv_cache, tofrom);
- if (ic) {
- e_dlist_remove((EDListNode *)ic);
- } else {
- struct _iconv_cache *last = (struct _iconv_cache *)iconv_cache_list.tailpred;
- struct _iconv_cache *prev;
-
- prev = last->prev;
- while (prev && iconv_cache_size > E_ICONV_CACHE_SIZE) {
- in = (struct _iconv_cache_node *)last->open.head;
- if (in->next && !in->busy) {
- cd(printf("Flushing iconv converter '%s'\n", last->conv));
- e_dlist_remove((EDListNode *)last);
- g_hash_table_remove(iconv_cache, last->conv);
- flush_entry(last);
- iconv_cache_size--;
- }
- last = prev;
- prev = last->prev;
- }
-
- iconv_cache_size++;
-
- ic = g_malloc(sizeof(*ic));
- e_dlist_init(&ic->open);
- ic->conv = g_strdup(tofrom);
- g_hash_table_insert(iconv_cache, ic->conv, ic);
-
- cd(printf("Creating iconv converter '%s'\n", ic->conv));
- }
- e_dlist_addhead(&iconv_cache_list, (EDListNode *)ic);
-
- /* If we have a free iconv, use it */
- in = (struct _iconv_cache_node *)ic->open.tailpred;
- if (in->prev && !in->busy) {
- cd(printf("using existing iconv converter '%s'\n", ic->conv));
- ip = in->ip;
- if (ip != (iconv_t)-1) {
- /* work around some broken iconv implementations
- * that die if the length arguments are NULL
- */
- size_t buggy_iconv = 0;
-
- /* resets the converter */
- iconv(ip, NULL, &buggy_iconv, NULL, &buggy_iconv);
- in->busy = TRUE;
- e_dlist_remove((EDListNode *)in);
- e_dlist_addhead(&ic->open, (EDListNode *)in);
- }
- } else {
- cd(printf("creating new iconv converter '%s'\n", ic->conv));
- ip = iconv_open(to, from);
- in = g_malloc(sizeof(*in));
- in->ip = ip;
- in->parent = ic;
- e_dlist_addhead(&ic->open, (EDListNode *)in);
- if (ip != (iconv_t)-1) {
- g_hash_table_insert(iconv_cache_open, ip, in);
- in->busy = TRUE;
- } else {
- g_warning("Could not open converter for '%s' to '%s' charset", from, to);
- in->busy = FALSE;
- }
- }
-
- UNLOCK();
-
- return ip;
-}
-
-size_t e_iconv(iconv_t cd, const char **inbuf, size_t *inbytesleft, char ** outbuf, size_t *outbytesleft)
-{
- return iconv(cd, (char **) inbuf, inbytesleft, outbuf, outbytesleft);
-}
-
-void
-e_iconv_close(iconv_t ip)
-{
- struct _iconv_cache_node *in;
-
- if (ip == (iconv_t)-1)
- return;
-
- LOCK();
- in = g_hash_table_lookup(iconv_cache_open, ip);
- if (in) {
- cd(printf("closing iconv converter '%s'\n", in->parent->conv));
- e_dlist_remove((EDListNode *)in);
- in->busy = FALSE;
- e_dlist_addtail(&in->parent->open, (EDListNode *)in);
- } else {
- g_warning("trying to close iconv i dont know about: %p", ip);
- iconv_close(ip);
- }
- UNLOCK();
-
-}
-
-const char *e_iconv_locale_charset(void)
-{
- e_iconv_init(FALSE);
-
- return locale_charset;
-}
-
diff --git a/e-util/e-iconv.h b/e-util/e-iconv.h
deleted file mode 100644
index daf97a30ab..0000000000
--- a/e-util/e-iconv.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-iconv.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Michael Zucchi <notzed@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_ICONV_H_
-#define _E_ICONV_H_
-
-#include <iconv.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-const char *e_iconv_charset_name(const char *charset);
-iconv_t e_iconv_open(const char *oto, const char *ofrom);
-size_t e_iconv(iconv_t cd, const char **inbuf, size_t *inbytesleft, char ** outbuf, size_t *outbytesleft);
-void e_iconv_close(iconv_t ip);
-const char *e_iconv_locale_charset(void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* !_E_ICONV_H_ */
diff --git a/e-util/e-sorter-array.c b/e-util/e-sorter-array.c
deleted file mode 100644
index 500bbe466e..0000000000
--- a/e-util/e-sorter-array.c
+++ /dev/null
@@ -1,292 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-sorter-array.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <stdlib.h>
-#include <string.h>
-#include <gtk/gtksignal.h>
-#include "gal/util/e-util.h"
-#include "e-sorter-array.h"
-
-#define d(x)
-
-/* The arguments we take */
-enum {
- ARG_0,
-};
-
-#define PARENT_TYPE e_sorter_get_type()
-
-#define INCREMENT_AMOUNT 100
-
-static ESorterClass *parent_class;
-
-static void esa_sort (ESorterArray *esa);
-static void esa_backsort (ESorterArray *esa);
-
-static gint esa_model_to_sorted (ESorter *sorter, int row);
-static gint esa_sorted_to_model (ESorter *sorter, int row);
-static void esa_get_model_to_sorted_array (ESorter *sorter, int **array, int *count);
-static void esa_get_sorted_to_model_array (ESorter *sorter, int **array, int *count);
-static gboolean esa_needs_sorting (ESorter *esa);
-
-#define ESA_NEEDS_SORTING(esa) (((ESorterArray *) (esa))->compare != NULL)
-
-static int
-esort_callback(const void *data1, const void *data2, gpointer user_data)
-{
- ESorterArray *esa = user_data;
- int ret_val;
- int int1, int2;
-
- int1 = *(int *)data1;
- int2 = *(int *)data2;
-
- ret_val = esa->compare (int1, int2, esa->closure);
- if (ret_val != 0)
- return ret_val;
-
- if (int1 < int2)
- return -1;
- if (int1 > int2)
- return 1;
- return 0;
-}
-
-static void
-esa_sort(ESorterArray *esa)
-{
- int rows;
- int i;
-
- if (esa->sorted)
- return;
-
- rows = esa->rows;
-
- esa->sorted = g_new(int, rows);
- for (i = 0; i < rows; i++)
- esa->sorted[i] = i;
-
- if (esa->compare)
- e_sort (esa->sorted, rows, sizeof(int), esort_callback, esa);
-}
-
-static void
-esa_backsort(ESorterArray *esa)
-{
- int i, rows;
-
- if (esa->backsorted)
- return;
-
- esa_sort(esa);
-
- rows = esa->rows;
-
- esa->backsorted = g_new0(int, rows);
-
- for (i = 0; i < rows; i++) {
- esa->backsorted[esa->sorted[i]] = i;
- }
-}
-
-
-static gint
-esa_model_to_sorted (ESorter *es, int row)
-{
- ESorterArray *esa = E_SORTER_ARRAY(es);
-
- g_return_val_if_fail(row >= 0, -1);
- g_return_val_if_fail(row < esa->rows, -1);
-
- if (ESA_NEEDS_SORTING(es))
- esa_backsort(esa);
-
- if (esa->backsorted)
- return esa->backsorted[row];
- else
- return row;
-}
-
-static gint
-esa_sorted_to_model (ESorter *es, int row)
-{
- ESorterArray *esa = (ESorterArray *) es;
-
- g_return_val_if_fail(row >= 0, -1);
- g_return_val_if_fail(row < esa->rows, -1);
-
- if (ESA_NEEDS_SORTING(es))
- esa_sort(esa);
-
- if (esa->sorted)
- return esa->sorted[row];
- else
- return row;
-}
-
-static void
-esa_get_model_to_sorted_array (ESorter *es, int **array, int *count)
-{
- ESorterArray *esa = E_SORTER_ARRAY(es);
- if (array || count) {
- esa_backsort(esa);
-
- if (array)
- *array = esa->backsorted;
- if (count)
- *count = esa->rows;
- }
-}
-
-static void
-esa_get_sorted_to_model_array (ESorter *es, int **array, int *count)
-{
- ESorterArray *esa = E_SORTER_ARRAY(es);
- if (array || count) {
- esa_sort(esa);
-
- if (array)
- *array = esa->sorted;
- if (count)
- *count = esa->rows;
- }
-}
-
-static gboolean
-esa_needs_sorting(ESorter *es)
-{
- ESorterArray *esa = E_SORTER_ARRAY(es);
- return esa->compare != NULL;
-}
-
-void
-e_sorter_array_clean(ESorterArray *esa)
-{
- g_free(esa->sorted);
- esa->sorted = NULL;
-
- g_free(esa->backsorted);
- esa->backsorted = NULL;
-}
-
-void
-e_sorter_array_set_count (ESorterArray *esa, int count)
-{
- e_sorter_array_clean (esa);
- esa->rows = count;
-}
-
-void
-e_sorter_array_append (ESorterArray *esa, int count)
-{
- int i;
- g_free(esa->backsorted);
- esa->backsorted = NULL;
-
- if (esa->sorted) {
- esa->sorted = g_renew(int, esa->sorted, esa->rows + count);
- for (i = 0; i < count; i++) {
- int value = esa->rows;
- size_t pos;
- e_bsearch (&value, esa->sorted, esa->rows, sizeof (int), esort_callback, esa, &pos, NULL);
- memmove (esa->sorted + pos + 1, esa->sorted + pos, sizeof (int) * (esa->rows - pos));
- esa->sorted[pos] = value;
- esa->rows ++;
- }
- } else {
- esa->rows += count;
- }
-}
-
-ESorterArray *
-e_sorter_array_construct (ESorterArray *esa,
- ECompareRowsFunc compare,
- gpointer closure)
-{
- esa->compare = compare;
- esa->closure = closure;
- return esa;
-}
-
-ESorterArray *
-e_sorter_array_new (ECompareRowsFunc compare, gpointer closure)
-{
- ESorterArray *esa = gtk_type_new (E_SORTER_ARRAY_TYPE);
-
- return e_sorter_array_construct (esa, compare, closure);
-}
-
-static void
-esa_destroy (GtkObject *object)
-{
- GTK_OBJECT_CLASS (parent_class)->destroy (object);
-}
-
-static void
-esa_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- switch (arg_id) {
- default:
- break;
- }
-}
-
-static void
-esa_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- switch (arg_id) {
- }
-}
-
-static void
-esa_class_init (ESorterArrayClass *klass)
-{
- GtkObjectClass *object_class = GTK_OBJECT_CLASS(klass);
- ESorterClass *sorter_class = E_SORTER_CLASS(klass);
-
- parent_class = gtk_type_class (PARENT_TYPE);
-
- object_class->destroy = esa_destroy;
- object_class->set_arg = esa_set_arg;
- object_class->get_arg = esa_get_arg;
-
- sorter_class->model_to_sorted = esa_model_to_sorted ;
- sorter_class->sorted_to_model = esa_sorted_to_model ;
- sorter_class->get_model_to_sorted_array = esa_get_model_to_sorted_array ;
- sorter_class->get_sorted_to_model_array = esa_get_sorted_to_model_array ;
- sorter_class->needs_sorting = esa_needs_sorting ;
-}
-
-static void
-esa_init (ESorterArray *esa)
-{
- esa->rows = 0;
- esa->compare = NULL;
- esa->closure = NULL;
- esa->sorted = NULL;
- esa->backsorted = NULL;
-}
-
-E_MAKE_TYPE(e_sorter_array, "ESorterArray", ESorterArray, esa_class_init, esa_init, PARENT_TYPE);
diff --git a/e-util/e-sorter-array.h b/e-util/e-sorter-array.h
deleted file mode 100644
index a80534c0e5..0000000000
--- a/e-util/e-sorter-array.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-sorter-array.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_SORTER_ARRAY_H_
-#define _E_SORTER_ARRAY_H_
-
-#include <gtk/gtkobject.h>
-#include <gal/util/e-sorter.h>
-#include <glib.h>
-#include <libgnome/gnome-defs.h>
-
-BEGIN_GNOME_DECLS
-
-#define E_SORTER_ARRAY_TYPE (e_sorter_array_get_type ())
-#define E_SORTER_ARRAY(o) (GTK_CHECK_CAST ((o), E_SORTER_ARRAY_TYPE, ESorterArray))
-#define E_SORTER_ARRAY_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_SORTER_ARRAY_TYPE, ESorterArrayClass))
-#define E_IS_SORTER_ARRAY(o) (GTK_CHECK_TYPE ((o), E_SORTER_ARRAY_TYPE))
-#define E_IS_SORTER_ARRAY_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_SORTER_ARRAY_TYPE))
-
-#ifndef _E_COMPARE_ROWS_FUNC_H_
-#define _E_COMPARE_ROWS_FUNC_H_
-typedef int (*ECompareRowsFunc) (int row1,
- int row2,
- gpointer closure);
-#endif
-
-typedef struct {
- ESorter base;
-
- ECompareRowsFunc compare;
- gpointer closure;
-
- /* If needs_sorting is 0, then model_to_sorted and sorted_to_model are no-ops. */
- int *sorted;
- int *backsorted;
-
- int rows;
-} ESorterArray;
-
-typedef struct {
- ESorterClass parent_class;
-} ESorterArrayClass;
-
-GtkType e_sorter_array_get_type (void);
-ESorterArray *e_sorter_array_construct (ESorterArray *sorter,
- ECompareRowsFunc compare,
- gpointer closure);
-ESorterArray *e_sorter_array_new (ECompareRowsFunc compare,
- gpointer closure);
-void e_sorter_array_clean (ESorterArray *esa);
-void e_sorter_array_set_count (ESorterArray *esa,
- int count);
-void e_sorter_array_append (ESorterArray *esa,
- int count);
-
-END_GNOME_DECLS
-
-#endif /* _E_SORTER_ARRAY_H_ */
diff --git a/e-util/e-sorter.c b/e-util/e-sorter.c
deleted file mode 100644
index 0617045b6f..0000000000
--- a/e-util/e-sorter.c
+++ /dev/null
@@ -1,156 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-sorter.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <stdlib.h>
-#include <gtk/gtksignal.h>
-#include <string.h>
-#include "gal/util/e-util.h"
-#include "e-sorter.h"
-
-#define d(x)
-
-#define PARENT_TYPE gtk_object_get_type()
-
-static GtkObjectClass *parent_class;
-
-#define ES_CLASS(es) ((ESorterClass *)((GtkObject *)(es))->klass)
-
-static gint es_model_to_sorted (ESorter *es, int row);
-static gint es_sorted_to_model (ESorter *es, int row);
-static void es_get_model_to_sorted_array (ESorter *es, int **array, int *count);
-static void es_get_sorted_to_model_array (ESorter *es, int **array, int *count);
-static gboolean es_needs_sorting(ESorter *es);
-
-static void
-es_class_init (ESorterClass *klass)
-{
- parent_class = gtk_type_class (PARENT_TYPE);
-
- klass->model_to_sorted = es_model_to_sorted;
- klass->sorted_to_model = es_sorted_to_model;
- klass->get_model_to_sorted_array = es_get_model_to_sorted_array;
- klass->get_sorted_to_model_array = es_get_sorted_to_model_array;
- klass->needs_sorting = es_needs_sorting;
-}
-
-static void
-es_init (ESorter *es)
-{
-}
-
-E_MAKE_TYPE(e_sorter, "ESorter", ESorter, es_class_init, es_init, PARENT_TYPE);
-
-ESorter *
-e_sorter_new (void)
-{
- ESorter *es = gtk_type_new (E_SORTER_TYPE);
-
- return es;
-}
-
-
-static gint
-es_model_to_sorted (ESorter *es, int row)
-{
- return row;
-}
-
-static gint
-es_sorted_to_model (ESorter *es, int row)
-{
- return row;
-}
-
-
-static void
-es_get_model_to_sorted_array (ESorter *es, int **array, int *count)
-{
-}
-
-static void
-es_get_sorted_to_model_array (ESorter *es, int **array, int *count)
-{
-}
-
-
-static gboolean
-es_needs_sorting(ESorter *es)
-{
- return FALSE;
-}
-
-gint
-e_sorter_model_to_sorted (ESorter *es, int row)
-{
- g_return_val_if_fail(es != NULL, -1);
- g_return_val_if_fail(row >= 0, -1);
-
- if (ES_CLASS(es)->model_to_sorted)
- return ES_CLASS(es)->model_to_sorted (es, row);
- else
- return -1;
-}
-
-gint
-e_sorter_sorted_to_model (ESorter *es, int row)
-{
- g_return_val_if_fail(es != NULL, -1);
- g_return_val_if_fail(row >= 0, -1);
-
- if (ES_CLASS(es)->sorted_to_model)
- return ES_CLASS(es)->sorted_to_model (es, row);
- else
- return -1;
-}
-
-
-void
-e_sorter_get_model_to_sorted_array (ESorter *es, int **array, int *count)
-{
- g_return_if_fail(es != NULL);
-
- if (ES_CLASS(es)->get_model_to_sorted_array)
- ES_CLASS(es)->get_model_to_sorted_array (es, array, count);
-}
-
-void
-e_sorter_get_sorted_to_model_array (ESorter *es, int **array, int *count)
-{
- g_return_if_fail(es != NULL);
-
- if (ES_CLASS(es)->get_sorted_to_model_array)
- ES_CLASS(es)->get_sorted_to_model_array (es, array, count);
-}
-
-
-gboolean
-e_sorter_needs_sorting(ESorter *es)
-{
- g_return_val_if_fail (es != NULL, FALSE);
-
- if (ES_CLASS(es)->needs_sorting)
- return ES_CLASS(es)->needs_sorting (es);
- else
- return FALSE;
-}
diff --git a/e-util/e-sorter.h b/e-util/e-sorter.h
deleted file mode 100644
index 5a89fa4c59..0000000000
--- a/e-util/e-sorter.h
+++ /dev/null
@@ -1,81 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-sorter.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_SORTER_H_
-#define _E_SORTER_H_
-
-#include <gtk/gtkobject.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#define E_SORTER_TYPE (e_sorter_get_type ())
-#define E_SORTER(o) (GTK_CHECK_CAST ((o), E_SORTER_TYPE, ESorter))
-#define E_SORTER_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_SORTER_TYPE, ESorterClass))
-#define E_IS_SORTER(o) (GTK_CHECK_TYPE ((o), E_SORTER_TYPE))
-#define E_IS_SORTER_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_SORTER_TYPE))
-
-typedef struct {
- GtkObject base;
-} ESorter;
-
-typedef struct {
- GtkObjectClass parent_class;
- gint (*model_to_sorted) (ESorter *sorter,
- int row);
- gint (*sorted_to_model) (ESorter *sorter,
- int row);
-
- void (*get_model_to_sorted_array) (ESorter *sorter,
- int **array,
- int *count);
- void (*get_sorted_to_model_array) (ESorter *sorter,
- int **array,
- int *count);
-
- gboolean (*needs_sorting) (ESorter *sorter);
-} ESorterClass;
-
-GtkType e_sorter_get_type (void);
-ESorter *e_sorter_new (void);
-
-gint e_sorter_model_to_sorted (ESorter *sorter,
- int row);
-gint e_sorter_sorted_to_model (ESorter *sorter,
- int row);
-
-void e_sorter_get_model_to_sorted_array (ESorter *sorter,
- int **array,
- int *count);
-void e_sorter_get_sorted_to_model_array (ESorter *sorter,
- int **array,
- int *count);
-
-gboolean e_sorter_needs_sorting (ESorter *sorter);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _E_SORTER_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 887cfd9e24..0000000000
--- a/e-util/e-text-event-processor-emacs-like.c
+++ /dev/null
@@ -1,508 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-text-event-processor-emacs-like.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <string.h>
-#include <gdk/gdkkeysyms.h>
-#include <gtk/gtksignal.h>
-#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_SELECTION, E_TEP_NOP, 0, "" }, /* w */
- { E_TEP_SELECTION, E_TEP_DELETE, 0, "" }, /* x */
- { E_TEP_SELECTION, E_TEP_PASTE, 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_CAPS, E_TEP_CAPS_TITLE, "" },/* 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_CAPS, E_TEP_CAPS_LOWER, "" }, /* 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_CAPS, E_TEP_CAPS_UPPER, "" }, /* 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_2BUTTON_PRESS:
- if (event->button.button == 1) {
- command.action = E_TEP_SELECT;
- command.position = E_TEP_SELECT_WORD;
- command.time = event->button.time;
- }
- break;
- case GDK_3BUTTON_PRESS:
- if (event->button.button == 1) {
- command.action = E_TEP_SELECT;
- command.position = E_TEP_SELECT_ALL;
- command.time = event->button.time;
- }
- break;
- case GDK_BUTTON_RELEASE:
- if (event->button.button == 1) {
- command.action = E_TEP_UNGRAB;
- 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:
- case GDK_KP_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:
- case GDK_KP_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:
- case GDK_KP_Page_Up: command.position = E_TEP_BACKWARD_PAGE; break;
-
- case GDK_Page_Down:
- case GDK_KP_Page_Down: command.position = E_TEP_FORWARD_PAGE; break;
- /* CUA has Ctrl-Up/Ctrl-Down as paragraph up down */
- case GDK_Up:
- case GDK_KP_Up: command.position = E_TEP_BACKWARD_LINE; break;
-
- case GDK_Down:
- case GDK_KP_Down: command.position = E_TEP_FORWARD_LINE; break;
-
- case GDK_Left:
- case GDK_KP_Left:
- if (key.state & GDK_CONTROL_MASK)
- command.position = E_TEP_BACKWARD_WORD;
- else
- command.position = E_TEP_BACKWARD_CHARACTER;
- break;
- case GDK_Right:
- case GDK_KP_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:
- case GDK_KP_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 -- FIXME */
- }
- break;
- case GDK_Delete:
- case GDK_KP_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:
- case GDK_KP_Tab:
- case GDK_ISO_Left_Tab:
- case GDK_3270_BackTab:
- /* Don't insert literally */
- command.action = E_TEP_NOP;
- command.position = E_TEP_SELECTION;
- break;
- case GDK_Return:
- case GDK_KP_Enter:
- if (tep->allow_newlines) {
- 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";
- }
- } else {
- if (key.state & GDK_CONTROL_MASK) {
- command.action = E_TEP_NOP;
- command.position = E_TEP_SELECTION;
- } else {
- command.action = E_TEP_ACTIVATE;
- command.position = E_TEP_SELECTION;
- }
- }
- break;
- case GDK_Escape:
- /* Don't insert literally */
- command.action = E_TEP_NOP;
- command.position = E_TEP_SELECTION;
- break;
-
- case GDK_KP_Space:
- command.action = E_TEP_INSERT;
- command.position = E_TEP_SELECTION;
- command.value = 1;
- command.string = " ";
- break;
- case GDK_KP_Equal:
- command.action = E_TEP_INSERT;
- command.position = E_TEP_SELECTION;
- command.value = 1;
- command.string = "=";
- break;
- case GDK_KP_Multiply:
- command.action = E_TEP_INSERT;
- command.position = E_TEP_SELECTION;
- command.value = 1;
- command.string = "*";
- break;
- case GDK_KP_Add:
- command.action = E_TEP_INSERT;
- command.position = E_TEP_SELECTION;
- command.value = 1;
- command.string = "+";
- break;
- case GDK_KP_Subtract:
- command.action = E_TEP_INSERT;
- command.position = E_TEP_SELECTION;
- command.value = 1;
- command.string = "-";
- break;
- case GDK_KP_Decimal:
- command.action = E_TEP_INSERT;
- command.position = E_TEP_SELECTION;
- command.value = 1;
- command.string = ".";
- break;
- case GDK_KP_Divide:
- command.action = E_TEP_INSERT;
- command.position = E_TEP_SELECTION;
- command.value = 1;
- command.string = "/";
- break;
- case GDK_KP_0:
- command.action = E_TEP_INSERT;
- command.position = E_TEP_SELECTION;
- command.value = 1;
- command.string = "0";
- break;
- case GDK_KP_1:
- command.action = E_TEP_INSERT;
- command.position = E_TEP_SELECTION;
- command.value = 1;
- command.string = "1";
- break;
- case GDK_KP_2:
- command.action = E_TEP_INSERT;
- command.position = E_TEP_SELECTION;
- command.value = 1;
- command.string = "2";
- break;
- case GDK_KP_3:
- command.action = E_TEP_INSERT;
- command.position = E_TEP_SELECTION;
- command.value = 1;
- command.string = "3";
- break;
- case GDK_KP_4:
- command.action = E_TEP_INSERT;
- command.position = E_TEP_SELECTION;
- command.value = 1;
- command.string = "4";
- break;
- case GDK_KP_5:
- command.action = E_TEP_INSERT;
- command.position = E_TEP_SELECTION;
- command.value = 1;
- command.string = "5";
- break;
- case GDK_KP_6:
- command.action = E_TEP_INSERT;
- command.position = E_TEP_SELECTION;
- command.value = 1;
- command.string = "6";
- break;
- case GDK_KP_7:
- command.action = E_TEP_INSERT;
- command.position = E_TEP_SELECTION;
- command.value = 1;
- command.string = "7";
- break;
- case GDK_KP_8:
- command.action = E_TEP_INSERT;
- command.position = E_TEP_SELECTION;
- command.value = 1;
- command.string = "8";
- break;
- case GDK_KP_9:
- command.action = E_TEP_INSERT;
- command.position = E_TEP_SELECTION;
- command.value = 1;
- command.string = "9";
- break;
-
- default:
- if ((key.state & GDK_CONTROL_MASK) && !(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 = 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) && !(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 = 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.state & GDK_MOD1_MASK) && !(key.state & GDK_CONTROL_MASK) && key.length > 0) {
- if (key.keyval >= GDK_KP_0 && key.keyval <= GDK_KP_9) {
- key.keyval = '0';
- key.string = "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 58a92168a8..0000000000
--- a/e-util/e-text-event-processor-emacs-like.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-text-event-processor-emacs-like.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef __E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_H__
-#define __E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_H__
-
-#include <gal/util/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 */
- guint mouse_down : 1;
-};
-
-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 0881438cec..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-types.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef __E_TEXT_EVENT_PROCESSOR_TYPES_H__
-#define __E_TEXT_EVENT_PROCESSOR_TYPES_H__
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-#include <gdk/gdktypes.h>
-
-typedef union _ETextEventProcessorEvent ETextEventProcessorEvent;
-
-typedef enum {
- 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,
-
- E_TEP_SELECT_WORD,
- E_TEP_SELECT_ALL
-
-} ETextEventProcessorCommandPosition;
-
-typedef enum {
- E_TEP_MOVE,
- E_TEP_SELECT,
- E_TEP_DELETE,
- E_TEP_INSERT,
-
- E_TEP_CAPS,
-
- 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
-} ETextEventProcessorCommandAction;
-
-typedef struct {
- ETextEventProcessorCommandPosition position;
- ETextEventProcessorCommandAction action;
- int value;
- char *string;
- guint32 time;
-} ETextEventProcessorCommand;
-
-typedef struct {
- GdkEventType type;
- guint32 time;
- guint state;
- guint button;
- gint position;
-} ETextEventProcessorEventButton;
-
-typedef struct {
- GdkEventType type;
- guint32 time;
- guint state;
- guint keyval;
- gint length;
- gchar *string;
-} ETextEventProcessorEventKey;
-
-typedef struct {
- GdkEventType type;
- guint32 time;
- guint state;
- gint position;
-} ETextEventProcessorEventMotion;
-
-union _ETextEventProcessorEvent {
- GdkEventType type;
- ETextEventProcessorEventButton button;
- ETextEventProcessorEventKey key;
- ETextEventProcessorEventMotion motion;
-};
-
-typedef enum _ETextEventProcessorCaps {
- E_TEP_CAPS_UPPER,
- E_TEP_CAPS_LOWER,
- E_TEP_CAPS_TITLE
-} ETextEventProcessorCaps;
-
-#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 8ef98c5447..0000000000
--- a/e-util/e-text-event-processor.c
+++ /dev/null
@@ -1,149 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-text-event-processor.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include "e-text-event-processor.h"
-#include <gal/util/e-util.h>
-#include <gtk/gtksignal.h>
-
-static void e_text_event_processor_init (ETextEventProcessor *card);
-static void e_text_event_processor_class_init (ETextEventProcessorClass *klass);
-
-static void e_text_event_processor_set_arg (GtkObject *object, GtkArg *arg, guint arg_id);
-static void e_text_event_processor_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
-
-static GtkObjectClass *parent_class = NULL;
-
-/* The arguments we take */
-enum {
- ARG_0,
- ARG_ALLOW_NEWLINES,
-};
-
-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,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETextEventProcessorClass, command),
- gtk_marshal_NONE__POINTER,
- GTK_TYPE_NONE, 1,
- GTK_TYPE_POINTER);
-
- E_OBJECT_CLASS_ADD_SIGNALS (object_class, e_tep_signals, E_TEP_LAST_SIGNAL);
-
- gtk_object_add_arg_type ("ETextEventProcessor::allow_newlines", GTK_TYPE_BOOL,
- GTK_ARG_READWRITE, ARG_ALLOW_NEWLINES);
-
- klass->event = NULL;
- klass->command = NULL;
-
- object_class->set_arg = e_text_event_processor_set_arg;
- object_class->get_arg = e_text_event_processor_get_arg;
-}
-
-static void
-e_text_event_processor_init (ETextEventProcessor *tep)
-{
- tep->allow_newlines = TRUE;
-}
-
-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;
- }
-}
-
-/* Set_arg handler for the text item */
-static void
-e_text_event_processor_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- ETextEventProcessor *tep = E_TEXT_EVENT_PROCESSOR (object);
-
- switch (arg_id) {
- case ARG_ALLOW_NEWLINES:
- tep->allow_newlines = GTK_VALUE_BOOL (*arg);
- break;
- default:
- return;
- }
-}
-
-/* Get_arg handler for the text item */
-static void
-e_text_event_processor_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- ETextEventProcessor *tep = E_TEXT_EVENT_PROCESSOR (object);
-
- switch (arg_id) {
- case ARG_ALLOW_NEWLINES:
- GTK_VALUE_BOOL (*arg) = tep->allow_newlines;
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
diff --git a/e-util/e-text-event-processor.h b/e-util/e-text-event-processor.h
deleted file mode 100644
index 2f9bd590dc..0000000000
--- a/e-util/e-text-event-processor.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-text-event-processor.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef __E_TEXT_EVENT_PROCESSOR_H__
-#define __E_TEXT_EVENT_PROCESSOR_H__
-
-#include <glib.h>
-#include <gtk/gtkobject.h>
-#include <gal/util/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 */
- guint allow_newlines : 1;
-};
-
-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 5d8e9b19db..0000000000
--- a/e-util/e-util.c
+++ /dev/null
@@ -1,1620 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-util.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include "e-util.h"
-
-#include <glib.h>
-#include <gtk/gtkobject.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <ctype.h>
-#include <sys/stat.h>
-#include <string.h>
-#include <locale.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-
-#if 0
-#include <libgnomevfs/gnome-vfs.h>
-#endif
-
-int
-g_str_compare(const void *x, const void *y)
-{
- if (x == NULL || y == NULL) {
- if (x == y)
- return 0;
- else
- return x ? -1 : 1;
- }
-
- 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;
-}
-
-char *
-e_strdup_strip(const char *string)
-{
- int i;
- int length = 0;
- int initial = 0;
- for ( i = 0; string[i]; i++ ) {
- if (initial == i && isspace((unsigned char) string[i])) {
- initial ++;
- }
- if (!isspace((unsigned char) string[i])) {
- length = i - initial + 1;
- }
- }
- return g_strndup(string + initial, length);
-}
-
-void
-e_free_object_list (GList *list)
-{
- GList *p;
-
- for (p = list; p != NULL; p = p->next)
- gtk_object_unref (GTK_OBJECT (p->data));
-
- g_list_free (list);
-}
-
-void
-e_free_object_slist (GSList *list)
-{
- GSList *p;
-
- for (p = list; p != NULL; p = p->next)
- gtk_object_unref (GTK_OBJECT (p->data));
-
- g_slist_free (list);
-}
-
-void
-e_free_string_list (GList *list)
-{
- GList *p;
-
- for (p = list; p != NULL; p = p->next)
- g_free (p->data);
-
- g_list_free (list);
-}
-
-void
-e_free_string_slist (GSList *list)
-{
- GSList *p;
-
- for (p = list; p != NULL; p = p->next)
- g_free (p->data);
- g_slist_free (list);
-}
-
-#define BUFF_SIZE 1024
-
-char *
-e_read_file(const char *filename)
-{
- int fd;
- char buffer[BUFF_SIZE];
- GList *list = NULL, *list_iterator;
- GList *lengths = NULL, *lengths_iterator;
- int length = 0;
- int bytes;
- char *ret_val;
-
- fd = open(filename, O_RDONLY);
- if (fd == -1)
- return NULL;
- bytes = read(fd, buffer, BUFF_SIZE);
- while (bytes) {
- if (bytes > 0) {
- char *temp = g_malloc(bytes);
- memcpy (temp, buffer, bytes);
- list = g_list_prepend(list, temp);
- lengths = g_list_prepend(lengths, GINT_TO_POINTER(bytes));
- length += bytes;
- } else {
- if (errno != EINTR) {
- close(fd);
- g_list_foreach(list, (GFunc) g_free, NULL);
- g_list_free(list);
- g_list_free(lengths);
- return NULL;
- }
- }
- bytes = read(fd, buffer, BUFF_SIZE);
- }
- ret_val = g_new(char, length + 1);
- ret_val[length] = 0;
- lengths_iterator = lengths;
- list_iterator = list;
- for ( ; list_iterator; list_iterator = list_iterator->next, lengths_iterator = lengths_iterator->next) {
- int this_length = GPOINTER_TO_INT(lengths_iterator->data);
- length -= this_length;
- memcpy(ret_val + length, list_iterator->data, this_length);
- }
- close(fd);
- g_list_foreach(list, (GFunc) g_free, NULL);
- g_list_free(list);
- g_list_free(lengths);
- return ret_val;
-}
-
-gint
-e_write_file(const char *filename, const char *data, int flags)
-{
- int fd;
- int length = strlen(data);
- int bytes;
- fd = open(filename, flags, 0666);
- if (fd == -1)
- return errno;
- while (length > 0) {
- bytes = write(fd, data, length);
- if (bytes > 0) {
- length -= bytes;
- data += bytes;
- } else {
- if (errno != EINTR && errno != EAGAIN) {
- int save_errno = errno;
- close(fd);
- return save_errno;
- }
- }
- }
- if (close(fd) != 0) {
- return errno;
- }
- return 0;
-}
-
-gint
-e_write_file_mkstemp(char *filename, const char *data)
-{
- int fd;
- int length = strlen(data);
- int bytes;
- fd = mkstemp (filename);
- if (fd == -1)
- return errno;
- while (length > 0) {
- bytes = write(fd, data, length);
- if (bytes > 0) {
- length -= bytes;
- data += bytes;
- } else {
- if (errno != EINTR && errno != EAGAIN) {
- int save_errno = errno;
- close(fd);
- return save_errno;
- }
- }
- }
- if (close(fd) != 0) {
- return errno;
- }
- return 0;
-}
-
-/**
- * e_mkdir_hier:
- * @path: a directory path
- * @mode: a mode, as for mkdir(2)
- *
- * This creates the named directory with the given @mode, creating
- * any necessary intermediate directories (with the same @mode).
- *
- * Return value: 0 on success, -1 on error, in which case errno will
- * be set as for mkdir(2).
- **/
-int
-e_mkdir_hier(const char *path, mode_t mode)
-{
- char *copy, *p;
-
- p = copy = g_strdup (path);
- do {
- p = strchr (p + 1, '/');
- if (p)
- *p = '\0';
- if (access (copy, F_OK) == -1) {
- if (mkdir (copy, mode) == -1) {
- g_free (copy);
- return -1;
- }
- }
- if (p)
- *p = '/';
- } while (p);
-
- g_free (copy);
- return 0;
-}
-
-#if 0
-char *
-e_read_uri(const char *uri)
-{
- GnomeVFSHandle *handle;
- GList *list = NULL, *list_iterator;
- GList *lengths = NULL, *lengths_iterator;
- gchar buffer[1025];
- gchar *ret_val;
- int length = 0;
- GnomeVFSFileSize bytes;
-
- gnome_vfs_open(&handle, uri, GNOME_VFS_OPEN_READ);
-
- gnome_vfs_read(handle, buffer, 1024, &bytes);
- while (bytes) {
- if (bytes) {
- char *temp = g_malloc(bytes);
- memcpy (temp, buffer, bytes);
- list = g_list_prepend(list, temp);
- lengths = g_list_prepend(lengths, GINT_TO_POINTER((gint) bytes));
- length += bytes;
- }
- gnome_vfs_read(handle, buffer, 1024, &bytes);
- }
-
- ret_val = g_new(char, length + 1);
- ret_val[length] = 0;
- lengths_iterator = lengths;
- list_iterator = list;
- for ( ; list_iterator; list_iterator = list_iterator->next, lengths_iterator = lengths_iterator->next) {
- int this_length = GPOINTER_TO_INT(lengths_iterator->data);
- length -= this_length;
- memcpy(ret_val + length, list_iterator->data, this_length);
- }
- gnome_vfs_close(handle);
- g_list_foreach(list, (GFunc) g_free, NULL);
- g_list_free(list);
- g_list_free(lengths);
- return ret_val;
-}
-#endif
-
-typedef gint (*GtkSignal_INT__INT_INT_POINTER) (GtkObject * object,
- gint arg1,
- gint arg2,
- gpointer arg3,
- gpointer user_data);
-
-void
-e_marshal_INT__INT_INT_POINTER (GtkObject * object,
- GtkSignalFunc func,
- gpointer func_data, GtkArg * args)
-{
- GtkSignal_INT__INT_INT_POINTER rfunc;
- gint *return_val;
- return_val = GTK_RETLOC_INT (args[3]);
- rfunc = (GtkSignal_INT__INT_INT_POINTER) func;
- *return_val = (*rfunc) (object,
- GTK_VALUE_INT (args[0]),
- GTK_VALUE_INT (args[1]),
- GTK_VALUE_POINTER (args[2]),
- func_data);
-}
-
-typedef gint (*GtkSignal_INT__INT_POINTER_INT_POINTER) (GtkObject * object,
- gint arg1,
- gpointer arg2,
- gint arg3,
- gpointer arg4,
- gpointer user_data);
-
-void
-e_marshal_INT__INT_POINTER_INT_POINTER (GtkObject * object,
- GtkSignalFunc func,
- gpointer func_data, GtkArg * args)
-{
- GtkSignal_INT__INT_POINTER_INT_POINTER rfunc;
- gint *return_val;
- return_val = GTK_RETLOC_INT (args[4]);
- rfunc = (GtkSignal_INT__INT_POINTER_INT_POINTER) func;
- *return_val = (*rfunc) (object,
- GTK_VALUE_INT (args[0]),
- GTK_VALUE_POINTER (args[1]),
- GTK_VALUE_INT (args[2]),
- GTK_VALUE_POINTER (args[3]),
- func_data);
-}
-
-typedef void (*GtkSignal_NONE__OBJECT_DOUBLE_DOUBLE_BOOL) (GtkObject * object,
- GtkObject *arg1,
- gdouble arg2,
- gdouble arg3,
- gboolean arg4,
- gpointer user_data);
-
-void
-e_marshal_NONE__OBJECT_DOUBLE_DOUBLE_BOOL (GtkObject * object,
- GtkSignalFunc func,
- gpointer func_data, GtkArg * args)
-{
- GtkSignal_NONE__OBJECT_DOUBLE_DOUBLE_BOOL rfunc;
- rfunc = (GtkSignal_NONE__OBJECT_DOUBLE_DOUBLE_BOOL) func;
- (*rfunc) (object,
- GTK_VALUE_OBJECT (args[0]),
- GTK_VALUE_DOUBLE (args[1]),
- GTK_VALUE_DOUBLE (args[2]),
- GTK_VALUE_BOOL (args[3]),
- func_data);
-}
-
-typedef gdouble (*GtkSignal_DOUBLE__OBJECT_DOUBLE_DOUBLE_BOOL) (GtkObject * object,
- GtkObject *arg1,
- gdouble arg2,
- gdouble arg3,
- gboolean arg4,
- gpointer user_data);
-
-void
-e_marshal_DOUBLE__OBJECT_DOUBLE_DOUBLE_BOOL (GtkObject * object,
- GtkSignalFunc func,
- gpointer func_data, GtkArg * args)
-{
- GtkSignal_DOUBLE__OBJECT_DOUBLE_DOUBLE_BOOL rfunc;
- gdouble *return_val;
- return_val = GTK_RETLOC_DOUBLE (args[4]);
- rfunc = (GtkSignal_DOUBLE__OBJECT_DOUBLE_DOUBLE_BOOL) func;
- *return_val = (*rfunc) (object,
- GTK_VALUE_OBJECT (args[0]),
- GTK_VALUE_DOUBLE (args[1]),
- GTK_VALUE_DOUBLE (args[2]),
- GTK_VALUE_BOOL (args[3]),
- func_data);
-}
-
-typedef gdouble (*GtkSignal_BOOL__OBJECT_DOUBLE_DOUBLE_BOOL) (GtkObject * object,
- GtkObject *arg1,
- gdouble arg2,
- gdouble arg3,
- gboolean arg4,
- gpointer user_data);
-
-void
-e_marshal_BOOL__OBJECT_DOUBLE_DOUBLE_BOOL (GtkObject * object,
- GtkSignalFunc func,
- gpointer func_data, GtkArg * args)
-{
- GtkSignal_BOOL__OBJECT_DOUBLE_DOUBLE_BOOL rfunc;
- gboolean *return_val;
- return_val = GTK_RETLOC_BOOL (args[4]);
- rfunc = (GtkSignal_BOOL__OBJECT_DOUBLE_DOUBLE_BOOL) func;
- *return_val = (*rfunc) (object,
- GTK_VALUE_OBJECT (args[0]),
- GTK_VALUE_DOUBLE (args[1]),
- GTK_VALUE_DOUBLE (args[2]),
- GTK_VALUE_BOOL (args[3]),
- func_data);
-}
-
-typedef void (*GtkSignal_NONE__INT_INT_POINTER_POINTER_INT_INT) (GtkObject * object,
- gint arg1,
- gint arg2,
- gpointer arg3,
- gpointer arg4,
- gint arg5,
- gint arg6,
- gpointer user_data);
-void
-e_marshal_NONE__INT_INT_POINTER_POINTER_INT_INT (GtkObject * object,
- GtkSignalFunc func,
- gpointer func_data, GtkArg * args)
-{
- GtkSignal_NONE__INT_INT_POINTER_POINTER_INT_INT rfunc;
- rfunc = (GtkSignal_NONE__INT_INT_POINTER_POINTER_INT_INT) func;
- (*rfunc) (object,
- GTK_VALUE_INT (args[0]), GTK_VALUE_INT (args[1]),
- GTK_VALUE_POINTER (args[2]),
- GTK_VALUE_POINTER (args[3]),
- GTK_VALUE_INT (args[4]), GTK_VALUE_INT (args[5]), func_data);
-}
-
-typedef void (*GtkSignal_NONE__INT_POINTER_INT_POINTER_POINTER_INT_INT) (GtkObject * object,
- gint arg1,
- gpointer arg2,
- gint arg3,
- gpointer arg4,
- gpointer arg5,
- gint arg6,
- gint arg7,
- gpointer user_data);
-void
-e_marshal_NONE__INT_POINTER_INT_POINTER_POINTER_INT_INT (GtkObject * object,
- GtkSignalFunc func,
- gpointer func_data, GtkArg * args)
-{
- GtkSignal_NONE__INT_POINTER_INT_POINTER_POINTER_INT_INT rfunc;
- rfunc = (GtkSignal_NONE__INT_POINTER_INT_POINTER_POINTER_INT_INT) func;
- (*rfunc) (object,
- GTK_VALUE_INT (args[0]), GTK_VALUE_POINTER (args[1]), GTK_VALUE_INT (args[2]),
- GTK_VALUE_POINTER (args[3]),
- GTK_VALUE_POINTER (args[4]),
- GTK_VALUE_INT (args[5]), GTK_VALUE_INT (args[6]), func_data);
-}
-
-typedef void (*GtkSignal_NONE__INT_INT_POINTER_INT) (GtkObject * object,
- gint arg1,
- gint arg2,
- gpointer arg3,
- gint arg4, gpointer user_data);
-void
-e_marshal_NONE__INT_INT_POINTER_INT (GtkObject * object,
- GtkSignalFunc func,
- gpointer func_data, GtkArg * args)
-{
- GtkSignal_NONE__INT_INT_POINTER_INT rfunc;
- rfunc = (GtkSignal_NONE__INT_INT_POINTER_INT) func;
- (*rfunc) (object,
- GTK_VALUE_INT (args[0]), GTK_VALUE_INT (args[1]),
- GTK_VALUE_POINTER (args[2]), GTK_VALUE_INT (args[3]), func_data);
-}
-
-typedef void (*GtkSignal_NONE__INT_POINTER_INT_POINTER_INT) (GtkObject * object,
- gint arg1,
- gpointer arg2,
- gint arg3,
- gpointer arg4,
- gint arg5, gpointer user_data);
-void
-e_marshal_NONE__INT_POINTER_INT_POINTER_INT (GtkObject * object,
- GtkSignalFunc func,
- gpointer func_data, GtkArg * args)
-{
- GtkSignal_NONE__INT_POINTER_INT_POINTER_INT rfunc;
- rfunc = (GtkSignal_NONE__INT_POINTER_INT_POINTER_INT) func;
- (*rfunc) (object,
- GTK_VALUE_INT (args[0]), GTK_VALUE_POINTER (args[1]), GTK_VALUE_INT (args[2]),
- GTK_VALUE_POINTER (args[3]), GTK_VALUE_INT (args[4]), func_data);
-}
-
-typedef gboolean (*GtkSignal_BOOL__INT_INT_POINTER_INT_INT_INT) (GtkObject * object,
- gint arg1,
- gint arg2,
- gpointer arg3,
- gint arg4,
- gint arg5,
- gint arg6,
- gpointer user_data);
-void
-e_marshal_BOOL__INT_INT_POINTER_INT_INT_INT (GtkObject * object,
- GtkSignalFunc func,
- gpointer func_data, GtkArg * args)
-{
- GtkSignal_BOOL__INT_INT_POINTER_INT_INT_INT rfunc;
- gboolean *return_val;
- return_val = GTK_RETLOC_BOOL (args[6]);
- rfunc = (GtkSignal_BOOL__INT_INT_POINTER_INT_INT_INT) func;
- *return_val = (*rfunc) (object,
- GTK_VALUE_INT (args[0]),
- GTK_VALUE_INT (args[1]),
- GTK_VALUE_POINTER (args[2]),
- GTK_VALUE_INT (args[3]),
- GTK_VALUE_INT (args[4]),
- GTK_VALUE_INT (args[5]), func_data);
-}
-
-typedef gboolean (*GtkSignal_BOOL__INT_POINTER_INT_POINTER_INT_INT_INT) (GtkObject * object,
- gint arg1,
- gpointer arg2,
- gint arg3,
- gpointer arg4,
- gint arg5,
- gint arg6,
- gint arg7,
- gpointer user_data);
-void
-e_marshal_BOOL__INT_POINTER_INT_POINTER_INT_INT_INT (GtkObject * object,
- GtkSignalFunc func,
- gpointer func_data, GtkArg * args)
-{
- GtkSignal_BOOL__INT_POINTER_INT_POINTER_INT_INT_INT rfunc;
- gboolean *return_val;
- return_val = GTK_RETLOC_BOOL (args[7]);
- rfunc = (GtkSignal_BOOL__INT_POINTER_INT_POINTER_INT_INT_INT) func;
- *return_val = (*rfunc) (object,
- GTK_VALUE_INT (args[0]),
- GTK_VALUE_POINTER (args[1]),
- GTK_VALUE_INT (args[2]),
- GTK_VALUE_POINTER (args[3]),
- GTK_VALUE_INT (args[4]),
- GTK_VALUE_INT (args[5]),
- GTK_VALUE_INT (args[6]), func_data);
-}
-
-typedef void (*GtkSignal_NONE__INT_INT_POINTER_INT_INT_POINTER_INT_INT) (GtkObject *
- object,
- gint arg1,
- gint arg2,
- gpointer
- arg3,
- gint arg4,
- gint arg5,
- gpointer
- arg6,
- gint arg7,
- gint arg8,
- gpointer
- user_data);
-
-void
-e_marshal_NONE__INT_INT_POINTER_INT_INT_POINTER_INT_INT (GtkObject * object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg * args)
-{
- GtkSignal_NONE__INT_INT_POINTER_INT_INT_POINTER_INT_INT rfunc;
- rfunc = (GtkSignal_NONE__INT_INT_POINTER_INT_INT_POINTER_INT_INT) func;
- (*rfunc) (object,
- GTK_VALUE_INT (args[0]), GTK_VALUE_INT (args[1]),
- GTK_VALUE_POINTER (args[2]),
- GTK_VALUE_INT (args[3]),
- GTK_VALUE_INT (args[4]),
- GTK_VALUE_POINTER (args[5]),
- GTK_VALUE_INT (args[6]), GTK_VALUE_INT (args[7]), func_data);
-}
-
-typedef void (*GtkSignal_NONE__INT_POINTER_INT_POINTER_INT_INT_POINTER_INT_INT) (GtkObject *
- object,
- gint arg1,
- gpointer arg2,
- gint arg3,
- gpointer arg4,
- gint arg5,
- gint arg6,
- gpointer arg7,
- gint arg8,
- gint arg9,
- gpointer user_data);
-
-void
-e_marshal_NONE__INT_POINTER_INT_POINTER_INT_INT_POINTER_INT_INT (GtkObject * object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg * args)
-{
- GtkSignal_NONE__INT_POINTER_INT_POINTER_INT_INT_POINTER_INT_INT rfunc;
- rfunc = (GtkSignal_NONE__INT_POINTER_INT_POINTER_INT_INT_POINTER_INT_INT) func;
- (*rfunc) (object,
- GTK_VALUE_INT (args[0]),
- GTK_VALUE_POINTER (args[1]),
- GTK_VALUE_INT (args[2]),
- GTK_VALUE_POINTER (args[3]),
- GTK_VALUE_INT (args[4]),
- GTK_VALUE_INT (args[5]),
- GTK_VALUE_POINTER (args[6]),
- GTK_VALUE_INT (args[7]), GTK_VALUE_INT (args[8]), func_data);
-}
-
-typedef void (*GtkSignal_NONE__POINTER_POINTER_INT) (GtkObject *, gpointer,
- gpointer, gint, gpointer);
-
-void
-e_marshal_NONE__POINTER_POINTER_INT (GtkObject * object, GtkSignalFunc func,
- gpointer func_data, GtkArg * args)
-{
- GtkSignal_NONE__POINTER_POINTER_INT rfunc;
- rfunc = (GtkSignal_NONE__POINTER_POINTER_INT) func;
- (*rfunc) (object, GTK_VALUE_POINTER (args[0]), GTK_VALUE_POINTER (args[1]),
- GTK_VALUE_INT (args[2]), func_data);
-}
-
-typedef void (*GtkSignal_NONE__INT_POINTER_INT_POINTER) (GtkObject *, gint, gpointer,
- gint, gpointer, gpointer);
-
-void
-e_marshal_NONE__INT_POINTER_INT_POINTER (GtkObject * object, GtkSignalFunc func,
- gpointer func_data, GtkArg * args)
-{
- GtkSignal_NONE__INT_POINTER_INT_POINTER rfunc;
- rfunc = (GtkSignal_NONE__INT_POINTER_INT_POINTER) func;
- (*rfunc) (object, GTK_VALUE_INT (args[0]), GTK_VALUE_POINTER (args[1]),
- GTK_VALUE_INT (args[2]), GTK_VALUE_POINTER (args[3]), func_data);
-}
-
-typedef void (*GtkSignal_NONE__POINTER_POINTER_POINTER_POINTER) (GtkObject *,
- gpointer, gpointer, gpointer, gpointer,
- gpointer);
-
-void
-e_marshal_NONE__POINTER_POINTER_POINTER_POINTER (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args)
-{
- GtkSignal_NONE__POINTER_POINTER_POINTER_POINTER rfunc;
- rfunc = (GtkSignal_NONE__POINTER_POINTER_POINTER_POINTER) func;
- (*rfunc) (object, GTK_VALUE_POINTER (args[0]), GTK_VALUE_POINTER (args[1]),
- GTK_VALUE_POINTER (args[2]), GTK_VALUE_POINTER (args[3]), func_data);
-}
-
-typedef int (*GtkSignal_INT__POINTER_POINTER) (GtkObject *,
- gpointer, gpointer,
- gpointer user_data);
-void
-e_marshal_INT__POINTER_POINTER (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args)
-{
- GtkSignal_INT__POINTER_POINTER rfunc;
- int *return_val;
-
- rfunc = (GtkSignal_INT__POINTER_POINTER) func;
- return_val = GTK_RETLOC_INT (args[2]);
-
- *return_val = (*rfunc) (object,
- GTK_VALUE_POINTER (args[0]),
- GTK_VALUE_POINTER (args[1]),
- func_data);
-}
-
-typedef int (*GtkSignal_INT__POINTER_POINTER_POINTER) (GtkObject *,
- gpointer, gpointer, gpointer,
- gpointer user_data);
-void
-e_marshal_INT__POINTER_POINTER_POINTER (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args)
-{
- GtkSignal_INT__POINTER_POINTER_POINTER rfunc;
- int *return_val;
-
- rfunc = (GtkSignal_INT__POINTER_POINTER_POINTER) func;
- return_val = GTK_RETLOC_INT (args[3]);
-
- *return_val = (*rfunc) (object,
- GTK_VALUE_POINTER (args[0]),
- GTK_VALUE_POINTER (args[1]),
- GTK_VALUE_POINTER (args[2]),
- func_data);
-}
-
-typedef int (*GtkSignal_INT__POINTER_POINTER_POINTER_POINTER) (GtkObject *,
- gpointer, gpointer, gpointer, gpointer,
- gpointer user_data);
-void
-e_marshal_INT__POINTER_POINTER_POINTER_POINTER (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args)
-{
- GtkSignal_INT__POINTER_POINTER_POINTER_POINTER rfunc;
- int *return_val;
-
- rfunc = (GtkSignal_INT__POINTER_POINTER_POINTER_POINTER) func;
- return_val = GTK_RETLOC_INT (args[4]);
-
- *return_val = (*rfunc) (object,
- GTK_VALUE_POINTER (args[0]),
- GTK_VALUE_POINTER (args[1]),
- GTK_VALUE_POINTER (args[2]),
- GTK_VALUE_POINTER (args[3]),
- func_data);
-}
-
-
-typedef int (*GtkSignal_INT__POINTER_POINTER_POINTER_POINTER_POINTER) (GtkObject *,
- gpointer, gpointer, gpointer, gpointer, gpointer,
- gpointer user_data);
-void
-e_marshal_INT__POINTER_POINTER_POINTER_POINTER_POINTER (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args)
-{
- GtkSignal_INT__POINTER_POINTER_POINTER_POINTER_POINTER rfunc;
- int *return_val;
-
- rfunc = (GtkSignal_INT__POINTER_POINTER_POINTER_POINTER_POINTER) func;
- return_val = GTK_RETLOC_INT (args[4]);
-
- *return_val = (*rfunc) (object,
- GTK_VALUE_POINTER (args[0]),
- GTK_VALUE_POINTER (args[1]),
- GTK_VALUE_POINTER (args[2]),
- GTK_VALUE_POINTER (args[3]),
- GTK_VALUE_POINTER (args[4]),
- func_data);
-}
-
-typedef void (*GtkSignal_NONE__POINTER_POINTER_POINTER_BOOL) (GtkObject *,
- gpointer, gpointer, gpointer, gboolean,
- gpointer user_data);
-
-void
-e_marshal_NONE__POINTER_POINTER_POINTER_BOOL (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args)
-{
- GtkSignal_NONE__POINTER_POINTER_POINTER_BOOL rfunc;
-
- rfunc = (GtkSignal_NONE__POINTER_POINTER_POINTER_BOOL) func;
-
- (*rfunc) (object,
- GTK_VALUE_POINTER (args[0]),
- GTK_VALUE_POINTER (args[1]),
- GTK_VALUE_POINTER (args[2]),
- GTK_VALUE_BOOL (args[3]),
- func_data);
-}
-
-void
-e_marshal_NONE__POINTER_INT_INT_INT (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args)
-{
- (* (void (*)(GtkObject *, gpointer, int, int, int, gpointer)) func)
- (object,
- GTK_VALUE_POINTER (args[0]),
- GTK_VALUE_INT (args[1]),
- GTK_VALUE_INT (args[2]),
-
- GTK_VALUE_INT (args[3]),
- func_data);
-}
-
-typedef int (*GtkSignal_INT__OBJECT_POINTER) (GtkObject *,
- GtkObject *, gpointer,
- gpointer user_data);
-void
-e_marshal_INT__OBJECT_POINTER (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args)
-{
- GtkSignal_INT__OBJECT_POINTER rfunc;
- int *return_val;
-
- rfunc = (GtkSignal_INT__OBJECT_POINTER) func;
- return_val = GTK_RETLOC_INT (args[2]);
-
- *return_val = (*rfunc) (object,
- GTK_VALUE_OBJECT (args[0]),
- GTK_VALUE_POINTER (args[1]),
- func_data);
-}
-
-typedef void (*GtkSignal_NONE__DOUBLE) (GtkObject *,
- gdouble,
- gpointer user_data);
-void
-e_marshal_NONE__DOUBLE (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args)
-{
- GtkSignal_NONE__DOUBLE rfunc;
-
- rfunc = (GtkSignal_NONE__DOUBLE) func;
-
- (*rfunc) (object,
- GTK_VALUE_DOUBLE (args[0]),
- func_data);
-}
-
-typedef gboolean (*GtkSignal_BOOL__STRING_INT) (GtkObject *,
- char *,
- gint,
- gpointer user_data);
-
-void
-e_marshal_BOOL__STRING_INT (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args)
-{
- GtkSignal_BOOL__STRING_INT rfunc;
- gboolean *return_val;
-
- rfunc = (GtkSignal_BOOL__STRING_INT) func;
- return_val = GTK_RETLOC_BOOL (args[2]);
-
- *return_val = (*rfunc) (object,
- GTK_VALUE_STRING (args[0]),
- GTK_VALUE_INT (args[1]),
- func_data);
-}
-
-gchar**
-e_strsplit (const gchar *string,
- const gchar *delimiter,
- gint max_tokens)
-{
- GSList *string_list = NULL, *slist;
- gchar **str_array, *s;
- guint i, n = 1;
-
- g_return_val_if_fail (string != NULL, NULL);
- g_return_val_if_fail (delimiter != NULL, NULL);
-
- if (max_tokens < 1)
- max_tokens = G_MAXINT;
-
- s = strstr (string, delimiter);
- if (s)
- {
- guint delimiter_len = strlen (delimiter);
-
- do
- {
- guint len;
- gchar *new_string;
-
- len = s - string;
- new_string = g_new (gchar, len + 1);
- strncpy (new_string, string, len);
- new_string[len] = 0;
- string_list = g_slist_prepend (string_list, new_string);
- n++;
- string = s + delimiter_len;
- s = strstr (string, delimiter);
- }
- while (--max_tokens && s);
- }
-
- n++;
- string_list = g_slist_prepend (string_list, g_strdup (string));
-
- str_array = g_new (gchar*, n);
-
- i = n - 1;
-
- str_array[i--] = NULL;
- for (slist = string_list; slist; slist = slist->next)
- str_array[i--] = slist->data;
-
- g_slist_free (string_list);
-
- return str_array;
-}
-
-gchar *
-e_strstrcase (const gchar *haystack, const gchar *needle)
-{
- /* find the needle in the haystack neglecting case */
- const gchar *ptr;
- guint len;
-
- g_return_val_if_fail (haystack != NULL, NULL);
- g_return_val_if_fail (needle != NULL, NULL);
-
- len = strlen(needle);
- if (len > strlen(haystack))
- return NULL;
-
- if (len == 0)
- return (gchar *) haystack;
-
- for (ptr = haystack; *(ptr + len - 1) != '\0'; ptr++)
- if (!g_strncasecmp (ptr, needle, len))
- return (gchar *) ptr;
-
- return NULL;
-}
-
-void
-e_filename_make_safe (gchar *string)
-{
- gchar *p;
-
- g_return_if_fail (string != NULL);
-
- for (p = string; *p; p++) {
- if (!isprint ((unsigned char)*p) || strchr (" /'\"`&();|<>${}!", *p))
- *p = '_';
- }
-}
-
-static gint
-epow10 (gint number) {
- gint value;
-
- for (value = 1; number > 0; number --) {
- value *= 10;
- }
- return value;
-}
-
-gchar *
-e_format_number (gint number)
-{
- GList *iterator, *list = NULL;
- struct lconv *locality;
- gint char_length = 0;
- gint group_count = 0;
- guchar *grouping;
- int last_count = 3;
- int divider;
- char *value;
- char *value_iterator;
-
- locality = localeconv();
- grouping = locality->grouping;
- while (number) {
- char *group;
- switch (*grouping) {
- default:
- last_count = *grouping;
- grouping++;
- case 0:
- divider = epow10(last_count);
- if (number >= divider) {
- group = g_strdup_printf("%0*d", last_count, number % divider);
- } else {
- group = g_strdup_printf("%d", number % divider);
- }
- number /= divider;
- break;
- case CHAR_MAX:
- group = g_strdup_printf("%d", number);
- number = 0;
- break;
- }
- char_length += strlen(group);
- list = g_list_prepend(list, group);
- group_count ++;
- }
-
- if (list) {
- value = g_new(char, 1 + char_length + (group_count - 1) * strlen(locality->thousands_sep));
-
- iterator = list;
- value_iterator = value;
-
- strcpy(value_iterator, iterator->data);
- value_iterator += strlen(iterator->data);
- for (iterator = iterator->next; iterator; iterator = iterator->next) {
- strcpy(value_iterator, locality->thousands_sep);
- value_iterator += strlen(locality->thousands_sep);
-
- strcpy(value_iterator, iterator->data);
- value_iterator += strlen(iterator->data);
- }
- e_free_string_list (list);
- return value;
- } else {
- return g_strdup("0");
- }
-}
-
-gchar *
-e_format_number_float (gfloat number)
-{
- gint int_part;
- gint fraction;
- struct lconv *locality;
- gchar *str_intpart;
- gchar *decimal_point;
- gchar *str_fraction;
- gchar *value;
-
- locality = localeconv();
-
- int_part = (int) number;
- str_intpart = e_format_number (int_part);
-
- if (!strcmp(locality->mon_decimal_point, "")) {
- decimal_point = ".";
- }
- else {
- decimal_point = locality->mon_decimal_point;
- }
-
- fraction = (int) ((number - int_part) * 100);
-
- if (fraction == 0) {
- str_fraction = g_strdup ("00");
- }
- else {
- str_fraction = g_strdup_printf ("%02d", fraction);
- }
-
- value = g_strconcat (str_intpart, decimal_point, str_fraction, NULL);
-
- g_free (str_intpart);
- g_free (str_fraction);
-
- return value;
-}
-
-gboolean
-e_create_directory (gchar *directory)
-{
- gchar *full_name;
- gchar *position;
- gchar *current_dir = g_get_current_dir();
- struct stat info;
- gboolean return_value = TRUE;
-
- if (directory[0] == '/') {
- full_name = g_malloc0 (strlen (directory) + 1);
- strcpy (full_name, directory);
- } else {
- full_name = g_malloc0 (strlen (directory) + strlen (current_dir) + 2);
- sprintf (full_name, "%s/%s", current_dir, directory);
- }
-
- if ((position = strrchr (full_name, '/')) == full_name) {
- if (stat (full_name, &info)) {
- switch (errno) {
- case ENOENT:
- if (mkdir (full_name, 0777)) {
- switch (errno) {
- default:
- return_value = FALSE;
- break;
- }
- }
- break;
- default:
- return_value = FALSE;
- break;
- }
- }
- } else {
- *position = 0;
- e_create_directory (full_name);
- *position = '/';
- if (stat (full_name, &info)) {
- switch (errno) {
- case ENOENT:
- if (mkdir (full_name, 0777)) {
- switch (errno) {
- default:
- return_value = FALSE;
- break;
- }
- }
- break;
- default:
- return_value = FALSE;
- break;
- }
- }
- }
-
- g_free (current_dir);
- g_free (full_name);
-
- return (return_value);
-}
-
-
-/* Perform a binary search for key in base which has nmemb elements
- of size bytes each. The comparisons are done by (*compare)(). */
-void e_bsearch (const void *key,
- const void *base,
- size_t nmemb,
- size_t size,
- ESortCompareFunc compare,
- gpointer closure,
- size_t *start,
- size_t *end)
-{
- size_t l, u, idx;
- const void *p;
- int comparison;
- if (!(start || end))
- return;
-
- l = 0;
- u = nmemb;
- while (l < u) {
- idx = (l + u) / 2;
- p = (void *) (((const char *) base) + (idx * size));
- comparison = (*compare) (key, p, closure);
- if (comparison < 0)
- u = idx;
- else if (comparison > 0)
- l = idx + 1;
- else {
- size_t lsave, usave;
- lsave = l;
- usave = u;
- if (start) {
- while (l < u) {
- idx = (l + u) / 2;
- p = (void *) (((const char *) base) + (idx * size));
- comparison = (*compare) (key, p, closure);
- if (comparison <= 0)
- u = idx;
- else
- l = idx + 1;
- }
- *start = l;
-
- l = lsave;
- u = usave;
- }
- if (end) {
- while (l < u) {
- idx = (l + u) / 2;
- p = (void *) (((const char *) base) + (idx * size));
- comparison = (*compare) (key, p, closure);
- if (comparison < 0)
- u = idx;
- else
- l = idx + 1;
- }
- *end = l;
- }
- return;
- }
- }
-
- if (start)
- *start = l;
- if (end)
- *end = l;
-}
-
-static gpointer closure_closure;
-static ESortCompareFunc compare_closure;
-
-static int
-qsort_callback(const void *data1, const void *data2)
-{
- return (*compare_closure) (data1, data2, closure_closure);
-}
-
-/* Forget it. We're just going to use qsort. I lost the need for a stable sort. */
-void
-e_sort (void *base,
- size_t nmemb,
- size_t size,
- ESortCompareFunc compare,
- gpointer closure)
-{
- closure_closure = closure;
- compare_closure = compare;
- qsort(base, nmemb, size, qsort_callback);
-#if 0
- void *base_copy;
- int i;
- base_copy = g_malloc(nmemb * size);
-
- for (i = 0; i < nmemb; i++) {
- int position;
- e_bsearch(base + (i * size), base_copy, i, size, compare, closure, NULL, &position);
- memmove(base_copy + (position + 1) * size, base_copy + position * size, (i - position) * size);
- memcpy(base_copy + position * size, base + i * size, size);
- }
- memcpy(base, base_copy, nmemb * size);
- g_free(base_copy);
-#endif
-}
-
-size_t e_strftime(char *s, size_t max, const char *fmt, const struct tm *tm)
-{
-#ifdef HAVE_LKSTRFTIME
- return strftime(s, max, fmt, tm);
-#else
- char *c, *ffmt, *ff;
- size_t ret;
-
- ffmt = g_strdup(fmt);
- ff = ffmt;
- while ((c = strstr(ff, "%l")) != NULL) {
- c[1] = 'I';
- ff = c;
- }
-
- ff = fmt;
- while ((c = strstr(ff, "%k")) != NULL) {
- c[1] = 'H';
- ff = c;
- }
-
- ret = strftime(s, max, ffmt, tm);
- g_free(ffmt);
- return ret;
-#endif
-}
-
-
-/**
- * Function to do a last minute fixup of the AM/PM stuff if the locale
- * and gettext haven't done it right. Most English speaking countries
- * except the USA use the 24 hour clock (UK, Australia etc). However
- * since they are English nobody bothers to write a language
- * translation (gettext) file. So the locale turns off the AM/PM, but
- * gettext does not turn on the 24 hour clock. Leaving a mess.
- *
- * This routine checks if AM/PM are defined in the locale, if not it
- * forces the use of the 24 hour clock.
- *
- * The function itself is a front end on strftime and takes exactly
- * the same arguments.
- *
- * TODO: Actually remove the '%p' from the fixed up string so that
- * there isn't a stray space.
- **/
-
-size_t e_strftime_fix_am_pm(char *s, size_t max, const char *fmt, const struct tm *tm)
-{
- char buf[10];
- char *sp;
- char *ffmt;
- size_t ret;
-
- if (strstr(fmt, "%p")==NULL && strstr(fmt, "%P")==NULL) {
- /* No AM/PM involved - can use the fmt string directly */
- ret=e_strftime(s, max, fmt, tm);
- } else {
- /* Get the AM/PM symbol from the locale */
- e_strftime (buf, 10, "%p", tm);
-
- if (buf[0]) {
- /**
- * AM/PM have been defined in the locale
- * so we can use the fmt string directly
- **/
- ret=e_strftime(s, max, fmt, tm);
- } else {
- /**
- * No AM/PM defined by locale
- * must change to 24 hour clock
- **/
- ffmt=g_strdup(fmt);
- for (sp=ffmt; (sp=strstr(sp, "%l")); sp++) {
- /**
- * Maybe this should be 'k', but I have never
- * seen a 24 clock actually use that format
- **/
- sp[1]='H';
- }
- for (sp=ffmt; (sp=strstr(sp, "%I")); sp++) {
- sp[1]='H';
- }
- ret=e_strftime(s, max, ffmt, tm);
- g_free(ffmt);
- }
- }
- return(ret);
-}
-
-/**
- * e_flexible_strtod:
- * @nptr: the string to convert to a numeric value.
- * @endptr: if non-NULL, it returns the character after
- * the last character used in the conversion.
- *
- * Converts a string to a gdouble value. This function detects
- * strings either in the standard C locale or in the current locale.
- *
- * This function is typically used when reading configuration files or
- * other non-user input that should not be locale dependent, but may
- * have been in the past. To handle input from the user you should
- * normally use the locale-sensitive system strtod function.
- *
- * To convert from a double to a string in a locale-insensitive way, use
- * @g_ascii_dtostr.
- *
- * Return value: the gdouble value.
- **/
-gdouble
-e_flexible_strtod (const gchar *nptr,
- gchar **endptr)
-{
- gchar *fail_pos;
- gdouble val;
- struct lconv *locale_data;
- const char *decimal_point;
- int decimal_point_len;
- const char *p, *decimal_point_pos;
- const char *end = NULL; /* Silence gcc */
- char *copy, *c;
-
- g_return_val_if_fail (nptr != NULL, 0);
-
- fail_pos = NULL;
-
- locale_data = localeconv ();
- decimal_point = locale_data->decimal_point;
- decimal_point_len = strlen (decimal_point);
-
- g_assert (decimal_point_len != 0);
-
- decimal_point_pos = NULL;
- if (!strcmp (decimal_point, "."))
- return strtod (nptr, endptr);
-
- p = nptr;
-
- /* Skip leading space */
- while (isspace ((guchar)*p))
- p++;
-
- /* Skip leading optional sign */
- if (*p == '+' || *p == '-')
- p++;
-
- if (p[0] == '0' &&
- (p[1] == 'x' || p[1] == 'X')) {
- p += 2;
- /* HEX - find the (optional) decimal point */
-
- while (isxdigit ((guchar)*p))
- p++;
-
- if (*p == '.') {
- decimal_point_pos = p++;
-
- while (isxdigit ((guchar)*p))
- p++;
-
- if (*p == 'p' || *p == 'P')
- p++;
- if (*p == '+' || *p == '-')
- p++;
- while (isdigit ((guchar)*p))
- p++;
- end = p;
- } else if (strncmp (p, decimal_point, decimal_point_len) == 0) {
- return strtod (nptr, endptr);
- }
- } else {
- while (isdigit ((guchar)*p))
- p++;
-
- if (*p == '.') {
- decimal_point_pos = p++;
-
- while (isdigit ((guchar)*p))
- p++;
-
- if (*p == 'e' || *p == 'E')
- p++;
- if (*p == '+' || *p == '-')
- p++;
- while (isdigit ((guchar)*p))
- p++;
- end = p;
- } else if (strncmp (p, decimal_point, decimal_point_len) == 0) {
- return strtod (nptr, endptr);
- }
- }
- /* For the other cases, we need not convert the decimal point */
-
- if (!decimal_point_pos)
- return strtod (nptr, endptr);
-
- /* We need to convert the '.' to the locale specific decimal point */
- copy = g_malloc (end - nptr + 1 + decimal_point_len);
-
- c = copy;
- memcpy (c, nptr, decimal_point_pos - nptr);
- c += decimal_point_pos - nptr;
- memcpy (c, decimal_point, decimal_point_len);
- c += decimal_point_len;
- memcpy (c, decimal_point_pos + 1, end - (decimal_point_pos + 1));
- c += end - (decimal_point_pos + 1);
- *c = 0;
-
- val = strtod (copy, &fail_pos);
-
- if (fail_pos) {
- if (fail_pos > decimal_point_pos)
- fail_pos = (char *)nptr + (fail_pos - copy) - (decimal_point_len - 1);
- else
- fail_pos = (char *)nptr + (fail_pos - copy);
- }
-
- g_free (copy);
-
- if (endptr)
- *endptr = fail_pos;
-
- return val;
-}
-
-/**
- * e_ascii_dtostr:
- * @buffer: A buffer to place the resulting string in
- * @buf_len: The length of the buffer.
- * @format: The printf-style format to use for the
- * code to use for converting.
- * @d: The double to convert
- *
- * Converts a double to a string, using the '.' as
- * decimal_point. To format the number you pass in
- * a printf-style formating string. Allowed conversion
- * specifiers are eEfFgG.
- *
- * If you want to generates enough precision that converting
- * the string back using @g_strtod gives the same machine-number
- * (on machines with IEEE compatible 64bit doubles) use the format
- * string "%.17g". If you do this it is guaranteed that the size
- * of the resulting string will never be larger than
- * @G_ASCII_DTOSTR_BUF_SIZE bytes.
- *
- * Return value: The pointer to the buffer with the converted string.
- **/
-gchar *
-e_ascii_dtostr (gchar *buffer,
- gint buf_len,
- const gchar *format,
- gdouble d)
-{
- struct lconv *locale_data;
- const char *decimal_point;
- int decimal_point_len;
- gchar *p;
- int rest_len;
- gchar format_char;
-
- g_return_val_if_fail (buffer != NULL, NULL);
- g_return_val_if_fail (format[0] == '%', NULL);
- g_return_val_if_fail (strpbrk (format + 1, "'l%") == NULL, NULL);
-
- format_char = format[strlen (format) - 1];
-
- g_return_val_if_fail (format_char == 'e' || format_char == 'E' ||
- format_char == 'f' || format_char == 'F' ||
- format_char == 'g' || format_char == 'G',
- NULL);
-
- if (format[0] != '%')
- return NULL;
-
- if (strpbrk (format + 1, "'l%"))
- return NULL;
-
- if (!(format_char == 'e' || format_char == 'E' ||
- format_char == 'f' || format_char == 'F' ||
- format_char == 'g' || format_char == 'G'))
- return NULL;
-
-
- g_snprintf (buffer, buf_len, format, d);
-
- locale_data = localeconv ();
- decimal_point = locale_data->decimal_point;
- decimal_point_len = strlen (decimal_point);
-
- g_assert (decimal_point_len != 0);
-
- if (strcmp (decimal_point, ".")) {
- p = buffer;
-
- if (*p == '+' || *p == '-')
- p++;
-
- while (isdigit ((guchar)*p))
- p++;
-
- if (strncmp (p, decimal_point, decimal_point_len) == 0) {
- *p = '.';
- p++;
- if (decimal_point_len > 1) {
- rest_len = strlen (p + (decimal_point_len-1));
- memmove (p, p + (decimal_point_len-1),
- rest_len);
- p[rest_len] = 0;
- }
- }
- }
-
- return buffer;
-}
-
-gchar *
-e_strdup_append_strings (gchar *first_string, ...)
-{
- gchar *buffer;
- gchar *current;
- gint length;
- va_list args1;
- va_list args2;
- char *v_string;
- int v_int;
-
- va_start (args1, first_string);
- G_VA_COPY (args2, args1);
-
- length = 0;
-
- v_string = first_string;
- while (v_string) {
- v_int = va_arg (args1, int);
- if (v_int >= 0)
- length += v_int;
- else
- length += strlen (v_string);
- v_string = va_arg (args1, char *);
- }
-
- buffer = g_new (char, length + 1);
- current = buffer;
-
- v_string = first_string;
- while (v_string) {
- v_int = va_arg (args2, int);
- if (v_int < 0) {
- int i;
- for (i = 0; v_string[i]; i++) {
- *(current++) = v_string[i];
- }
- } else {
- int i;
- for (i = 0; v_string[i] && i < v_int; i++) {
- *(current++) = v_string[i];
- }
- }
- v_string = va_arg (args2, char *);
- }
- *(current++) = 0;
-
- va_end (args1);
- va_end (args2);
-
- return buffer;
-}
-
-gchar **
-e_strdupv (const gchar **str_array)
-{
- if (str_array) {
- gint i;
- gchar **retval;
-
- i = 0;
- while (str_array[i])
- i++;
-
- retval = g_new (gchar*, i + 1);
-
- i = 0;
- while (str_array[i]) {
- retval[i] = g_strdup (str_array[i]);
- i++;
- }
- retval[i] = NULL;
-
- return retval;
- } else {
- return NULL;
- }
-}
diff --git a/e-util/e-util.h b/e-util/e-util.h
deleted file mode 100644
index 65a8d0d618..0000000000
--- a/e-util/e-util.h
+++ /dev/null
@@ -1,327 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-util.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_UTIL_H_
-#define _E_UTIL_H_
-
-#include <sys/types.h>
-#include <gtk/gtktypeutils.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-#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;\
-}
-
-
-#define E_MAKE_X_TYPE(l,str,t,ci,i,parent,poa_init,offset) \
-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 = bonobo_x_type_unique (\
- parent, poa_init, NULL,\
- offset, &info);\
- }\
- return type;\
-}
-
-#define GET_STRING_ARRAY_FROM_ELLIPSIS(labels, first_string) \
- { \
- va_list args; \
- int i; \
- char *s; \
- \
- va_start (args, (first_string)); \
- \
- i = 0; \
- for (s = (first_string); s; s = va_arg (args, char *)) \
- i++; \
- va_end (args); \
- \
- (labels) = g_new (char *, i + 1); \
- \
- va_start (args, (first_string)); \
- i = 0; \
- for (s = (first_string); s; s = va_arg (args, char *)) \
- (labels)[i++] = s; \
- \
- va_end (args); \
- (labels)[i] = NULL; \
- }
-
-
-#define GET_DUPLICATED_STRING_ARRAY_FROM_ELLIPSIS(labels, first_string) \
- { \
- int i; \
- GET_STRING_ARRAY_FROM_ELLIPSIS ((labels), (first_string)); \
- for (i = 0; labels[i]; i++) \
- labels[i] = g_strdup (labels[i]); \
- }
-
-
-#if 1
-# define E_OBJECT_CLASS_ADD_SIGNALS(oc,sigs,last) \
- gtk_object_class_add_signals (oc, sigs, last)
-# define E_OBJECT_CLASS_TYPE(oc) (oc)->type
-#else
-# define E_OBJECT_CLASS_ADD_SIGNALS(oc,sigs,last)
-# define E_OBJECT_CLASS_TYPE(oc) G_TYPE_FROM_CLASS (oc)
-#endif
-
-
-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);
-char *e_strdup_strip (const char *string);
-void e_free_object_list (GList *list);
-void e_free_object_slist (GSList *list);
-void e_free_string_list (GList *list);
-void e_free_string_slist (GSList *list);
-char *e_read_file (const char *filename);
-int e_write_file (const char *filename,
- const char *data,
- int flags);
-int e_write_file_mkstemp (char *filename,
- const char *data);
-int e_mkdir_hier (const char *path,
- mode_t mode);
-
-gchar **e_strsplit (const gchar *string,
- const gchar *delimiter,
- gint max_tokens);
-gchar *e_strstrcase (const gchar *haystack,
- const gchar *needle);
-void e_filename_make_safe (gchar *string);
-gchar *e_format_number (gint number);
-gchar *e_format_number_float (gfloat number);
-gboolean e_create_directory (gchar *directory);
-gchar **e_strdupv (const gchar **str_array);
-
-
-typedef int (*ESortCompareFunc) (const void *first,
- const void *second,
- gpointer closure);
-void e_sort (void *base,
- size_t nmemb,
- size_t size,
- ESortCompareFunc compare,
- gpointer closure);
-void e_bsearch (const void *key,
- const void *base,
- size_t nmemb,
- size_t size,
- ESortCompareFunc compare,
- gpointer closure,
- size_t *start,
- size_t *end);
-size_t e_strftime_fix_am_pm (char *s,
- size_t max,
- const char *fmt,
- const struct tm *tm);
-
-size_t e_strftime (char *s,
- size_t max,
- const char *fmt,
- const struct tm *tm);
-
-
-/* String to/from double conversion functions */
-gdouble e_flexible_strtod (const gchar *nptr,
- gchar **endptr);
-/* 29 bytes should enough for all possible values that
- * g_ascii_dtostr can produce with the %.17g format.
- * Then add 10 for good measure */
-#define E_ASCII_DTOSTR_BUF_SIZE (29 + 10)
-gchar *e_ascii_dtostr (gchar *buffer,
- gint buf_len,
- const gchar *format,
- gdouble d);
-
-/* Alternating char * and int arguments with a NULL char * to end.
- Less than 0 for the int means copy the whole string. */
-gchar *e_strdup_append_strings (gchar *first_string,
- ...);
-
-/* Marshallers */
-void e_marshal_INT__INT_INT_POINTER (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-void e_marshal_INT__INT_POINTER_INT_POINTER (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-void e_marshal_NONE__OBJECT_DOUBLE_DOUBLE_BOOL (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-void e_marshal_DOUBLE__OBJECT_DOUBLE_DOUBLE_BOOL (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-void e_marshal_BOOL__OBJECT_DOUBLE_DOUBLE_BOOL (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-
-#define e_marshal_NONE__INT_INT_POINTER_POINTER_UINT_UINT e_marshal_NONE__INT_INT_POINTER_POINTER_INT_INT
-void e_marshal_NONE__INT_INT_POINTER_POINTER_INT_INT (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-
-#define e_marshal_NONE__INT_POINTER_INT_POINTER_POINTER_UINT_UINT e_marshal_NONE__INT_POINTER_INT_POINTER_POINTER_INT_INT
-void e_marshal_NONE__INT_POINTER_INT_POINTER_POINTER_INT_INT (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-
-#define e_marshal_NONE__INT_INT_POINTER_UINT e_marshal_NONE__INT_INT_POINTER_INT
-void e_marshal_NONE__INT_INT_POINTER_INT (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-
-#define e_marshal_NONE__INT_POINTER_INT_POINTER_UINT e_marshal_NONE__INT_POINTER_INT_POINTER_INT
-void e_marshal_NONE__INT_POINTER_INT_POINTER_INT (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-
-#define e_marshal_BOOL__INT_INT_POINTER_INT_INT_UINT e_marshal_BOOL__INT_INT_POINTER_INT_INT_INT
-void e_marshal_BOOL__INT_INT_POINTER_INT_INT_INT (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-
-#define e_marshal_BOOL__INT_POINTER_INT_POINTER_INT_INT_UINT e_marshal_BOOL__INT_POINTER_INT_POINTER_INT_INT_INT
-void e_marshal_BOOL__INT_POINTER_INT_POINTER_INT_INT_INT (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-
-#define e_marshal_NONE__INT_INT_POINTER_INT_INT_POINTER_UINT_UINT e_marshal_NONE__INT_INT_POINTER_INT_INT_POINTER_INT_INT
-void e_marshal_NONE__INT_INT_POINTER_INT_INT_POINTER_INT_INT (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-
-#define e_marshal_NONE__INT_POINTER_INT_POINTER_INT_INT_POINTER_UINT_UINT e_marshal_NONE__INT_POINTER_INT_POINTER_INT_INT_POINTER_INT_INT
-void e_marshal_NONE__INT_POINTER_INT_POINTER_INT_INT_POINTER_INT_INT (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-void e_marshal_NONE__POINTER_POINTER_INT (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-void e_marshal_NONE__INT_POINTER_INT_POINTER (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-void e_marshal_NONE__POINTER_POINTER_POINTER_POINTER (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-void e_marshal_INT__POINTER_POINTER (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-void e_marshal_INT__POINTER_POINTER_POINTER (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-void e_marshal_INT__POINTER_POINTER_POINTER_POINTER (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-void e_marshal_INT__POINTER_POINTER_POINTER_POINTER_POINTER (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-void e_marshal_NONE__POINTER_POINTER_POINTER_BOOL (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-void e_marshal_NONE__POINTER_INT_INT_INT (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-void e_marshal_INT__OBJECT_POINTER (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-void e_marshal_NONE__DOUBLE (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-
-#define e_marshal_BOOL__STRING_ENUM e_marshal_BOOL__STRING_INT
-void e_marshal_BOOL__STRING_INT (GtkObject *object,
- GtkSignalFunc func,
- gpointer func_data,
- GtkArg *args);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#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 fa4f96c1a2..0000000000
--- a/e-util/e-xml-utils.c
+++ /dev/null
@@ -1,423 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-xml-utils.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-
-#include "e-xml-utils.h"
-
-#include <locale.h>
-#include <math.h>
-#include <string.h>
-
-#include <parser.h>
-#include <xmlmemory.h>
-
-#include "gal/util/e-i18n.h"
-#include "gal/util/e-util.h"
-
-xmlNode *
-e_xml_get_child_by_name (const xmlNode *parent, const xmlChar *child_name)
-{
- xmlNode *child;
-
- g_return_val_if_fail (parent != NULL, NULL);
- g_return_val_if_fail (child_name != NULL, NULL);
-
- for (child = parent->xmlChildrenNode; child != NULL; child = child->next) {
- if (xmlStrcmp (child->name, child_name) == 0) {
- return child;
- }
- }
- return NULL;
-}
-
-/* Returns the first child with the name child_name and the "lang"
- * attribute that matches the current LC_MESSAGES, or else, the first
- * child with the name child_name and no "lang" attribute.
- */
-xmlNode *
-e_xml_get_child_by_name_by_lang (const xmlNode *parent,
- const xmlChar *child_name,
- const gchar *lang)
-{
- xmlNode *child;
- /* This is the default version of the string. */
- xmlNode *C = NULL;
-
- g_return_val_if_fail (parent != NULL, NULL);
- g_return_val_if_fail (child_name != NULL, NULL);
-
- if (lang == NULL) {
-#ifdef HAVE_LC_MESSAGES
- lang = setlocale (LC_MESSAGES, NULL);
-#else
- lang = setlocale (LC_CTYPE, NULL);
-#endif
- }
- for (child = parent->xmlChildrenNode; child != NULL; child = child->next) {
- if (xmlStrcmp (child->name, child_name) == 0) {
- xmlChar *this_lang = xmlGetProp (child, "lang");
- if (this_lang == NULL) {
- C = child;
- } else if (xmlStrcmp(this_lang, "lang") == 0) {
- return child;
- }
- }
- }
- return C;
-}
-
-static xmlNode *
-e_xml_get_child_by_name_by_lang_list_with_score (const xmlNode *parent,
- const gchar *name,
- GList *lang_list,
- gint *best_lang_score)
-{
- xmlNodePtr best_node = NULL, node;
-
- for (node = parent->xmlChildrenNode; node != NULL; node = node->next) {
- xmlChar *lang;
-
- if (node->name == NULL || strcmp (node->name, name) != 0) {
- continue;
- }
- lang = xmlGetProp (node, "xml:lang");
- if (lang != NULL) {
- GList *l;
- gint i;
-
- for (l = lang_list, i = 0;
- l != NULL && i < *best_lang_score;
- l = l->next, i++) {
- if (strcmp ((gchar *) l->data, lang) == 0) {
- best_node = node;
- *best_lang_score = i;
- }
- }
- } else {
- if (best_node == NULL) {
- best_node = node;
- }
- }
- xmlFree (lang);
- if (*best_lang_score == 0) {
- return best_node;
- }
- }
-
- return best_node;
-}
-
-/*
- * e_xml_get_child_by_name_by_lang_list:
- *
- */
-xmlNode *
-e_xml_get_child_by_name_by_lang_list (const xmlNode *parent,
- const gchar *name,
- GList *lang_list)
-{
- gint best_lang_score = INT_MAX;
-
- g_return_val_if_fail (parent != NULL, NULL);
- g_return_val_if_fail (name != NULL, NULL);
-
- if (lang_list == NULL) {
- lang_list = gnome_i18n_get_language_list ("LC_MESSAGES");
- }
- return e_xml_get_child_by_name_by_lang_list_with_score
- (parent,name,
- lang_list,
- &best_lang_score);
-}
-
-/*
- * e_xml_get_child_by_name_no_lang
- *
- */
-xmlNode *
-e_xml_get_child_by_name_no_lang (const xmlNode *parent, const gchar *name)
-{
- xmlNodePtr node;
-
- g_return_val_if_fail (parent != NULL, NULL);
- g_return_val_if_fail (name != NULL, NULL);
-
- for (node = parent->xmlChildrenNode; node != NULL; node = node->next) {
- xmlChar *lang;
-
- if (node->name == NULL || strcmp (node->name, name) != 0) {
- continue;
- }
- lang = xmlGetProp (node, "xml:lang");
- if (lang == NULL) {
- return node;
- }
- xmlFree (lang);
- }
-
- return NULL;
-}
-
-gint
-e_xml_get_integer_prop_by_name (const xmlNode *parent, const xmlChar *prop_name)
-{
- g_return_val_if_fail (parent != NULL, 0);
- g_return_val_if_fail (prop_name != NULL, 0);
-
- return e_xml_get_integer_prop_by_name_with_default (parent, prop_name, 0);
-}
-
-gint
-e_xml_get_integer_prop_by_name_with_default (const xmlNode *parent,
- const xmlChar *prop_name,
- gint def)
-{
- xmlChar *prop;
- gint ret_val = def;
-
- g_return_val_if_fail (parent != NULL, 0);
- g_return_val_if_fail (prop_name != NULL, 0);
-
- prop = xmlGetProp ((xmlNode *) parent, prop_name);
- if (prop != NULL) {
- (void) sscanf (prop, "%d", &ret_val);
- xmlFree (prop);
- }
- return ret_val;
-}
-
-void
-e_xml_set_integer_prop_by_name (xmlNode *parent,
- const xmlChar *prop_name,
- gint value)
-{
- gchar *valuestr;
-
- g_return_if_fail (parent != NULL);
- g_return_if_fail (prop_name != NULL);
-
- valuestr = g_strdup_printf ("%d", value);
- xmlSetProp (parent, prop_name, valuestr);
- g_free (valuestr);
-}
-
-guint
-e_xml_get_uint_prop_by_name (const xmlNode *parent, const xmlChar *prop_name)
-{
- g_return_val_if_fail (parent != NULL, 0);
- g_return_val_if_fail (prop_name != NULL, 0);
-
- return e_xml_get_uint_prop_by_name_with_default (parent, prop_name, 0);
-}
-
-guint
-e_xml_get_uint_prop_by_name_with_default (const xmlNode *parent,
- const xmlChar *prop_name,
- guint def)
-{
- xmlChar *prop;
- guint ret_val = def;
-
- g_return_val_if_fail (parent != NULL, 0);
- g_return_val_if_fail (prop_name != NULL, 0);
-
- prop = xmlGetProp ((xmlNode *) parent, prop_name);
- if (prop != NULL) {
- (void) sscanf (prop, "%u", &ret_val);
- xmlFree (prop);
- }
- return ret_val;
-}
-
-void
-e_xml_set_uint_prop_by_name (xmlNode *parent,
- const xmlChar *prop_name,
- guint value)
-{
- gchar *valuestr;
-
- g_return_if_fail (parent != NULL);
- g_return_if_fail (prop_name != NULL);
-
- valuestr = g_strdup_printf ("%u", value);
- xmlSetProp (parent, prop_name, valuestr);
- g_free (valuestr);
-}
-
-gboolean
-e_xml_get_bool_prop_by_name (const xmlNode *parent,
- const xmlChar *prop_name)
-{
- g_return_val_if_fail (parent != NULL, 0);
- g_return_val_if_fail (prop_name != NULL, 0);
-
- return e_xml_get_bool_prop_by_name_with_default (parent,
- prop_name,
- FALSE);
-}
-
-gboolean
-e_xml_get_bool_prop_by_name_with_default(const xmlNode *parent,
- const xmlChar *prop_name,
- gboolean def)
-{
- xmlChar *prop;
- gboolean ret_val = def;
-
- g_return_val_if_fail (parent != NULL, 0);
- g_return_val_if_fail (prop_name != NULL, 0);
-
- prop = xmlGetProp ((xmlNode *) parent, prop_name);
- if (prop != NULL) {
- if (g_strcasecmp (prop, "true") == 0) {
- ret_val = TRUE;
- } else if (g_strcasecmp (prop, "false") == 0) {
- ret_val = FALSE;
- }
- xmlFree(prop);
- }
- return ret_val;
-}
-
-void
-e_xml_set_bool_prop_by_name (xmlNode *parent, const xmlChar *prop_name, gboolean value)
-{
- g_return_if_fail (parent != NULL);
- g_return_if_fail (prop_name != NULL);
-
- if (value) {
- xmlSetProp (parent, prop_name, "true");
- } else {
- xmlSetProp (parent, prop_name, "false");
- }
-}
-
-gdouble
-e_xml_get_double_prop_by_name (const xmlNode *parent, const xmlChar *prop_name)
-{
- g_return_val_if_fail (parent != NULL, 0);
- g_return_val_if_fail (prop_name != NULL, 0);
-
- return e_xml_get_double_prop_by_name_with_default (parent, prop_name, 0.0);
-}
-
-gdouble
-e_xml_get_double_prop_by_name_with_default (const xmlNode *parent, const xmlChar *prop_name, gdouble def)
-{
- xmlChar *prop;
- gdouble ret_val = def;
-
- g_return_val_if_fail (parent != NULL, 0);
- g_return_val_if_fail (prop_name != NULL, 0);
-
- prop = xmlGetProp ((xmlNode *) parent, prop_name);
- if (prop != NULL) {
- ret_val = e_flexible_strtod (prop, NULL);
- xmlFree (prop);
- }
- return ret_val;
-}
-
-void
-e_xml_set_double_prop_by_name(xmlNode *parent, const xmlChar *prop_name, gdouble value)
-{
- char buffer[E_ASCII_DTOSTR_BUF_SIZE];
-
- g_return_if_fail (parent != NULL);
- g_return_if_fail (prop_name != NULL);
-
- if (fabs (value) < 1e9 && fabs (value) > 1e-5) {
- e_ascii_dtostr (buffer, sizeof (buffer), "%.17f", value);
- } else {
- e_ascii_dtostr (buffer, sizeof (buffer), "%.17g", value);
- }
- xmlSetProp (parent, prop_name, buffer);
-}
-
-gchar *
-e_xml_get_string_prop_by_name (const xmlNode *parent, const xmlChar *prop_name)
-{
- g_return_val_if_fail (parent != NULL, 0);
- g_return_val_if_fail (prop_name != NULL, 0);
-
- return e_xml_get_string_prop_by_name_with_default (parent, prop_name, NULL);
-}
-
-gchar *
-e_xml_get_string_prop_by_name_with_default (const xmlNode *parent, const xmlChar *prop_name, const gchar *def)
-{
- xmlChar *prop;
- gchar *ret_val;
-
- g_return_val_if_fail (parent != NULL, 0);
- g_return_val_if_fail (prop_name != NULL, 0);
-
- prop = xmlGetProp ((xmlNode *) parent, prop_name);
- if (prop != NULL) {
- ret_val = g_strdup (prop);
- xmlFree (prop);
- } else {
- ret_val = g_strdup (def);
- }
- return ret_val;
-}
-
-void
-e_xml_set_string_prop_by_name (xmlNode *parent, const xmlChar *prop_name, const gchar *value)
-{
- g_return_if_fail (parent != NULL);
- g_return_if_fail (prop_name != NULL);
-
- if (value != NULL) {
- xmlSetProp (parent, prop_name, value);
- }
-}
-
-gchar *
-e_xml_get_translated_string_prop_by_name (const xmlNode *parent, const xmlChar *prop_name)
-{
- xmlChar *prop;
- gchar *ret_val = NULL;
- gchar *combined_name;
-
- g_return_val_if_fail (parent != NULL, 0);
- g_return_val_if_fail (prop_name != NULL, 0);
-
- prop = xmlGetProp ((xmlNode *) parent, prop_name);
- if (prop != NULL) {
- ret_val = g_strdup (prop);
- xmlFree (prop);
- return ret_val;
- }
-
- combined_name = g_strdup_printf("_%s", prop_name);
- prop = xmlGetProp ((xmlNode *) parent, combined_name);
- if (prop != NULL) {
- ret_val = g_strdup (gettext(prop));
- xmlFree (prop);
- }
- g_free(combined_name);
-
- return ret_val;
-}
diff --git a/e-util/e-xml-utils.h b/e-util/e-xml-utils.h
deleted file mode 100644
index 54981c96e6..0000000000
--- a/e-util/e-xml-utils.h
+++ /dev/null
@@ -1,100 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-xml-utils.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef __E_XML_UTILS__
-#define __E_XML_UTILS__
-
-#include <libgnome/gnome-defs.h>
-#include <glib.h>
-#include <gnome-xml/tree.h>
-
-BEGIN_GNOME_DECLS
-
-xmlNode *e_xml_get_child_by_name (const xmlNode *parent,
- const xmlChar *child_name);
-/* lang set to NULL means use the current locale. */
-xmlNode *e_xml_get_child_by_name_by_lang (const xmlNode *parent,
- const xmlChar *child_name,
- const gchar *lang);
-/* lang_list set to NULL means use the current locale. */
-xmlNode *e_xml_get_child_by_name_by_lang_list (const xmlNode *parent,
- const gchar *name,
- GList *lang_list);
-xmlNode *e_xml_get_child_by_name_no_lang (const xmlNode *parent,
- const gchar *name);
-
-
-gint e_xml_get_integer_prop_by_name (const xmlNode *parent,
- const xmlChar *prop_name);
-gint e_xml_get_integer_prop_by_name_with_default (const xmlNode *parent,
- const xmlChar *prop_name,
- gint def);
-void e_xml_set_integer_prop_by_name (xmlNode *parent,
- const xmlChar *prop_name,
- gint value);
-
-
-guint e_xml_get_uint_prop_by_name (const xmlNode *parent,
- const xmlChar *prop_name);
-guint e_xml_get_uint_prop_by_name_with_default (const xmlNode *parent,
- const xmlChar *prop_name,
- guint def);
-void e_xml_set_uint_prop_by_name (xmlNode *parent,
- const xmlChar *prop_name,
- guint value);
-
-
-gboolean e_xml_get_bool_prop_by_name (const xmlNode *parent,
- const xmlChar *prop_name);
-gboolean e_xml_get_bool_prop_by_name_with_default (const xmlNode *parent,
- const xmlChar *prop_name,
- gboolean def);
-void e_xml_set_bool_prop_by_name (xmlNode *parent,
- const xmlChar *prop_name,
- gboolean value);
-
-gdouble e_xml_get_double_prop_by_name (const xmlNode *parent,
- const xmlChar *prop_name);
-gdouble e_xml_get_double_prop_by_name_with_default (const xmlNode *parent,
- const xmlChar *prop_name,
- gdouble def);
-void e_xml_set_double_prop_by_name ( xmlNode *parent,
- const xmlChar *prop_name,
- gdouble value);
-
-
-gchar *e_xml_get_string_prop_by_name (const xmlNode *parent,
- const xmlChar *prop_name);
-gchar *e_xml_get_string_prop_by_name_with_default (const xmlNode *parent,
- const xmlChar *prop_name,
- const gchar *def);
-void e_xml_set_string_prop_by_name (xmlNode *parent,
- const xmlChar *prop_name,
- const gchar *value);
-
-gchar *e_xml_get_translated_string_prop_by_name (const xmlNode *parent,
- const xmlChar *prop_name);
-
-END_GNOME_DECLS
-
-#endif /* __E_XML_UTILS__ */
diff --git a/filter/ChangeLog b/filter/ChangeLog
index 732377ea82..daf4ff8853 100644
--- a/filter/ChangeLog
+++ b/filter/ChangeLog
@@ -1,141 +1,7 @@
-2002-04-18 Jeffrey Stedfast <fejj@ximian.com>
-
- * filtertypes.xml: The score "is" rule should have a value of "is"
- and not "less-than".
-
-2002-04-12 Jeffrey Stedfast <fejj@ximian.com>
-
- * filter-rule.c (get_widget): Fixed a grammer mistake, or so
- according to bug #23376. Whatever.
-
-2002-04-11 Russell Steinthal <rms39@columbia.edu>
-
- * filtertypes.xml: Fix "Follow Up" searches by generating a
- boolean, rather than a string result (Fixes #23334)
-
- * vfoldertypes.xml: Ditto
-
-2002-04-09 Jeffrey Stedfast <fejj@ximian.com>
-
- * rule-editor.c (double_click): This needs to return a gboolean
- (TRUE).
- (rule_edit): Using gnome_dialog_set_parent instead of
- gtk_widget_set_parent_window seems to fix bug #23226.
-
2002-04-10 Not Zed <NotZed@Ximian.com>
- * filter-input.c (validate): Check that there is a value to
- setup. Fixes #15470.
-
- * filtertypes.xml: Added closing ) for "not starts with" subject
- rule.
- Added closing ) for all the other broken rules too ...
-
-2002-04-04 Dan Winship <danw@ximian.com>
-
- * filter-folder.c: Remove the #ifndef SHELL part. Use an
- EvolutionFolderSelectorButton. Remove FilterFolder->name since
- it's no longer needed.
-
- * filter-context.c (filter_rename_uri): Update for removal of
- FilterFolder->name.
-
- * filter-element.c (filter_element_copy_value): Likewise.
-
- * vfolder-rule.c (source_add): Update for
- evolution_shell_client_user_select_folder API change.
-
-2002-04-01 Jeffrey Stedfast <fejj@ximian.com>
-
- * rule-editor.c (rule_edit): Set 're' as the parent window rather
- than as the parent widget.
- (add_editor_clicked): Only unref the editor if it is non-NULL.
-
-2002-03-18 Jeffrey Stedfast <fejj@ximian.com>
-
- * filter-source.c (filter_source_get_sources): Free account_name
- so we don't leak. Also after getting the source uri, use camel-url
- to hide unwanted stuff.
- (xml_decode): Use xmlFree on the buffer returned from
- xmlNodeGetContent rather than g_free, as I think they are
- incompatable. Also use camel-url here to hide any params in the
- decoded url (to make things compatable with what older versions
- may have saved).
-
-2002-03-06 Jeffrey Stedfast <fejj@ximian.com>
-
- * filtertypes.xml: Added beep and play-sound actions.
-
-2002-02-26 Not Zed <NotZed@Ximian.com>
-
- * filter-filter.c (option_activate): Copy values across to new
- part.
-
- * filter-rule.c (option_activate): copy values across to new part,
- if they are compatible.
-
- * filter-element.c (filter_element_copy_value): New function to
- copy values (where they can be) from one filter element to another.
-
- * filter-part.c (filter_part_copy_values): New function to copy
- values of a filter part. #1359.
-
-2002-02-12 Jeffrey Stedfast <fejj@ximian.com>
-
- * vfoldertypes.xml:
- * filtertypes.xml: Re-added contains and
- not-contains. Also added filter/vfolder rules for
- Flag-for-Followup.
-
-2002-02-04 Jeffrey Stedfast <fejj@ximian.com>
-
- * vfoldertypes.xml: Same here.
-
- * filtertypes.xml: For mlist matching, we only want "is" and "is
- not" because that is all we really support anyway.
-
-2002-01-27 Ettore Perazzoli <ettore@ximian.com>
-
- * Makefile.am: Use LIBFILTER_CFLAGS.
-
-2002-01-26 Mikael Hallendal <micke@codefactory.se>
-
- * rule-editor.c (add_editor_clicked): check if re->edit != NULL
- before trying to unref it. Fixes a segfault when closing the
- rule editor.
-
-2002-01-15 Not Zed <NotZed@Ximian.com>
-
- * filter-input.c (xml_decode): If we write "" to an xml file, we
- read back NULL. So if we read back NULL, convert it to "".
- Sigh. This makes a fix for #7801, although new gui may also be
- required.
-
-2002-01-03 Jeffrey Stedfast <fejj@ximian.com>
-
- * filter-source.c (filter_source_get_sources): Get the account
- name because that is the string we'd like to use for display.
- (get_widget): Generate the account label the same as we do for the
- composer's From optionmenu.
- (filter_source_finalize): Free the account_name.
- (clone): Pass along the account_name member to filter_add_source
-
-2002-01-02 Jeffrey Stedfast <fejj@ximian.com>
-
- * vfoldertypes.xml: Make the date comparisons read the same as the
- ones in filtertypes.xml
-
-2001-12-17 Jeffrey Stedfast <fejj@ximian.com>
-
- * filtertypes.xml: Add new action to execute a shell command.
-
-2001-12-09 Jon Trowbridge <trow@ximian.com>
-
- * vfoldertypes.xml: Add "Needs Reply" option to different status
- types.
-
- * filtertypes.xml: Add "Needs Reply" option to different status
- types.
+ * filtertypes.xml: Matched all )'s in rule parts. About 5 were
+ broken.
2001-11-15 Zbigniew Chyla <cyba@gnome.pl>
diff --git a/filter/filter-folder.c b/filter/filter-folder.c
index 100b4fe253..5b862a986a 100644
--- a/filter/filter-folder.c
+++ b/filter/filter-folder.c
@@ -20,6 +20,8 @@
#include <config.h>
+#define SHELL
+
#include <glib.h>
#include <libgnome/gnome-defs.h>
#include <libgnome/gnome-i18n.h>
@@ -28,7 +30,9 @@
#include <gal/widgets/e-unicode.h>
#include "filter-folder.h"
-#include "shell/evolution-folder-selector-button.h"
+#ifdef SHELL
+#include "shell/evolution-shell-client.h"
+#endif
#include "e-util/e-sexp.h"
#define d(x)
@@ -41,7 +45,9 @@ static GtkWidget *get_widget(FilterElement *fe);
static void build_code(FilterElement *fe, GString *out, struct _FilterPart *ff);
static void format_sexp(FilterElement *, GString *);
+#ifdef SHELL
extern EvolutionShellClient *global_shell_client;
+#endif
static void filter_folder_class_init (FilterFolderClass *class);
static void filter_folder_init (FilterFolder *gspaper);
@@ -109,6 +115,7 @@ filter_folder_finalise (GtkObject *obj)
FilterFolder *o = (FilterFolder *)obj;
g_free (o->uri);
+ g_free (o->name);
((GtkObjectClass *)(parent_class))->finalize(obj);
}
@@ -128,10 +135,12 @@ filter_folder_new (void)
}
void
-filter_folder_set_value(FilterFolder *ff, const char *uri)
+filter_folder_set_value(FilterFolder *ff, const char *uri, const char *name)
{
g_free(ff->uri);
ff->uri = g_strdup(uri);
+ g_free(ff->name);
+ ff->name = g_strdup(name);
}
static gboolean
@@ -173,6 +182,7 @@ xml_encode (FilterElement *fe)
xmlSetProp (value, "type", "folder");
work = xmlNewChild (value, NULL, "folder", NULL);
+ xmlSetProp (work, "name", ff->name);
xmlSetProp (work, "uri", ff->uri);
return value;
@@ -192,7 +202,12 @@ xml_decode (FilterElement *fe, xmlNodePtr node)
n = node->childs;
while (n) {
if (!strcmp (n->name, "folder")) {
- char *uri;
+ char *uri, *name;
+
+ name = xmlGetProp (n, "name");
+ g_free (ff->name);
+ ff->name = g_strdup (name);
+ xmlFree (name);
uri = xmlGetProp (n, "uri");
g_free (ff->uri);
@@ -207,12 +222,88 @@ xml_decode (FilterElement *fe, xmlNodePtr node)
}
static void
-folder_selected (EvolutionFolderSelectorButton *button,
- GNOME_Evolution_Folder *folder,
- FilterFolder *ff)
+button_clicked (GtkButton *button, FilterFolder *ff)
{
- g_free (ff->uri);
- ff->uri = g_strdup (folder->physicalUri);
+#ifdef SHELL
+ const char *allowed_types[] = { "mail", NULL };
+ char *def, *physical_uri, *evolution_uri;
+ gchar *s;
+
+ def = ff->uri ? ff->uri : "";
+
+ gtk_widget_set_sensitive((GtkWidget *)button, FALSE);
+ gtk_object_ref((GtkObject *)ff);
+
+ evolution_shell_client_user_select_folder (global_shell_client,
+ GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (button))),
+ _("Select Folder"),
+ def, allowed_types,
+ &evolution_uri,
+ &physical_uri);
+
+ if (GTK_OBJECT_DESTROYED(button)) {
+ g_free(physical_uri);
+ g_free(evolution_uri);
+ gtk_object_unref((GtkObject *)ff);
+ return;
+ }
+
+ gtk_widget_set_sensitive((GtkWidget *)button, TRUE);
+
+ if (physical_uri != NULL && physical_uri[0] != '\0') {
+ g_free (ff->uri);
+ ff->uri = physical_uri;
+
+ g_free (ff->name);
+ ff->name = g_strdup (g_basename (evolution_uri));
+ s = e_utf8_to_gtk_string (GTK_WIDGET (button), ff->name);
+ gtk_label_set_text (GTK_LABEL (GTK_BIN (button)->child), s);
+ g_free (s);
+ } else {
+ g_free (physical_uri);
+ }
+ g_free (evolution_uri);
+
+ gtk_object_unref((GtkObject *)ff);
+
+#else
+ GnomeDialog *gd;
+ GtkEntry *entry;
+ char *uri, *str;
+
+ gd = (GnomeDialog *)gnome_dialog_new(_("Enter folder URI"),
+ GNOME_STOCK_BUTTON_OK, GNOME_STOCK_BUTTON_CANCEL,
+ NULL);
+ gtk_window_set_policy(GTK_WINDOW(gd), FALSE, TRUE, FALSE);
+ entry = (GtkEntry *)gtk_entry_new();
+ if (ff->uri) {
+ e_utf8_gtk_entry_set_text(entry, ff->uri);
+ }
+ gtk_box_pack_start((GtkBox *)gd->vbox, (GtkWidget *)entry, TRUE, TRUE, 3);
+ gtk_widget_show((GtkWidget *)entry);
+ switch (gnome_dialog_run(gd)) {
+ case 0:
+ g_free(ff->uri);
+ g_free(ff->name);
+ uri = e_utf8_gtk_entry_get_text(entry);
+ ff->uri = uri;
+ str = strstr(uri, "//");
+ if (str)
+ str = strchr(str+2, '/');
+ if (str)
+ str++;
+ else
+ str = uri;
+ ff->name = g_strdup(str);
+ s = e_utf8_to_gtk_string ((GtkWidget *) button, ff->name);
+ gtk_label_set_text((GtkLabel *)GTK_BIN(button)->child, s);
+ g_free (s);
+ case 1:
+ gnome_dialog_close(gd);
+ case -1:
+ /* nothing */
+ }
+#endif
gdk_window_raise (GTK_WIDGET (gtk_widget_get_ancestor (GTK_WIDGET (button), GTK_TYPE_WINDOW))->window);
}
@@ -220,17 +311,20 @@ folder_selected (EvolutionFolderSelectorButton *button,
static GtkWidget *
get_widget (FilterElement *fe)
{
- static const char *allowed_types[] = { "mail", NULL };
FilterFolder *ff = (FilterFolder *)fe;
GtkWidget *button;
+ GtkWidget *label;
- button = evolution_folder_selector_button_new (global_shell_client,
- _("Select Folder"),
- ff->uri,
- allowed_types);
-
+ if (ff->name && ff->name[0])
+ label = gtk_label_new (g_basename (ff->name));
+ else
+ label = gtk_label_new (_("<click here to select a folder>"));
+
+ button = gtk_button_new ();
+ gtk_container_add (GTK_CONTAINER (button), label);
gtk_widget_show (button);
- gtk_signal_connect (GTK_OBJECT (button), "selected", folder_selected, ff);
+ gtk_widget_show (label);
+ gtk_signal_connect (GTK_OBJECT (button), "clicked", button_clicked, ff);
return button;
}
diff --git a/filter/filtertypes.xml b/filter/filtertypes.xml
index f6f0ce2abe..2d90f9eb87 100644
--- a/filter/filtertypes.xml
+++ b/filter/filtertypes.xml
@@ -162,7 +162,7 @@
<option value="not contains">
<title>does not contain</title>
<code>
- (match-all (not (header-contains "Subject" ${subject})))
+ (match-all (not (header-contains "Subject" ${subject}))))
</code>
</option>
<option value="is">
@@ -337,13 +337,13 @@
</code>
</option>
<option value="before">
- <title>is before</title>
+ <title>was before</title>
<code>
(match-all (&lt; (get-sent-date) ${versus}))
</code>
</option>
<option value="after">
- <title>is after</title>
+ <title>was after</title>
<code>
(match-all (&gt; (get-sent-date) ${versus}))
</code>
@@ -368,13 +368,13 @@
</code>
</option>
<option value="before">
- <title>is before</title>
+ <title>was before</title>
<code>
(match-all (&lt; (get-received-date) ${versus}))
</code>
</option>
<option value="after">
- <title>is after</title>
+ <title>was after</title>
<code>
(match-all (&gt; (get-received-date) ${versus}))
</code>
@@ -386,7 +386,7 @@
<part name="score">
<title>Score</title>
<input type="optionlist" name="score-type">
- <option value="is">
+ <option value="less-than">
<title>is</title>
<code>
(match-all (= (get-score) ${versus}))
@@ -414,6 +414,7 @@
<input type="score" name="versus"/>
</part>
+
<part name="size">
<title>Size (kB)</title>
<input type="optionlist" name="size-type">
@@ -465,24 +466,6 @@
</input>
</part>
- <part name="follow-up">
- <title>Follow Up</title>
- <input type="optionlist" name="match-type">
- <option value="is">
- <title>is Flagged</title>
- <code>
- (match-all (not (= (user-tag "follow-up") "")))
- </code>
- </option>
- <option value="is not">
- <title>is not Flagged</title>
- <code>
- (match-all (= (user-tag "follow-up") ""))
- </code>
- </option>
- </input>
- </part>
-
<part name="attachments">
<title>Attachments</title>
<input type="optionlist" name="match-type">
@@ -504,21 +487,45 @@
<part name="mlist">
<title>Mailing list</title>
<input type="optionlist" name="mlist-type">
+ <option value="contains">
+ <title>contains</title>
+ <code>(match-all (header-contains "x-camel-mlist" ${mlist}))</code>
+ </option>
+ <option value="not contains">
+ <title>does not contain</title>
+ <code>(match-all (not (header-contains "x-camel-mlist" ${mlist})))</code>
+ </option>
<option value="is">
<title>is</title>
- <code>(match-all (header-matches "x-camel-mlist" ${mlist}))</code>
+ <code>(match-all (header-matches "x-camel-mlist" ${mlist}))</code>
</option>
<option value="is not">
<title>is not</title>
<code>(match-all (not (header-matches "x-camel-mlist" ${mlist})))</code>
</option>
- <option value="contains">
- <title>contains</title>
- <code>(match-all (header-contains "x-camel-mlist" ${mlist}))</code>
+ <option value="starts with">
+ <title>starts with</title>
+ <code>
+ (match-all (header-starts-with "x-camel-mlist" ${mlist}))
+ </code>
</option>
- <option value="not contains">
- <title>does not contain</title>
- <code>(match-all (not (header-contains "x-camel-mlist" ${mlist})))</code>
+ <option value="not starts with">
+ <title>does not start with</title>
+ <code>
+ (match-all (not (header-starts-with "x-camel-mlist" ${mlist})))
+ </code>
+ </option>
+ <option value="ends with">
+ <title>ends with</title>
+ <code>
+ (match-all (header-ends-with "x-camel-mlist" ${mlist}))
+ </code>
+ </option>
+ <option value="not ends with">
+ <title>does not end with</title>
+ <code>
+ (match-all (not (header-ends-with "x-camel-mlist" ${mlist})))
+ </code>
</option>
</input>
<input type="string" name="mlist"/>
@@ -561,7 +568,7 @@
</input>
<input type="source" name="source"/>
</part>
-
+
</partset>
@@ -594,11 +601,6 @@
<code>(set-score ${score})</code>
<input type="score" name="score"/>
</part>
- <part name="adj-score">
- <title>Adjust Score</title>
- <code>(adjust-score ${score})</code>
- <input type="score" name="score"/>
- </part>
<part name="set-status">
<title>Set Status</title>
<code>
@@ -622,19 +624,5 @@
</option>
</input>
</part>
- <part name="beep">
- <title>Beep</title>
- <code>(beep)</code>
- </part>
- <part name="play-sound">
- <title>Play Sound</title>
- <code>(play-sound ${sound})</code>
- <input type="string" name="sound"/>
- </part>
- <part name="shell-exec">
- <title>Execute Shell Command</title>
- <code>(shell-exec ${command})</code>
- <input type="string" name="command"/>
- </part>
</actionset>
</filterdescription>
diff --git a/filter/libfilter-i18n.h b/filter/libfilter-i18n.h
index 6d9828a52f..175eac2dc6 100644
--- a/filter/libfilter-i18n.h
+++ b/filter/libfilter-i18n.h
@@ -1,42 +1,23 @@
/* Automatically generated. Do not edit. */
-char *s = N_("Adjust Score");
char *s = N_("Assign Color");
char *s = N_("Assign Score");
char *s = N_("Attachments");
-char *s = N_("Beep");
-char *s = N_("contains");
char *s = N_("Copy to Folder");
char *s = N_("Date received");
char *s = N_("Date sent");
char *s = N_("Delete");
char *s = N_("Deleted");
-char *s = N_("does not contain");
-char *s = N_("does not end with");
-char *s = N_("does not exist");
-char *s = N_("does not sound like");
-char *s = N_("does not start with");
char *s = N_("Do Not Exist");
char *s = N_("Draft");
-char *s = N_("ends with");
-char *s = N_("Execute Shell Command");
char *s = N_("Exist");
-char *s = N_("exists");
char *s = N_("Expression");
-char *s = N_("Follow Up");
char *s = N_("Important");
-char *s = N_("is");
-char *s = N_("is after");
-char *s = N_("is before");
-char *s = N_("is Flagged");
-char *s = N_("is greater than");
-char *s = N_("is less than");
-char *s = N_("is not");
-char *s = N_("is not Flagged");
char *s = N_("Mailing list");
char *s = N_("Message Body");
char *s = N_("Message Header");
+char *s = N_("Message was received");
+char *s = N_("Message was sent");
char *s = N_("Move to Folder");
-char *s = N_("Play Sound");
char *s = N_("Read");
char *s = N_("Recipients");
char *s = N_("Regex Match");
@@ -45,10 +26,28 @@ char *s = N_("Score");
char *s = N_("Sender");
char *s = N_("Set Status");
char *s = N_("Size (kB)");
-char *s = N_("sounds like");
char *s = N_("Source Account");
char *s = N_("Specific header");
-char *s = N_("starts with");
char *s = N_("Status");
char *s = N_("Stop Processing");
char *s = N_("Subject");
+char *s = N_("after");
+char *s = N_("before");
+char *s = N_("contains");
+char *s = N_("does not contain");
+char *s = N_("does not end with");
+char *s = N_("does not exist");
+char *s = N_("does not sound like");
+char *s = N_("does not start with");
+char *s = N_("ends with");
+char *s = N_("exists");
+char *s = N_("is greater than");
+char *s = N_("is less than");
+char *s = N_("is not");
+char *s = N_("is");
+char *s = N_("on or after");
+char *s = N_("on or before");
+char *s = N_("sounds like");
+char *s = N_("starts with");
+char *s = N_("was after");
+char *s = N_("was before");
diff --git a/filter/rule-editor.c b/filter/rule-editor.c
index f9350ea372..b6056b3777 100644
--- a/filter/rule-editor.c
+++ b/filter/rule-editor.c
@@ -253,10 +253,8 @@ add_editor_clicked (GtkWidget *dialog, int button, RuleEditor *re)
default:
gnome_dialog_close (GNOME_DIALOG (dialog));
case -1:
- if (re->edit) {
- gtk_object_unref (GTK_OBJECT (re->edit));
- re->edit = NULL;
- }
+ gtk_object_unref (GTK_OBJECT (re->edit));
+ re->edit = NULL;
re->dialog = NULL;
@@ -329,10 +327,8 @@ edit_editor_clicked (GtkWidget *dialog, int button, RuleEditor *re)
default:
gnome_dialog_close (GNOME_DIALOG (dialog));
case -1:
- if (re->edit) {
- gtk_object_unref (GTK_OBJECT (re->edit));
- re->edit = NULL;
- }
+ gtk_object_unref (GTK_OBJECT (re->edit));
+ re->edit = NULL;
re->dialog = NULL;
@@ -363,9 +359,9 @@ rule_edit (GtkWidget *widget, RuleEditor *re)
GNOME_STOCK_BUTTON_CANCEL,
NULL);
- gnome_dialog_set_parent (GNOME_DIALOG (re->dialog), GTK_WINDOW (re));
gtk_window_set_default_size (GTK_WINDOW (re->dialog), 600, 400);
gtk_window_set_policy (GTK_WINDOW (re->dialog), FALSE, TRUE, FALSE);
+ gtk_widget_set_parent (re->dialog, GTK_WIDGET (re));
gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (re->dialog)->vbox), rules, TRUE, TRUE, 0);
gtk_signal_connect (GTK_OBJECT (re->dialog), "clicked", edit_editor_clicked, re);
gtk_signal_connect (GTK_OBJECT (re->dialog), "destroy", edit_editor_destroyed, re);
@@ -385,7 +381,7 @@ rule_delete (GtkWidget *widget, RuleEditor *re)
d(printf ("delete rule\n"));
pos = rule_context_get_rank_rule (re->context, re->current, re->source);
if (pos != -1) {
- int len;
+ gint len;
rule_context_remove_rule (re->context, re->current);
@@ -393,7 +389,7 @@ rule_delete (GtkWidget *widget, RuleEditor *re)
l = g_list_append (NULL, item);
gtk_list_remove_items (re->list, l);
g_list_free (l);
-
+
rule_editor_add_undo(re, RULE_EDITOR_LOG_REMOVE, re->current, rule_context_get_rank_rule(re->context, re->current, re->current->source), 0);
#if 0
gtk_object_unref (GTK_OBJECT (re->current));
@@ -496,13 +492,11 @@ select_rule (GtkWidget *w, GtkWidget *child, RuleEditor *re)
rule_editor_set_sensitive (re);
}
-static gboolean
+static void
double_click (GtkWidget *widget, GdkEventButton *event, RuleEditor *re)
{
if (re->current && event->type == GDK_2BUTTON_PRESS)
rule_edit (widget, re);
-
- return TRUE;
}
static void
@@ -643,8 +637,7 @@ rule_editor_construct (RuleEditor *re, RuleContext *context, GladeXML *gui, cons
re->list = (GtkList *) w = glade_xml_get_widget(gui, "rule_list");
gtk_signal_connect (GTK_OBJECT (w), "select_child", select_rule, re);
- gtk_signal_connect (GTK_OBJECT (w), "button_press_event",
- GTK_SIGNAL_FUNC (double_click), re);
+ gtk_signal_connect (GTK_OBJECT (w), "button_press_event", double_click, re);
gtk_signal_connect (GTK_OBJECT (re), "clicked", editor_clicked, re);
rule_editor_set_source (re, source);
diff --git a/filter/vfolder-rule.c b/filter/vfolder-rule.c
index 36b381eb06..818b303366 100644
--- a/filter/vfolder-rule.c
+++ b/filter/vfolder-rule.c
@@ -352,8 +352,7 @@ select_source_with(GtkWidget *w, struct _source_data *data)
static void
source_add(GtkWidget *widget, struct _source_data *data)
{
- static const char *allowed_types[] = { "mail", NULL };
- GNOME_Evolution_Folder *folder;
+ const char *allowed_types[] = { "mail", NULL };
char *def, *uri;
GtkListItem *item;
GList *l;
@@ -364,18 +363,16 @@ source_add(GtkWidget *widget, struct _source_data *data)
evolution_shell_client_user_select_folder (global_shell_client,
GTK_WINDOW (gtk_widget_get_toplevel (widget)),
_("Select Folder"),
- def, allowed_types, &folder);
+ def, allowed_types, NULL, &uri);
if (GTK_OBJECT_DESTROYED(widget)) {
- if (folder)
- CORBA_free (folder);
+ g_free(uri);
return;
}
gtk_widget_set_sensitive(widget, TRUE);
- if (folder) {
- uri = g_strdup (folder->physicalUri);
+ if (uri != NULL && uri[0] != '\0') {
data->vr->sources = g_list_append(data->vr->sources, uri);
l = NULL;
@@ -388,8 +385,9 @@ source_add(GtkWidget *widget, struct _source_data *data)
gtk_list_append_items(data->list, l);
gtk_list_select_child(data->list, (GtkWidget *)item);
data->current = uri;
+ } else {
+ g_free(uri);
}
- CORBA_free (folder);
set_sensitive(data);
}
diff --git a/help/C/Makefile.am b/help/C/Makefile.am
index e6c225a754..eb8b2120ce 100644
--- a/help/C/Makefile.am
+++ b/help/C/Makefile.am
@@ -4,9 +4,9 @@ figs = \
figures/config-mail.png \
figures/contact-editor.png \
figures/contact.png \
- figures/exchange-identity.png \
+ figures/exchange-identity.png \
+ figures/exchange-receive.png \
figures/exchange-receive-options.png \
- figures/exchange-receive.png \
figures/filter-assist-fig.png \
figures/filter-new-fig.png \
figures/full-1.png \
@@ -22,6 +22,7 @@ figs = \
figures/mail-threaded.png \
figures/mainwindow-pic.png \
figures/newmsg.png \
+ figures/outline.png \
figures/print-dest.png \
figures/print-preview.png \
figures/replymsg.png \
@@ -45,7 +46,6 @@ sgml_ents = \
usage-calendar.sgml \
usage-contact.sgml \
usage-exec-summary.sgml \
- usage-exchange.sgml \
usage-mail-org.sgml \
usage-mail.sgml \
usage-mainwindow.sgml \
diff --git a/help/C/apx-gloss.sgml b/help/C/apx-gloss.sgml
index 40fa9a0ce9..380f9e38be 100644
--- a/help/C/apx-gloss.sgml
+++ b/help/C/apx-gloss.sgml
@@ -290,16 +290,6 @@
</glossdef>
</glossentry>
- <glossentry id="postscript">
- <glossterm>Postscript:</glossterm>
- <glossdef>
- <para>
- A standard document publishing format. Many printers read raw
- Postscript, making Postscript quite versatile.
- </para>
- </glossdef>
- </glossentry>
-
<glossentry id="public-key-encryption">
<glossterm>Public Key Encryption:</glossterm>
<glossdef>
diff --git a/help/C/evolution-C.omf b/help/C/evolution-C.omf
index e166862a81..3d7c23d5fc 100644
--- a/help/C/evolution-C.omf
+++ b/help/C/evolution-C.omf
@@ -7,7 +7,7 @@
<subject>
<category>GNOME|Applications</category>
</subject>
- <format mime="text/html" />
+ <format mime="text/html"/>
<identifier url="index.html"/>
<language code="C"/>
</resource>
diff --git a/help/C/usage-calendar.sgml b/help/C/usage-calendar.sgml
index 9da056b3b4..b8fc3aedce 100644
--- a/help/C/usage-calendar.sgml
+++ b/help/C/usage-calendar.sgml
@@ -440,14 +440,13 @@
</sect2>
########## END UNIMPLEMENTED FEATURESET ############ -->
<sect2 id="usage-calendar-freebusy">
- <title>Scheduling Meetings and The Free/Busy View</title>
+ <title>The Free/Busy View</title>
<para>
- In addition to the standard meeting scheduling tools, you can
- use the Free/Busy view to check whether people are available
- in advance. At this time, the Free/Busy feature only works
- with Microsoft Exchange servers. However, you can still use
- iCal event invitations to coordinate schedules with other
- people no matter what server you're using.
+ <application>Evolution</application> has a Free/Busy window so
+ that you can view people's schedules together to help you
+ schedule appointments. Read <xref linkend="full-advantage"> to
+ learn about how to use this feature with the Ximian Connector
+ for Microsoft Exchange.
</para>
<para>
To access the free/busy view:
@@ -475,11 +474,11 @@
</orderedlist>
</para>
<figure>
- <title>Appointment Scheduing Window</title>
+ <title>Appointment Scheduling Window</title>
<screenshot>
<screeninfo>Appointment Scheduling Window</screeninfo>
<mediaobject><imageobject>
- <imagedata format="png" fileref="figures/freebusy"
+ <imagedata format="png" fileref="figures/schedule"
srccredit="Kevin Breit">
</imageobject></mediaobject>
</screenshot>
@@ -549,15 +548,8 @@
automatically; others will receive email notification of any
change in plans.
</para>
-
- <para>
- Read <xref linkend="full-advantage"> to learn about how to
- use this feature with the Ximian Connector for Microsoft
- Exchange.
- </para>
</sect3>
</sect2>
-
</sect1>
<sect1 id="usage-calendar-todo">
diff --git a/help/C/usage-exchange.sgml b/help/C/usage-exchange.sgml
index e2f0085d4f..fc0b92753d 100644
--- a/help/C/usage-exchange.sgml
+++ b/help/C/usage-exchange.sgml
@@ -64,7 +64,7 @@
<warning id="licensing">
<title>Exchange Client Licenses</title>
<para>
- Each user will need a valid Microsoft <application>Exchange</application>2000 server
+ Each user will need a valid Microsoft Exchange 2000 server
account and license.
</para>
</warning>
@@ -110,7 +110,7 @@
</para>
<variablelist>
<varlistentry>
- <term>Viewing Mail in <application>Exchange</application>Folder</term>
+ <term>Viewing Mail in Exchange Folder</term>
<listitem>
<para></para>
</listitem>
@@ -123,8 +123,8 @@
protocol to send email. Make sure that the address
you have entered as your email address is exactly
the one that the Exchange server has on file. This
- may be "yourname@exchange-server.ximian.com" rather
- than "yourname@ximian.com.a"
+ may be "yourname@exchange-server.xyzcorp.com" rather
+ than "yourname@xyzcorp.com."
</para>
</listitem>
</varlistentry>
@@ -180,7 +180,7 @@
<para>
If you receive a vCard attachment and click
<guibutton>Save in Address Book</guibutton>, it will
- be saved to your <application>Exchange</application>address book.
+ be saved to your <application>Exchange</application> address book.
</para>
</listitem>
</varlistentry>
@@ -243,7 +243,7 @@ There are, however, some features which are not available:
Software</guimenuitem></menuchoice>. Subscribe to the Ximian
Connector for Microsoft Exchange channel, select the Ximian
Connector for Microsoft
- <application>Exchange</application>2000, and click the
+ <application>Exchange</application> 2000, and click the
<guibutton>Install</guibutton> button. You can also install
the Connector by downloading the individual packages from
ftp.ximian.com if you wish.
@@ -259,8 +259,7 @@ There are, however, some features which are not available:
to access the store. When you purchase a Ximian Connector
license, the store will mail you the license file with
instructions for installation. Once installed, the license file
- unlocks the Ximian Connector functionality and you may connect
- to an <application>Exchange</application>server.
+ unlocks the Ximian Connector functionality.
</para>
</sect1>
@@ -268,8 +267,27 @@ There are, however, some features which are not available:
<title>Configuration</title>
<para>
Once you have installed the Connector, you need to set up access
- for your <application>Exchange</application>account on both the
- <application>Exchange</application>server and within Evolution.
+ for your <application>Exchange</application> account on both the
+ <application>Exchange</application> server and within
+ Evolution. If you are not sure of the information you need to
+ set up your Exchange account, ask your system administrator, or
+ use the Ximian Connector Tester utility, which is installed
+ alongside the Ximian Connector. To start it, select
+ <menuchoice>
+ <guimenu>
+ Programs
+ </guimenu>
+ <guisubmenu>
+ Internet
+ </guisubmenu>
+ <guimenuitem>
+ Ximian Connector Tester
+</guimenuitem>
+</menuchoice> or run the command <command>connect-test</command> in a
+terminal window. The utility will help you determine if your Exchange
+server is compatible with the Ximian Connector, and locate your Active
+Directory server. Armed with that information, you'll be ready to set
+up a new account on your Exchange server and get to work.
</para>
<sect2 id="config-server">
@@ -278,14 +296,14 @@ There are, however, some features which are not available:
Check with your system administrator to ensure that:
<itemizedlist>
<listitem>
- <para>
- You have a valid account on the <application>Exchange</application>server.
+ <para> You have a valid account on the
+ <application>Exchange</application> server.
</para>
</listitem>
<listitem>
<para> You are permitted to access the account with
WebDAV. This is the default setting for the
- <application>Exchange</application>server, so unless
+ <application>Exchange</application> server, so unless
your system administrator has specifically turned it
off, no changes should be necessary.
</para>
@@ -296,13 +314,14 @@ There are, however, some features which are not available:
The Ximian website knowledge base, at <ulink type="http"
url="http://support.ximian.com">support.ximian.com</ulink>,
has additional information about checking to make sure that
- your <application>Exchange</application>server will accept
+ your <application>Exchange</application> server will accept
connections from Ximian Evolution.
</para>
</sect2>
<sect2 id="config-client">
- <title>Evolution Settings for Connecting to an <application>Exchange</application>Server</title>
+ <title>Evolution Settings for Connecting to an
+ Exchange Server</title>
<para>
Once you know that your server is ready for you to connect, start
@@ -593,24 +612,24 @@ There are, however, some features which are not available:
</sect1>
<sect1 id="access">
- <title>Accessing the <application>Exchange</application>Server</title>
+ <title>Accessing the Exchange Server</title>
<para>
Like IMAP and LDAP data, information for
- <application>Exchange</application>accounts is stored on the
+ <application>Exchange</application> accounts is stored on the
server, not on your desktop computer. This means that you can
access it from multiple locations. It also means that your
- Microsoft <application>Exchange</application>account information
- is in a seperate folder tree from the <guilabel>Local</guilabel>
- tree in your folder bar. You'll see it below the local tree,
- with the name you gave the account. If you have multiple
- accounts, you will have multiple folder trees.
+ Microsoft <application>Exchange</application> account
+ information is in a seperate folder tree from the
+ <guilabel>Local</guilabel> tree in your folder bar. You'll see
+ it below the local tree, with the name you gave the account. If
+ you have multiple accounts, you will have multiple folder trees.
</para>
<para>
Click on any of the folder tree items to visit them; you may
have to enter your server password. You can now create contact
cards, send and receive email as you would normally. If there
are items in your local calendar or addressbook that you'd like
- to add to your <application>Exchange</application>stores, you
+ to add to your <application>Exchange</application> stores, you
can copy and paste them over, or just drag items from one folder
to another as you would with two local stores.
</para>
@@ -646,9 +665,9 @@ There are, however, some features which are not available:
<title>Taking Full Advantage of the Exchange Server When Scheduling Appointments</title>
<para>
When you schedule a meeting with your calendar on the
- <application>Exchange</application>server, you can check when
+ <application>Exchange</application> server, you can check when
other local Exchange users are busy according to their
- <application>Exchange</application>calendars. To do so:
+ <application>Exchange</application> calendars. To do so:
</para>
<figure>
<title>Scheduling With Free/Busy Information</title>
@@ -705,4 +724,6 @@ There are, however, some features which are not available:
</para>
</tip>
</sect1>
-</chapter> \ No newline at end of file
+</chapter>
+
+
diff --git a/help/C/usage-mail-org.sgml b/help/C/usage-mail-org.sgml
index e933d6a033..35b78d1f7a 100644
--- a/help/C/usage-mail-org.sgml
+++ b/help/C/usage-mail-org.sgml
@@ -12,8 +12,7 @@
<sect1 id="importing-mail-and-settings">
<title>Importing Your Old Email and Settings</title>
<para>
-
- <application>Evolution</application> allows you to import your old
+ <application>Evolution</application> allows you to import old
email and data so that you don't need to worry about losing your
old information.
</para>
@@ -27,7 +26,7 @@
<term>VCard (.vcf, gcrd):</term>
<listitem>
<para>
- The addressbook format used by GNOME, KDE, and
+ The addressbook format used by the GNOME, KDE, and
many other contact management applications. You
should be able to export to VCard format from any
address book application.
@@ -74,16 +73,12 @@
<orderedlist numeration="arabic">
<listitem>
<para>
- Click <menuchoice>
- <guimenu>File</guimenu>
- <guimenuitem>Import</guimenuitem>
- </menuchoice>.
+ Click <menuchoice><guimenu>File</guimenu><guimenuitem>Import</guimenuitem></menuchoice>.
</para>
</listitem>
<listitem>
<para>
- Click <guibutton>Next</guibutton> after reading the
- Welcome screen.
+ Click <guibutton>Next</guibutton> after reading the Welcome screen.
</para>
</listitem>
<listitem>
@@ -93,8 +88,7 @@
</listitem>
<listitem>
<para>
- Find the file that you wish to import into
- <application>Evolution</application>.
+ Find the file that you wish to import into <application>Evolution</application>.
</para>
</listitem>
<listitem>
@@ -118,11 +112,7 @@
<orderedlist numeration="arabic">
<listitem>
<para>
- Click
- <menuchoice>
- <guimenu>File</guimenu>
- <guimenuitem>Import</guimenuitem>
- </menuchoice>.
+ Click <menuchoice><guimenu>File</guimenu><guimenuitem>Import</guimenuitem></menuchoice>.
</para>
</listitem>
<listitem>
@@ -137,38 +127,34 @@
</listitem>
<listitem>
<para>
- The left-most column shows the application from which
- your information will be imported from. Then, select
+ The left-most column shows the application which your
+ information will be imported from. You then select
checkboxes on each component to import different
properties of each application.
</para>
</listitem>
<listitem>
<para>
- Click <guibutton>Next</guibutton>.
+ Click <guibutton>Next</guibutton>
</para>
</listitem>
<listitem>
<para>
- Click <guibutton>Import</guibutton>.
+ Click <guibutton>Import</guibutton>
</para>
</listitem>
</orderedlist>
</para>
+
<para>
<note>
<title>Microsoft Outlook and Outlook Express Users</title>
<para>
Microsoft Outlook, and versions of Outlook Express after
- version 4, use proprietary formats that
- <application>Ximian Evolution</application> cannot read or
- import. For contacts, you may wish to consider using
- OutPort, a third-party conversion tool. Ximian does not
- support OutPort but you can find more information about it
- at <ulink
- url="http://www.cyberus.ca/~phoenix/outport/">the Outport
- homepage.</ulink> For email, there is a more simple
- workaround:
+ version 4, use proprietary formats that <application>Ximian
+ Evolution</application> cannot read or import. For contacts,
+ you may have to email them to yourself and import them that
+ way. For email, there is a simpler workaround:
<orderedlist numeration="arabic">
<listitem>
@@ -190,7 +176,7 @@
<para>
Use the <application>Ximian Evolution</application> import
tool to import the files. There's more information about
- why this works, and how, at the <ulink url="http://support.ximian.com">Ximian support website</ulink>.
+ why this works, and how, at the Ximian support website.
</para>
</listitem>
</orderedlist>
@@ -207,6 +193,7 @@
the messages in your Trash folders.
</para>
</note>
+
</para>
</sect2>
@@ -525,11 +512,11 @@
looking for messages less than two days old.
</para></listitem>
- <listitem><para> Date Received - This works the same
- way as the <guilabel>Date Sent</guilabel> option,
- except that it compares the time you got the
- message with the dates you specify.
- </para></listitem>
+ <listitem><para>
+ Date Received - This works the same way as the <guilabel>Date Sent</guilabel>
+ option, except that it compares the time you got the message
+ with the dates you specify.
+ </para></listitem>
<listitem><para>
Score - Emails have a standard priority range from -3 (least
diff --git a/help/C/usage-mail.sgml b/help/C/usage-mail.sgml
index 70bc78bd1d..aa834c4b54 100644
--- a/help/C/usage-mail.sgml
+++ b/help/C/usage-mail.sgml
@@ -15,7 +15,8 @@
them. Read <xref linkend="usage-mail-subscriptions"> to find out
how.
</para>
- </note>
+ </note>
+
<sect1 id="usage-mail-getnsend-read">
<title>Reading Mail</title>
@@ -119,16 +120,15 @@
When you press <guibutton>Delete</guibutton> or click
the trash button, your mail isn't actually deleted,
but is marked for deletion. Your email is not gone
- until you have <glossterm
- linkend="expunge">expunged</glossterm> it. When you
- expunge a folder, you remove all the mail that you
- have marked for deletion.
+ until you have expunged it. When you "Expunge" a
+ folder, you remove all the mail that you have marked
+ for deletion.
</para>
<para>
If you don't like this behavior, select
<menuchoice><guimenu>View</guimenu><guimenuitem>Hide
- Deleted Messages</guimenuitem></menuchoice>.
- You will only see deleted messages when you look in
+ Deleted Messages</guimenuitem></menuchoice>. Then,
+ you will only see deleted messages when you look in
your <guilabel>Trash</guilabel> folder.
</para>
</note>
@@ -152,7 +152,7 @@
<note>
<title>Trash is Actually a vFolder?</title>
<para>
- Both local and IMAP Trash folders are actually vFolders that
+ Both local and IMAP Trash folders are actually vFolders that
display all messages you have marked for later deletion.
For more information about vFolders, see <xref
linkend="usage-mail-organize-vfolders">. Since emptying
@@ -162,6 +162,12 @@
same as expunging deleted mail from <emphasis>all</emphasis>
your folders.
</para>
+ <para>
+ This is not, however, true for the Trash folder on Exchange
+ servers, which behaves just the same as it would in
+ Outlook. That is to say, the Trash folder on an Exchange
+ server is a normal folder with actual messages in it.
+ </para>
</note>
</sect2>
<sect2 id="usage-mail-getnsend-undelete">
@@ -190,7 +196,7 @@
<title>What does Undelete actually do?</title>
<para>
If you have marked a message for deletion, undeleting
- it will unmark it and the message will be removed
+ it will unmark it, and the message will be removed
from the Trash folder. However, it can't bring back
messages that have been expunged.
</para>
@@ -216,17 +222,17 @@
<itemizedlist>
<listitem>
<para>
- Your personal information.
+ your personal information
</para>
</listitem>
<listitem>
<para>
- Your outgoing email server information.
+ your outgoing email server information
</para>
</listitem>
<listitem>
<para>
- Your mail account identity name.
+ your mail account identity name
</para>
</listitem>
</itemizedlist>
@@ -242,52 +248,54 @@
<title>Can't Check Mail?</title>
<para>
If you get an error message instead of mail, you probably need
- to check your network settings. For more information on your
- network seeings, refer to <xref linkend="config-prefs-mail">,
- or ask your system administrator.
+ to check your network settings. To learn how to do that, have
+ a look at <xref linkend="config-prefs-mail">, or ask your
+ system administrator.
</para>
</note>
- <tip>
- <title>Sharing Mailboxes with Other Mail Programs</title>
- <para>
- If you want to use <application>Evolution</application>
- and another email client, such as
- <application>Mutt</application>, at the same time,
- here's how:
- <orderedlist numeration="arabic">
- <listitem>
- <para>
- Download your mail in the other application as
- you would normally.
- </para>
- </listitem>
- <listitem>
- <para>
- In <application>Evolution</application>
- <menuchoice><guimenu>Tools</guimenu><guimenuitem>Mail
- Settings</guimenuitem></menuchoice>, and pick the account
- you'd like to use to share mail. You may want to
- create a new account just for this source of
- mail.
- </para>
- </listitem>
- <listitem>
- <para>
- Under the <guilabel>Receiving Mail</guilabel>
- tab, select the type of mail file that your
- other mail application uses, and then enter the
- full path to that file.
- </para>
- </listitem>
- <listitem>
- <para>
- Click the <guibutton>OK</guibutton> button.
- </para>
- </listitem>
- </orderedlist>
- </para>
- </tip>
+
+
+ <tip>
+ <title>Sharing Mailboxes with Other Mail Programs</title>
+ <para>
+ If you want to use <application>Evolution</application>
+ and another email client, such as
+ <application>Mutt</application>, at the same time,
+ here's how:
+ <orderedlist numeration="arabic">
+ <listitem>
+ <para>
+ Download your mail in the other application as
+ you would normally.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ In <application>Evolution</application>
+ <menuchoice><guimenu>Tools</guimenu><guimenuitem>Mail
+ Settings</guimenuitem></menuchoice>, and pick the account
+ you'd like to use to share mail. You may want to
+ create a new account just for this source of
+ mail.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Under the <guilabel>Receiving Mail</guilabel>
+ tab, select the type of mail file that your
+ other mail application uses, and then enter the
+ full path to that file.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Click the <guibutton>OK</guibutton> button.
+ </para>
+ </listitem>
+ </orderedlist>
+ </para>
+ </tip>
<!-- NOT FOR 1.0
@@ -307,93 +315,90 @@
-->
<sect2 id="usage-mail-getnsend-get-attach">
- <title>Working with Attachments and HTML Mail</title>
- <para>
- If someone sends you an <glossterm linkend="attachment">attachment</glossterm>,
- a file attached to an email,
- <application>Evolution</application> will display the file
- at the bottom of the message to which it's attached. Text,
- including HTML formatting and embedded images, will appear
- as part of the message, rather than at the end of the
- message as an attachment.
- </para>
+ <title>Working with Attachments and HTML Mail</title>
+ <para>
+ If someone sends you an <glossterm linkend="attachment">attachment</glossterm>,
+ a file attached to an email,
+ <application>Evolution</application> will display the file
+ at the bottom of the message to which it's attached. Text,
+ including HTML formatting and embedded images, will appear
+ as part of the message, rather than at the end of the
+ message as an attachment.
+ </para>
<sect3 id="usage-mail-getnsend-get-attach-actions">
- <title>Saving or Opening Attachments</title>
- <para>
- If you get an attachment with an email message,
- <application>Ximian Evolution</application> can help you save
- it or open it with the appropriate applications.
- </para>
- <para>
- To save an attachment to disk:
- <orderedlist numeration="arabic">
- <listitem>
- <para>
- Click the downward pointing arrow on the attachment icon
- and select <guimenuitem>Save to Disk</guimenuitem>.
- </para>
- </listitem>
- <listitem>
- <para>
- Choose a location and name for the file.
- </para>
- </listitem>
- <listitem>
- <para>
- Click <guibutton>OK</guibutton>.
- </para>
- </listitem>
- </orderedlist>
- </para>
-
- <para>
- To Open an Attachment in a Program:
- <orderedlist numeration="arabic">
- <listitem>
- <para>
- Open the mail message with the attachment you want to read.
- </para>
- </listitem>
- <listitem>
- <para>
- Click the arrow next the attachment icon.
- </para>
- </listitem>
- <listitem>
- <para>
- Select the program you'd like to use. It will start up
- and open the document.
- </para>
- </listitem>
- </orderedlist>
- </para>
- <para>
- </para>
+ <title>Saving or Opening Attachments</title>
+ <para>
+ If you get an attachment with an email message,
+ <application>Ximian Evolution</application> can help you save
+ it or open it with the appropriate applications.
+ </para>
+ <para>
+ To save an attachment to disk:
+ <orderedlist numeration="arabic">
+ <listitem>
+ <para>
+ Click the downward pointing arrow on the attachment icon
+ and select <guimenuitem>Save to Disk</guimenuitem>.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Choose a location and name for the file.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Click <guibutton>OK</guibutton>.
+ </para>
+ </listitem>
+ </orderedlist>
+ </para>
+
+ <para>
+ To Open an Attachment in a Program:
+ <orderedlist numeration="arabic">
+ <listitem>
+ <para>
+ Open the mail message with the attachment you want to read.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Click the arrow next the attachment icon.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Select the program you'd like to use. It will start up
+ and open the document.
+ </para>
+ </listitem>
+ </orderedlist>
+ </para>
+ <para>
+ </para>
</sect3>
-
+
<sect3 id="usage-mail-getnsend-get-attach-html">
- <title>Inline Images in HTML Mail</title>
- <para>
- When someone sends you HTML mail that includes an image in
- the body of the message (for example, the welcome message in your
- Inbox when you first start <application>Ximian
- Evolution</application>) <application>Evolution</application>
- will display the image inside the message. You can create
- messages like this by using the
- <menuchoice>
- <guimenu>Insert</guimenu>
- <guimenuitem>Image</guimenuitem>
- </menuchoice>
- tool in the message composer.
- </para>
+ <title>Inline Images in HTML Mail</title>
+ <para>
+ When someone sends you HTML mail that includes an image in
+ the body of the message (for example, the welcome message in your
+ Inbox when you first start <application>Ximian
+ Evolution</application>) <application>Evolution</application>
+ will display the image inside the message. You can create
+ messages like this by using the
+ <menuchoice><guimenu>Insert</guimenu><guimenuitem>Image</guimenuitem></menuchoice>
+ tool in the message composer.
+ </para>
<para>
- If the image isn't included in the message, but is
+ If the image isn't included in the message, but is, instead,
a link to an image, <application>Evolution</application> can
- download the image from the Internet for you. By default,
- <application>Evolution</application> will not display the image.
- This is because remotely hosted
+ download the image from the Internet for you. However,
+ <application>Evolution</application> will not display the
+ image unless you ask it to. This is because remotely hosted
images can be slow to load and display, and can even be used
by spammers to track who reads their email. Having images
not load automatically helps protect your privacy.
@@ -425,14 +430,14 @@
through the Summary tool. You can tell the GNOME Virtual
File System about your HTTP proxy in one of two ways:
<variablelist>
- <varlistentry>
+ <varlistentry>
<term>Configure it with Nautilus</term>
<listitem>
<para>
<orderedlist numeration="arabic">
<listitem>
<para>
- Open a Nautilus window.
+ Open a Nautilus window
</para>
</listitem>
<listitem>
@@ -508,20 +513,18 @@
</sect2>
</sect1>
- <sect1 id="usage-mail-getnsend-send">
- <title>Composing New Email Messages</title>
- <para>
- You can start writing a new email message by selecting
- <menuchoice>
- <guimenu>File</guimenu>
- <guisubmenu>New</guisubmenu>
- <guimenuitem>Mail Message</guimenuitem>
- </menuchoice>, or by pressing the
- <guibutton>Compose</guibutton> button in the Inbox toolbar.
- When you do so, the <interface>New Message</interface> window
- will open, as shown in <xref
- linkend="usage-mail-newmsg-fig">.
- </para>
+ <sect1 id="usage-mail-getnsend-send">
+ <title>Composing New Email Messages</title>
+ <para>
+ You can start writing a new email message by selecting
+ <menuchoice> <guimenu>File</guimenu>
+ <guisubmenu>New</guisubmenu> <guimenuitem>
+ Mail Message</guimenuitem></menuchoice>, or by pressing the
+ <guibutton>Compose</guibutton> button in the Inbox toolbar.
+ When you do so, the <interface>New Message</interface> window
+ will open, as shown in <xref
+ linkend="usage-mail-newmsg-fig">.
+ </para>
<!-- ==============Figure=================================== -->
<figure id="usage-mail-newmsg-fig">
@@ -621,12 +624,12 @@
<orderedlist numeration="arabic">
<listitem>
<para>
- Push the attach button in the composer toolbar.
+ Push the attach button in the composer toolbar
</para>
</listitem>
<listitem>
<para>
- Select the file you want to attach.
+ Select the file you want to attach
</para>
</listitem>
<listitem>
@@ -641,19 +644,19 @@
attach it as well.
</para>
<para>
- To hide the display of files you've attached to the
- message, select <menuchoice>
+ To hide the display of files you've attached to the
+ message, select <menuchoice>
<guimenu>View</guimenu> <guimenuitem>Hide
- Attachments</guimenuitem> </menuchoice>; to show them
- again, choose <guimenuitem>Show Attachments</guimenuitem>.
+ Attachments</guimenuitem> </menuchoice>; to show them
+ again, choose <guimenuitem>Show Attachments</guimenuitem>.
</para>
<para>
- When you send the message, a copy of the attached file
- will go with it. Be aware that big attachments can take a
- long time to download.
+ When you send the message, a copy of the attached file
+ will go with it. Be aware that big attachments can take a
+ long time to download.
</para>
- </sect3>
-
+ </sect3>
+
<sect3 id="usage-mail-getnsend-send-to-types">
<title>Specifying Recipients for Email</title>
<para>
@@ -1606,7 +1609,7 @@
</para>
</sect2>
<sect2 id="fancy-mail">
- <title>Improving Email Appearance with HTML</title>
+ <title>Making Your Email More Fancy</title>
<para>
<application>Evolution</application> can do a lot with email
by utilizing the HTML features. Making an email functional
@@ -1625,8 +1628,7 @@
<title>Indented Text with Headlines</title>
<screenshot>
<screeninfo></screeninfo>
- <graphic format="png" fileref="figures/outline"
- srccredit="Kevin Breit">
+ <graphic format="png" fileref="figures/outline" srccredit="Kevin Breit">
</screenshot>
</figure>
</para>
@@ -1637,13 +1639,12 @@
following content indented.
</para>
<para>
- Making your headlines a larger size instead of bold can help
- as well. Header size 4 is often the best alternative for
- bold. You can change your text to size 4 by selecting it and
- pressing <keycombo
- action="simul"><keycap>Ctrl</keycap><keycap>4</keycap></keycombo>,
- and change it back to normal size with <keycombo
- action="simul"><keycap>Ctrl</keycap><keycap>0</keycap></keycombo>.
+ You may want to increase the size of your section headlings
+ instead of merely putting them in bold. Header size 4 is
+ often the best choice, since it is not too large. You can
+ change your text to size 4 by selecting it and pressing
+ Ctrl+4. You can set your text to the normal text size by
+ hitting Ctrl+0.
</para>
</sect3>
<sect3 id="bulleted-lists">
@@ -1662,24 +1663,25 @@
<sect3 id="inline-images">
<title>Images In Your Email</title>
<para>
- Another way to improve the appearance of messages is to add
- images to them. Especially if you want to discuss a
- particular image in the message, the the HTML picture frame
- template in <application>Evolution</application>, as it
- looks good and has captions below it.
+ Images can help people to understand your point. You can
+ even use a HTML Picture Frame Template in
+ <application>Evolution</application>, which looks very
+ attractive and sets your image off from the rest of your
+ message with a border and caption.
</para>
<para>
If you do choose to use images, try to keep them narrow. If
your images are wider than 400 pixels, the image may not fit
in the whole email window, making it hard for your reader to
- read the email and view the image. Instead, you should
- consider using a thumbnail and creating a link on the image
- which opens a browser with the full image.
+ read the email and view the image. Consider using a smaller
+ version ("thumbnail") of your image, and offering a link to
+ the larger version your readers can view in a web browser if
+ they want.
<figure>
<title>Images in an email</title>
<screenshot>
<screeninfo></screeninfo>
- <graphic format="png" fileref="small_desktop" srccredit="Kevin Breit">
+ <graphic format="png" fileref="figures/small_desktop" srccredit="Kevin Breit">
</screenshot>
</figure>
</para>
@@ -1687,10 +1689,9 @@
<sect3 id="color-suggestions">
<title>Coloring Your Text</title>
<para>
- Colors can help bring words or sentences out for emphasis.
- You should choose your colors carefully though, because the
- wrong color can be distracting. Some good colors to use
- are:
+ Colors can help bring words or sentences out for emphasis. You
+ should choose your colors carefully though, as the wrong color
+ can be distracting. Some good colors to use would be:
<itemizedlist>
<listitem>
<para>
@@ -1708,91 +1709,11 @@
</para>
</listitem>
</itemizedlist>
- <!-- Include a screenshot -->
-
- All of these colors are of a similar level of saturation and are
- easy to read on a white background.
-
- </para>
- </sect3>
- <sect3 id="signature-howto">
- <title>HTML Signatures in Your Email</title>
- <para>
- The last few lines of an email message are often devoted to
- a signature block, typically a few lines of text appended
- automatically to every email by the mail program itself. You
- can use the signature to add your address and any other
- contact information you think is important, or simply to
- provide an amusing or interesting closing line for your
- message. <application>Evolution</application> gives you the
- option of designing your signatures in HTML or in plain
- text.
+ <!-- Include a screenshot -->
+ Notice how these colors are similar saturation <!-- Confirm I am using the right word -->
</para>
<para>
- To set up an HTML signature:
- <orderedlist numeration="arabic">
- <listitem>
- <para>
- Click
- <menuchoice>
- <guimenu>Tools</guimenu>
- <guimenuitem>Mail Settings</guimenuitem>
- </menuchoice>
- while in the mail component.
- </para>
- </listitem>
- <listitem>
- <para>
- Select the account you wish to associate the signature
- to and click <guibutton>Edit</guibutton>.
- </para>
- </listitem>
- <listitem>
- <para>
- At the bottom you'll see a field for a <guilabel>HTML
- Signature</guilabel>. Click the box next to it to
- enable a signature.
- </para>
- </listitem>
- <listitem>
- <para>
- If you have a pre-made signature, click the
- <guibutton>Browse</guibutton> to select your
- signature. You can find pre-made signatures at <ulink
- url="http://www.ximian.com/devzone/projects/art/signatures.html">the
- Ximian signature page</ulink>.
- </para>
- </listitem>
- <listitem>
- <para>
- If you are creating a new signature, click the
- <guibutton>Edit</guibutton> button to open up the HTML
- signature editor.
- </para>
- </listitem>
- <listitem>
- <para>
- The HTML signature editor uses the same interface as
- the composer. You can create your signature in this
- window.
- </para>
- </listitem>
- <listitem>
- <para>
- Once you have completed your signature, click
- <menuchoice>
- <guimenu>File</guimenu>
- <guimenuitem>Save and Close</guimenuitem>
- </menuchoice>
- </para>
- </listitem>
- <listitem>
- <para>
- When you select your mail to be composed in HTML
- format, your HTML signature will automatically show up.
- </para>
- </listitem>
- </orderedlist>
+ Happy mailing!
</para>
</sect3>
</sect2>
@@ -1973,7 +1894,7 @@
</para>
<example>
- <title>Sending an Encrypted Message</title>
+ <title>Sending an Encrypted Messagee</title>
<para>
Kevin wants to send an encrypted message to his friend
Rachel. He looks up her public key on a general key
@@ -1988,8 +1909,7 @@
<tip id="always-sign">
<title>Always Sign</title>
<para>
- You can set <application>Evolution</application> to always
- sign your email messages:
+ You can set <application>Evolution</application> to always sign your email messages:
<orderedlist numeration="arabic">
<listitem>
<para>
@@ -2003,8 +1923,7 @@
</listitem>
<listitem>
<para>
- Click the <guibutton>Always sign outgoing messages
- when using this account</guibutton> button.
+ Click the <guibutton>Always sign outgoing messages when using this account</guibutton> button.
</para>
</listitem>
</orderedlist>
@@ -2044,8 +1963,7 @@
<listitem>
<para>
Choose a key length. The default, 1024 bits, should be
- long enough, and 2048 bits is considered very strong
- indeed.
+ long enough.
</para>
</listitem>
@@ -2241,4 +2159,4 @@ wwwkeys.pgp.net 32j38dk2</command>. Substitute your key ID for
</para>
</sect2>
</sect1>
-</chapter> \ No newline at end of file
+</chapter>
diff --git a/help/C/usage-mainwindow.sgml b/help/C/usage-mainwindow.sgml
index 99d914422b..d05a6dd0ba 100644
--- a/help/C/usage-mainwindow.sgml
+++ b/help/C/usage-mainwindow.sgml
@@ -133,8 +133,8 @@
<sect2 id="second-step">
<title>Receiving Email</title>
<para>
- The <guilabel>Receiving Email</guilabel> lets you determine
- which you will get your email.
+ The <guilabel>Receiving Email</guilabel> step lets you configure
+ receiving email people have sent you.
<itemizedlist>
<listitem>
<para>
@@ -151,6 +151,7 @@
permanent storage.
</para>
</listitem>
+
<listitem>
<para>
Microsoft Exchange: Available only if you have
@@ -162,7 +163,6 @@
</para>
</listitem>
-
<listitem>
<para>
IMAP: Keeps the email on your server so you can
@@ -174,8 +174,9 @@
<para>
Standard Unix mbox spools: If you want to read and
store mail in the mail spool on your local system,
- choose this option. You'll need to provide the
- path to the mail spool you want to use.
+ choose this option. You'll need
+ to provide the path to the mail spool you want to
+ use.
</para>
</listitem>
@@ -319,9 +320,9 @@
</listitem>
<listitem>
- <para>Create a Global Address List folder: If you want to
- use your organization's Active Directory or Global Address
- List, leave this box checked. </para>
+ <para>Create a Global Address List folder: If you would
+ like to have a separate folder for the Active Directory's
+ Global Address List, leave this box checked. </para>
</listitem>
<listitem>
@@ -381,14 +382,15 @@
server: If you'd like your filters to work on this account
as well as on locally downloaded mail, check this box.</para>
</listitem>
+
+
</itemizedlist>
</para>
- </listitem>
- </varlistentry>
- </variablelist>
+ </listitem>
+ </varlistentry>
+ </variablelist>
<note id="imap-namespace">
- <note id="imap-namespace">
<title>What's an IMAP Namespace?</title>
<para>
For IMAP mail servers, your sysadmin may provide
@@ -429,9 +431,9 @@
<para>
Microsoft Exchange: Sends mail through a Microsoft
Exchange server using the Microsoft Exchange 2000
- protocol. Available only if you have are using the
- Ximian Connector for Microsoft Exchange. You must
- have a valid license key purchased from <ulink
+ protocol. Available only if you have purchased the
+ Ximian Connector for Microsoft Exchange from
+ <ulink
url="http://store.ximian.com">store.ximian.com</ulink>.
</para>
</listitem>
@@ -464,12 +466,11 @@
</listitem>
<listitem>
<para>
- Authentication Type: Unless you've been told otherwise,
- your best bet is to leave this set at
+ Authentication Type: Chances are you are using
<guilabel>Password</guilabel>. If you're not sure, ask
your system administrator or ISP, or have
- <application>Ximian Evolution</application> check for
- you by clicking <guibutton>Check for supported
+ <application>Ximian Evolution</application> check for you by
+ clicking <guibutton>Check for supported
types</guibutton>.
</para>
</listitem>
@@ -619,11 +620,11 @@ the workaround described in the note below.
<sect2 id="mutt">
<title>Importing Mail from mutt</title>
<para>
- <application>mutt</application> is a text-based mail client
- which is shipped with many Linux and Unix distributions.
+ <application>mutt</application> is a full-featured mail client
+ which is shipped with most Linux and Unix distributions.
<application>mutt</application> uses the standard mbox,
- maildir, and MH file formats, which makes importing your mail
- into <application>Evolution</application> easy. By default,
+ maildir, and MH file formats, which makes importing your mail into
+ <application>Evolution</application> easy. By default,
<application>mutt</application> uses the mbox file format.
<orderedlist numeration="arabic">
<listitem>
@@ -678,9 +679,9 @@ the workaround described in the note below.
<sect2 id="kmail">
<title>Importing Mail from KMail</title>
<para>
- KMail is the mail client which is shipped with the KDE desktop
- environment. KMail uses the standard mbox file format, which
- means that importing your mail into
+ KMail is a mail client which is shipped with the
+ KDE desktop environment. KMail uses the standard mbox file
+ format, which means that importing your mail into
<application>Evolution</application> is easy.
<orderedlist numeration="arabic">
<listitem>
diff --git a/help/C/usage-print.sgml b/help/C/usage-print.sgml
index c36a53fe2a..2ef026e2f1 100644
--- a/help/C/usage-print.sgml
+++ b/help/C/usage-print.sgml
@@ -1,19 +1,19 @@
<chapter id="usage-print">
<title>Printing with Evolution</title>
<para>
- If you've printed from most any other
- <application>Gnome</application> application, you should be able
- to print from <application>Evolution</application> without much
- trouble.
+ Like most GNOME applications, <application>Evolution</application> uses
+ the gnome-print system, so if you've used any other GNOME
+ application to print, you should be able to print from
+ <application>Evolution</application> immediately.
</para>
<para>
Whether you're printing a message, a calendar page, or a selection
- of address cards, you can choose to print directly to a printer,
- or save the print output to a <glossterm
- linkend="postscript">postscript</glossterm> file. You can also
- use the preview feature to see how your printed output will look.
+ of address cards, you can choose to print directly to a printer, or
+ save the print output to a postscript file. You can also use the
+ preview feature to see how your printed output will look.
</para>
+
<sect1 id="printpreview">
<title>Print Preview</title>
<para>
diff --git a/help/ChangeLog b/help/ChangeLog
index 20a7d26acd..122c581499 100644
--- a/help/ChangeLog
+++ b/help/ChangeLog
@@ -1,207 +1,37 @@
-2002-04-04 Ettore Perazzoli <ettore@ximian.com>
-
- * C/Makefile.am: Remove bogus EXTRA_DIST with sgmldocs.make.
- Problem pointed out by Richard Boulton <richard@tartarus.org>.
-
-2002-03-27 JP Rosevear <jpr@ximian.com>
-
- * C/Makefile.am: end the line properly
-
-2002-03-27 Aaron Weber <aaron@ximian.com>
-
- * C/topic.dat: add from branch.
- * C/figures/*: merge from branch
- * C/usage-calendar.sgml: merge from branch
- * C/usage-mail.sgml: merge from branch
- * C/usage-mail-org.sgml: merge from branch
- * C/Makefile.am: changes from other branch
- * C/usage-print.sgml: merge from branch
- * C/usage-exchange.sgml: merge from branch
- * C/usage-mail.sgml: merge from evolution-1-0-branch branch.
-
2002-03-25 Kevin Breit <mrproper@ximian.com>
- * C/usage-mail.sgml: Added mention that 2048 maybe recommended by
- some people. Fixed a typo.
-
-2002-03-23 Kevin Breit <mrproper@ximian.com>
-
- * C/usage-print.sgml: I fixed a typo which caused the
- documentation to not build.
-
-2002-03-14 Kevin Breit <mrproper@ximian.com>
-
- * C/usage-mail-org.sgml: Did some basic cleanup.
-
- * C/usage-mail.sgml: Linked "expunge" to the glossary.
- Made some basic grammar changes.
- Reindented a whole lot of things.
-
- * C/apx-gloss.sgml: Added Postscript as a glossary definition.
-
- * C/usage-print.sgml: Changed the introduction of this. Do users
- really care about gnome-print? Linked the Postscript line to the
- glossary.
-
- * C/usage-mail.sgml: Pulled warning about the HTML mail stuff.
-
-2002-03-12 Kevin Breit <mrproper@ximian.com>
-
- * C/usage-mail.sgml: Replaced "png" with "PNG". This shouldn't
- break the SGML build and it's a slow start to the XML porting
- process. Included information about how to create an HTML
- signature.
-
-2002-03-11 Kevin Breit <mrproper@ximian.com>
-
- * C/usage-mail.sgml: Redid wording on a title, minute change.
- Fix indenting.
+ * C/evolution-C.omf: Changed title from "The Evolution Manual" to "Evolution Manual".
-2002-02-10 Kevin Breit <mrproper@ximian.com>
+2002-03-22 Kevin Breit <mrproper@ximian.com>
- * C/evolution-C.omf: Removed "The" from title.
-
-2002-02-06 Aaron Weber <aaron@ximian.com>
-
- * C/Makefile.am: added
- C/figures/schedule.png,exchange-identity.png exchange-receive.png,
- exchange-receive-options.png
-
- * C/usage-exchange.sgml: expanded note about active directory
- server. added screenshot for Free/Busy feature. Doubled the size
- of the config instructions.
-
- * C/figures/schedule.png: New file, screenshot for free/busy feature.
-
- * C/evolution.sgml: added correct copyright years.
-
- * C/usage-mail-org.sgml: warning about INBOX subfolder brokenness.
-
-2002-01-29 Kevin Breit <mrproper@ximian.com>
+ * C/Makefile.am: Added a bunch of figures to figs=
+ Added one more figure. Damn.
+
+2002-03-16 Aaron Weber <aaron@ximian.com>
- * C/config-prefs.sgml: Started writing an LDAP config example
+ * C/usage-mail.sgml: Slight revisions to style.
+
+2002-02-22 Aaron Weber <aaron@ximian.com>
-2002-01-27 Kevin Breit <mrproper@ximian.com>
+ * C/usage-mail.sgml:
- * C/config-prefs.sgml: Added information regarding types of search scopes
+ * C/usage-mainwindow.sgml: validation issue.
- * C/usage-contact.sgml: Fixed some linking brokenness
+ * C/usage-exchange.sgml: spelling, use faker email addresses for
+ examples.
- * C/apx-gloss.sgml: Added Search Base as an entry
- Added Search Scope as an entry
+ * C/usage-calendar.sgml: spelling.
- * C/config-prefs.sgml: Fixed indenting, I guess.
+ * C/usage-mail.sgml: misspelled "receive"
- * C/usage-contact.sgml: Rewrote LDAP introduction paragraph
- Added information about setting up Evolution to use LDAP. It's just a lazy xref.
+ * C/usage-mainwindow.sgml: tm on vfolders, link on
+ support.ximian.com
-2002-01-27 Ettore Perazzoli <ettore@ximian.com>
+2001-11-16 Ettore Perazzoli <ettore@ximian.com>
* sgmldocs.make: Use `-f' instead of `-e' so installation of
topic.dat works on non-GNU systems too.
-2002-01-17 Aaron Weber <aaron@ximian.com>
-
- * C/apx-gloss.sgml: typos.
-
-2002-01-15 Aaron Weber <aaron@ximian.com>
-
- * C/config-prefs.sgml: Redo the whole options/account-creation
- thing.
-
- * C/usage-mainwindow.sgml: Redo the whole options/account-creation
- thing.
-
-2002-01-07 Aaron Weber <aaron@ximian.com>
-
- * C/evolution.sgml: Touched this file but don't think I changed
- it.
-
- * C/usage-calendar.sgml: mention the full-advantage section and
- the exchange features. Expand mention of "autopick" and general
- polish on the appointment-scheduling and peer-to-peer groupware
- functions. Also clarify palm-sync location information. All
- features danw mentioned as critical are now docuemnted.
-
- * C/usage-exchange.sgml: Fix and expand as per Danw's notes about
- Features that need to be documented.
-
-2002-01-04 Aaron Weber <aaron@ximian.com>
-
- * C/usage-exchange.sgml: Revised list of supported/unsupported
- features. Changed installation instructions.
-
-2001-12-21 Aaron Weber <aaron@ximian.com>
-
- * C/usage-exchange.sgml: add notes about server/license
- requirements, revise "your previous options" text to flow more
- smoothly.
-
-2002-01-04 Kevin Breit <mrproper@ximian.com>
-
- * C/usage-mail.sgml: Added a tip about reply-to specification stuff
-
- * C/usage-calendar.sgml: Fixed brokenness
-
-2001-12-27 Kevin Breit <mrproper@ximian.com>
-
- * C/usage-exchange.sgml: Small fix
-
-2001-12-24 Kevin Breit <mrproper@ximian.com>
-
- * C/apx-bugs.sgml: Updated indenting
-
- * C/apx-authors.sgml: Updated my email address
-
- * C/usage-print.sgml: Just, ya know, small change
-
- * C/usage-exchange.sgml: Fixed wording, tags, and indenting
-
-2001-12-22 Kevin Breit <mrproper@ximian.com>
-
- * C/usage-mainwindow.sgml: Added information about importing mutt to Evolution.
- Added a bit of info to the above.
-
-2001-12-20 Kevin Breit <mrproper@ximian.com>
-
- * C/usage-exchange.sgml: Added a <sect1> that discusses features of Connector
-
-2001-12-18 Aaron Weber <aaron@ximian.com>
-
- * C/usage-exchange.sgml: add notes about server requirements.
-
- * C/topic.dat: Changed label of "Connecting to Exchange Servers"
-
-2001-12-18 Kevin Breit <mrproper@ximian.com>
-
- * C/usage-mainwindow.sgml: Added information about importing KMail to Evolution.
-
-2001-12-14 Kevin Breit <mrproper@ximian.com>
-
- * C/apx-gloss.sgml: Slight glossary changes in wording
-
- * C/usage-mail.sgml: Indenting changes, minor reorganization.
-
-2001-12-05 Aaron Weber <aaron@ximian.com>
-
- * C/usage-calendar.sgml: added "meeting-announce" note ("Simple
- meeting announcements").
-
- * C/config-prefs.sgml: Additional links to other portions of the
- document.
-
-2001-11-30 Aaron Weber <aaron@ximian.com>
-
- * C/usage-mail.sgml: Tiny error fix.
-
-2001-11-29 Kevin Breit <mrproper@ximian.com>
-
- * C/usage-mail.sgml: Added more info about pretty emails.
-
-2001-11-28 Kevin Breit <mrproper@ximian.com>
-
- * C/usage-mail.sgml: Added section about how to make your email pretty. I'll add more each day or something.
-
2001-11-14 Ettore Perazzoli <ettore@ximian.com>
[Workaround for Nautilus/Scrollkeeper bug that prevents our SGML
diff --git a/help/devel/executive-summary/evolution-services.hierarchy b/help/devel/executive-summary/evolution-services.hierarchy
deleted file mode 100644
index 37559d819d..0000000000
--- a/help/devel/executive-summary/evolution-services.hierarchy
+++ /dev/null
@@ -1,7 +0,0 @@
-GtkObject
- BonoboObject
- ExecutiveSummaryComponent
- ExecutiveSummaryComponentFactory
- Handle to remote Bonobo::Unknown
- ExecutiveSummaryComponentFactoryClient
- ExecutiveSummaryHtmlView
diff --git a/help/devel/importer/evolution-shell-importer.hierarchy b/help/devel/importer/evolution-shell-importer.hierarchy
deleted file mode 100644
index c46ebdf782..0000000000
--- a/help/devel/importer/evolution-shell-importer.hierarchy
+++ /dev/null
@@ -1,7 +0,0 @@
-GtkObject
- BonoboObject
- BonoboXObject
- EvolutionImporter
- EvolutionImporterListener
- Handle to remote Bonobo::Unknown
- EvolutionImporterClient
diff --git a/help/no/config-encryption.sgml b/help/no/config-encryption.sgml
index e36f17c652..1834a10a86 100644
--- a/help/no/config-encryption.sgml
+++ b/help/no/config-encryption.sgml
@@ -3,66 +3,66 @@
<article>
<sect1 id="encryption-intro">
- <title>What is Encryption?</title>
+ <title>Hva er kryptering?</title>
<para>
- Encryption is an ancient method of changing readable text to unreadable
- text that dates back to Egyptian times. Encryption takes the statement
- "Evolution" and turns it into something which cannot be read without help
- through decryption.
+ Kryptering er en gammel metode for å endre lesbar tekst til ikke-lesbar
+ tekst som kan dateres tilbake til det gamle Egypt. Kryptering tar f.eks.
+ frasen "Evolution" og gjør den om til noe som ikke kan leses før man
+ dekrypterer det.
<example>
- <title>Encryption Example</title>
+ <title>Eksempel på kryptering</title>
<para>
- Kevin orders an <application>Evolution</application> t-shirt from
- Ximian, Inc. over the internet. He puts in his credit card number
- which is 1234-567-8901. For security, his computer encrypts the
- credit card number so it can be safely transmitted over the internet.
- The number now is @#$23ui7yr87#@!48970fsd, which holds no intentional
- resemblance to the inital number. When the information gets to
- Ximian, Inc. it'll be decrypted into the inital number.
+ Kevin bestiller en <application>Evolution</application> t-skjorte fra
+ Ximian, Inc. over Internett. Han legger inn sitt kredittkortnummer
+ som er 1234-567-8901. For sikkerhet skyld krypterer datamaskinen
+ kredittkortnummeret slik at det kan overføres på en sikker måte over
+ Internett. Nummeret er nå @#$23ui7yr87#@!48970fsd, hvilket ikke har
+ noen som helst likhet til det opprinnelige nummeret. Når informasjonen
+ Når Ximian, Inc., vil det bli dekryptert tilbake til det opprinnelige
+ nummeret.
</para>
</example>
- Encryption can be used in email in two ways: to verify that the sender is
- the real sender, and to hide the message while in transmission.
- <application>Evolution</application> has the capability to do both.
+ Kryptering kan brukes i e-post på to måter: for å verifisere at avsender
+ er den virkelige avsenderen, og for å skjule meldingen under overføring.
+ <application>Evolution</application> kan gjøre begge deler.
</para>
</sect1>
<sect1 id="generating-key">
- <title>Generating your PGP key</title>
+ <title>Generering av en PGP-nøkkel</title>
<para>
- First, you need to create a PGP key. To do this, you'll need GPG
- installed.
+ Først må du generere en PGP-nøkkel. For å gjøre dette må du ha GPG
+ installert.
</para>
<tip>
- <title>GPG Versions</title>
+ <title>GPG versjoner</title>
<para>
- This manual covers version 1.0.6 of GPG. If your version is different,
- this may not be entirely accurate. You may find out your version number
- by typing in: <command>gpg --version</command>.
+ Denne håndboken dekker versjon 1.0.6 av GPG. Hvis din versjon er forskjellig,
+ vil denne teksten kanskje ikke være helt korrekt. Du kan finne ut hvilken
+ versjon du har ved å skrive inn: <command>gpg --version</command>.
</para>
</tip>
<para>
- You can start by typing in: <command>gpg --gen-key</command>. At the
- first question, select 1. The next question asks you about key length.
- The longer the key, more stronger it is. However, the longer the key, the
- longer it takes to generate. This is your choice. However, 1024 bits
- (default) should be adequate. The next question asks you if you want your
- key to expire. Expiring keys make your key invalid after a certain amount
- of time, so old keys don't float around active. This is the same concept
- as a coupon at a supermarket. Next, you'll type in your Real name, your
- email address, and a comment. You should not forge this information, as
- it is used later to verify who you are. Assuming that all your
- information is correct, press "O" to continue. GPG now asks you for a
- passphrase. This is a password which you will need to decrypt and encrypt
- messages. This can be any length, with any characters in it. It is case
- sensitive, which means that it does know the difference between capital
- letters and lower-case. Now your key is generated. It is recommend you
- surf the internet, read your email, or write a letter in a word
- processor. This help creates randomness in the key.
+ Du kan starte ved å skrive: <command>gpg --gen-key</command>. Ved første
+ spørsmål, velger du 1. Neste spørsmål gjelder nøkkellengde.
+ Nøkkelen er sterkere jo lengre den er. Men det tar mer tid å generere
+ en nøkkel med flere bits. Dette valget er opp til deg. En 1024 bits
+ nøkkel bør være nok. Neste spørsmål er om du ønsker at din nøkkel skal
+ utgå. Utdatering av en nøkkel medfører at den blir ugyldig etter en
+ viss tid, slik at gamle nøkler ikke er aktive. Dette er det samme konseptet
+ som brukes på matkuponger. Videre må du skrive inn ditt navn, din
+ e-post adresse, og en kommentar. Du bør ikke oppgi feil informasjon, siden
+ den brukes senere for å verifisere din identitet. Hvis all din informasjon
+ er korrekt kan du trykke "O" for å fortsette. GPG spør så etter et
+ passord. Dette er et passord som du trenger for å kryptere og dekryptere
+ meldinger. Dette kan ha valgfri lengde, og bestå av valgfrie tegn. Det
+ skilles mellom store og små bokstaver. Etter dette genereres din nøkkel.
+ Det anbefales at du bruker datamaskinen mens dette skjer fordi aktivitet
+ brukes for å øke tilfeldigheten i nøkkelen.
</para>
<para>
- Once this is completed, you'll be dropped back to the command line.
- Now you can view your key information by typing <command>gpg
- --list-keys</command>. You should see something similar to this:
+ Når dette er fullført vil du komme tilbake til kommandolinjen. Etter
+ dette kan du din nøkkelinformasjon ved å skrive <command>gpg
+ --list-keys</command>. Du vil da se noe som ligner dette:
<example id="gpg-list-keys">
<title>GPG Listing Keys</title>
<para>
@@ -72,76 +72,76 @@
sub 1024g/289sklj3 2001-06-20 [expires: 2002-11-14]
</para>
</example>
- You'll now need to upload your public key to a keyserver, so that your
- friends can use your key. You'll need to know the ID of your key, which
- is after the 1024D on the line beginning with pub. For this example, it
- is 32j38dk2. You now type in <command>gpg --send-keys --keyserver
- wwwkeys.pgp.net 32j38dk2</command>. Substitute your key ID for 32j38dk2.
- You will be prompted to type in your password <!-- verify that you need to
- enter your password here --> and your key will be uploaded for your
- friends to download.
+ Du må laste opp din offentlige nøkkel til en nøkkeltjener, slik at dine
+ venner kan bruke din nøkkel. Du må ha IDen til din nøkkel, og den finner
+ du etter 1024D på linjen som starter med pub. I dette eksempelet er
+ den 32j38dk2. Skriv nå inn <command>gpg --send-keys --keyserver
+ wwwkeys.pgp.net 32j38dk2</command>. Bytt ut din nøkkel-ID med 32j38dk2.
+ Du vil bli spurt om å skrive inn ditt passord <!-- verify that you need to
+ enter your password here --> og nøkkelen vil bli lastet opp slik at
+ andre kan hente den.
</para>
</sect1>
<sect1 id="encrypt-evo-integ">
- <title>Setting up Evolution's Encryption</title>
+ <title>Oppsett av kryptering i Evolution</title>
<para>
- You'll need to open
+ Du må gå til menyvalget
<menuchoice>
- <guimenu>Tools</guimenu>
- <guimenuitem>Mail Settings</guimenuitem>
+ <guimenu>Verktøy</guimenu>
+ <guimenuitem>Instillinger for e-post</guimenuitem>
</menuchoice>
- Once there, select the account you'd like to associate the key to and click
- the <guibutton>Edit</guibutton> button. In the
- <guilabel>Security</guilabel> tab is a section labeled <guilabel>Pretty
- Goog Privacy</guilabel>. Enter your key ID and click
- <guibutton>OK</guibutton>. Your key is now integrated into your identity
- in <application>Evolution</application>.
+ Når dialogen vises velger du kontoen du vil assosiere nøkkelen med og klikker
+ <guibutton>Rediger</guibutton>-knappen. Under fanen
+ <guilabel>Sikkerhet</guilabel> finner du en seksjon kalt <guilabel>Pretty
+ Good Privacy</guilabel>. Skriv inn din nøkkel-ID og klikk
+ <guibutton>OK</guibutton>. Din nøkkel vil nå integreres med din identitet
+ i <application>Evolution</application>.
</para>
</sect1>
<sect1 id="encrypt-sending">
- <title>Sending Encrypted Messages</title>
+ <title>Sending av krypterte meldinger</title>
<para>
- You can either sign or encrypt a message. When you sign a message, verify
- that you were the one who sent it, and that no one is forging your
- identity. Encrypting a message makes it impossible for someone with
- prying eyes to view it while it's in tranmission.
+ Du kan enten signere eller kryptere en melding. Når du signerer en melding
+ verifiserer du at det var du som sendte den, og at ingen andre bruker
+ din identitet. Kryptering av en melding gjør det umulig for noen å se
+ innholdet mens meldingen blir sendt over nettet.
</para>
<para>
<sect2 id="sign-msg">
- <title>Signing a Message</title>
+ <title>Signering av en melding</title>
<para>
- To sign a message, you simply click
+ For å signere en melding klikker du bare
<menuchoice>
- <guimenu>Security</guimenu>
- <guimenuitem>PGP Sign</guimenuitem>
+ <guimenu>Sikkerhet</guimenu>
+ <guimenuitem>Signer med PGP</guimenuitem>
</menuchoice>
- . You will be prompted for your PGP password. Once you enter it,
- click <guibutton>OK</guibutton> and your message will be signed.
+ Du vil bli spurt etter ditt PGP-passord. Når du har skrevet det
+ klikk <guibutton>OK</guibutton> og meldingen vil bli signert.
</para>
</sect2>
<sect2 id="encrypt-msg">
- <title>Encrypting a Message</title>
+ <title>Kryptering av en melding</title>
<para>
- Encrypting a message is very similar to signing a message. You simply
- click the menu item
+ Kryptering av en melding ligner mye på signering. Du klikker bare
+ på menyoppføringen
<menuchoice>
- <guimenu>Security</guimenu>
- <guimenuitem>PGP Encrypt</guimenuitem>
+ <guimenu>Sikkerhet</guimenu>
+ <guimenuitem>Krypter med PGP</guimenuitem>
</menuchoice>
</para>
</sect2>
</para>
</sect1>
<sect1 id="unencrypting">
- <title>Unencrypting a Recieved Message</title>
+ <title>Dekryptering av en mottatt melding</title>
<para>
- Sometimes, a friend will send you a message which is encrypted. In order
- for you to read it, you need to unencrypt it.
+ Noen ganger kan en venn sende deg en melding som er kryptert. For at du
+ skal kunne lese den vil du måtte dekryptere den.
</para>
<para>
- When you view the encrypted message, <application>Evolution</application>
- will prompt you for your PGP password. You type in your PGP password and
- the message is then decrypted.
+ Når du viser den krypterte meldingen vil <application>Evolution</application>
+ spørre deg etter ditt PGP-passord. Du oppgir ditt PGP-passord og
+ meldingen blir kryptert.
</para>
</sect1>
</article>
diff --git a/help/no/config-prefs.sgml b/help/no/config-prefs.sgml
index 77ebe4e807..9568a00d5b 100644
--- a/help/no/config-prefs.sgml
+++ b/help/no/config-prefs.sgml
@@ -3,57 +3,57 @@
-->
<chapter id="config-prefs">
- <title>Advanced Configuration</title>
+ <title>Avansert konfigurasjon</title>
<para>
- Perhaps your mail server has changed names. Perhaps you've
- grown tired of a certain layout for your appointments.
- Whatever the reason, you want to change your
- <application>Evolution</application> settings. This chapter
- will tell you how to do just that.
+ Kanskje din e-posttjener har byttet navn. Kanskje du er
+ lei av et spesifikt utseende for dine avtaler.
+ Uansett grunn, du ønsker å endre dine innstillinger for
+ <application>Evolution</application>. Dette kapittelet
+ vil forklare deg hvordan du gjør nettopp dette.
</para>
<sect1 id="config-prefs-mail">
- <title>Mail Settings</title>
+ <title>Innstillinger for e-post</title>
<para>
- To change your mail settings, select <menuchoice>
- <guimenu>Tools</guimenu> <guimenuitem>Mail
- Settings</guimenuitem></menuchoice> in the Inbox. This
- will open the <interface>mail preferences window</interface>,
- illustrated in <xref linkend="config-prefs-mail-fig">. Mail
- preferences are separated into several categories:
+ For å endre dine e-post innstillinger velg <menuchoice>
+ <guimenu>Verktøy</guimenu> <guimenuitem>Innstillinger
+ for e-post</guimenuitem></menuchoice> i innboksen. Dette vil
+ åpne vinduet <interface>brukervalg for e-post</interface>,
+ illustrert i <xref linkend="config-prefs-mail-fig">. E-post
+ brukervalg er delt opp i flere kategorier:
<variablelist>
<varlistentry>
- <term><guilabel>Accounts</guilabel></term>
+ <term><guilabel>Kontoer</guilabel></term>
<listitem>
<para>
- This allows you to create and alter one or more identities for your
- email.
+ Dette lar deg opprette og endre en eller flere identiteter for
+ e-post.
</para>
</listitem>
</varlistentry>
<varlistentry>
- <term><guilabel>Display</guilabel></term>
+ <term><guilabel>Visning</guilabel></term>
<listitem>
<para>
- Allows you to edit how email appears.
+ Lar deg redigere utseende for meldinger.
</para>
</listitem>
</varlistentry>
<varlistentry>
- <term><guilabel>Composer</guilabel></term>
+ <term><guilabel>Redigering</guilabel></term>
<listitem>
<para>
- Customizes the behavior of the email message composer.
+ Tilpasser oppførselen ved meldingsredigering for e-post.
</para>
</listitem>
</varlistentry>
<varlistentry>
- <term><guilabel>Other</guilabel></term>
+ <term><guilabel>Annet</guilabel></term>
<listitem>
<para>
- Configures miscellanious aspects of
- <application>Evolution</application> such as character
- set and encryption tools.
+ Konfigurerer forskjellige aspekter ved
+ <application>Evolution</application> slik som tegnsett
+ og krypteringsverktøy.
</para>
</listitem>
</varlistentry>
diff --git a/help/no/evolution-no.omf b/help/no/evolution-no.omf
index cd0e866e64..6465ae888d 100644
--- a/help/no/evolution-no.omf
+++ b/help/no/evolution-no.omf
@@ -8,7 +8,7 @@
<category>GNOME|Applikasjoner</category>
</subject>
<format mime="text/sgml"/>
- <identifier url="evolution.sgml"/>
+ <identifier url="index.html"/>
<language code="no"/>
</resource>
</omf>
diff --git a/help/no/preface.sgml b/help/no/preface.sgml
index 9637beaf4c..8aad3dc1c8 100644
--- a/help/no/preface.sgml
+++ b/help/no/preface.sgml
@@ -2,79 +2,81 @@
<!DOCTYPE preface PUBLIC "-//GNOME//DTD DocBook PNG Variant V1.1//EN">
-->
<preface id="introduction">
- <title>About this Book</title>
+ <title>Om denne boken</title>
<sect1 id="organization">
- <title>Organization</title>
+ <title>Organisering</title>
<para>
- This book is divided into two parts, with several
- appendices. The first part is a <link linkend="usage">guided
- tour</link>, which will explain how to use
- <application>Evolution</application>. If you are new to
- <application>Evolution</application> or to groupware in
- general, this section is for you. The second section, covering
- <link linkend="config">configuration</link>, is targeted at
- more advanced users, but anyone who wants to change the way
- <application>Evolution</application> looks or acts can benefit
- from reading it.
+ Denne boken er delt inn i to deler, med flere
+ appendikser. Første del er en <link linkend="usage">
+ omvisning</link>, som vil forklare hvordan du bruker
+ <application>Evolution</application>. Hvis du ikke har brukt
+ <application>Evolution</application> eller andre gruppevare-
+ produkter vil denne delen være av interesse. Den andre delen, som
+ dekker <link linkend="config">konfigurasjon</link>, har mer avanserte
+ brukere som målgruppe, men alle som ønsker å endre utseende eller
+ oppførsel for <application>Evolution</application> vil kunne dra nytte
+ av å lese den.
</para>
</sect1>
<sect1 id="typography">
- <title>Typographical conventions</title>
+ <title>Typografiske konvensjoner</title>
<para>
- In this book, we'll mark some words with special typography:
+ I denne boken, vil vi markere noen ord med spesiell typografi:
<simplelist>
- <member><application>Applications</application></member>
- <member><command>Commands</command> you type at the command line</member>
- <member><guilabel>Labels</guilabel> for buttons and other portions of the graphical interface</member>
+ <member><application>Applikasjoner</application></member>
+ <member><command>Kommandoer</command> du skriver på kommandolinjen</member>
+ <member><guilabel>Etiketter</guilabel> for knapper og andre deler av det
+ grafiske grensesnittet</member>
- <member> Menu selections look like this:
+ <member>Menyutvalg har følgende utseende:
<menuchoice>
- <guimenu>Menu</guimenu>
- <guisubmenu>Submenu</guisubmenu>
- <guimenuitem>Menu Item</guimenuitem>
+ <guimenu>Meny</guimenu>
+ <guisubmenu>Undermeny</guisubmenu>
+ <guimenuitem>Menyoppføring</guimenuitem>
</menuchoice>
</member>
- <member><guibutton>Buttons</guibutton> you can
- click</member> <member><userinput>Anything you type
- in</userinput></member> <member><computeroutput>Text
- output from a computer</computeroutput></member>
- <member><glossterm linkend="apx-gloss">Words</glossterm>
- that are defined in the <xref linkend="apx-gloss">.</member>
+ <member><guibutton>Knapper</guibutton> du kan
+ klikke på</member> <member><userinput>Alle steder du kan
+ skrive inn tekst</userinput></member> <member><computeroutput>
+ Tekstutskrift fra en datamaskin</computeroutput></member>
+ <member><glossterm linkend="apx-gloss">Ord</glossterm>
+ som er definert i ordboken<xref linkend="apx-gloss">.</member>
</simplelist>
</para>
<para>
-We'll provide assorted bits of additional information in tips set off from the rest of the book, as well.
+ Du vil få forskjellig tilleggsinformasjon i tips som er skilt ut
+ fra resten av boken.
<tip id="example-tip">
- <title>Tip</title>
+ <title>Tips</title>
<para>
- Tips and bits of extra information will look like
- this.
+ Tips og ekstra informasjon vil ha se slik
+ ut.
</para>
</tip>
</para>
<para>
-Examples are also set off from the rest of the text. They look like this:
+Eksempler er også adskilt fra resten av teksten. De ser slik ut:
<example>
- <title>Example Example</title>
+ <title>Eksempel</title>
<para>
- This is what an example looks like. We'll provide
- examples for some of the more complicated tasks you
- might be performing.
+ Et eksempel vil se slik ut. Eksempler vil bli gitt
+ for noen av de mer kompliserte oppgavene du kan
+ utføre.
</para>
</example>
</para>
<para>
-Lastly, we'll have warnings, in cases where you should be careful:
+Til slutt har vi advarsler, for tilfeller hvor man bør være forsiktig:
<warning id="example-warning">
- <title>Example Warning</title>
+ <title>Exempel på advarsel</title>
<para>
- This is what a warning looks like. If there's a chance
- you'll run into trouble, we'll warn you beforehand.
+ Dette er en advarsel. Hvis det er muligheter for at
+ du kan få problemer vil du få en advarsel på forhånd.
</para>
</warning>
</para>
diff --git a/help/zh_CN/apx-authors.sgml b/help/zh_CN/apx-authors.sgml
new file mode 100644
index 0000000000..acf43b6cfc
--- /dev/null
+++ b/help/zh_CN/apx-authors.sgml
@@ -0,0 +1,100 @@
+ <appendix id="authors">
+ <title>Authors</title>
+ <para>
+ <application>Evolution</application> was written by:
+<simplelist>
+ <member>Seth Alves: <email>alves@ximian.com</email></member>
+ <member>Anders Carlsson: <email>andersca@gnu.org</email></member>
+ <member>Damon Chaplin: <email>damon@ximian.com</email></member>
+ <member>Clifford R. Conover: <email>rusty@zootweb.com</email></member>
+ <member>Anna Dirks: <email>anna@ximian.com</email></member>
+ <member>Miguel De Icaza: <email>miguel@ximian.com</email></member>
+ <member>Radek Doulik: <email>rodo@ximian.com</email></member>
+ <member>Arturo Espinoza: <email>arturo@nucleu.unam.mx</email></member>
+ <member>Larry Ewing: <email>lewing@ximian.com</email></member>
+ <member>Nat Friedman: <email>nat@ximian.com</email></member>
+ <member>Bertrand Guiheneuf: <email>bertrand@ximian.com</email></member>
+ <member>Iain Holmes: <email>iain@ximian.com</email></member>
+ <member>Tuomas Kuosmanen: <email>tigert@gimp.org</email></member>
+ <member>Christopher J. Lahey: <email>clahey@ximian.com</email></member>
+ <member>Jason Leach: <email>jleach@usa.net</email></member>
+ <member>Matthew Loper: <email>matt@loper.org</email></member>
+ <member>Federico Mena: <email>federico@ximian.com</email></member>
+ <member>Rodrigo Moya: <email>rodrigo@ximian.com</email></member>
+ <member>Eskil Heyn Olsen: <email>deity@eski.dk</email></member>
+ <member>Federico Mena: <email>federico@ximian.com</email></member>
+ <member>Jesse Pavel: <email>jpavel@ximian.com</email></member>
+ <member>Ettore Perazzoli: <email>ettore@ximian.com</email></member>
+ <member>Jeffrey Stedfast: <email>jeff@ximian.com</email></member>
+ <member>Jakyb Steiner: <email>rodo@ximian.com</email></member>
+ <member>Russell Steinthal: <email>rms39@columbia.edu</email></member>
+ <member>Peter Teichman: <email>peter@ximian.com</email></member>
+ <member>Chris Toshok: <email>toshok@ximian.com</email></member>
+ <member>Peter Williams: <email>peter@newton.cx</email></member>
+ <member>Dan Winship: <email>danw@ximian.com</email></member>
+ <member>Michael Zucchi: <email>notzed@ximian.com</email></member>
+</simplelist>
+and numerous other dedicated GNOME programmers.
+</para>
+ <para>
+ The <application>Evolution</application> code owes a great debt
+ to the <application>GNOME-pim</application> and
+ <application>GNOME-Calendar</application> applications, and to
+ <application>KHTMLW</application>. The developers of
+ <application>Evolution</application> acknowledge the efforts
+ and contributions of all who worked on those projects.
+ </para>
+
+ <para>
+ Ximian would like to thank Miles Lane for his contributions in
+ quality assurance, and the staff of the El Pelon Taqueria, on
+ Peterborough St. in Boston, for sustenance.
+ </para>
+
+ <para>
+ For more information please visit the
+ <application>Evolution</application> <ulink
+ url="http://www.ximian.com/products/ximian_evolution/"
+ type="http">Web page</ulink>. Please send all comments,
+ suggestions, and bug reports to the <ulink
+ url="http://bugzilla.ximian.com" type="http">Ximian bug tracking
+ database</ulink>. Instructions for submitting bug reports can be
+ found on-line at the same location. You can also use the GNOME
+ bug report tool, <command>bug-buddy,</command> to submit your
+ defect reports.
+ </para>
+ <para>
+ This manual was written by Aaron Weber
+ (<email>aaron@ximian.com</email>), Kevin Breit
+ (<email>battery841@mypad.com</email>) Duncan Mak
+ (<email>duncan@ximian.com</email>) and Ettore Perazzoli
+ (<email>ettore@ximian.com</email>) with the help of the
+ application programmers and the GNOME Documentation Project.
+ Please file comments and suggestions for this manual as bugs in
+ the Ximian bug tracking system. If you contributed to this
+ project but do not see your name here, please contact Aaron
+ Weber (<email>aaron@ximian.com</email>) and he'll list you.
+ </para>
+ <para>
+ Partial list of Translators:
+ <itemizedlist>
+ <listitem><para>
+ Daniel Persson for .se
+ </para></listitem>
+
+ <listitem><para>
+ Hector Garcia Alvarez for .es
+ </para></listitem>
+
+ <listitem><para>
+ Kjartan Maraas for .no
+ </para></listitem>
+ </itemizedlist>
+
+ </para>
+ </appendix>
+
+
+
+
+
diff --git a/help/zh_CN/apx-bugs.sgml b/help/zh_CN/apx-bugs.sgml
new file mode 100644
index 0000000000..e3249c548c
--- /dev/null
+++ b/help/zh_CN/apx-bugs.sgml
@@ -0,0 +1,36 @@
+ <appendix id="bugs">
+
+ <title>已知问题和é™åˆ¶</title>
+ <abstract>
+ <para>
+ Ximian Evolution 使用 <ulink url="http://bugzilla.ximian.com">
+ Ximian 错误跟踪系统</ulink> æ¥è·Ÿè¸ªé”™è¯¯ã€‚如果您å‘现了错误或者想
+ è¦æ±‚增加一个新的特性,您å¯ä»¥ä½¿ç”¨é”™è¯¯è·Ÿè¸ªç³»ç»Ÿæˆ–者 GNOME
+ <application>错误报告工具</application>(也就是命令行工具<command>
+ bug-buddy</command>)æ¥å®Œæˆã€‚
+ </para>
+ <para>
+ 如果您需è¦èŽ·å¾— Ximian Evolution çš„é¢å¤–帮助,请访问 Ximian 支æŒ
+ 站点 <ulink url="http://support.ximian.com">ximian.com/support</ulink>。
+ </para>
+ </abstract>
+
+ <para>
+ 许多被多次è¦æ±‚的特性将ä¸ä¼šåœ¨ Ximian Evolution 1.0 中,但是我们
+ 计划在版本 1.1 中加入它们。这其中包括:
+ <simplelist>
+ <member>ç›´æŽ¥æ”¯æŒ Microsoft Outlook è”系人å¡ç‰‡</member>
+ <member>和手æŒè®¾å¤‡åŒæ­¥ç”µå­é‚®ä»¶</member>
+ <member>S/MIME 支æŒ</member>
+ <member>ä¸å¯¼å…¥è€Œç›´æŽ¥è¯»å–其它格å¼çš„邮件文件夹</member>
+ <member>导入 WINMAIL.DAT 附件</member>
+ <member>当新邮件到达时播放声音</member>
+</simplelist>
+ </para>
+ <para>
+ Evolution 的更完整的特性è¦æ±‚和其它问题å¯ä»¥åœ¨ Ximian 错误跟踪系统中
+ 在线获得。
+ </para>
+
+ </appendix>
+
diff --git a/help/zh_CN/apx-gloss.sgml b/help/zh_CN/apx-gloss.sgml
new file mode 100644
index 0000000000..7660d400c8
--- /dev/null
+++ b/help/zh_CN/apx-gloss.sgml
@@ -0,0 +1,437 @@
+<glossary id="apx-gloss">
+
+ <title>Glossary</title>
+
+ <glossentry id="attachment">
+ <glossterm>Attachment:</glossterm>
+ <glossdef>
+ <para>
+ Any file sent along with an email. Attachments may be embedded in
+ a message or appended to it.
+ </para>
+ </glossdef>
+ </glossentry>
+
+<glossentry id="automatic-indexing">
+ <glossterm>Automatic Indexing:</glossterm>
+ <glossdef>
+ <para>
+ Pre-sorting procedure that allows
+ <application>Evolution</application> to refer to data quickly.
+ It enables faster searches and decreases memory usage for
+ data displays.
+ </para>
+ </glossdef>
+ </glossentry>
+
+ <glossentry id="bcc">
+ <glossterm>Bcc (Blind Carbon Copy):</glossterm>
+ <glossdef>
+ <para>
+ A way of addressing a message. Bcc is used to send a group of
+ people an e-mail, while hiding their names and addresses from each
+ other.
+ </para>
+ </glossdef>
+ </glossentry>
+
+ <glossentry id="cc">
+ <glossterm>Cc (Carbon Copy):</glossterm>
+ <glossdef>
+ <para>
+ Carbon-copies are used to send a 3rd party a copy of the e-mail,
+ so they an keep up to date on a conversation, without being in the
+ To: list.
+ </para>
+ </glossdef>
+ </glossentry>
+
+ <glossentry id="conduit">
+ <glossterm>Conduit:</glossterm>
+ <glossdef>
+ <para>
+ A synchronization conduit is a small application which controls
+ the transfer of data between a handheld device and a desktop
+ computer.
+ </para>
+ </glossdef>
+ </glossentry>
+
+
+ <glossentry id="druid">
+ <glossterm>Druid:</glossterm>
+ <glossdef>
+ <para>
+ A tool which guides a user through a series of steps, usually to
+ configure or set up a program. Equivalent to "Assistant" and
+ "Wizard."
+ </para>
+ </glossdef>
+ </glossentry>
+
+ <glossentry id="evolution">
+ <glossterm>Evolution:</glossterm>
+ <glossdef>
+ <para>
+ <application>Evolution</application> is the <acronym> GNOME
+ </acronym> groupware application.
+ </para>
+ </glossdef>
+ </glossentry>
+
+ <glossentry id="execute">
+ <glossterm>Execute:</glossterm>
+ <glossdef>
+ <para>
+ To run a program. Any file that can be run is called an
+ executable. <application>Evolution</application> can download
+ executable attachments, but before they can be run, the files must
+ be marked as executable with a shell or file manager. This
+ security precaution prevents the automatic or accidental execution
+ of malicious programs. For more information on executables and file
+ permissions, see the documentation for your file manager or shell.
+ </para>
+ </glossdef>
+ </glossentry>
+
+ <glossentry id="expunge">
+ <glossterm>Expunge:</glossterm>
+ <glossdef>
+ <para>
+ When messages are marked for deletion, they remain till they are expunged.
+ When a message is expunged, it is permanently deleted, as long as it was
+ marked for deletion.
+ </para>
+ </glossdef>
+ </glossentry>
+
+ <glossentry id="filetree">
+ <glossterm>File Tree:</glossterm>
+ <glossdef>
+ <para>
+ A way of describing a group of files on a computer. With the
+ perversity typical of computer (and especially Unix and Linux)
+ nomenclature, the top of the tree is called the root directory,
+ and denoted by <filename>/</filename>.
+ The rest of the "branches" spread downwards from the root. Don't
+ confuse the root directory with the root
+ account, or root's home directory,
+ <filename>/home/root</filename>.b
+ </para>
+ </glossdef>
+ </glossentry>
+
+ <glossentry id="filter">
+ <glossterm>Filter:</glossterm>
+ <glossdef>
+ <para>
+ Within <application>Evolution</application>, a filter is a method
+ of sorting mail automatically. You can create filters to perform
+ one or more actions on a message that meets any (or all) of a wide
+ range of criteria.
+ </para>
+ </glossdef>
+ </glossentry>
+
+ <glossentry id="forward">
+ <glossterm>Forward:</glossterm>
+ <glossdef>
+ <para>
+ If you get a message intended for someone else, you can use
+ message forwarding to send it on to the right person.
+ </para>
+ </glossdef>
+ </glossentry>
+
+ <glossentry id="groupware">
+ <glossterm>Groupware:</glossterm>
+ <glossdef>
+ <para>
+ Groupware is a term describing an application which helps groups
+ of people work together. Typically, a groupware application will
+ have several productivity features built into one program,
+ including email, calendar, and addressbook tools.
+ </para>
+ </glossdef>
+ </glossentry>
+
+ <glossentry id="html">
+ <glossterm>HTML:</glossterm>
+ <glossdef>
+ <para>
+ Hyper-text Markup Language (<acronym>HTML</acronym>) is a language
+ for describing page layout in electronic documents like web pages,
+ help files, and email messages. HTML can be used in email and
+ news posts to insert images and apply text treatments.
+ </para>
+ </glossdef>
+ </glossentry>
+
+ <glossentry id="hot-key">
+ <glossterm>Hot Key:</glossterm>
+ <glossdef>
+ <para>
+ Hot-keys are keyboard combinations used to do actions on a
+ computer instead of using the mouse to do the same action.
+ Hot-keys can speed up computer usage.
+ </para>
+ </glossdef>
+ </glossentry>
+
+ <glossentry id="ical">
+ <glossterm>iCal:</glossterm>
+ <glossdef>
+ <para>
+ <application>iCal</application> is the program which
+ <application>Evolution</application> uses to manage the calendar
+ section.
+ </para>
+ </glossdef>
+ </glossentry>
+
+ <glossentry id="imap">
+ <glossterm>IMAP:</glossterm>
+ <glossdef>
+ <para>
+ Depending upon whom you ask, IMAP stands for the Internet Mail
+ Access Protocol, or the Interim Mail Access Protocol. Whatever it
+ stands for, it allows access to email which is typically (although
+ not always) stored remotely on a server rather than on a local
+ hard disk. Often contrasted with <glossterm>POP:</glossterm>.
+ This will not be on the test.
+ </para>
+ </glossdef>
+ </glossentry>
+
+
+ <glossentry id="inline">
+ <glossterm>Inline:</glossterm>
+ <glossdef>
+ <para>
+ Displayed as part of a message or other document, rather than
+ attached as a separate file. Contrast with <glossterm
+ linkend="attachment">Attachment:</glossterm>.
+ </para>
+ </glossdef>
+ </glossentry>
+
+ <glossentry id="ldap">
+ <glossterm>LDAP:</glossterm>
+ <glossdef>
+ <para>
+ LDAP, the Lightweight Directory Access Protocol, allows a client
+ to search through a large database of addresses, phone numbers,
+ and people stored on a server.
+ </para>
+ </glossdef>
+ </glossentry>
+
+ <glossentry id="mail-client">
+ <glossterm>Mail Client:</glossterm>
+ <glossdef>
+ <para>
+ A mail client is the application with which a person reads and
+ sends e-mail. Its counterparts are the various types of mail
+ servers, which handle user authentication and direct messages from
+ sender to recipient.
+ </para>
+ </glossdef>
+ </glossentry>
+
+
+ <glossentry id="minicard">
+ <glossterm>Minicard:</glossterm>
+ <glossdef>
+ <para>
+ A format for the display of contact data. Similar in appearance
+ to a small business card.
+ </para>
+ </glossdef>
+ </glossentry>
+
+ <glossentry id="nautilus">
+ <glossterm>Nautilus:</glossterm>
+ <glossdef>
+ <para>
+ <application>Nautilus</application> is the next generation file
+ manager for <acronym>GNOME</acronym> being written by Eazel.
+ </para>
+ </glossdef>
+ </glossentry>
+
+ <glossentry id="pop">
+ <glossterm>POP:</glossterm>
+ <glossdef>
+ <para>
+ POP, the Post Office Protocol, is a mechanism for email
+ transport. In contrast to IMAP, it is used only to get mail from
+ a server and store it locally on your hard disk.
+ </para>
+ </glossdef>
+ </glossentry>
+
+ <glossentry id="protocol">
+ <glossterm>Protocol:</glossterm>
+ <glossdef>
+ <para>
+ An agreed-upon method of communication, especially one for
+ sending particular types of information between computer systems.
+ Examples include POP (Post Office Protocol), for email, and HTTP
+ (HypterText Transfer Protocol), for web pages.
+ </para>
+ </glossdef>
+ </glossentry>
+
+ <glossentry id="public-key-encryption">
+ <glossterm>Public Key Encryption:</glossterm>
+ <glossdef>
+ <para>
+ A strong encryption method that uses a set of two "keys," one of
+ which is made public, and one of which is kept private. Data
+ encrypted using the public key can only be decrypted using the
+ private key. The longer the keys, the more difficult it is to
+ break the encryption.
+ </para>
+ </glossdef>
+ </glossentry>
+
+
+
+ <glossentry id="regular-expression">
+ <glossterm>Regular Expression:</glossterm>
+ <glossdef>
+ <para>
+ A regular expression, or "regex", is a way of describing a
+ string of text using metacharacters or wild-card symbols. For
+ example, the statement <userinput>fly.*so[a|u]p</userinput> means
+ "any phrase beginning with 'fly' and ending in 'soup' or
+ 'soap'". If you searched for that expression, you'd find both
+ "fly in my soup" and "fly in my soap." There's not room here to
+ go into depth, but if you want, have a look at the documentation
+ for the <command>grep</command> command.
+ </para>
+ </glossdef>
+ </glossentry>
+
+ <glossentry id="script">
+ <glossterm>Script:</glossterm>
+ <glossdef>
+ <para>
+ A program written in an interpreted (rather than compiled)
+ language. Often used as a synonym for "macro," to denote a series
+ of pre-recorded commands or actions within an application.
+ </para>
+ </glossdef>
+ </glossentry>
+
+ <glossentry id="sendmail">
+ <glossterm>Sendmail:</glossterm>
+ <glossdef>
+ <para>
+ As its name implies, <application>sendmail</application> is a
+ program which sends mail. <application>Evolution</application>
+ can use it instead of <glossterm>SMTP:</glossterm>; some people
+ prefer it because it offers more flexibility, but is more
+ difficult to set up.
+ </para>
+ </glossdef>
+ </glossentry>
+
+
+ <glossentry id="shortcut-bar">
+ <glossterm>Shortcut Bar:</glossterm>
+ <glossdef>
+ <para>
+ A portion of <application>Evolution</application> which offers
+ users fast access to the most frequently used portions of the
+ application.
+ </para>
+ </glossdef>
+ </glossentry>
+
+ <glossentry id="signature">
+ <glossterm>Signature:</glossterm>
+ <glossdef>
+ <para>
+ In email terms, a signature is a piece of text placed at the end
+ of every email sent, like a hand-written signature at the bottom
+ of a written letter. A signature can be anything from a favorite
+ quotation to a link to a web page; courtesy dictates that it be
+ fewer than four lines long.
+ </para>
+ </glossdef>
+ </glossentry>
+
+ <glossentry id="SMTP">
+ <glossterm>SMTP:</glossterm>
+ <glossdef>
+ <para>
+ This is the most common way of transporting mail messages from
+ the client's computer (you) to the server. SMTP stands for
+ Simple Mail Transfer Protocol.
+ </para>
+ </glossdef>
+ </glossentry>
+
+ <glossentry id="tooltip">
+ <glossterm>Tool-Tip:</glossterm>
+ <glossdef>
+ <para>
+ A small box of explanatory text which appears when the mouse
+ pointer is held motionless over a button or other interface
+ element.
+ </para>
+ </glossdef>
+ </glossentry>
+
+ <glossentry id="virus">
+ <glossterm>Virus:</glossterm>
+ <glossdef>
+ <para>
+ A program which inserts itself into other files or programs and
+ which, when executed, spreads to more programs and other
+ computers. A virus can cause substantial damage by clogging
+ networks or disk drives, deleting files, or opening security
+ holes.
+ </para>
+ </glossdef>
+ </glossentry>
+
+ <glossentry id="vcard">
+ <glossterm>vCard:</glossterm>
+ <glossdef>
+ <para>
+ A file format for the exchange of contact information. When you
+ get an address card attached to an email, it's probably in vCard
+ format. Not to be confused with <glossterm
+ linkend="vfolder">vFolder:</glossterm>.
+ </para>
+ </glossdef>
+ </glossentry>
+
+ <glossentry id="vfolder">
+ <glossterm>vFolder:</glossterm>
+ <glossdef>
+ <para>
+ An email organization tool. vFolders allows you to create a folder
+ that contains the results of a complex search. vFolder contents are
+ are updated dynamically.
+ </para>
+ </glossdef>
+ </glossentry>
+
+</glossary>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/help/zh_CN/config-prefs.sgml b/help/zh_CN/config-prefs.sgml
new file mode 100644
index 0000000000..77ebe4e807
--- /dev/null
+++ b/help/zh_CN/config-prefs.sgml
@@ -0,0 +1,744 @@
+<!--
+<!DOCTYPE Chapter PUBLIC "-//GNOME//DTD DocBook PNG Variant V1.1//EN">
+-->
+<chapter id="config-prefs">
+
+ <title>Advanced Configuration</title>
+ <para>
+ Perhaps your mail server has changed names. Perhaps you've
+ grown tired of a certain layout for your appointments.
+ Whatever the reason, you want to change your
+ <application>Evolution</application> settings. This chapter
+ will tell you how to do just that.
+ </para>
+
+ <sect1 id="config-prefs-mail">
+ <title>Mail Settings</title>
+ <para>
+ To change your mail settings, select <menuchoice>
+ <guimenu>Tools</guimenu> <guimenuitem>Mail
+ Settings</guimenuitem></menuchoice> in the Inbox. This
+ will open the <interface>mail preferences window</interface>,
+ illustrated in <xref linkend="config-prefs-mail-fig">. Mail
+ preferences are separated into several categories:
+ <variablelist>
+ <varlistentry>
+ <term><guilabel>Accounts</guilabel></term>
+ <listitem>
+ <para>
+ This allows you to create and alter one or more identities for your
+ email.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><guilabel>Display</guilabel></term>
+ <listitem>
+ <para>
+ Allows you to edit how email appears.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><guilabel>Composer</guilabel></term>
+ <listitem>
+ <para>
+ Customizes the behavior of the email message composer.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><guilabel>Other</guilabel></term>
+ <listitem>
+ <para>
+ Configures miscellanious aspects of
+ <application>Evolution</application> such as character
+ set and encryption tools.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+
+ </para>
+
+ <!-- ==============Figure===================== -->
+ <figure id="config-prefs-mail-fig">
+ <title>Mail Preferences Dialog</title>
+ <screenshot>
+ <screeninfo>Setting mail preferences</screeninfo>
+ <mediaobject><imageobject><imagedata fileref="figures/config-mail" format="png" srccredit="Aaron Weber">
+ </imageobject></mediaobject>
+ </screenshot>
+ </figure>
+ <!-- ==============End of Figure================-->
+
+
+ <sect2 id="config-prefs-mail-identity">
+ <title>Working with the Accounts Tab</title>
+ <para>
+ <application>Ximian Evolution</application> allows you to
+ maintain multiple accounts, or identities. This is useful
+ want to keep personal and professional email separate, or if
+ you wear several hats at work. When you are writing an email
+ message, you can which account to use by selecting from the
+ drop-down list next to the <guilabel>From</guilabel> entry in
+ the message composer.
+ </para>
+
+ <para>
+ Clicking <guibutton>Get Mail</guibutton> will refresh any
+ IMAP, <filename>mh</filename>, or
+ <filename>mbox</filename> listings
+ and check and download mail from all POP servers. In other
+ words, <guibutton>Get Mail</guibutton> gets your mail, no
+ matter how many sources you have, or what types they are. If
+ you don't want to check mail for a given account, select it
+ in the <guilabel>Accounts</guilabel> tab and click the
+ <guibutton>Disable</guibutton> button.
+ </para>
+
+ <para>
+ To add a new account, simply click <guibutton>Add</guibutton>
+ to open the mail configuration assistant. To alter an
+ existing identity, select it in the
+ <interface>Preferences</interface> window, and then click
+ <guibutton>Edit</guibutton> to open the account editor
+ dialog.
+ </para>
+ <para>
+ The account editor dialog has six sections:
+ <variablelist>
+
+ <varlistentry>
+ <term>Identity:</term>
+ <listitem>
+ <para>
+ Here, enter the name,
+ email address, and other identifying information for the
+ account.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Receiving Mail</term>
+ <listitem>
+ <para>
+ Here, select the way you will be getting mail: you may
+ download mail from a server (<glossterm
+ linkend="pop">POP</glossterm> or <glossterm
+ linkend="imap">IMAP</glossterm>) or access it from files
+ on your local system. If you use a server, it may permit
+ or require you to use a Secure Socket Layer (SSL)
+ connection. To turn SSL connections on, just click the
+ <guibutton>Use Secure Connection (SSL)</guibutton>
+ button.
+
+<note id="config-arbitrary-port">
+<title>Specifying Port Numbers</title>
+<para>
+Your system administrator may ask you to connect to a specific port on
+a mail server. To specify which port you use, just type a colon and
+the port number after the server name. For example, to connect to port
+143 on the server smtp.omniport.com, you would enter
+as
+<userinput>
+smtp.omniport.com:143
+</userinput> as the server name.
+</para>
+</note>
+
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Receiving Options</term>
+ <listitem>
+ <para>
+ Here, decide whether you'd like to check for mail
+ automatically, and set other options related to the
+ behavior of your server. If you use POP mail, you can
+ decide whether to leave mail on the server, and if you
+ use IMAP, you can set folder subscription options here.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Sending Mail</term>
+ <listitem>
+ <para>
+ In this section, you will choose and configure a method
+ for sending mail. You may choose <glossterm
+ linkend="smtp">SMTP</glossterm> or <glossterm
+ linkend="sendmail">sendmail</glossterm>.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Special Folders</term>
+ <listitem>
+ <para>
+ Here, you can decide where this account will store the
+ messages that it has sent, and the messages that you
+ save as drafts.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Security</term>
+ <listitem>
+ <para>
+ In this section, you will set the security options for
+ this account. Enter your PGP Key ID and decide how
+ frequently to encrypt and sign your messages.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+ </sect2>
+
+ <sect2 id="config-prefs-mail-display">
+ <title>Mail Display Options</title>
+ <para>
+ In this tab you can decide how you would like
+ <application>Ximian Evolution</application> to display your
+ mail: how to display citations, how long to wait before
+ marking a message as read, and so forth.
+ </para>
+ <para>
+ This is also where you can decide how you would like
+ <application>Ximian Evolution</application> to handle inline
+ images in HTML mail that you get. There is a detailed
+ discussion of the issues surrounding these options in <xref
+ linkend="usage-mail-getnsend-get-attach-html">.
+ </para>
+ <para>
+ To hange the font which <application>Ximian
+ Evolution</application> uses to display mail, do the
+ following:
+ <orderedlist numeration="arabic">
+ <listitem>
+ <para>
+ Open the Control Center by selecting <menuchoice>
+ <guimenu>System</guimenu>
+ <guimenuitem>Settings</guimenuitem> </menuchoice> from
+ the menu panel.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Select the HTML Viewer settings tool.
+ </para>
+ </listitem>
+ <listitem>
+ <para>Choose the font and font size you would like to use.
+ </para>
+ </listitem>
+ </orderedlist>
+
+ Alternately, open a terminal and run the
+ <command>gtkhtml-properties-capplet</command> command. This
+ will open the GNOME HTML Display Properties tool, and you can
+ select a font and other attributes of your HTML display,
+ including that in <application>Ximian Evolution</application>.
+ </para>
+ </sect2>
+
+ <sect2 id="config-prefs-mail-composer">
+ <title>Message Composer Preferences</title>
+
+ <para>
+ Mercifully, there are only four preferences you can prefer in
+ the message composer preferences dialog:
+ <variablelist>
+ <varlistentry>
+ <term>Send mail in HTML format by default </term>
+ <listitem>
+ <para>
+ If you would like all email messages that you compose
+ to begin in HTML format, leave this box checked. You
+ can convert messages between HTML and plain text by
+ selecting the <menuchoice> <guimenu>Format</guimenu>
+ <guimenuitem>HTML</guimenuitem> </menuchoice> toggle
+ in the message composer.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>Default Forward style</term>
+ <listitem>
+ <para>
+ Select from:
+ <simplelist>
+ <member><guilabel>Attachment:</guilabel> the
+ message you forward appended to the message you send
+ as a seperate file.</member>
+
+ <member> <guilabel>Inline:</guilabel> The message
+ you forward is included at the end of the message
+ you send.</member>
+
+ <member>
+ <guilabel>Quoted:</guilabel> The message
+ you forward is included at the end of the message
+ you send, and a greater-than symbol (&gt;) is
+ inserted at the beginning of each line to
+ indicate that it is quoted.
+ </member>
+ </simplelist>
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>Prompt when sending messages with an empty subject</term>
+ <listitem>
+ <para>
+ The composer will warn you if you try to send a
+ message without a subject.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>Prompt when sending messages with only Bcc recipients defined</term>
+ <listitem>
+ <para>
+ The composer will warn you if you try to send a
+ message that has only <guilabel>Bcc</guilabel>
+ recipients. This is important because some mail
+ servers will fail to honor blind carbon copy if you
+ do not have at least one recipient that is visible to
+ all readers.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+ </sect2>
+ <sect2 id="config-prefs-mail-other">
+ <title>Other Mail Preferences</title>
+ <para>
+ Not everything fits neatly into categories. This tab
+ contains some miscellaneous configuration options that
+ didn't fit anywhere else.
+ <variablelist>
+
+ <varlistentry>
+ <term>
+ <guilabel>PGP binary path</guilabel>
+ </term>
+ <listitem>
+ <para>
+ The complete path to your external encryption tool On
+ most Linux systems, this will be
+ <filename>/usr/bin/gpg</filename>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>
+ <guilabel>Remember PGP Passphrase until Exit</guilabel>
+ </term>
+ <listitem>
+ <para> Check this box if you want <application>Ximian
+ Evolution</application> to remember your PGP
+ passphrase for as long as it is running. You will
+ still have to enter your passphrase again each time
+ you start <application>Ximian Evolution</application>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>
+ <guilabel>Default Character Encoding</guilabel>
+ </term>
+ <listitem> <para> Choose a default character encoding for
+ your messages.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>
+ <guilabel>Empty Trash Folders on Exit</guilabel>
+ </term>
+ <listitem> <para> If you would like to expunge all deleted
+ mail when you quit <application>Ximian
+ Evolution</application>, check this box.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>
+ <guilabel>Log filter actions to:</guilabel>
+ </term>
+ <listitem> <para> If you like, you can have
+ <application>Ximian Evolution</application> write all
+ its message filter actions to a log file. Select a log
+ file here.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+ </sect2>
+ </sect1>
+
+
+<!-- NOT FOR 1.0, see usage-mail.sgml
+ <sect1 id="config-prefs-news">
+ <title>News Servers</title>
+ <para>
+ Newsgroups are so much like mailing lists that there's no
+ reason not to keep them right next to your mail. When you
+ first select the <guilabel>News Servers</guilabel> tab,
+ you will see a blank box with the three familiar buttons
+ on the right: <guibutton>Add</guibutton>,
+ <guibutton>Edit</guibutton>, and
+ <guibutton>Delete</guibutton>.
+ </para>
+ <para>
+ Click <guibutton>Add</guibutton> to add a news server; you
+ will be prompted for its name. Enter the name, click
+ <guibutton>OK</guibutton>, and you're done. You can have
+ as many news servers as you like, of course. News servers
+ will appear next to your IMAP servers in the
+ <interface>folder bar</interface>.
+ </para>
+ </sect2>
+-->
+
+
+ <sect1 id="config-prefs-cal">
+ <title>Configuring the Calendar</title>
+ <para>
+ To set your calendar preferences, select
+ <menuchoice><guimenu>Settings</guimenu>
+ <guimenuitem>Calendar
+ Settings</guimenuitem></menuchoice> from the Calendar
+ view. This will open up the
+ <interface>Preferences</interface> window. It contains four
+ tabs: <guilabel>General</guilabel>, <guilabel>Display</guilabel>, <guilabel>Task List</guilabel>, and <guilabel>Other</guilabel>. The <interface>calendar
+ preferences window</interface> is illustrated in <xref
+ linkend="config-prefs-cal-fig">.
+
+ <!-- ==============Figure===================== -->
+ <figure id="config-prefs-cal-fig">
+ <title>Calendar Preferences Dialog</title>
+ <screenshot>
+ <screeninfo>If this worked on my job as well as my calendar...</screeninfo>
+ <mediaobject><imageobject><imagedata fileref="figures/config-cal" format="png" srccredit="Aaron Weber">
+ </imageobject></mediaobject>
+ </screenshot>
+ </figure>
+ <!-- ==============End of Figure================-->
+ </para>
+
+ <sect2 id="config-prefs-cal-general">
+ <title>Calendar's General Settings</title>
+ <para>
+ The <guilabel>Time display</guilabel> tab lets you set the
+ following:
+ <variablelist>
+ <varlistentry>
+ <term>Time zone</term>
+ <listitem>
+ <para>
+ The city you're located in, to judge your time zone.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Time format</term>
+ <listitem>
+ <para>You may choose between twelve-hour (AM/PM) and
+ twenty-four hour time formats here by clicking the
+ appropriate radio button.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Work Week</term>
+ <listitem>
+ <para>
+ When does your work day start, and when does it end?
+ In the day and week views,
+ <application>Evolution</application> displays all the
+ hours in the range you select here, even if there are
+ no appointments for those times. Of course, you can
+ still schedule an appointment outside of these hours,
+ and if you do, the display will be extended to show
+ it.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>First day of the week</term>
+ <listitem>
+ <para>You can set weeks to start on Sunday or on Monday.</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Start of day</term>
+ <listitem>
+ <para>
+ Says what time of the day your weekday starts. This will show all times till the end of the day, regardless of there is an appointment during the time period.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>End of day</term>
+ <listitem>
+ <para>
+ Sets the time the day ends at.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+ </sect2>
+ <sect2 id="config-prefs-cal-display">
+ <title>Display</title>
+ <para>
+ The <interface>Display</interface> section lets you configure some visual properties of the calendar.
+ </para>
+ <para>The display properties you can set are:
+
+ <variablelist>
+ <varlistentry>
+ <term>Time divisions</term>
+ <listitem>
+ <para>
+ Sets the increments shown on the daily view in the calendar. You can set this to be:
+ <itemizedlist>
+ <listitem>
+ <para>
+ 5 minutes
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ 10 minutes
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ 15 minutes
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ 30 minutes
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ 60 minutes
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>Show appointment end times in week and month views</term>
+ <listitem>
+ <para>
+ If there is space, <application>Evolution</application> will show the end times in the week and month views for each appointment.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Compress weekends in month view</term>
+ <listitem>
+ <para>
+ If checked, your weekends will be shown in one box, instead of one for each day in the month view.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>Show week numbers in date navigator</term>
+ <listitem>
+ <para>
+ This will show the week numbers next to the respective weeks in the calendar.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+ </sect2>
+
+ <sect2 id="config-prefs-cal-tasklist">
+ <title>Task List Settings</title>
+ <para>
+ You can choose what information the To Do list displays and the
+ way it is displayed.
+ <variablelist>
+ <varlistentry>
+ <term>Tasks due today</term>
+ <listitem>
+ <para>
+ Configures what color to set your tasks that are due today to.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Overdue tasks</term>
+ <listitem>
+ <para>
+ Configures what color to set your overdue items to.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+ </sect2>
+
+ <sect2 id="config-prefs-cal-other">
+ <title>Other Calendar Settings</title>
+ <para>
+ This configures miscellaneous items for the calendar and todo list's functionality.
+ <variablelist>
+ <varlistentry>
+ <term>Ask for confirmation when deleting items</term>
+ <listitem>
+ <para>
+ When you delete an item in either the Task List or the Calendar, you will be prompted to confirm that you want to delete the item.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Create new appointments with a default reminder</term>
+ <listitem>
+ <para>
+ All your appointments will be created using a default reminder enabled. You can still change what way you are reminded though. If enabled, you can then set the time before your appointment to be reminded.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+ </sect2>
+ </sect1>
+
+ <sect1 id="config-prefs-contact">
+ <title>Managing the Addressbook</title>
+ <para>
+ The addressbook does not have a large list of configuration
+ settings, but those that are there can be found in the
+ <guimenu>Tools</guimenu> menu.
+ </para>
+
+ <sect2 id="config-prefs-contact-ldap-add">
+ <title>Adding Directory Servers</title>
+ <para>
+ To add a new LDAP server to your available contact
+ folders:
+ <orderedlist numeration="arabic">
+ <listitem>
+ <para>
+ Select
+ <menuchoice>
+ <guimenu>Tools</guimenu>
+ <guimenuitem>Addressbook Sources</guimenuitem>
+ </menuchoice>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Click <guibutton>Add</guibutton>.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Enter the server information.
+ <variablelist>
+ <varlistentry>
+ <term>Account name</term>
+ <listitem>
+ <para>
+ The name that you see on the screen. This could be anything you wish.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Server name</term>
+ <listitem>
+ <para>
+ Address of the server where the addressbook is located.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>My server requires authentication</term>
+ <listitem>
+ <para>
+ Select this if the server needs a password to access the addressbook.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Port</term>
+ <listitem>
+ <para>
+ The internet port to connect to in order to access the database. This is normally 389.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Search base</term>
+ <listitem>
+ <para>
+ The base node to use for all your searches. Contact your administrator for information about setting this up.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Search scope</term>
+ <listitem>
+ <para>
+How broad the search is in the directory.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Click <guibutton>OK</guibutton>.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Click <guibutton>OK</guibutton> to permanenty make changes or <guibutton>Apply</guibutton> to temporarily set the changes.
+ </para>
+ </listitem>
+ </orderedlist>
+ </para>
+ </sect2>
+ </sect1>
+
+
+<!--
+ <sect1 id="config-prefs-general">
+ <title>General Preferences</title>
+ <para>
+ Additional configuration options will be covered here, as
+ they become available.
+ </para>
+ </sect1>
+-->
+</chapter>
+
+
+
+
+
+
diff --git a/help/zh_CN/config-sync.sgml b/help/zh_CN/config-sync.sgml
new file mode 100644
index 0000000000..5ce42c3467
--- /dev/null
+++ b/help/zh_CN/config-sync.sgml
@@ -0,0 +1,133 @@
+ <chapter id="config-sync">
+ <title>Setting up your synchronization system</title>
+ <para>
+ Synchronization presents you with two issues you'll need to
+ address.
+ <simplelist>
+ <member>
+ Your computer needs to recognize and access your handheld.
+ At this time, <application>Ximian Evolution</application> only
+ supports Palm-OS devices like the PalmPilot and the
+ Handspring Visor.
+ </member>
+ <member>
+ You should decide what sort of synchronization behavior you
+ want.
+ </member>
+ </simplelist>
+ </para>
+
+ <para>
+ If you haven't used a handheld device with your computer
+ before, you'll need to run the GNOME <application>Control
+ Center</application> by selecting
+ <menuchoice><guimenu>System</guimenu><guimenuitem>Settings</guimenuitem></menuchoice>,
+ and make sure that <application>Pilot Link</application> is
+ properly configured.
+ </para>
+ <para>
+ Once your computer and your Palm-OS device are talking happily
+ to each other, select the <glossterm
+ linkend="conduit">conduits</glossterm> you want under the
+ <guilabel>Pilot Conduits</guilabel> section of the Control
+ Center. You may use conduits to synchronize data with several
+ applications; the <application>Ximian Evolution</application>
+ conduits are labelled <guilabel>EAddress</guilabel>, for the
+ contacts in your addressbook, <guilabel>ECalendar</guilabel>,
+ for your calendar, and <guilabel>ETodo</guilabel>, for your
+ task list.
+ </para>
+ <para>
+ To enable a conduit, click the
+ <guibutton>Enable</guibutton> to enable it, and click
+ <guibutton>Settings</guibutton> to change what it will do when
+ activated. Your options may vary depending on the conduit,
+ but typically they will be:
+
+ <variablelist>
+ <varlistentry>
+ <term>Disabled:</term>
+ <listitem>
+ <para>
+ Do nothing.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>Synchronize:</term>
+ <listitem>
+ <para>
+ Copy new data from the computer to the handheld, and
+ from the handheld to the computer. Remove items
+ that were on both systems but have been deleted on
+ one.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>Copy From Pilot:</term>
+ <listitem>
+ <para>
+ If there is any new data on the the handheld device,
+ copy it to the computer.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>Copy To Pilot:</term>
+ <listitem>
+ <para>
+ Copy new data from the computer to the handheld.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>Merge From Pilot:</term>
+ <listitem>
+ <para>
+ Copy new data from the handheld to the computer, and
+ remove any information from the computer that has
+ been deleted on the handheld.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>Merge To Pilot:</term>
+ <listitem>
+ <para>
+ Copy new data from the computer to the handheld, and
+ remove any information from the handheld that has
+ been deleted on the computer.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+
+ <para>
+ Select the behavior you want for each conduit you choose to use.
+ If you're not sure, go ahead and stick with
+ <guilabel>Synchronize</guilabel>. Then, put your handheld on
+ its cradle and press the HotSync button.
+ </para>
+ <para>
+ <tip>
+ <title>Data Loss Prevention</title>
+ <para>
+ It's always a good idea to make a backup. To do that,
+ make a copy of the <filename>evolution</filename>
+ directory inside your home directory.
+ </para>
+ </tip>
+ </para>
+
+ </chapter>
+
+
+
+
diff --git a/help/zh_CN/evolution.sgml b/help/zh_CN/evolution.sgml
new file mode 100644
index 0000000000..aff75abe03
--- /dev/null
+++ b/help/zh_CN/evolution.sgml
@@ -0,0 +1,138 @@
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V4.1//EN"[
+
+<!ENTITY PREFACE SYSTEM "preface.sgml">
+<!ENTITY USAGE-MAINWINDOW SYSTEM "usage-mainwindow.sgml">
+<!ENTITY USAGE-EXEC-SUMMARY SYSTEM "usage-exec-summary.sgml">
+<!ENTITY USAGE-MAIL SYSTEM "usage-mail.sgml">
+<!ENTITY USAGE-MAIL-ORG SYSTEM "usage-mail-org.sgml">
+<!ENTITY USAGE-CONTACT SYSTEM "usage-contact.sgml">
+<!ENTITY USAGE-CALENDAR SYSTEM "usage-calendar.sgml">
+<!ENTITY USAGE-SYNC SYSTEM "usage-sync.sgml">
+<!ENTITY USAGE-PRINT SYSTEM "usage-print.sgml">
+<!ENTITY CONFIG-PREFS SYSTEM "config-prefs.sgml">
+<!ENTITY CONFIG-SYNC SYSTEM "config-sync.sgml">
+<!ENTITY MENUREF SYSTEM "menuref.sgml">
+<!ENTITY APX-GLOSS SYSTEM "apx-gloss.sgml">
+<!ENTITY APX-COMMON-TASKS SYSTEM "apx-common-tasks.sgml">
+<!ENTITY APX-BUGS SYSTEM "apx-bugs.sgml">
+<!ENTITY APX-AUTHORS SYSTEM "apx-authors.sgml">
+
+]>
+
+
+<!-- Almost every chapter is an entity. Files, Chapter id's, and
+entity names correspond. APX is for appendix. Note that there is no
+entity for apx-notes.sgml, which is still included in the file
+set. Reinstate the entity if and when the Notes feature is
+implemented. -->
+
+<book id="index">
+ <bookinfo>
+ <title>A User's Guide to Ximian Evolution</title>
+ <authorgroup>
+ <author><firstname>Aaron</firstname><surname>Weber</surname></author>
+ <author><firstname>Kevin</firstname><surname>Breit</surname></author>
+ <author><firstname>Ettore</firstname><surname>Perazzoli</surname></author>
+ <author><firstname>Duncan</firstname><surname>Mak</surname></author>
+ </authorgroup>
+ <copyright>
+ <year>2001</year>
+ <holder>Ximian, Inc.</holder>
+ </copyright>
+
+ <legalnotice id="legalnotice">
+
+ <para>
+ Permission is granted to copy, distribute and/or modify this
+ document under the terms of the <ulink type="help"
+ url="gnome-help:fdl"><citetitle>GNU Free Documentation
+ License</citetitle></ulink>, Version 1.1 or any later version
+ published by the Free Software Foundation with no Invariant
+ Sections, no Front-Cover Texts, and no Back-Cover Texts. You
+ may obtain a copy of the <citetitle>GNU Free Documentation
+ License</citetitle> from the Free Software Foundation by
+ visiting <ulink type="http" url="http://www.fsf.org">their
+ Web site</ulink> or by writing to: Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
+ USA.
+ </para>
+ <para>
+ Many of the names used by companies to distinguish their
+ products and services are claimed as trademarks. Where those
+ names appear in any GNOME documentation, and those trademarks
+ are made aware to the members of the GNOME Documentation
+ Project, the names have been printed in caps or initial caps.
+ </para>
+ </legalnotice>
+
+ <releaseinfo>
+ This is version 1.0 of the Ximian Evolution manual.
+ </releaseinfo>
+
+ </bookinfo>
+
+ &PREFACE;
+
+ <part id="usage">
+ <title>Getting Started with Ximian Evolution</title>
+ <partintro>
+ <para>
+ Part one of the <application>Ximian Evolution</application> manual
+ describes how to use <application>Ximian Evolution</application> for
+ email, contact management, and appointment and task
+ scheduling. You'll find as you go along that there's more
+ than one way to do things, and you can pick whichever method
+ you like best.
+ </para>
+ </partintro>
+
+ &USAGE-MAINWINDOW;
+ &USAGE-EXEC-SUMMARY;
+ &USAGE-MAIL;
+ &USAGE-MAIL-ORG;
+ &USAGE-CONTACT;
+ &USAGE-CALENDAR;
+<!-- &USAGE-NOTES; -->
+ &USAGE-SYNC;
+ &USAGE-PRINT;
+ </part>
+ <part id="config">
+ <title>Configuring and Managing Ximian Evolution</title>
+ <partintro>
+ <para>
+ <application>Ximian Evolution</application> is highly
+ configurable. Usually, when developers say that, they mean
+ that they didn't test it out thoroughly and have left it to
+ other programmers to "configure" themselves a working
+ system. In the case of <application>Ximian
+ Evolution</application>, "configurable", it means that, while
+ you can expect the program to work perfectly well in its
+ default settings, it's also easy to alter its behavior in a
+ wide variety of ways, so that it fits your needs exactly.
+ This part of the book will describe that process, from the
+ quickest glimpse of the Setup Assistant to an in-depth tour of
+ the preferences dialogs.
+ </para>
+ </partintro>
+
+ &CONFIG-PREFS;
+ &CONFIG-SYNC;
+ </part>
+
+<!-- &FAQ; Just link to the webpage -->
+ &MENUREF;
+ &APX-GLOSS;
+ &APX-BUGS;
+ &APX-AUTHORS;
+
+</book>
+
+
+
+
+
+
+
+
+
+
diff --git a/help/zh_CN/menuref.sgml b/help/zh_CN/menuref.sgml
new file mode 100644
index 0000000000..340a408847
--- /dev/null
+++ b/help/zh_CN/menuref.sgml
@@ -0,0 +1,421 @@
+<!--
+<!DOCTYPE Appendix PUBLIC "-//GNOME//DTD DocBook PNG Variant V1.1//EN">
+-->
+
+<appendix id="menuref">
+ <title>Quick Reference</title>
+ <para>
+ You might want to copy this section and tape it to the wall
+ next to your computer: it's a very short summary of most of
+ the things you'll want to do with
+ <application>Ximian Evolution</application>.
+ </para>
+
+
+<note id="shortcuts">
+<title>Custom Keyboard Shortcuts</title>
+<para>
+ If you have set custom keyboard shortcuts for your desktop, (you can
+ do this the control center: select
+ <menuchoice><guimenu>System</guimenu><guimenuitem>Settings</guimenuitem></menuchoice>
+ from your menu panel), they may interfere with Evolution keyboard
+ shortcuts.
+</para>
+<para>
+ For example, if you have chosen Emacs-style key bindings for your
+ desktop-wide text editor, the shortcut
+ <keycombo action="simul">
+ <keycap>Ctrl</keycap>
+ <keycap>W</keycap>
+ </keycombo>
+ will act as "Cut region" rather than as "Close Window" in the
+ message composer.
+</para>
+</note>
+
+
+
+
+ <sect1 id="quickref-open">
+ <title>Opening or Creating Anything</title>
+ <para>
+ <variablelist>
+
+
+ <varlistentry>
+ <term>New Item:</term>
+ <listitem>
+ <para>
+ Press <keycombo action="simul"> <keycap>Ctrl</keycap>
+ <keycap>N</keycap> </keycombo> to open a new item
+ for whatever part of <application>Ximian
+ Evolution</application> you're working on. In mail,
+ that means you'll create a new message. If you're
+ looking at your addressbook, <keycombo
+ action="simul"> <keycap>Ctrl</keycap>
+ <keycap>N</keycap> </keycombo> creates a new contact
+ card, and in the calendar, a new appointment.
+ </para>
+ </listitem>
+ </varlistentry>
+
+
+ <varlistentry>
+ <term>Create a new folder:</term>
+ <listitem>
+ <para>
+ <menuchoice><guimenu>File</guimenu><guisubmenu>New</guisubmenu>
+ <guimenuitem>Folder</guimenuitem></menuchoice> or
+ <keycombo action="simul">
+ <keycap>Ctrl</keycap>
+ <keycap>Shift </keycap>
+ <keycap>E</keycap>
+ </keycombo>
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>Create a new Shortcut in the Evolution Bar:</term>
+ <listitem>
+ <para>
+ <menuchoice><guimenu>File</guimenu>
+ <guisubmenu>New</guisubmenu>
+ <guimenuitem>Evolution Bar Shortcut</guimenuitem> </menuchoice> or
+ <keycombo action="simul">
+ <keycap>Ctrl</keycap>
+ <keycap>Shift</keycap>
+ <keycap>S</keycap>
+ </keycombo>
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>Create a new email message:</term>
+ <listitem>
+ <para>
+ Use
+ <menuchoice><guimenu>File</guimenu><guisubmenu>New</guisubmenu><guimenuitem>Mail
+ Message</guimenuitem> </menuchoice> or
+ <keycombo action="simul">
+ <keycap>Ctrl</keycap>
+ <keycap>Shift </keycap>
+ <keycap>M</keycap>
+ </keycombo>
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>Create a new Appointment:</term>
+ <listitem>
+ <para>
+ <menuchoice><guimenu>File</guimenu>
+ <guisubmenu>New</guisubmenu>
+ <guimenuitem>Appointment</guimenuitem> </menuchoice> or
+ <keycombo action="simul">
+ <keycap>Ctrl</keycap>
+ <keycap>Shift</keycap>
+ <keycap>A</keycap>
+ </keycombo>
+ </para>
+ </listitem>
+ </varlistentry>
+
+
+ <varlistentry>
+ <term>Enter a new Contact:</term>
+ <listitem>
+ <para>
+ Double-click in any blank space in the contact
+ manager to create a new address card. You can also
+ use
+ <menuchoice><guimenu>File</guimenu>
+ <guisubmenu>New</guisubmenu>
+ <guimenuitem>Contact</guimenuitem> </menuchoice> or
+ <keycombo action="simul">
+ <keycap>Ctrl</keycap>
+ <keycap>Shift</keycap>
+ <keycap>C</keycap>
+ </keycombo>
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>Create a new Task:</term>
+ <listitem>
+ <para>
+ <menuchoice><guimenu>File</guimenu>
+ <guisubmenu>New</guisubmenu>
+ <guimenuitem>Task</guimenuitem> </menuchoice> or
+ <keycombo action="simul">
+ <keycap>Ctrl</keycap>
+ <keycap>Shift</keycap>
+ <keycap>T</keycap>
+ </keycombo>
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+ </sect1>
+ <sect1 id="quickref-mail">
+ <title>Mail Tasks</title>
+ <para>
+ Here are the most frequent email tasks, and shortcuts for
+ navigating your mailbox with the keyboard instead of the
+ mouse:
+ <variablelist>
+
+
+ <varlistentry>
+ <term>Send and Receive Mail:</term>
+ <listitem>
+ <para>
+ Press <keycap>F9</keycap>, click the
+ <guibutton>Send/Receive</guibutton> button in the
+ toolbar, or choose
+ <menuchoice><guimenu>Actions</guimenu>
+ <guimenuitem>Send/Receive</guimenuitem></menuchoice>.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Navigating the Message List with the Keyboard:</term>
+ <listitem>
+ <para>
+ Press <keycap>N</keycap> to jump to the next unread
+ message. <keycap>P</keycap> goes to the previous
+ unread message. Use the arrow keys to move up
+ and down along the list of all messages.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>Move the display up and down in the preview pane:</term>
+ <listitem>
+ <para>
+ Press the space bar to go a page down. Press
+ <keycap>Backspace</keycap> to go a page up.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>Reply to a Message:</term>
+ <listitem>
+ <para>
+ To reply to the sender of the message only:
+ click <guibutton>Reply</guibutton> in the
+ toolbar, or press
+ <keycombo action="simul">
+ <keycap>Ctrl</keycap>
+ <keycap>R</keycap>
+ </keycombo>
+ </para>
+ <para>
+ To reply to the sender and all the other visible
+ recipients of the message, click <guibutton>Reply to
+ All</guibutton> or select the message and press
+ <keycombo action="simul">
+ <keycap>Shift</keycap>
+ <keycap>Ctrl</keycap>
+ <keycap>R</keycap>
+ </keycombo>
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>Forward a Message:</term>
+ <listitem>
+ <para>
+ Select the message or messages you want to forward,
+ and click <guibutton>Forward</guibutton> in the
+ toolbar, or press
+ <keycombo action="simul">
+ <keycap>Ctrl</keycap>
+ <keycap>F</keycap>
+ </keycombo>
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>Open a Message in a New Window:</term>
+ <listitem>
+ <para>
+ Double-click the message you want to view, or select
+ it and press
+ <keycombo action="simul">
+ <keycap>Ctrl</keycap>
+ <keycap>O</keycap>
+ </keycombo>
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>Create Filters and Virtual Folders:</term>
+ <listitem>
+ <para>
+ Right-click on a message and select
+ <guimenuitem>Create Rule From
+ Message</guimenuitem>. You can also create filters and
+ virtual folders in the <guimenu>Tools</guimenu> menu.
+ </para>
+ </listitem>
+ </varlistentry>
+
+
+ <varlistentry>
+ <term>Add Sender to Address Book:</term>
+ <listitem>
+ <para>
+ Right-click on a message and select <guimenuitem>Add
+ Sender to Address Book</guimenuitem>. You can also
+ right-click on any email address to add it to your
+ address book.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+
+
+
+ </para>
+ </sect1>
+ <sect1 id="quickref-cal">
+ <title>Calendar</title>
+ <para>
+ <variablelist>
+
+ <varlistentry>
+ <term>Create a new Appointment:</term>
+ <listitem>
+ <para>
+ <menuchoice><guimenu>File</guimenu>
+ <guisubmenu>New</guisubmenu>
+ <guimenuitem>Appointment</guimenuitem> </menuchoice> or
+ <keycombo action="simul">
+ <keycap>Ctrl</keycap>
+ <keycap>Shift</keycap>
+ <keycap>A</keycap>
+ </keycombo>
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>Create a new Task:</term>
+ <listitem>
+ <para>
+ <menuchoice><guimenu>File</guimenu>
+ <guisubmenu>New</guisubmenu>
+ <guimenuitem>Task</guimenuitem> </menuchoice> or
+ <keycombo action="simul">
+ <keycap>Ctrl</keycap>
+ <keycap>Shift</keycap>
+ <keycap>T</keycap>
+ </keycombo>
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term></term>
+ <listitem>
+ <para>
+ <tip id="new-appt">
+ <title>New Appointments Fast</title>
+ <para>
+ Click on any blank spot in the calendar and start
+ typing to create a new appointment entry.
+ </para>
+ </tip>
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+
+ </para>
+ </sect1>
+ <sect1 id="quickref-contact">
+ <title>Addressbook</title>
+ <para>
+ Here are shortcuts for the most frequent addressbook actions:
+ <variablelist>
+ <varlistentry>
+ <term>Edit a Contact:</term>
+ <listitem>
+ <para>
+ You can edit a contact two ways:
+ <itemizedlist>
+ <listitem>
+ <para>
+ Click once on the person's address card and you can
+ edit the person's properties all in the same window.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Double-click on the contact's card and alter their details.
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+
+ <variablelist>
+ <varlistentry>
+ <term>Deleting a Contact:</term>
+ <listitem>
+ <para>
+ Right click on a contact and click <guilabel>Delete</guilabel>
+ or select a contact and press the <guibutton>Delete</guibutton>
+ on the <guilabel>toolbar</guilabel>.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+
+
+ <variablelist>
+ <varlistentry>
+ <term>Email a Contact:</term>
+ <listitem>
+ <para>
+ Right click on a contact and select
+ <guilabel>Send message to contact</guilabel>.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+
+ <variablelist>
+ <varlistentry>
+ <term>Creating a New Contact:</term>
+ <listitem>
+ <para>
+ Double-click in any blank space in the contact
+ manager to create a new address card. You can also
+ use <menuchoice><guimenu>File</guimenu>
+ <guisubmenu>New</guisubmenu>
+ <guimenuitem>Contact</guimenuitem> </menuchoice> or
+ <keycombo action="simul">
+ <keycap>Ctrl</keycap>
+ <keycap>Shift</keycap>
+ <keycap>C</keycap>
+ </keycombo>
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+ </sect1>
+</appendix> \ No newline at end of file
diff --git a/help/zh_CN/preface.sgml b/help/zh_CN/preface.sgml
new file mode 100644
index 0000000000..9637beaf4c
--- /dev/null
+++ b/help/zh_CN/preface.sgml
@@ -0,0 +1,83 @@
+<!--
+<!DOCTYPE preface PUBLIC "-//GNOME//DTD DocBook PNG Variant V1.1//EN">
+-->
+ <preface id="introduction">
+ <title>About this Book</title>
+ <sect1 id="organization">
+ <title>Organization</title>
+ <para>
+ This book is divided into two parts, with several
+ appendices. The first part is a <link linkend="usage">guided
+ tour</link>, which will explain how to use
+ <application>Evolution</application>. If you are new to
+ <application>Evolution</application> or to groupware in
+ general, this section is for you. The second section, covering
+ <link linkend="config">configuration</link>, is targeted at
+ more advanced users, but anyone who wants to change the way
+ <application>Evolution</application> looks or acts can benefit
+ from reading it.
+ </para>
+ </sect1>
+
+ <sect1 id="typography">
+ <title>Typographical conventions</title>
+ <para>
+ In this book, we'll mark some words with special typography:
+ <simplelist>
+ <member><application>Applications</application></member>
+ <member><command>Commands</command> you type at the command line</member>
+ <member><guilabel>Labels</guilabel> for buttons and other portions of the graphical interface</member>
+
+ <member> Menu selections look like this:
+ <menuchoice>
+ <guimenu>Menu</guimenu>
+ <guisubmenu>Submenu</guisubmenu>
+ <guimenuitem>Menu Item</guimenuitem>
+ </menuchoice>
+ </member>
+ <member><guibutton>Buttons</guibutton> you can
+ click</member> <member><userinput>Anything you type
+ in</userinput></member> <member><computeroutput>Text
+ output from a computer</computeroutput></member>
+ <member><glossterm linkend="apx-gloss">Words</glossterm>
+ that are defined in the <xref linkend="apx-gloss">.</member>
+ </simplelist>
+</para>
+<para>
+We'll provide assorted bits of additional information in tips set off from the rest of the book, as well.
+
+ <tip id="example-tip">
+ <title>Tip</title>
+ <para>
+ Tips and bits of extra information will look like
+ this.
+ </para>
+ </tip>
+</para>
+
+<para>
+Examples are also set off from the rest of the text. They look like this:
+
+ <example>
+ <title>Example Example</title>
+ <para>
+ This is what an example looks like. We'll provide
+ examples for some of the more complicated tasks you
+ might be performing.
+ </para>
+ </example>
+</para>
+<para>
+Lastly, we'll have warnings, in cases where you should be careful:
+
+ <warning id="example-warning">
+ <title>Example Warning</title>
+ <para>
+ This is what a warning looks like. If there's a chance
+ you'll run into trouble, we'll warn you beforehand.
+ </para>
+ </warning>
+ </para>
+ </sect1>
+</preface>
+
diff --git a/help/zh_CN/usage-calendar.sgml b/help/zh_CN/usage-calendar.sgml
new file mode 100644
index 0000000000..4a1745e55a
--- /dev/null
+++ b/help/zh_CN/usage-calendar.sgml
@@ -0,0 +1,561 @@
+<!--
+<!DOCTYPE Chapter PUBLIC "-//GNOME//DTD DocBook PNG Variant V1.1//EN">
+-->
+
+<chapter id="usage-calendar">
+ <title>Managing your Schedule</title>
+
+ <para>
+ This chapter will show you how to use the Ximian Evolution
+ Calendar to manage your schedule alone or in conjunction with
+ peers.
+ </para>
+
+ <sect1 id ="usage-calendar-view">
+ <title>Ways of Looking at your Calendar</title>
+ <para>
+ The toolbar offers you four different views of your calendar:
+ <itemizedlist>
+ <listitem>
+ <para>
+ Day
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Work Week
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Week
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Month
+ </para>
+ </listitem>
+ </itemizedlist>
+
+ Press the calendar-shaped buttons on the right side of the toolbar to
+ switch between views.
+
+ You can also select a range of
+ days&mdash; three days, ten days, or a fortnight if you want
+ &mdash; in the small calendar at the upper right. To do this, simply click and drag on the days that you wish to view in your calendar.
+
+ </para>
+ <para>
+ The <guibutton>Prev</guibutton> and <guibutton>Next</guibutton>
+ buttons will move you forward and back in your calendar pages.
+ If you're looking at only one day, you'll see tomorrow's page,
+ or yesterday's. If you're looking at your calendar by week or
+ month, you'll move around by just that much.
+ To come back to today's listing, click the
+ <guibutton>Today</guibutton> button in the toolbar.
+ </para>
+ <para>
+ To visit a specific date's calendar entries, click
+ <guibutton>Go To</guibutton> and select the date in the dialog
+ box that appears.
+ </para>
+
+ </sect1>
+ <sect1 id="usage-calendar-apts">
+ <title>Scheduling With the Evolution Calendar</title>
+ <para>
+ Of course, you'll want to use the calendar to do more than find
+ out what day it is. This section will tell you how to schedule
+ appointments, set alarms, and determine appointment recurrence.
+ </para>
+
+ <sect2 id="usage-calendar-apts-basic">
+ <title>Creating appointments</title>
+ <para>
+ To create a new appointment, select
+ <menuchoice>
+ <guimenu>File</guimenu>
+ <guisubmenu>New</guisubmenu>
+ <guimenuitem>Appointment</guimenuitem>
+ </menuchoice>
+ or click the <guibutton>New Appointment</guibutton> button on the left end
+ of the toolbar. The <interface>New Appointment</interface>
+ dialog will pop up with the menu bar, tool bar, and
+ window full of choices for you.
+ </para>
+ <tip id="new-appointment-shortcut">
+ <title>Shortcut</title>
+ <para>
+ If you don't need to enter more information than the date
+ and time of the appointment, you just click in any blank
+ space in the calendar and start typing. You can enter other
+ information later with the appointment editor.
+ </para>
+ </tip>
+
+ <para>
+ Your appointment must have a starting and ending date &mdash; by
+ default, today &mdash; but you can choose whether to give it
+ starting and ending times or to mark it as an <guilabel>All
+ day event</guilabel>. An <guilabel>All day event</guilabel>
+ appears at the top of a day's appointment list, in the grey header under the date, rather than inside
+ it. That makes it easy to have appointments that overlap and fit
+ inside each other. For example, a conference might be an all
+ day appointment, and the meetings at the conference would be timed
+ appointments. Of course, appointments with specific starting and ending
+ times can also overlap. When they do they're displayed as
+ multiple columns in the day view of the calendar.
+ </para>
+ <para>
+ <application>Evolution</application> supports the use of timezones. If you share calendar files with friends or co-workers, it is quite possible you will need to configure your timezone. To configure your timezone:
+ <orderedlist numeration="arabic">
+ <listitem>
+ <para>
+ Click
+ <menuchoice>
+ <guimenu>Tools</guimenu>
+ <guimenuitem>Calendar Settings</guimenuitem>
+ </menuchoice>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Click the <guibutton>Globe</guibutton> button in the <guilabel>Time</guilabel> section, located in the <guilabel>General</guilabel> tab.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Each red dot represents a major city. Click a dot and click <guibutton>OK</guibutton> to select your time zone.
+ </para>
+ </listitem>
+ </orderedlist>
+ </para>
+ <para>
+ You can also configure timezone information specific to Start and End time in each appointment. To do that, simply create a new appointment and click on a globe to customize the timezone that the time exists in.
+ </para>
+ <note>
+ <title>Multiple Simultanious Appointments</title>
+ <para>
+ If you create calendar appointments that overlap,
+ <application>Evolution</application> will display them side
+ by side in your calendar. However,
+ <application>Evolution</application> cannot help you do
+ multiple things at once.
+ </para>
+ </note>
+ <para>
+ You can have as many
+ <guilabel>Alarms</guilabel>, any time prior to the appointment
+ you've scheduled. You can have one alarm of each of the following types:
+ <variablelist>
+ <varlistentry>
+ <term><guilabel>Display:</guilabel></term>
+ <listitem>
+ <para>
+ A window will pop up on your screen to remind you of
+ your appointment.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><guilabel>Audio:</guilabel></term>
+ <listitem>
+ <para>
+ Choose this to have your computer deliver a sound
+ alarm.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><guilabel>Program:</guilabel></term>
+ <listitem>
+ <para>
+ Select this if you would like to run a program as a
+ reminder. You can enter its name in the text field,
+ or find it with the <guibutton>Browse</guibutton>
+ button.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+
+ </para>
+ <para>
+ <guilabel>Classification</guilabel>
+ only applies to calendars on a
+ network. <guilabel>Public</guilabel> is the default category,
+ and a public appointment can be viewed by anyone on the calendar
+ sharing network. <guilabel>Private</guilabel> denotes one
+ level of security, and <guilabel>Confidential</guilabel> an even
+ higher level.
+ </para>
+ <para>
+ <application>Evolution</application> can handle not only time that you're busy, but free time. This can be useful if you're on a network sharing calendar files. You can easily compare schedules with other people, allowing easy setup of a RSVP.
+ </para>
+ <para>
+ To set your appointment to be free or busy, simply click the box in the <guilabel>Show Time As</guilabel> section in the <guilabel>Appointment Editor</guilabel>.
+ </para>
+ <para>
+ <application>Evolution</application> lets you categorize your
+ appointments, which can help if you lead a busy life. The bottom
+ section of the <guilabel>Appointment</guilabel> tab is where your
+ categorization is done.
+ </para>
+
+ <tip>
+ <title>Adding a New Appointment Category</title>
+ <para>
+ You can add a new category to your category list by clicking on
+ <guibutton>Edit Master Category List</guibutton> and single-clicking
+ on <guilabel> Click here to add a category</guilabel>.
+ </para>
+ </tip>
+
+ <para>
+ The purpose of categories is to let you view all appointments which have
+ similar activities. To do this, change <guilabel>Any field contains</guilabel>
+ to <guilabel>Has category</guilabel> and enter your category at right.
+ </para>
+
+ <para>
+ Clicking on the <guibutton>Categories</guibutton> button opens up the category
+ list. To associate a category to an appointment, simply click the check box.
+ </para>
+ <para>
+ Once you've selected your categories, click <guibutton>OK</guibutton> to
+ assign these categories to the appointment. The categories you selected are now
+ listed in the text box to the right of the <guibutton>Categories...</guibutton>
+ button.
+ </para>
+
+ <para>
+ The <guilabel>Recurrence</guilabel> tab lets you describe
+ repetition in appointments ranging from once every day up to once
+ every 100 years. You can then choose a time and date when the
+ appointment will stop recurring, and, under
+ <guilabel>Exceptions</guilabel>, pick individual days when the
+ appointment will <emphasis>not</emphasis> recur. Make your
+ selections from left to right, and you'll form a sentence:
+ "Every two weeks on Monday and Friday until January 3, 2003"
+ or "Every month on the first Friday for 12 occurrences."
+ </para>
+
+ <para>
+ Once you're done with all those settings, click on the disk
+ icon in the toolbar to save and close the appointment editor window.
+ If you want, you can alter an appointment
+ summary in the calendar view by clicking on it and typing. You
+ can change other settings by right-clicking on the appointment then
+ choosing <guimenuitem>Edit this Appointment</guimenuitem>.
+ </para>
+ </sect2>
+ <sect2 id="usage-calendar-rsvp">
+ <title>Sending an RSVP with the Calendar</title>
+ <para>
+ <application>Evolution</application> can be used to schedule
+ group meetings and help you manage responses to meeting
+ requests.
+ </para>
+ <para>
+ When you create a meeting or group appointment, you can
+ specify the attendees in several categories, such as "chair"
+ or "required." When you save the appointment listing, each
+ attendee will be sent an email with the appointment
+ information and gives them the option to respond.
+ </para>
+ <para>
+ To schedule a meeting:
+ <orderedlist numeration="arabic">
+ <listitem>
+ <para>
+ Select
+ <menuchoice>
+ <guimenu>Actions</guimenu> <guimenuitem>Schedule
+ Meeting</guimenuitem> </menuchoice>. The
+ <guilabel>Scheduling</guilabel> and
+ <guilabel>Meeting</guilabel> tabs open.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ If you have multiple Evolution identities, choose the
+ one you'll use by selecting an item in the
+ <guilabel>Sent By</guilabel> field.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Click the space labelled <guilabel>Click here to add an
+ attendee</guilabel> to enter the names and email
+ addresses of people you will invite, or click the
+ <guibutton>Invite Others</guibutton> to select them from
+ your addressbook.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Save the Appointment.
+ </para>
+ </listitem>
+ </orderedlist>
+ An email is now sent out to all the recipients, inviting them to your event.
+ </para>
+ </sect2>
+ <sect2 id="replying-to-rsvp">
+ <title>Replying to a Meeting Request</title>
+ <para>
+ Meeting requests are sent as iCal attachments. To view or
+ respond to one, click on the attachment icon and view it
+ inline in the mail window. All the details are shown about
+ the event including time and dates. Then you can choose how
+ to reply to the RSVP. Your choices are:
+ <itemizedlist>
+ <listitem>
+ <para>
+ Accept
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Tentatively Accept
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Decline
+ </para>
+ </listitem>
+ </itemizedlist>
+ Click <guibutton>OK</guibutton> and an email will be sent to
+ the organizer with your answer. The event will also be added
+ to your calendar if you accept.
+ </para>
+ </sect2>
+
+ <sect2 id="recieving-rsvp-response">
+ <title>Getting Responses to Meeting Requests</title>
+ <para>
+ Once you get a reply to your meeting invitation, you'll need
+ to view it inline in the email. Click the attachment and
+ select <guibutton>View Inline</guibutton>. At the bottom, you
+ can click <guibutton>OK</guibutton> to update your attendee
+ list.
+ </para>
+ </sect2>
+
+<!-- ############UNIMPLEMENTED FEATURES ###################
+
+ <sect2 id="usage-calendar-apts-group">
+ <title>Appointments for Groups</title>
+ <para>
+ You can use <application>Evolution</application> to mark a
+ meeting request on another person's calendar. To do it, click
+ <guibutton>New</guibutton> in the calendar toolbar, or select
+ <menuchoice> <guimenu>File</guimenu>
+ <guisubmenu>New</guisubmenu>
+ <guimenuitem>Appointment</guimenuitem> </menuchoice> to bring
+ up the <interface>new appointment</interface> window. Then
+ describe the appointment as you would any other. When you are
+ ready to send the invitation <guibutton>OK</guibutton>
+ <application>Evolution</application> will automatically send
+ email to each person on the request list, notifying of the
+ time and date of the meeting you have requested with them. In
+ addition, it will mark the appointment on your calendar and on
+ theirs as tentative, rather than a confirmed, appointment.
+ </para>
+ <para>
+ To mark a tentative appointment as confirmed, click once on the
+ appointment in the <interface>calendar view</interface> to select
+ it, and then choose <guimenuitem>Appointment
+ Properties</guimenuitem> from the <guimenu>Settings</guimenu>
+ menu. In the <interface>Appointment Properties</interface> dialog
+ window, click the "tentative" button to De-select the
+ appointment.
+ </para>
+ <para>
+ When your meeting attendees get the email inviting them to the
+ meeting, they'll be able to enter the information into their
+ calendars and let you know if they'll be able to attend; if
+ they use <application>Ximian Evolution</application> or
+ another iCal compliant mail client, they can do this with just
+ one click. When you get a response from them, it will include
+ an iCal attachment. Opening and accepting this attachment will
+ change the meeting data in your calendar to indicate that they
+ have responded to your invitation, and whether they will be in
+ attendance.
+ </para>
+ </sect2>
+
+
+ <sect2 id="usage-calendar-apts-privs">
+ <title>Scheduling privileges</title>
+ <para>
+ There are several levels of scheduling privileges. You
+ can set whether people can see your calendar, whether they
+ can request meetings or appointments, and whether they can
+ create appointments. This section may have to be deleted,
+ because I don't know if we are going to support privileges
+ at all.
+ </para>
+ </sect2>
+ ########## END UNIMPLEMENTED FEATURESET ############ -->
+
+ </sect1>
+
+ <sect1 id="usage-calendar-todo">
+ <title>The Task Pad</title>
+ <para>
+ The Task Pad, located in the lower right corner of the
+ calendar, lets you keep a list of tasks separate from your
+ calendar appointments. You can use the list
+ in a larger window by choosing the <guibutton>Tasks</guibutton>
+ button in the shortcut bar or in the folder tree.
+ </para>
+ <para>
+ To record a new task, click the <guibutton>Add</guibutton>
+ button in the toolbar. <application>Evolution</application>
+ will pop up a small window with five items in it:
+
+ <variablelist>
+ <varlistentry>
+ <term> <guilabel>Summary:</guilabel></term>
+ <listitem>
+ <para>
+ The description you enter here will appear in the To Do
+ list itself.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term> <guilabel>Due Date:</guilabel></term>
+ <listitem>
+ <para>
+ Decide when this item is
+ due. You can either type in a date and time, or select one from
+ the <guibutton>Calendar</guibutton> and time drop-down menus.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><guilabel>Start Date:</guilabel></term>
+ <listitem>
+ <para>
+ The date you intend to start working.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term> <guilabel>Description:</guilabel></term>
+ <listitem>
+ <para>
+ If you wish, you can keep a more detailed description of
+ the item here. For example, you can note that a task is
+ in progress, and display how close it is to completion.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><guilabel>Classification:</guilabel></term>
+ <listitem>
+ <para>
+ Sets who will see it if your calendar is shared.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+ <para>
+ There are more options in the <guilabel>Details</guilabel> tab such as priority and progress settings.
+ </para>
+ <para>
+ Once you've added a task to your to-do list, its summary
+ appears in the <guilabel>Summary</guilabel> section of task
+ list. To view or edit a detailed description of an item,
+ double-click on it, or right click on it and select <guibutton>Open</guibutton>. You can delete items by selecting
+ them and clicking on the <guibutton>Delete</guibutton> button.
+ </para>
+ <para>
+ The list of tasks is sorted in a similar way to the list of
+ email messages in <application>Ximian Evolution
+ Mail</application>. Click once on the message headers to change
+ the direction and type of sorting, or right-click to add or
+ remove columns from the display.
+ </para>
+ <sect2 id="task-folders">
+ <title>Folders for Your Tasks</title>
+ <para>
+ Like any other component in
+ <application>Evolution</application>, you can create a folder
+ to help organize your tasks. To do this:
+ <orderedlist numeration="arabic">
+ <listitem>
+ <para>
+ Open the <guilabel>Folders Bar</guilabel>.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Click <guibutton>Tasks</guibutton>.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Right click on <guibutton>Tasks</guibutton>.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Click <menuchoice><guimenuitem>Create New Folder</guimenuitem></menuchoice>.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Enter the folder name.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Click <guibutton>OK</guibutton>
+ </para>
+ </listitem>
+ </orderedlist>
+ </para>
+ </sect2>
+ </sect1>
+
+ <sect1 id="usage-calendar-multiple">
+ <title>Multiple Calendars</title>
+ <para>
+ <application>Evolution</application> permits you to have and
+ maintain multiple calendars. This is useful if you maintain
+ schedules for other people, if you are responsible for resource
+ or room allocation, or if you have multiple personalities.
+ </para>
+
+ <example>
+ <title>Keeping Multiple Calendars</title>
+ <para>
+ Lucy, the office manager for a small company, has one calendar
+ for her own schedule. She maintains one for the conference
+ room, to schedule meetings. Next to that, she maintains a
+ calendar that reflects when consultants are going to be on
+ site, and another that keeps track of when the Cubs are
+ playing.
+ </para>
+ </example>
+ <para>
+ To create a new calendar, select
+ <menuchoice>
+ <guimenu>File</guimenu> <guisubmenu>New</guisubmenu>
+ <guimenuitem>Folder</guimenuitem>
+ </menuchoice>.
+ You'll need to tell the <guilabel>New Folder</guilabel> dialog that the new folder should be of the calendar type. You can place the calendar in any calendar folder and access it
+ from the folder view.
+ </para>
+ <para>
+ Each calendar folder can hold only one calendar.
+ </para>
+ </sect1>
+</chapter>
diff --git a/help/zh_CN/usage-contact.sgml b/help/zh_CN/usage-contact.sgml
new file mode 100644
index 0000000000..dc11b4bd0a
--- /dev/null
+++ b/help/zh_CN/usage-contact.sgml
@@ -0,0 +1,609 @@
+<!--
+<!DOCTYPE Chapter PUBLIC "-//GNOME//DTD DocBook PNG Variant V1.1//EN">
+-->
+<chapter id="usage-contact">
+ <title>Working with Your Contacts</title>
+ <para>
+ This chapter will show you how to use the
+ <application>Evolution</application> addressbook to organize
+ any amount of contact information, share addresses over a
+ network, and several ways to save time with everyday tasks. To
+ learn about configuring the addressbook, see <xref
+ linkend="config-prefs-contact">. You can import contacts from
+ other contact management tools with the Import tool by
+ selecting
+ <menuchoice><guimenu>File</guimenu><guimenuitem>Import</guimenuitem></menuchoice>,
+ or by mailing them to yourself as vCard attachments.
+ </para>
+
+ <para>
+ The toolbar for the addressbook is quite simple.
+ <itemizedlist>
+ <listitem><para>
+ Click <guibutton>New Contact</guibutton> to create a new card, or double-click
+ in a blank space in the contact list.
+ </para></listitem>
+
+ <listitem><para>
+ Click <guibutton>New List</guibutton> to create a new card, or double-click
+ in a blank space in the contact list.
+ </para></listitem>
+
+ <listitem><para> The <guiicon>printer</guiicon> icon sends one
+ or more of your cards to the printer. </para></listitem>
+
+ <listitem><para> The <guiicon>stop sign</guiicon> icon stops loading
+ contact data from the network. This button is only
+ relevant if you are looking at contact information on a
+ network. </para></listitem>
+ </itemizedlist>
+ </para>
+
+ <para>
+ Your contact information fills the rest of the display. Move
+ through the cards alphabetically with the buttons and the
+ scrollbar to the right of the window. Of course, if you have
+ more than a few people listed, you'll want some way of finding
+ them more quickly, which is why there's a search feature.
+ </para>
+
+ <sect1 id="usage-contact-cards">
+ <title>The Contact Editor</title>
+ <para>
+ To delete a contact:
+ <orderedlist numeration="arabic">
+ <listitem>
+ <para>
+ Click once on the contact.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Press the <guibutton>Delete</guibutton> button.
+ </para>
+ </listitem>
+ </orderedlist>
+ </para>
+ <para>
+ If you want to add or change cards, you'll use the contact
+ editor. To change a card that already exists, double click on
+ it to open the contact editor window. If you want to create a new
+ card, clicking the <guibutton>New</guibutton> button in the
+ toolbar will open the same window, with blank entry boxes for
+ you to fill in.
+ </para>
+
+ <para>
+ The contact editor window has two tabs,
+ <guilabel>General</guilabel>, for basic contact information, and
+ <guilabel>Details</guilabel>, for a more specific description of
+ the person. In addition, it contains a <guimenu>File</guimenu>
+ menu and a toolbar with three items: <guilabel>Save and
+ Close</guilabel>, <guilabel>Print</guilabel>, and
+ <guilabel>Delete</guilabel>.
+ </para>
+
+ <figure id="usage-contact-editor-fig">
+ <title>Evolution Contact Editor</title>
+ <screenshot>
+ <screeninfo>Evolution Contact Editor</screeninfo>
+ <mediaobject><imageobject><imagedata
+ fileref="figures/contact-editor" format="png" srccredit="Aaron
+ Weber">
+ </imageobject></mediaobject>
+ </screenshot>
+ </figure>
+
+ <para> The <guilabel>General</guilabel> tab has seven sections,
+ each with an icon: a face, for name and company; a telephone
+ for phone numbers; an envelope for email address; a globe for
+ web page address; a house for postal address; a file folder
+ for contacts, and a briefcase for categories.
+ </para>
+ <para>
+ <variablelist>
+
+ <varlistentry>
+ <term>Full Name</term>
+ <listitem>
+ <para>
+ The <guilabel>Full Name</guilabel> field has two
+ major features:
+ <itemizedlist>
+ <listitem>
+ <para>
+ You can enter a name into the <guibutton>Full
+ Name</guibutton> field, but you can also click the
+ <guibutton>Full Name</guibutton> button to bring
+ up a small dialog box with a few text boxes
+ <variablelist>
+ <varlistentry>
+ <term><guilabel>Title: </guilabel></term>
+ <listitem> <para>
+ Enter an honorific or select one from the menu.
+ </para></listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><guilabel>First: </guilabel></term>
+ <listitem> <para>
+ Enter the first, or given, name.
+ </para></listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><guilabel>Middle: </guilabel></term>
+ <listitem> <para>
+ Enter the middle name or initial, if any.
+ </para></listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><guilabel>Last: </guilabel></term>
+ <listitem> <para>
+ Enter the last name (surname).
+ </para></listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><guilabel>Suffix: </guilabel></term>
+ <listitem> <para>
+ Enter suffixes such as "Jr." or "III."
+ </para></listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+ <para>
+ The <guilabel>Full Name</guilabel> field also
+ interacts with the <guilabel>File As</guilabel>
+ box to help you organize your contacts.
+ </para>
+ <para>
+ To see how it works, type a name in the
+ <guilabel>Full Name</guilabel> field. As an example,
+ we'll use the Ximian mascot, <userinput>Rupert
+ T. Monkey</userinput>. You'll notice that the
+ <guilabel>File As</guilabel> field also fills in,
+ but in reverse: <computeroutput>Monkey,
+ Rupert</computeroutput>. You can pick
+ <computeroutput>Rupert Monkey </computeroutput> from
+ the drop-down, or type in your own, such as
+ <userinput> T. Rupert Monkey </userinput>.
+ </para>
+ <tip>
+ <title>Filing Suggestion</title>
+ <para>
+ Don't enter something entirely different from the
+ actual name, since you might forget that you've filed
+ Rupert's information under "F" for "Fictitious Ximian
+ Employee."
+ </para>
+ </tip>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Multiple Values for Fields:</term>
+ <listitem>
+ <para>
+ If you click on the downward pointing triangle buttons
+ next to the <guilabel>Primary Email</guilabel> field,
+ you can also choose <guilabel>Email 2</guilabel> and
+ <guilabel>Email 3</guilabel>. Although the contact
+ editor will only display one of those at any given
+ time, <application>Evolution</application> will store
+ them all. Entries that have information in them have
+ a check mark next to them. The buttons next to the
+ telephone and postal address fields work in the same
+ way.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+ <para>
+ The last item in the <guilabel>General</guilabel> tab is the
+ <guilabel>Categories</guilabel> organization tool; for
+ information on that, read <xref
+ linkend="usage-contact-organize">.
+ </para>
+ <para>
+ The <guilabel>Details</guilabel> tab is much simpler:
+ <itemizedlist>
+ <listitem>
+ <para>
+ The briefcase - Describes the person's professional life
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ The face - Describes the person's personal life
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ The globe - Miscellanious notes
+ </para>
+ </listitem>
+ </itemizedlist>
+
+ <tip>
+ <title>Contact Shortcuts</title>
+ <para>
+ You can add cards from within an email message or calendar
+ appointment. While looking at an email, right-click on
+ any email address or message, and choose
+ <guimenuitem>Create Card for this Address</guimenuitem> or
+ <guimenuitem>Create Card for this Sender</guimenuitem>
+ from the menu.
+ </para>
+ </tip>
+ </para>
+ </sect1>
+
+ <sect1 id="contact-search">
+ <title>Searching for Contacts</title>
+ <para>
+ <application>Evolution</application> allows searching through contacts
+ quickly and easily.
+ </para>
+ <para>
+ To search through contacts:
+ <orderedlist numeration="arabic">
+ <listitem>
+ <para>
+ Select your search focus in the search bar.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Enter your query.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Press return to search.
+ </para>
+ </listitem>
+ </orderedlist>
+ </para>
+ <para>
+ You can refine searches by doing several in
+ succession, or start over by pressing the <guibutton>Show
+ All</guibutton> button.
+ </para>
+ <para>
+ If there are no matches, the card display will be
+ blank. When you'd like to see all the cards again, press
+ <guilabel>Show All</guilabel>.
+ </para>
+ <example id="contact-quicksearch-ex">
+ <title>Refining a Quick Search</title>
+ <para>
+ Tom comes back from lunch and finds a note on his
+ keyboard: "Curtis in sales called for you, but he didn't
+ leave a number, and I forgot to write down the name of the
+ company he works for. He said it was important, though."
+ Tom is not at all annoyed.
+ </para>
+ <para>
+ He opens his contacts folder, and runs a quick search for
+ "Curtis." There are eighteen different people with that name
+ in the file. He then enters "Sales," and
+ <application>Evolution</application> narrows it down to the
+ right Curtis. He only becomes annoyed when he discovers that
+ the call was not actually important.
+ </para>
+ </example>
+
+ <para>
+ To perform a complex search through your contacts:
+ <orderedlist numeration="arabic">
+ <listitem>
+ <para>
+ Open
+ <menuchoice>
+ <guimenu>Tools</guimenu>
+ <guimenuitem>Search for contacts</guimenuitem>
+ </menuchoice>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Name the rule in the <guilabel>Rule Name</guilabel> field.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Setup your criteria information in the <guilabel>If</guilabel> section.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ If you want to add more critera, click the <guibutton>Add
+ Criterion</guibutton> button.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Click <guibutton>Search</guibutton>.
+ </para>
+ </listitem>
+ </orderedlist>
+ </para>
+ <para>
+ To show all your contacts, select <guibutton>Show All</guibutton> in the
+ <guilabel>Search Bar</guilabel> or search with an empty query.
+ </para>
+
+ </sect1>
+
+ <sect1 id="usage-contact-organize">
+ <title>Organizing your Addressbook</title>
+ <para>
+ Organizing your addressbook is a lot like organizing your
+ mail. You can have folders and searches the same way you can
+ with mail, but the addressbook does not allow Virtual Folders. It
+ does, however, allow each card to fall under several
+ categories, and allow you to create your own categories. To
+ learn about categories, read <xref
+ linkend="usage-contact-organize-group-category">.
+ </para>
+
+<!-- UNIMPLEMENTED FEATURE
+ <para>
+ Another useful <application>Evolution</application> feature is
+ its ability to recognize when people live or work together. If
+ several people in your addressbook share an address, and you
+ change the address for one of them,
+ <application>Evolution</application> will ask you if you wish to
+ change the address for all of them, or just for one.
+ </para>
+-->
+
+ <sect2 id="usage-contact-organize-group">
+ <title>Groups of contacts</title>
+ <para>
+ <application>Evolution</application> offers two ways for you
+ to organize your cards. The first way is to use folders;
+ this works the same way mail folders do. For more
+ flexibility, you can also mark contacts as elements of
+ different categories. To better integrate with email tools,
+ you can also create lists of contacts that you can send mail
+ to as a single person.
+ </para>
+
+ <sect3 id="usage-contact-organize-group-folder">
+ <title>Grouping with Folders</title>
+ <para>
+ The simplest way to group address cards is to use folders.
+ By default, cards start in the
+ <guilabel>Contacts</guilabel> folder. If you've read <xref
+ linkend="usage-mainwindow"> then you already know that you
+ can create a new folder by selecting
+ <menuchoice>
+ <guimenu>File</guimenu>
+ <guisubmenu>New</guisubmenu>
+ <guimenuitem>Folder</guimenuitem>
+ </menuchoice>
+ and that you can put new folders anywhere you like. Just
+ like with mail, cards must be in a card folder, and no card
+ can be in two places at once. If you want more
+ flexibility, try <xref
+ linkend="usage-contact-organize-group-category">.
+ </para>
+ <para>
+ To put a card into a folder, just drag it there from the
+ folder view. Remember that contact cards can only go in
+ contact folders, just like mail can only go in mail folders,
+ and calendars in calendar folders.
+ </para>
+ </sect3>
+
+ <sect3 id="usage-contact-organize-group-category">
+ <title>Grouping with Categories</title>
+ <para>
+ The other way to group cards is to mark them as belonging
+ to different categories.
+ That means that you
+ can mark a card as being in several categories or no
+ category at all. For example, I put my friend Matthew's
+ card in the "Business" category, because he works with me,
+ the "Friends" category, because he's also my friend, and
+ the "Frequent" category, because I call him all the time
+ and can never remember his phone number.
+ </para>
+ <para>
+ To mark a card as belonging to a category, click the
+ <guibutton>Categories</guibutton> button at the lower
+ right. From the dialog box that appears, you can check as
+ many or as few categories as you like.
+ </para>
+
+ <!-- Feature Not Implemented
+ <para>
+
+ If the master list of categories doesn't suit you, you can
+ add your own. Just enter the new category's name in the
+ text box, then click <guibutton>Categories</guibutton> and
+ choose <guilabel>Add to Master List</guilabel> in the
+ window that appears.
+ </para>
+ -->
+
+ </sect3>
+
+ <sect3 id="usage-contact-organize-group-list">
+ <title>Creating a List of Contacts</title>
+ <para>
+ To create a list of contacts:
+
+ <orderedlist numeration="arabic">
+ <listitem>
+ <para>
+ Open the list creation dialog box by clicking the
+ <guibutton>New List</guibutton> button or selecting
+ <menuchoice>
+ <guimenu>
+ File
+ </guimenu>
+ <guisubmenu>
+ New
+ </guisubmenu>
+ <guimenuitem>
+ Contact List
+ </guimenuitem>
+ </menuchoice>.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ Enter a name for the list.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Enter names or email addresses of contacts, or just
+ drag contacts from the main window into the list.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ Choose whether you would like to hide the email
+ addresses when you send a message to the list.
+ Unless it is a very small list, it is recommended
+ that you leave the addresses hidden. This is the
+ same thing as using the "Bcc:" feature discussed in
+ <xref linkend="usage-mail-getnsend-send-to-types">.
+ </para>
+ </listitem>
+
+ </orderedlist>
+ </para>
+ <para>
+ When you are done, click <guibutton>OK</guibutton>. The
+ list will appear as a contact card, which you can use as
+ you would any other. That includes emailing the list to
+ another person, and, of course, sending email to the list.
+ </para>
+ <para>
+ To mail the list, open a new email and type the name you
+ chose for the list. Ximian Evolution will address the
+ message to the entire list when you send it. You can also
+ right-click on the list's address card in the Addressbook
+ and select <guimenuitem>Send Message to List</guimenuitem>.
+ </para>
+ </sect3>
+
+
+ </sect2>
+ </sect1>
+
+<!-- we need a LDAP server up for me to test this -->
+ <sect1 id="usage-contact-sharing">
+ <title>Sharing your Cards</title>
+ <para>
+ If you keep your cards on a network using an <glossterm
+ linkend="ldap">LDAP</glossterm> server, you can share access to
+ them, browse other peoples addressbooks, or maintain a shared set of
+ contact information for your company or your department. This
+ is the sort of feature you'll want to use if your company has a
+ list of vendors and clients that needs constant updating. If
+ you share calendars as well as addressbooks, people can avoid
+ duplicating work and keep up to date on developments within
+ their workgroup or across the entire company.
+ </para>
+
+ <example id="usage-contact-sharing-ex">
+ <title>Sharing Address Cards and Calendar Data</title>
+ <para>
+ Ray wants to schedule a meeting with Company X, so he
+ checks the network for the Company X address card so he
+ knows whom to call there. Since his company also shares
+ calendars, he then learns that his co-worker Deanna has
+ already scheduled a meeting with Company X next Thursday.
+ He can either go to the meeting himself or ask Deanna to
+ discuss his concerns for him. Either way, he avoids
+ scheduling an extra meeting with Company X.
+ </para>
+ </example>
+ <para>
+ Of course, you don't want to share all of your cards&mdash; why
+ overload the network with a list of babysitters or tell
+ everyone in the office you're talking to new job prospects? If
+ you keep cards on your own computer, you can decide which items
+ you want to make accessible to others.
+ </para>
+ <para>
+ To learn how to add a remote directory to your available
+ contact folders, see <xref linkend="config-prefs-contact">.
+ Once you have a connection, the network contacts folder or
+ folders will appear inside the <guilabel>External
+ Directories</guilabel> folder in the folder bar. It will work
+ exactly like a local folder of cards, with the following
+ exceptions:
+ <itemizedlist>
+
+ <listitem>
+ <para>
+ Network folders are only available when you are
+ connected to the network. If you use a laptop or have a
+ modem connection, you may wish to copy or cache the
+ network directory. You do this by dragging and dropping your desired contacts into the local contacts list.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ To prevent excess network traffic,
+ <application>Evolution</application> will not normally
+ load the contents of LDAP folders immediately upon
+ opening. You must click <guilabel>Display
+ All</guilabel> before LDAP folder cards will be loaded
+ from the network. You can change this behavior in the
+ <interface>Contact Preferences</interface> window.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Your ability to view, change, add, and delete contacts
+ depends on the settings of the LDAP server.
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+ </sect1>
+
+ <sect1 id="contact-automation-basic">
+ <title>Send me a Card: Adding New Cards Quickly</title>
+ <para>
+ As noted before, when you get information about a person in
+ the mail or in a calendar entry, you can add it to an address
+ card. To do so, right click on any email address or email
+ message, and select <guimenuitem>Add Address
+ Card</guimenuitem> from the menu that appears. Of course,
+ <application> Evolution</application> can also add cards from a
+ hand-held device during HotSync operation. For more
+ information about that, see <xref linkend="usage-sync">.
+ </para>
+ </sect1>
+
+<!-- Unimplemented features:
+ <para>
+ You can also use the addressbook to print postal addresses
+ on mailing labels. Future versions of
+ <application>Evolution</application> will allow you to you
+ export a group of cards to a spreadsheet, database, or word
+ processor so you can print address labels or prepare large
+ mailings.
+ </para>
+ <para>
+ Need a map or directions? Click <guibutton>MapIt</guibutton> from
+ within the addressbook, and <application>Evolution</application>
+ will map the address for you online.
+ </para>
+ -->
+
+
+
+</chapter>
diff --git a/help/zh_CN/usage-mail.sgml b/help/zh_CN/usage-mail.sgml
new file mode 100644
index 0000000000..2a1958805e
--- /dev/null
+++ b/help/zh_CN/usage-mail.sgml
@@ -0,0 +1,2005 @@
+<chapter id="usage-mail">
+ <title>Using Evolution for Email</title>
+ <para>
+ This chapter, and <xref linkend="usage-mail-organize">, will
+ provide you with an in-depth guide to the capabilities of
+ Evolution as a mail client. For information about how to set up
+ your mail account, see <xref linkend="config-prefs-mail">.
+ </para>
+
+ <note>
+ <title>If you use IMAP Mail</title>
+ <para>
+ If you chose IMAP mail during the setup process, you must
+ subscribe to your mail folders before you can read mail in
+ them. Read <xref linkend="usage-mail-subscriptions"> to find out
+ how.
+ </para>
+ </note>
+
+
+ <sect1 id="usage-mail-getnsend-read">
+ <title>Reading Mail</title>
+ <para>
+ Start the mail client by clicking on the
+ <guibutton>Inbox</guibutton> icon in the shortcut bar, or by
+ selecting a mail folder in the folder bar. To read a message,
+ select it in the message list; if you'd like to see it in its
+ own window, double-click on it or press
+ <keycombo action="simul">
+ <keycap>Ctrl</keycap>
+ <keycap>O</keycap>
+ </keycombo>.
+ </para>
+
+ <tip id="spaceandbs">
+ <title>Reading Mail with the Keyboard</title>
+ <para>
+ You can click the spacebar to page down while you're reading
+ an email, and press backspace to page up in an email. This
+ may help to make reading your email faster.
+ </para>
+ </tip>
+
+ <sect2 id="usage-mail-listorder">
+ <title>Sorting the message list</title>
+ <para>
+ <application>Evolution</application> helps you work by letting you sort
+ your email. To sort by sender, subject, or date, click
+ on the bars with those labels at the top of the message
+ list. The direction of the arrow next to the label indicates
+ the direction of the sort, and if you click again, you'll
+ sort them in reverse order. For example, click once on
+ <guilabel>Date</guilabel> to sort messages by date from
+ oldest to newest. Click again, and
+ <application>Evolution</application> sorts the list from
+ newest to oldest. You can also right-click on the message
+ header bars to get a set of sorting options, and add or
+ remove columns from the message list. You can find detailed
+ instructions on how to customize your message display
+ columns in <xref linkend="usage-mail-organize-columns">.
+ </para>
+
+ <tip id="view-headers">
+ <title>Email Headers</title>
+ <para>
+ To look at the complete headers for email messages, select
+ <menuchoice><guimenu>View</guimenu><guisubmenu>Message
+ Display</guisubmenu><guimenuitem>Show Full
+ Headers</guimenuitem></menuchoice>. To see absolutely every
+ bit, choose
+ <menuchoice><guimenu>View</guimenu><guisubmenu>Message
+ Display</guisubmenu><guimenuitem>Show Email Source
+ </guimenuitem></menuchoice>.
+ </para>
+ </tip>
+
+ <para>
+ You can also choose a threaded message view. Select
+ <menuchoice>
+ <guimenu>View</guimenu>
+ <guimenuitem>Threaded</guimenuitem>
+ </menuchoice>
+ to turn the threaded view on or off. When you select this option,
+ <application>Evolution</application> groups the replies to a
+ message with the original, so you can follow the thread of a
+ conversation from one message to the next.
+ </para>
+<figure>
+ <title>Threaded Mail View</title>
+<screenshot>
+<screeninfo>Threaded Mail View</screeninfo>
+<mediaobject><imageobject><imagedata format="png" fileref="figures/mail-threaded" srccredit="Aaron Weber">
+</imageobject></mediaobject>
+</screenshot>
+</figure>
+
+ </sect2>
+
+ <sect2 id="usage-mail-getnsend-delete">
+ <title>Deleting Mail</title>
+ <para>
+ Once you've read your mail, you may want to get rid of
+ it.
+ To delete a message:
+ <orderedlist numeration="arabic">
+ <listitem>
+ <para>
+ Click the message to select it
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Press delete button or right click on the message and
+ choose <guilabel>Delete</guilabel>.
+ </para>
+ <note>
+ <title>Why do I still see deleted mail?</title>
+ <para>
+ When you press <guibutton>Delete</guibutton> or click
+ the trash button, your mail isn't actually deleted,
+ but is marked for deletion. Your email is not gone
+ until you have expunged it. When you "Expunge" a
+ folder, you remove all the mail that you have marked
+ for deletion.
+ </para>
+ <para>
+ If you don't like this behavior, select
+ <menuchoice><guimenu>View</guimenu><guimenuitem>Hide
+ Deleted Messages</guimenuitem></menuchoice>. Then,
+ you will only see deleted messages when you look in
+ your <guilabel>Trash</guilabel> folder.
+ </para>
+ </note>
+ </listitem>
+ <listitem>
+ <para>
+ Click
+ <menuchoice>
+ <guimenu>Actions</guimenu>
+ <guimenuitem>Expunge</guimenuitem>
+ </menuchoice>
+ or press
+ <keycombo action="simul">
+ <keycap>Ctrl</keycap>
+ <keycap>E</keycap>
+ </keycombo>
+ </para>
+ </listitem>
+ </orderedlist>
+ </para>
+ <note>
+ <title>Trash is Actually a vFolder?</title>
+ <para>
+ Your trash folder is actually a vFolder that displays all
+ messages you have marked for later deletion. For more
+ information about vFolders, see <xref
+ linkend="usage-mail-organize-vfolders">. If you choose
+ <menuchoice> <guimenu>Actions</guimenu> <guimenuitem>Empty
+ Trash</guimenuitem> </menuchoice> you will expunge
+ <emphasis>all</emphasis> your folders.
+ </para>
+ </note>
+ </sect2>
+ <sect2 id="usage-mail-getnsend-undelete">
+ <title>Undeleting Messages</title>
+ <para>
+ To undelete a message:
+ <orderedlist numeration="arabic">
+ <listitem>
+ <para>
+ Select a message you have marked for deletion.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Press <keycombo
+ action="simul"><keycap>Ctrl</keycap><keycap>U</keycap>
+ </keycombo>
+ or choose
+ <menuchoice>
+ <guimenu>Actions</guimenu>
+ <guimenuitem>Undelete</guimenuitem>
+ </menuchoice>
+
+ </para>
+ <note>
+ <title>What does Undelete actually do?</title>
+ <para>
+ If you have marked a message for deletion, undeleting
+ it will unmark it, and the message will be removed
+ from the Trash folder. However, it can't bring back
+ messages that have been expunged.
+ </para>
+ </note>
+ </listitem>
+ </orderedlist>
+ </para>
+ </sect2>
+ </sect1>
+
+ <sect1 id="usage-mail-getnsend-get">
+ <title>Checking for New Mail</title>
+ <para>
+ Now that you've had a look around the
+ <interface>Inbox</interface>, it's time to check for new mail.
+ Click <guibutton>Get Mail</guibutton> in the toolbar to check
+ your mail. If you haven't entered any mail settings yet, the
+ <interface>setup assistant</interface> will ask you for the
+ information it needs to check your email.
+ </para>
+ <para>
+ The assistant will give you several dialog boxes where you configure:
+ <itemizedlist>
+ <listitem>
+ <para>
+ your personal information
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ your outgoing email server information
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ your mail account identity name
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+ <para>
+ To check your email, press the <guibutton>Check Mail</guibutton>
+ button. If this is your first time checking mail, or you
+ haven't asked <application>Evolution</application> to store your
+ password, you'll be prompted for the password. Enter your
+ password and your email will be downloaded.
+ </para>
+ <note id="badmailsettings">
+ <title>Can't Check Mail?</title>
+ <para>
+ If you get an error message instead of mail, you probably need
+ to check your network settings. To learn how to do that, have
+ a look at <xref linkend="config-prefs-mail">, or ask your
+ system administrator.
+ </para>
+ </note>
+
+
+
+ <tip>
+ <title>Sharing Mailboxes with Other Mail Programs</title>
+ <para>
+ If you want to use <application>Evolution</application>
+ and another email client, such as
+ <application>Mutt</application>, at the same time,
+ here's how:
+ <orderedlist numeration="arabic">
+ <listitem>
+ <para>
+ Download your mail in the other application as
+ you would normally.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ In <application>Evolution</application>
+ <menuchoice><guimenu>Tools</guimenu><guimenuitem>Mail
+ Settings</guimenuitem></menuchoice>, and pick the account
+ you'd like to use to share mail. You may want to
+ create a new account just for this source of
+ mail.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Under the <guilabel>Receiving Mail</guilabel>
+ tab, select the type of mail file that your
+ other mail application uses, and then enter the
+ full path to that file.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Click the <guibutton>OK</guibutton> button.
+ </para>
+ </listitem>
+ </orderedlist>
+ </para>
+ </tip>
+
+
+<!-- NOT FOR 1.0
+ <sect2 id="usage-mail-getnsend-get-news">
+ <title>Using Evolution for News</title>
+ <para>
+ Newsgroups are so similar to email that there's no reason not
+ to read them side by side. If you want to do that, add a
+ news source to your configuration (see <xref
+ linkend="config-prefs-network-news">). The news server will
+ appear as a remote server, and will look quite similar to an
+ IMAP folder. When you click <guibutton>Get Mail</guibutton>,
+ <application>Evolution</application> will also check for news
+ messages.
+ </para>
+ </sect2>
+-->
+
+ <sect2 id="usage-mail-getnsend-get-attach">
+ <title>Working with Attachments and HTML Mail</title>
+ <para>
+ If someone sends you an <glossterm linkend="attachment">attachment</glossterm>,
+ a file attached to an email,
+ <application>Evolution</application> will display the file
+ at the bottom of the message to which it's attached. Text,
+ including HTML formatting and embedded images, will appear
+ as part of the message, rather than at the end of the
+ message as an attachment.
+ </para>
+
+ <sect3 id="usage-mail-getnsend-get-attach-actions">
+ <title>Saving or Opening Attachments</title>
+ <para>
+ If you get an attachment with an email message,
+ <application>Ximian Evolution</application> can help you save
+ it or open it with the appropriate applications.
+ </para>
+ <para>
+ To save an attachment to disk:
+ <orderedlist numeration="arabic">
+ <listitem>
+ <para>
+ Click the downward pointing arrow on the attachment icon
+ and select <guimenuitem>Save to Disk</guimenuitem>.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Choose a location and name for the file.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Click <guibutton>OK</guibutton>.
+ </para>
+ </listitem>
+ </orderedlist>
+ </para>
+
+ <para>
+ To Open an Attachment in a Program:
+ <orderedlist numeration="arabic">
+ <listitem>
+ <para>
+ Open the mail message with the attachment you want to read.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Click the arrow next the attachment icon.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Select the program you'd like to use. It will start up
+ and open the document.
+ </para>
+ </listitem>
+ </orderedlist>
+ </para>
+ <para>
+ </para>
+ </sect3>
+
+ <sect3 id="usage-mail-getnsend-get-attach-html">
+ <title>Inline Images in HTML Mail</title>
+ <para>
+ When someone sends you HTML mail that includes an image in
+ the body of the message (for example, the welcome message in your
+ Inbox when you first start <application>Ximian
+ Evolution</application>) <application>Evolution</application>
+ will display the image inside the message. You can create
+ messages like this by using the
+ <menuchoice><guimenu>Insert</guimenu><guimenuitem>Image</guimenuitem></menuchoice>
+ tool in the message composer.
+ </para>
+
+ <para>
+ If the image isn't included in the message, but is, instead,
+ a link to an image, <application>Evolution</application> can
+ download the image from the Internet for you. However,
+ <application>Evolution</application> will not display the
+ image unless you ask it to. This is because remotely hosted
+ images can be slow to load and display, and can even be used
+ by spammers to track who reads their email. Having images
+ not load automatically helps protect your privacy.
+ </para>
+ <para>
+ If you want the images to load for one message, select
+ <menuchoice>
+ <guimenu>View</guimenu>
+ <guisubmenu>Message Display</guisubmenu>
+ <guimenuitem>Load Images</guimenuitem>
+ </menuchoice>.
+
+ If you want <application>Ximian Evolution</application> to
+ load remotely hosted images more often, go to the
+ <guilabel>Display</guilabel> tab of the
+ <menuchoice>
+ <guimenu>Tools</guimenu>
+ <guimenuitem>Mail Settings</guimenuitem>
+ </menuchoice> dialog.
+ </para>
+ <note id="http-proxy">
+ <title>Loading Images from the Net through an HTTP Proxy</title>
+ <para>
+ If you use an HTTP proxy,
+ <application>Evolution</application> must be able to find
+ it through the <systemitem>gnome-vfs</systemitem> subsystem
+ before it can load images from the Internet. This is also
+ the case if you wish to access weather and news information
+ through the Summary tool. You can tell the GNOME Virtual
+ File System about your HTTP proxy in one of two ways:
+ <variablelist>
+ <varlistentry>
+ <term>Configure it with Nautilus</term>
+ <listitem>
+ <para>
+ <orderedlist numeration="arabic">
+ <listitem>
+ <para>
+ Open a Nautilus window
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Select <menuchoice>
+ <guimenu>Preferences</guimenu>
+ <guimenuitem>Edit Preferences</guimenuitem>
+ </menuchoice>.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Go to the <guilabel>Navigation</guilabel> tab.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Click the <guilabel>Use HTTP Proxy</guilabel>
+ checkbox and enter the location of your HTTP
+ proxy in the <guilabel>Location</guilabel> field.
+ </para>
+ </listitem>
+ </orderedlist>
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Configure it with the gconftool command</term>
+ <listitem>
+ <para>
+ <orderedlist numeration="arabic">
+ <listitem>
+ <para>
+ Open a terminal.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Enter the command
+ <command>
+ gconftool --type=bool --set /system/gnome-vfs/use-http-proxy "TRUE"
+ </command>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Enter the command
+ <command>
+ gconftool --type=string --set /system/gnome-vfs/http-proxy-host "your-proxy-url"
+ </command>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Enter the command
+ <command>
+ gconftool --type=int --set /system/gnome-vfs/http-proxy-port "8080"
+ </command>
+ </para>
+ </listitem>
+ </orderedlist>
+ </para>
+ <para>
+ For more information about the gconftool command,
+ read the gconftool man page.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+ </note>
+ </sect3>
+ </sect2>
+ </sect1>
+
+ <sect1 id="usage-mail-getnsend-send">
+ <title>Composing New Email Messages</title>
+ <para>
+ You can start writing a new email message by selecting
+ <menuchoice> <guimenu>File</guimenu>
+ <guisubmenu>New</guisubmenu> <guimenuitem>
+ Mail Message</guimenuitem></menuchoice>, or by pressing the
+ <guibutton>Compose</guibutton> button in the Inbox toolbar.
+ When you do so, the <interface>New Message</interface> window
+ will open, as shown in <xref
+ linkend="usage-mail-newmsg-fig">.
+ </para>
+
+<!-- ==============Figure=================================== -->
+ <figure id="usage-mail-newmsg-fig">
+ <title>New Message Window</title>
+ <screenshot>
+ <screeninfo>Evolution Main Window</screeninfo>
+ <mediaobject><imageobject><imagedata fileref="figures/newmsg" format="png" srccredit="Aaron Weber">
+ </imageobject></mediaobject>
+ </screenshot>
+ </figure>
+<!-- ==============End of Figure=================================== -->
+
+ <para>
+ Enter an address in the <guilabel>To:</guilabel> field. If you
+ wish, enter a subject in the <guilabel>Subject:</guilabel>, and
+ a message in the box at the bottom of the window.
+ Once you have written your message, press
+ <guibutton>Send</guibutton>.
+ </para>
+
+ <sect2 id="usage-mail-getnsend-send-delay">
+ <title>Sending Composed Messages Later</title>
+ <para>
+ <application>Evolution</application> will send mail
+ immediately unless you tell it to do otherwise by selecting
+ <menuchoice> <guimenu>File</guimenu> <guimenuitem>Send
+ Later</guimenuitem></menuchoice>. This will add your
+ messages to the <guilabel>Outbox</guilabel> queue. The
+ "Send Later" feature is particularly useful if you use a
+ modem to connect to the Internet and pay per-minute
+ charges: you can remain offline until you need to send
+ mail, then connect and send all your mail at once. Mail in
+ the outbox is sent when you click
+ <guibutton>Send/Recieve</guibutton> in the main window.
+ </para>
+ <para>
+ To learn more about how you can specify message queue and
+ filter behavior, see <xref linkend="config-prefs-mail">.
+ </para>
+ <note>
+ <title>Working Offline</title>
+ <para>
+ Select
+ <menuchoice><guimenu>File</guimenu><guimenuitem>Work
+ Offline</guimenuitem></menuchoice> to have
+ <application>Ximian Evolution</application> disconnect
+ from the Internet while you work. When you want to
+ reconnect, choose
+ <menuchoice><guimenu>File</guimenu><guimenuitem>Work
+ Online</guimenuitem></menuchoice>. Alternativly, you can click the connection button at the bottom left side of the window.
+ </para>
+ </note>
+
+ <para>
+ You can also choose to save messages as drafts or as text
+ files. Your options are:
+ <itemizedlist>
+ <listitem><para>
+ Choose
+ <menuchoice>
+ <guimenu>File</guimenu>
+ <guimenuitem>Save Draft</guimenuitem>
+ </menuchoice>
+ to store your messages in the drafts folder for later
+ revision.
+ </para></listitem>
+
+ <listitem><para>
+ If you'd like to have the message sent later, you
+ can choose <guimenuitem>Send Later</guimenuitem>. That way,
+ the message will be added to the queue, and you can send a
+ batch of messages all at once.
+ </para></listitem>
+
+ <listitem><para>
+ If you prefer to save your message as a text file,
+ choose <guimenuitem>Save As</guimenuitem> and then choose a
+ file name.
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+ </sect2>
+
+ <sect2 id="usage-mail-getnsend-send-compose">
+ <title>More About Mail Composition</title>
+ <para>
+ In the next few sections, you'll see how
+ <application>Evolution</application> handles advanced email
+ features, including large recipient lists, attachments, and
+ forwarding.
+ </para>
+ <sect3 id="usage-mail-getnsend-send-attach">
+ <title>Attachments</title>
+ <para>
+ To attach a file to your email:
+ <orderedlist numeration="arabic">
+ <listitem>
+ <para>
+ Push the attach button in the composer toolbar
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Select the file you want to attach
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Press <guibutton>OK</guibutton>
+ </para>
+ </listitem>
+ </orderedlist>
+ </para>
+ <para>
+ You can drag a file from your desktop into the composer window to
+ attach it as well.
+ </para>
+ <para>
+ To hide the display of files you've attached to the
+ message, select <menuchoice>
+ <guimenu>View</guimenu> <guimenuitem>Hide
+ Attachments</guimenuitem> </menuchoice>; to show them
+ again, choose <guimenuitem>Show Attachments</guimenuitem>.
+ </para>
+ <para>
+ When you send the message, a copy of the attached file
+ will go with it. Be aware that big attachments can take a
+ long time to download.
+ </para>
+ </sect3>
+
+ <sect3 id="usage-mail-getnsend-send-to-types">
+ <title>Specifying Recipients for Email</title>
+ <para>
+ <application>Evolution</application>, like most email
+ programs, recognizes three types of addressee: primary
+ recipients, secondary recipients, and hidden ("blind")
+ recipients.
+ </para>
+ <para>
+ The simplest way to direct a message is to put the email
+ address or addresses in the <guilabel>To:</guilabel>
+ field, which denotes primary recipients. To send mail to
+ more than one or two people, you can use the
+ <guilabel>Cc:</guilabel> field.
+ </para>
+ <para>
+ Hearkening back to the dark ages when people used
+ typewriters and there were no copy machines, "Cc" stands
+ for "Carbon Copy." Use it whenever you want to share a
+ message you've written to someone else.
+ </para>
+ <para>
+ <guilabel>Bcc:</guilabel> is a little more complex. You
+ use it like <guilabel>Cc:</guilabel>, but people on the
+ <guilabel>Bcc:</guilabel> list are hidden from the other
+ recipients of the message. Use it to send mail to large
+ groups of people, especially if they don't know each other
+ or if privacy is a concern. If your <guilabel>Bcc:</guilabel> field is absent, click
+ <menuchoice>
+ <guimenu>View</guimenu>
+ <guimenuitem>Bcc Field</guimenuitem>
+ </menuchoice>.
+
+ </para>
+
+ <para>
+ If you frequently write email to the same groups of people,
+ you can create address lists in the Contact Manager, and
+ then send them mail as though they had a single address.
+ To learn how to do that, read <xref
+ linkend="usage-contact-organize-group-list">.
+ </para>
+
+ </sect3>
+
+ <sect3 id="usage-mail-getnsend-send-to">
+ <title>Choosing Recipients Quickly</title>
+ <para>
+ If you have created address cards in the contact manager,
+ you can also enter nicknames or other portions of address
+ data, and <application>Evolution</application> will offer a
+ drop down list of possible address completions from your
+ address book. If you enter a name or nickname that can go
+ with more than one card, Evolution will open a dialog box to
+ ask you which person you meant.
+
+<!-- Also, <application>Evolution</application> will add a
+ domain to any unqualified addresses. By default, this is
+ your domain, but you can choose which one mail preferences
+ dialog. NOTE: Bug filed on this: it's not available now,
+ but may be in the future.
+-->
+
+ </para>
+
+ <para>
+ Alternately, you can click on the
+ <guibutton>To:</guibutton>, <guibutton>Cc:</guibutton>, or
+ <guibutton>Bcc:</guibutton> buttons to get a list --
+ potentially a very long one -- of the email addresses
+ in your contact manager. Select addresses and click on
+ the arrows to move them into the appropriate address
+ columns.
+ </para>
+ <para>
+ For more information about using email together with the
+ contact manager and the calendar, see <xref
+ linkend="contact-automation-basic"> and <xref
+ linkend="usage-calendar-apts">.
+ </para>
+ </sect3>
+ </sect2>
+
+ <sect2 id="usage-mail-getnsend-send-reply">
+ <title>Replying to Email Messages</title>
+ <para>
+ To reply to a message, press the
+ <guibutton>Reply:</guibutton> button while it is selected,
+ or choose <guimenuitem>Reply to Sender:</guimenuitem> from
+ the message's right-click menu. That will open the
+ <interface>message composer</interface>. The
+ <guilabel>To:</guilabel> and <guilabel>Subject:</guilabel>
+ fields will already be filled, although you can alter them
+ if you wish. In addition, the full text of the old message
+ is inserted into the new message, either grey (for
+ HTML display) or with the &gt; character before each line
+ (in plain text mode), to indicate that it's part of the
+ previous message. People often intersperse their message
+ with the quoted material as shown in <xref
+ linkend="usage-mail-getnsend-reply-fig">.
+
+ <!-- ==============Figure=================================== -->
+ <figure id="usage-mail-getnsend-reply-fig">
+ <title>Reply Message Window</title>
+ <screenshot>
+ <screeninfo>Evolution Main Window</screeninfo>
+ <mediaobject><imageobject><imagedata fileref="figures/replymsg" format="png" srccredit="Aaron Weber">
+ </imageobject></mediaobject>
+ </screenshot>
+ </figure>
+<!-- ==============End of Figure=================================== -->
+ </para>
+ <para>
+ If you're reading a message with several recipients, you may
+ wish to use <guibutton>Reply to All</guibutton> instead of
+ <guibutton>Reply</guibutton>. If there are large numbers
+ of people in the <guilabel>Cc:</guilabel> or
+ <guilabel>To:</guilabel> fields, this can save substantial
+ amounts of time.
+ <example>
+ <title>Using the Reply to All feature</title>
+ <para>
+ Susan sends an email to a client and sends copies to Tim
+ and to an internal company mailing list of co-workers.
+ If Tim wants to make a comment for all of them to read,
+ he uses <guibutton>Reply to All</guibutton>, but if he
+ just wants to tell Susan that he agrees with her, he
+ uses <guibutton>Reply</guibutton>. Note that his reply
+ will not reach anyone that Susan put on her
+ <guilabel>Bcc</guilabel> list, since that list is not
+ shared with anyone.
+ </para>
+ </example>
+ </para>
+ <para>
+ If you're subscribed to a mailing list, and want your reply
+ to go just to the list, rather than to the sender, choose
+ <guibutton>Reply to List</guibutton> instead of
+ <guibutton>Reply</guibutton> or <guibutton>Reply to
+ All</guibutton>.
+ <note>
+ <title>What is a Mailing List?</title>
+ <para>
+ Mailing Lists are one of the most popular tools for
+ group collaboration on the Internet. Here's how they work:
+ <simplelist>
+ <member>
+ Someone sends a message to a single address, like
+ <email>evolution@ximian.com</email>.
+ </member>
+ <member>
+ That address belongs to a program that distributes
+ the message to a list of recipients.
+ </member>
+ </simplelist>
+ The mail management program lets individuals subscribe
+ to or unsubscribe from the list at will, without
+ requiring the message writers to remember the addresses
+ of every recipient.
+ </para>
+ <para>
+ Mailing list servers can also let network administrators
+ control mail flow, list membership, and even moderate
+ the content of mailing lists.
+ </para>
+ </note>
+ </para>
+ </sect2>
+
+ <sect2 id="usage-mail-getnsend-send-find">
+ <title>Searching and Replacing with the Composer</title>
+ <para>
+ You are probably familiar with search and replace features
+ in any sort of text-editing software, and if you come from
+ a Linux or Unix background, you may know what
+ <guimenuitem>Find Regex</guimenuitem> does. If you aren't
+ among the lucky who already know, here's a quick rundown of
+ the automated text searching features that the message
+ composer makes available to you.
+ </para>
+ <para>
+ <variablelist>
+ <varlistentry>
+ <term><guimenuitem>Find:</guimenuitem></term>
+ <listitem><para> Enter a word or phrase, and
+ <application>Evolution</application> will find it
+ in your message.
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><guimenuitem>Find Regex:</guimenuitem></term>
+ <listitem>
+ <para>
+ Find a regex, also called a
+ <glossterm linkend="regular-expression">regular
+ expression</glossterm>, in your composer window.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><guimenuitem>Find Again:</guimenuitem></term>
+ <listitem><para>
+ Select this item to repeat the last search you performed.
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><guimenuitem>Replace:</guimenuitem></term>
+ <listitem><para>
+ Find a word or phrase, and replace it with
+ something else.
+ </para></listitem>
+ </varlistentry>
+
+ </variablelist>
+ </para>
+
+ <para>
+ For all of these menu items, you can choose whether or not
+ to <guilabel>Search Backwards</guilabel> in the document
+ from the point where your cursor is. For all but the
+ regular expression search (which doesn't need it), you are
+ offered a check box to determine whether the search is to
+ be <guilabel>Case Sensitive</guilabel> when it determines
+ a match.
+ </para>
+ </sect2>
+
+ <sect2 id="usage-mail-getnsend-send-html">
+ <title>Enhance your email with HTML</title>
+ <para>
+ Normally, you can't set text styles or insert pictures in
+ emails, which is why email is often regarded as
+ uncommunicative and cold, and why people often resort to
+ using far too many exclamation points to convey their
+ feelings. However, most newer email programs can display
+ images and text styles as well as basic alignment and
+ paragraph formatting. They do this with <glossterm
+ linkend="html">HTML</glossterm>, just like web pages do.
+ </para>
+ <note>
+ <title>HTML Mail is not a Default Setting</title>
+ <para>
+ Some people do not have HTML-capable mail clients, or
+ prefer not to receive HTML-enhanced mail because it is
+ slower to download and display. Because some people may
+ prefer not to get HTML mail,
+ <application>Evolution</application> sends plain text
+ unless you explicitly ask for HTML.
+ </para>
+ </note>
+
+ <para> You can change the format of an email message between
+ plain text and HTML by choosing <menuchoice>
+ <guimenu>Format</guimenu> <guimenuitem>
+ HTML</guimenuitem></menuchoice>.
+ </para>
+ <para>
+ To send all your mail as HTML by default, set your mail
+ format preferences in the mail configuration dialog. See
+ <xref linkend="config-prefs-mail-other"> for more
+ information.
+ </para>
+ <para>
+ HTML formatting tools are located in the toolbar just above
+ the space where you'll actually compose the message, and
+ they also appear in the <guimenu>Insert</guimenu> and
+ <guimenu>Format</guimenu> menus.
+ </para>
+ <para>
+ The icons in the toolbar are explained in <glossterm
+ linkend="tooltip">tool-tips</glossterm>, which appear when
+ you hold your mouse over the buttons. The buttons fall
+ into four categories:
+ <variablelist>
+ <varlistentry>
+ <term>Headers and lists:</term>
+ <listitem>
+ <para>
+ At the left edge of the toolbar, you can choose
+ <guilabel>Normal</guilabel> for a default text style
+ or <guilabel>Header 1</guilabel> through
+ <guilabel>Header 6</guilabel> for varying sizes of
+ header from large (1) to tiny (6). Other styles
+ include <guilabel>preformat</guilabel>, to use the HTML
+ tag for preformatted blocks of text, and three types
+ of bullet points for the highly
+ organized.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Text style:</term>
+ <listitem>
+ <para>
+ Use these buttons to determine the way your letters
+ look. If you have text selected, the style will
+ apply to the selected text. If you do not have text
+ selected, the style will apply to whatever you type
+ next. The buttons are:
+ <itemizedlist mark="none">
+ <listitem><para>Push <guibutton>B</guibutton> for bold text</para></listitem>
+ <listitem><para>Push <guibutton>I</guibutton> for italics</para></listitem>
+ <listitem><para>Push <guibutton>U</guibutton> to underline</para></listitem>
+ <listitem><para>Push <guibutton>S</guibutton> for a strikethrough.</para></listitem>
+ </itemizedlist>
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Alignment:</term>
+ <listitem>
+ <para>
+ Located next to the text style buttons, these three
+ paragraph icons should be familiar to users of most
+ word processing software. The leftmost button will
+ make your text aligned to the left, the center
+ button, centered, and the right hand button,
+ aligned on the right side.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>Indentation rules:</term>
+ <listitem>
+ <para>
+ The button with the arrow pointing left will reduce
+ a paragraph's indentation, and the right arrow will
+ increase its indentation.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>Color Selection:</term>
+ <listitem>
+ <para>
+ At the far right is the color section tool. The
+ colored box displays the current text color; to
+ choose a new one, click the arrow button just to the
+ right. If you have text selected, the color will
+ apply to the selected text. If you do not have text
+ selected, the color will apply to whatever you type
+ next. You can select a background color or image by
+ right-clicking on the message background and
+ selecting <guilabel>Page</guilabel>.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+ <para>
+ The <guimenu>Insert</guimenu> gives you opinions which let you
+ spruce up your email to make it more interesting:
+ <variablelist>
+ <varlistentry>
+ <term><guimenuitem>Link:</guimenuitem></term>
+ <listitem>
+ <para>
+ Lets you link some text to a website. Use this tool to put hyperlinks in your HTML
+ messages. If you don't want special link text, you can just enter the address
+ directly, and <application>Evolution</application>
+ will recognize it as a link. To add a link:
+ <orderedlist numeration="arabic">
+ <listitem>
+ <para>
+ Select the text you wish to link from.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Right click on the text and click on <guibutton>Link</guibutton>.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Put the URL you want to use in the <guilabel>URL</guilabel> field.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Click <guibutton>OK</guibutton>.
+ </para>
+ </listitem>
+ </orderedlist>
+ </para>
+ <note>
+ <para>
+ If you're typing a webpage address to be automatically formatted, keep in mind that a space terminates the link.
+ </para>
+ </note>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><guimenuitem>Image:</guimenuitem></term>
+ <listitem>
+ <para>
+ Lets you put an image alongside text.
+ </para>
+ <para>
+ To insert an image into your email:
+ <orderedlist numeration="arabic">
+ <listitem>
+ <para>
+ Open a new email by clicking <guibutton>New Message</guibutton>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Make sure that you have the
+ <menuchoice>
+ <guimenu>Format</guimenu>
+ <guimenuitem>HTML</guimenuitem>
+ </menuchoice>
+ selector checked.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Click the <guibutton>Insert Image</guibutton> button in the toolbar, or select
+ <menuchoice>
+ <guimenu>Insert</guimenu>
+ <guimenuitem>Image</guimenuitem>
+ </menuchoice>.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Choose your image by clicking the <guibutton>Browse</guibutton> button.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Press <guibutton>Insert</guibutton> to insert the image.
+ </para>
+ </listitem>
+ </orderedlist>
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><guimenuitem>Rule:</guimenuitem></term>
+ <listitem>
+ <para>
+ Inserts a horizontal line into the text to help divide two
+ sections.
+ </para>
+ <para>
+ To insert a rule:
+ <orderedlist numeration="arabic">
+ <listitem>
+ <para>
+ Open a new email by clicking <guibutton>New Message</guibutton>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Make sure that you have the
+ <menuchoice>
+ <guimenu>Format</guimenu>
+ <guimenuitem>HTML</guimenuitem>
+ </menuchoice>
+ selector checked.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Click the <guibutton>Rule</guibutton> button in the <guilabel>Toolbar</guilabel>.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Select the type of rule. You can use a plain
+ line, a 3D line, or a yellow line with flowers.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Choose the size of the line, as a percentage of the width of the email window.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ Choose the alignment and style. For the plain
+ line, you can choose the thickness of the line,
+ and whether it will be shaded, or solid. For the
+ other types, you can only choose alignment.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ Click <guibutton>Insert</guibutton> to insert the rule.
+ </para>
+ </listitem>
+ </orderedlist>
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Table:</term>
+ <listitem>
+ <para>
+ Inserts a table into the text to help divide two
+ sections.
+ </para>
+ <para>
+ To insert a rule:
+ <orderedlist numeration="arabic">
+ <listitem>
+ <para>
+ Open a new email by clicking <guibutton>New Message</guibutton>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Make sure that you have the
+ <menuchoice>
+ <guimenu>Format</guimenu>
+ <guimenuitem>HTML</guimenuitem>
+ </menuchoice>
+ selector checked.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Click the <guibutton>Table</guibutton> button in the <guilabel>Toolbar</guilabel>.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Select the <guibutton>Template</guibutton> you wish to use. Each template has a slightly different feel and layout.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ If you so desire, you may change the other options such as: number of rows, columns, spacing of each cell, and more.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Click the <guibutton>Insert</guibutton> button.
+ </para>
+ </listitem>
+ </orderedlist>
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ To add a hyperlink to your HTML message:
+ <orderedlist numeration="arabic">
+ <listitem>
+ <para>
+ Select the text you want to display as a link.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Right click on text and select
+ <guimenuitem>Link</guimenuitem>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Enter the address you wish to link to in the
+ <guilabel>URL</guilabel> field.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Press <guibutton>OK</guibutton>.
+ </para>
+ </listitem>
+ </orderedlist>
+ </para>
+
+ <para>
+ To add an image to your HTML message:
+ <orderedlist numeration="arabic">
+ <listitem>
+ <para>
+ Select
+ <menuchoice>
+ <guimenu>Insert</guimenu>
+ <guimenuitem>Image</guimenuitem>
+ </menuchoice>.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Click <guibutton>Browse</guibutton> to select the image
+ you want to include in your email.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ Along the right side of the window, choose the alignment,
+ border, and other attributes of the image. If you change
+ the size attributes, the image will be shrunk or stretched
+ to fit the size you have chosen.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ If you would like to make the image a clickable link,
+ enter a URL in the <guilabel>Link</guilabel> tab of the
+ window.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ When you are finished, press
+ <guibutton>Insert</guibutton> to include the image in
+ your message.
+ </para>
+ </listitem>
+ </orderedlist>
+ </para>
+ <para>
+ You can insert an image into the background of your message by
+ right-clicking on the message background and selecting
+ <guimenuitem>Page</guimenuitem>. From that dialog, you may
+ also select background color and set other general options
+ about the html message you are composing.
+ </para>
+ <sect3 id="html-templates">
+ <title>HTML Templates</title>
+ <para>
+ <application>Evolution</application> not only allows you to
+ decorate your email with HTML text and graphics, but
+ provides you with prebuilt templates for you to use when
+ making these improvements. You can use these to emphasize a
+ point or frame an image in an attractive manner.
+ </para>
+ <para>
+ To include a template into your HTML based email:
+ <orderedlist numeration="arabic">
+ <listitem>
+ <para>
+ Create a new email by clicking <guibutton>New Message</guibutton>.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Make sure that the
+ <menuchoice>
+ <guimenu>
+ Format
+ </guimenu>
+ <guimenuitem>
+ HTML
+ </guimenuitem>
+ </menuchoice>
+ selector is checked.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Click the <guibutton>HTML Template</guibutton> button in the
+ <guilabel>Toolbar</guilabel> or select
+ <menuchoice>
+ <guimenu>
+ Insert
+ </guimenu>
+ <guimenuitem>
+ HTML Template
+ </guimenuitem>
+ </menuchoice>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Select the template type in the
+ <guilabel>Template</guilabel> selection box. Your
+ options are <guilabel>Note</guilabel> and
+ <guilabel>Image Frame</guilabel>.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Set the size and alignment of the HTML template.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ Click <guibutton>Insert</guibutton> to insert it where the
+ cursor is.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Once you have inserted the template, click on the text
+ in the template, and enter the text you want to use.
+ </para>
+ <para>
+ If you have selected an image frame template,
+ right-click on the image and select
+ <guimenuitem>Image</guimenuitem> to select the image
+ you want to place in the frame.
+ </para>
+ </listitem>
+ </orderedlist>
+ </para>
+ </sect3>
+ <sect3 id="composer-tables">
+ <title>Tables in Email</title>
+ <para>
+ <application>Evolution</application> allows you to put
+ tables in your HTML email to help organize your thoughts.
+ These tables are a simplified version of what you might find
+ in a spreadsheet program like
+ <application>Gnumeric</application>.
+ </para>
+ <para>
+ To include a table in your email:
+ <orderedlist numeration="arabic">
+ <listitem>
+ <para>
+ Create a new email by clicking <guibutton>New Message</guibutton>.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Make sure you have the
+ <menuchoice>
+ <guimenu>
+ Format
+ </guimenu>
+ <guimenuitem>
+ HTML
+ </guimenuitem>
+ </menuchoice>
+ selector checked.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ Select
+ <menuchoice>
+ <guimenu>
+ Insert
+ </guimenu>
+ <guimenuitem>
+ Table
+ </guimenuitem>
+ </menuchoice>
+ or click the <guiicon>Table</guiicon> button in the
+ toolbar.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ Select the template, or style, you want to use for the
+ table.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Set the number of rows and columns you want.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Click the <guibutton>Insert</guibutton> button.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Click in a cell and type to insert text into the table.
+ </para>
+ </listitem>
+ </orderedlist>
+ </para>
+ <para>
+ You can also edit a table after creation. Just right-click
+ on it and select <guimenuitem>Table</guimenuitem> to open
+ the table editing window again. Or, you can select items
+ from the <guimenu>Table Delete</guimenu> and <guimenu>Table
+ Insert</guimenu> menus.
+ </para>
+
+ <para>
+ <tip id="table-tip">
+ <title>Deleting an Entire Table</title>
+ <para>
+ You can delete an entire table by right-clicking on
+ a table or other HTML object in a message, and selecting
+ <menuchoice>
+ <guimenu>Table Delete</guimenu>
+ <guimenuitem>Table</guimenuitem> </menuchoice>. In an
+ HMTL message, your signature, templates, and image
+ inclusions all have tables around them, and you can remove
+ them completely and quickly with this shortcut.
+ </para>
+ </tip>
+ </para>
+
+ </sect3>
+ </sect2>
+
+ <sect2 id="usage-mail-getnsend-fwd">
+ <title>Forwarding Mail</title>
+ <para>
+ The post office forwards your mail for you when you change
+ addresses, and you can forward a letter if it comes to you by mistake.
+ The email <guilabel>Forward</guilabel> button
+ works in much the same way. It's particularly useful if you
+ have received a message and you think someone else would
+ like to see it. You can forward a message as an attachment
+ to a new message (this is the default) or
+ you can send it <glossterm linkend="inline">inline</glossterm> as a quoted
+ portion of the message you are sending. Attachment
+ forwarding is best if you want to send the full, unaltered
+ message on to someone else. Inline forwarding is best if
+ you want to send portions of a message, or if you have a
+ large number of comments on different sections of the
+ message you are forwarding. Remember to note from whom the
+ message came, and where, if at all, you have removed or
+ altered content.
+ </para>
+ <para>
+ To forward a message you are reading, press
+ <guibutton>Forward</guibutton> on the toolbar, or select
+ <menuchoice> <guimenu>Message</guimenu>
+ <guimenuitem>Forward</guimenuitem> </menuchoice>. If you
+ prefer to forward the message <glossterm linkend="inline">inline</glossterm>
+ instead of attached, select <menuchoice>
+ <guimenu>Message</guimenu> <guimenuitem>Forward
+ Inline</guimenuitem> </menuchoice> from the menu. Choose an
+ addressee as you would when sending a new message; the
+ subject will already be entered, but you can alter it.
+ Enter your comments on the message in the
+ <interface>composition frame</interface>, and press
+ <guibutton>Send</guibutton>.
+ </para>
+ </sect2>
+
+ <sect2 id="usage-mail-getnsend-ettiquette">
+ <title>Seven Tips for Email Courtesy</title>
+ <para>
+
+ <itemizedlist>
+
+ <listitem>
+ <para>
+ Don't send spam or forward chain mail. If you must,
+ watch out for hoaxes and urban legends, and make sure
+ the message doesn't have multiple layers of
+ greater-than signs, (&gt;) indicating multiple layers
+ of careless in-line forwarding.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ Always begin and close with a salutation. Say "please"
+ and "thank you," just like you do in real life. You
+ can keep your pleasantries short, but be pleasant!
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ WRITING IN CAPITAL LETTERS MEANS YOU'RE SHOUTING!
+ Don't write a whole message in capital letters. It
+ hurts people's ears.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ Check your spelling and use complete sentences. By
+ default, <application>Evolution</application> will put
+ a red line beneath words it doesn't recognize, as you
+ type them.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ Don't send nasty emails (flames). If you get one,
+ don't write back.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ When you reply or forward, include just enough of
+ the previous message to provide context: not too
+ much, not too little.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ Don't send spam.
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+ <para> Happy mailing! </para>
+ </sect2>
+ </sect1>
+ <sect1 id="rsvp-stuff">
+ <title>RSVPs in Mail</title>
+ <para>
+ If you create an event in the calendar component, you can then
+ send invitations to the attendee list through the
+ <application>Ximian Evolution</application> email tool. The
+ invitation card is sent as an attachment in iCal format.
+ </para>
+ <para>
+ If you click on the attachment button and click the
+ <guibutton>View Inline</guibutton>, <application>Ximian
+ Evolution</application> will show you information about the
+ meeting, and let you respond to the meeting in several ways.
+ Select the response that you would like, and then click the
+ <guibutton>OK</guibutton> button.
+ </para>
+ <para>
+ Your options are:
+ <variablelist>
+ <varlistentry>
+ <term>Accept:</term>
+ <listitem>
+ <para>
+ Select this entry if you will attend the meeting. When you
+ click the <guibutton>OK</guibutton> button, the meeting will
+ be entered into your calendar.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>Tentatively Accept:</term>
+ <listitem>
+ <para>
+ Select this entry if you will probably attend the meeting.
+ When you click the <guibutton>OK</guibutton> button, the
+ meeting will be entered into your calendar, but marked as
+ tentative.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>Decline:</term>
+ <listitem>
+ <para>
+ Select this item if you will be unable to attend the
+ meeting. The meeting will not be entered into your calendar
+ when you click the <guibutton>OK</guibutton>, although your
+ response will be sent to the meeting host if you have
+ checked the <guilabel>RSVP</guilabel> box.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>RSVP:</term>
+ <listitem>
+ <para>
+ Check this box if you would like your response sent to
+ the meeting organizers.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+ </sect1>
+
+ <sect1 id="usage-mail-subscriptions">
+ <title>Subscription Management</title>
+ <para>
+ Since IMAP folders exist on the server, and opening them or
+ checking them takes time, you need fine-grained control over the
+ way that you use IMAP folders. That's why
+ <application>Evolution</application> has an IMAP subscriptions
+ manager. If you prefer to have every mail folder displayed, you
+ can select that option as well. However, if you'd like to choose
+ specific items in your mailbox, and exclude others, you can use
+ the subscription management tool to do that.
+ </para>
+ <para>
+ Here's how:
+ <orderedlist numeration="arabic">
+
+ <listitem>
+ <para>
+ Select
+ <menuchoice><guimenu>Tools</guimenu><guimenuitem>Subscribe
+ to Folders</guimenuitem></menuchoice>.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ If you have accounts on multiple IMAP servers, select the
+ server where you'd like to manage your
+ subscriptions. <application>Evolution</application> will
+ display a list of available files and folders.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ Select a file or folder by clicking on it. You will want
+ to select at least the <guilabel>INBOX</guilabel>
+ folder. Depending upon the way your IMAP server is
+ configured, the list of available files may include
+ non-mail folders. If it does, you can ignore them.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ Click the <guibutton>Subscribe</guibutton> to add it to
+ the subscribed list.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ When you have subscribed to the folders you want, close
+ the window.
+ </para>
+ </listitem>
+ </orderedlist>
+ </para>
+ </sect1>
+
+ <sect1 id="encryption">
+ <title>Encryption</title>
+ <sect2 id="encryption-whatis">
+ <title>What is Encryption?</title>
+ <para>
+ Encryption is an ancient method of keeping information safe
+ from prying eyes. <application>Evolution</application> helps
+ you you protect your privacy by using
+ <application>gpg</application>, an implementation of strong
+ <glossterm linkend="public-key-encryption">Public Key
+ Encryption.</glossterm>
+ </para>
+
+ <note id="pub-priv">
+ <title>Public Key? Private Key? What is the difference?</title>
+ <para>
+ GPG uses two keys: public and private. You can give your
+ public key to anyone you want to recieve
+ encrypted messages, or put it on a public key server so
+ that people can look it up before contacting you.
+ <emphasis>Never give your private key to anyone,
+ ever</emphasis>. Your private key lets you decrypt any
+ message encrypted with your public key.
+ </para>
+ </note>
+
+ <para>
+ Using encryption takes a bit of forethought. When you send a
+ message that is encrypted, you must encrypt it using your
+ intended recipient's public key. To <emphasis>get</emphasis>
+ an encrypted message, you must make sure that the sender has
+ your public key in advance.
+ </para>
+
+ <para>
+ You can use encryption in two different ways:
+ <simplelist>
+ <member>
+ Encrypt the entire message, so that nobody but the recipient can read it.
+ </member>
+ <member>
+ Attach an encrypted signature to a plain text message, so
+ that the recipient can read the message without decrypting it, and
+ only needs decryption to verify the sender's identity.
+ </member>
+ </simplelist>
+ </para>
+
+ <example>
+ <title>Sending an Encrypted Messagee</title>
+ <para>
+ Kevin wants to send an encrypted message to his friend
+ Rachel. He looks up her public key on a general key
+ server, and then tells
+ <application>Evolution</application> to encrypt the
+ message. The message now reads "@#$23ui7yr87#@!48970fsd."
+ When the information gets to Rachel, she decrypts it using
+ her private key, and it appears as plain text for her to
+ read.
+ </para>
+ </example>
+ <tip id="always-sign">
+ <title>Always Sign</title>
+ <para>
+ You can set <application>Evolution</application> to always sign your email messages:
+ <orderedlist numeration="arabic">
+ <listitem>
+ <para>
+ Open your account preferences.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Open the <guilabel>Security</guilabel> tab.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Click the <guibutton>Always sign outgoing messages when using this account</guibutton> button.
+ </para>
+ </listitem>
+ </orderedlist>
+ </para>
+ </tip>
+ </sect2>
+
+ <sect2 id="encryption-keygen">
+ <title>Making Encryption Keys</title>
+ <para>
+ Before you can get or send encrypted mail, you need to
+ generate your public and private keys with GPG. Here's how:
+ </para>
+ <tip>
+ <title>GPG Versions</title>
+ <para>
+ This manual covers version 1.0.6 of GPG. If your version is
+ different, this may not be entirely accurate. You may find
+ out your version number by typing in: <command>gpg
+ --version</command>.
+ </para>
+ </tip>
+ <para>
+ <orderedlist numeration="arabic">
+ <listitem>
+ <para>
+ Open a terminal and type <command>gpg --gen-key</command>.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ Choose the default algorythm, "DSA and ElGamal."
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ Choose a key length. The default, 1024 bits, should be
+ long enough.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ Decide if you want your key to expire automatically, and if so, when.
+ </para>
+ </listitem>
+
+
+ <listitem>
+ <para>
+ Enter your name, email address, and any additional
+ personal information you think is appropriate. Do not
+ falsify this information, because it will be needed to
+ verify your identity later on.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ Next, enter your passphrase. It does not have to be the
+ same as your email password or your login password. In
+ fact, it probably shouldn't. Don't forget it. If you lose
+ it, your keys will be useless and you will be unable to
+ decrypt messages sent to you with those keys.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ Now, GPG will generate your keys. This may take awhile,
+ so feel free to do something else while it's
+ happening. In fact, using your computer for something
+ else actually helps to generate better keys, because it
+ increases the randomness in the key generation seeds.
+ </para>
+ </listitem>
+ </orderedlist>
+ </para>
+ <para>
+ Once the keys are generated, you can view your key information
+ by typing <command>gpg --list-keys</command>. You should see
+ something similar to this:
+ <programlisting>
+ /home/you/.gnupg/pubring.gpg
+ ----------------------------
+ pub 1024D/32j38dk2 2001-06-20 you &lt;you@your-address.com&gt;
+ sub 1024g/289sklj3 2001-06-20 [expires: 2002-11-14]
+ </programlisting>
+ </para>
+ <para>
+ GPG will create one list, or keyring, for your public keys
+ and one for your private keys. All the public keys you know
+ are stored in the file
+ <filename>~/.gnupg/pubring.gpg</filename>. If you want to
+ give other people your key, send them that file.
+ </para>
+ <para>
+ If you wish, you can upload your keys to a keyserver. Here's
+ how:
+ <orderedlist>
+ <listitem>
+ <para>
+ Check your public key ID with <command>gpg
+--list-keys</command>. It will be the string after 1024D on the line
+beginning with "pub." In this example, it's 32j38dk2.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Enter the command <command>gpg --send-keys --keyserver
+wwwkeys.pgp.net 32j38dk2</command>. Substitute your key ID for
+32j38dk2. You will need your password to do this.
+ </para>
+ </listitem>
+ </orderedlist>
+
+ <note id="why-keyserver">
+ <title>Why Use a Keyserver?</title>
+ <para>
+ Keyservers store your public keys for you so that your
+ friends can decrypt your messages. If you choose not to
+ use a keyserver, you can manually send your people public
+ key, include it in your signature file, or put it on your
+ own web page. However, it's easier to publish them once,
+ and then let people download them from the keyserver when
+ they want.
+ </para>
+ </note>
+
+ </para>
+ </sect2>
+
+ <sect2 id="encrypt-getting-key">
+ <title>Getting and Using Public Keys</title>
+ <para>
+ To encrypt a message to your someone else you'll need to use
+ their public key in combination with your private key.
+ <application>Evolution</application> does that for you, but
+ you still need to get their key and add it to your keyring.
+ </para>
+ <para>
+ To get public keys from a public key server, enter the
+ command:
+ <command>
+ gpg --recv-keys --keyserver wwwkeys.pgp.net keyid
+ </command>, substituting "keyid" for your recipient's ID. You
+ will need to type in your password, and then their ID will
+ automatically be added to your keyring. When you send mail to
+ them, <application>Evolution</application> will allow you to
+ encrypt your messages.
+ </para>
+ <para>
+ If someone sends you their public key directly, save it as a
+ plain text file and enter the command <command>gpg
+ filename</command>. This will add it to your keyring.
+ </para>
+ </sect2>
+
+ <sect2 id="encrypt-evo-integ">
+ <title>Setting up Evolution's Encryption</title>
+ <para>
+ You'll need to open
+ <menuchoice>
+ <guimenu>Tools</guimenu>
+ <guimenuitem>Mail Settings</guimenuitem>
+ </menuchoice>
+ Once there, select the account with which you'd like to send
+ and recieve encrypted mail, and click the
+ <guibutton>Edit</guibutton> button. In the
+ <guilabel>Security</guilabel> tab is a section labeled
+ <guilabel>Pretty Good Privacy</guilabel>. Enter your key ID
+ and click <guibutton>OK</guibutton>. Your key is now
+ integrated into your identity in
+ <application>Evolution</application>.
+ </para>
+ <note>
+ <title>What is my Key ID again?</title>
+ <para>
+ <application>Evolution</application> requires that you know your key ID. If you don't remember it, you can find it by typing <command>gpg --list-keys</command> in a console window. Your key ID will be an eight character string with random numbers and letters.
+ </para>
+ </note>
+ </sect2>
+
+ <sect2 id="encrypt-sending">
+ <title>Sending Encrypted Messages</title>
+ <para>
+ As you know, you can use encryption to hide the entire
+ message, or just to verify your signature. Once you've
+ generated your public and private keys, and have the public
+ keys of the people to whom you want to send mail, here's what
+ to do:
+ </para>
+ </sect2>
+
+ <sect2 id="sign-msg">
+ <title>Signing a Message</title>
+ <para>
+ To sign a message, choose:
+ <menuchoice>
+ <guimenu>Security</guimenu>
+ <guimenuitem>PGP Sign</guimenuitem>
+ </menuchoice>
+ . You will be prompted for your PGP password. Once you enter it,
+ click <guibutton>OK</guibutton> and your message will be signed.
+ </para>
+ </sect2>
+
+ <sect2 id="encrypt-msg">
+ <title>Encrypting a Message</title>
+ <para>
+ Encrypting a message is very similar to signing a message.
+ Just choose the menu item
+ <menuchoice>
+ <guimenu>Security</guimenu>
+ <guimenuitem>PGP Encrypt</guimenuitem>
+ </menuchoice>
+ </para>
+ </sect2>
+ <sect2 id="unencrypting">
+ <title>Unencrypting a Recieved Message</title>
+ <para>
+ If you get an encrypted message, you will need to decrypt it
+ before you read it. Remember, the sender has to have your
+ public key before they can send you an encrypted message.
+ </para>
+ <para>
+ When you view the message,
+ <application>Evolution</application> will ask you for your
+ PGP password. Enter it, and the message will be displayed
+ properly.
+ </para>
+ </sect2>
+ </sect1>
+</chapter>
diff --git a/help/zh_CN/usage-mainwindow.sgml b/help/zh_CN/usage-mainwindow.sgml
new file mode 100644
index 0000000000..b7ff02ecf7
--- /dev/null
+++ b/help/zh_CN/usage-mainwindow.sgml
@@ -0,0 +1,1174 @@
+<!--
+<!DOCTYPE Chapter PUBLIC "-//GNOME//DTD DocBook PNG Variant V1.1//EN">
+-->
+<chapter id="usage-mainwindow">
+
+ <title>Getting Started with Ximian Evolution</title>
+
+ <sect1 id="what">
+ <title>What is Ximian Evolution, and What Can It Do for Me?</title>
+ <para>
+ Information is useless unless it's organized and accessible;
+ it's hardly even worth the name if you can't look at it and be
+ <emphasis>informed</emphasis>. The goal of
+ <application>Ximian Evolution</application> is to make the
+ tasks of storing, organizing, and retrieving your personal
+ information easier, so you can work and communicate with
+ others. That is, it's a highly evolved <glossterm
+ linkend="groupware">groupware</glossterm> program, an integral
+ part of the Internet-connected desktop.
+ </para>
+ <para>
+ In other words, <application>Ximian Evolution</application> is
+ a tool to help you get your work done.
+ </para>
+ <para>
+ <application>Ximian Evolution</application> is Free Software. The
+ program and its source code are released under the terms of
+ the GNU <ulink type="help"
+ url="gnome-help:gpl"><citetitle>General Public License
+ (GPL)</citetitle></ulink>, and the documentation falls under
+ the <ulink type="help" url="gnome-help:fdl"><citetitle>Free
+ Documentation License</citetitle></ulink> (FDL). For more
+ information about the GPL and the FDL, visit the Free Software
+ Foundation's website at <ulink
+ url="http://www.fsf.org">http://www.fsf.org</ulink>.
+ </para>
+
+ <para>
+ <application>Ximian Evolution</application> can help you work in a
+ group by handling email, address and other contact
+ information, and one or more calendars. It can do that on one
+ or several computers, connected directly or over a network,
+ for one person or for large groups.
+ </para>
+
+ <para>
+ With <application>Ximian Evolution</application>, you can
+ accomplish your most common daily tasks faster. For example, it
+ takes only one or two clicks to enter an appointment or an
+ address card sent to you by email, or to send email to a contact
+ or appointment. <application>Ximian Evolution</application>
+ makes displays faster and more efficient, so searches are faster
+ and memory usage is lower. People who get lots of mail will
+ appreciate advanced features like <link
+ linkend="usage-mail-organize-vFolders"> Virtual Folders</link>,
+ which let you save searches as though they were ordinary mail
+ folders.
+ </para>
+ </sect1>
+
+ <sect1 id="usage-mainwindow-starting">
+ <title>The First Time you Start Ximian Evolution</title>
+ <para>
+ To start <application>Ximian Evolution</application>, do either
+ of the following:
+ <itemizedlist>
+ <listitem>
+ <para>
+ Select <menuchoice><guimenu>Programs</guimenu>
+ <guimenuitem>Evolution</guimenuitem> </menuchoice> from your
+ menu panel.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ Type <command>evolution</command> at the command line.
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+
+ <para>
+ The first time you run the program, it will create a directory
+ called <filename>evolution</filename> in your home directory,
+ where it will store all of its local data. Then, it will open a
+ first-run assistant to help you set up mail accounts and import
+ data from other applications.
+ </para>
+ <para>
+ Using the first-run assistant will take approximately two to
+ five minutes.
+ </para>
+
+ <sect2 id="first-step">
+ <title>Defining Your Identity</title>
+ <para>
+ The Identity window is the first of four steps in the
+ assistant. The identity step will ask you to enter your basic
+ personal information. You can define multiple identities
+ later on with the <menuchoice><guimenu>Tools</guimenu>
+ <guimenuitem>Mail Settings</guimenuitem></menuchoice> tool.
+ <itemizedlist>
+ <listitem>
+ <para>
+ Full Name: Your full name (Example: John Doe).
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Email Address: Your email address (Example: john@doe.com)
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Organization: The company where you work (optional).
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Signature file: If you'd like to use an email
+ <glossterm linkend="signature">signature</glossterm>,
+ select your signature file here. Normally, the
+ signature will be the contents of the
+ <filename>.signature</filename> file in your home
+ directory.
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+ </sect2>
+
+ <sect2 id="second-step">
+ <title>Recieving Email</title>
+ <para>
+ The <guilabel>Recieving Email</guilabel> step lets you configure
+ receving email people have sent you.
+ <itemizedlist>
+ <listitem>
+ <para>
+ Server Type: There are numerous types of servers
+ from which <application>Ximian Evolution</application>
+ can fetch your mail. Ask your system administrator if
+ you're not sure which of the following are available to
+ you:
+ <itemizedlist>
+ <listitem>
+ <para>
+ POP: Downloads your email to your hard disk for
+ permanent storage.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ IMAP: Keeps the email on your server so you
+ can access your email from multiple systems.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Unix mail spool file: If you run a mail
+ server on your desktop computer, choose this
+ option.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Standard Unix .mbox file: If you want
+ <application>Ximian Evolution</application> to
+ read mail from a specific file, or if you download
+ mail with another application, choose this option.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Qmail maildir format files: If you download your
+ mail using qmail, you'll want to use this.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ None: Select this if you do not plan to
+ check mail with this account.
+ </para>
+ </listitem>
+ </itemizedlist>
+
+ <note id="imap-note-one">
+ <title>What's an IMAP Namespace?</title>
+ <para>
+ For IMAP mail servers, your sysadmin may provide
+ you with a specific namespace, the path on the
+ IMAP server where you check for mail. If you
+ check your IMAP mail and your folder list includes
+ files that don't look like mail folders, you
+ probably need to change your mail
+ namespace. Typical values are "mail" and "Mail."
+ If you prefer, you can choose to subscribe to
+ individual mail folders one at a time. For more
+ information about how to use IMAP mail, see <xref
+ linkend="usage-mail-subscriptions">.
+ </para>
+ </note>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Email Server: This is the address of the server you're
+ downloading from.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Username: The username that you login to your email. That
+ is often the part before the @ in your email.
+ </para>
+ <para>
+ Authentication Type: Chances are you are using
+ <guilabel>Password</guilabel>. Ask your administrator
+ for more details. You can have <application>Ximian
+ Evolution</application> make sure you've chosen
+ correctly by clicking <guibutton>Check for supported
+ types</guibutton>.
+ </para>
+ <para>
+ Remember Password: If you prefer to not enter your
+ password every time you check email, press this button.
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+ <tip id="exchange-info">
+ <title>Can Ximian Evolution Talk to Exchange?</title>
+ <para>
+ <application>Ximian Evolution</application> can work with the
+ <application>Microsoft Exchange</application> server over
+ standard protocols such as POP or IMAP. Check with your
+ system administrator to see if you can get POP or IMAP
+ access to your email server.
+ </para>
+ </tip>
+ </sect2>
+ <sect2 id="third-step">
+ <title>Sending Email</title>
+ <para>
+ The <guilabel>Sending Email</guilabel> step lets you configure sending
+ email.
+ <itemizedlist>
+ <listitem>
+ <para>
+ Server Type: There are numerous server types that
+ <application>Ximian Evolution</application> supports for sending your
+ mail.
+ <itemizedlist>
+ <listitem>
+ <para>
+ SMTP: Downloads mail into your mailbox file.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Sendmail: Uses another program to download your mail
+ to your mailbox files.
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Host: If you chose SMTP, enter the server's name
+ or IP address here.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Server requires authentication: If your server
+ requires you to enter a password to send mail, check
+ this box.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Authentication Type: Chances are you are using
+ <guilabel>Password</guilabel>. If you're not sure, ask
+ your system administrator or ISP, or have
+ <application>Ximian Evolution</application> check for you by
+ clicking <guibutton>Check for supported
+ types</guibutton>.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Username: The account name you use when you login
+ to check your email. Normally, this is the part of your
+ email address before the '@' character.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Remember Password: If you prefer to not enter
+ your password every time you check email, press this
+ button.
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+ </sect2>
+
+ <sect2 id="fourth-step">
+ <title>Importing Mail (Optional)</title>
+ <para>
+ If <application>Ximian Evolution</application> finds mail or
+ address files from another application, it will offer to
+ import them. If you're not sure which file format your mail
+ program uses, ask your system administrator. If you want, you
+ can skip this step and return to it at a later time by
+ selecting
+ <menuchoice><guimenu>File</guimenu><guimenuitem>Import</guimenuitem></menuchoice>.
+ </para>
+ <para>
+ <application>Ximian Evolution</application> can import the following types of
+ files:
+ <variablelist>
+ <varlistentry>
+ <term>VCard (.vcf, gcrd):</term>
+ <listitem>
+ <para>
+ The addressbook format used by the GNOME, KDE, and
+ many other contact management applications. You
+ should be able to export to VCard format from any
+ address book application.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>Microsoft Outlook Express 4 (.mbx):</term>
+ <listitem>
+ <para>
+ Email file format used by Microsoft Outlook Express
+4. For other versions of Microsoft Outlook and Outlook Express, see
+the workaround described in the note below.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>MBox (mbox):</term>
+ <listitem>
+ <para>
+ The email box format used by Mozilla, Netscape,
+ Ximian Evolution, Eudora, and many other email clients.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+</para>
+<para>
+ <note>
+ <title>Microsoft Outlook and Outlook Express Users</title>
+ <para>
+ Microsoft Outlook, and versions of Outlook Express after
+ version 4, use proprietary formats that <application>Ximian
+ Evolution</application> cannot read or import. For contacts,
+ you may have to email them to yourself and import them that
+ way. For email, there is a simpler workaround:
+ <orderedlist numeration="arabic">
+
+ <listitem>
+ <para>
+ While using Windows, import the files into Mozilla Mail (or
+ another mailer, such as Netscape or Eudora, that uses the
+ standard mbox format).
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ Copy the files to the system or partition you use for
+ <application>Ximian Evolution</application>.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ Use the <application>Ximian Evolution</application> import
+ tool to import the files. There's more information about
+ why this works, and how, at the Ximian support website.
+ </para>
+ </listitem>
+ </orderedlist>
+ </para>
+ </note>
+
+ <note>
+ <title>Netscape Users</title>
+ <para>
+ Before importing mail from Netscape, make sure you select
+ <menuchoice><guimenu>File</guimenu><guimenuitem>Compact All
+ Folders</guimenuitem></menuchoice>. If you don't,
+ <application>Ximian Evolution</application> will import and undelete
+ the messages in your Trash folders.
+ </para>
+ </note>
+
+ </para>
+
+ <tip>
+ <title>Exporting Files From Ximian Evolution</title>
+ <para>
+ Ximian Evolution uses standard file types for all its information,
+ so you should have no trouble taking your information
+ elsewhere if you want.
+ </para>
+ <para>
+ For mail, that's <filename>mbox</filename>, for calendar,
+ <filename>iCal</filename>, and for the address book, vCards
+ in a <filename>.db3</filename> database.
+ </para>
+ </tip>
+ </sect2>
+ </sect1>
+
+ <sect1 id="ui-intro">
+ <title>What's What in Ximian Evolution</title>
+ <para>
+ Now that you've gotten the first-run configuration out of the
+ way, you're ready to get down to work. Here's a quick
+ explanation of what's going on in your main
+ <application>Ximian Evolution</application> window.
+ </para>
+
+ <figure id="preface-basic-interface">
+ <title>The Ximian Evolution Main Window</title>
+ <screenshot>
+ <screeninfo>Inbox</screeninfo>
+ <mediaobject><imageobject><imagedata
+ fileref="figures/mainwindow-pic" format="png" srccredit="Kevin
+ Breit"> </imageobject></mediaobject>
+ </screenshot>
+ </figure>
+
+ <para>
+ <inlinemediaobject><imageobject><imagedata fileref="figures/full-1" format="png"></imageobject></inlinemediaobject>
+ <guilabel>Menubar</guilabel>
+ </para>
+
+ <para>
+ The <guilabel>Menubar</guilabel> gives you access to nearly all the
+ features that can be found in <application>Ximian Evolution</application>.
+ </para>
+
+ <para>
+ <inlinemediaobject><imageobject><imagedata fileref="figures/full-2" format="png"></imageobject></inlinemediaobject>
+ <guilabel>Toolbar</guilabel>
+ </para>
+
+ <para>
+ The <guilabel>Toolbar</guilabel> gives you fast and easy access to the
+ most used features in each component.
+ </para>
+
+ <para>
+ <inlinemediaobject><imageobject><imagedata fileref="figures/full-3" format="png"></imageobject></inlinemediaobject>
+ <guilabel>Shortcut Bar</guilabel>
+ </para>
+
+ <para>
+ The <guilabel>Shortcut Bar</guilabel> lets you go to your favorite
+ components with the click of a click of a button.
+ </para>
+
+ <para>
+ <inlinemediaobject><imageobject><imagedata fileref="figures/full-4" format="png"></imageobject></inlinemediaobject>
+ <guilabel>Status Bar</guilabel>
+ </para>
+
+ <para>
+ Periodically, <application>Ximian Evolution</application> will need to quietly
+ display a message, or tell you the progress of a task. This most
+ often happens when you're checking or sending email. These progress
+ queues are shown here, in the <guilabel>Status Bar</guilabel>.
+ </para>
+
+ <para>
+ <inlinemediaobject><imageobject><imagedata fileref="figures/full-5" format="png"></imageobject></inlinemediaobject>
+ <guilabel>Search Tool</guilabel>
+ </para>
+
+ <para>
+ The <guilabel>Search Tool</guilabel> lets you search through your email
+ with precision so you can easily find what you're looking for.
+ </para>
+
+
+ <sect2 id="usage-mainwindow-shortcutbar">
+ <title>The Shortcut Bar</title>
+ <para>
+ <application>Ximian Evolution</application>'s most important job is
+ to give you access to your information and help you use it
+ quickly. One way it does that is through the
+ <interface>shortcut bar</interface>, the column on the left
+ hand side of the main window. The large buttons with names
+ like <guilabel>Inbox</guilabel> and
+ <guilabel>Contacts</guilabel> are the shortcuts, and you can
+ select different groups of shortcuts by clicking the
+ rectangular group buttons.
+ </para>
+ <para>
+ Take a look at the <guilabel>Shortcut Bar</guilabel>
+ The shortcut buttons in that category are:
+
+ <variablelist>
+ <varlistentry>
+ <term> <guibutton>Summary</guibutton>:</term>
+ <listitem>
+ <para>
+ Start your day here. The Ximian Evolution
+ <guilabel>Summary</guilabel> gives you a quick
+ summary of new or important messages, daily
+ appointments and urgent tasks. You can customize
+ its appearance and content, and use it to access
+ Ximian Evolution services.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term> <guibutton>Inbox</guibutton>:</term>
+ <listitem>
+ <para>
+ Click the <guibutton>Inbox</guibutton> button to start
+ reading your mail. Your Inbox is also where you can
+ access Ximian Evolution's tools to filter, sort, organize, and
+ search your mail.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><guibutton>Calendar</guibutton>:</term>
+ <listitem>
+ <para>
+ The Calendar can store your appointments and task lists
+ for you. Connected to a network, you can use it to keep
+ a group of people on schedule and up to date.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><guibutton>Tasks</guibutton>:</term>
+ <listitem>
+ <para>
+ A full-size view of your calendar's task pad.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term><guibutton>Contacts</guibutton>:</term>
+ <listitem>
+ <para>
+ The Addressbook holds contacts, with address, phone, and
+ other personal information. Like calendar information,
+ contact data can be synchronized with hand-held devices
+ and shared over a network.
+ </para>
+ </listitem>
+ </varlistentry>
+
+<!-- NOT IMPLEMENTED YET
+
+
+ <varlistentry>
+ <term> <guibutton>Notes:</guibutton></term>
+ <listitem>
+ <para> The note pad is your catch-all tool: use it to take
+ messages from phone conversations, keep small things
+ organized, write <glossterm linkend="haiku">haiku</glossterm>, or whatever
+ you like. This feature is not yet implemented, but will be
+ soon. See <xref linkend="usage-notes"> for more
+ information.
+ </para>
+ </listitem>
+ </varlistentry>
+-->
+
+ </variablelist>
+ </para>
+ </sect2>
+ <sect2 id="usage-mainwindow-folderbar">
+ <title>Folders and The Folder Bar</title>
+ <para>
+ The <interface>folder bar</interface> is a more comprehensive
+ way to view the information you've stored with
+ <application>Ximian Evolution</application>. It displays all your
+ appointments, address cards, and email in a tree that's a lot
+ like a <glossterm linkend="filetree">file
+ tree</glossterm>-- it starts small at the top, and branches
+ downwards. On most computers, there will be three or four
+ folders at the base. First, of course, is the
+ <guilabel>Summary</guilabel>, a customizable summary of your
+ information. Below that are your <guilabel>Local
+ Folders</guilabel>, which hold all the
+ <application>Ximian Evolution</application> data that's stored on your
+ computer. After that are your network servers: <glossterm
+ linkend="ldap">LDAP</glossterm> servers that host shared contact
+ directories, and <glossterm linkend="imap">IMAP</glossterm> mail
+ folders to which you subscribe. Lastly, there are
+ <guilabel>vFolders</guilabel>, or virtual folders, discussed in
+ <xref linkend="usage-mail-organize-vfolders">,
+ </para>
+ <para>
+
+ A typical <guilabel>Local</guilabel> folder contains the following folders:
+ <itemizedlist>
+ <listitem>
+ <para>
+ <guilabel>Calendar</guilabel>, for appointments and
+ event listings.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <guilabel>Contacts</guilabel>, for address cards.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <guilabel>Drafts</guilabel>, for messages you started and didn't finish.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ <guilabel>Inbox</guilabel>, for incoming mail.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ <guilabel>Outbox</guilabel>, for messages you have written
+ but not yet sent. This will be empty unless you use
+ <application>Ximian Evolution</application> while offline.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ <guilabel>Sent</guilabel>, for sent mail.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ <guilabel>Trash</guilabel>, a vFolder view of all the
+ messages you have marked for deletion but not yet
+ <glossterm linkend="expunge">expunged</glossterm>.
+ </para>
+ </listitem>
+ </itemizedlist>
+
+ </para>
+ <tip id="foldertips">
+ <title>Navigating without the Folder Bar or the Shortcut Bar</title>
+ <para>
+ You don't need the folder bar or the shortcut bar to move
+ around the main window. You can use the <keycap>Tab</keycap>
+ key to switch from one part of the window to another. When
+ you hide the folder bar, there is a menu on the left side of
+ the window just below the toolbar to move about the folder
+ tree, even with the folder and shortcut bars hidden.
+ </para>
+ </tip>
+
+ <para>
+ If you get large volumes of mail, you'll want more folders than
+ just your Inbox. To create a new folder:
+ <orderedlist numeration="arabic">
+ <listitem>
+ <para>
+ Select
+ <menuchoice> <guimenu>File</guimenu>
+ <guisubmenu>New</guisubmenu>
+ <guimenuitem>Folder</guimenuitem></menuchoice>
+ <keycombo action="simul">
+ <keycap>Shift</keycap>
+ <keycap>Ctrl</keycap>
+ <keycap>E</keycap>
+ </keycombo>.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Select the name of the folder in the <guilabel>Folder
+ Name</guilabel> field.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Select the folder type. The available options are.
+ <itemizedlist>
+ <listitem>
+ <para>
+ Calendar
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Contacts
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Mail
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Tasks
+ </para>
+ </listitem>
+ </itemizedlist>
+
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Choose the location of the new folder.
+ </para>
+ </listitem>
+ </orderedlist>
+ </para>
+
+ <sect3 id="subfolders">
+ <title>Subfolders</title>
+ <para>
+ <application>Ximian Evolution</application> lets you nest folders
+ inside of each other, so that you can have a detailed
+ organizational system.
+ </para>
+
+ <note>
+ <title>Folders Have Limits</title>
+ <para>
+ Calendars must go in calendar folders, mail in mail
+ folders, and contacts in contact folders.
+ </para>
+ </note>
+
+ <para>
+ Right-clicking will bring up a menu for just about anything in
+ <application>Ximian Evolution</application>. If you right-click on a
+ folder, you'll have a menu with the following options:
+ <itemizedlist>
+ <listitem><para><guimenuitem>View</guimenuitem>, to view the folder. </para></listitem>
+ <listitem><para><guimenuitem>Open in New Window</guimenuitem> to view the folder in another window. </para></listitem>
+ <listitem><para><guimenuitem>Move</guimenuitem>, to move the folder to another location. </para></listitem>
+ <listitem><para><guimenuitem>Copy</guimenuitem>, to duplicate the folder. </para></listitem>
+ <listitem><para><guimenuitem>Delete</guimenuitem>, to delete the folder and all its contents. </para></listitem>
+ <listitem><para><guimenuitem>Rename</guimenuitem>, to change its name. </para></listitem>
+ <listitem><para><guimenuitem>Create New Folder</guimenuitem>, to create another folder in the same location. </para></listitem>
+ <listitem><para><guimenuitem>Add to Shortcut Bar</guimenuitem>, to add the folder to your shortcut bar. </para></listitem>
+ <listitem><para><guimenuitem>Properties</guimenuitem>, to view or change the folder properties. </para></listitem>
+ </itemizedlist>
+ </para>
+ <para>
+ You can also rearrange folders and messages by dragging and
+ dropping them.
+ </para>
+
+ <para>
+ Any time new mail arrives in a mail folder, that folder
+ label is displayed in bold text, along with the number of
+ new messages in that folder.
+ </para>
+ </sect3>
+ </sect2>
+
+ <sect2 id="usage-mainwindow-menubar">
+ <title>The Menu Bar</title>
+ <para>
+ The <interface>menu bar</interface>'s contents will always
+ provide all the possible actions for any given view of your
+ data. If you're looking at your Inbox, most of the menu items
+ will relate to mail; some will relate to other components of
+ <application>Ximian Evolution</application> and some, especially those
+ in the <guimenu>File Menu</guimenu> will relate to the
+ application as a whole.
+ </para>
+ <para>
+ <variablelist>
+ <varlistentry>
+ <term> <guimenu>File</guimenu>:</term>
+
+ <listitem><para> Anything related to a file or to the
+ operations of the application generally falls under this
+ menu: creating things, saving them to disk, printing them,
+ and quitting the program itself. </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term> <guimenu>Edit</guimenu>:</term>
+ <listitem><para>
+ The <guimenu>Edit</guimenu> menu holds
+ useful tools that help you edit text and move it around.
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term> <guimenu>View</guimenu>:</term>
+ <listitem><para>
+ This menu lets you decide how <application>Ximian Evolution</application>
+ should look. Some of the features control the appearance of
+ <application>Ximian Evolution</application> as a whole, and others
+ the way a particular kind of information appears.
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term> <guimenu>Actions</guimenu>:</term>
+ <listitem><para>
+ Holds actions which maybe applied to a message. Normally,
+ if there is only one target for the action -- for
+ example, replying to a message -- you can find it in
+ the <guimenu>Actions</guimenu> menu.
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term> <guimenu>Tools</guimenu>:</term>
+ <listitem><para>
+ Tools for configuring, changing, and
+ setting up preferences go here. For mail, that means things like
+ <guimenuitem>Mail Configuration</guimenuitem> and the
+ <guimenuitem>Virtual Folder Editor</guimenuitem>. For the
+ <interface>Calendar</interface> and the <interface>Contact
+ Manager</interface>, it's color, network, and layout
+ configuration.
+ </para></listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term> <guimenu>Help</guimenu>:</term>
+ <listitem><para>
+ Select among these items to open the
+ <application>Help Browser</application>
+ and read the <application>Ximian Evolution</application> manual.
+ </para></listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+
+ <para>
+ Once you've familiarized yourself with the <interface>main
+ window</interface> you can start doing things with it. We'll
+ start with the <guilabel>Summary</guilabel>, which provides a
+ quick overview of your <application>Ximian
+ Evolution</application> information.
+ </para>
+ </sect2>
+ <sect2 id="basics-summary">
+ <title>Introducing the Summary</title>
+ <para>
+ The Ximian Evolution Summary provides you with a quick
+ run-down of important information: your appointments for a
+ given day, how much new mail you have, headlines from
+ selected news services, and so forth. To see the Summary,
+ click on the <guibutton>Summary</guibutton> button in the
+ shortcut bar, or select the <guilabel>Summary</guilabel>
+ folder in the folder bar.
+ </para>
+
+ <para>
+<figure>
+ <title>The Evolution Summary</title>
+
+<screenshot>
+<graphic format="png" fileref="figures/summary" srccredit="Kevin Breit">
+</screenshot>
+</figure>
+ </para>
+
+<para>
+<inlinemediaobject><imageobject><imagedata fileref="figures/full-1" format="png"></imageobject></inlinemediaobject> <guilabel>Weather Summary</guilabel>
+</para>
+<para>
+Shows you the latest weather updates from hundreds of cities around the world.
+</para>
+<para>
+<inlinemediaobject><imageobject><imagedata fileref="figures/full-2" format="png"></imageobject></inlinemediaobject> <guilabel>News Feeds</guilabel>
+</para>
+<para>
+Displays up to the minute news from your favorite websites.
+</para>
+<para>
+<inlinemediaobject><imageobject><imagedata fileref="figures/full-3" format="png"></imageobject></inlinemediaobject> <guilabel>Mail Summary</guilabel>
+</para>
+<para>
+Shows you how many email messages you have in your selected folders, waiting to be read.
+</para>
+<para>
+<inlinemediaobject><imageobject><imagedata fileref="figures/full-4" format="png"></imageobject></inlinemediaobject> <guilabel>Calendar Summary</guilabel>
+</para>
+<para>
+Shows you your calendar.
+</para>
+<para>
+<inlinemediaobject><imageobject><imagedata fileref="figures/full-5" format="png"></imageobject></inlinemediaobject> <guilabel>Tasks</guilabel>
+</para>
+<para>
+Shows your pending tasks
+</para>
+
+
+ <para>
+ To add additional services to your Summary, or to edit the
+ existing services, select
+ <menuchoice>
+ <guimenu>Tools</guimenu>
+ <guimenuitem>Summary Settings</guimenuitem>
+ </menuchoice>.
+ </para>
+
+ </sect2>
+
+ <sect2 id="basics-mail">
+ <title>Introducing Email</title>
+ <para>
+ <application>Ximian Evolution</application> email is like other
+ email programs in several ways:
+ <itemizedlist>
+ <listitem>
+ <para>
+ It can sort and organize your mail in a wide variety of
+ ways with folders, searches, and filters.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ It can send and receive mail in HTML or as plain text,
+ and makes it easy to send and recieve multiple file
+ attachments.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ It supports multiple mail sources, including <glossterm
+ linkend="imap">IMAP</glossterm>, <glossterm
+ linkend="pop">POP3</glossterm>, local
+ <filename>mbox</filename> and <filename>mh</filename>
+ spools and files created by other mail programs.
+
+<!-- NOT FOR 1.0, but maybe later
+ and even NNTP messages (newsgroups), which aren't
+ technically email.
+-->
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ It lets you guard your privacy with encryption.
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+ <para>
+ However, <application>Ximian Evolution</application> has some
+ important differences. First, it's built to handle very large
+ amounts of mail. Both the <link
+ linkend="usage-mail-organize-filters">filtering</link> and
+ <link linkend="usage-mail-organize-search">searching</link>
+ functions were built for speed and efficiency on large volumes
+ of mail. There's also the <application>Ximian Evolution</application>
+ <link linkend="usage-mail-organize-vFolders">vFolder</link>,
+ an advanced organizational feature not found in mainstream
+ mail clients. If you get a lot of mail, or if you keep every
+ message you get in case you need to refer to it later, you'll
+ find this feature especially useful.
+ </para>
+ <para>
+ Here's what the mailer looks like:
+
+ <!-- ==============Figure=================================== -->
+
+ <figure id="usage-mail-intro-fig">
+ <title>Ximian Evolution Mail</title>
+ <screenshot>
+ <screeninfo>Inbox</screeninfo>
+ <mediaobject><imageobject><imagedata fileref="figures/mail-inbox" format="png" srccredit="Kevin Breit">
+ </imageobject></mediaobject>
+ </screenshot>
+ </figure>
+<!-- ==============End of Figure============================== -->
+</para>
+ <para>
+ <inlinemediaobject><imageobject><imagedata fileref="figures/full-1"
+ format="png"></imageobject></inlinemediaobject> <guilabel>Email
+ Viewer</guilabel>
+ </para>
+
+ <para>
+ This is where your email is displayed.
+ </para>
+
+ <para>
+ <inlinemediaobject><imageobject><imagedata fileref="figures/full-2"
+ format="png"></imageobject></inlinemediaobject> <guilabel>Message List</guilabel>
+ </para>
+
+ <para>
+ The <guilabel>Message List</guilabel> displays all the emails
+ that you have. This includes all your read, unread, and email
+ that is flagged to be deleted.
+ </para>
+
+ <para>
+ If you find the <interface>view pane</interface> too small, you can resize
+ the pane, enlarge the whole window, or double-click on the
+ message in the <interface>message list</interface> to have it
+ open in a new window. To change the sizes of a pane, just click
+ and hold on the divider between the two panes. Then you can drag
+ up and down to select the size of the panes.
+
+</para>
+<para> Just like with folders, you can right-click on messages in the
+ message list and get a menu of possible actions: you can move,
+ delete, or undelete them, and create filters or vFolders based
+ on them.
+ </para>
+ <para>
+ Most of the mail-related actions you'll want to perform are
+ listed in the <guimenu>Message</guimenu> menu in the menu bar.
+ The most frequently used ones, like
+ <guimenuitem>Reply</guimenuitem> and
+ <guimenuitem>Forward</guimenuitem>, also appear as buttons in
+ the toolbar. Almost all of them are also located in the
+ right-click menu and as keyboard shortcuts, which tend to be
+ faster once you get the hang of them. You can choose
+ whichever way you like best; the idea is that the software
+ should work the way you want, rather than making you work the
+ way the it does.
+ </para>
+
+ <para>
+ For an in-depth guide to the email capabilities of Ximian
+ Evolution, read <xref linkend="usage-mail">.
+ </para>
+ </sect2>
+ <sect2 id="basics-calendar">
+ <title>Introducing the Calendar</title>
+ <para>
+ To begin using the calendar, select
+ <guibutton>Calendar</guibutton> from the <interface>shortcut
+ bar</interface>. By default, the calendar starts showing
+ today's schedule on a ruled background. At the upper right,
+ there's a monthly calendar you can use to switch days. Below
+ that, there's a <guilabel>Task</guilabel> pad, where you can
+ keep a list of tasks separate from your calendar appointments.
+ The day view in the calendar looks like this:
+
+ <!-- ============== Figure ============================= -->
+ <figure id="usage-calendar-fig">
+ <title>Ximian Evolution Calendar View</title>
+ <screenshot>
+ <screeninfo>Ximian Evolution Contact Manager Window</screeninfo>
+ <mediaobject><imageobject><imagedata fileref="figures/calendar" format="png" srccredit="Aaron Weber">
+ </imageobject></mediaobject>
+ </screenshot>
+ </figure>
+ <!-- ============== End of Figure ============================= -->
+
+ </para>
+
+ <para>
+ <inlinemediaobject><imageobject><imagedata fileref="figures/full-1"
+ format="png"></imageobject></inlinemediaobject> <guilabel>Appointment
+ List</guilabel>
+ </para>
+
+ <para>
+ The <guilabel>Appointment List</guilabel> is responsible for showing you all of
+ your scheduled appointments, whether they are all day appointments or simply one time
+ appointments that last a half an hour.
+ </para>
+
+ <para>
+ <inlinemediaobject><imageobject><imagedata fileref="figures/full-2" format="png"></imageobject></inlinemediaobject>
+ <guilabel>Task List</guilabel>
+ </para>
+
+ <para>
+ The <guilabel>Task List</guilabel> compliments the
+ <guilabel>Appointment List </guilabel> as it keeps track of
+ tasks which don't have a time associated with them. Tasks can
+ have complex notes associated with them, and you can also note
+ their completeness on a percentage scale.
+ </para>
+
+ <para>
+ <inlinemediaobject><imageobject><imagedata fileref="figures/full-3" format="png"></imageobject></inlinemediaobject>
+ <guilabel>Calendar Window</guilabel>
+ </para>
+
+ <para>
+ The <guilabel>Calendar Window</guilabel> has a graphical representation of
+ the calendar, so you can select what days to view in the <guilabel>Appointment
+ List</guilabel>.
+ </para>
+
+ <para>
+ For more information about the calendar
+ read <xref linkend="usage-calendar">.
+ </para>
+
+ </sect2>
+ <sect2 id="basics-contacts">
+ <title>Introducing the Address Book</title>
+ <para>
+ The <application>Ximian Evolution</application> address book
+ can handle all of the functions of an address book, phone
+ book, or Rolodex. Of course, it's a lot easier to update
+ <application>Ximian Evolution</application> than it is to
+ change an actual paper book. <application>Ximian
+ Evolution</application> also allows easy synchronization with
+ hand-held devices and functions with <glossterm
+ linkend="ldap">LDAP</glossterm> directories on a network.
+ </para>
+ <para>
+ Another advantage of the <application>Ximian Evolution</application>
+ address book is its integration with the rest of the
+ application. For example, you can create an address card from
+ an email just by right-clicking on the sender's email address.
+ </para>
+ <para>
+ To open your address book, click on
+ <guibutton>Contacts</guibutton> in the shortcut bar, or select
+ one of your contacts folders from the folder bar. <xref
+ linkend="usage-contact-fig"> shows the address book in all its
+ organizational glory. By default, the address book shows all
+ your cards in alphabetical order, in a <glossterm
+ linkend="minicard">minicard</glossterm> view. You can select
+ other views from the <guimenu>View</guimenu> menu, and adjust
+ the width of the columns by clicking and dragging the grey
+ column dividers.
+ </para>
+ <para>
+ The address book looks like this:
+
+ <figure id="usage-contact-fig">
+ <title>Ximian Evolution Contact Interface</title>
+ <screenshot>
+ <screeninfo>Ximian Evolution Contact List Window</screeninfo>
+ <mediaobject><imageobject><imagedata fileref="figures/contact" format="png" srccredit="Kevin Breit">
+ </imageobject></mediaobject>
+ </screenshot>
+ </figure>
+ </para>
+ <para>
+ <inlinemediaobject><imageobject><imagedata fileref="figures/full-1"
+ format="png"></imageobject></inlinemediaobject> <guilabel>Contact
+ List</guilabel>
+ </para>
+ <para>
+ The <guilabel>Contact List</guilabel> lists your contacts.
+ </para>
+ <para>
+ For detailed instructions on how to use the address book,
+ read <xref linkend="usage-contact">.
+ </para>
+ </sect2>
+ </sect1>
+</chapter> \ No newline at end of file
diff --git a/help/zh_CN/usage-notes.sgml b/help/zh_CN/usage-notes.sgml
new file mode 100644
index 0000000000..1ff2283128
--- /dev/null
+++ b/help/zh_CN/usage-notes.sgml
@@ -0,0 +1,49 @@
+<chapter id="usage-notes">
+ <title>Evolution Notes</title>
+ <abstract>
+ <title> An Overview of the Evolution Notes</title>
+ <para>
+ In the dark ages before email was invented, there were little
+ scraps of people which people used for short-term information
+ storage. These scraps of paper were called notes. Now, notes
+ are an almost necessary part of our lives, albeit in electronic
+ form. It only makes sense, then, that
+ <application>Evolution</application> will eventually have a
+ Notes feature. <application>Evolution</application> can help
+ you take notes in the following ways:
+ <itemizedlist>
+ <listitem>
+ <para>
+ Take down phone numbers, take school notes, take phone
+ messages, or even write poetry.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Color code notes to organize them, or just to
+ make them look good.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Turn a note into an email or a text file.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Write <glossterm>Haiku</glossterm>
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+ <para>
+ You can start writing notes by clicking
+ <guibutton>Notes</guibutton> in the shortcut bar. Of course,
+ it's not there yet. But when it is, it'll take you to the
+ notepad.
+ </para>
+ </abstract>
+</chapter>
+
+
+
diff --git a/help/zh_CN/usage-print.sgml b/help/zh_CN/usage-print.sgml
new file mode 100644
index 0000000000..e611b97b00
--- /dev/null
+++ b/help/zh_CN/usage-print.sgml
@@ -0,0 +1,115 @@
+<chapter id="usage-print">
+<title>Printing with Evolution</title>
+<para>
+ Like most GNOME applications, <application>Evolution</application> uses
+ the gnome-print system, so if you've used any other GNOME
+ application to print, you should be able to print from
+ <application>Evolution</application> immediately.
+</para>
+<para>
+ Whether you're printing a message, a calendar page, or a selection
+ of address cards, you can choose to print directly to a printer, or
+ save the print output to a postscript file. You can also use the
+ preview feature to see how your printed output will look.
+</para>
+
+
+ <sect1 id="printpreview">
+ <title>Print Preview</title>
+ <para>
+ <guibutton>Print Preview</guibutton> appears both as a button in
+ the printing dialog and as an item in the
+ <guimenu>File</guimenu> menu. In both places, it does the same
+ thing: it opens a new window that shows you what would happen if
+ you were to print the current message, calendar, appointment, or
+ address card.
+ </para>
+ <para>
+ That window allows you to select which pages you want to see,
+ and how close you'd like to look at them. Zoom in or out, fit
+ the page to the window (the <guibutton>Fit</guibutton> button)
+ or match the width of the page and the window (the
+ <guibutton>Fit Width</guibutton> button). None of these buttons
+ changes the way the page will be printed, but they do let you
+ get a better look. If you're satisfied with the way the things
+ look, click <guibutton>Print</guibutton> to send your document
+ on its way. If you'd like to change it, just close the
+ <guilabel>Print Preview</guilabel> window and make the changes
+ you want from your mail, calendar, or addressbook.
+ </para>
+
+
+ <!-- ==============Figure=================================== -->
+
+ <figure id="print-preview">
+ <title>Print Preview</title>
+ <screenshot>
+ <screeninfo>Print Preview</screeninfo>
+ <mediaobject><imageobject><imagedata fileref="figures/print-preview" format="png" srccredit="Aaron Weber">
+ </imageobject></mediaobject>
+ </screenshot>
+ </figure>
+<!-- ==============End of Figure============================== -->
+
+ </sect1>
+
+ <sect1 id="print-destination">
+ <title>File or Printer?</title>
+ <para>
+ The printer selection window, shown in <xref
+ linkend="print-dest">, lets you choose the format for
+ printing&mdash; <guilabel>Generic Postscript</guilabel>,
+ whether to write to a PDF file, and whether to print to a file
+ or to an actual printer in Generic Postscript. If you choose a
+ printer, you'll be asked for the printer command (probably
+ <guilabel>lpr</guilabel>) which your system uses. If you
+ choose to print to a file, you'll need to decide upon a
+ filename. And of course, you'll want to choose a number of
+ copies, and whether to collate them.
+
+ <note id="windows-ps">
+ <title>Printing to PostScript?</title>
+ <para>
+ PostScript is the file format used by most laser printers,
+ and in UNIX world is the easiest way to print to a file.
+ However, most systems running Microsoft Windows can't
+ recognize or handle PostScript files. You'll need to print
+ to PDF if you want to share your file with Windows users.
+ </para>
+ </note>
+ </para>
+
+ <!-- ==============Figure=================================== -->
+
+ <figure id="print-dest">
+ <title>Choosing a Printer</title>
+ <screenshot>
+ <screeninfo>Choosing a Printer</screeninfo>
+ <mediaobject><imageobject><imagedata fileref="figures/print-dest" format="png" srccredit="Aaron Weber">
+ </imageobject></mediaobject>
+ </screenshot>
+ </figure>
+<!-- ==============End of Figure============================== -->
+
+ <para>
+ If you're printing a message that's more than one page, you'll
+ have the option of choosing which pages to print. If you're
+ printing a calendar entry, you can decide what range of dates to
+ print. And, if you're printing contact cards, you can decide
+ whether to print only the selected cards, or all of them.
+ </para>
+ <para>
+ When you're ready, click <guibutton>Print</guibutton> to print,
+ <guibutton>Preview</guibutton> to have a look (or another look)
+ at the preview, or <guibutton>Cancel</guibutton> to cancel the
+ whole deal.
+ </para>
+ </sect1>
+</chapter>
+
+
+
+
+
+
+
diff --git a/help/zh_CN/usage-sync.sgml b/help/zh_CN/usage-sync.sgml
new file mode 100644
index 0000000000..5b93a65736
--- /dev/null
+++ b/help/zh_CN/usage-sync.sgml
@@ -0,0 +1,39 @@
+ <chapter id="usage-sync">
+ <title>Synchronizing Evolution with Hand-Held Devices</title>
+ <para>
+ This chapter is very short. It describes how to synchronize
+ the data on your Palm-OS device with the data you store in
+ <application>Ximian Evolution</application>. If you need
+ information on how to set up handheld synchronization, consult
+ <xref linkend="config-sync">.
+ </para>
+
+ <sect1 id="hotsync">
+ <title>Using HotSync</title>
+ <para>
+ Put your hand-held device in its cradle and press the
+ HotSync button.
+ </para>
+
+<tip id="sync-tip">
+<title>Palm OS v. 4.0 with Passwords</title>
+<para>
+If you use Palm OS v. 4.0 and have password protection turned on for
+your handheld device, you may encounter trouble synchronizing. If
+this happens, try turning off password protection on your handheld,
+synchronize it with your desktop computer, and then re-enable password
+protection on your handheld.
+</para>
+</tip>
+ <para>
+ If you have followed the set up instructions properly, your
+ Palm-OS device will synchronize data with <application>Ximian
+ Evolution</application>.
+ </para>
+
+ <para>
+ That's it.
+ </para>
+
+ </sect1>
+ </chapter>
diff --git a/libical/ChangeLog b/libical/ChangeLog
index d69a377318..2ecd0248d7 100644
--- a/libical/ChangeLog
+++ b/libical/ChangeLog
@@ -1,54 +1,11 @@
-2002-04-01 Dan Winship <danw@ximian.com>
+2001-12-18 Dan Winship <danw@ximian.com>
- Darwin/OS portability from Max Horn <max@quendi.de>
-
- * src/libical/icallangbind.c: #include <stdlib.h>, not <malloc.h>
-
- * src/libicalvcal/vobject.c: Likewise
-
- * src/libicalvcal/vcc.y: Likewise
-
- * src/libicalss/icaldirset.c: Rearrange #includes slightly to make
- Darwin happy.
-
-2002-02-08 Damon Chaplin <damon@ximian.com>
-
- * src/Makefile.am (SUBDIRS): added libicalvcal.
-
- * configure.in (AC_OUTPUT): added src/libicalvcal/Makefile.
-
-2002-02-06 Damon Chaplin <damon@ximian.com>
-
- * src/libicalvcal/icalvcal.c: major changes to support RRULE/EXRULE,
- VALARMS and several other properties.
-
- * src/libicalvcal/icalvcal.h (icalvcal_convert_with_defaults): new
- function to pass defaults for a few values into the importer. These
- are used when the vCalendar file doesn't provide the property but it
- is required in iCalendar.
-
- * src/libicalvcal/vcc.y: support multi-valued properties, by appending
- new ones and separating by ';'. This was pinched from our changes to
- evolution/libversit/vcc.y.
-
- * src/libicalvcal/Makefile.am: renamed library to libicalvcal-evolution
- Don't install the headers.
-
- * design-data/parameters.csv: added new error for error's parsing
- vCalendar properties.
-
-2002-01-28 Dan Winship <danw@ximian.com>
-
- * src/libical/icalrecur.c (icalrecur_add_bydayrules): Skip over
- illegal whitespace in Microsoft-generated BYDAY rules.
-
-2001-12-18 Damon Chaplin <damon@ximian.com>
-
- * src/libical/icalyacc.y: removed unused 'trigger:' production.
+ * configure.in (AC_OUTPUT): Remove src/libicalss/Makefile and
+ src/libicalvcal/Makefile since we don't build those any more. From
+ Jeremy Katz (katzj@redhat.com). #17606.
- * configure.in (AC_OUTPUT): patch from Jeremy Katz <katzj@redhat.com>
- to remove src/libicalss/Makefile and src/libicalvcal/Makefile, as we
- don't ship those directories now.
+ * src/libical/icalyacc.y: Remove an unused rule since bison 1.30
+ apparently considers this an error. #17531.
2001-12-10 Damon Chaplin <damon@ximian.com>
diff --git a/libical/configure.in b/libical/configure.in
index a07b8be2b3..df88303e14 100644
--- a/libical/configure.in
+++ b/libical/configure.in
@@ -94,7 +94,6 @@ scripts/Makefile
src/Makefile
src/libical/Makefile
src/libical/icalversion.h
-src/libicalvcal/Makefile
test-data/Makefile
zoneinfo/Makefile
])
diff --git a/libical/design-data/parameters.csv b/libical/design-data/parameters.csv
index f223b415a8..c71eb115eb 100644
--- a/libical/design-data/parameters.csv
+++ b/libical/design-data/parameters.csv
@@ -20,5 +20,5 @@
"TZID","const char*",
"VALUE","icalparameter_value","BINARY;BOOLEAN;DATE;DURATION;FLOAT;INTEGER;PERIOD;RECUR;TEXT;TIME;URI;ERROR;DATE-TIME;UTC-OFFSET;CAL-ADDRESS"
"X","const char*",
-"X-LIC-ERRORTYPE","icalparameter_xlicerrortype","COMPONENT-PARSE-ERROR;PROPERTY-PARSE-ERROR;PARAMETER-NAME-PARSE-ERROR;PARAMETER-VALUE-PARSE-ERROR;VALUE-PARSE-ERROR;INVALID-ITIP;UNKNOWN-VCAL-PROP-ERROR;MIME-PARSE-ERROR;VCAL-PROP-PARSE-ERROR"
+"X-LIC-ERRORTYPE","icalparameter_xlicerrortype","COMPONENT-PARSE-ERROR;PROPERTY-PARSE-ERROR;PARAMETER-NAME-PARSE-ERROR;PARAMETER-VALUE-PARSE-ERROR;VALUE-PARSE-ERROR;INVALID-ITIP;UNKNOWN-VCAL-PROP-ERROR;MIME-PARSE-ERROR"
"X-LIC-COMPARETYPE","icalparameter_xliccomparetype","EQUAL;NOTEQUAL;LESS;GREATER;LESSEQUAL;GREATEREQUAL;REGEX"
diff --git a/libical/src/Makefile.am b/libical/src/Makefile.am
index 7a3f9fcdff..fea649ac50 100644
--- a/libical/src/Makefile.am
+++ b/libical/src/Makefile.am
@@ -5,5 +5,5 @@ PYTHON_DIR =
endif
# For evolution we only build libical at present.
-SUBDIRS = libical libicalvcal
+SUBDIRS = libical
#SUBDIRS = libical libicalss libicalvcal # $(PYTHON_DIR) test
diff --git a/libical/src/libical/icalyacc.y b/libical/src/libical/icalyacc.y
index 87bcb3bec5..bf732a204e 100644
--- a/libical/src/libical/icalyacc.y
+++ b/libical/src/libical/icalyacc.y
@@ -6,7 +6,7 @@
DESCRIPTION:
- $Id: icalyacc.y,v 1.13 2001/12/18 20:08:31 damon Exp $
+ $Id: icalyacc.y,v 1.12.12.1 2001/12/18 20:16:48 danw Exp $
$Locker: $
(C) COPYRIGHT 1999 Eric Busboom
diff --git a/libical/src/libicalvcal/Makefile.am b/libical/src/libicalvcal/Makefile.am
index e8e8310941..c409347d14 100644
--- a/libical/src/libicalvcal/Makefile.am
+++ b/libical/src/libicalvcal/Makefile.am
@@ -1,4 +1,4 @@
-lib_LTLIBRARIES = libicalvcal-evolution.la
+lib_LTLIBRARIES = libicalvcal.la
INCLUDES = \
-I$(top_builddir) \
@@ -6,27 +6,22 @@ INCLUDES = \
-I$(top_builddir)/src/libical \
-I$(top_srcdir)/src/libicalss
-libicalvcal_evolution_la_LDFLAGS = -version-info 0:0:0
+libicalvcal_la_LDFLAGS = -version-info 0:0:0
-libicalvcal_evolution_la_SOURCES = \
- icalvcal.h \
+libicalvcal_la_SOURCES = \
icalvcal.c \
- port.h \
- vcc.h \
vcc.y \
- vobject.h \
vobject.c \
- vcaltmp.h \
vcaltmp.c
-#libicalvcalincludedir = $(includedir)/evolution/libicalvcal
+libicalvcalincludedir = $(includedir)/libicalvcal
-#libicalvcalinclude_HEADERS = \
-# icalvcal.h \
-# port.h \
-# vcc.h \
-# vobject.h \
-# vcaltmp.h
+libicalvcalinclude_HEADERS = \
+ icalvcal.h \
+ port.h \
+ vcc.h \
+ vobject.h \
+ vcaltmp.h
EXTRA_DIST = \
README.TXT \
diff --git a/libical/src/libicalvcal/vcc.y b/libical/src/libicalvcal/vcc.y
index 95d5858d81..70feefab57 100644
--- a/libical/src/libicalvcal/vcc.y
+++ b/libical/src/libicalvcal/vcc.y
@@ -107,6 +107,9 @@ DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable.
#endif
#include <string.h>
+#ifndef __MWERKS__
+#include <malloc.h>
+#endif
#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
@@ -411,31 +414,9 @@ static void enterValues(const char *value)
}
else {
if (value) {
- char *p1, *p2;
- wchar_t *p3;
- int i;
-
- /* If the property already has a string value, we append this one,
- using ';' to separate the values. */
- if (vObjectUStringZValue(curProp)) {
- p1 = fakeCString(vObjectUStringZValue(curProp));
- p2 = malloc((strlen(p1)+strlen(value)+1));
- strcpy(p2, p1);
- deleteStr(p1);
-
- i = strlen(p2);
- p2[i] = ';';
- p2[i+1] = '\0';
- p2 = strcat(p2, value);
- p3 = (wchar_t *) vObjectUStringZValue(curProp);
- free(p3);
- setVObjectUStringZValue_(curProp,fakeUnicode(p2,0));
- deleteStr(p2);
- } else {
- setVObjectUStringZValue_(curProp,fakeUnicode(value,0));
+ setVObjectUStringZValue_(curProp,fakeUnicode(value,0));
}
}
- }
deleteStr(value);
}
diff --git a/mail/ChangeLog b/mail/ChangeLog
index 9795a6c130..35acaea732 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,715 +1,8 @@
-2002-04-18 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-callbacks.c (redirect_get_composer): Removed all
- Delivered-To headers before redirecting. Fixes bug #23635.
-
2002-04-18 Radek Doulik <rodo@ximian.com>
* mail-callbacks.c (do_mail_print): use default paper name in case
of wrong translation
-2002-04-15 Not Zed <NotZed@Ximian.com>
-
- * mail-identify.c (mail_identify_mime_part): Turn off the code
- which downloads the part if we can't identify it. See discussion
- in #11778.
-
-2002-04-17 Christopher James Lahey <clahey@ximian.com>
-
- * folder-browser.c, mail-display.c: Updated these to match the new
- EPopupMenu.
-
-2002-04-17 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-format.c (handle_multipart_signed): Handle broken
- multipart/signed parts such as where the signature part is not the
- last part (as it should be). Fixes bug #23583.
-
- * folder-browser.c (message_list_drag_data_get): Free the temp
- GByteArrays.
-
-2002-04-17 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-local.c (mail_local_folder_construct): Just use g_basename.
- (mlf_finalize): Free the real_path.
-
- * folder-browser.c (on_right_click): Unref the GdkGC so we don't
- leak it.
-
-2002-04-16 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-tools.c (mail_tool_destroy_xevolution): Free the format
- string.
-
- * mail-config.c (config_write_signature): Don't leak the path
- strings here.
-
- * mail-signature-editor.c (menu_file_save_cb): Free the dirname
- string.
-
- * mail-config-factory.c (config_control_factory_cb): Ref the prefs
- widget here since we unref in the destroy callback. Caught this
- thanks to purify.
-
-2002-04-13 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-accounts.c: Build fixes for --enable-nntp.
-
-2002-04-13 Christophe Merlet <redfox@eikonex.org>
-
- * mail-config.glade: Little typo. s/IS0/ISO/
-
-2002-04-12 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-composer-prefs.c (mail_composer_prefs_construct): Make it
- so that unchecking the "Enable Advanced Options" in the signature
- tab disables the advanced settings and vise versa.
-
- * mail-accounts.c (mail_accounts_tab_construct): Setup News
- preferences too if it is enabled.
-
- * mail-account-gui.c (mail_account_gui_new): Set the text of the
- reply-to.
- (mail_account_gui_save): Get the reply-to text here.
- (mail_account_gui_identity_complete): If there is text in the
- reply-to widget make sure it's valid.
-
- * mail-config.c (identity_copy): Copy the reply-to.
- (config_read): Read in the reply-to for all the accounts.
- (mail_config_write): Save the reply-to.
- (impl_GNOME_Evolution_MailConfig_addAccount): Get the reply-to.
- (identity_destroy): Free the reply-to.
-
-2002-04-11 Jeffrey Stedfast <fejj@ximian.com>
-
- * message-list.etspec: s/Sent/Date. This fixes bug #11159.
-
-2002-04-10 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-callbacks.c (confirm_expunge): Set the 'No' button as the
- default.
-
-2002-04-10 Dan Winship <danw@ximian.com>
-
- * mail-config.c (config_read, mail_config_write,
- mail_config_get_x_mailer_display_style,
- mail_config_set_x_mailer_display_style): Handle the X-Mailer
- display style. (There is currently no GUI for configuring this.)
-
- * mail-format.c (write_headers, write_xmailer_header): Show
- X-Mailer/User-Agent (and Rupert's stamp of approval) as
- appropriate.
-
-2002-04-09 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-account-gui.c (setup_service): Kludge around the brokeness
- that is GtkOptionMenu just like we kludge around it for the
- authtype option menu.
-
-2002-04-09 Dan Winship <danw@ximian.com>
-
- * component-factory.c (create_view): Add view_info arg, but don't
- do anything with it.
-
-2002-04-08 Not Zed <NotZed@Ximian.com>
-
- * mail-send-recv.c (receive_update_got_folderinfo): Argh!
- get_folder_info owns and frees its *OWN* folder info, it shouldn't
- be free'd here! See mail-ops.c:get_folderinfo_free.
- This should fix #17259 and friends.
-
-2002-04-08 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-signature-editor.c (menu_file_save_cb): Simplify a bit and
- write to a temp file first and then rename() it to the real
- filename. This protects against losing data if the drive is full
- too. Also use a real mode, not 0, so that we can actually
- save/read the content ;-)
-
- * GNOME_Evolution_Mail.oaf.in: Re-added the config wizard
- interfaces. Ettore accidently removed them thinking they were
- duplicates of the new mail-config interfaces.
-
- * mail-config.glade: Remove the OK, Apply, Cancel buttons from the
- keyboard shortcut tab in the composer_prefs dialog.
-
- * mail-account-gui.c: No need to check gui->source before using
- gui->source->url, since gui->source *has* to exist.
-
-2002-04-06 JP Rosevear <jpr@ximian.com>
-
- * GNOME_Evolution_Mail.oaf.in: add config_item:type
-
-2002-04-04 Dan Winship <danw@ximian.com>
-
- * mail-account-gui.c (mail_account_gui_new): Make the drafts and
- sent folder buttons be EvolutionFolderSelectorButtons. Remove the
- code to deal with drafts_folder_name and sent_folder_name, since
- they were only used to construct the button and aren't needed now.
- (mail_account_gui_save): Remove drafts/sent name references.
- (mail_account_gui_destroy): Likewise
- (folder_selected): Handle the "selected" signal on the folder
- selector button by updating the URI in the MailAccountGui.
- (mail_account_gui_folder_selector_button_new): Glade custom widget
- constructor.
-
- * mail-callbacks.c (transfer_msg): Update for
- evolution_shell_client_user_select_folder change.
-
- * message-browser.c (transfer_msg): Likewise. (Sigh. Why is this
- cut+pasted?)
-
- * mail-config.glade: Make the drafts/sent folder buttons custom
- widgets.
-
- * mail-config.c (account_copy): Remove drafts/sent folder name
- handling.
- (account_destroy): Likewise.
- (config_read): Likewise.
- (mail_config_write): Likewise.
-
- * Mail.idl (MailConfig:Account): remove drafts_folder_name and
- sent_folder_name.
-
-2002-04-03 Jeffrey Stedfast <fejj@ximian.com>
-
- * message-tag-followup.c (construct): Set the window title/icon
- here instead.
-
- * message-tag-editor.c (message_tag_editor_init): Don't set the
- title or window icon here, this is a generic class.
-
- * mail-format.c (handle_multipart_signed): Replace
- get_url_for_icon with the new mail_display_get_url_for_icon
- function.
- (handle_multipart_digest): Here too.
- (get_cid): Use mail_display_add_url instead.
- (get_location): Same.
- (handle_text_enriched): Here too.
- (handle_multipart_signed): And here.
-
- * message-tag-followup.c (message_tag_followup_i18n_name): Use the
- U_() macro, not the _() macro as it is what we really want.
-
- * mail-ops.c (mail_send_message): Don't cast the message into a
- CamelMedium before sending anymore.
-
- * mail-callbacks.c (expunge_folder): Set the followup argument to
- NULL here.
- (done_message_selected): Get the followup value here and pass it
- to the mail-display here.
- (do_mail_fetch_and_print): Again with the NULL followup here.
-
- * folder-browser.c (folder_browser_set_message_preview): Update to
- pass in NULL as the followup since we are setting the message to
- NULL here.
- (done_message_selected): Get and set the appropriate followup
- value here.
- (do_message_selected): Update to pass in NULL as the followup
- since we are setting the message to NULL here.
-
- * mail-display.c (mail_display_set_message): Now takes a followup
- tag value.
- (mail_display_init): Set md->followup to NULL.
- (mail_display_destroy): Free md->followup.
- (mail_display_add_url): New: replaces the static add_url function
- originally in mail-format.c
- (mail_display_get_url_for_icon): New: replaces get_url_for_icon
- which was originally in mail-format.c
-
-2002-04-03 Dan Winship <danw@ximian.com>
-
- * mail-account-gui.c: Changes to allow combined store/transport
- providers (like exchange and nntp). You can only select the
- transport if the account is also using that provider for the
- source.
- (source_type_changed): If changing away from a combined
- store/transport type, disable that provider on the transport page.
- If change to a combined store/transport type, enable and select
- that provider on the transport page.
- (mail_account_gui_setup): Do some additional bookkeeping here to
- make the above stuff work.
- (transport_type_changed): If the provider is a combined
- store/transport type, pretend it doesn't need any additional URL
- configuration.
- (mail_account_gui_transport_complete): if the transport provider
- is also a store provider, then as long as it matches the source
- for the account, it's considered complete.
- (mail_account_gui_save): If the selected transport is a combined
- store/transport provider, use the source page's information to
- fill in the transport url.
-
- * mail-local.c (mail_local_provider_init): Don't set up
- service_cache.
-
-2002-04-02 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-callbacks.c (do_edit_messages): Pass the UID of the message
- being edited to the save-draft signal handler.
- (composer_save_draft_cb): Pass the old draft uid to our async
- append_message function and let the append_message callback worry
- about deleting the old draft message on success.
- (save_draft_done): Delete the old draft message if we successfully
- appended the new draft message.
-
-2002-04-01 Jeffrey Stedfast <fejj@ximian.com>
-
- * folder-browser-ui.c: Removed an unused pixmap from
- Tools/Settings to avoid a big nasty bonobo warning.
-
- * mail-composer-prefs.c (mail_composer_prefs_construct):
- Re-Implemented the signature editor stuff (mostly just copy/paste
- from Radeks original code).
-
- * mail-signature-editor.c (mail_signature_editor): Use the right
- oafiid for the html editor control.
-
-2002-04-01 Dan Winship <danw@ximian.com>
-
- * importers/Makefile.am (liboutlook_la_LDFLAGS,
- libmbox_la_LDFLAGS): Use -avoid-version -module. (From Max Horn
- <max@quendi.de>)
-
-2002-03-29 Ettore Perazzoli <ettore@ximian.com>
-
- * GNOME_Evolution_Mail.oaf.in: Added priorities for all the
- configuration pages [evolution:config_item:priority].
-
-2002-03-29 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-preferences.c (colorpicker_get_color): Don't shift the r, g
- and b values here either.
-
- * mail-composer-prefs.c (colorpicker_get_color): Don't shift the
- r, g, b values.
-
- * mail-preferences.c (mail_preferences_construct): Restore the
- labels & colours options from the grave.
- (mail_preferences_apply): Save these labels & colours options.
-
-2002-03-29 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-composer-prefs.c (mail_composer_prefs_construct): Same
- here.
-
- * mail-preferences.c (mail_preferences_construct): Do some gtk
- hackery action so we can detect if a option menu has changed.
-
-2002-03-29 Ettore Perazzoli <ettore@ximian.com>
-
- * GNOME_Evolution_Mail.oaf.in: Cleaned up a bunch [removing
- duplicates ;-)], set up icons for all the configuration pages.
-
-2002-03-28 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-accounts.c: Use a GtkCList instead of an ETable, for some
- reason the etable was getting into some infinite resize loop or
- something. I probably did something wrong but I can't figure out
- what so I'm using a clist for now.
- (account_cursor_change): Make sure that event is non-NULL here.
-
-2002-03-27 Ettore Perazzoli <ettore@ximian.com>
-
- * mail-accounts.c (mail_accounts_tab_construct): Use
- gtk_container_add() to put the toplevel in the parent widget,
- instead of just gtk_widget_set_parent().
- * mail-preferences.c (mail_preferences_construct): Likewise.
- * mail-composer-prefs.c (mail_composer_prefs_construct): Likewise.
-
-2002-03-27 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-callbacks.c (mail_generate_reply): Updated to respect the
- new mail-config options for default reply style that NotZed had
- started to implement before there was a gui.
-
-2002-03-27 Dan Winship <danw@ximian.com>
-
- * mail-display.c (do_attachment_header): unset GTK_CAN_FOCUS on
- the button so that it can't grab focus when you click it.
- (do_signature): Likewise on the signature button. #3904
-
-2002-03-26 Jeffrey Stedfast <fejj@ximian.com>
-
- Sync with yet-another-mail-config branch.
-
- * mail-composer-prefs.c: Updated to get the right widgets and
- whatnot. Also updated to tell the evolution-config-control that
- stuff has changed.
-
- * mail-preferences.c: Updated to get the right widgets and
- whatnot. Also updated to tell the evolution-config-control that
- stuff has changed.
-
- * mail-accounts.etspec: New file needed by mail-accounts.c
-
-2002-03-26 Not Zed <NotZed@Ximian.com>
-
- * mail-callbacks.c (addrbook_sender): Changed to get the address
- from the messageinfo of the current selected message rather than
- from the current_message.
- (requeue_mail_reply): Only re-queue if we got a message, could
- potentially cause an infinite loop trying to get a message it
- can't.
- (reply_to_sender, reply_to_list, reply_to_all): Always pass NULL
- as the msg to mail_replay, this forces mail_reply to always load
- the message anew. Fixes FIXME's and popup behaviour. Basically
- this and stuff below fixes #8542. Its probably not the nicest
- way, but it works.
- (mark_as_important): Use the flags properly, we can set all flags
- to any combination of on or off as we want, so we just need to
- call set_flags once, thats why its set flags and not set_option.
- (toggle_flags): Fixed the logic here also, so we dont have to call
- set_message_flags more than once, and also implement a true toggle
- for any number of simultaneous flags (whilst simplifying code).
-
- * mail-vfolder.c (vfolder_gui_add_from_mlist): Removed the 'msg'
- parameter, its not used, fixed callers.
-
- * folder-browser.c (on_right_click): Lookup the mlist from
- messageinfo, and change the 'no selected' logic slightly, fixes
- most of #8542.
- (filter_data_free): Free filter data struct.
- (vfolder_type_got_message): Actually create vfolder once we have
- the message we need to use for it. Code could probably be changed
- to use messageinfo instead.
- (vfolder_type_uid): Lookup a message based on uid, and use that to
- create a vfolder based on type.
- (vfolder_subject_uid, vfolder_sender_uid, vfolder_receipient_uid,
- vfolder_mlist_uid): Callbacks for the popup menu, used to create
- rules based on the uid rather than the message, which it loads as
- required.
- (filter_type_got_message, filter_*_uid): Similar to vfolder
- stuff above.
- (filter_menu[]): Changed callbacks to popup specific ones, not
- folderbrowser specific ones used by bonobo.
- (on_right_click): Initialise callback data for the filter submenu
- so it can look up messages for callback implementation.
-
- * local-config.glade: New version from anna, with fixed widget
- names.
-
-2002-03-20 Ettore Perazzoli <ettore@ximian.com>
-
- * folder-browser.c: Reorder folder_browser_search_menu_items
- according to #16246.
-
-2002-03-24 Ettore Perazzoli <ettore@ximian.com>
-
- * mail-send-recv.c: Remove member current_folder from struct
- _send_data.
- (build_dialogue): Remove arg @current_folder.
- (mail_send_receive): Likewise.
- (free_send_data): No need to refresh the current folder here.
- [Well, hopefully, at least.]
-
- * component-factory.c (send_receive_callback): New.
- (create_component): Connect.
-
- * mail-callbacks.c (send_receive_mail): Removed.
-
- * folder-browser-ui.c: Remove "MailGetSend" verb.
-
-2002-03-22 Jeffrey Stedfast <fejj@ximian.com>
-
- * GNOME_Evolution_Mail.oaf.in: Add info about the new config
- controls.
-
- * mail-config-factory.c: New file to handle the creation/etc of
- the config controls.
-
- * mail-accounts.c:
-
- * mail-preferences.c:
-
- * mail-composer-prefs.c: No longer handle their own bonobo control
- creation.
-
-2002-03-22 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-account-gui.c (sig_new_text): Temporarily #if 0 this
- function out.
- (sig_new_html): Same.
-
- * mail-config.c (config_read): Read in the default reply style
- setting.
- (mail_config_write_on_exit): Same the default reply style.
- (mail_config_get_default_reply_style): New function to get the
- default reply style.
- (mail_config_set_default_reply_style): New function to set the
- default reply style.
-
- * folder-browser-ui.c: There is no longer a Tools/Mail Settings
- menu item.
-
- * mail-account-gui.c: Updated the widget types for the
- MailAccountsDialog->MailAccountsTab change.
-
- * mail_account_editor.c: Same.
-
- * mail-callbacks.c (providers_config): Removed.
-
- * mail-composer-prefs.c: New file that implements the composer
- preferences tab of anna's new config design.
-
-2002-03-21 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-accounts.c: Reimplemented. This time we only have to worry
- about accounts. Also this now implements Annas config gui changes.
-
- * mail-preferences.c: Implements the mailer's Preferences tab in
- Anna's new config GUI.
-
-2002-03-19 Larry Ewing <lewing@ximian.com>
-
- * mail-display.c: add missing NULL closure data to popup menu
- initialization.
-
-2002-03-19 Dan Winship <danw@ximian.com>
-
- * Makefile.am (evolution_mail_LDADD): s/libversit.la/libversit.a/
-
-2002-03-18 Ettore Perazzoli <ettore@ximian.com>
-
- * main.c (main): Report a message before entering bonobo_main() to
- simplify debugging.
-
-2002-03-18 Ettore Perazzoli <ettore@ximian.com>
-
- * folder-browser.c: Remove E_FILTERBAR_RESET menu entry.
-
-2002-03-15 Jeffrey Stedfast <fejj@ximian.com>
-
- * folder-browser.c (on_right_click): Draw colour rectangles for
- each of the colour items and set a closure on each.
- (colourise_msg): colourise the message, yo.
-
-2002-03-15 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-callbacks.c (colour_msg): New callback to set a colour on a
- message.
-
- * folder-browser.c (on_right_click): Setup our popup icons and
- stuff. Also add a submenu for Labels.
-
- * mail-display.c (pixmap_press): Sync up with the new EPopupMenu
- API. Note: This code can probably now be fixed to use per-item
- closures - yay!
-
- * mail-accounts.c (construct): Connect to the label GtkEntry's and
- GnomeColorPickers and also to the Restore Defaults button.
-
- * mail-config.c (mail_config_get_label_name): New function to get
- a label's name.
- (mail_config_set_label_name): New function to set the label name.
- (mail_config_get_label_color): New function to get the label
- color.
- (mail_config_set_label_color): New function to set the label
- color.
- (config_read): Read in the config options for the labels and their
- colors.
- (mail_config_write_on_exit): Save the label options.
-
-2002-03-15 Larry Ewing <lewing@ximian.com>
-
- * mail-display.c: expand the relative urls of the object at the
- point so that relative images can be saved correctly.
-
- * folder-browser.c: add a closing quote in a comment.
-
-2002-03-15 Ettore Perazzoli <ettore@ximian.com>
-
- * folder-browser-factory.c (control_activate): Set the UI
- component on the search bar.
-
-2002-03-14 Dan Winship <danw@ximian.com>
-
- * component-factory.c (folder_types): Remove "mailstorage", since
- it's not needed any more.
- (storage_activate): Gone, although some of it is moved to
- storage_connect.
- (create_view): Remove mailstorage code.
- (add_storage): Connect to the storage's open_folder signal.
- Instead of creating a "mailstorage" folder, call
- evolution_storage_has_subfolders to let the shell know we haven't
- finished filling it in yet.
- (storage_connect): Handler for the storage's asyncOpenFolder
- signal. Call mail_note_store() to try to connect.
- (storage_connected): Callback for above. If the connection attempt
- failed, call evolution_storage_has_subfolders again to make the
- shell re-close the storage.
-
- * mail-folder-cache.c (update_folders): Remove a piece of
- mailstorage legacy code from here.
-
-2002-03-14 Radek Doulik <rodo@ximian.com>
-
- * mail-config.c (get_new_signature_filename): create new signature
- file
- (delete_unused_signature_file): be more careful about signature
- file path before unlinking
-
-2002-03-14 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-callbacks.c (next_thread): Implemented.
-
- * message-list.c (message_list_select_next_thread): New function
- to select the next thread.
-
-2002-03-13 Jeffrey Stedfast <fejj@ximian.com>
-
- * folder-browser-window.c (folder_browser_window_new): Set a
- default size of the window, so we don't get this itty-bitty window
- the size of a quarter on the screen when it first gets shown.
-
-2002-03-12 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-display.c (on_link_clicked): Handle digest: urls.
-
- * mail-format.c (setup_mime_tables): Add a handler for
- multipart/digest.
- (handle_multipart_digest): Handle multipart/digest parts.
-
-2002-03-12 Jeffrey Stedfast <fejj@ximian.com>
-
- * folder-browser.c (folder_browser_set_folder): Set the folder on
- a folder-browser object.
-
- * folder-browser-window.c (folder_browser_window_new): Simple
- window to display a folder-browser.
-
- * mail-callbacks.c (view_digest): New callback to open a
- folder-browser-window with a digest folder.
-
-2002-03-08 Radek Doulik <rodo@ximian.com>
-
- * mail-signature-editor.c (menu_file_save_cb): truncate stream
- before saving
-
- * mail-config.c (mail_config_signature_set_html): new function
-
- * mail-accounts.c (sig_event_client): watch for HTML changed event
-
- * mail-signature-editor.c: added HTML check menu item to Format
- menu
-
-2002-03-08 Dan Winship <danw@ximian.com>
-
- * mail-config-druid.c (management_prepare): Rewrite this to not
- use stpcpy, which isn't portable.
-
-2002-03-08 Radek Doulik <rodo@ximian.com>
-
- * mail-accounts.c (sig_event_client): handle name changed event
- (sig_load_preview): don't run script before each reload
- (sig_script_activate): run script only if script entry is
- activated
-
- * mail-signature-editor.c (mail_signature_editor): added signature
- name entry
-
-2002-03-07 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-config-druid.c (management_changed): Re-focus the account
- name entry widget.
- (identity_prepare): If a name is not set, try and get the user's
- full name for them and set the text on the entry widget.
- (management_prepare): If the account name is already taken,
- generate a unique one by appending " (%d)".
-
-2002-03-07 Radek Doulik <rodo@ximian.com>
-
- * mail-account-gui.c (sig_new_html): make edit button sensitive
- after new signature is created
- (sig_new_text): ditto
-
-2002-03-07 Anna Marie Dirks <anna@ximian.com>
-
- * folder-browser.c: Made all the acclerators in the context menu
- on a message work. (There are 22 different menu items here, so
- picking a unique accelerator for each label was tricky, and some
- of the choices I made are different from the ones I would have
- made if there weren't so many stinking menu items.)
-
-2002-03-07 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-config.c (config_import_old_signatures): Don't use an
- uninitialized 'id'.
-
-2002-03-07 Radek Doulik <rodo@ximian.com>
-
- * mail-signature-editor.c: notify accounts dialog about signature
- content change
-
- * mail-accounts.c (run_script): run script only if file regular
- file exists and has x flag
-
- * mail-signature-editor.c (mail_signature_editor): set initial
- focus to editor
- (do_exit): use hasUndo to avoid question dialog when content is
- unchanged
-
-2002-03-07 Dan Winship <danw@ximian.com>
-
- * component-factory.c (add_storage): Update for storage changes:
- explicitly create a root folder.
-
-2002-03-06 Dan Winship <danw@ximian.com>
-
- * mail-display.c (mail_display_render): Fix the "don't scroll back
- to the top of the HTML widget when opening an attachment" hack
- again by moving it here from mail_display_redisplay(). (It has to
- happen after the gtk_html_begin.)
- (mail_display_redisplay): Pass reset_scroll arg to
- mail_display_render.
-
- * mail-callbacks.c (do_mail_print): Pass reset_scroll (TRUE) to
- mail_display_render.
-
-2002-03-05 Dan Winship <danw@ximian.com>
-
- * folder-browser-ui.c: Don't try to set pixmap for
- /Toolbar/MailCompose, since it doesn't exist any more.
-
-2002-03-05 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-account-gui.c (save_service): "use_ssl" can now be 3
- options, modify the code to handle this.
- (setup_service): Toggle the correct ssl option.
- (source_type_changed): Show/hide the ssl hbox container widget.
- (transport_type_changed): Same.
-
-2002-03-05 Dan Winship <danw@ximian.com>
-
- * mail-folder-cache.c (mail_note_store): Pull up assertion change
- from evolution-1-0-branch to allow external storages.
-
-2002-03-04 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-accounts.c (mail_unselect): If the clicked column was
- column 0, enable/disable it.
- (mail_select): Same.
-
- * mail-display.c (load_http): Added more debugging code to help
- figure out why a certain image isn't loading - looks like
- gnome-vfs is getting a premature EOF?
-
- * folder-browser.c (my_folder_browser_init): Connect to the
- focus-in/out events on the message-list so that we can disable the
- EditInvertSelection and EditSelectThread menu items when the
- message-list is not in focus.
-
- * folder-browser-ui.c (folder_browser_ui_message_list_unfocus):
- New function to de-sensitize some items if the message-list is not
- in focus.
- (folder_browser_ui_message_list_focus): New function to sensitize
- some items if the message-list is not in focus.
-
- * mail-callbacks.c (invert_selection): Only invert the selection
- of the message-list if it is the widget in focus.
-
- * message-list.c (message_list_select): Do not explicitly grab the
- focus here.
-
2002-03-04 Ettore Perazzoli <ettore@ximian.com>
[Fix #19303.]
@@ -717,33 +10,6 @@
* mail-ops.c (mail_send_message): Set X-Mailer to say "Ximian
Evolution", not just "Evolution".
-2002-03-01 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-callbacks.c (forward_message): Forward all selected
- messages. Fixes bug #21190.
-
-2002-02-26 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-format.c (handle_text_html): Get the Content-Base if the
- header exists and use gtk_html_set_base to set this base url.
-
- * mail-display.c (on_link_clicked): No longer need to calculate
- the full url. This is now handled by GtkHTML.
- (on_set_base): Removed.
- (on_url_requested): No longer need to calculate the full url.
- (mail_display_initialize_gtkhtml): Don't connect to the set_base
- signal anymore. We don't care.
-
- * mail-display.h: No longer need base_url (it was broken anyway).
-
-2002-02-26 Not Zed <NotZed@Ximian.com>
-
- * mail-display.c (on_url_requested): If a related part is
- requested, remove it from the related undisplayed list.
-
- * mail-format.c (handle_multipart_related): Check if related parts
- are displayed, if not, remove them. For #2741.
-
2002-02-24 Chris Toshok <toshok@ximian.com>
* folder-browser.c (folder_browser_search_do_search): rename
@@ -752,549 +18,42 @@
search_activated up to folder_browser_search_do_search, preserving
current behavior.
-2002-02-22 Jeffrey Stedfast <fejj@ximian.com>
-
- * message-list.c (on_message_list_built): Removed, this wasn't
- working as intended and seemed to break other features.
-
-2002-02-21 Ettore Perazzoli <ettore@ximian.com>
-
- * component-factory.c (create_component): Add an icon for the "New
- message" user creatable item.
-
-2002-02-21 Jeffrey Stedfast <fejj@ximian.com>
-
- * message-list.c (on_message_list_built): Connect to our own
- message_list_built signal. Focus the list and select the first
- unread message (or frst message depending). Fixes bug #3900.
-
-2002-02-20 Anna Marie Dirks <anna@ximian.com>
-
- * message-tag-editor.c (message_tag_editor_init): Gave the editor
- window a title and an icon.
-
-2002-02-20 Anna Marie Dirks <anna@ximian.com>
-
- * message-tags.glade: Changed the policy for table2 so that it
- does not expand/fill. This was necessary to allow the message list
- as much growing room as possible. (And besides, there's no reason for
- table2 to expand/fill; its child widgets can't change size.
-
-2002-02-19 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-callbacks.c (confirm_goto_next_folder): Prompt the user to
- find out if he/she wants to go to the next folder with unread mail
- in it.
- (find_current_folder): Find a given CamelFolderInfo node based on
- a given uri.
- (find_next_folder_r): Recursively look for a CamelFOlderInfo node
- which has unread messages.
- (find_next_folder): Given a currently selected CamelFolderInfo
- node, look for the next node containing unread messages.
- (do_evil_kludgy_goto_next_folder_hack): Find the currently
- selected folder and then find the very next folder after it that
- contains unread messages and then select it via a CORBA call to
- the shell.
- (next_unread_msg): If we fail to find an unread message in the
- message-list, prompt the user to find out if we should jump to the
- next fodler containing unread messages. If so, call
- do_evil_kludgy_goto_next_folder_hack().
-
- * message-list.c (message_list_select): Return a boolean value
- based on whether the call was successfull or not.
-
- * mail-config.c (mail_config_get_confirm_goto_next_folder):
- (mail_config_set_confirm_goto_next_folder):
- (mail_config_get_goto_next_folder):
- (mail_config_set_goto_next_folder): All new functions, yay.
- (config_read): Read in the confirm_goto_next_folder and
- goto_next_folder config options.
- (mail_config_write_on_exit): Same the options here.
-
2002-02-15 Jeffrey Stedfast <fejj@ximian.com>
- * mail-account-gui.c (basename_from_uri): Ack, strip off the
- leading '/' char and also only translate if it is a local uri,
- imap folders and other external folders will be named by the user
- so no need to translate those.
-
- * mail-display.c (do_attachment_header): Don't display a
- down-arrow if the attachment is undisplayable. Fixes bug #6919.
- (launch_cb): Some programs are buggy when it comes to parsing
- file: uris, so make sure we do file://%s. Fixes bug #20456.
-
-2002-02-14 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-account-gui.c (basename_from_uri): Replacement for using
- g_basename and also translates the basename string to fix bug
- #7160.
- (mail_account_gui_save): Use basename_from_uri().
- (folder_picker_clicked): Here too.
-
- * mail-callbacks.c (mail_generate_reply): Default the from-account
- to the source account. If that fails, then guess the from-account
- based on the recipients. Fixes bug #20479.
-
-2002-02-13 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-display.c (drag_data_get_cb): Implement.
- (drag_data_delete_cb): Implement.
- (do_attachment_header): Setup Drag & Drop. This implements
- bugzilla bug #1066.
-
- * folder-browser-ui.c: Set the followup icon to use the new flag
- icon rather than the exclamation mark icon.
-
- * mail-callbacks.c (flag_for_followup): Append the selected
- messages to the clist in the followp editor.
-
- * message-list.c: Include the new flag-for-followup icon.
-
- * message-tag-followup.c (message_tag_followup_append_message):
- New method to add a message to the message-list.
- (construct): Get the message_list widget and load the flag icon
- pixmap.
-
-2002-02-12 Jeffrey Stedfast <fejj@ximian.com>
-
- * message-tag-followup.c (set_widget_values): Fixed a bug.
-
- * mail-callbacks.c (flag_for_followup): If only 1 message is
- selected and it happens to already be marked for follow-up, set
- the value of the flag on the editor so the settings are restored.
-
- * folder-browser-ui.c: Set the pixmaps on MarkAsRead, MarkAsUnread
- and MarkAsImportant bonobo verbs. Also connect to
- flag-for-followup verb.
- (folder_browser_ui_set_selection_state): Added MessageFollowUpFlag
- verb to the array of verb strings.
-
- * folder-browser.c: Set key accelerators on the follow-up
- right-click menu items to match Outlook.
-
-2002-02-12 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-callbacks.c (create_msg_composer): No longer need to call
- e_msg_composer_show_sig_file(). This gets handled auto-magically
- by a signal emition when the default From address chooser gets
- created.
- (do_forward_non_attached): No longer need to call it here either
- because e_msg_composer_set_body_text() now makes sure to re-show
- the signature.
+ * mail-display.c (launch_cb): Some programs are buggy when it
+ comes to parsing file: uris, so make sure we do file://%s. Fixes
+ bug #20456.
2002-02-12 Jeffrey Stedfast <fejj@ximian.com>
* mail-callbacks.c (do_forward_non_attached): Show the signature.
-2002-02-11 Jeffrey Stedfast <fejj@ximian.com>
-
- * message-list.c (ml_tree_value_at): Get followup-up message-list
- values. Also highlight the message in red if the due-by date is
- past due (this is what Outlook does).
- (ml_duplicate_value): Handle follow-up columns.
- (ml_free_value): Same.
- (ml_initialize_value): Here too.
- (ml_value_is_empty): And here.
- (ml_value_to_string): And finally here.
-
- * message-tag-followup.c (message_tag_followup_i18n_name): New
- convenience function.
-
-2002-02-11 Radek Doulik <rodo@ximian.com>
-
- * mail-callbacks.c (create_msg_composer): unset changed, drop
- editor undo
- (mail_generate_reply): drop editor undo
- (do_forward_non_attached): ditto
- (do_forward_attach): ditto
- (do_redirect): ditto
-
-2002-02-11 Jeffrey Stedfast <fejj@ximian.com>
-
- * folder-browser.c (followup_tag_complete): Implemented.
- (on_right_click): Do better enabling/hiding of unwanted
- flag-for-followup options.
-
-2002-02-09 Jeffrey Stedfast <fejj@ximian.com>
-
- * message-tag-followup.c (set_widget_values): Set the correct
- drop-down menu item.
- (message_tag_followup_encode): Return NULL if the type is NONE.
- (clear_clicked): Set the drop-down menu to None.
- (type_changed): Hide the None menu item.
- (construct): Create a None menu item and set it as the default.
-
-2002-02-08 Jeffrey Stedfast <fejj@ximian.com>
-
- * message-tag-followup.[c,h]: New flag-for-followup tag editor
- dialog.
-
- * mail-callbacks.c (flag_for_followup): New callback that pops up
- a flag-for-followup editor dialog.
- (flag_followup_completed): Marks all flag-for-followup'd messages
- as 'complete'.
- (flag_followup_clear): Clears all flag-for-followup tags from the
- selected messages.
-
- * message-tags.glade: glade file for tag editors.
-
2002-02-08 Jeffrey Stedfast <fejj@ximian.com>
- * message-tag-editor.[c,h]: Base class for a message tag editor.
-
- * folder-browser.c (on_right_click): Setup the hide/enable masks
- for "Flag for Follow-up"
-
- * mail-callbacks.c (confirm_expunge): Instead of hiding deleted
- messages and then expunging, disable the use of the message-list
- completely during the expunge operation.
- (expunged_folder): Re-enable the use of the message-list widget
- here.
-
-2002-02-07 Radek Doulik <rodo@ximian.com>
-
- * mail-callbacks.c (mail_generate_reply): call set_body later to
- allow ignored words to be sent to gtkhtml control ahead
-
-2002-02-07 JP Rosevear <jpr@ximian.com>
-
- * component-factory.c (create_component): remove "New" from user
- creatable menu item
-
-2002-02-07 Christopher James Lahey <clahey@ximian.com>
-
- * folder-browser.c, folder-browser.h, folder-browser-ui.c,
- folder-browser-ui.h
- (folder_browser_ui_setup_view_menus,
- folder_browser_ui_discard_view_menus): Changed this to use the new
- GalViewMenus stuff. Made these exported functions.
-
- * mail-callbacks.c, message-browser.c: Changed these to not pass
- the now removed row parameter to message_list_select.
-
- * mail-config.c, mail-config.h (mail_config_folder_to_safe_url):
- Refactored this out of mail_config_folder_to_cachename.
-
- * message-list.c, message-list.h (message_list_select): Removed
- the row argument. Changed this to use the new function in ETree
- for finding the next cursor row that matches a test.
- (message_list_construct): Handle a failed construction of the
- ETree here.
- (message_list_setup_etree, save_tree_state): Don't load or save
- the header state. folder-browser-ui.c deals with this now.
-
-2002-02-06 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-account-gui.c (mail_account_gui_new): Rearranged the #if
- checks so that we don't ever try to access any smime widgets
- (since they are now being destroyed) if smime isn't enabled.
- (mail_account_gui_save): Same here.
-
- * message-list.c: Removed references to NEEDS_REPLY.
-
- * mail-callbacks.c (mark_as_needing_reply): Removed.
- (mark_as_not_needing_reply): Removed.
- (toggle_need_reply): Removed.
-
- * folder-browser.c (on_right_click): Remove CAN_MARK_NEEDS_REPLY
- stuff, this is going to be implemented in an entirely different
- way.
-
- * mail-format.c (handle_text_plain): Look for DOCTYPE XML comments
- too to decide if the message content is really HTML.
-
-2002-02-06 Not Zed <NotZed@Ximian.com>
-
- * mail-callbacks.c (mail_generate_reply): Dont double-free the
- text body data.
-
-2002-01-31 Not Zed <NotZed@Ximian.com>
-
- * mail-callbacks.c (mail_generate_reply): Add attachments after
- we've seen if the composer object is valid.
- (mail_generate_reply): Support new flag REPLY_NO_QUOTE - if set,
- then dont quote any of the message in the reply.
-
-2002-02-02 Ettore Perazzoli <ettore@ximian.com>
-
- * mail-account-gui.c (mail_account_gui_new): Destroy the S/MIME
- frame if not available, instead of just graying it out. [I would
- just hide it, but it looks like there is a show_all somewhere so
- that doesn't work.]
-
-2002-02-02 Ettore Perazzoli <ettore@ximian.com>
-
- * mail-config.glade: Some touchups from me and Anna.
-
-2002-01-31 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-callbacks.c (composer_get_message): Don't bother setting
- the auto-cc/bcc recipients here. I'm moving the code to add them
- in the GUI in the composer so they will already be in the
- recipient list by this point.
-
-2002-01-31 Radek Doulik <rodo@ximian.com>
-
- * mail-callbacks.c (mail_generate_reply): ignore spell checking of
- words in addresses, move set_body_text after all ignored words are
- set so we don't have to spell check whole document again
- (mail_ignore_address): helper function
- (mail_ignore): ditto
-
-2002-01-30 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-accounts.c (mail_edit): Pass the parent window to
- mail_account_editor_new().
-
- * mail-account-editor.c (mail_account_editor_new): Set the parent
- window here because construct() inadvertantly
- gtk_widget_show_all's the editor.
-
- * mail-account-gui.c (mail_account_gui_save): Use g_basename()
- rather than strrchr for '/' especially since the strrchr code
- wasn't doing any NULL checks.
-
-2002-01-30 Radek Doulik <rodo@ximian.com>
-
- * mail-format.c (handle_text_plain_flowed): print quoted text in
- italic
-
-2002-01-30 Not Zed <NotZed@Ximian.com>
-
- * component-factory.c (create_component): re-enable popup menu.
- (populate_folder_context_menu): If we're on a vfolder, and its not
- UNMATCHED, create a change properties item, and set it up
- approriately.
- (change_prop_popup): Callback to edit the vfolder rule. For
- #3358.
-
-2002-01-29 Dave West <kat@unleashed.org>
-
- * mail-callbacks.c (create_msg_composer): Changed the function
- signature so that we can pass in whom we want to compose as.
- Should fix bug #10391.
- (compose_msg): Get the current profile account and pass it along
- to create_msg_composer.
- (send_to_url): Pass in a NULL profile account to cause
- create_msg_composer to use the default account.
-
-2002-01-29 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-ops.c (mail_send_message): Make X-Evolution-Account take
- priority over X-Evolution-Transport. Should we just get rid of
- X-Evolution-Transport? Anyways, this ought to fix a number of
- complaints.
-
- * mail-accounts.c (construct): Don't pass NULL text to
- gtk_entry_set_text. Maybe this will fix bug #18971.
-
-2002-01-29 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-callbacks.c (redirect): New function that implements the
- Redirect feature.
-
- * mail-ops.c (mail_send_message): If we are redirecting a message,
- get the Resent-* recipients otherwise get the normal To/Cc/Bcc
- recipients and use them in the CamelTransport::send_to() method.
-
- * mail-session.c (main_get_filter_driver): Set the beep_func to
- the beep_cb, not the play_sound_func. Oops ;-)
-
- * folder-browser-ui.c: Add Redirect bonobo verb thingy here.
- (folder_browser_ui_set_selection_state): Add MessageRedirect to
- the proper string arrays.
-
-2002-01-29 Radek Doulik <rodo@ximian.com>
-
- * mail-callbacks.c (do_mail_print): initialize line to 0 to make
- everybody happy ;-)
- ops, set local_font to NULL
- (do_mail_print): get rid of static global variables, as they are
- not thread safe (thanks to clahey for pointing this out)
- (footer_info_free): unref footer font
-
-2002-01-28 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-callbacks.c (composer_get_message): Don't bother checking
- for invalid recipients anymore. If a recipient is invalid, the
- transport error message will specify that now.
-
-2002-01-28 Radek Doulik <rodo@ximian.com>
-
- * mail-callbacks.c (do_mail_print): print footer
- (footer_print_cb): print page number and number of pages
-
-2002-01-27 Ettore Perazzoli <ettore@ximian.com>
-
- * importers/Makefile.am: Use IMPORTERS_CFLAGS.
-
-2002-01-25 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-account-gui.c (delete_event_cb): We need to return a value
- here. I think FALSE is fine (I hope).
-
- * mail-display.c (save_data_cb): Save the pathname.
- (save_part): Use the new mail_config cruft to get the last used
- save pathname.
-
- * mail-config.c (config_read): Read in last_filesel_dir string.
- (mail_config_write_on_exit): Save the last_filesel_dir setting.
- (mail_config_get_last_filesel_dir): New
- (mail_config_set_last_filesel_dir): New
-
- * component-factory.c (destination_folder_handle_motion): Do some
- NULL checking on the url before using it.
- (destination_folder_handle_drop): Make sure the uri is non-NULL
- before freeing.
-
-2002-01-24 Ettore Perazzoli <ettore@ximian.com>
-
- * Makefile.am: s/MAILER_CFLAGS/EVOLUTION_MAIL_CFLAGS/,
- s/MAILER_LIBS/EVOLUTION_MAIL_LIBS/.
-
-2002-01-24 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-session.c (session_system_beep): This wrapper for gdk_beep().
-
- * mail-account-gui.c (is_email): Don't bother trying to see if the
- domain looks like a FQDN.
-
- * mail-callbacks.c (select_all): If the mail-display is in focus,
- then select-all in the mail display rather than the
- message-list. Fixes bug #19126.
-
-2002-01-23 Ettore Perazzoli <ettore@ximian.com>
-
- * component-factory.c (create_component): Pass a NULL icon to
- `evolution_shell_component_add_user_creatable_item()'.
-
-2002-01-23 Jeffrey Stedfast <fejj@ximian.com>
-
- Implements bug #15692
-
- * folder-browser.c (html_button_press_event): New callback that
- checks to make sure that the mouse isn't over a link or image in
- the html view and then calls the on_right_click handler after
- getting the appropriate args.
- (my_folder_browser_init): Connect to the button_press_event here.
+ * mail-format.c (try_inline_pgp_sig): Handle cases where there
+ isn't a hash header (apparently some PGP versions don't use them
+ and/or are configurable to not display them?). Fixes bug #18935.
2002-01-23 Dan Winship <danw@ximian.com>
- * Makefile.am (INCLUDES): Define CAMEL_PROVIDERDIR to be the
- configure.in-defined camel_providerdir. (Was supposed to have been
- committed a month ago... oops.)
-
-2002-01-22 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-ops.c (mail_filter_folder): Now takes a boolean notify
- argument. If this is *not* set, then remove the sound-notify
- filter rule that mail-session adds. Kinda kludgy, but good enough
- for the moment.
-
- * mail-callbacks.c (guess_me): Simplified.
-
-2002-01-21 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-format.c (handle_text_plain): If the first "token" in the
- body is "<html>", then treat this as a text/html part rather than
- a text/plain part. Fixes bug #16817.
-
- * component-factory.c (destination_folder_handle_drop): Removed
- some unused variables.
-
-2002-01-17 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-format.c (try_uudecoding): Update to match new uudecode
- interface (ie, no longer need a uulen state variable).
-
-2002-01-15 Jeffrey Stedfast <fejj@ximian.com>
+ * mail-folder-cache.c (mail_note_store): Allow this to be called
+ with both storage and corba_storage NULL.
- * mail-display.c (on_set_base): New callback to handle the
- set_base signal.
- (on_url_requested): If the base_url is set, prepend it to the data
- url (we don't want to do this for cid urls or part urls tho).
- (mail_display_init): Initialize md->base_url to NULL.
- (mail_display_destroy): Free the base_url.
- (mail_display_initialize_gtkhtml): Connect to the set_base signal.
- (on_link_clicked): If the base_url is set, prepend it to the url
- string passed to us from gtkhtml.
-
-2002-01-10 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-callbacks.c (do_edit_messages): Don't remove any
- X-Evolution* headers here, the composer already knows to ignore
- these. Besides, it needs to know the X-Evolution-Format header.
+ * mail-send-recv.c (receive_update_got_store): Remove the
+ 2001-12-07 hack since it's no longer needed.
2002-01-08 Jeffrey Stedfast <fejj@ximian.com>
- * mail-callbacks.c (composer_save_draft_cb): Do proper refcounting
- on the draft folder.
-
* message-list.c (message_list_select): When performing a
- wraparound, check to see if the first (or last depending on
- direction) message fits the selection criteria before telling
- etable to find the next/previous matching node.
+ wraparound, check to see if the first message fits the selection
+ criteria before telling etable to find the next node.
+
+2002-01-08 Jeffrey Stedfast <fejj@ximian.com>
* mail-account-gui.c (mail_account_gui_new): When connecting to
the transport username changed event, pass the gui->transport not
the gui->source.
-2002-01-08 Iain Holmes <iain@ximian.com>
-
- * importers/evolution-mbox-importer.c (string_to_int): Takes a hex
- string and converts it to an int.
- (get_info_from_mozilla): Creates a CamelMessageInfo structure from
- the X-Mozilla-Status header.
- (process_item_fn): Check for the X-Mozilla-Status header and if it
- is present call get_info_from_mozilla. If get_info_from_mozilla
- returns that the message was marked as deleted but never expunged
- it isn't imported.
-
- * importers/mozilla-status-headers.h: Stuff Evolution cares about
- from the mozilla header.
-
-2002-01-07 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-config.c (mail_config_set_new_mail_notify_sound_file): Renamed.
- (mail_config_get_new_mail_notify_sound_file): Renamed.
-
- * mail-accounts.c (notify_radio_toggled): Replace EXEC with
- PLAY_SOUND.
- (construct): renamed the exec_command stuff to play_sound.
-
- * main.c (main): Init and shutdown gnome_sound.
-
- * mail-ops.c (fetch_mail_fetch): Don't do any new-mail
- notification here.
- (filter_folder_filter): call camel_filter_driver_flush.
-
- * mail-session.c (main_get_filter_driver): Set the filter-driver
- exec_func here instead.
-
- * mail-ops.c (mail_fetch_mail): Don't set the filter-driver
- exec_func here.
-
-2002-01-03 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-callbacks.c (composer_get_message): Add an Organization
- header.
-
-2002-01-02 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-callbacks.c (list_add_addresses): Simplified. Also no
- longer needs an "ignore_addr" argument as far as I can tell so
- that has been removed.
- (mail_generate_reply): Don't pass an ignore_addr argument to
- list_add_addresses and also change to use g_strcase_hash and
- g_strcase_equal since addresses are not case snesitive
- (mostly). Also, Reply-To can contain multiple addresses, so handle
- this case too.
-
-2002-01-02 JP Rosevear <jpr@ximian.com>
-
- * mail-callbacks.c: remove e_gnome_dialog util functions and use
- e-util ones instead
-
2001-12-21 Jeffrey Stedfast <fejj@ximian.com>
The idea here is that if we consistantly name the movemail file
@@ -1312,84 +71,21 @@
provided.
(mail_tool_do_movemail): Pass along the source_uri.
-2001-12-20 Jon Trowbridge <trow@ximian.com>
+2001-12-21 Jon Trowbridge <trow@ximian.com>
* message-list.c (on_click): Makes the auto-undelete behavior when
changing message flags a bit more sane. (Fixes #17634)
-2001-12-20 Ettore Perazzoli <ettore@ximian.com>
-
- [Fixes #17377, Evolution doesn't work on multi-depth displays.]
-
- * main.c (main): Push GdkRGB visual and colormap.
-
-2001-12-19 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-callbacks.c (composer_get_message): Add the auto-cc/bcc
- recipients here. The problem with setting them in the composer is
- that what if the user changes which account he wants to use? We'd
- either have to clear the cc/bcc lists *or* we'd have to leave them
- alone. Either way is bad. We can't just clear the entries because
- the user may have added addresses since the composer was
- opened. We don't want to leave any old auto-cc/bcc addresses there
- because that isn't desirable either. So we give up and add them
- here after the user has already hit the send button.
-
- * mail-config.c (account_copy): Update to copy the always-[b]cc
- options.
- (account_destroy): Update to destroy the above options.
- (config_read): Update to read in those values.
- (mail_config_write): Save those options.
-
- * mail-account-gui.c (mail_account_gui_new): Setup Always Cc/Bcc
- widgets.
- (mail_account_gui_save): Get the user-entered values for the
- always-cc/bcc stuff.
-
-2001-12-19 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-account-gui.c (setup_service): If the provider is NULL,
- don't do anything.
-
- * mail-accounts.c (construct): Oops, no wonder the exec command
- thing never stuck around... I wasn't getting the right widget from
- libglade. Also connect to the GtkEntry's changed event since a
- GnomeFileEntry doesn't have that signal in its ancestry.
-
-2001-12-18 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-ops.c (filter_folder_free): Argh, don't notify about new
- mail here.
- (fetch_mail_fetch): Notify about new mail here instead.
-
- * mail-accounts.c (construct): Setup the new-mail-notification
- widgets.
- (notify_command_changed): Update the command-line for new mail
- notification.
- (notify_radio_toggled): Update the new-mail-notification type.
-
- * mail-ops.c (filter_folder_free): See if we got any new mail and
- "sound the alarm" if we did.
-
-2001-12-17 Jon Trowbridge <trow@ximian.com>
-
- * mail-format.c (handle_text_plain_flowed): Set citation color to
- black when we are printing.
+2001-12-17 Dan Winship <danw@ximian.com>
- * mail-format.c (attachment_header): Avoid embedding <object> tags
- when we are printing.
- (handle_multipart_signed): Don't do the click-for-info signature
- stuff when we are printing.
- (handle_via_bonobo): Don't embed an <object> tag if we are
- printing.
+ * Makefile.am (INCLUDES): Define CAMEL_PROVIDERDIR to be the
+ configure.in-defined camel_providerdir.
- * folder-browser.c: Changed context_menu[] array so that we can
- print when the preview pane is closed.
+2001-12-17 Ettore Perazzoli <ettore@ximian.com>
-2001-12-14 Jeffrey Stedfast <fejj@ximian.com>
+ [Fixes #17377, Evolution doesn't work on multi-depth displays.]
- * mail-ops.c (mail_fetch_mail): Set the filter driver's shell-exec
- callback.
+ * main.c (main): Push GdkRGB visual and colormap.
2001-12-12 Jeffrey Stedfast <fejJ@ximian.com>
@@ -1401,123 +97,6 @@
* mail-format.c (handle_text_plain): Make sure i != num_specials
after we check for any special text markers. Fixes bug #12265.
-2001-12-14 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-callbacks.c (compose_msg): Connect to the save-draft signal.
- (send_to_url): Here too.
- (mail_reply): And here...
- (forward_get_composer): Same.
- (do_edit_messages): And finally here.
-
- * mail-format.c (try_inline_pgp):
- (try_inline_pgp_sig): Start reiplementing The Right Way and not
- danw's fucking half-assed kludge that doesn't work.
-
-2001-12-12 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-config.c (mail_config_set_new_mail_notification_command):
- set the new-mail-notify command.
- (mail_config_get_new_mail_notification_command): get the
- new-mail-notify command.
- (mail_config_set_new_mail_notification): set the
- new-mail-notification action.
- (mail_config_get_new_mail_notification): get the
- new-mail-notification action.
- (mail_config_write_on_exit): save the new-mail-notification
- settings.
- (config_read): Read in the new-mail-notification settings.
-
- * mail-ops.c (mail_execute_shell_command): New function to execute
- a shell command async. Will be used for playing sounds on new mail
- or whatever.
-
-2001-12-11 Jon Trowbridge <trow@ximian.com>
-
- * mail-identify.c (mail_identify_mime_part): Fixed for
- mail_content_loaded's new signature.
-
- * mail-format.c (attachment_header): Don't convert URLs, etc. if
- we are printing.
- (write_address): Don't convert addresses to mailto: links if we
- are printing.
- (write_one_text_plain_chunk): Add a printing flag, that we pass
- along to mail_text_write.
- (handle_text_plain): Pass our printing flag to
- write_one_text_plain_chunk.
- (mail_get_message_rfc822): Don't unneccesarily convert URLs.
- (mail_content_loaded): Add a GtkHTML parameter.
-
- * mail-display.c (mail_display_initialize_gtkhtml): Added. Breaks
- all of the signal hookups out of mail_display_new.
- (mail_display_new): Call mail_display_initialize_gtkhtml.
- (mail_text_write): Don't convert URLs, etc., if we are printing.
- Lots of other changes to pass around GtkHTML/GtkHTMLStream objects.
-
- * mail-callbacks.c (do_mail_print): Call
- mail_display_initialize_gtkhtml on our GtkHTML object.
-
- * folder-browser.c (update_status_bar): Make the status bar more
- useful when you have a large number of hidden messages.
-
- * message-list.etspec: Add ETable magic for our new "Needs Reply"
- column. (The next few entries are for bug #90)
-
- * message-list.h: Add COL_NEED_REPLY.
-
- * message-list.c: Move mail_need_reply_xpm to the end of
- states_pixmaps.
- (ml_duplicate_value): Handle COL_NEED_REPLY.
- (ml_free_value): Handle COL_NEED_REPLY.
- (ml_initialize_value): Handle COL_NEED_REPLY.
- (ml_value_is_empty): Handle COL_NEED_REPLY. Added
- needs_reply_map[] array.
- (ml_value_to_string): Handle COL_NEED_REPLY.
- (ml_tree_value_at): Fix magic numbers, undoing my changes from the
- otehr day. Add handler for COL_NEED_REPLY.
- (message_list_create_extras): Attach icons for COL_NEED_REPLY.
- (on_click): Undo my previous changes to display need-reply status
- in COL_MESSAGE_STATUS. Add handing for COL_NEED_REPLY.
-
- * mail.h: Change mail_format_mime_message, mail_format_raw_message
- and the MailMimeHandlerFn typedef to take GtkHTML and
- GtkHTMLStream args, as per our changes in mail-format.c.
-
- * mail-format.c: Giant refactoring. Remove the assumption
- throughout that we will always want to render into the GtkHTML
- object contained in the MailDisplay. Instead, always pass in the
- GtkHTML and GtkHTMLStream that we want to write to. Also, ignore
- theme work-arounds if the printing flag is set. (This and what
- follows fixes bug #82)
-
- * mail-display.h: Remove GtkHTMLStream *stream from MailDisplay.
- We don't need it anymore.
-
- * mail-display.c (mail_display_render): Added. Breaks the code
- that renders the message into the GtkHTML object out of
- mail_display_redisplay.
- (mail_display_redisplay): Call mail_display_render.
- (mail_display_init): Remove reference to ->stream.
- (mail_display_new): Remove reference to ->stream.
-
- * mail-callbacks.c (do_mail_print): Create a new GtkHTML to render
- our printed version into (via the new function
- mail_display_render. Set the MailDisplay's printing flag to TRUE
- before we render, and set it back to FALSE afterwards.
- (do_mail_fetch_and_print): If the preview pane isn't open when we
- try to print, fetch the message before printing.
- (print_msg): Call do_mail_fetch_and_print.
- (print_preview_msg): Call do_mail_fetch_and_print.
-
- * folder-browser-ui.c: Remove "PrintMessage" and
- "PrintPreviewMessage" from message_pane_enables... these now work
- when the preview pane is closed. Disable printing if multiple
- messages are selected.
-
-2001-12-10 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-ops.c (filter_folder_filter): Don't expunge when we sync
- anymore, this fixes bug #4472.
-
2001-12-04 Jeffrey Stedfast <fejj@ximian.com>
* mail-autofilter.c (rule_from_message): Make sure that the
@@ -16714,48 +15293,48 @@ End of branch
current_message = NULL, which shouldn't happen, but has happened
to me.
-2000-07-25 Dan Winship <danw@helixcode.com>
-
- * message-thread.c (group_root_set): Don't group together messages
- with the same non-Re: subject and no References/In-Reply-To. More
- often than not, they're unrelated. (eg, "[No subject]".)
- (thread_messages): Handle messages with no Message-Id. "This
- shouldn't happen", but it does sometimes, and it's not much code
- to make it just work.
-
-2000-07-25 Ettore Perazzoli <ettore@helixcode.com>
-
- * mail-config.c (create_service_page): Call
- `gtk_option_menu_set_menu()' as the last thing, as `GtkOptionMenu'
- is fscking broken. Also, `gtk_widget_show()' the individual menu
- items.
-
-2000-07-24 Dan Winship <danw@helixcode.com>
-
- * message-list.c (mark_msg_seen, ml_tree_set_value_at,
- message_list_regenerate): Update for CamelFolder API changes.
- (Certain functions no longer take a CamelException.)
-
- * mail-ops.c (real_fetch_mail, real_send_mail, real_delete_msg):
- ditto
-
- * component-factory.c (real_create_imap_storage,
- real_create_news_storage): ditto
-
-2000-07-24 Dan Winship <danw@helixcode.com>
-
- * component-factory.c, folder-browser-factory.c, test-mail.c:
- Remove GOAD support.
-
- * main.c: Remove GOAD support.
- (main): More "guess the build mistake" fun, this time for the
- failure to initialize Bonobo case.
-
-2000-07-24 Peter Williams <peterw@helixcode.com>
-
- * mail-tools.c (mail_tool_set_uid_flags): Change
- function to faithfully pass parameters to
- camel_folder_set_message_flags; this function is
+2000-07-25 Dan Wnihspi d<na@wehilcxdo.eoc>m
+
+* m seasegt-rhae.d cg(orpur_oo_tes)t :oD'n trguo poteghtrem seaseg
+sw ti hht easemn noR-:es buejtca dnn oeRefercnseI/-neRlp-yoT .oMer
+foet nhtnan to ,htyer' enueralet.d( ge ,["oNs buejtc"]).
+t(rhae_demssgase:)H nald eemssgasew ti honM seasegI-.d" hTsi
+hsuodl'n tahppne,"b tui todses motemise ,na dtis'n tom cu hoced
+otm ka etij su towkr
+.2
+00-0702- 5E ttro eeParzzlo i< teoterh@lexiocedc.mo
+>
+ *amlic-noif.g cc(erta_eesvrci_eapeg:)C la
+l` tg_kpoitnom_ne_ues_temun)( 'sat ehl sa thtni,ga sG`ktpOitnoeMun
+'i ssfkcni grbkone .A sl,o` tg_kiwgdtes_oh(w')t ehi dnvidiau lemun
+time.s
+
+02000--742 aD niWsnih p< adwnh@lexiocedc.mo
+>
+ *emssga-eiltsc.( amkrm_gss_ee,nm _lrtees_tev_laeua_,t
+emssga_eiltsr_genereta)e :pUadetf roC maleoFdlreA IPc ahgnse
+.( eCtria nufcnitno sonl noeg rateka C malexEectpoi.n
+)
+ *amlio-spc.( erlaf_tehcm_ia,lr ae_lesdnm_ia,lr ae_ledeletm_gs:)
+idtt
+o
+ *ocpmnone-taftcro.y cr(ae_lrcaeeti_am_ptsroga,e
+erlac_erta_eensws_otareg:)d tiot
+
+02000--742 aD niWsnih p< adwnh@lexiocedc.mo
+>
+ *ocpmnone-taftcro.y,cf loed-rrbwoes-raftcro.y,ct se-tamlic.
+:R mevo eOGDAs puoptr
+.
+ *amnic. :eRomevG AO Dusppro.t
+m(ia)n :oMer" ugse sht eubli dimtska"ef nu ,htsit mi eof rht
+ef iaulert onitiaiilezB nobo oaces
+.2
+00-0702- 4P tereW liilma s< epetwrh@lexiocedc.mo
+>
+ *amlit-ooslc.( amlit_oo_les_tiu_dlfga)s :hCnaeg
+ufcnitnot oaftifhluylp sa saparemetsrt
+oc malef_loed_res_temssga_elfga;st ih sufnction is
somewhat useless now. Other files synced with
API change.
diff --git a/mail/Makefile.am b/mail/Makefile.am
index 5cc3e03c59..fe9eb71142 100644
--- a/mail/Makefile.am
+++ b/mail/Makefile.am
@@ -16,12 +16,11 @@ INCLUDES = \
-I$(top_srcdir)/shell \
-I$(top_srcdir)/shell/importer \
-I$(top_builddir)/shell/importer \
- $(EVOLUTION_MAIL_CFLAGS) \
+ $(MAILER_CFLAGS) \
-DEVOLUTION_DATADIR=\""$(datadir)"\" \
-DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \
-DEVOLUTION_ETSPECDIR=\""$(etspecdir)"\" \
-DEVOLUTION_ICONSDIR=\""$(iconsdir)"\" \
- -DEVOLUTION_IMAGES=\""$(datadir)/images/evolution"\" \
-DEVOLUTION_BUTTONSDIR=\""$(buttonsdir)"\" \
-DEVOLUTION_LOCALEDIR=\""$(localedir)"\" \
-DCAMEL_PROVIDERDIR=\""$(camel_providerdir)"\" \
@@ -54,8 +53,6 @@ evolution_mail_SOURCES = \
folder-browser-factory.h \
folder-browser-ui.c \
folder-browser-ui.h \
- folder-browser-window.c \
- folder-browser-window.h \
folder-info.c \
mail-accounts.c \
mail-accounts.h \
@@ -67,14 +64,10 @@ evolution_mail_SOURCES = \
mail-autofilter.h \
mail-callbacks.c \
mail-callbacks.h \
- mail-composer-prefs.c \
- mail-composer-prefs.h \
mail-config.c \
mail-config.h \
mail-config-druid.c \
mail-config-druid.h \
- mail-config-factory.c \
- mail-config-factory.h \
mail-crypto.c \
mail-crypto.h \
mail-display.c \
@@ -93,8 +86,6 @@ evolution_mail_SOURCES = \
mail-offline-handler.h \
mail-ops.c \
mail-ops.h \
- mail-preferences.c \
- mail-preferences.h \
mail-search.c \
mail-search.h \
mail-search-dialogue.c \
@@ -103,8 +94,6 @@ evolution_mail_SOURCES = \
mail-send-recv.h \
mail-session.c \
mail-session.h \
- mail-signature-editor.c \
- mail-signature-editor.h \
mail-stream-gtkhtml.c \
mail-stream-gtkhtml.h \
mail-tools.c \
@@ -117,10 +106,6 @@ evolution_mail_SOURCES = \
main.c \
message-list.c \
message-list.h \
- message-tag-editor.c \
- message-tag-editor.h \
- message-tag-followup.c \
- message-tag-followup.h \
subscribe-dialog.c \
subscribe-dialog.h \
mail.h
@@ -132,13 +117,13 @@ evolution_mail_LDADD = \
$(top_builddir)/composer/libcomposer.a \
$(top_builddir)/widgets/misc/libemiscwidgets.a \
$(top_builddir)/addressbook/backend/ebook/libebook.la \
- $(top_builddir)/libversit/libversit.a \
+ $(top_builddir)/libversit/libversit.la \
$(top_builddir)/e-util/ename/libename.la \
$(top_builddir)/libibex/libibex.la \
$(top_builddir)/filter/libfilter.la \
$(top_builddir)/shell/importer/libevolution-importer.la \
$(top_builddir)/widgets/menus/libmenus.la \
- $(EVOLUTION_MAIL_LIBS)
+ $(MAILER_LIBS)
evolution_mail_LDFLAGS = \
-export-dynamic
@@ -150,10 +135,10 @@ oaf_DATA = $(oaf_in_files:.oaf.in=.oaf)
@XML_I18N_MERGE_OAF_RULE@
gladedir = $(datadir)/evolution/glade
-glade_DATA = mail-config.glade local-config.glade subscribe-dialog.glade message-tags.glade
+glade_DATA = mail-config.glade local-config.glade subscribe-dialog.glade
etspecdir = $(datadir)/evolution/etspec/
-etspec_DATA = mail-accounts.etspec message-list.etspec subscribe-dialog.etspec
+etspec_DATA = message-list.etspec subscribe-dialog.etspec
iconsdir = $(datadir)/images/evolution
buttonsdir = $(datadir)/images/evolution/buttons
diff --git a/mail/folder-browser-ui.c b/mail/folder-browser-ui.c
index e2638d79a1..e2b718c191 100644
--- a/mail/folder-browser-ui.c
+++ b/mail/folder-browser-ui.c
@@ -39,7 +39,7 @@ static BonoboUIVerb message_verbs [] = {
BONOBO_UI_UNSAFE_VERB ("MailNext", next_msg),
BONOBO_UI_UNSAFE_VERB ("MailNextFlagged", next_flagged_msg),
BONOBO_UI_UNSAFE_VERB ("MailNextUnread", next_unread_msg),
- BONOBO_UI_UNSAFE_VERB ("MailNextThread", next_thread),
+/* BONOBO_UI_UNSAFE_VERB ("MailNextThread", next_thread),*/
BONOBO_UI_UNSAFE_VERB ("MailPrevious", previous_msg),
BONOBO_UI_UNSAFE_VERB ("MailPreviousFlagged", previous_flagged_msg),
BONOBO_UI_UNSAFE_VERB ("MailPreviousUnread", previous_unread_msg),
@@ -51,12 +51,10 @@ static BonoboUIVerb message_verbs [] = {
BONOBO_UI_UNSAFE_VERB ("MessageForwardAttached", forward_attached),
BONOBO_UI_UNSAFE_VERB ("MessageForwardInline", forward_inline),
BONOBO_UI_UNSAFE_VERB ("MessageForwardQuoted", forward_quoted),
- BONOBO_UI_UNSAFE_VERB ("MessageRedirect", redirect),
BONOBO_UI_UNSAFE_VERB ("MessageMarkAsRead", mark_as_seen),
BONOBO_UI_UNSAFE_VERB ("MessageMarkAsUnRead", mark_as_unseen),
BONOBO_UI_UNSAFE_VERB ("MessageMarkAsImportant", mark_as_important),
BONOBO_UI_UNSAFE_VERB ("MessageMarkAsUnimportant", mark_as_unimportant),
- BONOBO_UI_UNSAFE_VERB ("MessageFollowUpFlag", flag_for_followup),
BONOBO_UI_UNSAFE_VERB ("MessageMove", move_msg),
BONOBO_UI_UNSAFE_VERB ("MessageOpen", open_message),
BONOBO_UI_UNSAFE_VERB ("MessageReplyAll", reply_to_all),
@@ -108,8 +106,10 @@ static BonoboUIVerb global_verbs [] = {
BONOBO_UI_UNSAFE_VERB ("EmptyTrash", empty_trash),
BONOBO_UI_UNSAFE_VERB ("ForgetPasswords", mail_session_forget_passwords),
BONOBO_UI_UNSAFE_VERB ("MailCompose", compose_msg),
+ BONOBO_UI_UNSAFE_VERB ("MailGetSend", send_receive_mail),
BONOBO_UI_UNSAFE_VERB ("MailStop", stop_threads),
BONOBO_UI_UNSAFE_VERB ("ToolsFilters", filter_edit),
+ BONOBO_UI_UNSAFE_VERB ("ToolsSettings", providers_config),
BONOBO_UI_UNSAFE_VERB ("ToolsSubscriptions", manage_subscriptions),
BONOBO_UI_UNSAFE_VERB ("ToolsVFolders", vfolder_edit_vfolders),
/* ViewPreview is a toggle */
@@ -130,11 +130,7 @@ static EPixmap message_pixcache [] = {
E_PIXMAP ("/commands/MessageApplyFilters", "apply-filters-16.xpm"),
E_PIXMAP ("/commands/MessageSearch", "search-16.png"),
E_PIXMAP ("/commands/MessageSaveAs", "save-as-16.png"),
- E_PIXMAP ("/commands/MessageMarkAsRead", "mail-read.xpm"),
- E_PIXMAP ("/commands/MessageMarkAsUnRead", "mail-new.xpm"),
- E_PIXMAP ("/commands/MessageMarkAsImportant", "priority-high.xpm"),
- E_PIXMAP ("/commands/MessageFollowUpFlag", "flag-for-followup-16.png"),
-
+
E_PIXMAP ("/Toolbar/MailMessageToolbar/MessageReplySender", "buttons/reply.png"),
E_PIXMAP ("/Toolbar/MailMessageToolbar/MessageReplyAll", "buttons/reply-to-all.png"),
E_PIXMAP ("/Toolbar/MailMessageToolbar/MessageForward", "buttons/forward.png"),
@@ -142,7 +138,7 @@ static EPixmap message_pixcache [] = {
E_PIXMAP ("/Toolbar/MailMessageToolbar/MessageMove", "buttons/move-message.png"),
E_PIXMAP ("/Toolbar/MailMessageToolbar/MessageCopy", "buttons/copy-message.png"),
E_PIXMAP ("/Toolbar/MailMessageToolbar/MessageDelete", "buttons/delete-message.png"),
-
+
E_PIXMAP ("/Toolbar/MailNextButtons/MailNext", "buttons/next-message.png"),
E_PIXMAP ("/Toolbar/MailNextButtons/MailPrevious", "buttons/previous-message.png"),
@@ -154,7 +150,7 @@ static EPixmap list_pixcache [] = {
E_PIXMAP ("/commands/ViewHideRead", "hide_read_messages.xpm"),
E_PIXMAP ("/commands/ViewHideSelected", "hide_selected_messages.xpm"),
E_PIXMAP ("/commands/ViewShowAll", "show_all_messages.xpm"),
-
+
E_PIXMAP ("/commands/EditCut", "16_cut.png"),
E_PIXMAP ("/commands/EditCopy", "16_copy.png"),
E_PIXMAP ("/commands/EditPaste", "16_paste.png"),
@@ -164,7 +160,12 @@ static EPixmap list_pixcache [] = {
static EPixmap global_pixcache [] = {
E_PIXMAP ("/commands/MailCompose", "new-message.xpm"),
+ E_PIXMAP ("/commands/MailGetSend", "send-receive.xpm"),
+ E_PIXMAP ("/commands/ToolsSettings", "configure_16_mail.xpm"),
+ E_PIXMAP ("/Toolbar/MailGetSend", "buttons/send-24-receive.png"),
+ E_PIXMAP ("/Toolbar/MailCompose", "buttons/compose-message.png"),
+
E_PIXMAP_END
};
@@ -192,137 +193,66 @@ static void ui_add (FolderBrowser *fb,
/* more complex stuff */
static void
-display_view(GalViewInstance *instance,
+display_view(GalViewCollection *collection,
GalView *view,
gpointer data)
{
FolderBrowser *fb = data;
if (GAL_IS_VIEW_ETABLE(view)) {
- gal_view_etable_attach_tree (GAL_VIEW_ETABLE(view), fb->message_list->tree);
+ e_tree_set_state_object(fb->message_list->tree, GAL_VIEW_ETABLE(view)->state);
}
}
-void
-folder_browser_ui_setup_view_menus (FolderBrowser *fb)
+static void
+folder_browser_setup_view_menus (FolderBrowser *fb,
+ BonoboUIComponent *uic)
{
- static GalViewCollection *collection = NULL;
- char *id;
- gboolean outgoing;
+ GalViewFactory *factory;
+ ETableSpecification *spec;
+ char *local_dir;
- if (fb->uicomp == NULL || fb->folder == NULL)
- return;
-
- g_assert (fb->view_instance == NULL);
+ g_assert (fb->view_collection == NULL);
g_assert (fb->view_menus == NULL);
- outgoing = folder_browser_is_drafts (fb) ||
- folder_browser_is_sent (fb) ||
- folder_browser_is_outbox (fb);
-
- if (collection == NULL) {
- ETableSpecification *spec;
- char *local_dir;
- GalViewFactory *factory;
-
- collection = gal_view_collection_new();
-
- local_dir = gnome_util_prepend_user_home ("/evolution/views/mail/");
- gal_view_collection_set_storage_directories
- (collection,
- EVOLUTION_DATADIR "/evolution/views/mail/",
- local_dir);
- g_free (local_dir);
-
- spec = e_table_specification_new();
- e_table_specification_load_from_file(spec, EVOLUTION_ETSPECDIR "/message-list.etspec");
-
- factory = gal_view_factory_etable_new (spec);
- gtk_object_unref (GTK_OBJECT (spec));
- gal_view_collection_add_factory (collection, factory);
- gtk_object_unref (GTK_OBJECT (factory));
-
- gal_view_collection_load(collection);
- }
-
- id = mail_config_folder_to_safe_url(fb->folder);
- fb->view_instance = gal_view_instance_new (collection, id);
- g_free (id);
+ fb->view_collection = gal_view_collection_new();
- if (outgoing)
- gal_view_instance_set_default_view (fb->view_instance, "As_Sent_Folder");
+ local_dir = gnome_util_prepend_user_home ("/evolution/views/mail/");
+ gal_view_collection_set_storage_directories(
+ fb->view_collection,
+ EVOLUTION_DATADIR "/evolution/views/mail/",
+ local_dir);
+ g_free (local_dir);
- if (!gal_view_instance_exists (fb->view_instance)) {
- char *path;
- struct stat st;
+ spec = e_table_specification_new();
+ e_table_specification_load_from_file(spec, EVOLUTION_ETSPECDIR "/message-list.etspec");
- gal_view_instance_load (fb->view_instance);
+ factory = gal_view_factory_etable_new (spec);
+ gtk_object_unref (GTK_OBJECT (spec));
+ gal_view_collection_add_factory (fb->view_collection, factory);
+ gtk_object_unref (GTK_OBJECT (factory));
- path = mail_config_folder_to_cachename (fb->folder, "et-header-");
- if (path && stat (path, &st) == 0 && st.st_size > 0 && S_ISREG (st.st_mode)) {
- ETableSpecification *spec;
- ETableState *state;
- GalView *view;
+ gal_view_collection_load(fb->view_collection);
- spec = e_table_specification_new();
- e_table_specification_load_from_file(spec, EVOLUTION_ETSPECDIR "/message-list.etspec");
- view = gal_view_etable_new(spec, "");
- gtk_object_unref (GTK_OBJECT (spec));
-
- state = e_table_state_new ();
- e_table_state_load_from_file (state, path);
- gal_view_etable_set_state (GAL_VIEW_ETABLE (view), state);
- gtk_object_unref (GTK_OBJECT (state));
-
- gal_view_instance_set_custom_view (fb->view_instance, view);
- gtk_object_unref (GTK_OBJECT (view));
- }
- g_free (path);
- }
-
-
- fb->view_menus = gal_view_menus_new(fb->view_instance);
- gal_view_menus_apply(fb->view_menus, fb->uicomp, NULL);
- gtk_signal_connect(GTK_OBJECT(fb->view_instance), "display_view",
+ fb->view_menus = gal_view_menus_new(fb->view_collection);
+ gal_view_menus_apply(fb->view_menus, uic, NULL);
+ gtk_signal_connect(GTK_OBJECT(fb->view_collection), "display_view",
display_view, fb);
- display_view (fb->view_instance, gal_view_instance_get_current_view (fb->view_instance), fb);
}
-/* Gets rid of the view instance and view menus objects */
-void
-folder_browser_ui_discard_view_menus (FolderBrowser *fb)
+/* Gets rid of the view collection and view menus objects */
+static void
+folder_browser_discard_view_menus (FolderBrowser *fb)
{
- g_assert (fb->view_instance != NULL);
+ g_assert (fb->view_collection != NULL);
g_assert (fb->view_menus != NULL);
- gtk_object_unref (GTK_OBJECT (fb->view_instance));
- fb->view_instance = NULL;
+ gtk_object_unref (GTK_OBJECT (fb->view_collection));
+ fb->view_collection = NULL;
gtk_object_unref (GTK_OBJECT (fb->view_menus));
fb->view_menus = NULL;
}
-void
-folder_browser_ui_message_list_focus (FolderBrowser *fb)
-{
- g_assert (fb->uicomp != NULL);
-
- bonobo_ui_component_set_prop (fb->uicomp, "/commands/EditInvertSelection",
- "sensitive", "1", NULL);
- bonobo_ui_component_set_prop (fb->uicomp, "/commands/EditSelectThread",
- "sensitive", "1", NULL);
-}
-
-void
-folder_browser_ui_message_list_unfocus (FolderBrowser *fb)
-{
- g_assert (fb->uicomp != NULL);
-
- bonobo_ui_component_set_prop (fb->uicomp, "/commands/EditInvertSelection",
- "sensitive", "0", NULL);
- bonobo_ui_component_set_prop (fb->uicomp, "/commands/EditSelectThread",
- "sensitive", "0", NULL);
-}
-
static void
folder_browser_setup_property_menu (FolderBrowser *fb,
BonoboUIComponent *uic)
@@ -440,16 +370,14 @@ folder_browser_ui_add_list (FolderBrowser *fb)
folder_browser_setup_property_menu (fb, fb->uicomp);
/* View menu */
- if (fb->view_instance == NULL)
- folder_browser_ui_setup_view_menus (fb);
+ folder_browser_setup_view_menus (fb, fb->uicomp);
}
void
folder_browser_ui_rm_list (FolderBrowser *fb)
{
/* View menu */
- if (fb->view_instance != NULL)
- folder_browser_ui_discard_view_menus (fb);
+ folder_browser_discard_view_menus (fb);
}
void
@@ -592,6 +520,7 @@ static const char *message_pane_enables[] = {
/* these only work if there's a message in the message pane
* (preview pane). This state is independent of how many are
* selected. */
+ "PrintMessage", "PrintPreviewMessage",
"ViewFullHeaders", "ViewLoadImages", "ViewNormal", "ViewSource",
"MessageSearch", "AddSenderToAddressbook",
NULL
@@ -614,13 +543,13 @@ folder_browser_ui_set_selection_state (FolderBrowser *fb, FolderBrowserSelection
static const char *none_disables[] = {
/* actions that work on > 0 messages */
- "MessageApplyFilters", "MessageCopy", "MessageMove",
+ "MessageApplyFilters",
+ "MessageCopy", "MessageMove",
"MessageDelete", "MessageUndelete",
"MessageMarkAsRead", "MessageMarkAsUnRead",
"MessageMarkAsImportant", "MessageMarkAsUnimportant",
- "MessageFollowUpFlag", "MessageOpen", "MessageSaveAs",
+ "MessageOpen", "MessageSaveAs",
"MessageForward", "MessageForwardAttached",
- "MessageRedirect",
"EditCut", "EditCopy", "EditPaste", "ViewHideSelected",
@@ -633,9 +562,7 @@ folder_browser_ui_set_selection_state (FolderBrowser *fb, FolderBrowserSelection
static const char *multiple_disables[] = {
/* actions that work on exactly 1 message */
"MessageReplyAll", "MessageReplyList", "MessageReplySender", "MessageResend",
- "MessageForwardInline", "MessageForwardQuoted", "MessageRedirect", "MessageSearch",
-
- "PrintMessage", "PrintPreviewMessage",
+ "MessageForwardInline", "MessageForwardQuoted", "MessageSearch",
"ToolsFilterMailingList", "ToolsFilterRecipient", "ToolsFilterSender",
"ToolsFilterSubject", "ToolsVFolderMailingList", "ToolsVFolderRecipient",
diff --git a/mail/folder-browser.c b/mail/folder-browser.c
index 0ce4e7ee64..889af4709e 100644
--- a/mail/folder-browser.c
+++ b/mail/folder-browser.c
@@ -3,7 +3,7 @@
* Authors: Miguel De Icaza <miguel@ximian.com>
* Jeffrey Stedfast <fejj@ximian.com>
*
- * Copyright 2000,2001 Ximian, Inc. (www.ximian.com)
+ * Copyright 2000,2001 Ximain, Inc. (www.ximian.com)
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
@@ -38,11 +38,8 @@
#include <gal/widgets/e-unicode.h>
#include <libgnomeui/gnome-dialog-util.h>
-#include <libgnomeui/gnome-pixmap.h>
#include <gtkhtml/htmlengine.h>
-#include <gtkhtml/htmlobject.h>
-#include <gtkhtml/htmlinterval.h>
#include <gtkhtml/htmlengine-edit-cut-and-paste.h>
#include "filter/vfolder-rule.h"
@@ -58,13 +55,13 @@
#include "mail.h"
#include "mail-callbacks.h"
#include "mail-tools.h"
+#include "message-list.h"
#include "mail-ops.h"
#include "mail-vfolder.h"
#include "mail-autofilter.h"
#include "mail-mt.h"
#include "mail-folder-cache.h"
#include "folder-browser-ui.h"
-#include "message-tag-followup.h"
#include "mail-local.h"
#include "mail-config.h"
@@ -157,9 +154,9 @@ folder_browser_finalise (GtkObject *object)
CORBA_exception_free (&ev);
- if (folder_browser->view_instance) {
- gtk_object_unref (GTK_OBJECT (folder_browser->view_instance));
- folder_browser->view_instance = NULL;
+ if (folder_browser->view_collection) {
+ gtk_object_unref (GTK_OBJECT (folder_browser->view_collection));
+ folder_browser->view_collection = NULL;
}
if (folder_browser->view_menus) {
@@ -305,7 +302,6 @@ message_list_drag_data_get (ETree *tree, int row, ETreePath path, int col,
for (i = 0; i < uids->len; i++)
g_free (uids->pdata[i]);
g_ptr_array_free (uids, TRUE);
- g_free (msg);
return;
}
@@ -315,7 +311,7 @@ message_list_drag_data_get (ETree *tree, int row, ETreePath path, int col,
if (uids->len == 1) {
filename = camel_mime_message_get_subject (message);
if (!filename)
- filename = _("Unknown");
+ filename = "Unknown";
} else
filename = "mbox";
@@ -381,7 +377,7 @@ message_list_drag_data_get (ETree *tree, int row, ETreePath path, int col,
gtk_selection_data_set (selection_data, selection_data->target, 8,
bytes->data, bytes->len);
- g_byte_array_free (bytes, TRUE);
+ g_byte_array_free (bytes, FALSE);
}
break;
case DND_TARGET_TYPE_X_EVOLUTION_MESSAGE:
@@ -409,7 +405,7 @@ message_list_drag_data_get (ETree *tree, int row, ETreePath path, int col,
gtk_selection_data_set (selection_data, selection_data->target, 8,
array->data, array->len);
- g_byte_array_free (array, TRUE);
+ g_byte_array_free (array, FALSE);
}
break;
default:
@@ -722,7 +718,7 @@ static void
update_status_bar(FolderBrowser *fb)
{
CORBA_Environment ev;
- int tmp, total;
+ int tmp;
GString *work;
extern CamelFolder *outbox_folder, *sent_folder;
@@ -731,49 +727,44 @@ update_status_bar(FolderBrowser *fb)
|| fb->shell_view == CORBA_OBJECT_NIL)
return;
+ work = g_string_new("");
+ g_string_sprintfa(work, _("%d new"), camel_folder_get_unread_message_count(fb->folder));
+ tmp = message_list_hidden(fb->message_list);
+ if (tmp) {
+ g_string_append(work, _(", "));
+ g_string_sprintfa(work, _("%d hidden"), tmp);
+ }
+ tmp = e_selection_model_selected_count(e_tree_get_selection_model(fb->message_list->tree));
+ if (tmp) {
+ g_string_append(work, _(", "));
+ g_string_sprintfa(work, _("%d selected"), tmp);
+ }
if (!fb->message_list->hidedeleted || !camel_folder_has_summary_capability(fb->folder)) {
- total = camel_folder_get_message_count(fb->folder);
+ tmp = camel_folder_get_message_count(fb->folder);
} else {
GPtrArray *sum = camel_folder_get_summary(fb->folder);
int i;
if (sum) {
- total = 0;
+ tmp = 0;
for (i=0;i<sum->len;i++) {
CamelMessageInfo *info = sum->pdata[i];
if ((info->flags & CAMEL_MESSAGE_DELETED) == 0)
- total++;
+ tmp++;
}
camel_folder_free_summary(fb->folder, sum);
} else {
- total = camel_folder_get_message_count(fb->folder);
+ tmp = camel_folder_get_message_count(fb->folder);
}
}
-
- work = g_string_new("");
- g_string_sprintfa(work, _("%d new"), camel_folder_get_unread_message_count(fb->folder));
- tmp = message_list_hidden(fb->message_list);
- if (0 < tmp && tmp < total) {
- g_string_append(work, _(", "));
- if (tmp < total / 2)
- g_string_sprintfa(work, _("%d hidden"), tmp);
- else
- g_string_sprintfa(work, _("%d visible"), total - tmp);
- }
- tmp = e_selection_model_selected_count(e_tree_get_selection_model(fb->message_list->tree));
- if (tmp) {
- g_string_append(work, _(", "));
- g_string_sprintfa(work, _("%d selected"), tmp);
- }
g_string_append(work, _(", "));
-
if (fb->folder == outbox_folder)
- g_string_sprintfa(work, _("%d unsent"), total);
+ g_string_sprintfa(work, _("%d unsent"), tmp);
else if (fb->folder == sent_folder)
- g_string_sprintfa(work, _("%d sent"), total);
+ g_string_sprintfa(work, _("%d sent"), tmp);
else
- g_string_sprintfa(work, _("%d total"), total);
+ g_string_sprintfa(work, _("%d total"), tmp);
CORBA_exception_init(&ev);
GNOME_Evolution_ShellView_setFolderBarLabel(fb->shell_view, work->str, &ev);
@@ -853,11 +844,6 @@ got_folder(char *uri, CamelFolder *folder, void *data)
camel_object_hook_event(CAMEL_OBJECT(fb->folder), "message_changed",
folder_changed, fb);
- if (fb->view_instance != NULL && fb->view_menus != NULL)
- folder_browser_ui_discard_view_menus (fb);
-
- folder_browser_ui_setup_view_menus (fb);
-
/* when loading a new folder, nothing is selected initially */
if (fb->uicomp)
@@ -869,23 +855,6 @@ got_folder(char *uri, CamelFolder *folder, void *data)
}
void
-folder_browser_set_folder (FolderBrowser *fb, CamelFolder *folder, const char *uri)
-{
- g_return_if_fail (IS_FOLDER_BROWSER (fb));
- g_return_if_fail (CAMEL_IS_FOLDER (folder));
-
- if (fb->get_id != -1) {
- /* FIXME: cancel the get_folder request? */
- }
-
- g_free (fb->uri);
- fb->uri = g_strdup (uri);
-
- gtk_object_ref (GTK_OBJECT (fb));
- got_folder (NULL, folder, fb);
-}
-
-void
folder_browser_set_ui_component (FolderBrowser *fb, BonoboUIComponent *uicomp)
{
g_return_if_fail (IS_FOLDER_BROWSER (fb));
@@ -1065,7 +1034,7 @@ folder_browser_set_message_preview (FolderBrowser *folder_browser, gboolean show
} else {
e_paned_set_position (E_PANED (folder_browser->vpaned), 10000);
gtk_widget_hide (GTK_WIDGET (folder_browser->mail_display));
- mail_display_set_message (folder_browser->mail_display, NULL, NULL);
+ mail_display_set_message(folder_browser->mail_display, NULL);
folder_browser_ui_message_loaded(folder_browser);
}
}
@@ -1075,13 +1044,11 @@ enum {
};
static ESearchBarItem folder_browser_search_menu_items[] = {
- E_FILTERBAR_ADVANCED,
- { NULL, 0, NULL },
+ E_FILTERBAR_RESET,
E_FILTERBAR_SAVE,
+ { N_("Create vFolder from Search"), ESB_SAVE, NULL },
E_FILTERBAR_EDIT,
- { NULL, 0, NULL },
- { N_("Create _Virtual Folder From Search..."), ESB_SAVE, NULL },
- { NULL, -1, NULL }
+ { NULL, -1, NULL }
};
static void
@@ -1273,7 +1240,6 @@ folder_browser_charset_changed (BonoboUIComponent *component,
}
}
-/* external api to vfolder/filter on X, based on current message */
void
vfolder_subject (GtkWidget *w, FolderBrowser *fb)
{
@@ -1302,7 +1268,7 @@ vfolder_mlist (GtkWidget *w, FolderBrowser *fb)
name = header_raw_check_mailing_list(&((CamelMimePart *)fb->mail_display->current_message)->headers);
if (name) {
g_strstrip (name);
- vfolder_gui_add_from_mlist(name, fb->uri);
+ vfolder_gui_add_from_mlist(fb->mail_display->current_message, name, fb->uri);
g_free(name);
}
}
@@ -1339,84 +1305,6 @@ filter_mlist (GtkWidget *w, FolderBrowser *fb)
}
}
-/* ************************************************************ */
-
-/* popup api to vfolder/filter on X, based on current selection */
-struct _filter_data {
- CamelFolder *folder;
- char *uid;
- int type;
- char *uri;
- char *mlist;
-};
-
-static void
-filter_data_free(struct _filter_data *fdata)
-{
- g_free(fdata->uid);
- g_free(fdata->uri);
- if (fdata->folder)
- camel_object_unref((CamelObject *)fdata->folder);
- g_free(fdata->mlist);
- g_free(fdata);
-}
-
-static void
-vfolder_type_got_message(CamelFolder *folder, char *uid, CamelMimeMessage *msg, void *d)
-{
- struct _filter_data *data = d;
-
- if (msg)
- vfolder_gui_add_from_message(msg, data->type, data->uri);
-
- filter_data_free(data);
-}
-
-static void
-vfolder_type_uid(struct _filter_data *fdata, int type)
-{
- struct _filter_data *data;
-
- /* sigh, we need to copy this because the menu will free the one we got passed in */
- data = g_malloc0(sizeof(*data));
- data->type = type;
- data->uri = fdata->uri;
- fdata->uri = NULL;
- mail_get_message(fdata->folder, fdata->uid, vfolder_type_got_message, data, mail_thread_new);
-}
-
-static void vfolder_subject_uid (GtkWidget *w, struct _filter_data *fdata) { vfolder_type_uid(fdata, AUTO_SUBJECT); }
-static void vfolder_sender_uid(GtkWidget *w, struct _filter_data *fdata) { vfolder_type_uid(fdata, AUTO_FROM); }
-static void vfolder_recipient_uid(GtkWidget *w, struct _filter_data *fdata) { vfolder_type_uid(fdata, AUTO_TO); }
-static void vfolder_mlist_uid(GtkWidget *w, struct _filter_data *fdata) { vfolder_gui_add_from_mlist(fdata->mlist, fdata->uri); }
-
-static void
-filter_type_got_message(CamelFolder *folder, char *uid, CamelMimeMessage *msg, void *d)
-{
- struct _filter_data *data = d;
-
- if (msg)
- filter_gui_add_from_message(msg, data->type);
-
- filter_data_free(data);
-}
-
-static void
-filter_type_uid(struct _filter_data *fdata, int type)
-{
- struct _filter_data *data;
-
- /* sigh, we need to copy this because the menu will free the one we got passed in */
- data = g_malloc0(sizeof(*data));
- data->type = type;
- mail_get_message(fdata->folder, fdata->uid, filter_type_got_message, data, mail_thread_new);
-}
-
-static void filter_subject_uid (GtkWidget *w, struct _filter_data *fdata) { filter_type_uid(fdata, AUTO_SUBJECT); }
-static void filter_sender_uid(GtkWidget *w, struct _filter_data *fdata) { filter_type_uid(fdata, AUTO_FROM); }
-static void filter_recipient_uid(GtkWidget *w, struct _filter_data *fdata) { filter_type_uid(fdata, AUTO_TO); }
-static void filter_mlist_uid(GtkWidget *w, struct _filter_data *fdata) { filter_gui_add_from_mlist(fdata->mlist); }
-
void
hide_none(GtkWidget *w, FolderBrowser *fb)
{
@@ -1523,170 +1411,75 @@ hide_sender(GtkWidget *w, FolderBrowser *fb)
}
}
-struct _colour_data {
- FolderBrowser *fb;
- guint32 rgb;
-};
-
-#define COLOUR_NONE (~0)
-
-static void
-colourise_msg (GtkWidget *widget, gpointer user_data)
-{
- struct _colour_data *data = user_data;
- char *colour = NULL;
- GPtrArray *uids;
- int i;
-
- if (data->rgb != COLOUR_NONE) {
- colour = alloca (8);
- sprintf (colour, "#%.2x%.2x%.2x", (data->rgb & 0xff0000) >> 16,
- (data->rgb & 0xff00) >> 8, data->rgb & 0xff);
- }
-
- uids = g_ptr_array_new ();
- message_list_foreach (data->fb->message_list, enumerate_msg, uids);
- for (i = 0; i < uids->len; i++) {
- camel_folder_set_message_user_tag (data->fb->folder, uids->pdata[i], "colour", colour);
- }
- g_ptr_array_free (uids, TRUE);
-}
-
-
enum {
- SELECTION_SET = 1<<1,
- CAN_MARK_READ = 1<<2,
- CAN_MARK_UNREAD = 1<<3,
- CAN_DELETE = 1<<4,
- CAN_UNDELETE = 1<<5,
- IS_MAILING_LIST = 1<<6,
- CAN_RESEND = 1<<7,
- CAN_MARK_IMPORTANT = 1<<8,
- CAN_MARK_UNIMPORTANT = 1<<9,
- CAN_FLAG_FOR_FOLLOWUP = 1<<10,
- CAN_FLAG_COMPLETED = 1<<11,
- CAN_CLEAR_FLAG = 1<<12
+ SELECTION_SET = 2,
+ CAN_MARK_READ = 4,
+ CAN_MARK_UNREAD = 8,
+ CAN_DELETE = 16,
+ CAN_UNDELETE = 32,
+ IS_MAILING_LIST = 64,
+ CAN_RESEND = 128,
+ CAN_MARK_IMPORTANT = 256,
+ CAN_MARK_UNIMPORTANT = 512
};
#define MLIST_VFOLDER (3)
#define MLIST_FILTER (8)
static EPopupMenu filter_menu[] = {
- E_POPUP_ITEM (N_("VFolder on _Subject"), GTK_SIGNAL_FUNC (vfolder_subject_uid), SELECTION_SET),
- E_POPUP_ITEM (N_("VFolder on Se_nder"), GTK_SIGNAL_FUNC (vfolder_sender_uid), SELECTION_SET),
- E_POPUP_ITEM (N_("VFolder on _Recipients"), GTK_SIGNAL_FUNC (vfolder_recipient_uid), SELECTION_SET),
- E_POPUP_ITEM (N_("VFolder on Mailing _List"), GTK_SIGNAL_FUNC (vfolder_mlist_uid), SELECTION_SET | IS_MAILING_LIST),
+ { N_("VFolder on _Subject"), NULL, GTK_SIGNAL_FUNC (vfolder_subject), NULL, SELECTION_SET },
+ { N_("VFolder on Se_nder"), NULL, GTK_SIGNAL_FUNC (vfolder_sender), NULL, SELECTION_SET },
+ { N_("VFolder on _Recipients"), NULL, GTK_SIGNAL_FUNC (vfolder_recipient), NULL, SELECTION_SET },
+ { N_("VFolder on Mailing _List"), NULL, GTK_SIGNAL_FUNC (vfolder_mlist), NULL, SELECTION_SET | IS_MAILING_LIST },
E_POPUP_SEPARATOR,
- E_POPUP_ITEM (N_("Filter on Sub_ject"), GTK_SIGNAL_FUNC (filter_subject_uid), SELECTION_SET),
- E_POPUP_ITEM (N_("Filter on Sen_der"), GTK_SIGNAL_FUNC (filter_sender_uid), SELECTION_SET),
- E_POPUP_ITEM (N_("Filter on Re_cipients"), GTK_SIGNAL_FUNC (filter_recipient_uid), SELECTION_SET),
- E_POPUP_ITEM (N_("Filter on _Mailing List"), GTK_SIGNAL_FUNC (filter_mlist_uid), SELECTION_SET | IS_MAILING_LIST),
+ { N_("Filter on Sub_ject"), NULL, GTK_SIGNAL_FUNC (filter_subject), NULL, SELECTION_SET },
+ { N_("Filter on Sen_der"), NULL, GTK_SIGNAL_FUNC (filter_sender), NULL, SELECTION_SET },
+ { N_("Filter on Re_cipients"), NULL, GTK_SIGNAL_FUNC (filter_recipient), NULL, SELECTION_SET },
+ { N_("Filter on _Mailing List"), NULL, GTK_SIGNAL_FUNC (filter_mlist), NULL, SELECTION_SET | IS_MAILING_LIST },
E_POPUP_TERMINATOR
};
-static EPopupMenu label_menu[] = {
- E_POPUP_ITEM (N_("None"), GTK_SIGNAL_FUNC (colourise_msg), 0),
- E_POPUP_SEPARATOR,
- E_POPUP_ITEM (NULL, GTK_SIGNAL_FUNC (colourise_msg), 0),
- E_POPUP_ITEM (NULL, GTK_SIGNAL_FUNC (colourise_msg), 0),
- E_POPUP_ITEM (NULL, GTK_SIGNAL_FUNC (colourise_msg), 0),
- E_POPUP_ITEM (NULL, GTK_SIGNAL_FUNC (colourise_msg), 0),
- E_POPUP_ITEM (NULL, GTK_SIGNAL_FUNC (colourise_msg), 0),
- E_POPUP_TERMINATOR
-};
static EPopupMenu context_menu[] = {
- E_POPUP_ITEM (N_("_Open"), GTK_SIGNAL_FUNC (open_msg), 0),
- E_POPUP_ITEM (N_("_Edit as New Message..."), GTK_SIGNAL_FUNC (resend_msg), CAN_RESEND),
- E_POPUP_ITEM (N_("_Save As..."), GTK_SIGNAL_FUNC (save_msg), 0),
- E_POPUP_ITEM (N_("_Print"), GTK_SIGNAL_FUNC (print_msg), 0),
-
- E_POPUP_SEPARATOR,
-
- E_POPUP_ITEM (N_("_Reply to Sender"), GTK_SIGNAL_FUNC (reply_to_sender), 0),
- E_POPUP_ITEM (N_("Reply to _List"), GTK_SIGNAL_FUNC (reply_to_list), 0),
- E_POPUP_ITEM (N_("Reply to _All"), GTK_SIGNAL_FUNC (reply_to_all), 0),
- E_POPUP_ITEM (N_("_Forward"), GTK_SIGNAL_FUNC (forward), 0),
-
- E_POPUP_SEPARATOR,
-
- E_POPUP_ITEM (N_("Follo_w Up..."), GTK_SIGNAL_FUNC (flag_for_followup), CAN_FLAG_FOR_FOLLOWUP),
- E_POPUP_ITEM (N_("Fla_g Completed"), GTK_SIGNAL_FUNC (flag_followup_completed), CAN_FLAG_COMPLETED),
- E_POPUP_ITEM (N_("Cl_ear Flag"), GTK_SIGNAL_FUNC (flag_followup_clear), CAN_CLEAR_FLAG),
-
- /* separator here? */
-
- E_POPUP_ITEM (N_("Mar_k as Read"), GTK_SIGNAL_FUNC (mark_as_seen), CAN_MARK_READ),
- E_POPUP_ITEM (N_("Mark as _Unread"), GTK_SIGNAL_FUNC (mark_as_unseen), CAN_MARK_UNREAD),
- E_POPUP_ITEM (N_("Mark as _Important"), GTK_SIGNAL_FUNC (mark_as_important), CAN_MARK_IMPORTANT),
- E_POPUP_ITEM (N_("_Mark as Unimportant"), GTK_SIGNAL_FUNC (mark_as_unimportant), CAN_MARK_UNIMPORTANT),
-
- E_POPUP_SEPARATOR,
-
- E_POPUP_ITEM (N_("_Delete"), GTK_SIGNAL_FUNC (delete_msg), CAN_DELETE),
- E_POPUP_ITEM (N_("U_ndelete"), GTK_SIGNAL_FUNC (undelete_msg), CAN_UNDELETE),
+ { N_("_Open"), NULL, GTK_SIGNAL_FUNC (open_msg), NULL, 0 },
+ { N_("_Edit as New Message..."), NULL, GTK_SIGNAL_FUNC (resend_msg), NULL, CAN_RESEND },
+ { N_("_Save As..."), NULL, GTK_SIGNAL_FUNC (save_msg), NULL, 0 },
+ { N_("_Print"), NULL, GTK_SIGNAL_FUNC (print_msg), NULL, SELECTION_SET },
E_POPUP_SEPARATOR,
- E_POPUP_ITEM (N_("Mo_ve to Folder..."), GTK_SIGNAL_FUNC (move_msg_cb), 0),
- E_POPUP_ITEM (N_("_Copy to Folder..."), GTK_SIGNAL_FUNC (copy_msg_cb), 0),
+ { N_("_Reply to Sender"), NULL, GTK_SIGNAL_FUNC (reply_to_sender), NULL, 0 },
+ { N_("Reply to _List"), NULL, GTK_SIGNAL_FUNC (reply_to_list), NULL, 0 },
+ { N_("Reply to _All"), NULL, GTK_SIGNAL_FUNC (reply_to_all), NULL, 0 },
+ { N_("_Forward"), NULL, GTK_SIGNAL_FUNC (forward), NULL, 0 },
+ { "", NULL, (NULL), NULL, 0 },
+ { N_("Mar_k as Read"), NULL, GTK_SIGNAL_FUNC (mark_as_seen), NULL, CAN_MARK_READ },
+ { N_("Mark as U_nread"), NULL, GTK_SIGNAL_FUNC (mark_as_unseen), NULL, CAN_MARK_UNREAD },
+ { N_("Mark as _Important"), NULL, GTK_SIGNAL_FUNC (mark_as_important), NULL, CAN_MARK_IMPORTANT },
+ { N_("Mark as Unim_portant"), NULL, GTK_SIGNAL_FUNC (mark_as_unimportant), NULL, CAN_MARK_UNIMPORTANT },
E_POPUP_SEPARATOR,
- E_POPUP_SUBMENU (N_("Label"), label_menu, 0),
+ { N_("_Move to Folder..."), NULL, GTK_SIGNAL_FUNC (move_msg_cb), NULL, 0 },
+ { N_("_Copy to Folder..."), NULL, GTK_SIGNAL_FUNC (copy_msg_cb), NULL, 0 },
+ { N_("_Delete"), NULL, GTK_SIGNAL_FUNC (delete_msg), NULL, CAN_DELETE },
+ { N_("_Undelete"), NULL, GTK_SIGNAL_FUNC (undelete_msg), NULL, CAN_UNDELETE },
E_POPUP_SEPARATOR,
- E_POPUP_ITEM (N_("Add Sender to Address_book"), GTK_SIGNAL_FUNC (addrbook_sender), SELECTION_SET),
+ { N_("Add Sender to Address Book"), NULL, GTK_SIGNAL_FUNC (addrbook_sender), NULL, SELECTION_SET },
+ { "", NULL, GTK_SIGNAL_FUNC (NULL), NULL, 0 },
- E_POPUP_SEPARATOR,
-
- E_POPUP_ITEM (N_("Appl_y Filters"), GTK_SIGNAL_FUNC (apply_filters), 0),
-
- E_POPUP_SEPARATOR,
-
- E_POPUP_SUBMENU (N_("Crea_te Rule From Message"), filter_menu, SELECTION_SET),
+ { N_("Apply Filters"), NULL, GTK_SIGNAL_FUNC (apply_filters), NULL, 0 },
+ { "", NULL, GTK_SIGNAL_FUNC (NULL), NULL, 0 },
+ { N_("Create Ru_le From Message"), NULL, GTK_SIGNAL_FUNC (NULL), filter_menu, SELECTION_SET },
E_POPUP_TERMINATOR
};
-/* Note: this must be kept in sync with the context_menu!!! */
-static char *context_pixmaps[] = {
- NULL, /* Open */
- NULL, /* Edit */
- "save-as-16.png",
- "print.xpm",
- NULL,
- "reply.xpm",
- NULL, /* Reply to List */
- "reply_to_all.xpm",
- "forward.xpm",
- NULL,
- "flag-for-followup-16.png",
- NULL, /* Flag */
- NULL, /* Clear */
- "mail-read.xpm",
- "mail-new.xpm",
- "priority-high.xpm",
- NULL, /* Mark as Unimportant */
- NULL,
- "evolution-trash-mini.png",
- "undelete_message-16.png",
- NULL,
- "move_message.xpm",
- "copy_16_message.xpm",
- NULL,
- NULL, /* Label */
- NULL,
- NULL, /* Add Sender to Addressbook */
- NULL,
- NULL, /* Apply Filters */
- NULL,
- NULL, /* Create Rule from Message */
-};
struct cmpf_data {
ETree *tree;
@@ -1699,7 +1492,7 @@ context_menu_position_func (GtkMenu *menu, gint *x, gint *y,
{
int tx, ty, tw, th;
struct cmpf_data *closure = user_data;
-
+
gdk_window_get_origin (GTK_WIDGET (closure->tree)->window, x, y);
e_tree_get_cell_geometry (closure->tree, closure->row, closure->col,
&tx, &ty, &tw, &th);
@@ -1707,69 +1500,44 @@ context_menu_position_func (GtkMenu *menu, gint *x, gint *y,
*y += ty + th / 2;
}
-static gboolean
-followup_tag_complete (const char *tag_value)
-{
- struct _FollowUpTag *tag;
- gboolean ret;
-
- tag = message_tag_followup_decode (tag_value);
- ret = tag->completed != (time_t) 0 ? TRUE : FALSE;
- g_free (tag);
-
- return ret;
-}
-
-static void
-setup_popup_icons (void)
-{
- int i;
-
- for (i = 0; context_menu[i].name; i++) {
- if (context_pixmaps[i]) {
- char *filename;
-
- filename = g_strdup_printf ("%s/%s", EVOLUTION_IMAGES, context_pixmaps[i]);
- context_menu[i].pixmap_widget = gnome_pixmap_new_from_file (filename);
- g_free (filename);
- }
- }
-}
-
-static void
-colour_closures_free (GPtrArray *closures)
-{
- struct _colour_data *data;
- int i;
-
- for (i = 0; i < closures->len; i++) {
- data = closures->pdata[i];
- gtk_object_unref (GTK_OBJECT (data->fb));
- g_free (data);
- }
- g_ptr_array_free (closures, TRUE);
-}
-
/* handle context menu over message-list */
-static int
+static gint
on_right_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event, FolderBrowser *fb)
{
extern CamelFolder *sent_folder;
CamelMessageInfo *info;
- GPtrArray *uids, *closures;
+ GPtrArray *uids;
int enable_mask = 0;
int hide_mask = 0;
int i;
char *mlist = NULL;
GtkMenu *menu;
- struct _filter_data *fdata = NULL;
if (fb->folder != sent_folder) {
enable_mask |= CAN_RESEND;
hide_mask |= CAN_RESEND;
}
- enable_mask |= SELECTION_SET;
+ if (fb->mail_display->current_message == NULL) {
+ enable_mask |= SELECTION_SET;
+ } else {
+ char *mname, *p, c, *o;
+
+ mname = header_raw_check_mailing_list (&((CamelMimePart *)fb->mail_display->current_message)->headers);
+ /* Escape the mailing list name before showing it */
+ if (mname) {
+ mlist = alloca (strlen (mname)+2);
+ p = mname;
+ o = mlist;
+ while ((c = *p++)) {
+ if (c == '_')
+ *o++ = '_';
+ *o++ = c;
+ }
+ *o = 0;
+ g_free (mname);
+ }
+ }
/* get a list of uids */
uids = g_ptr_array_new ();
@@ -1782,46 +1550,12 @@ on_right_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event
gboolean have_unseen = FALSE;
gboolean have_important = FALSE;
gboolean have_unimportant = FALSE;
- gboolean have_flag_for_followup = FALSE;
- gboolean have_flag_completed = FALSE;
- gboolean have_flag_incomplete = FALSE;
- gboolean have_unflagged = FALSE;
- const char *tag;
for (i = 0; i < uids->len; i++) {
info = camel_folder_get_message_info (fb->folder, uids->pdata[i]);
if (info == NULL)
continue;
- if (i == 0 && uids->len == 1) {
- const char *mname, *p;
- char c, *o;
-
- /* used by filter/vfolder from X callbacks */
- fdata = g_malloc0(sizeof(*fdata));
- fdata->uid = g_strdup(uids->pdata[i]);
- fdata->uri = g_strdup(fb->uri);
- fdata->folder = fb->folder;
- camel_object_ref((CamelObject *)fdata->folder);
-
- enable_mask &= ~SELECTION_SET;
- mname = camel_message_info_mlist(info);
- if (mname && mname[0]) {
- fdata->mlist = g_strdup(mname);
-
- /* Escape the mailing list name before showing it */
- mlist = alloca (strlen (mname)+2);
- p = mname;
- o = mlist;
- while ((c = *p++)) {
- if (c == '_')
- *o++ = '_';
- *o++ = c;
- }
- *o = 0;
- }
- }
-
if (info->flags & CAMEL_MESSAGE_SEEN)
have_seen = TRUE;
else
@@ -1837,15 +1571,6 @@ on_right_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event
else
have_unimportant = TRUE;
- if ((tag = camel_tag_get (&info->user_tags, "follow-up"))) {
- have_flag_for_followup = TRUE;
- if (followup_tag_complete (tag))
- have_flag_completed = TRUE;
- else
- have_flag_incomplete = TRUE;
- } else
- have_unflagged = TRUE;
-
camel_folder_free_message_info (fb->folder, info);
if (have_seen && have_unseen && have_deleted && have_undeleted)
@@ -1867,43 +1592,29 @@ on_right_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event
if (!have_important)
enable_mask |= CAN_MARK_UNIMPORTANT;
- if (!have_flag_for_followup)
- enable_mask |= CAN_CLEAR_FLAG;
- if (!have_unflagged)
- enable_mask |= CAN_FLAG_FOR_FOLLOWUP;
- if (!have_flag_incomplete)
- enable_mask |= CAN_FLAG_COMPLETED;
-
/*
* Hide items that wont get used.
*/
- if (!(have_unseen && have_seen)) {
+ if (!(have_unseen && have_seen)){
if (have_seen)
hide_mask |= CAN_MARK_READ;
else
hide_mask |= CAN_MARK_UNREAD;
}
- if (!(have_undeleted && have_deleted)) {
+ if (!(have_undeleted && have_deleted)){
if (have_deleted)
hide_mask |= CAN_DELETE;
else
hide_mask |= CAN_UNDELETE;
}
- if (!(have_important && have_unimportant)) {
+ if (!(have_important && have_unimportant)){
if (have_important)
hide_mask |= CAN_MARK_IMPORTANT;
else
hide_mask |= CAN_MARK_UNIMPORTANT;
}
-
- if (!have_flag_for_followup)
- hide_mask |= CAN_CLEAR_FLAG;
- if (!have_unflagged)
- hide_mask |= CAN_FLAG_FOR_FOLLOWUP;
- if (!have_flag_incomplete)
- hide_mask |= CAN_FLAG_COMPLETED;
}
/* free uids */
@@ -1911,73 +1622,19 @@ on_right_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event
g_free (uids->pdata[i]);
g_ptr_array_free (uids, TRUE);
- /* generate the "Filter on Mailing List" menu item name */
+ /* generate the "Filter on Mailing List menu item name */
if (mlist == NULL) {
enable_mask |= IS_MAILING_LIST;
- filter_menu[MLIST_FILTER].name = g_strdup (_("Filter on _Mailing List"));
- filter_menu[MLIST_VFOLDER].name = g_strdup (_("VFolder on M_ailing List"));
+ filter_menu[MLIST_FILTER].name = g_strdup (_("Filter on Mailing List"));
+ filter_menu[MLIST_VFOLDER].name = g_strdup (_("VFolder on Mailing List"));
} else {
- filter_menu[MLIST_FILTER].name = g_strdup_printf (_("Filter on _Mailing List (%s)"), mlist);
- filter_menu[MLIST_VFOLDER].name = g_strdup_printf (_("VFolder on M_ailing List (%s)"), mlist);
- }
-
- /* create the label/colour menu */
- closures = g_ptr_array_new ();
- label_menu[0].closure = g_new (struct _colour_data, 1);
- g_ptr_array_add (closures, label_menu[0].closure);
- gtk_object_ref (GTK_OBJECT (fb));
- ((struct _colour_data *) label_menu[0].closure)->fb = fb;
- ((struct _colour_data *) label_menu[0].closure)->rgb = COLOUR_NONE;
-
- for (i = 0; i < 5; i++) {
- struct _colour_data *closure;
- GdkPixmap *pixmap;
- GdkColormap *map;
- GdkColor color;
- guint32 rgb;
- GdkGC *gc;
-
- rgb = mail_config_get_label_color (i);
-
- color.red = ((rgb & 0xff0000) >> 8) | 0xff;
- color.green = (rgb & 0xff00) | 0xff;
- color.blue = ((rgb & 0xff) << 8) | 0xff;
-
- map = gdk_colormap_get_system ();
- gdk_color_alloc (map, &color);
-
- pixmap = gdk_pixmap_new (GTK_WIDGET (fb)->window, 16, 16, -1);
- gc = gdk_gc_new (GTK_WIDGET (fb)->window);
- gdk_gc_set_foreground (gc, &color);
- gdk_draw_rectangle (pixmap, gc, TRUE, 0, 0, 16, 16);
- gdk_gc_unref (gc);
-
- closure = g_new (struct _colour_data, 1);
- gtk_object_ref (GTK_OBJECT (fb));
- closure->fb = fb;
- closure->rgb = rgb;
-
- g_ptr_array_add (closures, closure);
-
- label_menu[i + 2].name = e_utf8_to_locale_string (mail_config_get_label_name (i));
- label_menu[i + 2].pixmap_widget = gtk_pixmap_new (pixmap, NULL);
- label_menu[i + 2].closure = closure;
+ filter_menu[MLIST_FILTER].name = g_strdup_printf (_("Filter on Mailing List (%s)"), mlist);
+ filter_menu[MLIST_VFOLDER].name = g_strdup_printf (_("VFolder on Mailing List (%s)"), mlist);
}
- setup_popup_icons ();
-
- for (i = 0; i < sizeof (filter_menu) / sizeof (filter_menu[0]); i++)
- filter_menu[i].closure = fdata;
-
menu = e_popup_menu_create (context_menu, enable_mask, hide_mask, fb);
e_auto_kill_popup_menu_on_hide (menu);
- gtk_object_set_data_full (GTK_OBJECT (menu), "colour_closures",
- closures, (GtkDestroyNotify) colour_closures_free);
-
- if (fdata)
- gtk_object_set_data_full(GTK_OBJECT(menu), "filter_data", fdata, (GtkDestroyNotify)filter_data_free);
-
if (event->type == GDK_KEY_PRESS) {
struct cmpf_data closure;
@@ -1994,76 +1651,28 @@ on_right_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event
g_free (filter_menu[MLIST_FILTER].name);
g_free (filter_menu[MLIST_VFOLDER].name);
- /* free the label/colour menu */
- for (i = 0; i < 5; i++) {
- g_free (label_menu[i + 2].name);
- }
-
return TRUE;
}
-static int
-html_button_press_event (GtkWidget *widget, GdkEventButton *event, gpointer data)
-{
- FolderBrowser *fb = data;
- HTMLEngine *engine;
- HTMLPoint *point;
- ETreePath *path;
- int row;
-
- if (event->type != GDK_BUTTON_PRESS || event->button != 3)
- return FALSE;
-
- engine = GTK_HTML (widget)->engine;
- point = html_engine_get_point_at (engine, event->x + engine->x_offset,
- event->y + engine->y_offset, FALSE);
-
- if (point) {
- /* don't popup a menu if the mouse is hovering over a
- url or a source image because those situations are
- handled in mail-display.c's button_press_event
- callback */
- const char *src, *url;
-
- url = html_object_get_url (point->object);
- src = html_object_get_src (point->object);
-
- if (url || src) {
- html_point_destroy (point);
- return FALSE;
- }
-
- html_point_destroy (point);
- }
-
- path = e_tree_get_cursor (fb->message_list->tree);
- row = e_tree_row_of_node (fb->message_list->tree, path);
-
- on_right_click (fb->message_list->tree, row, path, 2,
- (GdkEvent *) event, fb);
-
- return TRUE;
-}
-
-static int
+static gint
on_key_press (GtkWidget *widget, GdkEventKey *key, gpointer data)
{
FolderBrowser *fb = data;
ETreePath *path;
int row;
-
+
if (key->state & GDK_CONTROL_MASK)
return FALSE;
-
+
path = e_tree_get_cursor (fb->message_list->tree);
row = e_tree_row_of_node (fb->message_list->tree, path);
-
+
switch (key->keyval) {
case GDK_Delete:
case GDK_KP_Delete:
delete_msg (NULL, fb);
return TRUE;
-
+
case GDK_Menu:
on_right_click (fb->message_list->tree, row, path, 2,
(GdkEvent *)key, fb);
@@ -2072,7 +1681,7 @@ on_key_press (GtkWidget *widget, GdkEventKey *key, gpointer data)
toggle_as_important (NULL, fb, NULL);
return TRUE;
}
-
+
return FALSE;
}
@@ -2245,15 +1854,12 @@ done_message_selected (CamelFolder *folder, char *uid, CamelMimeMessage *msg, vo
{
FolderBrowser *fb = data;
int timeout = mail_config_get_mark_as_seen_timeout ();
- const char *followup;
if (folder != fb->folder || fb->mail_display == NULL)
return;
- followup = camel_folder_get_message_user_tag (folder, uid, "follow-up");
-
- mail_display_set_message (fb->mail_display, (CamelMedium *) msg, followup);
-
+ mail_display_set_message (fb->mail_display, (CamelMedium *)msg);
+
/* FIXME: should this signal be emitted here?? */
gtk_signal_emit (GTK_OBJECT (fb), folder_browser_signals [MESSAGE_LOADED], uid);
@@ -2302,7 +1908,7 @@ do_message_selected (FolderBrowser *fb)
fb->loading_uid = g_strdup (fb->new_uid);
mail_get_message (fb->folder, fb->loading_uid, done_message_selected, fb, mail_thread_new);
} else {
- mail_display_set_message (fb->mail_display, NULL, NULL);
+ mail_display_set_message (fb->mail_display, NULL);
}
}
@@ -2325,28 +1931,6 @@ on_message_selected (MessageList *ml, const char *uid, FolderBrowser *fb)
fb->loading_id = gtk_timeout_add (100, (GtkFunction)do_message_selected, fb);
}
-static gboolean
-on_message_list_focus_in (GtkWidget *widget, GdkEventFocus *event, gpointer user_data)
-{
- FolderBrowser *fb = (FolderBrowser *) user_data;
-
- printf ("got focus!\n");
- folder_browser_ui_message_list_focus (fb);
-
- return FALSE;
-}
-
-static gboolean
-on_message_list_focus_out (GtkWidget *widget, GdkEventFocus *event, gpointer user_data)
-{
- FolderBrowser *fb = (FolderBrowser *) user_data;
-
- printf ("got unfocus!\n");
- folder_browser_ui_message_list_unfocus (fb);
-
- return FALSE;
-}
-
static void
folder_browser_init (GtkObject *object)
{
@@ -2362,7 +1946,7 @@ my_folder_browser_init (GtkObject *object)
FolderBrowser *fb = FOLDER_BROWSER (object);
int i;
- fb->view_instance = NULL;
+ fb->view_collection = NULL;
fb->view_menus = NULL;
fb->pref_master = FALSE;
@@ -2383,8 +1967,6 @@ my_folder_browser_init (GtkObject *object)
gtk_signal_connect (GTK_OBJECT (fb->mail_display->html),
"key_press_event", GTK_SIGNAL_FUNC (on_key_press), fb);
- gtk_signal_connect (GTK_OBJECT (fb->mail_display->html),
- "button_press_event", GTK_SIGNAL_FUNC (html_button_press_event), fb);
gtk_signal_connect (GTK_OBJECT (fb->message_list->tree),
"key_press", GTK_SIGNAL_FUNC (etree_key), fb);
@@ -2395,12 +1977,6 @@ my_folder_browser_init (GtkObject *object)
gtk_signal_connect (GTK_OBJECT (fb->message_list->tree),
"double_click", GTK_SIGNAL_FUNC (on_double_click), fb);
- gtk_signal_connect (GTK_OBJECT (fb->message_list), "focus_in_event",
- GTK_SIGNAL_FUNC (on_message_list_focus_in), fb);
-
- gtk_signal_connect (GTK_OBJECT (fb->message_list), "focus_out_event",
- GTK_SIGNAL_FUNC (on_message_list_focus_out), fb);
-
gtk_signal_connect (GTK_OBJECT (fb->message_list), "message_selected",
on_message_selected, fb);
@@ -2462,13 +2038,10 @@ folder_browser_new (const GNOME_Evolution_Shell shell, const char *uri)
}
CORBA_exception_free (&ev);
-
- if (uri) {
- folder_browser->uri = g_strdup (uri);
- gtk_object_ref (GTK_OBJECT (folder_browser));
- folder_browser->get_id = mail_get_folder (folder_browser->uri, 0, got_folder,
- folder_browser, mail_thread_new);
- }
+
+ folder_browser->uri = g_strdup (uri);
+ gtk_object_ref (GTK_OBJECT (folder_browser));
+ folder_browser->get_id = mail_get_folder (folder_browser->uri, 0, got_folder, folder_browser, mail_thread_new);
return GTK_WIDGET (folder_browser);
}
diff --git a/mail/mail-account-gui.c b/mail/mail-account-gui.c
index cbe13958db..514ffd717d 100644
--- a/mail/mail-account-gui.c
+++ b/mail/mail-account-gui.c
@@ -29,47 +29,40 @@
#include <string.h>
#include <stdarg.h>
+#include <bonobo.h>
+#include <bonobo/bonobo-stream-memory.h>
#include <gal/widgets/e-unicode.h>
#include <gal/widgets/e-gui-utils.h>
-#include "evolution-folder-selector-button.h"
+#include "shell/evolution-shell-client.h"
#include "mail-account-gui.h"
#include "mail-session.h"
#include "mail-send-recv.h"
-#include "mail-signature-editor.h"
+#include "e-msg-composer.h"
#define d(x)
extern char *default_drafts_folder_uri, *default_sent_folder_uri;
-extern EvolutionShellClient *global_shell_client;
static void save_service (MailAccountGuiService *gsvc, GHashTable *extra_conf, MailConfigService *service);
static void service_changed (GtkEntry *entry, gpointer user_data);
-struct {
- char *label;
- char *value;
-} ssl_options[] = {
- { N_("Always"), "always" },
- { N_("Whenever Possible"), "when-possible" },
- { N_("Never"), "never" }
-};
-
-static int num_ssl_options = sizeof (ssl_options) / sizeof (ssl_options[0]);
-
static gboolean
is_email (const char *address)
{
- /* This is supposed to check if the address's domain could be
- an FQDN but alas, it's not worth the pain and suffering. */
- const char *at;
+ const char *at, *hname;
at = strchr (address, '@');
/* make sure we have an '@' and that it's not the first or last char */
if (!at || at == address || *(at + 1) == '\0')
return FALSE;
- return TRUE;
+ hname = at + 1;
+ /* make sure the first and last chars aren't '.' */
+ if (*hname == '.' || hname[strlen (hname) - 1] == '.')
+ return FALSE;
+
+ return strchr (hname, '.') != NULL;
}
static GtkWidget *
@@ -106,7 +99,6 @@ mail_account_gui_identity_complete (MailAccountGui *gui, GtkWidget **incomplete)
if (incomplete)
*incomplete = get_focused_widget (GTK_WIDGET (gui->full_name),
GTK_WIDGET (gui->email_address),
- GTK_WIDGET (gui->reply_to),
NULL);
return FALSE;
}
@@ -116,18 +108,6 @@ mail_account_gui_identity_complete (MailAccountGui *gui, GtkWidget **incomplete)
if (incomplete)
*incomplete = get_focused_widget (GTK_WIDGET (gui->email_address),
GTK_WIDGET (gui->full_name),
- GTK_WIDGET (gui->reply_to),
- NULL);
- return FALSE;
- }
-
- /* make sure that if the reply-to field is filled in, that it is valid */
- text = gtk_entry_get_text (gui->reply_to);
- if (text && *text && !is_email (text)) {
- if (incomplete)
- *incomplete = get_focused_widget (GTK_WIDGET (gui->reply_to),
- GTK_WIDGET (gui->email_address),
- GTK_WIDGET (gui->full_name),
NULL);
return FALSE;
}
@@ -204,17 +184,6 @@ mail_account_gui_source_complete (MailAccountGui *gui, GtkWidget **incomplete)
gboolean
mail_account_gui_transport_complete (MailAccountGui *gui, GtkWidget **incomplete)
{
- /* If it's both source and transport, there's nothing extra to
- * configure on the transport page.
- */
- if (CAMEL_PROVIDER_IS_STORE_AND_TRANSPORT (gui->transport.provider)) {
- if (gui->transport.provider == gui->source.provider)
- return TRUE;
- if (incomplete)
- *incomplete = GTK_WIDGET (gui->transport.type);
- return FALSE;
- }
-
if (!service_complete (&gui->transport, incomplete))
return FALSE;
@@ -315,27 +284,7 @@ build_auth_menu (MailAccountGuiService *service, GList *all_authtypes,
if (first) {
gtk_option_menu_set_history (service->authtype, history);
- gtk_signal_emit_by_name (GTK_OBJECT (first), "activate");
- }
-}
-
-static void
-transport_provider_set_available (MailAccountGui *gui, CamelProvider *provider,
- gboolean available)
-{
- GtkWidget *menuitem;
-
- menuitem = gtk_object_get_data (GTK_OBJECT (gui->transport.type),
- provider->protocol);
- g_return_if_fail (menuitem != NULL);
- gtk_widget_set_sensitive (menuitem, available);
-
- if (available) {
- gpointer number = gtk_object_get_data (GTK_OBJECT (menuitem), "number");
-
- gtk_signal_emit_by_name (GTK_OBJECT (menuitem), "activate");
- gtk_option_menu_set_history (gui->transport.type,
- GPOINTER_TO_UINT (number));
+ gtk_signal_emit_by_name (GTK_OBJECT (first), "activate", service);
}
}
@@ -347,13 +296,6 @@ source_type_changed (GtkWidget *widget, gpointer user_data)
CamelProvider *provider;
provider = gtk_object_get_data (GTK_OBJECT (widget), "provider");
-
- /* If the previously-selected provider has a linked transport,
- * disable it.
- */
- if (gui->source.provider &&
- CAMEL_PROVIDER_IS_STORE_AND_TRANSPORT (gui->source.provider))
- transport_provider_set_available (gui, gui->source.provider, FALSE);
gui->source.provider = provider;
@@ -427,13 +369,13 @@ source_type_changed (GtkWidget *widget, gpointer user_data)
/* ssl */
#ifdef HAVE_SSL
if (provider && provider->flags & CAMEL_PROVIDER_SUPPORTS_SSL)
- gtk_widget_show (gui->source.ssl_hbox);
+ gtk_widget_show (GTK_WIDGET (gui->source.use_ssl));
else
- gtk_widget_hide (gui->source.ssl_hbox);
- gtk_widget_hide (gui->source.no_ssl);
+ gtk_widget_hide (GTK_WIDGET (gui->source.use_ssl));
+ gtk_widget_hide (GTK_WIDGET (gui->source.no_ssl));
#else
- gtk_widget_hide (gui->source.ssl_hbox);
- gtk_widget_show (gui->source.no_ssl);
+ gtk_widget_hide (GTK_WIDGET (gui->source.use_ssl));
+ gtk_widget_show (GTK_WIDGET (gui->source.no_ssl));
#endif
/* auth */
@@ -455,10 +397,6 @@ source_type_changed (GtkWidget *widget, gpointer user_data)
gtk_widget_grab_focus (dwidget);
mail_account_gui_build_extra_conf (gui, gui && gui->account && gui->account->source ? gui->account->source->url : NULL);
-
- if (provider &&
- CAMEL_PROVIDER_IS_STORE_AND_TRANSPORT (provider))
- transport_provider_set_available (gui, provider, TRUE);
}
@@ -484,15 +422,17 @@ transport_type_changed (GtkWidget *widget, gpointer user_data)
provider = gtk_object_get_data (GTK_OBJECT (widget), "provider");
gui->transport.provider = provider;
-
+
/* description */
- gtk_label_set_text (gui->transport.description, provider->description);
+ if (provider)
+ gtk_label_set_text (gui->transport.description, provider->description);
+ else
+ gtk_label_set_text (gui->transport.description, "");
frame = glade_xml_get_widget (gui->xml, "transport_frame");
- if (!CAMEL_PROVIDER_IS_STORE_AND_TRANSPORT (provider) &&
- (CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_HOST) ||
- (CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_AUTH) &&
- !CAMEL_PROVIDER_NEEDS (provider, CAMEL_URL_PART_AUTH)))) {
+ if (CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_HOST) ||
+ (CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_AUTH) &&
+ !CAMEL_PROVIDER_NEEDS (provider, CAMEL_URL_PART_AUTH))) {
gtk_widget_show (frame);
label = glade_xml_get_widget (gui->xml, "transport_host_label");
@@ -508,13 +448,13 @@ transport_type_changed (GtkWidget *widget, gpointer user_data)
/* ssl */
#ifdef HAVE_SSL
if (provider && provider->flags & CAMEL_PROVIDER_SUPPORTS_SSL)
- gtk_widget_show (gui->transport.ssl_hbox);
+ gtk_widget_show (GTK_WIDGET (gui->transport.use_ssl));
else
- gtk_widget_hide (gui->transport.ssl_hbox);
- gtk_widget_hide (gui->transport.no_ssl);
+ gtk_widget_hide (GTK_WIDGET (gui->transport.use_ssl));
+ gtk_widget_hide (GTK_WIDGET (gui->transport.no_ssl));
#else
- gtk_widget_hide (gui->transport.ssl_hbox);
- gtk_widget_show (gui->transport.no_ssl);
+ gtk_widget_hide (GTK_WIDGET (gui->transport.use_ssl));
+ gtk_widget_show (GTK_WIDGET (gui->transport.no_ssl));
#endif
/* auth */
@@ -527,8 +467,7 @@ transport_type_changed (GtkWidget *widget, gpointer user_data)
gtk_widget_hide (frame);
frame = glade_xml_get_widget (gui->xml, "transport_auth_frame");
- if (!CAMEL_PROVIDER_IS_STORE_AND_TRANSPORT (provider) &&
- CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_AUTH)) {
+ if (CAMEL_PROVIDER_ALLOWS (provider, CAMEL_URL_PART_AUTH)) {
gtk_widget_show (frame);
label = glade_xml_get_widget (gui->xml, "transport_user_label");
@@ -872,34 +811,53 @@ extract_values (MailAccountGuiService *source, GHashTable *extra_config, CamelUR
}
+extern EvolutionShellClient *global_shell_client;
+
static void
-folder_selected (EvolutionFolderSelectorButton *button,
- GNOME_Evolution_Folder *corba_folder,
- gpointer user_data)
+set_folder_picker_label (GtkButton *button, const char *name)
{
- char **folder_name = user_data;
+ char *string;
- g_free (*folder_name);
- *folder_name = g_strdup (corba_folder->physicalUri);
+ string = e_utf8_to_gtk_string (GTK_WIDGET (button), name);
+ gtk_label_set_text (GTK_LABEL (GTK_BIN (button)->child), string);
+ g_free (string);
}
-GtkWidget *mail_account_gui_folder_selector_button_new (char *widget_name, char *string1, char *string2, int int1, int int2);
-
-GtkWidget *
-mail_account_gui_folder_selector_button_new (char *widget_name,
- char *string1, char *string2,
- int int1, int int2)
+static void
+folder_picker_clicked (GtkButton *button, gpointer user_data)
{
- return (GtkWidget *)gtk_type_new (EVOLUTION_TYPE_FOLDER_SELECTOR_BUTTON);
+ MailAccountGuiFolder *folder = user_data;
+ const char *allowed_types[] = { "mail", NULL };
+ char *physical_uri, *evolution_uri;
+
+ physical_uri = evolution_uri = NULL;
+ evolution_shell_client_user_select_folder (
+ global_shell_client,
+ GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (button))),
+ _("Select Folder"), folder->uri,
+ allowed_types, &evolution_uri, &physical_uri);
+ if (!physical_uri || !*physical_uri) {
+ g_free (physical_uri);
+ g_free (evolution_uri);
+ return;
+ }
+
+ g_free (folder->uri);
+ folder->uri = physical_uri;
+ g_free (folder->name);
+ folder->name = g_strdup (g_basename (evolution_uri));
+ g_free (evolution_uri);
+ set_folder_picker_label (button, folder->name);
}
+
static gboolean
setup_service (MailAccountGuiService *gsvc, MailConfigService *service)
{
CamelURL *url = camel_url_new (service->url, NULL);
gboolean has_auth = FALSE;
- if (url == NULL || gsvc->provider == NULL)
+ if (url == NULL)
return FALSE;
if (url->user && CAMEL_PROVIDER_ALLOWS (gsvc->provider, CAMEL_URL_PART_USER))
@@ -921,24 +879,8 @@ setup_service (MailAccountGuiService *gsvc, MailConfigService *service)
gtk_entry_set_text (gsvc->path, url->path);
if (gsvc->provider->flags & CAMEL_PROVIDER_SUPPORTS_SSL) {
- GList *children, *item;
- const char *use_ssl;
- int i;
-
- use_ssl = camel_url_get_param (url, "use_ssl");
- if (!use_ssl)
- use_ssl = "never";
- else if (!*use_ssl) /* old config code just used an empty string as the value */
- use_ssl = "always";
-
- children = gtk_container_children (GTK_CONTAINER (gtk_option_menu_get_menu (gsvc->use_ssl)));
- for (item = children, i = 0; item; item = item->next, i++) {
- if (!strcmp (use_ssl, ssl_options[i].value)) {
- gtk_option_menu_set_history (gsvc->use_ssl, i);
- gtk_signal_emit_by_name (item->data, "activate", gsvc);
- break;
- }
- }
+ gboolean use_ssl = camel_url_get_param (url, "use_ssl") != NULL;
+ gtk_toggle_button_set_active (gsvc->use_ssl, use_ssl);
}
if (url->authmech && CAMEL_PROVIDER_ALLOWS (gsvc->provider, CAMEL_URL_PART_AUTH)) {
@@ -983,415 +925,308 @@ provider_compare (const CamelProvider *p1, const CamelProvider *p2)
}
}
-static void
-ssl_option_activate (GtkWidget *widget, gpointer user_data)
-{
- MailAccountGuiService *service = user_data;
-
- service->ssl_selected = widget;
-}
+/*
+ * Signature editor
+ *
+ */
-static void
-construct_ssl_menu (MailAccountGuiService *service)
-{
- GtkWidget *menu, *item = NULL;
- int i;
-
- menu = gtk_menu_new ();
-
- for (i = 0; i < num_ssl_options; i++) {
- item = gtk_menu_item_new_with_label (_(ssl_options[i].label));
- gtk_object_set_data (GTK_OBJECT (item), "use_ssl", ssl_options[i].value);
- gtk_signal_connect (GTK_OBJECT (item), "activate",
- ssl_option_activate, service);
- gtk_widget_show (item);
- gtk_menu_append (GTK_MENU (menu), item);
- }
-
- gtk_option_menu_remove_menu (service->use_ssl);
- gtk_option_menu_set_menu (service->use_ssl, menu);
+struct _ESignatureEditor {
+ MailAccountGui *gui;
+ GtkWidget *win;
+ GtkWidget *control;
- gtk_option_menu_set_history (service->use_ssl, i - 1);
- gtk_signal_emit_by_name (GTK_OBJECT (item), "activate", service);
-}
+ gchar *filename;
+ gboolean html;
+ gboolean has_changed;
+};
+typedef struct _ESignatureEditor ESignatureEditor;
-static void
-clear_menu (GtkWidget *menu)
-{
- while (GTK_MENU_SHELL (menu)->children)
- gtk_container_remove (GTK_CONTAINER (menu), GTK_MENU_SHELL (menu)->children->data);
-}
+#define E_SIGNATURE_EDITOR(o) ((ESignatureEditor *) o)
-static inline int
-sig_get_index (MailConfigSignature *sig)
+#define DEFAULT_WIDTH 600
+#define DEFAULT_HEIGHT 500
+
+enum { REPLY_YES = 0, REPLY_NO, REPLY_CANCEL };
+
+static void
+destroy_editor (ESignatureEditor *editor)
{
- return sig->id + (mail_config_get_signatures_random () ? 2 : 1);
+ gtk_widget_destroy (editor->win);
+ g_free (editor->filename);
+ g_free (editor);
}
-static gint
-sig_get_gui_index (MailAccountGui *gui, gboolean text)
-{
- MailConfigSignature *sig = text ? gui->text_signature : gui->html_signature;
- gboolean random = text ? gui->text_random : gui->html_random;
+static void
+menu_file_save_error (BonoboUIComponent *uic, CORBA_Environment *ev) {
+ e_notice (GTK_WINDOW (uic), GNOME_MESSAGE_BOX_ERROR,
+ _("Could not save signature file."));
- if (random)
- return 1;
- else if (!sig)
- return 0;
- else
- return sig_get_index (sig);
+ g_warning ("Exception while saving signature (%s)",
+ bonobo_exception_get_text (ev));
}
static void
-sig_fill_options (MailAccountGui *gui)
+menu_file_save_cb (BonoboUIComponent *uic,
+ void *data,
+ const char *path)
{
- GtkWidget *menu_text, *menu_html;
- GtkWidget *mi;
- GList *l;
- MailConfigSignature *sig;
-
- menu_text = gtk_option_menu_get_menu (GTK_OPTION_MENU (gui->sig_option_text));
- menu_html = gtk_option_menu_get_menu (GTK_OPTION_MENU (gui->sig_option_html));
+ ESignatureEditor *editor;
+ Bonobo_PersistFile pfile_iface;
+ CORBA_Environment ev;
- clear_menu (menu_text);
- clear_menu (menu_html);
-
- gtk_menu_append (GTK_MENU (menu_text), gtk_menu_item_new_with_label (_("None")));
- gtk_menu_append (GTK_MENU (menu_html), gtk_menu_item_new_with_label (_("None")));
+ editor = E_SIGNATURE_EDITOR (data);
+ if (editor->html) {
+ CORBA_exception_init (&ev);
+
+ pfile_iface = bonobo_object_client_query_interface (bonobo_widget_get_server (BONOBO_WIDGET (editor->control)),
+ "IDL:Bonobo/PersistFile:1.0", NULL);
+ Bonobo_PersistFile_save (pfile_iface, editor->filename, &ev);
+
+ if (ev._major != CORBA_NO_EXCEPTION)
+ menu_file_save_error (uic, &ev);
+
+ CORBA_exception_free (&ev);
+ } else {
+ BonoboStream *stream;
+ CORBA_Environment ev;
+ Bonobo_PersistStream pstream_iface;
+
+ CORBA_exception_init (&ev);
- if (mail_config_get_signatures_random ()) {
- gtk_menu_append (GTK_MENU (menu_text), gtk_menu_item_new_with_label (_("Random")));
- gtk_menu_append (GTK_MENU (menu_html), gtk_menu_item_new_with_label (_("Random")));
- }
+ stream = bonobo_stream_open (BONOBO_IO_DRIVER_FS, editor->filename,
+ Bonobo_Storage_WRITE | Bonobo_Storage_CREATE, 0);
+
+ pstream_iface = bonobo_object_client_query_interface
+ (bonobo_widget_get_server (BONOBO_WIDGET (editor->control)),
+ "IDL:Bonobo/PersistStream:1.0", NULL);
+
+ Bonobo_PersistStream_save (pstream_iface,
+ (Bonobo_Stream) bonobo_object_corba_objref (BONOBO_OBJECT (stream)),
+ "text/plain", &ev);
+
+ if (ev._major != CORBA_NO_EXCEPTION)
+ menu_file_save_error (uic, &ev);
- for (l = mail_config_get_signature_list (); l; l = l->next) {
- sig = l->data;
- mi = gtk_menu_item_new_with_label (sig->name);
- gtk_object_set_data (GTK_OBJECT (mi), "sig", sig);
- gtk_menu_append (GTK_MENU (menu_text), mi);
-
- mi = gtk_menu_item_new_with_label (sig->name);
- gtk_object_set_data (GTK_OBJECT (mi), "sig", sig);
- gtk_menu_append (GTK_MENU (menu_html), mi);
+ CORBA_exception_free (&ev);
+ bonobo_object_unref (BONOBO_OBJECT (stream));
}
}
static void
-sig_select_text_sig (MailAccountGui *gui)
+exit_dialog_cb (int reply, ESignatureEditor *editor)
{
- gtk_option_menu_set_history (GTK_OPTION_MENU (gui->sig_option_text), sig_get_gui_index (gui, TRUE));
+ switch (reply) {
+ case REPLY_YES:
+ menu_file_save_cb (NULL, editor, NULL);
+ destroy_editor (editor);
+ break;
+ case REPLY_NO:
+ destroy_editor (editor);
+ break;
+ case REPLY_CANCEL:
+ default:
+ }
}
static void
-sig_select_html_sig (MailAccountGui *gui)
+do_exit (ESignatureEditor *editor)
{
- gtk_option_menu_set_history (GTK_OPTION_MENU (gui->sig_option_html), sig_get_gui_index (gui, FALSE));
+ if (editor->has_changed) {
+ GtkWidget *dialog;
+ GtkWidget *label;
+ gint button;
+
+ dialog = gnome_dialog_new (_("Save signature"),
+ GNOME_STOCK_BUTTON_YES, /* Save */
+ GNOME_STOCK_BUTTON_NO, /* Don't save */
+ GNOME_STOCK_BUTTON_CANCEL, /* Cancel */
+ NULL);
+
+ label = gtk_label_new (_("This signature has been changed, but hasn't been saved.\n"
+ "\nDo you wish to save your changes?"));
+ gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), label, TRUE, TRUE, 0);
+ gtk_widget_show (label);
+ gnome_dialog_set_parent (GNOME_DIALOG (dialog), GTK_WINDOW (editor->win));
+ gnome_dialog_set_default (GNOME_DIALOG (dialog), 0);
+ button = gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
+
+ exit_dialog_cb (button, editor);
+ } else
+ destroy_editor (editor);
}
-static void
-sig_changed_text (GtkWidget *w, MailAccountGui *gui)
+static int
+delete_event_cb (GtkWidget *w, GdkEvent *event, ESignatureEditor *editor)
{
- GtkWidget *active;
- int index;
-
- active = gtk_menu_get_active (GTK_MENU (w));
- index = g_list_index (GTK_MENU_SHELL (w)->children, active);
-
- gui->text_signature = (MailConfigSignature *) gtk_object_get_data (GTK_OBJECT (active), "sig");
- gui->text_random = index == 1;
-
- gtk_widget_set_sensitive (GTK_WIDGET (gui->sig_edit_text), gui->text_signature != NULL);
+ do_exit (editor);
}
static void
-sig_changed_html (GtkWidget *w, MailAccountGui *gui)
+menu_file_close_cb (BonoboUIComponent *uic, gpointer data, const gchar *path)
{
- GtkWidget *active;
- int index;
-
- active = gtk_menu_get_active (GTK_MENU (w));
- index = g_list_index (GTK_MENU_SHELL (w)->children, active);
-
- gui->html_signature = (MailConfigSignature *) gtk_object_get_data (GTK_OBJECT (active), "sig");
- gui->html_random = index == 1;
+ ESignatureEditor *editor;
- gtk_widget_set_sensitive (GTK_WIDGET (gui->sig_edit_html), gui->html_signature != NULL);
+ editor = E_SIGNATURE_EDITOR (data);
+ do_exit (editor);
}
static void
-sig_edit_text (GtkWidget *w, MailAccountGui *gui)
+menu_file_save_close_cb (BonoboUIComponent *uic, gpointer data, const gchar *path)
{
- MailConfigSignature *sig = gui->text_signature;
+ ESignatureEditor *editor;
- if (!sig)
- return;
-
- if (sig->filename && *sig->filename)
- mail_signature_editor (sig);
- else
- e_notice (NULL, GNOME_MESSAGE_BOX_ERROR,
- _("Please specify signature filename\nin Andvanced section of signature settings."));
-}
+ editor = E_SIGNATURE_EDITOR (data);
-static void
-sig_edit_html (GtkWidget *w, MailAccountGui *gui)
-{
- MailConfigSignature *sig = gui->html_signature;
-
- if (!sig)
- return;
-
- if (sig->filename && *sig->filename)
- mail_signature_editor (sig);
- else
- e_notice (NULL, GNOME_MESSAGE_BOX_ERROR,
- _("Please specify signature filename\nin Andvanced section of signature settings."));
+ menu_file_save_cb (uic, editor, path);
+ destroy_editor (editor);
}
-static void
-sig_switch_to_list (GtkWidget *w, MailAccountGui *gui)
-{
- gtk_window_set_transient_for (GTK_WINDOW (gtk_widget_get_toplevel (w)), NULL);
- gdk_window_raise (GTK_WIDGET (gui->dialog)->window);
- gtk_notebook_set_page (GTK_NOTEBOOK (glade_xml_get_widget (gui->dialog->gui, "notebook")), 3);
-}
+static BonoboUIVerb verbs [] = {
+
+ BONOBO_UI_VERB ("FileSave", menu_file_save_cb),
+ BONOBO_UI_VERB ("FileClose", menu_file_close_cb),
+ BONOBO_UI_VERB ("FileSaveClose", menu_file_save_close_cb),
+
+ BONOBO_UI_VERB_END
+};
static void
-sig_set_and_write (MailAccountGui *gui)
+load_signature (ESignatureEditor *editor)
{
- gui->account->id->text_signature = gui->text_signature;
- gui->account->id->text_random = gui->text_random;
- gui->account->id->html_signature = gui->html_signature;
- gui->account->id->html_random = gui->html_random;
+ CORBA_Environment ev;
- mail_config_write_account_sig (gui->account, -1);
+ if (editor->html) {
+ Bonobo_PersistFile pfile_iface;
+
+ pfile_iface = bonobo_object_client_query_interface (bonobo_widget_get_server (BONOBO_WIDGET (editor->control)),
+ "IDL:Bonobo/PersistFile:1.0", NULL);
+ CORBA_exception_init (&ev);
+ Bonobo_PersistFile_load (pfile_iface, editor->filename, &ev);
+ CORBA_exception_free (&ev);
+ } else {
+ Bonobo_PersistStream pstream_iface;
+ BonoboStream *stream;
+ gchar *data, *html;
+
+ data = e_msg_composer_get_sig_file_content (editor->filename, FALSE);
+ html = g_strdup_printf ("<PRE>\n%s", data);
+ g_free (data);
+
+ pstream_iface = bonobo_object_client_query_interface
+ (bonobo_widget_get_server (BONOBO_WIDGET (editor->control)),
+ "IDL:Bonobo/PersistStream:1.0", NULL);
+ CORBA_exception_init (&ev);
+ stream = bonobo_stream_mem_create (html, strlen (html), TRUE, FALSE);
+
+ if (stream == NULL) {
+ g_warning ("Couldn't create memory stream\n");
+ } else {
+ BonoboObject *stream_object;
+ Bonobo_Stream corba_stream;
+
+ stream_object = BONOBO_OBJECT (stream);
+ corba_stream = bonobo_object_corba_objref (stream_object);
+ Bonobo_PersistStream_load (pstream_iface, corba_stream,
+ "text/html", &ev);
+ }
+
+ Bonobo_Unknown_unref (pstream_iface, &ev);
+ CORBA_Object_release (pstream_iface, &ev);
+ CORBA_exception_free (&ev);
+ bonobo_object_unref (BONOBO_OBJECT (stream));
+
+ g_free (html);
+ }
}
static void
-sig_new_text (GtkWidget *w, MailAccountGui *gui)
+launch_signature_editor (MailAccountGui *gui, const gchar *filename, gboolean html)
{
-#if 0
- if (!gui->dialog)
- return;
-
- sig_switch_to_list (w, gui);
+ ESignatureEditor *editor;
+ BonoboUIComponent *component;
+ BonoboUIContainer *container;
+ gchar *title;
- gui->text_signature = mail_composer_prefs_new_signature (gui->dialog, FALSE);
- gui->text_random = FALSE;
+ if (!filename || !*filename)
+ return;
- gtk_option_menu_set_history (GTK_OPTION_MENU (gui->sig_option_text), sig_get_index (gui->text_signature));
+ editor = g_new0 (ESignatureEditor, 1);
- sig_set_and_write (gui);
- gtk_widget_set_sensitive (gui->sig_edit_text, TRUE);
-#endif
-}
+ editor->html = html;
+ editor->filename = g_strdup (filename);
+ editor->has_changed = TRUE;
-static void
-sig_new_html (GtkWidget *w, MailAccountGui *gui)
-{
-#if 0
- if (!gui->dialog)
- return;
+ title = g_strdup_printf ("Edit %ssignature (%s)", html ? "HTML " : "", filename);
+ editor->win = bonobo_window_new ("e-sig-editor", title);
+ editor->gui = gui;
+ gtk_window_set_default_size (GTK_WINDOW (editor->win), DEFAULT_WIDTH, DEFAULT_HEIGHT);
+ gtk_window_set_policy (GTK_WINDOW (editor->win), FALSE, TRUE, FALSE);
+ gtk_window_set_modal (GTK_WINDOW (editor->win), TRUE);
+ g_free (title);
- sig_switch_to_list (w, gui);
+ container = bonobo_ui_container_new ();
+ bonobo_ui_container_set_win (container, BONOBO_WINDOW (editor->win));
- gui->html_signature = mail_accounts_dialog_new_signature (gui->dialog, TRUE);
- gui->html_random = FALSE;
+ component = bonobo_ui_component_new_default ();
+ bonobo_ui_component_set_container (component, bonobo_object_corba_objref (BONOBO_OBJECT (container)));
+ bonobo_ui_component_add_verb_list_with_data (component, verbs, editor);
+ bonobo_ui_util_set_ui (component, EVOLUTION_DATADIR, "evolution-signature-editor.xml", "evolution-signature-editor");
- gtk_option_menu_set_history (GTK_OPTION_MENU (gui->sig_option_html), sig_get_index (gui->html_signature));
+ editor->control = bonobo_widget_new_control ("OAFIID:GNOME_GtkHTML_Editor",
+ bonobo_ui_component_get_container (component));
- sig_set_and_write (gui);
- gtk_widget_set_sensitive (gui->sig_edit_html, TRUE);
-#endif
+ if (editor->control == NULL) {
+ g_warning ("Cannot get 'OAFIID:GNOME_GtkHTML_Editor'.");
+
+ destroy_editor (editor);
+ return;
+ }
+
+ load_signature (editor);
+
+ gtk_signal_connect (GTK_OBJECT (editor->win), "delete_event",
+ GTK_SIGNAL_FUNC (delete_event_cb), editor);
+
+ bonobo_window_set_contents (BONOBO_WINDOW (editor->win), editor->control);
+ bonobo_widget_set_property (BONOBO_WIDGET (editor->control), "FormatHTML", html, NULL);
+ gtk_widget_show (GTK_WIDGET (editor->win));
+ gtk_widget_show (GTK_WIDGET (editor->control));
+ gtk_widget_grab_focus (editor->control);
}
static void
-setup_signatures (MailAccountGui *gui)
+edit_signature (GtkWidget *w, MailAccountGui *gui)
{
- gui->text_signature = gui->account->id->text_signature;
- gui->text_random = gui->account->id->text_random;
- gui->html_signature = gui->account->id->html_signature;
- gui->html_random = gui->account->id->html_random;
-
- sig_select_text_sig (gui);
- sig_select_html_sig (gui);
-
- gtk_widget_set_sensitive (GTK_WIDGET (gui->sig_edit_text), gui->text_signature != NULL);
- gtk_widget_set_sensitive (GTK_WIDGET (gui->sig_edit_html), gui->html_signature != NULL);
+ launch_signature_editor (gui, gtk_entry_get_text (GTK_ENTRY (gnome_file_entry_gtk_entry (gui->signature))), FALSE);
}
static void
-sig_event_client (MailConfigSigEvent event, MailConfigSignature *sig, MailAccountGui *gui)
+edit_html_signature (GtkWidget *w, MailAccountGui *gui)
{
- switch (event) {
- case MAIL_CONFIG_SIG_EVENT_ADDED: {
- GtkWidget *menu;
- GtkWidget *mi;
-
- d(printf ("accounts ADDED\n"));
- mi = gtk_menu_item_new_with_label (sig->name);
- gtk_object_set_data (GTK_OBJECT (mi), "sig", sig);
- gtk_widget_show (mi);
- menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (gui->sig_option_text));
- gtk_menu_append (GTK_MENU (menu), mi);
-
- mi = gtk_menu_item_new_with_label (sig->name);
- gtk_object_set_data (GTK_OBJECT (mi), "sig", sig);
- gtk_widget_show (mi);
- menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (gui->sig_option_html));
- gtk_menu_append (GTK_MENU (GTK_MENU (menu)), mi);
-
- break;
- }
- case MAIL_CONFIG_SIG_EVENT_NAME_CHANGED: {
- GtkWidget *menu;
- GtkWidget *mi;
-
- d(printf ("gui NAME CHANGED\n"));
- menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (gui->sig_option_text));
- gtk_widget_ref (menu);
- gtk_option_menu_remove_menu (GTK_OPTION_MENU (gui->sig_option_text));
- mi = g_list_nth_data (GTK_MENU_SHELL (menu)->children, sig_get_index (sig));
- gtk_label_set_text (GTK_LABEL (GTK_BIN (mi)->child), sig->name);
- gtk_option_menu_set_menu (GTK_OPTION_MENU (gui->sig_option_text), menu);
- gtk_widget_unref (menu);
- gtk_option_menu_set_history (GTK_OPTION_MENU (gui->sig_option_text), sig_get_gui_index (gui, TRUE));
-
- menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (gui->sig_option_html));
- gtk_widget_ref (menu);
- gtk_option_menu_remove_menu (GTK_OPTION_MENU (gui->sig_option_html));
- mi = g_list_nth_data (GTK_MENU_SHELL (menu)->children, sig_get_index (sig));
- gtk_label_set_text (GTK_LABEL (GTK_BIN (mi)->child), sig->name);
- gtk_option_menu_set_menu (GTK_OPTION_MENU (gui->sig_option_html), menu);
- gtk_widget_unref (menu);
- gtk_option_menu_set_history (GTK_OPTION_MENU (gui->sig_option_html), sig_get_gui_index (gui, FALSE));
-
- break;
- }
- case MAIL_CONFIG_SIG_EVENT_DELETED: {
- GtkWidget *menu;
- GtkWidget *mi;
-
- d(printf ("gui DELETED\n"));
-
- if (sig == gui->text_signature) {
- gui->text_signature = NULL;
- gtk_option_menu_set_history (GTK_OPTION_MENU (gui->sig_option_text),
- sig_get_gui_index (gui, TRUE));
- }
-
- if (sig == gui->html_signature) {
- gui->html_signature = NULL;
- gtk_option_menu_set_history (GTK_OPTION_MENU (gui->sig_option_html),
- sig_get_gui_index (gui, FALSE));
- }
-
- menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (gui->sig_option_text));
- mi = g_list_nth_data (GTK_MENU_SHELL (menu)->children, sig_get_index (sig));
- gtk_container_remove (GTK_CONTAINER (menu), mi);
-
- menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (gui->sig_option_html));
- mi = g_list_nth_data (GTK_MENU_SHELL (menu)->children, sig_get_index (sig));
- gtk_container_remove (GTK_CONTAINER (menu), mi);
+ launch_signature_editor (gui, gtk_entry_get_text (GTK_ENTRY (gnome_file_entry_gtk_entry (gui->html_signature))), TRUE);
+}
- break;
- }
- case MAIL_CONFIG_SIG_EVENT_RANDOM_ON: {
- GtkWidget *menu;
- GtkWidget *mi;
-
- d(printf ("gui RANDOM ON\n"));
-
- mi = gtk_menu_item_new_with_label (_("Random"));
- menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (gui->sig_option_text));
- gtk_menu_insert (GTK_MENU (menu), mi, 1);
- gtk_widget_show (mi);
-
- mi = gtk_menu_item_new_with_label (_("Random"));
- menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (gui->sig_option_html));
- gtk_menu_insert (GTK_MENU (menu), mi, 1);
- gtk_widget_show (mi);
-
- break;
- }
- case MAIL_CONFIG_SIG_EVENT_RANDOM_OFF: {
- GtkWidget *menu;
- GtkWidget *mi;
-
- d(printf ("gui RANDOM OFF\n"));
-
- if (gui->text_random) {
- gui->text_random = FALSE;
- gtk_option_menu_set_history (GTK_OPTION_MENU (gui->sig_option_text),
- sig_get_gui_index (gui, TRUE));
- }
-
- if (gui->html_random) {
- gui->html_random = FALSE;
- gtk_option_menu_set_history (GTK_OPTION_MENU (gui->sig_option_html),
- sig_get_gui_index (gui, FALSE));
- }
-
- menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (gui->sig_option_text));
- mi = g_list_nth_data (GTK_MENU_SHELL (menu)->children, 1);
- gtk_container_remove (GTK_CONTAINER (menu), mi);
-
- menu = gtk_option_menu_get_menu (GTK_OPTION_MENU (gui->sig_option_html));
- mi = g_list_nth_data (GTK_MENU_SHELL (menu)->children, 1);
- gtk_container_remove (GTK_CONTAINER (menu), mi);
-
- break;
- }
- default:
- ;
- }
+static void
+signature_changed (GtkWidget *entry, MailAccountGui *gui)
+{
+ gtk_widget_set_sensitive (GTK_WIDGET (gui->edit_signature),
+ *gtk_entry_get_text (GTK_ENTRY (gnome_file_entry_gtk_entry (gui->signature))) != 0);
}
static void
-prepare_signatures (MailAccountGui *gui)
+html_signature_changed (GtkWidget *entry, MailAccountGui *gui)
{
- gui->sig_option_text = glade_xml_get_widget (gui->xml, "option-sig-text");
- gui->sig_option_html = glade_xml_get_widget (gui->xml, "option-sig-html");
-
- sig_fill_options (gui);
-
- gtk_signal_connect (GTK_OBJECT (gtk_option_menu_get_menu (GTK_OPTION_MENU (gui->sig_option_text))),
- "selection-done", sig_changed_text, gui);
- gtk_signal_connect (GTK_OBJECT (gtk_option_menu_get_menu (GTK_OPTION_MENU (gui->sig_option_html))),
- "selection-done", sig_changed_html, gui);
-
- gui->sig_new_text = glade_xml_get_widget (gui->xml, "button-sig-new-text");
- gtk_signal_connect (GTK_OBJECT (gui->sig_new_text), "clicked", GTK_SIGNAL_FUNC (sig_new_text), gui);
- gui->sig_new_html = glade_xml_get_widget (gui->xml, "button-sig-new-html");
- gtk_signal_connect (GTK_OBJECT (gui->sig_new_html), "clicked", GTK_SIGNAL_FUNC (sig_new_html), gui);
- gui->sig_edit_text = glade_xml_get_widget (gui->xml, "button-sig-edit-text");
- gtk_signal_connect (GTK_OBJECT (gui->sig_edit_text), "clicked", GTK_SIGNAL_FUNC (sig_edit_text), gui);
- gui->sig_edit_html = glade_xml_get_widget (gui->xml, "button-sig-edit-html");
- gtk_signal_connect (GTK_OBJECT (gui->sig_edit_html), "clicked", GTK_SIGNAL_FUNC (sig_edit_html), gui);
-
- if (!gui->dialog) {
- gtk_widget_hide (glade_xml_get_widget (gui->xml, "label-sig-text"));
- gtk_widget_hide (glade_xml_get_widget (gui->xml, "label-sig-html"));
- gtk_widget_hide (gui->sig_option_text);
- gtk_widget_hide (gui->sig_option_html);
- gtk_widget_hide (gui->sig_new_text);
- gtk_widget_hide (gui->sig_new_html);
- gtk_widget_hide (gui->sig_edit_text);
- gtk_widget_hide (gui->sig_edit_html);
- } else {
- mail_config_signature_register_client ((MailConfigSignatureClient) sig_event_client, gui);
- }
+ gtk_widget_set_sensitive (GTK_WIDGET (gui->edit_html_signature),
+ *gtk_entry_get_text (GTK_ENTRY (gnome_file_entry_gtk_entry (gui->html_signature))) != 0);
}
MailAccountGui *
-mail_account_gui_new (MailConfigAccount *account, MailAccountsTab *dialog)
+mail_account_gui_new (MailConfigAccount *account)
{
MailAccountGui *gui;
- const char *allowed_types[] = { "mail", NULL };
gui = g_new0 (MailAccountGui, 1);
gui->account = account;
- gui->dialog = dialog;
gui->xml = glade_xml_new (EVOLUTION_GLADEDIR "/mail-config.glade", NULL);
/* Management */
@@ -1406,22 +1241,41 @@ mail_account_gui_new (MailConfigAccount *account, MailAccountsTab *dialog)
/* Identity */
gui->full_name = GTK_ENTRY (glade_xml_get_widget (gui->xml, "identity_full_name"));
gui->email_address = GTK_ENTRY (glade_xml_get_widget (gui->xml, "identity_address"));
- gui->reply_to = GTK_ENTRY (glade_xml_get_widget (gui->xml, "identity_reply_to"));
gui->organization = GTK_ENTRY (glade_xml_get_widget (gui->xml, "identity_organization"));
-
- prepare_signatures (gui);
+ gui->signature = GNOME_FILE_ENTRY (glade_xml_get_widget (gui->xml, "fileentry_signature"));
+ gui->html_signature = GNOME_FILE_ENTRY (glade_xml_get_widget (gui->xml, "fileentry_html_signature"));
+ gui->has_html_signature = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui->xml, "check_html_signature"));
+ gnome_file_entry_set_default_path (gui->signature, g_get_home_dir ());
+ gnome_file_entry_set_default_path (gui->html_signature, g_get_home_dir ());
+ gui->edit_signature = GTK_BUTTON (glade_xml_get_widget (gui->xml, "button_edit_signature"));
+ gtk_widget_set_sensitive (GTK_WIDGET (gui->edit_signature), FALSE);
+ gui->edit_html_signature = GTK_BUTTON (glade_xml_get_widget (gui->xml, "button_edit_html_signature"));
+ gtk_widget_set_sensitive (GTK_WIDGET (gui->edit_html_signature), FALSE);
+
+ gtk_signal_connect (GTK_OBJECT (gnome_file_entry_gtk_entry (gui->signature)), "changed", signature_changed, gui);
+ gtk_signal_connect (GTK_OBJECT (gnome_file_entry_gtk_entry (gui->html_signature)), "changed",
+ html_signature_changed, gui);
+ gtk_signal_connect (GTK_OBJECT (gui->edit_signature), "clicked", edit_signature, gui);
+ gtk_signal_connect (GTK_OBJECT (gui->edit_html_signature), "clicked", edit_html_signature, gui);
if (account->id) {
if (account->id->name)
e_utf8_gtk_entry_set_text (gui->full_name, account->id->name);
if (account->id->address)
gtk_entry_set_text (gui->email_address, account->id->address);
- if (account->id->reply_to)
- gtk_entry_set_text (gui->reply_to, account->id->reply_to);
if (account->id->organization)
e_utf8_gtk_entry_set_text (gui->organization, account->id->organization);
-
- setup_signatures (gui);
+ if (account->id->signature) {
+ gnome_file_entry_set_default_path (gui->signature, account->id->signature);
+ gtk_entry_set_text (GTK_ENTRY (gnome_file_entry_gtk_entry (gui->signature)),
+ account->id->signature);
+ }
+ if (account->id->html_signature) {
+ gnome_file_entry_set_default_path (gui->html_signature, account->id->html_signature);
+ gtk_entry_set_text (GTK_ENTRY (gnome_file_entry_gtk_entry (gui->html_signature)),
+ account->id->html_signature);
+ }
+ gtk_toggle_button_set_active (gui->has_html_signature, account->id->has_html_signature);
}
/* Source */
@@ -1437,9 +1291,7 @@ mail_account_gui_new (MailConfigAccount *account, MailAccountsTab *dialog)
gui->source.path = GTK_ENTRY (glade_xml_get_widget (gui->xml, "source_path"));
gtk_signal_connect (GTK_OBJECT (gui->source.path), "changed",
GTK_SIGNAL_FUNC (service_changed), &gui->source);
- gui->source.ssl_hbox = glade_xml_get_widget (gui->xml, "source_ssl_hbox");
- gui->source.use_ssl = GTK_OPTION_MENU (glade_xml_get_widget (gui->xml, "source_use_ssl"));
- construct_ssl_menu (&gui->source);
+ gui->source.use_ssl = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui->xml, "source_use_ssl"));
gui->source.no_ssl = glade_xml_get_widget (gui->xml, "source_ssl_disabled");
gui->source.authtype = GTK_OPTION_MENU (glade_xml_get_widget (gui->xml, "source_auth_omenu"));
gui->source.remember = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui->xml, "source_remember_password"));
@@ -1459,9 +1311,7 @@ mail_account_gui_new (MailConfigAccount *account, MailAccountsTab *dialog)
gui->transport.username = GTK_ENTRY (glade_xml_get_widget (gui->xml, "transport_user"));
gtk_signal_connect (GTK_OBJECT (gui->transport.username), "changed",
GTK_SIGNAL_FUNC (service_changed), &gui->transport);
- gui->transport.ssl_hbox = glade_xml_get_widget (gui->xml, "transport_ssl_hbox");
- gui->transport.use_ssl = GTK_OPTION_MENU (glade_xml_get_widget (gui->xml, "transport_use_ssl"));
- construct_ssl_menu (&gui->transport);
+ gui->transport.use_ssl = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui->xml, "transport_use_ssl"));
gui->transport.no_ssl = glade_xml_get_widget (gui->xml, "transport_ssl_disabled");
gui->transport_needs_auth = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui->xml, "transport_needs_auth"));
gtk_signal_connect (GTK_OBJECT (gui->transport_needs_auth), "toggled", transport_needs_auth_toggled, gui);
@@ -1473,43 +1323,29 @@ mail_account_gui_new (MailConfigAccount *account, MailAccountsTab *dialog)
/* Drafts folder */
gui->drafts_folder_button = GTK_BUTTON (glade_xml_get_widget (gui->xml, "drafts_button"));
- gtk_signal_connect (GTK_OBJECT (gui->drafts_folder_button), "selected",
- GTK_SIGNAL_FUNC (folder_selected), &gui->drafts_folder_uri);
- if (account->drafts_folder_uri)
- gui->drafts_folder_uri = g_strdup (account->drafts_folder_uri);
- else
- gui->drafts_folder_uri = g_strdup (default_drafts_folder_uri);
- evolution_folder_selector_button_construct (EVOLUTION_FOLDER_SELECTOR_BUTTON (gui->drafts_folder_button),
- global_shell_client,
- _("Select Folder"),
- gui->drafts_folder_uri,
- allowed_types);
+ gtk_signal_connect (GTK_OBJECT (gui->drafts_folder_button), "clicked",
+ GTK_SIGNAL_FUNC (folder_picker_clicked), &gui->drafts_folder);
+ if (account->drafts_folder_uri) {
+ gui->drafts_folder.uri = g_strdup (account->drafts_folder_uri);
+ gui->drafts_folder.name = g_strdup (account->drafts_folder_name);
+ } else {
+ gui->drafts_folder.uri = g_strdup (default_drafts_folder_uri);
+ gui->drafts_folder.name = g_strdup (strrchr (default_drafts_folder_uri, '/') + 1);
+ }
+ set_folder_picker_label (gui->drafts_folder_button, gui->drafts_folder.name);
/* Sent folder */
gui->sent_folder_button = GTK_BUTTON (glade_xml_get_widget (gui->xml, "sent_button"));
- gtk_signal_connect (GTK_OBJECT (gui->sent_folder_button), "selected",
- GTK_SIGNAL_FUNC (folder_selected), &gui->sent_folder_uri);
- if (account->sent_folder_uri)
- gui->sent_folder_uri = g_strdup (account->sent_folder_uri);
- else
- gui->sent_folder_uri = g_strdup (default_sent_folder_uri);
- evolution_folder_selector_button_construct (EVOLUTION_FOLDER_SELECTOR_BUTTON (gui->sent_folder_button),
- global_shell_client,
- _("Select Folder"),
- gui->sent_folder_uri,
- allowed_types);
-
- /* Always Cc */
- gui->always_cc = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui->xml, "always_cc"));
- gtk_toggle_button_set_active (gui->always_cc, account->always_cc);
- gui->cc_addrs = GTK_ENTRY (glade_xml_get_widget (gui->xml, "cc_addrs"));
- e_utf8_gtk_entry_set_text (gui->cc_addrs, account->cc_addrs);
-
- /* Always Bcc */
- gui->always_bcc = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui->xml, "always_bcc"));
- gtk_toggle_button_set_active (gui->always_bcc, account->always_bcc);
- gui->bcc_addrs = GTK_ENTRY (glade_xml_get_widget (gui->xml, "bcc_addrs"));
- e_utf8_gtk_entry_set_text (gui->bcc_addrs, account->bcc_addrs);
+ gtk_signal_connect (GTK_OBJECT (gui->sent_folder_button), "clicked",
+ GTK_SIGNAL_FUNC (folder_picker_clicked), &gui->sent_folder);
+ if (account->sent_folder_uri) {
+ gui->sent_folder.uri = g_strdup (account->sent_folder_uri);
+ gui->sent_folder.name = g_strdup (account->sent_folder_name);
+ } else {
+ gui->sent_folder.uri = g_strdup (default_sent_folder_uri);
+ gui->sent_folder.name = g_strdup (strrchr (default_sent_folder_uri, '/') + 1);
+ }
+ set_folder_picker_label (gui->sent_folder_button, gui->sent_folder.name);
/* Security */
gui->pgp_key = GTK_ENTRY (glade_xml_get_widget (gui->xml, "pgp_key"));
@@ -1519,8 +1355,6 @@ mail_account_gui_new (MailConfigAccount *account, MailAccountsTab *dialog)
gtk_toggle_button_set_active (gui->pgp_encrypt_to_self, account->pgp_encrypt_to_self);
gui->pgp_always_sign = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui->xml, "pgp_always_sign"));
gtk_toggle_button_set_active (gui->pgp_always_sign, account->pgp_always_sign);
-
-#if defined (HAVE_NSS) && defined (SMIME_SUPPORTED)
gui->smime_key = GTK_ENTRY (glade_xml_get_widget (gui->xml, "smime_key"));
if (account->smime_key)
e_utf8_gtk_entry_set_text (gui->smime_key, account->smime_key);
@@ -1528,15 +1362,16 @@ mail_account_gui_new (MailConfigAccount *account, MailAccountsTab *dialog)
gtk_toggle_button_set_active (gui->smime_encrypt_to_self, account->smime_encrypt_to_self);
gui->smime_always_sign = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui->xml, "smime_always_sign"));
gtk_toggle_button_set_active (gui->smime_always_sign, account->smime_always_sign);
-#else
+
+#if !defined(HAVE_NSS) || !defined(SMIME_SUPPORTED)
{
/* Since we don't have NSS, hide the S/MIME config options */
GtkWidget *frame;
frame = glade_xml_get_widget (gui->xml, "smime_frame");
- gtk_widget_destroy (frame);
+ gtk_widget_set_sensitive (frame, FALSE);
}
-#endif /* HAVE_NSS && SMIME_SUPPORTED */
+#endif
return gui;
}
@@ -1581,11 +1416,7 @@ mail_account_gui_setup (MailAccountGui *gui, GtkWidget *top)
item = NULL;
if (provider->object_types[CAMEL_PROVIDER_STORE] && provider->flags & CAMEL_PROVIDER_IS_SOURCE) {
item = gtk_menu_item_new_with_label (provider->name);
- gtk_object_set_data (GTK_OBJECT (gui->source.type),
- provider->protocol, item);
gtk_object_set_data (GTK_OBJECT (item), "provider", provider);
- gtk_object_set_data (GTK_OBJECT (item), "number",
- GUINT_TO_POINTER (si));
gtk_signal_connect (GTK_OBJECT (item), "activate",
GTK_SIGNAL_FUNC (source_type_changed),
gui);
@@ -1609,11 +1440,7 @@ mail_account_gui_setup (MailAccountGui *gui, GtkWidget *top)
if (provider->object_types[CAMEL_PROVIDER_TRANSPORT]) {
item = gtk_menu_item_new_with_label (provider->name);
- gtk_object_set_data (GTK_OBJECT (gui->transport.type),
- provider->protocol, item);
gtk_object_set_data (GTK_OBJECT (item), "provider", provider);
- gtk_object_set_data (GTK_OBJECT (item), "number",
- GUINT_TO_POINTER (ti));
gtk_signal_connect (GTK_OBJECT (item), "activate",
GTK_SIGNAL_FUNC (transport_type_changed),
gui);
@@ -1621,9 +1448,6 @@ mail_account_gui_setup (MailAccountGui *gui, GtkWidget *top)
gtk_menu_append (GTK_MENU (transports), item);
gtk_widget_show (item);
-
- if (CAMEL_PROVIDER_IS_STORE_AND_TRANSPORT (provider))
- gtk_widget_set_sensitive (item, FALSE);
if (!ftransport) {
ftransport = item;
@@ -1707,10 +1531,10 @@ mail_account_gui_setup (MailAccountGui *gui, GtkWidget *top)
}
if (fstore)
- gtk_signal_emit_by_name (GTK_OBJECT (fstore), "activate");
+ gtk_signal_emit_by_name (GTK_OBJECT (fstore), "activate", gui);
if (ftransport)
- gtk_signal_emit_by_name (GTK_OBJECT (ftransport), "activate");
+ gtk_signal_emit_by_name (GTK_OBJECT (ftransport), "activate", gui);
if (source_proto) {
setup_service (&gui->source, gui->account->source);
@@ -1785,14 +1609,8 @@ save_service (MailAccountGuiService *gsvc, GHashTable *extra_config,
}
if (gsvc->provider->flags & CAMEL_PROVIDER_SUPPORTS_SSL) {
- const char *use_ssl;
-
- use_ssl = gtk_object_get_data (GTK_OBJECT (gsvc->ssl_selected), "use_ssl");
-
- /* set the value to either "always" or "when-possible"
- but don't bother setting it for "never" */
- if (strcmp (use_ssl, "never"))
- camel_url_set_param (url, "use_ssl", use_ssl);
+ if (gtk_toggle_button_get_active (gsvc->use_ssl))
+ camel_url_set_param (url, "use_ssl", "");
}
if (extra_config)
@@ -1815,7 +1633,7 @@ mail_account_gui_save (MailAccountGui *gui)
const MailConfigAccount *old_account;
CamelProvider *provider = NULL;
CamelURL *source_url = NULL, *url;
- char *new_name;
+ gchar *new_name;
gboolean old_enabled;
if (!mail_account_gui_identity_complete (gui, NULL) ||
@@ -1845,16 +1663,16 @@ mail_account_gui_save (MailAccountGui *gui)
account->id = g_new0 (MailConfigIdentity, 1);
account->id->name = e_utf8_gtk_entry_get_text (gui->full_name);
account->id->address = e_utf8_gtk_entry_get_text (gui->email_address);
- account->id->reply_to = e_utf8_gtk_entry_get_text (gui->reply_to);
account->id->organization = e_utf8_gtk_entry_get_text (gui->organization);
-
- sig_set_and_write (gui);
+ account->id->signature = gnome_file_entry_get_full_path (gui->signature, TRUE);
+ account->id->html_signature = gnome_file_entry_get_full_path (gui->html_signature, TRUE);
+ account->id->has_html_signature = gtk_toggle_button_get_active (gui->has_html_signature);
old_enabled = account->source && account->source->enabled;
service_destroy (account->source);
account->source = g_new0 (MailConfigService, 1);
save_service (&gui->source, gui->extra_config, account->source);
- if (account->source->url) {
+ if (account->source && account->source->url) {
provider = camel_session_get_provider (session, account->source->url, NULL);
source_url = provider ? camel_url_new (account->source->url, NULL) : NULL;
@@ -1867,19 +1685,20 @@ mail_account_gui_save (MailAccountGui *gui)
service_destroy (account->transport);
account->transport = g_new0 (MailConfigService, 1);
- if (CAMEL_PROVIDER_IS_STORE_AND_TRANSPORT (gui->transport.provider))
- save_service (&gui->transport, gui->extra_config, account->transport);
- else
- save_service (&gui->transport, NULL, account->transport);
+ save_service (&gui->transport, NULL, account->transport);
/* Check to make sure that the Drafts folder uri is "valid" before assigning it */
- url = source_url && gui->drafts_folder_uri ? camel_url_new (gui->drafts_folder_uri, NULL) : NULL;
- if (mail_config_get_account_by_source_url (gui->drafts_folder_uri) ||
+ url = source_url && gui->drafts_folder.uri ? camel_url_new (gui->drafts_folder.uri, NULL) : NULL;
+ if (mail_config_get_account_by_source_url (gui->drafts_folder.uri) ||
(url && provider->url_equal (source_url, url))) {
+ g_free (account->drafts_folder_name);
+ account->drafts_folder_name = g_strdup (gui->drafts_folder.name);
g_free (account->drafts_folder_uri);
- account->drafts_folder_uri = g_strdup (gui->drafts_folder_uri);
+ account->drafts_folder_uri = g_strdup (gui->drafts_folder.uri);
} else {
/* assign defaults - the uri is unknown to us (probably pointed to an old source url) */
+ g_free (account->drafts_folder_name);
+ account->drafts_folder_name = g_strdup (strrchr (default_drafts_folder_uri, '/') + 1);
g_free (account->drafts_folder_uri);
account->drafts_folder_uri = g_strdup (default_drafts_folder_uri);
}
@@ -1888,13 +1707,17 @@ mail_account_gui_save (MailAccountGui *gui)
camel_url_free (url);
/* Check to make sure that the Sent folder uri is "valid" before assigning it */
- url = source_url && gui->sent_folder_uri ? camel_url_new (gui->sent_folder_uri, NULL) : NULL;
- if (mail_config_get_account_by_source_url (gui->sent_folder_uri) ||
+ url = source_url && gui->sent_folder.uri ? camel_url_new (gui->sent_folder.uri, NULL) : NULL;
+ if (mail_config_get_account_by_source_url (gui->sent_folder.uri) ||
(url && provider->url_equal (source_url, url))) {
+ g_free (account->sent_folder_name);
+ account->sent_folder_name = g_strdup (gui->sent_folder.name);
g_free (account->sent_folder_uri);
- account->sent_folder_uri = g_strdup (gui->sent_folder_uri);
+ account->sent_folder_uri = g_strdup (gui->sent_folder.uri);
} else {
/* assign defaults - the uri is unknown to us (probably pointed to an old source url) */
+ g_free (account->sent_folder_name);
+ account->sent_folder_name = g_strdup (strrchr (default_sent_folder_uri, '/') + 1);
g_free (account->sent_folder_uri);
account->sent_folder_uri = g_strdup (default_sent_folder_uri);
}
@@ -1905,22 +1728,14 @@ mail_account_gui_save (MailAccountGui *gui)
if (source_url)
camel_url_free (source_url);
- account->always_cc = gtk_toggle_button_get_active (gui->always_cc);
- account->cc_addrs = e_utf8_gtk_entry_get_text (gui->cc_addrs);
- account->always_bcc = gtk_toggle_button_get_active (gui->always_bcc);
- account->bcc_addrs = e_utf8_gtk_entry_get_text (gui->bcc_addrs);
-
g_free (account->pgp_key);
account->pgp_key = e_utf8_gtk_entry_get_text (gui->pgp_key);
account->pgp_encrypt_to_self = gtk_toggle_button_get_active (gui->pgp_encrypt_to_self);
account->pgp_always_sign = gtk_toggle_button_get_active (gui->pgp_always_sign);
-
-#if defined (HAVE_NSS) && defined (SMIME_SUPPORTED)
g_free (account->smime_key);
account->smime_key = e_utf8_gtk_entry_get_text (gui->smime_key);
account->smime_encrypt_to_self = gtk_toggle_button_get_active (gui->smime_encrypt_to_self);
account->smime_always_sign = gtk_toggle_button_get_active (gui->smime_always_sign);
-#endif /* HAVE_NSS && SMIME_SUPPORTED */
if (!mail_config_find_account (account))
mail_config_add_account (account);
@@ -1935,13 +1750,12 @@ mail_account_gui_save (MailAccountGui *gui)
void
mail_account_gui_destroy (MailAccountGui *gui)
{
- if (gui->dialog)
- mail_config_signature_unregister_client ((MailConfigSignatureClient) sig_event_client, gui);
-
gtk_object_unref (GTK_OBJECT (gui->xml));
if (gui->extra_config)
g_hash_table_destroy (gui->extra_config);
- g_free (gui->drafts_folder_uri);
- g_free (gui->sent_folder_uri);
+ g_free (gui->drafts_folder.name);
+ g_free (gui->drafts_folder.uri);
+ g_free (gui->sent_folder.name);
+ g_free (gui->sent_folder.uri);
g_free (gui);
}
diff --git a/mail/mail-accounts.c b/mail/mail-accounts.c
index 7090b06155..2b386e1b11 100644
--- a/mail/mail-accounts.c
+++ b/mail/mail-accounts.c
@@ -2,210 +2,292 @@
/*
* Authors: Jeffrey Stedfast <fejj@ximian.com>
*
- * Copyright 2002 Ximian, Inc. (www.ximian.com)
+ * Copyright 2001 Ximian, Inc. (www.ximian.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 free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
*
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
*
- * You should have 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.
+ * You should have received a copy of the GNU General Public
+ * License along with this program; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
*
*/
-
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
-#include "mail-accounts.h"
-
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
#include <libgnomeui/gnome-stock.h>
#include <libgnomeui/gnome-messagebox.h>
-#include <gal/e-table/e-table-memory-store.h>
-#include <gal/e-table/e-table-scrolled.h>
-#include <gal/e-table/e-cell-toggle.h>
-#include <gal/util/e-unicode-i18n.h>
-#include <gal/widgets/e-unicode.h>
#include <camel/camel-url.h>
+#include <camel/camel-pgp-context.h>
+
+#include <gal/widgets/e-unicode.h>
-#include <bonobo/bonobo-generic-factory.h>
+#include "widgets/misc/e-charset-picker.h"
#include "mail.h"
+#include "mail-accounts.h"
#include "mail-config.h"
#include "mail-config-druid.h"
#include "mail-account-editor.h"
+#ifdef ENABLE_NNTP
#include "mail-account-editor-news.h"
+#endif
#include "mail-send-recv.h"
-
-#include "art/mail-new.xpm"
-#include "art/mail-read.xpm"
+#include "mail-session.h"
#include "art/mark.xpm"
-#define USE_ETABLE 0
+static void mail_accounts_dialog_class_init (MailAccountsDialogClass *class);
+static void mail_accounts_dialog_init (MailAccountsDialog *dialog);
+static void mail_accounts_dialog_finalise (GtkObject *obj);
+static void mail_unselect (GtkCList *clist, gint row, gint column, GdkEventButton *event, gpointer data);
-static void mail_accounts_tab_class_init (MailAccountsTabClass *class);
-static void mail_accounts_tab_init (MailAccountsTab *prefs);
-static void mail_accounts_tab_finalise (GtkObject *obj);
-
-static void mail_accounts_load (MailAccountsTab *tab);
-
-static GdkPixbuf *disabled_pixbuf = NULL;
-static GdkPixbuf *enabled_pixbuf = NULL;
-
-static GtkVBoxClass *parent_class = NULL;
+static MailConfigDruid *druid = NULL;
+static MailAccountEditor *editor = NULL;
+#ifdef ENABLE_NNTP
+static MailAccountEditorNews *news_editor = NULL;
+#endif
+static GnomeDialogClass *parent_class;
GtkType
-mail_accounts_tab_get_type (void)
+mail_accounts_dialog_get_type ()
{
static GtkType type = 0;
if (!type) {
GtkTypeInfo type_info = {
- "MailAccountsTab",
- sizeof (MailAccountsTab),
- sizeof (MailAccountsTabClass),
- (GtkClassInitFunc) mail_accounts_tab_class_init,
- (GtkObjectInitFunc) mail_accounts_tab_init,
+ "MailAccountsDialog",
+ sizeof (MailAccountsDialog),
+ sizeof (MailAccountsDialogClass),
+ (GtkClassInitFunc) mail_accounts_dialog_class_init,
+ (GtkObjectInitFunc) mail_accounts_dialog_init,
(GtkArgSetFunc) NULL,
(GtkArgGetFunc) NULL
};
- type = gtk_type_unique (gtk_vbox_get_type (), &type_info);
+ type = gtk_type_unique (gnome_dialog_get_type (), &type_info);
}
return type;
}
static void
-mail_accounts_tab_class_init (MailAccountsTabClass *klass)
+mail_accounts_dialog_class_init (MailAccountsDialogClass *class)
{
GtkObjectClass *object_class;
- object_class = (GtkObjectClass *) klass;
- parent_class = gtk_type_class (gtk_vbox_get_type ());
+ object_class = (GtkObjectClass *) class;
+ parent_class = gtk_type_class (gnome_dialog_get_type ());
- object_class->finalize = mail_accounts_tab_finalise;
+ object_class->finalize = mail_accounts_dialog_finalise;
/* override methods */
-
- /* setup static data */
- disabled_pixbuf = gdk_pixbuf_new_from_xpm_data ((const char **) mail_new_xpm);
- enabled_pixbuf = gdk_pixbuf_new_from_xpm_data ((const char **) mail_read_xpm);
}
static void
-mail_accounts_tab_init (MailAccountsTab *prefs)
+mail_accounts_dialog_init (MailAccountsDialog *o)
{
- prefs->druid = NULL;
- prefs->editor = NULL;
+ GdkPixbuf *pixbuf;
+
+ pixbuf = gdk_pixbuf_new_from_xpm_data ((const char **) mark_xpm);
+ gdk_pixbuf_render_pixmap_and_mask (pixbuf, &(o->mark_pixmap), &(o->mark_bitmap), 128);
+ gdk_pixbuf_unref (pixbuf);
}
static void
-mail_accounts_tab_finalise (GtkObject *obj)
+mail_accounts_dialog_finalise (GtkObject *obj)
{
- MailAccountsTab *prefs = (MailAccountsTab *) obj;
-
- gtk_object_unref (GTK_OBJECT (prefs->gui));
+ MailAccountsDialog *dialog = (MailAccountsDialog *) obj;
+ gtk_object_unref (GTK_OBJECT (dialog->gui));
+ gdk_pixmap_unref (dialog->mark_pixmap);
+ gdk_bitmap_unref (dialog->mark_bitmap);
+
((GtkObjectClass *)(parent_class))->finalize (obj);
}
static void
-account_add_finished (GtkWidget *widget, gpointer user_data)
+load_accounts (MailAccountsDialog *dialog)
+{
+ const MailConfigAccount *account, *default_account;
+ const GSList *node = dialog->accounts;
+ int i = 0;
+
+ gtk_clist_freeze (dialog->mail_accounts);
+
+ gtk_clist_clear (dialog->mail_accounts);
+
+ default_account = mail_config_get_default_account ();
+
+ while (node) {
+ CamelURL *url;
+ char *text[3];
+
+ account = node->data;
+
+ if (account->source && account->source->url)
+ url = camel_url_new (account->source->url, NULL);
+ else
+ url = NULL;
+
+ text[0] = "";
+ text[1] = e_utf8_to_gtk_string (GTK_WIDGET (dialog->mail_accounts), account->name);
+ text[2] = g_strdup_printf ("%s%s", url && url->protocol ? url->protocol : _("None"),
+ (account == default_account) ? _(" (default)") : "");
+
+ if (url)
+ camel_url_free (url);
+
+ gtk_clist_append (dialog->mail_accounts, text);
+ g_free (text[1]);
+ g_free (text[2]);
+
+ if (account->source->enabled)
+ gtk_clist_set_pixmap (dialog->mail_accounts, i, 0,
+ dialog->mark_pixmap,
+ dialog->mark_bitmap);
+
+ /* set the account on the row */
+ gtk_clist_set_row_data (dialog->mail_accounts, i, (gpointer) account);
+
+ node = node->next;
+ i++;
+ }
+
+ gtk_clist_thaw (dialog->mail_accounts);
+
+ /*
+ * The selection gets cleared when we rebuild the clist, but no
+ * unselect event is emitted. So we simulate it here.
+ * I hate the clist.
+ */
+ mail_unselect (dialog->mail_accounts, 0, 0, NULL, dialog);
+}
+
+
+/* mail callbacks */
+static void
+mail_select (GtkCList *clist, gint row, gint column, GdkEventButton *event, gpointer data)
+{
+ MailAccountsDialog *dialog = data;
+ MailConfigAccount *account = gtk_clist_get_row_data (clist, row);
+
+ dialog->accounts_row = row;
+ gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_edit), TRUE);
+ gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_delete), TRUE);
+ gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_default), TRUE);
+ gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_able), TRUE);
+ if (account->source && account->source->enabled)
+ gtk_label_set_text (GTK_LABEL (GTK_BIN (dialog->mail_able)->child), _("Disable"));
+ else
+ gtk_label_set_text (GTK_LABEL (GTK_BIN (dialog->mail_able)->child), _("Enable"));
+}
+
+static void
+mail_unselect (GtkCList *clist, gint row, gint column, GdkEventButton *event, gpointer data)
+{
+ MailAccountsDialog *dialog = data;
+
+ dialog->accounts_row = -1;
+ gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_edit), FALSE);
+ gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_delete), FALSE);
+ gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_default), FALSE);
+ gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_able), FALSE);
+
+ /*
+ * If an insensitive button in a button box has the focus, and if you hit tab,
+ * there is a segfault. I think that this might be a gtk bug. Anyway, this
+ * is a workaround.
+ */
+ gtk_widget_grab_focus (GTK_WIDGET (dialog->mail_add));
+}
+
+static void
+mail_add_finished (GtkWidget *widget, gpointer data)
{
/* Either Cancel or Finished was clicked in the druid so reload the accounts */
- MailAccountsTab *prefs = user_data;
+ MailAccountsDialog *dialog = data;
- prefs->druid = NULL;
- mail_accounts_load (prefs);
+ dialog->accounts = mail_config_get_accounts ();
+ load_accounts (dialog);
+ druid = NULL;
}
static void
-account_add_clicked (GtkButton *button, gpointer user_data)
+mail_add (GtkButton *button, gpointer data)
{
- MailAccountsTab *prefs = (MailAccountsTab *) user_data;
+ MailAccountsDialog *dialog = data;
- if (prefs->druid == NULL) {
- prefs->druid = (GtkWidget *) mail_config_druid_new (prefs->shell);
- gtk_signal_connect (GTK_OBJECT (prefs->druid), "destroy",
- GTK_SIGNAL_FUNC (account_add_finished), prefs);
+ if (druid == NULL) {
+ druid = mail_config_druid_new (dialog->shell);
+ gtk_signal_connect (GTK_OBJECT (druid), "destroy",
+ GTK_SIGNAL_FUNC (mail_add_finished), dialog);
- gtk_widget_show (prefs->druid);
+ gtk_widget_show (GTK_WIDGET (druid));
} else {
- gdk_window_raise (prefs->druid->window);
+ gdk_window_raise (GTK_WIDGET (druid)->window);
}
}
static void
-account_edit_finished (GtkWidget *widget, gpointer user_data)
+mail_editor_destroyed (GtkWidget *widget, gpointer data)
{
- MailAccountsTab *prefs = user_data;
-
- prefs->editor = NULL;
- mail_accounts_load (prefs);
+ load_accounts (MAIL_ACCOUNTS_DIALOG (data));
+ editor = NULL;
}
static void
-account_edit_clicked (GtkButton *button, gpointer user_data)
+mail_edit (GtkButton *button, gpointer data)
{
- MailAccountsTab *prefs = (MailAccountsTab *) user_data;
+ MailAccountsDialog *dialog = data;
- if (prefs->editor == NULL) {
- int row;
-#if USE_ETABLE
- row = e_table_get_cursor_row (prefs->table);
-#else
- row = prefs->table->selection ? GPOINTER_TO_INT (prefs->table->selection->data) : -1;
-#endif
- if (row >= 0) {
+ if (editor == NULL) {
+ if (dialog->accounts_row >= 0) {
MailConfigAccount *account;
- GtkWidget *window;
-
- window = gtk_widget_get_ancestor (GTK_WIDGET (prefs), GTK_TYPE_WINDOW);
-#if USE_ETABLE
- account = e_table_memory_get_data (E_TABLE_MEMORY (prefs->model), row);
-#else
- account = gtk_clist_get_row_data (prefs->table, row);
-#endif
- prefs->editor = (GtkWidget *) mail_account_editor_new (account, GTK_WINDOW (window), prefs);
- gtk_signal_connect (GTK_OBJECT (prefs->editor), "destroy",
- GTK_SIGNAL_FUNC (account_edit_finished),
- prefs);
- gtk_widget_show (prefs->editor);
+ account = gtk_clist_get_row_data (dialog->mail_accounts, dialog->accounts_row);
+ editor = mail_account_editor_new (account);
+ gnome_dialog_set_parent (GNOME_DIALOG (editor), GTK_WINDOW (dialog));
+ gtk_signal_connect (GTK_OBJECT (editor), "destroy",
+ GTK_SIGNAL_FUNC (mail_editor_destroyed),
+ dialog);
+ gtk_widget_show (GTK_WIDGET (editor));
}
} else {
- gdk_window_raise (prefs->editor->window);
+ gdk_window_raise (GTK_WIDGET (editor)->window);
}
}
static void
-account_delete_clicked (GtkButton *button, gpointer user_data)
+mail_double_click (GtkWidget *widget, GdkEventButton *event, gpointer data)
{
- MailAccountsTab *prefs = user_data;
- const MailConfigAccount *account;
+ if (event->type == GDK_2BUTTON_PRESS)
+ mail_edit (NULL, data);
+}
+
+static void
+mail_delete (GtkButton *button, gpointer data)
+{
+ MailAccountsDialog *dialog = data;
+ MailConfigAccount *account;
GnomeDialog *confirm;
- const GSList *list;
- int row, ans;
-
-#if USE_ETABLE
- row = e_table_get_cursor_row (prefs->table);
-#else
- row = prefs->table->selection ? GPOINTER_TO_INT (prefs->table->selection->data) : -1;
-#endif
+ int ans;
/* make sure we have a valid account selected and that we aren't editing anything... */
- if (row < 0 || prefs->editor != NULL)
+ if (dialog->accounts_row < 0 || editor != NULL)
return;
confirm = GNOME_DIALOG (gnome_message_box_new (_("Are you sure you want to delete this account?"),
@@ -216,265 +298,102 @@ account_delete_clicked (GtkButton *button, gpointer user_data)
gtk_window_set_policy (GTK_WINDOW (confirm), TRUE, TRUE, TRUE);
gtk_window_set_modal (GTK_WINDOW (confirm), TRUE);
gtk_window_set_title (GTK_WINDOW (confirm), _("Really delete account?"));
- gnome_dialog_set_parent (confirm, GTK_WINDOW (prefs));
+ gnome_dialog_set_parent (confirm, GTK_WINDOW (dialog));
ans = gnome_dialog_run_and_close (confirm);
if (ans == 0) {
- int select, len;
+ int sel, row, len;
-#if USE_ETABLE
- account = e_table_memory_get_data (E_TABLE_MEMORY (prefs->model), row);
-#else
- account = gtk_clist_get_row_data (prefs->table, row);
-#endif
+ sel = dialog->accounts_row;
+
+ account = gtk_clist_get_row_data (dialog->mail_accounts, sel);
/* remove it from the folder-tree in the shell */
if (account->source && account->source->url && account->source->enabled)
mail_remove_storage_by_uri (account->source->url);
/* remove it from the config file */
- list = mail_config_remove_account ((MailConfigAccount *) account);
-
+ dialog->accounts = mail_config_remove_account (account);
mail_config_write ();
-
mail_autoreceive_setup ();
-#if USE_ETABLE
- e_table_memory_store_remove (E_TABLE_MEMORY_STORE (prefs->model), row);
-#else
- gtk_clist_remove (prefs->table, row);
-#endif
+ gtk_clist_remove (dialog->mail_accounts, sel);
- len = list ? g_slist_length ((GSList *) list) : 0;
+ len = dialog->accounts ? g_slist_length ((GSList *) dialog->accounts) : 0;
if (len > 0) {
- select = row >= len ? len - 1 : row;
-#if USE_ETABLE
- e_table_set_cursor_row (prefs->table, select);
-#else
- gtk_clist_select_row (prefs->table, select, 0);
-#endif
+ row = sel >= len ? len - 1 : sel;
+ load_accounts (dialog);
+ gtk_clist_select_row (dialog->mail_accounts, row, 0);
} else {
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_edit), FALSE);
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_delete), FALSE);
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_default), FALSE);
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_able), FALSE);
+ dialog->accounts_row = -1;
+ gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_edit), FALSE);
+ gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_delete), FALSE);
+ gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_default), FALSE);
+ gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_able), FALSE);
}
}
}
static void
-account_default_clicked (GtkButton *button, gpointer user_data)
+mail_default (GtkButton *button, gpointer data)
{
- MailAccountsTab *prefs = user_data;
+ MailAccountsDialog *dialog = data;
const MailConfigAccount *account;
- int row;
-#if USE_ETABLE
- row = e_table_get_cursor_row (prefs->table);
-#else
- row = prefs->table->selection ? GPOINTER_TO_INT (prefs->table->selection->data) : -1;
-#endif
-
- if (row >= 0) {
-#if USE_ETABLE
- account = e_table_memory_get_data (E_TABLE_MEMORY (prefs->model), row);
-#else
- account = gtk_clist_get_row_data (prefs->table, row);
-#endif
+ if (dialog->accounts_row >= 0) {
+ int row;
+ row = dialog->accounts_row;
+ account = gtk_clist_get_row_data (dialog->mail_accounts, row);
mail_config_set_default_account (account);
-
mail_config_write ();
-
- mail_accounts_load (prefs);
+ load_accounts (dialog);
+ gtk_clist_select_row (dialog->mail_accounts, row, 0);
}
}
static void
-account_able_clicked (GtkButton *button, gpointer user_data)
+mail_able (GtkButton *button, gpointer data)
{
- MailAccountsTab *prefs = user_data;
+ MailAccountsDialog *dialog = data;
const MailConfigAccount *account;
- int row;
-
-#if USE_ETABLE
- row = e_table_get_cursor_row (prefs->table);
-#else
- row = prefs->table->selection ? GPOINTER_TO_INT (prefs->table->selection->data) : -1;
-#endif
- if (row >= 0) {
-#if USE_ETABLE
- account = e_table_memory_get_data (E_TABLE_MEMORY (prefs->model), row);
-#else
- account = gtk_clist_get_row_data (prefs->table, row);
-#endif
+ if (dialog->accounts_row >= 0) {
+ int row;
+ row = dialog->accounts_row;
+ account = gtk_clist_get_row_data (dialog->mail_accounts, row);
account->source->enabled = !account->source->enabled;
if (account->source && account->source->url) {
if (account->source->enabled)
- mail_load_storage_by_uri (prefs->shell, account->source->url, account->name);
+ mail_load_storage_by_uri (dialog->shell, account->source->url, account->name);
else
mail_remove_storage_by_uri (account->source->url);
}
mail_autoreceive_setup ();
-
mail_config_write ();
-
- mail_accounts_load (prefs);
- }
-}
-
-#if USE_ETABLE
-static void
-account_cursor_change (ETable *table, int row, gpointer user_data)
-{
- MailAccountsTab *prefs = user_data;
-
- if (row >= 0) {
- const MailConfigAccount *account;
-
- account = e_table_memory_get_data (E_TABLE_MEMORY (prefs->model), row);
- if (account->source && account->source->enabled)
- gtk_label_set_text (GTK_LABEL (GTK_BIN (prefs->mail_able)->child), _("Disable"));
- else
- gtk_label_set_text (GTK_LABEL (GTK_BIN (prefs->mail_able)->child), _("Enable"));
-
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_edit), TRUE);
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_delete), TRUE);
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_default), TRUE);
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_able), TRUE);
- } else {
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_edit), FALSE);
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_delete), FALSE);
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_default), FALSE);
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_able), FALSE);
-
- gtk_widget_grab_focus (GTK_WIDGET (prefs->mail_add));
- }
-}
-
-static void
-account_double_click (ETable *table, int row, int col, GdkEvent *event, gpointer user_data)
-{
- account_edit_clicked (NULL, user_data);
-}
-#else
-static void
-account_cursor_change (GtkCList *table, int row, int column, GdkEventButton *event, gpointer user_data)
-{
- MailAccountsTab *prefs = user_data;
-
- if (row >= 0) {
- const MailConfigAccount *account;
-
- account = gtk_clist_get_row_data (prefs->table, row);
- if (account->source && account->source->enabled)
- gtk_label_set_text (GTK_LABEL (GTK_BIN (prefs->mail_able)->child), _("Disable"));
- else
- gtk_label_set_text (GTK_LABEL (GTK_BIN (prefs->mail_able)->child), _("Enable"));
-
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_edit), TRUE);
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_delete), TRUE);
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_default), TRUE);
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_able), TRUE);
-
- if (event && event->type == GDK_2BUTTON_PRESS)
- account_edit_clicked (NULL, user_data);
- } else {
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_edit), FALSE);
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_delete), FALSE);
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_default), FALSE);
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->mail_able), FALSE);
-
- gtk_widget_grab_focus (GTK_WIDGET (prefs->mail_add));
- }
-}
-#endif
-
-
-static void
-mail_accounts_load (MailAccountsTab *prefs)
-{
- const GSList *node;
- int row = 0;
-
-#if USE_ETABLE
- e_table_memory_freeze (E_TABLE_MEMORY (prefs->model));
-
- e_table_memory_store_clear (E_TABLE_MEMORY_STORE (prefs->model));
-#else
- gtk_clist_freeze (prefs->table);
-
- gtk_clist_clear (prefs->table);
-#endif
-
- node = mail_config_get_accounts ();
- while (node) {
- const MailConfigAccount *account;
- CamelURL *url;
-
- account = node->data;
-
- url = account->source && account->source->url ? camel_url_new (account->source->url, NULL) : NULL;
-
-#if USE_ETABLE
- e_table_memory_store_insert_list (E_TABLE_MEMORY_STORE (prefs->model),
- row, GINT_TO_POINTER (account->source->enabled),
- account->name,
- url && url->protocol ? url->protocol : U_("None"));
-
- e_table_memory_set_data (E_TABLE_MEMORY (prefs->model), row, (gpointer) account);
-#else
- {
- char *text[3];
-
- text[0] = NULL;
- text[1] = e_utf8_to_gtk_string (GTK_WIDGET (prefs->table), account->name);
- text[2] = url && url->protocol ? url->protocol : (char *) U_("None");
-
- gtk_clist_insert (prefs->table, row, text);
-
- g_free (text[1]);
-
- gtk_clist_set_row_data (prefs->table, row, (gpointer) account);
- }
-#endif
-
- if (url)
- camel_url_free (url);
-
- node = node->next;
- row++;
+ load_accounts (dialog);
+ gtk_clist_select_row (dialog->mail_accounts, row, 0);
}
-
-#if USE_ETABLE
- e_table_memory_thaw (E_TABLE_MEMORY (prefs->model));
-#else
- gtk_clist_thaw (prefs->table);
-#endif
}
-
#ifdef ENABLE_NNTP
static void
-news_load (MailAccountsTab *prefs)
+load_news (MailAccountsDialog *dialog)
{
const MailConfigService *service;
- const GSList *node;
+ const GSList *node = dialog->news;
int i = 0;
+
+ gtk_clist_freeze (dialog->news_accounts);
- gtk_clist_freeze (prefs->news);
-
- gtk_clist_clear (prefs->news);
-
- node = mail_config_get_news ();
+ gtk_clist_clear (dialog->news_accounts);
while (node) {
CamelURL *url;
- char *text[1];
+ gchar *text[1];
service = node->data;
@@ -488,130 +407,128 @@ news_load (MailAccountsTab *prefs)
if (url)
camel_url_free (url);
- gtk_clist_append (prefs->news, text);
+ gtk_clist_append (dialog->news_accounts, text);
g_free (text[0]);
/* set the account on the row */
- gtk_clist_set_row_data (prefs->news, i, (gpointer) service);
+ gtk_clist_set_row_data (dialog->news_accounts, i, (gpointer) service);
node = node->next;
i++;
}
- gtk_clist_thaw (prefs->news);
+ gtk_clist_thaw (dialog->news_accounts);
}
/* news callbacks */
static void
-news_select_row (GtkCList *clist, int row, int column, GdkEventButton *event, gpointer user_data)
+news_select (GtkCList *clist, gint row, gint column, GdkEventButton *event, gpointer data)
{
- MailAccountsTab *prefs = user_data;
+ MailAccountsDialog *dialog = data;
- prefs->news_row = row;
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->news_edit), TRUE);
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->news_delete), TRUE);
+ dialog->news_row = row;
+ gtk_widget_set_sensitive (GTK_WIDGET (dialog->news_edit), TRUE);
+ gtk_widget_set_sensitive (GTK_WIDGET (dialog->news_delete), TRUE);
}
static void
-news_unselect_row (GtkCList *clist, int row, int column, GdkEventButton *event, gpointer user_data)
+news_unselect (GtkCList *clist, gint row, gint column, GdkEventButton *event, gpointer data)
{
- MailAccountsTab *prefs = user_data;
+ MailAccountsDialog *dialog = data;
- prefs->news_row = -1;
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->news_edit), FALSE);
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->news_delete), FALSE);
+ dialog->news_row = -1;
+ gtk_widget_set_sensitive (GTK_WIDGET (dialog->news_edit), FALSE);
+ gtk_widget_set_sensitive (GTK_WIDGET (dialog->news_delete), FALSE);
}
static void
-news_editor_destroyed (GtkWidget *widget, gpointer user_data)
+news_editor_destroyed (GtkWidget *widget, gpointer data)
{
- MailAccountsTab *prefs = user_data;
-
- news_load (prefs);
- prefs->news_editor = NULL;
+ load_news (MAIL_ACCOUNTS_DIALOG (data));
+ news_editor = NULL;
}
static void
-news_edit_clicked (GtkButton *button, gpointer user_data)
+news_edit (GtkButton *button, gpointer data)
{
- MailAccountsTab *prefs = user_data;
+ MailAccountsDialog *dialog = data;
- if (prefs->news_editor == NULL) {
- if (prefs->news_row >= 0) {
+ if (news_editor == NULL) {
+ if (dialog->news_row >= 0) {
MailConfigService *service;
- service = gtk_clist_get_row_data (prefs->news, prefs->news_row);
- prefs->news_editor = mail_account_editor_news_new (service);
- gtk_signal_connect (GTK_OBJECT (prefs->news_editor), "destroy",
+ service = gtk_clist_get_row_data (dialog->news_accounts, dialog->news_row);
+ news_editor = mail_account_editor_news_new (service);
+ gtk_signal_connect (GTK_OBJECT (news_editor), "destroy",
GTK_SIGNAL_FUNC (news_editor_destroyed),
- prefs);
- gtk_widget_show (GTK_WIDGET (prefs->news_editor));
+ dialog);
+ gtk_widget_show (GTK_WIDGET (news_editor));
}
} else {
- gdk_window_raise (GTK_WIDGET (prefs->news_editor)->window);
+ gdk_window_raise (GTK_WIDGET (news_editor)->window);
}
}
static void
-news_add_destroyed (GtkWidget *widget, gpointer user_data)
+news_add_destroyed (GtkWidget *widget, gpointer data)
{
- gpointer *send = user_data;
- MailAccountsTab *prefs;
+ gpointer *send = data;
+ MailAccountsDialog *dialog;
MailConfigService *service;
-
+
service = send[0];
- prefs = send[1];
- g_free (send);
-
- news_load (prefs);
+ dialog = send[1];
+ g_free(send);
+
+ dialog->news = mail_config_get_news ();
+ load_news (dialog);
+
+ mail_load_storage_by_uri(dialog->shell, service->url, NULL);
- mail_load_storage_by_uri (prefs->shell, service->url, NULL);
+ dialog->news = mail_config_get_news ();
+ load_news (dialog);
- /* FIXME: why do we re-load? */
- news_load (prefs);
}
static void
-news_add_clicked (GtkButton *button, gpointer user_data)
+news_add (GtkButton *button, gpointer data)
{
- MailAccountsTab *prefs = user_data;
+ MailAccountsDialog *dialog = data;
MailConfigService *service;
gpointer *send;
- if (prefs->news_editor == NULL) {
+ if (news_editor == NULL) {
send = g_new (gpointer, 2);
service = g_new0 (MailConfigService, 1);
service->url = NULL;
- prefs->news_editor = mail_account_editor_news_new (service);
+ news_editor = mail_account_editor_news_new (service);
send[0] = service;
- send[1] = prefs;
- gtk_signal_connect (GTK_OBJECT (prefs->news_editor), "destroy",
+ send[1] = dialog;
+ gtk_signal_connect (GTK_OBJECT (news_editor), "destroy",
GTK_SIGNAL_FUNC (news_add_destroyed),
send);
- gtk_widget_show (GTK_WIDGET (prefs->news_editor));
+ gtk_widget_show (GTK_WIDGET (news_editor));
} else {
- gdk_window_raise (GTK_WIDGET (prefs->news_editor)->window);
+ gdk_window_raise (GTK_WIDGET (news_editor)->window);
}
}
static void
-news_delete_clicked (GtkButton *button, gpointer user_data)
+news_delete (GtkButton *button, gpointer data)
{
- MailAccountsTab *prefs = user_data;
- GtkWidget *window, *label;
+ MailAccountsDialog *dialog = data;
MailConfigService *server;
GnomeDialog *confirm;
+ GtkWidget *label;
int ans;
/* don't allow user to delete an account if he might be editing it */
- if (prefs->news_row < 0 || prefs->news_editor != NULL)
+ if (dialog->news_row < 0 || news_editor != NULL)
return;
- window = gtk_widget_get_ancestor (GTK_WIDGET (prefs), GTK_TYPE_WINDOW);
-
confirm = GNOME_DIALOG (gnome_dialog_new (_("Are you sure you want to delete this news account?"),
GNOME_STOCK_BUTTON_YES, GNOME_STOCK_BUTTON_NO, NULL));
gtk_window_set_policy (GTK_WINDOW (confirm), TRUE, TRUE, TRUE);
@@ -620,14 +537,13 @@ news_delete_clicked (GtkButton *button, gpointer user_data)
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
gtk_box_pack_start (GTK_BOX (confirm->vbox), label, TRUE, TRUE, 0);
gtk_widget_show (label);
- gnome_dialog_set_parent (confirm, GTK_WINDOW (window));
+ gnome_dialog_set_parent (confirm, GTK_WINDOW (dialog));
ans = gnome_dialog_run_and_close (confirm);
if (ans == 0) {
- const GSList *servers;
int row, len;
- server = gtk_clist_get_row_data (prefs->news, prefs->news_row);
+ server = gtk_clist_get_row_data (dialog->news_accounts, dialog->news_row);
/* remove it from the folder-tree in the shell */
if (server && server->url) {
@@ -653,193 +569,426 @@ news_delete_clicked (GtkButton *button, gpointer user_data)
}
/* remove it from the config file */
- servers = mail_config_remove_news (server);
+ dialog->news = mail_config_remove_news (server);
mail_config_write ();
- gtk_clist_remove (prefs->news, prefs->news_row);
+ gtk_clist_remove (dialog->news_accounts, dialog->news_row);
- len = servers ? g_slist_length ((GSList *) servers) : 0;
+ len = dialog->news ? g_slist_length ((GSList *) dialog->news) : 0;
if (len > 0) {
- row = prefs->news_row;
+ row = dialog->news_row;
row = row >= len ? len - 1 : row;
- gtk_clist_select_row (prefs->news, row, 0);
+ gtk_clist_select_row (dialog->news_accounts, row, 0);
} else {
- prefs->news_row = -1;
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->news_edit), FALSE);
- gtk_widget_set_sensitive (GTK_WIDGET (prefs->news_delete), FALSE);
+ dialog->news_row = -1;
+ gtk_widget_set_sensitive (GTK_WIDGET (dialog->news_edit), FALSE);
+ gtk_widget_set_sensitive (GTK_WIDGET (dialog->news_delete), FALSE);
}
}
}
#endif /* ENABLE_NNTP */
+/* temp widget callbacks */
+static void
+send_html_toggled (GtkToggleButton *button, gpointer data)
+{
+ mail_config_set_send_html (gtk_toggle_button_get_active (button));
+}
+
+static void
+citation_highlight_toggled (GtkToggleButton *button, gpointer data)
+{
+ mail_config_set_citation_highlight (gtk_toggle_button_get_active (button));
+}
-GtkWidget *mail_accounts_etable_new (char *widget_name, char *string1, char *string2,
- int int1, int int2);
+static void
+timeout_toggled (GtkToggleButton *button, gpointer data)
+{
+ mail_config_set_do_seen_timeout (gtk_toggle_button_get_active (button));
+}
-#if USE_ETABLE
-GtkWidget *
-mail_accounts_etable_new (char *widget_name, char *string1, char *string2, int int1, int int2)
+static void
+citation_color_set (GnomeColorPicker *cp, guint r, guint g, guint b, guint a)
{
- ETableModel *model;
- ETableExtras *extras;
- GdkPixbuf *images[2];
- ETableMemoryStoreColumnInfo columns[] = {
- E_TABLE_MEMORY_STORE_INTEGER,
- E_TABLE_MEMORY_STORE_STRING,
- E_TABLE_MEMORY_STORE_STRING,
- E_TABLE_MEMORY_STORE_TERMINATOR,
- };
-
- extras = e_table_extras_new ();
-
- images[0] = disabled_pixbuf; /* disabled */
- images[1] = enabled_pixbuf; /* enabled */
- e_table_extras_add_cell (extras, "render_able", e_cell_toggle_new (0, 2, images));
+ guint32 rgb;
+
+ rgb = r >> 8;
+ rgb <<= 8;
+ rgb |= g >> 8;
+ rgb <<= 8;
+ rgb |= b >> 8;
+
+ mail_config_set_citation_color (rgb);
+}
+
+/* FIXME: */
+
+static void
+timeout_changed (GtkEntry *entry, gpointer data)
+{
+ MailAccountsDialog *dialog = data;
+ gint val;
- model = e_table_memory_store_new (columns);
+ val = (gint) (gtk_spin_button_get_value_as_float (dialog->timeout) * 1000);
- return e_table_scrolled_new_from_spec_file (model, extras, EVOLUTION_ETSPECDIR "/mail-accounts.etspec", NULL);
+ mail_config_set_mark_as_seen_timeout (val);
}
-#else
-GtkWidget *
-mail_accounts_etable_new (char *widget_name, char *string1, char *string2, int int1, int int2)
+
+static void
+pgp_path_changed (GtkEntry *entry, gpointer data)
{
- GtkWidget *table, *scrolled;
- char *titles[3];
+ CamelPgpType type;
+ const char *path;
- scrolled = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolled),
- GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
+ path = gtk_entry_get_text (entry);
- titles[0] = _("Enabled");
- titles[1] = _("Account name");
- titles[2] = _("Protocol");
- table = gtk_clist_new_with_titles (3, titles);
- gtk_clist_set_selection_mode (GTK_CLIST (table), GTK_SELECTION_SINGLE);
- gtk_clist_column_titles_show (GTK_CLIST (table));
+ type = mail_config_pgp_type_detect_from_path (path);
- gtk_container_add (GTK_CONTAINER (scrolled), table);
+ mail_config_set_pgp_path (path && *path ? path : NULL);
+ mail_config_set_pgp_type (type);
+}
+
+static void
+filter_log_path_changed (GtkEntry *entry, gpointer data)
+{
+ const char *path;
- gtk_object_set_data (GTK_OBJECT (scrolled), "table", table);
+ path = gtk_entry_get_text (entry);
- gtk_widget_show (scrolled);
- gtk_widget_show (table);
+ mail_config_set_filter_log_path (path && *path ? path : NULL);
+}
+
+static void
+set_color (GnomeColorPicker *cp)
+{
+ guint32 rgb = mail_config_get_citation_color ();
+
+ gnome_color_picker_set_i8 (cp, (rgb & 0xff0000) >> 16, (rgb & 0xff00) >> 8, rgb & 0xff, 0xff);
+}
+
+static void
+images_radio_toggled (GtkWidget *radio, gpointer data)
+{
+ MailAccountsDialog *dialog = data;
- return scrolled;
+ if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (radio)))
+ return;
+
+ if (radio == (GtkWidget *)dialog->images_always)
+ mail_config_set_http_mode (MAIL_CONFIG_HTTP_ALWAYS);
+ else if (radio == (GtkWidget *)dialog->images_sometimes)
+ mail_config_set_http_mode (MAIL_CONFIG_HTTP_SOMETIMES);
+ else
+ mail_config_set_http_mode (MAIL_CONFIG_HTTP_NEVER);
+}
+
+static void
+empty_trash_toggled (GtkWidget *toggle, gpointer data)
+{
+ mail_config_set_empty_trash_on_exit (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle)));
+}
+
+static void
+prompt_empty_subject_toggled (GtkWidget *toggle, gpointer data)
+{
+ mail_config_set_prompt_empty_subject (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle)));
+}
+
+static void
+prompt_bcc_only_toggled (GtkWidget *toggle, gpointer data)
+{
+ mail_config_set_prompt_only_bcc (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle)));
+}
+
+static void
+prompt_unwanted_html_toggled (GtkWidget *toggle, gpointer data)
+{
+ mail_config_set_confirm_unwanted_html (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle)));
+}
+
+#if 0
+/* Note: Please see construct() for a reason as to why these 2 options are disabled */
+static void
+thread_list_toggled (GtkWidget *toggle, gpointer data)
+{
+ mail_config_set_thread_list (NULL, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle)));
+}
+
+static void
+show_preview_toggled (GtkWidget *toggle, gpointer data)
+{
+ mail_config_set_show_preview (NULL, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle)));
}
#endif
static void
-mail_accounts_tab_construct (MailAccountsTab *prefs)
+filter_log_toggled (GtkWidget *toggle, gpointer data)
{
- GtkWidget *toplevel, *widget;
- GladeXML *gui;
+ mail_config_set_filter_log (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle)));
+}
+
+static void
+confirm_expunge_toggled (GtkWidget *toggle, gpointer data)
+{
+ mail_config_set_confirm_expunge (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (toggle)));
+}
+
+static void
+forward_style_activated (GtkWidget *item, gpointer data)
+{
+ int style = GPOINTER_TO_INT (data);
+
+ mail_config_set_default_forward_style (style);
+}
+
+static void
+attach_forward_style_signal (GtkWidget *item, gpointer data)
+{
+ int *num = data;
+
+ gtk_signal_connect (GTK_OBJECT (item), "activate",
+ forward_style_activated, GINT_TO_POINTER (*num));
+ (*num)++;
+}
+
+static void
+charset_menu_deactivate (GtkWidget *menu, gpointer data)
+{
+ char *charset;
+
+ charset = e_charset_picker_get_charset (menu);
+ if (charset) {
+ mail_config_set_default_charset (charset);
+ g_free (charset);
+ }
+}
+
+static void
+dialog_destroy (GtkWidget *dialog, gpointer user_data)
+{
+ if (druid)
+ gtk_widget_destroy (GTK_WIDGET (druid));
- gui = glade_xml_new (EVOLUTION_GLADEDIR "/mail-config.glade", "accounts_tab");
- prefs->gui = gui;
+ if (editor)
+ gtk_widget_destroy (GTK_WIDGET (editor));
- /* get our toplevel widget */
#ifdef ENABLE_NNTP
- toplevel = glade_xml_get_widget (gui, "toplevel_notebook");
-#else
- toplevel = glade_xml_get_widget (gui, "toplevel");
+ if (news_editor)
+ gtk_widget_destroy (GTK_WIDGET (news_editor));
#endif
+}
+
+static void
+construct (MailAccountsDialog *dialog)
+{
+ GladeXML *gui;
+ GtkWidget *notebook, *menu;
+ int num;
- /* reparent */
- gtk_widget_ref (toplevel);
- gtk_container_remove (GTK_CONTAINER (toplevel->parent), toplevel);
- gtk_container_add (GTK_CONTAINER (prefs), toplevel);
- gtk_widget_unref (toplevel);
-
- widget = glade_xml_get_widget (gui, "etableMailAccounts");
-
-#if USE_ETABLE
- prefs->table = e_table_scrolled_get_table (E_TABLE_SCROLLED (widget));
- prefs->model = prefs->table->model;
+ gui = glade_xml_new (EVOLUTION_GLADEDIR "/mail-config.glade", NULL);
+ dialog->gui = gui;
- gtk_signal_connect (GTK_OBJECT (prefs->table), "cursor_change",
- account_cursor_change, prefs);
+ /* get our toplevel widget */
+ notebook = glade_xml_get_widget (gui, "notebook");
- gtk_signal_connect (GTK_OBJECT (prefs->table), "double_click",
- account_double_click, prefs);
+ /* reparent */
+ gtk_widget_reparent (notebook, GNOME_DIALOG (dialog)->vbox);
+
+ /* give our dialog an Close button and title */
+ gtk_window_set_title (GTK_WINDOW (dialog), _("Mail Settings"));
+ gtk_window_set_policy (GTK_WINDOW (dialog), FALSE, TRUE, TRUE);
+ gtk_window_set_default_size (GTK_WINDOW (dialog), 400, 300);
+ gnome_dialog_append_button (GNOME_DIALOG (dialog), GNOME_STOCK_BUTTON_OK);
+
+ gtk_signal_connect (GTK_OBJECT (dialog), "destroy",
+ GTK_SIGNAL_FUNC (dialog_destroy), dialog);
+
+ dialog->mail_accounts = GTK_CLIST (glade_xml_get_widget (gui, "clistAccounts"));
+ gtk_signal_connect (GTK_OBJECT (dialog->mail_accounts), "select-row",
+ GTK_SIGNAL_FUNC (mail_select), dialog);
+ gtk_signal_connect (GTK_OBJECT (dialog->mail_accounts), "unselect-row",
+ GTK_SIGNAL_FUNC (mail_unselect), dialog);
+ gtk_signal_connect (GTK_OBJECT (dialog->mail_accounts), "button_press_event",
+ mail_double_click, dialog);
+ dialog->mail_add = GTK_BUTTON (glade_xml_get_widget (gui, "cmdMailAdd"));
+ gtk_signal_connect (GTK_OBJECT (dialog->mail_add), "clicked",
+ GTK_SIGNAL_FUNC (mail_add), dialog);
+ dialog->mail_edit = GTK_BUTTON (glade_xml_get_widget (gui, "cmdMailEdit"));
+ gtk_signal_connect (GTK_OBJECT (dialog->mail_edit), "clicked",
+ GTK_SIGNAL_FUNC (mail_edit), dialog);
+ dialog->mail_delete = GTK_BUTTON (glade_xml_get_widget (gui, "cmdMailDelete"));
+ gtk_signal_connect (GTK_OBJECT (dialog->mail_delete), "clicked",
+ GTK_SIGNAL_FUNC (mail_delete), dialog);
+ dialog->mail_default = GTK_BUTTON (glade_xml_get_widget (gui, "cmdMailDefault"));
+ gtk_signal_connect (GTK_OBJECT (dialog->mail_default), "clicked",
+ GTK_SIGNAL_FUNC (mail_default), dialog);
+ dialog->mail_able = GTK_BUTTON (glade_xml_get_widget (gui, "cmdMailAble"));
+ gtk_signal_connect (GTK_OBJECT (dialog->mail_able), "clicked",
+ GTK_SIGNAL_FUNC (mail_able), dialog);
- mail_accounts_load (prefs);
+#ifdef ENABLE_NNTP
+ dialog->news_accounts = GTK_CLIST (glade_xml_get_widget (gui, "clistNews"));
+ gtk_signal_connect (GTK_OBJECT (dialog->news_accounts), "select-row",
+ GTK_SIGNAL_FUNC (news_select), dialog);
+ gtk_signal_connect (GTK_OBJECT (dialog->news_accounts), "unselect-row",
+ GTK_SIGNAL_FUNC (news_unselect), dialog);
+ dialog->news_add = GTK_BUTTON (glade_xml_get_widget (gui, "cmdNewsAdd"));
+ gtk_signal_connect (GTK_OBJECT (dialog->news_add), "clicked",
+ GTK_SIGNAL_FUNC (news_add), dialog);
+ dialog->news_edit = GTK_BUTTON (glade_xml_get_widget (gui, "cmdNewsEdit"));
+ gtk_signal_connect (GTK_OBJECT (dialog->news_edit), "clicked",
+ GTK_SIGNAL_FUNC (news_edit), dialog);
+ dialog->news_delete = GTK_BUTTON (glade_xml_get_widget (gui, "cmdNewsDelete"));
+ gtk_signal_connect (GTK_OBJECT (dialog->news_delete), "clicked",
+ GTK_SIGNAL_FUNC (news_delete), dialog);
#else
- prefs->table = GTK_CLIST (gtk_object_get_data (GTK_OBJECT (widget), "table"));
-
- gtk_signal_connect (GTK_OBJECT (prefs->table), "select-row",
- account_cursor_change, prefs);
-
- mail_accounts_load (prefs);
-
- {
- int col;
-
- for (col = 0; col < 3; col++) {
- gtk_clist_set_column_auto_resize (prefs->table, col, TRUE);
- }
- }
+ /* remove the news tab since we don't support nntp */
+ gtk_notebook_remove_page (GTK_NOTEBOOK (notebook), 1);
#endif
- prefs->mail_add = GTK_BUTTON (glade_xml_get_widget (gui, "cmdAccountAdd"));
- gtk_signal_connect (GTK_OBJECT (prefs->mail_add), "clicked",
- account_add_clicked, prefs);
-
- prefs->mail_edit = GTK_BUTTON (glade_xml_get_widget (gui, "cmdAccountEdit"));
- gtk_signal_connect (GTK_OBJECT (prefs->mail_edit), "clicked",
- account_edit_clicked, prefs);
-
- prefs->mail_delete = GTK_BUTTON (glade_xml_get_widget (gui, "cmdAccountDelete"));
- gtk_signal_connect (GTK_OBJECT (prefs->mail_delete), "clicked",
- account_delete_clicked, prefs);
-
- prefs->mail_default = GTK_BUTTON (glade_xml_get_widget (gui, "cmdAccountDefault"));
- gtk_signal_connect (GTK_OBJECT (prefs->mail_default), "clicked",
- account_default_clicked, prefs);
+ /* Display page */
+ dialog->citation_highlight = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chckHighlightCitations"));
+ gtk_toggle_button_set_active (dialog->citation_highlight, mail_config_get_citation_highlight ());
+ gtk_signal_connect (GTK_OBJECT (dialog->citation_highlight), "toggled",
+ GTK_SIGNAL_FUNC (citation_highlight_toggled), dialog);
+ dialog->citation_color = GNOME_COLOR_PICKER (glade_xml_get_widget (gui, "colorpickerCitations"));
+ set_color (dialog->citation_color);
+ gtk_signal_connect (GTK_OBJECT (dialog->citation_color), "color_set",
+ GTK_SIGNAL_FUNC (citation_color_set), dialog);
+
+ dialog->timeout_toggle = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "checkMarkTimeout"));
+ gtk_toggle_button_set_active (dialog->timeout_toggle, mail_config_get_do_seen_timeout ());
+ gtk_signal_connect (GTK_OBJECT (dialog->timeout_toggle), "toggled",
+ GTK_SIGNAL_FUNC (timeout_toggled), dialog);
+
+ dialog->timeout = GTK_SPIN_BUTTON (glade_xml_get_widget (gui, "spinMarkTimeout"));
+ gtk_spin_button_set_value (dialog->timeout, (1.0 * mail_config_get_mark_as_seen_timeout ()) / 1000.0);
+ gtk_signal_connect (GTK_OBJECT (dialog->timeout), "changed",
+ GTK_SIGNAL_FUNC (timeout_changed), dialog);
+
+ dialog->images_never = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radioImagesNever"));
+ gtk_toggle_button_set_active (dialog->images_never, mail_config_get_http_mode () == MAIL_CONFIG_HTTP_NEVER);
+ gtk_signal_connect (GTK_OBJECT (dialog->images_never), "toggled",
+ GTK_SIGNAL_FUNC (images_radio_toggled), dialog);
+ dialog->images_sometimes = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radioImagesSometimes"));
+ gtk_toggle_button_set_active (dialog->images_sometimes, mail_config_get_http_mode () == MAIL_CONFIG_HTTP_SOMETIMES);
+ gtk_signal_connect (GTK_OBJECT (dialog->images_sometimes), "toggled",
+ GTK_SIGNAL_FUNC (images_radio_toggled), dialog);
+ dialog->images_always = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radioImagesAlways"));
+ gtk_toggle_button_set_active (dialog->images_always, mail_config_get_http_mode () == MAIL_CONFIG_HTTP_ALWAYS);
+ gtk_signal_connect (GTK_OBJECT (dialog->images_always), "toggled",
+ GTK_SIGNAL_FUNC (images_radio_toggled), dialog);
+
+#if 0
+ /* These options are disabled because they are completely non-intuitive and evil */
+ dialog->thread_list = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkThreadedList"));
+ gtk_toggle_button_set_active (dialog->thread_list, mail_config_get_thread_list (NULL));
+ gtk_signal_connect (GTK_OBJECT (dialog->thread_list), "toggled",
+ GTK_SIGNAL_FUNC (thread_list_toggled), dialog);
+
+ dialog->show_preview = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkShowPreview"));
+ gtk_toggle_button_set_active (dialog->show_preview, mail_config_get_show_preview (NULL));
+ gtk_signal_connect (GTK_OBJECT (dialog->show_preview), "toggled",
+ GTK_SIGNAL_FUNC (show_preview_toggled), dialog);
+#endif
- prefs->mail_able = GTK_BUTTON (glade_xml_get_widget (gui, "cmdAccountAble"));
- gtk_signal_connect (GTK_OBJECT (prefs->mail_able), "clicked",
- account_able_clicked, prefs);
+ /* Composer page */
+ dialog->send_html = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkSendHTML"));
+ gtk_toggle_button_set_active (dialog->send_html, mail_config_get_send_html ());
+ gtk_signal_connect (GTK_OBJECT (dialog->send_html), "toggled",
+ GTK_SIGNAL_FUNC (send_html_toggled), dialog);
+
+ dialog->forward_style = GTK_OPTION_MENU (glade_xml_get_widget (gui, "omenuForwardStyle"));
+ gtk_option_menu_set_history (dialog->forward_style, mail_config_get_default_forward_style ());
+ /* Hm. This sucks... */
+ num = 0;
+ gtk_container_foreach (GTK_CONTAINER (gtk_option_menu_get_menu (dialog->forward_style)),
+ attach_forward_style_signal, &num);
+
+ dialog->prompt_empty_subject = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkPromptEmptySubject"));
+ gtk_toggle_button_set_active (dialog->prompt_empty_subject, mail_config_get_prompt_empty_subject ());
+ gtk_signal_connect (GTK_OBJECT (dialog->prompt_empty_subject), "toggled",
+ GTK_SIGNAL_FUNC (prompt_empty_subject_toggled), dialog);
+
+ dialog->prompt_bcc_only = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkPromptBccOnly"));
+ gtk_toggle_button_set_active (dialog->prompt_bcc_only, mail_config_get_prompt_only_bcc ());
+ gtk_signal_connect (GTK_OBJECT (dialog->prompt_bcc_only), "toggled",
+ GTK_SIGNAL_FUNC (prompt_bcc_only_toggled), dialog);
+
+ dialog->prompt_unwanted_html = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkPromptWantHTML"));
+ gtk_toggle_button_set_active (dialog->prompt_unwanted_html, mail_config_get_confirm_unwanted_html ());
+ gtk_signal_connect (GTK_OBJECT (dialog->prompt_unwanted_html), "toggled",
+ GTK_SIGNAL_FUNC (prompt_unwanted_html_toggled), dialog);
+
+ /* Other page */
+ dialog->pgp_path = GNOME_FILE_ENTRY (glade_xml_get_widget (gui, "filePgpPath"));
+ gtk_entry_set_text (GTK_ENTRY (gnome_file_entry_gtk_entry (dialog->pgp_path)),
+ mail_config_get_pgp_path ());
+ gnome_file_entry_set_default_path (dialog->pgp_path, mail_config_get_pgp_path ());
+ gtk_signal_connect (GTK_OBJECT (gnome_file_entry_gtk_entry (dialog->pgp_path)),
+ "changed", GTK_SIGNAL_FUNC (pgp_path_changed), dialog);
+
+ dialog->charset = GTK_OPTION_MENU (glade_xml_get_widget (gui, "omenuCharset"));
+ menu = e_charset_picker_new (mail_config_get_default_charset ());
+ gtk_option_menu_set_menu (dialog->charset, GTK_WIDGET (menu));
+ gtk_signal_connect (GTK_OBJECT (menu), "deactivate",
+ GTK_SIGNAL_FUNC (charset_menu_deactivate), NULL);
+
+ dialog->empty_trash = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkEmptyTrashOnExit"));
+ gtk_toggle_button_set_active (dialog->empty_trash, mail_config_get_empty_trash_on_exit ());
+ gtk_signal_connect (GTK_OBJECT (dialog->empty_trash), "toggled",
+ GTK_SIGNAL_FUNC (empty_trash_toggled), dialog);
+
+ dialog->filter_log = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkFilterLog"));
+ gtk_toggle_button_set_active (dialog->filter_log, mail_config_get_filter_log ());
+ gtk_signal_connect (GTK_OBJECT (dialog->filter_log), "toggled",
+ GTK_SIGNAL_FUNC (filter_log_toggled), dialog);
+
+ dialog->filter_log_path = GNOME_FILE_ENTRY (glade_xml_get_widget (gui, "fileFilterLog"));
+ gtk_entry_set_text (GTK_ENTRY (gnome_file_entry_gtk_entry (dialog->filter_log_path)),
+ mail_config_get_filter_log_path ());
+ gnome_file_entry_set_default_path (dialog->filter_log_path, mail_config_get_filter_log_path ());
+ gtk_signal_connect (GTK_OBJECT (gnome_file_entry_gtk_entry (dialog->filter_log_path)),
+ "changed", GTK_SIGNAL_FUNC (filter_log_path_changed), dialog);
+
+ dialog->confirm_expunge = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkConfirmExpunge"));
+ gtk_toggle_button_set_active (dialog->confirm_expunge, mail_config_get_confirm_expunge ());
+ gtk_signal_connect (GTK_OBJECT (dialog->confirm_expunge), "toggled",
+ GTK_SIGNAL_FUNC (confirm_expunge_toggled), dialog);
+
+ /* now to fill in the clists */
+ dialog->accounts_row = -1;
+ dialog->accounts = mail_config_get_accounts ();
+ if (dialog->accounts) {
+ load_accounts (dialog);
+ gtk_clist_select_row (dialog->mail_accounts, 0, 0);
+ } else {
+ gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_edit), FALSE);
+ gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_delete), FALSE);
+ gtk_widget_set_sensitive (GTK_WIDGET (dialog->mail_default), FALSE);
+ }
#ifdef ENABLE_NNTP
- prefs->news = GTK_CLIST (gtk_object_get_data (GTK_OBJECT (widget), "clistNews"));
- gtk_signal_connect (GTK_OBJECT (prefs->news), "select-row",
- news_select_row, prefs);
- gtk_signal_connect (GTK_OBJECT (prefs->news), "unselect-row",
- news_unselect_row, prefs);
-
- news_load (prefs);
-
- prefs->news_add = GTK_BUTTON (glade_xml_get_widget (gui, "cmdNewsAdd"));
- gtk_signal_connect (GTK_OBJECT (prefs->news_add), "clicked",
- news_add_clicked, prefs);
-
- prefs->mail_edit = GTK_BUTTON (glade_xml_get_widget (gui, "cmdNewsEdit"));
- gtk_signal_connect (GTK_OBJECT (prefs->news_edit), "clicked",
- news_edit_clicked, prefs);
-
- prefs->mail_delete = GTK_BUTTON (glade_xml_get_widget (gui, "cmdNewsDelete"));
- gtk_signal_connect (GTK_OBJECT (prefs->news_delete), "clicked",
- news_delete_clicked, prefs);
+ dialog->news_row = -1;
+ dialog->news = mail_config_get_news ();
+ if (dialog->news) {
+ load_news (dialog);
+ gtk_clist_select_row (dialog->news_accounts, 0, 0);
+ } else {
+ gtk_widget_set_sensitive (GTK_WIDGET (dialog->news_edit), FALSE);
+ gtk_widget_set_sensitive (GTK_WIDGET (dialog->news_delete), FALSE);
+ }
#endif /* ENABLE_NNTP */
}
-
-GtkWidget *
-mail_accounts_tab_new (GNOME_Evolution_Shell shell)
+MailAccountsDialog *
+mail_accounts_dialog_new (GNOME_Evolution_Shell shell)
{
- MailAccountsTab *new;
+ MailAccountsDialog *new;
- new = (MailAccountsTab *) gtk_type_new (mail_accounts_tab_get_type ());
- mail_accounts_tab_construct (new);
+ new = (MailAccountsDialog *) gtk_type_new (mail_accounts_dialog_get_type ());
+ construct (new);
new->shell = shell;
- return (GtkWidget *) new;
-}
-
-
-void
-mail_accounts_tab_apply (MailAccountsTab *prefs)
-{
- /* nothing to do here... */
+ return new;
}
diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c
index 9c2c9f7d7c..026769d005 100644
--- a/mail/mail-callbacks.c
+++ b/mail/mail-callbacks.c
@@ -31,6 +31,8 @@
#include <errno.h>
#include <time.h>
#include <libgnome/gnome-paper.h>
+#include <libgnomeui/gnome-dialog.h>
+#include <libgnomeui/gnome-dialog-util.h>
#include <libgnomeui/gnome-stock.h>
#include <libgnome/gnome-paper.h>
#include <libgnomeprint/gnome-print-master.h>
@@ -40,10 +42,8 @@
#include <gal/e-table/e-table.h>
#include <gal/widgets/e-gui-utils.h>
#include <gal/widgets/e-unicode.h>
-#include <e-util/e-dialog-utils.h>
#include <filter/filter-editor.h>
#include "mail.h"
-#include "folder-browser-window.h"
#include "message-browser.h"
#include "mail-callbacks.h"
#include "mail-config.h"
@@ -59,8 +59,6 @@
#include "mail-folder-cache.h"
#include "folder-browser.h"
#include "subscribe-dialog.h"
-#include "message-tag-editor.h"
-#include "message-tag-followup.h"
#include "e-messagebox.h"
#include "Evolution.h"
@@ -68,13 +66,59 @@
#include "evolution-shell-client.h"
+#ifndef HAVE_MKSTEMP
+#include <fcntl.h>
+#include <sys/stat.h>
+#endif
#define FB_WINDOW(fb) GTK_WINDOW (gtk_widget_get_ancestor (GTK_WIDGET (fb), GTK_TYPE_WINDOW))
+/* These e_gnome_dialog* functions are to handle the brokenness that is gnome-dialog */
+static void
+e_gnome_dialog_parent_destroyed (GtkWidget *parent, GtkWidget *dialog)
+{
+ gnome_dialog_close (GNOME_DIALOG (dialog));
+}
+
+static void
+e_gnome_dialog_set_parent (GnomeDialog *dialog, GtkWindow *parent)
+{
+ gnome_dialog_set_parent (dialog, parent);
+ gtk_signal_connect_while_alive (GTK_OBJECT (parent), "destroy",
+ e_gnome_dialog_parent_destroyed,
+ dialog, GTK_OBJECT (dialog));
+}
+
+static GtkWidget *
+e_gnome_warning_dialog_parented (const char *warning, GtkWindow *parent)
+{
+ GtkWidget *dialog;
+
+ dialog = gnome_warning_dialog_parented (warning, parent);
+ gtk_signal_connect (GTK_OBJECT (parent), "destroy",
+ e_gnome_dialog_parent_destroyed, dialog);
+
+ return dialog;
+}
+
+static GtkWidget *
+e_gnome_ok_cancel_dialog_parented (const char *message, GnomeReplyCallback callback,
+ gpointer data, GtkWindow *parent)
+{
+ GtkWidget *dialog;
+
+ dialog = gnome_ok_cancel_dialog_parented (message, callback, data, parent);
+ gtk_signal_connect (GTK_OBJECT (parent), "destroy",
+ e_gnome_dialog_parent_destroyed, dialog);
+
+ return dialog;
+}
+
+
struct post_send_data {
CamelFolder *folder;
gchar *uid;
- guint32 flags, set;
+ guint32 flags;
};
static void
@@ -130,7 +174,7 @@ check_send_configuration (FolderBrowser *fb)
/* Check general */
if (!mail_config_is_configured () && !configure_mail (fb))
- return FALSE;
+ return FALSE;
/* Get the default account */
account = mail_config_get_default_account ();
@@ -167,6 +211,33 @@ check_send_configuration (FolderBrowser *fb)
return TRUE;
}
+void
+send_receive_mail (GtkWidget *widget, gpointer user_data)
+{
+ FolderBrowser *fb = FOLDER_BROWSER (user_data);
+ const MailConfigAccount *account;
+
+ if (FOLDER_BROWSER_IS_DESTROYED (fb))
+ return;
+
+ if (!mail_config_is_configured () && !configure_mail (fb))
+ return;
+
+ account = mail_config_get_default_account ();
+ if (!account || !account->transport) {
+ GtkWidget *dialog;
+
+ dialog = gnome_error_dialog_parented (_("You have not set a mail transport method"),
+ FB_WINDOW (fb));
+ gnome_dialog_set_close (GNOME_DIALOG (dialog), TRUE);
+ gtk_widget_show (dialog);
+
+ return;
+ }
+
+ mail_send_receive (fb->folder);
+}
+
static void
msgbox_destroyed (GtkWidget *widget, gpointer data)
{
@@ -183,7 +254,7 @@ ask_confirm_for_unwanted_html_mail (EMsgComposer *composer, EDestination **recip
gboolean show_again = TRUE;
GString *str;
GtkWidget *mbox;
- int i, button;
+ gint i, button;
if (!mail_config_get_confirm_unwanted_html ()) {
g_message ("doesn't want to see confirm html messages!");
@@ -284,13 +355,13 @@ ask_confirm_for_only_bcc (EMsgComposer *composer, gboolean hidden_list_case)
if (!mail_config_get_prompt_only_bcc ())
return TRUE;
-
+
/* If the user is mailing a hidden contact list, it is possible for
them to create a message with only Bcc recipients without really
realizing it. To try to avoid being totally confusing, I've changed
this dialog to provide slightly different text in that case, to
better explain what the hell is going on. */
-
+
if (hidden_list_case) {
first_text = _("Since the contact list you are sending to "
"is configured to hide the list's addresses, "
@@ -315,7 +386,7 @@ ask_confirm_for_only_bcc (EMsgComposer *composer, gboolean hidden_list_case)
button = gnome_dialog_run_and_close (GNOME_DIALOG (mbox));
mail_config_set_prompt_only_bcc (show_again);
-
+
g_free (message_text);
if (button == 0)
@@ -349,7 +420,7 @@ composer_sent_cb (char *uri, CamelMimeMessage *message, gboolean sent, void *dat
if (sent) {
if (send->psd) {
camel_folder_set_message_flags (send->psd->folder, send->psd->uid,
- send->psd->flags, send->psd->set);
+ send->psd->flags, send->psd->flags);
}
gtk_widget_destroy (GTK_WIDGET (send->composer));
} else {
@@ -373,28 +444,53 @@ composer_get_message (EMsgComposer *composer)
const CamelInternetAddress *iaddr;
const MailConfigAccount *account;
CamelMimeMessage *message;
- EDestination **recipients;
const char *subject;
int num_addrs, i;
+ EDestination **recipients;
message = e_msg_composer_get_message (composer);
if (message == NULL)
return NULL;
- /* Add info about the sending account */
- account = e_msg_composer_get_preferred_account (composer);
+ recipients = e_msg_composer_get_recipients (composer);
- if (account) {
- camel_medium_set_header (CAMEL_MEDIUM (message), "X-Evolution-Account", account->name);
- camel_medium_set_header (CAMEL_MEDIUM (message), "X-Evolution-Transport", account->transport->url);
- camel_medium_set_header (CAMEL_MEDIUM (message), "X-Evolution-Fcc", account->sent_folder_uri);
- if (account->id->organization)
- camel_medium_set_header (CAMEL_MEDIUM (message), "Organization", account->id->organization);
+ /* Check for invalid recipients */
+ if (recipients) {
+ gboolean have_invalid = FALSE;
+ gchar *msg, *new_msg;
+ GtkWidget *message_box;
+
+ for (i = 0; recipients[i] && !have_invalid; ++i) {
+ if (!e_destination_is_valid (recipients[i]))
+ have_invalid = TRUE;
+ }
+
+ if (have_invalid) {
+ msg = g_strdup (_("This message contains invalid recipients:"));
+ for (i = 0; recipients[i]; ++i) {
+ if (!e_destination_is_valid (recipients[i])) {
+ new_msg = g_strdup_printf ("%s\n %s", msg,
+ e_destination_get_address (recipients[i]));
+ g_free (msg);
+ msg = new_msg;
+ }
+ }
+
+ new_msg = e_utf8_from_locale_string (msg);
+ g_free (msg);
+ msg = new_msg;
+
+ message_box = gnome_message_box_new (msg, GNOME_MESSAGE_BOX_WARNING, GNOME_STOCK_BUTTON_OK, NULL);
+ g_free (msg);
+
+ gnome_dialog_run_and_close (GNOME_DIALOG (message_box));
+
+ camel_object_unref (CAMEL_OBJECT (message));
+ message = NULL;
+ goto finished;
+ }
}
- /* get the message recipients */
- recipients = e_msg_composer_get_recipients (composer);
-
/* Check for recipients */
for (num_addrs = 0, i = 0; i < 3; i++) {
iaddr = camel_mime_message_get_recipients (message, recipient_type[i]);
@@ -422,13 +518,13 @@ composer_get_message (EMsgComposer *composer)
/* this means that the only recipients are Bcc's */
/* OK, this is an abusive hack. If someone sends a mail with a
- hidden contact list on the To: line and no other recipients,
+ hidden contact list on to to: line and no other recipients,
they will unknowingly create a message with only bcc: recipients.
We try to detect this and pass a flag to ask_confirm_for_only_bcc,
so that it can present the user with a dialog whose text has been
modified to reflect this situation. */
- const char *to_header = camel_medium_get_header (CAMEL_MEDIUM (message), CAMEL_RECIPIENT_TYPE_TO);
+ const gchar *to_header = camel_medium_get_header (CAMEL_MEDIUM (message), CAMEL_RECIPIENT_TYPE_TO);
gboolean hidden_list_case = FALSE;
if (to_header && !strcmp (to_header, "Undisclosed-Recipient:;"))
@@ -449,12 +545,12 @@ composer_get_message (EMsgComposer *composer)
&& mail_config_get_confirm_unwanted_html ()) {
gboolean html_problem = FALSE;
for (i = 0; recipients[i] != NULL && !html_problem; ++i) {
- if (!e_destination_get_html_mail_pref (recipients[i]))
+ if (! e_destination_get_html_mail_pref (recipients[i]))
html_problem = TRUE;
}
if (html_problem) {
- html_problem = !ask_confirm_for_unwanted_html_mail (composer, recipients);
+ html_problem = ! ask_confirm_for_unwanted_html_mail (composer, recipients);
if (html_problem) {
camel_object_unref (CAMEL_OBJECT (message));
message = NULL;
@@ -473,13 +569,20 @@ composer_get_message (EMsgComposer *composer)
}
}
+ /* Add info about the sending account */
+ account = e_msg_composer_get_preferred_account (composer);
+ if (account) {
+ camel_medium_set_header (CAMEL_MEDIUM (message), "X-Evolution-Account", account->name);
+ camel_medium_set_header (CAMEL_MEDIUM (message), "X-Evolution-Transport", account->transport->url);
+ camel_medium_set_header (CAMEL_MEDIUM (message), "X-Evolution-Fcc", account->sent_folder_uri);
+ }
+
/* Get the message recipients and 'touch' them, boosting their use scores */
+ recipients = e_msg_composer_get_recipients (composer);
e_destination_touchv (recipients);
finished:
-
e_destination_freev (recipients);
-
return message;
}
@@ -536,7 +639,6 @@ composer_postpone_cb (EMsgComposer *composer, gpointer data)
message = composer_get_message (composer);
if (message == NULL)
return;
-
info = camel_message_info_new ();
info->flags = CAMEL_MESSAGE_SEEN;
@@ -544,139 +646,27 @@ composer_postpone_cb (EMsgComposer *composer, gpointer data)
camel_object_unref (CAMEL_OBJECT (message));
if (psd)
- camel_folder_set_message_flags (psd->folder, psd->uid, psd->flags, psd->set);
+ camel_folder_set_message_flags (psd->folder, psd->uid, psd->flags, psd->flags);
gtk_widget_destroy (GTK_WIDGET (composer));
}
-struct _save_draft_info {
- EMsgComposer *composer;
- const char *old_uid;
- int quit;
-};
-
-static void
-save_draft_done (CamelFolder *folder, CamelMimeMessage *msg, CamelMessageInfo *info, int ok, void *data)
-{
- struct _save_draft_info *sdi = data;
-
- /* delete the original draft message */
- if (ok && sdi->old_uid)
- camel_folder_set_message_flags (folder, sdi->old_uid,
- CAMEL_MESSAGE_DELETED,
- CAMEL_MESSAGE_DELETED);
-
- if (ok && sdi->quit)
- gtk_widget_destroy (GTK_WIDGET (sdi->composer));
- else
- gtk_object_unref (GTK_OBJECT (sdi->composer));
-
- g_free (info);
- g_free (sdi);
-}
-
-static void
-use_default_drafts_cb (int reply, gpointer data)
-{
- extern CamelFolder *drafts_folder;
- CamelFolder **folder = data;
-
- if (reply == 0) {
- *folder = drafts_folder;
- camel_object_ref (CAMEL_OBJECT (*folder));
- }
-}
-
-static void
-save_draft_folder (char *uri, CamelFolder *folder, gpointer data)
-{
- CamelFolder **save = data;
-
- if (folder) {
- *save = folder;
- camel_object_ref (CAMEL_OBJECT (folder));
- }
-}
-
-void
-composer_save_draft_cb (EMsgComposer *composer, int quit, gpointer user_data)
-{
- extern char *default_drafts_folder_uri;
- extern CamelFolder *drafts_folder;
- CamelMimeMessage *msg;
- CamelMessageInfo *info;
- const MailConfigAccount *account;
- struct _save_draft_info *sdi;
- CamelFolder *folder = NULL;
-
- account = e_msg_composer_get_preferred_account (composer);
- if (account && account->drafts_folder_uri &&
- strcmp (account->drafts_folder_uri, default_drafts_folder_uri) != 0) {
- int id;
-
- id = mail_get_folder (account->drafts_folder_uri, 0, save_draft_folder, &folder, mail_thread_new);
- mail_msg_wait (id);
-
- if (!folder) {
- GtkWidget *dialog;
-
- dialog = gnome_ok_cancel_dialog_parented (_("Unable to open the drafts folder for this account.\n"
- "Would you like to use the default drafts folder?"),
- use_default_drafts_cb, &folder, GTK_WINDOW (composer));
- gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
- if (!folder)
- return;
- }
- } else {
- folder = drafts_folder;
- camel_object_ref (CAMEL_OBJECT (folder));
- }
-
- msg = e_msg_composer_get_message_draft (composer);
-
- info = g_new0 (CamelMessageInfo, 1);
- info->flags = CAMEL_MESSAGE_DRAFT | CAMEL_MESSAGE_SEEN;
-
- sdi = g_malloc (sizeof (struct _save_draft_info));
- sdi->composer = composer;
- gtk_object_ref (GTK_OBJECT (composer));
- sdi->old_uid = (const char *) user_data;
- sdi->quit = quit;
-
- /* FIXME: we need to have some way of getting the UID of the
- newly appended message so that we can update the data that
- this callback gets called with (user_data is the UID of the
- message being edited) so that if the user saves a
- second/third/fourth/etc time, we keep deleting the previous
- copy of the draft */
-
- mail_append_mail (folder, msg, info, save_draft_done, sdi);
- camel_object_unref (CAMEL_OBJECT (folder));
- camel_object_unref (CAMEL_OBJECT (msg));
-}
-
static GtkWidget *
-create_msg_composer (const MailConfigAccount *account, const char *url)
+create_msg_composer (const char *url)
{
- EMsgComposer *composer;
+ const MailConfigAccount *account;
gboolean send_html;
+ EMsgComposer *composer;
- /* Make sure that we've actually been passed in an account. If one has
- * not been passed in, grab the default account.
- */
- if (account == NULL) {
- account = mail_config_get_default_account ();
- }
-
+ account = mail_config_get_default_account ();
send_html = mail_config_get_send_html ();
-
+
composer = url ? e_msg_composer_new_from_url (url) : e_msg_composer_new ();
if (composer) {
e_msg_composer_hdrs_set_from_account (E_MSG_COMPOSER_HDRS (composer->hdrs), account->name);
e_msg_composer_set_send_html (composer, send_html);
- e_msg_composer_unset_changed (composer);
- e_msg_composer_drop_editor_undo (composer);
+ e_msg_composer_show_sig_file (composer);
return GTK_WIDGET (composer);
} else
return NULL;
@@ -685,17 +675,13 @@ create_msg_composer (const MailConfigAccount *account, const char *url)
void
compose_msg (GtkWidget *widget, gpointer user_data)
{
- const MailConfigAccount *account;
FolderBrowser *fb = FOLDER_BROWSER (user_data);
GtkWidget *composer;
if (FOLDER_BROWSER_IS_DESTROYED (fb) || !check_send_configuration (fb))
return;
- /* Figure out which account we want to initially compose from */
- account = mail_config_get_account_by_source_url (fb->uri);
-
- composer = create_msg_composer (account, NULL);
+ composer = create_msg_composer (NULL);
if (!composer)
return;
@@ -703,8 +689,6 @@ compose_msg (GtkWidget *widget, gpointer user_data)
GTK_SIGNAL_FUNC (composer_send_cb), NULL);
gtk_signal_connect (GTK_OBJECT (composer), "postpone",
GTK_SIGNAL_FUNC (composer_postpone_cb), NULL);
- gtk_signal_connect (GTK_OBJECT (composer), "save-draft",
- GTK_SIGNAL_FUNC (composer_save_draft_cb), NULL);
gtk_widget_show (composer);
}
@@ -720,8 +704,7 @@ send_to_url (const char *url)
if (!check_send_configuration (NULL))
return;
- /* Tell create_msg_composer to use the default email profile */
- composer = create_msg_composer (NULL, url);
+ composer = create_msg_composer (url);
if (!composer)
return;
@@ -729,118 +712,102 @@ send_to_url (const char *url)
GTK_SIGNAL_FUNC (composer_send_cb), NULL);
gtk_signal_connect (GTK_OBJECT (composer), "postpone",
GTK_SIGNAL_FUNC (composer_postpone_cb), NULL);
- gtk_signal_connect (GTK_OBJECT (composer), "save-draft",
- GTK_SIGNAL_FUNC (composer_save_draft_cb), NULL);
-
+
gtk_widget_show (composer);
}
static GList *
list_add_addresses (GList *list, const CamelInternetAddress *cia, const GSList *accounts,
- GHashTable *rcpt_hash, const MailConfigAccount **me)
+ GHashTable *rcpt_hash, const MailConfigAccount **me,
+ const char *ignore_addr)
{
- const MailConfigAccount *account;
- GHashTable *account_hash;
const char *name, *addr;
const GSList *l;
+ gboolean notme;
int i;
- account_hash = g_hash_table_new (g_strcase_hash, g_strcase_equal);
- l = accounts;
- while (l) {
- account = l->data;
- g_hash_table_insert (account_hash, (char *) account->id->address, (void *) account);
- l = l->next;
- }
-
for (i = 0; camel_internet_address_get (cia, i, &name, &addr); i++) {
- /* Here I'll check to see if the cc:'d address is the address
- of the sender, and if so, don't add it to the cc: list; this
- is to fix Bugzilla bug #455. */
- account = g_hash_table_lookup (account_hash, addr);
- if (account && me && !*me)
- *me = account;
-
- if (!account && !g_hash_table_lookup (rcpt_hash, addr)) {
- EDestination *dest;
+ /* Make sure we don't want to ignore this address */
+ if (!ignore_addr || g_strcasecmp (ignore_addr, addr)) {
- dest = e_destination_new ();
- e_destination_set_name (dest, name);
- e_destination_set_email (dest, addr);
+ /* Here I'll check to see if the cc:'d address is the address
+ of the sender, and if so, don't add it to the cc: list; this
+ is to fix Bugzilla bug #455. */
+ notme = TRUE;
+ l = accounts;
+ while (l) {
+ const MailConfigAccount *acnt = l->data;
+
+ if (!g_strcasecmp (acnt->id->address, addr)) {
+ notme = FALSE;
+ if (me && !*me)
+ *me = acnt;
+ break;
+ }
+
+ l = l->next;
+ }
- list = g_list_append (list, dest);
- g_hash_table_insert (rcpt_hash, (char *) addr, GINT_TO_POINTER (1));
- }
+ if (notme && !g_hash_table_lookup (rcpt_hash, addr)) {
+ EDestination *dest;
+
+ dest = e_destination_new ();
+ e_destination_set_name (dest, name);
+ e_destination_set_email (dest, addr);
+
+ list = g_list_append (list, dest);
+ g_hash_table_insert (rcpt_hash, (char *) addr, GINT_TO_POINTER (1));
+ }
+ }
}
- g_hash_table_destroy (account_hash);
-
return list;
}
static const MailConfigAccount *
guess_me (const CamelInternetAddress *to, const CamelInternetAddress *cc, const GSList *accounts)
{
- const MailConfigAccount *account;
- GHashTable *account_hash;
- const char *addr;
+ const char *name, *addr;
const GSList *l;
+ gboolean notme;
+ char *full;
int i;
- /* "optimization" */
- if (!to && !cc)
- return NULL;
-
- account_hash = g_hash_table_new (g_strcase_hash, g_strcase_equal);
- l = accounts;
- while (l) {
- account = l->data;
- g_hash_table_insert (account_hash, (char *) account->id->address, (void *) account);
- l = l->next;
- }
-
if (to) {
- for (i = 0; camel_internet_address_get (to, i, NULL, &addr); i++) {
- account = g_hash_table_lookup (account_hash, addr);
- if (account)
- goto found;
+ for (i = 0; camel_internet_address_get (to, i, &name, &addr); i++) {
+ full = camel_internet_address_format_address (name, addr);
+ l = accounts;
+ while (l) {
+ const MailConfigAccount *acnt = l->data;
+
+ if (!g_strcasecmp (acnt->id->address, addr)) {
+ notme = FALSE;
+ return acnt;
+ }
+
+ l = l->next;
+ }
}
}
if (cc) {
- for (i = 0; camel_internet_address_get (cc, i, NULL, &addr); i++) {
- account = g_hash_table_lookup (account_hash, addr);
- if (account)
- goto found;
+ for (i = 0; camel_internet_address_get (cc, i, &name, &addr); i++) {
+ full = camel_internet_address_format_address (name, addr);
+ l = accounts;
+ while (l) {
+ const MailConfigAccount *acnt = l->data;
+
+ if (!g_strcasecmp (acnt->id->address, addr)) {
+ notme = FALSE;
+ return acnt;
+ }
+
+ l = l->next;
+ }
}
}
- account = NULL;
-
- found:
-
- g_hash_table_destroy (account_hash);
-
- return account;
-}
-
-inline static void
-mail_ignore (EMsgComposer *composer, const gchar *name, const gchar *address)
-{
- e_msg_composer_ignore (composer, name && *name ? name : address);
-}
-
-static void
-mail_ignore_address (EMsgComposer *composer, const CamelInternetAddress *addr)
-{
- const gchar *name, *address;
- gint i, max;
-
- max = camel_address_length (CAMEL_ADDRESS (addr));
- for (i = 0; i < max; i++) {
- camel_internet_address_get (addr, i, &name, &address);
- mail_ignore (composer, name, address);
- }
+ return NULL;
}
static EMsgComposer *
@@ -849,34 +816,46 @@ mail_generate_reply (CamelFolder *folder, CamelMimeMessage *message, const char
const CamelInternetAddress *reply_to, *sender, *to_addrs, *cc_addrs;
const char *name = NULL, *address = NULL, *source = NULL;
const char *message_id, *references, *reply_addr = NULL;
- char *text = NULL, *subject, date_str[100], *format;
+ char *text, *subject, date_str[100], *format;
const MailConfigAccount *me = NULL;
const GSList *accounts = NULL;
GList *to = NULL, *cc = NULL;
EDestination **tov, **ccv;
EMsgComposer *composer;
- CamelMimePart *part;
time_t date;
const int max_subject_length = 1024;
- composer = e_msg_composer_new ();
+ composer = e_msg_composer_new ();
+ e_msg_composer_add_message_attachments (composer, message, TRUE);
+
if (!composer)
return NULL;
- e_msg_composer_add_message_attachments (composer, message, TRUE);
+ sender = camel_mime_message_get_from (message);
+ if (sender != NULL && camel_address_length (CAMEL_ADDRESS (sender)) > 0) {
+ camel_internet_address_get (sender, 0, &name, &address);
+ } else {
+ name = _("an unknown sender");
+ }
+
+ date = camel_mime_message_get_date (message, NULL);
+
+ strftime (date_str, sizeof (date_str), _("On %a, %Y-%m-%d at %H:%M, %%s wrote:"),
+ localtime (&date));
+ format = e_utf8_from_locale_string (date_str);
+ text = mail_tool_quote_message (message, format, name && *name ? name : address);
+ g_free (format);
+
+ if (text) {
+ e_msg_composer_set_body_text (composer, text);
+ g_free (text);
+ }
/* Set the recipients */
accounts = mail_config_get_accounts ();
to_addrs = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_TO);
cc_addrs = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_CC);
- mail_ignore_address (composer, to_addrs);
- mail_ignore_address (composer, cc_addrs);
-
- /* default 'me' to the source account... */
- source = camel_mime_message_get_source (message);
- if (source)
- me = mail_config_get_account_by_source_url (source);
if (mode == REPLY_LIST) {
CamelMessageInfo *info;
@@ -919,21 +898,18 @@ mail_generate_reply (CamelFolder *folder, CamelMimeMessage *message, const char
}
}
- if (!me)
- me = guess_me (to_addrs, cc_addrs, accounts);
+ me = guess_me (to_addrs, cc_addrs, accounts);
} else {
GHashTable *rcpt_hash;
- rcpt_hash = g_hash_table_new (g_strcase_hash, g_strcase_equal);
+ rcpt_hash = g_hash_table_new (g_str_hash, g_str_equal);
reply_to = camel_mime_message_get_reply_to (message);
if (!reply_to)
reply_to = camel_mime_message_get_from (message);
if (reply_to) {
- int i;
-
- for (i = 0; camel_internet_address_get (reply_to, i, &name, &reply_addr); i++) {
- /* Get the Reply-To address so we can ignore references to it in the Cc: list */
+ /* Get the Reply-To address so we can ignore references to it in the Cc: list */
+ if (camel_internet_address_get (reply_to, 0, &name, &reply_addr)) {
EDestination *dest;
dest = e_destination_new ();
@@ -941,54 +917,24 @@ mail_generate_reply (CamelFolder *folder, CamelMimeMessage *message, const char
e_destination_set_email (dest, reply_addr);
to = g_list_append (to, dest);
g_hash_table_insert (rcpt_hash, (char *) reply_addr, GINT_TO_POINTER (1));
- mail_ignore (composer, name, reply_addr);
}
}
if (mode == REPLY_ALL) {
- cc = list_add_addresses (cc, to_addrs, accounts, rcpt_hash, me ? NULL : &me);
- cc = list_add_addresses (cc, cc_addrs, accounts, rcpt_hash, me ? NULL : &me);
+ cc = list_add_addresses (cc, to_addrs, accounts, rcpt_hash, &me, NULL);
+ cc = list_add_addresses (cc, cc_addrs, accounts, rcpt_hash, me ? NULL : &me, reply_addr);
} else {
- if (!me)
- me = guess_me (to_addrs, cc_addrs, accounts);
+ me = guess_me (to_addrs, cc_addrs, accounts);
}
g_hash_table_destroy (rcpt_hash);
}
- /* set body text here as we want all ignored words to take effect */
- switch (mail_config_get_default_reply_style ()) {
- case MAIL_CONFIG_REPLY_DO_NOT_QUOTE:
- /* do nothing */
- break;
- case MAIL_CONFIG_REPLY_ATTACH:
- /* attach the original message as an attachment */
- part = mail_tool_make_message_attachment (message);
- e_msg_composer_attach (composer, part);
- camel_object_unref (CAMEL_OBJECT (part));
- break;
- case MAIL_CONFIG_REPLY_QUOTED:
- default:
- /* do what any sane user would want when replying... */
- sender = camel_mime_message_get_from (message);
- if (sender != NULL && camel_address_length (CAMEL_ADDRESS (sender)) > 0) {
- camel_internet_address_get (sender, 0, &name, &address);
- } else {
- name = _("an unknown sender");
- }
-
- date = camel_mime_message_get_date (message, NULL);
- strftime (date_str, sizeof (date_str), _("On %a, %Y-%m-%d at %H:%M, %%s wrote:"),
- localtime (&date));
- format = e_utf8_from_locale_string (date_str);
- text = mail_tool_quote_message (message, format, name && *name ? name : address);
- mail_ignore (composer, name, address);
- g_free (format);
- if (text) {
- e_msg_composer_set_body_text (composer, text);
- g_free (text);
- }
- break;
+ if (me == NULL) {
+ /* as a last resort, set the replying account (aka me)
+ to the account this was fetched from */
+ source = camel_mime_message_get_source (message);
+ me = mail_config_get_account_by_source_url (source);
}
/* Set the subject of the new message. */
@@ -1048,8 +994,6 @@ mail_generate_reply (CamelFolder *folder, CamelMimeMessage *message, const char
e_msg_composer_add_header (composer, "References", references);
}
- e_msg_composer_drop_editor_undo (composer);
-
return composer;
}
@@ -1058,8 +1002,7 @@ requeue_mail_reply (CamelFolder *folder, char *uid, CamelMimeMessage *msg, void
{
int mode = GPOINTER_TO_INT (data);
- if (msg != NULL)
- mail_reply (folder, msg, uid, mode);
+ mail_reply (folder, msg, uid, mode);
}
void
@@ -1082,7 +1025,6 @@ mail_reply (CamelFolder *folder, CamelMimeMessage *msg, const char *uid, int mod
camel_object_ref (CAMEL_OBJECT (psd->folder));
psd->uid = g_strdup (uid);
psd->flags = CAMEL_MESSAGE_ANSWERED;
- psd->set = CAMEL_MESSAGE_ANSWERED;
composer = mail_generate_reply (folder, msg, uid, mode);
if (!composer)
@@ -1092,8 +1034,6 @@ mail_reply (CamelFolder *folder, CamelMimeMessage *msg, const char *uid, int mod
GTK_SIGNAL_FUNC (composer_send_cb), psd);
gtk_signal_connect (GTK_OBJECT (composer), "postpone",
GTK_SIGNAL_FUNC (composer_postpone_cb), psd);
- gtk_signal_connect (GTK_OBJECT (composer), "save-draft",
- GTK_SIGNAL_FUNC (composer_save_draft_cb), NULL);
gtk_signal_connect (GTK_OBJECT (composer), "destroy",
GTK_SIGNAL_FUNC (free_psd), psd);
@@ -1106,10 +1046,13 @@ reply_to_sender (GtkWidget *widget, gpointer user_data)
{
FolderBrowser *fb = FOLDER_BROWSER (user_data);
+ /* FIXME: make this always load the message based on cursor */
+
if (FOLDER_BROWSER_IS_DESTROYED (fb) || !check_send_configuration (fb))
return;
- mail_reply(fb->folder, NULL, fb->message_list->cursor_uid, REPLY_SENDER);
+ mail_reply (fb->folder, fb->mail_display->current_message,
+ fb->message_list->cursor_uid, REPLY_SENDER);
}
void
@@ -1120,7 +1063,10 @@ reply_to_list (GtkWidget *widget, gpointer user_data)
if (FOLDER_BROWSER_IS_DESTROYED (fb) || !check_send_configuration (fb))
return;
- mail_reply (fb->folder, NULL, fb->message_list->cursor_uid, REPLY_LIST);
+ /* FIXME: make this always load the message based on cursor */
+
+ mail_reply (fb->folder, fb->mail_display->current_message,
+ fb->message_list->cursor_uid, REPLY_LIST);
}
void
@@ -1131,7 +1077,10 @@ reply_to_all (GtkWidget *widget, gpointer user_data)
if (FOLDER_BROWSER_IS_DESTROYED (fb) || !check_send_configuration (fb))
return;
- mail_reply(fb->folder, NULL, fb->message_list->cursor_uid, REPLY_ALL);
+ /* FIXME: make this always load the message based on cursor */
+
+ mail_reply (fb->folder, fb->mail_display->current_message,
+ fb->message_list->cursor_uid, REPLY_ALL);
}
void
@@ -1176,8 +1125,6 @@ forward_get_composer (CamelMimeMessage *message, const char *subject)
GTK_SIGNAL_FUNC (composer_send_cb), NULL);
gtk_signal_connect (GTK_OBJECT (composer), "postpone",
GTK_SIGNAL_FUNC (composer_postpone_cb), NULL);
- gtk_signal_connect (GTK_OBJECT (composer), "save-draft",
- GTK_SIGNAL_FUNC (composer_save_draft_cb), NULL);
e_msg_composer_set_headers (composer, account->name, NULL, NULL, NULL, subject);
} else {
g_warning ("Could not create composer");
@@ -1204,6 +1151,7 @@ do_forward_non_attached (CamelFolder *folder, char *uid, CamelMimeMessage *messa
CamelDataWrapper *wrapper;
e_msg_composer_set_body_text (composer, text);
+ e_msg_composer_show_sig_file (composer);
wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (message));
if (CAMEL_IS_MULTIPART (wrapper))
@@ -1211,7 +1159,6 @@ do_forward_non_attached (CamelFolder *folder, char *uid, CamelMimeMessage *messa
gtk_widget_show (GTK_WIDGET (composer));
e_msg_composer_unset_changed (composer);
- e_msg_composer_drop_editor_undo (composer);
}
g_free (text);
}
@@ -1222,27 +1169,21 @@ do_forward_non_attached (CamelFolder *folder, char *uid, CamelMimeMessage *messa
static void
forward_message (FolderBrowser *fb, MailConfigForwardStyle style)
{
- GPtrArray *uids;
- int i;
-
if (FOLDER_BROWSER_IS_DESTROYED (fb))
return;
if (!check_send_configuration (fb))
return;
- uids = g_ptr_array_new ();
- message_list_foreach (fb->message_list, enumerate_msg, uids);
-
- for (i = 0; i < uids->len; i++) {
- mail_get_message (fb->folder, uids->pdata[i],
- do_forward_non_attached,
- GINT_TO_POINTER (style),
+ if (fb->mail_display && fb->mail_display->current_message) {
+ do_forward_non_attached (fb->folder, NULL,
+ fb->mail_display->current_message,
+ GINT_TO_POINTER (style));
+ } else {
+ mail_get_message (fb->folder, fb->message_list->cursor_uid,
+ do_forward_non_attached, GINT_TO_POINTER (style),
mail_thread_new);
- g_free (uids->pdata[i]);
}
-
- g_ptr_array_free (uids, TRUE);
}
void
@@ -1268,7 +1209,6 @@ do_forward_attach (CamelFolder *folder, GPtrArray *messages, CamelMimePart *part
e_msg_composer_attach (composer, part);
gtk_widget_show (GTK_WIDGET (composer));
e_msg_composer_unset_changed (composer);
- e_msg_composer_drop_editor_undo (composer);
}
}
}
@@ -1299,96 +1239,6 @@ forward (GtkWidget *widget, gpointer user_data)
forward_message (user_data, style);
}
-static EMsgComposer *
-redirect_get_composer (CamelMimeMessage *message)
-{
- const MailConfigAccount *account = NULL;
- const CamelInternetAddress *to_addrs, *cc_addrs;
- const GSList *accounts = NULL;
- EMsgComposer *composer;
-
- g_return_val_if_fail (message != NULL, NULL);
-
- accounts = mail_config_get_accounts ();
- to_addrs = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_TO);
- cc_addrs = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_CC);
-
- account = guess_me (to_addrs, cc_addrs, accounts);
-
- if (!account) {
- const char *source;
-
- source = camel_mime_message_get_source (message);
- account = mail_config_get_account_by_source_url (source);
- }
-
- if (!account)
- account = mail_config_get_default_account ();
-
- /* QMail will refuse to send a message if it finds one of
- it's Delivered-To headers in the message, so remove all
- Delivered-To headers. Fixes bug #23635. */
- while (camel_medium_get_header (CAMEL_MEDIUM (message), "Delivered-To"))
- camel_medium_remove_header (CAMEL_MEDIUM (message), "Delivered-To");
-
- composer = e_msg_composer_new_redirect (message, account->name);
- if (composer) {
- gtk_signal_connect (GTK_OBJECT (composer), "send",
- GTK_SIGNAL_FUNC (composer_send_cb), NULL);
- gtk_signal_connect (GTK_OBJECT (composer), "postpone",
- GTK_SIGNAL_FUNC (composer_postpone_cb), NULL);
- gtk_signal_connect (GTK_OBJECT (composer), "save-draft",
- GTK_SIGNAL_FUNC (composer_save_draft_cb), NULL);
- } else {
- g_warning ("Could not create composer");
- }
-
- return composer;
-}
-
-static void
-do_redirect (CamelFolder *folder, char *uid, CamelMimeMessage *message, void *data)
-{
- EMsgComposer *composer;
-
- if (!message)
- return;
-
- composer = redirect_get_composer (message);
- if (composer) {
- CamelDataWrapper *wrapper;
-
- wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (message));
- if (CAMEL_IS_MULTIPART (wrapper))
- e_msg_composer_add_message_attachments (composer, message, FALSE);
-
- gtk_widget_show (GTK_WIDGET (composer));
- e_msg_composer_unset_changed (composer);
- e_msg_composer_drop_editor_undo (composer);
- }
-}
-
-void
-redirect (GtkWidget *widget, gpointer user_data)
-{
- FolderBrowser *fb = (FolderBrowser *) user_data;
-
- if (FOLDER_BROWSER_IS_DESTROYED (fb))
- return;
-
- if (!check_send_configuration (fb))
- return;
-
- if (fb->mail_display && fb->mail_display->current_message) {
- do_redirect (fb->folder, NULL,
- fb->mail_display->current_message,
- NULL);
- } else {
- mail_get_message (fb->folder, fb->message_list->cursor_uid,
- do_redirect, NULL, mail_thread_new);
- }
-}
-
static void
transfer_msg_done (gboolean ok, void *data)
{
@@ -1403,10 +1253,10 @@ transfer_msg_done (gboolean ok, void *data)
are hidden, select the previous */
if ((row + 1 == e_tree_row_count (fb->message_list->tree))
&& mail_config_get_hide_deleted ())
- message_list_select (fb->message_list, MESSAGE_LIST_SELECT_PREVIOUS,
+ message_list_select (fb->message_list, row, MESSAGE_LIST_SELECT_PREVIOUS,
0, CAMEL_MESSAGE_DELETED, FALSE);
else
- message_list_select (fb->message_list, MESSAGE_LIST_SELECT_NEXT,
+ message_list_select (fb->message_list, row, MESSAGE_LIST_SELECT_NEXT,
0, 0, FALSE);
}
@@ -1416,35 +1266,38 @@ transfer_msg_done (gboolean ok, void *data)
static void
transfer_msg (FolderBrowser *fb, gboolean delete_from_source)
{
- static const char *allowed_types[] = { "mail", "vtrash", NULL };
+ const char *allowed_types[] = { "mail", "vtrash", NULL };
extern EvolutionShellClient *global_shell_client;
- GNOME_Evolution_Folder *folder;
- static char *last_uri = NULL;
+ char *uri, *physical, *path, *desc;
+ static char *last = NULL;
GPtrArray *uids;
- char *desc;
if (FOLDER_BROWSER_IS_DESTROYED (fb))
return;
- if (last_uri == NULL)
- last_uri = g_strdup ("");
+ if (last == NULL)
+ last = g_strdup ("");
if (delete_from_source)
desc = _("Move message(s) to");
else
desc = _("Copy message(s) to");
+ uri = NULL;
+ physical = NULL;
evolution_shell_client_user_select_folder (global_shell_client,
GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (fb))),
- desc, last_uri, allowed_types,
- &folder);
- if (!folder)
+ desc, last,
+ allowed_types, &uri, &physical);
+ if (!uri)
return;
- if (strcmp (last_uri, folder->evolutionUri) != 0) {
- g_free (last_uri);
- last_uri = g_strdup (folder->evolutionUri);
+ path = strchr (uri, '/');
+ if (path && strcmp (last, path) != 0) {
+ g_free (last);
+ last = g_strdup_printf ("evolution:%s", path);
}
+ g_free (uri);
uids = g_ptr_array_new ();
message_list_foreach (fb->message_list, enumerate_msg, uids);
@@ -1452,13 +1305,12 @@ transfer_msg (FolderBrowser *fb, gboolean delete_from_source)
if (delete_from_source) {
gtk_object_ref (GTK_OBJECT (fb));
mail_transfer_messages (fb->folder, uids, delete_from_source,
- folder->physicalUri, 0,
- transfer_msg_done, fb);
+ physical, 0, transfer_msg_done, fb);
} else {
mail_transfer_messages (fb->folder, uids, delete_from_source,
- folder->physicalUri, 0, NULL, NULL);
+ physical, 0, NULL, NULL);
}
- CORBA_free (folder);
+ g_free(physical);
}
void
@@ -1527,26 +1379,27 @@ void
addrbook_sender (GtkWidget *widget, gpointer user_data)
{
FolderBrowser *fb = FOLDER_BROWSER (user_data);
- const char *addr_str;
- CamelMessageInfo *info;
+ CamelMimeMessage *msg = NULL;
+ const CamelInternetAddress *addr;
+ gchar *addr_str;
GtkWidget *win;
GtkWidget *control;
GtkWidget *socket;
- GPtrArray *uids;
- int i;
-
+
+ /* FIXME: make this use the cursor message id */
+
if (FOLDER_BROWSER_IS_DESTROYED (fb))
return;
-
- uids = g_ptr_array_new();
- message_list_foreach(fb->message_list, enumerate_msg, uids);
- if (uids->len != 1)
- goto done;
-
- info = camel_folder_get_message_info(fb->folder, uids->pdata[0]);
- if (info == NULL
- || (addr_str = camel_message_info_from(info)) == NULL)
- goto done;
+
+ msg = fb->mail_display->current_message;
+ if (msg == NULL)
+ return;
+
+ addr = camel_mime_message_get_from (msg);
+ if (addr == NULL)
+ return;
+
+ addr_str = camel_address_format (CAMEL_ADDRESS (addr));
win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (win), _("Sender"));
@@ -1568,11 +1421,6 @@ addrbook_sender (GtkWidget *widget, gpointer user_data)
gtk_container_add (GTK_CONTAINER (win), control);
gtk_widget_show_all (win);
-
-done:
- for (i=0; i < uids->len; i++)
- g_free(uids->pdata[i]);
- g_ptr_array_free(uids, TRUE);
}
void
@@ -1605,13 +1453,9 @@ select_all (BonoboUIComponent *uih, void *user_data, const char *path)
if (FOLDER_BROWSER_IS_DESTROYED (fb))
return;
- if (GTK_WIDGET_HAS_FOCUS (fb->mail_display->html)) {
- gtk_html_select_all (fb->mail_display->html);
- } else {
- etsm = e_tree_get_selection_model (fb->message_list->tree);
-
- e_selection_model_select_all (etsm);
- }
+ etsm = e_tree_get_selection_model (fb->message_list->tree);
+
+ e_selection_model_select_all (etsm);
}
/* Thread selection */
@@ -1636,7 +1480,7 @@ thread_select_foreach (ETreePath path, gpointer user_data)
thread_select_info_t *tsi = (thread_select_info_t *) user_data;
ETreeModel *tm = tsi->ml->model;
ETreePath node;
-
+
/* @path part of the initial selection. If it has children,
* we select them as well. If it doesn't, we select its siblings and
* their children (ie, the current node must be inside the thread
@@ -1695,11 +1539,9 @@ invert_selection (BonoboUIComponent *uih, void *user_data, const char *path)
if (FOLDER_BROWSER_IS_DESTROYED (fb))
return;
- if (GTK_WIDGET_HAS_FOCUS (fb->message_list)) {
- etsm = e_tree_get_selection_model (fb->message_list->tree);
-
- e_selection_model_invert_selection (etsm);
- }
+ etsm = e_tree_get_selection_model (fb->message_list->tree);
+
+ e_selection_model_invert_selection (etsm);
}
/* flag all selected messages. Return number flagged */
@@ -1741,24 +1583,18 @@ toggle_flags (FolderBrowser *fb, guint32 mask)
message_list_foreach (fb->message_list, enumerate_msg, uids);
camel_folder_freeze (fb->folder);
for (i = 0; i < uids->len; i++) {
- guint32 flags;
+ int flags;
- flags = ~(camel_folder_get_message_flags (fb->folder, uids->pdata[i]));
-
- /* if we're flagging a message important, always undelete it too */
- if (mask & flags & CAMEL_MESSAGE_FLAGGED) {
- flags &= ~CAMEL_MESSAGE_DELETED;
- mask |= CAMEL_MESSAGE_DELETED;
- }
-
- /* if we're flagging a message deleted, always mark it seen too */
- if (mask & flags & CAMEL_MESSAGE_DELETED) {
- flags |= CAMEL_MESSAGE_SEEN;
- mask |= CAMEL_MESSAGE_SEEN;
+ flags = camel_folder_get_message_flags (fb->folder, uids->pdata[i]);
+
+ if (flags & mask)
+ camel_folder_set_message_flags (fb->folder, uids->pdata[i], mask, 0);
+ else {
+ if ((mask & CAMEL_MESSAGE_FLAGGED) && (flags & CAMEL_MESSAGE_DELETED))
+ camel_folder_set_message_flags (fb->folder, uids->pdata[i], CAMEL_MESSAGE_DELETED, 0);
+ camel_folder_set_message_flags (fb->folder, uids->pdata[i], mask, mask);
}
-
- camel_folder_set_message_flags (fb->folder, uids->pdata[i], mask, flags);
-
+
g_free (uids->pdata[i]);
}
camel_folder_thaw (fb->folder);
@@ -1812,7 +1648,8 @@ mark_all_as_seen (BonoboUIComponent *uih, void *user_data, const char *path)
void
mark_as_important (BonoboUIComponent *uih, void *user_data, const char *path)
{
- flag_messages (FOLDER_BROWSER (user_data), CAMEL_MESSAGE_FLAGGED|CAMEL_MESSAGE_DELETED, CAMEL_MESSAGE_FLAGGED);
+ flag_messages (FOLDER_BROWSER (user_data), CAMEL_MESSAGE_DELETED, 0);
+ flag_messages (FOLDER_BROWSER (user_data), CAMEL_MESSAGE_FLAGGED, CAMEL_MESSAGE_FLAGGED);
}
void
@@ -1827,170 +1664,6 @@ toggle_as_important (BonoboUIComponent *uih, void *user_data, const char *path)
toggle_flags (FOLDER_BROWSER (user_data), CAMEL_MESSAGE_FLAGGED);
}
-
-struct _tag_editor_data {
- MessageTagEditor *editor;
- FolderBrowser *fb;
- GPtrArray *uids;
-};
-
-static void
-tag_editor_ok (GtkWidget *button, gpointer user_data)
-{
- struct _tag_editor_data *data = user_data;
- const char *name, *value;
- int i;
-
- if (FOLDER_BROWSER_IS_DESTROYED (data->fb))
- goto done;
-
- name = message_tag_editor_get_name (data->editor);
- if (!name)
- goto done;
-
- value = message_tag_editor_get_value (data->editor);
-
- camel_folder_freeze (data->fb->folder);
- for (i = 0; i < data->uids->len; i++) {
- camel_folder_set_message_user_tag (data->fb->folder, data->uids->pdata[i], name, value);
- }
- camel_folder_thaw (data->fb->folder);
-
- done:
- gtk_widget_destroy (GTK_WIDGET (data->editor));
-}
-
-static void
-tag_editor_cancel (GtkWidget *button, gpointer user_data)
-{
- struct _tag_editor_data *data = user_data;
-
- gtk_widget_destroy (GTK_WIDGET (data->editor));
-}
-
-static void
-tag_editor_destroy (GnomeDialog *dialog, gpointer user_data)
-{
- struct _tag_editor_data *data = user_data;
-
- gtk_object_unref (GTK_OBJECT (data->fb));
- g_ptr_array_free (data->uids, TRUE);
- g_free (data);
-}
-
-void
-flag_for_followup (BonoboUIComponent *uih, void *user_data, const char *path)
-{
- FolderBrowser *fb = FOLDER_BROWSER (user_data);
- struct _tag_editor_data *data;
- GtkWidget *editor;
- GPtrArray *uids;
- int i;
-
- if (FOLDER_BROWSER_IS_DESTROYED (fb))
- return;
-
- uids = g_ptr_array_new ();
- message_list_foreach (fb->message_list, enumerate_msg, uids);
-
- editor = (GtkWidget *) message_tag_followup_new ();
-
- data = g_new (struct _tag_editor_data, 1);
- data->editor = MESSAGE_TAG_EDITOR (editor);
- gtk_widget_ref (GTK_WIDGET (fb));
- data->fb = fb;
- data->uids = uids;
-
- for (i = 0; i < uids->len; i++) {
- CamelMessageInfo *info;
-
- info = camel_folder_get_message_info (fb->folder, uids->pdata[i]);
- message_tag_followup_append_message (MESSAGE_TAG_FOLLOWUP (editor),
- camel_message_info_from (info),
- camel_message_info_subject (info));
- }
-
- gnome_dialog_button_connect (GNOME_DIALOG (editor), 0, tag_editor_ok, data);
- gnome_dialog_button_connect (GNOME_DIALOG (editor), 1, tag_editor_cancel, data);
- gnome_dialog_set_close (GNOME_DIALOG (editor), TRUE);
-
- /* special-case... */
- if (uids->len == 1) {
- const char *tag_value;
-
- tag_value = camel_folder_get_message_user_tag (fb->folder, uids->pdata[0], "follow-up");
- if (tag_value)
- message_tag_editor_set_value (MESSAGE_TAG_EDITOR (editor), tag_value);
- }
-
- gtk_signal_connect (GTK_OBJECT (editor), "destroy",
- tag_editor_destroy, data);
-
- gtk_widget_show (editor);
-}
-
-void
-flag_followup_completed (BonoboUIComponent *uih, void *user_data, const char *path)
-{
- FolderBrowser *fb = FOLDER_BROWSER (user_data);
- GPtrArray *uids;
- time_t now;
- int i;
-
- if (FOLDER_BROWSER_IS_DESTROYED (fb))
- return;
-
- uids = g_ptr_array_new ();
- message_list_foreach (fb->message_list, enumerate_msg, uids);
-
- now = time (NULL);
-
- camel_folder_freeze (fb->folder);
- for (i = 0; i < uids->len; i++) {
- struct _FollowUpTag *tag;
- const char *tag_value;
- char *value;
-
- tag_value = camel_folder_get_message_user_tag (fb->folder, uids->pdata[i], "follow-up");
- if (!tag_value)
- continue;
-
- tag = message_tag_followup_decode (tag_value);
- tag->completed = now;
-
- value = message_tag_followup_encode (tag);
- g_free (tag);
-
- camel_folder_set_message_user_tag (fb->folder, uids->pdata[i], "follow-up", value);
- g_free (value);
- }
- camel_folder_thaw (fb->folder);
-
- g_ptr_array_free (uids, TRUE);
-}
-
-void
-flag_followup_clear (BonoboUIComponent *uih, void *user_data, const char *path)
-{
- FolderBrowser *fb = FOLDER_BROWSER (user_data);
- GPtrArray *uids;
- int i;
-
- if (FOLDER_BROWSER_IS_DESTROYED (fb))
- return;
-
- uids = g_ptr_array_new ();
- message_list_foreach (fb->message_list, enumerate_msg, uids);
-
- camel_folder_freeze (fb->folder);
- for (i = 0; i < uids->len; i++) {
- camel_folder_set_message_user_tag (fb->folder, uids->pdata[i], "follow-up", NULL);
- }
- camel_folder_thaw (fb->folder);
-
- g_ptr_array_free (uids, TRUE);
-}
-
void
zoom_in (BonoboUIComponent *uih, void *user_data, const char *path)
{
@@ -2035,8 +1708,10 @@ do_edit_messages (CamelFolder *folder, GPtrArray *uids, GPtrArray *messages, voi
for (i = 0; i < messages->len; i++) {
EMsgComposer *composer;
- char *uid;
+ XEvolution *hdrs;
+ hdrs = mail_tool_remove_xevolution_headers (messages->pdata[i]);
+ mail_tool_destroy_xevolution (hdrs);
camel_medium_remove_header (CAMEL_MEDIUM (messages->pdata[i]), "X-Mailer");
composer = e_msg_composer_new_with_message (messages->pdata[i]);
@@ -2047,12 +1722,6 @@ do_edit_messages (CamelFolder *folder, GPtrArray *uids, GPtrArray *messages, voi
gtk_signal_connect (GTK_OBJECT (composer), "postpone",
composer_postpone_cb, NULL);
- uid = g_strdup (uids->pdata[i]);
- gtk_object_set_data_full (GTK_OBJECT (composer), "uid", uid, (GtkDestroyNotify) g_free);
-
- gtk_signal_connect (GTK_OBJECT (composer), "save-draft",
- composer_save_draft_cb, uid);
-
gtk_widget_show (GTK_WIDGET (composer));
}
}
@@ -2311,12 +1980,6 @@ save_msg (GtkWidget *widget, gpointer user_data)
}
void
-colour_msg (GtkWidget *widget, gpointer user_data)
-{
- /* FIXME: implement me? */
-}
-
-void
delete_msg (GtkWidget *button, gpointer user_data)
{
FolderBrowser *fb = FOLDER_BROWSER (user_data);
@@ -2337,10 +2000,10 @@ delete_msg (GtkWidget *button, gpointer user_data)
are hidden, select the previous */
if ((row+1 == e_tree_row_count (fb->message_list->tree))
&& mail_config_get_hide_deleted ())
- message_list_select (fb->message_list, MESSAGE_LIST_SELECT_PREVIOUS,
+ message_list_select (fb->message_list, row, MESSAGE_LIST_SELECT_PREVIOUS,
0, CAMEL_MESSAGE_DELETED, FALSE);
else
- message_list_select (fb->message_list, MESSAGE_LIST_SELECT_NEXT,
+ message_list_select (fb->message_list, row, MESSAGE_LIST_SELECT_NEXT,
0, 0, FALSE);
}
}
@@ -2351,208 +2014,58 @@ undelete_msg (GtkWidget *button, gpointer user_data)
flag_messages (FOLDER_BROWSER (user_data), CAMEL_MESSAGE_DELETED, 0);
}
-
-static gboolean
-confirm_goto_next_folder (FolderBrowser *fb)
-{
- GtkWidget *dialog, *label, *checkbox;
- int button;
-
- if (!mail_config_get_confirm_goto_next_folder ())
- return mail_config_get_goto_next_folder ();
-
- dialog = gnome_dialog_new (_("Go to next folder with unread messages?"),
- GNOME_STOCK_BUTTON_YES,
- GNOME_STOCK_BUTTON_NO,
- NULL);
-
- e_gnome_dialog_set_parent (GNOME_DIALOG (dialog), FB_WINDOW (fb));
-
- label = gtk_label_new (_("There are no more new messages in this folder.\n"
- "Would you like to go to the next folder?"));
-
- gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
- gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
- gtk_widget_show (label);
- gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), label, TRUE, TRUE, 4);
-
- checkbox = gtk_check_button_new_with_label (_("Do not ask me again."));
- gtk_object_ref (GTK_OBJECT (checkbox));
- gtk_widget_show (checkbox);
- gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), checkbox, TRUE, TRUE, 4);
-
- button = gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
-
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbox)))
- mail_config_set_confirm_goto_next_folder (FALSE);
-
- gtk_object_unref (GTK_OBJECT (checkbox));
-
- if (button == 0) {
- mail_config_set_goto_next_folder (TRUE);
- return TRUE;
- } else {
- mail_config_set_goto_next_folder (FALSE);
- return FALSE;
- }
-}
-
-static CamelFolderInfo *
-find_current_folder (CamelFolderInfo *root, const char *current_uri)
-{
- CamelFolderInfo *node, *current = NULL;
-
- node = root;
- while (node) {
- if (!strcmp (current_uri, node->url)) {
- current = node;
- break;
- }
-
- current = find_current_folder (node->child, current_uri);
- if (current)
- break;
-
- node = node->sibling;
- }
-
- return current;
-}
-
-static CamelFolderInfo *
-find_next_folder_r (CamelFolderInfo *node)
-{
- CamelFolderInfo *next;
-
- while (node) {
- if (node->unread_message_count > 0)
- return node;
-
- next = find_next_folder_r (node->child);
- if (next)
- return next;
-
- node = node->sibling;
- }
-
- return NULL;
-}
-
-static CamelFolderInfo *
-find_next_folder (CamelFolderInfo *current)
-{
- CamelFolderInfo *next;
-
- /* first search subfolders... */
- next = find_next_folder_r (current->child);
- if (next)
- return next;
-
- /* now search siblings... */
- next = find_next_folder_r (current->sibling);
- if (next)
- return next;
-
- /* now go up one level (if we can) and search... */
- if (current->parent && current->parent->sibling) {
- return find_next_folder_r (current->parent->sibling);
- } else {
- return NULL;
- }
-}
-
-static void
-do_evil_kludgy_goto_next_folder_hack (FolderBrowser *fb)
-{
- CamelFolderInfo *root, *current, *node;
- CORBA_Environment ev;
- CamelStore *store;
-
- store = camel_folder_get_parent_store (fb->folder);
-
- /* FIXME: loop over all available mail stores? */
-
- root = camel_store_get_folder_info (store, "", CAMEL_STORE_FOLDER_INFO_RECURSIVE |
- CAMEL_STORE_FOLDER_INFO_SUBSCRIBED, NULL);
-
- if (!root)
- return;
-
- current = find_current_folder (root, fb->uri);
- g_assert (current != NULL);
-
- node = find_next_folder (current);
- if (node) {
- g_warning ("doin' my thang...");
- CORBA_exception_init (&ev);
- GNOME_Evolution_ShellView_changeCurrentView (fb->shell_view, "evolution:/local/Inbox", &ev);
- if (ev._major != CORBA_NO_EXCEPTION)
- g_warning ("got an exception");
- CORBA_exception_free (&ev);
- } else {
- g_warning ("can't find a folder with unread mail?");
- }
-
- camel_store_free_folder_info (store, root);
-}
-
void
next_msg (GtkWidget *button, gpointer user_data)
{
FolderBrowser *fb = FOLDER_BROWSER (user_data);
+ int row;
if (FOLDER_BROWSER_IS_DESTROYED (fb))
return;
- message_list_select (fb->message_list, MESSAGE_LIST_SELECT_NEXT, 0, 0, FALSE);
+ row = e_tree_row_of_node (fb->message_list->tree, e_tree_get_cursor (fb->message_list->tree));
+ message_list_select (fb->message_list, row, MESSAGE_LIST_SELECT_NEXT, 0, 0, FALSE);
}
void
next_unread_msg (GtkWidget *button, gpointer user_data)
{
FolderBrowser *fb = FOLDER_BROWSER (user_data);
+ int row;
if (FOLDER_BROWSER_IS_DESTROYED (fb))
return;
- if (!message_list_select (fb->message_list, MESSAGE_LIST_SELECT_NEXT, 0, CAMEL_MESSAGE_SEEN, TRUE)) {
- if (confirm_goto_next_folder (fb))
- do_evil_kludgy_goto_next_folder_hack (fb);
- }
+ row = e_tree_row_of_node (fb->message_list->tree, e_tree_get_cursor (fb->message_list->tree));
+ message_list_select (fb->message_list, row, MESSAGE_LIST_SELECT_NEXT,
+ 0, CAMEL_MESSAGE_SEEN, TRUE);
}
void
next_flagged_msg (GtkWidget *button, gpointer user_data)
{
FolderBrowser *fb = FOLDER_BROWSER (user_data);
+ int row;
if (FOLDER_BROWSER_IS_DESTROYED (fb))
return;
- message_list_select (fb->message_list, MESSAGE_LIST_SELECT_NEXT,
+ row = e_tree_row_of_node (fb->message_list->tree, e_tree_get_cursor (fb->message_list->tree));
+ message_list_select (fb->message_list, row, MESSAGE_LIST_SELECT_NEXT,
CAMEL_MESSAGE_FLAGGED, CAMEL_MESSAGE_FLAGGED, FALSE);
}
void
-next_thread (GtkWidget *button, gpointer user_data)
-{
- FolderBrowser *fb = FOLDER_BROWSER (user_data);
-
- if (FOLDER_BROWSER_IS_DESTROYED (fb))
- return;
-
- message_list_select_next_thread (fb->message_list);
-}
-
-void
previous_msg (GtkWidget *button, gpointer user_data)
{
FolderBrowser *fb = FOLDER_BROWSER (user_data);
+ int row;
if (FOLDER_BROWSER_IS_DESTROYED (fb))
return;
- message_list_select (fb->message_list, MESSAGE_LIST_SELECT_PREVIOUS,
+ row = e_tree_row_of_node (fb->message_list->tree, e_tree_get_cursor (fb->message_list->tree));
+ message_list_select (fb->message_list, row, MESSAGE_LIST_SELECT_PREVIOUS,
0, 0, FALSE);
}
@@ -2560,11 +2073,13 @@ void
previous_unread_msg (GtkWidget *button, gpointer user_data)
{
FolderBrowser *fb = FOLDER_BROWSER (user_data);
+ int row;
if (FOLDER_BROWSER_IS_DESTROYED (fb))
return;
- message_list_select (fb->message_list, MESSAGE_LIST_SELECT_PREVIOUS,
+ row = e_tree_row_of_node (fb->message_list->tree, e_tree_get_cursor (fb->message_list->tree));
+ message_list_select (fb->message_list, row, MESSAGE_LIST_SELECT_PREVIOUS,
0, CAMEL_MESSAGE_SEEN, TRUE);
}
@@ -2572,24 +2087,34 @@ void
previous_flagged_msg (GtkWidget *button, gpointer user_data)
{
FolderBrowser *fb = FOLDER_BROWSER (user_data);
+ int row;
if (FOLDER_BROWSER_IS_DESTROYED (fb))
return;
- message_list_select (fb->message_list, MESSAGE_LIST_SELECT_PREVIOUS,
+ row = e_tree_row_of_node (fb->message_list->tree, e_tree_get_cursor (fb->message_list->tree));
+ message_list_select (fb->message_list, row, MESSAGE_LIST_SELECT_PREVIOUS,
CAMEL_MESSAGE_FLAGGED, CAMEL_MESSAGE_FLAGGED, TRUE);
}
+struct _expunged_folder_data {
+ FolderBrowser *fb;
+ gboolean hidedeleted;
+};
+
static void
expunged_folder (CamelFolder *f, void *data)
{
- FolderBrowser *fb = data;
+ FolderBrowser *fb = ((struct _expunged_folder_data *) data)->fb;
+ gboolean hidedeleted = ((struct _expunged_folder_data *) data)->hidedeleted;
if (FOLDER_BROWSER_IS_DESTROYED (fb))
return;
fb->expunging = NULL;
- gtk_widget_set_sensitive (GTK_WIDGET (fb->message_list), TRUE);
+ message_list_set_hidedeleted (fb->message_list, hidedeleted);
+
+ g_free (data);
}
static gboolean
@@ -2620,9 +2145,6 @@ confirm_expunge (FolderBrowser *fb)
gtk_widget_show (checkbox);
gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), checkbox, TRUE, TRUE, 4);
- /* Set the 'No' button as the default */
- gnome_dialog_set_default (GNOME_DIALOG (dialog), 1);
-
button = gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
if (button == 0 && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbox)))
@@ -2645,10 +2167,15 @@ expunge_folder (BonoboUIComponent *uih, void *user_data, const char *path)
return;
if (fb->folder && (fb->expunging == NULL || fb->folder != fb->expunging) && confirm_expunge (fb)) {
+ struct _expunged_folder_data *data;
CamelMessageInfo *info;
+ data = g_malloc (sizeof (*data));
+ data->fb = fb;
+ data->hidedeleted = fb->message_list->hidedeleted;
+
/* hide the deleted messages so user can't click on them while we expunge */
- gtk_widget_set_sensitive (GTK_WIDGET (fb->message_list), FALSE);
+ message_list_set_hidedeleted (fb->message_list, TRUE);
/* Only blank the mail display if the message being
viewed is one of those to be expunged */
@@ -2656,11 +2183,11 @@ expunge_folder (BonoboUIComponent *uih, void *user_data, const char *path)
info = camel_folder_get_message_info (fb->folder, fb->loaded_uid);
if (!info || info->flags & CAMEL_MESSAGE_DELETED)
- mail_display_set_message (fb->mail_display, NULL, NULL);
+ mail_display_set_message (fb->mail_display, NULL);
}
fb->expunging = fb->folder;
- mail_expunge_folder (fb->folder, expunged_folder, fb);
+ mail_expunge_folder (fb->folder, expunged_folder, data);
}
}
@@ -2750,84 +2277,52 @@ vfolder_edit_vfolders (BonoboUIComponent *uih, void *user_data, const char *path
}
-/* static void
-header_print_cb (GtkHTML *html, GnomePrintContext *print_context,
- double x, double y, double width, double height, gpointer user_data)
-{
- printf ("header_print_cb %f,%f x %f,%f\n", x, y, width, height);
-
- gnome_print_newpath (print_context);
- gnome_print_setlinewidth (print_context, 12.0);
- gnome_print_setrgbcolor (print_context, 1.0, 0.0, 0.0);
- gnome_print_moveto (print_context, x, y);
- gnome_print_lineto (print_context, x+width, y-height);
- gnome_print_strokepath (print_context);
-} */
-
-struct footer_info {
- GnomeFont *local_font;
- gint page_num, pages;
-};
-
-static void
-footer_print_cb (GtkHTML *html, GnomePrintContext *print_context,
- double x, double y, double width, double height, gpointer user_data)
-{
- struct footer_info *info = (struct footer_info *) user_data;
-
- if (info->local_font) {
- gchar *text = g_strdup_printf (_("Page %d of %d"), info->page_num, info->pages);
- gdouble tw = gnome_font_get_width_string (info->local_font, text);
-
- gnome_print_newpath (print_context);
- gnome_print_setrgbcolor (print_context, .0, .0, .0);
- gnome_print_moveto (print_context, x + width - tw, y - gnome_font_get_ascender (info->local_font));
- gnome_print_setfont (print_context, info->local_font);
- gnome_print_show (print_context, text);
-
- g_free (text);
- info->page_num++;
- }
-}
+static MailAccountsDialog *accounts_dialog = NULL;
static void
-footer_info_free (struct footer_info *info)
+accounts_dialog_close (GtkWidget *widget, gpointer user_data)
{
- if (info->local_font)
- gnome_font_unref (info->local_font);
- g_free (info);
+ accounts_dialog = NULL;
}
-static struct footer_info *
-footer_info_new (GtkHTML *html, GnomePrintContext *pc, gdouble *line)
+void
+providers_config (BonoboUIComponent *uih, void *user_data, const char *path)
{
- struct footer_info *info;
-
- info = g_new (struct footer_info, 1);
- info->local_font = gnome_font_new_closest ("Helvetica", GNOME_FONT_BOOK, FALSE, 10);
- if (info->local_font) {
- *line = gnome_font_get_ascender (info->local_font) + gnome_font_get_descender (info->local_font);
+ FolderBrowser *fb = FOLDER_BROWSER (user_data);
+
+ if (FOLDER_BROWSER_IS_DESTROYED (fb))
+ return;
+
+ if (!accounts_dialog) {
+ accounts_dialog = mail_accounts_dialog_new (fb->shell);
+ gtk_widget_set_parent_window (GTK_WIDGET (accounts_dialog),
+ GTK_WIDGET (FB_WINDOW (fb))->window);
+ gtk_signal_connect (GTK_OBJECT (accounts_dialog), "destroy",
+ accounts_dialog_close, NULL);
+ gnome_dialog_set_close (GNOME_DIALOG (accounts_dialog), TRUE);
+ gtk_widget_show (GTK_WIDGET (accounts_dialog));
+ } else {
+ gdk_window_raise (GTK_WIDGET (accounts_dialog)->window);
+ gtk_widget_grab_focus (GTK_WIDGET (accounts_dialog));
}
- info->page_num = 1;
- info->pages = gtk_html_print_get_pages_num (html, pc, 0.0, *line);
-
- return info;
}
+/*
+ * FIXME: This routine could be made generic, by having a closure
+ * function plus data, and having the whole process be taken care
+ * of for you
+ */
static void
do_mail_print (FolderBrowser *fb, gboolean preview)
{
- GtkHTML *html;
GnomePrintContext *print_context;
GnomePrintMaster *print_master;
GnomePrintDialog *dialog;
GnomePrinter *printer = NULL;
GnomePaper *paper;
- gdouble line = 0.0;
int copies = 1;
int collate = FALSE;
- struct footer_info *info;
-
+
if (!preview) {
dialog = GNOME_PRINT_DIALOG (gnome_print_dialog_new (_("Print Message"),
GNOME_PRINT_DIALOG_COPIES));
@@ -2862,24 +2357,8 @@ do_mail_print (FolderBrowser *fb, gboolean preview)
gnome_print_master_set_paper (print_master, paper);
gnome_print_master_set_copies (print_master, copies, collate);
print_context = gnome_print_master_get_context (print_master);
-
- html = GTK_HTML (gtk_html_new ());
- mail_display_initialize_gtkhtml (fb->mail_display, html);
-
- /* Set our 'printing' flag to true and render. This causes us
- to ignoring any adjustments we made to accomodate the
- user's theme. */
- fb->mail_display->printing = TRUE;
-
- mail_display_render (fb->mail_display, html, TRUE);
- gtk_html_print_set_master (html, print_master);
-
- info = footer_info_new (html, print_context, &line);
- gtk_html_print_with_header_footer (html, print_context, 0.0, line, NULL, footer_print_cb, info);
- footer_info_free (info);
-
- fb->mail_display->printing = FALSE;
-
+ gtk_html_print_set_master (fb->mail_display->html, print_master);
+ gtk_html_print (fb->mail_display->html, print_context);
gnome_print_master_close (print_master);
if (preview){
@@ -2897,76 +2376,9 @@ do_mail_print (FolderBrowser *fb, gboolean preview)
_("Printing of message failed"));
}
}
-
- /* FIXME: We are leaking the GtkHTML object */
-}
-
-/* This is pretty evil. FolderBrowser's API should be extended to allow these sorts of
- things to be done in a more natural way. */
-
-/* <evil_code> */
-
-struct blarg_this_sucks {
- FolderBrowser *fb;
- gboolean preview;
-};
-
-static void
-done_message_selected (CamelFolder *folder, char *uid, CamelMimeMessage *msg, void *data)
-{
- struct blarg_this_sucks *blarg = data;
- FolderBrowser *fb = blarg->fb;
- gboolean preview = blarg->preview;
- const char *followup;
-
- g_free (blarg);
-
- followup = camel_folder_get_message_user_tag (folder, uid, "follow-up");
-
- mail_display_set_message (fb->mail_display, (CamelMedium *) msg, followup);
-
- g_free (fb->loaded_uid);
- fb->loaded_uid = fb->loading_uid;
- fb->loading_uid = NULL;
-
- do_mail_print (fb, preview);
-}
-
-/* Ack! Most of this is copied from folder-browser.c */
-static void
-do_mail_fetch_and_print (FolderBrowser *fb, gboolean preview)
-{
- if (!fb->preview_shown) {
- /* If the preview pane is closed, we have to do some
- extra magic to load the message. */
- struct blarg_this_sucks *blarg = g_new (struct blarg_this_sucks, 1);
-
- blarg->fb = fb;
- blarg->preview = preview;
-
- fb->loading_id = 0;
-
- /* if we are loading, then set a pending, but leave the loading, coudl cancel here (?) */
- if (fb->loading_uid) {
- g_free (fb->pending_uid);
- fb->pending_uid = g_strdup (fb->new_uid);
- } else {
- if (fb->new_uid) {
- fb->loading_uid = g_strdup (fb->new_uid);
- mail_get_message (fb->folder, fb->loading_uid, done_message_selected, blarg, mail_thread_new);
- } else {
- mail_display_set_message (fb->mail_display, NULL, NULL);
- g_free (blarg);
- }
- }
- } else {
- do_mail_print (fb, preview);
- }
+ gtk_object_unref (GTK_OBJECT (print_master));
}
-/* </evil_code> */
-
-
void
print_msg (GtkWidget *button, gpointer user_data)
{
@@ -2975,7 +2387,7 @@ print_msg (GtkWidget *button, gpointer user_data)
if (FOLDER_BROWSER_IS_DESTROYED (fb))
return;
- do_mail_fetch_and_print (fb, FALSE);
+ do_mail_print (fb, FALSE);
}
void
@@ -2986,7 +2398,7 @@ print_preview_msg (GtkWidget *button, gpointer user_data)
if (FOLDER_BROWSER_IS_DESTROYED (fb))
return;
- do_mail_fetch_and_print (fb, TRUE);
+ do_mail_print (fb, TRUE);
}
/******************** Begin Subscription Dialog ***************************/
@@ -3034,63 +2446,6 @@ configure_folder (BonoboUIComponent *uih, void *user_data, const char *path)
}
static void
-do_view_digest (CamelFolder *folder, char *uid, CamelMimeMessage *message, void *data)
-{
- FolderBrowser *folder_browser = FOLDER_BROWSER (data);
-
- if (FOLDER_BROWSER_IS_DESTROYED (folder_browser))
- return;
-
- if (message) {
- CamelFolder *digest;
- CamelStore *store;
- FolderBrowser *fb;
- GtkWidget *window;
-
- store = camel_digest_store_new ("digest:/");
-
- digest = camel_digest_folder_new (store, message);
- camel_object_unref (CAMEL_OBJECT (store));
- if (!digest)
- return;
-
- camel_folder_set_message_flags (folder, uid, CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_SEEN);
-
- fb = (FolderBrowser *) folder_browser_new (folder_browser->shell, NULL);
- folder_browser_set_message_preview (fb, TRUE);
- folder_browser_set_folder (fb, digest, "digest:/");
- camel_object_unref (CAMEL_OBJECT (digest));
- gtk_widget_show (GTK_WIDGET (fb));
-
- window = folder_browser_window_new (fb);
- gtk_widget_show (window);
- }
-}
-
-void
-view_digest (GtkWidget *widget, gpointer user_data)
-{
- FolderBrowser *fb = FOLDER_BROWSER (user_data);
- GPtrArray *uids;
- int i;
-
- if (FOLDER_BROWSER_IS_DESTROYED (fb))
- return;
-
- uids = g_ptr_array_new ();
- message_list_foreach (fb->message_list, enumerate_msg, uids);
-
- if (uids->len > 10 && !are_you_sure (_("Are you sure you want to open all %d messages in separate windows?"), uids, fb))
- return;
-
- for (i = 0; i < uids->len; i++) {
- mail_get_message (fb->folder, uids->pdata [i], do_view_digest, fb, mail_thread_queued);
- g_free (uids->pdata [i]);
- }
- g_ptr_array_free (uids, TRUE);
-}
-
-static void
do_view_message (CamelFolder *folder, char *uid, CamelMimeMessage *message, void *data)
{
FolderBrowser *fb = FOLDER_BROWSER (data);
@@ -3122,7 +2477,7 @@ view_msg (GtkWidget *widget, gpointer user_data)
if (uids->len > 10 && !are_you_sure (_("Are you sure you want to open all %d messages in separate windows?"), uids, fb))
return;
-
+
for (i = 0; i < uids->len; i++) {
mail_get_message (fb->folder, uids->pdata [i], do_view_message, fb, mail_thread_queued);
g_free (uids->pdata [i]);
diff --git a/mail/mail-callbacks.h b/mail/mail-callbacks.h
index 3c453623e0..f2bee415cf 100644
--- a/mail/mail-callbacks.h
+++ b/mail/mail-callbacks.h
@@ -37,14 +37,14 @@ extern "C" {
enum {
REPLY_SENDER,
REPLY_LIST,
- REPLY_ALL,
- REPLY_NO_QUOTE = 0x80 /* dont quote reply */
+ REPLY_ALL
};
void enumerate_msg (MessageList *ml, const char *uid, gpointer data);
void fetch_mail (GtkWidget *widget, gpointer user_data);
void send_queued_mail (GtkWidget *widget, gpointer user_data);
+void send_receive_mail (GtkWidget *widget, gpointer user_data);
void compose_msg (GtkWidget *widget, gpointer user_data);
void send_to_url (const char *url);
@@ -54,13 +54,10 @@ void forward_quoted (GtkWidget *widget, gpointer user_data);
void forward_attached (GtkWidget *widget, gpointer user_data);
void forward (GtkWidget *widget, gpointer user_data);
-void redirect (GtkWidget *widget, gpointer user_data);
-
void reply_to_sender (GtkWidget *widget, gpointer user_data);
void reply_to_list (GtkWidget *widget, gpointer user_data);
void reply_to_all (GtkWidget *widget, gpointer user_data);
-void colour_msg (GtkWidget *widget, gpointer user_data);
void delete_msg (GtkWidget *widget, gpointer user_data);
void undelete_msg (GtkWidget *widget, gpointer user_data);
void move_msg_cb (GtkWidget *widget, gpointer user_data);
@@ -73,12 +70,10 @@ void edit_msg (GtkWidget *widget, gpointer user_data);
void open_msg (GtkWidget *widget, gpointer user_data);
void save_msg (GtkWidget *widget, gpointer user_data);
void view_msg (GtkWidget *widget, gpointer user_data);
-void view_digest (GtkWidget *widget, gpointer user_data);
void view_source (GtkWidget *widget, gpointer user_data);
void next_msg (GtkWidget *widget, gpointer user_data);
void next_unread_msg (GtkWidget *widget, gpointer user_data);
void next_flagged_msg (GtkWidget *widget, gpointer user_data);
-void next_thread (GtkWidget *widget, gpointer user_data);
void previous_msg (GtkWidget *widget, gpointer user_data);
void previous_unread_msg (GtkWidget *widget, gpointer user_data);
void previous_flagged_msg (GtkWidget *widget, gpointer user_data);
@@ -86,21 +81,19 @@ void resend_msg (GtkWidget *widget, gpointer user_data);
void search_msg (GtkWidget *widget, gpointer user_data);
void load_images (GtkWidget *widget, gpointer user_data);
-void add_sender_to_addrbook (BonoboUIComponent *uih, void *user_data, const char *path);
-void move_msg (BonoboUIComponent *uih, void *user_data, const char *path);
-void copy_msg (BonoboUIComponent *uih, void *user_data, const char *path);
-void select_all (BonoboUIComponent *uih, void *user_data, const char *path);
-void select_thread (BonoboUIComponent *uih, void *user_data, const char *path);
-void invert_selection (BonoboUIComponent *uih, void *user_data, const char *path);
-void mark_as_seen (BonoboUIComponent *uih, void *user_data, const char *path);
-void mark_all_as_seen (BonoboUIComponent *uih, void *user_data, const char *path);
-void mark_as_unseen (BonoboUIComponent *uih, void *user_data, const char *path);
-void mark_as_important (BonoboUIComponent *uih, void *user_data, const char *path);
-void mark_as_unimportant (BonoboUIComponent *uih, void *user_data, const char *path);
-void toggle_as_important (BonoboUIComponent *uih, void *user_data, const char *path);
-void flag_for_followup (BonoboUIComponent *uih, void *user_data, const char *path);
-void flag_followup_completed (BonoboUIComponent *uih, void *user_data, const char *path);
-void flag_followup_clear (BonoboUIComponent *uih, void *user_data, const char *path);
+void add_sender_to_addrbook (BonoboUIComponent *uih, void *user_data, const char *path);
+void move_msg (BonoboUIComponent *uih, void *user_data, const char *path);
+void copy_msg (BonoboUIComponent *uih, void *user_data, const char *path);
+void add_sender_to_addrbook(BonoboUIComponent *uih, void *user_data, const char *path);
+void select_all (BonoboUIComponent *uih, void *user_data, const char *path);
+void select_thread (BonoboUIComponent *uih, void *user_data, const char *path);
+void invert_selection (BonoboUIComponent *uih, void *user_data, const char *path);
+void mark_as_seen (BonoboUIComponent *uih, void *user_data, const char *path);
+void mark_all_as_seen (BonoboUIComponent *uih, void *user_data, const char *path);
+void mark_as_unseen (BonoboUIComponent *uih, void *user_data, const char *path);
+void mark_as_important (BonoboUIComponent *uih, void *user_data, const char *path);
+void mark_as_unimportant (BonoboUIComponent *uih, void *user_data, const char *path);
+void toggle_as_important (BonoboUIComponent *uih, void *user_data, const char *path);
void zoom_in (BonoboUIComponent *uih, void *user_data, const char *path);
void zoom_out (BonoboUIComponent *uih, void *user_data, const char *path);
@@ -111,6 +104,7 @@ void open_message (BonoboUIComponent *uih, void *user_data, const char
void expunge_folder (BonoboUIComponent *uih, void *user_data, const char *path);
void filter_edit (BonoboUIComponent *uih, void *user_data, const char *path);
void vfolder_edit_vfolders (BonoboUIComponent *uih, void *user_data, const char *path);
+void providers_config (BonoboUIComponent *uih, void *user_data, const char *path);
void manage_subscriptions (BonoboUIComponent *uih, void *user_data, const char *path);
void configure_folder (BonoboUIComponent *uih, void *user_data, const char *path);
@@ -123,7 +117,6 @@ void mail_reply (CamelFolder *folder, CamelMimeMessage *msg, const ch
void composer_send_cb (EMsgComposer *composer, gpointer data);
void composer_postpone_cb (EMsgComposer *composer, gpointer data);
-void composer_save_draft_cb (EMsgComposer *composer, int quit, gpointer data);
void forward_messages (CamelFolder *folder, GPtrArray *uids, gboolean inline);
diff --git a/mail/mail-config.c b/mail/mail-config.c
index f874e56814..aa64ee2e61 100644
--- a/mail/mail-config.c
+++ b/mail/mail-config.c
@@ -1,7 +1,6 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* Authors: Jeffrey Stedfast <fejj@ximian.com>
- * Radek Doulik <rodo@ximian.com>
*
* Copyright 2001 Ximian, Inc. (www.ximian.com)
*
@@ -69,15 +68,6 @@
#include "Mail.h"
-
-MailConfigLabel label_defaults[5] = {
- { N_("Important"), 0x00ff0000 }, /* red */
- { N_("Work"), 0x00ff8c00 }, /* orange */
- { N_("Personal"), 0x00008b00 }, /* forest green */
- { N_("To Do"), 0x000000ff }, /* blue */
- { N_("Later"), 0x008b008b } /* magenta */
-};
-
typedef struct {
Bonobo_ConfigDatabase db;
@@ -86,7 +76,7 @@ typedef struct {
gboolean show_preview;
gboolean thread_list;
gboolean hide_deleted;
- int paned_size;
+ gint paned_size;
gboolean send_html;
gboolean confirm_unwanted_html;
gboolean citation_highlight;
@@ -94,14 +84,12 @@ typedef struct {
gboolean prompt_empty_subject;
gboolean prompt_only_bcc;
gboolean confirm_expunge;
- gboolean confirm_goto_next_folder;
- gboolean goto_next_folder;
gboolean do_seen_timeout;
- int seen_timeout;
+ gint seen_timeout;
gboolean empty_trash_on_exit;
GSList *accounts;
- int default_account;
+ gint default_account;
GSList *news;
@@ -110,9 +98,7 @@ typedef struct {
MailConfigHTTPMode http_mode;
MailConfigForwardStyle default_forward_style;
- MailConfigReplyStyle default_reply_style;
MailConfigDisplayStyle message_display_style;
- MailConfigXMailerDisplayStyle x_mailer_display_style;
char *default_charset;
GHashTable *threaded_hash;
@@ -120,17 +106,6 @@ typedef struct {
gboolean filter_log;
char *filter_log_path;
-
- MailConfigNewMailNotify notify;
- char *notify_filename;
-
- char *last_filesel_dir;
-
- GList *signature_list;
- int signatures;
- int signatures_random;
-
- MailConfigLabel labels[5];
} MailConfig;
static MailConfig *config = NULL;
@@ -139,36 +114,8 @@ static MailConfig *config = NULL;
/* Prototypes */
static void config_read (void);
-static void mail_config_set_default_account_num (int new_default);
-
-/* signatures */
-MailConfigSignature *
-signature_copy (const MailConfigSignature *sig)
-{
- MailConfigSignature *ns;
-
- g_return_val_if_fail (sig != NULL, NULL);
-
- ns = g_new (MailConfigSignature, 1);
-
- ns->id = sig->id;
- ns->name = g_strdup (sig->name);
- ns->filename = g_strdup (sig->filename);
- ns->script = g_strdup (sig->script);
- ns->random = sig->random;
- ns->html = sig->html;
-
- return ns;
-}
+static void mail_config_set_default_account_num (gint new_default);
-void
-signature_destroy (MailConfigSignature *sig)
-{
- g_free (sig->name);
- g_free (sig->filename);
- g_free (sig->script);
- g_free (sig);
-}
/* Identity */
MailConfigIdentity *
@@ -181,13 +128,11 @@ identity_copy (const MailConfigIdentity *id)
new = g_new0 (MailConfigIdentity, 1);
new->name = g_strdup (id->name);
new->address = g_strdup (id->address);
- new->reply_to = g_strdup (id->reply_to);
new->organization = g_strdup (id->organization);
- new->text_signature = id->text_signature;
- new->text_random = id->text_random;
- new->html_signature = id->html_signature;
- new->html_random = id->html_random;
-
+ new->signature = g_strdup (id->signature);
+ new->html_signature = g_strdup (id->html_signature);
+ new->has_html_signature = id->has_html_signature;
+
return new;
}
@@ -199,8 +144,9 @@ identity_destroy (MailConfigIdentity *id)
g_free (id->name);
g_free (id->address);
- g_free (id->reply_to);
g_free (id->organization);
+ g_free (id->signature);
+ g_free (id->html_signature);
g_free (id);
}
@@ -256,14 +202,11 @@ account_copy (const MailConfigAccount *account)
new->source = service_copy (account->source);
new->transport = service_copy (account->transport);
+ new->drafts_folder_name = g_strdup (account->drafts_folder_name);
new->drafts_folder_uri = g_strdup (account->drafts_folder_uri);
+ new->sent_folder_name = g_strdup (account->sent_folder_name);
new->sent_folder_uri = g_strdup (account->sent_folder_uri);
- new->always_cc = account->always_cc;
- new->cc_addrs = g_strdup (account->cc_addrs);
- new->always_bcc = account->always_bcc;
- new->bcc_addrs = g_strdup (account->bcc_addrs);
-
new->pgp_key = g_strdup (account->pgp_key);
new->pgp_encrypt_to_self = account->pgp_encrypt_to_self;
new->pgp_always_sign = account->pgp_always_sign;
@@ -287,12 +230,11 @@ account_destroy (MailConfigAccount *account)
service_destroy (account->source);
service_destroy (account->transport);
+ g_free (account->drafts_folder_name);
g_free (account->drafts_folder_uri);
+ g_free (account->sent_folder_name);
g_free (account->sent_folder_uri);
- g_free (account->cc_addrs);
- g_free (account->bcc_addrs);
-
g_free (account->pgp_key);
g_free (account->smime_key);
@@ -340,8 +282,6 @@ mail_config_init (void)
void
mail_config_clear (void)
{
- int i;
-
if (!config)
return;
@@ -356,261 +296,14 @@ mail_config_clear (void)
g_slist_free (config->news);
config->news = NULL;
}
-
- g_free (config->pgp_path);
- config->pgp_path = NULL;
-
- g_free (config->default_charset);
- config->default_charset = NULL;
-
- g_free (config->filter_log_path);
- config->filter_log_path = NULL;
-
- g_free (config->notify_filename);
- config->notify_filename = NULL;
-
- g_free (config->last_filesel_dir);
- config->last_filesel_dir = NULL;
-
- for (i = 0; i < 5; i++) {
- g_free (config->labels[i].name);
- config->labels[i].name = NULL;
- }
-}
-
-static MailConfigSignature *
-config_read_signature (gint i)
-{
- MailConfigSignature *sig;
- gchar *path, *val;
-
- sig = g_new0 (MailConfigSignature, 1);
-
- sig->id = i;
-
- path = g_strdup_printf ("/Mail/Signatures/name_%d", i);
- val = bonobo_config_get_string (config->db, path, NULL);
- g_free (path);
- if (val && *val)
- sig->name = val;
- else
- g_free (val);
-
- path = g_strdup_printf ("/Mail/Signatures/filename_%d", i);
- val = bonobo_config_get_string (config->db, path, NULL);
- g_free (path);
- if (val && *val)
- sig->filename = val;
- else
- g_free (val);
-
- path = g_strdup_printf ("/Mail/Signatures/script_%d", i);
- val = bonobo_config_get_string (config->db, path, NULL);
- g_free (path);
- if (val && *val)
- sig->script = val;
- else
- g_free (val);
-
- path = g_strdup_printf ("/Mail/Signatures/random_%d", i);
- sig->random = bonobo_config_get_boolean_with_default (config->db, path, FALSE, NULL);
-
- path = g_strdup_printf ("/Mail/Signatures/html_%d", i);
- sig->html = bonobo_config_get_boolean_with_default (config->db, path, FALSE, NULL);
-
- return sig;
-}
-
-static void
-config_read_signatures ()
-{
- MailConfigSignature *sig;
- gint i;
-
- config->signature_list = NULL;
- config->signatures_random = 0;
- config->signatures = bonobo_config_get_long_with_default (config->db, "/Mail/Signatures/num", 0, NULL);
-
- for (i = 0; i < config->signatures; i ++) {
- sig = config_read_signature (i);
- config->signature_list = g_list_append (config->signature_list, sig);
- if (sig->random)
- config->signatures_random ++;
- }
-}
-
-static void
-config_write_signature (MailConfigSignature *sig, gint i)
-{
- char *path;
-
- printf ("config_write_signature i: %d id: %d\n", i, sig->id);
-
- path = g_strdup_printf ("/Mail/Signatures/name_%d", i);
- bonobo_config_set_string (config->db, path, sig->name ? sig->name : "", NULL);
- g_free (path);
-
- path = g_strdup_printf ("/Mail/Signatures/filename_%d", i);
- bonobo_config_set_string (config->db, path, sig->filename ? sig->filename : "", NULL);
- g_free (path);
-
- path = g_strdup_printf ("/Mail/Signatures/script_%d", i);
- bonobo_config_set_string (config->db, path, sig->script ? sig->script : "", NULL);
- g_free (path);
-
- path = g_strdup_printf ("/Mail/Signatures/random_%d", i);
- bonobo_config_set_boolean (config->db, path, sig->random, NULL);
- g_free (path);
-
- path = g_strdup_printf ("/Mail/Signatures/html_%d", i);
- bonobo_config_set_boolean (config->db, path, sig->html, NULL);
- g_free (path);
-}
-
-static void
-config_write_signatures_num ()
-{
- bonobo_config_set_long (config->db, "/Mail/Signatures/num", config->signatures, NULL);
-}
-
-static void
-config_write_signatures ()
-{
- GList *l;
- gint id;
-
- for (id = 0, l = config->signature_list; l; l = l->next, id ++) {
- config_write_signature ((MailConfigSignature *) l->data, id);
- }
-
- config_write_signatures_num ();
-}
-
-static MailConfigSignature *
-lookup_signature (gint i)
-{
- MailConfigSignature *sig;
- GList *l;
-
- if (i == -1)
- return NULL;
-
- for (l = config->signature_list; l; l = l->next) {
- sig = (MailConfigSignature *) l->data;
- if (sig->id == i)
- return sig;
- }
-
- return NULL;
-}
-
-static void
-config_write_imported_signature (gchar *filename, gint i, gboolean html)
-{
- MailConfigSignature *sig = g_new0 (MailConfigSignature, 1);
- gchar *name;
-
- name = strrchr (filename, '/');
- if (!name)
- name = filename;
- else
- name ++;
-
- sig->name = g_strdup (name);
- sig->filename = filename;
- sig->html = html;
-
- config_write_signature (sig, i);
- signature_destroy (sig);
-}
-
-static void
-config_import_old_signatures ()
-{
- gint num;
-
- num = bonobo_config_get_long_with_default (config->db, "/Mail/Signatures/num", -1, NULL);
-
- if (num == -1) {
- /* there are no signatures defined
- * look for old config to create new ones from old ones
- */
-
- GHashTable *cache;
- gint i, accounts;
-
- cache = g_hash_table_new (g_str_hash, g_str_equal);
- accounts = bonobo_config_get_long_with_default (config->db, "/Mail/Accounts/num", 0, NULL);
- num = 0;
- for (i = 0; i < accounts; i ++) {
- gchar *path, *val;
-
- /* read text signature file */
- path = g_strdup_printf ("/Mail/Accounts/identity_signature_%d", i);
- val = bonobo_config_get_string (config->db, path, NULL);
- g_free (path);
- if (val && *val) {
- gint id;
- gpointer orig_key, node_val;
-
- if (g_hash_table_lookup_extended (cache, val, &orig_key, &node_val)) {
- id = GPOINTER_TO_INT (node_val);
- } else {
- g_hash_table_insert (cache, g_strdup (val), GINT_TO_POINTER (num));
- config_write_imported_signature (val, num, FALSE);
- id = num;
- num ++;
- }
-
- /* set new text signature to this identity */
- path = g_strdup_printf ("/Mail/Accounts/identity_signature_text_%d", i);
- bonobo_config_set_long (config->db, path, id, NULL);
- g_free (path);
- } else
- g_free (val);
-
- path = g_strdup_printf ("/Mail/Accounts/identity_has_html_signature_%d", i);
- if (bonobo_config_get_boolean_with_default (config->db, path, FALSE, NULL)) {
- g_free (path);
- path = g_strdup_printf ("/Mail/Accounts/identity_html_signature_%d", i);
- val = bonobo_config_get_string (config->db, path, NULL);
- if (val && *val) {
- gint id;
- gpointer orig_key, node_val;
-
- if (g_hash_table_lookup_extended (cache, val, &orig_key, &node_val)) {
- id = GPOINTER_TO_INT (node_val);
- } else {
- g_hash_table_insert (cache, g_strdup (val), GINT_TO_POINTER (num));
- config_write_imported_signature (val, num, TRUE);
- id = num;
- num ++;
- }
-
- /* set new html signature to this identity */
- g_free (path);
- path = g_strdup_printf ("/Mail/Accounts/identity_signature_html_%d", i);
- bonobo_config_set_long (config->db, path, id, NULL);
- } else
- g_free (val);
- }
- g_free (path);
- }
- bonobo_config_set_long (config->db, "/Mail/Signatures/num", num, NULL);
- g_hash_table_destroy (cache);
- }
}
static void
config_read (void)
{
int len, i, default_num;
- char *path, *val, *p;
mail_config_clear ();
-
- config_import_old_signatures ();
- config_read_signatures ();
len = bonobo_config_get_long_with_default (config->db,
"/Mail/Accounts/num", 0, NULL);
@@ -620,6 +313,7 @@ config_read (void)
MailConfigIdentity *id;
MailConfigService *source;
MailConfigService *transport;
+ char *path, *val;
account = g_new0 (MailConfigAccount, 1);
path = g_strdup_printf ("/Mail/Accounts/account_name_%d", i);
@@ -633,45 +327,35 @@ config_read (void)
config->corrupt = TRUE;
}
- path = g_strdup_printf ("/Mail/Accounts/account_drafts_folder_uri_%d", i);
+ path = g_strdup_printf ("/Mail/Accounts/account_drafts_folder_name_%d", i);
val = bonobo_config_get_string (config->db, path, NULL);
g_free (path);
if (val && *val)
- account->drafts_folder_uri = val;
+ account->drafts_folder_name = val;
else
g_free (val);
- path = g_strdup_printf ("/Mail/Accounts/account_sent_folder_uri_%d", i);
+ path = g_strdup_printf ("/Mail/Accounts/account_drafts_folder_uri_%d", i);
val = bonobo_config_get_string (config->db, path, NULL);
g_free (path);
if (val && *val)
- account->sent_folder_uri = val;
+ account->drafts_folder_uri = val;
else
g_free (val);
- path = g_strdup_printf ("/Mail/Accounts/account_always_cc_%d", i);
- account->always_cc = bonobo_config_get_boolean_with_default (
- config->db, path, FALSE, NULL);
- g_free (path);
-
- path = g_strdup_printf ("/Mail/Accounts/account_always_cc_addrs_%d", i);
+ path = g_strdup_printf ("/Mail/Accounts/account_sent_folder_name_%d", i);
val = bonobo_config_get_string (config->db, path, NULL);
g_free (path);
if (val && *val)
- account->cc_addrs = val;
+ account->sent_folder_name = val;
else
g_free (val);
- path = g_strdup_printf ("/Mail/Accounts/account_always_bcc_%d", i);
- account->always_bcc = bonobo_config_get_boolean_with_default (
- config->db, path, FALSE, NULL);
- g_free (path);
-
- path = g_strdup_printf ("/Mail/Accounts/account_always_bcc_addrs_%d", i);
+ path = g_strdup_printf ("/Mail/Accounts/account_sent_folder_uri_%d", i);
val = bonobo_config_get_string (config->db, path, NULL);
g_free (path);
if (val && *val)
- account->bcc_addrs = val;
+ account->sent_folder_uri = val;
else
g_free (val);
@@ -723,29 +407,19 @@ config_read (void)
id->address = bonobo_config_get_string (config->db, path, NULL);
g_free (path);
- path = g_strdup_printf ("/Mail/Accounts/identity_reply_to_%d", i);
- id->reply_to = bonobo_config_get_string (config->db, path, NULL);
- g_free (path);
-
path = g_strdup_printf ("/Mail/Accounts/identity_organization_%d", i);
id->organization = bonobo_config_get_string (config->db, path, NULL);
g_free (path);
- /* id signatures */
- path = g_strdup_printf ("/Mail/Accounts/identity_signature_text_%d", i);
- id->text_signature = lookup_signature (bonobo_config_get_long_with_default (config->db, path, -1, NULL));
+ path = g_strdup_printf ("/Mail/Accounts/identity_signature_%d", i);
+ id->signature = bonobo_config_get_string (config->db, path, NULL);
g_free (path);
-
- path = g_strdup_printf ("/Mail/Accounts/identity_signature_html_%d", i);
- id->html_signature = lookup_signature (bonobo_config_get_long_with_default (config->db, path, -1, NULL));
- g_free (path);
-
- path = g_strdup_printf ("/Mail/Accounts/identity_signature_text_random_%d", i);
- id->text_random = bonobo_config_get_boolean_with_default (config->db, path, FALSE, NULL);
+ path = g_strdup_printf ("/Mail/Accounts/identity_html_signature_%d", i);
+ id->html_signature = bonobo_config_get_string (config->db, path, NULL);
g_free (path);
-
- path = g_strdup_printf ("/Mail/Accounts/identity_signature_html_random_%d", i);
- id->html_random = bonobo_config_get_boolean_with_default (config->db, path, FALSE, NULL);
+ path = g_strdup_printf ("/Mail/Accounts/identity_has_html_signature_%d", i);
+ id->has_html_signature = bonobo_config_get_boolean_with_default (
+ config->db, path, FALSE, NULL);
g_free (path);
/* get the source */
@@ -823,14 +497,13 @@ config_read (void)
"/News/Sources/num", 0, NULL);
for (i = 0; i < len; i++) {
MailConfigService *n;
- char *path, *r;
+ gchar *path, *r;
path = g_strdup_printf ("/News/Sources/url_%d", i);
if ((r = bonobo_config_get_string (config->db, path, NULL))) {
n = g_new0 (MailConfigService, 1);
n->url = r;
- n->enabled = TRUE;
config->news = g_slist_append (config->news, n);
}
@@ -877,10 +550,6 @@ config_read (void)
config->paned_size = bonobo_config_get_long_with_default (config->db,
"/Mail/Display/paned_size", 200, NULL);
- /* Goto next folder when user has reached the bottom of the message-list */
- config->goto_next_folder = bonobo_config_get_boolean_with_default (
- config->db, "/Mail/MessageList/goto_next_folder", FALSE, NULL);
-
/* Empty Subject */
config->prompt_empty_subject = bonobo_config_get_boolean_with_default (
config->db, "/Mail/Prompts/empty_subject", TRUE, NULL);
@@ -893,10 +562,6 @@ config_read (void)
config->confirm_expunge = bonobo_config_get_boolean_with_default (
config->db, "/Mail/Prompts/confirm_expunge", TRUE, NULL);
- /* Goto next folder */
- config->confirm_goto_next_folder = bonobo_config_get_boolean_with_default (
- config->db, "/Mail/Prompts/confirm_goto_next_folder", TRUE, NULL);
-
/* PGP/GPG */
config->pgp_path = bonobo_config_get_string (config->db,
"/Mail/PGP/path", NULL);
@@ -913,11 +578,6 @@ config_read (void)
config->db, "/Mail/Format/default_forward_style",
MAIL_CONFIG_FORWARD_ATTACHED, NULL);
- /* Replying */
- config->default_reply_style = bonobo_config_get_long_with_default (
- config->db, "/Mail/Format/default_reply_style",
- MAIL_CONFIG_REPLY_QUOTED, NULL);
-
/* Message Display */
config->message_display_style = bonobo_config_get_long_with_default (
config->db, "/Mail/Format/message_display_style",
@@ -946,87 +606,11 @@ config_read (void)
config->filter_log_path = bonobo_config_get_string (
config->db, "/Mail/Filters/log_path", NULL);
-
- /* New Mail Notification */
- config->notify = bonobo_config_get_long_with_default (
- config->db, "/Mail/Notify/new_mail_notification",
- MAIL_CONFIG_NOTIFY_NOT, NULL);
-
- config->notify_filename = bonobo_config_get_string (
- config->db, "/Mail/Notify/new_mail_notification_sound_file", NULL);
-
- /* X-Mailer header display */
- config->x_mailer_display_style = bonobo_config_get_long_with_default (
- config->db, "/Mail/Display/x_mailer_display_style",
- MAIL_CONFIG_XMAILER_NONE, NULL);
-
- /* last filesel dir */
- config->last_filesel_dir = bonobo_config_get_string (
- config->db, "/Mail/Filesel/last_filesel_dir", NULL);
-
- /* Color labels */
- /* Note: we avoid having to malloc/free 10 times this way... */
- path = g_malloc (sizeof ("/Mail/Labels/") + sizeof ("label_#") + 1);
- strcpy (path, "/Mail/Labels/label_#");
- p = path + strlen (path) - 1;
- for (i = 0; i < 5; i++) {
- *p = '0' + i;
- val = bonobo_config_get_string (config->db, path, NULL);
- if (!(val && *val)) {
- g_free (val);
- val = NULL;
- }
- config->labels[i].name = val;
- }
- strcpy (path, "/Mail/Labels/color_#");
- p = path + strlen (path) - 1;
- for (i = 0; i < 5; i++) {
- *p = '0' + i;
- config->labels[i].color = bonobo_config_get_long_with_default (config->db, path,
- label_defaults[i].color, NULL);
- }
- g_free (path);
}
#define bonobo_config_set_string_wrapper(db, path, val, ev) bonobo_config_set_string (db, path, val ? val : "", ev)
void
-mail_config_write_account_sig (MailConfigAccount *account, gint i)
-{
- char *path;
-
- if (i == -1) {
- GSList *link;
-
- link = g_slist_find (config->accounts, account);
- if (!link) {
- g_warning ("Can't find account in accounts list");
- return;
- }
- i = g_slist_position (config->accounts, link);
- }
-
- /* id signatures */
- path = g_strdup_printf ("/Mail/Accounts/identity_signature_text_%d", i);
- bonobo_config_set_long (config->db, path, account->id->text_signature
- ? account->id->text_signature->id : -1, NULL);
- g_free (path);
-
- path = g_strdup_printf ("/Mail/Accounts/identity_signature_html_%d", i);
- bonobo_config_set_long (config->db, path, account->id->html_signature
- ? account->id->html_signature->id : -1, NULL);
- g_free (path);
-
- path = g_strdup_printf ("/Mail/Accounts/identity_signature_text_random_%d", i);
- bonobo_config_set_boolean (config->db, path, account->id->text_random, NULL);
- g_free (path);
-
- path = g_strdup_printf ("/Mail/Accounts/identity_signature_html_random_%d", i);
- bonobo_config_set_boolean (config->db, path, account->id->html_random, NULL);
- g_free (path);
-}
-
-void
mail_config_write (void)
{
CORBA_Environment ev;
@@ -1044,8 +628,6 @@ mail_config_write (void)
CORBA_exception_init (&ev);
Bonobo_ConfigDatabase_sync (config->db, &ev);
- config_write_signatures ();
-
len = g_slist_length (config->accounts);
bonobo_config_set_long (config->db,
"/Mail/Accounts/num", len, NULL);
@@ -1065,32 +647,24 @@ mail_config_write (void)
bonobo_config_set_string_wrapper (config->db, path, account->name, NULL);
g_free (path);
- path = g_strdup_printf ("/Mail/Accounts/account_drafts_folder_uri_%d", i);
+ path = g_strdup_printf ("/Mail/Accounts/account_drafts_folder_name_%d", i);
bonobo_config_set_string_wrapper (config->db, path,
- account->drafts_folder_uri, NULL);
+ account->drafts_folder_name, NULL);
g_free (path);
- path = g_strdup_printf ("/Mail/Accounts/account_sent_folder_uri_%d", i);
+ path = g_strdup_printf ("/Mail/Accounts/account_drafts_folder_uri_%d", i);
bonobo_config_set_string_wrapper (config->db, path,
- account->sent_folder_uri, NULL);
- g_free (path);
-
- path = g_strdup_printf ("/Mail/Accounts/account_always_cc_%d", i);
- bonobo_config_set_boolean (config->db, path, account->always_cc, NULL);
+ account->drafts_folder_uri, NULL);
g_free (path);
- path = g_strdup_printf ("/Mail/Accounts/account_always_cc_addrs_%d", i);
+ path = g_strdup_printf ("/Mail/Accounts/account_sent_folder_name_%d", i);
bonobo_config_set_string_wrapper (config->db, path,
- account->cc_addrs, NULL);
+ account->sent_folder_name, NULL);
g_free (path);
- path = g_strdup_printf ("/Mail/Accounts/account_always_bcc_%d", i);
- bonobo_config_set_boolean (config->db, path, account->always_bcc, NULL);
- g_free (path);
-
- path = g_strdup_printf ("/Mail/Accounts/account_always_bcc_addrs_%d", i);
+ path = g_strdup_printf ("/Mail/Accounts/account_sent_folder_uri_%d", i);
bonobo_config_set_string_wrapper (config->db, path,
- account->bcc_addrs, NULL);
+ account->sent_folder_uri, NULL);
g_free (path);
/* account pgp options */
@@ -1129,15 +703,21 @@ mail_config_write (void)
bonobo_config_set_string_wrapper (config->db, path, account->id->address, NULL);
g_free (path);
- path = g_strdup_printf ("/Mail/Accounts/identity_reply_to_%d", i);
- bonobo_config_set_string_wrapper (config->db, path, account->id->reply_to, NULL);
- g_free (path);
-
path = g_strdup_printf ("/Mail/Accounts/identity_organization_%d", i);
bonobo_config_set_string_wrapper (config->db, path, account->id->organization, NULL);
g_free (path);
- mail_config_write_account_sig (account, i);
+ path = g_strdup_printf ("/Mail/Accounts/identity_signature_%d", i);
+ bonobo_config_set_string_wrapper (config->db, path, account->id->signature, NULL);
+ g_free (path);
+
+ path = g_strdup_printf ("/Mail/Accounts/identity_html_signature_%d", i);
+ bonobo_config_set_string_wrapper (config->db, path, account->id->html_signature, NULL);
+ g_free (path);
+
+ path = g_strdup_printf ("/Mail/Accounts/identity_has_html_signature_%d", i);
+ bonobo_config_set_boolean (config->db, path, account->id->has_html_signature, NULL);
+ g_free (path);
/* source info */
path = g_strdup_printf ("/Mail/Accounts/source_url_%d", i);
@@ -1181,7 +761,7 @@ mail_config_write (void)
bonobo_config_set_long (config->db, "/News/Sources/num", len, NULL);
for (i = 0; i < len; i++) {
MailConfigService *n;
- char *path;
+ gchar *path;
n = g_slist_nth_data (config->news, i);
@@ -1218,8 +798,6 @@ mail_config_write_on_exit (void)
CORBA_Environment ev;
MailConfigAccount *account;
const GSList *accounts;
- char *path, *p;
- int i;
/* Show Messages Threaded */
bonobo_config_set_boolean (config->db, "/Mail/Display/thread_list",
@@ -1247,7 +825,7 @@ mail_config_write_on_exit (void)
/* Format */
bonobo_config_set_boolean (config->db, "/Mail/Format/send_html",
config->send_html, NULL);
-
+
/* Confirm Sending Unwanted HTML */
bonobo_config_set_boolean (config->db, "/Mail/Format/confirm_unwanted_html",
config->confirm_unwanted_html, NULL);
@@ -1260,10 +838,6 @@ mail_config_write_on_exit (void)
bonobo_config_set_long (config->db, "/Mail/Display/citation_color",
config->citation_color, NULL);
- /* Goto next folder */
- bonobo_config_set_boolean (config->db, "/Mail/MessageList/goto_next_folder",
- config->goto_next_folder, NULL);
-
/* Empty Subject */
bonobo_config_set_boolean (config->db, "/Mail/Prompts/empty_subject",
config->prompt_empty_subject, NULL);
@@ -1276,10 +850,6 @@ mail_config_write_on_exit (void)
bonobo_config_set_boolean (config->db, "/Mail/Prompts/confirm_expunge",
config->confirm_expunge, NULL);
- /* Goto next folder */
- bonobo_config_set_boolean (config->db, "/Mail/Prompts/confirm_goto_next_folder",
- config->confirm_goto_next_folder, NULL);
-
/* PGP/GPG */
bonobo_config_set_string_wrapper (config->db, "/Mail/PGP/path",
config->pgp_path, NULL);
@@ -1296,11 +866,6 @@ mail_config_write_on_exit (void)
"/Mail/Format/default_forward_style",
config->default_forward_style, NULL);
- /* Replying */
- bonobo_config_set_long (config->db,
- "/Mail/Format/default_reply_style",
- config->default_reply_style, NULL);
-
/* Message Display */
bonobo_config_set_long (config->db,
"/Mail/Format/message_display_style",
@@ -1320,45 +885,10 @@ mail_config_write_on_exit (void)
bonobo_config_set_string_wrapper (config->db, "/Mail/Filters/log_path",
config->filter_log_path, NULL);
-
- /* New Mail Notification */
- bonobo_config_set_long (config->db, "/Mail/Notify/new_mail_notification",
- config->notify, NULL);
-
- bonobo_config_set_string_wrapper (config->db, "/Mail/Notify/new_mail_notification_sound_file",
- config->notify_filename, NULL);
-
- /* X-Mailer Display */
- bonobo_config_set_long (config->db,
- "/Mail/Display/x_mailer_display_style",
- config->x_mailer_display_style, NULL);
-
- /* last filesel dir */
- bonobo_config_set_string_wrapper (config->db, "/Mail/Filesel/last_filesel_dir",
- config->last_filesel_dir, NULL);
-
- /* Color labels */
- /* Note: we avoid having to malloc/free 10 times this way... */
- path = g_malloc (sizeof ("/Mail/Labels/") + sizeof ("label_#") + 1);
- strcpy (path, "/Mail/Labels/label_#");
- p = path + strlen (path) - 1;
- for (i = 0; i < 5; i++) {
- *p = '0' + i;
- bonobo_config_set_string_wrapper (config->db, path, config->labels[i].name, NULL);
- }
- strcpy (path, "/Mail/Labels/color_#");
- p = path + strlen (path) - 1;
- for (i = 0; i < 5; i++) {
- *p = '0' + i;
- bonobo_config_set_long (config->db, path, config->labels[i].color, NULL);
- }
- g_free (path);
-
- /* Message Threading */
+
if (config->threaded_hash)
g_hash_table_foreach_remove (config->threaded_hash, hash_save_state, "Threads");
- /* Message Preview */
if (config->preview_hash)
g_hash_table_foreach_remove (config->preview_hash, hash_save_state, "Preview");
@@ -1367,7 +897,7 @@ mail_config_write_on_exit (void)
CORBA_exception_free (&ev);
/* Passwords */
-
+
/* then we make sure the ones we want to remember are in the
session cache */
accounts = mail_config_get_accounts ();
@@ -1388,21 +918,21 @@ mail_config_write_on_exit (void)
g_free (passwd);
}
}
-
+
/* then we clear out our component passwords */
e_passwords_clear_component_passwords ();
-
+
/* then we remember them */
accounts = mail_config_get_accounts ();
for ( ; accounts; accounts = accounts->next) {
account = accounts->data;
if (account->source->save_passwd && account->source->url)
mail_session_remember_password (account->source->url);
-
+
if (account->transport->save_passwd && account->transport->url)
mail_session_remember_password (account->transport->url);
}
-
+
/* now do cleanup */
mail_config_clear ();
}
@@ -1588,22 +1118,6 @@ mail_config_set_filter_log_path (const char *path)
config->filter_log_path = g_strdup (path);
}
-const char *
-mail_config_get_last_filesel_dir (void)
-{
- if (config->last_filesel_dir)
- return config->last_filesel_dir;
- else
- return g_get_home_dir ();
-}
-
-void
-mail_config_set_last_filesel_dir (const char *path)
-{
- g_free (config->last_filesel_dir);
- config->last_filesel_dir = g_strdup (path);
-}
-
gboolean
mail_config_get_hide_deleted (void)
{
@@ -1616,14 +1130,14 @@ mail_config_set_hide_deleted (gboolean value)
config->hide_deleted = value;
}
-int
+gint
mail_config_get_paned_size (void)
{
return config->paned_size;
}
void
-mail_config_set_paned_size (int value)
+mail_config_set_paned_size (gint value)
{
config->paned_size = value;
}
@@ -1688,14 +1202,14 @@ mail_config_set_do_seen_timeout (gboolean do_seen_timeout)
config->do_seen_timeout = do_seen_timeout;
}
-int
+gint
mail_config_get_mark_as_seen_timeout (void)
{
return config->seen_timeout;
}
void
-mail_config_set_mark_as_seen_timeout (int timeout)
+mail_config_set_mark_as_seen_timeout (gint timeout)
{
config->seen_timeout = timeout;
}
@@ -1736,29 +1250,6 @@ mail_config_set_confirm_expunge (gboolean value)
config->confirm_expunge = value;
}
-gboolean
-mail_config_get_confirm_goto_next_folder (void)
-{
- return config->confirm_goto_next_folder;
-}
-
-void
-mail_config_set_confirm_goto_next_folder (gboolean value)
-{
- config->confirm_goto_next_folder = value;
-}
-
-gboolean
-mail_config_get_goto_next_folder (void)
-{
- return config->goto_next_folder;
-}
-
-void
-mail_config_set_goto_next_folder (gboolean value)
-{
- config->goto_next_folder = value;
-}
struct {
char *bin;
@@ -2093,18 +1584,6 @@ mail_config_set_default_forward_style (MailConfigForwardStyle style)
config->default_forward_style = style;
}
-MailConfigReplyStyle
-mail_config_get_default_reply_style (void)
-{
- return config->default_reply_style;
-}
-
-void
-mail_config_set_default_reply_style (MailConfigReplyStyle style)
-{
- config->default_reply_style = style;
-}
-
MailConfigDisplayStyle
mail_config_get_message_display_style (void)
{
@@ -2130,82 +1609,6 @@ mail_config_set_default_charset (const char *charset)
config->default_charset = g_strdup (charset);
}
-MailConfigNewMailNotify
-mail_config_get_new_mail_notify (void)
-{
- return config->notify;
-}
-
-void
-mail_config_set_new_mail_notify (MailConfigNewMailNotify type)
-{
- config->notify = type;
-}
-
-const char *
-mail_config_get_new_mail_notify_sound_file (void)
-{
- return config->notify_filename;
-}
-
-void
-mail_config_set_new_mail_notify_sound_file (const char *filename)
-{
- g_free (config->notify_filename);
- config->notify_filename = g_strdup (filename);
-}
-
-MailConfigXMailerDisplayStyle
-mail_config_get_x_mailer_display_style (void)
-{
- return config->x_mailer_display_style;
-}
-
-void
-mail_config_set_x_mailer_display_style (MailConfigXMailerDisplayStyle style)
-{
- config->x_mailer_display_style = style;
-}
-
-const char *
-mail_config_get_label_name (int label)
-{
- g_return_val_if_fail (label >= 0 && label < 5, NULL);
-
- if (!config->labels[label].name)
- config->labels[label].name = g_strdup (U_(label_defaults[label].name));
-
- return config->labels[label].name;
-}
-
-void
-mail_config_set_label_name (int label, const char *name)
-{
- g_return_if_fail (label >= 0 && label < 5);
-
- if (!name)
- name = U_(label_defaults[label].name);
-
- g_free (config->labels[label].name);
- config->labels[label].name = g_strdup (name);
-}
-
-guint32
-mail_config_get_label_color (int label)
-{
- g_return_val_if_fail (label >= 0 && label < 5, 0);
-
- return config->labels[label].color;
-}
-
-void
-mail_config_set_label_color (int label, guint32 color)
-{
- g_return_if_fail (label >= 0 && label < 5);
-
- config->labels[label].color = color;
-}
-
gboolean
mail_config_find_account (const MailConfigAccount *account)
@@ -2430,8 +1833,8 @@ new_source_created (MailConfigAccount *account)
CamelProvider *prov;
CamelFolder *inbox;
CamelException ex;
- char *name;
- char *url;
+ gchar *name;
+ gchar *url;
/* no source, don't bother. */
if (!account->source || !account->source->url)
@@ -2569,14 +1972,14 @@ mail_config_remove_account (MailConfigAccount *account)
return config->accounts;
}
-int
+gint
mail_config_get_default_account_num (void)
{
return config->default_account;
}
static void
-mail_config_set_default_account_num (int new_default)
+mail_config_set_default_account_num (gint new_default)
{
config->default_account = new_default;
}
@@ -2675,25 +2078,17 @@ mail_config_service_set_save_passwd (MailConfigService *service, gboolean save_p
}
char *
-mail_config_folder_to_safe_url (CamelFolder *folder)
+mail_config_folder_to_cachename (CamelFolder *folder, const char *prefix)
{
CamelService *service = CAMEL_SERVICE (folder->parent_store);
- char *service_url, *url;
+ char *service_url, *url, *filename;
service_url = camel_url_to_string (service->url, CAMEL_URL_HIDE_ALL);
url = g_strdup_printf ("%s/%s", service_url, folder->full_name);
g_free (service_url);
e_filename_make_safe (url);
- return url;
-}
-
-char *
-mail_config_folder_to_cachename (CamelFolder *folder, const char *prefix)
-{
- char *url, *filename;
- url = mail_config_folder_to_safe_url (folder);
filename = g_strdup_printf ("%s/config/%s%s", evolution_dir, prefix, url);
g_free (url);
@@ -2791,7 +2186,7 @@ mail_config_check_service (const char *url, CamelProviderType type, GList **auth
id = m->msg.seq;
e_thread_put(mail_thread_queued, (EMsg *)m);
-
+
dialog = gnome_dialog_new (_("Connecting to server..."),
GNOME_STOCK_BUTTON_CANCEL,
NULL);
@@ -2806,9 +2201,9 @@ mail_config_check_service (const char *url, CamelProviderType type, GList **auth
GTK_SIGNAL_FUNC (check_cancelled), &id);
gtk_window_set_modal (GTK_WINDOW (dialog), FALSE);
gtk_widget_show_all (dialog);
-
+
mail_msg_wait(id);
-
+
gtk_widget_destroy (dialog);
dialog = NULL;
@@ -2857,8 +2252,10 @@ impl_GNOME_Evolution_MailConfig_addAccount (PortableServer_Servant servant,
mail_id = g_new0 (MailConfigIdentity, 1);
mail_id->name = g_strdup (id.name);
mail_id->address = g_strdup (id.address);
- mail_id->reply_to = g_strdup (id.reply_to);
mail_id->organization = g_strdup (id.organization);
+ mail_id->signature = g_strdup (id.signature);
+ mail_id->html_signature = g_strdup (id.html_signature);
+ mail_id->has_html_signature = id.has_html_signature;
mail_account->id = mail_id;
@@ -2944,246 +2341,3 @@ evolution_mail_config_factory_init (void)
bonobo_running_context_auto_exit_unref (BONOBO_OBJECT (factory));
return TRUE;
}
-
-GList *
-mail_config_get_signature_list (void)
-{
- return config->signature_list;
-}
-
-static gchar *
-get_new_signature_filename ()
-{
- struct stat st_buf;
- gchar *filename;
- gint i;
-
- filename = g_strconcat (evolution_dir, "/signatures", NULL);
- if (lstat (filename, &st_buf)) {
- if (errno == ENOENT) {
- if (mkdir (filename, 0700))
- g_warning ("Fatal problem creating %s/signatures directory.", evolution_dir);
- } else
- g_warning ("Fatal problem with %s/signatures directory.", evolution_dir);
- }
- g_free (filename);
-
- for (i = 0; ; i ++) {
- filename = g_strdup_printf ("%s/signatures/signature-%d", evolution_dir, i);
- if (lstat (filename, &st_buf) == - 1 && errno == ENOENT) {
- gint fd;
-
- fd = creat (filename, 0600);
- if (fd >= 0) {
- close (fd);
- return filename;
- }
- }
- g_free (filename);
- }
-
- return NULL;
-}
-
-MailConfigSignature *
-mail_config_signature_add (gboolean html)
-{
- MailConfigSignature *sig;
-
- sig = g_new0 (MailConfigSignature, 1);
-
- /* printf ("mail_config_signature_add %d\n", config->signatures); */
- sig->id = config->signatures;
- sig->name = g_strdup (_("Unnamed"));
- sig->filename = get_new_signature_filename ();
- sig->html = html;
-
- config->signature_list = g_list_append (config->signature_list, sig);
- config->signatures ++;
-
- config_write_signature (sig, sig->id);
- config_write_signatures_num ();
-
- mail_config_signature_emit_event (MAIL_CONFIG_SIG_EVENT_ADDED, sig);
- /* printf ("mail_config_signature_add end\n"); */
-
- return sig;
-}
-
-static void
-delete_unused_signature_file (const gchar *filename)
-{
- gint len;
- gchar *signatures_dir;
-
- signatures_dir = g_strconcat (evolution_dir, "/signatures", NULL);
-
- /* remove signature file if it's in evolution dir and no other signature uses it */
- len = strlen (signatures_dir);
- if (filename && !strncmp (filename, signatures_dir, len)) {
- GList *l;
- gboolean only_one = TRUE;
-
- for (l = config->signature_list; l; l = l->next) {
- if (((MailConfigSignature *)l->data)->filename
- && !strcmp (filename, ((MailConfigSignature *)l->data)->filename)) {
- only_one = FALSE;
- break;
- }
- }
-
- if (only_one) {
- unlink (filename);
- }
- }
-
- g_free (signatures_dir);
-}
-
-void
-mail_config_signature_delete (MailConfigSignature *sig)
-{
- GList *l, *next;
- GSList *al;
- gboolean after = FALSE;
-
- for (al = config->accounts; al; al = al->next) {
- MailConfigAccount *account;
-
- account = (MailConfigAccount *) al->data;
-
- if (account->id->text_signature == sig)
- account->id->text_signature = NULL;
- if (account->id->html_signature == sig)
- account->id->html_signature = NULL;
- }
-
- for (l = config->signature_list; l; l = next) {
- next = l->next;
- if (after)
- ((MailConfigSignature *) l->data)->id --;
- else if (l->data == sig) {
- config->signature_list = g_list_remove_link (config->signature_list, l);
- after = TRUE;
- config->signatures --;
- if (sig->random)
- config->signatures_random --;
- }
- }
-
- config_write_signatures ();
- delete_unused_signature_file (sig->filename);
- /* printf ("signatures: %d\n", config->signatures); */
- mail_config_signature_emit_event (MAIL_CONFIG_SIG_EVENT_DELETED, sig);
- signature_destroy (sig);
-}
-
-void
-mail_config_signature_write (MailConfigSignature *sig)
-{
- config_write_signature (sig, sig->id);
-}
-
-void
-mail_config_signature_set_filename (MailConfigSignature *sig, const gchar *filename)
-{
- gchar *old_filename = sig->filename;
-
- sig->filename = g_strdup (filename);
- if (old_filename) {
- delete_unused_signature_file (old_filename);
- g_free (old_filename);
- }
- mail_config_signature_write (sig);
-}
-
-void
-mail_config_signature_set_name (MailConfigSignature *sig, const gchar *name)
-{
- g_free (sig->name);
- sig->name = g_strdup (name);
-
- mail_config_signature_emit_event (MAIL_CONFIG_SIG_EVENT_NAME_CHANGED, sig);
-}
-
-void
-mail_config_signature_set_random (MailConfigSignature *sig, gboolean random)
-{
- if (random != sig->random) {
- if (random && !sig->random) {
- config->signatures_random ++;
- if (config->signatures_random == 1)
- mail_config_signature_emit_event (MAIL_CONFIG_SIG_EVENT_RANDOM_ON, sig);
- } else if (!random && sig->random) {
- config->signatures_random --;
- if (config->signatures_random == 0)
- mail_config_signature_emit_event (MAIL_CONFIG_SIG_EVENT_RANDOM_OFF, sig);
- }
- sig->random = random;
- mail_config_signature_write (sig);
- }
-}
-
-gint
-mail_config_get_signatures_random (void)
-{
- return config->signatures_random;
-}
-
-static GList *clients = NULL;
-
-void
-mail_config_signature_register_client (MailConfigSignatureClient client, gpointer data)
-{
- clients = g_list_append (clients, client);
- clients = g_list_append (clients, data);
-}
-
-void
-mail_config_signature_unregister_client (MailConfigSignatureClient client, gpointer data)
-{
- GList *link;
-
- link = g_list_find (clients, data);
- clients = g_list_remove_link (clients, link->prev);
- clients = g_list_remove_link (clients, link);
-}
-
-void
-mail_config_signature_emit_event (MailConfigSigEvent event, MailConfigSignature *sig)
-{
- GList *l, *next;
-
- for (l = clients; l; l = next) {
- next = l->next->next;
- (*((MailConfigSignatureClient) l->data)) (event, sig, l->next->data);
- }
-}
-
-void
-mail_config_signature_run_script (gchar *script)
-{
- if (script) {
- gchar *argv[2];
- gint pid, status;
-
- printf ("running script %s\n", script);
- argv [0] = script;
- argv [1] = NULL;
- pid = gnome_execute_async (NULL, 1, argv);
- if (pid < 0)
- gnome_error_dialog (_("Cannot execute signature script"));
- else
- waitpid (pid, &status, 0);
- }
-}
-
-void
-mail_config_signature_set_html (MailConfigSignature *sig, gboolean html)
-{
- if (sig->html != html) {
- sig->html = html;
- mail_config_signature_write (sig);
- mail_config_signature_emit_event (MAIL_CONFIG_SIG_EVENT_HTML_CHANGED, sig);
- }
-}
diff --git a/mail/mail-display.c b/mail/mail-display.c
index a4d3ae65bd..e979ae8878 100644
--- a/mail/mail-display.c
+++ b/mail/mail-display.c
@@ -46,9 +46,6 @@
#include "e-searching-tokenizer.h"
#include "folder-browser-factory.h"
#include "mail-stream-gtkhtml.h"
-#include "message-tag-followup.h"
-#include "folder-browser-window.h"
-#include "folder-browser.h"
#include "mail-display.h"
#include "mail-config.h"
#include "mail-ops.h"
@@ -74,18 +71,7 @@ struct _PixbufLoader {
};
static GHashTable *thumbnail_cache = NULL;
-/* Drag & Drop types */
-#define TEXT_URI_LIST_TYPE "text/uri-list"
-
-enum DndTargetType {
- DND_TARGET_TYPE_TEXT_URI_LIST,
-};
-
-static GtkTargetEntry drag_types[] = {
- { TEXT_URI_LIST_TYPE, 0, DND_TARGET_TYPE_TEXT_URI_LIST },
-};
-
-static const int num_drag_types = sizeof (drag_types) / sizeof (drag_types[0]);
+static gchar *save_pathname = NULL; /* preserves last directory in save dialog */
/*----------------------------------------------------------------------*
* Callbacks
@@ -140,7 +126,7 @@ make_safe_filename (const char *prefix,CamelMimePart *part)
{
const char *name = NULL;
char *safe, *p;
-
+
if (part) {
name = camel_mime_part_get_filename (part);
}
@@ -149,7 +135,7 @@ make_safe_filename (const char *prefix,CamelMimePart *part)
/* This is a filename. Translators take note. */
name = _("attachment");
}
-
+
p = strrchr (name, '/');
if (p)
safe = g_strdup_printf ("%s%s", prefix, p);
@@ -168,18 +154,24 @@ save_data_cb (GtkWidget *widget, gpointer user_data)
{
GtkFileSelection *file_select = (GtkFileSelection *)
gtk_widget_get_ancestor (widget, GTK_TYPE_FILE_SELECTION);
- char *dir;
-
+ gchar *p;
+
/* uh, this doesn't really feel right, but i dont know what to do better */
gtk_widget_hide (GTK_WIDGET (file_select));
- write_data_to_file (user_data, gtk_file_selection_get_filename (file_select),
+ write_data_to_file (user_data,
+ gtk_file_selection_get_filename (file_select),
FALSE);
-
+
/* preserve the pathname */
- dir = g_dirname (gtk_file_selection_get_filename (file_select));
- mail_config_set_last_filesel_dir (dir);
- g_free (dir);
-
+ g_free(save_pathname);
+ save_pathname = g_strdup(gtk_file_selection_get_filename(file_select));
+ if((p = strrchr(save_pathname, '/')) != NULL)
+ p[0] = 0;
+ else {
+ g_free(save_pathname);
+ save_pathname = NULL;
+ }
+
gtk_widget_destroy (GTK_WIDGET (file_select));
}
@@ -220,46 +212,17 @@ mail_display_jump_to_anchor (MailDisplay *md, const char *url)
}
static void
-mail_display_digest_clicked (MailDisplay *md, const char *url)
-{
- FolderBrowser *fb, *parent_fb;
- CamelFolder *digest;
- CamelStore *store;
- GtkWidget *window;
-
- parent_fb = (FolderBrowser *) gtk_widget_get_ancestor (GTK_WIDGET (md), FOLDER_BROWSER_TYPE);
-
- store = camel_digest_store_new (url);
-
- digest = camel_digest_folder_new (store, md->current_message);
- camel_object_unref (CAMEL_OBJECT (store));
- if (!digest)
- return;
-
- fb = (FolderBrowser *) folder_browser_new (parent_fb->shell, NULL);
- folder_browser_set_message_preview (fb, TRUE);
- folder_browser_set_folder (fb, digest, url);
- camel_object_unref (CAMEL_OBJECT (digest));
- gtk_widget_show (GTK_WIDGET (fb));
-
- window = folder_browser_window_new (fb);
- gtk_widget_show (window);
-}
-
-static void
on_link_clicked (GtkHTML *html, const char *url, MailDisplay *md)
{
- if (!g_strncasecmp (url, "news:", 5) || !g_strncasecmp (url, "nntp:", 5)) {
+ if (!g_strncasecmp (url, "news:", 5) ||
+ !g_strncasecmp (url, "nntp:", 5))
g_warning ("Can't handle news URLs yet.");
- } else if (!g_strncasecmp (url, "mailto:", 7)) {
+ else if (!g_strncasecmp (url, "mailto:", 7))
send_to_url (url);
- } else if (!g_strncasecmp (url, "digest:", 7)) {
- mail_display_digest_clicked (md, url);
- } else if (*url == '#') {
+ else if (*url == '#')
mail_display_jump_to_anchor (md, url);
- } else {
+ else
gnome_url_show (url);
- }
}
static void
@@ -271,7 +234,10 @@ save_part (CamelMimePart *part)
g_return_if_fail (part != NULL);
camel_object_ref (CAMEL_OBJECT (part));
- filename = make_safe_filename (mail_config_get_last_filesel_dir (), part);
+ if (save_pathname == NULL)
+ save_pathname = g_strdup (g_get_home_dir ());
+
+ filename = make_safe_filename (save_pathname, part);
file_select = GTK_FILE_SELECTION (
gtk_file_selection_new (_("Save Attachment")));
@@ -297,7 +263,7 @@ static void
save_cb (GtkWidget *widget, gpointer user_data)
{
CamelMimePart *part = gtk_object_get_data (GTK_OBJECT (user_data), "CamelMimePart");
-
+
save_part (part);
}
@@ -329,7 +295,8 @@ launch_cb (GtkWidget *widget, gpointer user_data)
tmpdir = e_mkdtemp ("evolution.XXXXXX");
if (!tmpdir) {
- char *msg = g_strdup_printf (_("Could not create temporary directory: %s"),
+ char *msg = g_strdup_printf (_("Could not create temporary "
+ "directory: %s"),
g_strerror (errno));
gnome_error_dialog (msg);
g_free (msg);
@@ -339,21 +306,16 @@ launch_cb (GtkWidget *widget, gpointer user_data)
filename = make_safe_filename (tmpdir, part);
if (!write_data_to_file (part, filename, TRUE)) {
- char *msg = g_strdup_printf (_("Could not create temporary file '%s': %s"),
- filename, g_strerror (errno));
- gnome_error_dialog (msg);
g_free (filename);
- g_free (msg);
return;
}
command = g_strdup_printf ("%s %s%s &", app->command,
app->expects_uris == GNOME_VFS_MIME_APPLICATION_ARGUMENT_TYPE_URIS ? "file://" : "",
filename);
- g_free (filename);
-
system (command);
g_free (command);
+ g_free (filename);
}
static void
@@ -385,14 +347,17 @@ static gboolean
pixmap_press (GtkWidget *widget, GdkEventButton *event, EScrollFrame *user_data)
{
EPopupMenu *menu;
- EPopupMenu save_item = E_POPUP_ITEM (N_("Save to Disk..."), GTK_SIGNAL_FUNC (save_cb), 0);
- EPopupMenu view_item = E_POPUP_ITEM (N_("View Inline"), GTK_SIGNAL_FUNC (inline_cb), 2);
- EPopupMenu open_item = E_POPUP_ITEM (N_("Open in %s..."), GTK_SIGNAL_FUNC (launch_cb), 1);
+ EPopupMenu save_item = { N_("Save to Disk..."), NULL,
+ GTK_SIGNAL_FUNC (save_cb), NULL, 0 };
+ EPopupMenu view_item = { N_("View Inline"), NULL,
+ GTK_SIGNAL_FUNC (inline_cb), NULL, 2 };
+ EPopupMenu open_item = { N_("Open in %s..."), NULL,
+ GTK_SIGNAL_FUNC (launch_cb), NULL, 1 };
MailDisplay *md;
CamelMimePart *part;
MailMimeHandler *handler;
int mask = 0, i, nitems;
-
+
#ifdef USE_OLD_DISPLAY_STYLE
if (event->button != 3) {
gtk_propagate_event (GTK_WIDGET (user_data),
@@ -400,27 +365,27 @@ pixmap_press (GtkWidget *widget, GdkEventButton *event, EScrollFrame *user_data)
return TRUE;
}
#endif
-
+
if (event->button != 1 && event->button != 3) {
gtk_propagate_event (GTK_WIDGET (user_data),
(GdkEvent *)event);
return TRUE;
}
-
+
/* Stop the signal, since we don't want the button's class method to
mess up our popup. */
gtk_signal_emit_stop_by_name (GTK_OBJECT (widget), "button_press_event");
-
+
part = gtk_object_get_data (GTK_OBJECT (widget), "CamelMimePart");
handler = mail_lookup_handler (gtk_object_get_data (GTK_OBJECT (widget),
"mime_type"));
-
+
if (handler && handler->applications)
nitems = g_list_length (handler->applications) + 2;
else
nitems = 3;
menu = g_new0 (EPopupMenu, nitems + 1);
-
+
/* Save item */
memcpy (&menu[0], &save_item, sizeof (menu[0]));
menu[0].name = _(menu[0].name);
@@ -619,7 +584,7 @@ pixbuf_gen_idle (struct _PixbufLoader *pbl)
pixbuf = gdk_pixbuf_new_from_file (EVOLUTION_ICONSDIR "/pgp-signature-nokey.png");
} else
pixbuf = gdk_pixbuf_loader_get_pixbuf (pbl->loader);
-
+
width = gdk_pixbuf_get_width (pixbuf);
height = gdk_pixbuf_get_height (pixbuf);
@@ -796,7 +761,7 @@ save_url (MailDisplay *md, const char *url)
g_return_val_if_fail (CAMEL_IS_MIME_PART (part), NULL);
data = camel_medium_get_content_object ((CamelMedium *)part);
- if (!mail_content_loaded (data, md, TRUE, NULL, NULL, NULL)) {
+ if (!mail_content_loaded (data, md, TRUE, NULL, NULL)) {
return NULL;
}
@@ -809,75 +774,6 @@ save_url (MailDisplay *md, const char *url)
return NULL;
}
-static void
-drag_data_get_cb (GtkWidget *widget,
- GdkDragContext *drag_context,
- GtkSelectionData *selection_data,
- guint info,
- guint time,
- gpointer user_data)
-{
- CamelMimePart *part = user_data;
- const char *filename, *tmpdir;
- char *uri_list;
-
- switch (info) {
- case DND_TARGET_TYPE_TEXT_URI_LIST:
- /* Kludge around Nautilus requesting the same data many times */
- uri_list = gtk_object_get_data (GTK_OBJECT (widget), "uri-list");
- if (uri_list) {
- gtk_selection_data_set (selection_data, selection_data->target, 8,
- uri_list, strlen (uri_list));
- return;
- }
-
- tmpdir = e_mkdtemp ("drag-n-drop-XXXXXX");
- if (!tmpdir) {
- char *msg;
-
- msg = g_strdup_printf (_("Could not create temporary directory: %s"),
- g_strerror (errno));
- gnome_error_dialog (msg);
- g_free (msg);
- }
-
- filename = camel_mime_part_get_filename (part);
- if (!filename)
- filename = _("Unknown");
-
- uri_list = g_strdup_printf ("file://%s/%s", tmpdir, filename);
-
- if (!write_data_to_file (part, uri_list + 7, TRUE)) {
- g_free (uri_list);
- return;
- }
-
- gtk_selection_data_set (selection_data, selection_data->target, 8,
- uri_list, strlen (uri_list));
-
- gtk_object_set_data_full (GTK_OBJECT (widget), "uri-list", uri_list, g_free);
-
- break;
- default:
- g_assert_not_reached ();
- }
-}
-
-static void
-drag_data_delete_cb (GtkWidget *widget,
- GdkDragContext *drag_context,
- gpointer user_data)
-{
- char *uri_list;
-
- uri_list = gtk_object_get_data (GTK_OBJECT (widget), "uri-list");
- if (uri_list) {
- gtk_object_set_data (GTK_OBJECT (widget), "uri-list", NULL);
- unlink (uri_list + 7);
- g_free (uri_list);
- }
-}
-
static gboolean
do_attachment_header (GtkHTML *html, GtkHTMLEmbedded *eb,
CamelMimePart *part, MailDisplay *md)
@@ -885,11 +781,11 @@ do_attachment_header (GtkHTML *html, GtkHTMLEmbedded *eb,
GtkWidget *button, *mainbox, *hbox, *arrow, *popup;
MailMimeHandler *handler;
struct _PixbufLoader *pbl;
-
+
pbl = g_new0 (struct _PixbufLoader, 1);
if (g_strncasecmp (eb->type, "image/", 6) == 0) {
CamelDataWrapper *content;
-
+
content = camel_medium_get_content_object (CAMEL_MEDIUM (part));
if (!camel_data_wrapper_is_offline (content)) {
pbl->mstream = camel_stream_mem_new ();
@@ -904,65 +800,54 @@ do_attachment_header (GtkHTML *html, GtkHTMLEmbedded *eb,
pbl->eb = eb;
pbl->destroy_id = gtk_signal_connect (GTK_OBJECT (eb), "destroy",
embeddable_destroy_cb, pbl);
-
+
g_idle_add_full (G_PRIORITY_LOW, (GSourceFunc)pixbuf_gen_idle,
pbl, NULL);
-
+
mainbox = gtk_hbox_new (FALSE, 0);
-
+
button = gtk_button_new ();
- GTK_WIDGET_UNSET_FLAGS (button, GTK_CAN_FOCUS);
gtk_object_set_data (GTK_OBJECT (button), "MailDisplay", md);
-
+
gtk_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (button_press), part);
-
- handler = mail_lookup_handler (eb->type);
- if (handler && handler->builtin)
- gtk_widget_set_sensitive (button, TRUE);
- else
- gtk_widget_set_sensitive (button, FALSE);
-
- /* Drag & Drop */
- gtk_drag_source_set (button, GDK_BUTTON1_MASK,
- drag_types, num_drag_types,
- GDK_ACTION_MOVE);
- gtk_signal_connect (GTK_OBJECT (button), "drag-data-get",
- drag_data_get_cb, part);
- gtk_signal_connect (GTK_OBJECT (button), "drag-data-delete",
- drag_data_delete_cb, part);
-
+
hbox = gtk_hbox_new (FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 2);
-
- if (handler && mail_part_is_displayed_inline (part, md))
+
+ if (mail_part_is_displayed_inline (part, md))
arrow = gnome_stock_new_with_icon (GNOME_STOCK_PIXMAP_DOWN);
else
arrow = gnome_stock_new_with_icon (GNOME_STOCK_PIXMAP_FORWARD);
gtk_box_pack_start (GTK_BOX (hbox), arrow, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (hbox), pbl->pixmap, TRUE, TRUE, 0);
gtk_container_add (GTK_CONTAINER (button), hbox);
-
+
popup = gtk_button_new ();
- GTK_WIDGET_UNSET_FLAGS (popup, GTK_CAN_FOCUS);
gtk_container_add (GTK_CONTAINER (popup),
gtk_arrow_new (GTK_ARROW_DOWN,
GTK_SHADOW_ETCHED_IN));
-
+
gtk_object_set_data (GTK_OBJECT (popup), "MailDisplay", md);
gtk_object_set_data (GTK_OBJECT (popup), "CamelMimePart", part);
gtk_object_set_data_full (GTK_OBJECT (popup), "mime_type",
g_strdup (eb->type), (GDestroyNotify)g_free);
-
+
gtk_signal_connect (GTK_OBJECT (popup), "button_press_event",
GTK_SIGNAL_FUNC (pixmap_press), md->scroll);
-
+
gtk_box_pack_start (GTK_BOX (mainbox), button, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (mainbox), popup, TRUE, TRUE, 0);
gtk_widget_show_all (mainbox);
-
+
+ handler = mail_lookup_handler (eb->type);
+ if (handler && handler->builtin)
+ gtk_widget_set_sensitive (button, TRUE);
+ else
+ gtk_widget_set_sensitive (button, FALSE);
+
gtk_container_add (GTK_CONTAINER (eb), mainbox);
-
+
return TRUE;
}
@@ -1050,7 +935,6 @@ do_signature (GtkHTML *html, GtkHTMLEmbedded *eb,
pbl, NULL);
button = gtk_button_new ();
- GTK_WIDGET_UNSET_FLAGS (button, GTK_CAN_FOCUS);
gtk_object_set_data (GTK_OBJECT (button), "MailDisplay", md);
gtk_signal_connect (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (button_press), part);
@@ -1074,7 +958,7 @@ on_object_requested (GtkHTML *html, GtkHTMLEmbedded *eb, gpointer data)
urls = g_datalist_get_data (md->data, "part_urls");
if (!urls)
return FALSE;
-
+
if (!strncmp (eb->classid, "popup:", 6) && eb->type) {
part = g_hash_table_lookup (urls, eb->classid + 6);
if (!CAMEL_IS_MIME_PART (part))
@@ -1102,11 +986,9 @@ load_http (MailDisplay *md, gpointer data)
GHashTable *urls;
GnomeVFSHandle *handle;
GnomeVFSFileSize read;
- GnomeVFSResult result;
GByteArray *ba;
char buf[8192];
- size_t total = 0;
-
+
urls = g_datalist_get_data (md->data, "data_urls");
ba = g_hash_table_lookup (urls, url);
g_return_if_fail (ba != NULL);
@@ -1119,15 +1001,10 @@ load_http (MailDisplay *md, gpointer data)
return;
}
- while ((result = gnome_vfs_read (handle, buf, sizeof (buf), &read)) == GNOME_VFS_OK) {
- printf ("%s: read %d bytes\n", url, (int) read);
+ while (gnome_vfs_read (handle, buf, sizeof (buf), &read) == GNOME_VFS_OK)
g_byte_array_append (ba, buf, read);
- total += read;
- }
gnome_vfs_close (handle);
-
- printf ("gnome_vfs_read result is %d; read %d total bytes\n", result, total);
-
+
#if 0
if (!ba->len)
printf ("no data in %s\n", url);
@@ -1174,11 +1051,8 @@ on_url_requested (GtkHTML *html, const char *url, GtkHTMLStream *handle,
g_return_if_fail (CAMEL_IS_MEDIUM (medium));
- if (md->related)
- g_hash_table_remove(md->related, medium);
-
data = camel_medium_get_content_object (medium);
- if (!mail_content_loaded (data, md, FALSE, url, html, handle))
+ if (!mail_content_loaded (data, md, FALSE, url, handle))
return;
content_type = camel_data_wrapper_get_mime_type_field (data);
@@ -1201,7 +1075,7 @@ on_url_requested (GtkHTML *html, const char *url, GtkHTMLStream *handle,
gtk_html_end (html, handle, GTK_HTML_STREAM_OK);
return;
}
-
+
urls = g_datalist_get_data (md->data, "data_urls");
g_return_if_fail (urls != NULL);
@@ -1217,23 +1091,23 @@ on_url_requested (GtkHTML *html, const char *url, GtkHTMLStream *handle,
gtk_html_end (html, handle, GTK_HTML_STREAM_OK);
return;
}
-
+
/* See if it's something we can load. */
if (strncmp (url, "http:", 5) == 0) {
if (mail_config_get_http_mode () == MAIL_CONFIG_HTTP_ALWAYS ||
g_datalist_get_data (md->data, "load_images")) {
ba = g_byte_array_new ();
g_hash_table_insert (urls, g_strdup (url), ba);
- mail_display_stream_write_when_loaded (md, ba, url, load_http, html, handle,
+ mail_display_stream_write_when_loaded (md, ba, url, load_http, handle,
g_strdup (url));
} else if (mail_config_get_http_mode () == MAIL_CONFIG_HTTP_SOMETIMES &&
!g_datalist_get_data (md->data, "checking_from")) {
const CamelInternetAddress *from = camel_mime_message_get_from (md->current_message);
const char *name, *addr;
-
+
g_datalist_set_data (md->data, "checking_from",
GINT_TO_POINTER (1));
-
+
/* Make sure we aren't deal w/ some sort of a pathological message w/o a From: header */
if (from != NULL && camel_internet_address_get (from, 0, &name, &addr))
e_book_query_address_locally (addr, ebook_callback, md);
@@ -1247,11 +1121,10 @@ struct _load_content_msg {
struct _mail_msg msg;
MailDisplay *display;
- GtkHTML *html;
GtkHTMLStream *handle;
- int redisplay_counter;
- char *url;
+ gint redisplay_counter;
+ gchar *url;
CamelMimeMessage *message;
void (*callback)(MailDisplay *, gpointer);
gpointer data;
@@ -1289,16 +1162,16 @@ try_part_urls (struct _load_content_msg *m)
g_return_val_if_fail (CAMEL_IS_MEDIUM (medium), FALSE);
data = camel_medium_get_content_object (medium);
- if (!mail_content_loaded (data, m->display, FALSE, m->url, m->html, m->handle)) {
+ if (!mail_content_loaded (data, m->display, FALSE, m->url, m->handle)) {
g_warning ("This code should not be reached\n");
return TRUE;
}
- html_stream = mail_stream_gtkhtml_new (m->html, m->handle);
+ html_stream = mail_stream_gtkhtml_new (m->display->html, m->handle);
camel_data_wrapper_write_to_stream (data, html_stream);
camel_object_unref (CAMEL_OBJECT (html_stream));
- gtk_html_end (m->html, m->handle, GTK_HTML_STREAM_OK);
+ gtk_html_end (m->display->html, m->handle, GTK_HTML_STREAM_OK);
return TRUE;
}
@@ -1318,9 +1191,9 @@ try_data_urls (struct _load_content_msg *m)
if (ba) {
if (ba->len) {
printf ("writing ...\n");
- gtk_html_write (m->html, m->handle, ba->data, ba->len);
+ gtk_html_write (m->display->html, m->handle, ba->data, ba->len);
}
- gtk_html_end (m->html, m->handle, GTK_HTML_STREAM_OK);
+ gtk_html_end (m->display->html, m->handle, GTK_HTML_STREAM_OK);
return TRUE;
}
@@ -1342,7 +1215,7 @@ load_content_loaded (struct _mail_msg *mm)
m->display->redisplay_counter);
if (m->redisplay_counter == m->display->redisplay_counter) {
if (!try_part_urls (m) && !try_data_urls (m))
- gtk_html_end (m->html, m->handle, GTK_HTML_STREAM_ERROR);
+ gtk_html_end (m->display->html, m->handle, GTK_HTML_STREAM_ERROR);
}
} else
mail_display_redisplay (m->display, FALSE);
@@ -1368,7 +1241,6 @@ static struct _mail_msg_op load_content_op = {
static void
stream_write_or_redisplay_when_loaded (MailDisplay *md,
- GtkHTML *html,
gconstpointer key,
const gchar *url,
void (*callback)(MailDisplay *, gpointer),
@@ -1395,7 +1267,6 @@ stream_write_or_redisplay_when_loaded (MailDisplay *md,
m = mail_msg_new (&load_content_op, NULL, sizeof (*m));
m->display = md;
gtk_object_ref (GTK_OBJECT (m->display));
- m->html = html;
m->handle = handle;
m->url = g_strdup (url);
m->redisplay_counter = md->redisplay_counter;
@@ -1411,40 +1282,34 @@ stream_write_or_redisplay_when_loaded (MailDisplay *md,
void
mail_display_stream_write_when_loaded (MailDisplay *md,
gconstpointer key,
- const char *url,
+ const gchar *url,
void (*callback)(MailDisplay *, gpointer),
- GtkHTML *html,
GtkHTMLStream *handle,
gpointer data)
{
- stream_write_or_redisplay_when_loaded (md, html, key, url, callback, handle, data);
+ stream_write_or_redisplay_when_loaded (md, key, url, callback, handle, data);
}
void
mail_display_redisplay_when_loaded (MailDisplay *md,
gconstpointer key,
void (*callback)(MailDisplay *, gpointer),
- GtkHTML *html,
gpointer data)
{
- stream_write_or_redisplay_when_loaded (md, html, key, NULL, callback, NULL, data);
+ stream_write_or_redisplay_when_loaded (md, key, NULL, callback, NULL, data);
}
void
-mail_text_write (GtkHTML *html, GtkHTMLStream *stream, gboolean printing, const char *text)
+mail_text_write (GtkHTML *html, GtkHTMLStream *stream, const char *text)
{
- guint flags;
char *htmltext;
- flags = E_TEXT_TO_HTML_CONVERT_NL | E_TEXT_TO_HTML_CONVERT_SPACES;
-
- if (!printing)
- flags |= E_TEXT_TO_HTML_CONVERT_URLS | E_TEXT_TO_HTML_CONVERT_ADDRESSES;
-
- if (mail_config_get_citation_highlight () && ! printing)
- flags |= E_TEXT_TO_HTML_MARK_CITATION;
-
- htmltext = e_text_to_html_full (text, flags, mail_config_get_citation_color ());
+ htmltext = e_text_to_html_full (text, E_TEXT_TO_HTML_CONVERT_URLS |
+ E_TEXT_TO_HTML_CONVERT_ADDRESSES |
+ E_TEXT_TO_HTML_CONVERT_NL |
+ E_TEXT_TO_HTML_CONVERT_SPACES |
+ (mail_config_get_citation_highlight () ? E_TEXT_TO_HTML_MARK_CITATION : 0),
+ mail_config_get_citation_color ());
gtk_html_write (html, stream, "<tt>", 4);
gtk_html_write (html, stream, htmltext, strlen (htmltext));
@@ -1477,101 +1342,19 @@ static void
clear_data (CamelObject *object, gpointer event_data, gpointer user_data)
{
GData *data = user_data;
-
- g_datalist_clear (&data);
-}
-
-#define COLOR_IS_LIGHT(r, g, b) ((r + g + b) > (128 * 3))
-
-void
-mail_display_render (MailDisplay *md, GtkHTML *html, gboolean reset_scroll)
-{
- GtkHTMLStream *stream;
- char bgcolor[7], fontcolor[7];
- GtkStyle *style = NULL;
-
- g_return_if_fail (IS_MAIL_DISPLAY (md));
- g_return_if_fail (GTK_IS_HTML (html));
-
- stream = gtk_html_begin (html);
- if (!reset_scroll) {
- /* This is a hack until there's a clean way to do this. */
- GTK_HTML (md->html)->engine->newPage = FALSE;
- }
-
- mail_html_write (html, stream,
- "<!doctype html public \"-//W3C//DTD HTML 4.0 TRANSITIONAL//EN\">\n"
- "<html>\n"
- "<head>\n<meta name=\"generator\" content=\"Evolution Mail Component\">\n</head>\n");
- mail_html_write (html, stream, "<body marginwidth=0 marginheight=0>\n");
-
- if (md->followup) {
- /* my favorite thing to do... muck around with colors so we respect people's stupid themes. */
- style = gtk_widget_get_style (GTK_WIDGET (html));
- if (style && !md->printing) {
- int state = GTK_WIDGET_STATE (GTK_WIDGET (html));
- gushort r, g, b;
-
- r = style->base[state].red / 256;
- g = style->base[state].green / 256;
- b = style->base[state].blue / 256;
-
- if (COLOR_IS_LIGHT (r, g, b)) {
- r *= 0.92;
- g *= 0.92;
- b *= 0.92;
- } else {
- r = 255 - (0.92 * (255 - r));
- g = 255 - (0.92 * (255 - g));
- b = 255 - (0.92 * (255 - b));
- }
-
- sprintf (bgcolor, "%.2X%.2X%.2X", r, g, b);
-
- r = style->text[state].red / 256;
- g = style->text[state].green / 256;
- b = style->text[state].blue / 256;
-
- sprintf (fontcolor, "%.2X%.2X%.2X", r, g, b);
- } else {
- strcpy (bgcolor, "EEEEEE");
- strcpy (fontcolor, "000000");
- }
-
- gtk_html_stream_printf (stream, "<font color=\"#%s\">"
- "<table width=\"100%%\" cellspacing=0 cellpading=0><tr><td width=\"100%%\">"
- "<table bgcolor=\"#000000\" width=\"100%%\" cellspacing=0 cellpadding=1>"
- "<tr><td><table bgcolor=\"#%s\" width=\"100%%\" cellpadding=0 cellspacing=0>"
- "<tr>\n", fontcolor, bgcolor);
-
- gtk_html_stream_printf (stream, "<td><img src=\"%s\"></td><td halign=left><b>%s</b></td>\n",
- mail_display_get_url_for_icon (md, EVOLUTION_IMAGES "/flag-for-followup-16.png"),
- message_tag_followup_i18n_name (md->followup->type));
-
- mail_html_write (html, stream, "</tr></table></tr></table></td></tr></table></font>");
- }
-
- if (md->current_message) {
- if (md->display_style == MAIL_CONFIG_DISPLAY_SOURCE)
- mail_format_raw_message (md->current_message, md, html, stream);
- else
- mail_format_mime_message (md->current_message, md, html, stream);
- }
-
- mail_html_write (html, stream, "</body></html>\n");
- gtk_html_end (html, stream, GTK_HTML_STREAM_OK);
+ g_datalist_clear (&data);
}
/**
* mail_display_redisplay:
* @mail_display: the mail display object
- * @reset_scroll: specifies whether or not to reset current scroll
+ * @unscroll: specifies whether or not to lose current scroll
*
* Force a redraw of the message display.
**/
void
-mail_display_redisplay (MailDisplay *md, gboolean reset_scroll)
+mail_display_redisplay (MailDisplay *md, gboolean unscroll)
{
if (GTK_OBJECT_DESTROYED (md))
return;
@@ -1580,7 +1363,25 @@ mail_display_redisplay (MailDisplay *md, gboolean reset_scroll)
md->redisplay_counter++;
/* printf ("md %p redisplay %d\n", md, md->redisplay_counter); */
- mail_display_render (md, md->html, reset_scroll);
+ md->stream = gtk_html_begin (GTK_HTML (md->html));
+ if (!unscroll) {
+ /* This is a hack until there's a clean way to do this. */
+ GTK_HTML (md->html)->engine->newPage = FALSE;
+ }
+
+ mail_html_write (md->html, md->stream, "<!doctype html public \"-//W3C//DTD HTML 4.0 TRANSITIONAL//EN\">\n<html>\n<head>\n<meta name=\"generator\" content=\"Evolution Mail Component\">\n</head>\n");
+ mail_html_write (md->html, md->stream, "<body marginwidth=0 marginheight=0>\n");
+
+ if (md->current_message) {
+ if (md->display_style == MAIL_CONFIG_DISPLAY_SOURCE)
+ mail_format_raw_message (md->current_message, md);
+ else
+ mail_format_mime_message (md->current_message, md);
+ }
+
+ mail_html_write (md->html, md->stream, "</body></html>\n");
+ gtk_html_end (md->html, md->stream, GTK_HTML_STREAM_OK);
+ md->stream = NULL;
}
@@ -1588,30 +1389,25 @@ mail_display_redisplay (MailDisplay *md, gboolean reset_scroll)
* mail_display_set_message:
* @mail_display: the mail display object
* @medium: the input camel medium, or %NULL
- * @followup: followup value
*
* Makes the mail_display object show the contents of the medium
* param.
**/
void
-mail_display_set_message (MailDisplay *md, CamelMedium *medium, const char *followup)
+mail_display_set_message (MailDisplay *md, CamelMedium *medium)
{
/* For the moment, we deal only with CamelMimeMessage, but in
* the future, we should be able to deal with any medium.
*/
if (medium && !CAMEL_IS_MIME_MESSAGE (medium))
return;
-
+
/* Clean up from previous message. */
if (md->current_message)
camel_object_unref (CAMEL_OBJECT (md->current_message));
-
- g_free (md->followup);
-
- md->current_message = (CamelMimeMessage *) medium;
-
- md->followup = followup ? message_tag_followup_decode (followup) : NULL;
-
+
+ md->current_message = (CamelMimeMessage*)medium;
+
g_datalist_init (md->data);
mail_display_redisplay (md, TRUE);
if (medium) {
@@ -1663,19 +1459,16 @@ mail_display_init (GtkObject *object)
mail_display->scroll = NULL;
mail_display->html = NULL;
mail_display->redisplay_counter = 0;
+ mail_display->stream = NULL;
mail_display->last_active = NULL;
mail_display->idle_id = 0;
mail_display->selection = NULL;
- mail_display->charset = NULL;
- mail_display->followup = NULL;
mail_display->current_message = NULL;
mail_display->data = NULL;
-
+
mail_display->invisible = gtk_invisible_new ();
mail_display->display_style = mail_config_get_message_display_style ();
-
- mail_display->printing = FALSE;
}
static void
@@ -1685,7 +1478,6 @@ mail_display_destroy (GtkObject *object)
g_free (mail_display->charset);
g_free (mail_display->selection);
- g_free (mail_display->followup);
g_datalist_clear (mail_display->data);
g_free (mail_display->data);
@@ -1810,12 +1602,16 @@ enum {
#define TERMINATOR { NULL, NULL, (NULL), NULL, 0 }
static EPopupMenu link_menu [] = {
- E_POPUP_ITEM (N_("Open Link in Browser"), GTK_SIGNAL_FUNC (link_open_in_browser), MASK_URL),
- E_POPUP_ITEM (N_("Copy Link Location"), GTK_SIGNAL_FUNC (link_copy_location), MASK_URL),
+ { N_("Open Link in Browser"), NULL,
+ GTK_SIGNAL_FUNC (link_open_in_browser), NULL, MASK_URL },
+ { N_("Copy Link Location"), NULL,
+ GTK_SIGNAL_FUNC (link_copy_location), NULL, MASK_URL },
#if 0
- E_POPUP_ITEM (N_("Save Link as (FIXME)"), GTK_SIGNAL_FUNC (link_save_as), MASK_URL),
+ { N_("Save Link as (FIXME)"), NULL,
+ GTK_SIGNAL_FUNC (link_save_as), NULL, MASK_URL },
#endif
- E_POPUP_ITEM (N_("Save Image as..."), GTK_SIGNAL_FUNC (image_save_as), MASK_SRC),
+ { N_("Save Image as..."), NULL,
+ GTK_SIGNAL_FUNC (image_save_as), NULL, MASK_SRC },
TERMINATOR
};
@@ -2033,11 +1829,7 @@ html_button_press_event (GtkWidget *widget, GdkEventButton *event, MailDisplay *
if (url && !g_strncasecmp (url, "mailto:", 7)) {
PopupInfo *pop;
- gchar *url_decoded;
-
- url_decoded = gtk_html_get_url_object_relative (GTK_HTML (widget),
- point->object,
- url);
+ gchar *url_decoded = g_strdup (url);
camel_url_decode (url_decoded);
popup_thing = bonobo_widget_new_control ("OAFIID:GNOME_Evolution_Addressbook_AddressPopup",
@@ -2064,10 +1856,7 @@ html_button_press_event (GtkWidget *widget, GdkEventButton *event, MailDisplay *
hide_mask |= MASK_SRC;
g_free (gtk_object_get_data (GTK_OBJECT (mail_display), "current_src_uri"));
- gtk_object_set_data (GTK_OBJECT (mail_display), "current_src_uri",
- gtk_html_get_url_object_relative (GTK_HTML (widget),
- point->object,
- src));
+ gtk_object_set_data (GTK_OBJECT (mail_display), "current_src_uri", g_strdup (src));
e_popup_menu_run (link_menu, (GdkEvent *) event, 0, hide_mask, mail_display);
@@ -2252,10 +2041,10 @@ mail_display_new (void)
GtkWidget *scroll, *html;
GdkAtom clipboard_atom;
HTMLTokenizer *tok;
-
+
gtk_box_set_homogeneous (GTK_BOX (mail_display), FALSE);
gtk_widget_show (GTK_WIDGET (mail_display));
-
+
scroll = e_scroll_frame_new (NULL, NULL);
e_scroll_frame_set_policy (E_SCROLL_FRAME (scroll),
GTK_POLICY_AUTOMATIC,
@@ -2263,47 +2052,16 @@ mail_display_new (void)
e_scroll_frame_set_shadow_type (E_SCROLL_FRAME (scroll), GTK_SHADOW_IN);
gtk_box_pack_start_defaults (GTK_BOX (mail_display), GTK_WIDGET (scroll));
gtk_widget_show (GTK_WIDGET (scroll));
-
+
html = gtk_html_new ();
tok = e_searching_tokenizer_new ();
html_engine_set_tokenizer (GTK_HTML (html)->engine, tok);
gtk_object_unref (GTK_OBJECT (tok));
-
- mail_display_initialize_gtkhtml (mail_display, GTK_HTML (html));
-
- gtk_container_add (GTK_CONTAINER (scroll), html);
- gtk_widget_show (GTK_WIDGET (html));
-
- gtk_signal_connect (GTK_OBJECT (mail_display->invisible), "selection_get",
- GTK_SIGNAL_FUNC (invisible_selection_get_callback), mail_display);
- gtk_signal_connect (GTK_OBJECT (mail_display->invisible), "selection_clear_event",
- GTK_SIGNAL_FUNC (invisible_selection_clear_event_callback), mail_display);
-
- gtk_selection_add_target (mail_display->invisible,
- GDK_SELECTION_PRIMARY, GDK_SELECTION_TYPE_STRING, 1);
-
- clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE);
- if (clipboard_atom != GDK_NONE)
- gtk_selection_add_target (mail_display->invisible,
- clipboard_atom, GDK_SELECTION_TYPE_STRING, 1);
-
- mail_display->scroll = E_SCROLL_FRAME (scroll);
- mail_display->html = GTK_HTML (html);
- mail_display->last_active = NULL;
- mail_display->data = g_new0 (GData *, 1);
- g_datalist_init (mail_display->data);
-
- return GTK_WIDGET (mail_display);
-}
-void
-mail_display_initialize_gtkhtml (MailDisplay *mail_display, GtkHTML *html)
-{
gtk_html_set_default_content_type (GTK_HTML (html),
"text/html; charset=utf-8");
-
+
gtk_html_set_editable (GTK_HTML (html), FALSE);
-
gtk_signal_connect (GTK_OBJECT (html), "url_requested",
GTK_SIGNAL_FUNC (on_url_requested),
mail_display);
@@ -2323,62 +2081,31 @@ mail_display_initialize_gtkhtml (MailDisplay *mail_display, GtkHTML *html)
GTK_SIGNAL_FUNC (html_iframe_created), mail_display);
gtk_signal_connect (GTK_OBJECT (html), "on_url",
GTK_SIGNAL_FUNC (html_on_url), mail_display);
-}
+ gtk_container_add (GTK_CONTAINER (scroll), html);
+ gtk_widget_show (GTK_WIDGET (html));
-char *
-mail_display_add_url (MailDisplay *md, const char *kind, char *url, gpointer data)
-{
- GHashTable *urls;
- gpointer old_key, old_value;
-
- urls = g_datalist_get_data (md->data, kind);
- g_return_val_if_fail (urls != NULL, NULL);
- if (g_hash_table_lookup_extended (urls, url, &old_key, &old_value)) {
- g_free (url);
- url = old_key;
- }
-
- g_hash_table_insert (urls, url, data);
-
- return url;
-}
+ gtk_signal_connect (GTK_OBJECT (mail_display->invisible), "selection_get",
+ GTK_SIGNAL_FUNC (invisible_selection_get_callback), mail_display);
+ gtk_signal_connect (GTK_OBJECT (mail_display->invisible), "selection_clear_event",
+ GTK_SIGNAL_FUNC (invisible_selection_clear_event_callback), mail_display);
-const char *
-mail_display_get_url_for_icon (MailDisplay *md, const char *icon_name)
-{
- char *icon_path, buf[1024], *url;
- int fd, nread;
- GByteArray *ba;
-
- /* FIXME: cache */
-
- if (*icon_name == '/')
- icon_path = g_strdup (icon_name);
- else {
- icon_path = gnome_pixmap_file (icon_name);
- if (!icon_path)
- return "file:///dev/null";
- }
-
- fd = open (icon_path, O_RDONLY);
- g_free (icon_path);
- if (fd == -1)
- return "file:///dev/null";
-
- ba = g_byte_array_new ();
- while (1) {
- nread = read (fd, buf, sizeof (buf));
- if (nread < 1)
- break;
- g_byte_array_append (ba, buf, nread);
- }
- close (fd);
-
- url = g_strdup_printf ("x-evolution-data:%p", ba);
-
- return mail_display_add_url (md, "data_urls", url, ba);
-}
+ gtk_selection_add_target (mail_display->invisible,
+ GDK_SELECTION_PRIMARY, GDK_SELECTION_TYPE_STRING, 1);
+
+ clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE);
+ if (clipboard_atom != GDK_NONE)
+ gtk_selection_add_target (mail_display->invisible,
+ clipboard_atom, GDK_SELECTION_TYPE_STRING, 1);
+ mail_display->scroll = E_SCROLL_FRAME (scroll);
+ mail_display->html = GTK_HTML (html);
+ mail_display->stream = NULL;
+ mail_display->last_active = NULL;
+ mail_display->data = g_new0 (GData *, 1);
+ g_datalist_init (mail_display->data);
+
+ return GTK_WIDGET (mail_display);
+}
E_MAKE_TYPE (mail_display, "MailDisplay", MailDisplay, mail_display_class_init, mail_display_init, PARENT_TYPE);
diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c
index a9479f3d36..9bf7d12025 100644
--- a/mail/mail-folder-cache.c
+++ b/mail/mail-folder-cache.c
@@ -46,7 +46,7 @@
#include "mail-vfolder.h"
#include "mail-autofilter.h"
-#define w(x)
+#define w(x)
#define d(x)
/* note that many things are effectively serialised by having them run in
@@ -302,8 +302,6 @@ update_1folder(struct _folder_info *mfi, CamelFolderInfo *info)
} else if (info)
unread = info->unread_message_count;
- d(printf("folder updated: unread %d: '%s'\n", unread, mfi->full_name));
-
if (unread == -1)
return;
@@ -356,7 +354,7 @@ setup_folder(CamelFolderInfo *fi, struct _store_info *si)
static void
create_folders(CamelFolderInfo *fi, struct _store_info *si)
{
- d(printf("Setup new folder: %s\n %s\n", fi->url, fi->full_name));
+ d(printf("Setup new folder: %s\n", fi->url));
setup_folder(fi, si);
@@ -711,8 +709,11 @@ update_folders(CamelStore *store, CamelFolderInfo *fi, void *data)
/* otherwise its not, and we're on our own and free anyway */
e_dlist_remove((EDListNode *)ud);
- if (fi)
+ if (fi) {
+ if (si->storage)
+ gtk_object_set_data (GTK_OBJECT (si->storage), "connected", GINT_TO_POINTER (TRUE));
create_folders(fi, si);
+ }
}
UNLOCK(info_lock);
diff --git a/mail/mail-format.c b/mail/mail-format.c
index eb5723da17..23fae80837 100644
--- a/mail/mail-format.c
+++ b/mail/mail-format.c
@@ -31,8 +31,7 @@
#include <fcntl.h>
#include <liboaf/liboaf.h>
-#include <libgnome/gnome-defs.h>
-#include <libgnome/gnome-util.h>
+#include <libgnome/libgnome.h>
#include <libgnomevfs/gnome-vfs-mime-info.h>
#include <libgnomevfs/gnome-vfs-mime-handlers.h>
#include <gal/widgets/e-unicode.h>
@@ -52,67 +51,62 @@
#include "mail-crypto.h"
static char *try_inline_pgp (char *start, CamelMimePart *part,
- guint offset, MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
+ guint offset, MailDisplay *md);
static char *try_inline_pgp_sig (char *start, CamelMimePart *part,
- guint offset, MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
+ guint offset, MailDisplay *md);
static char *try_uudecoding (char *start, CamelMimePart *part,
- guint offset, MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
+ guint offset, MailDisplay *md);
static char *try_inline_binhex (char *start, CamelMimePart *part,
- guint offset, MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
+ guint offset, MailDisplay *md);
static gboolean handle_text_plain (CamelMimePart *part,
const char *mime_type,
- MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
+ MailDisplay *md);
static gboolean handle_text_plain_flowed (char *text,
- MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
+ MailDisplay *md);
static gboolean handle_text_enriched (CamelMimePart *part,
const char *mime_type,
- MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
+ MailDisplay *md);
static gboolean handle_text_html (CamelMimePart *part,
const char *mime_type,
- MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
+ MailDisplay *md);
static gboolean handle_image (CamelMimePart *part,
const char *mime_type,
- MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
+ MailDisplay *md);
static gboolean handle_multipart_mixed (CamelMimePart *part,
const char *mime_type,
- MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
+ MailDisplay *md);
static gboolean handle_multipart_related (CamelMimePart *part,
const char *mime_type,
- MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
+ MailDisplay *md);
static gboolean handle_multipart_alternative (CamelMimePart *part,
const char *mime_type,
- MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
+ MailDisplay *md);
static gboolean handle_multipart_appledouble (CamelMimePart *part,
const char *mime_type,
- MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
+ MailDisplay *md);
static gboolean handle_multipart_encrypted (CamelMimePart *part,
const char *mime_type,
- MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
+ MailDisplay *md);
static gboolean handle_multipart_signed (CamelMimePart *part,
const char *mime_type,
- MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
-static gboolean handle_multipart_digest (CamelMimePart *part,
- const char *mime_type,
- MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
+ MailDisplay *md);
static gboolean handle_message_rfc822 (CamelMimePart *part,
const char *mime_type,
- MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
+ MailDisplay *md);
static gboolean handle_message_external_body (CamelMimePart *part,
const char *mime_type,
- MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
+ MailDisplay *md);
static gboolean handle_via_bonobo (CamelMimePart *part,
const char *mime_type,
- MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
+ MailDisplay *md);
/* writes the header info for a mime message into an html stream */
-static void write_headers (CamelMimeMessage *message, MailDisplay *md,
- GtkHTML *html, GtkHTMLStream *stream);
+static void write_headers (CamelMimeMessage *message, MailDisplay *md);
/* dispatch html printing via mimetype */
-static gboolean format_mime_part (CamelMimePart *part, MailDisplay *md,
- GtkHTML *html, GtkHTMLStream *stream);
+static gboolean format_mime_part (CamelMimePart *part, MailDisplay *md);
static void
free_url (gpointer key, gpointer value, gpointer data)
@@ -136,6 +130,22 @@ free_data_urls (gpointer urls)
g_hash_table_destroy (urls);
}
+static char *
+add_url (const char *kind, char *url, gpointer data, MailDisplay *md)
+{
+ GHashTable *urls;
+ gpointer old_key, old_value;
+
+ urls = g_datalist_get_data (md->data, kind);
+ g_return_val_if_fail (urls != NULL, NULL);
+ if (g_hash_table_lookup_extended (urls, url, &old_key, &old_value)) {
+ g_free (url);
+ url = old_key;
+ }
+ g_hash_table_insert (urls, url, data);
+ return url;
+}
+
/**
* mail_format_mime_message:
* @mime_message: the input mime message
@@ -144,13 +154,12 @@ free_data_urls (gpointer urls)
* Writes a CamelMimeMessage out into a MailDisplay
**/
void
-mail_format_mime_message (CamelMimeMessage *mime_message, MailDisplay *md,
- GtkHTML *html, GtkHTMLStream *stream)
+mail_format_mime_message (CamelMimeMessage *mime_message, MailDisplay *md)
{
GHashTable *hash;
g_return_if_fail (CAMEL_IS_MIME_MESSAGE (mime_message));
-
+
hash = g_datalist_get_data (md->data, "part_urls");
if (!hash) {
hash = g_hash_table_new (g_str_hash, g_str_equal);
@@ -177,8 +186,8 @@ mail_format_mime_message (CamelMimeMessage *mime_message, MailDisplay *md,
(GDestroyNotify) g_hash_table_destroy);
}
- write_headers (mime_message, md, html, stream);
- format_mime_part (CAMEL_MIME_PART (mime_message), md, html, stream);
+ write_headers (mime_message, md);
+ format_mime_part (CAMEL_MIME_PART (mime_message), md);
}
@@ -190,33 +199,32 @@ mail_format_mime_message (CamelMimeMessage *mime_message, MailDisplay *md,
* Writes a CamelMimeMessage source out into a MailDisplay
**/
void
-mail_format_raw_message (CamelMimeMessage *mime_message, MailDisplay *md,
- GtkHTML *html, GtkHTMLStream *stream)
+mail_format_raw_message (CamelMimeMessage *mime_message, MailDisplay *md)
{
GByteArray *bytes;
- char *html_str;
+ char *html;
g_return_if_fail (CAMEL_IS_MIME_MESSAGE (mime_message));
if (!mail_content_loaded (CAMEL_DATA_WRAPPER (mime_message), md,
- TRUE, NULL, html, NULL))
+ TRUE, NULL, NULL))
return;
- mail_html_write (html, stream,
+ mail_html_write (md->html, md->stream,
"<table cellspacing=0 cellpadding=10 width=\"100%\"><tr><td><tt>\n");
bytes = mail_format_get_data_wrapper_text (CAMEL_DATA_WRAPPER (mime_message), md);
if (bytes) {
g_byte_array_append (bytes, "", 1);
- html_str = e_text_to_html (bytes->data, E_TEXT_TO_HTML_CONVERT_NL |
- E_TEXT_TO_HTML_CONVERT_SPACES | E_TEXT_TO_HTML_ESCAPE_8BIT);
+ html = e_text_to_html (bytes->data, E_TEXT_TO_HTML_CONVERT_NL |
+ E_TEXT_TO_HTML_CONVERT_SPACES | E_TEXT_TO_HTML_ESCAPE_8BIT);
g_byte_array_free (bytes, TRUE);
- mail_html_write (html, stream, html_str);
- g_free (html_str);
+ mail_html_write (md->html, md->stream, html);
+ g_free (html);
}
- mail_html_write (html, stream, "</tt></td></tr></table>");
+ mail_html_write (md->html, md->stream, "</tt></td></tr></table>");
}
static const char *
@@ -233,8 +241,8 @@ get_cid (CamelMimePart *part, MailDisplay *md)
camel_mime_part_get_content_id (part));
} else
cid = g_strdup_printf ("cid:@@@%d", fake_cid_counter++);
-
- return mail_display_add_url (md, "part_urls", cid, part);
+
+ return add_url ("part_urls", cid, part, md);
}
static const char *
@@ -247,7 +255,42 @@ get_location (CamelMimePart *part, MailDisplay *md)
if (!loc)
return NULL;
- return mail_display_add_url (md, "part_urls", g_strdup (loc), part);
+ return add_url ("part_urls", g_strdup (loc), part, md);
+}
+
+static const char *
+get_url_for_icon (const char *icon_name, MailDisplay *md)
+{
+ char *icon_path, buf[1024], *url;
+ int fd, nread;
+ GByteArray *ba;
+
+ /* FIXME: cache */
+
+ if (*icon_name == '/')
+ icon_path = g_strdup (icon_name);
+ else {
+ icon_path = gnome_pixmap_file (icon_name);
+ if (!icon_path)
+ return "file:///dev/null";
+ }
+
+ fd = open (icon_path, O_RDONLY);
+ g_free (icon_path);
+ if (fd == -1)
+ return "file:///dev/null";
+
+ ba = g_byte_array_new ();
+ while (1) {
+ nread = read (fd, buf, sizeof (buf));
+ if (nread < 1)
+ break;
+ g_byte_array_append (ba, buf, nread);
+ }
+ close (fd);
+
+ url = g_strdup_printf ("x-evolution-data:%p", ba);
+ return add_url ("data_urls", url, ba, md);
}
@@ -316,8 +359,6 @@ setup_mime_tables (void)
handle_multipart_encrypted);
g_hash_table_insert (mime_function_table, "multipart/signed",
handle_multipart_signed);
- g_hash_table_insert (mime_function_table, "multipart/digest",
- handle_multipart_digest);
/* RFC 2046 says unrecognized text subtypes can be treated
* as text/plain (as long as you recognize the character set),
@@ -572,34 +613,27 @@ mail_part_set_default_displayed_inline (CamelMimePart *part, MailDisplay *md,
}
static void
-attachment_header (CamelMimePart *part, const char *mime_type, MailDisplay *md,
- GtkHTML *html, GtkHTMLStream *stream)
+attachment_header (CamelMimePart *part, const char *mime_type, MailDisplay *md)
{
- char *htmlinfo, *html_str, *fmt;
+ char *htmlinfo, *html, *fmt;
const char *info;
/* Start the table, create the pop-up object. */
- mail_html_write (html, stream,
- "<table cellspacing=0 cellpadding=0>"
- "<tr><td><table width=10 cellspacing=0 cellpadding=0><tr><td></td></tr></table></td>");
-
- if (! md->printing) {
- gtk_html_stream_printf (stream, "<td><object classid=\"popup:%s\" type=\"%s\"></object></td>",
- get_cid (part, md), mime_type);
- }
-
- mail_html_write (html, stream,
- "<td><table width=3 cellspacing=0 cellpadding=0><tr><td></td></tr></table></td>"
- "<td><font size=-1>");
-
+ gtk_html_stream_printf (md->stream,
+ "<table cellspacing=0 cellpadding=0>"
+ "<tr><td><table width=10 cellspacing=0 cellpadding=0><tr><td></td></tr></table></td>"
+ "<td><object classid=\"popup:%s\" type=\"%s\"></object></td>"
+ "<td><table width=3 cellspacing=0 cellpadding=0><tr><td></td></tr></table></td>"
+ "<td><font size=-1>",
+ get_cid (part, md), mime_type);
/* Write the MIME type */
info = gnome_vfs_mime_get_value (mime_type, "description");
- html_str = e_text_to_html (info ? info : mime_type, 0);
- htmlinfo = e_utf8_from_locale_string (html_str);
- g_free (html_str);
+ html = e_text_to_html (info ? info : mime_type, 0);
+ htmlinfo = e_utf8_from_locale_string (html);
+ g_free (html);
fmt = e_utf8_from_locale_string (_("%s attachment"));
- gtk_html_stream_printf (stream, fmt, htmlinfo);
+ gtk_html_stream_printf (md->stream, fmt, htmlinfo);
g_free (htmlinfo);
g_free (fmt);
@@ -607,48 +641,47 @@ attachment_header (CamelMimePart *part, const char *mime_type, MailDisplay *md,
info = camel_mime_part_get_filename (part);
if (info) {
htmlinfo = e_text_to_html (info, 0);
- gtk_html_stream_printf (stream, " (%s)", htmlinfo);
+ gtk_html_stream_printf (md->stream, " (%s)", htmlinfo);
g_free (htmlinfo);
}
/* Write a description, if we have one. */
info = camel_mime_part_get_description (part);
if (info) {
- htmlinfo = e_text_to_html (info, md->printing ? 0 : E_TEXT_TO_HTML_CONVERT_URLS);
- gtk_html_stream_printf (stream, ", \"%s\"", htmlinfo);
+ htmlinfo = e_text_to_html (info, E_TEXT_TO_HTML_CONVERT_URLS);
+ gtk_html_stream_printf (md->stream, ", \"%s\"", htmlinfo);
g_free (htmlinfo);
}
- mail_html_write (html, stream, "</font></td></tr><tr>"
+ mail_html_write (md->html, md->stream, "</font></td></tr><tr>"
"<td height=10><table height=10 cellspacing=0 cellpadding=0>"
"<tr><td></td></tr></table></td></tr></table>\n");
}
static gboolean
-format_mime_part (CamelMimePart *part, MailDisplay *md,
- GtkHTML *html, GtkHTMLStream *stream)
+format_mime_part (CamelMimePart *part, MailDisplay *md)
{
CamelDataWrapper *wrapper;
char *mime_type;
MailMimeHandler *handler;
gboolean output;
int inline_flags;
-
+
/* Record URLs associated with this part */
get_cid (part, md);
get_location (part, md);
-
+
wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (part));
-
+
if (CAMEL_IS_MULTIPART (wrapper) &&
camel_multipart_get_number (CAMEL_MULTIPART (wrapper)) == 0) {
char *mesg;
mesg = e_utf8_from_locale_string (_("Could not parse MIME message. Displaying as source."));
- mail_error_printf (html, stream, "\n%s\n", mesg);
+ mail_error_printf (md->html, md->stream, "\n%s\n", mesg);
g_free (mesg);
- if (mail_content_loaded (wrapper, md, TRUE, NULL, html, NULL))
- handle_text_plain (part, "text/plain", md, html, stream);
+ if (mail_content_loaded (wrapper, md, TRUE, NULL, NULL))
+ handle_text_plain (part, "text/plain", md);
return TRUE;
}
@@ -680,11 +713,11 @@ format_mime_part (CamelMimePart *part, MailDisplay *md,
/* No header for anonymous inline parts. */
if (!((inline_flags & I_ACTUALLY) && is_anonymous (part, mime_type)))
- attachment_header (part, mime_type, md, html, stream);
+ attachment_header (part, mime_type, md);
if (handler && handler->builtin && inline_flags & I_DISPLAYED &&
- mail_content_loaded (wrapper, md, TRUE, NULL, html, NULL))
- output = (*handler->builtin) (part, mime_type, md, html, stream);
+ mail_content_loaded (wrapper, md, TRUE, NULL, NULL))
+ output = (*handler->builtin) (part, mime_type, md);
else
output = TRUE;
@@ -741,7 +774,7 @@ static void
write_text_header (const char *name, const char *value, int flags, GtkHTML *html, GtkHTMLStream *stream)
{
char *encoded;
-
+
if (value && *value)
encoded = e_text_to_html (value, E_TEXT_TO_HTML_CONVERT_NL | E_TEXT_TO_HTML_CONVERT_URLS);
else
@@ -756,8 +789,7 @@ write_text_header (const char *name, const char *value, int flags, GtkHTML *html
}
static void
-write_address (MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream,
- const CamelInternetAddress *addr, const char *field_name, int flags)
+write_address (MailDisplay *md, const CamelInternetAddress *addr, const char *field_name, int flags)
{
const char *name, *email;
gint i;
@@ -765,7 +797,7 @@ write_address (MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream,
if (addr == NULL || !camel_internet_address_get (addr, 0, NULL, NULL))
return;
- write_field_row_begin (field_name, flags, html, stream);
+ write_field_row_begin (field_name, flags, md->html, md->stream);
i = 0;
while (camel_internet_address_get (addr, i, &name, &email)) {
@@ -791,7 +823,7 @@ write_address (MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream,
}
if (i)
- mail_html_write (html, stream, ", ");
+ mail_html_write (md->html, md->stream, ", ");
if (have_email || have_name) {
if (!have_email) {
@@ -799,28 +831,20 @@ write_address (MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream,
}
if (have_name) {
- if (md->printing) {
- gtk_html_stream_printf (stream, "%s &lt;%s&gt;", name_disp, email_disp);
- } else {
- gtk_html_stream_printf (stream,
- "%s &lt;<a href=\"mailto:%s\">%s</a>&gt;",
- name_disp, addr_url, email_disp);
- }
+ gtk_html_stream_printf (md->stream,
+ "%s &lt;<a href=\"mailto:%s\">%s</a>&gt;",
+ name_disp, addr_url, email_disp);
} else {
- if (md->printing) {
- mail_html_write (html, stream, email_disp);
- } else {
- gtk_html_stream_printf (stream,
- "<a href=\"mailto:%s\">%s</a>",
- addr_url, email_disp);
- }
+ gtk_html_stream_printf (md->stream,
+ "<a href=\"mailto:%s\">%s</a>",
+ addr_url, email_disp);
}
} else {
char *str;
str = e_utf8_from_locale_string (_("Bad Address"));
- gtk_html_stream_printf (stream, "<i>%s</i>", str);
+ gtk_html_stream_printf (md->stream, "<i>%s</i>", str);
g_free (str);
}
@@ -832,7 +856,7 @@ write_address (MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream,
i++;
}
- mail_html_write (html, stream, "</td></tr>");
+ mail_html_write (md->html, md->stream, "</td></tr>");
}
/* order of these must match write_header code */
@@ -855,87 +879,53 @@ default_header_index(const char *name)
/* index is index of header in default_headers array */
static void
-write_default_header(CamelMimeMessage *message, MailDisplay *md,
- GtkHTML *html, GtkHTMLStream *stream,
- int index, int flags)
+write_default_header(CamelMimeMessage *message, MailDisplay *md, int index, int flags)
{
switch(index) {
case 0:
- write_address (md, html, stream,
- camel_mime_message_get_from (message), _("From"), flags | WRITE_BOLD);
+ write_address (md, camel_mime_message_get_from (message), _("From"), flags | WRITE_BOLD);
break;
case 1:
- write_address (md, html, stream,
- camel_mime_message_get_reply_to (message), _("Reply-To"), flags | WRITE_BOLD);
+ write_address (md, camel_mime_message_get_reply_to (message), _("Reply-To"), flags | WRITE_BOLD);
break;
case 2:
- write_address(md, html, stream,
- camel_mime_message_get_recipients(message, CAMEL_RECIPIENT_TYPE_TO),
+ write_address(md, camel_mime_message_get_recipients(message, CAMEL_RECIPIENT_TYPE_TO),
_("To"), flags | WRITE_BOLD);
break;
case 3:
- write_address (md, html, stream,
- camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_CC),
+ write_address (md, camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_CC),
_("Cc"), flags | WRITE_BOLD);
break;
case 4:
- write_address (md, html, stream,
- camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_BCC),
+ write_address (md, camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_BCC),
_("Bcc"), flags | WRITE_BOLD);
break;
case 5:
write_text_header (_("Subject"), camel_mime_message_get_subject (message),
- flags | WRITE_BOLD, html, stream);
+ flags | WRITE_BOLD, md->html, md->stream);
break;
case 6:
- write_date (message, flags | WRITE_BOLD, html, stream);
+ write_date (message, flags | WRITE_BOLD, md->html, md->stream);
break;
default:
g_assert_not_reached();
}
}
-static gboolean
-write_xmailer_header (CamelMimeMessage *message, MailDisplay *md,
- GtkHTML *html, GtkHTMLStream *stream,
- MailConfigXMailerDisplayStyle xm)
-{
- const char *xmailer, *evolution;
-
- xmailer = camel_medium_get_header (CAMEL_MEDIUM (message), "X-Mailer");
- if (!xmailer) {
- xmailer = camel_medium_get_header (CAMEL_MEDIUM (message), "User-Agent");
- if (!xmailer)
- return FALSE;
- }
-
- evolution = strstr (xmailer, "Evolution");
- if ((xm & MAIL_CONFIG_XMAILER_OTHER) ||
- (evolution && (xm & MAIL_CONFIG_XMAILER_EVO)))
- write_text_header (_("Mailer"), xmailer, WRITE_BOLD, html, stream);
-
- return evolution != NULL && (xm & MAIL_CONFIG_XMAILER_RUPERT_APPROVED);
-}
-
#define COLOR_IS_LIGHT(r, g, b) ((r + g + b) > (128 * 3))
static void
-write_headers (CamelMimeMessage *message, MailDisplay *md,
- GtkHTML *html, GtkHTMLStream *stream)
+write_headers (CamelMimeMessage *message, MailDisplay *md)
{
- MailConfigXMailerDisplayStyle xm = mail_config_get_x_mailer_display_style ();
gboolean full = (md->display_style == MAIL_CONFIG_DISPLAY_FULL_HEADERS);
char bgcolor[7], fontcolor[7];
GtkStyle *style = NULL;
- gboolean evo_icon = FALSE;
int i;
- /* My favorite thing to do... muck around with colors so we respect people's stupid themes.
- However, we only do this if we are rendering to the screen -- we ignore the theme
- when we are printing. */
- style = gtk_widget_get_style (GTK_WIDGET (html));
- if (style && !md->printing) {
- int state = GTK_WIDGET_STATE (GTK_WIDGET (html));
+ /* My favorite thing to do...much around with colors so we respect people's stupid themes */
+ style = gtk_widget_get_style (GTK_WIDGET (md->html));
+ if (style) {
+ int state = GTK_WIDGET_STATE (GTK_WIDGET (md->html));
gushort r, g, b;
r = style->base[state].red / 256;
@@ -954,7 +944,7 @@ write_headers (CamelMimeMessage *message, MailDisplay *md,
sprintf (bgcolor, "%.2X%.2X%.2X", r, g, b);
- r = style->text[state].red / 256;
+ r = style->text[state].red;
g = style->text[state].green / 256;
b = style->text[state].blue / 256;
@@ -964,68 +954,47 @@ write_headers (CamelMimeMessage *message, MailDisplay *md,
strcpy (fontcolor, "000000");
}
- gtk_html_stream_printf (
- stream,
- "<table width=\"100%%\" cellpadding=0 cellspacing=0>"
- /* Top margin */
- "<tr><td colspan=3 height=10><table height=10 cellpadding=0 cellspacing=0><tr><td></td></tr></table></td></tr>"
- /* Left margin */
- "<tr><td><table width=10 cellpadding=0 cellspacing=0><tr><td></td></tr></table></td>"
- /* Black border */
- "<td width=\"100%%\"><table bgcolor=\"#000000\" width=\"100%%\" cellspacing=0 cellpadding=1>"
- /* Main header box */
- "<tr><td><table bgcolor=\"#%s\" width=\"100%%\" cellpadding=0 cellspacing=0>"
- /* Internal header table */
- "<tr valign=top><td><table><font color=\"#%s\">\n",
- bgcolor, fontcolor);
+ gtk_html_stream_printf (md->stream,
+ "<table width=\"100%%\" cellpadding=0 cellspacing=0>"
+ "<tr><td colspan=3 height=10><table height=10 cellpadding=0 cellspacing=0>"
+ "<tr><td></td></tr></table></td></tr>"
+ "<tr><td><table width=10 cellpadding=0 cellspacing=0><tr><td></td></tr></table></td>"
+ "<td width=\"100%%\"><font color=\"#%s\">"
+ "<table bgcolor=\"#000000\" width=\"100%%\" "
+ "cellspacing=0 cellpadding=1><tr><td>"
+ "<table bgcolor=\"#%s\" width=\"100%%\" cellpadding=0 cellspacing=0>"
+ "<tr><td><table>\n", fontcolor, bgcolor);
if (full) {
struct _header_raw *header;
const char *charset;
CamelContentType *ct;
char *value;
-
+
ct = camel_mime_part_get_content_type(CAMEL_MIME_PART(message));
charset = header_content_type_param(ct, "charset");
charset = e_iconv_charset_name(charset);
-
+
header = CAMEL_MIME_PART(message)->headers;
while (header) {
i = default_header_index(header->name);
if (i == -1) {
value = header_decode_string(header->value, charset);
- write_text_header(header->name, value, WRITE_NOCOLUMNS, html, stream);
+ write_text_header(header->name, value, WRITE_NOCOLUMNS, md->html, md->stream);
g_free(value);
} else
- write_default_header(message, md, html, stream, i, WRITE_NOCOLUMNS);
+ write_default_header(message, md, i, WRITE_NOCOLUMNS);
header = header->next;
}
} else {
for (i=0;i<sizeof(default_headers)/sizeof(default_headers[0]);i++)
- write_default_header(message, md, html, stream, i, 0);
- if (xm != MAIL_CONFIG_XMAILER_NONE)
- evo_icon = write_xmailer_header(message, md, html, stream, xm);
+ write_default_header(message, md, i, 0);
}
- /* Close off the internal header table */
- mail_html_write (html, stream, "</font></table></td>");
-
- if (!md->printing && evo_icon) {
- gtk_html_stream_printf (stream,
- "<td align=right><table><tr><td width=16>"
- "<img src=\"%s\">"
- "</td></tr></table></td>",
- mail_display_get_url_for_icon (md, EVOLUTION_ICONSDIR "/monkey-16.png"));
- }
-
- mail_html_write (html, stream,
- /* Main header box */
- "</tr></table>"
- /* Black border */
- "</td></tr></table></td>"
- /* Right margin */
- "<td><table width=10 cellpadding=0 cellspacing=0><tr><td></td></tr></table></td>"
- "</tr></table>\n");
+ mail_html_write (md->html, md->stream,
+ "</table></td></tr></table></td></tr></table></font></td>"
+ "<td><table width=10 cellpadding=0 cellspacing=0><tr><td>"
+ "</td></tr></table></td></tr></table>\n");
}
static void
@@ -1041,17 +1010,16 @@ load_offline_content (MailDisplay *md, gpointer data)
}
gboolean
-mail_content_loaded (CamelDataWrapper *wrapper, MailDisplay *md, gboolean redisplay, const gchar *url,
- GtkHTML *html, GtkHTMLStream *handle)
+mail_content_loaded (CamelDataWrapper *wrapper, MailDisplay *md, gboolean redisplay, const gchar *url, GtkHTMLStream *handle)
{
if (!camel_data_wrapper_is_offline (wrapper))
return TRUE;
camel_object_ref (CAMEL_OBJECT (wrapper));
if (redisplay)
- mail_display_redisplay_when_loaded (md, wrapper, load_offline_content, html, wrapper);
+ mail_display_redisplay_when_loaded (md, wrapper, load_offline_content, wrapper);
else
- mail_display_stream_write_when_loaded (md, wrapper, url, load_offline_content, html, handle, wrapper);
+ mail_display_stream_write_when_loaded (md, wrapper, url, load_offline_content, handle, wrapper);
return FALSE;
}
@@ -1131,9 +1099,9 @@ mail_format_get_data_wrapper_text (CamelDataWrapper *wrapper, MailDisplay *mail_
}
static void
-write_hr (GtkHTML *html, GtkHTMLStream *stream)
+write_hr (MailDisplay *md)
{
- mail_html_write (html, stream,
+ mail_html_write (md->html, md->stream,
"<table cellspacing=0 cellpadding=10 width=\"100%\"><tr><td width=\"100%\">"
"<hr noshadow size=1></td></tr></table>\n");
}
@@ -1145,7 +1113,7 @@ write_hr (GtkHTML *html, GtkHTMLStream *stream)
struct {
char *start;
char * (*handler) (char *start, CamelMimePart *part,
- guint offset, MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream);
+ guint offset, MailDisplay *md);
} text_specials[] = {
{ "-----BEGIN PGP MESSAGE-----\n", try_inline_pgp },
{ "-----BEGIN PGP SIGNED MESSAGE-----\n", try_inline_pgp_sig },
@@ -1156,23 +1124,23 @@ struct {
static int num_specials = (sizeof (text_specials) / sizeof (text_specials[0]));
static void
-write_one_text_plain_chunk (const char *text, int len, GtkHTML *html, GtkHTMLStream *stream, gboolean printing)
+write_one_text_plain_chunk (const char *text, int len, MailDisplay *md)
{
char *buf;
- mail_html_write (html, stream,
+ mail_html_write (md->html, md->stream,
"<table cellspacing=0 cellpadding=10 width=\"100%\"><tr><td>\n");
buf = g_strndup (text, len);
- mail_text_write (html, stream, printing, buf);
+ mail_text_write (md->html, md->stream, buf);
g_free (buf);
- mail_html_write (html, stream, "</td></tr></table>\n");
+ mail_html_write (md->html, md->stream, "</td></tr></table>\n");
}
static gboolean
handle_text_plain (CamelMimePart *part, const char *mime_type,
- MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream)
+ MailDisplay *md)
{
CamelDataWrapper *wrapper =
camel_medium_get_content_object (CAMEL_MEDIUM (part));
@@ -1191,20 +1159,11 @@ handle_text_plain (CamelMimePart *part, const char *mime_type,
text = bytes->data;
g_byte_array_free (bytes, FALSE);
- /* Check to see if this is a broken text/html part with content-type text/plain */
- start = text;
- while (isspace ((unsigned) *start))
- start++;
- if (!g_strncasecmp (start, "<html>", 6) || !g_strncasecmp (start, "<!DOCTYPE HTML", 14)) {
- g_free (text);
- return handle_text_html (part, "text/html", md, html, stream);
- }
-
/* Check for RFC 2646 flowed text. */
type = camel_mime_part_get_content_type (part);
format = header_content_type_param (type, "format");
if (format && !g_strcasecmp (format, "flowed"))
- return handle_text_plain_flowed (text, md, html, stream);
+ return handle_text_plain_flowed (text, md);
/* Only look for binhex and stuff if this is real text/plain.
* (and not, say, application/mac-binhex40 that mail-identify
@@ -1226,9 +1185,9 @@ handle_text_plain (CamelMimePart *part, const char *mime_type,
/* Deal with special case */
if (start != p)
- write_one_text_plain_chunk (p, start - p, html, stream, md->printing);
+ write_one_text_plain_chunk (p, start - p, md);
- p = text_specials[i].handler (start, part, start - text, md, html, stream);
+ p = text_specials[i].handler (start, part, start - text, md);
if (p == start) {
/* Oops. That failed. Output this line normally and
* skip over it.
@@ -1240,13 +1199,13 @@ handle_text_plain (CamelMimePart *part, const char *mime_type,
break;
}
p++;
- write_one_text_plain_chunk (start, p - start, html, stream, md->printing);
+ write_one_text_plain_chunk (start, p - start, md);
} else if (p)
- write_hr (html, stream);
+ write_hr (md);
}
/* Finish up (or do the whole thing if there were no specials). */
if (p)
- write_one_text_plain_chunk (p, strlen (p), html, stream, md->printing);
+ write_one_text_plain_chunk (p, strlen (p), md);
g_free (text);
@@ -1254,13 +1213,13 @@ handle_text_plain (CamelMimePart *part, const char *mime_type,
}
static gboolean
-handle_text_plain_flowed (char *buf, MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream)
+handle_text_plain_flowed (char *buf, MailDisplay *md)
{
char *text, *line, *eol, *p;
int prevquoting = 0, quoting, len, br_pending = 0;
guint32 citation_color = mail_config_get_citation_color ();
- mail_html_write (html, stream,
+ mail_html_write (md->html, md->stream,
"\n<!-- text/plain, flowed -->\n"
"<table cellspacing=0 cellpadding=10 width=\"100%\"><tr><td>\n<tt>\n");
@@ -1269,29 +1228,26 @@ handle_text_plain_flowed (char *buf, MailDisplay *md, GtkHTML *html, GtkHTMLStre
eol = strchr (line, '\n');
if (eol)
*eol = '\0';
-
+
quoting = 0;
for (p = line; *p == '>'; p++)
quoting++;
if (quoting != prevquoting) {
if (prevquoting == 0) {
- if (md->printing)
- mail_html_write (html, stream, "<i>");
- else
- gtk_html_stream_printf (stream, "<font color=\"#%06x\">", citation_color);
+ gtk_html_stream_printf (md->stream, "<font color=\"#%06x\">", citation_color);
if (br_pending)
br_pending--;
}
while (quoting > prevquoting) {
- mail_html_write (html, stream, "<blockquote>");
+ mail_html_write (md->html, md->stream, "<blockquote>");
prevquoting++;
}
while (quoting < prevquoting) {
- mail_html_write (html, stream, "</blockquote>");
+ mail_html_write (md->html, md->stream, "</blockquote>");
prevquoting--;
}
if (quoting == 0) {
- mail_html_write (html, stream, md->printing ? "</i>" : "</font>\n");
+ mail_html_write (md->html, md->stream, "</font>\n");
if (br_pending)
br_pending--;
}
@@ -1306,30 +1262,27 @@ handle_text_plain_flowed (char *buf, MailDisplay *md, GtkHTML *html, GtkHTMLStre
}
while (br_pending) {
- mail_html_write (html, stream, "<br>\n");
+ mail_html_write (md->html, md->stream, "<br>\n");
br_pending--;
}
/* replace '<' with '&lt;', etc. */
- text = e_text_to_html (p,
- md->printing ?
- E_TEXT_TO_HTML_CONVERT_SPACES :
- E_TEXT_TO_HTML_CONVERT_SPACES | E_TEXT_TO_HTML_CONVERT_URLS);
+ text = e_text_to_html (p, E_TEXT_TO_HTML_CONVERT_SPACES |
+ E_TEXT_TO_HTML_CONVERT_URLS);
if (text && *text)
- mail_html_write (html, stream, text);
+ mail_html_write (md->html, md->stream, text);
g_free (text);
- if ((len > 0 && p[len - 1]) != ' ' || !strcmp (p, "-- "))
+ if (p[len - 1] != ' ' || !strcmp (p, "-- "))
br_pending++;
if (!eol)
break;
}
-
g_free (buf);
-
- mail_html_write (html, stream, "</tt>\n</td></tr></table>\n");
-
+
+ mail_html_write (md->html, md->stream, "</tt>\n</td></tr></table>\n");
+
return TRUE;
}
@@ -1368,24 +1321,121 @@ destroy_part (CamelObject *root, gpointer event_data, gpointer user_data)
static char *
try_inline_pgp (char *start, CamelMimePart *mime_part,
- guint offset, MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream)
+ guint offset, MailDisplay *md)
{
- return start;
+ CamelMimePart *part;
+ CamelMultipart *multipart;
+ char *end;
+
+ end = strstr (start, "\n-----END PGP MESSAGE-----\n");
+ if (!end)
+ return start;
+
+ end += sizeof ("\n-----END PGP MESSAGE-----\n") - 1;
+
+ multipart = camel_multipart_new ();
+ camel_data_wrapper_set_mime_type (CAMEL_DATA_WRAPPER (multipart),
+ "multipart/encrypted; "
+ "protocol=\"application/pgp-encrypted\"; "
+ "x-inline-pgp-hack=true");
+
+ part = fake_mime_part_from_data ("Version: 1\n",
+ sizeof ("Version: 1\n") - 1,
+ "application/pgp-encrypted",
+ offset + 1, md);
+ camel_multipart_add_part (multipart, part);
+ camel_object_unref (CAMEL_OBJECT (part));
+
+ part = fake_mime_part_from_data (start, end - start + 1,
+ "application/octet-stream",
+ offset, md);
+ camel_multipart_add_part (multipart, part);
+ camel_object_unref (CAMEL_OBJECT (part));
+
+ part = camel_mime_part_new ();
+ camel_medium_set_content_object (CAMEL_MEDIUM (part),
+ CAMEL_DATA_WRAPPER (multipart));
+
+ camel_object_hook_event (CAMEL_OBJECT (md->current_message),
+ "finalize", destroy_part, part);
+
+ write_hr (md);
+ format_mime_part (part, md);
+
+ return end;
}
static char *
try_inline_pgp_sig (char *start, CamelMimePart *mime_part,
- guint offset, MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream)
+ guint offset, MailDisplay *md)
{
- return start;
+ CamelMimePart *part;
+ CamelMultipart *multipart;
+ char *msg_start, *msg_end, *sig_start, *sig_end;
+ CamelContentType *type;
+ char *type_str;
+
+ /* We know start points to "-----BEGIN PGP SIGNED MESSAGE-----\n" */
+ msg_start = start + sizeof ("-----BEGIN PGP SIGNED MESSAGE-----\n") - 1;
+
+ if (*msg_start != '\n') {
+ /* Skip 'One or more "Hash" Armor Headers' followed by
+ * 'Exactly one empty line'.
+ */
+ msg_start = strstr (msg_start, "\n\n");
+ if (!msg_start)
+ return start;
+ msg_start += 2;
+ }
+
+ msg_end = strstr (msg_start, "\n-----BEGIN PGP SIGNATURE-----\n");
+ if (!msg_end || msg_end == msg_start)
+ return start;
+
+ sig_start = msg_end;
+ sig_end = strstr (sig_start, "\n-----END PGP SIGNATURE-----\n");
+ if (!sig_end)
+ return start;
+ sig_end += sizeof ("\n-----END PGP SIGNATURE-----\n") - 1;
+
+ multipart = camel_multipart_new ();
+ camel_data_wrapper_set_mime_type (CAMEL_DATA_WRAPPER (multipart),
+ "multipart/signed; micalg=pgp-sha1;"
+ "x-inline-pgp-hack=true");
+
+ type = camel_mime_part_get_content_type (mime_part);
+ type_str = header_content_type_format (type);
+ part = fake_mime_part_from_data (msg_start, msg_end - msg_start,
+ type_str, offset, md);
+ g_free (type_str);
+ camel_multipart_add_part (multipart, part);
+ camel_object_unref (CAMEL_OBJECT (part));
+
+ part = fake_mime_part_from_data (sig_start, sig_end - sig_start,
+ "application/pgp-signature",
+ offset + 1, md);
+ camel_multipart_add_part (multipart, part);
+ camel_object_unref (CAMEL_OBJECT (part));
+
+ part = camel_mime_part_new ();
+ camel_medium_set_content_object (CAMEL_MEDIUM (part),
+ CAMEL_DATA_WRAPPER (multipart));
+
+ camel_object_hook_event (CAMEL_OBJECT (md->current_message),
+ "finalize", destroy_part, part);
+
+ write_hr (md);
+ format_mime_part (part, md);
+
+ return sig_end;
}
static char *
try_uudecoding (char *start, CamelMimePart *mime_part,
- guint offset, MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream)
+ guint offset, MailDisplay *md)
{
- int mode, len, state = CAMEL_UUDECODE_STATE_INIT;
- char *filename, *estart, *p, *out;
+ int mode, len, state = 0;
+ char *filename, *estart, *p, *out, uulen = 0;
guint32 save = 0;
CamelMimePart *part;
@@ -1411,7 +1461,7 @@ try_uudecoding (char *start, CamelMimePart *mime_part,
}
out = g_malloc (p - estart);
- len = uudecode_step (estart, p - estart, out, &state, &save);
+ len = uudecode_step (estart, p - estart, out, &state, &save, &uulen);
part = fake_mime_part_from_data (out, len, "application/octet-stream",
offset, md);
@@ -1421,15 +1471,15 @@ try_uudecoding (char *start, CamelMimePart *mime_part,
camel_object_hook_event (CAMEL_OBJECT (md->current_message),
"finalize", destroy_part, part);
- write_hr (html, stream);
- format_mime_part (part, md, html, stream);
+ write_hr (md);
+ format_mime_part (part, md);
return p + 4;
}
static char *
try_inline_binhex (char *start, CamelMimePart *mime_part,
- guint offset, MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream)
+ guint offset, MailDisplay *md)
{
char *p;
CamelMimePart *part;
@@ -1451,8 +1501,8 @@ try_inline_binhex (char *start, CamelMimePart *mime_part,
camel_object_hook_event (CAMEL_OBJECT (md->current_message),
"finalize", destroy_part, part);
- write_hr (html, stream);
- format_mime_part (part, md, html, stream);
+ write_hr (md);
+ format_mime_part (part, md);
return p;
}
@@ -1472,7 +1522,7 @@ g_string_append_len (GString *string, const char *str, int len)
/* text/enriched (RFC 1896) or text/richtext (included in RFC 1341) */
static gboolean
handle_text_enriched (CamelMimePart *part, const char *mime_type,
- MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream)
+ MailDisplay *md)
{
static GHashTable *translations = NULL;
CamelDataWrapper *wrapper =
@@ -1522,11 +1572,11 @@ handle_text_enriched (CamelMimePart *part, const char *mime_type,
if (!g_strcasecmp (mime_type, "text/richtext")) {
enriched = FALSE;
- mail_html_write (html, stream,
+ mail_html_write (md->html, md->stream,
"\n<!-- text/richtext -->\n");
} else {
enriched = TRUE;
- mail_html_write (html, stream,
+ mail_html_write (md->html, md->stream,
"\n<!-- text/enriched -->\n");
}
@@ -1620,56 +1670,39 @@ handle_text_enriched (CamelMimePart *part, const char *mime_type,
g_string_free (string, TRUE);
xed = g_strdup_printf ("x-evolution-data:%p", part);
- gtk_html_stream_printf (stream, "<iframe src=\"%s\" frameborder=0 scrolling=no></iframe>", xed);
- mail_display_add_url (md, "data_urls", xed, ba);
+ gtk_html_stream_printf (md->stream, "<iframe src=\"%s\" frameborder=0 scrolling=no></iframe>", xed);
+ add_url ("data_urls", xed, ba, md);
return TRUE;
}
static gboolean
handle_text_html (CamelMimePart *part, const char *mime_type,
- MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream)
+ MailDisplay *md)
{
- const char *location, *base;
+ const char *location;
- mail_html_write (html, stream, "\n<!-- text/html -->\n");
-
- if ((base = camel_medium_get_header (CAMEL_MEDIUM (part), "Content-Base"))) {
- char *base_url;
- size_t len;
-
- len = strlen (base);
-
- if (*base == '"' && *(base + len - 1) == '"') {
- len -= 2;
- base_url = alloca (len + 1);
- memcpy (base_url, base + 1, len);
- base_url[len] = '\0';
- base = base_url;
- }
-
- gtk_html_set_base (html, base);
- }
+ mail_html_write (md->html, md->stream, "\n<!-- text/html -->\n");
/* FIXME: deal with relative URLs */
location = get_location (part, md);
if (!location)
location = get_cid (part, md);
- gtk_html_stream_printf (stream, "<iframe src=\"%s\" frameborder=0 scrolling=no></iframe>", location);
+ gtk_html_stream_printf (md->stream, "<iframe src=\"%s\" frameborder=0 scrolling=no></iframe>", location);
return TRUE;
}
static gboolean
-handle_image (CamelMimePart *part, const char *mime_type, MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream)
+handle_image (CamelMimePart *part, const char *mime_type, MailDisplay *md)
{
- gtk_html_stream_printf (stream, "<img hspace=10 vspace=10 src=\"%s\">",
+ gtk_html_stream_printf (md->stream, "<img hspace=10 vspace=10 src=\"%s\">",
get_cid (part, md));
return TRUE;
}
static gboolean
handle_multipart_mixed (CamelMimePart *part, const char *mime_type,
- MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream)
+ MailDisplay *md)
{
CamelDataWrapper *wrapper =
camel_medium_get_content_object (CAMEL_MEDIUM (part));
@@ -1683,35 +1716,19 @@ handle_multipart_mixed (CamelMimePart *part, const char *mime_type,
nparts = camel_multipart_get_number (mp);
for (i = 0; i < nparts; i++) {
if (i != 0 && output)
- write_hr (html, stream);
+ write_hr (md);
part = camel_multipart_get_part (mp, i);
- output = format_mime_part (part, md, html, stream);
+ output = format_mime_part (part, md);
}
return TRUE;
}
static gboolean
-handle_multipart_digest (CamelMimePart *part, const char *mime_type,
- MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream)
-{
- CamelDataWrapper *wrapper =
- camel_medium_get_content_object (CAMEL_MEDIUM (part));
-
- g_return_val_if_fail (CAMEL_IS_MULTIPART (wrapper), FALSE);
-
- gtk_html_stream_printf (stream, "&nbsp;&nbsp;&nbsp;&nbsp;<a href=\"digest:\"><img src=\"%s\">%s</a>",
- mail_display_get_url_for_icon (md, EVOLUTION_ICONSDIR "/envelope.png"),
- U_("View messages..."));
-
- return TRUE;
-}
-
-static gboolean
handle_multipart_encrypted (CamelMimePart *part, const char *mime_type,
- MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream)
+ MailDisplay *md)
{
CamelDataWrapper *wrapper;
CamelMimePart *mime_part;
@@ -1723,7 +1740,7 @@ handle_multipart_encrypted (CamelMimePart *part, const char *mime_type,
/* Currently we only handle RFC2015-style PGP encryption. */
if (!camel_pgp_mime_is_rfc2015_encrypted (part))
- return handle_multipart_mixed (part, mime_type, md, html, stream);
+ return handle_multipart_mixed (part, mime_type, md);
camel_exception_init (&ex);
mime_part = mail_crypto_pgp_mime_part_decrypt (part, &ex);
@@ -1733,7 +1750,7 @@ handle_multipart_encrypted (CamelMimePart *part, const char *mime_type,
error = e_utf8_from_locale_string (camel_exception_get_description (&ex));
- mail_error_printf (html, stream, "\n%s\n", error);
+ mail_error_printf (md->html, md->stream, "\n%s\n", error);
g_free (error);
camel_exception_clear (&ex);
@@ -1745,13 +1762,13 @@ handle_multipart_encrypted (CamelMimePart *part, const char *mime_type,
camel_object_unref (CAMEL_OBJECT (mime_part));
/* and continue on our merry way... */
- return format_mime_part (part, md, html, stream);
+ return format_mime_part (part, md);
}
}
static gboolean
handle_multipart_signed (CamelMimePart *part, const char *mime_type,
- MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream)
+ MailDisplay *md)
{
CamelMimePart *subpart;
CamelDataWrapper *wrapper;
@@ -1763,43 +1780,31 @@ handle_multipart_signed (CamelMimePart *part, const char *mime_type,
g_return_val_if_fail (CAMEL_IS_MULTIPART (wrapper), FALSE);
- /* Display all the subparts (there should be only 1) up to, but not including,
- * the signature. (this should be the last part but we all know that most
- * mailers are broken, so attempt to handle broken multipart/signed messages).
- * See bug #23583 for details.
+ /* Display all the subparts (there should be only 1)
+ * except the signature (last part).
*/
mp = CAMEL_MULTIPART (wrapper);
nparts = camel_multipart_get_number (mp);
- for (i = 0; i < nparts; i++) {
- CamelContentType *content_type;
+ for (i = 0; i < nparts - 1; i++) {
+ if (i != 0 && output)
+ write_hr (md);
subpart = camel_multipart_get_part (mp, i);
- content_type = camel_mime_part_get_content_type (subpart);
-
- if (header_content_type_is (content_type, "application", "pgp-signature"))
- break;
-
- if (i != 0 && output)
- write_hr (html, stream);
- output = format_mime_part (subpart, md, html, stream);
- }
-
- if (i >= nparts) {
- /* no signature part? wtf? */
- return TRUE;
+ output = format_mime_part (subpart, md);
}
+ subpart = camel_multipart_get_part (mp, i);
mail_part_set_default_displayed_inline (subpart, md, FALSE);
- if (!mail_part_is_displayed_inline (subpart, md) && !md->printing) {
+ if (!mail_part_is_displayed_inline (subpart, md)) {
char *url;
/* Write out the click-for-info object */
url = g_strdup_printf ("signature:%p/%lu", subpart,
(unsigned long)time (NULL));
- gtk_html_stream_printf (stream,
+ gtk_html_stream_printf (md->stream,
"<br><table cellspacing=0 cellpadding=0>"
"<tr><td><table width=10 cellspacing=0 cellpadding=0>"
"<tr><td></td></tr></table></td>"
@@ -1807,13 +1812,13 @@ handle_multipart_signed (CamelMimePart *part, const char *mime_type,
"<td><table width=3 cellspacing=0 cellpadding=0>"
"<tr><td></td></tr></table></td>"
"<td><font size=-1>", url);
- mail_display_add_url (md, "part_urls", url, subpart);
+ add_url ("part_urls", url, subpart, md);
- mail_html_write (html, stream,
+ mail_html_write (md->html, md->stream,
U_("This message is digitally signed. "
"Click the lock icon for more information."));
- mail_html_write (html, stream,
+ mail_html_write (md->html, md->stream,
"</font></td></tr><tr><td height=10><table height=10 cellspacing=0 cellpadding=0>"
"<tr><td></td></tr></table></td></tr></table>\n");
} else {
@@ -1836,61 +1841,50 @@ handle_multipart_signed (CamelMimePart *part, const char *mime_type,
message = U_("Evolution does not recognize this type of signed message.");
if (good) {
- gtk_html_stream_printf (stream,
+ gtk_html_stream_printf (md->stream,
"<table><tr valign=top>"
"<td><img src=\"%s\"></td>"
"<td>%s<br><br>",
- mail_display_get_url_for_icon (md, EVOLUTION_ICONSDIR "/pgp-signature-ok.png"),
+ get_url_for_icon (EVOLUTION_ICONSDIR "/pgp-signature-ok.png", md),
U_("This message is digitally signed and "
"has been found to be authentic."));
} else {
- gtk_html_stream_printf (stream,
+ gtk_html_stream_printf (md->stream,
"<table><tr valign=top>"
"<td><img src=\"%s\"></td>"
"<td>%s<br><br>",
- mail_display_get_url_for_icon (md, EVOLUTION_ICONSDIR "/pgp-signature-bad.png"),
+ get_url_for_icon (EVOLUTION_ICONSDIR "/pgp-signature-bad.png", md),
U_("This message is digitally signed but can "
"not be proven to be authentic."));
}
if (message) {
- gtk_html_stream_printf (stream, "<font size=-1 %s>", good || md->printing ? "" : "color=red");
- mail_text_write (html, stream, md->printing, message);
- mail_html_write (html, stream, "</font>");
+ gtk_html_stream_printf (md->stream, "<font size=-1 %s>",
+ good ? "" : "color=red");
+ mail_text_write (md->html, md->stream, message);
+ mail_html_write (md->html, md->stream, "</font>");
}
- mail_html_write (html, stream, "</td></tr></table>");
+ mail_html_write (md->html, md->stream, "</td></tr></table>");
camel_exception_clear (&ex);
camel_cipher_validity_free (valid);
}
- /* continuation of handling broken multipart/signed
- * parts... write out any extra parts that were added after
- * the signature part. */
- for (i++; i < nparts; i++) {
- subpart = camel_multipart_get_part (mp, i);
-
- write_hr (html, stream);
-
- output = format_mime_part (subpart, md, html, stream);
- }
-
return TRUE;
}
/* As seen in RFC 2387! */
static gboolean
handle_multipart_related (CamelMimePart *part, const char *mime_type,
- MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream)
+ MailDisplay *md)
{
- CamelDataWrapper *wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (part));
+ CamelDataWrapper *wrapper =
+ camel_medium_get_content_object (CAMEL_MEDIUM (part));
CamelMultipart *mp;
CamelMimePart *body_part, *display_part = NULL;
CamelContentType *content_type;
const char *start;
int i, nparts;
- GHashTable *related_save;
- int ret;
g_return_val_if_fail (CAMEL_IS_MULTIPART (wrapper), FALSE);
@@ -1926,13 +1920,9 @@ handle_multipart_related (CamelMimePart *part, const char *mime_type,
if (!display_part) {
/* Oops. Hrmph. */
- return handle_multipart_mixed (part, mime_type, md, html, stream);
+ return handle_multipart_mixed (part, mime_type, md);
}
- /* setup a 'stack' of related parts */
- related_save = md->related;
- md->related = g_hash_table_new(NULL, NULL);
-
/* Record the Content-ID/Content-Location of any non-displayed parts. */
for (i = 0; i < nparts; i++) {
body_part = camel_multipart_get_part (mp, i);
@@ -1941,33 +1931,10 @@ handle_multipart_related (CamelMimePart *part, const char *mime_type,
get_cid (body_part, md);
get_location (body_part, md);
- g_hash_table_insert(md->related, body_part, body_part);
}
/* Now, display the displayed part. */
- ret = format_mime_part (display_part, md, html, stream);
-
- /* FIXME: flush html stream via gtkhtml_stream_flush which doens't exist yet ... */
- while (gtk_events_pending())
- gtk_main_iteration();
-
- /* Now check for related parts which didn't display, display them as attachments */
- for (i = 0; i < nparts; i++) {
- body_part = camel_multipart_get_part (mp, i);
- if (body_part == display_part)
- continue;
-
- if (g_hash_table_lookup(md->related, body_part)) {
- if (ret)
- write_hr (html, stream);
- ret |= format_mime_part(body_part, md, html, stream);
- }
- }
-
- g_hash_table_destroy(md->related);
- md->related = related_save;
-
- return ret;
+ return format_mime_part (display_part, md);
}
/* RFC 2046 says "display the last part that you are able to display". */
@@ -1998,7 +1965,7 @@ find_preferred_alternative (CamelMultipart *multipart, gboolean want_plain)
static gboolean
handle_multipart_alternative (CamelMimePart *part, const char *mime_type,
- MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream)
+ MailDisplay *md)
{
CamelDataWrapper *wrapper =
camel_medium_get_content_object (CAMEL_MEDIUM (part));
@@ -2011,15 +1978,15 @@ handle_multipart_alternative (CamelMimePart *part, const char *mime_type,
mime_part = find_preferred_alternative (multipart, FALSE);
if (mime_part)
- return format_mime_part (mime_part, md, html, stream);
+ return format_mime_part (mime_part, md);
else
- return handle_multipart_mixed (part, mime_type, md, html, stream);
+ return handle_multipart_mixed (part, mime_type, md);
}
/* RFC 1740 */
static gboolean
handle_multipart_appledouble (CamelMimePart *part, const char *mime_type,
- MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream)
+ MailDisplay *md)
{
CamelDataWrapper *wrapper =
camel_medium_get_content_object (CAMEL_MEDIUM (part));
@@ -2034,28 +2001,28 @@ handle_multipart_appledouble (CamelMimePart *part, const char *mime_type,
* likely it's application/octet-stream though.
*/
part = camel_multipart_get_part (multipart, 1);
- return format_mime_part (part, md, html, stream);
+ return format_mime_part (part, md);
}
static gboolean
handle_message_rfc822 (CamelMimePart *part, const char *mime_type,
- MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream)
+ MailDisplay *md)
{
CamelDataWrapper *wrapper =
camel_medium_get_content_object (CAMEL_MEDIUM (part));
g_return_val_if_fail (CAMEL_IS_MIME_MESSAGE (wrapper), FALSE);
- mail_html_write (html, stream, "<blockquote>");
- mail_format_mime_message (CAMEL_MIME_MESSAGE (wrapper), md, html, stream);
- mail_html_write (html, stream, "</blockquote>");
+ mail_html_write (md->html, md->stream, "<blockquote>");
+ mail_format_mime_message (CAMEL_MIME_MESSAGE (wrapper), md);
+ mail_html_write (md->html, md->stream, "</blockquote>");
return TRUE;
}
static gboolean
handle_message_external_body (CamelMimePart *part, const char *mime_type,
- MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream)
+ MailDisplay *md)
{
CamelContentType *type;
const char *access_type;
@@ -2179,14 +2146,11 @@ handle_message_external_body (CamelMimePart *part, const char *mime_type,
static gboolean
handle_via_bonobo (CamelMimePart *part, const char *mime_type,
- MailDisplay *md, GtkHTML *html, GtkHTMLStream *stream)
+ MailDisplay *md)
{
- if (! md->printing) {
- gtk_html_stream_printf (stream,
- "<object classid=\"%s\" type=\"%s\"></object>",
- get_cid (part, md), mime_type);
- }
-
+ gtk_html_stream_printf (md->stream,
+ "<object classid=\"%s\" type=\"%s\"></object>",
+ get_cid (part, md), mime_type);
return TRUE;
}
@@ -2228,7 +2192,7 @@ mail_get_message_rfc822 (CamelMimeMessage *message, gboolean want_plain, gboolea
cia = camel_mime_message_get_from (message);
buf = camel_address_format (CAMEL_ADDRESS (cia));
if (buf) {
- html = e_text_to_html (buf, E_TEXT_TO_HTML_CONVERT_NL);
+ html = e_text_to_html (buf, E_TEXT_TO_HTML_CONVERT_NL | E_TEXT_TO_HTML_CONVERT_URLS);
g_string_sprintfa (retval, "%s<b>From:</b> %s<br>",
citation, html);
g_free (html);
@@ -2238,7 +2202,7 @@ mail_get_message_rfc822 (CamelMimeMessage *message, gboolean want_plain, gboolea
cia = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_TO);
buf = camel_address_format (CAMEL_ADDRESS (cia));
if (buf) {
- html = e_text_to_html (buf, E_TEXT_TO_HTML_CONVERT_NL);
+ html = e_text_to_html (buf, E_TEXT_TO_HTML_CONVERT_NL | E_TEXT_TO_HTML_CONVERT_URLS);
g_string_sprintfa (retval, "%s<b>To:</b> %s<br>",
citation, html);
g_free (html);
@@ -2248,7 +2212,7 @@ mail_get_message_rfc822 (CamelMimeMessage *message, gboolean want_plain, gboolea
cia = camel_mime_message_get_recipients (message, CAMEL_RECIPIENT_TYPE_CC);
buf = camel_address_format (CAMEL_ADDRESS (cia));
if (buf) {
- html = e_text_to_html (buf, E_TEXT_TO_HTML_CONVERT_NL);
+ html = e_text_to_html (buf, E_TEXT_TO_HTML_CONVERT_NL | E_TEXT_TO_HTML_CONVERT_URLS);
g_string_sprintfa (retval, "%s<b>Cc:</b> %s<br>",
citation, html);
g_free (html);
@@ -2265,7 +2229,7 @@ mail_get_message_rfc822 (CamelMimeMessage *message, gboolean want_plain, gboolea
date_val = camel_mime_message_get_date (message, &offset);
buf = header_format_date (date_val, offset);
- html = e_text_to_html (buf, E_TEXT_TO_HTML_CONVERT_NL);
+ html = e_text_to_html (buf, E_TEXT_TO_HTML_CONVERT_NL | E_TEXT_TO_HTML_CONVERT_URLS);
g_string_sprintfa (retval, "%s<b>Date:</b> %s<br>", citation, html);
g_free (html);
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index 13cd285f37..a0629ac093 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -30,8 +30,6 @@
/* #include <ctype.h> */
#include <errno.h>
-#include <libgnome/gnome-defs.h>
-#include <libgnome/gnome-exec.h>
#include <gal/util/e-util.h>
#include <gal/widgets/e-unicode.h>
#include <gal/util/e-unicode-i18n.h>
@@ -121,14 +119,13 @@ filter_folder_filter (struct _mail_msg *mm)
folder_uids = uids = camel_folder_get_uids (folder);
camel_filter_driver_filter_folder (m->driver, folder, m->cache, uids, m->delete, &mm->ex);
- camel_filter_driver_flush (m->driver, &mm->ex);
if (folder_uids)
camel_folder_free_uids (folder, folder_uids);
- /* sync our source folder */
+ /* sync and expunge */
if (!m->cache)
- camel_folder_sync (folder, FALSE, camel_exception_is_set (&mm->ex) ? NULL : &mm->ex);
+ camel_folder_sync (folder, TRUE, camel_exception_is_set (&mm->ex) ? NULL : &mm->ex);
camel_folder_thaw (folder);
if (m->destination)
@@ -178,8 +175,7 @@ static struct _mail_msg_op filter_folder_op = {
void
mail_filter_folder (CamelFolder *source_folder, GPtrArray *uids,
- const char *type, gboolean notify,
- CamelOperation *cancel)
+ const char *type, CamelOperation *cancel)
{
struct _filter_mail_msg *m;
@@ -196,12 +192,6 @@ mail_filter_folder (CamelFolder *source_folder, GPtrArray *uids,
m->driver = camel_session_get_filter_driver (session, type, NULL);
- if (!notify) {
- /* FIXME: have a #define NOTIFY_FILTER_NAME macro? */
- /* the filter name has to stay in sync with mail-session::get_filter_driver */
- camel_filter_driver_remove_rule_by_name (m->driver, "new-mail-notification");
- }
-
e_thread_put (mail_thread_new, (EMsg *)m);
}
@@ -209,7 +199,7 @@ mail_filter_folder (CamelFolder *source_folder, GPtrArray *uids,
void
mail_filter_on_demand (CamelFolder *folder, GPtrArray *uids)
{
- mail_filter_folder (folder, uids, FILTER_SOURCE_INCOMING, FALSE, NULL);
+ mail_filter_folder (folder, uids, FILTER_SOURCE_INCOMING, NULL);
}
/* ********************************************************************** */
@@ -427,42 +417,28 @@ mail_fetch_mail (const char *source, int keep, const char *type, CamelOperation
extern CamelFolder *sent_folder;
-static char *normal_recipients[] = {
- CAMEL_RECIPIENT_TYPE_TO,
- CAMEL_RECIPIENT_TYPE_CC,
- CAMEL_RECIPIENT_TYPE_BCC
-};
-
-static char *resent_recipients[] = {
- CAMEL_RECIPIENT_TYPE_RESENT_TO,
- CAMEL_RECIPIENT_TYPE_RESENT_CC,
- CAMEL_RECIPIENT_TYPE_RESENT_BCC
-};
-
/* send 1 message to a specific transport */
static void
mail_send_message (CamelMimeMessage *message, const char *destination,
CamelFilterDriver *driver, CamelException *ex)
{
- const CamelInternetAddress *iaddr;
- CamelAddress *from, *recipients;
CamelMessageInfo *info;
CamelTransport *xport = NULL;
char *transport_url = NULL;
char *sent_folder_uri = NULL;
- const char *resent_from;
CamelFolder *folder;
XEvolution *xev;
- int i;
- camel_medium_set_header (CAMEL_MEDIUM (message), "X-Mailer",
+ camel_medium_add_header (CAMEL_MEDIUM (message), "X-Mailer",
"Ximian Evolution " VERSION SUB_VERSION " " VERSION_COMMENT);
camel_mime_message_set_date (message, CAMEL_MESSAGE_DATE_CURRENT, 0);
xev = mail_tool_remove_xevolution_headers (message);
- if (xev->account) {
+ if (xev->transport) {
+ transport_url = g_strstrip (g_strdup (xev->transport));
+ } else if (xev->account) {
const MailConfigAccount *account;
char *name;
@@ -472,8 +448,6 @@ mail_send_message (CamelMimeMessage *message, const char *destination,
if (account && account->transport && account->transport->url)
transport_url = g_strdup (account->transport->url);
- } else if (xev->transport) {
- transport_url = g_strstrip (g_strdup (xev->transport));
}
if (xev->fcc)
@@ -488,27 +462,7 @@ mail_send_message (CamelMimeMessage *message, const char *destination,
return;
}
- from = (CamelAddress *) camel_internet_address_new ();
- resent_from = camel_medium_get_header (CAMEL_MEDIUM (message), "Resent-From");
- if (resent_from) {
- camel_address_decode (from, resent_from);
- } else {
- iaddr = camel_mime_message_get_from (message);
- camel_address_copy (from, CAMEL_ADDRESS (iaddr));
- }
-
- recipients = (CamelAddress *) camel_internet_address_new ();
- for (i = 0; i < 3; i++) {
- const char *type;
-
- type = resent_from ? resent_recipients[i] : normal_recipients[i];
- iaddr = camel_mime_message_get_recipients (message, type);
- camel_address_cat (recipients, CAMEL_ADDRESS (iaddr));
- }
-
- camel_transport_send_to (xport, message, from, recipients, ex);
- camel_object_unref (CAMEL_OBJECT (recipients));
- camel_object_unref (CAMEL_OBJECT (from));
+ camel_transport_send (xport, CAMEL_MEDIUM (message), ex);
mail_tool_restore_xevolution_headers (message, xev);
mail_tool_destroy_xevolution (xev);
@@ -2216,57 +2170,3 @@ mail_store_set_offline (CamelStore *store, gboolean offline,
e_thread_put(mail_thread_queued, (EMsg *)m);
}
-
-
-/* ** Execute Shell Command ***************************************************** */
-
-struct _execute_shell_command_msg {
- struct _mail_msg msg;
-
- char *command;
-};
-
-static char *execute_shell_command_desc (struct _mail_msg *mm, int done)
-{
- struct _execute_shell_command_msg *m = (struct _execute_shell_command_msg *) mm;
- char *msg;
-
- msg = g_strdup_printf (_("Executing shell command: %s"), m->command);
-
- return msg;
-}
-
-static void execute_shell_command_do (struct _mail_msg *mm)
-{
- struct _execute_shell_command_msg *m = (struct _execute_shell_command_msg *) mm;
-
- gnome_execute_shell (NULL, m->command);
-}
-
-static void execute_shell_command_free (struct _mail_msg *mm)
-{
- struct _execute_shell_command_msg *m = (struct _execute_shell_command_msg *) mm;
-
- g_free (m->command);
-}
-
-static struct _mail_msg_op execute_shell_command_op = {
- execute_shell_command_desc,
- execute_shell_command_do,
- NULL,
- execute_shell_command_free,
-};
-
-void
-mail_execute_shell_command (CamelFilterDriver *driver, const char *command, void *data)
-{
- struct _execute_shell_command_msg *m;
-
- if (command == NULL)
- return;
-
- m = mail_msg_new (&execute_shell_command_op, NULL, sizeof (*m));
- m->command = g_strdup (command);
-
- e_thread_put (mail_thread_queued, (EMsg *) m);
-}
diff --git a/mail/mail-send-recv.c b/mail/mail-send-recv.c
index bac7e17f46..baa4e108e4 100644
--- a/mail/mail-send-recv.c
+++ b/mail/mail-send-recv.c
@@ -78,6 +78,8 @@ struct _send_data {
CamelFolder *inbox; /* since we're never asked to update this one, do it ourselves */
time_t inbox_update;
+ CamelFolder *current_folder;
+
GMutex *lock;
GHashTable *folders;
@@ -177,7 +179,10 @@ free_send_data(void)
/*camel_folder_thaw (data->inbox); */
camel_object_unref((CamelObject *)data->inbox);
}
-
+ if (data->current_folder) {
+ mail_refresh_folder(data->current_folder, NULL, NULL);
+ camel_object_unref((CamelObject *)data->current_folder);
+ }
g_list_free(data->infos);
g_hash_table_foreach(data->active, (GHFunc)free_send_info, NULL);
g_hash_table_destroy(data->active);
@@ -269,7 +274,7 @@ static send_info_t get_receive_type(const char *url)
}
static struct _send_data *
-build_dialogue (GSList *sources, CamelFolder *outbox, const char *destination)
+build_dialogue (GSList *sources, CamelFolder *current_folder, CamelFolder *outbox, const char *destination)
{
GnomeDialog *gd;
GtkTable *table;
@@ -428,6 +433,8 @@ build_dialogue (GSList *sources, CamelFolder *outbox, const char *destination)
data->infos = list;
data->gd = gd;
+ data->current_folder = current_folder;
+ camel_object_ref (CAMEL_OBJECT (current_folder));
return data;
}
@@ -609,12 +616,6 @@ receive_get_folder(CamelFilterDriver *d, const char *uri, void *data, CamelExcep
}
static void
-receive_update_got_folderinfo (CamelStore *store, CamelFolderInfo *info, void *data)
-{
- receive_done ("", data);
-}
-
-static void
receive_update_got_store (char *uri, CamelStore *store, void *data)
{
struct _send_info *info = data;
@@ -622,23 +623,13 @@ receive_update_got_store (char *uri, CamelStore *store, void *data)
if (store) {
EvolutionStorage *storage = mail_lookup_storage (store);
- if (storage) {
- mail_note_store(store, storage, CORBA_OBJECT_NIL, receive_update_done, info);
- /*bonobo_object_unref (BONOBO_OBJECT (storage));*/
- } else {
- /* If we get here, store must be an external
- * storage other than /local. (Eg, Exchange).
- * Do a get_folder_info just to force it to
- * update itself.
- */
- mail_get_folderinfo(store, receive_update_got_folderinfo, info);
- }
+ mail_note_store(store, storage, CORBA_OBJECT_NIL, receive_update_done, info);
} else {
receive_done ("", info);
}
}
-void mail_send_receive (void)
+void mail_send_receive (CamelFolder *current_folder)
{
GSList *sources;
GList *scan;
@@ -665,7 +656,7 @@ void mail_send_receive (void)
Well, probably hook into receive_done or receive_status on
the right pop account, and when it is, then kick off the
smtp one. */
- data = build_dialogue(sources, outbox_folder, account->transport->url);
+ data = build_dialogue(sources, current_folder, outbox_folder, account->transport->url);
scan = data->infos;
while (scan) {
struct _send_info *info = scan->data;
diff --git a/mail/mail-send-recv.h b/mail/mail-send-recv.h
index 7d43d610fb..19afea853b 100644
--- a/mail/mail-send-recv.h
+++ b/mail/mail-send-recv.h
@@ -31,7 +31,7 @@ extern "C" {
#include "mail-config.h"
/* send/receive all uri's */
-void mail_send_receive(void);
+void mail_send_receive(CamelFolder *current_folder);
/* receive a single uri */
void mail_receive_uri(const char *uri, int keep);
/* setup auto receive stuff */
diff --git a/mail/mail-tools.c b/mail/mail-tools.c
index cf9dd484da..d80b3c04fa 100644
--- a/mail/mail-tools.c
+++ b/mail/mail-tools.c
@@ -237,7 +237,6 @@ mail_tool_destroy_xevolution (XEvolution *xev)
g_free (xev->source);
g_free (xev->transport);
g_free (xev->account);
- g_free (xev->format);
g_free (xev->fcc);
g_free (xev);
}
diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c
index 0c2ee4e2f7..44d0556fee 100644
--- a/mail/mail-vfolder.c
+++ b/mail/mail-vfolder.c
@@ -919,12 +919,11 @@ vfolder_gui_add_from_message(CamelMimeMessage *msg, int flags, const char *sourc
}
void
-vfolder_gui_add_from_mlist(const char *mlist, const char *source)
+vfolder_gui_add_from_mlist(CamelMimeMessage *msg, const char *mlist, const char *source)
{
VfolderRule *rule;
- g_return_if_fail (mlist != NULL);
- g_return_if_fail (source != NULL);
+ g_return_if_fail (msg != NULL);
rule = (VfolderRule*)vfolder_rule_from_mlist(context, mlist, source);
vfolder_gui_add_rule(rule);
diff --git a/mail/main.c b/mail/main.c
index d6c2e7ffcb..10497a145d 100644
--- a/mail/main.c
+++ b/mail/main.c
@@ -14,7 +14,6 @@
#include <signal.h>
#include <libgnome/gnome-defs.h>
-#include <libgnome/gnome-sound.h>
#include <libgnomeui/gnome-init.h>
#include <bonobo/bonobo-main.h>
#include <bonobo/bonobo-object-directory.h>
@@ -104,7 +103,7 @@ main (int argc, char *argv [])
gnome_init_with_popt_table ("evolution-mail-component", VERSION,
argc, argv, oaf_popt_options, 0, NULL);
-
+
sigaction (SIGSEGV, NULL, &osa);
if (osa.sa_handler != SIG_DFL) {
sa.sa_flags = 0;
@@ -145,8 +144,6 @@ main (int argc, char *argv [])
mail_config_init ();
mail_msg_init ();
- gnome_sound_init ("localhost");
-
component_factory_init ();
evolution_composer_factory_init (composer_send_cb,
composer_postpone_cb);
@@ -156,8 +153,6 @@ main (int argc, char *argv [])
gdk_threads_mutex = NULL;
}
- g_print ("Evolution Mail ready and running.\n");
-
GDK_THREADS_ENTER ();
bonobo_main ();
@@ -168,8 +163,6 @@ main (int argc, char *argv [])
mail_config_write_on_exit ();
e_passwords_shutdown ();
-
- gnome_sound_shutdown ();
-
+
return 0;
}
diff --git a/mail/message-list.c b/mail/message-list.c
index 79f24f14a8..6aead391f3 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -44,8 +44,6 @@
#include "mail-ops.h"
#include "Mail.h"
-#include "message-tag-followup.h"
-
#include "art/mail-new.xpm"
#include "art/mail-read.xpm"
#include "art/mail-replied.xpm"
@@ -59,7 +57,6 @@
#include "art/score-high.xpm"
#include "art/score-higher.xpm"
#include "art/score-highest.xpm"
-#include "art/flag-for-followup.xpm"
/*#define TIMEIT */
@@ -153,7 +150,6 @@ static struct {
{ score_high_xpm, NULL },
{ score_higher_xpm, NULL },
{ score_highest_xpm, NULL },
- { flag_for_followup_xpm,NULL },
{ NULL, NULL }
};
@@ -261,7 +257,7 @@ address_compare (gconstpointer address1, gconstpointer address2)
#ifdef SMART_ADDRESS_COMPARE
EMailAddress *addr1, *addr2;
#endif /* SMART_ADDRESS_COMPARE */
- gint retval;
+ int retval;
g_return_val_if_fail (address1 != NULL, 1);
g_return_val_if_fail (address2 != NULL, -1);
@@ -361,30 +357,6 @@ get_message_info (MessageList *message_list, ETreePath node)
return info;
}
-struct search_func_data {
- MessageList *message_list;
- guint32 flags;
- guint32 mask;
-};
-
-static gboolean
-search_func (ETreeModel *model, ETreePath path, struct search_func_data *data)
-{
- CamelMessageInfo *info;
-
- if (e_tree_model_node_is_root (data->message_list->model, path))
- return FALSE;
-
- info = get_message_info (data->message_list, path);
-
- if (info && (info->flags & data->mask) == data->flags) {
- gtk_signal_emit (GTK_OBJECT (data->message_list), message_list_signals[MESSAGE_SELECTED],
- camel_message_info_uid (info));
- return TRUE;
- }
- return FALSE;
-}
-
/**
* message_list_select:
* @message_list: a MessageList
@@ -403,32 +375,90 @@ search_func (ETreeModel *model, ETreePath path, struct search_func_data *data)
* message, or %MESSAGE_LIST_SELECT_PREVIOUS if it should find the
* previous. If no suitable row is found, the selection will be
* unchanged.
- *
- * Returns %TRUE if a new message has been selected or %FALSE otherwise.
**/
-gboolean
+void
message_list_select (MessageList *message_list,
+ int base_row,
MessageListSelectDirection direction,
guint32 flags,
guint32 mask,
gboolean wraparound)
{
- struct search_func_data data;
- ETreeFindNextParams params = 0;
+ CamelMessageInfo *info;
+ int vrow, last;
- data.message_list = message_list;
- data.flags = flags;
- data.mask = mask;
+ if (!GTK_WIDGET_HAS_FOCUS (message_list))
+ gtk_widget_grab_focus (GTK_WIDGET (message_list));
- if (direction == MESSAGE_LIST_SELECT_NEXT)
- params |= E_TREE_FIND_NEXT_FORWARD;
+ switch (direction) {
+ case MESSAGE_LIST_SELECT_PREVIOUS:
+ last = -1;
+ break;
+ case MESSAGE_LIST_SELECT_NEXT:
+ last = e_tree_row_count (message_list->tree);
+ if (last <= base_row)
+ return;
+ break;
+ default:
+ g_warning("Invalid argument to message_list_select");
+ return;
+ }
+
+ /* If it's -1, we want the last view row, not the last model row. */
+ /* model_to_view_row etc simply dont work for sorted views. Sigh. */
+ if (base_row == -1)
+ vrow = e_tree_row_count (message_list->tree) - 1;
else
- params |= E_TREE_FIND_NEXT_BACKWARD;
+ vrow = e_tree_model_to_view_row (message_list->tree, base_row);
+
+ if (vrow <= -1)
+ return;
+
+ /* This means that we'll move at least one message in 'direction'. */
+ if (vrow != last)
+ vrow += direction;
- if (wraparound)
- params |= E_TREE_FIND_NEXT_WRAP;
+ /* We don't know whether to use < or > due to "direction" */
+ while (vrow != last) {
+ ETreePath node = e_tree_node_at_row (message_list->tree, vrow);
+
+ info = get_message_info (message_list, node);
+
+ if (info && (info->flags & mask) == flags) {
+ e_tree_set_cursor (message_list->tree, node);
+
+ gtk_signal_emit (GTK_OBJECT (message_list), message_list_signals[MESSAGE_SELECTED],
+ camel_message_info_uid (info));
+ return;
+ }
+ vrow += direction;
+ }
- return e_tree_find_next (message_list->tree, params, (ETreePathFunc) search_func, &data);
+ if (wraparound) {
+ ETreePath node;
+
+ if (direction == MESSAGE_LIST_SELECT_NEXT) {
+ base_row = 0;
+ vrow = 0;
+ } else {
+ base_row = -1;
+ vrow = e_tree_row_count (message_list->tree) - 1;
+ }
+
+ /* lets see if the first/last (depending on direction)
+ row matches our selection criteria */
+ node = e_tree_node_at_row (message_list->tree, vrow);
+ info = get_message_info (message_list, node);
+ if (info && (info->flags & mask) == flags) {
+ e_tree_set_cursor (message_list->tree, node);
+
+ gtk_signal_emit (GTK_OBJECT (message_list), message_list_signals[MESSAGE_SELECTED],
+ camel_message_info_uid (info));
+ return;
+ }
+
+ message_list_select (message_list, base_row, direction, flags, mask, FALSE);
+ }
}
@@ -463,40 +493,6 @@ message_list_select_uid (MessageList *message_list, const char *uid)
}
}
-
-void
-message_list_select_next_thread (MessageList *message_list)
-{
- ETreePath node, last;
-
- if (!message_list->cursor_uid)
- return;
-
- /* get the thread parent node */
- last = node = g_hash_table_lookup (message_list->uid_nodemap, message_list->cursor_uid);
- while (!e_tree_model_node_is_root (message_list->model, node)) {
- last = node;
- node = e_tree_model_node_get_parent (message_list->model, node);
- }
-
- /* get the next toplevel node */
- node = e_tree_model_node_get_next (message_list->model, last);
-
- if (node) {
- CamelMessageInfo *info;
-
- info = get_message_info (message_list, node);
- e_tree_set_cursor (message_list->tree, node);
-
- g_free (message_list->cursor_uid);
- message_list->cursor_uid = g_strdup (camel_message_info_uid (info));
-
- gtk_signal_emit (GTK_OBJECT (message_list), message_list_signals[MESSAGE_SELECTED],
- camel_message_info_uid (info));
- }
-}
-
-
/*
* SimpleTableModel::col_count
*/
@@ -567,16 +563,13 @@ ml_duplicate_value (ETreeModel *etm, int col, const void *value, void *data)
case COL_SENT:
case COL_RECEIVED:
case COL_SIZE:
- case COL_FOLLOWUP_FLAG_STATUS:
- case COL_FOLLOWUP_DUE_BY:
return (void *) value;
-
+
case COL_FROM:
case COL_SUBJECT:
case COL_TO:
- case COL_FOLLOWUP_FLAG:
return g_strdup (value);
-
+
default:
g_assert_not_reached ();
}
@@ -596,14 +589,11 @@ ml_free_value (ETreeModel *etm, int col, void *value, void *data)
case COL_SENT:
case COL_RECEIVED:
case COL_SIZE:
- case COL_FOLLOWUP_FLAG_STATUS:
- case COL_FOLLOWUP_DUE_BY:
break;
-
+
case COL_FROM:
case COL_SUBJECT:
case COL_TO:
- case COL_FOLLOWUP_FLAG:
g_free (value);
break;
default:
@@ -624,15 +614,12 @@ ml_initialize_value (ETreeModel *etm, int col, void *data)
case COL_SENT:
case COL_RECEIVED:
case COL_SIZE:
- case COL_FOLLOWUP_FLAG_STATUS:
- case COL_FOLLOWUP_DUE_BY:
return NULL;
-
+
case COL_FROM:
case COL_SUBJECT:
case COL_TO:
- case COL_FOLLOWUP_FLAG:
- return g_strdup ("");
+ return g_strdup("");
default:
g_assert_not_reached ();
}
@@ -653,14 +640,11 @@ ml_value_is_empty (ETreeModel *etm, int col, const void *value, void *data)
case COL_SENT:
case COL_RECEIVED:
case COL_SIZE:
- case COL_FOLLOWUP_FLAG_STATUS:
- case COL_FOLLOWUP_DUE_BY:
return value == NULL;
-
+
case COL_FROM:
case COL_SUBJECT:
case COL_TO:
- case COL_FOLLOWUP_FLAG:
return !(value && *(char *)value);
default:
g_assert_not_reached ();
@@ -686,44 +670,40 @@ static const char *score_map[] = {
N_("Highest"),
};
-
static char *
ml_value_to_string (ETreeModel *etm, int col, const void *value, void *data)
{
unsigned int i;
-
+
switch (col){
case COL_MESSAGE_STATUS:
i = (unsigned int)value;
if (i > 4)
- return g_strdup ("");
- return g_strdup (_(status_map[i]));
-
+ return g_strdup("");
+ return g_strdup(_(status_map[i]));
+
case COL_SCORE:
- i = (unsigned int) value + 3;
+ i = (unsigned int)value + 3;
if (i > 6)
i = 3;
- return g_strdup (_(score_map[i]));
+ return g_strdup(_(score_map[i]));
case COL_ATTACHMENT:
case COL_FLAGGED:
case COL_DELETED:
case COL_UNREAD:
- case COL_FOLLOWUP_FLAG_STATUS:
- return g_strdup_printf ("%d", (int) value);
+ return g_strdup_printf("%d", (int) value);
case COL_SENT:
case COL_RECEIVED:
- case COL_FOLLOWUP_DUE_BY:
- return filter_date (GPOINTER_TO_INT (value));
+ return filter_date (GPOINTER_TO_INT(value));
case COL_SIZE:
- return filter_size (GPOINTER_TO_INT (value));
-
+ return filter_size (GPOINTER_TO_INT(value));
+
case COL_FROM:
case COL_SUBJECT:
case COL_TO:
- case COL_FOLLOWUP_FLAG:
return g_strdup (value);
default:
g_assert_not_reached ();
@@ -744,14 +724,14 @@ subtree_unread(MessageList *ml, ETreePath node)
{
CamelMessageInfo *info;
ETreePath child;
-
+
while (node) {
info = e_tree_memory_node_get_data((ETreeMemory *)ml->model, node);
g_assert(info);
-
+
if (!(info->flags & CAMEL_MESSAGE_SEEN))
return TRUE;
-
+
if ((child = e_tree_model_node_get_first_child (E_TREE_MODEL (ml->model), node)))
if (subtree_unread(ml, child))
return TRUE;
@@ -766,15 +746,15 @@ subtree_size(MessageList *ml, ETreePath node)
CamelMessageInfo *info;
int size = 0;
ETreePath child;
-
+
while (node) {
info = e_tree_memory_node_get_data((ETreeMemory *)ml->model, node);
g_assert(info);
-
+
size += info->size;
if ((child = e_tree_model_node_get_first_child (E_TREE_MODEL (ml->model), node)))
size += subtree_size(ml, child);
-
+
node = e_tree_model_node_get_next (ml->model, node);
}
return size;
@@ -786,28 +766,28 @@ subtree_earliest(MessageList *ml, ETreePath node, int sent)
CamelMessageInfo *info;
time_t earliest = 0, date;
ETreePath *child;
-
+
while (node) {
info = e_tree_memory_node_get_data((ETreeMemory *)ml->model, node);
g_assert(info);
-
+
if (sent)
date = info->date_sent;
else
date = info->date_received;
-
+
if (earliest == 0 || date < earliest)
earliest = date;
-
+
if ((child = e_tree_model_node_get_first_child (ml->model, node))) {
date = subtree_earliest(ml, child, sent);
if (earliest == 0 || (date != 0 && date < earliest))
earliest = date;
}
-
+
node = e_tree_model_node_get_next (ml->model, node);
}
-
+
return earliest;
}
@@ -816,15 +796,15 @@ ml_tree_value_at (ETreeModel *etm, ETreePath path, int col, void *model_data)
{
MessageList *message_list = model_data;
CamelMessageInfo *msg_info;
-
+
/* retrieve the message information array */
msg_info = e_tree_memory_node_get_data (E_TREE_MEMORY(etm), path);
g_assert(msg_info);
-
+
switch (col){
case COL_MESSAGE_STATUS: {
ETreePath child;
-
+
/* if a tree is collapsed, then scan its insides for details */
child = e_tree_model_node_get_first_child(etm, path);
if (child && !e_tree_node_is_expanded(message_list->tree, path)) {
@@ -833,7 +813,7 @@ ml_tree_value_at (ETreeModel *etm, ETreePath path, int col, void *model_data)
else
return (void *)4;
}
-
+
if (msg_info->flags & CAMEL_MESSAGE_ANSWERED)
return GINT_TO_POINTER (2);
else if (msg_info->flags & CAMEL_MESSAGE_SEEN)
@@ -854,46 +834,6 @@ ml_tree_value_at (ETreeModel *etm, ETreePath path, int col, void *model_data)
return GINT_TO_POINTER (score);
}
- case COL_FOLLOWUP_FLAG_STATUS: {
- const char *tag;
-
- tag = camel_tag_get ((CamelTag **) &msg_info->user_tags, "follow-up");
- if (tag)
- return GINT_TO_POINTER (TRUE);
- else
- return GINT_TO_POINTER (FALSE);
- }
- case COL_FOLLOWUP_DUE_BY: {
- struct _FollowUpTag *tag;
- const char *tag_value;
- time_t due_by;
-
- tag_value = camel_tag_get ((CamelTag **) &msg_info->user_tags, "follow-up");
- if (tag_value) {
- tag = message_tag_followup_decode (tag_value);
- due_by = tag->target_date;
- g_free (tag);
- return GINT_TO_POINTER (due_by);
- } else {
- return GINT_TO_POINTER (0);
- }
- }
- case COL_FOLLOWUP_FLAG: {
- struct _FollowUpTag *tag;
- const char *tag_value;
- int flag_type;
-
- tag_value = camel_tag_get ((CamelTag **) &msg_info->user_tags, "follow-up");
- if (tag_value) {
- tag = message_tag_followup_decode (tag_value);
- flag_type = tag ? tag->type : FOLLOWUP_FLAG_NONE;
- g_free (tag);
-
- return (void *) message_tag_followup_i18n_name (flag_type);
- } else {
- return NULL;
- }
- }
case COL_ATTACHMENT:
return GINT_TO_POINTER ((msg_info->flags & CAMEL_MESSAGE_ATTACHMENTS) != 0);
case COL_FROM:
@@ -912,40 +852,29 @@ ml_tree_value_at (ETreeModel *etm, ETreePath path, int col, void *model_data)
return GINT_TO_POINTER ((msg_info->flags & CAMEL_MESSAGE_DELETED) != 0);
case COL_UNREAD: {
ETreePath child;
-
+
child = e_tree_model_node_get_first_child(etm, path);
if (child && !e_tree_node_is_expanded(message_list->tree, path)
&& (msg_info->flags & CAMEL_MESSAGE_SEEN)) {
return GINT_TO_POINTER (subtree_unread (message_list, child));
}
-
+
return GINT_TO_POINTER (!(msg_info->flags & CAMEL_MESSAGE_SEEN));
}
case COL_COLOUR: {
- const char *colour, *followup;
-
+ const char *colour;
+
colour = camel_tag_get ((CamelTag **) &msg_info->user_tags, "colour");
- followup = camel_tag_get ((CamelTag **) &msg_info->user_tags, "follow-up");
- if (colour == NULL && msg_info->flags & CAMEL_MESSAGE_FLAGGED) {
+ if (colour == NULL && msg_info->flags & CAMEL_MESSAGE_FLAGGED)
/* FIXME: extract from the xpm somehow. */
colour = "#A7453E";
- } else if (followup != NULL) {
- struct _FollowUpTag *tag;
- time_t now = time (NULL);
-
- tag = message_tag_followup_decode (followup);
- if (tag && now >= tag->target_date) {
- /* FIXME: extract from the xpm somehow. */
- colour = "#A7453E";
- }
- g_free (tag);
- }
return (void *)colour;
}
- default:
- g_assert_not_reached ();
- return NULL;
}
+
+ g_assert_not_reached ();
+
+ return NULL;
}
static void
@@ -986,10 +915,10 @@ filter_date (time_t date)
struct tm then, now, yesterday;
char buf[26];
gboolean done = FALSE;
-
+
if (date == 0)
return g_strdup (_("?"));
-
+
localtime_r (&date, &then);
localtime_r (&nowdate, &now);
if (then.tm_mday == now.tm_mday &&
@@ -1047,37 +976,33 @@ message_list_create_extras (void)
GdkPixbuf *images [7];
ETableExtras *extras;
ECell *cell;
+
+ extras = e_table_extras_new();
+ e_table_extras_add_pixbuf(extras, "status", states_pixmaps [0].pixbuf);
+ e_table_extras_add_pixbuf(extras, "score", states_pixmaps [13].pixbuf);
+ e_table_extras_add_pixbuf(extras, "attachment", states_pixmaps [6].pixbuf);
+ e_table_extras_add_pixbuf(extras, "flagged", states_pixmaps [7].pixbuf);
- extras = e_table_extras_new ();
- e_table_extras_add_pixbuf (extras, "status", states_pixmaps [0].pixbuf);
- e_table_extras_add_pixbuf (extras, "score", states_pixmaps [13].pixbuf);
- e_table_extras_add_pixbuf (extras, "attachment", states_pixmaps [6].pixbuf);
- e_table_extras_add_pixbuf (extras, "flagged", states_pixmaps [7].pixbuf);
- e_table_extras_add_pixbuf (extras, "followup", states_pixmaps [15].pixbuf);
-
- e_table_extras_add_compare (extras, "address_compare", address_compare);
- e_table_extras_add_compare (extras, "subject_compare", subject_compare);
+ e_table_extras_add_compare(extras, "address_compare", address_compare);
+ e_table_extras_add_compare(extras, "subject_compare", subject_compare);
for (i = 0; i < 5; i++)
images [i] = states_pixmaps [i].pixbuf;
-
- e_table_extras_add_cell (extras, "render_message_status", e_cell_toggle_new (0, 5, images));
-
+
+ e_table_extras_add_cell(extras, "render_message_status", e_cell_toggle_new (0, 5, images));
+
for (i = 0; i < 2; i++)
images [i] = states_pixmaps [i + 5].pixbuf;
- e_table_extras_add_cell (extras, "render_attachment", e_cell_toggle_new (0, 2, images));
+ e_table_extras_add_cell(extras, "render_attachment", e_cell_toggle_new (0, 2, images));
images [1] = states_pixmaps [7].pixbuf;
- e_table_extras_add_cell (extras, "render_flagged", e_cell_toggle_new (0, 2, images));
-
- images[1] = states_pixmaps [15].pixbuf;
- e_table_extras_add_cell (extras, "render_flag_status", e_cell_toggle_new (0, 2, images));
-
+ e_table_extras_add_cell(extras, "render_flagged", e_cell_toggle_new (0, 2, images));
+
for (i = 0; i < 7; i++)
images[i] = states_pixmaps [i + 7].pixbuf;
- e_table_extras_add_cell (extras, "render_score", e_cell_toggle_new (0, 7, images));
+ e_table_extras_add_cell(extras, "render_score", e_cell_toggle_new (0, 7, images));
/* date cell */
cell = e_cell_date_new (NULL, GTK_JUSTIFY_LEFT);
@@ -1085,7 +1010,7 @@ message_list_create_extras (void)
"bold_column", COL_UNREAD,
"color_column", COL_COLOUR,
NULL);
- e_table_extras_add_cell (extras, "render_date", cell);
+ e_table_extras_add_cell(extras, "render_date", cell);
/* text cell */
cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT);
@@ -1093,20 +1018,20 @@ message_list_create_extras (void)
"bold_column", COL_UNREAD,
"color_column", COL_COLOUR,
NULL);
- e_table_extras_add_cell (extras, "render_text", cell);
-
- e_table_extras_add_cell (extras, "render_tree",
- e_cell_tree_new (NULL, NULL, /* let the tree renderer default the pixmaps */
- TRUE, cell));
+ e_table_extras_add_cell(extras, "render_text", cell);
+ e_table_extras_add_cell(extras, "render_tree",
+ e_cell_tree_new (NULL, NULL, /* let the tree renderer default the pixmaps */
+ TRUE, cell));
+
/* size cell */
cell = e_cell_size_new (NULL, GTK_JUSTIFY_RIGHT);
gtk_object_set (GTK_OBJECT (cell),
"bold_column", COL_UNREAD,
"color_column", COL_COLOUR,
NULL);
- e_table_extras_add_cell (extras, "render_size", cell);
-
+ e_table_extras_add_cell(extras, "render_size", cell);
+
return extras;
}
@@ -1118,14 +1043,26 @@ save_tree_state(MessageList *ml)
if (ml->folder == NULL || ml->tree == NULL)
return;
+ filename = mail_config_folder_to_cachename(ml->folder, "et-header-");
+ e_tree_save_state(ml->tree, filename);
+ g_free(filename);
+
filename = mail_config_folder_to_cachename(ml->folder, "et-expanded-");
e_tree_save_expanded_state(ml->tree, filename);
g_free(filename);
}
+static void
+sort_info_changed (GtkWidget *widget, MessageList *ml)
+{
+ save_tree_state(ml);
+}
+
static void
message_list_setup_etree (MessageList *message_list, gboolean outgoing)
{
+ ETableState *etstate;
+
/* build the spec based on the folder, and possibly from a saved file */
/* otherwise, leave default */
if (message_list->folder) {
@@ -1140,6 +1077,21 @@ message_list_setup_etree (MessageList *message_list, gboolean outgoing)
name = camel_service_get_name (CAMEL_SERVICE (message_list->folder->parent_store), TRUE);
d(printf ("folder name is '%s'\n", name));
+ path = mail_config_folder_to_cachename (message_list->folder, "et-header-");
+ if (path && stat (path, &st) == 0 && st.st_size > 0 && S_ISREG (st.st_mode)) {
+ /* build based on saved file */
+ e_tree_load_state (message_list->tree, path);
+ } else if (outgoing) {
+ /* Swap From/To for Drafts, Sent, Outbox */
+ char *state = "<ETableState>"
+ "<column source=\"0\"/> <column source=\"1\"/> "
+ "<column source=\"8\"/> <column source=\"5\"/> "
+ "<column source=\"6\"/> <grouping> </grouping> </ETableState>";
+
+ e_tree_set_state (message_list->tree, state);
+ }
+ g_free (path);
+
path = mail_config_folder_to_cachename (message_list->folder, "et-expanded-");
if (path && stat (path, &st) == 0 && st.st_size > 0 && S_ISREG (st.st_mode)) {
/* build based on saved file */
@@ -1148,6 +1100,18 @@ message_list_setup_etree (MessageList *message_list, gboolean outgoing)
g_free (path);
g_free (name);
+
+ etstate = e_tree_get_state_object (message_list->tree);
+ gtk_signal_connect (GTK_OBJECT (etstate->sort_info),
+ "sort_info_changed",
+ GTK_SIGNAL_FUNC (sort_info_changed),
+ message_list);
+ gtk_signal_connect (GTK_OBJECT (etstate->sort_info),
+ "group_info_changed",
+ GTK_SIGNAL_FUNC (sort_info_changed),
+ message_list);
+
+ gtk_object_unref (GTK_OBJECT (etstate));
}
}
@@ -1256,7 +1220,6 @@ message_list_class_init (GtkObjectClass *object_class)
static void
message_list_construct (MessageList *message_list)
{
- gboolean construct_failed;
message_list->model =
e_tree_memory_callbacks_new (ml_tree_icon_at,
@@ -1288,16 +1251,14 @@ message_list_construct (MessageList *message_list)
* The etree
*/
message_list->extras = message_list_create_extras ();
- construct_failed = (e_tree_scrolled_construct_from_spec_file (E_TREE_SCROLLED (message_list),
- message_list->model,
- message_list->extras,
- EVOLUTION_ETSPECDIR "/message-list.etspec",
- NULL)
- == NULL);
-
+ e_tree_scrolled_construct_from_spec_file (E_TREE_SCROLLED (message_list),
+ message_list->model,
+ message_list->extras,
+ EVOLUTION_ETSPECDIR "/message-list.etspec",
+ NULL);
+
message_list->tree = e_tree_scrolled_get_tree(E_TREE_SCROLLED (message_list));
- if (!construct_failed)
- e_tree_root_node_set_visible (message_list->tree, FALSE);
+ e_tree_root_node_set_visible (message_list->tree, FALSE);
gtk_signal_connect (GTK_OBJECT (message_list->tree), "cursor_activated",
GTK_SIGNAL_FUNC (on_cursor_activated_cmd),
@@ -1491,6 +1452,7 @@ build_tree (MessageList *ml, CamelFolderThread *thread, CamelFolderChangeInfo *c
diff -= start.tv_sec * 1000 + start.tv_usec/1000;
printf("Building tree took %ld.%03ld seconds\n", diff / 1000, diff % 1000);
#endif
+
}
/* this is about 20% faster than build_subtree_diff,
@@ -2076,9 +2038,9 @@ on_cursor_activated_cmd (ETree *tree, int row, ETreePath path, gpointer user_dat
static gint
on_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event, MessageList *list)
{
- CamelMessageInfo *info;
int flag;
-
+ CamelMessageInfo *info;
+
if (col == COL_MESSAGE_STATUS)
flag = CAMEL_MESSAGE_SEEN;
else if (col == COL_FLAGGED)
@@ -2092,12 +2054,12 @@ on_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event, Mess
}
/* If a message was marked as deleted and the user flags it as
- important, marks it as needing a reply, marks it as unread,
- then undelete the message. */
- if (info->flags & CAMEL_MESSAGE_DELETED) {
+ important or marks it as unread, undelete it. */
+ if (info->flags & CAMEL_MESSAGE_DELETED) {
+
if (col == COL_FLAGGED && !(info->flags & CAMEL_MESSAGE_FLAGGED))
flag |= CAMEL_MESSAGE_DELETED;
-
+
if (col == COL_MESSAGE_STATUS && (info->flags & CAMEL_MESSAGE_SEEN))
flag |= CAMEL_MESSAGE_DELETED;
}
@@ -2601,5 +2563,5 @@ mail_regen_list (MessageList *ml, const char *search, const char *hideexpr, Came
m->folder = ml->folder;
camel_object_ref (CAMEL_OBJECT (m->folder));
- e_thread_put (mail_thread_queued, (EMsg *)m);
+ e_thread_put (mail_thread_new, (EMsg *)m);
}
diff --git a/my-evolution/ChangeLog b/my-evolution/ChangeLog
index 916b65d6f1..08910f08d0 100644
--- a/my-evolution/ChangeLog
+++ b/my-evolution/ChangeLog
@@ -1,241 +1,9 @@
-2002-04-08 Dan Winship <danw@ximian.com>
+2002-04-16 Iain Holmes <iain@ximian.com>
- * component-factory.c (create_view): Add view_info arg but don't
- do anything with it.
-
-2002-04-06 JP Rosevear <jpr@ximian.com>
-
- * GNOME_Evolution_Summary.oaf.in.in: add config_item:priority
-
-2002-04-05 JP Rosevear <jpr@ximian.com>
-
- * Makefile.am: dist the relevant xpms
-
-2002-04-04 JP Rosevear <jpr@ximian.com>
-
- * Makefile.am: fix substitution typo
-
-2002-03-30 Ettore Perazzoli <ettore@ximian.com>
-
- * Makefile.am: Added support for the ENABLE_SHLIB_COMPONENTS
- conditional.
-
- * GNOME_Evolution_Summary.oaf.in.in: New.
-
- * e-summary-mail.c (update_folder_cb): Protect against
- summary->mail being NULL.
-
- * component-factory.c: Add a shlib factory.
- (create_component): Get a @factory and @data.
- (component_factory_init): Actually make it use a
- BonoboGenericFactory again.
-
-2002-03-29 Ettore Perazzoli <ettore@ximian.com>
-
- * GNOME_Evolution_Summary.oaf.in: Add priority.
-
-2002-03-19 Dan Winship <danw@ximian.com>
-
- * Makefile.am (evolution_executive_summary_LDADD):
- s/libversit.la/libversit.a/
-
-2002-03-19 Iain Holmes <iain@ximian.com>
-
- * component-factory.c: Create a global_preferences structure.
- (create_view): Pass in the global_preferences to the view.
- (create_component): Initialise the preferences.
-
- * e-summary-factory.[ch] (e_summary_factory_new_control): Take a prefs
- structure and pass it to the view creation.
-
- * e-summary-mail: Remove some debug spew.
-
- * e-summary-preferences.[ch]: Create a global_preferences structure.
- (e_summary_preferences_init): just return the prefs instead of adding
- a pointer to it.
- (config_control_destroy_cb): Remove the old_prefs stuff.
- (factory_fn): Ditto.
-
- * e-summary.[ch] (e_summary_init): Don't initialise the preferences
- here.
- (e_summary_new): Take a preferences structure and keep a pointer to
- it.
-
-2002-03-15 Iain Holmes <iain@ximian.com>
-
- * Makefile.am: Add the e-summary-shown.[ch] files.
-
- * e-summary-mail.c: Add entries for the Storages in the private
- struct.
- (new_folder_cb): Only allow mail folders that are local or vfolders.
- Store the StorageInfo that the folder belongs to in the folder struct
- Add the folder to the list of folders in the storage.
- (update_folder_cb): Update the signature.
- (mail_change_notify): Simplify the check to see if we are displaying
- the folder.
- (e_summary_mail_register_storage): Take a name argument.
- Create a StorageInfo structure, connect the signals and add the
- listener.
- (e_summary_mail_register_local_storage): Get the local storage from
- the shell and register it with e_summary_mail_register_storage.
- (storage_notify): Receive notifications when a new storage is created
- or destroyed or changed. Stuff only happens when a storage is
- created, currently.
- (e_summary_mail_register_storages): Don't register local storage
- here. Get the StorageRegistry from the corba_shell, create a new
- BonoboListener and add it to the registry.
- (e_summary_mail_init): Free a CORBA_Environment.
- (e_summary_mail_reconfigure): Add a check for the uri being a
- vfolder.
- (str_compare): Compare ESummaryMailFolders instead of MailRowDatas.
- (sort_storages): Compare 2 storage names.
- (get_parent_path): Special case for the vfolders.
- (insert_path_recur): Remove the toplevel creation.
- Create a toplevel node if the uri is a storage toplevel.
- Special case the name finder for vfolders.
- Get the number of children in the parent so that we can add the new
- child after the rest.
- (add_storage_to_table): For each folder in a storage, add it to the
- table.
- (make_toplevel): Generate the toplevel name for each storage.
- (e_summary_mail_fill_list): For each storage, add the folders.
-
- * e-summary-preferences.c (fill_rdf_etable): Put the entries into an
- ESummaryShown instead of an ESummaryTable.
- (make_property_dialog): Hook up to the Showns.
- (add_shown_to_list): Add the locations to the list.
- (property_box_clicked_cb): Create a new list for the RDFs and
- weathers.
- (e_summary_preferences_make_rdf_table): Make an ESummaryShown.
- (e_summary_preferences_make_weather_table): Make an ESummaryShown.
-
- * e-summary-table.c: Use ECellTri.
- (value_at): Get the right value for the TriCell.
- (set_value_at): Set the right value for the TriCell.
- (e_summary_table_init): Use the ECellTri.
- (e_summary_table_get_num_children): Get the number of children a
- path has.
-
- * e-summary-weather.c (e_summary_weather_fill_etable): Use an
- ESummaryShown instead of ESummaryTable.
-
- * e-summary.[ch]: Store the GNOME_Evolution_Shell in the nonprivate
- structure.
-
- * e-summary-shown.[ch]: Widget to do Add-> <-Remove with two tables.
-
-2002-02-22 Iain Holmes <iain@ximian.com>
-
- * e-summary-factory.c: Use the new configure icon.
-
-2002-02-13 Iain Holmes <iain@ximian.com>
-
- * Makefile.am: Add the e-cell-tri.[ch] files
-
- * e-summary-table.c
-
-2002-03-14 Ettore Perazzoli <ettore@ximian.com>
-
- * e-summary-factory.c (e_summary_factory_new_control): Call
- `e_summary_preferences_register_config_control_factory()'.
-
- * e-summary-preferences.c: Remove member `box' from struct
- PropertyData. Added member `config_control'.
- (e_summary_configure): Removed.
- (property_box_destroy_cb): Removed.
- (property_box_clicked_cb): Removed.
- (property_box_apply_cb): New.
- (config_control_destroy_cb): New.
- (factory_fn): New, factory function for the
- EvolutionConfigControl.
- (e_summary_preferences_register_config_control_factory): New.
- (mail_show_full_path_toggled_cb): Invoke ::changed on
- pd->config_control.
- (add_dialog_clicked_cb): Likewise.
- (rdf_refresh_value_changed_cb): Likewise.
- (rdf_limit_value_changed_cb): Likewise.
- (mail_etable_item_changed_cb): Likewise.
- (rdf_etable_item_changed_cb): Likewise.
- (weather_etable_item_changed_cb): Likewise.
- (weather_refresh_value_changed_cb): Likewise.
- (weather_metric_toggled_cb): Likewise.
- (weather_imperial_toggled_cb): Likewise.
- (calendar_one_toggled_cb): Likewise.
- (calendar_five_toggled_cb): Likewise.
- (calendar_week_toggled_cb): Likewise.
- (calendar_month_toggled_cb): Likewise.
- (calendar_all_toggled_cb): Likewise.
- (calendar_today_toggled_cb): Likewise.
- (config_control_destroy_cb): Don't set ->prefs_window to NULL.
-
- * my-evolution.glade: Renamed "notebook2" to "notebook". Also
- change its parent into a GtkWindow as libglade seems to have some
- kind of problem with the GnomePropertyBox [glade_xml_get_widget()
- for "notebook" always returned NULL].
-
- * e-summary.h: Remove member `prefs_window' from `ESummary'.
-
-2002-02-14 Radek Doulik <rodo@ximian.com>
-
- * e-summary-tasks.c (sort_uids): fix case when priority is
- undefined and pri_a or pri_b is returned as NULL, also fixes
- memory leak
-
-2002-02-08 Damon Chaplin <damon@ximian.com>
-
- * e-summary-calendar.c (e_cal_comp_util_compare_event_timezones):
- updated to new version from calendar/gui/comp-util.c
-
-2002-02-04 Iain Holmes <iain@ximian.com>
-
- * Makefile.am: Add the e-summary-table.[ch] files.
-
- * e-summary-mail.c: Move the headers.
- (e_summary_mail_get_html): Regenerate the HTML.
- (update_folder_cb): Make the file:// part static as it's the same
- every time.
- (mail_change_notify): Don't recalculate the HTML here.
- (e_summary_mail_reconfigure): Don't add file:// if it's already there.
- (get_parent_path): Given a path, return it's parent.
- (is_folder_shown): Check all the shown folders to see if the given one
- is shown.
- (insert_path_recur): Recursively add a path to the tree.
- (free_path_hash): Free the key of the hash table.
- (e_summary_mail_fill_list): Add all the folders to the tree.
-
- * e-summary-preferences.c: Move the headers
- (rdf_is_shown): Check if an RDF is shown.
- (fill_rdf_etable): Fill the etable with all the RDFs
- (fill_weather_etable): Fill the weather etable.
- (fill_mail_etable): Ditto (with mail)
- (make_property_dialog): Use the etables.
- (free_property_dialog): Free the new lists.
- (maybe_add_to_shown): Check if the item is clicked and if so add it to
- the list.
- (property_box_clicked_cb): Set all the new properties
- (e_summary_preferences_make_*_table): Make the etables
-
- * e-summary-rdf.c (e_summary_rdf_update): Don't cancel the message,
- just keep using the previous one.
-
- * e-summary-weather.c (message_finished): Better error message.
- (e_summary_weather_update): Just continue if a message is already
- going.
- (is_weather_shown): Find out if a station is shown.
- (e_summary_weather_fill_etable): Fill the etable.
-
- * main.c (main): Init the cursors.
-
- * my-evolution.glade: Add the custom widgets.
+ * e-summary-preferences.c: Change the kde url.
2002-02-02 Ettore Perazzoli <ettore@ximian.com>
- * e-summary-offline-handler.c (create_connection_list): Allocate
- the ConnectionList list with the right number of entries instead
- of zero.
-
-2002-02-01 Ettore Perazzoli <ettore@ximian.com>
-
[Fix a crash that can happen if you have opened multiple views of
the summary and try to go off-line. This is not the correct fix,
as the code should really be changed to only use one set of
@@ -268,17 +36,6 @@
(impl_goOnline): Likewise. Pass CORBA_OBJECT_NIL, not NULL, for
the progress CORBA_Object pointer.
-2002-01-24 Ettore Perazzoli <ettore@ximian.com>
-
- * Makefile.am: Use EVOLUTION_EXECUTIVE_SUMMARY_CFLAGS and
- EVOLUTION_EXECUTIVE_SUMMARY_LIBS.
-
-2002-01-24 Iain Holmes <iain@ximian.com>
-
- * Locations: Applied the Ukraine patch from Leonid Kanter
-
- * Locations.h: Re-generated to get the UK stations added.
-
2002-01-22 Iain Holmes <iain@ximian.com>
* e-summary-mail (e_summary_mail_reconfigure): Do the list backwards.
@@ -286,59 +43,12 @@
* e-summary-preferences.c (fill_mail_shown_clist): Prepend items.
(mail_add_clicked_cb): Prepend items.
-2002-01-04 Iain Holmes <iain@ximian.com>
-
- * e-summary-weather.c (message_finished): Made the Weather message
- more verbose, and say which station data could not be retrieved for.
-
-2002-01-03 Iain Holmes <iain@ximian.com>
-
- * Makefile.am: Use SOUP_CFLAGS and SOUP_LIBS
-
- * e-summary-rdf.c: Include soup.h
- (close_callback): Remove.
- (message_finished): Generate the cache and other stuff and redraw.
- (read_callback): Remove.
- (open_callback): Remove.
- (e_summary_rdf_update): Replace gnome-vfs with Soup stuff.
- (e_summary_rdf_count): Replace gnome-vfs with soup.
- (rdf_free): ditto
- (e_summary_rdf_set_online): Ditto
-
- * e-summary-weather.c: Include soup.h
- (close_callback): Remove.
- (message_finished): Parse all the downloaded html.
- (read_callback): Remove.
- (open_callback): Remove.
- (e_summary_weather_update): Use soup instead of gnome-vfs
- (weather_free): Ditto.
- (e_summary_weather_count): Ditto.
- (e_summary_weather_add): ditto;
- (e_summary_weather_set_online): Ditto.
+2002-02-03 Iain Holmes <iain@ximian.com>
- * e-summary.c (close_callback): Remove.
- (read_callback): Remove.
- (open_callback): Remove.
- (e_read_file_with_length): Read a file.
- (e_summary_url_requested): Create the images cache. Load the image
- with e_read_file_with_length instead of gnome-vfs.
-
- * main.c (main): Remove gnome_vfs_init.
-
- * weather.h: Replace gnome-vfs stuff.
-
-2002-01-03 Iain Holmes <iain@ximian.com>
-
- * e-summary-offline-handler.c (impl_prepareForOffline): Create an
+ * e-summary-offline-handler.c (impl_prepareForOffline): Create an
empty list if the summary == NULL. Fixes bug 18025
-2001-12-20 Ettore Perazzoli <ettore@ximian.com>
-
- [Fixes #17377, Evolution doesn't work on multi-depth displays.]
-
- * main.c (main): Push GdkRGB visual and colormap.
-
-2001-12-19 JP Rosevear <jpr@ximian.com>
+2001-12-18 JP Rosevear <jpr@ximian.com>
* e-summary-tasks.c (e_summary_tasks_init): use
cal_client_open_default_tasks
@@ -346,6 +56,12 @@
* e-summary-calendar.c (e_summary_calendar_init): use
cal_client_open_default_calendar
+2001-12-17 Ettore Perazzoli <ettore@ximian.com>
+
+ [Fixes #17377, Evolution doesn't work on multi-depth displays.]
+
+ * main.c (main): Push GdkRGB visual and colormap.
+
2001-12-14 Iain Holmes <iain@ximian.com>
* Location-translation-script: shell script to convert Locations to
diff --git a/my-evolution/Locations b/my-evolution/Locations
index 1d242283df..40ac71b2d8 100644
--- a/my-evolution/Locations
+++ b/my-evolution/Locations
@@ -1,5 +1,5 @@
[Main]
-regions=US CA MX EU AF OZ ME AS M_ AT
+regions=US CA EU AF OZ ME AS M_ AT
[ME]
name=Middle East
@@ -1581,74 +1581,9 @@ loc3=Swift\\ Current CYYN ------ ---
name=Yukon
loc0=Shingle\\ Point CYUA ------ ---
-[MX]
-name=Mexico
-states=MX
-
-[MX_MX]
-name=Mexico
-loc0=Acapulco MMAA ------ ---
-loc1=Aeropuerto\\ del\\ Norte MMAN ------ ---
-loc2=Aguascaliantes MMAS ------ ---
-loc3=Bahias\\ de\\ Huatulco MMBT ------ ---
-loc4=Campeche MMCP ------ ---
-loc5=Cancun MMUN ------ ---
-loc6=Chetumal MMCM ------ ---
-loc7=Chihuahua MMCU ------ ---
-loc8=Ciudad\\ del\\ Carmen MMCE ------ ---
-loc9=Ciudad\\ Juarez MMCS ------ ---
-loc10=Ciudad\\ Obregon MMCN ------ ---
-loc11=Ciudad\\ Victoria MMCV ------ ---
-loc12=Colima MMIA ------ ---
-loc13=Cozumel MMCZ ------ ---
-loc14=Cuernavaca MMCB ------ ---
-loc15=Culiacan MMCL ------ ---
-loc16=Del\\ Bajio MMLO ------ ---
-loc17=Durango MMDO ------ ---
-loc18=Guadalajara MMGL ------ ---
-loc19=Guaymas MMGM ------ ---
-loc20=Hermosillo MMHO ------ ---
-loc21=Ixtapa MMZH ------ ---
-loc22=La\\ Paz MMLP ------ ---
-loc23=Los\\ Mochis MMLM ------ ---
-loc24=Manzanillo MMZO ------ ---
-loc25=Matamoros MMMA ------ ---
-loc26=Mazatlan MMMZ ------ ---
-loc27=Merida MMMD ------ ---
-loc28=Mexicali MMML ------ ---
-loc29=Mexico MMMX ------ ---
-loc30=Minatitlan MMMT ------ ---
-loc31=Monclova MMMV ------ ---
-loc32=Morelia MMMM ------ ---
-loc33=Monterrey MMMY ------ ---
-loc34=Nuevo\\ Laredo MMNL ------ ---
-loc35=Oaxaca MMOX ------ ---
-loc36=Piedras\\ Negras MMPG ------ ---
-loc37=Poza\\ Rica MMPA ------ ---
-loc38=Puebla MMPB ------ ---
-loc39=Puerto\\ Vallarta MMPR ------ ---
-loc40=Puerto\\ Escondido MMPS ------ ---
-loc41=Queretaro MMQT ------ ---
-loc42=Reynosa MMRX ------ ---
-loc43=Saltillo MMIO ------ ---
-loc44=San\\ Jose\\ del\\ Cabo MMSD ------ ---
-loc45=San\\ Luis\\ Potosi MMSP ------ ---
-loc46=Tampico MMTM ------ ---
-loc47=Tapachula MMTP ------ ---
-loc48=Tepic MMEP ------ ---
-loc49=Tijuana MMTJ ------ ---
-loc50=Toluca MMTO ------ ---
-loc51=Torreon MMTC ------ ---
-loc52=Tulancingo MMTL ------ ---
-loc53=Tuxtla\\ Gutierrez MMTG ------ ---
-loc54=Uruapan MMPN ------ ---
-loc55=Veracruz MMVR ------ ---
-loc56=Villahermosa MMVA ------ ---
-loc57=Zacatecas MMZC ------ ---
-
[EU]
name=Europe
-states=AB OS BE BA BG CZ HR CY DK EE FI FR MK DE GI GR HU IE IS IT LV LT LU MT MD NL NO PL PT RO RU SK SI SP SE CH TR UA UK YU
+states=AB OS BE BA BG CZ HR CY DK EE FI FR MK DE GI GR HU IE IS IT LV LT LU MT MD NL NO PL PT RO RU SK SI SP SE CH TR UK YU
[EU_AB]
name=Albania
@@ -1915,21 +1850,6 @@ loc50=Yakutsk UEEE ------ ---
loc51=Yekaterinburg USSS ------ ---
loc52=Yuzhno-Sakhalinsk UHSS ------ ---
-[EU_UA]
-name=Ukraine
-loc0=Dnipropetrovsk UKDD ------ ---
-loc1=Donetsk UKCC ------ ---
-loc2=Ivano-Frankivsk UKLI ------ ---
-loc3=Kharkiv UKHH ------ ---
-loc4=Kyyiv/Boryspil UKBB ------ ---
-loc5=Kyyiv/Zhulyany UKKK ------ ---
-loc6=Kryviy\\ Rig/Lozovatka UKDR ------ ---
-loc7=Lviv UKLL ------ ---
-loc8=Odesa UKOO ------ ---
-loc9=Rivne UKLR ------ ---
-loc10=Sympheropol UKFF ------ ---
-loc11=Uzhgorod UKLU ------ ---
-
[EU_SK]
name=Slovakia
loc0=Bratislava LZIB ------ ---
@@ -2681,7 +2601,7 @@ loc23=Wuchia\\ Observatory RCMQ ------ ---
[M_]
name=Central and South America
-states=BS BZ KY CU CR DO SV GT HT HN JM NI PA AR BR BO CL CO EC PY PE SR UY VE
+states=BS BZ KY CU CR DO SV GT HT HN JM MX NI PA AR BR BO CL CO EC PY PE SR UY VE
[M__BS]
name=Bahamas
@@ -2909,6 +2829,67 @@ loc16=San\\ Fernando\\ De\\ Apure SVSR ------ ---
loc17=Valera* SVVL ------ ---
loc18=Caracas\\ La\\ Carlota SVFM ------ ---
+[M__MX]
+name=Mexico
+loc0=Acapulco MMAA ------ ---
+loc1=Aeropuerto\\ del\\ Norte MMAN ------ ---
+loc2=Aguascaliantes MMAS ------ ---
+loc3=Bahias\\ de\\ Huatulco MMBT ------ ---
+loc4=Campeche MMCP ------ ---
+loc5=Cancun MMUN ------ ---
+loc6=Chetumal MMCM ------ ---
+loc7=Chihuahua MMCU ------ ---
+loc8=Ciudad\\ del\\ Carmen MMCE ------ ---
+loc9=Ciudad\\ Juarez MMCS ------ ---
+loc10=Ciudad\\ Obregon MMCN ------ ---
+loc11=Ciudad\\ Victoria MMCV ------ ---
+loc12=Colima MMIA ------ ---
+loc13=Cozumel MMCZ ------ ---
+loc14=Cuernavaca MMCB ------ ---
+loc15=Culiacan MMCL ------ ---
+loc16=Del\\ Bajio MMLO ------ ---
+loc17=Durango MMDO ------ ---
+loc18=Guadalajara MMGL ------ ---
+loc19=Guaymas MMGM ------ ---
+loc20=Hermosillo MMHO ------ ---
+loc21=Ixtapa MMZH ------ ---
+loc22=La\\ Paz MMLP ------ ---
+loc23=Los\\ Mochis MMLM ------ ---
+loc24=Manzanillo MMZO ------ ---
+loc25=Matamoros MMMA ------ ---
+loc26=Mazatlan MMMZ ------ ---
+loc27=Merida MMMD ------ ---
+loc28=Mexicali MMML ------ ---
+loc29=Mexico MMMX ------ ---
+loc30=Minatitlan MMMT ------ ---
+loc31=Monclova MMMV ------ ---
+loc32=Morelia MMMM ------ ---
+loc33=Monterrey MMMY ------ ---
+loc34=Nuevo\\ Laredo MMNL ------ ---
+loc35=Oaxaca MMOX ------ ---
+loc36=Piedras\\ Negras MMPG ------ ---
+loc37=Poza\\ Rica MMPA ------ ---
+loc38=Puebla MMPB ------ ---
+loc39=Puerto\\ Vallarta MMPR ------ ---
+loc40=Puerto\\ Escondido MMPS ------ ---
+loc41=Queretaro MMQT ------ ---
+loc42=Reynosa MMRX ------ ---
+loc43=Saltillo MMIO ------ ---
+loc44=San\\ Jose\\ del\\ Cabo MMSD ------ ---
+loc45=San\\ Luis\\ Potosi MMSP ------ ---
+loc46=Tampico MMTM ------ ---
+loc47=Tapachula MMTP ------ ---
+loc48=Tepic MMEP ------ ---
+loc49=Tijuana MMTJ ------ ---
+loc50=Toluca MMTO ------ ---
+loc51=Torreon MMTC ------ ---
+loc52=Tulancingo MMTL ------ ---
+loc53=Tuxtla\\ Gutierrez MMTG ------ ---
+loc54=Uruapan MMPN ------ ---
+loc55=Veracruz MMVR ------ ---
+loc56=Villahermosa MMVA ------ ---
+loc57=Zacatecas MMZC ------ ---
+
[M__AR]
name=Argentina
loc0=Aeroparque SABE ------ ---
diff --git a/my-evolution/Locations.h b/my-evolution/Locations.h
index 5f554a78e1..d41489411b 100644
--- a/my-evolution/Locations.h
+++ b/my-evolution/Locations.h
@@ -600,13 +600,11 @@ N_("Dillon")
N_("Dinard")
N_("District of Columbia")
N_("Diyarbakir")
-N_("Dnipropetrovsk")
N_("Dobbiaco")
N_("Dodge City")
N_("Doha")
N_("Dole")
N_("Dominican Republic")
-N_("Donetsk")
N_("Dongsha")
N_("Dongshi")
N_("Don Torcuato")
@@ -1015,7 +1013,6 @@ N_("Istanbul")
N_("Itaituba")
N_("Italy")
N_("Ithaca")
-N_("Ivano-Frankivsk")
N_("Iwakuni MCAS")
N_("Iwojima")
N_("Ixtapa")
@@ -1092,7 +1089,6 @@ N_("Key West")
N_("Key West NAS")
N_("Khabarovsk")
N_("Khamis Mushait")
-N_("Kharkiv")
N_("Kikai Island")
N_("Killeen")
N_("Killeen-Ft Hood")
@@ -1139,13 +1135,10 @@ N_("Krasnodar")
N_("Krasnoyarsk")
N_("Kristiansand/Kjevik")
N_("Kristiansund/Kvernberget")
-N_("Kryviy Rig/Lozovatka")
N_("Kumamoto Airport")
N_("Kunming")
N_("Kushiro Airport")
N_("Kuwait")
-N_("Kyyiv/Boryspil")
-N_("Kyyiv/Zhulyany")
N_("La Ceiba")
N_("Laconia")
N_("La Coruna")
@@ -1268,7 +1261,6 @@ N_("Luton")
N_("Luxembourg")
N_("Luxeuil")
N_("Luxor")
-N_("Lviv")
N_("Lynchburg")
N_("Lyneham")
N_("Lyon-Bron")
@@ -1605,7 +1597,6 @@ N_("Obihiro Airport")
N_("Ocala")
N_("Oceanside")
N_("Odense")
-N_("Odesa")
N_("Oelwen")
N_("Ogden")
N_("Ogden-Hill AFB")
@@ -1893,7 +1884,6 @@ N_("Rivera")
N_("Riverside")
N_("Riverside/March AFB")
N_("Riverton")
-N_("Rivne")
N_("Rivolto")
N_("Riyadh")
N_("Roanoke")
@@ -2183,7 +2173,6 @@ N_("Swift Current")
N_("Switzerland")
N_("Sydney")
N_("Syktyvkar")
-N_("Sympheropol")
N_("Syracuse")
N_("Szczecin")
N_("Szombathely")
@@ -2331,7 +2320,6 @@ N_("Tyumen")
N_("Uberaba")
N_("Ufa")
N_("Ukiah")
-N_("Ukraine")
N_("Ulan-Ude")
N_("Ulsan")
N_("Ulyanovsk")
@@ -2351,7 +2339,6 @@ N_("Utah")
N_("Utica")
N_("Utrecht/Soesterberg")
N_("Utsunomiya Ab")
-N_("Uzhgorod")
N_("Vadso")
N_("Vaerlose")
N_("Vagar")
diff --git a/my-evolution/Makefile.am b/my-evolution/Makefile.am
index 4a1e159723..1213ac79f2 100644
--- a/my-evolution/Makefile.am
+++ b/my-evolution/Makefile.am
@@ -1,3 +1,5 @@
+bin_PROGRAMS = evolution-executive-summary
+
INCLUDES = \
-I$(top_srcdir) \
-I$(top_srcdir)/shell \
@@ -6,11 +8,15 @@ INCLUDES = \
-I$(top_builddir)/calendar/cal-client \
-I$(top_srcdir)/libical/src/libical \
-I$(top_builddir)/libical/src/libical \
+ $(EXTRA_GNOME_CFLAGS) \
+ $(GNOME_VFS_CFLAGS) \
+ $(GTKHTML_CFLAGS) \
+ $(BONOBO_CONF_CFLAGS) \
+ $(BONOBO_GNOME_CFLAGS) \
-DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \
-DEVOLUTION_LOCALEDIR=\""$(localedir)"\" \
-DEVOLUTION_DATADIR=\""$(datadir)"\" \
- -DG_LOG_DOMAIN=\"evolution-executive-summary\" \
- $(EVOLUTION_EXECUTIVE_SUMMARY_CFLAGS)
+ -DG_LOG_DOMAIN=\"evolution-executive-summary\"
IDLS = \
$(top_srcdir)/mail/Mail.idl
@@ -24,107 +30,75 @@ MAIL_GENERATED = \
$(MAIL_GENERATED): $(IDLS)
$(ORBIT_IDL) -I $(srcdir) `$(GNOME_CONFIG) --cflags idl` $(top_srcdir)/mail/Mail.idl
-summary_sources = \
+evolution_executive_summary_SOURCES = \
$(MAIL_GENERATED) \
- component-factory.c \
- component-factory.h \
- e-cell-tri.c \
- e-cell-tri.h \
- e-summary.c \
- e-summary.h \
- e-summary-calendar.c \
- e-summary-calendar.h \
- e-summary-factory.c \
- e-summary-factory.h \
- e-summary-mail.c \
- e-summary-mail.h \
- e-summary-offline-handler.c \
- e-summary-offline-handler.h \
- e-summary-preferences.c \
- e-summary-preferences.h \
- e-summary-rdf.c \
- e-summary-rdf.h \
- e-summary-shown.c \
- e-summary-shown.h \
- e-summary-table.c \
- e-summary-table.h \
- e-summary-tasks.c \
- e-summary-tasks.h \
- e-summary-type.h \
- e-summary-weather.c \
- e-summary-weather.h \
- metar.c \
- metar.h \
- my-evolution-html.h \
+ component-factory.c \
+ component-factory.h \
+ e-summary.c \
+ e-summary.h \
+ e-summary-calendar.c \
+ e-summary-calendar.h \
+ e-summary-factory.c \
+ e-summary-factory.h \
+ e-summary-mail.c \
+ e-summary-mail.h \
+ e-summary-offline-handler.c \
+ e-summary-offline-handler.h \
+ e-summary-preferences.c \
+ e-summary-preferences.h \
+ e-summary-rdf.c \
+ e-summary-rdf.h \
+ e-summary-tasks.c \
+ e-summary-tasks.h \
+ e-summary-type.h \
+ e-summary-weather.c \
+ e-summary-weather.h \
+ main.c \
+ metar.c \
+ metar.h \
+ my-evolution-html.h \
weather.h
-summary_exe_sources = \
- main.c
-
-summary_libs = \
- $(top_builddir)/calendar/gui/alarm-notify/libalarm.a \
- $(top_builddir)/shell/libeshell.la \
- $(top_builddir)/widgets/misc/libemiscwidgets.a \
- $(top_builddir)/e-util/libeutil.la \
+evolution_executive_summary_LDADD = \
+ $(top_builddir)/calendar/gui/alarm-notify/libalarm.a \
+ $(top_builddir)/shell/libeshell.la \
+ $(top_builddir)/widgets/misc/libemiscwidgets.a \
+ $(top_builddir)/e-util/libeutil.la \
$(top_builddir)/calendar/cal-client/libcal-client.la \
$(top_builddir)/calendar/cal-util/libcal-util.la \
- $(top_builddir)/libversit/libversit.a \
+ $(top_builddir)/libversit/libversit.la \
$(top_builddir)/libical/src/libical/libical-evolution.la \
- $(top_builddir)/libwombat/libwombat.la \
- $(EVOLUTION_EXECUTIVE_SUMMARY_LIBS)
-
-if ENABLE_SHLIB_COMPONENTS
-
-lib_LTLIBRARIES = libevolution-executive-summary.la
-
-libevolution_executive_summary_la_SOURCES = \
- $(summary_sources)
-
-libevolution_executive_summary_la_LIBADD = \
- $(summary_libs)
-
-else
-
-bin_PROGRAMS = evolution-executive-summary
-
-evolution_executive_summary_SOURCES = \
- $(summary_sources) \
- $(summary_exe_sources)
-
-evolution_executive_summary_LDADD = \
- $(summary_libs)
-
-endif
+ $(top_builddir)/libwombat/libwombat.la \
+ $(BONOBO_VFS_GNOME_LIBS) \
+ $(BONOBO_CONF_LIBS) \
+ $(EXTRA_GNOME_LIBS) \
+ -lgal \
+ $(GTKHTML_LIBS)
Locationdir = $(datadir)/evolution
Location_DATA = Locations
-oaf_files = GNOME_Evolution_Summary.oaf
-oaf_in_files = $(oaf_files:.oaf=.oaf.in)
-oaf_in_in_files = $(oaf_files:.oaf=.oaf.in.in)
-
oafdir = $(datadir)/oaf
-oaf_DATA = $(oaf_files)
+oaf_in_files = GNOME_Evolution_Summary.oaf.in
+oaf_DATA = $(oaf_in_files:.oaf.in=.oaf)
gladedir = $(datadir)/evolution/glade
glade_DATA = my-evolution.glade
@XML_I18N_MERGE_OAF_RULE@
-EXTRA_DIST = \
- $(summary_sources) \
- $(summary_exe_sources) \
- $(oaf_files) \
- $(oaf_in_files) \
- $(oaf_in_in_files) \
- $(oaf_DATA) \
- $(Location_DATA) \
- $(glade_DATA) \
- Locations.h \
- Location-translation-script \
- check-empty.xpm \
- check-filled.xpm \
- check-none.xpm
+EXTRA_DIST = $(oaf_in_files) $(oaf_DATA) $(Location_DATA) $(glade_DATA) Locations.h Location-translation-script
+
+if ENABLE_PURIFY
+PLINK = $(LIBTOOL) --mode=link $(PURIFY) $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
+
+all-local: evolution-executive-summary.pure
+
+evolution-executive-summary.pure: evolution-executive-summary
+ @rm -f evolution-executive-summary.pure
+ $(PLINK) $(evolution_executive_summary_OBJECTS) $(evolution_executive_summary_LDADD) $(LIBS)
+
+endif
dist-hook:
cd $(distdir); rm -f $(BUILT_SOURCES)
diff --git a/my-evolution/e-summary-calendar.c b/my-evolution/e-summary-calendar.c
index 6ad68427b4..b76ceeb8c0 100644
--- a/my-evolution/e-summary-calendar.c
+++ b/my-evolution/e-summary-calendar.c
@@ -86,97 +86,72 @@ e_cal_comp_util_compare_event_timezones (CalComponent *comp,
CalClient *client,
icaltimezone *zone)
{
- CalClientGetStatus status;
- CalComponentDateTime start_datetime, end_datetime;
- const char *tzid;
- gboolean retval = FALSE;
- icaltimezone *start_zone, *end_zone;
- int offset1, offset2;
+ CalClientGetStatus status;
+ CalComponentDateTime start_datetime, end_datetime;
+ const char *tzid;
+ gboolean retval = FALSE;
+ icaltimezone *start_zone, *end_zone;
+ int offset1, offset2;
- tzid = icaltimezone_get_tzid (zone);
+ tzid = icaltimezone_get_tzid (zone);
- cal_component_get_dtstart (comp, &start_datetime);
- cal_component_get_dtend (comp, &end_datetime);
+ cal_component_get_dtstart (comp, &start_datetime);
+ cal_component_get_dtend (comp, &end_datetime);
/* If either the DTSTART or the DTEND is a DATE value, we return TRUE.
Maybe if one was a DATE-TIME we should check that, but that should
not happen often. */
- if ((start_datetime.value && start_datetime.value->is_date)
- || (end_datetime.value && end_datetime.value->is_date)) {
+ if (start_datetime.value->is_date || end_datetime.value->is_date) {
retval = TRUE;
goto out;
}
- /* If the event uses UTC for DTSTART & DTEND, return TRUE. Outlook
- will send single events as UTC, so we don't want to mark all of
- these. */
- if ((!start_datetime.value || start_datetime.value->is_utc)
- && (!end_datetime.value || end_datetime.value->is_utc)) {
- retval = TRUE;
- goto out;
- }
-
- /* If the event uses floating time for DTSTART & DTEND, return TRUE.
- Imported vCalendar files will use floating times, so we don't want
- to mark all of these. */
- if (!start_datetime.tzid && !end_datetime.tzid) {
- retval = TRUE;
- goto out;
- }
-
- /* FIXME: DURATION may be used instead. */
- if (cal_component_compare_tzid (tzid, start_datetime.tzid)
- && cal_component_compare_tzid (tzid, end_datetime.tzid)) {
- /* If both TZIDs are the same as the given zone's TZID, then
- we know the timezones are the same so we return TRUE. */
- retval = TRUE;
- } else {
- /* If the TZIDs differ, we have to compare the UTC offsets
- of the start and end times, using their own timezones and
- the given timezone. */
- status = cal_client_get_timezone (client,
- start_datetime.tzid,
- &start_zone);
- if (status != CAL_CLIENT_GET_SUCCESS)
- goto out;
-
- if (start_datetime.value) {
- offset1 = icaltimezone_get_utc_offset (start_zone,
- start_datetime.value,
- NULL);
- offset2 = icaltimezone_get_utc_offset (zone,
- start_datetime.value,
- NULL);
- if (offset1 != offset2)
- goto out;
- }
-
- status = cal_client_get_timezone (client,
- end_datetime.tzid,
- &end_zone);
- if (status != CAL_CLIENT_GET_SUCCESS)
- goto out;
-
- if (end_datetime.value) {
- offset1 = icaltimezone_get_utc_offset (end_zone,
- end_datetime.value,
- NULL);
- offset2 = icaltimezone_get_utc_offset (zone,
- end_datetime.value,
- NULL);
- if (offset1 != offset2)
- goto out;
- }
-
- retval = TRUE;
- }
+ /* FIXME: DURATION may be used instead. */
+ if (cal_component_compare_tzid (tzid, start_datetime.tzid)
+ && cal_component_compare_tzid (tzid, end_datetime.tzid)) {
+ /* If both TZIDs are the same as the given zone's TZID, then
+ we know the timezones are the same so we return TRUE. */
+ retval = TRUE;
+ } else {
+ /* If the TZIDs differ, we have to compare the UTC offsets
+ of the start and end times, using their own timezones and
+ the given timezone. */
+ status = cal_client_get_timezone (client,
+ start_datetime.tzid,
+ &start_zone);
+ if (status != CAL_CLIENT_GET_SUCCESS)
+ goto out;
+
+ offset1 = icaltimezone_get_utc_offset (start_zone,
+ start_datetime.value,
+ NULL);
+ offset2 = icaltimezone_get_utc_offset (zone,
+ start_datetime.value,
+ NULL);
+ if (offset1 == offset2) {
+ status = cal_client_get_timezone (client,
+ end_datetime.tzid,
+ &end_zone);
+ if (status != CAL_CLIENT_GET_SUCCESS)
+ goto out;
+
+ offset1 = icaltimezone_get_utc_offset (end_zone,
+ end_datetime.value,
+ NULL);
+ offset2 = icaltimezone_get_utc_offset (zone,
+ end_datetime.value,
+ NULL);
+ if (offset1 == offset2)
+ retval = TRUE;
+ }
+ }
out:
- cal_component_free_datetime (&start_datetime);
- cal_component_free_datetime (&end_datetime);
+ cal_component_free_datetime (&start_datetime);
+ cal_component_free_datetime (&end_datetime);
- return retval;
+ return retval;
}
static int
@@ -371,7 +346,7 @@ generate_html (gpointer data)
g_free (s1);
g_free (s2);
-/* e_summary_draw (summary); */
+ e_summary_draw (summary);
return FALSE;
} else {
GPtrArray *uidarray;
@@ -434,7 +409,7 @@ generate_html (gpointer data)
calendar->html = string->str;
g_string_free (string, FALSE);
-/* e_summary_draw (summary); */
+ e_summary_draw (summary);
return FALSE;
}
diff --git a/my-evolution/e-summary-factory.c b/my-evolution/e-summary-factory.c
index db84213374..9344f70016 100644
--- a/my-evolution/e-summary-factory.c
+++ b/my-evolution/e-summary-factory.c
@@ -39,6 +39,7 @@
BonoboUIVerb verbs[] = {
BONOBO_UI_VERB ("PrintMyEvolution", e_summary_print),
+ BONOBO_UI_VERB ("ToolsSettings", e_summary_configure),
BONOBO_UI_VERB ("Reload", e_summary_reload),
BONOBO_UI_VERB_END
};
@@ -46,6 +47,7 @@ BonoboUIVerb verbs[] = {
static EPixmap pixmaps [] = {
E_PIXMAP ("/commands/PrintMyEvolution", "print.xpm"),
+ E_PIXMAP ("/commands/ToolsSettings", "configure_16_mail.xpm"),
E_PIXMAP ("/Toolbar/PrintMyEvolution", "buttons/print.png"),
E_PIXMAP_END
};
@@ -126,13 +128,12 @@ control_destroy_cb (BonoboControl *control,
BonoboControl *
e_summary_factory_new_control (const char *uri,
const GNOME_Evolution_Shell shell,
- ESummaryOfflineHandler *handler,
- ESummaryPrefs *global_preferences)
+ ESummaryOfflineHandler *handler)
{
BonoboControl *control;
GtkWidget *summary;
- summary = e_summary_new (shell, global_preferences);
+ summary = e_summary_new (shell);
if (summary == NULL) {
return NULL;
}
@@ -152,8 +153,5 @@ e_summary_factory_new_control (const char *uri,
gtk_signal_connect (GTK_OBJECT (control), "destroy",
control_destroy_cb, summary);
- /* FIXME: We register the factory here as it needs the summary object.
- Sigh, this is really wrong. */
-
return control;
}
diff --git a/my-evolution/e-summary-mail.c b/my-evolution/e-summary-mail.c
index aa9753619c..90d6bddd91 100644
--- a/my-evolution/e-summary-mail.c
+++ b/my-evolution/e-summary-mail.c
@@ -26,6 +26,12 @@
#include <liboaf/liboaf.h>
#include <gal/widgets/e-unicode.h>
+#include "Mail.h"
+#include "e-summary.h"
+#include "e-summary-mail.h"
+
+#include "e-util/e-path.h"
+
#include <libgnome/gnome-defs.h>
#include <libgnome/gnome-i18n.h>
#include <libgnome/gnome-util.h> /* gnome_util_prepend_user_home */
@@ -36,56 +42,20 @@
#include <Evolution.h>
#include <evolution-storage-listener.h>
-#include "Mail.h"
-#include "e-summary.h"
-#include "e-summary-mail.h"
-#include "e-summary-table.h"
-#include "e-summary-preferences.h"
-
-#include "e-util/e-path.h"
-
#define MAIL_IID "OAFIID:GNOME_Evolution_FolderInfo"
-typedef struct _FolderStore {
- GNOME_Evolution_Shell shell;
- GNOME_Evolution_FolderInfo folder_info;
- GNOME_Evolution_StorageRegistry registry;
- BonoboListener *listener;
- EvolutionStorageListener *storage_listener;
-
- GSList *storage_list;
- GHashTable *folders;
-
- GList *shown;
-} FolderStore;
-
struct _ESummaryMail {
-#if 0
GNOME_Evolution_FolderInfo folder_info;
- GNOME_Evolution_StorageRegistry registry;
BonoboListener *listener;
EvolutionStorageListener *storage_listener;
- GSList *storage_list;
-
GHashTable *folders;
-#endif
GList *shown;
ESummaryMailMode mode;
char *html;
};
-typedef struct _StorageInfo {
- char *name;
- char *toplevel;
-
- GNOME_Evolution_Storage storage;
- EvolutionStorageListener *listener;
-/* ESummary *summary; */
- GList *folders;
-} StorageInfo;
-
typedef struct _ESummaryMailFolder {
char *name;
char *path;
@@ -94,10 +64,17 @@ typedef struct _ESummaryMailFolder {
int unread;
gboolean init; /* Has this folder been initialised? */
- StorageInfo *si;
} ESummaryMailFolder;
-static FolderStore *folder_store = NULL;
+const char *
+e_summary_mail_get_html (ESummary *summary)
+{
+ if (summary->mail == NULL) {
+ return NULL;
+ }
+
+ return summary->mail->html;
+}
/* Work out what to do with folder names */
static char *
@@ -168,31 +145,20 @@ e_summary_mail_generate_html (ESummary *summary)
g_string_free (string, FALSE);
}
-const char *
-e_summary_mail_get_html (ESummary *summary)
-{
- /* Only regenerate HTML when it's needed */
- e_summary_mail_generate_html (summary);
-
- if (summary->mail == NULL) {
- return NULL;
- }
-
- return summary->mail->html;
-}
-
static void
-e_summary_mail_get_info (const char *uri,
+e_summary_mail_get_info (ESummaryMail *mail,
+ const char *uri,
BonoboListener *listener)
{
Bonobo_Listener corba_listener;
CORBA_Environment ev;
- g_return_if_fail (folder_store->folder_info != CORBA_OBJECT_NIL);
+ g_return_if_fail (mail != NULL);
+ g_return_if_fail (mail->folder_info != CORBA_OBJECT_NIL);
corba_listener = bonobo_object_corba_objref (BONOBO_OBJECT (listener));
CORBA_exception_init (&ev);
- GNOME_Evolution_FolderInfo_getInfo (folder_store->folder_info, uri ? uri : "",
+ GNOME_Evolution_FolderInfo_getInfo (mail->folder_info, uri ? uri : "",
corba_listener, &ev);
if (BONOBO_EX (&ev)) {
g_warning ("Error getting info for %s:\n%s", uri,
@@ -200,7 +166,7 @@ e_summary_mail_get_info (const char *uri,
CORBA_exception_free (&ev);
return;
}
-
+
CORBA_exception_free (&ev);
return;
}
@@ -209,38 +175,39 @@ static void
new_folder_cb (EvolutionStorageListener *listener,
const char *path,
const GNOME_Evolution_Folder *folder,
- StorageInfo *si)
+ ESummary *summary)
{
- ESummaryPrefs *global_preferences;
+ ESummaryMail *mail;
ESummaryMailFolder *mail_folder;
GList *p;
/* Don't care about non mail */
if (strcmp (folder->type, "mail") != 0 ||
- (strncmp (folder->physicalUri, "file://", 7) != 0 &&
- strncmp (folder->physicalUri, "vfolder", 7) != 0)) {
+ strncmp (folder->physicalUri, "file://", 7) != 0) {
return;
}
+ mail = summary->mail;
+
mail_folder = g_new (ESummaryMailFolder, 1);
- mail_folder->si = si;
mail_folder->path = g_strdup (folder->physicalUri);
mail_folder->name = g_strdup (path);
mail_folder->count = -1;
mail_folder->unread = -1;
mail_folder->init = FALSE;
- g_hash_table_insert (folder_store->folders, mail_folder->path, mail_folder);
- si->folders = g_list_prepend (si->folders, mail_folder);
+ g_hash_table_insert (mail->folders, mail_folder->path, mail_folder);
- global_preferences = e_summary_preferences_get_global ();
- for (p = global_preferences->display_folders; p; p = p->next) {
- if (strcmp (p->data, folder->physicalUri) == 0) {
- g_print ("Showning: %s\n", folder->physicalUri);
- folder_store->shown = g_list_append (folder_store->shown, mail_folder);
- e_summary_mail_get_info (mail_folder->path,
- folder_store->listener);
+ for (p = summary->preferences->display_folders; p; p = p->next) {
+ char *uri;
+
+ uri = g_strconcat ("file://", p->data, NULL);
+ if (strcmp (uri, folder->physicalUri) == 0) {
+ mail->shown = g_list_append (mail->shown, mail_folder);
+ e_summary_mail_get_info (mail, mail_folder->path,
+ mail->listener);
}
+ g_free (uri);
}
}
@@ -248,49 +215,49 @@ static void
update_folder_cb (EvolutionStorageListener *listener,
const char *path,
int unread_count,
- StorageInfo *si)
+ ESummary *summary)
{
char *evolution_dir;
- static char *proto = NULL;
+ char *proto;
char *uri;
- /* Make this static, saves having to recompute it each time */
- if (proto == NULL) {
- evolution_dir = gnome_util_prepend_user_home ("evolution/local");
+ evolution_dir = gnome_util_prepend_user_home ("evolution/local");
- proto = g_strconcat ("file://", evolution_dir, NULL);
- g_free (evolution_dir);
- }
+ proto = g_strconcat ("file://", evolution_dir, NULL);
uri = e_path_to_physical (proto, path);
- e_summary_mail_get_info (uri, folder_store->listener);
+ e_summary_mail_get_info (summary->mail, uri, summary->mail->listener);
g_free (uri);
+ g_free (evolution_dir);
+ g_free (proto);
}
static void
remove_folder_cb (EvolutionStorageListener *listener,
const char *path,
- StorageInfo *si)
+ ESummary *summary)
{
+ ESummaryMail *mail;
ESummaryMailFolder *mail_folder;
GList *p;
- mail_folder = g_hash_table_lookup (folder_store->folders, path);
+ mail = summary->mail;
+ mail_folder = g_hash_table_lookup (mail->folders, path);
if (mail_folder == NULL) {
return;
}
/* Check if we're displaying it, because we can't display it if it
doesn't exist :) */
- for (p = folder_store->shown; p; p = p->next) {
+ for (p = mail->shown; p; p = p->next) {
if (p->data == mail_folder) {
- folder_store->shown = g_list_remove_link (folder_store->shown, p);
+ mail->shown = g_list_remove_link (mail->shown, p);
g_list_free (p);
}
}
- g_hash_table_remove (folder_store->folders, path);
+ g_hash_table_remove (mail->folders, path);
g_free (mail_folder->name);
g_free (mail_folder->path);
g_free (mail_folder);
@@ -304,12 +271,16 @@ mail_change_notify (BonoboListener *listener,
ESummary *summary)
{
GNOME_Evolution_FolderInfo_MessageCount *count;
+ ESummaryMail *mail;
ESummaryMailFolder *folder;
GList *p;
- g_print ("Yo!\n");
+ mail = summary->mail;
+
+ g_return_if_fail (mail != NULL);
+
count = arg->_value;
- folder = g_hash_table_lookup (folder_store->folders, count->path);
+ folder = g_hash_table_lookup (mail->folders, count->path);
if (folder == NULL) {
return;
@@ -321,12 +292,19 @@ mail_change_notify (BonoboListener *listener,
/* Are we displaying this folder? */
for (p = summary->preferences->display_folders; p; p = p->next) {
- g_print ("folder: %s\n", folder->path);
- if (strcmp (p->data, folder->path) == 0) {
- g_print ("Received info for shown folder %s\n", folder->path);
- e_summary_redraw_all (); /* All summaries should be redrawn, not just this one */
+ char *uri;
+
+ uri = g_strconcat ("file://", p->data, NULL);
+ if (strcmp (uri, folder->path) == 0) {
+ /* Regen HTML */
+ e_summary_mail_generate_html (summary);
+ e_summary_draw (summary);
+
+ g_free (uri);
return;
}
+
+ g_free (uri);
}
}
@@ -337,33 +315,30 @@ e_summary_mail_protocol (ESummary *summary,
{
}
-
-
static gboolean
-e_summary_folder_register_storage (const char *name,
+e_summary_mail_register_storage (ESummary *summary,
GNOME_Evolution_Storage corba_storage)
{
+ ESummaryMail *mail;
+ EvolutionStorageListener *listener;
GNOME_Evolution_StorageListener corba_listener;
- StorageInfo *si;
CORBA_Environment ev;
- si = g_new (StorageInfo, 1);
- si->name = g_strdup (name);
- si->toplevel = NULL;
- si->storage = corba_storage;
- si->listener = evolution_storage_listener_new ();
- si->folders = NULL;
+ mail = summary->mail;
+
+ if (mail->storage_listener == NULL) {
+ mail->storage_listener = evolution_storage_listener_new ();
- folder_store->storage_list = g_slist_prepend (folder_store->storage_list, si);
-
- gtk_signal_connect (GTK_OBJECT (si->listener), "new-folder",
- GTK_SIGNAL_FUNC (new_folder_cb), si);
- gtk_signal_connect (GTK_OBJECT (si->listener), "removed-folder",
- GTK_SIGNAL_FUNC (remove_folder_cb), si);
- gtk_signal_connect (GTK_OBJECT (si->listener), "update_folder",
- GTK_SIGNAL_FUNC (update_folder_cb), si);
+ gtk_signal_connect (GTK_OBJECT (mail->storage_listener), "new-folder",
+ GTK_SIGNAL_FUNC (new_folder_cb), summary);
+ gtk_signal_connect (GTK_OBJECT (mail->storage_listener), "removed-folder",
+ GTK_SIGNAL_FUNC (remove_folder_cb), summary);
+ gtk_signal_connect (GTK_OBJECT (mail->storage_listener), "update_folder",
+ GTK_SIGNAL_FUNC (update_folder_cb), summary);
+ }
+ listener = mail->storage_listener;
- corba_listener = evolution_storage_listener_corba_objref (si->listener);
+ corba_listener = evolution_storage_listener_corba_objref (listener);
CORBA_exception_init (&ev);
GNOME_Evolution_Storage_addListener (corba_storage, corba_listener, &ev);
@@ -372,6 +347,7 @@ e_summary_folder_register_storage (const char *name,
CORBA_exception_id (&ev));
CORBA_exception_free (&ev);
+ g_free (mail);
return FALSE;
}
@@ -380,158 +356,96 @@ e_summary_folder_register_storage (const char *name,
return TRUE;
}
-static void
-e_summary_folder_register_local_storage (void)
+static gboolean
+e_summary_mail_register_storages (ESummary *summary,
+ GNOME_Evolution_Shell corba_shell)
{
GNOME_Evolution_Storage local_storage;
CORBA_Environment ev;
- CORBA_exception_init (&ev);
- local_storage = GNOME_Evolution_Shell_getLocalStorage (folder_store->shell, &ev);
- if (BONOBO_EX (&ev) || local_storage == CORBA_OBJECT_NIL) {
- g_warning ("Error getting local storage: %s", CORBA_exception_id (&ev));
- CORBA_exception_free (&ev);
- return;
- }
- CORBA_exception_free (&ev);
-
- e_summary_folder_register_storage (_("Local Folders"), local_storage);
-}
-
-static void
-storage_notify (BonoboListener *listener,
- const char *name,
- const BonoboArg *arg,
- CORBA_Environment *ev,
- gpointer data)
-{
- GNOME_Evolution_StorageRegistry_NotifyResult *nr;
- GNOME_Evolution_Storage corba_storage;
- CORBA_Environment ev2;
-
- nr = arg->_value;
- switch (nr->type) {
- case GNOME_Evolution_StorageRegistry_STORAGE_CREATED:
- /* These need to be special cased because they're special */
- if (strcmp (nr->name, "summary") == 0) {
- break;
- }
-
- if (strcmp (nr->name, "local") == 0) {
- e_summary_folder_register_local_storage ();
- break;
- }
-
- CORBA_exception_init (&ev2);
- corba_storage = GNOME_Evolution_StorageRegistry_getStorageByName (folder_store->registry,
- nr->name, &ev2);
- if (BONOBO_EX (&ev2) || corba_storage == CORBA_OBJECT_NIL) {
- g_warning ("Error getting storage %s\n%s", nr->name,
- CORBA_exception_id (&ev2));
- CORBA_exception_free (&ev2);
- return;
- }
-
- CORBA_exception_free (&ev2);
- e_summary_folder_register_storage (nr->name, corba_storage);
- break;
-
- case GNOME_Evolution_StorageRegistry_STORAGE_DESTROYED:
- g_print ("%s removed\n", nr->name);
- break;
-
- default:
- g_print ("Unknown response %d\n", nr->type);
- break;
- }
-}
-
-static gboolean
-e_summary_folder_register_storages (GNOME_Evolution_Shell corba_shell)
-{
- Bonobo_Listener corba_listener;
- BonoboListener *listener;
- CORBA_Environment ev;
+ g_return_val_if_fail (summary != NULL, FALSE);
+ g_return_val_if_fail (IS_E_SUMMARY (summary), FALSE);
CORBA_exception_init (&ev);
-
- folder_store->registry = Bonobo_Unknown_queryInterface (corba_shell,
- "IDL:GNOME/Evolution/StorageRegistry:1.0",
- &ev);
- if (BONOBO_EX (&ev) || folder_store->registry == NULL) {
- g_warning ("No storage registry: %s", CORBA_exception_id (&ev));
- CORBA_exception_free (&ev);
- return FALSE;
- }
-
- listener = bonobo_listener_new (NULL, NULL);
- gtk_signal_connect (GTK_OBJECT (listener), "event-notify",
- GTK_SIGNAL_FUNC (storage_notify), NULL);
- corba_listener = bonobo_object_corba_objref (BONOBO_OBJECT (listener));
-
- /* Storages will be added whenever the listener gets an event. */
- GNOME_Evolution_StorageRegistry_addListener (folder_store->registry, corba_listener, &ev);
+ local_storage = GNOME_Evolution_Shell_getLocalStorage (corba_shell, &ev);
if (BONOBO_EX (&ev)) {
- g_warning ("Cannot add listener\n%s", CORBA_exception_id (&ev));
+ g_warning ("Exception getting local storage: %s",
+ CORBA_exception_id (&ev));
CORBA_exception_free (&ev);
+
return FALSE;
}
-
CORBA_exception_free (&ev);
- return TRUE;
+
+ if (e_summary_mail_register_storage (summary, local_storage))
+ return TRUE;
+ else
+ return FALSE;
}
void
-e_summary_mail_init (ESummary *summary)
+e_summary_mail_init (ESummary *summary,
+ GNOME_Evolution_Shell corba_shell)
{
ESummaryMail *mail;
+ CORBA_Environment ev;
g_return_if_fail (summary != NULL);
g_return_if_fail (IS_E_SUMMARY (summary));
- g_return_if_fail (folder_store != NULL);
-
mail = g_new0 (ESummaryMail, 1);
summary->mail = mail;
mail->html = NULL;
+ CORBA_exception_init (&ev);
+ mail->folder_info = oaf_activate_from_id (MAIL_IID, 0, NULL, &ev);
+ if (BONOBO_EX (&ev) || mail->folder_info == NULL) {
+ g_warning ("Exception creating FolderInfo: %s",
+ CORBA_exception_id (&ev));
+ CORBA_exception_free (&ev);
+
+ return;
+ }
- /* Connect to the global folder_store listener */
- gtk_signal_connect (GTK_OBJECT (folder_store->listener), "event-notify",
+ /* Create a BonoboListener for all the notifies. */
+ mail->listener = bonobo_listener_new (NULL, NULL);
+ gtk_signal_connect (GTK_OBJECT (mail->listener), "event-notify",
GTK_SIGNAL_FUNC (mail_change_notify), summary);
+ /* Create a hash table for the folders */
+ mail->folders = g_hash_table_new (g_str_hash, g_str_equal);
+ mail->shown = NULL;
+
+ e_summary_mail_register_storages (summary, corba_shell);
e_summary_add_protocol_listener (summary, "mail", e_summary_mail_protocol, mail);
return;
}
void
-e_summary_mail_reconfigure (void)
+e_summary_mail_reconfigure (ESummary *summary)
{
- ESummaryPrefs *preferences;
+ ESummaryMail *mail;
GList *old, *p;
- old = folder_store->shown;
- folder_store->shown = NULL;
+ g_return_if_fail (summary != NULL);
+ g_return_if_fail (IS_E_SUMMARY (summary));
+
+ mail = summary->mail;
+ old = mail->shown;
+ mail->shown = NULL;
- preferences = e_summary_preferences_get_global ();
- for (p = g_list_last (preferences->display_folders); p; p = p->prev) {
+ for (p = g_list_last (summary->preferences->display_folders); p; p = p->prev) {
ESummaryMailFolder *folder;
char *uri;
- if (strncmp (p->data, "file://", 7) == 0 ||
- strncmp (p->data, "vfolder:", 8) == 0) {
- uri = g_strdup (p->data);
- } else {
- uri = g_strconcat ("file://", p->data, NULL);
- }
-
- folder = g_hash_table_lookup (folder_store->folders, uri);
+ uri = g_strconcat ("file://", p->data, NULL);
+ folder = g_hash_table_lookup (mail->folders, uri);
if (folder != NULL) {
if (folder->init == FALSE) {
- e_summary_mail_get_info (folder->path,
- folder_store->listener);
+ e_summary_mail_get_info (mail, folder->path,
+ mail->listener);
}
- folder_store->shown = g_list_append (folder_store->shown, folder);
+ mail->shown = g_list_append (mail->shown, folder);
}
g_free (uri);
@@ -540,7 +454,8 @@ e_summary_mail_reconfigure (void)
/* Free the old list */
g_list_free (old);
-/* e_summary_redraw_all (); */
+ e_summary_mail_generate_html (summary);
+ e_summary_draw (summary);
}
static void
@@ -576,195 +491,49 @@ static int
str_compare (gconstpointer a,
gconstpointer b)
{
- ESummaryMailFolder *folder_a, *folder_b;
-
- folder_a = (ESummaryMailFolder *) a;
- folder_b = (ESummaryMailFolder *) b;
- return strcasecmp (folder_a->name, folder_b->name);
-}
-
-static int
-sort_storages (gconstpointer a,
- gconstpointer b)
-{
- StorageInfo *si_a, *si_b;
-
- si_a = (StorageInfo *) a;
- si_b = (StorageInfo *) b;
-
- return strcasecmp (si_a->name, si_b->name);
-}
-
-static char *
-get_parent_path (const char *path)
-{
- char *last;
-
- if (strncmp (path, "vfolder", 7) == 0) {
- last = strrchr (path, '#');
- if (last == NULL) {
- return g_strdup (path);
- }
- return g_strndup (path, last - path);
- } else {
- last = strrchr (path, '/');
- return g_strndup (path, last - path);
- }
-}
-
-static gboolean
-is_folder_shown (const char *path)
-{
- GList *p;
-
- for (p = folder_store->shown; p; p = p->next) {
- ESummaryMailFolder *folder = p->data;
- if (strcmp (folder->path, path) == 0) {
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-static ETreePath
-insert_path_recur (ESummaryTable *est,
- StorageInfo *si,
- GHashTable *hash_table,
- const char *path)
-{
- char *parent_path, *name;
- ETreePath parent_node, node;
- ESummaryTableModelEntry *entry;
- int children;
-
- parent_path = get_parent_path (path);
-
- parent_node = g_hash_table_lookup (hash_table, parent_path);
- if (parent_node == NULL) {
- if (strcmp (si->toplevel, path) == 0) {
- /* Insert root */
- children = e_summary_table_get_num_children (est, NULL);
- node = e_summary_table_add_node (est, NULL, children, NULL);
- entry = g_new (ESummaryTableModelEntry, 1);
- entry->path = node;
- entry->location = NULL;
- entry->name = g_strdup (si->name);
- entry->editable = FALSE;
- entry->removable = FALSE;
- entry->shown = FALSE;
-
- g_hash_table_insert (est->model, entry->path, entry);
- g_hash_table_insert (hash_table, g_strdup (path), node);
- return node;
- } else {
- parent_node = insert_path_recur (est, si, hash_table, parent_path);
- }
- }
+ ESummaryMailRowData *rda, *rdb;
- g_free (parent_path);
- if (strcmp (si->name, "VFolders") == 0) {
- name = strrchr (path, '#');
- } else {
- name = strrchr (path, '/');
- }
-
- /* Leave out folders called "subfolder" */
- if (strcmp (name + 1, "subfolders") == 0) {
- return parent_node;
- }
-
- children = e_summary_table_get_num_children (est, parent_node);
- node = e_summary_table_add_node (est, parent_node, children, NULL);
- entry = g_new (ESummaryTableModelEntry, 1);
- entry->path = node;
- entry->location = g_strdup (path);
- entry->name = g_strdup (name + 1);
- entry->editable = TRUE;
- entry->removable = FALSE;
-
- /* Check if shown */
- entry->shown = is_folder_shown (path);
- g_hash_table_insert (est->model, entry->path, entry);
- g_hash_table_insert (hash_table, g_strdup (path), node);
-
- return node;
+ rda = (ESummaryMailRowData *) a;
+ rdb = (ESummaryMailRowData *) b;
+ return strcmp (rda->name, rdb->name);
}
-static void
-free_path_hash (gpointer key,
- gpointer value,
- gpointer data)
-{
- g_free (key);
-}
-
-static void
-add_storage_to_table (ESummaryTable *est,
- StorageInfo *si)
+void
+e_summary_mail_fill_list (GtkCList *clist,
+ ESummary *summary)
{
- GHashTable *path_hash;
- GList *p;
-
- path_hash = g_hash_table_new (g_str_hash, g_str_equal);
- p = g_list_sort (si->folders, str_compare);
-
- for (; p; p = p->next) {
- ESummaryMailFolder *folder = p->data;
-
- insert_path_recur (est, si, path_hash, folder->path);
- }
-
- g_hash_table_foreach (path_hash, free_path_hash, NULL);
- g_hash_table_destroy (path_hash);
-}
+ ESummaryMail *mail;
+ GList *names = NULL, *p;
-static void
-make_toplevel (StorageInfo *si)
-{
- if (si->toplevel != NULL) {
+ mail = summary->mail;
+ if (mail == NULL) {
return;
}
- if (strcmp (si->name, "VFolders") == 0) {
- si->toplevel = g_strdup_printf ("vfolder:%s/evolution/vfolder",
- g_get_home_dir ());
- } else if (strcmp (si->name, "Local Folders") == 0) {
- si->toplevel = g_strdup_printf ("file://%s/evolution/local",
- g_get_home_dir ());
- } else {
- g_warning ("Unknown folder name... EEEEEEKEKEKEKEE!");
- si->toplevel = g_strdup ("Dunno");
- }
-}
+ g_hash_table_foreach (mail->folders, hash_to_list, &names);
-void
-e_summary_mail_fill_list (ESummaryTable *est)
-{
- GSList *p;
-
- g_return_if_fail (IS_E_SUMMARY_TABLE (est));
+ names = g_list_sort (names, str_compare);
+ for (p = names; p; p = p->next) {
+ ESummaryMailRowData *rd;
+ char *text[1];
+ int row;
- g_return_if_fail (folder_store != NULL);
-
- p = g_slist_sort (folder_store->storage_list, sort_storages);
- for (; p; p = p->next) {
- StorageInfo *si = p->data;
-
- if (si->toplevel == NULL) {
- make_toplevel (si);
- }
-
- add_storage_to_table (est, si);
+ rd = p->data;
+ text[0] = rd->name + 1;
+ row = gtk_clist_append (clist, text);
+ gtk_clist_set_row_data_full (clist, row, rd, free_row_data);
}
+
+ g_list_free (names);
}
const char *
-e_summary_mail_uri_to_name (const char *uri)
+e_summary_mail_uri_to_name (ESummary *summary,
+ const char *uri)
{
ESummaryMailFolder *folder;
- folder = g_hash_table_lookup (folder_store->folders, uri);
+ folder = g_hash_table_lookup (summary->mail->folders, uri);
if (folder == NULL) {
return NULL;
} else {
@@ -793,57 +562,25 @@ e_summary_mail_free (ESummary *summary)
g_return_if_fail (IS_E_SUMMARY (summary));
mail = summary->mail;
+ bonobo_object_release_unref (mail->folder_info, NULL);
+ mail->folder_info = CORBA_OBJECT_NIL;
- /* Probably need to disconnect by ID here instead */
- gtk_signal_disconnect_by_func (GTK_OBJECT (folder_store->listener),
+ gtk_signal_disconnect_by_func (GTK_OBJECT (mail->listener),
GTK_SIGNAL_FUNC (mail_change_notify), summary);
+ bonobo_object_unref (BONOBO_OBJECT (mail->listener));
-#if 0
g_hash_table_foreach (mail->folders, free_folder, NULL);
g_hash_table_destroy (mail->folders);
-#endif
+
g_free (mail->html);
-#if 0
gtk_signal_disconnect_by_func (GTK_OBJECT (mail->storage_listener),
GTK_SIGNAL_FUNC (new_folder_cb), summary);
gtk_signal_disconnect_by_func (GTK_OBJECT (mail->storage_listener),
GTK_SIGNAL_FUNC (remove_folder_cb), summary);
gtk_signal_disconnect_by_func (GTK_OBJECT (mail->storage_listener),
GTK_SIGNAL_FUNC (update_folder_cb), summary);
-#endif
-
+
g_free (mail);
summary->mail = NULL;
}
-
-gboolean
-e_summary_folder_init_folder_store (GNOME_Evolution_Shell shell)
-{
- CORBA_Environment ev;
-
- if (folder_store != NULL) {
- return TRUE;
- }
-
- folder_store = g_new0 (FolderStore, 1);
- folder_store->shell = shell;
-
- CORBA_exception_init (&ev);
- folder_store->folder_info = oaf_activate_from_id (MAIL_IID, 0, NULL, &ev);
- if (BONOBO_EX (&ev) || folder_store->folder_info == NULL) {
- g_warning ("Exception creating folderinfo: %s\n",
- CORBA_exception_id (&ev) ? CORBA_exception_id (&ev) : "(null)");
- CORBA_exception_free (&ev);
- return FALSE;
- }
-
- CORBA_exception_free (&ev);
- folder_store->listener = bonobo_listener_new (NULL, NULL);
-
- /* Create a hash table for the folders */
- folder_store->folders = g_hash_table_new (g_str_hash, g_str_equal);
-
- e_summary_folder_register_storages (shell);
- return TRUE;
-}
diff --git a/my-evolution/e-summary-preferences.c b/my-evolution/e-summary-preferences.c
index 447812b317..5c2e91f145 100644
--- a/my-evolution/e-summary-preferences.c
+++ b/my-evolution/e-summary-preferences.c
@@ -24,6 +24,9 @@
#include <config.h>
#endif
+#include "e-summary.h"
+#include "e-summary-preferences.h"
+
#include <gtk/gtk.h>
#include <libgnome/gnome-defs.h>
@@ -38,23 +41,9 @@
#include <stdio.h>
#include <bonobo/bonobo-exception.h>
-#include <bonobo/bonobo-generic-factory.h>
#include <bonobo/bonobo-moniker-util.h>
-#include <bonobo/bonobo-shlib-factory.h>
-
#include <bonobo-conf/bonobo-config-database.h>
-#include "e-summary.h"
-#include "e-summary-preferences.h"
-#include "e-summary-table.h"
-#include "e-summary-shown.h"
-
-#include "evolution-config-control.h"
-
-#define FACTORY_ID "OAFIID:GNOME_Evolution_Summary_ConfigControlFactory"
-
-static ESummaryPrefs *global_preferences = NULL;
-
static void
make_initial_mail_list (ESummaryPrefs *prefs)
{
@@ -365,22 +354,22 @@ e_summary_preferences_copy (ESummaryPrefs *prefs)
return prefs_copy;
}
-ESummaryPrefs *
-e_summary_preferences_init (void)
+void
+e_summary_preferences_init (ESummary *summary)
{
ESummaryPrefs *prefs;
- if (global_preferences != NULL) {
- return global_preferences;
- }
-
- prefs = g_new0 (ESummaryPrefs, 1);
- global_preferences = prefs;
-
- if (e_summary_preferences_restore (prefs) == TRUE) {
- return prefs;
+ g_return_if_fail (summary != NULL);
+ g_return_if_fail (IS_E_SUMMARY (summary));
+
+ summary->preferences = g_new0 (ESummaryPrefs, 1);
+ summary->old_prefs = NULL;
+
+ if (e_summary_preferences_restore (summary->preferences) == TRUE) {
+ return;
}
+ prefs = summary->preferences;
/* Defaults */
/* Mail */
@@ -398,42 +387,29 @@ e_summary_preferences_init (void)
prefs->days = E_SUMMARY_CALENDAR_ONE_DAY;
prefs->show_tasks = E_SUMMARY_CALENDAR_ALL_TASKS;
-
- return prefs;
-}
-
-ESummaryPrefs *
-e_summary_preferences_get_global (void)
-{
- return global_preferences;
}
struct _MailPage {
- GtkWidget *etable;
GtkWidget *all, *shown;
GtkWidget *fullpath;
GtkWidget *add, *remove;
-
- GHashTable *model;
- GList *tmp_list;
};
struct _RDFPage {
- GtkWidget *etable;
+ GtkWidget *all, *shown;
GtkWidget *refresh, *limit;
- GtkWidget *new_url, *delete_url;
+ GtkWidget *add, *remove;
+ GtkWidget *new_url;
- GHashTable *default_hash, *model;
- GList *known, *tmp_list;
+ GList *known;
};
struct _WeatherPage {
- GtkWidget *etable;
+ GtkWidget *all, *shown;
GtkWidget *refresh, *imperial, *metric;
GtkWidget *add, *remove;
- GHashTable *model;
- GList *tmp_list;
+ GtkCTreeNode *selected_node;
};
struct _CalendarPage {
@@ -442,8 +418,8 @@ struct _CalendarPage {
};
typedef struct _PropertyData {
- EvolutionConfigControl *config_control;
-
+ ESummary *summary;
+ GnomePropertyBox *box;
GtkWidget *new_url_entry, *new_name_entry;
GladeXML *xml;
@@ -456,47 +432,45 @@ typedef struct _PropertyData {
struct _RDFInfo {
char *url;
char *name;
-
- gboolean custom;
};
static struct _RDFInfo rdfs[] = {
- {"http://advogato.org/rss/articles.xml", "Advogato", FALSE},
- {"http://barrapunto.com/barrapunto.rdf", "Barrapunto", FALSE},
- {"http://barrapunto.com/gnome.rdf", "Barrapunto GNOME", FALSE,},
- {"http://www.bsdtoday.com/backend/bt.rdf", "BSD Today", FALSE},
- {"http://beyond2000.com/b2k.rdf", "Beyond 2000", FALSE},
- {"http://www.cnn.com/cnn.rss", "CNN", FALSE},
- {"http://www.debianplanet.org/debianplanet/backend.php", "Debian Planet", FALSE},
- {"http://www.dictionary.com/wordoftheday/wotd.rss", N_("Dictionary.com Word of the Day"), FALSE},
- {"http://www.dvdreview.com/rss/newschannel.rss", "DVD Review", FALSE},
- {"http://freshmeat.net/backend/fm.rdf", "Freshmeat", FALSE},
- {"http://news.gnome.org/gnome-news/rdf", "GNotices", FALSE},
- {"http://headlines.internet.com/internetnews/prod-news/news.rss", "Internet.com", FALSE},
- {"http://www.hispalinux.es/backend.php", "HispaLinux", FALSE},
- {"http://dot.kde.org/rdf", "KDE Dot News", FALSE},
- {"http://www.kuro5hin.org/backend.rdf", "Kuro5hin", FALSE},
- {"http://linuxgames.com/bin/mynetscape.pl", "Linux Games", FALSE},
- {"http://linux.com/mrn/jobs/latest_jobs.rss", "Linux Jobs", FALSE},
- {"http://linuxtoday.com/backend/my-netscape.rdf", "Linux Today", FALSE},
- {"http://lwn.net/headlines/rss", "Linux Weekly News", FALSE},
- {"http://www.linux.com/mrn/front_page.rss", "Linux.com", FALSE},
- {"http://memepool.com/memepool.rss", "Memepool", FALSE},
- {"http://www.mozilla.org/news.rdf", "Mozilla", FALSE},
- {"http://www.mozillazine.org/contents.rdf", "Mozillazine", FALSE},
- {"http://www.fool.com/about/headlines/rss_headlines.asp", "The Motley Fool", FALSE},
- {"http://www.newsforge.com/newsforge.rss", "Newsforge", FALSE},
- {"http://www.nanotechnews.com/nano/rdf", "Nanotech News", FALSE},
- {"http://www.pigdog.org/pigdog.rdf", "Pigdog", FALSE},
- {"http://www.python.org/channews.rdf", "Python.org", FALSE},
- {"http://www.quotationspage.com/data/mqotd.rss", N_("Quotes of the Day"), FALSE},
- {"http://www.salon.com/feed/RDF/salon_use.rdf", "Salon", FALSE},
- {"http://slashdot.org/slashdot.rdf", "Slashdot", FALSE},
- {"http://www.theregister.co.uk/tonys/slashdot.rdf", "The Register", FALSE},
- {"http://www.thinkgeek.com/thinkgeek.rdf", "Think Geek", FALSE},
- {"http://www.webreference.com/webreference.rdf", "Web Reference", FALSE},
- {"http://redcarpet.ximian.com/red-carpet.rdf", "Ximian Red Carpet New", FALSE},
- {NULL, NULL, FALSE}
+ {"http://advogato.org/rss/articles.xml", "Advogato"},
+ {"http://barrapunto.com/barrapunto.rdf", "Barrapunto"},
+ {"http://barrapunto.com/gnome.rdf", "Barrapunto GNOME"},
+ {"http://www.bsdtoday.com/backend/bt.rdf", "BSD Today"},
+ {"http://beyond2000.com/b2k.rdf", "Beyond 2000"},
+ {"http://www.cnn.com/cnn.rss", "CNN"},
+ {"http://www.debianplanet.org/debianplanet/backend.php", "Debian Planet"},
+ {"http://www.dictionary.com/wordoftheday/wotd.rss", N_("Dictionary.com Word of the Day")},
+ {"http://www.dvdreview.com/rss/newschannel.rss", "DVD Review"},
+ {"http://freshmeat.net/backend/fm.rdf", "Freshmeat"},
+ {"http://news.gnome.org/gnome-news/rdf", "GNotices"},
+ {"http://headlines.internet.com/internetnews/prod-news/news.rss", "Internet.com"},
+ {"http://www.hispalinux.es/backend.php", "HispaLinux"},
+ {"http://www.kde.org/dotkdeorg.rdf", "KDE Dot News"},
+ {"http://www.kuro5hin.org/backend.rdf", "Kuro5hin"},
+ {"http://linuxgames.com/bin/mynetscape.pl", "Linux Games"},
+ {"http://linux.com/mrn/jobs/latest_jobs.rss", "Linux Jobs"},
+ {"http://linuxtoday.com/backend/my-netscape.rdf", "Linux Today"},
+ {"http://lwn.net/headlines/rss", "Linux Weekly News"},
+ {"http://www.linux.com/mrn/front_page.rss", "Linux.com"},
+ {"http://memepool.com/memepool.rss", "Memepool"},
+ {"http://www.mozilla.org/news.rdf", "Mozilla"},
+ {"http://www.mozillazine.org/contents.rdf", "Mozillazine"},
+ {"http://www.fool.com/about/headlines/rss_headlines.asp", "The Motley Fool"},
+ {"http://www.newsforge.com/newsforge.rss", "Newsforge"},
+ {"http://www.nanotechnews.com/nano/rdf", "Nanotech News"},
+ {"http://www.pigdog.org/pigdog.rdf", "Pigdog"},
+ {"http://www.python.org/channews.rdf", "Python.org"},
+ {"http://www.quotationspage.com/data/mqotd.rss", N_("Quotes of the Day")},
+ {"http://www.salon.com/feed/RDF/salon_use.rdf", "Salon"},
+ {"http://slashdot.org/slashdot.rdf", "Slashdot"},
+ {"http://www.theregister.co.uk/tonys/slashdot.rdf", "The Register"},
+ {"http://www.thinkgeek.com/thinkgeek.rdf", "Think Geek"},
+ {"http://www.webreference.com/webreference.rdf", "Web Reference"},
+ {"http://redcarpet.ximian.com/red-carpet.rdf", "Ximian Red Carpet New"},
+ {NULL, NULL}
};
static void
@@ -548,10 +522,6 @@ save_known_rdfs (GList *rdfs)
char *line;
info = rdfs->data;
- if (info->custom == FALSE) {
- continue;
- }
-
line = g_strconcat (info->url, ",", info->name, "\n", NULL);
fputs (line, handle);
g_free (line);
@@ -560,58 +530,14 @@ save_known_rdfs (GList *rdfs)
fclose (handle);
}
-/* Yeah a silly loop, but p should be short enough that it doesn't matter much */
-static gboolean
-rdf_is_shown (PropertyData *pd,
- const char *url)
-{
- GList *p;
-
- for (p = global_preferences->rdf_urls; p; p = p->next) {
- if (strcmp (p->data, url) == 0) {
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
static void
-fill_rdf_etable (GtkWidget *widget,
- PropertyData *pd)
+fill_rdf_all_clist (GtkCList *clist,
+ PropertyData *pd)
{
- ESummaryShownModelEntry *entry;
- ESummaryShown *ess;
FILE *handle;
- int i, total;
+ int i;
char *rdf_file, line[4096];
- if (pd->rdf->default_hash == NULL) {
- pd->rdf->default_hash = g_hash_table_new (g_str_hash, g_str_equal);
- }
-
- ess = E_SUMMARY_SHOWN (widget);
-
- /* Fill the defaults first */
- for (i = 0; rdfs[i].url; i++) {
- entry = g_new (ESummaryShownModelEntry, 1);
- entry->location = g_strdup (rdfs[i].url);
- entry->name = g_strdup (rdfs[i].name);
- entry->showable = TRUE;
-
- e_summary_shown_add_node (ess, TRUE, entry, NULL, NULL);
-
- if (rdf_is_shown (pd, rdfs[i].url) == TRUE) {
- e_summary_shown_add_node (ess, FALSE, entry, NULL, NULL);
- }
-
- pd->rdf->known = g_list_append (pd->rdf->known, &rdfs[i]);
-
- g_hash_table_insert (pd->rdf->default_hash, rdfs[i].url, &rdfs[i]);
- }
-
- total = i;
-
rdf_file = gnome_util_prepend_user_home ("evolution/RDF-urls.txt");
handle = fopen (rdf_file, "r");
g_free (rdf_file);
@@ -623,17 +549,29 @@ fill_rdf_etable (GtkWidget *widget,
}
if (handle == NULL) {
+ for (i = 0; rdfs[i].url; i++) {
+ char *text[1];
+ int row;
+
+ text[0] = _(rdfs[i].name);
+ row = gtk_clist_append (clist, text);
+ /* We don't need to free this data as it's
+ static */
+ gtk_clist_set_row_data (clist, row, &rdfs[i]);
+ pd->rdf->known = g_list_append (pd->rdf->known, &rdfs[i]);
+ }
+
return;
}
while (fgets (line, 4095, handle)) {
+ char *text[1];
char **tokens;
struct _RDFInfo *info;
- int len;
+ int row;
- len = strlen (line);
- if (line[len - 1] == '\n') {
- line[len - 1] = 0;
+ if (line[strlen (line) - 1] == '\n') {
+ line[strlen (line) - 1] = 0;
}
tokens = g_strsplit (line, ",", 2);
@@ -641,59 +579,357 @@ fill_rdf_etable (GtkWidget *widget,
continue;
}
- if (g_hash_table_lookup (pd->rdf->default_hash, tokens[0]) != NULL) {
- g_strfreev (tokens);
- continue;
- }
-
info = g_new (struct _RDFInfo, 1);
info->url = g_strdup (tokens[0]);
info->name = g_strdup (tokens[1]);
- info->custom = TRUE;
-
+
pd->rdf->known = g_list_append (pd->rdf->known, info);
+ text[0] = tokens[1];
+ row = gtk_clist_append (clist, text);
+ gtk_clist_set_row_data_full (clist, row, info,
+ (GtkDestroyNotify) free_rdf_info);
+ g_strfreev (tokens);
+ }
+
+ fclose (handle);
+}
+
+static void
+fill_rdf_shown_clist (GtkCList *clist,
+ PropertyData *pd)
+{
+ GList *p;
+
+ for (p = pd->summary->preferences->rdf_urls; p; p = p->next) {
+ char *text[1];
+ int row;
+
+ text[0] = (char *) find_name_for_url (pd, p->data);
+ row = gtk_clist_append (clist, text);
+ gtk_clist_set_row_data (clist, row, p);
+ }
+}
+
+static void
+fill_weather_all_ctree (GtkCTree *ctree)
+{
+ e_summary_weather_ctree_fill (ctree);
+}
+
+static void
+fill_weather_shown_clist (GtkCList *clist,
+ PropertyData *pd)
+{
+ GList *p;
+
+ for (p = pd->summary->preferences->stations; p; p = p->next) {
+ char *text[1];
+ char *pretty;
+
+ pretty = (char *) e_summary_weather_code_to_name (p->data);
+
+ text[0] = pretty;
+ gtk_clist_append (clist, text);
+ }
+}
- entry = g_new (ESummaryShownModelEntry, 1);
- entry->location = g_strdup (info->url);
- entry->name = g_strdup (info->name);
- entry->showable = TRUE;
+static void
+fill_mail_all_clist (GtkCList *clist,
+ PropertyData *pd)
+{
+ e_summary_mail_fill_list (clist, pd->summary);
+}
- e_summary_shown_add_node (ess, TRUE, entry, NULL, NULL);
+static void
+fill_mail_shown_clist (GtkCList *clist,
+ PropertyData *pd)
+{
+ GList *p;
- if (rdf_is_shown (pd, tokens[0]) == TRUE) {
- e_summary_shown_add_node (ess, FALSE, entry, NULL, NULL);
+ for (p = pd->summary->preferences->display_folders; p; p = p->next) {
+ char *text[1];
+ char *uri;
+ const char *name;
+ int row;
+
+ uri = g_strconcat ("file://", p->data, NULL);
+ name = e_summary_mail_uri_to_name (pd->summary, uri);
+ g_free (uri);
+ if (name == NULL) {
+ text[0] = p->data;
+ } else {
+ text[0] = (char *) name + 1; /* GtkCList sucks. */
}
+ row = gtk_clist_prepend (clist, text);
+ gtk_clist_set_row_data (clist, row, p);
+ }
+}
- g_strfreev (tokens);
+static void
+mail_all_select_row_cb (GtkCList *clist,
+ int row,
+ int column,
+ GdkEvent *event,
+ PropertyData *pd)
+{
+ ESummaryMailRowData *rd;
+ GList *p;
+
+ rd = gtk_clist_get_row_data (GTK_CLIST (pd->mail->all), row);
+ if (rd == NULL) {
+ return;
}
- fclose (handle);
+ for (p = pd->summary->preferences->display_folders; p; p = p->next) {
+ if (strcmp (rd->uri + 7, p->data) == 0) {
+ /* Already in list */
+ return;
+ }
+ }
+
+ gtk_widget_set_sensitive (pd->mail->add, TRUE);
+}
+
+static void
+mail_all_unselect_row_cb (GtkCList *clist,
+ int row,
+ int column,
+ GdkEvent *event,
+ PropertyData *pd)
+{
+ if (clist->selection == NULL) {
+ gtk_widget_set_sensitive (pd->mail->add, FALSE);
+ }
+}
+
+static void
+mail_shown_select_row_cb (GtkCList *clist,
+ int row,
+ int column,
+ GdkEvent *event,
+ PropertyData *pd)
+{
+ gtk_widget_set_sensitive (pd->mail->remove, TRUE);
+}
+
+static void
+mail_shown_unselect_row_cb (GtkCList *clist,
+ int row,
+ int column,
+ GdkEvent *event,
+ PropertyData *pd)
+{
+ if (clist->selection == NULL) {
+ gtk_widget_set_sensitive (pd->mail->remove, FALSE);
+ }
}
static void
-fill_weather_etable (ESummaryShown *ess,
+mail_add_clicked_cb (GtkButton *button,
PropertyData *pd)
{
- e_summary_weather_fill_etable (ess);
+ int row;
+ ESummaryMailRowData *rd;
+ char *text[1];
+ GList *p;
+
+ row = GPOINTER_TO_INT (GTK_CLIST (pd->mail->all)->selection->data);
+ rd = gtk_clist_get_row_data (GTK_CLIST (pd->mail->all), row);
+ g_return_if_fail (rd != NULL);
+
+ for (p = pd->summary->preferences->display_folders; p; p = p->next) {
+ if (strcmp (rd->uri + 7, p->data) == 0) {
+ /* Already in list */
+ return;
+ }
+ }
+
+ text[0] = rd->name + 1;
+ row = gtk_clist_append (GTK_CLIST (pd->mail->shown), text);
+
+ pd->summary->preferences->display_folders = g_list_prepend (pd->summary->preferences->display_folders,
+ g_strdup (rd->uri + 7));
+ gtk_clist_set_row_data (GTK_CLIST (pd->mail->shown), row, pd->summary->preferences->display_folders);
+
+ gnome_property_box_changed (pd->box);
}
static void
-fill_mail_etable (ESummaryTable *est,
- PropertyData *pd)
+mail_remove_clicked_cb (GtkButton *button,
+ PropertyData *pd)
{
- e_summary_mail_fill_list (est);
+ int row;
+ GList *p;
+
+ row = GPOINTER_TO_INT (GTK_CLIST (pd->mail->shown)->selection->data);
+ p = gtk_clist_get_row_data (GTK_CLIST (pd->mail->shown), row);
+
+ gtk_clist_remove (GTK_CLIST (pd->mail->shown), row);
+ pd->summary->preferences->display_folders = g_list_remove_link (pd->summary->preferences->display_folders, p);
+ g_free (p->data);
+ g_list_free (p);
+
+ gtk_clist_select_row (GTK_CLIST (pd->mail->shown), row, 0);
+ gnome_property_box_changed (pd->box);
}
static void
mail_show_full_path_toggled_cb (GtkToggleButton *tb,
PropertyData *pd)
{
- global_preferences->show_full_path = gtk_toggle_button_get_active (tb);
+ pd->summary->preferences->show_full_path = gtk_toggle_button_get_active (tb);
+ gnome_property_box_changed (pd->box);
+}
+
+static void
+rdf_all_select_row_cb (GtkCList *clist,
+ int row,
+ int column,
+ GdkEvent *event,
+ PropertyData *pd)
+{
+ struct _RDFInfo *info;
+ GList *p;
+
+ info = gtk_clist_get_row_data (GTK_CLIST (pd->rdf->all), row);
+ g_return_if_fail (info != NULL);
+
+ for (p = pd->summary->preferences->rdf_urls; p; p = p->next) {
+ if (strcmp (p->data, info->url) == 0) {
+ /* Found it already */
+ return;
+ }
+ }
+
+ gtk_widget_set_sensitive (pd->rdf->add, TRUE);
+}
+
+static void
+rdf_all_unselect_row_cb (GtkCList *clist,
+ int row,
+ int column,
+ GdkEvent *event,
+ PropertyData *pd)
+{
+ if (GTK_CLIST (pd->rdf->all)->selection == NULL) {
+ gtk_widget_set_sensitive (pd->rdf->add, FALSE);
+ }
+}
- evolution_config_control_changed (pd->config_control);
+static void
+rdf_shown_select_row_cb (GtkCList *clist,
+ int row,
+ int column,
+ GdkEvent *event,
+ PropertyData *pd)
+{
+ gtk_widget_set_sensitive (pd->rdf->remove, TRUE);
+}
+
+static void
+rdf_shown_unselect_row_cb (GtkCList *clist,
+ int row,
+ int column,
+ GdkEvent *event,
+ PropertyData *pd)
+{
+ if (GTK_CLIST (pd->rdf->shown)->selection == NULL) {
+ gtk_widget_set_sensitive (pd->rdf->remove, FALSE);
+ }
+}
+
+static void
+rdf_add_clicked_cb (GtkButton *button,
+ PropertyData *pd)
+{
+ struct _RDFInfo *info;
+ GList *p, *rows;
+ char *text[1];
+ int row;
+
+ for (rows = GTK_CLIST (pd->rdf->all)->selection; rows; rows = rows->next) {
+ row = GPOINTER_TO_INT (rows->data);
+ info = gtk_clist_get_row_data (GTK_CLIST (pd->rdf->all), row);
+
+ text[0] = info->name;
+
+ for (p = pd->summary->preferences->rdf_urls; p; p = p->next) {
+ if (strcmp (p->data, info->url) == 0) {
+ /* Found it already */
+ return;
+ }
+ }
+
+
+ pd->summary->preferences->rdf_urls = g_list_prepend (pd->summary->preferences->rdf_urls, g_strdup (info->url));
+ row = gtk_clist_prepend (GTK_CLIST (pd->rdf->shown), text);
+ gtk_clist_set_row_data (GTK_CLIST (pd->rdf->shown), row,
+ pd->summary->preferences->rdf_urls);
+ }
+ gnome_property_box_changed (pd->box);
+}
+
+static void
+rdf_remove_clicked_cb (GtkButton *button,
+ PropertyData *pd)
+{
+ GList *p;
+ int row;
+
+ row = GPOINTER_TO_INT (GTK_CLIST (pd->rdf->shown)->selection->data);
+ p = gtk_clist_get_row_data (GTK_CLIST (pd->rdf->shown), row);
+ gtk_clist_remove (GTK_CLIST (pd->rdf->shown), row);
+
+ pd->summary->preferences->rdf_urls = g_list_remove_link (pd->summary->preferences->rdf_urls, p);
+ g_free (p->data);
+ g_list_free (p);
+
+ gtk_clist_select_row (GTK_CLIST (pd->rdf->shown), row, 0);
+ gnome_property_box_changed (pd->box);
+}
+
+static void
+add_dialog_clicked_cb (GnomeDialog *dialog,
+ int button,
+ PropertyData *pd)
+{
+ struct _RDFInfo *info;
+ char *url, *name;
+ char *text[1];
+ int row;
+
+ if (button == 1) {
+ gnome_dialog_close (dialog);
+ return;
+ }
+
+ url = gtk_entry_get_text (GTK_ENTRY (pd->new_url_entry));
+ if (url == NULL || *text == 0) {
+ gnome_dialog_close (dialog);
+ return;
+ }
+ name = gtk_entry_get_text (GTK_ENTRY (pd->new_name_entry));
+ info = g_new (struct _RDFInfo, 1);
+ info->url = g_strdup (url);
+ info->name = name ? g_strdup (name) : g_strdup (url);
+
+ text[0] = info->name;
+ row = gtk_clist_append (GTK_CLIST (pd->rdf->all), text);
+ gtk_clist_set_row_data_full (GTK_CLIST (pd->rdf->all), row, info,
+ (GdkDestroyNotify) free_rdf_info);
+ pd->rdf->known = g_list_append (pd->rdf->known, info);
+
+ save_known_rdfs (pd->rdf->known);
+ pd->summary->preferences->rdf_urls = g_list_prepend (pd->summary->preferences->rdf_urls, g_strdup (info->url));
+ row = gtk_clist_prepend (GTK_CLIST (pd->rdf->shown), text);
+ gtk_clist_set_row_data (GTK_CLIST (pd->rdf->shown), row,
+ pd->summary->preferences->rdf_urls);
+
+
+ gnome_property_box_changed (pd->box);
+ gnome_dialog_close (dialog);
}
-#if 0
static void
rdf_new_url_clicked_cb (GtkButton *button,
PropertyData *pd)
@@ -735,58 +971,132 @@ rdf_new_url_clicked_cb (GtkButton *button,
hbox, TRUE, TRUE, 0);
gtk_widget_show_all (add_dialog);
}
-#endif
static void
rdf_refresh_value_changed_cb (GtkAdjustment *adj,
PropertyData *pd)
{
- global_preferences->rdf_refresh_time = (int) adj->value;
- evolution_config_control_changed (pd->config_control);
+ pd->summary->preferences->rdf_refresh_time = (int) adj->value;
+ gnome_property_box_changed (pd->box);
}
static void
rdf_limit_value_changed_cb (GtkAdjustment *adj,
PropertyData *pd)
{
- global_preferences->limit = (int) adj->value;
- evolution_config_control_changed (pd->config_control);
+ pd->summary->preferences->limit = (int) adj->value;
+ gnome_property_box_changed (pd->box);
+}
+
+static void
+weather_all_select_row_cb (GtkCTree *ctree,
+ GtkCTreeNode *row,
+ int column,
+ PropertyData *pd)
+{
+ ESummaryWeatherLocation *location;
+ GList *p;
+
+ location = gtk_ctree_node_get_row_data (GTK_CTREE (pd->weather->all), row);
+ if (location == NULL) {
+ gtk_ctree_unselect (ctree, row);
+ return;
+ }
+
+ for (p = pd->summary->preferences->stations; p; p = p->next) {
+ if (strcmp (location->code, p->data) == 0) {
+ return; /* Already have it */
+ }
+ }
+
+ gtk_widget_set_sensitive (pd->weather->add, TRUE);
+ pd->weather->selected_node = row;
}
static void
-mail_etable_item_changed_cb (ESummaryTable *est,
- ETreePath path,
+weather_all_unselect_row_cb (GtkCList *clist,
+ GtkCTreeNode *row,
+ int column,
PropertyData *pd)
{
- if (pd->config_control != NULL) {
- evolution_config_control_changed (pd->config_control);
+ if (clist->selection == NULL) {
+ gtk_widget_set_sensitive (pd->weather->add, FALSE);
}
+ pd->weather->selected_node = NULL;
}
static void
-rdf_etable_item_changed_cb (ESummaryShown *ess,
- PropertyData *pd)
+weather_shown_select_row_cb (GtkCList *clist,
+ int row,
+ int column,
+ GdkEvent *event,
+ PropertyData *pd)
+{
+ gtk_widget_set_sensitive (pd->weather->remove, TRUE);
+}
+
+static void
+weather_shown_unselect_row_cb (GtkCList *clist,
+ int row,
+ int column,
+ GdkEvent *event,
+ PropertyData *pd)
{
- if (pd->config_control != NULL) {
- evolution_config_control_changed (pd->config_control);
+ if (clist->selection == NULL) {
+ gtk_widget_set_sensitive (pd->weather->remove, FALSE);
}
}
static void
-weather_etable_item_changed_cb (ESummaryShown *ess,
- PropertyData *pd)
+weather_add_clicked_cb (GtkButton *button,
+ PropertyData *pd)
{
- if (pd->config_control != NULL) {
- evolution_config_control_changed (pd->config_control);
+ ESummaryWeatherLocation *location;
+ GList *p;
+ char *text[1];
+
+ location = gtk_ctree_node_get_row_data (GTK_CTREE (pd->weather->all), pd->weather->selected_node);
+
+ g_return_if_fail (location != NULL);
+
+ for (p = pd->summary->preferences->stations; p; p = p->next) {
+ if (strcmp (location->code, p->data) == 0) {
+ return; /* Already have it */
+ }
}
+
+ pd->summary->preferences->stations = g_list_prepend (pd->summary->preferences->stations, g_strdup (location->code));
+ text[0] = location->name;
+ gtk_clist_prepend (GTK_CLIST (pd->weather->shown), text);
+
+ gnome_property_box_changed (pd->box);
+}
+
+static void
+weather_remove_clicked_cb (GtkButton *button,
+ PropertyData *pd)
+{
+ int row;
+ GList *p;
+
+ row = GPOINTER_TO_INT (GTK_CLIST (pd->weather->shown)->selection->data);
+ p = g_list_nth (pd->summary->preferences->stations, row);
+ gtk_clist_remove (GTK_CLIST (pd->weather->shown), row);
+
+ pd->summary->preferences->stations = g_list_remove_link (pd->summary->preferences->stations, p);
+ g_free (p->data);
+ g_list_free (p);
+
+ gtk_clist_select_row (GTK_CLIST (pd->weather->shown), row, 0);
+ gnome_property_box_changed (pd->box);
}
static void
weather_refresh_value_changed_cb (GtkAdjustment *adj,
PropertyData *pd)
{
- global_preferences->weather_refresh_time = (int) adj->value;
- evolution_config_control_changed (pd->config_control);
+ pd->summary->preferences->weather_refresh_time = (int) adj->value;
+ gnome_property_box_changed (pd->box);
}
static void
@@ -797,8 +1107,8 @@ weather_metric_toggled_cb (GtkToggleButton *tb,
return;
}
- global_preferences->units = UNITS_METRIC;
- evolution_config_control_changed (pd->config_control);
+ pd->summary->preferences->units = UNITS_METRIC;
+ gnome_property_box_changed (pd->box);
}
static void
@@ -809,8 +1119,8 @@ weather_imperial_toggled_cb (GtkToggleButton *tb,
return;
}
- global_preferences->units = UNITS_IMPERIAL;
- evolution_config_control_changed (pd->config_control);
+ pd->summary->preferences->units = UNITS_IMPERIAL;
+ gnome_property_box_changed (pd->box);
}
@@ -822,8 +1132,8 @@ calendar_one_toggled_cb (GtkToggleButton *tb,
return;
}
- global_preferences->days = E_SUMMARY_CALENDAR_ONE_DAY;
- evolution_config_control_changed (pd->config_control);
+ pd->summary->preferences->days = E_SUMMARY_CALENDAR_ONE_DAY;
+ gnome_property_box_changed (pd->box);
}
static void
@@ -834,8 +1144,8 @@ calendar_five_toggled_cb (GtkToggleButton *tb,
return;
}
- global_preferences->days = E_SUMMARY_CALENDAR_FIVE_DAYS;
- evolution_config_control_changed (pd->config_control);
+ pd->summary->preferences->days = E_SUMMARY_CALENDAR_FIVE_DAYS;
+ gnome_property_box_changed (pd->box);
}
static void
@@ -846,8 +1156,8 @@ calendar_week_toggled_cb (GtkToggleButton *tb,
return;
}
- global_preferences->days = E_SUMMARY_CALENDAR_ONE_WEEK;
- evolution_config_control_changed (pd->config_control);
+ pd->summary->preferences->days = E_SUMMARY_CALENDAR_ONE_WEEK;
+ gnome_property_box_changed (pd->box);
}
static void
@@ -858,8 +1168,8 @@ calendar_month_toggled_cb (GtkToggleButton *tb,
return;
}
- global_preferences->days = E_SUMMARY_CALENDAR_ONE_MONTH;
- evolution_config_control_changed (pd->config_control);
+ pd->summary->preferences->days = E_SUMMARY_CALENDAR_ONE_MONTH;
+ gnome_property_box_changed (pd->box);
}
static void
@@ -870,8 +1180,8 @@ calendar_all_toggled_cb (GtkToggleButton *tb,
return;
}
- global_preferences->show_tasks = E_SUMMARY_CALENDAR_ALL_TASKS;
- evolution_config_control_changed (pd->config_control);
+ pd->summary->preferences->show_tasks = E_SUMMARY_CALENDAR_ALL_TASKS;
+ gnome_property_box_changed (pd->box);
}
static void
@@ -882,8 +1192,23 @@ calendar_today_toggled_cb (GtkToggleButton *tb,
return;
}
- global_preferences->show_tasks = E_SUMMARY_CALENDAR_TODAYS_TASKS;
- evolution_config_control_changed (pd->config_control);
+ pd->summary->preferences->show_tasks = E_SUMMARY_CALENDAR_TODAYS_TASKS;
+ gnome_property_box_changed (pd->box);
+}
+
+static void
+construct_pixmap_button (GladeXML *xml,
+ const char *id,
+ const char *image)
+{
+ GtkWidget *box, *pixmap;
+
+ box = glade_xml_get_widget (xml, id);
+
+ pixmap = gnome_stock_pixmap_widget (NULL, image);
+ gtk_box_pack_start (GTK_BOX (box), pixmap, TRUE, TRUE, 0);
+
+ gtk_widget_show (pixmap);
}
static gboolean
@@ -896,67 +1221,123 @@ make_property_dialog (PropertyData *pd)
/* Mail */
mail = pd->mail = g_new (struct _MailPage, 1);
- mail->tmp_list = NULL;
-
- mail->etable = glade_xml_get_widget (pd->xml, "mail-custom");
- g_return_val_if_fail (mail->etable != NULL, FALSE);
- fill_mail_etable (E_SUMMARY_TABLE (mail->etable), pd);
-
- gtk_signal_connect (GTK_OBJECT (mail->etable), "item-changed",
- GTK_SIGNAL_FUNC (mail_etable_item_changed_cb), pd);
- mail->model = E_SUMMARY_TABLE (mail->etable)->model;
+ /* I think this should be a fancy bonobo thingy */
+ mail->all = glade_xml_get_widget (pd->xml, "clist7");
+ g_return_val_if_fail (mail->all != NULL, FALSE);
+ fill_mail_all_clist (GTK_CLIST (mail->all), pd);
+ gtk_signal_connect (GTK_OBJECT (mail->all), "select-row",
+ GTK_SIGNAL_FUNC (mail_all_select_row_cb), pd);
+ gtk_signal_connect (GTK_OBJECT (mail->all), "unselect-row",
+ GTK_SIGNAL_FUNC (mail_all_unselect_row_cb), pd);
+
+ mail->shown = glade_xml_get_widget (pd->xml, "clist1");
+ g_return_val_if_fail (mail->shown != NULL, FALSE);
+ fill_mail_shown_clist (GTK_CLIST (mail->shown), pd);
+ gtk_signal_connect (GTK_OBJECT (mail->shown), "select-row",
+ GTK_SIGNAL_FUNC (mail_shown_select_row_cb), pd);
+ gtk_signal_connect (GTK_OBJECT (mail->shown), "unselect-row",
+ GTK_SIGNAL_FUNC (mail_shown_unselect_row_cb), pd);
+
mail->fullpath = glade_xml_get_widget (pd->xml, "checkbutton1");
g_return_val_if_fail (mail->fullpath != NULL, FALSE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (mail->fullpath),
- global_preferences->show_full_path);
+ pd->summary->preferences->show_full_path);
gtk_signal_connect (GTK_OBJECT (mail->fullpath), "toggled",
GTK_SIGNAL_FUNC (mail_show_full_path_toggled_cb), pd);
+ mail->add = glade_xml_get_widget (pd->xml, "button4");
+ g_return_val_if_fail (mail->add != NULL, FALSE);
+ construct_pixmap_button (pd->xml, "hbox-mailadd",
+ GNOME_STOCK_BUTTON_NEXT);
+ gtk_signal_connect (GTK_OBJECT (mail->add), "clicked",
+ GTK_SIGNAL_FUNC (mail_add_clicked_cb), pd);
+
+ mail->remove = glade_xml_get_widget (pd->xml, "button5");
+ g_return_val_if_fail (mail->remove != NULL, FALSE);
+ construct_pixmap_button (pd->xml, "hbox-mailremove",
+ GNOME_STOCK_BUTTON_PREV);
+ gtk_signal_connect (GTK_OBJECT (mail->remove), "clicked",
+ GTK_SIGNAL_FUNC (mail_remove_clicked_cb), pd);
+
/* RDF */
rdf = pd->rdf = g_new (struct _RDFPage, 1);
rdf->known = NULL;
- rdf->tmp_list = NULL;
- rdf->default_hash = NULL;
-
- rdf->etable = glade_xml_get_widget (pd->xml, "rdf-custom");
- g_return_val_if_fail (rdf->etable != NULL, FALSE);
+ rdf->all = glade_xml_get_widget (pd->xml, "clist6");
+ g_return_val_if_fail (rdf->all != NULL, FALSE);
+ gtk_signal_connect (GTK_OBJECT (rdf->all), "select-row",
+ GTK_SIGNAL_FUNC (rdf_all_select_row_cb), pd);
+ gtk_signal_connect (GTK_OBJECT (rdf->all), "unselect-row",
+ GTK_SIGNAL_FUNC (rdf_all_unselect_row_cb), pd);
+ fill_rdf_all_clist (GTK_CLIST (rdf->all), pd);
+
+ rdf->shown = glade_xml_get_widget (pd->xml, "clist5");
+ g_return_val_if_fail (rdf->shown != NULL, FALSE);
+ gtk_signal_connect (GTK_OBJECT (rdf->shown), "select-row",
+ GTK_SIGNAL_FUNC (rdf_shown_select_row_cb), pd);
+ gtk_signal_connect (GTK_OBJECT (rdf->shown), "unselect-row",
+ GTK_SIGNAL_FUNC (rdf_shown_unselect_row_cb), pd);
+ fill_rdf_shown_clist (GTK_CLIST (rdf->shown), pd);
- gtk_signal_connect (GTK_OBJECT (rdf->etable), "item-changed",
- GTK_SIGNAL_FUNC (rdf_etable_item_changed_cb), pd);
-
- fill_rdf_etable (rdf->etable, pd);
rdf->refresh = glade_xml_get_widget (pd->xml, "spinbutton1");
g_return_val_if_fail (rdf->refresh != NULL, FALSE);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (rdf->refresh),
- (float) global_preferences->rdf_refresh_time);
+ (float) pd->summary->preferences->rdf_refresh_time);
gtk_signal_connect (GTK_OBJECT (GTK_SPIN_BUTTON (rdf->refresh)->adjustment), "value_changed",
GTK_SIGNAL_FUNC (rdf_refresh_value_changed_cb), pd);
rdf->limit = glade_xml_get_widget (pd->xml, "spinbutton4");
g_return_val_if_fail (rdf->limit != NULL, FALSE);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (rdf->limit),
- (float) global_preferences->limit);
+ (float) pd->summary->preferences->limit);
gtk_signal_connect (GTK_OBJECT (GTK_SPIN_BUTTON (rdf->limit)->adjustment), "value_changed",
GTK_SIGNAL_FUNC (rdf_limit_value_changed_cb), pd);
- /* Weather */
- weather = pd->weather = g_new (struct _WeatherPage, 1);
- weather->tmp_list = NULL;
-
- weather->etable = glade_xml_get_widget (pd->xml, "weather-custom");
- g_return_val_if_fail (weather->etable != NULL, FALSE);
+ rdf->add = glade_xml_get_widget (pd->xml, "button9");
+ g_return_val_if_fail (rdf->add != NULL, FALSE);
+
+ construct_pixmap_button (pd->xml, "hbox-newsadd",
+ GNOME_STOCK_BUTTON_NEXT);
+ gtk_widget_set_sensitive (rdf->add, FALSE);
+ gtk_signal_connect (GTK_OBJECT (rdf->add), "clicked",
+ GTK_SIGNAL_FUNC (rdf_add_clicked_cb), pd);
- gtk_signal_connect (GTK_OBJECT (weather->etable), "item-changed",
- GTK_SIGNAL_FUNC (weather_etable_item_changed_cb),
- pd);
+ rdf->remove = glade_xml_get_widget (pd->xml, "button10");
+ g_return_val_if_fail (rdf->remove != NULL, FALSE);
- fill_weather_etable (E_SUMMARY_SHOWN (weather->etable), pd);
+ construct_pixmap_button (pd->xml, "hbox-newsremove",
+ GNOME_STOCK_BUTTON_PREV);
+ gtk_widget_set_sensitive (rdf->remove, FALSE);
+ gtk_signal_connect (GTK_OBJECT (rdf->remove), "clicked",
+ GTK_SIGNAL_FUNC (rdf_remove_clicked_cb), pd);
+
+ rdf->new_url = glade_xml_get_widget (pd->xml, "button11");
+ g_return_val_if_fail (rdf->new_url != NULL, FALSE);
+ gtk_signal_connect (GTK_OBJECT (rdf->new_url), "clicked",
+ GTK_SIGNAL_FUNC (rdf_new_url_clicked_cb), pd);
+
+ /* Weather */
+ weather = pd->weather = g_new (struct _WeatherPage, 1);
+ weather->all = glade_xml_get_widget (pd->xml, "ctree1");
+ g_return_val_if_fail (weather->all != NULL, FALSE);
+ fill_weather_all_ctree (GTK_CTREE (weather->all));
+ gtk_signal_connect (GTK_OBJECT (weather->all), "tree-select-row",
+ GTK_SIGNAL_FUNC (weather_all_select_row_cb), pd);
+ gtk_signal_connect (GTK_OBJECT (weather->all), "tree-unselect-row",
+ GTK_SIGNAL_FUNC (weather_all_unselect_row_cb), pd);
+
+ weather->shown = glade_xml_get_widget (pd->xml, "clist3");
+ g_return_val_if_fail (weather->shown != NULL, FALSE);
+ fill_weather_shown_clist (GTK_CLIST (weather->shown), pd);
+ gtk_signal_connect (GTK_OBJECT (weather->shown), "select-row",
+ GTK_SIGNAL_FUNC (weather_shown_select_row_cb), pd);
+ gtk_signal_connect (GTK_OBJECT (weather->shown), "unselect-row",
+ GTK_SIGNAL_FUNC (weather_shown_unselect_row_cb), pd);
weather->refresh = glade_xml_get_widget (pd->xml, "spinbutton5");
g_return_val_if_fail (weather->refresh != NULL, FALSE);
gtk_spin_button_set_value (GTK_SPIN_BUTTON (weather->refresh),
- (float) global_preferences->weather_refresh_time);
+ (float) pd->summary->preferences->weather_refresh_time);
gtk_signal_connect (GTK_OBJECT (GTK_SPIN_BUTTON (weather->refresh)->adjustment),
"value-changed",
GTK_SIGNAL_FUNC (weather_refresh_value_changed_cb),
@@ -964,83 +1345,90 @@ make_property_dialog (PropertyData *pd)
weather->metric = glade_xml_get_widget (pd->xml, "radiobutton7");
g_return_val_if_fail (weather->metric != NULL, FALSE);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (weather->metric),
- (global_preferences->units == UNITS_METRIC));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (weather->metric), (pd->summary->preferences->units == UNITS_METRIC));
gtk_signal_connect (GTK_OBJECT (weather->metric), "toggled",
GTK_SIGNAL_FUNC (weather_metric_toggled_cb), pd);
weather->imperial = glade_xml_get_widget (pd->xml, "radiobutton8");
g_return_val_if_fail (weather->imperial != NULL, FALSE);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (weather->imperial),
- (global_preferences->units == UNITS_IMPERIAL));
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (weather->imperial), (pd->summary->preferences->units == UNITS_IMPERIAL));
gtk_signal_connect (GTK_OBJECT (weather->imperial), "toggled",
GTK_SIGNAL_FUNC (weather_imperial_toggled_cb), pd);
+ weather->add = glade_xml_get_widget (pd->xml, "button6");
+ g_return_val_if_fail (weather->add != NULL, FALSE);
+
+ construct_pixmap_button (pd->xml, "hbox-weatheradd",
+ GNOME_STOCK_BUTTON_NEXT);
+ gtk_signal_connect (GTK_OBJECT (weather->add), "clicked",
+ GTK_SIGNAL_FUNC (weather_add_clicked_cb), pd);
+
+ weather->remove = glade_xml_get_widget (pd->xml, "button7");
+ g_return_val_if_fail (weather->remove != NULL, FALSE);
+
+ construct_pixmap_button (pd->xml, "hbox-weatherremove",
+ GNOME_STOCK_BUTTON_PREV);
+ gtk_signal_connect (GTK_OBJECT (weather->remove), "clicked",
+ GTK_SIGNAL_FUNC (weather_remove_clicked_cb), pd);
+
/* Calendar */
calendar = pd->calendar = g_new (struct _CalendarPage, 1);
calendar->one = glade_xml_get_widget (pd->xml, "radiobutton3");
g_return_val_if_fail (calendar->one != NULL, FALSE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (calendar->one),
- (global_preferences->days == E_SUMMARY_CALENDAR_ONE_DAY));
+ (pd->summary->preferences->days == E_SUMMARY_CALENDAR_ONE_DAY));
gtk_signal_connect (GTK_OBJECT (calendar->one), "toggled",
GTK_SIGNAL_FUNC (calendar_one_toggled_cb), pd);
calendar->five = glade_xml_get_widget (pd->xml, "radiobutton4");
g_return_val_if_fail (calendar->five != NULL, FALSE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (calendar->five),
- (global_preferences->days == E_SUMMARY_CALENDAR_FIVE_DAYS));
+ (pd->summary->preferences->days == E_SUMMARY_CALENDAR_FIVE_DAYS));
gtk_signal_connect (GTK_OBJECT (calendar->five), "toggled",
GTK_SIGNAL_FUNC (calendar_five_toggled_cb), pd);
calendar->week = glade_xml_get_widget (pd->xml, "radiobutton5");
g_return_val_if_fail (calendar->week != NULL, FALSE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (calendar->week),
- (global_preferences->days == E_SUMMARY_CALENDAR_ONE_WEEK));
+ (pd->summary->preferences->days == E_SUMMARY_CALENDAR_ONE_WEEK));
gtk_signal_connect (GTK_OBJECT (calendar->week), "toggled",
GTK_SIGNAL_FUNC (calendar_week_toggled_cb), pd);
calendar->month = glade_xml_get_widget (pd->xml, "radiobutton6");
g_return_val_if_fail (calendar->month != NULL, FALSE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (calendar->month),
- (global_preferences->days == E_SUMMARY_CALENDAR_ONE_MONTH));
+ (pd->summary->preferences->days == E_SUMMARY_CALENDAR_ONE_MONTH));
gtk_signal_connect (GTK_OBJECT (calendar->month), "toggled",
GTK_SIGNAL_FUNC (calendar_month_toggled_cb), pd);
calendar->all = glade_xml_get_widget (pd->xml, "radiobutton1");
g_return_val_if_fail (calendar->all != NULL, FALSE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (calendar->all),
- (global_preferences->show_tasks == E_SUMMARY_CALENDAR_ALL_TASKS));
+ (pd->summary->preferences->show_tasks == E_SUMMARY_CALENDAR_ALL_TASKS));
gtk_signal_connect (GTK_OBJECT (calendar->all), "toggled",
GTK_SIGNAL_FUNC (calendar_all_toggled_cb), pd);
calendar->today = glade_xml_get_widget (pd->xml, "radiobutton2");
g_return_val_if_fail (calendar->today != NULL, FALSE);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (calendar->today),
- (global_preferences->show_tasks == E_SUMMARY_CALENDAR_TODAYS_TASKS));
+ (pd->summary->preferences->show_tasks == E_SUMMARY_CALENDAR_TODAYS_TASKS));
gtk_signal_connect (GTK_OBJECT(calendar->today), "toggled",
GTK_SIGNAL_FUNC (calendar_today_toggled_cb), pd);
return TRUE;
}
-
+
static void
free_property_dialog (PropertyData *pd)
{
if (pd->rdf) {
g_list_free (pd->rdf->known);
-
- free_str_list (pd->rdf->tmp_list);
- g_list_free (pd->rdf->tmp_list);
g_free (pd->rdf);
}
if (pd->mail) {
- free_str_list (pd->mail->tmp_list);
- g_list_free (pd->mail->tmp_list);
g_free (pd->mail);
}
if (pd->weather) {
- free_str_list (pd->weather->tmp_list);
- g_list_free (pd->weather->tmp_list);
g_free (pd->weather);
}
if (pd->calendar) {
@@ -1050,176 +1438,80 @@ free_property_dialog (PropertyData *pd)
if (pd->xml) {
gtk_object_unref (GTK_OBJECT (pd->xml));
}
+ if (pd->summary) {
+ gtk_object_unref (GTK_OBJECT (pd->summary));
+ }
g_free (pd);
}
static void
-maybe_add_to_shown (gpointer key,
- gpointer value,
- gpointer data)
+property_box_clicked_cb (GnomeDialog *dialog,
+ int page_num,
+ PropertyData *pd)
{
- ESummaryTableModelEntry *item;
- GList **list;
-
- item = (ESummaryTableModelEntry *) value;
- list = (GList **) data;
-
- if (item->shown == TRUE) {
- *list = g_list_prepend (*list, g_strdup (item->location));
+ if (page_num == -1) {
+ e_summary_reconfigure (pd->summary);
}
}
-
-/* Prototypes to shut gcc up */
-GtkWidget *e_summary_preferences_make_mail_table (PropertyData *pd);
-GtkWidget *e_summary_preferences_make_rdf_table (PropertyData *pd);
-GtkWidget *e_summary_preferences_make_weather_table (PropertyData *pd);
-
-GtkWidget *
-e_summary_preferences_make_mail_table (PropertyData *pd)
-{
- return e_summary_table_new (g_hash_table_new (NULL, NULL));
-}
-
-GtkWidget *
-e_summary_preferences_make_rdf_table (PropertyData *pd)
-{
- return e_summary_shown_new ();
-}
-
-GtkWidget *
-e_summary_preferences_make_weather_table (PropertyData *pd)
-{
- return e_summary_shown_new ();
-}
-
-
-/* The factory for the ConfigControl. */
-
static void
-add_shown_to_list (gpointer key,
- gpointer value,
- gpointer data)
+property_box_destroy_cb (GtkObject *object,
+ PropertyData *pd)
{
- ESummaryShownModelEntry *item;
- GList **list;
-
- item = (ESummaryShownModelEntry *) value;
- list = (GList **) data;
+ if (pd->summary->old_prefs != NULL) {
+ e_summary_preferences_free (pd->summary->old_prefs);
+ pd->summary->old_prefs = NULL;
+ }
- *list = g_list_prepend (*list, g_strdup (item->location));
+ e_summary_preferences_save (pd->summary->preferences);
+ pd->summary->prefs_window = NULL;
+ free_property_dialog (pd);
}
-static void
-config_control_apply_cb (EvolutionConfigControl *control,
- void *data)
+void
+e_summary_configure (BonoboUIComponent *component,
+ gpointer userdata,
+ const char *cname)
{
+ ESummary *summary = userdata;
PropertyData *pd;
- pd = (PropertyData *) data;
-
- if (pd->rdf->tmp_list) {
- free_str_list (pd->rdf->tmp_list);
- g_list_free (pd->rdf->tmp_list);
- pd->rdf->tmp_list = NULL;
- }
- /* Take each news feed which is on and add it
- to the shown list */
- g_hash_table_foreach (E_SUMMARY_SHOWN (pd->rdf->etable)->shown_model,
- add_shown_to_list, &pd->rdf->tmp_list);
-
- if (global_preferences->rdf_urls) {
- free_str_list (global_preferences->rdf_urls);
- g_list_free (global_preferences->rdf_urls);
- }
-
- global_preferences->rdf_urls = copy_str_list (pd->rdf->tmp_list);
-
- /* Weather */
- if (pd->weather->tmp_list) {
- free_str_list (pd->weather->tmp_list);
- g_list_free (pd->weather->tmp_list);
- pd->weather->tmp_list = NULL;
- }
-
- g_hash_table_foreach (E_SUMMARY_SHOWN (pd->weather->etable)->shown_model,
- add_shown_to_list, &pd->weather->tmp_list);
- if (global_preferences->stations) {
- free_str_list (global_preferences->stations);
- g_list_free (global_preferences->stations);
- }
- global_preferences->stations = copy_str_list (pd->weather->tmp_list);
-
- /* Folders */
- if (pd->mail->tmp_list) {
- free_str_list (pd->mail->tmp_list);
- g_list_free (pd->mail->tmp_list);
- pd->mail->tmp_list = NULL;
- }
- g_hash_table_foreach (pd->mail->model, maybe_add_to_shown, &pd->mail->tmp_list);
-
- if (global_preferences->display_folders) {
- free_str_list (global_preferences->display_folders);
- g_list_free (global_preferences->display_folders);
+ if (summary->prefs_window != NULL) {
+ gdk_window_raise (summary->prefs_window->window);
+ gdk_window_show (summary->prefs_window->window);
+ return;
}
- global_preferences->display_folders = copy_str_list (pd->mail->tmp_list);
-
- e_summary_reconfigure_all ();
-}
-static void
-config_control_destroy_cb (EvolutionConfigControl *config_control,
- void *data)
-{
- PropertyData *pd;
+ pd = g_new0 (PropertyData, 1);
- pd = (PropertyData *) data;
+ gtk_object_ref (GTK_OBJECT (summary));
+ pd->summary = summary;
- e_summary_preferences_save (global_preferences);
- free_property_dialog (pd);
-}
-
-static BonoboObject *
-factory_fn (BonoboGenericFactory *generic_factory,
- void *data)
-{
- PropertyData *pd;
- GtkWidget *widget;
+ if (summary->old_prefs != NULL) {
+ e_summary_preferences_free (summary->old_prefs);
+ }
- pd = g_new0 (PropertyData, 1);
+ summary->old_prefs = e_summary_preferences_copy (summary->preferences);
pd->xml = glade_xml_new (EVOLUTION_GLADEDIR "/my-evolution.glade", NULL);
- g_return_val_if_fail (pd->xml != NULL, NULL);
+ g_return_if_fail (pd->xml != NULL);
+
+ pd->box = GNOME_PROPERTY_BOX (glade_xml_get_widget (pd->xml, "dialog1"));
+ gtk_widget_hide (pd->box->help_button);
+ summary->prefs_window = GTK_WIDGET (pd->box);
- widget = glade_xml_get_widget (pd->xml, "notebook");
- if (widget == NULL || ! make_property_dialog (pd)) {
+ gtk_window_set_title (GTK_WINDOW (pd->box), _("Summary Settings"));
+ if (make_property_dialog (pd) == FALSE) {
g_warning ("Missing some part of XML file");
free_property_dialog (pd);
- return NULL;
+ return;
}
- gtk_widget_ref (widget);
- gtk_container_remove (GTK_CONTAINER (widget->parent), widget);
-
- gtk_widget_show (widget);
- pd->config_control = evolution_config_control_new (widget);
-
- gtk_widget_unref (widget);
-
- gtk_signal_connect (GTK_OBJECT (pd->config_control), "apply",
- GTK_SIGNAL_FUNC (config_control_apply_cb), pd);
- gtk_signal_connect (GTK_OBJECT (pd->config_control), "destroy",
- GTK_SIGNAL_FUNC (config_control_destroy_cb), pd);
-
- return BONOBO_OBJECT (pd->config_control);
+ gtk_signal_connect (GTK_OBJECT (pd->box), "apply",
+ GTK_SIGNAL_FUNC (property_box_clicked_cb), pd);
+ gtk_signal_connect (GTK_OBJECT (pd->box), "destroy",
+ GTK_SIGNAL_FUNC (property_box_destroy_cb), pd);
+ gtk_widget_show (GTK_WIDGET (pd->box));
}
-gboolean
-e_summary_preferences_register_config_control_factory (void)
-{
- if (bonobo_generic_factory_new (FACTORY_ID, factory_fn, NULL) == NULL)
- return FALSE;
-
- return TRUE;
-}
diff --git a/my-evolution/e-summary-rdf.c b/my-evolution/e-summary-rdf.c
index 9863b34a0c..015f75246e 100644
--- a/my-evolution/e-summary-rdf.c
+++ b/my-evolution/e-summary-rdf.c
@@ -33,12 +33,8 @@
#include <libgnome/gnome-defs.h>
#include <libgnome/gnome-i18n.h>
-
-
#include <gal/widgets/e-unicode.h>
-
-#include <libsoup/soup.h>
-
+#include <libgnomevfs/gnome-vfs.h>
#include "e-summary.h"
struct _ESummaryRDF {
@@ -53,14 +49,14 @@ struct _ESummaryRDF {
typedef struct _RDF {
char *uri;
char *html;
+ GnomeVFSAsyncHandle *handle;
+ GString *string;
+ char *buffer;
xmlDocPtr cache;
ESummary *summary;
gboolean shown;
-
- /* Soup stuff */
- SoupMessage *message;
} RDF;
int xmlSubstituteEntitiesDefaultValue = 1;
@@ -318,35 +314,120 @@ display_doc (RDF *r)
}
static void
-message_finished (SoupMessage *msg,
- gpointer userdata)
+close_callback (GnomeVFSAsyncHandle *handle,
+ GnomeVFSResult result,
+ RDF *r)
{
+ ESummary *summary;
+ char *xml;
xmlDocPtr doc;
- RDF *r = (RDF *) userdata;
- if (SOUP_MESSAGE_IS_ERROR (msg)) {
- g_warning ("Message failed: %d\n%s", msg->errorcode,
- msg->errorphrase);
- r->cache = NULL;
- r->message = NULL;
+ summary = r->summary;
+ if (summary->rdf->connection->callback) {
+ ESummaryConnection *connection = summary->rdf->connection;
+ connection->callback (summary, connection->callback_closure);
+ }
- display_doc (r);
+ if (r->handle == NULL) {
+ g_free (r->buffer);
+ r->buffer = NULL;
+ g_string_free (r->string, TRUE);
+ r->string = NULL;
return;
}
+ r->handle = NULL;
+ g_free (r->buffer);
+ r->buffer = NULL;
+ xml = r->string->str;
+ g_string_free (r->string, FALSE);
+ r->string = NULL;
+
if (r->cache != NULL) {
xmlFreeDoc (r->cache);
r->cache = NULL;
}
- doc = xmlParseMemory (msg->response.body, msg->response.length);
+ doc = xmlParseMemory (xml, strlen (xml));
+#if 0
+ if (doc == NULL) {
+ g_free (r->html);
+ r->html = g_strdup ("<b>Error parsing XML</b>");
+
+ e_summary_draw (r->summary);
+ g_free (xml);
+ return;
+ }
+#endif
+ g_free (xml);
r->cache = doc;
- r->message = NULL;
- /* Display it */
+ /* Draw it */
display_doc (r);
}
+static void
+read_callback (GnomeVFSAsyncHandle *handle,
+ GnomeVFSResult result,
+ gpointer buffer,
+ GnomeVFSFileSize bytes_requested,
+ GnomeVFSFileSize bytes_read,
+ RDF *r)
+{
+ if (result != GNOME_VFS_OK && result != GNOME_VFS_ERROR_EOF) {
+ char *str;
+
+ g_free (r->html);
+ str = g_strdup_printf ("<b>%s:</b><br>%s", _("Error downloading RDF"),
+ r->uri);
+ r->html = e_utf8_from_locale_string (str);
+
+ g_free (str);
+
+ e_summary_draw (r->summary);
+ r->handle = NULL;
+ gnome_vfs_async_close (handle,
+ (GnomeVFSAsyncCloseCallback) close_callback, r);
+ return;
+ }
+
+ if (bytes_read == 0) {
+ gnome_vfs_async_close (handle,
+ (GnomeVFSAsyncCloseCallback) close_callback, r);
+ } else {
+ *((char *) buffer + bytes_read) = 0;
+ g_string_append (r->string, (const char *) buffer);
+ gnome_vfs_async_read (handle, buffer, 4095,
+ (GnomeVFSAsyncReadCallback) read_callback, r);
+ }
+}
+
+static void
+open_callback (GnomeVFSAsyncHandle *handle,
+ GnomeVFSResult result,
+ RDF *r)
+{
+ if (result != GNOME_VFS_OK) {
+ char *str;
+
+ r->handle = NULL;
+ g_free (r->html);
+ str = g_strdup_printf ("<b>%s:</b><br>%s", _("Error downloading RDF"),
+ r->uri);
+ r->html = e_utf8_from_locale_string (str);
+ g_free (str);
+
+ display_doc (r);
+ return;
+ }
+
+ r->string = g_string_new ("");
+ r->buffer = g_new (char, 4096);
+
+ gnome_vfs_async_read (handle, r->buffer, 4095,
+ (GnomeVFSAsyncReadCallback) read_callback, r);
+}
+
gboolean
e_summary_rdf_update (ESummary *summary)
{
@@ -358,24 +439,27 @@ e_summary_rdf_update (ESummary *summary)
}
for (r = summary->rdf->rdfs; r; r = r->next) {
- SoupContext *context;
RDF *rdf = r->data;
- if (rdf->message) {
- continue;
+ if (rdf->handle) {
+ gnome_vfs_async_cancel (rdf->handle);
+ rdf->handle = NULL;
}
- context = soup_context_get (rdf->uri);
- g_print ("Updating %s\n", rdf->uri);
- if (context == NULL) {
- g_warning ("Invalid URL: %s", rdf->uri);
- soup_context_unref (context);
- continue;
+ if (rdf->buffer) {
+ g_free (rdf->buffer);
+ rdf->buffer = NULL;
+ }
+
+ if (rdf->string) {
+ g_string_free (rdf->string, TRUE);
+ rdf->string = NULL;
}
- rdf->message = soup_message_new (context, SOUP_METHOD_GET);
- soup_context_unref (context);
- soup_message_queue (rdf->message, message_finished, rdf);
+ g_warning ("Opening %s", rdf->uri);
+ gnome_vfs_async_open (&rdf->handle, rdf->uri,
+ GNOME_VFS_OPEN_READ,
+ (GnomeVFSAsyncOpenCallback) open_callback, rdf);
}
return TRUE;
@@ -426,7 +510,7 @@ e_summary_rdf_count (ESummary *summary,
for (p = rdf->rdfs; p; p = p->next) {
RDF *r = p->data;
- if (r->message != NULL) {
+ if (r->handle != NULL) {
count++;
}
}
@@ -457,7 +541,7 @@ e_summary_rdf_add (ESummary *summary,
for (p = rdf->rdfs; p; p = p->next) {
RDF *r = p->data;
- if (r->message != NULL) {
+ if (r->handle != NULL) {
ESummaryConnectionData *d;
d = make_connection (r);
@@ -472,12 +556,17 @@ static void
rdf_free (RDF *r)
{
/* Stop the download */
- if (r->message) {
- soup_message_cancel (r->message);
+ if (r->handle) {
+ gnome_vfs_async_cancel (r->handle);
}
g_free (r->uri);
g_free (r->html);
+ g_free (r->buffer);
+
+ if (r->string) {
+ g_string_free (r->string, TRUE);
+ }
if (r->cache) {
xmlFreeDoc (r->cache);
@@ -510,9 +599,9 @@ e_summary_rdf_set_online (ESummary *summary,
RDF *r;
r = p->data;
- if (r->message) {
- soup_message_cancel (r->message);
- r->message = NULL;
+ if (r->handle) {
+ gnome_vfs_async_cancel (r->handle);
+ r->handle = NULL;
}
}
diff --git a/my-evolution/e-summary-tasks.c b/my-evolution/e-summary-tasks.c
index 4a96e565cb..a8c32b1db7 100644
--- a/my-evolution/e-summary-tasks.c
+++ b/my-evolution/e-summary-tasks.c
@@ -136,9 +136,8 @@ sort_uids (gconstpointer a,
CalComponent *comp_a, *comp_b;
CalClient *client = user_data;
CalClientGetStatus status;
- /* let undefined priorities be lowest ones */
- int lowest = 10, rv;
- int *pri_a, *pri_b;
+ CalComponentDateTime start_a, start_b;
+ int retval;
/* a after b then return > 0 */
@@ -150,22 +149,20 @@ sort_uids (gconstpointer a,
if (status != CAL_CLIENT_GET_SUCCESS)
return 1;
- cal_component_get_priority (comp_a, &pri_a);
- cal_component_get_priority (comp_b, &pri_b);
+ cal_component_get_dtstart (comp_a, &start_a);
+ cal_component_get_dtstart (comp_b, &start_b);
- if (pri_a == NULL)
- pri_a = &lowest;
- if (pri_b == NULL)
- pri_b = &lowest;
-
- rv = *pri_a - *pri_b;
+ if (start_a.value == NULL || start_b.value == NULL) {
+ /* Try to do something reasonable if one or more of our .values is NULL */
+ retval = (start_a.value ? 1 : 0) - (start_b.value ? 1 : 0);
+ } else {
+ retval = icaltime_compare (*start_a.value, *start_b.value);
+ }
- if (pri_a != &lowest)
- cal_component_free_priority (pri_a);
- if (pri_b != &lowest)
- cal_component_free_priority (pri_b);
+ cal_component_free_datetime (&start_a);
+ cal_component_free_datetime (&start_b);
- return rv;
+ return retval;
}
static GList *
@@ -256,12 +253,11 @@ generate_html (gpointer data)
g_free (s1);
g_free (s2);
-/* e_summary_draw (summary); */
+ e_summary_draw (summary);
return FALSE;
} else {
char *s;
- uids = cal_list_sort (uids, sort_uids, tasks->client);
string = g_string_new ("<dl><dt><img src=\"myevo-post-it.png\" align=\"middle\" "
"alt=\"\" width=\"48\" height=\"48\"> <b><a href=\"evolution:/local/Tasks\">");
s = e_utf8_from_locale_string (_("Tasks"));
@@ -316,7 +312,7 @@ generate_html (gpointer data)
tasks->html = string->str;
g_string_free (string, FALSE);
-/* e_summary_draw (summary); */
+ e_summary_draw (summary);
return FALSE;
}
diff --git a/my-evolution/e-summary.c b/my-evolution/e-summary.c
index be738d726f..f03caa338d 100644
--- a/my-evolution/e-summary.c
+++ b/my-evolution/e-summary.c
@@ -24,12 +24,6 @@
#include <config.h>
#endif
-#include <stdio.h>
-#include <errno.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-
#include <glib.h>
#include <libgnome/gnome-defs.h>
#include <libgnome/gnome-i18n.h>
@@ -40,6 +34,8 @@
#include <gtkhtml/htmlengine.h>
#include <gtkhtml/htmlselection.h>
+#include <libgnomevfs/gnome-vfs.h>
+
#include <gal/util/e-util.h>
#include <gal/widgets/e-gui-utils.h>
#include <gal/widgets/e-unicode.h>
@@ -72,8 +68,6 @@
extern char *evolution_dir;
-static GList *all_summaries = NULL;
-
static GtkObjectClass *e_summary_parent_class;
struct _ESummaryMailFolderInfo {
@@ -83,7 +77,15 @@ struct _ESummaryMailFolderInfo {
int unread;
};
+typedef struct _DownloadInfo {
+ GtkHTMLStream *stream;
+ char *uri;
+ char *buffer, *ptr;
+ guint32 bufsize;
+} DownloadInfo;
+
struct _ESummaryPrivate {
+ GNOME_Evolution_Shell shell;
GNOME_Evolution_ShellView shell_view_interface;
GtkWidget *html_scroller;
@@ -128,8 +130,6 @@ destroy (GtkObject *object)
return;
}
- all_summaries = g_list_remove (all_summaries, summary);
-
if (priv->pending_reload_tag) {
gtk_timeout_remove (priv->pending_reload_tag);
priv->pending_reload_tag = 0;
@@ -239,16 +239,6 @@ e_summary_draw (ESummary *summary)
g_string_free (string, TRUE);
}
-void
-e_summary_redraw_all (void)
-{
- GList *p;
-
- for (p = all_summaries; p; p = p->next) {
- e_summary_draw (E_SUMMARY (p->data));
- }
-}
-
static char *
e_pixmap_file (const char *filename)
{
@@ -300,6 +290,74 @@ struct _imgcache {
};
static void
+close_callback (GnomeVFSAsyncHandle *handle,
+ GnomeVFSResult result,
+ gpointer data)
+{
+ DownloadInfo *info = data;
+ struct _imgcache *img;
+
+ if (images_cache == NULL) {
+ images_cache = g_hash_table_new (g_str_hash, g_str_equal);
+ }
+
+ img = g_new (struct _imgcache, 1);
+ img->buffer = info->buffer;
+ img->bufsize = info->bufsize;
+
+ g_hash_table_insert (images_cache, info->uri, img);
+ g_free (info);
+}
+
+/* The way this behaves is a workaround for ximian bug 10235: loading
+ * the image into gtkhtml progressively will result in garbage being
+ * drawn, so we wait until we've read the whole thing and then write
+ * it all at once.
+ */
+static void
+read_callback (GnomeVFSAsyncHandle *handle,
+ GnomeVFSResult result,
+ gpointer buffer,
+ GnomeVFSFileSize bytes_requested,
+ GnomeVFSFileSize bytes_read,
+ gpointer data)
+{
+ DownloadInfo *info = data;
+
+ if (result != GNOME_VFS_OK && result != GNOME_VFS_ERROR_EOF) {
+ gtk_html_stream_close (info->stream, GTK_HTML_STREAM_ERROR);
+ gnome_vfs_async_close (handle, close_callback, info);
+ } else if (bytes_read == 0) {
+ gtk_html_stream_write (info->stream, info->buffer, info->bufsize);
+ gtk_html_stream_close (info->stream, GTK_HTML_STREAM_OK);
+ gnome_vfs_async_close (handle, close_callback, info);
+ } else {
+ bytes_read += info->ptr - info->buffer;
+ info->bufsize += 4096;
+ info->buffer = g_realloc (info->buffer, info->bufsize);
+ info->ptr = info->buffer + bytes_read;
+ gnome_vfs_async_read (handle, info->ptr, 4095, read_callback, info);
+ }
+}
+
+static void
+open_callback (GnomeVFSAsyncHandle *handle,
+ GnomeVFSResult result,
+ DownloadInfo *info)
+{
+ if (result != GNOME_VFS_OK) {
+ gtk_html_stream_close (info->stream, GTK_HTML_STREAM_ERROR);
+ g_free (info->uri);
+ g_free (info);
+ return;
+ }
+
+ info->bufsize = 4096;
+ info->buffer = info->ptr = g_new (char, info->bufsize);
+ gnome_vfs_async_read (handle, info->buffer, 4095, read_callback, info);
+}
+
+static void
e_summary_url_clicked (GtkHTML *html,
const char *url,
ESummary *summary)
@@ -329,52 +387,6 @@ e_summary_url_clicked (GtkHTML *html,
protocol_listener->listener (summary, url, protocol_listener->closure);
}
-static char *
-e_read_file_with_length (const char *filename,
- size_t *length)
-{
- int fd;
- struct stat stat_buf;
- char *buf;
- size_t bytes_read, size;
-
- g_return_val_if_fail (filename != NULL, NULL);
-
- fd = open (filename, O_RDONLY);
- g_return_val_if_fail (fd != -1, NULL);
-
- fstat (fd, &stat_buf);
- size = stat_buf.st_size;
- buf = g_new (char, size + 1);
-
- bytes_read = 0;
- while (bytes_read < size) {
- ssize_t rc;
-
- rc = read (fd, buf + bytes_read, size - bytes_read);
- if (rc < 0) {
- if (errno != EINTR) {
- close (fd);
- g_free (buf);
-
- return NULL;
- }
- } else if (rc == 0) {
- break;
- } else {
- bytes_read += rc;
- }
- }
-
- buf[bytes_read] = '\0';
-
- if (length) {
- *length = bytes_read;
- }
-
- return buf;
-}
-
static void
e_summary_url_requested (GtkHTML *html,
const char *url,
@@ -382,6 +394,8 @@ e_summary_url_requested (GtkHTML *html,
ESummary *summary)
{
char *filename;
+ GnomeVFSAsyncHandle *handle;
+ DownloadInfo *info;
struct _imgcache *img = NULL;
if (strncasecmp (url, "file:", 5) == 0) {
@@ -400,28 +414,19 @@ e_summary_url_requested (GtkHTML *html,
if (images_cache != NULL) {
img = g_hash_table_lookup (images_cache, filename);
- } else {
- images_cache = g_hash_table_new (g_str_hash, g_str_equal);
}
if (img == NULL) {
- size_t length;
- char *contents;
-
- contents = e_read_file_with_length (filename, &length);
- if (contents == NULL) {
- return;
- }
+ info = g_new (DownloadInfo, 1);
+ info->stream = stream;
+ info->uri = filename;
- img = g_new (struct _imgcache, 1);
- img->buffer = contents;
- img->bufsize = length;
-
- g_hash_table_insert (images_cache, g_strdup (filename), img);
+ gnome_vfs_async_open (&handle, filename, GNOME_VFS_OPEN_READ,
+ (GnomeVFSAsyncOpenCallback) open_callback, info);
+ } else {
+ gtk_html_stream_write (stream, img->buffer, img->bufsize);
+ gtk_html_stream_close (stream, GTK_HTML_STREAM_OK);
}
-
- gtk_html_stream_write (stream, img->buffer, img->bufsize);
- gtk_html_stream_close (stream, GTK_HTML_STREAM_OK);
}
static void
@@ -472,7 +477,7 @@ e_summary_init (ESummary *summary)
priv = summary->priv;
- priv->frozen = TRUE;
+ priv->frozen = FALSE;
priv->redraw_pending = FALSE;
priv->pending_reload_tag = 0;
@@ -508,6 +513,9 @@ e_summary_init (ESummary *summary)
priv->protocol_hash = NULL;
priv->connections = NULL;
+ summary->prefs_window = NULL;
+ e_summary_preferences_init (summary);
+
CORBA_exception_init (&ev);
db = bonobo_get_object ("wombat:", "Bonobo/ConfigDatabase", &ev);
if (BONOBO_EX (&ev) || db == CORBA_OBJECT_NIL) {
@@ -541,19 +549,16 @@ E_MAKE_TYPE (e_summary, "ESummary", ESummary, e_summary_class_init,
e_summary_init, PARENT_TYPE);
GtkWidget *
-e_summary_new (const GNOME_Evolution_Shell shell,
- ESummaryPrefs *prefs)
+e_summary_new (const GNOME_Evolution_Shell shell)
{
ESummary *summary;
summary = gtk_type_new (e_summary_get_type ());
- summary->shell = shell;
- /* Just get a pointer to the global preferences */
- summary->preferences = prefs;
-
+ summary->priv->shell = shell;
+
e_summary_add_protocol_listener (summary, "evolution", e_summary_evolution_protocol_listener, summary);
- e_summary_mail_init (summary);
+ e_summary_mail_init (summary, shell);
e_summary_calendar_init (summary);
e_summary_tasks_init (summary);
e_summary_rdf_init (summary);
@@ -561,7 +566,6 @@ e_summary_new (const GNOME_Evolution_Shell shell,
/* e_summary_draw (summary); */
- all_summaries = g_list_prepend (all_summaries, summary);
return GTK_WIDGET (summary);
}
@@ -735,6 +739,10 @@ e_summary_unset_message (ESummary *summary)
void
e_summary_reconfigure (ESummary *summary)
{
+ if (summary->mail != NULL) {
+ e_summary_mail_reconfigure (summary);
+ }
+
if (summary->rdf != NULL) {
e_summary_rdf_reconfigure (summary);
}
@@ -750,21 +758,6 @@ e_summary_reconfigure (ESummary *summary)
if (summary->tasks != NULL) {
e_summary_tasks_reconfigure (summary);
}
-
- e_summary_draw (summary);
-}
-
-void
-e_summary_reconfigure_all (void)
-{
- GList *p;
-
- /* This is here, because it only needs to be done once for all summaries */
- e_summary_mail_reconfigure ();
-
- for (p = all_summaries; p; p = p->next) {
- e_summary_reconfigure (E_SUMMARY (p->data));
- }
}
static gint
diff --git a/my-evolution/main.c b/my-evolution/main.c
index da9df3c23a..107b0919b8 100644
--- a/my-evolution/main.c
+++ b/my-evolution/main.c
@@ -43,6 +43,7 @@
#include <gconf/gconf.h>
#endif
+#include <libgnomevfs/gnome-vfs.h>
#include <glade/glade.h>
#include "component-factory.h"
@@ -71,8 +72,8 @@ main (int argc,
#endif
glade_gnome_init ();
+ gnome_vfs_init ();
- e_cursors_init ();
gtk_widget_push_visual (gdk_rgb_get_visual ());
gtk_widget_push_colormap (gdk_rgb_get_cmap ());
diff --git a/shell/ChangeLog b/shell/ChangeLog
index 05cc90f0c8..fa432cc51d 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,681 +1,11 @@
-2002-04-18 JP Rosevear <jpr@ximian.com>
-
- * evolution-shell-view.c (impl_ShellView_show_settings): emit
- show_settings signal
- (corba_class_init): assign epv method
- (class_init): add signal
-
- * evolution-shell-view.h: new signal
-
- * e-shell.c (init): init settings_dialog private member
- (settings_dialog_destroy_cb): reset dialog pointer
- (e_shell_show_settings): show the settings dialog, bring it to the
- front if one already exists for this shell
-
- * e-shell.h: new proto
-
- * e-shell-view.c (corba_interface_show_settings): implement
- showSettings method
- (setup_corba_interface): listen for show_settings signal
- (e_shell_view_show_settings): show the settings dialog
-
- * e-shell-view.h: new proto
-
- * e-shell-view-menu.c (command_settings): call
- e_shell_view_show_settings instead
-
- * Evolution-ShellView.idl: add showSettings method
-
-2002-04-17 Ettore Perazzoli <ettore@ximian.com>
-
- * e-shortcuts-view.c (impl_shortcut_drag_motion): New, override
- for EShortcutBar::shortcut_drag_motion.
- (impl_shortcut_drag_data_received): New, override for
- EShortcutBar::shortcut_drag_data_received.
- (class_init): Install the method overrides.
-
-2002-04-17 Christopher James Lahey <clahey@ximian.com>
-
- * e-activity-handler.c: Updated this to match the new EPopupMenu.
-
-2002-04-17 Ettore Perazzoli <ettore@ximian.com>
-
- * e-storage-set-view.c (handle_evolution_path_drag_motion):
- Removed.
- (impl_tree_drag_motion): Rewritten to use
- `e_folder_dnd_bridge_motion()'.
- (impl_tree_drag_data_received): Rewritten to use
- `e_folder_dnd_bridge_data_received()'.
- (convert_gdk_drag_action_to_corba): Removed.
- (convert_corba_drag_action_to_gdk): Removed.
- (find_matching_target_for_drag_context): Removed.
-
- * e-folder-dnd-bridge.c: New.
- * e-folder-dnd-bridge.h: New.
-
-2002-04-10 Dan Winship <danw@ximian.com>
-
- * e-shell-config.c: Shell config page routines. Right now
- handles the default folders page.
-
- * glade/e-shell-config-default-folders.glade: New.
-
- * GNOME_Evolution_Shell.oaf.in: Add info for the default folders
- config page.
-
- * main.c (idle_cb): If we successfully registered the shell,
- register the config factory.
-
- * evolution-shell-client.c (evolution_shell_client_new): Note the
- fact that it frees the corba_shell when it is destroyed.
-
- * evolution-folder-selector-button.c
- (evolution_folder_selector_button_construct, destroy): Use
- bonobo_object_ref/unref on the shell client, not gtk.
-
- * e-shell.c (e_shell_construct): Pass local_directory to
- e_setup_check_db.
- (handle_default_uri): Fix the config db paths here to match the
- other routines.
-
- * e-setup.c (e_setup_check_db): Make this take the evolution
- directory path as well so we can properly set up file: URIs for
- the default folders.
-
-2002-04-09 Ettore Perazzoli <ettore@ximian.com>
-
- * main.c (idle_cb): Change the logic for displaying a default
- window, so we don't end up with two windows all the time.
-
-2002-04-09 Ettore Perazzoli <ettore@ximian.com>
-
- [Patch from Max Horn <max@quendi.de>.]
-
- * e-local-storage.c: Move <dirent.h> down the #include list so it
- compiles on Darwin.
-
-2002-04-09 Dan Winship <danw@ximian.com>
-
- * e-setup.c (e_setup_check_db): New. Check that things that need
- to be in the config db are. Right now it sets up the default
- folders.
-
- * e-shell.c (e_shell_construct): Call e_setup_check_db after
- getting the config db.
- (impl_Shell_handleURI): Handle "default:" URIs by looking up the
- default folders in the config db.
-
- * main.c (idle_cb): Check for "default:" URIs and treat them the
- same way as "evolution:" URIs. If the shell fails to display all
- of the requested URIs, fall back to the default URI (Summary).
-
- * e-shell-constants.h: Add E_SUMMARY_URI, E_LOCAL_INBOX_URI, etc.
-
- * e-shortcuts.c (e_shortcuts_add_default_group): Use
- E_LOCAL_INBOX_URI, etc.
-
- * e-shell-view.c: #define FALLBACK_URI to E_SUMMARY_URI
-
-2002-04-09 Dan Winship <danw@ximian.com>
-
- * Evolution-ShellComponent.idl (createView): Add a "view_info"
- argument.
-
- * e-shell-view.c (get_view_for_uri): if the URI contains a '#',
- split it into a URI and a "view_info" at that point. (Otherwise,
- pass "" for the view_info to ShellComponent_createView.) This can
- be used for things like specifying day/month/week view to the
- calendar.
-
- * e-shell.c (create_view): Ignore e_shell_view_display_uri's
- return code: it's possible/likely that the requested URL is remote
- and hasn't been filled in yet.
- (impl_Shell_handleURI): Don't use Shell_createNewView directly,
- call e_shell_create_view_from_uri_and_settings. (For the above fix
- and some others.)
-
- * evolution-shell-component.c (impl_createView): Add view_info.
-
- * evolution-shell-component-client.c
- (evolution_shell_component_client_create_view): Add view_info.
-
- * evolution-test-component.c (create_view_fn): add view_data.
-
- * e-corba-storage-registry.c
- (impl_StorageRegistry_getFolderByUri): kill a warning
-
-2002-04-08 Dan Winship <danw@ximian.com>
-
- Fix "evolution evolution:/path/to/folder" to use default view
- prefs.
-
- * e-shell.c (impl_Shell_createNewView): Use
- e_shell_create_view_from_uri_and_settings to create the new view
- based on saved view 0 instead of always using the initial
- evolution defaults.
- (e_shell_create_view_from_uri_and_settings): Renamed and
- simplified; the template_view argument was useless and
- settings_found would always be set to TRUE in the context it was
- being used it.
- (e_shell_restore_from_settings): Simplify for
- e_shell_create_view_from_uri_and_settings changes.
-
- * e-shell-view.c (e_shell_view_load_settings): Only load the
- DisplayedURI if the view isn't already displaying a URI. Also,
- pass an &ev to the first bonobo_config_get_long so we can tell if
- it failed and bail out.
-
- * e-shell-view.h: Remove a prototype for a non-existent function
- (e_shell_view_remove_control_for_uri).
-
- * main.c (idle_cb): Add some comments here and remove some dead
- code.
-
-2002-04-06 JP Rosevear <jpr@ximian.com>
-
- * e-shell-settings-dialog.c (page_new): set type
- (load_pages): get the oaf property for type and track the page
- number of the highest priority for each type
- (destroy_type_entry): destroy hash func
- (impl_destroy): destroy the hash table
- (init): create private struct and hash table
- (e_shell_settings_dialog_show_type): show the page of the given
- type
-
- * e-shell-view-menu.c (command_settings): show the page for the
- current folder type by default
-
- * e-shell-settings-dialog.h: new proto
-
-2002-04-06 Ettore Perazzoli <ettore@ximian.com>
-
- * e-shell-settings-dialog.c (init): Set the title of the dialog.
-
-2002-04-04 Dan Winship <danw@ximian.com>
-
- * evolution-shell-client.c
- (evolution_shell_client_get_pixbuf_for_type): Fix a memory mixup.
-
-2002-04-04 Dan Winship <danw@ximian.com>
-
- * evolution-folder-selector-button.c: New widget for a button that
- displays a folder selection in a standard form, and when clicked
- lets the user select a new folder.
-
- * Evolution-Shell.idl (FolderSelectionListener:notifySelected):
- Make this take an Evolution:Folder instead of a pair of uris.
- (Shell:getIconByType): New method to get the icon for a type from
- the folder type registry.
-
- * Evolution-common.idl (Folder): add "evolutionUri" to the folder
- structure.
-
- * Evolution-Storage.idl (StorageRegistry:getFolderByUri): get an
- Evolution:Folder for a given uri.
-
- * evolution-shell-client.c
- (evolution_shell_client_user_select_folder): Update this to
- reflect the IDL change: return a GNOME_Evolution_Folder instead of
- a pair of URIs. Make sure it always sets *@folder_return to %NULL
- if it fails (even if it's a g_return_if_fail).
- (evolution_shell_client_get_storage_registry_interface): New.
- (evolution_shell_client_get_pixbuf_for_type): New. Uses
- Shell_getIconByType, but caches results.
-
- * e-shell.c (folder_selection_dialog_folder_selected_cb): Update
- for API change. (Return a GNOME_Evolution_Folder.)
- (impl_Shell_getIconByType): Implement.
-
- * e-corba-storage-registry.c
- (impl_StorageRegistry_getFolderByUri): Implement.
-
- * evolution-storage.c (evolution_storage_new_folder): Add a
- (dummy) evolutionUri to the folder.
-
- * Makefile.am (libeshell_la_SOURCES): add
- evolution-folder-selector-button.c
- (eshellinclude_HEADERS): and .h
-
2002-04-04 Ettore Perazzoli <ettore@ximian.com>
- * evolution-shell-component.c: Change type of parent_class to
- BonoboXObjectClass.
-
- * e-shell.c (pop_up_activation_error_dialog): New helper function
- to pop up a dialog if one of the components couldn't be activated,
- getting the description for the error from
- e_get_activation_failure_msg().
- (setup_components): Use this function in case of activation error.
- (set_owner_on_components): Likewise, when the component gets
- restarted. Also get a @splash arg so we can set the parent for
- this dialog correctly.
-
- * e-component-registry.c (register_component): New arg @ev.
- (e_component_registry_register_component): Likewise.
- (e_component_registry_restart_component): Likewise. Also, remove
- some bogus code that was #if'ed out.
-
- * evolution-shell-component-client.c
- (evolution_shell_component_client_new): New arg @ev.
-
- * evolution-shell-component-utils.c
- (e_get_activation_failure_msg): New.
-
-2002-04-03 Dan Winship <danw@ximian.com>
-
- * e-storage.c (get_path_for_physical_uri_foreach): Deal with
- folders with no physical_uri.
-
-2002-04-02 Christopher James Lahey <clahey@ximian.com>
-
- * e-storage-set-view.c (e_storage_set_view_set_show_checkboxes):
- Set the show_checkboxes field here instead of the show_folders
- field.
-
-2002-04-02 Christopher James Lahey <clahey@ximian.com>
-
- * e-storage-set-view.c (etree_value_at): If folder is NULL, return
- the correct type of data.
-
-2002-04-02 Christopher James Lahey <clahey@ximian.com>
-
- * Makefile.am (etspec_DATA): Added
- e-storage-set-view-checkboxes.etstate and
- e-storage-set-view-no-checkboxes.etstate here.
-
- * e-storage-set-view-checkboxes.etstate,
- e-storage-set-view-no-checkboxes.etstate: The two possible states
- of the EStorageSetView.
-
- * e-storage-set-view.c, e-storage-set-view.h
- (e_storage_set_view_set_show_checkboxes,
- e_storage_set_view_get_show_checkboxes): Added this functionality.
- Added a model column to the underlying table for the checkbox
- data.
-
- * e-storage-set-view.etspec: Added a view column for the
- checkboxes.
-
-2002-03-29 Ettore Perazzoli <ettore@ximian.com>
-
- * e-shell-settings-dialog.c: Add type "Page".
- (page_new): New helper function.
- (page_free): New helper function.
- (compare_page_func): Callback for sorting a GList of pages.
- (sort_page_list): New helper function.
- (load_pages): Create the pages, sort them, add them sorted. Now
- we have a priority field that overrides alphabetical sorting.
-
-2002-03-26 Ettore Perazzoli <ettore@ximian.com>
-
- * e-component-info.c: New.
- * e-component-info.h: New.
-
-2002-03-26 Ettore Perazzoli <ettore@ximian.com>
-
- * e-shell-settings-dialog.c (load_pages): g_warning if the control
- cannot be activated.
-
-2002-03-25 Dan Winship <danw@ximian.com>
-
- * e-shell.c (e_shell_construct): Register a "working" folder type
- with the hourglass icon. (Would eventually like an animated gif,
- when ETable supports that.)
-
- * e-storage.c (e_storage_has_subfolders): Use "working" rather
- than "noselect" as the folder type.
-
- * e-shell-view.c (get_view_for_uri): Simplify a bit.
-
-2002-03-22 Ettore Perazzoli <ettore@ximian.com>
-
- * e-shell-settings-dialog.c (get_language_list): Removed.
- (load_pages): Use e_get_language_list() here instead. Also, free
- using e_free_language_list().
-
-2002-03-22 Dan Winship <danw@ximian.com>
-
- * evolution-storage.c (evolution_storage_update_folder): Fix a
- "how can this ever have worked" bug to make unread message counts
- start working again. (#22293 etc)
- (evolution_storage_removed_folder): Oops. Fix here too.
- (evolution_storage_has_subfolders): And here. When cut and paste
- goes bad...
-
- * e-shell-folder-commands.c (e_shell_command_rename_folder): Use
- e_folder_get_name. Don't assume it's the same as the last path
- element.
-
-2002-03-21 Dan Winship <danw@ximian.com>
-
- * e-splash.c (e_splash_construct): Set the wmclass to
- "evolution-splash" so sawfish knows it's not the same kind of
- window as the main window.
-
-2002-03-20 Ettore Perazzoli <ettore@ximian.com>
-
- * e-shell-view-menu.c: Make all the verb/menu arrays appropriately
- static.
-
-2002-03-20 Ettore Perazzoli <ettore@ximian.com>
-
- * e-shell-view-menu.c (command_send_receive): New, implementation
- for the "SendReceive" verb.
-
- * e-shell.c (e_shell_send_receive): New.
-
- * evolution-shell-component.c (impl_sendReceive): Implementation
- of ShellComponent::sendReceive.
- (class_init): Add the "send_receive" signal.
-
- * evolution-shell-component.h: Added `send_receive' signal.
-
- * Evolution-ShellComponent.idl: Added ShellComponent::sendReceive.
-
-2002-03-18 Ettore Perazzoli <ettore@ximian.com>
-
- * e-storage-set-view.etspec: Add `search="string"' for the
- keyboard navigability search thingy.
-
-2002-03-15 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-activity-handler.c (show_cancellation_popup): Updated to use
- new EPopupMenu API.
-
-2002-03-14 Dan Winship <danw@ximian.com>
-
- Support for delayed filling-in of storages/folders.
-
- * Evolution-Storage.idl (StorageListener): add
- notifyHasSubfolders, to announce that a folder has currently-
- unknown subfolders.
- (Storage): add asyncOpenFolder, to request that previously-
- announced subfolders be filled in.
-
- * evolution-storage.c (impl_Storage_async_open_folder): emit
- OPEN_FOLDER.
- (evolution_storage_has_subfolders): Implement by calling
- notifyHasSubfolders on all of its listeners.
-
- * evolution-storage-listener.c
- (impl_GNOME_Evolution_StorageListener_notifyHasSubfolders): emit
- HAS_SUBFOLDERS.
-
- * e-corba-storage.c (impl_StorageListener_notifyHasSubfolders):
- Implement by calling e_storage_has_subfolders.
- (async_open_folder): Implement by calling asyncOpenFolder on the
- CORBA storage.
-
- * e-storage.c (EStoragePrivate, init, destroy): Keep a list of
- pseudofolders representing un-filled-in subtrees.
- (impl_async_open_folder): No-op default implementation
- (e_storage_async_open_folder): New function to request that
- un-filled-in subtrees be filled in.
- (e_storage_new_folder): If the new folder's parent has an
- "un-filled-in children" pseudofolder, remove it.
- (e_storage_has_subfolders): New function to note that a folder has
- unknown children. If the folder previously was marked as having
- real children, remove them, and emit CLOSE_FOLDER to reset it back
- to an a "unknown subfolders" state.
-
- * e-storage-set.c (make_full_path): Make this deal with path being
- "/", since that case gets used from storage_close_folder_cb
- sometimes.
- (storage_close_folder_cb): Proxy EStorage's CLOSE_FOLDER signal.
- (storage_set_view_folder_opened): Handle EStorageSetView's
- FOLDER_OPENED signal by calling e_storage_async_open_folder.
-
- * e-storage-set-view.c (etree_fill_in_children): If the given node
- is its parent's first child, emit FOLDER_OPENED for the parent.
- (close_folder_cb): Handler for EStorageSet's CLOSE_FOLDER signal.
- Ask the model to close that node.
- (e_storage_set_view_construct): Set the default expanded state for
- the tree to FALSE rather than TRUE, to prevent unwanted expansion
- of delayed nodes. (This only affects the very first time the tree
- is displayed anyway: after that its state is loaded off disk.)
-
- * e-shell.c (e_shell_construct): Register the "noselect" type with
- the folder type registry, so icon lookups on placeholder folders
- will work.
-
-2002-03-13 Ettore Perazzoli <ettore@ximian.com>
+ [Fix #22047, Crash after running the start-up wizard.]
- * e-shell-settings-dialog.c (load_pages): Use
- `evolution:config_item:icon_name' instead of
- `evolution:config_item:icon_path'. If it's not an absolute path,
- load from the IMAGESDIR. Also, no need to specify the language
- list for this one, as the icon name shouldn't be translated.
+ * e-shell-startup-wizard.c (startup_wizard_cancel): Unref the
+ ETimezoneDialog.
+ (finish_func): Likewise.
-2002-03-12 Ettore Perazzoli <ettore@ximian.com>
-
- * evolution-test-component.c (create_configuration_page): Update
- to create an EvolutionConfigControl instead of just a
- BonoboControl.
-
- * e-corba-config-page.c (e_corba_config_page_construct): Get a
- GNOME_Evolution_ConfigControl instead of a CORBA_Object. Retrieve
- the control from it using ::_get_control instead of just assuming
- it's a control. Also return a boolen indicating success or
- failure.
- (e_corba_config_page_new): Likewise, get a
- GNOME_Evolution_ConfigControl.
- (setup_listener): Renamed from `setup_config_control_interface'.
- Get a ::ConfigControl instead of a CORBA::Object. Thus, no need
- to queryInterface here anymore.
-
- * evolution-config-control.c, evolution-config-control.h: New,
- implementation for the Evolution::ConfigControl interface.
-
- * Evolution-ConfigControl.idl: New attribute `control'.
-
-2002-03-09 Ettore Perazzoli <ettore@ximian.com>
-
- * e-shell-folder-commands.c (e_shell_command_rename_folder): Make
- old_name_locale non-const to placate a compiler warning.
- (get_corba_null_value): Likewise.
-
- * e-activity-handler.c (report_task_event): `#if 0' out.
-
-2002-03-09 Ettore Perazzoli <ettore@ximian.com>
-
- * e-shell-settings-dialog.c (load_pages): Use ECorbaConfigPages.
-
- * e-corba-config-page.c: New.
- * e-corba-config-page.h: New.
-
- * Evolution.idl: #include <Evolution-ConfigControl.idl>.
-
- * Evolution-ConfigControl.idl: New IDL for configuration Controls
- that will be displayed in the global config dialog.
-
-2002-03-08 Dan Winship <danw@ximian.com>
-
- * e-storage-set-view.[ch]: Note that e_storage_set_view_new
- shouldn't be used directly.
-
- * e-shell-view.c (setup_storage_set_subwindow): Use
- e_storage_set_new_view instead of e_storage_set_view_new.
-
- * evolution-storage-set-view-factory.c
- (evolution_storage_set_view_factory_new_view): Likewise.
-
-2002-03-07 Ettore Perazzoli <ettore@ximian.com>
-
- * evolution-test-component.c (create_configuration_page): New
- function to create a test configuration page for the test
- component.
- (configuration_control_factory_fn): Factory function for the
- configuration controls.
- (register_configuration_control_factory): New function to register
- the factory.
- (main): Call it.
-
- * e-shell-view-menu.c: Add verb "Settings".
- (command_settings): Implementation for the "Settings" verb.
-
- * GNOME_Evolution_TestComponent.oaf: Add a configuration control.
-
- * e-shell-settings-dialog.c: New.
- * e-shell-settings-dialog.h: New.
-
-2002-03-07 Dan Winship <danw@ximian.com>
-
- Addendum to previous commit: Remove "storage_selected" vs
- "folder_selected" distinction.
-
- * evolution-storage-set-view.c
- (storage_set_view_widget_storage_selected_cb): Removed.
-
- * evolution-storage-set-view-listener.c
- (impl_GNOME_Evolution_StorageSetViewListener_notifyStorageSelected):
- Removed.
- (class_init): Remove STORAGE_SELECTED signal.
-
- * e-storage-set-view.c (impl_cursor_activated): Always emit
- FOLDER_SELECTED, never STORAGE_SELECTED.
- (class_init): Remove STORAGE_SELECTED signal.
-
- * e-shell-view.c (storage_selected_cb): Removed.
-
- * e-shell-folder-creation-dialog.c
- (storage_set_view_storage_selected_cb): Removed.
-
- * Evolution-StorageSetView.idl (StorageSetViewListener): Remove
- notifyStorageSelected.
-
-2002-03-07 Dan Winship <danw@ximian.com>
-
- Make storages-with-toplevel-views less of a hack.
-
- * e-folder-tree.c (e_folder_tree_add): Allow the caller to "add" a
- root folder, if the existing root folder has no children.
- (e_folder_tree_new): Use e_folder_tree_add to create the root
- folder, since it can do that now.
-
- * e-storage.c: (e_storage_construct): Replace toplevel_node_uri
- and toplevel_node_type args with root_folder.
- (e_storage_new): Likewise.
- (*): Remove toplevel uri/type stuff everywhere. Also remove
- display_name since now we will use the name of the root folder for
- that.
-
- * evolution-storage.c: Remove toplevel uri/type stuff everywhere.
-
- * e-local-storage.c (construct): Pass root_folder to
- e_storage_construct instead of toplevel uri/type.
- Also, evolution_storage_new no longer takes toplevel uri/type.
-
- * e-corba-storage.c (e_corba_storage_construct): Out with toplevel
- uri/type, in with root_folder.
- (e_corba_storage_new): Remove toplevel uri/type.
-
- * e-shell.c (setup_local_storage): Create a top-level folder of
- type "summary" for the Summary storage.
-
- * e-storage-set-view.c (set_e_shortcut_selection): Remove
- special-case for storages.
- (etree_icon_at): Remove special case for figuring out storage
- icons (but leave the code for storages without icons).
- (etree_value_at): Remove special case for storage names. (But
- still make storages always bold.) Remove unused special-case code
- for Summary.
-
- * e-shortcuts.c (load_shortcuts): Remove special case for
- storages, reorganize a bit.
-
- * e-shortcuts-view.c (get_shortcut_info): Remove special case for
- storages.
-
- * e-shell-view.c (update_for_current_uri): Remove special case for
- storages.
- (socket_destroy_cb): Likewise.
- (get_type_for_storage): No longer needed.
- (get_view_for_uri): No longer needs to special-case storages (but
- add a special case for folders of type "noselect", to make them
- unselectable like storages-without-toplevel-views used to be).
-
- * e-storage-set.c (get_storage_for_path): If passed "/foo", return
- "/" as subpath_return so e_storage_set_get_folder will DTRT in the
- NWO.
-
- * Evolution-Storage.idl (addStorage): Remove the toplevel_node_uri
- and toplevel_node_type arguments.
-
- * e-corba-storage-registry.c (impl_StorageRegistry_addStorage):
- Likewise.
-
-2002-03-06 Dan Winship <danw@ximian.com>
-
- * e-storage.c: Keep the storage name and display_name in
- EStoragePriv.
- (impl_get_name, impl_get_display_name): Return them.
- (e_storage_construct): Set them here.
- (e_storage_new): And here.
-
- * e-local-storage.c: (impl_get_name, impl_get_display_name):
- Removed.
- (construct): Pass E_LOCAL_STORAGE_NAME and U_("Local Folders") to
- e_storage_construct.
-
- * e-corba-storage.c: Remove priv->name.
- (get_name, get_display_name): Removed.
- (e_corba_storage_construct): Pass name to e_storage_construct().
-
- * e-summary-storage.[ch]: Gone. This didn't override anything in
- EStorage but get_name/get_display_name, and the defaults for those
- DTRT now.
-
- * e-shell-constants.h: Move E_SUMMARY_STORAGE_NAME here from
- e-summary-storage.h, and move E_LOCAL_STORAGE_NAME too for
- consistency.
-
- * e-storage-set-view.c: Fix up #includes.
-
- * e-shell-importer.c: Likewise
-
- * e-shell.c: Likewise. Create summary_storage as a plain EStorage
- since ESummaryStorage is gone now.
-
- * Makefile.am (evolution_SOURCES): Remove e-summary-storage.[ch]
-
-2002-03-06 Dan Winship <danw@ximian.com>
-
- * e-corba-storage-registry.c
- (impl_StorageRegistry_removeListener): Fix up GList/GSList
- confusion.
-
- * e-shell-user-creatable-items-handler.c
- (get_default_action_for_view): Don't look into the types list if
- it's empty.
-
-2002-03-06 Ettore Perazzoli <ettore@ximian.com>
-
- * e-shell-about-box.c: Reduce width of the copyright message so it
- looks prettier with the new Rupert artwork.
-
-2002-03-04 Iain Holmes <iain@ximian.com>
-
- * Evolution-Storage.idl: Add some methods to the StorageRegistry
- interface to get a storage, and add or remove listeners. Also add a
- new exception and some structs and enums for messages.
-
- * e-corba_storage-registry.c: Add a GSList to the private stuct for
- recording the listeners.
- (listener_notify): Send a message to the listeners.
- (impl_StorageRegistry_getStorageByName): Implementation of the
- getStorageByName method. Returns the associated storage interface
- (storage_set_foreach): Loop through all the storages in the storageset
- and notify the listeners about them.
- (find_listener): Find a listener in the list of them.
- (impl_StorageRegistry_addListener): Add a new listener to the
- registry.
- (impl_StorageRegistry_removeListener): Remove a listener.
- (corba_class_init): Add the new methods to the EPV.
- (init): NULL the listeners list.
-
- * e-corba-storage.[ch] (e_corba_storage_get_corba_objref): Get the CORBA
- interface from the GtkObject.
-
2002-03-04 Ettore Perazzoli <ettore@ximian.com>
[Fix #20234, Deleting Folder gratuitiously causes /local to open.]
@@ -699,7 +29,7 @@
* e-shell-folder-commands.c (xfer_result_callback): Display an
error message if the operation failed.
-2002-02-26 Ettore Perazzoli <ettore@ximian.com>
+2002-03-04 Ettore Perazzoli <ettore@ximian.com>
[This gets rid of some spurious "could not find handler" messages
on exit. What happened is that the signal would be disconnected
@@ -710,138 +40,6 @@
(e_shell_view_display_uri): Use gtk_signal_connect_full(), not
e_gtk_signal_connect_full_while_alive().
-2002-02-23 Ettore Perazzoli <ettore@ximian.com>
-
- * e-shell-about-box.c: Add year 2002 to the copyright.
-
-2002-02-23 Ettore Perazzoli <ettore@ximian.com>
-
- * e-storage-set-view.c (impl_destroy): Renamed from `destroy'.
- (impl_right_click): Renamed from `right_click'.
- (impl_cursor_activated): Renamed from `cursor_activated'.
- (impl_tree_start_drag): Renamed from `tree_start_drag'.
- (impl_tree_drag_begin): Renamed from `tree_drag_begin'.
- (impl_tree_drag_end): Renamed from `tree_drag_end'.
- (impl_tree_drag_data_get): Renamed from `tree_drag_data_get'.
- (impl_tree_drag_data_delete): Renamed from
- `tree_drag_data_delete'.
- (impl_tree_drag_motion): Renamed from `tree_drag_motion'.
- (impl_tree_drag_leave): Renamed from `tree_drag_leave'.
- (impl_tree_drag_drop): Renamed from `tree_drag_drop'.
- (impl_tree_drag_data_received): Renamed from
- `tree_drag_data_received'.
-
-2002-02-22 Ettore Perazzoli <ettore@ximian.com>
-
- [Fix #3029, Offline mode should be preserved across sessions.]
-
- * main.c (idle_cb): Use the e_shell_new() API below so that we use
- the saved offline settings at the next start-up if neither
- --offline nor --online has been specified.
-
- * e-shell.c (save_misc_settings): New function. For now, just
- save `/Shell/StartOffline' indicating whether the shell should
- start in offline mode or not.
- (e_shell_construct): Replace @start_online with
- @startup_line_mode.
- (e_shell_new): Likewise.
-
- * e-shell.h: New enum EShellStartupLineMode.
-
-2002-02-22 Ettore Perazzoli <ettore@ximian.com>
-
- * e-shell-view.c (remove_uri_from_history): New helper function to
- remove all the matching URIs from the history.
- (history_uri_matching_func): Compare function for using
- e_history_remove_matching.
- (storage_set_removed_folder_callback): Call
- `remove_uri_from_history()'.
-
- * e-history.c (e_history_remove_matching): New.
-
-2002-02-22 Ettore Perazzoli <ettore@ximian.com>
-
- * e-shell-view.c (update_navigation_buttons): New.
- (display_uri): Call it before returning so the navigation buttons
- always have the right sensitivity.
-
- * e-shell-folder-title-bar.c
- (e_shell_folder_title_bar_update_navigation_buttons): New.
- (add_navigation_buttons): Remove the "Back" label.
-
-2002-02-22 Ettore Perazzoli <ettore@ximian.com>
-
- * e-shell-view.c: New member `history' in `EShellViewPrivate'.
- (init): Initialize.
- (destroy): Unref.
- (e_shell_view_display_uri): Make it a no-op if the URI is the same
- as the current one. Also, moved code into `display_uri' and use
- it.
- (back_clicked_callback): New, callback for the back button on the
- folder title bar.
- (forward_clicked_callback): Likewise for the forward button.
-
- * e-history.c: New.
- * e-history.h: New.
-
-2002-02-22 Ettore Perazzoli <ettore@ximian.com>
-
- * e-shell-view.c (e_shell_view_show_folder_bar):
- `e_shell_folder_title_bar_set_title_clickable()', not
- `e_shell_folder_title_bar_set_clickable()'.
-
- * e-shell-folder-title-bar.c: Rename `button', `button_label' and
- `button_arrow' to `title_button', `title_button_label' and
- `title_button_arrow'. Renamed `label' to `title_label'. Renamed
- `arrow_xpm' to `down_arrow_xpm'. Added `left_arrow.xpm' and
- `right_arrow.xpm'.
- (class_init): Add the "back_clicked" and "forward_clicked"
- signals.
- (add_navigation_buttons): New function to add the navigation
- buttons to the title bar.
- (back_button_clicked_callback): Callback for the back button,
- emits "back_clicked".
- (forward_button_clicked_callback): Callback for the forward
- button, emits "forward_clicked".
- (e_shell_folder_title_bar_construct): Call
- `add_navigation_buttons()'.
- (forward_button_clicked_callback):
- (create_arrow_pixmap): Removed.
- (create_pixmap_widget_from_xpm): New.
- (title_button_box_realize_cb): Removed.
- (e_shell_folder_title_bar_construct): Don't connect. Just add the
- icon normally using the new `create_pixmap_widget_from_xpm()'.
- (e_shell_folder_title_bar_set_title_clickable): Renamed from
- `e_shell_folder_title_bar_set_clickable'.
- (size_allocate_navigation_buttons): New.
- (size_allocate_title_button): Get an @offset.
- (size_allocate_label): Get an @offset.
- (size_allocate): Allocate the navigation buttons and offset
- everything else accordingly.
-
- * e-shell-folder-title-bar.h: New signals "back_clicked",
- "forward_clicked".
-
-2002-02-21 Ettore Perazzoli <ettore@ximian.com>
-
- * e-shell-user-creatable-items-handler.c
- (get_default_action_for_view): Return NULL if there is no
- component ID for the current view.
-
-2002-02-21 Ettore Perazzoli <ettore@ximian.com>
-
- * e-shell-user-creatable-items-handler.c (ensure_menu_items): Set
- the icons for all the "New..." menu items from the specified one
- in the type definitions.
-
- * e-activity-handler.c (create_gdk_pixbuf_from_corba_icon):
- Removed.
- (impl_operationStarted): Just use
- `e_new_gdk_pixbuf_from_corba_icon()'.
-
- * e-shell-corba-icon-utils.c (e_new_gdk_pixbuf_from_corba_icon):
- New.
-
2002-02-20 Ettore Perazzoli <ettore@ximian.com>
[Fix #20311, new window from Shortcuts should not show the folder
@@ -854,106 +52,12 @@
* e-shell-view.c (activate_shortcut_cb): Don't show the folder bar
and the shortcut bar in the new window.
- * e-shell-view.c (e_shell_create_view): Don't flush the GTK events
+ * e-shell.c (e_shell_create_view): Don't flush the GTK events
here.
2002-02-20 Ettore Perazzoli <ettore@ximian.com>
- * e-shell.c (e_shell_construct): New arg @start_online. If true,
- invoke `e_shell_go_online()' before returning.
- (e_shell_new): New arg @start_online. Pass it to
- e_shell_construct().
- (init): Default ->line_status to E_SHELL_LINE_STATUS_OFFLINE.
-
- * main.c (main): Add "--offline" and "--online" options.
-
-2002-01-30 Not Zed <NotZed@Ximian.com>
-
- * e-storage-set-view.c (popup_folder_menu): Use
- right_click_row_path rather than selected_row_path, so clients get
- the uri that was actually clicked on.
-
-2002-01-27 Ettore Perazzoli <ettore@ximian.com>
-
- * Makefile.am: Use SHELL_CFLAGS and SHELL_LIBS.
- * importer/Makefile.am: Likewise.
-
-2002-01-24 Ettore Perazzoli <ettore@ximian.com>
-
- * Makefile.am: Just use BONOBO_HTML_GNOME_CFLAGS and
- BONOBO_HTML_GNOME_LIBS for compiling/linking; we don't need the
- other ones.
-
-2002-01-23 Ettore Perazzoli <ettore@ximian.com>
-
- * e-shell-user-creatable-items-handler.c: New member `id' in
- struct `Component'. New member `icon' in struct `MenuItem'.
- (component_free): Free ->id.
- (component_new): Renamed from `component_new_from_client'. Get an
- @id arg and set ->id accordingly.
- (e_shell_user_creatable_items_handler_add_component): New arg @id.
- Pass it to `component_new'.
- (e_shell_user_creatable_items_handler_setup_menus): New arg
- @current_component_id.
- (e_shell_user_creatable_items_handler_update_menus): New.
- (set_current_component): New helper function.
- (get_component_by_id): New helper function.
- (add_verbs): Renamed from `add_verbs_to_ui_component()'. Get a
- @shell_view instead of a @ui_component. Set the SHELL_VIEW_KEY on
- the ui_component of the shell_view to point to the shell_view
- itself.
- (ensure_menu_items): Set item->icon to NULL.
- (free_menu_items): Unref item->icon.
- (ensure_menu_xml): Set the icon as well.
- (get_default_action_for_view): New helper function.
- (find_menu_item_for_verb): New helper function.
- (shell_view_view_changed_callback): New callback, set up the label
- on the "New" button depending on the current component.
- (e_shell_user_creatable_items_handler_attach_menus): New. For
- now, do not display the toolbar button yet.
- (execute_verb): New helper function, splitting out code from
- `verb_fn'.
- (verb_fn): Use `execute_verb'.
- (combo_button_activate_default_callback): Callback for the
- "activate_default" signal on the EComboButton.
- (setup_toolbar_button): Connect.
-
- * evolution-shell-component.c: New member `icon' in
- `UserCreatableItemType'.
- (impl__get_userCreatableItemTypes): Put the ->icon in the
- corba_type as well.
- (user_creatable_item_type_new): Get a new @icon argument.
- (evolution_shell_component_add_user_creatable_item): New arg
- @icon.
-
- * Evolution-ShellComponent.idl: New member `icon' in struct
- `UserCreatableItemType'.
-
- * evolution-test-component.c (register_component): Pass a NULL
- @icon to `evolution_shell_component_add_user_creatable_item()'.
-
- * e-shell-view.c (class_init): Add the signal to the class.
- (e_shell_view_display_uri): Emit "view_changed".
- (e_shell_view_get_current_component_id): New.
-
- * evolution-shell-component-client.c: New member `id' in
- EvolutionShellComponentClientPrivate.
- (init): Init to NULL.
- (impl_destroy): Free.
- (evolution_shell_component_client_new_for_objref): Removed.
- (evolution_shell_component_client_construct): New arg @id.
- Initialize ->id from it.
- (evolution_shell_component_client_get_id): New.
-
- * e-shell-view.h: New signal "view_changed".
-
- * evolution-activity-client.c (create_icon_from_pixbuf): Removed.
- (create_corba_animated_icon_from_pixbuf_array): Removed.
- (evolution_activity_client_construct): Use
- `e_new_corba_animated_icon_from_pixbuf_array()' instead.
-
- * e-shell-icon-utils.h: New.
- * e-shell-icon-utils.c: New.
+ * e-shell-about-box.c: Add Hans Petter.
2002-01-23 Ettore Perazzoli <ettore@ximian.com>
@@ -964,8 +68,8 @@
2002-01-15 Iain Holmes <iain@ximian.com>
- * e-shell-importer.c (show_import_wizard): Set the importer druid
- as a transient window of the parent shell.
+ * e-shell-importer.c (show_import_wizard): Set the druid as transient
+ for the main shell.
2002-01-15 Ettore Perazzoli <ettore@ximian.com>
@@ -994,7 +98,7 @@
2001-12-17 Ettore Perazzoli <ettore@ximian.com>
- [Fix #17377, Evolution doesn't work on multi-depth displays.]
+ [Fixes #17377, Evolution doesn't work on multi-depth displays.]
* main.c (main): Push GdkRGB visual and colormap.
@@ -1075,6 +179,10 @@
of the tree.
(impl_destroy): Call save_expanded_state().
+2001-11-15 Ettore Perazzoli <ettore@ximian.com>
+
+ * e-shell-about-box.c: Add missing comma.
+
2001-11-14 Ettore Perazzoli <ettore@ximian.com>
* e-shell-about-box.c: Add more contributors to the box.
diff --git a/shell/Makefile.am b/shell/Makefile.am
index b30e3787f6..c406707087 100644
--- a/shell/Makefile.am
+++ b/shell/Makefile.am
@@ -1,23 +1,25 @@
SUBDIRS = glade importer
-INCLUDES = -O \
- -I$(top_srcdir)/widgets \
- -I$(top_srcdir)/widgets/misc \
- -I$(top_srcdir)/libical/src/libical \
- -I$(top_srcdir) \
- -DEVOLUTION_IMAGES=\""$(datadir)/images/evolution"\" \
- -DEVOLUTION_LOCALEDIR=\""$(localedir)"\" \
- -DEVOLUTION_DATADIR=\""$(datadir)"\" \
- -DEVOLUTION_GLADEDIR=\"$(datadir)/evolution/glade\" \
- -DEVOLUTION_ETSPECDIR=\""$(etspecdir)"\" \
- -DG_LOG_DOMAIN=\"evolution-shell\" \
- $(SHELL_CFLAGS)
+INCLUDES = -O \
+ -I$(top_srcdir)/widgets \
+ -I$(top_srcdir)/widgets/misc \
+ -I$(top_srcdir)/libical/src/libical \
+ -I$(top_srcdir) \
+ $(BONOBO_GNOME_CFLAGS) \
+ $(BONOBO_CONF_CFLAGS) \
+ $(EXTRA_GNOME_CFLAGS) \
+ $(GTKHTML_CFLAGS) \
+ -DEVOLUTION_IMAGES=\""$(datadir)/images/evolution"\" \
+ -DEVOLUTION_LOCALEDIR=\""$(localedir)"\" \
+ -DEVOLUTION_DATADIR=\""$(datadir)"\" \
+ -DEVOLUTION_GLADEDIR=\"$(datadir)/evolution/glade\" \
+ -DEVOLUTION_ETSPECDIR=\""$(etspecdir)"\" \
+ -DG_LOG_DOMAIN=\"evolution-shell\"
# CORBA stuff
IDLS = \
Evolution-Activity.idl \
- Evolution-ConfigControl.idl \
Evolution-Offline.idl \
Evolution-Session.idl \
Evolution-Shell.idl \
@@ -60,7 +62,6 @@ eshellinclude_HEADERS = \
Evolution.h \
e-folder-tree.h \
evolution-activity-client.h \
- evolution-folder-selector-button.h \
evolution-session.h \
evolution-shell-client.h \
evolution-shell-component-client.h \
@@ -76,12 +77,7 @@ eshellinclude_HEADERS = \
libeshell_la_SOURCES = \
$(IDL_GENERATED) \
e-folder-tree.c \
- e-shell-corba-icon-utils.c \
- e-shell-corba-icon-utils.h \
evolution-activity-client.c \
- evolution-config-control.c \
- evolution-config-control.h \
- evolution-folder-selector-button.c \
evolution-session.c \
evolution-shell-client.c \
evolution-shell-component-client.c \
@@ -102,38 +98,28 @@ bin_PROGRAMS = evolution
evolution_SOURCES = \
e-activity-handler.c \
e-activity-handler.h \
- e-component-info.c \
- e-component-info.h \
e-component-registry.c \
e-component-registry.h \
- e-corba-config-page.c \
- e-corba-config-page.h \
e-corba-shortcuts.c \
e-corba-shortcuts.h \
e-corba-storage-registry.c \
e-corba-storage-registry.h \
e-corba-storage.c \
e-corba-storage.h \
- e-folder-dnd-bridge.c \
- e-folder-dnd-bridge.h \
e-folder-type-registry.c \
e-folder-type-registry.h \
e-folder.c \
e-folder.h \
e-gray-bar.c \
e-gray-bar.h \
- e-history.c \
- e-history.h \
e-local-folder.c \
e-local-folder.h \
e-local-storage.c \
e-local-storage.h \
e-setup.c \
e-setup.h \
- e-shell-about-box.c \
e-shell-about-box.h \
- e-shell-config.c \
- e-shell-config.h \
+ e-shell-about-box.c \
e-shell-constants.h \
e-shell-folder-commands.c \
e-shell-folder-commands.h \
@@ -147,8 +133,6 @@ evolution_SOURCES = \
e-shell-importer.h \
e-shell-offline-handler.c \
e-shell-offline-handler.h \
- e-shell-settings-dialog.c \
- e-shell-settings-dialog.h \
e-shell-startup-wizard.c \
e-shell-startup-wizard.h \
e-shell-user-creatable-items-handler.c \
@@ -175,6 +159,8 @@ evolution_SOURCES = \
e-storage-set.h \
e-storage.c \
e-storage.h \
+ e-summary-storage.c \
+ e-summary-storage.h \
e-task-bar.c \
e-task-bar.h \
e-task-widget.c \
@@ -187,14 +173,18 @@ evolution_SOURCES = \
evolution-storage-set-view-factory.h \
main.c
-evolution_LDADD = \
- libeshell.la \
- importer/libevolution-importer.la \
+evolution_LDADD = \
+ libeshell.la \
+ importer/libevolution-importer.la \
$(top_builddir)/widgets/e-timezone-dialog/libetimezonedialog.a \
- $(top_builddir)/widgets/misc/libemiscwidgets.a \
- $(top_builddir)/e-util/libeutil.la \
+ $(top_builddir)/widgets/misc/libemiscwidgets.a \
+ $(top_builddir)/e-util/libeutil.la \
$(top_builddir)/libical/src/libical/libical-evolution.la \
- $(SHELL_LIBS)
+ $(EXTRA_GNOME_LIBS) \
+ $(GNOME_PRINT_LIBS) \
+ $(GTKHTML_LIBS) \
+ $(BONOBO_CONF_LIBS) \
+ $(BONOBO_GNOME_LIBS)
# Test component
@@ -206,7 +196,10 @@ evolution_test_component_SOURCES = \
evolution_test_component_LDADD = \
libeshell.la \
- $(SHELL_LIBS)
+ $(EXTRA_GNOME_LIBS) \
+ $(GNOME_PRINT_LIBS) \
+ $(GTKHTML_LIBS) \
+ $(BONOBO_GNOME_LIBS)
install-test-component: evolution-test-component
$(mkinstalldirs) $(DESTDIR)$(bindir)
@@ -221,7 +214,7 @@ oaf_in_files = GNOME_Evolution_Shell.oaf.in
oaf_DATA = $(oaf_in_files:.oaf.in=.oaf)
etspecdir = $(datadir)/evolution/etspec/
-etspec_DATA = e-storage-set-view.etspec e-storage-set-view-checkboxes.etstate e-storage-set-view-no-checkboxes.etstate
+etspec_DATA = e-storage-set-view.etspec
@XML_I18N_MERGE_OAF_RULE@
diff --git a/shell/e-setup.c b/shell/e-setup.c
index b3d41509c4..31c16eca2b 100644
--- a/shell/e-setup.c
+++ b/shell/e-setup.c
@@ -41,8 +41,6 @@
#include <gal/widgets/e-gui-utils.h>
#include "e-local-folder.h"
-#include "e-shell-config.h"
-#include "e-shell-constants.h"
#include "e-setup.h"
@@ -415,44 +413,3 @@ e_setup (const char *evolution_directory)
Check if it is up to date. */
return check_evolution_directory (evolution_directory);
}
-
-
-void
-e_setup_check_db (Bonobo_ConfigDatabase db, const char *evolution_directory)
-{
- char *uri;
-
- if (bonobo_config_get_string_with_default (db, "/DefaultFolders/mail_path", NULL, NULL) == NULL) {
- bonobo_config_set_string (db, "/DefaultFolders/mail_path",
- E_LOCAL_INBOX_URI, NULL);
- uri = g_strconcat ("file://", evolution_directory, "/local",
- strrchr (E_LOCAL_INBOX_URI, '/'), NULL);
- bonobo_config_set_string (db, "/DefaultFolders/mail_uri",
- uri, NULL);
- g_free (uri);
-
- bonobo_config_set_string (db, "/DefaultFolders/contacts_path",
- E_LOCAL_CONTACTS_URI, NULL);
- uri = g_strconcat ("file://", evolution_directory, "/local",
- strrchr (E_LOCAL_CONTACTS_URI, '/'), NULL);
- bonobo_config_set_string (db, "/DefaultFolders/contacts_uri",
- uri, NULL);
- g_free (uri);
-
- bonobo_config_set_string (db, "/DefaultFolders/calendar_path",
- E_LOCAL_CALENDAR_URI, NULL);
- uri = g_strconcat ("file://", evolution_directory, "/local",
- strrchr (E_LOCAL_CALENDAR_URI, '/'), NULL);
- bonobo_config_set_string (db, "/DefaultFolders/calendar_uri",
- uri, NULL);
- g_free (uri);
-
- bonobo_config_set_string (db, "/DefaultFolders/tasks_path",
- E_LOCAL_TASKS_URI, NULL);
- uri = g_strconcat ("file://", evolution_directory, "/local",
- strrchr (E_LOCAL_TASKS_URI, '/'), NULL);
- bonobo_config_set_string (db, "/DefaultFolders/tasks_uri",
- uri, NULL);
- g_free (uri);
- }
-}
diff --git a/shell/e-shell-about-box.c b/shell/e-shell-about-box.c
index 461cda2d08..4cd54f52fe 100644
--- a/shell/e-shell-about-box.c
+++ b/shell/e-shell-about-box.c
@@ -1,7 +1,7 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* e-shell-about-box.c
*
- * Copyright (C) 2001, 2002 Ximian, Inc.
+ * Copyright (C) 2001 Ximian, Inc.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
@@ -37,8 +37,8 @@ static GtkEventBoxClass *parent_class = NULL;
static const char *text[] = {
"",
- "Evolution " VERSION,
- "Copyright 1999 - 2002 Ximian, Inc.",
+ N_("Evolution " VERSION),
+ N_("Copyright 1999, 2000, 2001 Ximian, Inc."),
"",
N_("Brought to you by"),
"",
@@ -74,6 +74,7 @@ static const char *text[] = {
"Gediminas Paulauskas",
"Jesse Pavel",
"Ettore Perazzoli",
+ "Hans Petter",
"JP Rosevear",
"Jeffrey Stedfast",
"Jakub Steiner",
diff --git a/shell/e-shell-folder-commands.c b/shell/e-shell-folder-commands.c
index a2b1055b5a..4a2bbe7e4f 100644
--- a/shell/e-shell-folder-commands.c
+++ b/shell/e-shell-folder-commands.c
@@ -524,8 +524,7 @@ e_shell_command_rename_folder (EShell *shell,
EStorageSet *storage_set;
EFolder *folder;
RenameCallbackData *callback_data;
- const char *old_name;
- char *old_name_locale;
+ const char *old_name, *old_name_locale;
char *prompt;
char *new_name;
char *old_base_path;
@@ -544,7 +543,10 @@ e_shell_command_rename_folder (EShell *shell,
folder = e_storage_set_get_folder (storage_set, folder_path);
g_return_if_fail (folder != NULL);
- old_name = e_folder_get_name (folder);
+ /* Note that we don't need to get the display name here, as the stock
+ folders cannot be renamed anyway. */
+ old_name = g_basename (folder_path);
+
old_name_locale = e_utf8_to_locale_string (old_name);
prompt = g_strdup_printf (_("Rename the \"%s\" folder to:"), old_name_locale);
g_free (old_name_locale);
@@ -573,8 +575,8 @@ e_shell_command_rename_folder (EShell *shell,
return;
}
- old_base_path = g_dirname (folder_path);
- new_path = g_concat_dir_and_file (old_base_path, new_name);
+ old_base_path = g_strndup (folder_path, old_name - folder_path);
+ new_path = g_strconcat (old_base_path, new_name, NULL);
callback_data = rename_callback_data_new (shell_view, new_path);
e_storage_set_async_xfer_folder (storage_set, folder_path, new_path, TRUE, rename_cb, callback_data);
diff --git a/shell/e-shell-folder-creation-dialog.c b/shell/e-shell-folder-creation-dialog.c
index 7b9b5ab4de..dbbdcdfd74 100644
--- a/shell/e-shell-folder-creation-dialog.c
+++ b/shell/e-shell-folder-creation-dialog.c
@@ -262,6 +262,19 @@ storage_set_view_folder_selected_cb (EStorageSetView *storage_set_view,
gnome_dialog_set_sensitive (GNOME_DIALOG (dialog_data->dialog), 0, TRUE);
}
+static void
+storage_set_view_storage_selected_cb (EStorageSetView *storage_set_view,
+ const char *name,
+ void *data)
+{
+ DialogData *dialog_data;
+
+ dialog_data = (DialogData *) data;
+
+ if (GTK_ENTRY (dialog_data->folder_name_entry)->text_length > 0)
+ gnome_dialog_set_sensitive (GNOME_DIALOG (dialog_data->dialog), 0, TRUE);
+}
+
/* Shell signal callbacks. */
@@ -536,6 +549,8 @@ e_shell_show_folder_creation_dialog (EShell *shell,
gtk_signal_connect (GTK_OBJECT (dialog_data->storage_set_view), "folder_selected",
storage_set_view_folder_selected_cb, dialog_data);
+ gtk_signal_connect (GTK_OBJECT (dialog_data->storage_set_view), "storage_selected",
+ storage_set_view_storage_selected_cb, dialog_data);
gtk_signal_connect_while_alive (GTK_OBJECT (shell), "destroy",
GTK_SIGNAL_FUNC (shell_destroy_cb), dialog_data,
diff --git a/shell/e-shell-importer.c b/shell/e-shell-importer.c
index 54012965ab..c6e2bac359 100644
--- a/shell/e-shell-importer.c
+++ b/shell/e-shell-importer.c
@@ -46,7 +46,7 @@
#include "e-shell.h"
#include "e-shell-view.h"
-#include "e-shell-constants.h"
+#include "e-local-storage.h" /* for E_LOCAL_STORAGE_NAME */
#include "e-shell-folder-selection-dialog.h"
#include "importer/evolution-importer-client.h"
diff --git a/shell/e-shell-startup-wizard.c b/shell/e-shell-startup-wizard.c
index 33e3297bd6..3de62204dc 100644
--- a/shell/e-shell-startup-wizard.c
+++ b/shell/e-shell-startup-wizard.c
@@ -363,6 +363,12 @@ finish_func (GnomeDruidPage *page,
/* Free data */
data->cancel = FALSE;
+
+ /* Need to do this otherwise the timezone widget gets destroyed but the
+ timezone object isn't, and we can get a crash like #22047. */
+ gtk_object_unref (GTK_OBJECT (data->timezone_page->etd));
+ data->timezone_page->etd = NULL;
+
gtk_widget_destroy (data->dialog);
gtk_main_quit ();
@@ -816,6 +822,14 @@ startup_wizard_cancel (GnomeDruid *druid,
{
/* Free data */
data->cancel = TRUE;
+
+ if (data->timezone_page->etd != NULL) {
+ /* Need to do this otherwise the timezone widget gets destroyed but the
+ timezone object isn't, and we can get a crash like #22047. */
+ gtk_object_unref (GTK_OBJECT (data->timezone_page->etd));
+ data->timezone_page->etd = NULL;
+ }
+
gtk_widget_destroy (data->dialog);
gtk_main_quit ();
}
diff --git a/shell/e-shell-view-menu.c b/shell/e-shell-view-menu.c
index 5869048abf..649e37b016 100644
--- a/shell/e-shell-view-menu.c
+++ b/shell/e-shell-view-menu.c
@@ -24,23 +24,7 @@
/* FIXME: This file is a bit of a mess. */
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
-
-#include "e-shell-view-menu.h"
-
-#include "e-shell-folder-creation-dialog.h"
-#include "e-shell-folder-selection-dialog.h"
-
-#include "e-shell-constants.h"
-
-#include "e-shell-importer.h"
-#include "e-shell-about-box.h"
-
-#include "e-shell-folder-commands.h"
-
-#include "evolution-shell-component-utils.h"
#include <glib.h>
@@ -62,6 +46,19 @@
#include <gal/widgets/e-gui-utils.h>
+#include "e-shell-folder-creation-dialog.h"
+#include "e-shell-folder-selection-dialog.h"
+
+#include "e-shell-constants.h"
+
+#include "e-shell-view-menu.h"
+#include "e-shell-importer.h"
+#include "e-shell-about-box.h"
+
+#include "e-shell-folder-commands.h"
+
+#include "evolution-shell-component-utils.h"
+
/* Utility functions. */
@@ -269,20 +266,6 @@ command_toggle_shortcut_bar (BonoboUIComponent *component,
static void
-command_send_receive (BonoboUIComponent *ui_component,
- void *data,
- const char *path)
-{
- EShellView *shell_view;
- EShell *shell;
-
- shell_view = E_SHELL_VIEW (data);
- shell = e_shell_view_get_shell (shell_view);
-
- e_shell_send_receive (shell);
-}
-
-static void
command_new_folder (BonoboUIComponent *uih,
void *data,
const char *path)
@@ -581,18 +564,6 @@ command_new_shortcut (BonoboUIComponent *uih,
/* Tools menu. */
static void
-command_settings (BonoboUIComponent *uih,
- void *data,
- const char *path)
-{
- EShellView *shell_view;
-
- shell_view = E_SHELL_VIEW (data);
-
- e_shell_view_show_settings (shell_view);
-}
-
-static void
command_pilot_settings (BonoboUIComponent *uih,
void *data,
const char *path)
@@ -618,14 +589,14 @@ command_pilot_settings (BonoboUIComponent *uih,
}
-static BonoboUIVerb new_verbs [] = {
+BonoboUIVerb new_verbs [] = {
BONOBO_UI_VERB ("NewFolder", command_new_folder),
BONOBO_UI_VERB ("NewShortcut", command_new_shortcut),
BONOBO_UI_VERB_END
};
-static BonoboUIVerb file_verbs [] = {
+BonoboUIVerb file_verbs [] = {
BONOBO_UI_VERB ("FileImporter", (BonoboUIVerbFn) show_import_wizard),
BONOBO_UI_VERB ("FileGoToFolder", command_goto_folder),
BONOBO_UI_VERB ("FileCreateFolder", command_create_folder),
@@ -638,7 +609,7 @@ static BonoboUIVerb file_verbs [] = {
BONOBO_UI_VERB_END
};
-static BonoboUIVerb folder_verbs [] = {
+BonoboUIVerb folder_verbs [] = {
BONOBO_UI_VERB ("ActivateView", command_activate_view),
BONOBO_UI_VERB ("OpenFolderInNewWindow", command_open_folder_in_new_window),
BONOBO_UI_VERB ("MoveFolder", command_move_folder),
@@ -652,36 +623,24 @@ static BonoboUIVerb folder_verbs [] = {
BONOBO_UI_VERB_END
};
-static BonoboUIVerb actions_verbs[] = {
- BONOBO_UI_VERB ("SendReceive", command_send_receive),
-
- BONOBO_UI_VERB_END
-};
-
-static BonoboUIVerb tools_verbs[] = {
- BONOBO_UI_VERB ("Settings", command_settings),
-
+BonoboUIVerb tools_verbs[] = {
BONOBO_UI_VERB ("PilotSettings", command_pilot_settings),
BONOBO_UI_VERB_END
};
-static BonoboUIVerb help_verbs [] = {
+BonoboUIVerb help_verbs [] = {
BONOBO_UI_VERB_DATA ("HelpFAQ", command_help_faq, NULL),
BONOBO_UI_VERB_END
};
static EPixmap pixmaps [] = {
- E_PIXMAP ("/commands/SendReceive", "send-receive.xpm"),
-
E_PIXMAP ("/menu/File/New/Folder", "folder.xpm"),
E_PIXMAP ("/menu/File/Folder/Folder", "folder.xpm"),
E_PIXMAP ("/menu/File/FileImporter", "import.xpm"),
E_PIXMAP ("/menu/File/ToggleOffline", "work_offline.xpm"),
- E_PIXMAP ("/Toolbar/SendReceive", "buttons/send-24-receive.png"),
-
E_PIXMAP_END
};
@@ -802,7 +761,6 @@ e_shell_view_menu_setup (EShellView *shell_view)
bonobo_ui_component_add_verb_list_with_data (uic, folder_verbs, shell_view);
bonobo_ui_component_add_verb_list_with_data (uic, new_verbs, shell_view);
- bonobo_ui_component_add_verb_list_with_data (uic, actions_verbs, shell_view);
bonobo_ui_component_add_verb_list_with_data (uic, tools_verbs, shell_view);
bonobo_ui_component_add_verb_list (uic, help_verbs);
diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c
index 07ef3d2aa4..f1a03a772b 100644
--- a/shell/e-shell-view.c
+++ b/shell/e-shell-view.c
@@ -56,7 +56,6 @@
#include "evolution-shell-view.h"
#include "e-gray-bar.h"
-#include "e-history.h"
#include "e-shell-constants.h"
#include "e-shell-folder-title-bar.h"
#include "e-shell-utils.h"
@@ -90,9 +89,6 @@ struct _EShellViewPrivate {
BonoboUIComponent *ui_component;
BonoboUIContainer *ui_container;
- /* History of visited (evolution:) URIs. */
- EHistory *history;
-
/* Currently displayed URI. */
char *uri;
@@ -151,7 +147,6 @@ struct _EShellViewPrivate {
enum {
SHORTCUT_BAR_VISIBILITY_CHANGED,
FOLDER_BAR_VISIBILITY_CHANGED,
- VIEW_CHANGED,
LAST_SIGNAL
};
@@ -169,7 +164,7 @@ static guint signals[LAST_SIGNAL] = { 0 };
/* URI to display when the currently displayed folder is removed from the
storage. */
-#define FALLBACK_URI E_SUMMARY_URI
+#define FALLBACK_URI "evolution:/local/Inbox"
/* The icons for the offline/online status. */
@@ -188,7 +183,6 @@ static const char *get_storage_set_path_from_uri (const char *uri);
/* Boo. */
static void new_folder_cb (EStorageSet *storage_set, const char *path, void *data);
-static gboolean display_uri (EShellView *shell_view, const char *uri, gboolean add_to_history);
/* View handling. */
@@ -320,42 +314,6 @@ setup_verb_sensitivity_for_folder (EShellView *shell_view,
bonobo_ui_component_set_prop (ui_component, "/commands/RenameFolder", "sensitive", prop, NULL);
}
-
-static void
-update_navigation_buttons (EShellView *shell_view)
-{
- EShellViewPrivate *priv;
-
- priv = shell_view->priv;
-
- e_shell_folder_title_bar_update_navigation_buttons (E_SHELL_FOLDER_TITLE_BAR (priv->folder_title_bar),
- e_history_has_prev (priv->history),
- e_history_has_next (priv->history));
-}
-
-static int
-history_uri_matching_func (const void *a,
- const void *b)
-{
- const char *s1, *s2;
-
- s1 = (const char *) a;
- s2 = (const char *) b;
-
- return strcmp (s1, s2);
-}
-
-static void
-remove_uri_from_history (EShellView *shell_view,
- const char *uri)
-{
- EShellViewPrivate *priv;
-
- priv = shell_view->priv;
-
- e_history_remove_matching (priv->history, uri, history_uri_matching_func);
-}
-
/* This implements the behavior for when the folder which is currently displayed
gets deleted. */
@@ -496,16 +454,7 @@ storage_set_removed_folder_callback (EStorageSet *storage_set,
priv = shell_view->priv;
uri = g_strconcat (E_SHELL_URI_PREFIX, path, NULL);
-
- remove_uri_from_history (shell_view, uri);
- update_navigation_buttons (shell_view);
-
- /* (Note that at this point the current URI in the history might have
- been changed and not match the current view. But we catch this case
- when checking if this was the current view, below.) */
-
view = g_hash_table_lookup (priv->uri_to_view, uri);
-
g_free (uri);
if (view == NULL)
@@ -873,6 +822,23 @@ folder_selected_cb (EStorageSetView *storage_set_view,
switch_on_folder_tree_click (shell_view, path);
}
+/* Callback called when a storage in the tree view is clicked. */
+static void
+storage_selected_cb (EStorageSetView *storage_set_view,
+ const char *name,
+ void *data)
+{
+ EShellView *shell_view;
+ char *path;
+
+ shell_view = E_SHELL_VIEW (data);
+
+ path = g_strconcat (G_DIR_SEPARATOR_S, name, NULL);
+ switch_on_folder_tree_click (shell_view, path);
+
+ g_free (path);
+}
+
/* Callbacks for the folder context menu in the folder bar. */
static void
@@ -955,47 +921,6 @@ offline_toggle_clicked_cb (GtkButton *button,
}
-/* Navigation button callbacks. */
-
-static void
-back_clicked_callback (EShellFolderTitleBar *title_bar,
- void *data)
-{
- EShellView *shell_view;
- EShellViewPrivate *priv;
- const char *new_uri;
-
- shell_view = E_SHELL_VIEW (data);
- priv = shell_view->priv;
-
- if (! e_history_has_prev (priv->history))
- return;
-
- new_uri = (const char *) e_history_prev (priv->history);
-
- display_uri (shell_view, new_uri, FALSE);
-}
-
-static void
-forward_clicked_callback (EShellFolderTitleBar *title_bar,
- void *data)
-{
- EShellView *shell_view;
- EShellViewPrivate *priv;
- const char *new_uri;
-
- shell_view = E_SHELL_VIEW (data);
- priv = shell_view->priv;
-
- if (! e_history_has_next (priv->history))
- return;
-
- new_uri = (const char *) e_history_next (priv->history);
-
- display_uri (shell_view, new_uri, FALSE);
-}
-
-
/* Widget setup. */
static void
@@ -1008,10 +933,12 @@ setup_storage_set_subwindow (EShellView *shell_view)
priv = shell_view->priv;
- storage_set_view = e_storage_set_new_view (e_shell_get_storage_set (priv->shell),
+ storage_set_view = e_storage_set_view_new (e_shell_get_storage_set (priv->shell),
priv->ui_container);
gtk_signal_connect (GTK_OBJECT (storage_set_view), "folder_selected",
GTK_SIGNAL_FUNC (folder_selected_cb), shell_view);
+ gtk_signal_connect (GTK_OBJECT (storage_set_view), "storage_selected",
+ GTK_SIGNAL_FUNC (storage_selected_cb), shell_view);
gtk_signal_connect (GTK_OBJECT (storage_set_view), "folder_context_menu_popping_up",
GTK_SIGNAL_FUNC (folder_context_menu_popping_up_cb), shell_view);
gtk_signal_connect (GTK_OBJECT (storage_set_view), "folder_context_menu_popped_down",
@@ -1216,10 +1143,6 @@ setup_widgets (EShellView *shell_view)
priv->folder_title_bar = e_shell_folder_title_bar_new ();
gtk_signal_connect (GTK_OBJECT (priv->folder_title_bar), "title_toggled",
GTK_SIGNAL_FUNC (title_bar_toggled_cb), shell_view);
- gtk_signal_connect (GTK_OBJECT (priv->folder_title_bar), "back_clicked",
- GTK_SIGNAL_FUNC (back_clicked_callback), shell_view);
- gtk_signal_connect (GTK_OBJECT (priv->folder_title_bar), "forward_clicked",
- GTK_SIGNAL_FUNC (forward_clicked_callback), shell_view);
priv->view_hpaned = e_hpaned_new ();
e_paned_pack1 (E_PANED (priv->view_hpaned), priv->storage_set_view_box, FALSE, FALSE);
@@ -1303,15 +1226,8 @@ destroy (GtkObject *object)
storage set used for the delayed selection mechanism. */
cleanup_delayed_selection (shell_view);
- /* This is necessary to remove the signal handler for folder_new on the
- storage set used for the delayed selection mechanism. */
- cleanup_delayed_selection (shell_view);
-
gtk_object_unref (GTK_OBJECT (priv->tooltips));
- if (priv->history != NULL)
- gtk_object_unref (GTK_OBJECT (priv->history));
-
if (priv->shell != NULL)
bonobo_object_unref (BONOBO_OBJECT (priv->shell));
@@ -1382,18 +1298,6 @@ class_init (EShellViewClass *klass)
GTK_TYPE_NONE, 1,
GTK_TYPE_INT);
- signals[VIEW_CHANGED]
- = gtk_signal_new ("view_changed",
- GTK_RUN_FIRST,
- object_class->type,
- GTK_SIGNAL_OFFSET (EShellViewClass, view_changed),
- e_marshal_NONE__POINTER_POINTER_POINTER_POINTER,
- GTK_TYPE_NONE, 4,
- GTK_TYPE_STRING,
- GTK_TYPE_STRING,
- GTK_TYPE_STRING,
- GTK_TYPE_STRING);
-
gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
load_images ();
@@ -1409,7 +1313,6 @@ init (EShellView *shell_view)
priv->shell = NULL;
priv->corba_interface = NULL;
priv->ui_component = NULL;
- priv->history = e_history_new ((EHistoryItemFreeFunc) g_free);
priv->uri = NULL;
priv->delayed_selection = NULL;
@@ -1518,22 +1421,6 @@ corba_interface_set_folder_bar_label (EvolutionShellView *evolution_shell_view,
}
static void
-corba_interface_show_settings (EvolutionShellView *evolution_shell_view,
- void *data)
-{
- EShellView *shell_view;
- EShellViewPrivate *priv;
-
- g_return_if_fail (data != NULL);
- g_return_if_fail (E_IS_SHELL_VIEW (data));
-
- shell_view = E_SHELL_VIEW (data);
- priv = shell_view->priv;
-
- e_shell_view_show_settings (shell_view);
-}
-
-static void
unmerge_on_error (BonoboObject *object,
CORBA_Object cobject,
CORBA_Environment *ev)
@@ -1651,8 +1538,8 @@ e_shell_view_construct (EShellView *shell_view,
GTK_SIGNAL_FUNC (storage_set_removed_folder_callback), shell_view,
GTK_OBJECT (shell_view));
- e_shell_user_creatable_items_handler_attach_menus (e_shell_get_user_creatable_items_handler (priv->shell),
- shell_view);
+ e_shell_user_creatable_items_handler_setup_menus (e_shell_get_user_creatable_items_handler (priv->shell),
+ shell_view);
return view;
}
@@ -1799,19 +1686,30 @@ update_for_current_uri (EShellView *shell_view)
path = get_storage_set_path_from_uri (priv->uri);
- folder = NULL;
folder_name = NULL;
type = NULL;
unread_count = 0;
- if (path != NULL) {
+ if (path == NULL) {
+ folder = NULL;
+ } else {
folder = e_storage_set_get_folder (e_shell_get_storage_set (priv->shell), path);
if (folder != NULL) {
folder_name = e_folder_get_name (folder);
type = e_folder_get_type_string (folder);
unread_count = e_folder_get_unread_count (folder);
- }
+ } else if (path != NULL) {
+ EStorage *storage;
+
+ storage = e_storage_set_get_storage (e_shell_get_storage_set (priv->shell), path + 1);
+ unread_count = 0;
+
+ if (storage != NULL) {
+ folder_name = e_storage_get_display_name (storage);
+ type = e_storage_get_toplevel_node_type (storage);
+ }
+ }
}
if (unread_count > 0)
@@ -1912,6 +1810,7 @@ set_current_notebook_page (EShellView *shell_view,
if (current_page != -1 && current_page != 0) {
current = gtk_notebook_get_nth_page (notebook, current_page);
+
old_control_frame = bonobo_widget_get_control_frame (BONOBO_WIDGET (current));
bonobo_control_frame_set_autoactivate (old_control_frame, FALSE);
}
@@ -1961,9 +1860,6 @@ setup_corba_interface (EShellView *shell_view,
gtk_signal_connect_while_alive (GTK_OBJECT (corba_interface), "set_folder_bar_label",
GTK_SIGNAL_FUNC (corba_interface_set_folder_bar_label),
shell_view, GTK_OBJECT (shell_view));
- gtk_signal_connect_while_alive (GTK_OBJECT (corba_interface), "show_settings",
- GTK_SIGNAL_FUNC (corba_interface_show_settings),
- shell_view, GTK_OBJECT (shell_view));
bonobo_object_add_interface (BONOBO_OBJECT (control_frame),
BONOBO_OBJECT (corba_interface));
@@ -2009,10 +1905,17 @@ socket_destroy_cb (GtkWidget *socket_widget, gpointer data)
path = get_storage_set_path_from_uri (uri);
folder = e_storage_set_get_folder (e_shell_get_storage_set (priv->shell), path);
- if (folder != NULL)
+ if (folder != NULL) {
folder_type = e_folder_get_type_string (folder);
- else
- folder_type = NULL;
+ } else {
+ EStorage *storage;
+
+ storage = e_storage_set_get_storage (e_shell_get_storage_set (priv->shell), path + 1);
+ if (storage == NULL)
+ folder_type = NULL;
+ else
+ folder_type = e_storage_get_toplevel_node_type (storage);
+ }
/* See if we were actively viewing the uri for the socket that's being closed */
current_uri = e_shell_view_get_current_uri (shell_view);
@@ -2037,6 +1940,27 @@ socket_destroy_cb (GtkWidget *socket_widget, gpointer data)
static const char *
+get_type_for_storage (EShellView *shell_view,
+ const char *name,
+ const char **physical_uri_return)
+{
+ EShellViewPrivate *priv;
+ EStorageSet *storage_set;
+ EStorage *storage;
+
+ priv = shell_view->priv;
+
+ storage_set = e_shell_get_storage_set (priv->shell);
+ storage = e_storage_set_get_storage (storage_set, name);
+ if (!storage)
+ return NULL;
+
+ *physical_uri_return = e_storage_get_toplevel_node_uri (storage);
+
+ return e_storage_get_toplevel_node_type (storage);
+}
+
+static const char *
get_type_for_folder (EShellView *shell_view,
const char *path,
const char **physical_uri_return)
@@ -2061,8 +1985,7 @@ get_type_for_folder (EShellView *shell_view,
/* Create a new view for @uri with @control. It assumes a view for @uri does not exist yet. */
static View *
get_view_for_uri (EShellView *shell_view,
- const char *uri,
- const char *view_info)
+ const char *uri)
{
EShellViewPrivate *priv;
CORBA_Environment ev;
@@ -2074,6 +1997,7 @@ get_view_for_uri (EShellView *shell_view,
GtkWidget *socket;
Bonobo_Control corba_control;
const char *path;
+ const char *slash;
const char *physical_uri;
const char *folder_type;
int destroy_connection_id;
@@ -2088,8 +2012,13 @@ get_view_for_uri (EShellView *shell_view,
if (*path == '\0')
return NULL;
- folder_type = get_type_for_folder (shell_view, path, &physical_uri);
- if (folder_type == NULL || physical_uri == NULL)
+ /* FIXME: This code needs to be made more robust. */
+ slash = strchr (path + 1, G_DIR_SEPARATOR);
+ if (slash == NULL || slash[1] == '\0')
+ folder_type = get_type_for_storage (shell_view, path + 1, &physical_uri);
+ else
+ folder_type = get_type_for_folder (shell_view, path, &physical_uri);
+ if (folder_type == NULL)
return NULL;
folder_type_registry = e_shell_get_folder_type_registry (e_shell_view_get_shell (shell_view));
@@ -2102,7 +2031,7 @@ get_view_for_uri (EShellView *shell_view,
CORBA_exception_init (&ev);
- corba_control = GNOME_Evolution_ShellComponent_createView (handler, physical_uri, folder_type, view_info, &ev);
+ corba_control = GNOME_Evolution_ShellComponent_createView (handler, physical_uri, folder_type, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
CORBA_exception_free (&ev);
@@ -2156,8 +2085,7 @@ show_existing_view (EShellView *shell_view,
static gboolean
create_new_view_for_uri (EShellView *shell_view,
- const char *uri,
- const char *view_info)
+ const char *uri)
{
View *view;
EShellViewPrivate *priv;
@@ -2165,7 +2093,7 @@ create_new_view_for_uri (EShellView *shell_view,
priv = shell_view->priv;
- view = get_view_for_uri (shell_view, uri, view_info);
+ view = get_view_for_uri (shell_view, uri);
if (view == NULL)
return FALSE;
@@ -2185,24 +2113,18 @@ create_new_view_for_uri (EShellView *shell_view,
return TRUE;
}
-static gboolean
-display_uri (EShellView *shell_view,
- const char *uri,
- gboolean add_to_history)
+gboolean
+e_shell_view_display_uri (EShellView *shell_view,
+ const char *uri)
{
EShellViewPrivate *priv;
View *view;
gboolean retval;
- const char *view_info;
- char *real_uri;
-
- priv = shell_view->priv;
- if (uri == NULL && priv->uri == NULL)
- return TRUE;
+ g_return_val_if_fail (shell_view != NULL, FALSE);
+ g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), FALSE);
- if (priv->uri != NULL && uri != NULL && strcmp (priv->uri, uri) == 0)
- return TRUE;
+ priv = shell_view->priv;
bonobo_window_freeze (BONOBO_WINDOW (shell_view));
@@ -2213,32 +2135,23 @@ display_uri (EShellView *shell_view,
set_current_notebook_page (shell_view, 0);
g_free (priv->uri);
- priv->uri = real_uri = NULL;
+ priv->uri = NULL;
retval = TRUE;
goto end;
}
- view_info = strchr (uri, '#');
- if (view_info) {
- real_uri = g_strndup (uri, view_info - uri);
- view_info++;
- } else {
- view_info = "";
- real_uri = g_strdup (uri);
- }
-
if (strncmp (uri, E_SHELL_URI_PREFIX, E_SHELL_URI_PREFIX_LEN) != 0) {
retval = FALSE;
goto end;
}
- view = g_hash_table_lookup (priv->uri_to_view, real_uri);
+ view = g_hash_table_lookup (priv->uri_to_view, uri);
if (view != NULL) {
- show_existing_view (shell_view, real_uri, view);
- } else if (! create_new_view_for_uri (shell_view, real_uri, view_info)) {
+ show_existing_view (shell_view, uri, view);
+ } else if (! create_new_view_for_uri (shell_view, uri)) {
cleanup_delayed_selection (shell_view);
- priv->delayed_selection = g_strdup (real_uri);
+ priv->delayed_selection = g_strdup (uri);
gtk_signal_connect_full (GTK_OBJECT (e_shell_get_storage_set (priv->shell)),
"new_folder", GTK_SIGNAL_FUNC (new_folder_cb), NULL,
shell_view, NULL, FALSE, TRUE);
@@ -2249,13 +2162,6 @@ display_uri (EShellView *shell_view,
retval = TRUE;
end:
- g_free (real_uri);
-
- if (add_to_history && retval == TRUE && priv->uri != NULL)
- e_history_add (priv->history, g_strdup (priv->uri));
-
- update_navigation_buttons (shell_view);
-
g_free (priv->set_folder_uri);
priv->set_folder_uri = NULL;
@@ -2268,25 +2174,9 @@ display_uri (EShellView *shell_view,
bonobo_window_thaw (BONOBO_WINDOW (shell_view));
- gtk_signal_emit (GTK_OBJECT (shell_view), signals[VIEW_CHANGED],
- e_shell_view_get_current_path (shell_view),
- e_shell_view_get_current_uri (shell_view),
- e_shell_view_get_current_folder_type (shell_view),
- e_shell_view_get_current_component_id (shell_view));
-
return retval;
}
-gboolean
-e_shell_view_display_uri (EShellView *shell_view,
- const char *uri)
-{
- g_return_val_if_fail (shell_view != NULL, FALSE);
- g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), FALSE);
-
- return display_uri (shell_view, uri, TRUE);
-}
-
void
e_shell_view_show_shortcut_bar (EShellView *shell_view,
@@ -2344,8 +2234,8 @@ e_shell_view_show_folder_bar (EShellView *shell_view,
e_title_bar_set_button_mode (E_TITLE_BAR (priv->storage_set_title_bar),
E_TITLE_BAR_BUTTON_MODE_CLOSE);
- e_shell_folder_title_bar_set_title_clickable (E_SHELL_FOLDER_TITLE_BAR (priv->folder_title_bar),
- FALSE);
+ e_shell_folder_title_bar_set_clickable (E_SHELL_FOLDER_TITLE_BAR (priv->folder_title_bar),
+ FALSE);
} else {
if (GTK_WIDGET_VISIBLE (priv->storage_set_view_box)) {
/* FIXME this is a private field! */
@@ -2358,8 +2248,8 @@ e_shell_view_show_folder_bar (EShellView *shell_view,
e_title_bar_set_button_mode (E_TITLE_BAR (priv->storage_set_title_bar),
E_TITLE_BAR_BUTTON_MODE_PIN);
- e_shell_folder_title_bar_set_title_clickable (E_SHELL_FOLDER_TITLE_BAR (priv->folder_title_bar),
- TRUE);
+ e_shell_folder_title_bar_set_clickable (E_SHELL_FOLDER_TITLE_BAR (priv->folder_title_bar),
+ TRUE);
}
priv->folder_bar_shown = !! show;
@@ -2368,21 +2258,6 @@ e_shell_view_show_folder_bar (EShellView *shell_view,
priv->folder_bar_shown);
}
-void
-e_shell_view_show_settings (EShellView *shell_view)
-{
- EShellViewPrivate *priv;
- const char *type;
-
- g_return_if_fail (shell_view != NULL);
- g_return_if_fail (E_IS_SHELL_VIEW (shell_view));
-
- priv = shell_view->priv;
-
- type = e_shell_view_get_current_folder_type (shell_view);
- e_shell_show_settings (priv->shell, type, shell_view);
-}
-
gboolean
e_shell_view_shortcut_bar_shown (EShellView *shell_view)
{
@@ -2524,23 +2399,6 @@ e_shell_view_get_current_folder_type (EShellView *shell_view)
return get_type_for_folder (shell_view, current_path, NULL);
}
-const char *
-e_shell_view_get_current_component_id (EShellView *shell_view)
-{
- EShellViewPrivate *priv;
- EFolderTypeRegistry *type_registry;
- EvolutionShellComponentClient *component_client;
- const char *current_folder_type;
-
- priv = shell_view->priv;
-
- type_registry = e_shell_get_folder_type_registry (priv->shell);
- current_folder_type = e_shell_view_get_current_folder_type (shell_view);
- component_client = e_folder_type_registry_get_handler_for_type (type_registry, current_folder_type);
-
- return evolution_shell_component_client_get_id (component_client);
-}
-
/**
* e_shell_view_save_settings:
@@ -2670,7 +2528,6 @@ e_shell_view_load_settings (EShellView *shell_view,
int num_groups, group, val;
long width, height;
char *stringval, *prefix, *filename, *key;
- CORBA_Environment ev;
g_return_val_if_fail (shell_view != NULL, FALSE);
g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), FALSE);
@@ -2684,14 +2541,9 @@ e_shell_view_load_settings (EShellView *shell_view,
prefix = g_strdup_printf ("/Shell/Views/%d/", view_num);
- CORBA_exception_init (&ev);
key = g_strconcat (prefix, "Width", NULL);
- width = bonobo_config_get_long (db, key, &ev);
+ width = bonobo_config_get_long (db, key, NULL);
g_free (key);
- if (ev._major != CORBA_NO_EXCEPTION) {
- CORBA_exception_free (&ev);
- return FALSE;
- }
key = g_strconcat (prefix, "Height", NULL);
height = bonobo_config_get_long (db, key, NULL);
@@ -2728,18 +2580,16 @@ e_shell_view_load_settings (EShellView *shell_view,
priv->view_hpaned_position = val;
g_free (key);
- if (priv->uri == NULL && priv->delayed_selection == NULL) {
- key = g_strconcat (prefix, "DisplayedURI", NULL);
- stringval = bonobo_config_get_string (db, key, NULL);
- if (stringval) {
- if (! e_shell_view_display_uri (shell_view, stringval))
- e_shell_view_display_uri (shell_view, E_SHELL_VIEW_DEFAULT_URI);
- } else
+ key = g_strconcat (prefix, "DisplayedURI", NULL);
+ stringval = bonobo_config_get_string (db, key, NULL);
+ if (stringval) {
+ if (! e_shell_view_display_uri (shell_view, stringval))
e_shell_view_display_uri (shell_view, E_SHELL_VIEW_DEFAULT_URI);
+ } else
+ e_shell_view_display_uri (shell_view, E_SHELL_VIEW_DEFAULT_URI);
- g_free (stringval);
- g_free (key);
- }
+ g_free (stringval);
+ g_free (key);
num_groups = e_shortcut_model_get_num_groups (shortcut_bar->model);
diff --git a/shell/e-shell.c b/shell/e-shell.c
index 4b561078c6..38951a3e7e 100644
--- a/shell/e-shell.c
+++ b/shell/e-shell.c
@@ -45,7 +45,6 @@
#include <gal/widgets/e-gui-utils.h>
#include <gal/util/e-util.h>
-#include <gal/util/e-unicode-i18n.h>
#include "Evolution.h"
@@ -57,20 +56,17 @@
#include "e-corba-storage-registry.h"
#include "e-folder-type-registry.h"
#include "e-local-storage.h"
-#include "e-setup.h"
#include "e-shell-constants.h"
-#include "e-shell-corba-icon-utils.h"
#include "e-shell-folder-selection-dialog.h"
#include "e-shell-offline-handler.h"
-#include "e-shell-settings-dialog.h"
#include "e-shell-startup-wizard.h"
#include "e-shell-view.h"
#include "e-shortcuts.h"
#include "e-storage-set.h"
#include "e-splash.h"
+#include "e-summary-storage.h"
#include "e-uri-schema-registry.h"
-#include "evolution-shell-component-utils.h"
#include "evolution-storage-set-view-factory.h"
#include "e-shell.h"
@@ -91,7 +87,7 @@ struct _EShellPrivate {
EStorageSet *storage_set;
ELocalStorage *local_storage;
- EStorage *summary_storage;
+ ESummaryStorage *summary_storage;
EShortcuts *shortcuts;
EFolderTypeRegistry *folder_type_registry;
@@ -120,9 +116,6 @@ struct _EShellPrivate {
/* Line status. */
EShellLineStatus line_status;
- /* Settings Dialog */
- GtkWidget *settings_dialog;
-
/* Configuration Database */
Bonobo_ConfigDatabase db;
@@ -155,25 +148,6 @@ enum {
static guint signals[LAST_SIGNAL] = { 0 };
-/* Utility functions. */
-
-static void
-pop_up_activation_error_dialog (ESplash *splash,
- const char *id,
- CORBA_Environment *ev)
-{
- char *error_message;
-
- error_message = e_get_activation_failure_msg (ev);
- e_notice (GTK_WINDOW (splash), GNOME_MESSAGE_BOX_ERROR,
- _("Cannot activate component %s :\n"
- "The error from the activation system is:\n"
- "%s"),
- id, error_message);
- g_free (error_message);
-}
-
-
/* Interactivity handling. */
static void
@@ -245,7 +219,8 @@ folder_selection_dialog_folder_selected_cb (EShellFolderSelectionDialog *folder_
GNOME_Evolution_FolderSelectionListener listener;
EStorageSet *storage_set;
EFolder *folder;
- GNOME_Evolution_Folder corba_folder;
+ char *uri;
+ const char *physical_uri;
shell = E_SHELL (data);
listener = gtk_object_get_data (GTK_OBJECT (folder_selection_dialog), "corba_listener");
@@ -255,28 +230,15 @@ folder_selection_dialog_folder_selected_cb (EShellFolderSelectionDialog *folder_
storage_set = e_shell_get_storage_set (shell);
folder = e_storage_set_get_folder (storage_set, path);
- if (folder == NULL) {
- corba_folder.type = "";
- corba_folder.description = "";
- corba_folder.displayName = "";
- corba_folder.physicalUri = "";
- corba_folder.evolutionUri = "";
- corba_folder.unreadCount = -1;
- } else {
- corba_folder.type = (CORBA_char *)e_folder_get_type_string (folder);
- corba_folder.description = (CORBA_char *)e_folder_get_description (folder);
- if (corba_folder.description == NULL)
- corba_folder.description = "";
- corba_folder.displayName = (CORBA_char *)e_folder_get_name (folder);
- corba_folder.physicalUri = (CORBA_char *)e_folder_get_physical_uri (folder);
- if (corba_folder.physicalUri == NULL)
- corba_folder.physicalUri = "";
- corba_folder.evolutionUri = (CORBA_char *)g_strconcat (E_SHELL_URI_PREFIX, path, NULL);
- corba_folder.unreadCount = e_folder_get_unread_count (folder);
- }
+ uri = g_strconcat (E_SHELL_URI_PREFIX, path, NULL);
- GNOME_Evolution_FolderSelectionListener_notifySelected (listener, &corba_folder, &ev);
- g_free (corba_folder.evolutionUri);
+ if (folder == NULL)
+ physical_uri = "";
+ else
+ physical_uri = e_folder_get_physical_uri (folder);
+
+ GNOME_Evolution_FolderSelectionListener_notifySelected (listener, uri, physical_uri, &ev);
+ g_free (uri);
CORBA_exception_free (&ev);
@@ -354,36 +316,6 @@ impl_Shell_getComponentByType (PortableServer_Servant servant,
return CORBA_Object_duplicate (corba_component, ev);
}
-static GNOME_Evolution_Icon *
-impl_Shell_getIconByType (PortableServer_Servant servant,
- const CORBA_char *type,
- const CORBA_boolean mini,
- CORBA_Environment *ev)
-{
- BonoboObject *bonobo_object;
- EFolderTypeRegistry *folder_type_registry;
- GdkPixbuf *pixbuf;
- GNOME_Evolution_Icon *icon;
- EShell *shell;
-
- if (raise_exception_if_not_ready (servant, ev))
- return CORBA_OBJECT_NIL;
-
- bonobo_object = bonobo_object_from_servant (servant);
- shell = E_SHELL (bonobo_object);
- folder_type_registry = shell->priv->folder_type_registry;
-
- pixbuf = e_folder_type_registry_get_icon_for_type (folder_type_registry, type, mini);
-
- if (pixbuf == NULL) {
- CORBA_exception_set (ev, CORBA_USER_EXCEPTION, ex_GNOME_Evolution_Shell_NotFound, NULL);
- return CORBA_OBJECT_NIL;
- }
-
- icon = e_new_corba_icon_from_pixbuf (pixbuf);
- return icon;
-}
-
static GNOME_Evolution_ShellView
impl_Shell_createNewView (PortableServer_Servant servant,
const CORBA_char *uri,
@@ -407,7 +339,7 @@ impl_Shell_createNewView (PortableServer_Servant servant,
return CORBA_OBJECT_NIL;
}
- shell_view = e_shell_create_view_from_uri_and_settings (shell, uri, 0);
+ shell_view = e_shell_create_view (shell, uri, NULL);
if (shell_view == NULL) {
CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
ex_GNOME_Evolution_Shell_NotFound, NULL);
@@ -426,43 +358,6 @@ impl_Shell_createNewView (PortableServer_Servant servant,
}
static void
-handle_default_uri (EShell *shell, const char *uri, CORBA_Environment *ev)
-{
- char *component, *dbpath, *extra_info, *new_uri;
- gboolean def;
-
- component = g_strdup (uri + E_SHELL_DEFAULTURI_PREFIX_LEN);
- extra_info = strchr (component, '#');
- if (extra_info)
- *extra_info++ = '\0';
-
- dbpath = g_strdup_printf ("/DefaultFolders/%s_path", component);
- new_uri = bonobo_config_get_string_with_default (shell->priv->db,
- dbpath, NULL, &def);
- g_free (dbpath);
-
- if (new_uri == NULL) {
- CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
- ex_GNOME_Evolution_Shell_NotFound, NULL);
- g_free (component);
- return;
- }
-
- if (extra_info) {
- char *tmp;
-
- tmp = new_uri;
- new_uri = g_strdup_printf ("%s#%s", new_uri, extra_info);
- g_free (tmp);
- }
-
- e_shell_create_view_from_uri_and_settings (shell, new_uri, 0);
- g_free (new_uri);
- g_free (component);
- return;
-}
-
-static void
impl_Shell_handleURI (PortableServer_Servant servant,
const CORBA_char *uri,
CORBA_Environment *ev)
@@ -480,12 +375,7 @@ impl_Shell_handleURI (PortableServer_Servant servant,
priv = shell->priv;
if (strncmp (uri, E_SHELL_URI_PREFIX, E_SHELL_URI_PREFIX_LEN) == 0) {
- e_shell_create_view_from_uri_and_settings (shell, uri, 0);
- return;
- }
-
- if (strncmp (uri, E_SHELL_DEFAULTURI_PREFIX, E_SHELL_DEFAULTURI_PREFIX_LEN) == 0) {
- handle_default_uri (shell, uri, ev);
+ GNOME_Evolution_Shell_createNewView (bonobo_object_corba_objref (BONOBO_OBJECT (shell)), uri, ev);
return;
}
@@ -749,7 +639,6 @@ setup_local_storage (EShell *shell)
EStorage *local_storage;
EShellPrivate *priv;
gchar *local_storage_path;
- EFolder *summary_folder;
priv = shell->priv;
@@ -768,11 +657,8 @@ setup_local_storage (EShell *shell)
e_storage_set_add_storage (priv->storage_set, local_storage);
priv->local_storage = E_LOCAL_STORAGE (local_storage);
- summary_folder = e_folder_new (U_("Summary"), "summary", "");
- e_folder_set_physical_uri (summary_folder, "/");
- priv->summary_storage = e_storage_new (E_SUMMARY_STORAGE_NAME,
- summary_folder);
- e_storage_set_add_storage (priv->storage_set, priv->summary_storage);
+ priv->summary_storage = E_SUMMARY_STORAGE (e_summary_storage_new ());
+ e_storage_set_add_storage (priv->storage_set, E_STORAGE (priv->summary_storage));
return TRUE;
}
@@ -848,23 +734,17 @@ setup_components (EShell *shell,
for (i = 0; i < info_list->_length; i++) {
const OAF_ServerInfo *info;
- CORBA_Environment ev;
info = info_list->_buffer + i;
- CORBA_exception_init (&ev);
-
- if (! e_component_registry_register_component (priv->component_registry, info->iid, &ev)) {
- pop_up_activation_error_dialog (splash, info->iid, &ev);
+ if (! e_component_registry_register_component (priv->component_registry, info->iid)) {
+ g_warning ("Cannot activate Evolution component -- %s", info->iid);
} else {
e_shell_user_creatable_items_handler_add_component
(priv->user_creatable_items_handler,
- info->iid,
e_component_registry_get_component_by_id (priv->component_registry, info->iid));
}
- CORBA_exception_free (&ev);
-
if (splash != NULL)
e_splash_set_icon_highlight (splash, i, TRUE);
@@ -879,8 +759,7 @@ setup_components (EShell *shell,
/* FIXME what if anything fails here? */
static void
-set_owner_on_components (EShell *shell,
- ESplash *splash)
+set_owner_on_components (EShell *shell)
{
GNOME_Evolution_Shell corba_shell;
EShellPrivate *priv;
@@ -908,26 +787,14 @@ set_owner_on_components (EShell *shell,
id, evolution_shell_component_result_to_string (result));
if (result == EVOLUTION_SHELL_COMPONENT_OLDOWNERHASDIED) {
- CORBA_Environment ev;
-
- CORBA_exception_init (&ev);
-
- component_client = e_component_registry_restart_component (priv->component_registry,
- id, &ev);
-
- if (component_client == NULL) {
- pop_up_activation_error_dialog (splash, id, &ev);
- } else {
- result = evolution_shell_component_client_set_owner (component_client, corba_shell,
- local_directory);
- if (result != EVOLUTION_SHELL_COMPONENT_OK) {
- g_warning ("Error re-setting owner on component %s -- %s",
- id, evolution_shell_component_result_to_string (result));
- /* (At this point, we give up.) */
- }
+ component_client = e_component_registry_restart_component (priv->component_registry, id);
+ result = evolution_shell_component_client_set_owner (component_client, corba_shell,
+ local_directory);
+ if (result != EVOLUTION_SHELL_COMPONENT_OK) {
+ g_warning ("Error re-setting owner on component %s -- %s",
+ id, evolution_shell_component_result_to_string (result));
+ /* (At this point, we give up.) */
}
-
- CORBA_exception_free (&ev);
}
}
}
@@ -1002,8 +869,13 @@ create_view (EShell *shell,
gtk_signal_connect (GTK_OBJECT (view), "destroy",
GTK_SIGNAL_FUNC (view_destroy_cb), shell);
- if (uri != NULL)
- e_shell_view_display_uri (E_SHELL_VIEW (view), uri);
+ if (uri != NULL) {
+ if (!e_shell_view_display_uri (E_SHELL_VIEW (view), uri)) {
+ /* FIXME: Consider popping a dialog box up about how the provided URI does not
+ exist/could not be displayed. */
+ e_shell_view_display_uri (E_SHELL_VIEW (view), E_SHELL_VIEW_DEFAULT_URI);
+ }
+ }
shell->priv->views = g_list_prepend (shell->priv->views, view);
@@ -1135,7 +1007,6 @@ class_init (EShellClass *klass)
epv = & klass->epv;
epv->_get_displayName = impl_Shell__get_displayName;
epv->getComponentByType = impl_Shell_getComponentByType;
- epv->getIconByType = impl_Shell_getIconByType;
epv->createNewView = impl_Shell_createNewView;
epv->handleURI = impl_Shell_handleURI;
epv->selectUserFolder = impl_Shell_selectUserFolder;
@@ -1168,8 +1039,7 @@ init (EShell *shell)
priv->corba_shortcuts = NULL;
priv->offline_handler = NULL;
priv->crash_type_names = NULL;
- priv->line_status = E_SHELL_LINE_STATUS_OFFLINE;
- priv->settings_dialog = NULL;
+ priv->line_status = E_SHELL_LINE_STATUS_ONLINE;
priv->db = CORBA_OBJECT_NIL;
priv->is_initialized = FALSE;
priv->is_interactive = FALSE;
@@ -1184,7 +1054,6 @@ init (EShell *shell)
* @iid: OAFIID for registering the shell into the name server
* @local_directory: Local directory for storing local information and folders
* @show_splash: Whether to display a splash screen.
- * @startup_line_mode: How to set up the line mode (online or offline) initally.
*
* Construct @shell so that it uses the specified @local_directory and
* @corba_object.
@@ -1195,42 +1064,26 @@ EShellConstructResult
e_shell_construct (EShell *shell,
const char *iid,
const char *local_directory,
- gboolean show_splash,
- EShellStartupLineMode startup_line_mode)
+ gboolean show_splash)
{
GtkWidget *splash;
EShellPrivate *priv;
CORBA_Object corba_object;
CORBA_Environment ev;
gchar *shortcut_path;
- gboolean start_online;
-
g_return_val_if_fail (shell != NULL, E_SHELL_CONSTRUCT_RESULT_INVALIDARG);
g_return_val_if_fail (E_IS_SHELL (shell), E_SHELL_CONSTRUCT_RESULT_INVALIDARG);
g_return_val_if_fail (local_directory != NULL, E_SHELL_CONSTRUCT_RESULT_INVALIDARG);
g_return_val_if_fail (g_path_is_absolute (local_directory), E_SHELL_CONSTRUCT_RESULT_INVALIDARG);
- g_return_val_if_fail (startup_line_mode == E_SHELL_STARTUP_LINE_MODE_CONFIG
- || startup_line_mode == E_SHELL_STARTUP_LINE_MODE_ONLINE
- || startup_line_mode == E_SHELL_STARTUP_LINE_MODE_OFFLINE,
- E_SHELL_CONSTRUCT_RESULT_INVALIDARG);
priv = shell->priv;
-
+
priv->iid = g_strdup (iid);
priv->local_directory = g_strdup (local_directory);
priv->folder_type_registry = e_folder_type_registry_new ();
priv->uri_schema_registry = e_uri_schema_registry_new ();
priv->storage_set = e_storage_set_new (priv->folder_type_registry);
- e_folder_type_registry_register_type (priv->folder_type_registry,
- "noselect", "empty.gif",
- "noselect", "", FALSE,
- 0, NULL, 0, NULL);
- e_folder_type_registry_register_type (priv->folder_type_registry,
- "working", "working-16.png",
- "working", "", FALSE,
- 0, NULL, 0, NULL);
-
/* CORBA storages must be set up before the components, because otherwise components
cannot register their own storages. */
if (! setup_corba_storages (shell))
@@ -1250,7 +1103,6 @@ e_shell_construct (EShell *shell,
CORBA_exception_free (&ev);
return E_SHELL_CONSTRUCT_RESULT_NOCONFIGDB;
}
- e_setup_check_db (priv->db, local_directory);
CORBA_exception_free (&ev);
@@ -1310,7 +1162,7 @@ e_shell_construct (EShell *shell,
/* Now that we have a local storage and all the interfaces set up, we
can tell the components we are here. */
- set_owner_on_components (shell, E_SPLASH (splash));
+ set_owner_on_components (shell);
if (show_splash) {
gtk_widget_destroy (splash);
@@ -1325,24 +1177,6 @@ e_shell_construct (EShell *shell,
priv->is_initialized = TRUE;
- switch (startup_line_mode) {
- case E_SHELL_STARTUP_LINE_MODE_CONFIG:
- start_online = ! bonobo_config_get_boolean_with_default (priv->db, "/Shell/StartOffline", FALSE, NULL);
- break;
- case E_SHELL_STARTUP_LINE_MODE_ONLINE:
- start_online = TRUE;
- break;
- case E_SHELL_STARTUP_LINE_MODE_OFFLINE:
- start_online = FALSE;
- break;
- default:
- start_online = FALSE; /* Make compiler happy. */
- g_assert_not_reached ();
- }
-
- if (start_online)
- e_shell_go_online (shell, NULL);
-
return E_SHELL_CONSTRUCT_RESULT_OK;
}
@@ -1350,7 +1184,6 @@ e_shell_construct (EShell *shell,
* e_shell_new:
* @local_directory: Local directory for storing local information and folders.
* @show_splash: Whether to display a splash screen.
- * @start_online: Whether to start in on-line mode or not.
* @construct_result_return: A pointer to an EShellConstructResult variable into
* which the result of the operation will be stored.
*
@@ -1361,7 +1194,6 @@ e_shell_construct (EShell *shell,
EShell *
e_shell_new (const char *local_directory,
gboolean show_splash,
- EShellStartupLineMode startup_line_mode,
EShellConstructResult *construct_result_return)
{
EShell *new;
@@ -1373,11 +1205,7 @@ e_shell_new (const char *local_directory,
new = gtk_type_new (e_shell_get_type ());
- construct_result = e_shell_construct (new,
- E_SHELL_OAFIID,
- local_directory,
- show_splash,
- startup_line_mode);
+ construct_result = e_shell_construct (new, E_SHELL_OAFIID, local_directory, show_splash);
if (construct_result != E_SHELL_CONSTRUCT_RESULT_OK) {
*construct_result_return = construct_result;
@@ -1432,17 +1260,20 @@ e_shell_create_view (EShell *shell,
}
EShellView *
-e_shell_create_view_from_uri_and_settings (EShell *shell,
- const char *uri,
- int view_num)
+e_shell_create_view_from_settings (EShell *shell,
+ const char *uri,
+ EShellView *template_view,
+ int view_num,
+ gboolean *settings_found)
{
EShellView *view;
g_return_val_if_fail (shell != NULL, NULL);
g_return_val_if_fail (E_IS_SHELL (shell), NULL);
- view = create_view (shell, uri, NULL);
- e_shell_view_load_settings (view, view_num);
+ view = create_view (shell, uri, template_view);
+
+ *settings_found = e_shell_view_load_settings (view, view_num);
gtk_widget_show (GTK_WIDGET (view));
while (gtk_events_pending ())
@@ -1658,20 +1489,6 @@ save_settings_for_components (EShell *shell)
return retval;
}
-static gboolean
-save_misc_settings (EShell *shell)
-{
- EShellPrivate *priv;
- gboolean is_offline;
-
- priv = shell->priv;
-
- is_offline = ( e_shell_get_line_status (shell) == E_SHELL_LINE_STATUS_OFFLINE );
- bonobo_config_set_boolean (priv->db, "/Shell/StartOffline", is_offline, NULL);
-
- return TRUE;
-}
-
/**
* e_shell_save_settings:
* @shell:
@@ -1687,16 +1504,14 @@ e_shell_save_settings (EShell *shell)
{
gboolean views_saved;
gboolean components_saved;
- gboolean misc_saved;
g_return_val_if_fail (shell != NULL, FALSE);
g_return_val_if_fail (E_IS_SHELL (shell), FALSE);
views_saved = save_settings_for_views (shell);
components_saved = save_settings_for_components (shell);
- misc_saved = save_misc_settings (shell);
- return views_saved && components_saved && misc_saved;
+ return views_saved && components_saved;
}
/**
@@ -1713,6 +1528,7 @@ gboolean
e_shell_restore_from_settings (EShell *shell)
{
EShellPrivate *priv;
+ gboolean retval;
int num_views;
int i;
@@ -1724,10 +1540,21 @@ e_shell_restore_from_settings (EShell *shell)
num_views = bonobo_config_get_long_with_default (priv->db, "/Shell/Views/NumberOfViews", 0, NULL);
- for (i = 0; i < num_views; i++)
- e_shell_create_view_from_uri_and_settings (shell, NULL, i);
+ if (num_views == 0)
+ return FALSE;
+
+ retval = TRUE;
- return (num_views > 0);
+ for (i = 0; i < num_views; i++) {
+ EShellView *view;
+ gboolean settings_found;
+
+ view = e_shell_create_view_from_settings (shell, NULL, NULL, i, &settings_found);
+ if (! settings_found)
+ retval = FALSE;
+ }
+
+ return retval;
}
/**
@@ -1984,86 +1811,10 @@ e_shell_go_online (EShell *shell,
}
-void
-e_shell_send_receive (EShell *shell)
-{
- EShellPrivate *priv;
- GList *id_list;
- GList *p;
-
- g_return_if_fail (E_IS_SHELL (shell));
-
- priv = shell->priv;
-
- id_list = e_component_registry_get_id_list (priv->component_registry);
-
- for (p = id_list; p != NULL; p = p->next) {
- EvolutionShellComponentClient *component_client;
- CORBA_Environment ev;
- const char *id;
-
- id = (const char *) p->data;
- component_client = e_component_registry_get_component_by_id (priv->component_registry, id);
-
- CORBA_exception_init (&ev);
-
- GNOME_Evolution_ShellComponent_sendReceive
- (bonobo_object_corba_objref (BONOBO_OBJECT (component_client)), TRUE, &ev);
-
- if (BONOBO_EX (&ev))
- g_warning ("Error invoking Send/Receive on %s -- %s", id, BONOBO_EX_ID (&ev));
-
- CORBA_exception_free (&ev);
- }
-
- e_free_string_list (id_list);
-}
-
-static void
-settings_dialog_destroy_cb (GtkWidget *widget, void *data)
-{
- EShell *shell;
- EShellPrivate *priv;
-
- shell = E_SHELL (data);
- priv = shell->priv;
-
- priv->settings_dialog = NULL;
-}
-
-void
-e_shell_show_settings (EShell *shell, const char *type, EShellView *shell_view)
-{
- EShellPrivate *priv;
-
- g_return_if_fail (shell != NULL);
- g_return_if_fail (E_IS_SHELL (shell));
- g_return_if_fail (type != NULL);
-
- priv = shell->priv;
-
- if (priv->settings_dialog != NULL) {
- gdk_window_show (priv->settings_dialog->window);
- gtk_widget_grab_focus (priv->settings_dialog);
- return;
- }
-
- priv->settings_dialog = e_shell_settings_dialog_new ();
- e_shell_settings_dialog_show_type (E_SHELL_SETTINGS_DIALOG (priv->settings_dialog), type);
-
- gtk_signal_connect (GTK_OBJECT (priv->settings_dialog), "destroy",
- GTK_SIGNAL_FUNC (settings_dialog_destroy_cb), shell);
-
- gtk_window_set_transient_for (GTK_WINDOW (priv->settings_dialog), GTK_WINDOW (shell_view));
- gtk_widget_show (priv->settings_dialog);
-
-}
-
-
Bonobo_ConfigDatabase
e_shell_get_config_db (EShell *shell)
{
- g_return_val_if_fail (E_IS_SHELL (shell), CORBA_OBJECT_NIL);
+ g_return_val_if_fail (shell != NULL, CORBA_OBJECT_NIL);
return shell->priv->db;
}
diff --git a/shell/e-splash.c b/shell/e-splash.c
index 90682e90af..f72ea77b12 100644
--- a/shell/e-splash.c
+++ b/shell/e-splash.c
@@ -332,7 +332,6 @@ e_splash_construct (ESplash *splash,
gtk_window_set_position (GTK_WINDOW (splash), GTK_WIN_POS_CENTER);
gtk_window_set_policy (GTK_WINDOW (splash), FALSE, FALSE, FALSE);
gtk_window_set_default_size (GTK_WINDOW (splash), image_width, image_height);
- gtk_window_set_wmclass (GTK_WINDOW (splash), "evolution-splash", "Evolution");
gnome_window_icon_set_from_file (GTK_WINDOW (splash), EVOLUTION_DATADIR "/pixmaps/evolution.png");
gtk_window_set_title (GTK_WINDOW (splash), "Ximian Evolution");
diff --git a/shell/main.c b/shell/main.c
index efb0294b6f..766d6e6d7d 100644
--- a/shell/main.c
+++ b/shell/main.c
@@ -23,7 +23,6 @@
#include <config.h>
#include <fcntl.h>
#include <glib.h>
-#include <stdio.h>
#include <gtk/gtkframe.h>
#include <gtk/gtklabel.h>
@@ -54,7 +53,6 @@
#include "e-util/e-gtk-utils.h"
#include "e-shell-constants.h"
-#include "e-shell-config.h"
#include "e-setup.h"
#include "e-shell.h"
@@ -62,11 +60,7 @@
static EShell *shell = NULL;
static char *evolution_directory = NULL;
-
-/* Command-line options. */
static gboolean no_splash = FALSE;
-static gboolean start_online = FALSE;
-static gboolean start_offline = FALSE;
extern char *evolution_debug_log;
@@ -188,30 +182,19 @@ idle_cb (void *data)
GNOME_Evolution_Shell corba_shell;
CORBA_Environment ev;
EShellConstructResult result;
- EShellStartupLineMode startup_line_mode;
GSList *p;
gboolean have_evolution_uri;
gboolean display_default;
- gboolean displayed_any;
CORBA_exception_init (&ev);
uri_list = (GSList *) data;
- if (! start_online && ! start_offline)
- startup_line_mode = E_SHELL_STARTUP_LINE_MODE_CONFIG;
- else if (start_online)
- startup_line_mode = E_SHELL_STARTUP_LINE_MODE_ONLINE;
- else
- startup_line_mode = E_SHELL_STARTUP_LINE_MODE_OFFLINE;
-
- shell = e_shell_new (evolution_directory, ! no_splash, startup_line_mode, &result);
+ shell = e_shell_new (evolution_directory, ! no_splash, &result);
g_free (evolution_directory);
switch (result) {
case E_SHELL_CONSTRUCT_RESULT_OK:
- e_shell_config_factory_register (shell);
-
gtk_signal_connect (GTK_OBJECT (shell), "no_views_left",
GTK_SIGNAL_FUNC (no_views_left_cb), NULL);
gtk_signal_connect (GTK_OBJECT (shell), "destroy",
@@ -246,25 +229,16 @@ idle_cb (void *data)
const char *uri;
uri = (const char *) p->data;
- if (strncmp (uri, E_SHELL_URI_PREFIX, E_SHELL_URI_PREFIX_LEN) == 0 ||
- strncmp (uri, E_SHELL_DEFAULTURI_PREFIX, E_SHELL_DEFAULTURI_PREFIX_LEN) == 0)
+ if (strncmp (uri, E_SHELL_URI_PREFIX, E_SHELL_URI_PREFIX_LEN) == 0)
have_evolution_uri = TRUE;
}
if (shell == NULL) {
- /* We're talking to a remote shell. If the user didn't
- * ask us to open any particular URI, then open another
- * view of the default URI
- */
if (uri_list == NULL)
display_default = TRUE;
else
display_default = FALSE;
} else {
- /* We're starting a new shell. If the user didn't specify
- * any evolution: URIs to view, AND we can't load the
- * user's previous settings, then show the default URI.
- */
if (! have_evolution_uri) {
if (! e_shell_restore_from_settings (shell))
display_default = TRUE;
@@ -275,31 +249,29 @@ idle_cb (void *data)
}
}
- displayed_any = FALSE;
- for (p = uri_list; p != NULL; p = p->next) {
+ if (display_default) {
const char *uri;
- uri = (const char *) p->data;
+ uri = E_SHELL_VIEW_DEFAULT_URI;
GNOME_Evolution_Shell_handleURI (corba_shell, uri, &ev);
- if (ev._major == CORBA_NO_EXCEPTION)
- displayed_any = TRUE;
- else {
+ if (ev._major != CORBA_NO_EXCEPTION)
g_warning ("CORBA exception %s when requesting URI -- %s", ev._repo_id, uri);
- CORBA_exception_free (&ev);
- }
}
- g_slist_free (uri_list);
-
- if (display_default && ! displayed_any) {
+ for (p = uri_list; p != NULL; p = p->next) {
const char *uri;
- uri = E_SHELL_VIEW_DEFAULT_URI;
+ uri = (const char *) p->data;
GNOME_Evolution_Shell_handleURI (corba_shell, uri, &ev);
if (ev._major != CORBA_NO_EXCEPTION)
g_warning ("CORBA exception %s when requesting URI -- %s", ev._repo_id, uri);
+
+ if (strncmp (uri, E_SHELL_URI_PREFIX, E_SHELL_URI_PREFIX_LEN) == 0)
+ have_evolution_uri = TRUE;
}
+ g_slist_free (uri_list);
+
CORBA_Object_release (corba_shell, &ev);
CORBA_exception_free (&ev);
@@ -315,8 +287,6 @@ main (int argc, char **argv)
{
struct poptOption options[] = {
{ "no-splash", '\0', POPT_ARG_NONE, &no_splash, 0, N_("Disable splash screen"), NULL },
- { "offline", '\0', POPT_ARG_NONE, &start_offline, 0, N_("Start in offline mode"), NULL },
- { "online", '\0', POPT_ARG_NONE, &start_online, 0, N_("Start in online mode"), NULL },
{ "debug", '\0', POPT_ARG_STRING, &evolution_debug_log, 0, N_("Send the debugging output of all components to a file."), NULL },
{ NULL, '\0', POPT_ARG_INCLUDE_TABLE, &oaf_popt_options, 0, NULL, NULL },
POPT_AUTOHELP
@@ -334,12 +304,6 @@ main (int argc, char **argv)
gnome_init_with_popt_table ("Evolution", VERSION " [" SUB_VERSION "]", argc, argv, options, 0, &popt_context);
- if (start_online && start_offline) {
- fprintf (stderr, _("%s: --online and --offline cannot be used together.\n Use %s --help for more information.\n"),
- argv[0], argv[0]);
- exit (1);
- }
-
if (evolution_debug_log) {
int fd;
diff --git a/tools/.cvsignore b/tools/.cvsignore
index 60825eed01..c7067fc98e 100644
--- a/tools/.cvsignore
+++ b/tools/.cvsignore
@@ -1,8 +1,8 @@
Makefile
Makefile.in
-evolution-addressbook-abuse
evolution-addressbook-clean
evolution-addressbook-import
evolution-addressbook-export
+evolution-addressbook-abuse
.deps
.libs \ No newline at end of file
diff --git a/tools/Makefile.am b/tools/Makefile.am
index 41e7ff7a86..347e45f454 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -10,26 +10,30 @@ bin_PROGRAMS = \
noinst_PROGRAMS = evolution-addressbook-abuse
-INCLUDES = \
- -DG_LOG_DOMAIN=\"evolution-tools\" \
- -I$(top_srcdir) \
- -I$(top_builddir) \
- -DEVOLUTION_BINDIR=\""$(bindir)"\" \
- -DEVOLUTION_LOCALEDIR=\""$(localedir)"\" \
- -I$(top_srcdir)/addressbook \
- $(GNOME_FULL_CFLAGS)
+INCLUDES = \
+ -DG_LOG_DOMAIN=\"evolution-tools\" \
+ $(EXTRA_GNOME_CFLAGS) \
+ $(GNOME_INCLUDEDIR) \
+ -I$(top_srcdir) \
+ -I$(top_builddir) \
+ $(BONOBO_HTML_GNOME_CFLAGS) \
+ -DEVOLUTION_BINDIR=\""$(bindir)"\" \
+ -DEVOLUTION_LOCALEDIR=\""$(localedir)"\" \
+ -I$(top_srcdir)/addressbook
EXTRA_DIST = $(bin_SCRIPTS) verify-evolution-install.sh \
evolution-addressbook-clean.in
-evolution_addressbook_import_LDADD = \
- $(GNOME_FULL_LIBS) \
- $(top_builddir)/addressbook/backend/ebook/libebook.la \
- $(top_builddir)/camel/libcamel.la \
- $(top_builddir)/libibex/libibex.la \
- $(top_builddir)/e-util/ename/libename.la \
- $(top_builddir)/libversit/libversit.a \
- $(top_builddir)/e-util/libeutil.la \
+evolution_addressbook_import_LDADD = \
+ $(EXTRA_GNOME_LIBS) \
+ $(BONOBO_HTML_GNOME_LIBS) \
+ $(BONOBO_CONF_LIBS) \
+ $(top_builddir)/addressbook/backend/ebook/libebook.la \
+ $(top_builddir)/camel/libcamel.la \
+ $(top_builddir)/libibex/libibex.la \
+ $(top_builddir)/e-util/ename/libename.la \
+ $(top_builddir)/libversit/libversit.la \
+ $(top_builddir)/e-util/libeutil.la \
$(top_builddir)/widgets/menus/libmenus.la
evolution_addressbook_export_LDADD = \
diff --git a/widgets/ChangeLog b/widgets/ChangeLog
index 51047e0201..78a37f315d 100644
--- a/widgets/ChangeLog
+++ b/widgets/ChangeLog
@@ -1,27 +1,7 @@
-2002-02-27 Larry Ewing <lewing@ximian.com>
+2002-04-04 Ettore Perazzoli <ettore@ximian.com>
- * misc/e-combo-button.c (impl_button_press_event): make a right
- click bring up the popup menu.
-
-2002-02-07 Christopher James Lahey <clahey@ximian.com>
-
- * menus/gal-view-menus.c, menus/gal-view-menus.h
- (gal_view_menus_unmerge): New function to handle unmerging menus
- at control deactivation time.
- (d): Turned off debugging output here.
- (build_menus): Gave the separators names and marked them with f=""
- to make them work better with bonobo 1.
-
-2002-02-07 Christopher James Lahey <clahey@ximian.com>
-
- * menus/gal-view-menus.c, menus/gal-view-menus.h
- (gal_view_menus_new): Made this take a GalViewInstance instead of
- a GalViewCollection. Reworked most of this to utilize the
- interfaces provided by GalViewInstance.
-
-2002-01-27 Ettore Perazzoli <ettore@ximian.com>
-
- * menus/Makefile.am: Use `GNOME_FULL_CFLAGS'.
+ * e-timezone-dialog/e-timezone-dialog.c (e_timezone_dialog_init):
+ Make not floating.
2002-01-11 Damon Chaplin <damon@ximian.com>
diff --git a/widgets/e-timezone-dialog/e-timezone-dialog.c b/widgets/e-timezone-dialog/e-timezone-dialog.c
index 293f2a0680..6b99bf4689 100644
--- a/widgets/e-timezone-dialog/e-timezone-dialog.c
+++ b/widgets/e-timezone-dialog/e-timezone-dialog.c
@@ -133,6 +133,8 @@ e_timezone_dialog_init (ETimezoneDialog *etd)
{
ETimezoneDialogPrivate *priv;
+ GTK_OBJECT_UNSET_FLAGS (etd, GTK_FLOATING);
+
priv = g_new0 (ETimezoneDialogPrivate, 1);
etd->priv = priv;
diff --git a/widgets/menus/gal-define-views-dialog.c b/widgets/menus/gal-define-views-dialog.c
deleted file mode 100644
index 55588fd960..0000000000
--- a/widgets/menus/gal-define-views-dialog.c
+++ /dev/null
@@ -1,335 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * gal-define-views-dialog.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <libgnomeui/gnome-dialog.h>
-#include <libgnomeui/gnome-stock.h>
-#include "gal-define-views-dialog.h"
-#include "gal-define-views-model.h"
-#include "gal-view-new-dialog.h"
-#include <gal/e-table/e-table-scrolled.h>
-
-static void gal_define_views_dialog_init (GalDefineViewsDialog *card);
-static void gal_define_views_dialog_class_init (GalDefineViewsDialogClass *klass);
-static void gal_define_views_dialog_set_arg (GtkObject *o, GtkArg *arg, guint arg_id);
-static void gal_define_views_dialog_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
-static void gal_define_views_dialog_destroy (GtkObject *object);
-
-static GnomeDialogClass *parent_class = NULL;
-#define PARENT_TYPE gnome_dialog_get_type()
-
-/* The arguments we take */
-enum {
- ARG_0,
- ARG_COLLECTION,
-};
-
-typedef struct {
- char *title;
- ETableModel *model;
- GalDefineViewsDialog *names;
-} GalDefineViewsDialogChild;
-
-GtkType
-gal_define_views_dialog_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type) {
- static const GtkTypeInfo info =
- {
- "GalDefineViewsDialog",
- sizeof (GalDefineViewsDialog),
- sizeof (GalDefineViewsDialogClass),
- (GtkClassInitFunc) gal_define_views_dialog_class_init,
- (GtkObjectInitFunc) gal_define_views_dialog_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- type = gtk_type_unique (PARENT_TYPE, &info);
- }
-
- return type;
-}
-
-static void
-gal_define_views_dialog_class_init (GalDefineViewsDialogClass *klass)
-{
- GtkObjectClass *object_class;
-
- object_class = (GtkObjectClass*) klass;
-
- parent_class = gtk_type_class (PARENT_TYPE);
-
- object_class->set_arg = gal_define_views_dialog_set_arg;
- object_class->get_arg = gal_define_views_dialog_get_arg;
- object_class->destroy = gal_define_views_dialog_destroy;
-
- gtk_object_add_arg_type("GalDefineViewsDialog::collection", GAL_VIEW_COLLECTION_TYPE,
- GTK_ARG_READWRITE, ARG_COLLECTION);
-}
-
-/* ETable creation */
-#define SPEC "<ETableSpecification cursor-mode=\"line\" draw-grid=\"true\" selection-mode=\"single\">" \
- "<ETableColumn model_col= \"0\" _title=\"Name\" expansion=\"1.0\" minimum_width=\"18\" resizable=\"true\" cell=\"string\" compare=\"string\"/>" \
- "<ETableState> <column source=\"0\"/> <grouping> </grouping> </ETableState>" \
- "</ETableSpecification>"
-
-/* For use from libglade. */
-GtkWidget *gal_define_views_dialog_create_etable(char *name, char *string1, char *string2, int int1, int int2);
-
-GtkWidget *
-gal_define_views_dialog_create_etable(char *name, char *string1, char *string2, int int1, int int2)
-{
- GtkWidget *table;
- ETableModel *model;
- model = gal_define_views_model_new();
- table = e_table_scrolled_new(model, NULL, SPEC, NULL);
- gtk_object_set_data(GTK_OBJECT(table), "GalDefineViewsDialog::model", model);
- return table;
-}
-
-/* Button callbacks */
-
-static void
-gdvd_button_new_dialog_callback(GtkWidget *widget, int button, GalDefineViewsDialog *dialog)
-{
- gchar *name;
- GalView *view;
- GalViewFactory *factory;
- switch (button) {
- case 0:
- gtk_object_get(GTK_OBJECT(widget),
- "name", &name,
- "factory", &factory,
- NULL);
- if (name && factory) {
- view = gal_view_factory_new_view(factory,
- name);
- gal_define_views_model_append(GAL_DEFINE_VIEWS_MODEL(dialog->model), view);
- gtk_object_unref(GTK_OBJECT(view));
- }
- break;
- }
- gnome_dialog_close(GNOME_DIALOG(widget));
-}
-
-static void
-gdvd_button_new_callback(GtkWidget *widget, GalDefineViewsDialog *dialog)
-{
- GtkWidget *view_new_dialog = gal_view_new_dialog_new(dialog->collection);
- gtk_signal_connect(GTK_OBJECT(view_new_dialog), "clicked",
- GTK_SIGNAL_FUNC(gdvd_button_new_dialog_callback), dialog);
- gtk_widget_show(GTK_WIDGET(view_new_dialog));
-}
-
-static void
-gdvd_button_modify_callback(GtkWidget *widget, GalDefineViewsDialog *dialog)
-{
- int row;
- GtkWidget *scrolled;
- ETable *etable;
-
- scrolled = glade_xml_get_widget(dialog->gui, "custom-table");
- etable = e_table_scrolled_get_table(E_TABLE_SCROLLED(scrolled));
- row = e_table_get_cursor_row (E_TABLE(etable));
-
- if (row != -1) {
- GalView *view;
- view = gal_define_views_model_get_view(GAL_DEFINE_VIEWS_MODEL(dialog->model),
- row);
- gal_view_edit(view);
- }
-
-}
-
-static void
-gdvd_button_delete_callback(GtkWidget *widget, GalDefineViewsDialog *dialog)
-{
- int row;
- GtkWidget *scrolled;
- ETable *etable;
-
- scrolled = glade_xml_get_widget(dialog->gui, "custom-table");
- etable = e_table_scrolled_get_table(E_TABLE_SCROLLED(scrolled));
- row = e_table_get_cursor_row (E_TABLE(etable));
-
- if (row != -1) {
- gal_define_views_model_delete_view(GAL_DEFINE_VIEWS_MODEL(dialog->model),
- row);
- }
-
-}
-
-static void
-gdvd_button_copy_callback(GtkWidget *widget, GalDefineViewsDialog *dialog)
-{
- int row;
- GtkWidget *scrolled;
- ETable *etable;
-
- scrolled = glade_xml_get_widget(dialog->gui, "custom-table");
- etable = e_table_scrolled_get_table(E_TABLE_SCROLLED(scrolled));
- row = e_table_get_cursor_row (E_TABLE(etable));
-
- if (row != -1) {
- gal_define_views_model_copy_view(GAL_DEFINE_VIEWS_MODEL(dialog->model),
- row);
- }
-
-}
-
-static void
-gdvd_connect_signal(GalDefineViewsDialog *dialog, char *widget_name, char *signal, GtkSignalFunc handler)
-{
- GtkWidget *widget;
-
- widget = glade_xml_get_widget(dialog->gui, widget_name);
-
- if (widget)
- gtk_signal_connect(GTK_OBJECT(widget), signal, handler, dialog);
-}
-
-static void
-gal_define_views_dialog_init (GalDefineViewsDialog *dialog)
-{
- GladeXML *gui;
- GtkWidget *widget;
- GtkWidget *etable;
-
- dialog->collection = NULL;
-
- gui = glade_xml_new_with_domain (GAL_GLADEDIR "/gal-define-views.glade", NULL, PACKAGE);
- dialog->gui = gui;
-
- widget = glade_xml_get_widget(gui, "table-top");
- if (!widget) {
- return;
- }
- gtk_widget_ref(widget);
- gtk_widget_unparent(widget);
- gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(dialog)->vbox), widget, TRUE, TRUE, 0);
- gtk_widget_unref(widget);
-
- gnome_dialog_append_buttons(GNOME_DIALOG(dialog),
- GNOME_STOCK_BUTTON_OK,
- GNOME_STOCK_BUTTON_CANCEL,
- NULL);
-
- gdvd_connect_signal(dialog, "button-new", "clicked", GTK_SIGNAL_FUNC(gdvd_button_new_callback));
- gdvd_connect_signal(dialog, "button-modify", "clicked", GTK_SIGNAL_FUNC(gdvd_button_modify_callback));
- gdvd_connect_signal(dialog, "button-delete", "clicked", GTK_SIGNAL_FUNC(gdvd_button_delete_callback));
- gdvd_connect_signal(dialog, "button-copy", "clicked", GTK_SIGNAL_FUNC(gdvd_button_copy_callback));
-
- dialog->model = NULL;
- etable = glade_xml_get_widget(dialog->gui, "custom-table");
- if (etable) {
- dialog->model = gtk_object_get_data(GTK_OBJECT(etable), "GalDefineViewsDialog::model");
- gtk_object_set(GTK_OBJECT(dialog->model),
- "collection", dialog->collection,
- NULL);
- }
-
- gtk_window_set_policy(GTK_WINDOW(dialog), FALSE, TRUE, FALSE);
-}
-
-static void
-gal_define_views_dialog_destroy (GtkObject *object)
-{
- GalDefineViewsDialog *gal_define_views_dialog = GAL_DEFINE_VIEWS_DIALOG(object);
-
- gtk_object_unref(GTK_OBJECT(gal_define_views_dialog->gui));
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-static void
-gal_define_views_dialog_set_collection(GalDefineViewsDialog *dialog,
- GalViewCollection *collection)
-{
- dialog->collection = collection;
- if (dialog->model) {
- gtk_object_set(GTK_OBJECT(dialog->model),
- "collection", collection,
- NULL);
- }
-}
-
-/**
- * gal_define_views_dialog_new
- *
- * Returns a new dialog for defining views.
- *
- * Returns: The GalDefineViewsDialog.
- */
-GtkWidget*
-gal_define_views_dialog_new (GalViewCollection *collection)
-{
- GtkWidget *widget = GTK_WIDGET (gtk_type_new (gal_define_views_dialog_get_type ()));
- gal_define_views_dialog_set_collection(GAL_DEFINE_VIEWS_DIALOG (widget), collection);
- return widget;
-}
-
-static void
-gal_define_views_dialog_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- GalDefineViewsDialog *dialog;
-
- dialog = GAL_DEFINE_VIEWS_DIALOG (o);
-
- switch (arg_id){
- case ARG_COLLECTION:
- if (GTK_VALUE_OBJECT(*arg))
- gal_define_views_dialog_set_collection(dialog, GAL_VIEW_COLLECTION(GTK_VALUE_OBJECT(*arg)));
- else
- gal_define_views_dialog_set_collection(dialog, NULL);
- break;
-
- default:
- return;
- }
-}
-
-static void
-gal_define_views_dialog_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- GalDefineViewsDialog *dialog;
-
- dialog = GAL_DEFINE_VIEWS_DIALOG (object);
-
- switch (arg_id) {
- case ARG_COLLECTION:
- if (dialog->collection)
- GTK_VALUE_OBJECT(*arg) = GTK_OBJECT(dialog->collection);
- else
- GTK_VALUE_OBJECT(*arg) = NULL;
- break;
-
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
diff --git a/widgets/menus/gal-define-views-dialog.h b/widgets/menus/gal-define-views-dialog.h
deleted file mode 100644
index edd40ed7c5..0000000000
--- a/widgets/menus/gal-define-views-dialog.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * gal-define-views-dialog.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef __GAL_DEFINE_VIEWS_DIALOG_H__
-#define __GAL_DEFINE_VIEWS_DIALOG_H__
-
-#include <libgnomeui/gnome-dialog.h>
-#include <glade/glade.h>
-#include <gal/e-table/e-table-model.h>
-#include <gal/menus/gal-view-collection.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-/* GalDefineViewsDialog - A dialog displaying information about a contact.
- *
- * The following arguments are available:
- *
- * name type read/write description
- * --------------------------------------------------------------------------------
- */
-
-#define GAL_DEFINE_VIEWS_DIALOG_TYPE (gal_define_views_dialog_get_type ())
-#define GAL_DEFINE_VIEWS_DIALOG(obj) (GTK_CHECK_CAST ((obj), GAL_DEFINE_VIEWS_DIALOG_TYPE, GalDefineViewsDialog))
-#define GAL_DEFINE_VIEWS_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GAL_DEFINE_VIEWS_DIALOG_TYPE, GalDefineViewsDialogClass))
-#define GAL_IS_DEFINE_VIEWS_DIALOG(obj) (GTK_CHECK_TYPE ((obj), GAL_DEFINE_VIEWS_DIALOG_TYPE))
-#define GAL_IS_DEFINE_VIEWS_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), GAL_DEFINE_VIEWS_DIALOG_TYPE))
-
-typedef struct _GalDefineViewsDialog GalDefineViewsDialog;
-typedef struct _GalDefineViewsDialogClass GalDefineViewsDialogClass;
-
-struct _GalDefineViewsDialog
-{
- GnomeDialog parent;
-
- /* item specific fields */
- GladeXML *gui;
- ETableModel *model;
-
- GalViewCollection *collection;
-};
-
-struct _GalDefineViewsDialogClass
-{
- GnomeDialogClass parent_class;
-};
-
-GtkWidget *gal_define_views_dialog_new (GalViewCollection *collection);
-GtkType gal_define_views_dialog_get_type (void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GAL_DEFINE_VIEWS_DIALOG_H__ */
diff --git a/widgets/menus/gal-define-views-model.c b/widgets/menus/gal-define-views-model.c
deleted file mode 100644
index ca54e19c8d..0000000000
--- a/widgets/menus/gal-define-views-model.c
+++ /dev/null
@@ -1,335 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * gal-define-views-model.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <gnome-xml/tree.h>
-#include <gnome-xml/parser.h>
-#include <gnome-xml/xmlmemory.h>
-#include "gal-define-views-model.h"
-
-#define PARENT_TYPE e_table_model_get_type()
-static ETableModelClass *parent_class;
-
-/*
- * GalDefineViewsModel callbacks
- * These are the callbacks that define the behavior of our custom model.
- */
-static void gal_define_views_model_set_arg (GtkObject *o, GtkArg *arg, guint arg_id);
-static void gal_define_views_model_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
-
-
-enum {
- ARG_0,
- ARG_EDITABLE,
- ARG_COLLECTION
-};
-
-static void
-gdvm_destroy(GtkObject *object)
-{
- GalDefineViewsModel *model = GAL_DEFINE_VIEWS_MODEL(object);
-
- gtk_object_unref(GTK_OBJECT(model->collection));
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-/* This function returns the number of columns in our ETableModel. */
-static int
-gdvm_col_count (ETableModel *etc)
-{
- return 1;
-}
-
-/* This function returns the number of rows in our ETableModel. */
-static int
-gdvm_row_count (ETableModel *etc)
-{
- GalDefineViewsModel *views = GAL_DEFINE_VIEWS_MODEL(etc);
- if (views->collection)
- return gal_view_collection_get_count(views->collection);
- else
- return 0;
-}
-
-/* This function returns the value at a particular point in our ETableModel. */
-static void *
-gdvm_value_at (ETableModel *etc, int col, int row)
-{
- GalDefineViewsModel *views = GAL_DEFINE_VIEWS_MODEL(etc);
- const char *value;
-
- value = gal_view_get_title (gal_view_collection_get_view(views->collection, row));
-
- return (void *)(value ? value : "");
-}
-
-/* This function sets the value at a particular point in our ETableModel. */
-static void
-gdvm_set_value_at (ETableModel *etc, int col, int row, const void *val)
-{
- GalDefineViewsModel *views = GAL_DEFINE_VIEWS_MODEL(etc);
- if (views->editable) {
- e_table_model_pre_change(etc);
- gal_view_set_title(gal_view_collection_get_view(views->collection, row), val);
- e_table_model_cell_changed(etc, col, row);
- }
-}
-
-/* This function returns whether a particular cell is editable. */
-static gboolean
-gdvm_is_cell_editable (ETableModel *etc, int col, int row)
-{
- return GAL_DEFINE_VIEWS_MODEL(etc)->editable;
-}
-
-static void
-gdvm_append_row (ETableModel *etm, ETableModel *source, gint row)
-{
-}
-
-/* This function duplicates the value passed to it. */
-static void *
-gdvm_duplicate_value (ETableModel *etc, int col, const void *value)
-{
- return g_strdup(value);
-}
-
-/* This function frees the value passed to it. */
-static void
-gdvm_free_value (ETableModel *etc, int col, void *value)
-{
- g_free(value);
-}
-
-static void *
-gdvm_initialize_value (ETableModel *etc, int col)
-{
- return g_strdup("");
-}
-
-static gboolean
-gdvm_value_is_empty (ETableModel *etc, int col, const void *value)
-{
- return !(value && *(char *)value);
-}
-
-static char *
-gdvm_value_to_string (ETableModel *etc, int col, const void *value)
-{
- return g_strdup(value);
-}
-
-/**
- * gal_define_views_model_append
- * @model: The model to add to.
- * @view: The view to add.
- *
- * Adds the given view to the gal define views model.
- */
-void
-gal_define_views_model_append (GalDefineViewsModel *model,
- GalView *view)
-{
- ETableModel *etm = E_TABLE_MODEL(model);
-
- e_table_model_pre_change(etm);
- gal_view_collection_append(model->collection, view);
- e_table_model_row_inserted(etm, gal_view_collection_get_count(model->collection) - 1);
-}
-
-static void
-gal_define_views_model_class_init (GtkObjectClass *object_class)
-{
- ETableModelClass *model_class = (ETableModelClass *) object_class;
-
- parent_class = gtk_type_class (PARENT_TYPE);
-
- object_class->destroy = gdvm_destroy;
- object_class->set_arg = gal_define_views_model_set_arg;
- object_class->get_arg = gal_define_views_model_get_arg;
-
- gtk_object_add_arg_type ("GalDefineViewsModel::editable", GTK_TYPE_BOOL,
- GTK_ARG_READWRITE, ARG_EDITABLE);
- gtk_object_add_arg_type ("GalDefineViewsModel::collection", GAL_VIEW_COLLECTION_TYPE,
- GTK_ARG_READWRITE, ARG_COLLECTION);
-
- model_class->column_count = gdvm_col_count;
- model_class->row_count = gdvm_row_count;
- model_class->value_at = gdvm_value_at;
- model_class->set_value_at = gdvm_set_value_at;
- model_class->is_cell_editable = gdvm_is_cell_editable;
- model_class->append_row = gdvm_append_row;
- model_class->duplicate_value = gdvm_duplicate_value;
- model_class->free_value = gdvm_free_value;
- model_class->initialize_value = gdvm_initialize_value;
- model_class->value_is_empty = gdvm_value_is_empty;
- model_class->value_to_string = gdvm_value_to_string;
-}
-
-static void
-gal_define_views_model_init (GtkObject *object)
-{
- GalDefineViewsModel *model = GAL_DEFINE_VIEWS_MODEL(object);
-
- model->collection = NULL;
-}
-
-static void
-gal_define_views_model_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- GalDefineViewsModel *model;
-
- model = GAL_DEFINE_VIEWS_MODEL (o);
-
- switch (arg_id){
- case ARG_EDITABLE:
- model->editable = GTK_VALUE_BOOL (*arg);
- break;
-
- case ARG_COLLECTION:
- e_table_model_pre_change(E_TABLE_MODEL(o));
- if (GTK_VALUE_OBJECT (*arg))
- model->collection = GAL_VIEW_COLLECTION(GTK_VALUE_OBJECT (*arg));
- else
- model->collection = NULL;
- e_table_model_changed(E_TABLE_MODEL(o));
- break;
- }
-}
-
-static void
-gal_define_views_model_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- GalDefineViewsModel *model;
-
- model = GAL_DEFINE_VIEWS_MODEL (object);
-
- switch (arg_id) {
- case ARG_EDITABLE:
- GTK_VALUE_BOOL (*arg) = model->editable;
- break;
-
- case ARG_COLLECTION:
- if (model->collection)
- GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(model->collection);
- else
- GTK_VALUE_OBJECT (*arg) = NULL;
- break;
-
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-GtkType
-gal_define_views_model_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type){
- GtkTypeInfo info = {
- "GalDefineViewsModel",
- sizeof (GalDefineViewsModel),
- sizeof (GalDefineViewsModelClass),
- (GtkClassInitFunc) gal_define_views_model_class_init,
- (GtkObjectInitFunc) gal_define_views_model_init,
- NULL, /* reserved 1 */
- NULL, /* reserved 2 */
- (GtkClassInitFunc) NULL
- };
-
- type = gtk_type_unique (PARENT_TYPE, &info);
- }
-
- return type;
-}
-
-/**
- * gal_define_views_model_new
- *
- * Returns a new define views model. This is a list of views as an
- * ETable for use in the GalDefineViewsDialog.
- *
- * Returns: The new GalDefineViewsModel.
- */
-ETableModel *
-gal_define_views_model_new (void)
-{
- GalDefineViewsModel *et;
-
- et = gtk_type_new (gal_define_views_model_get_type ());
-
- return E_TABLE_MODEL(et);
-}
-
-/**
- * gal_define_views_model_get_view:
- * @model: The GalDefineViewsModel.
- * @n: Which view to get.
- *
- * Gets the nth view.
- *
- * Returns: The view.
- */
-GalView *
-gal_define_views_model_get_view (GalDefineViewsModel *model,
- int n)
-{
- return gal_view_collection_get_view(model->collection, n);
-}
-
-/**
- * gal_define_views_model_delete_view:
- * @model: The GalDefineViewsModel.
- * @n: Which view to delete.
- *
- * Deletes the nth view.
- */
-void
-gal_define_views_model_delete_view (GalDefineViewsModel *model,
- int n)
-{
- e_table_model_pre_change(E_TABLE_MODEL(model));
- gal_view_collection_delete_view(model->collection, n);
- e_table_model_row_deleted(E_TABLE_MODEL(model), n);
-}
-
-/**
- * gal_define_views_model_copy_view:
- * @model: The GalDefineViewsModel.
- * @n: Which view to copy.
- *
- * Copys the nth view.
- */
-void
-gal_define_views_model_copy_view (GalDefineViewsModel *model,
- int n)
-{
- ETableModel *etm = E_TABLE_MODEL(model);
- e_table_model_pre_change(etm);
- gal_view_collection_copy_view(model->collection, n);
- e_table_model_row_inserted(etm, gal_view_collection_get_count(model->collection) - 1);
-}
diff --git a/widgets/menus/gal-define-views-model.h b/widgets/menus/gal-define-views-model.h
deleted file mode 100644
index 2724216985..0000000000
--- a/widgets/menus/gal-define-views-model.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * gal-define-views-model.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _GAL_DEFINE_VIEWS_MODEL_H_
-#define _GAL_DEFINE_VIEWS_MODEL_H_
-
-#include <gal/e-table/e-table-model.h>
-#include <gal/menus/gal-view.h>
-#include <gal/menus/gal-view-collection.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#define GAL_DEFINE_VIEWS_MODEL_TYPE (gal_define_views_model_get_type ())
-#define GAL_DEFINE_VIEWS_MODEL(o) (GTK_CHECK_CAST ((o), GAL_DEFINE_VIEWS_MODEL_TYPE, GalDefineViewsModel))
-#define GAL_DEFINE_VIEWS_MODEL_CLASS(k) (GTK_CHECK_CLASS_CAST((k), GAL_DEFINE_VIEWS_MODEL_TYPE, GalDefineViewsModelClass))
-#define GAL_IS_DEFINE_VIEWS_MODEL(o) (GTK_CHECK_TYPE ((o), GAL_DEFINE_VIEWS_MODEL_TYPE))
-#define GAL_IS_DEFINE_VIEWS_MODEL_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), GAL_DEFINE_VIEWS_MODEL_TYPE))
-
-typedef struct {
- ETableModel parent;
-
- /* item specific fields */
- GalViewCollection *collection;
-
- guint editable : 1;
-} GalDefineViewsModel;
-
-
-typedef struct {
- ETableModelClass parent_class;
-} GalDefineViewsModelClass;
-
-
-GtkType gal_define_views_model_get_type (void);
-ETableModel *gal_define_views_model_new (void);
-
-void gal_define_views_model_append (GalDefineViewsModel *model,
- GalView *view);
-GalView *gal_define_views_model_get_view (GalDefineViewsModel *model,
- int i);
-void gal_define_views_model_delete_view (GalDefineViewsModel *model,
- int i);
-void gal_define_views_model_copy_view (GalDefineViewsModel *model,
- int i);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _GAL_DEFINE_VIEWS_MODEL_H_ */
diff --git a/widgets/menus/gal-define-views.glade b/widgets/menus/gal-define-views.glade
deleted file mode 100644
index b393d97d2e..0000000000
--- a/widgets/menus/gal-define-views.glade
+++ /dev/null
@@ -1,311 +0,0 @@
-<?xml version="1.0"?>
-<GTK-Interface>
-
-<project>
- <name>gal-define-views</name>
- <program_name>gal-define-views</program_name>
- <directory></directory>
- <source_directory>src</source_directory>
- <pixmaps_directory>pixmaps</pixmaps_directory>
- <language>C</language>
- <gnome_support>True</gnome_support>
- <gettext_support>True</gettext_support>
- <use_widget_names>True</use_widget_names>
- <output_main_file>False</output_main_file>
- <output_support_files>False</output_support_files>
- <output_build_files>False</output_build_files>
- <gnome_help_support>True</gnome_help_support>
-</project>
-
-<widget>
- <class>GnomeDialog</class>
- <name>dialog1</name>
- <visible>False</visible>
- <title>Define Views for &quot;%s&quot;</title>
- <type>GTK_WINDOW_TOPLEVEL</type>
- <position>GTK_WIN_POS_NONE</position>
- <modal>False</modal>
- <allow_shrink>False</allow_shrink>
- <allow_grow>True</allow_grow>
- <auto_shrink>False</auto_shrink>
- <auto_close>False</auto_close>
- <hide_on_close>False</hide_on_close>
-
- <widget>
- <class>GtkVBox</class>
- <child_name>GnomeDialog:vbox</child_name>
- <name>dialog-vbox1</name>
- <homogeneous>False</homogeneous>
- <spacing>8</spacing>
- <child>
- <padding>4</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkHButtonBox</class>
- <child_name>GnomeDialog:action_area</child_name>
- <name>dialog-action_area1</name>
- <layout_style>GTK_BUTTONBOX_END</layout_style>
- <spacing>8</spacing>
- <child_min_width>85</child_min_width>
- <child_min_height>27</child_min_height>
- <child_ipad_x>7</child_ipad_x>
- <child_ipad_y>0</child_ipad_y>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- <pack>GTK_PACK_END</pack>
- </child>
-
- <widget>
- <class>GtkButton</class>
- <name>button1</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button7</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
- </widget>
- </widget>
-
- <widget>
- <class>GtkTable</class>
- <name>table-top</name>
- <rows>5</rows>
- <columns>1</columns>
- <homogeneous>False</homogeneous>
- <row_spacing>6</row_spacing>
- <column_spacing>6</column_spacing>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkFrame</class>
- <name>frame1</name>
- <label>Description</label>
- <label_xalign>0</label_xalign>
- <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>3</top_attach>
- <bottom_attach>4</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>GtkTable</class>
- <name>table-description</name>
- <border_width>6</border_width>
- <rows>1</rows>
- <columns>2</columns>
- <homogeneous>False</homogeneous>
- <row_spacing>6</row_spacing>
- <column_spacing>6</column_spacing>
- </widget>
- </widget>
-
- <widget>
- <class>GtkHBox</class>
- <name>hbox1</name>
- <homogeneous>False</homogeneous>
- <spacing>6</spacing>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>1</top_attach>
- <bottom_attach>2</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>True</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>Custom</class>
- <name>custom-table</name>
- <creation_function>gal_define_views_dialog_create_etable</creation_function>
- <int1>0</int1>
- <int2>0</int2>
- <last_modification_time>Fri, 10 Nov 2000 16:37:39 GMT</last_modification_time>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkVBox</class>
- <name>vbox1</name>
- <homogeneous>False</homogeneous>
- <spacing>6</spacing>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
-
- <widget>
- <class>GtkButton</class>
- <name>button-new</name>
- <can_focus>True</can_focus>
- <label>_New...</label>
- <relief>GTK_RELIEF_NORMAL</relief>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button-copy</name>
- <can_focus>True</can_focus>
- <label>_Copy...</label>
- <relief>GTK_RELIEF_NORMAL</relief>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button-modify</name>
- <can_focus>True</can_focus>
- <label>_Edit...</label>
- <relief>GTK_RELIEF_NORMAL</relief>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button-delete</name>
- <can_focus>True</can_focus>
- <label>_Delete...</label>
- <relief>GTK_RELIEF_NORMAL</relief>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GtkHButtonBox</class>
- <name>hbuttonbox1</name>
- <layout_style>GTK_BUTTONBOX_END</layout_style>
- <spacing>6</spacing>
- <child_min_width>85</child_min_width>
- <child_min_height>27</child_min_height>
- <child_ipad_x>7</child_ipad_x>
- <child_ipad_y>0</child_ipad_y>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>4</top_attach>
- <bottom_attach>5</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkAlignment</class>
- <name>alignment3</name>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xscale>0</xscale>
- <yscale>1</yscale>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>2</top_attach>
- <bottom_attach>3</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>GtkButton</class>
- <name>button-reset</name>
- <can_focus>True</can_focus>
- <label>Re_set to Factory Defaults...</label>
- <relief>GTK_RELIEF_NORMAL</relief>
- </widget>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label-views</name>
- <label>Views for &quot;%s&quot;</label>
- <justify>GTK_JUSTIFY_LEFT</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
- </widget>
- </widget>
-</widget>
-
-</GTK-Interface>
diff --git a/widgets/menus/gal-view-collection.c b/widgets/menus/gal-view-collection.c
deleted file mode 100644
index 290c28f688..0000000000
--- a/widgets/menus/gal-view-collection.c
+++ /dev/null
@@ -1,816 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * gal-view-collection.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-
-#include <util/e-i18n.h>
-#include <ctype.h>
-#include <string.h>
-#include <gtk/gtksignal.h>
-#include <gnome-xml/parser.h>
-#include <libgnome/gnome-defs.h>
-#include <libgnome/gnome-util.h>
-#include <gal/util/e-util.h>
-#include <gal/util/e-xml-utils.h>
-#include <gal/widgets/e-unicode.h>
-#include "gal-view-collection.h"
-
-#define GVC_CLASS(e) ((GalViewCollectionClass *)((GtkObject *)e)->klass)
-
-#define PARENT_TYPE gtk_object_get_type ()
-
-static GtkObjectClass *gal_view_collection_parent_class;
-
-#define d(x) x
-
-enum {
- DISPLAY_VIEW,
- CHANGED,
- LAST_SIGNAL
-};
-
-static guint gal_view_collection_signals [LAST_SIGNAL] = { 0, };
-
-/**
- * gal_view_collection_display_view:
- * @collection: The GalViewCollection to send the signal on.
- * @view: The view to display.
- *
- */
-void
-gal_view_collection_display_view (GalViewCollection *collection,
- GalView *view)
-{
- g_return_if_fail (collection != NULL);
- g_return_if_fail (GAL_IS_VIEW_COLLECTION (collection));
- g_return_if_fail (view != NULL);
- g_return_if_fail (GAL_IS_VIEW (view));
-
- gtk_signal_emit (GTK_OBJECT (collection),
- gal_view_collection_signals [DISPLAY_VIEW],
- view);
-}
-
-static void
-gal_view_collection_changed (GalViewCollection *collection)
-{
- g_return_if_fail (collection != NULL);
- g_return_if_fail (GAL_IS_VIEW_COLLECTION (collection));
-
- gtk_signal_emit (GTK_OBJECT (collection),
- gal_view_collection_signals [CHANGED]);
-}
-
-static void
-gal_view_collection_item_free (GalViewCollectionItem *item)
-{
- g_free(item->id);
- if (item->view) {
- if (item->view_changed_id)
- gtk_signal_disconnect (GTK_OBJECT (item->view),
- item->view_changed_id);
- gtk_object_unref(GTK_OBJECT(item->view));
- }
- g_free(item);
-}
-
-static char *
-gal_view_generate_string (GalViewCollection *collection,
- GalView *view,
- int which)
-{
- char *ret_val;
- char *pointer;
-
- if (which == 1)
- ret_val = g_strdup(gal_view_get_title(view));
- else
- ret_val = g_strdup_printf("%s_%d", gal_view_get_title(view), which);
- for (pointer = ret_val; *pointer; pointer++) {
- if (!isalnum((guint) *pointer)) {
- *pointer = '_';
- }
- }
- return ret_val;
-}
-
-static gint
-gal_view_check_string (GalViewCollection *collection,
- char *string)
-{
- int i;
-
- if (!strcmp (string, "current_view"))
- return FALSE;
-
- for (i = 0; i < collection->view_count; i++) {
- if (!strcmp(string, collection->view_data[i]->id))
- return FALSE;
- }
- for (i = 0; i < collection->removed_view_count; i++) {
- if (!strcmp(string, collection->removed_view_data[i]->id))
- return FALSE;
- }
- return TRUE;
-}
-
-static char *
-gal_view_generate_id (GalViewCollection *collection,
- GalView *view)
-{
- int i;
- for (i = 1; TRUE; i++) {
- char *try;
-
- try = gal_view_generate_string(collection, view, i);
- if (gal_view_check_string(collection, try))
- return try;
- g_free(try);
- }
-}
-
-static void
-gal_view_collection_destroy (GtkObject *object)
-{
- GalViewCollection *collection = GAL_VIEW_COLLECTION(object);
- int i;
-
- for (i = 0; i < collection->view_count; i++) {
- gal_view_collection_item_free (collection->view_data[i]);
- }
- g_free(collection->view_data);
- e_free_object_list(collection->factory_list);
-
- for (i = 0; i < collection->removed_view_count; i++) {
- gal_view_collection_item_free (collection->removed_view_data[i]);
- }
- g_free(collection->removed_view_data);
-
- g_free(collection->system_dir);
- g_free(collection->local_dir);
-
- g_free (collection->default_view);
-
- if (gal_view_collection_parent_class->destroy)
- (*gal_view_collection_parent_class->destroy)(object);
-}
-
-static void
-gal_view_collection_class_init (GtkObjectClass *object_class)
-{
- GalViewCollectionClass *klass = GAL_VIEW_COLLECTION_CLASS(object_class);
- gal_view_collection_parent_class = gtk_type_class (PARENT_TYPE);
-
- object_class->destroy = gal_view_collection_destroy;
-
- gal_view_collection_signals [DISPLAY_VIEW] =
- gtk_signal_new ("display_view",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (GalViewCollectionClass, display_view),
- gtk_marshal_NONE__OBJECT,
- GTK_TYPE_NONE, 1, GAL_VIEW_TYPE);
-
- gal_view_collection_signals [CHANGED] =
- gtk_signal_new ("changed",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (GalViewCollectionClass, changed),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- E_OBJECT_CLASS_ADD_SIGNALS (object_class, gal_view_collection_signals, LAST_SIGNAL);
-
- klass->display_view = NULL;
- klass->changed = NULL;
-}
-
-static void
-gal_view_collection_init (GalViewCollection *collection)
-{
- collection->view_data = NULL;
- collection->view_count = 0;
- collection->factory_list = NULL;
-
- collection->removed_view_data = NULL;
- collection->removed_view_count = 0;
-
- collection->system_dir = NULL;
- collection->local_dir = NULL;
-
- collection->loaded = FALSE;
- collection->default_view = NULL;
- collection->default_view_built_in = TRUE;
-}
-
-/**
- * gal_view_collection_get_type:
- *
- */
-guint
-gal_view_collection_get_type (void)
-{
- static guint type = 0;
-
- if (!type)
- {
- GtkTypeInfo info =
- {
- "GalViewCollection",
- sizeof (GalViewCollection),
- sizeof (GalViewCollectionClass),
- (GtkClassInitFunc) gal_view_collection_class_init,
- (GtkObjectInitFunc) gal_view_collection_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- type = gtk_type_unique (PARENT_TYPE, &info);
- }
-
- return type;
-}
-
-/**
- * gal_view_collection_new:
- *
- * A collection of views and view factories.
- */
-GalViewCollection *
-gal_view_collection_new (void)
-{
- return gtk_type_new(gal_view_collection_get_type());
-}
-
-/**
- * gal_view_collection_set_storage_directories
- * @collection: The view collection to initialize
- * @system_dir: The location of the system built in views
- * @local_dir: The location to store the users set up views
- *
- * Sets up the GalViewCollection.
- */
-void
-gal_view_collection_set_storage_directories (GalViewCollection *collection,
- const char *system_dir,
- const char *local_dir)
-{
- g_return_if_fail (collection != NULL);
- g_return_if_fail (GAL_IS_VIEW_COLLECTION (collection));
- g_return_if_fail (system_dir != NULL);
- g_return_if_fail (local_dir != NULL);
-
- g_free(collection->system_dir);
- g_free(collection->local_dir);
-
- collection->system_dir = g_strdup(system_dir);
- collection->local_dir = g_strdup(local_dir);
-}
-
-/**
- * gal_view_collection_add_factory
- * @collection: The view collection to add a factory to
- * @factory: The factory to add. The @collection will add a reference
- * to the factory object, so you should unref it after calling this
- * function if you no longer need it.
- *
- * Adds the given factory to this collection. This list is used both
- * when loading views from their xml description as well as when the
- * user tries to create a new view.
- */
-void
-gal_view_collection_add_factory (GalViewCollection *collection,
- GalViewFactory *factory)
-{
- g_return_if_fail (collection != NULL);
- g_return_if_fail (GAL_IS_VIEW_COLLECTION (collection));
- g_return_if_fail (factory != NULL);
- g_return_if_fail (GAL_IS_VIEW_FACTORY (factory));
-
- gtk_object_ref (GTK_OBJECT (factory));
- collection->factory_list = g_list_prepend (collection->factory_list, factory);
-}
-
-static void
-view_changed (GalView *view,
- GalViewCollectionItem *item)
-{
- item->changed = TRUE;
- item->ever_changed = TRUE;
-
- gal_view_collection_changed(item->collection);
-}
-
-/* Use factory list to load a GalView file. */
-static GalView *
-gal_view_collection_real_load_view_from_file (GalViewCollection *collection, const char *type, const char *title, const char *dir, const char *filename)
-{
- GalViewFactory *factory;
- GList *factories;
-
- factory = NULL;
- for (factories = collection->factory_list; factories; factories = factories->next) {
- if (type && !strcmp(gal_view_factory_get_type_code(factories->data), type)) {
- factory = factories->data;
- break;
- }
- }
- if (factory) {
- GalView *view;
-
- view = gal_view_factory_new_view (factory, title);
- gal_view_set_title (view, title);
- gal_view_load(view, filename);
- return view;
- }
- return NULL;
-}
-
-GalView *
-gal_view_collection_load_view_from_file (GalViewCollection *collection, const char *type, const char *filename)
-{
- return gal_view_collection_real_load_view_from_file (collection, type, "", collection->local_dir, filename);
-}
-
-static GalViewCollectionItem *
-load_single_file (GalViewCollection *collection,
- gchar *dir,
- gboolean local,
- xmlNode *node)
-{
- GalViewCollectionItem *item;
- item = g_new(GalViewCollectionItem, 1);
- item->ever_changed = local;
- item->changed = FALSE;
- item->built_in = !local;
- item->id = e_xml_get_string_prop_by_name(node, "id");
- item->filename = e_xml_get_string_prop_by_name(node, "filename");
- item->title = e_xml_get_translated_utf8_string_prop_by_name(node, "title");
- item->type = e_xml_get_string_prop_by_name(node, "type");
- item->collection = collection;
- item->view_changed_id = 0;
-
- if (item->filename) {
- char *fullpath;
- fullpath = g_concat_dir_and_file(dir, item->filename);
- item->view = gal_view_collection_real_load_view_from_file (collection, item->type, item->title, dir, fullpath);
- g_free(fullpath);
- if (item->view) {
- item->view_changed_id =
- gtk_signal_connect(GTK_OBJECT(item->view), "changed",
- GTK_SIGNAL_FUNC(view_changed), item);
- }
- }
- return item;
-}
-
-static void
-load_single_dir (GalViewCollection *collection,
- char *dir,
- gboolean local)
-{
- xmlDoc *doc;
- xmlNode *root;
- xmlNode *child;
- char *filename = g_concat_dir_and_file(dir, "galview.xml");
- char *default_view;
-
- doc = xmlParseFile(filename);
- if (!doc) {
- g_free (filename);
- return;
- }
- root = xmlDocGetRootElement(doc);
- for (child = root->xmlChildrenNode; child; child = child->next) {
- gchar *id = e_xml_get_string_prop_by_name(child, "id");
- gboolean found = FALSE;
- int i;
-
- for (i = 0; i < collection->view_count; i++) {
- if (!strcmp(id, collection->view_data[i]->id)) {
- if (!local)
- collection->view_data[i]->built_in = TRUE;
- found = TRUE;
- break;
- }
- }
- if (!found) {
- for (i = 0; i < collection->removed_view_count; i++) {
- if (!strcmp(id, collection->removed_view_data[i]->id)) {
- if (!local)
- collection->removed_view_data[i]->built_in = TRUE;
- found = TRUE;
- break;
- }
- }
- }
-
- if (!found) {
- GalViewCollectionItem *item = load_single_file (collection, dir, local, child);
- if (item->filename && *item->filename) {
- collection->view_data = g_renew(GalViewCollectionItem *, collection->view_data, collection->view_count + 1);
- collection->view_data[collection->view_count] = item;
- collection->view_count ++;
- } else {
- collection->removed_view_data = g_renew(GalViewCollectionItem *, collection->removed_view_data, collection->removed_view_count + 1);
- collection->removed_view_data[collection->removed_view_count] = item;
- collection->removed_view_count ++;
- }
- }
- g_free(id);
- }
-
- default_view = e_xml_get_string_prop_by_name (root, "default-view");
- if (default_view) {
- if (local)
- collection->default_view_built_in = FALSE;
- else
- collection->default_view_built_in = TRUE;
- g_free (collection->default_view);
- collection->default_view = default_view;
- }
-
- g_free(filename);
- xmlFreeDoc(doc);
-}
-
-/**
- * gal_view_collection_load
- * @collection: The view collection to load information for
- *
- * Loads the data from the system and user directories specified in
- * set storage directories. This is primarily for internal use by
- * other parts of gal_view.
- */
-void
-gal_view_collection_load (GalViewCollection *collection)
-{
- g_return_if_fail (collection != NULL);
- g_return_if_fail (GAL_IS_VIEW_COLLECTION (collection));
- g_return_if_fail (collection->local_dir != NULL);
- g_return_if_fail (collection->system_dir != NULL);
- g_return_if_fail (!collection->loaded);
-
- e_create_directory(collection->local_dir);
-
- load_single_dir(collection, collection->local_dir, TRUE);
- load_single_dir(collection, collection->system_dir, FALSE);
- gal_view_collection_changed(collection);
-
- collection->loaded = TRUE;
-}
-
-/**
- * gal_view_collection_save
- * @collection: The view collection to save information for
- *
- * Saves the data to the user directory specified in set storage
- * directories. This is primarily for internal use by other parts of
- * gal_view.
- */
-void
-gal_view_collection_save (GalViewCollection *collection)
-{
- int i;
- xmlDoc *doc;
- xmlNode *root;
- char *filename;
-
- g_return_if_fail (collection != NULL);
- g_return_if_fail (GAL_IS_VIEW_COLLECTION (collection));
- g_return_if_fail (collection->local_dir != NULL);
-
- doc = xmlNewDoc("1.0");
- root = xmlNewNode(NULL, "GalViewCollection");
- xmlDocSetRootElement(doc, root);
-
- if (collection->default_view && !collection->default_view_built_in) {
- e_xml_set_string_prop_by_name(root, "default-view", collection->default_view);
- }
-
- for (i = 0; i < collection->view_count; i++) {
- xmlNode *child;
- GalViewCollectionItem *item;
-
- item = collection->view_data[i];
- if (item->ever_changed) {
- child = xmlNewChild(root, NULL, "GalView", NULL);
- e_xml_set_string_prop_by_name(child, "id", item->id);
- e_xml_set_string_prop_by_name(child, "title", item->title);
- e_xml_set_string_prop_by_name(child, "filename", item->filename);
- e_xml_set_string_prop_by_name(child, "type", item->type);
-
- if (item->changed) {
- filename = g_concat_dir_and_file(collection->local_dir, item->filename);
- gal_view_save(item->view, filename);
- g_free(filename);
- }
- }
- }
- for (i = 0; i < collection->removed_view_count; i++) {
- xmlNode *child;
- GalViewCollectionItem *item;
-
- item = collection->removed_view_data[i];
-
- child = xmlNewChild(root, NULL, "GalView", NULL);
- e_xml_set_string_prop_by_name(child, "id", item->id);
- e_xml_set_string_prop_by_name(child, "title", item->title);
- e_xml_set_string_prop_by_name(child, "type", item->type);
- }
- filename = g_concat_dir_and_file(collection->local_dir, "galview.xml");
- xmlSaveFile(filename, doc);
- xmlFreeDoc(doc);
- g_free(filename);
-}
-
-/**
- * gal_view_collection_get_count
- * @collection: The view collection to count
- *
- * Calculates the number of views in the given collection.
- *
- * Returns: The number of views in the collection.
- */
-gint
-gal_view_collection_get_count (GalViewCollection *collection)
-{
- g_return_val_if_fail (collection != NULL, -1);
- g_return_val_if_fail (GAL_IS_VIEW_COLLECTION (collection), -1);
-
- return collection->view_count;
-}
-
-/**
- * gal_view_collection_get_view
- * @collection: The view collection to query
- * @n: The view to get.
- *
- * Returns: The nth view in the collection
- */
-GalView *
-gal_view_collection_get_view (GalViewCollection *collection,
- int n)
-{
- g_return_val_if_fail (collection != NULL, NULL);
- g_return_val_if_fail (GAL_IS_VIEW_COLLECTION (collection), NULL);
- g_return_val_if_fail (n < collection->view_count, NULL);
- g_return_val_if_fail (n >= 0, NULL);
-
- return collection->view_data[n]->view;
-}
-
-/**
- * gal_view_collection_get_view_item
- * @collection: The view collection to query
- * @n: The view item to get.
- *
- * Returns: The nth view item in the collection
- */
-GalViewCollectionItem *
-gal_view_collection_get_view_item (GalViewCollection *collection,
- int n)
-{
- g_return_val_if_fail (collection != NULL, NULL);
- g_return_val_if_fail (GAL_IS_VIEW_COLLECTION (collection), NULL);
- g_return_val_if_fail(n < collection->view_count, NULL);
- g_return_val_if_fail(n >= 0, NULL);
-
- return collection->view_data[n];
-}
-
-int
-gal_view_collection_get_view_index_by_id (GalViewCollection *collection, const char *view_id)
-{
- int i;
- for (i = 0; i < collection->view_count; i++) {
- if (!strcmp (collection->view_data[i]->id, view_id))
- return i;
- }
- return -1;
-}
-
-char *
-gal_view_collection_get_view_id_by_index (GalViewCollection *collection, int n)
-{
- g_return_val_if_fail (collection != NULL, NULL);
- g_return_val_if_fail (GAL_IS_VIEW_COLLECTION (collection), NULL);
- g_return_val_if_fail(n < collection->view_count, NULL);
- g_return_val_if_fail(n >= 0, NULL);
-
- return g_strdup (collection->view_data[n]->id);
-}
-
-
-void
-gal_view_collection_append (GalViewCollection *collection,
- GalView *view)
-{
- GalViewCollectionItem *item;
-
- g_return_if_fail (collection != NULL);
- g_return_if_fail (GAL_IS_VIEW_COLLECTION (collection));
- g_return_if_fail (view != NULL);
- g_return_if_fail (GAL_IS_VIEW (view));
-
- item = g_new(GalViewCollectionItem, 1);
- item->ever_changed = TRUE;
- item->changed = TRUE;
- item->built_in = FALSE;
- item->title = g_strdup(gal_view_get_title(view));
- item->type = g_strdup(gal_view_get_type_code(view));
- item->id = gal_view_generate_id(collection, view);
- item->filename = g_strdup_printf("%s.galview", item->id);
- item->view = view;
- item->collection = collection;
- gtk_object_ref(GTK_OBJECT(view));
-
- item->view_changed_id =
- gtk_signal_connect(GTK_OBJECT(item->view), "changed",
- GTK_SIGNAL_FUNC(view_changed), item);
-
- collection->view_data = g_renew(GalViewCollectionItem *, collection->view_data, collection->view_count + 1);
- collection->view_data[collection->view_count] = item;
- collection->view_count ++;
-
- gal_view_collection_changed(collection);
-}
-
-void
-gal_view_collection_delete_view (GalViewCollection *collection,
- int i)
-{
- GalViewCollectionItem *item;
-
- g_return_if_fail (collection != NULL);
- g_return_if_fail (GAL_IS_VIEW_COLLECTION (collection));
- g_return_if_fail (i >= 0 && i < collection->view_count);
-
- item = collection->view_data[i];
- memmove(collection->view_data + i, collection->view_data + i + 1, (collection->view_count - i - 1) * sizeof(GalViewCollectionItem *));
- collection->view_count --;
- if (item->built_in) {
- g_free(item->filename);
- item->filename = NULL;
-
- collection->removed_view_data = g_renew(GalViewCollectionItem *, collection->removed_view_data, collection->removed_view_count + 1);
- collection->removed_view_data[collection->removed_view_count] = item;
- collection->removed_view_count ++;
- } else {
- gal_view_collection_item_free (item);
- }
-
- gal_view_collection_changed(collection);
-}
-
-void
-gal_view_collection_copy_view (GalViewCollection *collection,
- int i)
-{
- GalViewCollectionItem *item;
- GalView *view;
-
- g_return_if_fail (collection != NULL);
- g_return_if_fail (GAL_IS_VIEW_COLLECTION (collection));
- g_return_if_fail (i >= 0 && i < collection->view_count);
-
- view = collection->view_data[i]->view;
-
- item = g_new(GalViewCollectionItem, 1);
- item->ever_changed = TRUE;
- item->changed = FALSE;
- item->built_in = FALSE;
- item->title = g_strdup(gal_view_get_title(view));
- item->type = g_strdup(gal_view_get_type_code(view));
- item->id = gal_view_generate_id(collection, view);
- item->filename = g_strdup_printf("%s.galview", item->id);
- item->view = gal_view_clone(view);
- item->collection = collection;
-
- item->view_changed_id =
- gtk_signal_connect(GTK_OBJECT(item->view), "changed",
- GTK_SIGNAL_FUNC(view_changed), item);
-
- collection->view_data = g_renew(GalViewCollectionItem *, collection->view_data, collection->view_count + 1);
- collection->view_data[collection->view_count] = item;
- collection->view_count ++;
-
- gal_view_collection_changed(collection);
-}
-
-gboolean
-gal_view_collection_loaded (GalViewCollection *collection)
-{
- return collection->loaded;
-}
-
-const char *
-gal_view_collection_append_with_title (GalViewCollection *collection, const char *title, GalView *view)
-{
- GalViewCollectionItem *item;
-
- g_return_val_if_fail (collection != NULL, NULL);
- g_return_val_if_fail (GAL_IS_VIEW_COLLECTION (collection), NULL);
- g_return_val_if_fail (view != NULL, NULL);
- g_return_val_if_fail (GAL_IS_VIEW (view), NULL);
-
- gal_view_set_title (view, title);
-
- d(g_print("%s: %p\n", __FUNCTION__, view));
-
- item = g_new(GalViewCollectionItem, 1);
- item->ever_changed = TRUE;
- item->changed = TRUE;
- item->built_in = FALSE;
- item->title = g_strdup(gal_view_get_title(view));
- item->type = g_strdup(gal_view_get_type_code(view));
- item->id = gal_view_generate_id(collection, view);
- item->filename = g_strdup_printf("%s.galview", item->id);
- item->view = view;
- item->collection = collection;
- gtk_object_ref(GTK_OBJECT(view));
-
- item->view_changed_id =
- gtk_signal_connect(GTK_OBJECT(item->view), "changed",
- GTK_SIGNAL_FUNC(view_changed), item);
-
- collection->view_data = g_renew(GalViewCollectionItem *, collection->view_data, collection->view_count + 1);
- collection->view_data[collection->view_count] = item;
- collection->view_count ++;
-
- gal_view_collection_changed(collection);
- return item->id;
-}
-
-const char *
-gal_view_collection_set_nth_view (GalViewCollection *collection, int i, GalView *view)
-{
- GalViewCollectionItem *item;
-
- g_return_val_if_fail (collection != NULL, NULL);
- g_return_val_if_fail (GAL_IS_VIEW_COLLECTION (collection), NULL);
- g_return_val_if_fail (view != NULL, NULL);
- g_return_val_if_fail (GAL_IS_VIEW (view), NULL);
- g_return_val_if_fail (i >= 0, NULL);
- g_return_val_if_fail (i < collection->view_count, NULL);
-
- d(g_print("%s: %p\n", __FUNCTION__, view));
-
- item = collection->view_data[i];
-
- gal_view_set_title (view, item->title);
- gtk_object_ref (GTK_OBJECT (view));
- if (item->view) {
- gtk_signal_disconnect (GTK_OBJECT (item->view),
- item->view_changed_id);
- gtk_object_unref (GTK_OBJECT (item->view));
- }
- item->view = view;
-
- item->ever_changed = TRUE;
- item->changed = TRUE;
- item->type = g_strdup(gal_view_get_type_code(view));
-
- item->view_changed_id =
- gtk_signal_connect(GTK_OBJECT(item->view), "changed",
- GTK_SIGNAL_FUNC(view_changed), item);
-
- gal_view_collection_changed (collection);
- return item->id;
-}
-
-const char *
-gal_view_collection_get_default_view (GalViewCollection *collection)
-{
- return collection->default_view;
-}
-
-void
-gal_view_collection_set_default_view (GalViewCollection *collection, const char *id)
-{
- g_free (collection->default_view);
- collection->default_view = g_strdup (id);
- gal_view_collection_changed (collection);
- collection->default_view_built_in = FALSE;
-}
diff --git a/widgets/menus/gal-view-collection.h b/widgets/menus/gal-view-collection.h
deleted file mode 100644
index 89501cda4c..0000000000
--- a/widgets/menus/gal-view-collection.h
+++ /dev/null
@@ -1,148 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * gal-view-collection.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _GAL_VIEW_SET_H_
-#define _GAL_VIEW_SET_H_
-
-#include <gtk/gtkobject.h>
-#include <gal/menus/gal-view-factory.h>
-#include <libgnome/gnome-defs.h>
-
-BEGIN_GNOME_DECLS
-
-
-#define GAL_VIEW_COLLECTION_TYPE (gal_view_collection_get_type ())
-#define GAL_VIEW_COLLECTION(o) (GTK_CHECK_CAST ((o), GAL_VIEW_COLLECTION_TYPE, GalViewCollection))
-#define GAL_VIEW_COLLECTION_CLASS(k) (GTK_CHECK_CLASS_CAST((k), GAL_VIEW_COLLECTION_TYPE, GalViewCollectionClass))
-#define GAL_IS_VIEW_COLLECTION(o) (GTK_CHECK_TYPE ((o), GAL_VIEW_COLLECTION_TYPE))
-#define GAL_IS_VIEW_COLLECTION_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), GAL_VIEW_COLLECTION_TYPE))
-
-typedef struct GalViewCollectionItem GalViewCollectionItem;
-
-typedef struct {
- GtkObject base;
-
- GalViewCollectionItem **view_data;
- int view_count;
-
- GList *factory_list;
-
- GalViewCollectionItem **removed_view_data;
- int removed_view_count;
-
- guint loaded : 1;
- guint default_view_built_in : 1;
-
- char *system_dir;
- char *local_dir;
-
- char *default_view;
-} GalViewCollection;
-
-typedef struct {
- GtkObjectClass parent_class;
-
- /*
- * Signals
- */
- void (*display_view) (GalViewCollection *collection,
- GalView *view);
- void (*changed) (GalViewCollection *collection);
-} GalViewCollectionClass;
-
-struct GalViewCollectionItem {
- GalView *view;
- char *id;
- guint changed : 1;
- guint ever_changed : 1;
- guint built_in : 1;
- char *filename;
- char *title;
- char *type;
- GalViewCollection *collection;
- guint view_changed_id;
-};
-
-/* Standard functions */
-GtkType gal_view_collection_get_type (void);
-GalViewCollection *gal_view_collection_new (void);
-
-/* Set up the view collection. Call these three functions before ever doing load or save and never call them again. */
-void gal_view_collection_set_storage_directories (GalViewCollection *collection,
- const char *system_dir,
- const char *local_dir);
-void gal_view_collection_add_factory (GalViewCollection *collection,
- GalViewFactory *factory);
-
-/* Send the display view signal. This function is deprecated. */
-void gal_view_collection_display_view (GalViewCollection *collection,
- GalView *view);
-
-
-/* Query the view collection. */
-gint gal_view_collection_get_count (GalViewCollection *collection);
-GalView *gal_view_collection_get_view (GalViewCollection *collection,
- int n);
-GalViewCollectionItem *gal_view_collection_get_view_item (GalViewCollection *collection,
- int n);
-int gal_view_collection_get_view_index_by_id (GalViewCollection *collection,
- const char *view_id);
-char *gal_view_collection_get_view_id_by_index (GalViewCollection *collection,
- int n);
-
-/* Manipulate the view collection */
-void gal_view_collection_append (GalViewCollection *collection,
- GalView *view);
-void gal_view_collection_delete_view (GalViewCollection *collection,
- int i);
-void gal_view_collection_copy_view (GalViewCollection *collection,
- int i);
-/* Call set_storage_directories and add factories for anything that
- * might be found there before doing either of these. */
-void gal_view_collection_load (GalViewCollection *collection);
-void gal_view_collection_save (GalViewCollection *collection);
-gboolean gal_view_collection_loaded (GalViewCollection *collection);
-
-/* Use factory list to load a GalView file. */
-GalView *gal_view_collection_load_view_from_file (GalViewCollection *collection,
- const char *type,
- const char *filename);
-
-/* Returns id of the new view. These functions are used for
- GalViewInstanceSaveAsDialog. */
-const char *gal_view_collection_append_with_title (GalViewCollection *collection,
- const char *title,
- GalView *view);
-const char *gal_view_collection_set_nth_view (GalViewCollection *collection,
- int i,
- GalView *view);
-
-const char *gal_view_collection_get_default_view (GalViewCollection *collection);
-void gal_view_collection_set_default_view (GalViewCollection *collection,
- const char *id);
-
-
-END_GNOME_DECLS
-
-
-#endif /* _GAL_VIEW_COLLECTION_H_ */
diff --git a/widgets/menus/gal-view-etable.c b/widgets/menus/gal-view-etable.c
deleted file mode 100644
index f81482435d..0000000000
--- a/widgets/menus/gal-view-etable.c
+++ /dev/null
@@ -1,321 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * gal-view-etable.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <gtk/gtksignal.h>
-#include "gal-view-etable.h"
-#include <gal/e-table/e-table-config.h>
-
-#define PARENT_TYPE gal_view_get_type ()
-
-static GalViewClass *gal_view_etable_parent_class;
-
-static void
-detach_table (GalViewEtable *view)
-{
- if (view->table == NULL)
- return;
- if (view->table_state_changed_id) {
- gtk_signal_disconnect (GTK_OBJECT (view->table),
- view->table_state_changed_id);
- view->table_state_changed_id = 0;
- }
- gtk_object_unref (GTK_OBJECT (view->table));
- view->table = NULL;
-}
-
-static void
-detach_tree (GalViewEtable *view)
-{
- if (view->tree == NULL)
- return;
- if (view->tree_state_changed_id) {
- gtk_signal_disconnect (GTK_OBJECT (view->tree),
- view->tree_state_changed_id);
- view->tree_state_changed_id = 0;
- }
- gtk_object_unref (GTK_OBJECT (view->tree));
- view->tree = NULL;
-}
-
-static void
-config_changed (ETableConfig *config, GalViewEtable *view)
-{
- ETableState *state;
- if (view->state)
- gtk_object_unref(GTK_OBJECT(view->state));
- gtk_object_get (GTK_OBJECT (config),
- "state", &state,
- NULL);
- view->state = e_table_state_duplicate(state);
- gal_view_changed(GAL_VIEW(view));
-}
-
-static void
-gal_view_etable_edit (GalView *view)
-{
- GalViewEtable *etable_view = GAL_VIEW_ETABLE(view);
- ETableConfig *config;
-
- config = e_table_config_new(etable_view->title,
- etable_view->spec,
- etable_view->state);
-
- gtk_signal_connect(GTK_OBJECT(config), "changed",
- GTK_SIGNAL_FUNC(config_changed), view);
-}
-
-static void
-gal_view_etable_load (GalView *view,
- const char *filename)
-{
- e_table_state_load_from_file(GAL_VIEW_ETABLE(view)->state, filename);
-}
-
-static void
-gal_view_etable_save (GalView *view,
- const char *filename)
-{
- e_table_state_save_to_file(GAL_VIEW_ETABLE(view)->state, filename);
-}
-
-static const char *
-gal_view_etable_get_title (GalView *view)
-{
- return GAL_VIEW_ETABLE(view)->title;
-}
-
-static void
-gal_view_etable_set_title (GalView *view,
- const char *title)
-{
- g_free(GAL_VIEW_ETABLE(view)->title);
- GAL_VIEW_ETABLE(view)->title = g_strdup(title);
-}
-
-static const char *
-gal_view_etable_get_type_code (GalView *view)
-{
- return "etable";
-}
-
-static GalView *
-gal_view_etable_clone (GalView *view)
-{
- GalViewEtable *gve, *new;
-
- gve = GAL_VIEW_ETABLE(view);
-
- new = gtk_type_new (gal_view_etable_get_type ());
- new->spec = gve->spec;
- new->title = g_strdup (gve->title);
- new->state = e_table_state_duplicate(gve->state);
-
- gtk_object_ref(GTK_OBJECT(new->spec));
-
- return GAL_VIEW(new);
-}
-
-static void
-gal_view_etable_destroy (GtkObject *object)
-{
- GalViewEtable *view = GAL_VIEW_ETABLE(object);
-
- gal_view_etable_detach (view);
-
- g_free(view->title);
- if (view->spec)
- gtk_object_unref(GTK_OBJECT(view->spec));
- if (view->state)
- gtk_object_unref(GTK_OBJECT(view->state));
-
- if (GTK_OBJECT_CLASS (gal_view_etable_parent_class)->destroy)
- (* GTK_OBJECT_CLASS (gal_view_etable_parent_class)->destroy) (object);
-}
-
-static void
-gal_view_etable_class_init (GtkObjectClass *object_class)
-{
- GalViewClass *gal_view_class = GAL_VIEW_CLASS(object_class);
- gal_view_etable_parent_class = gtk_type_class (PARENT_TYPE);
-
- gal_view_class->edit = gal_view_etable_edit ;
- gal_view_class->load = gal_view_etable_load ;
- gal_view_class->save = gal_view_etable_save ;
- gal_view_class->get_title = gal_view_etable_get_title ;
- gal_view_class->set_title = gal_view_etable_set_title ;
- gal_view_class->get_type_code = gal_view_etable_get_type_code;
- gal_view_class->clone = gal_view_etable_clone ;
-
- object_class->destroy = gal_view_etable_destroy ;
-}
-
-static void
-gal_view_etable_init (GalViewEtable *gve)
-{
- gve->spec = NULL;
- gve->state = e_table_state_new();
- gve->title = NULL;
-}
-
-GtkType
-gal_view_etable_get_type (void)
-{
- static guint type = 0;
-
- if (!type)
- {
- GtkTypeInfo info =
- {
- "GalViewEtable",
- sizeof (GalViewEtable),
- sizeof (GalViewEtableClass),
- (GtkClassInitFunc) gal_view_etable_class_init,
- (GtkObjectInitFunc) gal_view_etable_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- type = gtk_type_unique (PARENT_TYPE, &info);
- }
-
- return type;
-}
-
-/**
- * gal_view_etable_new
- * @spec: The ETableSpecification that this view will be based upon.
- * @title: The name of the new view.
- *
- * Returns a new GalViewEtable. This is primarily for use by
- * GalViewFactoryEtable.
- *
- * Returns: The new GalViewEtable.
- */
-GalView *
-gal_view_etable_new (ETableSpecification *spec,
- const gchar *title)
-{
- return gal_view_etable_construct (gtk_type_new (gal_view_etable_get_type ()), spec, title);
-}
-
-/**
- * gal_view_etable_construct
- * @view: The view to construct.
- * @spec: The ETableSpecification that this view will be based upon.
- * @title: The name of the new view.
- *
- * constructs the GalViewEtable. To be used by subclasses and
- * language bindings.
- *
- * Returns: The GalViewEtable.
- */
-GalView *
-gal_view_etable_construct (GalViewEtable *view,
- ETableSpecification *spec,
- const gchar *title)
-{
- if (spec)
- gtk_object_ref(GTK_OBJECT(spec));
- view->spec = spec;
-
- if (view->state)
- gtk_object_unref(GTK_OBJECT(view->state));
- view->state = e_table_state_duplicate(spec->state);
-
- view->title = g_strdup(title);
-
- return GAL_VIEW(view);
-}
-
-void
-gal_view_etable_set_state (GalViewEtable *view, ETableState *state)
-{
- if (view->state)
- gtk_object_unref(GTK_OBJECT(view->state));
- view->state = e_table_state_duplicate(state);
-
- gal_view_changed(GAL_VIEW(view));
-}
-
-static void
-table_state_changed (ETable *table, GalViewEtable *view)
-{
- ETableState *state;
-
- state = e_table_get_state_object (table);
- gtk_object_unref (GTK_OBJECT (view->state));
- view->state = state;
-
- gal_view_changed(GAL_VIEW(view));
-}
-
-static void
-tree_state_changed (ETree *tree, GalViewEtable *view)
-{
- ETableState *state;
-
- state = e_tree_get_state_object (tree);
- gtk_object_unref (GTK_OBJECT (view->state));
- view->state = state;
-
- gal_view_changed(GAL_VIEW(view));
-}
-
-void
-gal_view_etable_attach_table (GalViewEtable *view, ETable *table)
-{
- gal_view_etable_detach (view);
-
- view->table = table;
-
- e_table_set_state_object(view->table, view->state);
- gtk_object_ref (GTK_OBJECT (view->table));
- view->table_state_changed_id =
- gtk_signal_connect(GTK_OBJECT(view->table), "state_change",
- GTK_SIGNAL_FUNC (table_state_changed), view);
-}
-
-void
-gal_view_etable_attach_tree (GalViewEtable *view, ETree *tree)
-{
- gal_view_etable_detach (view);
-
- view->tree = tree;
-
- e_tree_set_state_object(view->tree, view->state);
- gtk_object_ref (GTK_OBJECT (view->tree));
- view->tree_state_changed_id =
- gtk_signal_connect(GTK_OBJECT(view->tree), "state_change",
- GTK_SIGNAL_FUNC (tree_state_changed), view);
-}
-
-void
-gal_view_etable_detach (GalViewEtable *view)
-{
- if (view->table != NULL)
- detach_table (view);
- if (view->tree != NULL)
- detach_tree (view);
-}
diff --git a/widgets/menus/gal-view-etable.h b/widgets/menus/gal-view-etable.h
deleted file mode 100644
index 2fd001e583..0000000000
--- a/widgets/menus/gal-view-etable.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * gal-view-etable.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _GAL_VIEW_ETABLE_H_
-#define _GAL_VIEW_ETABLE_H_
-
-#include <libgnome/gnome-defs.h>
-#include <gtk/gtkobject.h>
-#include <gal/menus/gal-view.h>
-#include <gal/e-table/e-table-state.h>
-#include <gal/e-table/e-table-specification.h>
-#include <gal/e-table/e-table.h>
-#include <gal/e-table/e-tree.h>
-
-BEGIN_GNOME_DECLS
-
-#define GAL_VIEW_ETABLE_TYPE (gal_view_etable_get_type ())
-#define GAL_VIEW_ETABLE(o) (GTK_CHECK_CAST ((o), GAL_VIEW_ETABLE_TYPE, GalViewEtable))
-#define GAL_VIEW_ETABLE_CLASS(k) (GTK_CHECK_CLASS_CAST((k), GAL_VIEW_ETABLE_TYPE, GalViewEtableClass))
-#define GAL_IS_VIEW_ETABLE(o) (GTK_CHECK_TYPE ((o), GAL_VIEW_ETABLE_TYPE))
-#define GAL_IS_VIEW_ETABLE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), GAL_VIEW_ETABLE_TYPE))
-
-typedef struct {
- GalView base;
-
- ETableSpecification *spec;
- ETableState *state;
- char *title;
-
- ETable *table;
- guint table_state_changed_id;
-
- ETree *tree;
- guint tree_state_changed_id;
-} GalViewEtable;
-
-typedef struct {
- GalViewClass parent_class;
-} GalViewEtableClass;
-
-/* Standard functions */
-GtkType gal_view_etable_get_type (void);
-GalView *gal_view_etable_new (ETableSpecification *spec,
- const gchar *title);
-GalView *gal_view_etable_construct (GalViewEtable *view,
- ETableSpecification *spec,
- const gchar *title);
-void gal_view_etable_set_state (GalViewEtable *view,
- ETableState *state);
-void gal_view_etable_attach_table (GalViewEtable *view,
- ETable *table);
-void gal_view_etable_attach_tree (GalViewEtable *view,
- ETree *tree);
-void gal_view_etable_detach (GalViewEtable *view);
-
-END_GNOME_DECLS
-
-#endif /* _GAL_VIEW_ETABLE_H_ */
diff --git a/widgets/menus/gal-view-factory-etable.c b/widgets/menus/gal-view-factory-etable.c
deleted file mode 100644
index 026d085145..0000000000
--- a/widgets/menus/gal-view-factory-etable.c
+++ /dev/null
@@ -1,143 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * gal-view-factory-etable.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include "gal/util/e-i18n.h"
-#include "gal-view-factory-etable.h"
-#include "gal-view-etable.h"
-
-#define GVFE_CLASS(e) ((GalViewFactoryEtableClass *)((GtkObject *)e)->klass)
-
-#define PARENT_TYPE gal_view_factory_get_type ()
-
-static GalViewFactoryClass *gal_view_factory_etable_parent_class;
-
-static const char *
-gal_view_factory_etable_get_title (GalViewFactory *factory)
-{
- return _("Table");
-}
-
-static GalView *
-gal_view_factory_etable_new_view (GalViewFactory *factory,
- const char *name)
-{
- return gal_view_etable_new(GAL_VIEW_FACTORY_ETABLE(factory)->spec, name);
-}
-
-static const char *
-gal_view_factory_etable_get_type_code (GalViewFactory *factory)
-{
- return "etable";
-}
-
-static void
-gal_view_factory_etable_destroy (GtkObject *object)
-{
- GalViewFactoryEtable *factory = GAL_VIEW_FACTORY_ETABLE(object);
-
- if (factory->spec)
- gtk_object_unref(GTK_OBJECT(factory->spec));
-
- if (GTK_OBJECT_CLASS (gal_view_factory_etable_parent_class)->destroy)
- (* GTK_OBJECT_CLASS (gal_view_factory_etable_parent_class)->destroy) (object);
-}
-
-static void
-gal_view_factory_etable_class_init (GtkObjectClass *object_class)
-{
- GalViewFactoryClass *view_factory_class = GAL_VIEW_FACTORY_CLASS(object_class);
- gal_view_factory_etable_parent_class = gtk_type_class (PARENT_TYPE);
-
- view_factory_class->get_title = gal_view_factory_etable_get_title;
- view_factory_class->new_view = gal_view_factory_etable_new_view;
- view_factory_class->get_type_code = gal_view_factory_etable_get_type_code;
-
- object_class->destroy = gal_view_factory_etable_destroy;
-}
-
-static void
-gal_view_factory_etable_init (GalViewFactoryEtable *factory)
-{
- factory->spec = NULL;
-}
-
-/**
- * gal_view_etable_new
- * @spec: The spec to create GalViewEtables based upon.
- *
- * A new GalViewFactory for creating ETable views. Create one of
- * these and pass it to GalViewCollection for use.
- *
- * Returns: The new GalViewFactoryEtable.
- */
-GalViewFactory *
-gal_view_factory_etable_new (ETableSpecification *spec)
-{
- return gal_view_factory_etable_construct (gtk_type_new (gal_view_factory_etable_get_type ()), spec);
-}
-
-/**
- * gal_view_etable_construct
- * @factory: The factory to construct
- * @spec: The spec to create GalViewEtables based upon.
- *
- * constructs the GalViewFactoryEtable. To be used by subclasses and
- * language bindings.
- *
- * Returns: The GalViewFactoryEtable.
- */
-GalViewFactory *
-gal_view_factory_etable_construct (GalViewFactoryEtable *factory,
- ETableSpecification *spec)
-{
- if (spec)
- gtk_object_ref(GTK_OBJECT(spec));
- factory->spec = spec;
- return GAL_VIEW_FACTORY(factory);
-}
-
-GtkType
-gal_view_factory_etable_get_type (void)
-{
- static guint type = 0;
-
- if (!type)
- {
- GtkTypeInfo info =
- {
- "GalViewFactoryEtable",
- sizeof (GalViewFactoryEtable),
- sizeof (GalViewFactoryEtableClass),
- (GtkClassInitFunc) gal_view_factory_etable_class_init,
- (GtkObjectInitFunc) gal_view_factory_etable_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- type = gtk_type_unique (PARENT_TYPE, &info);
- }
-
- return type;
-}
diff --git a/widgets/menus/gal-view-factory-etable.h b/widgets/menus/gal-view-factory-etable.h
deleted file mode 100644
index 502f39b5f6..0000000000
--- a/widgets/menus/gal-view-factory-etable.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * gal-view-factory-etable.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _GAL_VIEW_FACTORY_ETABLE_H_
-#define _GAL_VIEW_FACTORY_ETABLE_H_
-
-#include <gtk/gtkobject.h>
-#include <gal/menus/gal-view-factory.h>
-#include <gal/e-table/e-table-specification.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#define GAL_VIEW_FACTORY_ETABLE_TYPE (gal_view_factory_etable_get_type ())
-#define GAL_VIEW_FACTORY_ETABLE(o) (GTK_CHECK_CAST ((o), GAL_VIEW_FACTORY_ETABLE_TYPE, GalViewFactoryEtable))
-#define GAL_VIEW_FACTORY_ETABLE_CLASS(k) (GTK_CHECK_CLASS_CAST((k), GAL_VIEW_FACTORY_ETABLE_TYPE, GalViewFactoryEtableClass))
-#define GAL_IS_VIEW_FACTORY_ETABLE(o) (GTK_CHECK_TYPE ((o), GAL_VIEW_FACTORY_ETABLE_TYPE))
-#define GAL_IS_VIEW_FACTORY_ETABLE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), GAL_VIEW_FACTORY_ETABLE_TYPE))
-
-typedef struct {
- GalViewFactory base;
-
- ETableSpecification *spec;
-} GalViewFactoryEtable;
-
-typedef struct {
- GalViewFactoryClass parent_class;
-} GalViewFactoryEtableClass;
-
-/* Standard functions */
-GtkType gal_view_factory_etable_get_type (void);
-GalViewFactory *gal_view_factory_etable_new (ETableSpecification *spec);
-GalViewFactory *gal_view_factory_etable_construct (GalViewFactoryEtable *factory,
- ETableSpecification *spec);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _GAL_VIEW_FACTORY_ETABLE_H_ */
diff --git a/widgets/menus/gal-view-factory.c b/widgets/menus/gal-view-factory.c
deleted file mode 100644
index 90864fda8f..0000000000
--- a/widgets/menus/gal-view-factory.c
+++ /dev/null
@@ -1,126 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * gal-view-factory.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include "gal-view-factory.h"
-
-#define GVF_CLASS(e) ((GalViewFactoryClass *)((GtkObject *)e)->klass)
-
-#define PARENT_TYPE gtk_object_get_type ()
-
-#define d(x)
-
-d(static gint depth = 0);
-
-static GtkObjectClass *gal_view_factory_parent_class;
-
-/**
- * gal_view_factory_get_title:
- * @factory: The factory to query.
- *
- * Returns: The title of the factory.
- */
-const char *
-gal_view_factory_get_title (GalViewFactory *factory)
-{
- g_return_val_if_fail (factory != NULL, 0);
- g_return_val_if_fail (GAL_IS_VIEW_FACTORY (factory), 0);
-
- if (GVF_CLASS (factory)->get_title)
- return GVF_CLASS (factory)->get_title (factory);
- else
- return NULL;
-}
-
-/**
- * gal_view_factory_new_view:
- * @factory: The factory to use
- * @name: the name for the view.
- *
- * Returns: The new view
- */
-GalView *
-gal_view_factory_new_view (GalViewFactory *factory,
- const char *name)
-{
- g_return_val_if_fail (factory != NULL, NULL);
- g_return_val_if_fail (GAL_IS_VIEW_FACTORY (factory), NULL);
-
- if (GVF_CLASS (factory)->new_view)
- return GVF_CLASS (factory)->new_view (factory, name);
- else
- return NULL;
-}
-
-/**
- * gal_view_factory_get_type_code:
- * @factory: The factory to use
- *
- * Returns: The type code
- */
-const char *
-gal_view_factory_get_type_code (GalViewFactory *factory)
-{
- g_return_val_if_fail (factory != NULL, NULL);
- g_return_val_if_fail (GAL_IS_VIEW_FACTORY (factory), NULL);
-
- if (GVF_CLASS (factory)->get_type_code)
- return GVF_CLASS (factory)->get_type_code (factory);
- else
- return NULL;
-}
-
-static void
-gal_view_factory_class_init (GtkObjectClass *object_class)
-{
- GalViewFactoryClass *klass = GAL_VIEW_FACTORY_CLASS(object_class);
- gal_view_factory_parent_class = gtk_type_class (PARENT_TYPE);
-
- klass->get_title = NULL;
- klass->new_view = NULL;
-}
-
-GtkType
-gal_view_factory_get_type (void)
-{
- static guint type = 0;
-
- if (!type)
- {
- GtkTypeInfo info =
- {
- "GalViewFactory",
- sizeof (GalViewFactory),
- sizeof (GalViewFactoryClass),
- (GtkClassInitFunc) gal_view_factory_class_init,
- NULL,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- type = gtk_type_unique (PARENT_TYPE, &info);
- }
-
- return type;
-}
diff --git a/widgets/menus/gal-view-factory.h b/widgets/menus/gal-view-factory.h
deleted file mode 100644
index b02c728517..0000000000
--- a/widgets/menus/gal-view-factory.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * gal-view-factory.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _GAL_VIEW_FACTORY_H_
-#define _GAL_VIEW_FACTORY_H_
-
-#include <gtk/gtkobject.h>
-#include <gal/menus/gal-view.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#define GAL_VIEW_FACTORY_TYPE (gal_view_factory_get_type ())
-#define GAL_VIEW_FACTORY(o) (GTK_CHECK_CAST ((o), GAL_VIEW_FACTORY_TYPE, GalViewFactory))
-#define GAL_VIEW_FACTORY_CLASS(k) (GTK_CHECK_CLASS_CAST((k), GAL_VIEW_FACTORY_TYPE, GalViewFactoryClass))
-#define GAL_IS_VIEW_FACTORY(o) (GTK_CHECK_TYPE ((o), GAL_VIEW_FACTORY_TYPE))
-#define GAL_IS_VIEW_FACTORY_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), GAL_VIEW_FACTORY_TYPE))
-
-typedef struct {
- GtkObject base;
-} GalViewFactory;
-
-typedef struct {
- GtkObjectClass parent_class;
-
- /*
- * Virtual methods
- */
- const char *(*get_title) (GalViewFactory *factory);
- const char *(*get_type_code) (GalViewFactory *factory);
- GalView *(*new_view) (GalViewFactory *factory,
- const char *name);
-} GalViewFactoryClass;
-
-/* Standard functions */
-GtkType gal_view_factory_get_type (void);
-
-/* Query functions */
-/* Returns already translated title. */
-const char *gal_view_factory_get_title (GalViewFactory *factory);
-
-/* Returns the code for use in identifying this type of object in the
- * view list. This identifier should identify this as being the
- * unique factory for xml files which were written out with this
- * identifier. Thus each factory should have a unique type code. */
-const char *gal_view_factory_get_type_code (GalViewFactory *factory);
-
-/* Create a new view */
-GalView *gal_view_factory_new_view (GalViewFactory *factory,
- const char *name);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* _GAL_VIEW_FACTORY_H_ */
diff --git a/widgets/menus/gal-view-new-dialog.c b/widgets/menus/gal-view-new-dialog.c
deleted file mode 100644
index 417fa7c343..0000000000
--- a/widgets/menus/gal-view-new-dialog.c
+++ /dev/null
@@ -1,224 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * gal-view-new-dialog.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <libgnomeui/gnome-dialog.h>
-#include <libgnomeui/gnome-stock.h>
-#include "gal-view-new-dialog.h"
-#include "gal-define-views-model.h"
-#include <gal/widgets/e-unicode.h>
-#include <gal/e-table/e-table-scrolled.h>
-
-static void gal_view_new_dialog_init (GalViewNewDialog *card);
-static void gal_view_new_dialog_class_init (GalViewNewDialogClass *klass);
-static void gal_view_new_dialog_set_arg (GtkObject *o, GtkArg *arg, guint arg_id);
-static void gal_view_new_dialog_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
-static void gal_view_new_dialog_destroy (GtkObject *object);
-
-static GnomeDialogClass *parent_class = NULL;
-#define PARENT_TYPE gnome_dialog_get_type()
-
-/* The arguments we take */
-enum {
- ARG_0,
- ARG_NAME,
- ARG_FACTORY,
-};
-
-GtkType
-gal_view_new_dialog_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type) {
- static const GtkTypeInfo info =
- {
- "GalViewNewDialog",
- sizeof (GalViewNewDialog),
- sizeof (GalViewNewDialogClass),
- (GtkClassInitFunc) gal_view_new_dialog_class_init,
- (GtkObjectInitFunc) gal_view_new_dialog_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- type = gtk_type_unique (PARENT_TYPE, &info);
- }
-
- return type;
-}
-
-static void
-gal_view_new_dialog_class_init (GalViewNewDialogClass *klass)
-{
- GtkObjectClass *object_class;
-
- object_class = (GtkObjectClass*) klass;
-
- parent_class = gtk_type_class (PARENT_TYPE);
-
- object_class->set_arg = gal_view_new_dialog_set_arg;
- object_class->get_arg = gal_view_new_dialog_get_arg;
- object_class->destroy = gal_view_new_dialog_destroy;
-
- gtk_object_add_arg_type ("GalViewNewDialog::name", GTK_TYPE_STRING,
- GTK_ARG_READWRITE, ARG_NAME);
- gtk_object_add_arg_type ("GalViewNewDialog::factory", GTK_TYPE_OBJECT,
- GTK_ARG_READABLE, ARG_FACTORY);
-}
-
-static void
-gal_view_new_dialog_init (GalViewNewDialog *dialog)
-{
- GladeXML *gui;
- GtkWidget *widget;
-
- gui = glade_xml_new_with_domain (GAL_GLADEDIR "/gal-view-new-dialog.glade", NULL, PACKAGE);
- dialog->gui = gui;
-
- widget = glade_xml_get_widget(gui, "table-top");
- if (!widget) {
- return;
- }
- gtk_widget_ref(widget);
- gtk_widget_unparent(widget);
- gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(dialog)->vbox), widget, TRUE, TRUE, 0);
- gtk_widget_unref(widget);
-
- gnome_dialog_append_buttons(GNOME_DIALOG(dialog),
- GNOME_STOCK_BUTTON_OK,
- GNOME_STOCK_BUTTON_CANCEL,
- NULL);
-
- gtk_window_set_policy(GTK_WINDOW(dialog), FALSE, TRUE, FALSE);
-
- dialog->collection = NULL;
- dialog->selected_factory = NULL;
-}
-
-static void
-gal_view_new_dialog_destroy (GtkObject *object)
-{
- GalViewNewDialog *gal_view_new_dialog = GAL_VIEW_NEW_DIALOG(object);
-
- gtk_object_unref(GTK_OBJECT(gal_view_new_dialog->gui));
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-GtkWidget*
-gal_view_new_dialog_new (GalViewCollection *collection)
-{
- GtkWidget *widget =
- gal_view_new_dialog_construct(gtk_type_new (gal_view_new_dialog_get_type ()),
- collection);
- return widget;
-}
-
-
-static void
-gal_view_new_dialog_select_row_callback(GtkCList *list,
- gint row,
- gint column,
- GdkEventButton *event,
- GalViewNewDialog *dialog)
-{
- dialog->selected_factory = gtk_clist_get_row_data(list,
- row);
-}
-
-GtkWidget*
-gal_view_new_dialog_construct (GalViewNewDialog *dialog,
- GalViewCollection *collection)
-{
- GtkWidget *list = glade_xml_get_widget(dialog->gui,
- "clist-type-list");
- GList *iterator;
- dialog->collection = collection;
-
- iterator = dialog->collection->factory_list;
-
- for ( ; iterator; iterator = g_list_next(iterator) ) {
- GalViewFactory *factory = iterator->data;
- char *text[1];
- int row;
-
- gtk_object_ref(GTK_OBJECT(factory));
- text[0] = (char *) gal_view_factory_get_title(factory);
- row = gtk_clist_append(GTK_CLIST(list), text);
- gtk_clist_set_row_data(GTK_CLIST(list), row, factory);
- }
-
- gtk_signal_connect(GTK_OBJECT (list),
- "select_row",
- GTK_SIGNAL_FUNC(gal_view_new_dialog_select_row_callback),
- dialog);
-
- return GTK_WIDGET(dialog);
-}
-
-static void
-gal_view_new_dialog_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- GalViewNewDialog *dialog;
- GtkWidget *entry;
-
- dialog = GAL_VIEW_NEW_DIALOG (o);
-
- switch (arg_id){
- case ARG_NAME:
- entry = glade_xml_get_widget(dialog->gui, "entry-name");
- if (entry && GTK_IS_EDITABLE(entry)) {
- e_utf8_gtk_editable_set_text(GTK_EDITABLE(entry), GTK_VALUE_STRING(*arg));
- }
- break;
- default:
- return;
- }
-}
-
-static void
-gal_view_new_dialog_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- GalViewNewDialog *dialog;
- GtkWidget *entry;
-
- dialog = GAL_VIEW_NEW_DIALOG (object);
-
- switch (arg_id) {
- case ARG_NAME:
- entry = glade_xml_get_widget(dialog->gui, "entry-name");
- if (entry && GTK_IS_EDITABLE(entry)) {
- GTK_VALUE_STRING(*arg) = e_utf8_gtk_editable_get_text(GTK_EDITABLE(entry));
- }
- break;
- case ARG_FACTORY:
- GTK_VALUE_OBJECT(*arg) = dialog->selected_factory ? GTK_OBJECT(dialog->selected_factory) : NULL;
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
diff --git a/widgets/menus/gal-view-new-dialog.glade b/widgets/menus/gal-view-new-dialog.glade
deleted file mode 100644
index 173fa6c3af..0000000000
--- a/widgets/menus/gal-view-new-dialog.glade
+++ /dev/null
@@ -1,220 +0,0 @@
-<?xml version="1.0"?>
-<GTK-Interface>
-
-<project>
- <name>gal-view-new-dialog</name>
- <program_name>gal-view-new-dialog</program_name>
- <directory></directory>
- <source_directory>src</source_directory>
- <pixmaps_directory>pixmaps</pixmaps_directory>
- <language>C</language>
- <gnome_support>True</gnome_support>
- <gettext_support>True</gettext_support>
- <use_widget_names>True</use_widget_names>
- <output_main_file>False</output_main_file>
- <output_support_files>False</output_support_files>
- <output_build_files>False</output_build_files>
- <gnome_help_support>True</gnome_help_support>
-</project>
-
-<widget>
- <class>GnomeDialog</class>
- <name>dialog1</name>
- <visible>False</visible>
- <type>GTK_WINDOW_TOPLEVEL</type>
- <position>GTK_WIN_POS_NONE</position>
- <modal>False</modal>
- <allow_shrink>False</allow_shrink>
- <allow_grow>True</allow_grow>
- <auto_shrink>False</auto_shrink>
- <auto_close>False</auto_close>
- <hide_on_close>False</hide_on_close>
-
- <widget>
- <class>GtkVBox</class>
- <child_name>GnomeDialog:vbox</child_name>
- <name>dialog-vbox1</name>
- <homogeneous>False</homogeneous>
- <spacing>8</spacing>
- <child>
- <padding>4</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkHButtonBox</class>
- <child_name>GnomeDialog:action_area</child_name>
- <name>dialog-action_area1</name>
- <layout_style>GTK_BUTTONBOX_END</layout_style>
- <spacing>8</spacing>
- <child_min_width>85</child_min_width>
- <child_min_height>27</child_min_height>
- <child_ipad_x>7</child_ipad_x>
- <child_ipad_y>0</child_ipad_y>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- <pack>GTK_PACK_END</pack>
- </child>
-
- <widget>
- <class>GtkButton</class>
- <name>button1</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button3</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
- </widget>
- </widget>
-
- <widget>
- <class>GtkTable</class>
- <name>table-top</name>
- <rows>4</rows>
- <columns>1</columns>
- <homogeneous>False</homogeneous>
- <row_spacing>6</row_spacing>
- <column_spacing>6</column_spacing>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkLabel</class>
- <name>label1</name>
- <label>Name of new view:</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <focus_target>entry-name</focus_target>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkEntry</class>
- <name>entry-name</name>
- <can_focus>True</can_focus>
- <editable>True</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>1</top_attach>
- <bottom_attach>2</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label2</name>
- <label>Type of view:</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>2</top_attach>
- <bottom_attach>3</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkScrolledWindow</class>
- <name>scrolledwindow1</name>
- <hscrollbar_policy>GTK_POLICY_AUTOMATIC</hscrollbar_policy>
- <vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy>
- <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
- <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>3</top_attach>
- <bottom_attach>4</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>True</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>GtkCList</class>
- <name>clist-type-list</name>
- <can_focus>True</can_focus>
- <columns>1</columns>
- <column_widths>80</column_widths>
- <selection_mode>GTK_SELECTION_SINGLE</selection_mode>
- <show_titles>False</show_titles>
- <shadow_type>GTK_SHADOW_IN</shadow_type>
-
- <widget>
- <class>GtkLabel</class>
- <child_name>CList:title</child_name>
- <name>label5</name>
- <label>label5</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- </widget>
- </widget>
- </widget>
- </widget>
- </widget>
-</widget>
-
-</GTK-Interface>
diff --git a/widgets/menus/gal-view-new-dialog.h b/widgets/menus/gal-view-new-dialog.h
deleted file mode 100644
index 623cb341d0..0000000000
--- a/widgets/menus/gal-view-new-dialog.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * gal-view-new-dialog.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef __GAL_VIEW_NEW_DIALOG_H__
-#define __GAL_VIEW_NEW_DIALOG_H__
-
-#include <glade/glade.h>
-#include <gal-view-collection.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-/* GalViewNewDialog - A dialog displaying information about a contact.
- *
- * The following arguments are available:
- *
- * name type read/write description
- * --------------------------------------------------------------------------------
- */
-
-#define GAL_VIEW_NEW_DIALOG_TYPE (gal_view_new_dialog_get_type ())
-#define GAL_VIEW_NEW_DIALOG(obj) (GTK_CHECK_CAST ((obj), GAL_VIEW_NEW_DIALOG_TYPE, GalViewNewDialog))
-#define GAL_VIEW_NEW_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), GAL_VIEW_NEW_DIALOG_TYPE, GalViewNewDialogClass))
-#define GAL_IS_VIEW_NEW_DIALOG(obj) (GTK_CHECK_TYPE ((obj), GAL_VIEW_NEW_DIALOG_TYPE))
-#define GAL_IS_VIEW_NEW_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), GAL_VIEW_NEW_DIALOG_TYPE))
-
-typedef struct _GalViewNewDialog GalViewNewDialog;
-typedef struct _GalViewNewDialogClass GalViewNewDialogClass;
-
-struct _GalViewNewDialog
-{
- GnomeDialog parent;
-
- /* item specific fields */
- GladeXML *gui;
-
- GalViewCollection *collection;
- GalViewFactory *selected_factory;
-};
-
-struct _GalViewNewDialogClass
-{
- GnomeDialogClass parent_class;
-};
-
-GtkWidget *gal_view_new_dialog_new (GalViewCollection *collection);
-GtkType gal_view_new_dialog_get_type (void);
-
-GtkWidget *gal_view_new_dialog_construct (GalViewNewDialog *dialog,
- GalViewCollection *collection);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GAL_VIEW_NEW_DIALOG_H__ */
diff --git a/widgets/menus/gal-view.c b/widgets/menus/gal-view.c
deleted file mode 100644
index 71cf0d3fdd..0000000000
--- a/widgets/menus/gal-view.c
+++ /dev/null
@@ -1,225 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * gal-view.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <gtk/gtksignal.h>
-#include "gal-view.h"
-#include "gal/util/e-util.h"
-
-#define GV_CLASS(e) ((GalViewClass *)((GtkObject *)e)->klass)
-
-#define PARENT_TYPE gtk_object_get_type ()
-
-#define d(x)
-
-d(static gint depth = 0);
-
-
-static GtkObjectClass *gal_view_parent_class;
-
-enum {
- CHANGED,
- LAST_SIGNAL
-};
-
-static guint gal_view_signals [LAST_SIGNAL] = { 0, };
-
-/**
- * gal_view_edit
- * @view: The view to edit
- */
-void
-gal_view_edit (GalView *view)
-{
- g_return_if_fail (view != NULL);
- g_return_if_fail (GAL_IS_VIEW (view));
-
- if (GV_CLASS (view)->edit)
- GV_CLASS (view)->edit (view);
-}
-
-/**
- * gal_view_load
- * @view: The view to load to
- * @filename: The file to load from
- */
-void
-gal_view_load (GalView *view,
- const char *filename)
-{
- g_return_if_fail (view != NULL);
- g_return_if_fail (GAL_IS_VIEW (view));
-
- if (GV_CLASS (view)->load)
- GV_CLASS (view)->load (view, filename);
-}
-
-/**
- * gal_view_save
- * @view: The view to save
- * @filename: The file to save to
- */
-void
-gal_view_save (GalView *view,
- const char *filename)
-{
- g_return_if_fail (view != NULL);
- g_return_if_fail (GAL_IS_VIEW (view));
-
- if (GV_CLASS (view)->save)
- GV_CLASS (view)->save (view, filename);
-}
-
-/**
- * gal_view_get_title
- * @view: The view to query.
- *
- * Returns: The title of the view.
- */
-const char *
-gal_view_get_title (GalView *view)
-{
- g_return_val_if_fail (view != NULL, NULL);
- g_return_val_if_fail (GAL_IS_VIEW (view), NULL);
-
- if (GV_CLASS (view)->get_title)
- return GV_CLASS (view)->get_title (view);
- else
- return NULL;
-}
-
-/**
- * gal_view_set_title
- * @view: The view to set.
- * @title: The new title value.
- */
-void
-gal_view_set_title (GalView *view,
- const char *title)
-{
- g_return_if_fail (view != NULL);
- g_return_if_fail (GAL_IS_VIEW (view));
-
- if (GV_CLASS (view)->set_title)
- GV_CLASS (view)->set_title (view, title);
-}
-
-/**
- * gal_view_get_type_code
- * @view: The view to get.
- *
- * Returns: The type of the view.
- */
-const char *
-gal_view_get_type_code (GalView *view)
-{
- g_return_val_if_fail (view != NULL, NULL);
- g_return_val_if_fail (GAL_IS_VIEW (view), NULL);
-
- if (GV_CLASS (view)->get_type_code)
- return GV_CLASS (view)->get_type_code (view);
- else
- return NULL;
-}
-
-/**
- * gal_view_clone
- * @view: The view to clone.
- *
- * Returns: The clone.
- */
-GalView *
-gal_view_clone (GalView *view)
-{
- g_return_val_if_fail (view != NULL, NULL);
- g_return_val_if_fail (GAL_IS_VIEW (view), NULL);
-
- if (GV_CLASS (view)->clone)
- return GV_CLASS (view)->clone (view);
- else
- return NULL;
-}
-
-/**
- * gal_view_changed
- * @view: The view that changed.
- */
-void
-gal_view_changed (GalView *view)
-{
- g_return_if_fail (view != NULL);
- g_return_if_fail (GAL_IS_VIEW (view));
-
- gtk_signal_emit(GTK_OBJECT(view),
- gal_view_signals [CHANGED]);
-}
-
-static void
-gal_view_class_init (GtkObjectClass *object_class)
-{
- GalViewClass *klass = GAL_VIEW_CLASS(object_class);
- gal_view_parent_class = gtk_type_class (PARENT_TYPE);
-
- klass->edit = NULL;
- klass->load = NULL;
- klass->save = NULL;
- klass->get_title = NULL;
- klass->clone = NULL;
-
- klass->changed = NULL;
-
- gal_view_signals [CHANGED] =
- gtk_signal_new ("changed",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (GalViewClass, changed),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- E_OBJECT_CLASS_ADD_SIGNALS (object_class, gal_view_signals, LAST_SIGNAL);
-}
-
-GtkType
-gal_view_get_type (void)
-{
- static guint type = 0;
-
- if (!type)
- {
- GtkTypeInfo info =
- {
- "GalView",
- sizeof (GalView),
- sizeof (GalViewClass),
- (GtkClassInitFunc) gal_view_class_init,
- NULL,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- type = gtk_type_unique (PARENT_TYPE, &info);
- }
-
- return type;
-}
diff --git a/widgets/menus/gal-view.h b/widgets/menus/gal-view.h
deleted file mode 100644
index 3d617df25f..0000000000
--- a/widgets/menus/gal-view.h
+++ /dev/null
@@ -1,96 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * gal-view.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _GAL_VIEW_H_
-#define _GAL_VIEW_H_
-
-#include <gtk/gtkobject.h>
-#include <gnome-xml/tree.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#define GAL_VIEW_TYPE (gal_view_get_type ())
-#define GAL_VIEW(o) (GTK_CHECK_CAST ((o), GAL_VIEW_TYPE, GalView))
-#define GAL_VIEW_CLASS(k) (GTK_CHECK_CLASS_CAST((k), GAL_VIEW_TYPE, GalViewClass))
-#define GAL_IS_VIEW(o) (GTK_CHECK_TYPE ((o), GAL_VIEW_TYPE))
-#define GAL_IS_VIEW_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), GAL_VIEW_TYPE))
-
-typedef struct {
- GtkObject base;
-} GalView;
-
-typedef struct {
- GtkObjectClass parent_class;
-
- /*
- * Virtual methods
- */
- void (*edit) (GalView *view);
- void (*load) (GalView *view,
- const char *filename);
- void (*save) (GalView *view,
- const char *filename);
- const char *(*get_title) (GalView *view);
- void (*set_title) (GalView *view,
- const char *title);
- const char *(*get_type_code) (GalView *view);
- GalView *(*clone) (GalView *view);
-
- /* Signals */
- void (*changed) (GalView *view);
-} GalViewClass;
-
-/* Standard functions */
-GtkType gal_view_get_type (void);
-
-/* Open an editor dialog for this view. */
-void gal_view_edit (GalView *view);
-
-/* xml load and save functions */
-void gal_view_load (GalView *view,
- const char *filename);
-void gal_view_save (GalView *view,
- const char *filename);
-
-/* Title functions */
-const char *gal_view_get_title (GalView *view);
-void gal_view_set_title (GalView *view,
- const char *title);
-
-/* View type. */
-const char *gal_view_get_type_code (GalView *view);
-
-/* Cloning the view */
-GalView *gal_view_clone (GalView *view);
-
-/* Changed signal */
-void gal_view_changed (GalView *view);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _GAL_VIEW_H_ */
diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog
index 432c6954ca..8bfbe71f7d 100644
--- a/widgets/misc/ChangeLog
+++ b/widgets/misc/ChangeLog
@@ -1,211 +1,3 @@
-2002-04-09 Dan Winship <danw@ximian.com>
-
- * e-search-bar.c (e_search_bar_construct, add_button): Oops. The
- previous change made the search bar widgets get packed in the
- wrong order. So use gtk_box_pack_end instead in add_button and add
- the two buttons in reverse order. It's all good now. Noticed by
- Ettore, who I then promptly blamed for it. Sorry Ettore!
-
-2002-04-08 Dan Winship <danw@ximian.com>
-
- * e-search-bar.c (e_search_bar_construct): Construct the buttons
- earlier so that the option-menu-setup code that tries to adjust
- the button sensitivity won't fail and g_warn.
-
-2002-04-06 JP Rosevear <jpr@ximian.com>
-
- * e-multi-config-dialog.c (e_multi_config_dialog_show_page): show
- a specific page number
-
- * e-multi-config-dialog.h: new proto
-
-2002-03-29 Ettore Perazzoli <ettore@ximian.com>
-
- * e-multi-config-dialog.c: Change the ETable specs so it doesn't
- sort.
-
-2002-03-20 Ettore Perazzoli <ettore@ximian.com>
-
- * e-search-bar.c (update_bonobo_menus): Add accelerators for "Find
- Now" and "Clear".
-
- * e-filter-bar.h: Change search labels as suggested in Anna's
- redesign [#16246].
-
-2002-03-20 Ettore Perazzoli <ettore@ximian.com>
-
- * e-search-bar.c (update_bonobo_menus): Remove all the SearchBar
- items before setting them up again.
- (free_menu_items): New.
- (impl_destroy): Call it.
- (set_menu): Call it here too before adding the new items.
-
-2002-03-18 Ettore Perazzoli <ettore@ximian.com>
-
- * e-search-bar.c (verb_name_from_id): New.
- (e_search_bar_set_menu_sensitive): Rewritten using it.
-
-2002-03-18 Ettore Perazzoli <ettore@ximian.com>
-
- * e-search-bar.c (update_bonobo_menus): No accelerator for
- "FindNow".
- (add_button): Add a one-pixel padding to the button.
-
-2002-03-18 Ettore Perazzoli <ettore@ximian.com>
-
- * e-search-bar.c (update_bonobo_menus): Rename the "Search Now"
- menu entry to "Find Now". Rename the corresponding verb to
- "ESearchBar:FindNow".
- (update_sensitivity): Updated accordingly.
- (setup_standard_verbs): Likewise.
-
-2002-03-18 Ettore Perazzoli <ettore@ximian.com>
-
- * e-search-bar.c (update_sensitivity): New halper function to
- update the sensitivity of the commands.
- (entry_changed_cb): New callback to make the activate_button and
- the "Find Now" verb sensitive only if the entry has some contents.
- (activate_by_subitems): Connect the callback here.
- (setup_standard_verbs): Call update_sensitivity() here.
-
-2002-03-18 Ettore Perazzoli <ettore@ximian.com>
-
- * e-search-bar.c (init): Init clear_button to NULL.
- (add_button): New helper function to add a button to the search
- bar with the right spacing etc.
- (clear_search): New helper function.
- (add_activate_button): Removed.
- (clear_button_clicked_cb): New.
- (e_search_bar_construct): Just add the button here using
- `add_button'. Also add a clear_button.
- (clear_verb_cb): Rewritten by means of `clear_search()'.
-
- * e-search-bar.h (ESearchBar): Add clear_button.
-
-2002-03-18 Ettore Perazzoli <ettore@ximian.com>
-
- * e-search-bar.c (search_now_verb_cb): New, implementation for a
- new "SearchNow" verb.
- (setup_standard_verbs): Create verb here.
- (update_bonobo_menus): Add SearchNow menu item.
-
-2002-03-18 Ettore Perazzoli <ettore@ximian.com>
-
- * e-search-bar.c (clear_verb_cb): New.
- (setup_standard_verbs): New.
- (e_search_bar_set_ui_component): Call it if a new
- BonoboUIComponent is set.
- (append_xml_menu_item): New helper function.
- (update_bonobo_menus): Use it. Also add a "Clear" menu item.
- (e_search_bar_construct): @menu_items can be NULL now.
- (e_search_bar_new): Same here.
- (set_menu): Work with NULL items.
-
- * e-filter-bar.c (menubar_activated): Don't handle
- E_FILTERBAR_RESET_ID anymore.
-
- * e-filter-bar.h: Remove `E_FILTERBAR_RESET_ID' and `E_FILTERBAR_RESET'.
-
-2002-03-15 Ettore Perazzoli <ettore@ximian.com>
-
- * e-search-bar.c (init): Init various members to NULL.
- (set_dropdown): Removed.
- (add_dropdown): Removed.
- (set_menu): New.
- (add_menu_items): New.
- (set_option): No need to setup the dropdown size here anymore.
- (verb_cb): Function implementing the search menu verbs.
- (update_bonobo_menus): New.
- (e_search_bar_set_ui_component): New.
-
- * e-search-bar.h: Remove the dropdown button stuff from struct
- ESearchBar. Add `uic' and `items' members.
-
- * e-filter-bar.c (e_filter_bar_new): Get a @uic arg.
-
-2002-03-15 Christopher James Lahey <clahey@ximian.com>
-
- * e-multi-config-dialog.c (init): Set horizontal scroll policy to
- GTK_POLICY_NEVER here. Don't set usize here. Changed RGBA_COLOR
- to RGB_COLOR. Turned on horizontal resize.
-
-2002-03-13 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-charset-picker.c (add_charset): If the charset item doesn't
- have a class (aka "Unknown"), don't write a class name, instead
- just give the charset name as the menu item label. Fixes bug
- #14753.
-
-2002-03-13 Christopher James Lahey <clahey@ximian.com>
-
- * e-multi-config-dialog.c: Added alpha blending here.
-
-2002-03-12 Christopher James Lahey <clahey@ximian.com>
-
- * e-multi-config-dialog.c: Removed Page struct.
- (e_multi_config_dialog_add_page): Select the initial row after
- appending to the model.
-
-2002-03-12 Christopher James Lahey <clahey@ximian.com>
-
- * e-multi-config-dialog.c (init): Use Use e_table_memory_store
- instead of e_table_memory_callbacks. Use e_cell_vbox to include a
- pixbuf cell and a text cell.
-
-2002-03-11 Ettore Perazzoli <ettore@ximian.com>
-
- * e-multi-config-dialog.c (init): Use GNOME_STOCK_BUTTON_CLOSE,
- not GNOME_STOCK_BUTTON_CANCEL.
- (do_close): Renamed from `cancel'.
- (do_apply): Renamed from `apply'.
- (do_ok): Renamed from `ok'.
-
-2002-03-09 Ettore Perazzoli <ettore@ximian.com>
-
- * e-multi-config-dialog.c: Rename Page.widget -> Page.page_widget;
- it is now an EConfigPage instead of just a GtkWidget. Add
- `num_unapplied' to EMultiConfigDialogPrivate. Derive from
- GnomeDialog, not GtkWindow.
- (update_buttons): New function to update the sensitiveness of the
- buttons according to whether all the settings have been applied or
- not.
- (page_new): Likewise.
- (create_page_container): Renamed from `create_page_widget'.
- (init): Add Apply/OK/Cancel buttons to the dialog. Init
- ->num_unapplied to zero.
- (page_changed_callback): New, callback for the page's "changed"
- signal.
- (e_multi_config_dialog_add_page): Connect the callback, update
- ->num_unapplied, update the buttons by calling `update_buttons'.
- (ok): New function for handling the OK button.
- (apply): New function for handling the Apply button.
- (cancel): New function for handling the Cancel button.
- (impl_clicked): Implementation for the GnomeDialog's ::clicked
- signal.
- (class_init): Install.
-
- * test-multi-config-dialog.c (add_pages): Update to use
- EConfigPages instead of plain GtkWidgets.
-
- * e-multi-config-dialog.c, e-multi-config-dialog.h: Derive from
- GnomeDialog, not GtkWindow.
-
- * e-config-page.c: New.
- * e-config-page.h: New.
-
-2002-03-07 Ettore Perazzoli <ettore@ximian.com>
-
- * e-multi-config-dialog.c: Don't display a header in the table on
- the left.
-
-2002-03-05 Ettore Perazzoli <ettore@ximian.com>
-
- * test-multi-config-dialog.c: New.
- * test-multi-config-dialog.h: New.
-
- * e-multi-config-dialog.c: New.
- * e-multi-config-dialog.h: New.
-
2002-02-24 Chris Toshok <toshok@ximian.com>
* e-filter-bar.c (init): preserve behavior - hook search_activated
@@ -227,71 +19,6 @@
* e-search-bar.h (struct _ESearchBarClass): add a search_activated
signal.
-2002-02-21 Ettore Perazzoli <ettore@ximian.com>
-
- * e-combo-button.c (set_icon): gtk_widget_show() the icon_pixmap
- if the specified icon is not NULL.
-
-2002-02-20 Ettore Perazzoli <ettore@ximian.com>
-
- * e-combo-button.c (set_icon): Work with a NULL @pixbuf as well
- [in that case, just hide the current icon widget].
- (e_combo_button_set_icon): Remove the precondition about @pixbuf
- being non-NULL.
-
-2002-02-08 JP Rosevear <jpr@ximian.com>
-
- * e-url-button.[hc]: remove briefly used files
-
-2002-02-08 JP Rosevear <jpr@ximian.com>
-
- * e-url-entry.[hc]: button/entry combo that launchs the gnome url
- handler on the entry text when the button is clicked
-
- * Makefile.am: build new files
-
-2002-02-08 JP Rosevear <jpr@ximian.com>
-
- * Makefile.am: build new files
-
- * e-url-button.[hc]: button widget that when clicked slurps the
- url of an entry and launchs the gnome url handler on the text
-
-2002-01-27 Ettore Perazzoli <ettore@ximian.com>
-
- * Makefile.am: Use GNOME_FULL_CFLAGS and GNOME_FULL_LIBS.
-
-2002-01-23 Ettore Perazzoli <ettore@ximian.com>
-
- * e-combo-button.c: Remove member `separator' from
- `EComboButtonPrivate'. New members `icon', `label'.
- (init): There shall be no separator no more. Init `icon' and
- `label' to %NULL.
- (e_combo_button_construct): Set no relief.
- (e_combo_button_new): Don't get a @menu arg anymore.
- (e_combo_button_construct): Likewise.
- (e_combo_button_set_icon): New.
- (e_combo_button_set_label): New.
- (e_combo_button_set_menu): New.
- (impl_clicked): New, overriding the "clicked" method for
- GtkButton.
- (class_init): Install.
- (impl_button_release_event): Removed.
- (class_init): No need to override ::release_event with this
- anymore.
- (impl_released): New, override for the GtkButton::released method.
- (class_init): Install.
-
-2002-01-04 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-charset-picker.c: Added iso-8859-8 (Hebrew; Visual) to the
- list of charsets in the menu. Fixes bug #15655.
-
-2001-12-20 Ettore Perazzoli <ettore@ximian.com>
-
- * e-combo-button.c: New.
- * e-combo-button.h: New.
-
2001-11-21 Not Zed <NotZed@Ximian.com>
* e-filter-bar.c (menubar_activated): Mark the dialogue as already
diff --git a/widgets/misc/e-canvas-utils.c b/widgets/misc/e-canvas-utils.c
deleted file mode 100644
index 0e7e73d6d0..0000000000
--- a/widgets/misc/e-canvas-utils.c
+++ /dev/null
@@ -1,172 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-canvas-utils.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#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);
-}
-
-static double
-compute_offset(int top, int bottom, int page_top, int page_bottom)
-{
- int size = bottom - top;
- int offset = 0;
-
- if (top <= page_top && bottom >= page_bottom)
- return 0;
-
- if (bottom > page_bottom)
- offset = (bottom - page_bottom);
- if (top < page_top + offset)
- offset = (top - page_top);
-
- if (top <= page_top + offset && bottom >= page_bottom + offset)
- return offset;
-
- if (top < page_top + size * 3 / 2 + offset)
- offset = top - (page_top + size * 3 / 2);
- if (bottom > page_bottom - size * 3 / 2 + offset)
- offset = bottom - (page_bottom - size * 3 / 2);
- if (top < page_top + size * 3 / 2 + offset)
- offset = top - ((page_top + page_bottom - (bottom - top)) / 2);
-
- return offset;
-}
-
-
-static void
-e_canvas_show_area (GnomeCanvas *canvas, double x1, double y1, double x2, double y2)
-{
- GtkAdjustment *h, *v;
- int dx = 0, dy = 0;
-
- g_return_if_fail (canvas != NULL);
- g_return_if_fail (GNOME_IS_CANVAS (canvas));
-
- h = gtk_layout_get_hadjustment(GTK_LAYOUT(canvas));
- dx = compute_offset(x1, x2, h->value, h->value + h->page_size);
- if (dx)
- gtk_adjustment_set_value(h, CLAMP(h->value + dx, h->lower, h->upper - h->page_size));
-
- v = gtk_layout_get_vadjustment(GTK_LAYOUT(canvas));
- dy = compute_offset(y1, y2, v->value, v->value + v->page_size);
- if (dy)
- gtk_adjustment_set_value(v, CLAMP(v->value + dy, v->lower, v->upper - v->page_size));
-}
-
-void
-e_canvas_item_show_area (GnomeCanvasItem *item, double x1, double y1, double x2, double y2)
-{
- g_return_if_fail (item != NULL);
- g_return_if_fail (GNOME_IS_CANVAS_ITEM (item));
-
- gnome_canvas_item_i2w(item, &x1, &y1);
- gnome_canvas_item_i2w(item, &x2, &y2);
-
- e_canvas_show_area(item->canvas, x1, y1, x2, y2);
-}
-
-
-static gboolean
-e_canvas_area_shown (GnomeCanvas *canvas, double x1, double y1, double x2, double y2)
-{
- GtkAdjustment *h, *v;
- int dx = 0, dy = 0;
-
- g_return_val_if_fail (canvas != NULL, FALSE);
- g_return_val_if_fail (GNOME_IS_CANVAS (canvas), FALSE);
-
- h = gtk_layout_get_hadjustment(GTK_LAYOUT(canvas));
- dx = compute_offset(x1, x2, h->value, h->value + h->page_size);
- if (CLAMP(h->value + dx, h->lower, h->upper - h->page_size) - h->value != 0)
- return FALSE;
-
- v = gtk_layout_get_vadjustment(GTK_LAYOUT(canvas));
- dy = compute_offset(y1, y2, v->value, v->value + v->page_size);
- if (CLAMP(v->value + dy, v->lower, v->upper - v->page_size) - v->value != 0)
- return FALSE;
- return TRUE;
-}
-
-gboolean
-e_canvas_item_area_shown (GnomeCanvasItem *item, double x1, double y1, double x2, double y2)
-{
- g_return_val_if_fail (item != NULL, FALSE);
- g_return_val_if_fail (GNOME_IS_CANVAS_ITEM (item), FALSE);
-
- gnome_canvas_item_i2w(item, &x1, &y1);
- gnome_canvas_item_i2w(item, &x2, &y2);
-
- return e_canvas_area_shown(item->canvas, x1, y1, x2, y2);
-}
-
-typedef struct {
- double x1;
- double y1;
- double x2;
- double y2;
- GnomeCanvas *canvas;
-} DoubsAndCanvas;
-
-static gboolean
-show_area_timeout (gpointer data)
-{
- DoubsAndCanvas *dac = data;
-
- if (!GTK_OBJECT_DESTROYED(dac->canvas))
- e_canvas_show_area(dac->canvas, dac->x1, dac->y1, dac->x2, dac->y2);
- gtk_object_unref(GTK_OBJECT(dac->canvas));
- g_free(dac);
- return FALSE;
-}
-
-void
-e_canvas_item_show_area_delayed (GnomeCanvasItem *item, double x1, double y1, double x2, double y2, gint delay)
-{
- DoubsAndCanvas *dac;
-
- g_return_if_fail (item != NULL);
- g_return_if_fail (GNOME_IS_CANVAS_ITEM (item));
-
- gnome_canvas_item_i2w(item, &x1, &y1);
- gnome_canvas_item_i2w(item, &x2, &y2);
-
- dac = g_new(DoubsAndCanvas, 1);
- dac->x1 = x1;
- dac->y1 = y1;
- dac->x2 = x2;
- dac->y2 = y2;
- dac->canvas = item->canvas;
- gtk_object_ref(GTK_OBJECT(item->canvas));
- g_timeout_add(delay, show_area_timeout, dac);
-}
diff --git a/widgets/misc/e-canvas-utils.h b/widgets/misc/e-canvas-utils.h
deleted file mode 100644
index ad8422772c..0000000000
--- a/widgets/misc/e-canvas-utils.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-canvas-utils.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef __E_CANVAS_UTILS__
-#define __E_CANVAS_UTILS__
-
-#include <libgnomeui/gnome-canvas.h>
-#include <libgnome/gnome-defs.h>
-
-BEGIN_GNOME_DECLS
-
-void e_canvas_item_move_absolute (GnomeCanvasItem *item,
- double dx,
- double dy);
-void e_canvas_item_show_area (GnomeCanvasItem *item,
- double x1,
- double y1,
- double x2,
- double y2);
-void e_canvas_item_show_area_delayed (GnomeCanvasItem *item,
- double x1,
- double y1,
- double x2,
- double y2,
- gint delay);
-/* Returns TRUE if the area is already shown on the screen (including
- spacing.) This is equivelent to returning FALSE iff show_area
- would do anything. */
-gboolean e_canvas_item_area_shown (GnomeCanvasItem *item,
- double x1,
- double y1,
- double x2,
- double y2);
-
-END_GNOME_DECLS
-
-#endif /* __E_CANVAS_UTILS__ */
diff --git a/widgets/misc/e-canvas-vbox.c b/widgets/misc/e-canvas-vbox.c
deleted file mode 100644
index e3ca3ce5d1..0000000000
--- a/widgets/misc/e-canvas-vbox.c
+++ /dev/null
@@ -1,376 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-canvas-vbox.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <math.h>
-#include <gdk/gdkkeysyms.h>
-#include <gtk/gtksignal.h>
-#include "e-canvas-vbox.h"
-#include "e-canvas-utils.h"
-#include "e-canvas.h"
-#include "gal/util/e-util.h"
-
-static void e_canvas_vbox_init (ECanvasVbox *CanvasVbox);
-static void e_canvas_vbox_class_init (ECanvasVboxClass *klass);
-static void e_canvas_vbox_set_arg (GtkObject *o, GtkArg *arg, guint arg_id);
-static void e_canvas_vbox_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
-static void e_canvas_vbox_destroy (GtkObject *object);
-
-static gint e_canvas_vbox_event (GnomeCanvasItem *item, GdkEvent *event);
-static void e_canvas_vbox_realize (GnomeCanvasItem *item);
-
-static void e_canvas_vbox_reflow (GnomeCanvasItem *item, int flags);
-
-static void e_canvas_vbox_real_add_item(ECanvasVbox *e_canvas_vbox, GnomeCanvasItem *item);
-static void e_canvas_vbox_real_add_item_start(ECanvasVbox *e_canvas_vbox, GnomeCanvasItem *item);
-static void e_canvas_vbox_resize_children (GnomeCanvasItem *item);
-
-static GnomeCanvasGroupClass *parent_class = NULL;
-
-/* The arguments we take */
-enum {
- ARG_0,
- ARG_WIDTH,
- ARG_MINIMUM_WIDTH,
- ARG_HEIGHT,
- ARG_SPACING,
-};
-
-GtkType
-e_canvas_vbox_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type)
- {
- static const GtkTypeInfo info =
- {
- "ECanvasVbox",
- sizeof (ECanvasVbox),
- sizeof (ECanvasVboxClass),
- (GtkClassInitFunc) e_canvas_vbox_class_init,
- (GtkObjectInitFunc) e_canvas_vbox_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- type = gtk_type_unique (gnome_canvas_group_get_type (), &info);
- }
-
- return type;
-}
-
-static void
-e_canvas_vbox_class_init (ECanvasVboxClass *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 ());
-
- gtk_object_add_arg_type ("ECanvasVbox::width", GTK_TYPE_DOUBLE,
- GTK_ARG_READWRITE, ARG_WIDTH);
- gtk_object_add_arg_type ("ECanvasVbox::minimum_width", GTK_TYPE_DOUBLE,
- GTK_ARG_READWRITE, ARG_MINIMUM_WIDTH);
- gtk_object_add_arg_type ("ECanvasVbox::height", GTK_TYPE_DOUBLE,
- GTK_ARG_READABLE, ARG_HEIGHT);
- gtk_object_add_arg_type ("ECanvasVbox::spacing", GTK_TYPE_DOUBLE,
- GTK_ARG_READWRITE, ARG_SPACING);
-
- klass->add_item = e_canvas_vbox_real_add_item;
- klass->add_item_start = e_canvas_vbox_real_add_item_start;
-
- object_class->set_arg = e_canvas_vbox_set_arg;
- object_class->get_arg = e_canvas_vbox_get_arg;
- object_class->destroy = e_canvas_vbox_destroy;
-
- /* GnomeCanvasItem method overrides */
- item_class->event = e_canvas_vbox_event;
- item_class->realize = e_canvas_vbox_realize;
-}
-
-static void
-e_canvas_vbox_init (ECanvasVbox *vbox)
-{
- vbox->items = NULL;
-
- vbox->width = 10;
- vbox->minimum_width = 10;
- vbox->height = 10;
- vbox->spacing = 0;
-
- e_canvas_item_set_reflow_callback(GNOME_CANVAS_ITEM(vbox), e_canvas_vbox_reflow);
-}
-
-static void
-e_canvas_vbox_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- GnomeCanvasItem *item;
- ECanvasVbox *e_canvas_vbox;
-
- item = GNOME_CANVAS_ITEM (o);
- e_canvas_vbox = E_CANVAS_VBOX (o);
-
- switch (arg_id){
- case ARG_WIDTH:
- case ARG_MINIMUM_WIDTH:
- e_canvas_vbox->minimum_width = GTK_VALUE_DOUBLE (*arg);
- e_canvas_vbox_resize_children(item);
- e_canvas_item_request_reflow(item);
- break;
- case ARG_SPACING:
- e_canvas_vbox->spacing = GTK_VALUE_DOUBLE (*arg);
- e_canvas_item_request_reflow(item);
- break;
- }
-}
-
-static void
-e_canvas_vbox_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- ECanvasVbox *e_canvas_vbox;
-
- e_canvas_vbox = E_CANVAS_VBOX (object);
-
- switch (arg_id) {
- case ARG_WIDTH:
- GTK_VALUE_DOUBLE (*arg) = e_canvas_vbox->width;
- break;
- case ARG_MINIMUM_WIDTH:
- GTK_VALUE_DOUBLE (*arg) = e_canvas_vbox->minimum_width;
- break;
- case ARG_HEIGHT:
- GTK_VALUE_DOUBLE (*arg) = e_canvas_vbox->height;
- break;
- case ARG_SPACING:
- GTK_VALUE_DOUBLE (*arg) = e_canvas_vbox->spacing;
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-/* Used from g_list_foreach(); disconnects from an item's signals */
-static void
-disconnect_item_cb (gpointer data, gpointer user_data)
-{
- ECanvasVbox *vbox;
- GnomeCanvasItem *item;
-
- vbox = E_CANVAS_VBOX (user_data);
-
- item = GNOME_CANVAS_ITEM (data);
- gtk_signal_disconnect_by_data (GTK_OBJECT (item), vbox);
-}
-
-static void
-e_canvas_vbox_destroy (GtkObject *object)
-{
- ECanvasVbox *vbox = E_CANVAS_VBOX(object);
-
- g_list_foreach(vbox->items, disconnect_item_cb, vbox);
- g_list_free(vbox->items);
- vbox->items = NULL;
-
- GTK_OBJECT_CLASS(parent_class)->destroy (object);
-}
-
-static gint
-e_canvas_vbox_event (GnomeCanvasItem *item, GdkEvent *event)
-{
- gint return_val = TRUE;
-
- switch (event->type) {
- case GDK_KEY_PRESS:
- switch (event->key.keyval) {
- case GDK_Left:
- case GDK_KP_Left:
- case GDK_Right:
- case GDK_KP_Right:
- case GDK_Down:
- case GDK_KP_Down:
- case GDK_Up:
- case GDK_KP_Up:
- case GDK_Return:
- case GDK_KP_Enter:
- return_val = TRUE;
- break;
- default:
- return_val = FALSE;
- break;
- }
- break;
- default:
- return_val = FALSE;
- break;
- }
- if (!return_val) {
- if (GNOME_CANVAS_ITEM_CLASS(parent_class)->event)
- return GNOME_CANVAS_ITEM_CLASS (parent_class)->event (item, event);
- }
- return return_val;
-
-}
-
-static void
-e_canvas_vbox_realize (GnomeCanvasItem *item)
-{
- if (GNOME_CANVAS_ITEM_CLASS(parent_class)->realize)
- (* GNOME_CANVAS_ITEM_CLASS(parent_class)->realize) (item);
-
- e_canvas_vbox_resize_children(item);
- e_canvas_item_request_reflow(item);
-}
-
-static void
-e_canvas_vbox_remove_item (GnomeCanvasItem *item, ECanvasVbox *vbox)
-{
- if (!GTK_OBJECT_DESTROYED (vbox))
- vbox->items = g_list_remove(vbox->items, item);
-}
-
-static void
-e_canvas_vbox_real_add_item(ECanvasVbox *e_canvas_vbox, GnomeCanvasItem *item)
-{
- e_canvas_vbox->items = g_list_append(e_canvas_vbox->items, item);
- gtk_signal_connect(GTK_OBJECT(item), "destroy",
- GTK_SIGNAL_FUNC(e_canvas_vbox_remove_item), e_canvas_vbox);
- if ( GTK_OBJECT_FLAGS( e_canvas_vbox ) & GNOME_CANVAS_ITEM_REALIZED ) {
- gnome_canvas_item_set(item,
- "width", (double) e_canvas_vbox->minimum_width,
- NULL);
- e_canvas_item_request_reflow(item);
- }
-}
-
-
-static void
-e_canvas_vbox_real_add_item_start(ECanvasVbox *e_canvas_vbox, GnomeCanvasItem *item)
-{
- e_canvas_vbox->items = g_list_prepend(e_canvas_vbox->items, item);
- gtk_signal_connect(GTK_OBJECT(item), "destroy",
- GTK_SIGNAL_FUNC(e_canvas_vbox_remove_item), e_canvas_vbox);
- if ( GTK_OBJECT_FLAGS( e_canvas_vbox ) & GNOME_CANVAS_ITEM_REALIZED ) {
- gnome_canvas_item_set(item,
- "width", (double) e_canvas_vbox->minimum_width,
- NULL);
- e_canvas_item_request_reflow(item);
- }
-}
-
-static void
-e_canvas_vbox_resize_children (GnomeCanvasItem *item)
-{
- GList *list;
- ECanvasVbox *e_canvas_vbox;
-
- e_canvas_vbox = E_CANVAS_VBOX (item);
- for ( list = e_canvas_vbox->items; list; list = list->next ) {
- GnomeCanvasItem *child = GNOME_CANVAS_ITEM(list->data);
- gnome_canvas_item_set(child,
- "width", (double) e_canvas_vbox->minimum_width,
- NULL);
- }
-}
-
-static void
-e_canvas_vbox_reflow( GnomeCanvasItem *item, int flags )
-{
- ECanvasVbox *e_canvas_vbox = E_CANVAS_VBOX(item);
- if ( GTK_OBJECT_FLAGS( e_canvas_vbox ) & GNOME_CANVAS_ITEM_REALIZED ) {
-
- gdouble old_height;
- gdouble running_height;
- gdouble old_width;
- gdouble max_width;
-
- old_width = e_canvas_vbox->width;
- max_width = e_canvas_vbox->minimum_width;
-
- old_height = e_canvas_vbox->height;
- running_height = 0;
-
- if (e_canvas_vbox->items == NULL) {
- } else {
- GList *list;
- gdouble item_height;
- gdouble item_width;
-
- list = e_canvas_vbox->items;
- gtk_object_get (GTK_OBJECT(list->data),
- "height", &item_height,
- "width", &item_width,
- NULL);
- e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(list->data),
- (double) 0,
- (double) running_height);
- running_height += item_height;
- if (max_width < item_width)
- max_width = item_width;
- list = g_list_next(list);
-
- for( ; list; list = g_list_next(list)) {
- running_height += e_canvas_vbox->spacing;
-
- gtk_object_get (GTK_OBJECT(list->data),
- "height", &item_height,
- "width", &item_width,
- NULL);
-
- e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(list->data),
- (double) 0,
- (double) running_height);
-
- running_height += item_height;
- if (max_width < item_width)
- max_width = item_width;
- }
-
- }
- e_canvas_vbox->height = running_height;
- e_canvas_vbox->width = max_width;
- if (old_height != e_canvas_vbox->height ||
- old_width != e_canvas_vbox->width)
- e_canvas_item_request_parent_reflow(item);
- }
-}
-
-void
-e_canvas_vbox_add_item(ECanvasVbox *e_canvas_vbox, GnomeCanvasItem *item)
-{
- if (E_CANVAS_VBOX_CLASS(GTK_OBJECT(e_canvas_vbox)->klass)->add_item)
- (E_CANVAS_VBOX_CLASS(GTK_OBJECT(e_canvas_vbox)->klass)->add_item) (e_canvas_vbox, item);
-}
-
-void
-e_canvas_vbox_add_item_start(ECanvasVbox *e_canvas_vbox, GnomeCanvasItem *item)
-{
- if (E_CANVAS_VBOX_CLASS(GTK_OBJECT(e_canvas_vbox)->klass)->add_item_start)
- (E_CANVAS_VBOX_CLASS(GTK_OBJECT(e_canvas_vbox)->klass)->add_item_start) (e_canvas_vbox, item);
-}
-
diff --git a/widgets/misc/e-canvas-vbox.h b/widgets/misc/e-canvas-vbox.h
deleted file mode 100644
index 48ba2ade52..0000000000
--- a/widgets/misc/e-canvas-vbox.h
+++ /dev/null
@@ -1,93 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-canvas-vbox.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef __E_CANVAS_VBOX_H__
-#define __E_CANVAS_VBOX_H__
-
-#include <gtk/gtktypeutils.h>
-#include <libgnomeui/gnome-canvas.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-/* ECanvasVbox - A canvas item container.
- *
- * The following arguments are available:
- *
- * name type read/write description
- * --------------------------------------------------------------------------------
- * width double RW width of the CanvasVbox
- * height double R height of the CanvasVbox
- * spacing double RW Spacing between items.
- */
-
-#define E_CANVAS_VBOX_TYPE (e_canvas_vbox_get_type ())
-#define E_CANVAS_VBOX(obj) (GTK_CHECK_CAST ((obj), E_CANVAS_VBOX_TYPE, ECanvasVbox))
-#define E_CANVAS_VBOX_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_CANVAS_VBOX_TYPE, ECanvasVboxClass))
-#define E_IS_CANVAS_VBOX(obj) (GTK_CHECK_TYPE ((obj), E_CANVAS_VBOX_TYPE))
-#define E_IS_CANVAS_VBOX_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_CANVAS_VBOX_TYPE))
-
-
-typedef struct _ECanvasVbox ECanvasVbox;
-typedef struct _ECanvasVboxClass ECanvasVboxClass;
-
-struct _ECanvasVbox
-{
- GnomeCanvasGroup parent;
-
- /* item specific fields */
- GList *items; /* Of type GnomeCanvasItem */
-
- double width;
- double minimum_width;
- double height;
- double spacing;
-};
-
-struct _ECanvasVboxClass
-{
- GnomeCanvasGroupClass parent_class;
-
- /* Virtual methods. */
- void (* add_item) (ECanvasVbox *CanvasVbox, GnomeCanvasItem *item);
- void (* add_item_start) (ECanvasVbox *CanvasVbox, GnomeCanvasItem *item);
-};
-
-/*
- * To be added to a CanvasVbox, an item must have the argument "width" as
- * a Read/Write argument and "height" as a Read Only argument. It
- * should also do an ECanvas parent CanvasVbox request if its size
- * changes.
- */
-void e_canvas_vbox_add_item(ECanvasVbox *e_canvas_vbox, GnomeCanvasItem *item);
-void e_canvas_vbox_add_item_start(ECanvasVbox *e_canvas_vbox, GnomeCanvasItem *item);
-GtkType e_canvas_vbox_get_type (void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __E_CANVAS_VBOX_H__ */
diff --git a/widgets/misc/e-canvas.c b/widgets/misc/e-canvas.c
deleted file mode 100644
index 594591f011..0000000000
--- a/widgets/misc/e-canvas.c
+++ /dev/null
@@ -1,1083 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-canvas.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <gtk/gtksignal.h>
-#include "e-canvas.h"
-#include "gal/util/e-util.h"
-
-static void e_canvas_init (ECanvas *card);
-static void e_canvas_destroy (GtkObject *object);
-static void e_canvas_class_init (ECanvasClass *klass);
-static void e_canvas_realize (GtkWidget *widget);
-static void e_canvas_unrealize (GtkWidget *widget);
-static gint e_canvas_key (GtkWidget *widget,
- GdkEventKey *event);
-static gint e_canvas_button (GtkWidget *widget,
- GdkEventButton *event);
-
-static gint e_canvas_visibility (GtkWidget *widget,
- GdkEventVisibility *event,
- ECanvas *canvas);
-
-static gint e_canvas_focus_in (GtkWidget *widget,
- GdkEventFocus *event);
-static gint e_canvas_focus_out (GtkWidget *widget,
- GdkEventFocus *event);
-
-static void e_canvas_style_set (GtkWidget *widget,
- GtkStyle *previous_style);
-
-static int emit_event (GnomeCanvas *canvas, GdkEvent *event);
-
-static GnomeCanvasClass *parent_class = NULL;
-
-#define d(x)
-
-enum {
- REFLOW,
- LAST_SIGNAL
-};
-
-static guint e_canvas_signals [LAST_SIGNAL] = { 0, };
-
-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 ());
-
- object_class->destroy = e_canvas_destroy;
-
- widget_class->key_press_event = e_canvas_key;
- widget_class->key_release_event = e_canvas_key;
- widget_class->button_press_event = e_canvas_button;
- widget_class->button_release_event = e_canvas_button;
- widget_class->focus_in_event = e_canvas_focus_in;
- widget_class->focus_out_event = e_canvas_focus_out;
- widget_class->style_set = e_canvas_style_set;
- widget_class->realize = e_canvas_realize;
- widget_class->unrealize = e_canvas_unrealize;
-
- klass->reflow = NULL;
-
- e_canvas_signals [REFLOW] =
- gtk_signal_new ("reflow",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ECanvasClass, reflow),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- E_OBJECT_CLASS_ADD_SIGNALS (object_class, e_canvas_signals, LAST_SIGNAL);
-}
-
-static void
-e_canvas_init (ECanvas *canvas)
-{
- canvas->selection = NULL;
- canvas->cursor = NULL;
- canvas->ic = NULL;
- canvas->ic_attr = NULL;
- canvas->tooltip_window = NULL;
-}
-
-static void
-e_canvas_destroy (GtkObject *object)
-{
- ECanvas *canvas = E_CANVAS(object);
-
- if (canvas->idle_id)
- g_source_remove(canvas->idle_id);
- canvas->idle_id = 0;
-
- if (canvas->toplevel) {
- if (canvas->visibility_notify_id)
- gtk_signal_disconnect (GTK_OBJECT(canvas->toplevel),
- canvas->visibility_notify_id);
- canvas->visibility_notify_id = 0;
-
- gtk_object_unref(GTK_OBJECT(canvas->toplevel));
- canvas->toplevel = NULL;
- }
-
- e_canvas_hide_tooltip(canvas);
-
- if ((GTK_OBJECT_CLASS (parent_class))->destroy)
- (*(GTK_OBJECT_CLASS (parent_class))->destroy) (object);
-}
-
-GtkWidget *
-e_canvas_new ()
-{
- return GTK_WIDGET (gtk_type_new (e_canvas_get_type ()));
-}
-
-
-/* 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;
-
- /* 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;
-
- if (canvas->grabbed_item)
- item = canvas->grabbed_item;
-
- /* Perform checks for grabbed items */
-
- 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;
- }
-
- /* 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;
- GdkEvent full_event;
-
- 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);
-
- full_event.key = *event;
-
- return emit_event (canvas, &full_event);
-}
-
-
-/* This routine invokes the point method of the item. The argument x, y should
- * be in the parent's item-relative coordinate system. This routine applies the
- * inverse of the item's transform, maintaining the affine invariant.
- */
-#define HACKISH_AFFINE
-
-static double
-gnome_canvas_item_invoke_point (GnomeCanvasItem *item, double x, double y, int cx, int cy,
- GnomeCanvasItem **actual_item)
-{
-#ifdef HACKISH_AFFINE
- double i2w[6], w2c[6], i2c[6], c2i[6];
- ArtPoint c, i;
-#endif
-
-#ifdef HACKISH_AFFINE
- gnome_canvas_item_i2w_affine (item, i2w);
- gnome_canvas_w2c_affine (item->canvas, w2c);
- art_affine_multiply (i2c, i2w, w2c);
- art_affine_invert (c2i, i2c);
- c.x = cx;
- c.y = cy;
- art_affine_point (&i, &c, c2i);
- x = i.x;
- y = i.y;
-#endif
-
- return (* GNOME_CANVAS_ITEM_CLASS (item->object.klass)->point) (
- item, x, y, cx, cy, actual_item);
-}
-
-/* Re-picks the current item in the canvas, based on the event's coordinates.
- * Also emits enter/leave events for items as appropriate.
- */
-#define DISPLAY_X1(canvas) (GNOME_CANVAS (canvas)->layout.xoffset)
-#define DISPLAY_Y1(canvas) (GNOME_CANVAS (canvas)->layout.yoffset)
-static int
-pick_current_item (GnomeCanvas *canvas, GdkEvent *event)
-{
- int button_down;
- double x, y;
- int cx, cy;
- int retval;
-
- retval = FALSE;
-
- /* If a button is down, we'll perform enter and leave events on the
- * current item, but not enter on any other item. This is more or less
- * like X pointer grabbing for canvas items.
- */
- button_down = canvas->state & (GDK_BUTTON1_MASK
- | GDK_BUTTON2_MASK
- | GDK_BUTTON3_MASK
- | GDK_BUTTON4_MASK
- | GDK_BUTTON5_MASK);
- d(g_print ("%s:%d: button_down = %s\n", __FUNCTION__, __LINE__, button_down ? "TRUE" : "FALSE"));
- if (!button_down)
- canvas->left_grabbed_item = FALSE;
-
- /* Save the event in the canvas. This is used to synthesize enter and
- * leave events in case the current item changes. It is also used to
- * re-pick the current item if the current one gets deleted. Also,
- * synthesize an enter event.
- */
- if (event != &canvas->pick_event) {
- if ((event->type == GDK_MOTION_NOTIFY) || (event->type == GDK_BUTTON_RELEASE)) {
- /* these fields have the same offsets in both types of events */
-
- canvas->pick_event.crossing.type = GDK_ENTER_NOTIFY;
- canvas->pick_event.crossing.window = event->motion.window;
- canvas->pick_event.crossing.send_event = event->motion.send_event;
- canvas->pick_event.crossing.subwindow = NULL;
- canvas->pick_event.crossing.x = event->motion.x;
- canvas->pick_event.crossing.y = event->motion.y;
- canvas->pick_event.crossing.mode = GDK_CROSSING_NORMAL;
- canvas->pick_event.crossing.detail = GDK_NOTIFY_NONLINEAR;
- canvas->pick_event.crossing.focus = FALSE;
- canvas->pick_event.crossing.state = event->motion.state;
-
- /* these fields don't have the same offsets in both types of events */
-
- if (event->type == GDK_MOTION_NOTIFY) {
- canvas->pick_event.crossing.x_root = event->motion.x_root;
- canvas->pick_event.crossing.y_root = event->motion.y_root;
- } else {
- canvas->pick_event.crossing.x_root = event->button.x_root;
- canvas->pick_event.crossing.y_root = event->button.y_root;
- }
- } else
- canvas->pick_event = *event;
- }
-
- /* Don't do anything else if this is a recursive call */
-
- if (canvas->in_repick)
- return retval;
-
- /* LeaveNotify means that there is no current item, so we don't look for one */
-
- if (canvas->pick_event.type != GDK_LEAVE_NOTIFY) {
- /* these fields don't have the same offsets in both types of events */
-
- if (canvas->pick_event.type == GDK_ENTER_NOTIFY) {
- x = canvas->pick_event.crossing.x + DISPLAY_X1 (canvas) - canvas->zoom_xofs;
- y = canvas->pick_event.crossing.y + DISPLAY_Y1 (canvas) - canvas->zoom_yofs;
- } else {
- x = canvas->pick_event.motion.x + DISPLAY_X1 (canvas) - canvas->zoom_xofs;
- y = canvas->pick_event.motion.y + DISPLAY_Y1 (canvas) - canvas->zoom_yofs;
- }
-
- /* canvas pixel coords */
-
- cx = (int) (x + 0.5);
- cy = (int) (y + 0.5);
-
- /* world coords */
-
- x = canvas->scroll_x1 + x / canvas->pixels_per_unit;
- y = canvas->scroll_y1 + y / canvas->pixels_per_unit;
-
- /* find the closest item */
-
- if (canvas->root->object.flags & GNOME_CANVAS_ITEM_VISIBLE)
- gnome_canvas_item_invoke_point (canvas->root, x, y, cx, cy,
- &canvas->new_current_item);
- else
- canvas->new_current_item = NULL;
- } else
- canvas->new_current_item = NULL;
-
- if ((canvas->new_current_item == canvas->current_item) && !canvas->left_grabbed_item)
- return retval; /* current item did not change */
-
- /* Synthesize events for old and new current items */
-
- if ((canvas->new_current_item != canvas->current_item)
- && (canvas->current_item != NULL)
- && !canvas->left_grabbed_item) {
- GdkEvent new_event;
- GnomeCanvasItem *item;
-
- item = canvas->current_item;
-
- new_event = canvas->pick_event;
- new_event.type = GDK_LEAVE_NOTIFY;
-
- new_event.crossing.detail = GDK_NOTIFY_ANCESTOR;
- new_event.crossing.subwindow = NULL;
- canvas->in_repick = TRUE;
- retval = emit_event (canvas, &new_event);
- canvas->in_repick = FALSE;
- }
-
- /* new_current_item may have been set to NULL during the call to emit_event() above */
-
- if ((canvas->new_current_item != canvas->current_item) && button_down) {
- canvas->left_grabbed_item = TRUE;
- return retval;
- }
-
- /* Handle the rest of cases */
-
- canvas->left_grabbed_item = FALSE;
- canvas->current_item = canvas->new_current_item;
-
- if (canvas->current_item != NULL) {
- GdkEvent new_event;
-
- new_event = canvas->pick_event;
- new_event.type = GDK_ENTER_NOTIFY;
- new_event.crossing.detail = GDK_NOTIFY_ANCESTOR;
- new_event.crossing.subwindow = NULL;
- retval = emit_event (canvas, &new_event);
- }
-
- return retval;
-}
-
-/* Button event handler for the canvas */
-static gint
-e_canvas_button (GtkWidget *widget, GdkEventButton *event)
-{
- GnomeCanvas *canvas;
- int mask;
- int retval;
-
- 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);
-
- retval = FALSE;
-
- canvas = GNOME_CANVAS (widget);
-
- d(g_print ("button %d, event type %d, grabbed=%p, current=%p\n",
- event->button,
- event->type,
- canvas->grabbed_item,
- canvas->current_item));
-
- /* dispatch normally regardless of the event's window if an item has
- has a pointer grab in effect */
- if (!canvas->grabbed_item && event->window != canvas->layout.bin_window)
- return retval;
-
- switch (event->button) {
- case 1:
- mask = GDK_BUTTON1_MASK;
- break;
- case 2:
- mask = GDK_BUTTON2_MASK;
- break;
- case 3:
- mask = GDK_BUTTON3_MASK;
- break;
- case 4:
- mask = GDK_BUTTON4_MASK;
- break;
- case 5:
- mask = GDK_BUTTON5_MASK;
- break;
- default:
- mask = 0;
- }
-
- switch (event->type) {
- case GDK_BUTTON_PRESS:
- case GDK_2BUTTON_PRESS:
- case GDK_3BUTTON_PRESS:
- /* Pick the current item as if the button were not pressed, and
- * then process the event.
- */
- canvas->state = event->state;
- pick_current_item (canvas, (GdkEvent *) event);
- canvas->state ^= mask;
- retval = emit_event (canvas, (GdkEvent *) event);
- break;
-
- case GDK_BUTTON_RELEASE:
- /* Process the event as if the button were pressed, then repick
- * after the button has been released
- */
- canvas->state = event->state;
- retval = emit_event (canvas, (GdkEvent *) event);
- event->state ^= mask;
- canvas->state = event->state;
- pick_current_item (canvas, (GdkEvent *) event);
- event->state ^= mask;
- break;
-
- default:
- g_assert_not_reached ();
- }
-
- return retval;
-}
-
-/* Key event handler for the canvas */
-static gint
-e_canvas_visibility (GtkWidget *widget, GdkEventVisibility *event, ECanvas *canvas)
-{
- if (! canvas->visibility_first) {
- e_canvas_hide_tooltip(canvas);
- }
- canvas->visibility_first = FALSE;
-
- return FALSE;
-}
-
-
-/**
- * e_canvas_item_grab_focus:
- * @item: A canvas item.
- * @widget_too: Whether or not to grab the widget-level focus too
- *
- * 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 and @widget_too is %TRUE, it grabs that focus as well.
- **/
-void
-e_canvas_item_grab_focus (GnomeCanvasItem *item, gboolean widget_too)
-{
- 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;
-
- if (widget_too && !GTK_WIDGET_HAS_FOCUS (GTK_WIDGET(item->canvas))) {
- gtk_widget_grab_focus (GTK_WIDGET (item->canvas));
- }
-
- if (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 = TRUE;
-
- emit_event (item->canvas, &ev);
- }
-}
-
-/* Focus in handler for the canvas */
-static gint
-e_canvas_focus_in (GtkWidget *widget, GdkEventFocus *event)
-{
- GnomeCanvas *canvas;
- ECanvas *ecanvas;
- GdkEvent full_event;
-
- canvas = GNOME_CANVAS (widget);
- ecanvas = E_CANVAS (widget);
-
- GTK_WIDGET_SET_FLAGS (widget, GTK_HAS_FOCUS);
-
- if (ecanvas->ic)
- gdk_im_begin (ecanvas->ic, canvas->layout.bin_window);
-
- if (canvas->focused_item) {
- full_event.focus_change = *event;
- return emit_event (canvas, &full_event);
- } else {
- return FALSE;
- }
-}
-
-/* Focus out handler for the canvas */
-static gint
-e_canvas_focus_out (GtkWidget *widget, GdkEventFocus *event)
-{
- GnomeCanvas *canvas;
- ECanvas *ecanvas;
- GdkEvent full_event;
-
- canvas = GNOME_CANVAS (widget);
- ecanvas = E_CANVAS (widget);
-
- GTK_WIDGET_UNSET_FLAGS (widget, GTK_HAS_FOCUS);
-
- if (ecanvas->ic)
- gdk_im_end ();
-
- if (canvas->focused_item) {
- full_event.focus_change = *event;
- return emit_event (canvas, &full_event);
- } else {
- return FALSE;
- }
-}
-
-static void
-ec_style_set_recursive (GnomeCanvasItem *item, GtkStyle *previous_style)
-{
- guint signal_id = gtk_signal_lookup ("style_set", GTK_OBJECT_TYPE (item));
- if (signal_id >= 1) {
- GtkSignalQuery *query = gtk_signal_query (signal_id);
- if (query->return_val == GTK_TYPE_NONE && query->nparams == 1 && query->params[0] == GTK_TYPE_STYLE) {
- gtk_signal_emit (GTK_OBJECT (item), signal_id, previous_style);
- }
- g_free (query);
- }
-
- if (GNOME_IS_CANVAS_GROUP (item) ) {
- GList *items = GNOME_CANVAS_GROUP (item)->item_list;
- for (; items; items = items->next)
- ec_style_set_recursive (items->data, previous_style);
- }
-}
-
-static void
-e_canvas_style_set (GtkWidget *widget, GtkStyle *previous_style)
-{
- ec_style_set_recursive (GNOME_CANVAS_ITEM (gnome_canvas_root (GNOME_CANVAS (widget))), previous_style);
-}
-
-
-static void
-e_canvas_realize (GtkWidget *widget)
-{
- gint width, height;
- ECanvas *ecanvas = E_CANVAS (widget);
-
- if (GTK_WIDGET_CLASS (parent_class)->realize)
- (* GTK_WIDGET_CLASS (parent_class)->realize) (widget);
-
- gdk_window_set_back_pixmap (GTK_LAYOUT (widget)->bin_window, NULL, FALSE);
-
- if (gdk_im_ready () && (ecanvas->ic_attr = gdk_ic_attr_new ()) != NULL) {
- GdkEventMask mask;
- GdkICAttr *attr = ecanvas->ic_attr;
- GdkICAttributesType attrmask = GDK_IC_ALL_REQ;
- GdkIMStyle style;
- GdkIMStyle supported_style = GDK_IM_PREEDIT_NONE |
- GDK_IM_PREEDIT_NOTHING |
- GDK_IM_PREEDIT_POSITION |
- GDK_IM_STATUS_NONE |
- GDK_IM_STATUS_NOTHING;
-
- if(widget->style && widget->style->font->type != GDK_FONT_FONTSET)
- supported_style &= ~GDK_IM_PREEDIT_POSITION;
-
- attr->style = style = gdk_im_decide_style (supported_style);
- attr->client_window = ecanvas->parent.layout.bin_window;
-
- switch (style & GDK_IM_PREEDIT_MASK)
- {
- case GDK_IM_PREEDIT_POSITION:
- if (widget->style && widget->style->font->type != GDK_FONT_FONTSET)
- {
- g_warning ("over-the-spot style requires fontset");
- break;
- }
-
- gdk_window_get_size (attr->client_window, &width, &height);
- height = widget->style->font->ascent +
- widget->style->font->descent;
-
- attrmask |= GDK_IC_PREEDIT_POSITION_REQ;
- attr->spot_location.x = 0;
- attr->spot_location.y = height;
- attr->preedit_area.x = 0;
- attr->preedit_area.y = 0;
- attr->preedit_area.width = width;
- attr->preedit_area.height = height;
- attr->preedit_fontset = widget->style->font;
-
- break;
- }
-
- ecanvas->ic = gdk_ic_new (attr, attrmask);
- if (ecanvas->ic != NULL) {
- mask = gdk_window_get_events (attr->client_window);
- mask |= gdk_ic_get_events (ecanvas->ic);
- gdk_window_set_events (attr->client_window, mask);
-
- if (GTK_WIDGET_HAS_FOCUS (widget))
- gdk_im_begin (ecanvas->ic, attr->client_window);
- } else
- g_warning ("Can't create input context.");
- }
-
-}
-
-static void
-e_canvas_unrealize (GtkWidget *widget)
-{
- ECanvas * ecanvas = E_CANVAS (widget);
-
- if (ecanvas->idle_id)
- g_source_remove(ecanvas->idle_id);
- ecanvas->idle_id = 0;
-
- if (ecanvas->ic) {
- gdk_ic_destroy (ecanvas->ic);
- ecanvas->ic = NULL;
- }
- if (ecanvas->ic_attr) {
- gdk_ic_attr_destroy (ecanvas->ic_attr);
- ecanvas->ic_attr = NULL;
- }
- if (GTK_WIDGET_CLASS (parent_class)->unrealize)
- (* GTK_WIDGET_CLASS (parent_class)->unrealize) (widget);
-}
-
-static void
-e_canvas_item_invoke_reflow (GnomeCanvasItem *item, int flags)
-{
- GnomeCanvasGroup *group;
- GList *list;
- GnomeCanvasItem *child;
-
- if (GNOME_IS_CANVAS_GROUP (item)) {
- group = GNOME_CANVAS_GROUP (item);
- for (list = group->item_list; list; list = list->next) {
- child = GNOME_CANVAS_ITEM (list->data);
- if (child->object.flags & E_CANVAS_ITEM_DESCENDENT_NEEDS_REFLOW)
- e_canvas_item_invoke_reflow (child, flags);
- }
- }
-
- if (item->object.flags & E_CANVAS_ITEM_NEEDS_REFLOW) {
- ECanvasItemReflowFunc func;
- func = gtk_object_get_data (GTK_OBJECT (item),
- "ECanvasItem::reflow_callback");
- if (func)
- func (item, flags);
- }
-
- item->object.flags &= ~E_CANVAS_ITEM_NEEDS_REFLOW;
- item->object.flags &= ~E_CANVAS_ITEM_DESCENDENT_NEEDS_REFLOW;
-}
-
-static void
-do_reflow (ECanvas *canvas)
-{
- if (GNOME_CANVAS(canvas)->root->object.flags & E_CANVAS_ITEM_DESCENDENT_NEEDS_REFLOW)
- e_canvas_item_invoke_reflow (GNOME_CANVAS(canvas)->root, 0);
-}
-
-/* Idle handler for the e-canvas. It deals with pending reflows. */
-static gint
-idle_handler (gpointer data)
-{
- ECanvas *canvas;
-
- GDK_THREADS_ENTER();
-
- canvas = E_CANVAS (data);
- do_reflow (canvas);
-
- /* Reset idle id */
- canvas->idle_id = 0;
-
- gtk_signal_emit (GTK_OBJECT (canvas),
- e_canvas_signals [REFLOW]);
-
- GDK_THREADS_LEAVE();
-
- return FALSE;
-}
-
-/* Convenience function to add an idle handler to a canvas */
-static void
-add_idle (ECanvas *canvas)
-{
- if (canvas->idle_id != 0)
- return;
-
- canvas->idle_id = g_idle_add_full (G_PRIORITY_HIGH_IDLE, idle_handler, (gpointer) canvas, NULL);
-}
-
-static void
-e_canvas_item_descendent_needs_reflow (GnomeCanvasItem *item)
-{
- if (item->object.flags & E_CANVAS_ITEM_DESCENDENT_NEEDS_REFLOW)
- return;
-
- item->object.flags |= E_CANVAS_ITEM_DESCENDENT_NEEDS_REFLOW;
- if (item->parent)
- e_canvas_item_descendent_needs_reflow(item->parent);
-}
-
-void
-e_canvas_item_request_reflow (GnomeCanvasItem *item)
-{
- if (item->object.flags & GNOME_CANVAS_ITEM_REALIZED) {
- item->object.flags |= E_CANVAS_ITEM_NEEDS_REFLOW;
- e_canvas_item_descendent_needs_reflow(item);
- add_idle(E_CANVAS(item->canvas));
- }
-}
-
-void
-e_canvas_item_request_parent_reflow (GnomeCanvasItem *item)
-{
- g_return_if_fail(item != NULL);
- g_return_if_fail(GNOME_IS_CANVAS_ITEM(item));
- e_canvas_item_request_reflow(item->parent);
-}
-
-void
-e_canvas_item_set_reflow_callback (GnomeCanvasItem *item, ECanvasItemReflowFunc func)
-{
- gtk_object_set_data(GTK_OBJECT(item), "ECanvasItem::reflow_callback", (gpointer) func);
-}
-
-
-void
-e_canvas_item_set_selection_callback (GnomeCanvasItem *item, ECanvasItemSelectionFunc func)
-{
- gtk_object_set_data(GTK_OBJECT(item), "ECanvasItem::selection_callback", (gpointer) func);
-}
-
-void
-e_canvas_item_set_selection_compare_callback (GnomeCanvasItem *item, ECanvasItemSelectionCompareFunc func)
-{
- gtk_object_set_data(GTK_OBJECT(item), "ECanvasItem::selection_compare_callback", (gpointer) func);
-}
-
-void
-e_canvas_item_set_cursor (GnomeCanvasItem *item, gpointer id)
-{
- GList *list;
- int flags;
- ECanvas *canvas;
- ECanvasSelectionInfo *info;
- ECanvasItemSelectionFunc func;
-
- g_return_if_fail(item != NULL);
- g_return_if_fail(GNOME_IS_CANVAS_ITEM(item));
- g_return_if_fail(item->canvas != NULL);
- g_return_if_fail(E_IS_CANVAS(item->canvas));
-
- canvas = E_CANVAS(item->canvas);
- flags = E_CANVAS_ITEM_SELECTION_DELETE_DATA;
-
- for (list = canvas->selection; list; list = g_list_next(list)) {
- info = list->data;
-
- func = gtk_object_get_data(GTK_OBJECT(info->item), "ECanvasItem::selection_callback");
- if (func)
- func(info->item, flags, info->id);
- g_message ("ECANVAS: free info (2): item %p, id %p",
- info->item, info->id);
- gtk_object_unref (GTK_OBJECT (info->item));
- g_free(info);
- }
- g_list_free(canvas->selection);
-
- canvas->selection = NULL;
-
- gnome_canvas_item_grab_focus(item);
-
- info = g_new(ECanvasSelectionInfo, 1);
- info->item = item;
- gtk_object_ref (GTK_OBJECT (info->item));
- info->id = id;
- g_message ("ECANVAS: new info item %p, id %p", item, id);
-
- flags = E_CANVAS_ITEM_SELECTION_SELECT | E_CANVAS_ITEM_SELECTION_CURSOR;
- func = gtk_object_get_data(GTK_OBJECT(item), "ECanvasItem::selection_callback");
- if (func)
- func(item, flags, id);
-
- canvas->selection = g_list_prepend(canvas->selection, info);
- canvas->cursor = info;
-}
-
-void
-e_canvas_item_set_cursor_end (GnomeCanvasItem *item, gpointer id)
-{
-}
-
-void
-e_canvas_item_add_selection (GnomeCanvasItem *item, gpointer id)
-{
- int flags;
- ECanvas *canvas;
- ECanvasSelectionInfo *info;
- ECanvasItemSelectionFunc func;
- GList *list;
-
- g_return_if_fail(item != NULL);
- g_return_if_fail(GNOME_IS_CANVAS_ITEM(item));
- g_return_if_fail(item->canvas != NULL);
- g_return_if_fail(E_IS_CANVAS(item->canvas));
-
- flags = E_CANVAS_ITEM_SELECTION_SELECT;
- canvas = E_CANVAS(item->canvas);
-
- if (canvas->cursor) {
- func = gtk_object_get_data(GTK_OBJECT(canvas->cursor->item), "ECanvasItem::selection_callback");
- if (func)
- func(canvas->cursor->item, flags, canvas->cursor->id);
- }
-
- gnome_canvas_item_grab_focus(item);
-
- flags = E_CANVAS_ITEM_SELECTION_SELECT | E_CANVAS_ITEM_SELECTION_CURSOR;
-
- for (list = canvas->selection; list; list = g_list_next(list)) {
- ECanvasSelectionInfo *search;
- search = list->data;
-
- if (search->item == item) {
- ECanvasItemSelectionCompareFunc compare_func;
- compare_func = gtk_object_get_data(GTK_OBJECT(search->item), "ECanvasItem::selection_compare_callback");
-
- if (compare_func(search->item, search->id, id, 0) == 0) {
- canvas->cursor = search;
- func = gtk_object_get_data(GTK_OBJECT(item), "ECanvasItem::selection_callback");
- if (func)
- func(item, flags, search->id);
- return;
- }
- }
- }
-
- info = g_new(ECanvasSelectionInfo, 1);
- info->item = item;
- gtk_object_ref (GTK_OBJECT (info->item));
- info->id = id;
- g_message ("ECANVAS: new info (2): item %p, id %p", item, id);
-
- func = gtk_object_get_data(GTK_OBJECT(item), "ECanvasItem::selection_callback");
- if (func)
- func(item, flags, id);
-
- canvas->selection = g_list_prepend(canvas->selection, info);
- canvas->cursor = info;
-}
-
-void
-e_canvas_item_remove_selection (GnomeCanvasItem *item, gpointer id)
-{
- int flags;
- ECanvas *canvas;
- ECanvasSelectionInfo *info;
- GList *list;
-
- g_return_if_fail(item != NULL);
- g_return_if_fail(GNOME_IS_CANVAS_ITEM(item));
- g_return_if_fail(item->canvas != NULL);
- g_return_if_fail(E_IS_CANVAS(item->canvas));
-
- flags = E_CANVAS_ITEM_SELECTION_DELETE_DATA;
- canvas = E_CANVAS(item->canvas);
-
- for (list = canvas->selection; list; list = g_list_next(list)) {
- info = list->data;
-
- if (info->item == item) {
- ECanvasItemSelectionCompareFunc compare_func;
- compare_func = gtk_object_get_data(GTK_OBJECT(info->item), "ECanvasItem::selection_compare_callback");
-
- if (compare_func(info->item, info->id, id, 0) == 0) {
- ECanvasItemSelectionFunc func;
- func = gtk_object_get_data(GTK_OBJECT(info->item), "ECanvasItem::selection_callback");
- if (func)
- func(info->item, flags, info->id);
- canvas->selection = g_list_remove_link(canvas->selection, list);
-
- if (canvas->cursor == info)
- canvas->cursor = NULL;
-
- g_message ("ECANVAS: removing info: item %p, info %p",
- info->item, info->id);
- gtk_object_unref (GTK_OBJECT (info->item));
- g_free(info);
- g_list_free_1(list);
- break;
- }
- }
- }
-}
-
-void e_canvas_popup_tooltip (ECanvas *canvas, GtkWidget *widget, int x, int y)
-{
- if (canvas->tooltip_window && canvas->tooltip_window != widget) {
- e_canvas_hide_tooltip(canvas);
- }
- canvas->tooltip_window = widget;
- canvas->visibility_first = TRUE;
- if (canvas->toplevel == NULL) {
- canvas->toplevel = gtk_widget_get_toplevel (GTK_WIDGET(canvas));
- if (canvas->toplevel) {
- gtk_widget_add_events(canvas->toplevel, GDK_VISIBILITY_NOTIFY_MASK);
- gtk_object_ref(GTK_OBJECT(canvas->toplevel));
- canvas->visibility_notify_id =
- gtk_signal_connect (GTK_OBJECT (canvas->toplevel), "visibility_notify_event",
- GTK_SIGNAL_FUNC (e_canvas_visibility), canvas);
- }
- }
- gtk_widget_popup (widget, x, y);
-}
-
-void e_canvas_hide_tooltip (ECanvas *canvas)
-{
- if (canvas->tooltip_window) {
- gtk_widget_destroy (canvas->tooltip_window);
- canvas->tooltip_window = NULL;
- }
-}
diff --git a/widgets/misc/e-canvas.h b/widgets/misc/e-canvas.h
deleted file mode 100644
index 1e8397b301..0000000000
--- a/widgets/misc/e-canvas.h
+++ /dev/null
@@ -1,132 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-canvas.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef __E_CANVAS_H__
-#define __E_CANVAS_H__
-
-#include <libgnomeui/gnome-canvas.h>
-
-#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 void (*ECanvasItemReflowFunc) (GnomeCanvasItem *item,
- gint flags);
-
-typedef void (*ECanvasItemSelectionFunc) (GnomeCanvasItem *item,
- gint flags,
- gpointer user_data);
-/* Returns the same as strcmp does. */
-typedef gint (*ECanvasItemSelectionCompareFunc) (GnomeCanvasItem *item,
- gpointer data1,
- gpointer data2,
- gint flags);
-
-
-typedef struct _ECanvas ECanvas;
-typedef struct _ECanvasClass ECanvasClass;
-
-/* Object flags for items */
-enum {
- E_CANVAS_ITEM_NEEDS_REFLOW = 1 << 13,
- E_CANVAS_ITEM_DESCENDENT_NEEDS_REFLOW = 1 << 14
-};
-
-enum {
- E_CANVAS_ITEM_SELECTION_SELECT = 1 << 0, /* TRUE = select. FALSE = unselect. */
- E_CANVAS_ITEM_SELECTION_CURSOR = 1 << 1, /* TRUE = has become cursor. FALSE = not cursor. */
- E_CANVAS_ITEM_SELECTION_DELETE_DATA = 1 << 2,
-};
-
-typedef struct {
- GnomeCanvasItem *item;
- gpointer id;
-} ECanvasSelectionInfo;
-
-struct _ECanvas
-{
- GnomeCanvas parent;
-
- int idle_id;
- GList *selection;
- ECanvasSelectionInfo *cursor;
-
- GtkWidget *tooltip_window;
- int visibility_notify_id;
- GtkWidget *toplevel;
- guint visibility_first : 1;
-
- /* Input context for dead key support */
- GdkIC *ic;
- GdkICAttr *ic_attr;
-};
-
-struct _ECanvasClass
-{
- GnomeCanvasClass parent_class;
- void (* reflow) (ECanvas *canvas);
-};
-
-
-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, gboolean widget_too);
-
-void e_canvas_item_request_reflow (GnomeCanvasItem *item);
-void e_canvas_item_request_parent_reflow (GnomeCanvasItem *item);
-void e_canvas_item_set_reflow_callback (GnomeCanvasItem *item, ECanvasItemReflowFunc func);
-
-void e_canvas_item_set_selection_callback (GnomeCanvasItem *item, ECanvasItemSelectionFunc func);
-void e_canvas_item_set_selection_compare_callback (GnomeCanvasItem *item, ECanvasItemSelectionCompareFunc func);
-
-void e_canvas_item_set_cursor (GnomeCanvasItem *item, gpointer id);
-void e_canvas_item_add_selection (GnomeCanvasItem *item, gpointer id);
-void e_canvas_item_remove_selection (GnomeCanvasItem *item, gpointer id);
-
-/* Not implemented yet. */
-void e_canvas_item_set_cursor_end (GnomeCanvasItem *item, gpointer id);
-
-void e_canvas_popup_tooltip (ECanvas *canvas, GtkWidget *widget, int x, int y);
-void e_canvas_hide_tooltip (ECanvas *canvas);
-
-#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 b95d0d2783..0000000000
--- a/widgets/misc/e-colors.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-colors.c - General color allocation utilities
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Miguel de Icaza (miguel@kernel.org)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-/* We keep our own color context, as the color allocation might take
- * place before things are realized.
- */
-
-#include <config.h>
-#include <gtk/gtkwidget.h>
-#include "e-colors.h"
-
-static gboolean e_color_inited;
-static GdkColorContext *e_color_context;
-
-GdkColor e_white, e_dark_gray, e_black;
-
-int
-e_color_alloc (gushort red, gushort green, gushort blue)
-{
- int failed;
-
- if (!e_color_inited)
- e_color_init ();
-
- return gdk_color_context_get_pixel (e_color_context,
- red, green, blue, &failed);
-}
-
-void
-e_color_alloc_gdk (GdkColor *c)
-{
- int failed;
-
- g_return_if_fail (c != NULL);
-
- if (!e_color_inited)
- e_color_init ();
-
- c->pixel = gdk_color_context_get_pixel (e_color_context, c->red, c->green, c->blue, &failed);
-}
-
-void
-e_color_alloc_name (const char *name, GdkColor *c)
-{
- int failed;
-
- g_return_if_fail (name != NULL);
- g_return_if_fail (c != NULL);
-
- if (!e_color_inited)
- e_color_init ();
-
- gdk_color_parse (name, c);
- c->pixel = 0;
- c->pixel = gdk_color_context_get_pixel (e_color_context, c->red, c->green, c->blue, &failed);
-}
-
-void
-e_color_init (void)
-{
- GdkColormap *colormap;
-
- /* It's surprisingly easy to end up calling this twice. Survive. */
- if (e_color_inited)
- return;
-
- colormap = gtk_widget_get_default_colormap ();
-
- /* Initialize the color context */
- e_color_context = gdk_color_context_new (
- gtk_widget_get_default_visual (), colormap);
-
- e_color_inited = TRUE;
-
- /* Allocate the default colors */
- gdk_color_white (colormap, &e_white);
- gdk_color_black (colormap, &e_black);
- e_color_alloc_name ("gray20", &e_dark_gray);
-}
diff --git a/widgets/misc/e-colors.h b/widgets/misc/e-colors.h
deleted file mode 100644
index 29e96811f1..0000000000
--- a/widgets/misc/e-colors.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-colors.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Miguel de Icaza (miguel@kernel.org)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef GNOME_APP_LIBS_COLOR_H
-#define GNOME_APP_LIBS_COLOR_H
-
-#include <glib.h>
-#include <gdk/gdk.h>
-#include <libgnome/gnome-defs.h>
-
-BEGIN_GNOME_DECLS
-
-void e_color_init (void);
-
-/* Return the pixel value for the given red, green and blue */
-int e_color_alloc (gushort red, gushort green, gushort blue);
-void e_color_alloc_name (const char *name, GdkColor *color);
-void e_color_alloc_gdk (GdkColor *color);
-
-extern GdkColor e_white, e_dark_gray, e_black;
-
-END_GNOME_DECLS
-
-#endif /* GNOME_APP_LIBS_COLOR_H */
diff --git a/widgets/misc/e-cursors.c b/widgets/misc/e-cursors.c
deleted file mode 100644
index 3ea1b3c6d1..0000000000
--- a/widgets/misc/e-cursors.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-cursors.c - cursor handling for gnumeric
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Miguel de Icaza (miguel@gnu.org)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-
-#include "e-cursors.h"
-
-#include "e-colors.h"
-#include "pixmaps/cursor_cross.xpm"
-#include "pixmaps/cursor_zoom_in.xpm"
-#include "pixmaps/cursor_zoom_out.xpm"
-#include "pixmaps/cursor_hand_open.xpm"
-#include "pixmaps/cursor_hand_closed.xpm"
-#include <stdio.h>
-
-#define GDK_INTERNAL_CURSOR -1
-
-typedef struct {
- GdkCursor *cursor;
- int hot_x, hot_y;
- char **xpm;
-} CursorDef;
-
-static CursorDef cursors [] = {
- { NULL, 17, 17, cursor_cross_xpm },
- { NULL, GDK_INTERNAL_CURSOR, GDK_CROSSHAIR, NULL },
- { NULL, GDK_INTERNAL_CURSOR, GDK_ARROW, NULL },
- { NULL, GDK_INTERNAL_CURSOR, GDK_FLEUR, NULL },
- { NULL, 24, 24, cursor_zoom_in_xpm },
- { NULL, 24, 24, cursor_zoom_out_xpm },
- { NULL, GDK_INTERNAL_CURSOR, GDK_SB_H_DOUBLE_ARROW, NULL },
- { NULL, GDK_INTERNAL_CURSOR, GDK_SB_V_DOUBLE_ARROW, NULL },
- { NULL, GDK_INTERNAL_CURSOR, GDK_SIZING, NULL },
- { NULL, GDK_INTERNAL_CURSOR, GDK_SIZING, NULL },
- { NULL, GDK_INTERNAL_CURSOR, GDK_HAND2, NULL },
- { NULL, 10, 10, cursor_hand_open_xpm },
- { NULL, 10, 10, cursor_hand_closed_xpm },
- { 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)
-{
- int i;
-
- 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,
- &e_black, &e_white,
- cursors [i].hot_x,
- cursors [i].hot_y);
- }
- }
-
- g_assert (i == E_CURSOR_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_CURSOR_NUM_CURSORS, NULL);
-
- return cursors [type].cursor;
-}
diff --git a/widgets/misc/e-cursors.h b/widgets/misc/e-cursors.h
deleted file mode 100644
index c7f17cbb77..0000000000
--- a/widgets/misc/e-cursors.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-cursors.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Miguel de Icaza (miguel@gnu.org)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef GNOME_APP_LIB_CURSORS_H
-#define GNOME_APP_LIB_CURSORS_H
-
-#include <gdk/gdk.h>
-#include <libgnome/gnome-defs.h>
-
-BEGIN_GNOME_DECLS
-
-typedef enum {
- E_CURSOR_FAT_CROSS,
- E_CURSOR_THIN_CROSS,
- E_CURSOR_ARROW,
- E_CURSOR_MOVE,
- E_CURSOR_ZOOM_IN,
- E_CURSOR_ZOOM_OUT,
- E_CURSOR_SIZE_X,
- E_CURSOR_SIZE_Y,
- E_CURSOR_SIZE_TL,
- E_CURSOR_SIZE_TR,
- E_CURSOR_PRESS,
- E_CURSOR_HAND_OPEN,
- E_CURSOR_HAND_CLOSED,
- E_CURSOR_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);
-
-END_GNOME_DECLS
-
-#endif /* GNOME_APP_LIB_CURSORS_H */
diff --git a/widgets/misc/e-filter-bar.c b/widgets/misc/e-filter-bar.c
index 91fb195779..9ff4c55aa0 100644
--- a/widgets/misc/e-filter-bar.c
+++ b/widgets/misc/e-filter-bar.c
@@ -137,12 +137,19 @@ menubar_activated (ESearchBar *esb, int id, void *data)
EFilterBar *efb = (EFilterBar *)esb;
switch (id) {
+ case E_FILTERBAR_RESET_ID:
+ d(printf("Reset menu\n"));
+ efb->current_query = NULL;
+ e_search_bar_set_item_id (esb, efb->option_base);
+ e_search_bar_set_text (esb, NULL);
+ gtk_widget_set_sensitive (esb->entry, TRUE);
+ break;
case E_FILTERBAR_EDIT_ID:
if (!efb->save_dialogue) {
GnomeDialog *gd;
gd = (GnomeDialog *) rule_editor_new (efb->context, FILTER_SOURCE_INCOMING);
- efb->save_dialogue = (GtkWidget *) gd;
+ efb->save_dialogue = gd;
gtk_window_set_title (GTK_WINDOW (gd), _("Search Editor"));
gtk_signal_connect (GTK_OBJECT (gd), "clicked", full_rule_editor_clicked, efb);
gtk_signal_connect (GTK_OBJECT (gd), "destroy", rule_editor_destroyed, efb);
@@ -453,6 +460,8 @@ context_changed (RuleContext *context, gpointer user_data)
static void
context_rule_removed (RuleContext *context, FilterRule *rule, gpointer user_data)
{
+ EFilterBar *efb = E_FILTER_BAR (user_data);
+
/*gtk_signal_disconnect_by_func((GtkObject *)rule, rule_changed, efb);*/
}
@@ -588,17 +597,14 @@ init (EFilterBar *efb)
/* Object construction. */
EFilterBar *
-e_filter_bar_new (RuleContext *context,
- const char *systemrules,
- const char *userrules,
- EFilterBarConfigRule config,
- void *data)
+e_filter_bar_new (RuleContext *context, const char *systemrules, const char *userrules,
+ EFilterBarConfigRule config, void *data)
{
EFilterBar *bar;
ESearchBarItem item = { NULL, -1, NULL };
bar = gtk_type_new (e_filter_bar_get_type ());
-
+
bar->context = context;
gtk_object_ref (GTK_OBJECT (context));
diff --git a/widgets/misc/e-gui-utils.c b/widgets/misc/e-gui-utils.c
deleted file mode 100644
index d70bb829a6..0000000000
--- a/widgets/misc/e-gui-utils.c
+++ /dev/null
@@ -1,262 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-gui-utils.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Miguel de Icaza <miguel@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-
-#include "e-gui-utils.h"
-
-#include <gtk/gtkentry.h>
-#include <gtk/gtksignal.h>
-#include <libgnomeui/gnome-messagebox.h>
-#include <libgnomeui/gnome-stock.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <gdk-pixbuf/gnome-canvas-pixbuf.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, GdkEvent *event)
-{
- g_return_if_fail (menu != NULL);
- g_return_if_fail (GTK_IS_MENU (menu));
-
- e_auto_kill_popup_menu_on_hide (menu);
-
- if (event->type == GDK_KEY_PRESS)
- gtk_menu_popup (menu, NULL, NULL, 0, NULL, 0, event->key.time);
- else if ((event->type == GDK_BUTTON_PRESS) ||
- (event->type == GDK_BUTTON_RELEASE) ||
- (event->type == GDK_2BUTTON_PRESS) ||
- (event->type == GDK_3BUTTON_PRESS)){
- gtk_menu_popup (menu, NULL, NULL, 0, NULL, event->button.button, event->button.time);
- } else
- gtk_menu_popup (menu, NULL, NULL, 0, NULL, 0, GDK_CURRENT_TIME);
-}
-
-typedef struct {
- GtkCallback callback;
- gpointer closure;
-} CallbackClosure;
-
-static void
-e_container_foreach_leaf_callback(GtkWidget *widget, CallbackClosure *callback_closure)
-{
- if (GTK_IS_CONTAINER(widget)) {
- e_container_foreach_leaf(GTK_CONTAINER(widget), callback_closure->callback, callback_closure->closure);
- } else {
- (*callback_closure->callback) (widget, callback_closure->closure);
- }
-}
-
-void
-e_container_foreach_leaf(GtkContainer *container,
- GtkCallback callback,
- gpointer closure)
-{
- CallbackClosure callback_closure;
- callback_closure.callback = callback;
- callback_closure.closure = closure;
- gtk_container_foreach(container, (GtkCallback) e_container_foreach_leaf_callback, &callback_closure);
-}
-
-static void
-e_container_change_tab_order_destroy_notify(gpointer data)
-{
- GList *list = data;
- g_list_foreach(list, (GFunc) gtk_object_unref, NULL);
- g_list_free(list);
-}
-
-
-static gint
-e_container_change_tab_order_callback(GtkContainer *container,
- GtkDirectionType direction,
- GList *children)
-{
- GtkWidget *focus_child;
- GtkWidget *child;
-
- if (direction != GTK_DIR_TAB_FORWARD &&
- direction != GTK_DIR_TAB_BACKWARD)
- return FALSE;
-
- focus_child = container->focus_child;
-
- if (focus_child == NULL)
- return FALSE;
-
- if (direction == GTK_DIR_TAB_BACKWARD) {
- children = g_list_last(children);
- }
-
- while (children) {
- child = children->data;
- if (direction == GTK_DIR_TAB_FORWARD)
- children = children->next;
- else
- children = children->prev;
-
- if (!child)
- continue;
-
- if (focus_child) {
- if (focus_child == child) {
- focus_child = NULL;
-
- if (GTK_WIDGET_DRAWABLE (child) &&
- GTK_IS_CONTAINER (child) &&
- !GTK_WIDGET_HAS_FOCUS (child))
- if (gtk_container_focus (GTK_CONTAINER (child), direction)) {
- gtk_signal_emit_stop_by_name(GTK_OBJECT(container), "focus");
- return TRUE;
- }
- }
- }
- else if (GTK_WIDGET_DRAWABLE (child)) {
- if (GTK_IS_CONTAINER (child)) {
- if (gtk_container_focus (GTK_CONTAINER (child), direction)) {
- gtk_signal_emit_stop_by_name(GTK_OBJECT(container), "focus");
- return TRUE;
- }
- }
- else if (GTK_WIDGET_CAN_FOCUS (child)) {
- gtk_widget_grab_focus (child);
- gtk_signal_emit_stop_by_name(GTK_OBJECT(container), "focus");
- return TRUE;
- }
- }
- }
-
- return FALSE;
-}
-
-gint
-e_container_change_tab_order(GtkContainer *container, GList *widgets)
-{
- GList *list;
- list = g_list_copy(widgets);
- g_list_foreach(list, (GFunc) gtk_object_ref, NULL);
- return gtk_signal_connect_full(GTK_OBJECT(container), "focus",
- GTK_SIGNAL_FUNC(e_container_change_tab_order_callback),
- NULL, list,
- e_container_change_tab_order_destroy_notify,
- FALSE, FALSE);
-}
-
-struct widgetandint {
- GtkWidget *widget;
- int count;
-};
-
-static void
-nth_entry_callback(GtkWidget *widget, struct widgetandint *data)
-{
- if (GTK_IS_ENTRY(widget)) {
- if (data->count > 1) {
- data->count --;
- data->widget = widget;
- } else if (data->count == 1) {
- data->count --;
- data->widget = NULL;
- gtk_widget_grab_focus(widget);
- }
- }
-}
-
-void
-e_container_focus_nth_entry(GtkContainer *container, int n)
-{
- struct widgetandint data;
- data.widget = NULL;
- data.count = n;
- e_container_foreach_leaf(container, (GtkCallback) nth_entry_callback, &data);
- if (data.widget)
- gtk_widget_grab_focus(data.widget);
-}
-
-gboolean
-e_glade_xml_connect_widget (GladeXML *gui, char *name, char *signal, GtkSignalFunc cb, gpointer closure)
-{
- GtkWidget *widget;
-
- widget = glade_xml_get_widget (gui, name);
-
- if (widget) {
- gtk_signal_connect (GTK_OBJECT (widget), signal,
- cb, closure);
- return TRUE;
- }
-
- return FALSE;
-}
-
-gboolean
-e_glade_xml_set_sensitive (GladeXML *gui, char *name, gboolean sensitive)
-{
- GtkWidget *widget;
-
- widget = glade_xml_get_widget (gui, name);
-
- if (widget) {
- gtk_widget_set_sensitive (widget, sensitive);
- return TRUE;
- }
-
- return FALSE;
-}
diff --git a/widgets/misc/e-gui-utils.h b/widgets/misc/e-gui-utils.h
deleted file mode 100644
index 7cbf774c9e..0000000000
--- a/widgets/misc/e-gui-utils.h
+++ /dev/null
@@ -1,62 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-gui-utils.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Miguel de Icaza <miguel@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef GAL_GUI_UTILS_H
-#define GAL_GUI_UTILS_H
-
-#include <gtk/gtkmenu.h>
-#include <gtk/gtkwindow.h>
-
-#include <libgnomeui/gnome-messagebox.h>
-#include <libgnome/gnome-defs.h>
-#include <glade/glade-xml.h>
-
-BEGIN_GNOME_DECLS
-
-void e_popup_menu (GtkMenu *menu,
- GdkEvent *event);
-void e_auto_kill_popup_menu_on_hide (GtkMenu *menu);
-void e_notice (GtkWindow *window,
- const char *type,
- const char *format,
- ...);
-void e_container_foreach_leaf (GtkContainer *container,
- GtkCallback callback,
- gpointer closure);
-void e_container_focus_nth_entry (GtkContainer *container,
- int n);
-gint e_container_change_tab_order (GtkContainer *container,
- GList *widgets);
-/* Returns TRUE on success. */
-gboolean e_glade_xml_connect_widget (GladeXML *gui,
- char *name,
- char *signal,
- GtkSignalFunc cb,
- gpointer closure);
-gboolean e_glade_xml_set_sensitive (GladeXML *gui,
- char *name,
- gboolean sensitive);
-
-END_GNOME_DECLS
-
-#endif /* GAL_GUI_UTILS_H */
diff --git a/widgets/misc/e-hsv-utils.c b/widgets/misc/e-hsv-utils.c
deleted file mode 100644
index 20c66daeae..0000000000
--- a/widgets/misc/e-hsv-utils.c
+++ /dev/null
@@ -1,178 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-hsv-utils.c - utilites for manipulating colours in HSV space
- * Copyright (C) 1995-2001 Seth Nickell, Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * Authors:
- * Seth Nickell <seth@eazel.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-
-#include "e-hsv-utils.h"
-
-/* tweak_hsv is a really tweaky function. it modifies its first argument, which
- should be the colour you want tweaked. delta_h, delta_s and delta_v specify
- how much you want their respective channels modified (and in what direction).
- if it can't do the specified modification, it does it in the oppositon direction */
-void
-e_hsv_tweak (GdkColor *colour, gdouble delta_h, gdouble delta_s, gdouble delta_v)
-{
- gdouble h, s, v, r, g, b;
-
- r = colour->red / 65535.0f;
- g = colour->green / 65535.0f;
- b = colour->blue / 65535.0f;
-
- e_rgb_to_hsv (r, g, b, &h, &s, &v);
-
- if (h + delta_h < 0) {
- h -= delta_h;
- } else {
- h += delta_h;
- }
-
- if (s + delta_s < 0) {
- s -= delta_s;
- } else {
- s += delta_s;
- }
-
- if (v + delta_v < 0) {
- v -= delta_v;
- } else {
- v += delta_v;
- }
-
- e_hsv_to_rgb (h, s, v, &r, &g, &b);
-
- colour->red = r * 65535.0f;
- colour->green = g * 65535.0f;
- colour->blue = b * 65535.0f;
-}
-
-/* Copy n' Paste code from the GTK+ colour selector (gtkcolorsel.c) */
-/* Originally lifted, I suspect, from "Foley, van Dam" */
-void
-e_hsv_to_rgb (gdouble h, gdouble s, gdouble v,
- gdouble *r, gdouble *g, gdouble *b)
-{
- gint i;
- gdouble f, w, q, t;
-
- if (s == 0.0)
- s = 0.000001;
-
- if (h == -1.0)
- {
- *r = v;
- *g = v;
- *b = v;
- }
- else
- {
- if (h == 360.0)
- h = 0.0;
- h = h / 60.0;
- i = (gint) h;
- f = h - i;
- w = v * (1.0 - s);
- q = v * (1.0 - (s * f));
- t = v * (1.0 - (s * (1.0 - f)));
-
- switch (i)
- {
- case 0:
- *r = v;
- *g = t;
- *b = w;
- break;
- case 1:
- *r = q;
- *g = v;
- *b = w;
- break;
- case 2:
- *r = w;
- *g = v;
- *b = t;
- break;
- case 3:
- *r = w;
- *g = q;
- *b = v;
- break;
- case 4:
- *r = t;
- *g = w;
- *b = v;
- break;
- case 5:
- *r = v;
- *g = w;
- *b = q;
- break;
- }
- }
-}
-
-void
-e_rgb_to_hsv (gdouble r, gdouble g, gdouble b,
- gdouble *h, gdouble *s, gdouble *v)
-{
- double max, min, delta;
-
- max = r;
- if (g > max)
- max = g;
- if (b > max)
- max = b;
-
- min = r;
- if (g < min)
- min = g;
- if (b < min)
- min = b;
-
- *v = max;
-
- if (max != 0.0)
- *s = (max - min) / max;
- else
- *s = 0.0;
-
- if (*s == 0.0)
- *h = -1.0;
- else
- {
- delta = max - min;
-
- if (r == max)
- *h = (g - b) / delta;
- else if (g == max)
- *h = 2.0 + (b - r) / delta;
- else if (b == max)
- *h = 4.0 + (r - g) / delta;
-
- *h = *h * 60.0;
-
- if (*h < 0.0)
- *h = *h + 360;
- }
-}
-
-
diff --git a/widgets/misc/e-hsv-utils.h b/widgets/misc/e-hsv-utils.h
deleted file mode 100644
index 34f4da615b..0000000000
--- a/widgets/misc/e-hsv-utils.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-hsv-utils.h - utilites for manipulating colours in HSV space
- * Copyright (C) 1995-2001 Seth Nickell, Peter Mattis, Spencer Kimball and Josh MacDonald
- *
- * Authors:
- * Seth Nickell <seth@eazel.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_HSV_UTILS_H_
-#define _E_HSV_UTILS_H_
-
-#include <libgnome/gnome-defs.h>
-#include <gdk/gdk.h>
-
-BEGIN_GNOME_DECLS
-
-void e_hsv_to_rgb (gdouble h,
- gdouble s,
- gdouble v,
- gdouble *r,
- gdouble *g,
- gdouble *b);
-
-void e_rgb_to_hsv (gdouble r,
- gdouble g,
- gdouble b,
- gdouble *h,
- gdouble *s,
- gdouble *v);
-
-void e_hsv_tweak (GdkColor *colour,
- gdouble delta_h,
- gdouble delta_s,
- gdouble delta_v);
-
-END_GNOME_DECLS
-
-#endif /* _E_HSV_UTILS_H_ */
diff --git a/widgets/misc/e-popup-menu.c b/widgets/misc/e-popup-menu.c
deleted file mode 100644
index 780ed55c76..0000000000
--- a/widgets/misc/e-popup-menu.c
+++ /dev/null
@@ -1,182 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-popup-menu.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Miguel de Icaza <miguel@ximian.com>
- * Jody Goldberg (jgoldberg@home.com)
- * Jeffrey Stedfast <fejj@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <string.h>
-#include <gdk/gdkkeysyms.h>
-#include <gtk/gtkaccellabel.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtkmenuitem.h>
-#include <gtk/gtkcheckmenuitem.h>
-#include <gtk/gtkradiomenuitem.h>
-#include <gtk/gtksignal.h>
-#include <libgnomeui/gtkpixmapmenuitem.h>
-#include <libgnomeui/gnome-stock.h>
-
-#include "e-popup-menu.h"
-#include "e-gui-utils.h"
-
-#include <libgnome/gnome-i18n.h>
-
-#ifndef GNOME_APP_HELPER_H
-/* Copied this i18n function to use for the same purpose */
-
-#ifdef ENABLE_NLS
-#define L_(x) gnome_app_helper_gettext(x)
-
-static gchar *
-gnome_app_helper_gettext (const gchar *str)
-{
- char *s;
-
- s = gettext (str);
- if ( s == str )
- s = dgettext (PACKAGE, str);
-
- return s;
-}
-
-#else
-#define L_(x) x
-#endif
-
-#endif
-
-/*
- * Creates an item with an optional icon
- */
-static void
-make_item (GtkMenu *menu, GtkMenuItem *item, const char *name, GtkWidget *pixmap)
-{
- GtkWidget *label;
- guint label_accel;
-
- /*
- * Ugh. This needs to go into Gtk+
- */
- label = gtk_accel_label_new ("");
- label_accel = gtk_label_parse_uline (GTK_LABEL (label), name);
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
- gtk_widget_show (label);
-
- gtk_container_add (GTK_CONTAINER (item), label);
-
- if (label_accel != GDK_VoidSymbol){
- gtk_widget_add_accelerator (
- GTK_WIDGET (item),
- "activate_item",
- gtk_menu_ensure_uline_accel_group (GTK_MENU (menu)),
- label_accel, 0,
- GTK_ACCEL_LOCKED);
- }
-
- if (pixmap && GTK_IS_PIXMAP_MENU_ITEM (item)){
- gtk_widget_show (pixmap);
- gtk_pixmap_menu_item_set_pixmap (GTK_PIXMAP_MENU_ITEM (item), pixmap);
- }
-}
-
-GtkMenu *
-e_popup_menu_create (EPopupMenu *menu_list, guint32 disable_mask, guint32 hide_mask, void *default_closure)
-{
- GtkMenu *menu = GTK_MENU (gtk_menu_new ());
- GSList *group = NULL;
- gboolean last_item_separator = TRUE;
- int last_non_separator = -1;
- int i;
-
- for (i = 0; menu_list[i].name; i++) {
- if (strcmp ("", menu_list[i].name) && !(menu_list [i].disable_mask & hide_mask)) {
- last_non_separator = i;
- }
- }
-
- for (i = 0; i <= last_non_separator; i++) {
- gboolean separator;
-
- separator = !strcmp ("", menu_list[i].name);
-
- if ((!(separator && last_item_separator)) && !(menu_list [i].disable_mask & hide_mask)) {
- GtkWidget *item = NULL;
-
- if (!separator) {
- if (menu_list[i].is_toggle)
- item = gtk_check_menu_item_new ();
- else if (menu_list[i].is_radio)
- item = gtk_radio_menu_item_new (group);
- else
- item = menu_list[i].pixmap_widget ? gtk_pixmap_menu_item_new () : gtk_menu_item_new ();
- if (menu_list[i].is_toggle || menu_list[i].is_radio)
- gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), menu_list[i].is_active);
- if (menu_list[i].is_radio)
- group = gtk_radio_menu_item_group (GTK_RADIO_MENU_ITEM (item));
-
- make_item (menu, GTK_MENU_ITEM (item), L_(menu_list[i].name), menu_list[i].pixmap_widget);
- } else {
- item = gtk_menu_item_new ();
- }
-
- gtk_menu_append (menu, item);
-
- if (!menu_list[i].submenu) {
- if (menu_list[i].fn)
- gtk_signal_connect (GTK_OBJECT (item), "activate",
- GTK_SIGNAL_FUNC (menu_list[i].fn),
- menu_list[i].use_custom_closure ? menu_list[i].closure : default_closure);
- } else {
- /* submenu */
- GtkMenu *submenu;
-
- submenu = e_popup_menu_create (menu_list[i].submenu, disable_mask, hide_mask,
- default_closure);
-
- gtk_menu_item_set_submenu (GTK_MENU_ITEM (item), GTK_WIDGET (submenu));
- }
-
- if (menu_list[i].disable_mask & disable_mask)
- gtk_widget_set_sensitive (item, FALSE);
-
- gtk_widget_show (item);
-
- last_item_separator = separator;
- }
- }
-
- return menu;
-}
-
-void
-e_popup_menu_run (EPopupMenu *menu_list, GdkEvent *event, guint32 disable_mask, guint32 hide_mask, void *default_closure)
-{
- GtkMenu *menu;
-
- g_return_if_fail (menu_list != NULL);
- g_return_if_fail (event != NULL);
-
- menu = e_popup_menu_create (menu_list, disable_mask, hide_mask, default_closure);
-
- e_popup_menu (menu, event);
-}
-
diff --git a/widgets/misc/e-popup-menu.h b/widgets/misc/e-popup-menu.h
deleted file mode 100644
index 095c1a42d7..0000000000
--- a/widgets/misc/e-popup-menu.h
+++ /dev/null
@@ -1,107 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-popup-menu.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Miguel de Icaza <miguel@ximian.com>
- * Jody Goldberg (jgoldberg@home.com)
- * Jeffrey Stedfast <fejj@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef E_POPUP_MENU_H
-#define E_POPUP_MENU_H
-
-#include <gtk/gtkmenu.h>
-#include <gtk/gtkwidget.h>
-#include <libgnome/gnome-defs.h>
-
-BEGIN_GNOME_DECLS
-
-#define E_POPUP_SEPARATOR { "", NULL, (NULL), NULL, 0 }
-#define E_POPUP_TERMINATOR { NULL, NULL, (NULL), NULL, 0 }
-
-
-/* In the following, CC = custom closure */
-
-#define E_POPUP_ITEM(name,fn,disable_mask) { (name), NULL, (fn), NULL, (disable_mask), NULL, NULL, 0, 0, 0, 0 }
-#define E_POPUP_ITEM_CC(name,fn,closure,disable_mask) { (name), NULL, (fn), NULL, (disable_mask), NULL, (closure), 0, 0, 0, 1 }
-#define E_POPUP_SUBMENU(name,submenu,disable_mask) { (name), NULL, NULL, (submenu), (disable_mask), NULL, NULL, 0, 0, 0, 0 }
-
-#define E_POPUP_PIXMAP_ITEM(name,pixmap,fn,disable_mask) { (name), (pixmap), (fn), NULL, (disable_mask), NULL, NULL, 0, 0, 0, 0 }
-#define E_POPUP_PIXMAP_ITEM_CC(name,pixmap,fn,closure,disable_mask) { (name), (pixmap), (fn), NULL, (disable_mask), NULL, (closure), 0, 0, 0, 1 }
-#define E_POPUP_PIXMAP_SUBMENU(name,pixmap,submenu,disable_mask) { (name), (pixmap), NULL, (submenu), (disable_mask), NULL, NULL, 0, 0, 0, 0 }
-
-#define E_POPUP_PIXMAP_WIDGET_ITEM(name,pixmap_widget,fn,disable_mask) { (name), NULL, (fn), NULL, (disable_mask), (pixmap_widget), NULL, 0, 0, 0, 0 }
-#define E_POPUP_PIXMAP_WIDGET_ITEM_CC(name,pixmap_widget,fn,closure,disable_mask) { (name), NULL, (fn), NULL, (disable_mask), (pixmap_widget), (closure), 0, 0, 0, 1 }
-#define E_POPUP_PIXMAP_WIDGET_SUBMENU(name,pixmap_widget,submenu,disable_mask) { (name), NULL, NULL, (submenu), (disable_mask), (pixmap_widget), NULL, 0, 0, 0, 0 }
-
-
-#define E_POPUP_TOGGLE_ITEM(name,fn,disable_mask,value) { (name), NULL, (fn), NULL, (disable_mask), NULL, NULL, 1, 0, value, 0 }
-#define E_POPUP_TOGGLE_ITEM_CC(name,fn,closure,disable_mask,value) { (name), NULL, (fn), NULL, (disable_mask), NULL, (closure), 1, 0, value, 1 }
-
-#define E_POPUP_TOGGLE_PIXMAP_ITEM(name,pixmap,fn,disable_mask) { (name), (pixmap), (fn), NULL, (disable_mask), NULL, NULL, 1, 0, value, 0 }
-#define E_POPUP_TOGGLE_PIXMAP_ITEM_CC(name,pixmap,fn,closure,disable_mask) { (name), (pixmap), (fn), NULL, (disable_mask), NULL, (closure), 1, 0, value, 1 }
-
-#define E_POPUP_TOGGLE_PIXMAP_WIDGET_ITEM(name,pixmap_widget,fn,disable_mask) { (name), NULL, (fn), NULL, (disable_mask), (pixmap_widget), NULL, 1, 0, value, 0 }
-#define E_POPUP_TOGGLE_PIXMAP_WIDGET_ITEM_CC(name,pixmap_widget,fn,closure,disable_mask) { (name), NULL, (fn), NULL, (disable_mask), (pixmap_widget), (closure), 1, 0, value, 1 }
-
-
-#define E_POPUP_RADIO_ITEM(name,fn,disable_mask,value) { (name), NULL, (fn), NULL, (disable_mask), NULL, NULL, 0, 1, value, 0 }
-#define E_POPUP_RADIO_ITEM_CC(name,fn,closure,disable_mask,value) { (name), NULL, (fn), NULL, (disable_mask), NULL, (closure), 0, 1, value, 1 }
-
-#define E_POPUP_RADIO_PIXMAP_ITEM(name,pixmap,fn,disable_mask) { (name), (pixmap), (fn), NULL, (disable_mask), NULL, NULL, 0, 1, value, 0 }
-#define E_POPUP_RADIO_PIXMAP_ITEM_CC(name,pixmap,fn,closure,disable_mask) { (name), (pixmap), (fn), NULL, (disable_mask), NULL, (closure), 0, 1, value, 1 }
-
-#define E_POPUP_RADIO_PIXMAP_WIDGET_ITEM(name,pixmap_widget,fn,disable_mask) { (name), NULL, (fn), NULL, (disable_mask), (pixmap_widget), NULL, 0, 1, value, 0 }
-#define E_POPUP_RADIO_PIXMAP_WIDGET_ITEM_CC(name,pixmap_widget,fn,closure,disable_mask) { (name), NULL, (fn), NULL, (disable_mask), (pixmap_widget), (closure), 0, 1, value, 1 }
-
-typedef struct _EPopupMenu EPopupMenu;
-
-struct _EPopupMenu {
- char *name;
- const gchar *pixmap;
- void (*fn) (GtkWidget *widget, void *closure);
- EPopupMenu *submenu;
- guint32 disable_mask;
-
- /* Added post 0.19 */
- GtkWidget *pixmap_widget;
- void *closure;
-
- guint is_toggle : 1;
- guint is_radio : 1;
- guint is_active : 1;
-
- guint use_custom_closure : 1;
-};
-
-
-GtkMenu *e_popup_menu_create (EPopupMenu *menu_list,
- guint32 disable_mask,
- guint32 hide_mask,
- void *default_closure);
-
-void e_popup_menu_run (EPopupMenu *menu_list,
- GdkEvent *event,
- guint32 disable_mask,
- guint32 hide_mask,
- void *default_closure);
-
-END_GNOME_DECLS
-
-#endif /* E_POPUP_MENU_H */
diff --git a/widgets/misc/e-printable.c b/widgets/misc/e-printable.c
deleted file mode 100644
index 749c3c2953..0000000000
--- a/widgets/misc/e-printable.c
+++ /dev/null
@@ -1,221 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-printable.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <gtk/gtksignal.h>
-#include "gal/util/e-util.h"
-#include "e-printable.h"
-
-#define EP_CLASS(e) ((EPrintableClass *)((GtkObject *)e)->klass)
-
-#define PARENT_TYPE gtk_object_get_type ()
-
-
-static GtkObjectClass *e_printable_parent_class;
-
-enum {
- PRINT_PAGE,
- DATA_LEFT,
- RESET,
- HEIGHT,
- WILL_FIT,
- LAST_SIGNAL
-};
-
-static guint e_printable_signals [LAST_SIGNAL] = { 0, };
-
-static void
-e_printable_class_init (GtkObjectClass *object_class)
-{
- EPrintableClass *klass = E_PRINTABLE_CLASS(object_class);
- e_printable_parent_class = gtk_type_class (PARENT_TYPE);
-
- e_printable_signals [PRINT_PAGE] =
- gtk_signal_new ("print_page",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (EPrintableClass, print_page),
- e_marshal_NONE__OBJECT_DOUBLE_DOUBLE_BOOL,
- GTK_TYPE_NONE, 4, GTK_TYPE_OBJECT, GTK_TYPE_DOUBLE, GTK_TYPE_DOUBLE, GTK_TYPE_BOOL);
-
- e_printable_signals [DATA_LEFT] =
- gtk_signal_new ("data_left",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (EPrintableClass, data_left),
- gtk_marshal_BOOL__NONE,
- GTK_TYPE_BOOL, 0, GTK_TYPE_NONE);
-
- e_printable_signals [RESET] =
- gtk_signal_new ("reset",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (EPrintableClass, reset),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0, GTK_TYPE_NONE);
-
- e_printable_signals [HEIGHT] =
- gtk_signal_new ("height",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (EPrintableClass, height),
- e_marshal_DOUBLE__OBJECT_DOUBLE_DOUBLE_BOOL,
- GTK_TYPE_DOUBLE, 4, GTK_TYPE_OBJECT, GTK_TYPE_DOUBLE, GTK_TYPE_DOUBLE, GTK_TYPE_BOOL);
-
- e_printable_signals [WILL_FIT] =
- gtk_signal_new ("will_fit",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (EPrintableClass, will_fit),
- e_marshal_BOOL__OBJECT_DOUBLE_DOUBLE_BOOL,
- GTK_TYPE_BOOL, 4, GTK_TYPE_OBJECT, GTK_TYPE_DOUBLE, GTK_TYPE_DOUBLE, GTK_TYPE_BOOL);
-
- E_OBJECT_CLASS_ADD_SIGNALS (object_class, e_printable_signals, LAST_SIGNAL);
-
- klass->print_page = NULL;
- klass->data_left = NULL;
- klass->reset = NULL;
- klass->height = NULL;
- klass->will_fit = NULL;
-}
-
-
-guint
-e_printable_get_type (void)
-{
- static guint type = 0;
-
- if (!type)
- {
- GtkTypeInfo info =
- {
- "EPrintable",
- sizeof (EPrintable),
- sizeof (EPrintableClass),
- (GtkClassInitFunc) e_printable_class_init,
- NULL,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- type = gtk_type_unique (gtk_object_get_type (), &info);
- }
-
- return type;
-}
-
-EPrintable *
-e_printable_new(void)
-{
- return E_PRINTABLE(gtk_type_new(e_printable_get_type()));
-}
-
-void
-e_printable_print_page (EPrintable *e_printable,
- GnomePrintContext *context,
- gdouble width,
- gdouble height,
- gboolean quantized)
-{
- g_return_if_fail (e_printable != NULL);
- g_return_if_fail (E_IS_PRINTABLE (e_printable));
-
- gtk_signal_emit (GTK_OBJECT (e_printable),
- e_printable_signals [PRINT_PAGE],
- context,
- width,
- height,
- quantized);
-}
-
-gboolean
-e_printable_data_left (EPrintable *e_printable)
-{
- gboolean ret_val;
-
- g_return_val_if_fail (e_printable != NULL, FALSE);
- g_return_val_if_fail (E_IS_PRINTABLE (e_printable), FALSE);
-
- gtk_signal_emit (GTK_OBJECT (e_printable),
- e_printable_signals [DATA_LEFT],
- &ret_val);
-
- return ret_val;
-}
-
-void
-e_printable_reset (EPrintable *e_printable)
-{
- g_return_if_fail (e_printable != NULL);
- g_return_if_fail (E_IS_PRINTABLE (e_printable));
-
- gtk_signal_emit (GTK_OBJECT (e_printable),
- e_printable_signals [RESET]);
-}
-
-gdouble
-e_printable_height (EPrintable *e_printable,
- GnomePrintContext *context,
- gdouble width,
- gdouble max_height,
- gboolean quantized)
-{
- gdouble ret_val;
-
- g_return_val_if_fail (e_printable != NULL, -1);
- g_return_val_if_fail (E_IS_PRINTABLE (e_printable), -1);
-
- gtk_signal_emit (GTK_OBJECT (e_printable),
- e_printable_signals [HEIGHT],
- context,
- width,
- max_height,
- quantized,
- &ret_val);
-
- return ret_val;
-}
-
-gboolean
-e_printable_will_fit (EPrintable *e_printable,
- GnomePrintContext *context,
- gdouble width,
- gdouble max_height,
- gboolean quantized)
-{
- gboolean ret_val;
-
- g_return_val_if_fail (e_printable != NULL, -1);
- g_return_val_if_fail (E_IS_PRINTABLE (e_printable), -1);
-
- gtk_signal_emit (GTK_OBJECT (e_printable),
- e_printable_signals [WILL_FIT],
- context,
- width,
- max_height,
- quantized,
- &ret_val);
-
- return ret_val;
-}
diff --git a/widgets/misc/e-printable.h b/widgets/misc/e-printable.h
deleted file mode 100644
index 471de36c4f..0000000000
--- a/widgets/misc/e-printable.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-printable.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_PRINTABLE_H_
-#define _E_PRINTABLE_H_
-
-#include <gtk/gtkobject.h>
-#include <libgnomeprint/gnome-print.h>
-#include <libgnome/gnome-defs.h>
-
-BEGIN_GNOME_DECLS
-
-#define E_PRINTABLE_TYPE (e_printable_get_type ())
-#define E_PRINTABLE(o) (GTK_CHECK_CAST ((o), E_PRINTABLE_TYPE, EPrintable))
-#define E_PRINTABLE_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_PRINTABLE_TYPE, EPrintableClass))
-#define E_IS_PRINTABLE(o) (GTK_CHECK_TYPE ((o), E_PRINTABLE_TYPE))
-#define E_IS_PRINTABLE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_PRINTABLE_TYPE))
-
-typedef struct {
- GtkObject base;
-} EPrintable;
-
-typedef struct {
- GtkObjectClass parent_class;
-
- /*
- * Signals
- */
-
- void (*print_page) (EPrintable *etm, GnomePrintContext *context, gdouble width, gdouble height, gboolean quantized);
- gboolean (*data_left) (EPrintable *etm);
- void (*reset) (EPrintable *etm);
- gdouble (*height) (EPrintable *etm, GnomePrintContext *context, gdouble width, gdouble max_height, gboolean quantized);
-
- /* e_printable_will_fit (ep, ...) should be equal in value to
- * (e_printable_print_page (ep, ...),
- * !e_printable_data_left(ep)) except that the latter has the
- * side effect of doing the printing and advancing the
- * position of the printable.
- */
-
- gboolean (*will_fit) (EPrintable *etm, GnomePrintContext *context, gdouble width, gdouble max_height, gboolean quantized);
-} EPrintableClass;
-
-GtkType e_printable_get_type (void);
-
-EPrintable *e_printable_new (void);
-
-/*
- * Routines for emitting signals on the e_table */
-void e_printable_print_page (EPrintable *e_printable,
- GnomePrintContext *context,
- gdouble width,
- gdouble height,
- gboolean quantized);
-gboolean e_printable_data_left (EPrintable *e_printable);
-void e_printable_reset (EPrintable *e_printable);
-gdouble e_printable_height (EPrintable *e_printable,
- GnomePrintContext *context,
- gdouble width,
- gdouble max_height,
- gboolean quantized);
-gboolean e_printable_will_fit (EPrintable *e_printable,
- GnomePrintContext *context,
- gdouble width,
- gdouble max_height,
- gboolean quantized);
-
-END_GNOME_DECLS
-
-#endif /* _E_PRINTABLE_H_ */
diff --git a/widgets/misc/e-reflow-model.c b/widgets/misc/e-reflow-model.c
deleted file mode 100644
index 0cf218e829..0000000000
--- a/widgets/misc/e-reflow-model.c
+++ /dev/null
@@ -1,303 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-reflow-model.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include "e-reflow-model.h"
-#include <gtk/gtksignal.h>
-#include "gal/util/e-util.h"
-
-#define ERM_CLASS(e) ((EReflowModelClass *)((GtkObject *)e)->klass)
-
-#define PARENT_TYPE gtk_object_get_type ()
-
-#define d(x)
-
-d(static gint depth = 0);
-
-
-static GtkObjectClass *e_reflow_model_parent_class;
-
-enum {
- MODEL_CHANGED,
- MODEL_ITEMS_INSERTED,
- MODEL_ITEM_CHANGED,
- LAST_SIGNAL
-};
-
-static guint e_reflow_model_signals [LAST_SIGNAL] = { 0, };
-
-/**
- * e_reflow_model_set_width:
- * @e_reflow_model: The e-reflow-model to operate on
- * @width: The new value for the width of each item.
- */
-void
-e_reflow_model_set_width (EReflowModel *e_reflow_model, int width)
-{
- g_return_if_fail (e_reflow_model != NULL);
- g_return_if_fail (E_IS_REFLOW_MODEL (e_reflow_model));
-
- ERM_CLASS (e_reflow_model)->set_width (e_reflow_model, width);
-}
-
-/**
- * e_reflow_model_count:
- * @e_reflow_model: The e-reflow-model to operate on
- *
- * Returns: the number of items in the reflow model.
- */
-int
-e_reflow_model_count (EReflowModel *e_reflow_model)
-{
- g_return_val_if_fail (e_reflow_model != NULL, 0);
- g_return_val_if_fail (E_IS_REFLOW_MODEL (e_reflow_model), 0);
-
- return ERM_CLASS (e_reflow_model)->count (e_reflow_model);
-}
-
-/**
- * e_reflow_model_height:
- * @e_reflow_model: The e-reflow-model to operate on
- * @n: The item number to get the height of.
- * @parent: The parent GnomeCanvasItem.
- *
- * Returns: the height of the nth item.
- */
-int
-e_reflow_model_height (EReflowModel *e_reflow_model, int n, GnomeCanvasGroup *parent)
-{
- g_return_val_if_fail (e_reflow_model != NULL, 0);
- g_return_val_if_fail (E_IS_REFLOW_MODEL (e_reflow_model), 0);
-
- return ERM_CLASS (e_reflow_model)->height (e_reflow_model, n, parent);
-}
-
-/**
- * e_reflow_model_incarnate:
- * @e_reflow_model: The e-reflow-model to operate on
- * @n: The item to create.
- * @parent: The parent GnomeCanvasItem to create a child of.
- *
- * Create a GnomeCanvasItem to represent the nth piece of data.
- *
- * Returns: the new GnomeCanvasItem.
- */
-GnomeCanvasItem *
-e_reflow_model_incarnate (EReflowModel *e_reflow_model, int n, GnomeCanvasGroup *parent)
-{
- g_return_val_if_fail (e_reflow_model != NULL, NULL);
- g_return_val_if_fail (E_IS_REFLOW_MODEL (e_reflow_model), NULL);
-
- return ERM_CLASS (e_reflow_model)->incarnate (e_reflow_model, n, parent);
-}
-
-/**
- * e_reflow_model_compare:
- * @e_reflow_model: The e-reflow-model to operate on
- * @n1: The first item to compare
- * @n2: The second item to compare
- *
- * Compares item n1 and item n2 to see which should come first.
- *
- * Returns: strcmp like semantics for the comparison value.
- */
-int
-e_reflow_model_compare (EReflowModel *e_reflow_model, int n1, int n2)
-{
-#if 0
- g_return_val_if_fail (e_reflow_model != NULL, 0);
- g_return_val_if_fail (E_IS_REFLOW_MODEL (e_reflow_model), 0);
-#endif
-
- return ERM_CLASS (e_reflow_model)->compare (e_reflow_model, n1, n2);
-}
-
-/**
- * e_reflow_model_reincarnate:
- * @e_reflow_model: The e-reflow-model to operate on
- * @n: The item to create.
- * @item: The item to reuse.
- *
- * Update item to represent the nth piece of data.
- */
-void
-e_reflow_model_reincarnate (EReflowModel *e_reflow_model, int n, GnomeCanvasItem *item)
-{
- g_return_if_fail (e_reflow_model != NULL);
- g_return_if_fail (E_IS_REFLOW_MODEL (e_reflow_model));
-
- ERM_CLASS (e_reflow_model)->reincarnate (e_reflow_model, n, item);
-}
-
-static void
-e_reflow_model_class_init (GtkObjectClass *object_class)
-{
- EReflowModelClass *klass = E_REFLOW_MODEL_CLASS(object_class);
- e_reflow_model_parent_class = gtk_type_class (PARENT_TYPE);
-
- e_reflow_model_signals [MODEL_CHANGED] =
- gtk_signal_new ("model_changed",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (EReflowModelClass, model_changed),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- e_reflow_model_signals [MODEL_ITEMS_INSERTED] =
- gtk_signal_new ("model_items_inserted",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (EReflowModelClass, model_items_inserted),
- gtk_marshal_NONE__INT_INT,
- GTK_TYPE_NONE, 2, GTK_TYPE_INT, GTK_TYPE_INT);
-
- e_reflow_model_signals [MODEL_ITEM_CHANGED] =
- gtk_signal_new ("model_item_changed",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (EReflowModelClass, model_item_changed),
- gtk_marshal_NONE__INT,
- GTK_TYPE_NONE, 1, GTK_TYPE_INT);
-
- E_OBJECT_CLASS_ADD_SIGNALS (object_class, e_reflow_model_signals, LAST_SIGNAL);
-
- klass->set_width = NULL;
- klass->count = NULL;
- klass->height = NULL;
- klass->incarnate = NULL;
- klass->reincarnate = NULL;
-
- klass->model_changed = NULL;
- klass->model_items_inserted = NULL;
- klass->model_item_changed = NULL;
-}
-
-
-guint
-e_reflow_model_get_type (void)
-{
- static guint type = 0;
-
- if (!type)
- {
- GtkTypeInfo info =
- {
- "EReflowModel",
- sizeof (EReflowModel),
- sizeof (EReflowModelClass),
- (GtkClassInitFunc) e_reflow_model_class_init,
- NULL,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- type = gtk_type_unique (PARENT_TYPE, &info);
- }
-
- return type;
-}
-
-#if d(!)0
-static void
-print_tabs (void)
-{
- int i;
- for (i = 0; i < depth; i++)
- g_print("\t");
-}
-#endif
-
-/**
- * e_reflow_model_changed:
- * @e_reflow_model: the reflow model to notify of the change
- *
- * Use this function to notify any views of this reflow model that
- * the contents of the reflow model have changed. This will emit
- * the signal "model_changed" on the @e_reflow_model object.
- *
- * It is preferable to use the e_reflow_model_item_changed() signal to
- * notify of smaller changes than to invalidate the entire model, as
- * the views might have ways of caching the information they render
- * from the model.
- */
-void
-e_reflow_model_changed (EReflowModel *e_reflow_model)
-{
- g_return_if_fail (e_reflow_model != NULL);
- g_return_if_fail (E_IS_REFLOW_MODEL (e_reflow_model));
-
- d(print_tabs());
- d(g_print("Emitting model_changed on model 0x%p.\n", e_reflow_model));
- d(depth++);
- gtk_signal_emit (GTK_OBJECT (e_reflow_model),
- e_reflow_model_signals [MODEL_CHANGED]);
- d(depth--);
-}
-
-/**
- * e_reflow_model_items_inserted:
- * @e_reflow_model: The model changed.
- * @position: The position the items were insert in.
- * @count: The number of items inserted.
- *
- * Use this function to notify any views of the reflow model that a number of items have been inserted.
- **/
-void
-e_reflow_model_items_inserted (EReflowModel *e_reflow_model, int position, int count)
-{
- g_return_if_fail (e_reflow_model != NULL);
- g_return_if_fail (E_IS_REFLOW_MODEL (e_reflow_model));
-
- d(print_tabs());
- d(g_print("Emitting items_inserted on model 0x%p, position=%d, count=%d.\n", e_reflow_model, position, count));
- d(depth++);
- gtk_signal_emit (GTK_OBJECT (e_reflow_model),
- e_reflow_model_signals [MODEL_ITEMS_INSERTED], position, count);
- d(depth--);
-}
-
-/**
- * e_reflow_model_item_changed:
- * @e_reflow_model: the reflow model to notify of the change
- * @item: the item that was changed in the model.
- *
- * Use this function to notify any views of the reflow model that the
- * contents of item @item have changed in model such that the height
- * has changed or the item needs to be reincarnated. This function
- * will emit the "model_item_changed" signal on the @e_reflow_model
- * object
- */
-void
-e_reflow_model_item_changed (EReflowModel *e_reflow_model, int n)
-{
- g_return_if_fail (e_reflow_model != NULL);
- g_return_if_fail (E_IS_REFLOW_MODEL (e_reflow_model));
-
- d(print_tabs());
- d(g_print("Emitting item_changed on model 0x%p, n=%d.\n", e_reflow_model, n));
- d(depth++);
- gtk_signal_emit (GTK_OBJECT (e_reflow_model),
- e_reflow_model_signals [MODEL_ITEM_CHANGED], n);
- d(depth--);
-}
diff --git a/widgets/misc/e-reflow-model.h b/widgets/misc/e-reflow-model.h
deleted file mode 100644
index 512c4587e3..0000000000
--- a/widgets/misc/e-reflow-model.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-reflow-model.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_REFLOW_MODEL_H_
-#define _E_REFLOW_MODEL_H_
-
-#include <gtk/gtkobject.h>
-#include <libgnomeui/gnome-canvas.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#define E_REFLOW_MODEL_TYPE (e_reflow_model_get_type ())
-#define E_REFLOW_MODEL(o) (GTK_CHECK_CAST ((o), E_REFLOW_MODEL_TYPE, EReflowModel))
-#define E_REFLOW_MODEL_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_REFLOW_MODEL_TYPE, EReflowModelClass))
-#define E_IS_REFLOW_MODEL(o) (GTK_CHECK_TYPE ((o), E_REFLOW_MODEL_TYPE))
-#define E_IS_REFLOW_MODEL_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_REFLOW_MODEL_TYPE))
-
-typedef struct {
- GtkObject base;
-} EReflowModel;
-
-typedef struct {
- GtkObjectClass parent_class;
-
- /*
- * Virtual methods
- */
- void (*set_width) (EReflowModel *etm, int width);
-
- int (*count) (EReflowModel *etm);
- int (*height) (EReflowModel *etm, int n, GnomeCanvasGroup *parent);
- GnomeCanvasItem *(*incarnate) (EReflowModel *etm, int n, GnomeCanvasGroup *parent);
- int (*compare) (EReflowModel *etm, int n1, int n2);
- void (*reincarnate) (EReflowModel *etm, int n, GnomeCanvasItem *item);
-
- /*
- * Signals
- */
-
- /*
- * These all come after the change has been made.
- * Major structural changes: model_changed
- * Changes only in an item: item_changed
- */
- void (*model_changed) (EReflowModel *etm);
- void (*model_items_inserted) (EReflowModel *etm, int position, int count);
- void (*model_item_changed) (EReflowModel *etm, int n);
-} EReflowModelClass;
-
-GtkType e_reflow_model_get_type (void);
-
-/**/
-void e_reflow_model_set_width (EReflowModel *e_reflow_model,
- int width);
-int e_reflow_model_count (EReflowModel *e_reflow_model);
-int e_reflow_model_height (EReflowModel *e_reflow_model,
- int n,
- GnomeCanvasGroup *parent);
-GnomeCanvasItem *e_reflow_model_incarnate (EReflowModel *e_reflow_model,
- int n,
- GnomeCanvasGroup *parent);
-int e_reflow_model_compare (EReflowModel *e_reflow_model,
- int n1,
- int n2);
-void e_reflow_model_reincarnate (EReflowModel *e_reflow_model,
- int n,
- GnomeCanvasItem *item);
-
-/*
- * Routines for emitting signals on the e_reflow
- */
-void e_reflow_model_changed (EReflowModel *e_reflow_model);
-void e_reflow_model_items_inserted (EReflowModel *e_reflow_model,
- int position,
- int count);
-void e_reflow_model_item_changed (EReflowModel *e_reflow_model,
- int n);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _E_REFLOW_MODEL_H_ */
diff --git a/widgets/misc/e-reflow.c b/widgets/misc/e-reflow.c
deleted file mode 100644
index f628dec126..0000000000
--- a/widgets/misc/e-reflow.c
+++ /dev/null
@@ -1,1378 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-reflow.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-
-#include "e-reflow.h"
-
-#include <math.h>
-#include <gdk/gdkkeysyms.h>
-#include "e-canvas-utils.h"
-#include "e-canvas.h"
-#include "gal/e-text/e-text.h"
-#include "gal/util/e-util.h"
-#include "gal/widgets/e-unicode.h"
-#include <gtk/gtksignal.h>
-#include "e-selection-model-simple.h"
-
-#include <string.h>
-
-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 e_reflow_reflow (GnomeCanvasItem *item, int flags);
-static void set_empty(EReflow *reflow);
-
-static void e_reflow_resize_children (GnomeCanvasItem *item);
-
-#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;
-
-/* The arguments we take */
-enum {
- ARG_0,
- ARG_MINIMUM_WIDTH,
- ARG_WIDTH,
- ARG_HEIGHT,
- ARG_EMPTY_MESSAGE,
- ARG_MODEL,
- ARG_COLUMN_WIDTH,
-};
-
-enum {
- SELECTION_EVENT,
- COLUMN_WIDTH_CHANGED,
- LAST_SIGNAL
-};
-
-static guint signals [LAST_SIGNAL] = {0, };
-
-static gint
-er_compare (int i1, int i2, gpointer user_data)
-{
- EReflow *reflow = user_data;
- return e_reflow_model_compare (reflow->model, i1, i2);
-}
-
-static gint
-e_reflow_pick_line (EReflow *reflow, double x)
-{
- x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH;
- x /= reflow->column_width + E_REFLOW_FULL_GUTTER;
- return x;
-}
-
-static int
-er_find_item (EReflow *reflow, GnomeCanvasItem *item)
-{
- int i;
- for (i = 0; i < reflow->count; i++) {
- if (reflow->items[i] == item)
- return i;
- }
- return -1;
-}
-
-static void
-e_reflow_resize_children (GnomeCanvasItem *item)
-{
- EReflow *reflow;
- int i;
- int count;
-
- reflow = E_REFLOW (item);
-
- count = reflow->count;
- for (i = 0; i < count; i++) {
- if (reflow->items[i])
- gnome_canvas_item_set(reflow->items[i],
- "width", (double) reflow->column_width,
- NULL);
- }
-}
-
-static inline void
-e_reflow_update_selection_row (EReflow *reflow, int row)
-{
- if (reflow->items[row]) {
- gtk_object_set(GTK_OBJECT(reflow->items[row]),
- "selected", e_selection_model_is_row_selected(E_SELECTION_MODEL(reflow->selection), row),
- NULL);
- } else if (e_selection_model_is_row_selected (E_SELECTION_MODEL (reflow->selection), row)) {
- reflow->items[row] = e_reflow_model_incarnate (reflow->model, row, GNOME_CANVAS_GROUP (reflow));
- gtk_object_set (GTK_OBJECT (reflow->items[row]),
- "selected", e_selection_model_is_row_selected(E_SELECTION_MODEL(reflow->selection), row),
- "width", (double) reflow->column_width,
- NULL);
- }
-}
-
-static void
-e_reflow_update_selection (EReflow *reflow)
-{
- int i;
- int count;
-
- count = reflow->count;
- for (i = 0; i < count; i++) {
- e_reflow_update_selection_row (reflow, i);
- }
-}
-
-static void
-selection_changed (ESelectionModel *selection, EReflow *reflow)
-{
- e_reflow_update_selection (reflow);
-}
-
-static void
-selection_row_changed (ESelectionModel *selection, int row, EReflow *reflow)
-{
- e_reflow_update_selection_row (reflow, row);
-}
-
-static void
-cursor_changed (ESelectionModel *selection, int row, int col, EReflow *reflow)
-{
- int count = reflow->count;
- int old_cursor = reflow->cursor_row;
-
- if (old_cursor < count && old_cursor >= 0) {
- if (reflow->items[old_cursor]) {
- gtk_object_set (GTK_OBJECT (reflow->items[old_cursor]),
- "has_cursor", FALSE,
- NULL);
- }
- }
-
- reflow->cursor_row = row;
-
- if (row < count && row >= 0) {
- if (reflow->items[row]) {
- gtk_object_set (GTK_OBJECT (reflow->items[row]),
- "has_cursor", TRUE,
- NULL);
- } else {
- reflow->items[row] = e_reflow_model_incarnate (reflow->model, row, GNOME_CANVAS_GROUP (reflow));
- gtk_object_set (GTK_OBJECT (reflow->items[row]),
- "has_cursor", TRUE,
- "width", (double) reflow->column_width,
- NULL);
- }
- }
-}
-
-static void
-incarnate (EReflow *reflow)
-{
- int column_width;
- int first_column;
- int last_column;
- int first_cell;
- int last_cell;
- int i;
- GtkAdjustment *adjustment = gtk_layout_get_hadjustment (GTK_LAYOUT (GNOME_CANVAS_ITEM (reflow)->canvas));
-
- column_width = reflow->column_width;
-
- first_column = adjustment->value - 1 + E_REFLOW_BORDER_WIDTH;
- first_column /= column_width + E_REFLOW_FULL_GUTTER;
-
- last_column = adjustment->value + adjustment->page_size + 1 - E_REFLOW_BORDER_WIDTH - E_REFLOW_DIVIDER_WIDTH;
- last_column /= column_width + E_REFLOW_FULL_GUTTER;
- last_column ++;
-
- if (first_column >= 0 && first_column < reflow->column_count)
- first_cell = reflow->columns[first_column];
- else
- first_cell = 0;
-
- if (last_column >= 0 && last_column < reflow->column_count)
- last_cell = reflow->columns[last_column];
- else
- last_cell = reflow->count;
-
- for (i = first_cell; i < last_cell; i++) {
- int unsorted = e_sorter_sorted_to_model (E_SORTER (reflow->sorter), i);
- if (reflow->items[unsorted] == NULL) {
- if (reflow->model) {
- reflow->items[unsorted] = e_reflow_model_incarnate (reflow->model, unsorted, GNOME_CANVAS_GROUP (reflow));
- gtk_object_set (GTK_OBJECT (reflow->items[unsorted]),
- "selected", e_selection_model_is_row_selected(E_SELECTION_MODEL(reflow->selection), unsorted),
- "width", (double) reflow->column_width,
- NULL);
- }
- }
- }
- reflow->incarnate_idle_id = 0;
-}
-
-static gboolean
-invoke_incarnate (gpointer user_data)
-{
- EReflow *reflow = user_data;
- incarnate (reflow);
- return FALSE;
-}
-
-static void
-queue_incarnate (EReflow *reflow)
-{
- if (reflow->incarnate_idle_id == 0)
- reflow->incarnate_idle_id =
- g_idle_add_full (25, invoke_incarnate, reflow, NULL);
-}
-
-static void
-reflow_columns (EReflow *reflow)
-{
- GSList *list;
- int count;
- int i;
- int column_count;
- double running_height;
-
- g_free (reflow->columns);
- reflow->column_count = 0;
- reflow->columns = NULL;
-
- list = NULL;
-
- running_height = E_REFLOW_BORDER_WIDTH;
- column_count = 1;
-
- count = reflow->count;
- for (i = 0; i < count; i++) {
- int unsorted = e_sorter_sorted_to_model (E_SORTER (reflow->sorter), i);
- if (reflow->heights[unsorted] == -1) {
- if (reflow->model)
- reflow->heights[unsorted] = e_reflow_model_height (reflow->model, unsorted, GNOME_CANVAS_GROUP (reflow));
- else
- reflow->heights[unsorted] = 0;
- }
- if (i != 0 && running_height + reflow->heights[unsorted] + E_REFLOW_BORDER_WIDTH > reflow->height) {
- list = g_slist_prepend (list, GINT_TO_POINTER(i));
- column_count ++;
- running_height = E_REFLOW_BORDER_WIDTH * 2 + reflow->heights[unsorted];
- } else
- running_height += reflow->heights[unsorted] + E_REFLOW_BORDER_WIDTH;
- }
-
- reflow->column_count = column_count;
- reflow->columns = g_new (int, column_count);
- column_count --;
- for (; column_count > 0; column_count--) {
- GSList *to_free;
- reflow->columns[column_count] = GPOINTER_TO_INT(list->data);
- to_free = list;
- list = list->next;
- g_slist_free_1 (to_free);
- }
- reflow->columns[0] = 0;
-
- queue_incarnate (reflow);
-
- reflow->need_reflow_columns = FALSE;
-}
-
-static void
-item_changed (EReflowModel *model, int i, EReflow *reflow)
-{
- if (i < 0 || i >= reflow->count)
- return;
-
- reflow->heights[i] = -1;
- if (reflow->items[i] != NULL)
- e_reflow_model_reincarnate (model, i, reflow->items[i]);
- e_sorter_array_clean (reflow->sorter);
- reflow->need_reflow_columns = TRUE;
- e_canvas_item_request_reflow(GNOME_CANVAS_ITEM (reflow));
-}
-
-static void
-items_inserted (EReflowModel *model, int position, int count, EReflow *reflow)
-{
- int i;
- int oldcount;
- if (position < 0 || position > reflow->count)
- return;
-
- oldcount = reflow->count;
-
- reflow->count += count;
-
- if (reflow->count > reflow->allocated_count) {
- while (reflow->count > reflow->allocated_count)
- reflow->allocated_count += 256;
- reflow->heights = g_renew (int, reflow->heights, reflow->allocated_count);
- reflow->items = g_renew (GnomeCanvasItem *, reflow->items, reflow->allocated_count);
- }
- memmove (reflow->heights + position + count, reflow->heights + position, (reflow->count - position - count) * sizeof (int));
- memmove (reflow->items + position + count, reflow->items + position, (reflow->count - position - count) * sizeof (GnomeCanvasItem *));
- for (i = position; i < position + count; i++) {
- reflow->items[i] = 0;
- reflow->heights[i] = -1;
- }
-
- e_selection_model_simple_set_row_count (E_SELECTION_MODEL_SIMPLE (reflow->selection), reflow->count);
- if (position == oldcount)
- e_sorter_array_append (reflow->sorter, count);
- else
- e_sorter_array_set_count (reflow->sorter, reflow->count);
- reflow->need_reflow_columns = TRUE;
- set_empty (reflow);
- e_canvas_item_request_reflow(GNOME_CANVAS_ITEM (reflow));
-}
-
-static void
-model_changed (EReflowModel *model, EReflow *reflow)
-{
- int i;
- int count;
- int oldcount;
-
- count = reflow->count;
- oldcount = count;
-
- for (i = 0; i < count; i++) {
- if (reflow->items[i])
- gtk_object_destroy (GTK_OBJECT (reflow->items[i]));
- }
- g_free (reflow->items);
- g_free (reflow->heights);
- reflow->count = e_reflow_model_count (model);
- reflow->allocated_count = reflow->count;
- reflow->items = g_new (GnomeCanvasItem *, reflow->count);
- reflow->heights = g_new (int, reflow->count);
-
- count = reflow->count;
- for (i = 0; i < count; i++) {
- reflow->items[i] = 0;
- reflow->heights[i] = -1;
- }
-
- e_selection_model_simple_set_row_count (E_SELECTION_MODEL_SIMPLE (reflow->selection), count);
- e_sorter_array_set_count (reflow->sorter, reflow->count);
-
- reflow->need_reflow_columns = TRUE;
- if (oldcount > reflow->count)
- reflow_columns (reflow);
- set_empty (reflow);
- e_canvas_item_request_reflow(GNOME_CANVAS_ITEM (reflow));
-}
-
-static void
-set_empty(EReflow *reflow)
-{
- if (reflow->count == 0) {
- if (reflow->empty_text) {
- if (reflow->empty_message) {
- char *empty_message = e_utf8_to_gtk_string (GTK_WIDGET (GNOME_CANVAS_ITEM (reflow)->canvas), reflow->empty_message);
- gnome_canvas_item_set(reflow->empty_text,
- "width", reflow->minimum_width,
- "text", empty_message,
- NULL);
- e_canvas_item_move_absolute(reflow->empty_text,
- reflow->minimum_width / 2,
- 0);
- g_free (empty_message);
- } else {
- gtk_object_destroy(GTK_OBJECT(reflow->empty_text));
- reflow->empty_text = NULL;
- }
- } else {
- if (reflow->empty_message) {
- char *empty_message = e_utf8_to_gtk_string (GTK_WIDGET (GNOME_CANVAS_ITEM (reflow)->canvas), reflow->empty_message);
- reflow->empty_text =
- gnome_canvas_item_new(GNOME_CANVAS_GROUP(reflow),
- e_text_get_type(),
- "anchor", GTK_ANCHOR_N,
- "width", reflow->minimum_width,
- "clip", TRUE,
- "use_ellipsis", TRUE,
- "font_gdk", GTK_WIDGET(GNOME_CANVAS_ITEM(reflow)->canvas)->style->font,
- "fill_color", "black",
- "justification", GTK_JUSTIFY_CENTER,
- "text", empty_message,
- "draw_background", FALSE,
- NULL);
- g_free (empty_message);
- e_canvas_item_move_absolute(reflow->empty_text,
- reflow->minimum_width / 2,
- 0);
- }
- }
- } else {
- if (reflow->empty_text) {
- gtk_object_destroy(GTK_OBJECT(reflow->empty_text));
- reflow->empty_text = NULL;
- }
- }
-}
-
-static void
-disconnect_model (EReflow *reflow)
-{
- if (reflow->model == NULL)
- return;
-
- gtk_signal_disconnect (GTK_OBJECT (reflow->model),
- reflow->model_changed_id);
- gtk_signal_disconnect (GTK_OBJECT (reflow->model),
- reflow->model_items_inserted_id);
- gtk_signal_disconnect (GTK_OBJECT (reflow->model),
- reflow->model_item_changed_id);
- gtk_object_unref (GTK_OBJECT (reflow->model));
-
- reflow->model_changed_id = 0;
- reflow->model_items_inserted_id = 0;
- reflow->model_item_changed_id = 0;
- reflow->model = NULL;
-}
-
-static void
-disconnect_selection (EReflow *reflow)
-{
- if (reflow->selection == NULL)
- return;
-
- gtk_signal_disconnect (GTK_OBJECT (reflow->selection),
- reflow->selection_changed_id);
- gtk_signal_disconnect (GTK_OBJECT (reflow->selection),
- reflow->selection_row_changed_id);
- gtk_signal_disconnect (GTK_OBJECT (reflow->selection),
- reflow->cursor_changed_id);
- gtk_object_unref (GTK_OBJECT (reflow->selection));
-
- reflow->selection_changed_id = 0;
- reflow->selection_row_changed_id = 0;
- reflow->cursor_changed_id = 0;
- reflow->selection = NULL;
-}
-
-static void
-connect_model (EReflow *reflow, EReflowModel *model)
-{
- if (reflow->model != NULL)
- disconnect_model (reflow);
-
- if (model == NULL)
- return;
-
- reflow->model = model;
- gtk_object_ref (GTK_OBJECT (reflow->model));
- reflow->model_changed_id =
- gtk_signal_connect (GTK_OBJECT (reflow->model), "model_changed",
- GTK_SIGNAL_FUNC (model_changed), reflow);
- reflow->model_items_inserted_id =
- gtk_signal_connect (GTK_OBJECT (reflow->model), "model_items_inserted",
- GTK_SIGNAL_FUNC (items_inserted), reflow);
- reflow->model_item_changed_id =
- gtk_signal_connect (GTK_OBJECT (reflow->model), "model_item_changed",
- GTK_SIGNAL_FUNC (item_changed), reflow);
- model_changed (model, reflow);
-}
-
-static void
-adjustment_changed (GtkAdjustment *adjustment, EReflow *reflow)
-{
- incarnate (reflow);
-}
-
-static void
-disconnect_adjustment (EReflow *reflow)
-{
- if (reflow->adjustment == NULL)
- return;
-
- gtk_signal_disconnect (GTK_OBJECT (reflow->adjustment),
- reflow->adjustment_changed_id);
- gtk_signal_disconnect (GTK_OBJECT (reflow->adjustment),
- reflow->adjustment_value_changed_id);
-
- gtk_object_unref (GTK_OBJECT (reflow->adjustment));
-
- reflow->adjustment_changed_id = 0;
- reflow->adjustment_value_changed_id = 0;
- reflow->adjustment = NULL;
-}
-
-static void
-connect_adjustment (EReflow *reflow, GtkAdjustment *adjustment)
-{
- if (reflow->adjustment != NULL)
- disconnect_adjustment (reflow);
-
- if (adjustment == NULL)
- return;
-
- reflow->adjustment = adjustment;
- reflow->adjustment_changed_id =
- gtk_signal_connect (GTK_OBJECT (adjustment), "changed",
- adjustment_changed, reflow);
- reflow->adjustment_value_changed_id =
- gtk_signal_connect (GTK_OBJECT (adjustment), "value_changed",
- adjustment_changed, reflow);
- gtk_object_ref (GTK_OBJECT (adjustment));
-}
-
-#if 0
-static void
-set_scroll_adjustments (GtkLayout *layout, GtkAdjustment *hadj, GtkAdjustment *vadj, EReflow *reflow)
-{
- connect_adjustment (reflow, hadj);
-}
-
-static void
-connect_set_adjustment (EReflow *reflow)
-{
- reflow->set_scroll_adjustments_id =
- gtk_signal_connect (GTK_OBJECT (GNOME_CANVAS_ITEM (reflow)->canvas),
- "set_scroll_adjustments",
- GTK_SIGNAL_FUNC (set_scroll_adjustments), reflow);
-}
-#endif
-
-static void
-disconnect_set_adjustment (EReflow *reflow)
-{
- if (reflow->set_scroll_adjustments_id != 0) {
- gtk_signal_disconnect (GTK_OBJECT (GNOME_CANVAS_ITEM (reflow)->canvas),
- reflow->set_scroll_adjustments_id);
- reflow->set_scroll_adjustments_id = 0;
- }
-}
-
-static void
-column_width_changed (EReflow *reflow)
-{
- gtk_signal_emit (GTK_OBJECT (reflow), signals[COLUMN_WIDTH_CHANGED], reflow->column_width);
-}
-
-
-
-
-/* Virtual functions */
-static void
-e_reflow_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- GnomeCanvasItem *item;
- EReflow *reflow;
-
- item = GNOME_CANVAS_ITEM (o);
- reflow = E_REFLOW (o);
-
- switch (arg_id){
- case ARG_HEIGHT:
- reflow->height = GTK_VALUE_DOUBLE (*arg);
- reflow->need_reflow_columns = TRUE;
- e_canvas_item_request_reflow(item);
- break;
- case ARG_MINIMUM_WIDTH:
- reflow->minimum_width = GTK_VALUE_DOUBLE (*arg);
- if (GNOME_CANVAS_ITEM_REALIZED & GTK_OBJECT_FLAGS(o))
- set_empty(reflow);
- e_canvas_item_request_reflow(item);
- break;
- case ARG_EMPTY_MESSAGE:
- g_free(reflow->empty_message);
- reflow->empty_message = g_strdup(GTK_VALUE_STRING (*arg));
- if (GNOME_CANVAS_ITEM_REALIZED & GTK_OBJECT_FLAGS(o))
- set_empty(reflow);
- break;
- case ARG_MODEL:
- connect_model (reflow, (EReflowModel *) GTK_VALUE_OBJECT (*arg));
- break;
- case ARG_COLUMN_WIDTH:
- if (reflow->column_width != GTK_VALUE_INT (*arg)) {
- GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas));
- double old_width = reflow->column_width;
-
- reflow->column_width = GTK_VALUE_INT (*arg);
- adjustment->step_increment = (reflow->column_width + E_REFLOW_FULL_GUTTER) / 2;
- adjustment->page_increment = adjustment->page_size - adjustment->step_increment;
- gtk_adjustment_changed(adjustment);
- e_reflow_resize_children(item);
- e_canvas_item_request_reflow(item);
-
- reflow->need_column_resize = TRUE;
- gnome_canvas_item_request_update(item);
-
- if (old_width != reflow->column_width)
- column_width_changed (reflow);
- }
- break;
- }
-}
-
-static void
-e_reflow_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- EReflow *reflow;
-
- reflow = E_REFLOW (object);
-
- switch (arg_id) {
- case ARG_MINIMUM_WIDTH:
- GTK_VALUE_DOUBLE (*arg) = reflow->minimum_width;
- break;
- case ARG_WIDTH:
- GTK_VALUE_DOUBLE (*arg) = reflow->width;
- break;
- case ARG_HEIGHT:
- GTK_VALUE_DOUBLE (*arg) = reflow->height;
- break;
- case ARG_EMPTY_MESSAGE:
- GTK_VALUE_STRING (*arg) = g_strdup(reflow->empty_message);
- break;
- case ARG_MODEL:
- GTK_VALUE_OBJECT (*arg) = (GtkObject *) reflow->model;
- break;
- case ARG_COLUMN_WIDTH:
- GTK_VALUE_INT (*arg) = reflow->column_width;
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-static void
-e_reflow_destroy (GtkObject *object)
-{
- EReflow *reflow = E_REFLOW(object);
-
- g_free (reflow->items);
- g_free (reflow->heights);
- g_free (reflow->columns);
-
- reflow->items = NULL;
- reflow->heights = NULL;
- reflow->columns = NULL;
- reflow->count = 0;
- reflow->allocated_count = 0;
-
- if (reflow->incarnate_idle_id != 0)
- g_source_remove (reflow->incarnate_idle_id);
-
- disconnect_model (reflow);
- disconnect_selection (reflow);
-
- g_free(reflow->empty_message);
-
- GTK_OBJECT_CLASS(parent_class)->destroy (object);
-}
-
-static void
-e_reflow_realize (GnomeCanvasItem *item)
-{
- EReflow *reflow;
- GnomeCanvasGroup *group;
- GtkAdjustment *adjustment;
- int count;
- int i;
-
- 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);
-
- reflow->arrow_cursor = gdk_cursor_new (GDK_SB_H_DOUBLE_ARROW);
- reflow->default_cursor = gdk_cursor_new (GDK_LEFT_PTR);
-
- count = reflow->count;
- for(i = 0; i < count; i++) {
- if (reflow->items[i])
- gnome_canvas_item_set(reflow->items[i],
- "width", (double) reflow->column_width,
- NULL);
- }
-
- set_empty(reflow);
-
- reflow->need_reflow_columns = TRUE;
- e_canvas_item_request_reflow(item);
-
- adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas));
-
-#if 0
- connect_set_adjustment (reflow);
-#endif
- connect_adjustment (reflow, adjustment);
-
- adjustment->step_increment = (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 *reflow;
-
- reflow = E_REFLOW (item);
-
- if (!item->canvas->aa) {
- }
-
- gdk_cursor_destroy (reflow->arrow_cursor);
- gdk_cursor_destroy (reflow->default_cursor);
- reflow->arrow_cursor = NULL;
- reflow->default_cursor = NULL;
-
- g_free (reflow->columns);
- reflow->columns = NULL;
-
- disconnect_set_adjustment (reflow);
- disconnect_adjustment (reflow);
-
- if (GNOME_CANVAS_ITEM_CLASS(parent_class)->unrealize)
- (* GNOME_CANVAS_ITEM_CLASS(parent_class)->unrealize) (item);
-}
-
-static gboolean
-e_reflow_event (GnomeCanvasItem *item, GdkEvent *event)
-{
- EReflow *reflow;
- int return_val = FALSE;
-
- reflow = E_REFLOW (item);
-
- switch( event->type )
- {
- case GDK_KEY_PRESS:
- return_val = e_selection_model_key_press(reflow->selection, (GdkEventKey *) event);
- break;
-#if 0
- if (event->key.keyval == GDK_Tab ||
- event->key.keyval == GDK_KP_Tab ||
- event->key.keyval == GDK_ISO_Left_Tab) {
- int i;
- int count;
- count = reflow->count;
- for (i = 0; i < count; i++) {
- int unsorted = e_sorter_sorted_to_model (E_SORTER (reflow->sorter), i);
- GnomeCanvasItem *item = reflow->items[unsorted];
- EFocus has_focus;
- if (item) {
- gtk_object_get(GTK_OBJECT(item),
- "has_focus", &has_focus,
- NULL);
- if (has_focus) {
- if (event->key.state & GDK_SHIFT_MASK) {
- if (i == 0)
- return 0;
- i--;
- } else {
- if (i == count - 1)
- return 0;
- i++;
- }
-
- unsorted = e_sorter_sorted_to_model (E_SORTER (reflow->sorter), i);
- if (reflow->items[unsorted] == NULL) {
- reflow->items[unsorted] = e_reflow_model_incarnate (reflow->model, unsorted, GNOME_CANVAS_GROUP (reflow));
- }
-
- item = reflow->items[unsorted];
- gnome_canvas_item_set(item,
- "has_focus", (event->key.state & GDK_SHIFT_MASK) ? E_FOCUS_END : E_FOCUS_START,
- NULL);
- return 1;
- }
- }
- }
- }
-#endif
- break;
- case GDK_BUTTON_PRESS:
- switch(event->button.button)
- {
- case 1:
- {
- GdkEventButton *button = (GdkEventButton *) event;
- double n_x, max_x;
- n_x = button->x;
- n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH;
- n_x = fmod(n_x,(reflow->column_width + E_REFLOW_FULL_GUTTER));
-
- max_x = E_REFLOW_BORDER_WIDTH;
- max_x += (reflow->column_width + E_REFLOW_FULL_GUTTER) * reflow->column_count;
- if ( button->y >= E_REFLOW_BORDER_WIDTH && button->y <= reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER && max_x > button->x ) {
- reflow->which_column_dragged = e_reflow_pick_line(reflow, button->x);
- reflow->start_x = reflow->which_column_dragged * (reflow->column_width + E_REFLOW_FULL_GUTTER) - E_REFLOW_DIVIDER_WIDTH / 2;
- reflow->temp_column_width = reflow->column_width;
- reflow->column_drag = TRUE;
-
- gnome_canvas_item_grab (item,
- GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK,
- reflow->arrow_cursor,
- button->time);
-
- reflow->previous_temp_column_width = -1;
- 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 (reflow->column_drag) {
- gdouble old_width = reflow->column_width;
- GdkEventButton *button = (GdkEventButton *) event;
- GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas));
- reflow->temp_column_width = reflow->column_width +
- (button->x - reflow->start_x)/(reflow->which_column_dragged - e_reflow_pick_line(reflow, adjustment->value));
- if ( reflow->temp_column_width < 50 )
- reflow->temp_column_width = 50;
- reflow->column_drag = FALSE;
- if ( old_width != reflow->temp_column_width ) {
- gtk_adjustment_set_value(adjustment, adjustment->value + e_reflow_pick_line(reflow, adjustment->value) * (reflow->temp_column_width - reflow->column_width));
- reflow->column_width = reflow->temp_column_width;
- adjustment->step_increment = (reflow->column_width + E_REFLOW_FULL_GUTTER) / 2;
- adjustment->page_increment = adjustment->page_size - adjustment->step_increment;
- gtk_adjustment_changed(adjustment);
- e_reflow_resize_children(item);
- e_canvas_item_request_reflow(item);
- column_width_changed (reflow);
- }
- 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 (reflow->column_drag) {
- double old_width = reflow->temp_column_width;
- GdkEventMotion *motion = (GdkEventMotion *) event;
- GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas));
- reflow->temp_column_width = reflow->column_width +
- (motion->x - reflow->start_x)/(reflow->which_column_dragged - e_reflow_pick_line(reflow, adjustment->value));
- if (reflow->temp_column_width < 50)
- reflow->temp_column_width = 50;
- if (old_width != reflow->temp_column_width) {
- reflow->need_column_resize = TRUE;
- gnome_canvas_item_request_update(item);
- }
- return TRUE;
- } else {
- GdkEventMotion *motion = (GdkEventMotion *) event;
- double n_x, max_x;
-
- n_x = motion->x;
- n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH;
- n_x = fmod(n_x,(reflow->column_width + E_REFLOW_FULL_GUTTER));
-
- max_x = E_REFLOW_BORDER_WIDTH;
- max_x += (reflow->column_width + E_REFLOW_FULL_GUTTER) * reflow->column_count;
-
- if ( motion->y >= E_REFLOW_BORDER_WIDTH && motion->y <= reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER && max_x > motion->x) {
- if ( reflow->default_cursor_shown ) {
- gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, reflow->arrow_cursor);
- reflow->default_cursor_shown = FALSE;
- }
- } else
- if ( ! reflow->default_cursor_shown ) {
- gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, reflow->default_cursor);
- reflow->default_cursor_shown = TRUE;
- }
-
- }
- break;
- case GDK_ENTER_NOTIFY:
- if (!reflow->column_drag) {
- GdkEventCrossing *crossing = (GdkEventCrossing *) event;
- double n_x, max_x;
- n_x = crossing->x;
- n_x += E_REFLOW_BORDER_WIDTH + E_REFLOW_DIVIDER_WIDTH;
- n_x = fmod(n_x,(reflow->column_width + E_REFLOW_FULL_GUTTER));
-
- max_x = E_REFLOW_BORDER_WIDTH;
- max_x += (reflow->column_width + E_REFLOW_FULL_GUTTER) * reflow->column_count;
- if ( crossing->y >= E_REFLOW_BORDER_WIDTH && crossing->y <= reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER && max_x > crossing->x) {
- if ( reflow->default_cursor_shown ) {
- gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, reflow->arrow_cursor);
- reflow->default_cursor_shown = FALSE;
- }
- }
- }
- break;
- case GDK_LEAVE_NOTIFY:
- if (!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,(reflow->column_width + E_REFLOW_FULL_GUTTER));
- if ( !( crossing->y >= E_REFLOW_BORDER_WIDTH && crossing->y <= reflow->height - E_REFLOW_BORDER_WIDTH && n_x < E_REFLOW_FULL_GUTTER ) ) {
- if ( ! reflow->default_cursor_shown ) {
- gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, reflow->default_cursor);
- reflow->default_cursor_shown = TRUE;
- }
- }
- }
- break;
- default:
- break;
- }
- if (return_val)
- return return_val;
- else if (GNOME_CANVAS_ITEM_CLASS( parent_class )->event)
- return (* GNOME_CANVAS_ITEM_CLASS( parent_class )->event) (item, event);
- else
- return FALSE;
-}
-
-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 *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 = 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 = 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 < 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 (reflow->column_drag) {
- int start_line = e_reflow_pick_line(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 = 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 = 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 < 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 *reflow;
- double x0, x1, y0, y1;
-
- 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 + reflow->width )
- x1 = x0 + reflow->width;
- if ( y1 < y0 + reflow->height )
- y1 = y0 + reflow->height;
- item->x2 = x1;
- item->y2 = y1;
-
- if (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);
- reflow->need_height_update = FALSE;
- } else if (reflow->need_column_resize) {
- int x_rect, y_rect, width_rect, height_rect;
- int start_line = e_reflow_pick_line(reflow,
- gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas))->value);
- gdouble running_width;
- int i;
- double column_width;
-
- if ( reflow->previous_temp_column_width != -1 ) {
- running_width = start_line * (reflow->column_width + E_REFLOW_FULL_GUTTER);
- column_width = 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 = reflow->height - (E_REFLOW_BORDER_WIDTH * 2);
-
- for ( i = 0; i < 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 ( reflow->temp_column_width != -1 ) {
- running_width = start_line * (reflow->column_width + E_REFLOW_FULL_GUTTER);
- column_width = 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 = reflow->height - (E_REFLOW_BORDER_WIDTH * 2);
-
- for ( i = 0; i < 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;
- }
- }
-
- reflow->previous_temp_column_width = reflow->temp_column_width;
- 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;
-
- *actual_item = NULL;
-
- if (GNOME_CANVAS_ITEM_CLASS(parent_class)->point)
- distance = GNOME_CANVAS_ITEM_CLASS(parent_class)->point (item, x, y, cx, cy, actual_item);
- if ((int) (distance * item->canvas->pixels_per_unit + 0.5) <= item->canvas->close_enough && *actual_item)
- return distance;
-
- *actual_item = item;
- return 0;
-#if 0
- if (y >= E_REFLOW_BORDER_WIDTH && y <= 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, (reflow->column_width + E_REFLOW_FULL_GUTTER));
- if (n_x < E_REFLOW_FULL_GUTTER) {
- *actual_item = item;
- return 0;
- }
- }
- return distance;
-#endif
-}
-
-static void
-e_reflow_reflow( GnomeCanvasItem *item, int flags )
-{
- EReflow *reflow = E_REFLOW(item);
- gdouble old_width;
- gdouble running_width;
- gdouble running_height;
- int next_column;
- int i;
-
- if (! (GTK_OBJECT_FLAGS (reflow) & GNOME_CANVAS_ITEM_REALIZED))
- return;
-
- if (reflow->need_reflow_columns) {
- reflow_columns (reflow);
- }
-
- old_width = reflow->width;
-
- running_width = E_REFLOW_BORDER_WIDTH;
- running_height = E_REFLOW_BORDER_WIDTH;
-
- next_column = 1;
-
- for (i = 0; i < reflow->count; i++) {
- int unsorted = e_sorter_sorted_to_model (E_SORTER (reflow->sorter), i);
- if (next_column < reflow->column_count && i == reflow->columns[next_column]) {
- running_height = E_REFLOW_BORDER_WIDTH;
- running_width += reflow->column_width + E_REFLOW_FULL_GUTTER;
- next_column ++;
- }
-
- if (unsorted >= 0 && reflow->items[unsorted]) {
- e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(reflow->items[unsorted]),
- (double) running_width,
- (double) running_height);
- running_height += reflow->heights[unsorted] + E_REFLOW_BORDER_WIDTH;
- }
- }
- reflow->width = running_width + reflow->column_width + E_REFLOW_BORDER_WIDTH;
- if ( reflow->width < reflow->minimum_width )
- reflow->width = reflow->minimum_width;
- if (old_width != reflow->width)
- e_canvas_item_request_parent_reflow(item);
-}
-
-static int
-e_reflow_selection_event_real (EReflow *reflow, GnomeCanvasItem *item, GdkEvent *event)
-{
- int row;
- int return_val = TRUE;
- switch (event->type) {
- case GDK_BUTTON_PRESS:
- switch (event->button.button) {
- case 1: /* Fall through. */
- case 2:
- row = er_find_item (reflow, item);
- e_selection_model_do_something(reflow->selection, row, 0, event->button.state);
- break;
- case 3:
- row = er_find_item (reflow, item);
- e_selection_model_right_click_down(reflow->selection, row, 0, 0);
- break;
- default:
- return_val = FALSE;
- break;
- }
- break;
- case GDK_KEY_PRESS:
- return_val = e_selection_model_key_press(reflow->selection, (GdkEventKey *) event);
- break;
- default:
- return_val = FALSE;
- break;
- }
-
- return return_val;
-}
-
-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 ());
-
- 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);
- gtk_object_add_arg_type ("EReflow::empty_message", GTK_TYPE_STRING,
- GTK_ARG_READWRITE, ARG_EMPTY_MESSAGE);
- gtk_object_add_arg_type ("EReflow::model", E_REFLOW_MODEL_TYPE,
- GTK_ARG_READWRITE, ARG_MODEL);
- gtk_object_add_arg_type ("EReflow::column_width", GTK_TYPE_INT,
- GTK_ARG_READWRITE, ARG_COLUMN_WIDTH);
-
- signals [SELECTION_EVENT] =
- gtk_signal_new ("selection_event",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (EReflowClass, selection_event),
- e_marshal_INT__OBJECT_POINTER,
- GTK_TYPE_INT, 2, GTK_TYPE_OBJECT, GTK_TYPE_GDK_EVENT);
-
- signals [COLUMN_WIDTH_CHANGED] =
- gtk_signal_new ("column_width_changed",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (EReflowClass, column_width_changed),
- e_marshal_NONE__DOUBLE,
- GTK_TYPE_NONE, 1, GTK_TYPE_DOUBLE);
-
- E_OBJECT_CLASS_ADD_SIGNALS (object_class, signals, LAST_SIGNAL);
-
- 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;
-
- klass->selection_event = e_reflow_selection_event_real;
- klass->column_width_changed = NULL;
-}
-
-static void
-e_reflow_init (EReflow *reflow)
-{
- reflow->model = NULL;
- reflow->items = NULL;
- reflow->heights = NULL;
- reflow->count = 0;
-
- reflow->columns = NULL;
- reflow->column_count = 0;
-
- reflow->empty_text = NULL;
- reflow->empty_message = NULL;
-
- reflow->minimum_width = 10;
- reflow->width = 10;
- reflow->height = 10;
-
- reflow->column_width = 150;
-
- 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;
-
- reflow->cursor_row = -1;
-
- reflow->incarnate_idle_id = 0;
- reflow->set_scroll_adjustments_id = 0;
-
- reflow->selection = E_SELECTION_MODEL (e_selection_model_simple_new());
- reflow->sorter = e_sorter_array_new (er_compare, reflow);
-
- gtk_object_set (GTK_OBJECT (reflow->selection),
- "sorter", reflow->sorter,
- NULL);
-
- reflow->selection_changed_id =
- gtk_signal_connect(GTK_OBJECT(reflow->selection), "selection_changed",
- GTK_SIGNAL_FUNC(selection_changed), reflow);
- reflow->selection_row_changed_id =
- gtk_signal_connect(GTK_OBJECT(reflow->selection), "selection_row_changed",
- GTK_SIGNAL_FUNC(selection_row_changed), reflow);
- reflow->cursor_changed_id =
- gtk_signal_connect(GTK_OBJECT(reflow->selection), "cursor_changed",
- GTK_SIGNAL_FUNC(cursor_changed), reflow);
-
- e_canvas_item_set_reflow_callback(GNOME_CANVAS_ITEM(reflow), e_reflow_reflow);
-}
-
-GtkType
-e_reflow_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type) {
- static const GtkTypeInfo info = {
- "EReflow",
- sizeof (EReflow),
- sizeof (EReflowClass),
- (GtkClassInitFunc) e_reflow_class_init,
- (GtkObjectInitFunc) e_reflow_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- type = gtk_type_unique (gnome_canvas_group_get_type (), &info);
- }
-
- return type;
-}
diff --git a/widgets/misc/e-reflow.h b/widgets/misc/e-reflow.h
deleted file mode 100644
index 0aed25945c..0000000000
--- a/widgets/misc/e-reflow.h
+++ /dev/null
@@ -1,139 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-reflow.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef __E_REFLOW_H__
-#define __E_REFLOW_H__
-
-#include <libgnomeui/gnome-canvas.h>
-#include <gal/widgets/e-reflow-model.h>
-#include <gal/widgets/e-selection-model.h>
-#include <gal/util/e-sorter-array.h>
-
-#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 EReflowPriv EReflowPriv;
-
-typedef struct _EReflow EReflow;
-typedef struct _EReflowClass EReflowClass;
-
-struct _EReflow
-{
- GnomeCanvasGroup parent;
-
- /* item specific fields */
- EReflowModel *model;
- guint model_changed_id;
- guint model_items_inserted_id;
- guint model_item_changed_id;
-
- ESelectionModel *selection;
- guint selection_changed_id;
- guint selection_row_changed_id;
- guint cursor_changed_id;
- ESorterArray *sorter;
-
- GtkAdjustment *adjustment;
- guint adjustment_changed_id;
- guint adjustment_value_changed_id;
- guint set_scroll_adjustments_id;
-
- int *heights;
- GnomeCanvasItem **items;
- int count;
- int allocated_count;
-
- int *columns;
- gint column_count; /* Number of columnns */
-
- GnomeCanvasItem *empty_text;
- gchar *empty_message;
-
- double minimum_width;
- double width;
- double height;
-
- double column_width;
-
- int incarnate_idle_id;
-
- /* These are all for when the column is being dragged. */
- gdouble start_x;
- gint which_column_dragged;
- double temp_column_width;
- double previous_temp_column_width;
-
- int cursor_row;
-
- guint column_drag : 1;
-
- guint need_height_update : 1;
- guint need_column_resize : 1;
- guint need_reflow_columns : 1;
-
- guint default_cursor_shown : 1;
- GdkCursor *arrow_cursor;
- GdkCursor *default_cursor;
-};
-
-struct _EReflowClass
-{
- GnomeCanvasGroupClass parent_class;
-
- int (*selection_event) (EReflow *reflow, GnomeCanvasItem *item, GdkEvent *event);
- void (*column_width_changed) (EReflow *reflow, double width);
-};
-
-/*
- * To be added to a reflow, an item must have the argument "width" as
- * a Read/Write argument and "height" as a Read Only argument. It
- * should also do an ECanvas parent reflow request if its size
- * changes.
- */
-GtkType e_reflow_get_type (void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __E_REFLOW_H__ */
diff --git a/widgets/misc/e-search-bar.c b/widgets/misc/e-search-bar.c
index cbf7984f05..c07c98fad2 100644
--- a/widgets/misc/e-search-bar.c
+++ b/widgets/misc/e-search-bar.c
@@ -39,11 +39,8 @@
#include <libgnome/gnome-defs.h>
#include <libgnome/gnome-i18n.h>
-#include <bonobo/bonobo-ui-util.h>
-
-#include <stdlib.h>
-
#include "e-search-bar.h"
+#include "e-dropdown-button.h"
enum {
@@ -97,140 +94,15 @@ emit_menu_activated (ESearchBar *esb, int item)
}
-/* Utility functions. */
-
-static void
-update_sensitivity (ESearchBar *search_bar)
-{
- const char *text;
-
- text = gtk_entry_get_text (GTK_ENTRY (search_bar->entry));
-
- if (text != NULL && text[0] != '\0') {
- if (search_bar->ui_component != NULL)
- bonobo_ui_component_set_prop (search_bar->ui_component,
- "/commands/ESearchBar:FindNow",
- "sensitive", "1", NULL);
- gtk_widget_set_sensitive (search_bar->activate_button, TRUE);
- } else {
- if (search_bar->ui_component != NULL)
- bonobo_ui_component_set_prop (search_bar->ui_component,
- "/commands/ESearchBar:FindNow",
- "sensitive", "0", NULL);
- gtk_widget_set_sensitive (search_bar->activate_button, FALSE);
- }
-}
-
-static char *
-verb_name_from_id (int id)
-{
- return g_strdup_printf ("ESearchBar:Activate:%d", id);
-}
-
-/* This implements the "clear" action, i.e. clears the text and then emits
- * ::search_activated. */
-
-static void
-clear_search (ESearchBar *esb)
-{
- e_search_bar_set_text (esb, "");
- emit_search_activated (esb);
-}
-
-/* Frees an array of subitem information */
-static void
-free_subitems (ESearchBarSubitem *subitems)
-{
- ESearchBarSubitem *s;
-
- g_assert (subitems != NULL);
-
- for (s = subitems; s->id != -1; s++) {
- if (s->text)
- g_free (s->text);
- }
-
- g_free (subitems);
-}
-
-static void
-free_menu_items (ESearchBar *esb)
-{
- GSList *p;
-
- if (esb->menu_items == NULL)
- return;
-
- for (p = esb->menu_items; p != NULL; p = p->next) {
- ESearchBarItem *item;
-
- item = (ESearchBarItem *) p->data;
-
- /* (No submitems for the menu_items, so no need to free that
- member.) */
-
- g_free (item->text);
- g_free (item);
- }
-
- g_slist_free (esb->menu_items);
- esb->menu_items = NULL;
-}
-
-
-/* Callbacks -- Standard verbs. */
-
-static void
-search_now_verb_cb (BonoboUIComponent *ui_component,
- void *data,
- const char *verb_name)
-{
- ESearchBar *esb;
-
- esb = E_SEARCH_BAR (data);
- emit_search_activated (esb);
-}
-
-static void
-clear_verb_cb (BonoboUIComponent *ui_component,
- void *data,
- const char *verb_name)
-{
- ESearchBar *esb;
-
- esb = E_SEARCH_BAR (data);
- clear_search (esb);
-}
-
-static void
-setup_standard_verbs (ESearchBar *search_bar)
-{
- bonobo_ui_component_add_verb (search_bar->ui_component, "ESearchBar:Clear",
- clear_verb_cb, search_bar);
- bonobo_ui_component_add_verb (search_bar->ui_component, "ESearchBar:FindNow",
- search_now_verb_cb, search_bar);
-
- /* Make sure the entries are created with the correct sensitivity. */
- update_sensitivity (search_bar);
-}
-
-/* Callbacks -- The verbs for all the definable items. */
+/* Callbacks. */
static void
-search_verb_cb (BonoboUIComponent *ui_component,
- void *data,
- const char *verb_name)
+menubar_activated_cb (GtkWidget *widget, ESearchBar *esb)
{
- ESearchBar *esb;
- const char *p;
int id;
- esb = E_SEARCH_BAR (data);
-
- p = strrchr (verb_name, ':');
- g_assert (p != NULL);
+ id = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget), "EsbMenuId"));
- id = atoi (p + 1);
emit_menu_activated (esb, id);
}
@@ -242,13 +114,6 @@ entry_activated_cb (GtkWidget *widget,
}
static void
-entry_changed_cb (GtkWidget *widget,
- ESearchBar *esb)
-{
- update_sensitivity (esb);
-}
-
-static void
subitem_activated_cb (GtkWidget *widget, ESearchBar *esb)
{
gint id, subid;
@@ -280,8 +145,6 @@ activate_by_subitems (ESearchBar *esb, gint item_id, ESearchBarSubitem *subitems
esb->entry = gtk_entry_new();
gtk_widget_set_usize (esb->entry, 4, -1);
gtk_object_ref (GTK_OBJECT (esb->entry));
- gtk_signal_connect (GTK_OBJECT (esb->entry), "changed",
- GTK_SIGNAL_FUNC (entry_changed_cb), esb);
gtk_signal_connect (GTK_OBJECT (esb->entry), "activate",
GTK_SIGNAL_FUNC (entry_activated_cb), esb);
gtk_container_add (GTK_CONTAINER (esb->entry_box), esb->entry);
@@ -386,19 +249,11 @@ option_activated_cb (GtkWidget *widget,
}
static void
-activate_button_clicked_cb (GtkWidget *widget,
- ESearchBar *esb)
+activate_button_clicked_cb (GtkWidget *widget, ESearchBar *esb)
{
emit_search_activated (esb);
}
-static void
-clear_button_clicked_cb (GtkWidget *widget,
- ESearchBar *esb)
-{
- clear_search (esb);
-}
-
/* Widgetry creation. */
@@ -444,88 +299,79 @@ copy_subitems (ESearchBarSubitem *subitems)
}
static void
-append_xml_menu_item (GString *xml,
- const char *name,
- const char *label,
- const char *verb,
- const char *accelerator)
+add_dropdown (ESearchBar *esb, ESearchBarItem *items)
{
- char *encoded_label;
-
- encoded_label = bonobo_ui_util_encode_str (label);
- g_string_sprintfa (xml, "<menuitem name=\"%s\" verb=\"%s\" label=\"%s\"",
- name, verb, encoded_label);
- g_free (encoded_label);
-
- if (accelerator != NULL)
- g_string_sprintfa (xml, " accel=\"%s\"", accelerator);
-
- g_string_sprintfa (xml, "/>");
+ GtkWidget *menu = esb->dropdown_menu;
+ GtkWidget *item;
+
+ if (items->text) {
+ char *str;
+ str = _(items->text);
+ if (str == items->text) {
+ /* It may be english string, or utf8 rule name */
+ item = e_utf8_gtk_menu_item_new_with_label (GTK_MENU (menu), str);
+ } else
+ item = gtk_menu_item_new_with_label (str);
+ } else {
+ item = gtk_menu_item_new();
+ gtk_widget_set_sensitive (item, FALSE);
+ }
+
+ gtk_widget_show (item);
+ gtk_menu_append (GTK_MENU (menu), item);
+ gtk_object_set_data (GTK_OBJECT (item), "EsbMenuId", GINT_TO_POINTER (items->id));
+ gtk_signal_connect (GTK_OBJECT (item), "activate",
+ GTK_SIGNAL_FUNC (menubar_activated_cb),
+ esb);
}
static void
-update_bonobo_menus (ESearchBar *esb)
+set_dropdown (ESearchBar *esb,
+ ESearchBarItem *items)
{
- GString *xml;
- GSList *p;
- char *verb_name;
-
- bonobo_ui_component_rm (esb->ui_component, "/menu/Search/SearchBar", NULL);
-
- xml = g_string_new ("<placeholder name=\"SearchBar\">");
-
- append_xml_menu_item (xml, "FindNow", _("_Find Now"), "ESearchBar:FindNow", NULL);
- append_xml_menu_item (xml, "Clear", _("_Clear"), "ESearchBar:Clear", "*Control**Shift*b");
-
- for (p = esb->menu_items; p != NULL; p = p->next) {
- const ESearchBarItem *item;
-
- item = (const ESearchBarItem *) p->data;
-
- verb_name = verb_name_from_id (item->id);
- bonobo_ui_component_add_verb (esb->ui_component, verb_name, search_verb_cb, esb);
-
- if (item->text == NULL)
- g_string_append (xml, "<separator/>");
- else
- append_xml_menu_item (xml, verb_name, item->text, verb_name, NULL);
+ GtkWidget *menu;
+ GtkWidget *dropdown;
+ int i;
+
+ menu = esb->dropdown_menu = gtk_menu_new ();
+ for (i = 0; items[i].id != -1; i++)
+ add_dropdown (esb, items + i);
+
+ gtk_widget_show_all (menu);
+
+ dropdown = e_dropdown_button_new (_("Sear_ch"), GTK_MENU (menu));
+ gtk_widget_show (dropdown);
+
+ if (esb->dropdown_holder == NULL) {
+ /* See the comment in `put_in_spacer_widget()' to understand
+ why we have to do this. */
+
+ esb->dropdown_holder = put_in_spacer_widget (dropdown);
+ esb->dropdown = dropdown;
+ gtk_widget_show (esb->dropdown_holder);
- g_free (verb_name);
+ gtk_box_pack_start (GTK_BOX (esb), esb->dropdown_holder, FALSE, FALSE, 0);
+ } else {
+ gtk_widget_destroy (esb->dropdown);
+ esb->dropdown = dropdown;
+ gtk_container_add (GTK_CONTAINER (esb->dropdown_holder), esb->dropdown);
}
-
- g_string_sprintfa (xml, "</placeholder>");
-
- bonobo_ui_component_set (esb->ui_component, "/menu/Search", xml->str, NULL);
-
- g_string_free (xml, TRUE);
}
+/* Frees an array of subitem information */
static void
-set_menu (ESearchBar *esb,
- ESearchBarItem *items)
+free_subitems (ESearchBarSubitem *subitems)
{
- int i;
-
- free_menu_items (esb);
-
- if (items == NULL)
- return;
-
- for (i = 0; items[i].id != -1; i++) {
- ESearchBarItem *new_item;
-
- g_assert (items[i].subitems == NULL);
+ ESearchBarSubitem *s;
- new_item = g_new (ESearchBarItem, 1);
- new_item->text = g_strdup (items[i].text);
- new_item->id = items[i].id;
- new_item->subitems = NULL;
+ g_assert (subitems != NULL);
- esb->menu_items = g_slist_append (esb->menu_items, new_item);
+ for (s = subitems; s->id != -1; s++) {
+ if (s->text)
+ g_free (s->text);
}
- if (esb->ui_component != NULL)
- update_bonobo_menus (esb);
+ g_free (subitems);
}
/* Callback used when an option item is destroyed. We have to destroy its
@@ -547,6 +393,8 @@ static void
set_option (ESearchBar *esb, ESearchBarItem *items)
{
GtkWidget *menu;
+ GtkRequisition dropdown_requisition;
+ GtkRequisition option_requisition;
int i;
if (esb->option) {
@@ -600,36 +448,41 @@ set_option (ESearchBar *esb, ESearchBarItem *items)
gtk_option_menu_set_history (GTK_OPTION_MENU (esb->option), 0);
gtk_widget_set_sensitive (esb->option, TRUE);
+
+ /* Set the minimum height of this widget to that of the dropdown
+ button, for a better look. */
+ g_assert (esb->dropdown != NULL);
+
+ gtk_widget_size_request (esb->dropdown, &dropdown_requisition);
+ gtk_widget_size_request (esb->option, &option_requisition);
+
+ gtk_container_set_border_width (GTK_CONTAINER (esb->dropdown), GTK_CONTAINER (esb->option)->border_width);
}
-static GtkWidget *
-add_button (ESearchBar *esb,
- const char *text,
- GtkSignalFunc callback)
+static void
+add_activate_button (ESearchBar *esb)
{
GtkWidget *label;
GtkWidget *holder;
- GtkWidget *button;
- label = gtk_label_new (text);
- gtk_misc_set_padding (GTK_MISC (label), 2, 0);
+ label = gtk_label_new (_("Find Now"));
+ gtk_misc_set_padding(GTK_MISC(label), 2, 0);
gtk_widget_show (label);
/* See the comment in `put_in_spacer_widget()' to understand
why we have to do this. */
- button = gtk_button_new ();
- gtk_widget_show (button);
- gtk_container_add (GTK_CONTAINER (button), label);
+ esb->activate_button = gtk_button_new ();
+ gtk_widget_show (esb->activate_button);
+ gtk_container_add (GTK_CONTAINER (esb->activate_button), label);
- holder = put_in_spacer_widget (button);
+ holder = put_in_spacer_widget (esb->activate_button);
gtk_widget_show (holder);
- gtk_signal_connect (GTK_OBJECT (button), "clicked", callback, esb);
+ gtk_signal_connect (GTK_OBJECT (esb->activate_button), "clicked",
+ GTK_SIGNAL_FUNC (activate_button_clicked_cb), esb);
- gtk_box_pack_end (GTK_BOX (esb), holder, FALSE, FALSE, 1);
-
- return button;
+ gtk_box_pack_start (GTK_BOX (esb), holder, FALSE, FALSE, 0);
}
static int
@@ -711,14 +564,9 @@ impl_destroy (GtkObject *object)
g_return_if_fail (object != NULL);
g_return_if_fail (E_IS_SEARCH_BAR (object));
-
- /* These three we do need to unref, because we explicitly hold
+
+ /* These two we do need to unref, because we explicitly hold
references to them. */
-
- if (esb->ui_component != NULL) {
- bonobo_object_unref (BONOBO_OBJECT (esb->ui_component));
- esb->ui_component = NULL;
- }
if (esb->entry)
gtk_object_unref (GTK_OBJECT (esb->entry));
if (esb->suboption)
@@ -728,8 +576,6 @@ impl_destroy (GtkObject *object)
gtk_idle_remove (esb->pending_activate);
esb->pending_activate = 0;
}
-
- free_menu_items (esb);
if (GTK_OBJECT_CLASS (parent_class)->destroy)
GTK_OBJECT_CLASS (parent_class)->destroy (object);
@@ -749,7 +595,7 @@ class_init (ESearchBarClass *klass)
object_class->get_arg = impl_get_arg;
object_class->destroy = impl_destroy;
- klass->set_menu = set_menu;
+ klass->set_menu = set_dropdown;
klass->set_option = set_option;
gtk_object_add_arg_type ("ESearchBar::item_id", GTK_TYPE_ENUM,
@@ -789,24 +635,12 @@ class_init (ESearchBarClass *klass)
static void
init (ESearchBar *esb)
{
- esb->ui_component = NULL;
- esb->menu_items = NULL;
-
- esb->option = NULL;
- esb->entry = NULL;
- esb->suboption = NULL;
+ esb->dropdown = NULL;
+ esb->option = NULL;
+ esb->entry = NULL;
- esb->option_menu = NULL;
- esb->suboption_menu = NULL;
- esb->dropdown_menu = NULL;
- esb->activate_button = NULL;
- esb->clear_button = NULL;
- esb->entry_box = NULL;
-
- esb->pending_activate = 0;
-
- esb->item_id = 0;
- esb->subitem_id = 0;
+ esb->item_id = 0;
+ esb->subitem_id = 0;
}
@@ -828,15 +662,11 @@ e_search_bar_construct (ESearchBar *search_bar,
{
g_return_if_fail (search_bar != NULL);
g_return_if_fail (E_IS_SEARCH_BAR (search_bar));
+ g_return_if_fail (menu_items != NULL);
g_return_if_fail (option_items != NULL);
-
+
gtk_box_set_spacing (GTK_BOX (search_bar), 1);
- search_bar->clear_button = add_button (search_bar, _("Clear"),
- GTK_SIGNAL_FUNC (clear_button_clicked_cb));
- search_bar->activate_button = add_button (search_bar, _("Find Now"),
- GTK_SIGNAL_FUNC (activate_button_clicked_cb));
-
e_search_bar_set_menu (search_bar, menu_items);
search_bar->entry_box = gtk_hbox_new (0, FALSE);
@@ -846,6 +676,8 @@ e_search_bar_construct (ESearchBar *search_bar,
gtk_widget_show (search_bar->entry_box);
gtk_box_pack_start (GTK_BOX(search_bar), search_bar->entry_box, TRUE, TRUE, 0);
+ add_activate_button (search_bar);
+
/*
* If the default choice for the option menu has subitems, then we need to
* activate the search immediately. However, the developer won't have
@@ -865,6 +697,7 @@ e_search_bar_set_menu (ESearchBar *search_bar, ESearchBarItem *menu_items)
{
g_return_if_fail (search_bar != NULL);
g_return_if_fail (E_IS_SEARCH_BAR (search_bar));
+ g_return_if_fail (menu_items != NULL);
((ESearchBarClass *)((GtkObject *)search_bar)->klass)->set_menu (search_bar, menu_items);
}
@@ -874,8 +707,9 @@ e_search_bar_add_menu (ESearchBar *search_bar, ESearchBarItem *menu_item)
{
g_return_if_fail (search_bar != NULL);
g_return_if_fail (E_IS_SEARCH_BAR (search_bar));
+ g_return_if_fail (menu_item != NULL);
- set_menu (search_bar, menu_item);
+ add_dropdown (search_bar, menu_item);
}
void
@@ -937,7 +771,8 @@ e_search_bar_new (ESearchBarItem *menu_items,
ESearchBarItem *option_items)
{
GtkWidget *widget;
-
+
+ g_return_val_if_fail (menu_items != NULL, NULL);
g_return_val_if_fail (option_items != NULL, NULL);
widget = GTK_WIDGET (gtk_type_new (e_search_bar_get_type ()));
@@ -948,37 +783,14 @@ e_search_bar_new (ESearchBarItem *menu_items,
}
void
-e_search_bar_set_ui_component (ESearchBar *search_bar,
- BonoboUIComponent *ui_component)
-{
- g_return_if_fail (E_IS_SEARCH_BAR (search_bar));
-
- if (search_bar->ui_component != NULL)
- bonobo_object_unref (BONOBO_OBJECT (search_bar->ui_component));
-
- search_bar->ui_component = ui_component;
- if (ui_component != NULL) {
- bonobo_object_ref (BONOBO_OBJECT (ui_component));
- setup_standard_verbs (search_bar);
- update_bonobo_menus (search_bar);
- }
-}
-
-void
-e_search_bar_set_menu_sensitive (ESearchBar *search_bar, int id, gboolean state)
+e_search_bar_set_menu_sensitive (ESearchBar *esb, int id, gboolean state)
{
- char *verb_name;
- char *path;
-
- verb_name = verb_name_from_id (id);
- path = g_strconcat ("/commands/", verb_name, NULL);
- g_free (verb_name);
-
- bonobo_ui_component_set_prop (search_bar->ui_component, path,
- "sensitive", state ? "1" : "0",
- NULL);
-
- g_free (path);
+ int row;
+ GtkWidget *widget;
+
+ row = find_id (esb->dropdown_menu, id, "EsbMenuId", &widget);
+ if (row != -1)
+ gtk_widget_set_sensitive (widget, state);
}
GtkType
diff --git a/widgets/misc/e-search-bar.h b/widgets/misc/e-search-bar.h
index f50f487b8d..0787a332da 100644
--- a/widgets/misc/e-search-bar.h
+++ b/widgets/misc/e-search-bar.h
@@ -22,8 +22,6 @@
#include <gtk/gtkhbox.h>
-#include <bonobo/bonobo-ui-component.h>
-
#ifdef __cplusplus
extern "C" {
#pragma }
@@ -40,9 +38,9 @@ extern "C" {
* text string RW Text in the entry box.
*/
-#define E_SEARCH_BAR_TYPE (e_search_bar_get_type ())
-#define E_SEARCH_BAR(obj) (GTK_CHECK_CAST ((obj), E_SEARCH_BAR_TYPE, ESearchBar))
-#define E_SEARCH_BAR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_SEARCH_BAR_TYPE, ESearchBarClass))
+#define E_SEARCH_BAR_TYPE (e_search_bar_get_type ())
+#define E_SEARCH_BAR(obj) (GTK_CHECK_CAST ((obj), E_SEARCH_BAR_TYPE, ESearchBar))
+#define E_SEARCH_BAR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_SEARCH_BAR_TYPE, ESearchBarClass))
#define E_IS_SEARCH_BAR(obj) (GTK_CHECK_TYPE ((obj), E_SEARCH_BAR_TYPE))
#define E_IS_SEARCH_BAR_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_SEARCH_BAR_TYPE))
@@ -64,23 +62,20 @@ typedef struct _ESearchBarClass ESearchBarClass;
struct _ESearchBar
{
GtkHBox parent;
-
- BonoboUIComponent *ui_component;
-
- GSList *menu_items;
/* item specific fields */
+ GtkWidget *dropdown;
GtkWidget *option;
GtkWidget *entry;
GtkWidget *suboption; /* an option menu for the choices associated with some options */
+
/* PRIVATE */
GtkWidget *dropdown_holder; /* holds the dropdown */
GtkWidget *option_menu;
GtkWidget *suboption_menu;
GtkWidget *dropdown_menu;
GtkWidget *activate_button;
- GtkWidget *clear_button;
GtkWidget *entry_box;
guint pending_activate;
@@ -104,45 +99,31 @@ struct _ESearchBarClass
GtkType e_search_bar_get_type (void);
-void e_search_bar_construct (ESearchBar *search_bar,
- ESearchBarItem *menu_items,
- ESearchBarItem *option_items);
-GtkWidget *e_search_bar_new (ESearchBarItem *menu_items,
- ESearchBarItem *option_items);
-
-void e_search_bar_set_ui_component (ESearchBar *search_bar,
- BonoboUIComponent *ui_component);
-
-void e_search_bar_set_menu (ESearchBar *search_bar,
- ESearchBarItem *menu_items);
-void e_search_bar_add_menu (ESearchBar *search_bar,
- ESearchBarItem *menu_item);
-
-void e_search_bar_set_option (ESearchBar *search_bar,
- ESearchBarItem *option_items);
-void e_search_bar_set_suboption (ESearchBar *search_bar,
- int option_id,
- ESearchBarSubitem *subitems);
-
-void e_search_bar_set_menu_sensitive (ESearchBar *search_bar,
- int id,
- gboolean state);
-
-void e_search_bar_set_item_id (ESearchBar *search_bar,
- int id);
-int e_search_bar_get_item_id (ESearchBar *search_bar);
-
-void e_search_bar_set_subitem_id (ESearchBar *search_bar,
- int id);
-int e_search_bar_get_subitem_id (ESearchBar *search_bar);
-
-void e_search_bar_set_ids (ESearchBar *search_bar,
- int item_id,
- int subitem_id);
-
-void e_search_bar_set_text (ESearchBar *search_bar,
- const char *text);
-char *e_search_bar_get_text (ESearchBar *search_bar);
+void e_search_bar_set_menu (ESearchBar *search_bar, ESearchBarItem *menu_items);
+void e_search_bar_add_menu (ESearchBar *search_bar, ESearchBarItem *menu_item);
+
+void e_search_bar_set_option (ESearchBar *search_bar, ESearchBarItem *option_items);
+void e_search_bar_set_suboption (ESearchBar *search_bar, int option_id,
+ ESearchBarSubitem *subitems);
+
+void e_search_bar_construct (ESearchBar *search_bar,
+ ESearchBarItem *menu_items,
+ ESearchBarItem *option_items);
+GtkWidget *e_search_bar_new (ESearchBarItem *menu_items,
+ ESearchBarItem *option_items);
+
+void e_search_bar_set_menu_sensitive(ESearchBar *search_bar, int id, gboolean state);
+
+void e_search_bar_set_item_id (ESearchBar *search_bar, int id);
+int e_search_bar_get_item_id (ESearchBar *search_bar);
+
+void e_search_bar_set_subitem_id (ESearchBar *search_bar, int id);
+int e_search_bar_get_subitem_id (ESearchBar *search_bar);
+
+void e_search_bar_set_ids (ESearchBar *search_bar, int item_id, int subitem_id);
+
+void e_search_bar_set_text (ESearchBar *search_bar, const char *text);
+char *e_search_bar_get_text (ESearchBar *search_bar);
#ifdef __cplusplus
}
diff --git a/widgets/misc/e-selection-model-array.c b/widgets/misc/e-selection-model-array.c
deleted file mode 100644
index 2ed1f0a6be..0000000000
--- a/widgets/misc/e-selection-model-array.c
+++ /dev/null
@@ -1,550 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-selection-model-array.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <gtk/gtksignal.h>
-#include "e-selection-model-array.h"
-#include "gal/util/e-util.h"
-
-#define ESMA_CLASS(e) ((ESelectionModelArrayClass *)((GtkObject *)e)->klass)
-
-#define PARENT_TYPE e_selection_model_get_type ()
-
-static ESelectionModelClass *parent_class;
-
-enum {
- ARG_0,
- ARG_CURSOR_ROW,
- ARG_CURSOR_COL,
-};
-
-void
-e_selection_model_array_confirm_row_count(ESelectionModelArray *esma)
-{
- if (esma->eba == NULL) {
- int row_count = e_selection_model_array_get_row_count(esma);
- esma->eba = e_bit_array_new(row_count);
- esma->selected_row = -1;
- esma->selected_range_end = -1;
- }
-}
-
-/* FIXME: Should this deal with moving the selection if it's in single mode? */
-void
-e_selection_model_array_delete_rows(ESelectionModelArray *esma, int row, int count)
-{
- if (esma->eba) {
- if (E_SELECTION_MODEL(esma)->mode == GTK_SELECTION_SINGLE)
- e_bit_array_delete_single_mode(esma->eba, row, count);
- else
- e_bit_array_delete(esma->eba, row, count);
-
- if (esma->cursor_row > row + count)
- esma->cursor_row -= count;
- else if (esma->cursor_row > row)
- esma->cursor_row = row;
-
- if (esma->cursor_row >= e_bit_array_bit_count (esma->eba)) {
- esma->cursor_row = e_bit_array_bit_count (esma->eba) - 1;
- } else if (esma->cursor_row < 0) {
- esma->cursor_row = -1;
- }
- if (esma->cursor_row >= 0)
- e_bit_array_change_one_row(esma->eba, esma->cursor_row, TRUE);
-
- esma->selected_row = -1;
- esma->selected_range_end = -1;
- e_selection_model_selection_changed(E_SELECTION_MODEL(esma));
- e_selection_model_cursor_changed(E_SELECTION_MODEL(esma), esma->cursor_row, esma->cursor_col);
- }
-}
-
-void
-e_selection_model_array_insert_rows(ESelectionModelArray *esma, int row, int count)
-{
- if (esma->eba) {
- e_bit_array_insert(esma->eba, row, count);
-
- if (esma->cursor_row >= row)
- esma->cursor_row += count;
-
- esma->selected_row = -1;
- esma->selected_range_end = -1;
- e_selection_model_selection_changed(E_SELECTION_MODEL(esma));
- e_selection_model_cursor_changed(E_SELECTION_MODEL(esma), esma->cursor_row, esma->cursor_col);
- }
-}
-
-void
-e_selection_model_array_move_row(ESelectionModelArray *esma, int old_row, int new_row)
-{
- ESelectionModel *esm = E_SELECTION_MODEL(esma);
-
- if (esma->eba) {
- gboolean selected = e_bit_array_value_at(esma->eba, old_row);
- gboolean cursor = (esma->cursor_row == old_row);
-
- if (old_row < esma->cursor_row && esma->cursor_row < new_row)
- esma->cursor_row --;
- else if (new_row < esma->cursor_row && esma->cursor_row < old_row)
- esma->cursor_row ++;
-
- e_bit_array_move_row(esma->eba, old_row, new_row);
-
- if (selected) {
- if (esm->mode == GTK_SELECTION_SINGLE)
- e_bit_array_select_single_row (esma->eba, new_row);
- else
- e_bit_array_change_one_row(esma->eba, new_row, TRUE);
- }
- if (cursor) {
- esma->cursor_row = new_row;
- }
- esma->selected_row = -1;
- esma->selected_range_end = -1;
- e_selection_model_selection_changed(esm);
- e_selection_model_cursor_changed(esm, esma->cursor_row, esma->cursor_col);
- }
-}
-
-static void
-esma_destroy (GtkObject *object)
-{
- ESelectionModelArray *esma;
-
- esma = E_SELECTION_MODEL_ARRAY (object);
-
- if (esma->eba) {
- gtk_object_unref(GTK_OBJECT(esma->eba));
- esma->eba = NULL;
- }
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-static void
-esma_get_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY (o);
-
- switch (arg_id){
- case ARG_CURSOR_ROW:
- GTK_VALUE_INT(*arg) = esma->cursor_row;
- break;
-
- case ARG_CURSOR_COL:
- GTK_VALUE_INT(*arg) = esma->cursor_col;
- break;
- }
-}
-
-static void
-esma_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- ESelectionModel *esm = E_SELECTION_MODEL (o);
- ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY (o);
-
- switch (arg_id){
- case ARG_CURSOR_ROW:
- e_selection_model_do_something(esm, GTK_VALUE_INT(*arg), esma->cursor_col, 0);
- break;
-
- case ARG_CURSOR_COL:
- e_selection_model_do_something(esm, esma->cursor_row, GTK_VALUE_INT(*arg), 0);
- break;
- }
-}
-
-/**
- * e_selection_model_is_row_selected
- * @selection: #ESelectionModel to check
- * @n: The row to check
- *
- * This routine calculates whether the given row is selected.
- *
- * Returns: %TRUE if the given row is selected
- */
-static gboolean
-esma_is_row_selected (ESelectionModel *selection,
- gint n)
-{
- ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY(selection);
- if (esma->eba)
- return e_bit_array_value_at(esma->eba, n);
- else
- return FALSE;
-}
-
-/**
- * e_selection_model_foreach
- * @selection: #ESelectionModel to traverse
- * @callback: The callback function to call back.
- * @closure: The closure
- *
- * This routine calls the given callback function once for each
- * selected row, passing closure as the closure.
- */
-static void
-esma_foreach (ESelectionModel *selection,
- EForeachFunc callback,
- gpointer closure)
-{
- ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY(selection);
- if (esma->eba)
- e_bit_array_foreach(esma->eba, callback, closure);
-}
-
-/**
- * e_selection_model_clear
- * @selection: #ESelectionModel to clear
- *
- * This routine clears the selection to no rows selected.
- */
-static void
-esma_clear(ESelectionModel *selection)
-{
- ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY(selection);
- if (esma->eba) {
- gtk_object_unref(GTK_OBJECT(esma->eba));
- esma->eba = NULL;
- }
- esma->cursor_row = -1;
- esma->cursor_col = -1;
- esma->selected_row = -1;
- esma->selected_range_end = -1;
- e_selection_model_selection_changed(E_SELECTION_MODEL(esma));
- e_selection_model_cursor_changed(E_SELECTION_MODEL(esma), -1, -1);
-}
-
-#define PART(x,n) (((x) & (0x01010101 << n)) >> n)
-#define SECTION(x, n) (((x) >> (n * 8)) & 0xff)
-
-/**
- * e_selection_model_selected_count
- * @selection: #ESelectionModel to count
- *
- * This routine calculates the number of rows selected.
- *
- * Returns: The number of rows selected in the given model.
- */
-static gint
-esma_selected_count (ESelectionModel *selection)
-{
- ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY(selection);
- if (esma->eba)
- return e_bit_array_selected_count(esma->eba);
- else
- return 0;
-}
-
-/**
- * e_selection_model_select_all
- * @selection: #ESelectionModel to select all
- *
- * This routine selects all the rows in the given
- * #ESelectionModel.
- */
-static void
-esma_select_all (ESelectionModel *selection)
-{
- ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY(selection);
-
- e_selection_model_array_confirm_row_count(esma);
-
- e_bit_array_select_all(esma->eba);
-
- esma->cursor_col = 0;
- esma->cursor_row = 0;
- esma->selection_start_row = 0;
- esma->selected_row = -1;
- esma->selected_range_end = -1;
- e_selection_model_selection_changed(E_SELECTION_MODEL(esma));
- e_selection_model_cursor_changed(E_SELECTION_MODEL(esma), 0, 0);
-}
-
-/**
- * e_selection_model_invert_selection
- * @selection: #ESelectionModel to invert
- *
- * This routine inverts all the rows in the given
- * #ESelectionModel.
- */
-static void
-esma_invert_selection (ESelectionModel *selection)
-{
- ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY(selection);
-
- e_selection_model_array_confirm_row_count(esma);
-
- e_bit_array_invert_selection(esma->eba);
-
- esma->cursor_col = -1;
- esma->cursor_row = -1;
- esma->selection_start_row = 0;
- esma->selected_row = -1;
- esma->selected_range_end = -1;
- e_selection_model_selection_changed(E_SELECTION_MODEL(esma));
- e_selection_model_cursor_changed(E_SELECTION_MODEL(esma), -1, -1);
-}
-
-static int
-esma_row_count (ESelectionModel *selection)
-{
- ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY(selection);
- e_selection_model_array_confirm_row_count(esma);
- return e_bit_array_bit_count(esma->eba);
-}
-
-static void
-esma_change_one_row(ESelectionModel *selection, int row, gboolean grow)
-{
- ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY(selection);
- e_selection_model_array_confirm_row_count(esma);
- e_bit_array_change_one_row(esma->eba, row, grow);
-}
-
-static void
-esma_change_cursor (ESelectionModel *selection, int row, int col)
-{
- ESelectionModelArray *esma;
-
- g_return_if_fail(selection != NULL);
- g_return_if_fail(E_IS_SELECTION_MODEL(selection));
-
- esma = E_SELECTION_MODEL_ARRAY(selection);
-
- esma->cursor_row = row;
- esma->cursor_col = col;
-}
-
-static void
-esma_change_range(ESelectionModel *selection, int start, int end, gboolean grow)
-{
- int i;
- ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY(selection);
- if (start != end) {
- if (selection->sorter && e_sorter_needs_sorting(selection->sorter)) {
- for ( i = start; i < end; i++) {
- e_bit_array_change_one_row(esma->eba, e_sorter_sorted_to_model(selection->sorter, i), grow);
- }
- } else {
- e_selection_model_array_confirm_row_count(esma);
- e_bit_array_change_range(esma->eba, start, end, grow);
- }
- }
-}
-
-static int
-esma_cursor_row (ESelectionModel *selection)
-{
- ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY(selection);
- return esma->cursor_row;
-}
-
-static int
-esma_cursor_col (ESelectionModel *selection)
-{
- ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY(selection);
- return esma->cursor_col;
-}
-
-static void
-esma_real_select_single_row (ESelectionModel *selection, int row)
-{
- ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY(selection);
-
- e_selection_model_array_confirm_row_count(esma);
-
- e_bit_array_select_single_row(esma->eba, row);
-
- esma->selection_start_row = row;
- esma->selected_row = row;
- esma->selected_range_end = row;
-}
-
-static void
-esma_select_single_row (ESelectionModel *selection, int row)
-{
- ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY(selection);
- int selected_row = esma->selected_row;
- esma_real_select_single_row (selection, row);
-
- if (selected_row != -1 && esma->eba && selected_row < e_bit_array_bit_count (esma->eba)) {
- if (selected_row != row) {
- e_selection_model_selection_row_changed(selection, selected_row);
- e_selection_model_selection_row_changed(selection, row);
- }
- } else {
- e_selection_model_selection_changed(selection);
- }
-}
-
-static void
-esma_toggle_single_row (ESelectionModel *selection, int row)
-{
- ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY(selection);
-
- e_selection_model_array_confirm_row_count(esma);
- e_bit_array_toggle_single_row(esma->eba, row);
-
- esma->selection_start_row = row;
- esma->selected_row = -1;
- esma->selected_range_end = -1;
- e_selection_model_selection_row_changed(E_SELECTION_MODEL(esma), row);
-}
-
-static void
-esma_real_move_selection_end (ESelectionModel *selection, int row)
-{
- ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY(selection);
- int old_start;
- int old_end;
- int new_start;
- int new_end;
- if (selection->sorter && e_sorter_needs_sorting(selection->sorter)) {
- old_start = MIN (e_sorter_model_to_sorted(selection->sorter, esma->selection_start_row),
- e_sorter_model_to_sorted(selection->sorter, esma->cursor_row));
- old_end = MAX (e_sorter_model_to_sorted(selection->sorter, esma->selection_start_row),
- e_sorter_model_to_sorted(selection->sorter, esma->cursor_row)) + 1;
- new_start = MIN (e_sorter_model_to_sorted(selection->sorter, esma->selection_start_row),
- e_sorter_model_to_sorted(selection->sorter, row));
- new_end = MAX (e_sorter_model_to_sorted(selection->sorter, esma->selection_start_row),
- e_sorter_model_to_sorted(selection->sorter, row)) + 1;
- } else {
- old_start = MIN (esma->selection_start_row, esma->cursor_row);
- old_end = MAX (esma->selection_start_row, esma->cursor_row) + 1;
- new_start = MIN (esma->selection_start_row, row);
- new_end = MAX (esma->selection_start_row, row) + 1;
- }
- /* This wouldn't work nearly so smoothly if one end of the selection weren't held in place. */
- if (old_start < new_start)
- esma_change_range(selection, old_start, new_start, FALSE);
- if (new_start < old_start)
- esma_change_range(selection, new_start, old_start, TRUE);
- if (old_end < new_end)
- esma_change_range(selection, old_end, new_end, TRUE);
- if (new_end < old_end)
- esma_change_range(selection, new_end, old_end, FALSE);
- esma->selected_row = -1;
- esma->selected_range_end = -1;
-}
-
-static void
-esma_move_selection_end (ESelectionModel *selection, int row)
-{
- esma_real_move_selection_end (selection, row);
- e_selection_model_selection_changed(selection);
-}
-
-static void
-esma_set_selection_end (ESelectionModel *selection, int row)
-{
- ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY(selection);
- int selected_range_end = esma->selected_range_end;
- int view_row = e_sorter_model_to_sorted(selection->sorter, row);
-
- esma_real_select_single_row(selection, esma->selection_start_row);
- esma->cursor_row = esma->selection_start_row;
- esma_real_move_selection_end(selection, row);
-
- esma->selected_range_end = view_row;
- if (selected_range_end != -1 && view_row != -1) {
- if (selected_range_end == view_row - 1 ||
- selected_range_end == view_row + 1) {
- e_selection_model_selection_row_changed(selection, selected_range_end);
- e_selection_model_selection_row_changed(selection, view_row);
- return;
- }
- }
- e_selection_model_selection_changed(selection);
-}
-
-int
-e_selection_model_array_get_row_count (ESelectionModelArray *esma)
-{
- g_return_val_if_fail(esma != NULL, 0);
- g_return_val_if_fail(E_IS_SELECTION_MODEL_ARRAY(esma), 0);
-
- if (ESMA_CLASS(esma)->get_row_count)
- return ESMA_CLASS(esma)->get_row_count (esma);
- else
- return 0;
-}
-
-
-static void
-e_selection_model_array_init (ESelectionModelArray *esma)
-{
- esma->eba = NULL;
- esma->selection_start_row = 0;
- esma->cursor_row = -1;
- esma->cursor_col = -1;
-
- esma->selected_row = -1;
- esma->selected_range_end = -1;
-}
-
-static void
-e_selection_model_array_class_init (ESelectionModelArrayClass *klass)
-{
- GtkObjectClass *object_class;
- ESelectionModelClass *esm_class;
-
- parent_class = gtk_type_class (e_selection_model_get_type ());
-
- object_class = GTK_OBJECT_CLASS(klass);
- esm_class = E_SELECTION_MODEL_CLASS(klass);
-
- object_class->destroy = esma_destroy;
- object_class->get_arg = esma_get_arg;
- object_class->set_arg = esma_set_arg;
-
- esm_class->is_row_selected = esma_is_row_selected ;
- esm_class->foreach = esma_foreach ;
- esm_class->clear = esma_clear ;
- esm_class->selected_count = esma_selected_count ;
- esm_class->select_all = esma_select_all ;
- esm_class->invert_selection = esma_invert_selection ;
- esm_class->row_count = esma_row_count ;
-
- esm_class->change_one_row = esma_change_one_row ;
- esm_class->change_cursor = esma_change_cursor ;
- esm_class->cursor_row = esma_cursor_row ;
- esm_class->cursor_col = esma_cursor_col ;
-
- esm_class->select_single_row = esma_select_single_row ;
- esm_class->toggle_single_row = esma_toggle_single_row ;
- esm_class->move_selection_end = esma_move_selection_end ;
- esm_class->set_selection_end = esma_set_selection_end ;
-
- klass->get_row_count = NULL ;
-
- gtk_object_add_arg_type ("ESelectionModelArray::cursor_row", GTK_TYPE_INT,
- GTK_ARG_READWRITE, ARG_CURSOR_ROW);
- gtk_object_add_arg_type ("ESelectionModelArray::cursor_col", GTK_TYPE_INT,
- GTK_ARG_READWRITE, ARG_CURSOR_COL);
-}
-
-E_MAKE_TYPE(e_selection_model_array, "ESelectionModelArray", ESelectionModelArray,
- e_selection_model_array_class_init, e_selection_model_array_init, PARENT_TYPE);
diff --git a/widgets/misc/e-selection-model-array.h b/widgets/misc/e-selection-model-array.h
deleted file mode 100644
index 805f331e88..0000000000
--- a/widgets/misc/e-selection-model-array.h
+++ /dev/null
@@ -1,95 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-selection-model-array.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_SELECTION_MODEL_ARRAY_H_
-#define _E_SELECTION_MODEL_ARRAY_H_
-
-#include <gtk/gtkobject.h>
-#include <gal/widgets/e-selection-model.h>
-#include <gal/util/e-bit-array.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#define E_SELECTION_MODEL_ARRAY_TYPE (e_selection_model_array_get_type ())
-#define E_SELECTION_MODEL_ARRAY(o) (GTK_CHECK_CAST ((o), E_SELECTION_MODEL_ARRAY_TYPE, ESelectionModelArray))
-#define E_SELECTION_MODEL_ARRAY_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_SELECTION_MODEL_ARRAY_TYPE, ESelectionModelArrayClass))
-#define E_IS_SELECTION_MODEL_ARRAY(o) (GTK_CHECK_TYPE ((o), E_SELECTION_MODEL_ARRAY_TYPE))
-#define E_IS_SELECTION_MODEL_ARRAY_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_SELECTION_MODEL_ARRAY_TYPE))
-
-typedef struct {
- ESelectionModel base;
-
- EBitArray *eba;
-
- gint cursor_row;
- gint cursor_col;
- gint selection_start_row;
-
- guint model_changed_id;
- guint model_row_inserted_id, model_row_deleted_id;
-
- /* Anything other than -1 means that the selection is a single
- * row. This being -1 does not impart any information. */
- gint selected_row;
- /* Anything other than -1 means that the selection is a all
- * rows between selection_start_path and cursor_path where
- * selected_range_end is the rwo number of cursor_path. This
- * being -1 does not impart any information. */
- gint selected_range_end;
-
- guint frozen : 1;
- guint selection_model_changed : 1;
- guint group_info_changed : 1;
-} ESelectionModelArray;
-
-typedef struct {
- ESelectionModelClass parent_class;
-
- gint (*get_row_count) (ESelectionModelArray *selection);
-} ESelectionModelArrayClass;
-
-GtkType e_selection_model_array_get_type (void);
-
-/* Protected Functions */
-void e_selection_model_array_insert_rows (ESelectionModelArray *esm,
- int row,
- int count);
-void e_selection_model_array_delete_rows (ESelectionModelArray *esm,
- int row,
- int count);
-void e_selection_model_array_move_row (ESelectionModelArray *esm,
- int old_row,
- int new_row);
-void e_selection_model_array_confirm_row_count (ESelectionModelArray *esm);
-
-/* Protected Virtual Function */
-gint e_selection_model_array_get_row_count (ESelectionModelArray *esm);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* _E_SELECTION_MODEL_ARRAY_H_ */
diff --git a/widgets/misc/e-selection-model-simple.c b/widgets/misc/e-selection-model-simple.c
deleted file mode 100644
index 0d87cdc779..0000000000
--- a/widgets/misc/e-selection-model-simple.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-selection-model-simple.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <gal/util/e-util.h>
-#include "e-selection-model-array.h"
-#include "e-selection-model-simple.h"
-
-#define ESMS_CLASS(e) ((ESelectionModelSimpleClass *)((GtkObject *)e)->klass)
-
-#define PARENT_TYPE e_selection_model_array_get_type ()
-
-static ESelectionModelArray *parent_class;
-
-static gint esms_get_row_count (ESelectionModelArray *esma);
-
-static void
-e_selection_model_simple_init (ESelectionModelSimple *selection)
-{
- selection->row_count = 0;
-}
-
-static void
-e_selection_model_simple_class_init (ESelectionModelSimpleClass *klass)
-{
- ESelectionModelArrayClass *esma_class;
-
- parent_class = gtk_type_class (PARENT_TYPE);
-
- esma_class = E_SELECTION_MODEL_ARRAY_CLASS(klass);
-
- esma_class->get_row_count = esms_get_row_count;
-}
-
-E_MAKE_TYPE(e_selection_model_simple, "ESelectionModelSimple", ESelectionModelSimple,
- e_selection_model_simple_class_init, e_selection_model_simple_init, PARENT_TYPE);
-
-/**
- * e_selection_model_simple_new
- *
- * This routine creates a new #ESelectionModelSimple.
- *
- * Returns: The new #ESelectionModelSimple.
- */
-ESelectionModelSimple *
-e_selection_model_simple_new (void)
-{
- return gtk_type_new (e_selection_model_simple_get_type ());
-}
-
-void
-e_selection_model_simple_set_row_count (ESelectionModelSimple *esms,
- int row_count)
-{
- if (esms->row_count != row_count) {
- ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY(esms);
- if (esma->eba)
- gtk_object_unref(GTK_OBJECT(esma->eba));
- esma->eba = NULL;
- esma->selected_row = -1;
- esma->selected_range_end = -1;
- }
- esms->row_count = row_count;
-}
-
-static gint
-esms_get_row_count (ESelectionModelArray *esma)
-{
- ESelectionModelSimple *esms = E_SELECTION_MODEL_SIMPLE(esma);
-
- return esms->row_count;
-}
-
-void e_selection_model_simple_insert_rows (ESelectionModelSimple *esms,
- int row,
- int count)
-{
- esms->row_count += count;
- e_selection_model_array_insert_rows (E_SELECTION_MODEL_ARRAY(esms), row, count);
-}
-
-void
-e_selection_model_simple_delete_rows (ESelectionModelSimple *esms,
- int row,
- int count)
-{
- esms->row_count -= count;
- e_selection_model_array_delete_rows (E_SELECTION_MODEL_ARRAY(esms), row, count);
-}
-
-void
-e_selection_model_simple_move_row (ESelectionModelSimple *esms,
- int old_row,
- int new_row)
-{
- e_selection_model_array_move_row (E_SELECTION_MODEL_ARRAY(esms), old_row, new_row);
-}
diff --git a/widgets/misc/e-selection-model-simple.h b/widgets/misc/e-selection-model-simple.h
deleted file mode 100644
index 5a19685827..0000000000
--- a/widgets/misc/e-selection-model-simple.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-selection-model-simple.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_SELECTION_MODEL_SIMPLE_H_
-#define _E_SELECTION_MODEL_SIMPLE_H_
-
-#include <gal/widgets/e-selection-model-array.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#define E_SELECTION_MODEL_SIMPLE_TYPE (e_selection_model_simple_get_type ())
-#define E_SELECTION_MODEL_SIMPLE(o) (GTK_CHECK_CAST ((o), E_SELECTION_MODEL_SIMPLE_TYPE, ESelectionModelSimple))
-#define E_SELECTION_MODEL_SIMPLE_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_SELECTION_MODEL_SIMPLE_TYPE, ESelectionModelSimpleClass))
-#define E_IS_SELECTION_MODEL_SIMPLE(o) (GTK_CHECK_TYPE ((o), E_SELECTION_MODEL_SIMPLE_TYPE))
-#define E_IS_SELECTION_MODEL_SIMPLE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_SELECTION_MODEL_SIMPLE_TYPE))
-
-typedef struct {
- ESelectionModelArray parent;
-
- int row_count;
-} ESelectionModelSimple;
-
-typedef struct {
- ESelectionModelArrayClass parent_class;
-} ESelectionModelSimpleClass;
-
-GtkType e_selection_model_simple_get_type (void);
-ESelectionModelSimple *e_selection_model_simple_new (void);
-
-void e_selection_model_simple_insert_rows (ESelectionModelSimple *esms,
- int row,
- int count);
-void e_selection_model_simple_delete_rows (ESelectionModelSimple *esms,
- int row,
- int count);
-void e_selection_model_simple_move_row (ESelectionModelSimple *esms,
- int old_row,
- int new_row);
-
-void e_selection_model_simple_set_row_count (ESelectionModelSimple *selection,
- int row_count);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _E_SELECTION_MODEL_SIMPLE_H_ */
-
diff --git a/widgets/misc/e-selection-model.c b/widgets/misc/e-selection-model.c
deleted file mode 100644
index b7472e99f5..0000000000
--- a/widgets/misc/e-selection-model.c
+++ /dev/null
@@ -1,661 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-selection-model.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <gdk/gdkkeysyms.h>
-#include <gtk/gtksignal.h>
-#include "e-selection-model.h"
-#include "gal/util/e-util.h"
-
-#define ESM_CLASS(e) ((ESelectionModelClass *)((GtkObject *)e)->klass)
-
-#define PARENT_TYPE gtk_object_get_type ()
-
-static GtkObjectClass *e_selection_model_parent_class;
-
-enum {
- CURSOR_CHANGED,
- CURSOR_ACTIVATED,
- SELECTION_CHANGED,
- SELECTION_ROW_CHANGED,
- LAST_SIGNAL
-};
-
-static guint e_selection_model_signals [LAST_SIGNAL] = { 0, };
-
-enum {
- ARG_0,
- ARG_SORTER,
- ARG_SELECTION_MODE,
- ARG_CURSOR_MODE,
-};
-
-inline static void
-add_sorter(ESelectionModel *esm, ESorter *sorter)
-{
- esm->sorter = sorter;
- if (sorter) {
- gtk_object_ref(GTK_OBJECT(sorter));
- }
-}
-
-inline static void
-drop_sorter(ESelectionModel *esm)
-{
- if (esm->sorter) {
- gtk_object_unref(GTK_OBJECT(esm->sorter));
- }
- esm->sorter = NULL;
-}
-
-static void
-esm_destroy (GtkObject *object)
-{
- ESelectionModel *esm;
-
- esm = E_SELECTION_MODEL (object);
-
- drop_sorter(esm);
-
- if (e_selection_model_parent_class->destroy)
- (* e_selection_model_parent_class->destroy) (object);
-}
-
-static void
-esm_get_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- ESelectionModel *esm = E_SELECTION_MODEL (o);
-
- switch (arg_id){
- case ARG_SORTER:
- GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(esm->sorter);
- break;
-
- case ARG_SELECTION_MODE:
- GTK_VALUE_ENUM(*arg) = esm->mode;
- break;
-
- case ARG_CURSOR_MODE:
- GTK_VALUE_ENUM(*arg) = esm->cursor_mode;
- break;
- }
-}
-
-static void
-esm_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- ESelectionModel *esm = E_SELECTION_MODEL (o);
-
- switch (arg_id){
- case ARG_SORTER:
- drop_sorter(esm);
- add_sorter(esm, GTK_VALUE_OBJECT (*arg) ? E_SORTER(GTK_VALUE_OBJECT (*arg)) : NULL);
- break;
-
- case ARG_SELECTION_MODE:
- esm->mode = GTK_VALUE_ENUM(*arg);
- if (esm->mode == GTK_SELECTION_SINGLE) {
- int cursor_row = e_selection_model_cursor_row(esm);
- int cursor_col = e_selection_model_cursor_col(esm);
- e_selection_model_do_something(esm, cursor_row, cursor_col, 0);
- }
- break;
-
- case ARG_CURSOR_MODE:
- esm->cursor_mode = GTK_VALUE_ENUM(*arg);
- break;
- }
-}
-
-static void
-e_selection_model_init (ESelectionModel *selection)
-{
- selection->mode = GTK_SELECTION_MULTIPLE;
- selection->cursor_mode = E_CURSOR_SIMPLE;
- selection->old_selection = -1;
-}
-
-static void
-e_selection_model_class_init (ESelectionModelClass *klass)
-{
- GtkObjectClass *object_class;
-
- e_selection_model_parent_class = gtk_type_class (gtk_object_get_type ());
-
- object_class = GTK_OBJECT_CLASS(klass);
-
- object_class->destroy = esm_destroy;
- object_class->get_arg = esm_get_arg;
- object_class->set_arg = esm_set_arg;
-
- e_selection_model_signals [CURSOR_CHANGED] =
- gtk_signal_new ("cursor_changed",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ESelectionModelClass, cursor_changed),
- gtk_marshal_NONE__INT_INT,
- GTK_TYPE_NONE, 2, GTK_TYPE_INT, GTK_TYPE_INT);
-
- e_selection_model_signals [CURSOR_ACTIVATED] =
- gtk_signal_new ("cursor_activated",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ESelectionModelClass, cursor_activated),
- gtk_marshal_NONE__INT_INT,
- GTK_TYPE_NONE, 2, GTK_TYPE_INT, GTK_TYPE_INT);
-
- e_selection_model_signals [SELECTION_CHANGED] =
- gtk_signal_new ("selection_changed",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ESelectionModelClass, selection_changed),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- e_selection_model_signals [SELECTION_ROW_CHANGED] =
- gtk_signal_new ("selection_row_changed",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ESelectionModelClass, selection_row_changed),
- gtk_marshal_NONE__INT,
- GTK_TYPE_NONE, 1, GTK_TYPE_INT);
-
- klass->cursor_changed = NULL;
- klass->cursor_activated = NULL;
- klass->selection_changed = NULL;
- klass->selection_row_changed = NULL;
-
- klass->is_row_selected = NULL;
- klass->foreach = NULL;
- klass->clear = NULL;
- klass->selected_count = NULL;
- klass->select_all = NULL;
- klass->invert_selection = NULL;
- klass->row_count = NULL;
-
- klass->change_one_row = NULL;
- klass->change_cursor = NULL;
- klass->cursor_row = NULL;
- klass->cursor_col = NULL;
-
- klass->select_single_row = NULL;
- klass->toggle_single_row = NULL;
- klass->move_selection_end = NULL;
- klass->set_selection_end = NULL;
-
-
- E_OBJECT_CLASS_ADD_SIGNALS (object_class, e_selection_model_signals, LAST_SIGNAL);
-
- gtk_object_add_arg_type ("ESelectionModel::sorter", GTK_TYPE_OBJECT,
- GTK_ARG_READWRITE, ARG_SORTER);
- gtk_object_add_arg_type ("ESelectionModel::selection_mode", GTK_TYPE_ENUM,
- GTK_ARG_READWRITE, ARG_SELECTION_MODE);
- gtk_object_add_arg_type ("ESelectionModel::cursor_mode", GTK_TYPE_ENUM,
- GTK_ARG_READWRITE, ARG_CURSOR_MODE);
-}
-
-E_MAKE_TYPE(e_selection_model, "ESelectionModel", ESelectionModel,
- e_selection_model_class_init, e_selection_model_init, PARENT_TYPE);
-
-/**
- * e_selection_model_is_row_selected
- * @selection: #ESelectionModel to check
- * @n: The row to check
- *
- * This routine calculates whether the given row is selected.
- *
- * Returns: %TRUE if the given row is selected
- */
-gboolean
-e_selection_model_is_row_selected (ESelectionModel *selection,
- gint n)
-{
- if (ESM_CLASS(selection)->is_row_selected)
- return ESM_CLASS(selection)->is_row_selected (selection, n);
- else
- return FALSE;
-}
-
-/**
- * e_selection_model_foreach
- * @selection: #ESelectionModel to traverse
- * @callback: The callback function to call back.
- * @closure: The closure
- *
- * This routine calls the given callback function once for each
- * selected row, passing closure as the closure.
- */
-void
-e_selection_model_foreach (ESelectionModel *selection,
- EForeachFunc callback,
- gpointer closure)
-{
- if (ESM_CLASS(selection)->foreach)
- ESM_CLASS(selection)->foreach (selection, callback, closure);
-}
-
-/**
- * e_selection_model_clear
- * @selection: #ESelectionModel to clear
- *
- * This routine clears the selection to no rows selected.
- */
-void
-e_selection_model_clear(ESelectionModel *selection)
-{
- if (ESM_CLASS(selection)->clear)
- ESM_CLASS(selection)->clear (selection);
-}
-
-/**
- * e_selection_model_selected_count
- * @selection: #ESelectionModel to count
- *
- * This routine calculates the number of rows selected.
- *
- * Returns: The number of rows selected in the given model.
- */
-gint
-e_selection_model_selected_count (ESelectionModel *selection)
-{
- if (ESM_CLASS(selection)->selected_count)
- return ESM_CLASS(selection)->selected_count (selection);
- else
- return 0;
-}
-
-/**
- * e_selection_model_select_all
- * @selection: #ESelectionModel to select all
- *
- * This routine selects all the rows in the given
- * #ESelectionModel.
- */
-void
-e_selection_model_select_all (ESelectionModel *selection)
-{
- if (ESM_CLASS(selection)->select_all)
- ESM_CLASS(selection)->select_all (selection);
-}
-
-/**
- * e_selection_model_invert_selection
- * @selection: #ESelectionModel to invert
- *
- * This routine inverts all the rows in the given
- * #ESelectionModel.
- */
-void
-e_selection_model_invert_selection (ESelectionModel *selection)
-{
- if (ESM_CLASS(selection)->invert_selection)
- ESM_CLASS(selection)->invert_selection (selection);
-}
-
-int
-e_selection_model_row_count (ESelectionModel *selection)
-{
- if (ESM_CLASS(selection)->row_count)
- return ESM_CLASS(selection)->row_count (selection);
- else
- return 0;
-}
-
-void
-e_selection_model_change_one_row(ESelectionModel *selection, int row, gboolean grow)
-{
- if (ESM_CLASS(selection)->change_one_row)
- ESM_CLASS(selection)->change_one_row (selection, row, grow);
-}
-
-void
-e_selection_model_change_cursor (ESelectionModel *selection, int row, int col)
-{
- if (ESM_CLASS(selection)->change_cursor)
- ESM_CLASS(selection)->change_cursor (selection, row, col);
-}
-
-int
-e_selection_model_cursor_row (ESelectionModel *selection)
-{
- if (ESM_CLASS(selection)->cursor_row)
- return ESM_CLASS(selection)->cursor_row (selection);
- else
- return -1;
-}
-
-int
-e_selection_model_cursor_col (ESelectionModel *selection)
-{
- if (ESM_CLASS(selection)->cursor_col)
- return ESM_CLASS(selection)->cursor_col (selection);
- else
- return -1;
-}
-
-void
-e_selection_model_select_single_row (ESelectionModel *selection, int row)
-{
- if (ESM_CLASS(selection)->select_single_row)
- ESM_CLASS(selection)->select_single_row (selection, row);
-}
-
-void
-e_selection_model_toggle_single_row (ESelectionModel *selection, int row)
-{
- if (ESM_CLASS(selection)->toggle_single_row)
- ESM_CLASS(selection)->toggle_single_row (selection, row);
-}
-
-void
-e_selection_model_move_selection_end (ESelectionModel *selection, int row)
-{
- if (ESM_CLASS(selection)->move_selection_end)
- ESM_CLASS(selection)->move_selection_end (selection, row);
-}
-
-void
-e_selection_model_set_selection_end (ESelectionModel *selection, int row)
-{
- if (ESM_CLASS(selection)->set_selection_end)
- ESM_CLASS(selection)->set_selection_end (selection, row);
-}
-
-/**
- * e_selection_model_do_something
- * @selection: #ESelectionModel to do something to.
- * @row: The row to do something in.
- * @col: The col to do something in.
- * @state: The state in which to do something.
- *
- * This routine does whatever is appropriate as if the user clicked
- * the mouse in the given row and column.
- */
-void
-e_selection_model_do_something (ESelectionModel *selection,
- guint row,
- guint col,
- GdkModifierType state)
-{
- gint shift_p = state & GDK_SHIFT_MASK;
- gint ctrl_p = state & GDK_CONTROL_MASK;
- int row_count;
-
- selection->old_selection = -1;
-
- if (row == -1 && col != -1)
- row = 0;
- if (col == -1 && row != -1)
- col = 0;
-
- row_count = e_selection_model_row_count(selection);
- if (row_count >= 0 && row < row_count) {
- switch (selection->mode) {
- case GTK_SELECTION_SINGLE:
- e_selection_model_select_single_row (selection, row);
- break;
- case GTK_SELECTION_BROWSE:
- case GTK_SELECTION_MULTIPLE:
- case GTK_SELECTION_EXTENDED:
- if (shift_p) {
- e_selection_model_set_selection_end (selection, row);
- } else {
- if (ctrl_p) {
- e_selection_model_toggle_single_row (selection, row);
- } else {
- e_selection_model_select_single_row (selection, row);
- }
- }
- break;
- }
- e_selection_model_change_cursor(selection, row, col);
- gtk_signal_emit(GTK_OBJECT(selection),
- e_selection_model_signals[CURSOR_CHANGED], row, col);
- gtk_signal_emit(GTK_OBJECT(selection),
- e_selection_model_signals[CURSOR_ACTIVATED], row, col);
- }
-}
-
-/**
- * e_selection_model_maybe_do_something
- * @selection: #ESelectionModel to do something to.
- * @row: The row to do something in.
- * @col: The col to do something in.
- * @state: The state in which to do something.
- *
- * If this row is selected, this routine just moves the cursor row and
- * column. Otherwise, it does the same thing as
- * e_selection_model_do_something(). This is for being used on
- * right clicks and other events where if the user hit the selection,
- * they don't want it to change.
- */
-gboolean
-e_selection_model_maybe_do_something (ESelectionModel *selection,
- guint row,
- guint col,
- GdkModifierType state)
-{
- selection->old_selection = -1;
-
- if (e_selection_model_is_row_selected(selection, row)) {
- e_selection_model_change_cursor(selection, row, col);
- gtk_signal_emit(GTK_OBJECT(selection),
- e_selection_model_signals[CURSOR_CHANGED], row, col);
- return FALSE;
- } else {
- e_selection_model_do_something(selection, row, col, state);
- return TRUE;
- }
-}
-
-void
-e_selection_model_right_click_down (ESelectionModel *selection,
- guint row,
- guint col,
- GdkModifierType state)
-{
- if (selection->mode == GTK_SELECTION_SINGLE) {
- selection->old_selection = e_selection_model_cursor_row (selection);
- e_selection_model_select_single_row (selection, row);
- } else {
- e_selection_model_maybe_do_something (selection, row, col, state);
- }
-}
-
-void
-e_selection_model_right_click_up (ESelectionModel *selection)
-{
- if (selection->mode == GTK_SELECTION_SINGLE && selection->old_selection != -1) {
- e_selection_model_select_single_row (selection, selection->old_selection);
- }
-}
-
-void
-e_selection_model_select_as_key_press (ESelectionModel *selection,
- guint row,
- guint col,
- GdkModifierType state)
-{
- int cursor_activated = TRUE;
-
- gint shift_p = state & GDK_SHIFT_MASK;
- gint ctrl_p = state & GDK_CONTROL_MASK;
-
- selection->old_selection = -1;
-
- switch (selection->mode) {
- case GTK_SELECTION_BROWSE:
- case GTK_SELECTION_MULTIPLE:
- case GTK_SELECTION_EXTENDED:
- if (shift_p) {
- e_selection_model_set_selection_end (selection, row);
- } else if (!ctrl_p) {
- e_selection_model_select_single_row (selection, row);
- } else
- cursor_activated = FALSE;
- break;
- case GTK_SELECTION_SINGLE:
- e_selection_model_select_single_row (selection, row);
- break;
- }
- if (row != -1) {
- e_selection_model_change_cursor(selection, row, col);
- gtk_signal_emit(GTK_OBJECT(selection),
- e_selection_model_signals[CURSOR_CHANGED], row, col);
- if (cursor_activated)
- gtk_signal_emit(GTK_OBJECT(selection),
- e_selection_model_signals[CURSOR_ACTIVATED], row, col);
- }
-}
-
-static gint
-move_selection (ESelectionModel *selection,
- gboolean up,
- GdkModifierType state)
-{
- int row = e_selection_model_cursor_row(selection);
- int col = e_selection_model_cursor_col(selection);
- int row_count;
-
- row = e_sorter_model_to_sorted(selection->sorter, row);
- if (up)
- row--;
- else
- row++;
- if (row < 0)
- row = 0;
- row_count = e_selection_model_row_count(selection);
- if (row >= row_count)
- row = row_count - 1;
- row = e_sorter_sorted_to_model(selection->sorter, row);
-
- e_selection_model_select_as_key_press (selection, row, col, state);
- return TRUE;
-}
-
-/**
- * e_selection_model_key_press
- * @selection: #ESelectionModel to affect.
- * @key: The event.
- *
- * This routine does whatever is appropriate as if the user pressed
- * the given key.
- *
- * Returns: %TRUE if the #ESelectionModel used the key.
- */
-gint
-e_selection_model_key_press (ESelectionModel *selection,
- GdkEventKey *key)
-{
- selection->old_selection = -1;
-
- switch (key->keyval) {
- case GDK_Up:
- case GDK_KP_Up:
- return move_selection(selection, TRUE, key->state);
- break;
- case GDK_Down:
- case GDK_KP_Down:
- return move_selection(selection, FALSE, key->state);
- break;
- case GDK_space:
- case GDK_KP_Space:
- if (selection->mode != GTK_SELECTION_SINGLE) {
- int row = e_selection_model_cursor_row(selection);
- int col = e_selection_model_cursor_col(selection);
- e_selection_model_toggle_single_row (selection, row);
- gtk_signal_emit(GTK_OBJECT(selection),
- e_selection_model_signals[CURSOR_ACTIVATED], row, col);
- return TRUE;
- }
- break;
- case GDK_Return:
- case GDK_KP_Enter:
- if (selection->mode != GTK_SELECTION_SINGLE) {
- int row = e_selection_model_cursor_row(selection);
- int col = e_selection_model_cursor_col(selection);
- e_selection_model_select_single_row (selection, row);
- gtk_signal_emit(GTK_OBJECT(selection),
- e_selection_model_signals[CURSOR_ACTIVATED], row, col);
- return TRUE;
- }
- break;
- case GDK_Home:
- case GDK_KP_Home:
- if (selection->cursor_mode == E_CURSOR_LINE) {
- int row = 0;
- int cursor_col = e_selection_model_cursor_col(selection);
-
- row = e_sorter_sorted_to_model(selection->sorter, row);
- e_selection_model_select_as_key_press (selection, row, cursor_col, key->state);
- return TRUE;
- }
- break;
- case GDK_End:
- case GDK_KP_End:
- if (selection->cursor_mode == E_CURSOR_LINE) {
- int row = e_selection_model_row_count(selection) - 1;
- int cursor_col = e_selection_model_cursor_col(selection);
-
- row = e_sorter_sorted_to_model(selection->sorter, row);
- e_selection_model_select_as_key_press (selection, row, cursor_col, key->state);
- return TRUE;
- }
- break;
- }
- return FALSE;
-}
-
-void
-e_selection_model_cursor_changed (ESelectionModel *selection,
- int row,
- int col)
-{
- gtk_signal_emit(GTK_OBJECT(selection),
- e_selection_model_signals[CURSOR_CHANGED], row, col);
-}
-
-void
-e_selection_model_cursor_activated (ESelectionModel *selection,
- int row,
- int col)
-{
- gtk_signal_emit(GTK_OBJECT(selection),
- e_selection_model_signals[CURSOR_ACTIVATED], row, col);
-}
-
-void
-e_selection_model_selection_changed (ESelectionModel *selection)
-{
- gtk_signal_emit(GTK_OBJECT(selection),
- e_selection_model_signals[SELECTION_CHANGED]);
-}
-
-void
-e_selection_model_selection_row_changed (ESelectionModel *selection,
- int row)
-{
- gtk_signal_emit(GTK_OBJECT(selection),
- e_selection_model_signals[SELECTION_ROW_CHANGED],
- row);
-}
diff --git a/widgets/misc/e-selection-model.h b/widgets/misc/e-selection-model.h
deleted file mode 100644
index fde97a0035..0000000000
--- a/widgets/misc/e-selection-model.h
+++ /dev/null
@@ -1,169 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-selection-model.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_SELECTION_MODEL_H_
-#define _E_SELECTION_MODEL_H_
-
-#include <gtk/gtkobject.h>
-#include <gal/util/e-sorter.h>
-#include <gdk/gdktypes.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#define E_SELECTION_MODEL_TYPE (e_selection_model_get_type ())
-#define E_SELECTION_MODEL(o) (GTK_CHECK_CAST ((o), E_SELECTION_MODEL_TYPE, ESelectionModel))
-#define E_SELECTION_MODEL_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_SELECTION_MODEL_TYPE, ESelectionModelClass))
-#define E_IS_SELECTION_MODEL(o) (GTK_CHECK_TYPE ((o), E_SELECTION_MODEL_TYPE))
-#define E_IS_SELECTION_MODEL_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_SELECTION_MODEL_TYPE))
-
-#ifndef _E_FOREACH_FUNC_H_
-#define _E_FOREACH_FUNC_H_
-typedef void (*EForeachFunc) (int model_row,
- gpointer closure);
-#endif
-
-/* list selection modes */
-typedef enum {
- E_CURSOR_LINE,
- E_CURSOR_SIMPLE,
- E_CURSOR_SPREADSHEET,
-} ECursorMode;
-
-typedef struct {
- GtkObject base;
-
- ESorter *sorter;
-
- GtkSelectionMode mode;
- ECursorMode cursor_mode;
-
- int old_selection;
-} ESelectionModel;
-
-typedef struct {
- GtkObjectClass parent_class;
-
- /* Virtual methods */
- gboolean (*is_row_selected) (ESelectionModel *esm, int row);
- void (*foreach) (ESelectionModel *esm, EForeachFunc callback, gpointer closure);
- void (*clear) (ESelectionModel *esm);
- gint (*selected_count) (ESelectionModel *esm);
- void (*select_all) (ESelectionModel *esm);
- void (*invert_selection) (ESelectionModel *esm);
- int (*row_count) (ESelectionModel *esm);
-
- /* Protected virtual methods. */
- void (*change_one_row) (ESelectionModel *esm, int row, gboolean on);
- void (*change_cursor) (ESelectionModel *esm, int row, int col);
- int (*cursor_row) (ESelectionModel *esm);
- int (*cursor_col) (ESelectionModel *esm);
-
- void (*select_single_row) (ESelectionModel *selection, int row);
- void (*toggle_single_row) (ESelectionModel *selection, int row);
- void (*move_selection_end) (ESelectionModel *selection, int row);
- void (*set_selection_end) (ESelectionModel *selection, int row);
-
- /*
- * Signals
- */
-
- void (*cursor_changed) (ESelectionModel *esm, int row, int col);
- void (*cursor_activated) (ESelectionModel *esm, int row, int col);
- void (*selection_row_changed) (ESelectionModel *esm, int row);
- void (*selection_changed) (ESelectionModel *esm);
-
-} ESelectionModelClass;
-
-
-GtkType e_selection_model_get_type (void);
-void e_selection_model_do_something (ESelectionModel *esm,
- guint row,
- guint col,
- GdkModifierType state);
-gboolean e_selection_model_maybe_do_something (ESelectionModel *esm,
- guint row,
- guint col,
- GdkModifierType state);
-void e_selection_model_right_click_down (ESelectionModel *selection,
- guint row,
- guint col,
- GdkModifierType state);
-void e_selection_model_right_click_up (ESelectionModel *selection);
-gint e_selection_model_key_press (ESelectionModel *esm,
- GdkEventKey *key);
-void e_selection_model_select_as_key_press (ESelectionModel *esm,
- guint row,
- guint col,
- GdkModifierType state);
-
-/* Virtual functions */
-gboolean e_selection_model_is_row_selected (ESelectionModel *esm,
- gint n);
-void e_selection_model_foreach (ESelectionModel *esm,
- EForeachFunc callback,
- gpointer closure);
-void e_selection_model_clear (ESelectionModel *esm);
-gint e_selection_model_selected_count (ESelectionModel *esm);
-void e_selection_model_select_all (ESelectionModel *esm);
-void e_selection_model_invert_selection (ESelectionModel *esm);
-int e_selection_model_row_count (ESelectionModel *esm);
-
-
-/* Private virtual Functions */
-void e_selection_model_change_one_row (ESelectionModel *esm,
- int row,
- gboolean on);
-void e_selection_model_change_cursor (ESelectionModel *esm,
- int row,
- int col);
-int e_selection_model_cursor_row (ESelectionModel *esm);
-int e_selection_model_cursor_col (ESelectionModel *esm);
-void e_selection_model_select_single_row (ESelectionModel *selection,
- int row);
-void e_selection_model_toggle_single_row (ESelectionModel *selection,
- int row);
-void e_selection_model_move_selection_end (ESelectionModel *selection,
- int row);
-void e_selection_model_set_selection_end (ESelectionModel *selection,
- int row);
-
-/* Signals */
-void e_selection_model_cursor_changed (ESelectionModel *selection,
- int row,
- int col);
-void e_selection_model_cursor_activated (ESelectionModel *selection,
- int row,
- int col);
-void e_selection_model_selection_row_changed (ESelectionModel *selection,
- int row);
-void e_selection_model_selection_changed (ESelectionModel *selection);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* _E_SELECTION_MODEL_H_ */
-
diff --git a/widgets/misc/e-unicode.c b/widgets/misc/e-unicode.c
deleted file mode 100644
index 1a3f606732..0000000000
--- a/widgets/misc/e-unicode.c
+++ /dev/null
@@ -1,3125 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-unicode.c - utf-8 support functions for gal
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Lauris Kaplinski <lauris@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-/*
- * TODO: Break simple ligatures in e_utf8_strstrcasedecomp
- */
-
-#include <config.h>
-
-#include "e-unicode.h"
-
-#include "gal/util/e-i18n.h"
-#include <ctype.h>
-#include <string.h>
-#include <stdio.h>
-#include <iconv.h>
-#include <gdk/gdk.h>
-#include <gdk/gdkx.h>
-#include <gdk/gdkkeysyms.h>
-#include <gtk/gtkmenuitem.h>
-#include "e-font.h"
-#include <gnome-xml/xmlmemory.h>
-#include <stdlib.h>
-#include "gal/util/e-iconv.h"
-
-#define d(x) x
-
-#define FONT_TESTING
-#define MAX_DECOMP 8
-
-static gint e_canonical_decomposition (gunichar ch, gunichar * buf);
-static gunichar e_stripped_char (gunichar ch);
-
-/*
- * This my favourite
- *
- * strstr doing case insensitive, decomposing search
- *
- * Lauris
- */
-
-const gchar *
-e_utf8_strstrcasedecomp (const gchar *haystack, const gchar *needle)
-{
- gunichar *nuni;
- gunichar unival;
- gint nlen;
- const guchar *o, *p;
-
- if (haystack == NULL) return NULL;
- if (needle == NULL) return NULL;
- if (strlen (needle) == 0) return haystack;
- if (strlen (haystack) == 0) return NULL;
-
- nuni = alloca (sizeof (gunichar) * strlen (needle));
-
- nlen = 0;
- for (p = e_unicode_get_utf8 (needle, &unival); p && unival; p = e_unicode_get_utf8 (p, &unival)) {
- gint sc;
- sc = e_stripped_char (unival);
- if (sc) {
- nuni[nlen++] = sc;
- }
- }
- /* NULL means there was illegal utf-8 sequence */
- if (!p) return NULL;
- /* If everything is correct, we have decomposed, lowercase, stripped needle */
- if (nlen < 1) return haystack;
-
- o = haystack;
- for (p = e_unicode_get_utf8 (o, &unival); p && unival; p = e_unicode_get_utf8 (p, &unival)) {
- gint sc;
- sc = e_stripped_char (unival);
- if (sc) {
- /* We have valid stripped char */
- if (sc == nuni[0]) {
- const gchar *q = p;
- gint npos = 1;
- while (npos < nlen) {
- q = e_unicode_get_utf8 (q, &unival);
- if (!q || !unival) return NULL;
- sc = e_stripped_char (unival);
- if ((!sc) || (sc != nuni[npos])) break;
- npos++;
- }
- if (npos == nlen) {
- return o;
- }
- }
- }
- o = p;
- }
-
- return NULL;
-}
-
-const gchar *
-e_utf8_strstrcase (const gchar *haystack, const gchar *needle)
-{
- gunichar *nuni;
- gunichar unival;
- gint nlen;
- const guchar *o, *p;
-
- if (haystack == NULL) return NULL;
- if (needle == NULL) return NULL;
- if (strlen (needle) == 0) return haystack;
- if (strlen (haystack) == 0) return NULL;
-
- nuni = alloca (sizeof (gunichar) * strlen (needle));
-
- nlen = 0;
- for (p = e_unicode_get_utf8 (needle, &unival); p && unival; p = e_unicode_get_utf8 (p, &unival)) {
- nuni[nlen++] = g_unichar_tolower (unival);
- }
- /* NULL means there was illegal utf-8 sequence */
- if (!p) return NULL;
-
- o = haystack;
- for (p = e_unicode_get_utf8 (o, &unival); p && unival; p = e_unicode_get_utf8 (p, &unival)) {
- gint sc;
- sc = g_unichar_tolower (unival);
- /* We have valid stripped char */
- if (sc == nuni[0]) {
- const gchar *q = p;
- gint npos = 1;
- while (npos < nlen) {
- q = e_unicode_get_utf8 (q, &unival);
- if (!q || !unival) return NULL;
- sc = g_unichar_tolower (unival);
- if (sc != nuni[npos]) break;
- npos++;
- }
- if (npos == nlen) {
- return o;
- }
- }
- o = p;
- }
-
- return NULL;
-}
-
-#if 0
-const gchar *
-e_utf8_strstrcase (const gchar *haystack, const gchar *needle)
-{
- gchar *p;
- gunichar *huni, *nuni;
- gunichar unival;
- gint hlen, nlen, hp, np;
-
- if (haystack == NULL) return NULL;
- if (needle == NULL) return NULL;
- if (strlen (needle) == 0) return haystack;
-
- huni = alloca (sizeof (gunichar) * strlen (haystack));
-
- for (hlen = 0, p = e_unicode_get_utf8 (haystack, &unival); p && unival; hlen++, p = e_unicode_get_utf8 (p, &unival)) {
- huni[hlen] = g_unichar_tolower (unival);
- }
-
- if (!p) return NULL;
- if (hlen == 0) return NULL;
-
- nuni = alloca (sizeof (gunichar) * strlen (needle));
-
- for (nlen = 0, p = e_unicode_get_utf8 (needle, &unival); p && unival; nlen++, p = e_unicode_get_utf8 (p, &unival)) {
- nuni[nlen] = g_unichar_tolower (unival);
- }
-
- if (!p) return NULL;
- if (nlen == 0) return NULL;
-
- if (hlen < nlen) return NULL;
-
- for (hp = 0; hp <= hlen - nlen; hp++) {
- for (np = 0; np < nlen; np++) {
- if (huni[hp + np] != nuni[np]) break;
- }
- if (np == nlen) return haystack + unicode_offset_to_index (haystack, hp);
- }
-
- return NULL;
-}
-#endif
-
-gchar *
-e_utf8_from_gtk_event_key (GtkWidget *widget, guint keyval, const gchar *string)
-{
- gint unival;
- gchar *utf;
- gint unilen;
-
- if (keyval == GDK_VoidSymbol) {
- utf = e_utf8_from_locale_string (string);
- } else {
- unival = gdk_keyval_to_unicode (keyval);
-
- if (unival < ' ') return NULL;
-
- utf = g_new (gchar, 7);
-
- unilen = e_unichar_to_utf8 (unival, utf);
-
- utf[unilen] = '\0';
- }
-
- return utf;
-}
-
-gchar *
-e_utf8_from_iconv_string_sized (iconv_t ic, const gchar *string, gint bytes)
-{
- char *new, *ob;
- const char *ib;
- size_t ibl, obl;
-
- if (!string) return NULL;
-
- if (ic == (iconv_t) -1) {
- gint i;
- /* iso-8859-1 */
- ib = (char *) string;
- new = ob = g_new (unsigned char, bytes * 2 + 1);
- for (i = 0; i < (bytes); i ++) {
- ob += e_unichar_to_utf8 (ib[i], ob);
- }
- *ob = '\0';
- return new;
- }
-
- ib = string;
- ibl = bytes;
- new = ob = g_new (gchar, ibl * 6 + 1);
- obl = ibl * 6 + 1;
-
- while (ibl > 0) {
- e_iconv (ic, &ib, &ibl, &ob, &obl);
- if (ibl > 0) {
- gint len;
- if ((*ib & 0x80) == 0x00) len = 1;
- else if ((*ib &0xe0) == 0xc0) len = 2;
- else if ((*ib &0xf0) == 0xe0) len = 3;
- else if ((*ib &0xf8) == 0xf0) len = 4;
- else {
- g_warning ("Invalid UTF-8 sequence");
- break;
- }
- ib += len;
- ibl = bytes - (ib - string);
- if (ibl > bytes) ibl = 0;
- *ob++ = '_';
- obl--;
- }
- }
-
- *ob = '\0';
-
- return new;
-}
-
-gchar *
-e_utf8_from_iconv_string (iconv_t ic, const gchar *string)
-{
- if (!string) return NULL;
- return e_utf8_from_iconv_string_sized (ic, string, strlen (string));
-}
-
-gchar *
-e_utf8_to_iconv_string_sized (iconv_t ic, const gchar *string, gint bytes)
-{
- char *new, *ob;
- const char *ib;
- size_t ibl, obl;
-
- if (!string) return NULL;
-
- if (ic == (iconv_t) -1) {
- gint len;
- const gchar *u;
- gunichar uc;
-
- new = g_new (unsigned char, bytes * 4 + 1);
- u = string;
- len = 0;
-
- while ((u) && (u - string < bytes)) {
- u = e_unicode_get_utf8 (u, &uc);
- new[len++] = uc & 0xff;
- }
- new[len] = '\0';
- return new;
- }
-
- ib = string;
- ibl = bytes;
- new = ob = g_new (gchar, ibl * 4 + 1);
- obl = ibl * 4 + 1;
-
- while (ibl > 0) {
- e_iconv (ic, &ib, &ibl, &ob, &obl);
- if (ibl > 0) {
- gint len;
- if ((*ib & 0x80) == 0x00) len = 1;
- else if ((*ib &0xe0) == 0xc0) len = 2;
- else if ((*ib &0xf0) == 0xe0) len = 3;
- else if ((*ib &0xf8) == 0xf0) len = 4;
- else {
- g_warning ("Invalid UTF-8 sequence");
- break;
- }
- ib += len;
- ibl = bytes - (ib - string);
- if (ibl > bytes) ibl = 0;
- *ob++ = '_';
- obl--;
- }
- }
-
- *ob = '\0';
-
- return new;
-}
-
-gchar *
-e_utf8_to_iconv_string (iconv_t ic, const gchar *string)
-{
- if (!string) return NULL;
- return e_utf8_to_iconv_string_sized (ic, string, strlen (string));
-}
-
-gchar *
-e_utf8_from_charset_string_sized (const gchar *charset, const gchar *string, gint bytes)
-{
- iconv_t ic;
- char *ret;
-
- if (!string) return NULL;
-
- ic = e_iconv_open("utf-8", charset);
- ret = e_utf8_from_iconv_string_sized (ic, string, bytes);
- e_iconv_close(ic);
-
- return ret;
-}
-
-gchar *
-e_utf8_from_charset_string (const gchar *charset, const gchar *string)
-{
- if (!string) return NULL;
- return e_utf8_from_charset_string_sized (charset, string, strlen (string));
-}
-
-gchar *
-e_utf8_to_charset_string_sized (const gchar *charset, const gchar *string, gint bytes)
-{
- iconv_t ic;
- char *ret;
-
- if (!string) return NULL;
-
- ic = e_iconv_open(charset, "utf-8");
- ret = e_utf8_to_iconv_string_sized (ic, string, bytes);
- e_iconv_close(ic);
-
- return ret;
-}
-
-gchar *
-e_utf8_to_charset_string (const gchar *charset, const gchar *string)
-{
- if (!string) return NULL;
- return e_utf8_to_charset_string_sized (charset, string, strlen (string));
-}
-
-gchar *
-e_utf8_from_gtk_string_sized (GtkWidget *widget, const gchar *string, gint bytes)
-{
- iconv_t ic;
- char *new, *ob;
- const char *ib;
- size_t ibl, obl;
-
- g_return_val_if_fail (widget != NULL, NULL);
- g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
-
- if (!string) return NULL;
-
- g_return_val_if_fail (widget, NULL);
-
- ic = e_iconv_from_gdk_font (widget->style->font);
- if (ic == (iconv_t) -1) {
- XFontStruct *xfs;
- /* If iconv is missing we assume either iso-10646 or iso-8859-1 */
- xfs = GDK_FONT_XFONT (widget->style->font);
- if (widget->style->font->type == GDK_FONT_FONTSET || ((xfs->min_byte1 != 0) || (xfs->max_byte1 != 0))) {
- gint i;
- const guchar *ib;
- guchar * ob, * new;
- /* iso-10646 */
- ib = string;
- new = ob = g_new (unsigned char, bytes * 6 + 1);
- for (i = 0; i < (bytes - 1); i += 2) {
- ob += e_unichar_to_utf8 (ib[i] * 256 + ib[i + 1], ob);
- }
- *ob = '\0';
- return new;
- } else {
- gint i;
- /* iso-8859-1 */
- ib = (char *) string;
- new = ob = g_new (unsigned char, bytes * 2 + 1);
- for (i = 0; i < (bytes); i ++) {
- ob += e_unichar_to_utf8 (ib[i], ob);
- }
- *ob = '\0';
- return new;
- }
- }
-
- ib = string;
- ibl = bytes;
- new = ob = g_new (gchar, ibl * 6 + 1);
- obl = ibl * 6 + 1;
-
- while (ibl > 0) {
- e_iconv (ic, &ib, &ibl, &ob, &obl);
- if (ibl > 0) {
- gint len;
- if ((*ib & 0x80) == 0x00) len = 1;
- else if ((*ib &0xe0) == 0xc0) len = 2;
- else if ((*ib &0xf0) == 0xe0) len = 3;
- else if ((*ib &0xf8) == 0xf0) len = 4;
- else {
- g_warning ("Invalid UTF-8 sequence");
- break;
- }
- ib += len;
- ibl = bytes - (ib - string);
- if (ibl > bytes) ibl = 0;
- *ob++ = '_';
- obl--;
- }
- }
-
- *ob = '\0';
-
- e_iconv_close(ic);
-
- return new;
-}
-
-gchar *
-e_utf8_from_gtk_string (GtkWidget *widget, const gchar *string)
-{
- if (!string) return NULL;
- return e_utf8_from_gtk_string_sized (widget, string, strlen (string));
-}
-
-gchar *
-e_utf8_to_gtk_string_sized (GtkWidget *widget, const gchar *string, gint bytes)
-{
- iconv_t ic;
- char *new, *ob;
- const char *ib;
- size_t ibl, obl;
-
- if (!string) return NULL;
-
- g_return_val_if_fail (widget, NULL);
-
- gtk_widget_ensure_style (widget);
- ic = e_iconv_to_gdk_font (widget->style->font);
- if (ic == (iconv_t) -1) {
- XFontStruct *xfs;
- gboolean twobyte;
- gint len;
- const gchar *u;
- gunichar uc;
- /* If iconv is missing we assume either iso-10646 or iso-8859-1 */
- xfs = GDK_FONT_XFONT (widget->style->font);
- twobyte = (widget->style->font->type == GDK_FONT_FONTSET || ((xfs->min_byte1 != 0) || (xfs->max_byte1 != 0)));
-
- new = g_new (unsigned char, bytes * 4 + 1);
- u = string;
- len = 0;
-
- while ((u) && (u - string < bytes)) {
- u = e_unicode_get_utf8 (u, &uc);
- if (twobyte) {
- new[len++] = (uc & 0xff00) >> 8;
- }
- new[len++] = uc & 0xff;
- }
- new[len] = '\0';
- return new;
- }
-
- ib = string;
- ibl = bytes;
- new = ob = g_new (gchar, ibl * 4 + 1);
- obl = ibl * 4 + 1;
-
- while (ibl > 0) {
- e_iconv (ic, &ib, &ibl, &ob, &obl);
- if (ibl > 0) {
- gint len;
- if ((*ib & 0x80) == 0x00) len = 1;
- else if ((*ib &0xe0) == 0xc0) len = 2;
- else if ((*ib &0xf0) == 0xe0) len = 3;
- else if ((*ib &0xf8) == 0xf0) len = 4;
- else {
- g_warning ("Invalid UTF-8 sequence");
- break;
- }
- ib += len;
- ibl = bytes - (ib - string);
- if (ibl > bytes) ibl = 0;
- *ob++ = '_';
- obl--;
- }
- }
-
- *ob = '\0';
-
- e_iconv_close(ic);
-
- return new;
-}
-
-gchar *
-e_utf8_to_gtk_string (GtkWidget *widget, const gchar *string)
-{
- if (!string) return NULL;
- return e_utf8_to_gtk_string_sized (widget, string, strlen (string));
-}
-
-gchar *
-e_utf8_from_locale_string_sized (const gchar *string, gint bytes)
-{
- iconv_t ic;
- char *ret;
-
- if (!string) return NULL;
-
- ic = e_iconv_open("utf-8", e_iconv_locale_charset());
- ret = e_utf8_from_iconv_string_sized (ic, string, bytes);
- e_iconv_close(ic);
-
- return ret;
-}
-
-gchar *
-e_utf8_from_locale_string (const gchar *string)
-{
- if (!string) return NULL;
- return e_utf8_from_locale_string_sized (string, strlen (string));
-}
-
-gchar *
-e_utf8_to_locale_string_sized (const gchar *string, gint bytes)
-{
- iconv_t ic;
- char *ret;
-
- if (!string) return NULL;
-
- ic = e_iconv_open(e_iconv_locale_charset(), "utf-8");
- ret = e_utf8_to_iconv_string_sized (ic, string, bytes);
- e_iconv_close(ic);
-
- return ret;
-}
-
-gchar *
-e_utf8_to_locale_string (const gchar *string)
-{
- if (!string) return NULL;
- return e_utf8_to_locale_string_sized (string, strlen (string));
-}
-
-gboolean
-e_utf8_is_ascii (const gchar *string)
-{
- char c;
-
- g_return_val_if_fail (string != NULL, FALSE);
-
- for (; (c = *string); string++) {
- if (c & 0x80)
- return FALSE;
- }
-
- return TRUE;
-}
-
-gchar *
-e_utf8_gtk_entry_get_text (GtkEntry *entry)
-{
- gchar *s, *u;
-
- s = gtk_entry_get_text (entry);
- if (!s) return NULL;
- u = e_utf8_from_gtk_string ((GtkWidget *) entry, s);
- return u;
-}
-
-gchar *
-e_utf8_gtk_editable_get_text (GtkEditable *editable)
-{
- return e_utf8_gtk_editable_get_chars(editable, 0, -1);
-}
-
-gchar *
-e_utf8_gtk_editable_get_chars (GtkEditable *editable, gint start, gint end)
-{
- gchar *s, *u;
-
- s = gtk_editable_get_chars (editable, start, end);
- u = e_utf8_from_gtk_string ((GtkWidget *) editable, s);
- g_free (s);
- return u;
-}
-
-void
-e_utf8_gtk_editable_insert_text (GtkEditable *editable, const gchar *text, gint length, gint *position)
-{
- gchar *s;
-
- s = e_utf8_to_gtk_string_sized ((GtkWidget *) editable, text, length);
-
- gtk_editable_insert_text (editable, s, length, position);
-
- g_free (s);
-}
-
-void
-e_utf8_gtk_editable_set_text (GtkEditable *editable, const gchar *text)
-{
- int position;
- gtk_editable_delete_text(editable, 0, -1);
- if (text)
- e_utf8_gtk_editable_insert_text(editable, text, strlen(text), &position);
-}
-
-void
-e_utf8_gtk_entry_set_text (GtkEntry *entry, const gchar *text)
-{
- if (!text)
- gtk_entry_set_text(entry, "");
- else {
- gchar *s;
-
- s = e_utf8_to_gtk_string ((GtkWidget *) entry, text);
- gtk_entry_set_text (entry, s);
-
- if (s) g_free (s);
- }
-}
-
-GtkWidget *
-e_utf8_gtk_menu_item_new_with_label (GtkMenu *menu, const gchar *label)
-{
- GtkWidget *w;
- gchar *s;
-
- if (!label) return NULL;
-
- s = e_utf8_to_gtk_string ((GtkWidget *) menu, label);
- w = gtk_menu_item_new_with_label (s);
-
- g_free (s);
-
- return w;
-}
-
-void
-e_utf8_gtk_clist_set_text (GtkCList *clist, gint row, gint col, const gchar *text)
-{
- gchar *s;
-
- if (!text) return;
-
- s = e_utf8_to_gtk_string ((GtkWidget *) clist, text);
- gtk_clist_set_text (clist, row, col, s);
-
- if (s) g_free (s);
-}
-
-gint
-e_utf8_gtk_clist_append (GtkCList *clist, gchar *text[])
-{
- gint row, i;
- gchar **v;
-
- if (!text) return 0;
-
- v = g_new (gchar *, clist->columns);
- for (i = 0; i < clist->columns; i++)
- v[i] = e_utf8_to_gtk_string ((GtkWidget *) clist, text[i]);
-
- row = gtk_clist_append (clist, v);
-
- for (i = 0; i < clist->columns; i++)
- if (v[i]) g_free (v[i]);
-
- return row;
-}
-
-/*
- * Translate \U+XXXX\ sequences to utf8 chars
- */
-
-gchar *
-e_utf8_xml1_decode (const gchar *text)
-{
- const guchar *c;
- guchar *u, *d;
- int len, s;
-
- g_return_val_if_fail (text != NULL, NULL);
-
- len = strlen (text)+1;
- /* len * 2 is absolute maximum */
- u = d = g_malloc (len * 2);
-
- c = text;
- s = 0;
- while (s < len) {
- if ((s <= (len - 8)) &&
- (c[s ] == '\\') &&
- (c[s + 1] == 'U' ) &&
- (c[s + 2] == '+' ) &&
- isxdigit (c[s + 3]) &&
- isxdigit (c[s + 4]) &&
- isxdigit (c[s + 5]) &&
- isxdigit (c[s + 6]) &&
- (c[s + 7] == '\\')) {
- /* Valid \U+XXXX\ sequence */
- unsigned int unival;
- unival = strtol (c + s + 3, NULL, 16);
- d += e_unichar_to_utf8 (unival, d);
- s += 8;
- } else if (c[s] > 127) {
- /* fixme: We assume iso-8859-1 currently */
- d += e_unichar_to_utf8 (c[s], d);
- s += 1;
- } else {
- *d++ = c[s++];
- }
- }
- *d++ = '\0';
- u = g_realloc (u, (d - u));
-
- return u;
-}
-
-gchar *
-e_utf8_xml1_encode (const gchar *text)
-{
- guchar *u, *d, *c;
- int unival;
- int len;
-
- g_return_val_if_fail (text != NULL, NULL);
-
- len = 0;
- for (u = e_unicode_get_utf8 (text, &unival); u && unival; u = e_unicode_get_utf8 (u, &unival)) {
- if ((unival >= 0x80) || (unival == '\\')) {
- len += 8;
- } else {
- len += 1;
- }
- }
- d = c = g_new (guchar, len + 1);
-
- for (u = e_unicode_get_utf8 (text, &unival); u && unival; u = e_unicode_get_utf8 (u, &unival)) {
- if ((unival >= 0x80) || (unival == '\\')) {
- *c++ = '\\';
- *c++ = 'U';
- *c++ = '+';
- c += sprintf (c, "%04x", unival);
- *c++ = '\\';
- } else {
- *c++ = unival;
- }
- }
- *c = '\0';
-
- return d;
-}
-
-/**
- * e_unichar_to_utf8:
- * @c: a ISO10646 character code
- * @outbuf: output buffer, must have at least 6 bytes of space.
- * If %NULL, the length will be computed and returned
- * and nothing will be written to @out.
- *
- * Convert a single character to utf8
- *
- * Return value: number of bytes written
- **/
-
-gint
-e_unichar_to_utf8 (gint c, gchar *outbuf)
-{
- size_t len = 0;
- int first;
- int i;
-
- if (c < 0x80)
- {
- first = 0;
- len = 1;
- }
- else if (c < 0x800)
- {
- first = 0xc0;
- len = 2;
- }
- else if (c < 0x10000)
- {
- first = 0xe0;
- len = 3;
- }
- else if (c < 0x200000)
- {
- first = 0xf0;
- len = 4;
- }
- else if (c < 0x4000000)
- {
- first = 0xf8;
- len = 5;
- }
- else
- {
- first = 0xfc;
- len = 6;
- }
-
- if (outbuf)
- {
- for (i = len - 1; i > 0; --i)
- {
- outbuf[i] = (c & 0x3f) | 0x80;
- c >>= 6;
- }
- outbuf[0] = c | first;
- }
-
- return len;
-}
-
-gchar *
-e_unicode_get_utf8 (const gchar *text, gunichar *out)
-{
- *out = g_utf8_get_char (text);
- return (*out == (gunichar)-1) ? NULL : g_utf8_next_char (text);
-}
-
-/*
- * The following is borrowed from Gtk+ 1.3
- */
-
-/* Thanks to Markus G. Kuhn <mkuhn@acm.org> for the ksysym<->Unicode
- * mapping functions, from the xterm sources.
- */
-
-/* These tables could be compressed by contiguous ranges, but the benefit of doing so
- * is smallish. It would save about ~1000 bytes total.
- */
-
-static struct {
- unsigned short keysym;
- unsigned short ucs;
-} gdk_keysym_to_unicode_tab[] = {
- { 0x01a1, 0x0104 }, /* Aogonek Ä„ LATIN CAPITAL LETTER A WITH OGONEK */
- { 0x01a2, 0x02d8 }, /* breve ˘ BREVE */
- { 0x01a3, 0x0141 }, /* Lstroke Å LATIN CAPITAL LETTER L WITH STROKE */
- { 0x01a5, 0x013d }, /* Lcaron Ľ LATIN CAPITAL LETTER L WITH CARON */
- { 0x01a6, 0x015a }, /* Sacute Åš LATIN CAPITAL LETTER S WITH ACUTE */
- { 0x01a9, 0x0160 }, /* Scaron Å  LATIN CAPITAL LETTER S WITH CARON */
- { 0x01aa, 0x015e }, /* Scedilla Åž LATIN CAPITAL LETTER S WITH CEDILLA */
- { 0x01ab, 0x0164 }, /* Tcaron Ť LATIN CAPITAL LETTER T WITH CARON */
- { 0x01ac, 0x0179 }, /* Zacute Ź LATIN CAPITAL LETTER Z WITH ACUTE */
- { 0x01ae, 0x017d }, /* Zcaron Ž LATIN CAPITAL LETTER Z WITH CARON */
- { 0x01af, 0x017b }, /* Zabovedot Å» LATIN CAPITAL LETTER Z WITH DOT ABOVE */
- { 0x01b1, 0x0105 }, /* aogonek Ä… LATIN SMALL LETTER A WITH OGONEK */
- { 0x01b2, 0x02db }, /* ogonek Ë› OGONEK */
- { 0x01b3, 0x0142 }, /* lstroke Å‚ LATIN SMALL LETTER L WITH STROKE */
- { 0x01b5, 0x013e }, /* lcaron ľ LATIN SMALL LETTER L WITH CARON */
- { 0x01b6, 0x015b }, /* sacute Å› LATIN SMALL LETTER S WITH ACUTE */
- { 0x01b7, 0x02c7 }, /* caron ˇ CARON */
- { 0x01b9, 0x0161 }, /* scaron Å¡ LATIN SMALL LETTER S WITH CARON */
- { 0x01ba, 0x015f }, /* scedilla ÅŸ LATIN SMALL LETTER S WITH CEDILLA */
- { 0x01bb, 0x0165 }, /* tcaron ť LATIN SMALL LETTER T WITH CARON */
- { 0x01bc, 0x017a }, /* zacute ź LATIN SMALL LETTER Z WITH ACUTE */
- { 0x01bd, 0x02dd }, /* doubleacute Ë DOUBLE ACUTE ACCENT */
- { 0x01be, 0x017e }, /* zcaron ž LATIN SMALL LETTER Z WITH CARON */
- { 0x01bf, 0x017c }, /* zabovedot ż LATIN SMALL LETTER Z WITH DOT ABOVE */
- { 0x01c0, 0x0154 }, /* Racute Å” LATIN CAPITAL LETTER R WITH ACUTE */
- { 0x01c3, 0x0102 }, /* Abreve Ä‚ LATIN CAPITAL LETTER A WITH BREVE */
- { 0x01c5, 0x0139 }, /* Lacute Ĺ LATIN CAPITAL LETTER L WITH ACUTE */
- { 0x01c6, 0x0106 }, /* Cacute Ć LATIN CAPITAL LETTER C WITH ACUTE */
- { 0x01c8, 0x010c }, /* Ccaron Č LATIN CAPITAL LETTER C WITH CARON */
- { 0x01ca, 0x0118 }, /* Eogonek Ę LATIN CAPITAL LETTER E WITH OGONEK */
- { 0x01cc, 0x011a }, /* Ecaron Äš LATIN CAPITAL LETTER E WITH CARON */
- { 0x01cf, 0x010e }, /* Dcaron ÄŽ LATIN CAPITAL LETTER D WITH CARON */
- { 0x01d0, 0x0110 }, /* Dstroke Ä LATIN CAPITAL LETTER D WITH STROKE */
- { 0x01d1, 0x0143 }, /* Nacute Ń LATIN CAPITAL LETTER N WITH ACUTE */
- { 0x01d2, 0x0147 }, /* Ncaron Ň LATIN CAPITAL LETTER N WITH CARON */
- { 0x01d5, 0x0150 }, /* Odoubleacute Å LATIN CAPITAL LETTER O WITH DOUBLE ACUTE */
- { 0x01d8, 0x0158 }, /* Rcaron Ř LATIN CAPITAL LETTER R WITH CARON */
- { 0x01d9, 0x016e }, /* Uring Å® LATIN CAPITAL LETTER U WITH RING ABOVE */
- { 0x01db, 0x0170 }, /* Udoubleacute Å° LATIN CAPITAL LETTER U WITH DOUBLE ACUTE */
- { 0x01de, 0x0162 }, /* Tcedilla Ţ LATIN CAPITAL LETTER T WITH CEDILLA */
- { 0x01e0, 0x0155 }, /* racute Å• LATIN SMALL LETTER R WITH ACUTE */
- { 0x01e3, 0x0103 }, /* abreve ă LATIN SMALL LETTER A WITH BREVE */
- { 0x01e5, 0x013a }, /* lacute ĺ LATIN SMALL LETTER L WITH ACUTE */
- { 0x01e6, 0x0107 }, /* cacute ć LATIN SMALL LETTER C WITH ACUTE */
- { 0x01e8, 0x010d }, /* ccaron Ä LATIN SMALL LETTER C WITH CARON */
- { 0x01ea, 0x0119 }, /* eogonek Ä™ LATIN SMALL LETTER E WITH OGONEK */
- { 0x01ec, 0x011b }, /* ecaron Ä› LATIN SMALL LETTER E WITH CARON */
- { 0x01ef, 0x010f }, /* dcaron Ä LATIN SMALL LETTER D WITH CARON */
- { 0x01f0, 0x0111 }, /* dstroke Ä‘ LATIN SMALL LETTER D WITH STROKE */
- { 0x01f1, 0x0144 }, /* nacute Å„ LATIN SMALL LETTER N WITH ACUTE */
- { 0x01f2, 0x0148 }, /* ncaron ň LATIN SMALL LETTER N WITH CARON */
- { 0x01f5, 0x0151 }, /* odoubleacute Å‘ LATIN SMALL LETTER O WITH DOUBLE ACUTE */
- { 0x01f8, 0x0159 }, /* rcaron Å™ LATIN SMALL LETTER R WITH CARON */
- { 0x01f9, 0x016f }, /* uring ů LATIN SMALL LETTER U WITH RING ABOVE */
- { 0x01fb, 0x0171 }, /* udoubleacute ű LATIN SMALL LETTER U WITH DOUBLE ACUTE */
- { 0x01fe, 0x0163 }, /* tcedilla ţ LATIN SMALL LETTER T WITH CEDILLA */
- { 0x01ff, 0x02d9 }, /* abovedot Ë™ DOT ABOVE */
- { 0x02a1, 0x0126 }, /* Hstroke Ħ LATIN CAPITAL LETTER H WITH STROKE */
- { 0x02a6, 0x0124 }, /* Hcircumflex Ĥ LATIN CAPITAL LETTER H WITH CIRCUMFLEX */
- { 0x02a9, 0x0130 }, /* Iabovedot Ä° LATIN CAPITAL LETTER I WITH DOT ABOVE */
- { 0x02ab, 0x011e }, /* Gbreve Äž LATIN CAPITAL LETTER G WITH BREVE */
- { 0x02ac, 0x0134 }, /* Jcircumflex Ä´ LATIN CAPITAL LETTER J WITH CIRCUMFLEX */
- { 0x02b1, 0x0127 }, /* hstroke ħ LATIN SMALL LETTER H WITH STROKE */
- { 0x02b6, 0x0125 }, /* hcircumflex ĥ LATIN SMALL LETTER H WITH CIRCUMFLEX */
- { 0x02b9, 0x0131 }, /* idotless ı LATIN SMALL LETTER DOTLESS I */
- { 0x02bb, 0x011f }, /* gbreve ÄŸ LATIN SMALL LETTER G WITH BREVE */
- { 0x02bc, 0x0135 }, /* jcircumflex ĵ LATIN SMALL LETTER J WITH CIRCUMFLEX */
- { 0x02c5, 0x010a }, /* Cabovedot ÄŠ LATIN CAPITAL LETTER C WITH DOT ABOVE */
- { 0x02c6, 0x0108 }, /* Ccircumflex Ĉ LATIN CAPITAL LETTER C WITH CIRCUMFLEX */
- { 0x02d5, 0x0120 }, /* Gabovedot Ä  LATIN CAPITAL LETTER G WITH DOT ABOVE */
- { 0x02d8, 0x011c }, /* Gcircumflex Ĝ LATIN CAPITAL LETTER G WITH CIRCUMFLEX */
- { 0x02dd, 0x016c }, /* Ubreve Ŭ LATIN CAPITAL LETTER U WITH BREVE */
- { 0x02de, 0x015c }, /* Scircumflex Ŝ LATIN CAPITAL LETTER S WITH CIRCUMFLEX */
- { 0x02e5, 0x010b }, /* cabovedot Ä‹ LATIN SMALL LETTER C WITH DOT ABOVE */
- { 0x02e6, 0x0109 }, /* ccircumflex ĉ LATIN SMALL LETTER C WITH CIRCUMFLEX */
- { 0x02f5, 0x0121 }, /* gabovedot Ä¡ LATIN SMALL LETTER G WITH DOT ABOVE */
- { 0x02f8, 0x011d }, /* gcircumflex Ä LATIN SMALL LETTER G WITH CIRCUMFLEX */
- { 0x02fd, 0x016d }, /* ubreve Å­ LATIN SMALL LETTER U WITH BREVE */
- { 0x02fe, 0x015d }, /* scircumflex Å LATIN SMALL LETTER S WITH CIRCUMFLEX */
- { 0x03a2, 0x0138 }, /* kra ĸ LATIN SMALL LETTER KRA */
- { 0x03a3, 0x0156 }, /* Rcedilla Å– LATIN CAPITAL LETTER R WITH CEDILLA */
- { 0x03a5, 0x0128 }, /* Itilde Ĩ LATIN CAPITAL LETTER I WITH TILDE */
- { 0x03a6, 0x013b }, /* Lcedilla Ä» LATIN CAPITAL LETTER L WITH CEDILLA */
- { 0x03aa, 0x0112 }, /* Emacron Ä’ LATIN CAPITAL LETTER E WITH MACRON */
- { 0x03ab, 0x0122 }, /* Gcedilla Ģ LATIN CAPITAL LETTER G WITH CEDILLA */
- { 0x03ac, 0x0166 }, /* Tslash Ŧ LATIN CAPITAL LETTER T WITH STROKE */
- { 0x03b3, 0x0157 }, /* rcedilla Å— LATIN SMALL LETTER R WITH CEDILLA */
- { 0x03b5, 0x0129 }, /* itilde Ä© LATIN SMALL LETTER I WITH TILDE */
- { 0x03b6, 0x013c }, /* lcedilla ļ LATIN SMALL LETTER L WITH CEDILLA */
- { 0x03ba, 0x0113 }, /* emacron Ä“ LATIN SMALL LETTER E WITH MACRON */
- { 0x03bb, 0x0123 }, /* gcedilla ģ LATIN SMALL LETTER G WITH CEDILLA */
- { 0x03bc, 0x0167 }, /* tslash ŧ LATIN SMALL LETTER T WITH STROKE */
- { 0x03bd, 0x014a }, /* ENG ÅŠ LATIN CAPITAL LETTER ENG */
- { 0x03bf, 0x014b }, /* eng Å‹ LATIN SMALL LETTER ENG */
- { 0x03c0, 0x0100 }, /* Amacron Ā LATIN CAPITAL LETTER A WITH MACRON */
- { 0x03c7, 0x012e }, /* Iogonek Ä® LATIN CAPITAL LETTER I WITH OGONEK */
- { 0x03cc, 0x0116 }, /* Eabovedot Ä– LATIN CAPITAL LETTER E WITH DOT ABOVE */
- { 0x03cf, 0x012a }, /* Imacron Ī LATIN CAPITAL LETTER I WITH MACRON */
- { 0x03d1, 0x0145 }, /* Ncedilla Å… LATIN CAPITAL LETTER N WITH CEDILLA */
- { 0x03d2, 0x014c }, /* Omacron Ō LATIN CAPITAL LETTER O WITH MACRON */
- { 0x03d3, 0x0136 }, /* Kcedilla Ķ LATIN CAPITAL LETTER K WITH CEDILLA */
- { 0x03d9, 0x0172 }, /* Uogonek Ų LATIN CAPITAL LETTER U WITH OGONEK */
- { 0x03dd, 0x0168 }, /* Utilde Ũ LATIN CAPITAL LETTER U WITH TILDE */
- { 0x03de, 0x016a }, /* Umacron Ū LATIN CAPITAL LETTER U WITH MACRON */
- { 0x03e0, 0x0101 }, /* amacron Ä LATIN SMALL LETTER A WITH MACRON */
- { 0x03e7, 0x012f }, /* iogonek į LATIN SMALL LETTER I WITH OGONEK */
- { 0x03ec, 0x0117 }, /* eabovedot Ä— LATIN SMALL LETTER E WITH DOT ABOVE */
- { 0x03ef, 0x012b }, /* imacron Ä« LATIN SMALL LETTER I WITH MACRON */
- { 0x03f1, 0x0146 }, /* ncedilla ņ LATIN SMALL LETTER N WITH CEDILLA */
- { 0x03f2, 0x014d }, /* omacron Å LATIN SMALL LETTER O WITH MACRON */
- { 0x03f3, 0x0137 }, /* kcedilla Ä· LATIN SMALL LETTER K WITH CEDILLA */
- { 0x03f9, 0x0173 }, /* uogonek ų LATIN SMALL LETTER U WITH OGONEK */
- { 0x03fd, 0x0169 }, /* utilde Å© LATIN SMALL LETTER U WITH TILDE */
- { 0x03fe, 0x016b }, /* umacron Å« LATIN SMALL LETTER U WITH MACRON */
- { 0x047e, 0x203e }, /* overline ‾ OVERLINE */
- { 0x04a1, 0x3002 }, /* kana_fullstop 。 IDEOGRAPHIC FULL STOP */
- { 0x04a2, 0x300c }, /* kana_openingbracket 「 LEFT CORNER BRACKET */
- { 0x04a3, 0x300d }, /* kana_closingbracket 〠RIGHT CORNER BRACKET */
- { 0x04a4, 0x3001 }, /* kana_comma 〠IDEOGRAPHIC COMMA */
- { 0x04a5, 0x30fb }, /* kana_conjunctive ・ KATAKANA MIDDLE DOT */
- { 0x04a6, 0x30f2 }, /* kana_WO ヲ KATAKANA LETTER WO */
- { 0x04a7, 0x30a1 }, /* kana_a ã‚¡ KATAKANA LETTER SMALL A */
- { 0x04a8, 0x30a3 }, /* kana_i ã‚£ KATAKANA LETTER SMALL I */
- { 0x04a9, 0x30a5 }, /* kana_u ã‚¥ KATAKANA LETTER SMALL U */
- { 0x04aa, 0x30a7 }, /* kana_e ェ KATAKANA LETTER SMALL E */
- { 0x04ab, 0x30a9 }, /* kana_o ã‚© KATAKANA LETTER SMALL O */
- { 0x04ac, 0x30e3 }, /* kana_ya ャ KATAKANA LETTER SMALL YA */
- { 0x04ad, 0x30e5 }, /* kana_yu ュ KATAKANA LETTER SMALL YU */
- { 0x04ae, 0x30e7 }, /* kana_yo ョ KATAKANA LETTER SMALL YO */
- { 0x04af, 0x30c3 }, /* kana_tsu ッ KATAKANA LETTER SMALL TU */
- { 0x04b0, 0x30fc }, /* prolongedsound ー KATAKANA-HIRAGANA PROLONGED SOUND MARK */
- { 0x04b1, 0x30a2 }, /* kana_A ã‚¢ KATAKANA LETTER A */
- { 0x04b2, 0x30a4 }, /* kana_I イ KATAKANA LETTER I */
- { 0x04b3, 0x30a6 }, /* kana_U ウ KATAKANA LETTER U */
- { 0x04b4, 0x30a8 }, /* kana_E エ KATAKANA LETTER E */
- { 0x04b5, 0x30aa }, /* kana_O オ KATAKANA LETTER O */
- { 0x04b6, 0x30ab }, /* kana_KA ã‚« KATAKANA LETTER KA */
- { 0x04b7, 0x30ad }, /* kana_KI ã‚­ KATAKANA LETTER KI */
- { 0x04b8, 0x30af }, /* kana_KU ク KATAKANA LETTER KU */
- { 0x04b9, 0x30b1 }, /* kana_KE ケ KATAKANA LETTER KE */
- { 0x04ba, 0x30b3 }, /* kana_KO コ KATAKANA LETTER KO */
- { 0x04bb, 0x30b5 }, /* kana_SA サ KATAKANA LETTER SA */
- { 0x04bc, 0x30b7 }, /* kana_SHI ã‚· KATAKANA LETTER SI */
- { 0x04bd, 0x30b9 }, /* kana_SU ス KATAKANA LETTER SU */
- { 0x04be, 0x30bb }, /* kana_SE ã‚» KATAKANA LETTER SE */
- { 0x04bf, 0x30bd }, /* kana_SO ソ KATAKANA LETTER SO */
- { 0x04c0, 0x30bf }, /* kana_TA ã‚¿ KATAKANA LETTER TA */
- { 0x04c1, 0x30c1 }, /* kana_CHI ムKATAKANA LETTER TI */
- { 0x04c2, 0x30c4 }, /* kana_TSU ツ KATAKANA LETTER TU */
- { 0x04c3, 0x30c6 }, /* kana_TE テ KATAKANA LETTER TE */
- { 0x04c4, 0x30c8 }, /* kana_TO ト KATAKANA LETTER TO */
- { 0x04c5, 0x30ca }, /* kana_NA ナ KATAKANA LETTER NA */
- { 0x04c6, 0x30cb }, /* kana_NI ニ KATAKANA LETTER NI */
- { 0x04c7, 0x30cc }, /* kana_NU ヌ KATAKANA LETTER NU */
- { 0x04c8, 0x30cd }, /* kana_NE ムKATAKANA LETTER NE */
- { 0x04c9, 0x30ce }, /* kana_NO ノ KATAKANA LETTER NO */
- { 0x04ca, 0x30cf }, /* kana_HA ムKATAKANA LETTER HA */
- { 0x04cb, 0x30d2 }, /* kana_HI ヒ KATAKANA LETTER HI */
- { 0x04cc, 0x30d5 }, /* kana_FU フ KATAKANA LETTER HU */
- { 0x04cd, 0x30d8 }, /* kana_HE ヘ KATAKANA LETTER HE */
- { 0x04ce, 0x30db }, /* kana_HO ホ KATAKANA LETTER HO */
- { 0x04cf, 0x30de }, /* kana_MA マ KATAKANA LETTER MA */
- { 0x04d0, 0x30df }, /* kana_MI ミ KATAKANA LETTER MI */
- { 0x04d1, 0x30e0 }, /* kana_MU ム KATAKANA LETTER MU */
- { 0x04d2, 0x30e1 }, /* kana_ME メ KATAKANA LETTER ME */
- { 0x04d3, 0x30e2 }, /* kana_MO モ KATAKANA LETTER MO */
- { 0x04d4, 0x30e4 }, /* kana_YA ヤ KATAKANA LETTER YA */
- { 0x04d5, 0x30e6 }, /* kana_YU ユ KATAKANA LETTER YU */
- { 0x04d6, 0x30e8 }, /* kana_YO ヨ KATAKANA LETTER YO */
- { 0x04d7, 0x30e9 }, /* kana_RA ラ KATAKANA LETTER RA */
- { 0x04d8, 0x30ea }, /* kana_RI リ KATAKANA LETTER RI */
- { 0x04d9, 0x30eb }, /* kana_RU ル KATAKANA LETTER RU */
- { 0x04da, 0x30ec }, /* kana_RE レ KATAKANA LETTER RE */
- { 0x04db, 0x30ed }, /* kana_RO ロ KATAKANA LETTER RO */
- { 0x04dc, 0x30ef }, /* kana_WA ワ KATAKANA LETTER WA */
- { 0x04dd, 0x30f3 }, /* kana_N ン KATAKANA LETTER N */
- { 0x04de, 0x309b }, /* voicedsound ã‚› KATAKANA-HIRAGANA VOICED SOUND MARK */
- { 0x04df, 0x309c }, /* semivoicedsound ゜ KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK */
- { 0x05ac, 0x060c }, /* Arabic_comma ، ARABIC COMMA */
- { 0x05bb, 0x061b }, /* Arabic_semicolon Ø› ARABIC SEMICOLON */
- { 0x05bf, 0x061f }, /* Arabic_question_mark ØŸ ARABIC QUESTION MARK */
- { 0x05c1, 0x0621 }, /* Arabic_hamza Ø¡ ARABIC LETTER HAMZA */
- { 0x05c2, 0x0622 }, /* Arabic_maddaonalef آ ARABIC LETTER ALEF WITH MADDA ABOVE */
- { 0x05c3, 0x0623 }, /* Arabic_hamzaonalef أ ARABIC LETTER ALEF WITH HAMZA ABOVE */
- { 0x05c4, 0x0624 }, /* Arabic_hamzaonwaw ؤ ARABIC LETTER WAW WITH HAMZA ABOVE */
- { 0x05c5, 0x0625 }, /* Arabic_hamzaunderalef إ ARABIC LETTER ALEF WITH HAMZA BELOW */
- { 0x05c6, 0x0626 }, /* Arabic_hamzaonyeh ئ ARABIC LETTER YEH WITH HAMZA ABOVE */
- { 0x05c7, 0x0627 }, /* Arabic_alef ا ARABIC LETTER ALEF */
- { 0x05c8, 0x0628 }, /* Arabic_beh ب ARABIC LETTER BEH */
- { 0x05c9, 0x0629 }, /* Arabic_tehmarbuta Ø© ARABIC LETTER TEH MARBUTA */
- { 0x05ca, 0x062a }, /* Arabic_teh ت ARABIC LETTER TEH */
- { 0x05cb, 0x062b }, /* Arabic_theh Ø« ARABIC LETTER THEH */
- { 0x05cc, 0x062c }, /* Arabic_jeem ج ARABIC LETTER JEEM */
- { 0x05cd, 0x062d }, /* Arabic_hah Ø­ ARABIC LETTER HAH */
- { 0x05ce, 0x062e }, /* Arabic_khah Ø® ARABIC LETTER KHAH */
- { 0x05cf, 0x062f }, /* Arabic_dal د ARABIC LETTER DAL */
- { 0x05d0, 0x0630 }, /* Arabic_thal Ø° ARABIC LETTER THAL */
- { 0x05d1, 0x0631 }, /* Arabic_ra ر ARABIC LETTER REH */
- { 0x05d2, 0x0632 }, /* Arabic_zain ز ARABIC LETTER ZAIN */
- { 0x05d3, 0x0633 }, /* Arabic_seen س ARABIC LETTER SEEN */
- { 0x05d4, 0x0634 }, /* Arabic_sheen Ø´ ARABIC LETTER SHEEN */
- { 0x05d5, 0x0635 }, /* Arabic_sad ص ARABIC LETTER SAD */
- { 0x05d6, 0x0636 }, /* Arabic_dad ض ARABIC LETTER DAD */
- { 0x05d7, 0x0637 }, /* Arabic_tah Ø· ARABIC LETTER TAH */
- { 0x05d8, 0x0638 }, /* Arabic_zah ظ ARABIC LETTER ZAH */
- { 0x05d9, 0x0639 }, /* Arabic_ain ع ARABIC LETTER AIN */
- { 0x05da, 0x063a }, /* Arabic_ghain غ ARABIC LETTER GHAIN */
- { 0x05e0, 0x0640 }, /* Arabic_tatweel Ù€ ARABIC TATWEEL */
- { 0x05e1, 0x0641 }, /* Arabic_feh Ù ARABIC LETTER FEH */
- { 0x05e2, 0x0642 }, /* Arabic_qaf Ù‚ ARABIC LETTER QAF */
- { 0x05e3, 0x0643 }, /* Arabic_kaf Ùƒ ARABIC LETTER KAF */
- { 0x05e4, 0x0644 }, /* Arabic_lam Ù„ ARABIC LETTER LAM */
- { 0x05e5, 0x0645 }, /* Arabic_meem Ù… ARABIC LETTER MEEM */
- { 0x05e6, 0x0646 }, /* Arabic_noon Ù† ARABIC LETTER NOON */
- { 0x05e7, 0x0647 }, /* Arabic_ha Ù‡ ARABIC LETTER HEH */
- { 0x05e8, 0x0648 }, /* Arabic_waw Ùˆ ARABIC LETTER WAW */
- { 0x05e9, 0x0649 }, /* Arabic_alefmaksura Ù‰ ARABIC LETTER ALEF MAKSURA */
- { 0x05ea, 0x064a }, /* Arabic_yeh ÙŠ ARABIC LETTER YEH */
- { 0x05eb, 0x064b }, /* Arabic_fathatan Ù‹ ARABIC FATHATAN */
- { 0x05ec, 0x064c }, /* Arabic_dammatan ٌ ARABIC DAMMATAN */
- { 0x05ed, 0x064d }, /* Arabic_kasratan Ù ARABIC KASRATAN */
- { 0x05ee, 0x064e }, /* Arabic_fatha ÙŽ ARABIC FATHA */
- { 0x05ef, 0x064f }, /* Arabic_damma Ù ARABIC DAMMA */
- { 0x05f0, 0x0650 }, /* Arabic_kasra Ù ARABIC KASRA */
- { 0x05f1, 0x0651 }, /* Arabic_shadda Ù‘ ARABIC SHADDA */
- { 0x05f2, 0x0652 }, /* Arabic_sukun Ù’ ARABIC SUKUN */
- { 0x06a1, 0x0452 }, /* Serbian_dje Ñ’ CYRILLIC SMALL LETTER DJE */
- { 0x06a2, 0x0453 }, /* Macedonia_gje Ñ“ CYRILLIC SMALL LETTER GJE */
- { 0x06a3, 0x0451 }, /* Cyrillic_io Ñ‘ CYRILLIC SMALL LETTER IO */
- { 0x06a4, 0x0454 }, /* Ukrainian_ie Ñ” CYRILLIC SMALL LETTER UKRAINIAN IE */
- { 0x06a5, 0x0455 }, /* Macedonia_dse Ñ• CYRILLIC SMALL LETTER DZE */
- { 0x06a6, 0x0456 }, /* Ukrainian_i Ñ– CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I */
- { 0x06a7, 0x0457 }, /* Ukrainian_yi Ñ— CYRILLIC SMALL LETTER YI */
- { 0x06a8, 0x0458 }, /* Cyrillic_je ј CYRILLIC SMALL LETTER JE */
- { 0x06a9, 0x0459 }, /* Cyrillic_lje Ñ™ CYRILLIC SMALL LETTER LJE */
- { 0x06aa, 0x045a }, /* Cyrillic_nje Ñš CYRILLIC SMALL LETTER NJE */
- { 0x06ab, 0x045b }, /* Serbian_tshe Ñ› CYRILLIC SMALL LETTER TSHE */
- { 0x06ac, 0x045c }, /* Macedonia_kje ќ CYRILLIC SMALL LETTER KJE */
- { 0x06ae, 0x045e }, /* Byelorussian_shortu Ñž CYRILLIC SMALL LETTER SHORT U */
- { 0x06af, 0x045f }, /* Cyrillic_dzhe ÑŸ CYRILLIC SMALL LETTER DZHE */
- { 0x06b0, 0x2116 }, /* numerosign â„– NUMERO SIGN */
- { 0x06b1, 0x0402 }, /* Serbian_DJE Ђ CYRILLIC CAPITAL LETTER DJE */
- { 0x06b2, 0x0403 }, /* Macedonia_GJE Ѓ CYRILLIC CAPITAL LETTER GJE */
- { 0x06b3, 0x0401 }, /* Cyrillic_IO Ð CYRILLIC CAPITAL LETTER IO */
- { 0x06b4, 0x0404 }, /* Ukrainian_IE Є CYRILLIC CAPITAL LETTER UKRAINIAN IE */
- { 0x06b5, 0x0405 }, /* Macedonia_DSE Ð… CYRILLIC CAPITAL LETTER DZE */
- { 0x06b6, 0x0406 }, /* Ukrainian_I І CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I */
- { 0x06b7, 0x0407 }, /* Ukrainian_YI Ї CYRILLIC CAPITAL LETTER YI */
- { 0x06b8, 0x0408 }, /* Cyrillic_JE Ј CYRILLIC CAPITAL LETTER JE */
- { 0x06b9, 0x0409 }, /* Cyrillic_LJE Љ CYRILLIC CAPITAL LETTER LJE */
- { 0x06ba, 0x040a }, /* Cyrillic_NJE Њ CYRILLIC CAPITAL LETTER NJE */
- { 0x06bb, 0x040b }, /* Serbian_TSHE Ћ CYRILLIC CAPITAL LETTER TSHE */
- { 0x06bc, 0x040c }, /* Macedonia_KJE Ќ CYRILLIC CAPITAL LETTER KJE */
- { 0x06be, 0x040e }, /* Byelorussian_SHORTU ÐŽ CYRILLIC CAPITAL LETTER SHORT U */
- { 0x06bf, 0x040f }, /* Cyrillic_DZHE Ð CYRILLIC CAPITAL LETTER DZHE */
- { 0x06c0, 0x044e }, /* Cyrillic_yu ÑŽ CYRILLIC SMALL LETTER YU */
- { 0x06c1, 0x0430 }, /* Cyrillic_a а CYRILLIC SMALL LETTER A */
- { 0x06c2, 0x0431 }, /* Cyrillic_be б CYRILLIC SMALL LETTER BE */
- { 0x06c3, 0x0446 }, /* Cyrillic_tse ц CYRILLIC SMALL LETTER TSE */
- { 0x06c4, 0x0434 }, /* Cyrillic_de д CYRILLIC SMALL LETTER DE */
- { 0x06c5, 0x0435 }, /* Cyrillic_ie е CYRILLIC SMALL LETTER IE */
- { 0x06c6, 0x0444 }, /* Cyrillic_ef Ñ„ CYRILLIC SMALL LETTER EF */
- { 0x06c7, 0x0433 }, /* Cyrillic_ghe г CYRILLIC SMALL LETTER GHE */
- { 0x06c8, 0x0445 }, /* Cyrillic_ha Ñ… CYRILLIC SMALL LETTER HA */
- { 0x06c9, 0x0438 }, /* Cyrillic_i и CYRILLIC SMALL LETTER I */
- { 0x06ca, 0x0439 }, /* Cyrillic_shorti й CYRILLIC SMALL LETTER SHORT I */
- { 0x06cb, 0x043a }, /* Cyrillic_ka к CYRILLIC SMALL LETTER KA */
- { 0x06cc, 0x043b }, /* Cyrillic_el л CYRILLIC SMALL LETTER EL */
- { 0x06cd, 0x043c }, /* Cyrillic_em м CYRILLIC SMALL LETTER EM */
- { 0x06ce, 0x043d }, /* Cyrillic_en н CYRILLIC SMALL LETTER EN */
- { 0x06cf, 0x043e }, /* Cyrillic_o о CYRILLIC SMALL LETTER O */
- { 0x06d0, 0x043f }, /* Cyrillic_pe п CYRILLIC SMALL LETTER PE */
- { 0x06d1, 0x044f }, /* Cyrillic_ya Ñ CYRILLIC SMALL LETTER YA */
- { 0x06d2, 0x0440 }, /* Cyrillic_er р CYRILLIC SMALL LETTER ER */
- { 0x06d3, 0x0441 }, /* Cyrillic_es Ñ CYRILLIC SMALL LETTER ES */
- { 0x06d4, 0x0442 }, /* Cyrillic_te Ñ‚ CYRILLIC SMALL LETTER TE */
- { 0x06d5, 0x0443 }, /* Cyrillic_u у CYRILLIC SMALL LETTER U */
- { 0x06d6, 0x0436 }, /* Cyrillic_zhe ж CYRILLIC SMALL LETTER ZHE */
- { 0x06d7, 0x0432 }, /* Cyrillic_ve в CYRILLIC SMALL LETTER VE */
- { 0x06d8, 0x044c }, /* Cyrillic_softsign ь CYRILLIC SMALL LETTER SOFT SIGN */
- { 0x06d9, 0x044b }, /* Cyrillic_yeru Ñ‹ CYRILLIC SMALL LETTER YERU */
- { 0x06da, 0x0437 }, /* Cyrillic_ze з CYRILLIC SMALL LETTER ZE */
- { 0x06db, 0x0448 }, /* Cyrillic_sha ш CYRILLIC SMALL LETTER SHA */
- { 0x06dc, 0x044d }, /* Cyrillic_e Ñ CYRILLIC SMALL LETTER E */
- { 0x06dd, 0x0449 }, /* Cyrillic_shcha щ CYRILLIC SMALL LETTER SHCHA */
- { 0x06de, 0x0447 }, /* Cyrillic_che ч CYRILLIC SMALL LETTER CHE */
- { 0x06df, 0x044a }, /* Cyrillic_hardsign ÑŠ CYRILLIC SMALL LETTER HARD SIGN */
- { 0x06e0, 0x042e }, /* Cyrillic_YU Ю CYRILLIC CAPITAL LETTER YU */
- { 0x06e1, 0x0410 }, /* Cyrillic_A Ð CYRILLIC CAPITAL LETTER A */
- { 0x06e2, 0x0411 }, /* Cyrillic_BE Б CYRILLIC CAPITAL LETTER BE */
- { 0x06e3, 0x0426 }, /* Cyrillic_TSE Ц CYRILLIC CAPITAL LETTER TSE */
- { 0x06e4, 0x0414 }, /* Cyrillic_DE Д CYRILLIC CAPITAL LETTER DE */
- { 0x06e5, 0x0415 }, /* Cyrillic_IE Е CYRILLIC CAPITAL LETTER IE */
- { 0x06e6, 0x0424 }, /* Cyrillic_EF Ф CYRILLIC CAPITAL LETTER EF */
- { 0x06e7, 0x0413 }, /* Cyrillic_GHE Г CYRILLIC CAPITAL LETTER GHE */
- { 0x06e8, 0x0425 }, /* Cyrillic_HA Х CYRILLIC CAPITAL LETTER HA */
- { 0x06e9, 0x0418 }, /* Cyrillic_I И CYRILLIC CAPITAL LETTER I */
- { 0x06ea, 0x0419 }, /* Cyrillic_SHORTI Й CYRILLIC CAPITAL LETTER SHORT I */
- { 0x06eb, 0x041a }, /* Cyrillic_KA К CYRILLIC CAPITAL LETTER KA */
- { 0x06ec, 0x041b }, /* Cyrillic_EL Л CYRILLIC CAPITAL LETTER EL */
- { 0x06ed, 0x041c }, /* Cyrillic_EM М CYRILLIC CAPITAL LETTER EM */
- { 0x06ee, 0x041d }, /* Cyrillic_EN Ð CYRILLIC CAPITAL LETTER EN */
- { 0x06ef, 0x041e }, /* Cyrillic_O О CYRILLIC CAPITAL LETTER O */
- { 0x06f0, 0x041f }, /* Cyrillic_PE П CYRILLIC CAPITAL LETTER PE */
- { 0x06f1, 0x042f }, /* Cyrillic_YA Я CYRILLIC CAPITAL LETTER YA */
- { 0x06f2, 0x0420 }, /* Cyrillic_ER Р CYRILLIC CAPITAL LETTER ER */
- { 0x06f3, 0x0421 }, /* Cyrillic_ES С CYRILLIC CAPITAL LETTER ES */
- { 0x06f4, 0x0422 }, /* Cyrillic_TE Т CYRILLIC CAPITAL LETTER TE */
- { 0x06f5, 0x0423 }, /* Cyrillic_U У CYRILLIC CAPITAL LETTER U */
- { 0x06f6, 0x0416 }, /* Cyrillic_ZHE Ж CYRILLIC CAPITAL LETTER ZHE */
- { 0x06f7, 0x0412 }, /* Cyrillic_VE Ð’ CYRILLIC CAPITAL LETTER VE */
- { 0x06f8, 0x042c }, /* Cyrillic_SOFTSIGN Ь CYRILLIC CAPITAL LETTER SOFT SIGN */
- { 0x06f9, 0x042b }, /* Cyrillic_YERU Ы CYRILLIC CAPITAL LETTER YERU */
- { 0x06fa, 0x0417 }, /* Cyrillic_ZE З CYRILLIC CAPITAL LETTER ZE */
- { 0x06fb, 0x0428 }, /* Cyrillic_SHA Ш CYRILLIC CAPITAL LETTER SHA */
- { 0x06fc, 0x042d }, /* Cyrillic_E Э CYRILLIC CAPITAL LETTER E */
- { 0x06fd, 0x0429 }, /* Cyrillic_SHCHA Щ CYRILLIC CAPITAL LETTER SHCHA */
- { 0x06fe, 0x0427 }, /* Cyrillic_CHE Ч CYRILLIC CAPITAL LETTER CHE */
- { 0x06ff, 0x042a }, /* Cyrillic_HARDSIGN Ъ CYRILLIC CAPITAL LETTER HARD SIGN */
- { 0x07a1, 0x0386 }, /* Greek_ALPHAaccent Ά GREEK CAPITAL LETTER ALPHA WITH TONOS */
- { 0x07a2, 0x0388 }, /* Greek_EPSILONaccent Έ GREEK CAPITAL LETTER EPSILON WITH TONOS */
- { 0x07a3, 0x0389 }, /* Greek_ETAaccent Ή GREEK CAPITAL LETTER ETA WITH TONOS */
- { 0x07a4, 0x038a }, /* Greek_IOTAaccent Ί GREEK CAPITAL LETTER IOTA WITH TONOS */
- { 0x07a5, 0x03aa }, /* Greek_IOTAdiaeresis Ϊ GREEK CAPITAL LETTER IOTA WITH DIALYTIKA */
- { 0x07a7, 0x038c }, /* Greek_OMICRONaccent Ό GREEK CAPITAL LETTER OMICRON WITH TONOS */
- { 0x07a8, 0x038e }, /* Greek_UPSILONaccent ÎŽ GREEK CAPITAL LETTER UPSILON WITH TONOS */
- { 0x07a9, 0x03ab }, /* Greek_UPSILONdieresis Ϋ GREEK CAPITAL LETTER UPSILON WITH DIALYTIKA */
- { 0x07ab, 0x038f }, /* Greek_OMEGAaccent Î GREEK CAPITAL LETTER OMEGA WITH TONOS */
- { 0x07ae, 0x0385 }, /* Greek_accentdieresis Î… GREEK DIALYTIKA TONOS */
- { 0x07af, 0x2015 }, /* Greek_horizbar ― HORIZONTAL BAR */
- { 0x07b1, 0x03ac }, /* Greek_alphaaccent ά GREEK SMALL LETTER ALPHA WITH TONOS */
- { 0x07b2, 0x03ad }, /* Greek_epsilonaccent έ GREEK SMALL LETTER EPSILON WITH TONOS */
- { 0x07b3, 0x03ae }, /* Greek_etaaccent ή GREEK SMALL LETTER ETA WITH TONOS */
- { 0x07b4, 0x03af }, /* Greek_iotaaccent ί GREEK SMALL LETTER IOTA WITH TONOS */
- { 0x07b5, 0x03ca }, /* Greek_iotadieresis ÏŠ GREEK SMALL LETTER IOTA WITH DIALYTIKA */
- { 0x07b6, 0x0390 }, /* Greek_iotaaccentdieresis Î GREEK SMALL LETTER IOTA WITH DIALYTIKA AND TONOS */
- { 0x07b7, 0x03cc }, /* Greek_omicronaccent ό GREEK SMALL LETTER OMICRON WITH TONOS */
- { 0x07b8, 0x03cd }, /* Greek_upsilonaccent Ï GREEK SMALL LETTER UPSILON WITH TONOS */
- { 0x07b9, 0x03cb }, /* Greek_upsilondieresis Ï‹ GREEK SMALL LETTER UPSILON WITH DIALYTIKA */
- { 0x07ba, 0x03b0 }, /* Greek_upsilonaccentdieresis ΰ GREEK SMALL LETTER UPSILON WITH DIALYTIKA AND TONOS */
- { 0x07bb, 0x03ce }, /* Greek_omegaaccent ÏŽ GREEK SMALL LETTER OMEGA WITH TONOS */
- { 0x07c1, 0x0391 }, /* Greek_ALPHA Α GREEK CAPITAL LETTER ALPHA */
- { 0x07c2, 0x0392 }, /* Greek_BETA Î’ GREEK CAPITAL LETTER BETA */
- { 0x07c3, 0x0393 }, /* Greek_GAMMA Γ GREEK CAPITAL LETTER GAMMA */
- { 0x07c4, 0x0394 }, /* Greek_DELTA Δ GREEK CAPITAL LETTER DELTA */
- { 0x07c5, 0x0395 }, /* Greek_EPSILON Ε GREEK CAPITAL LETTER EPSILON */
- { 0x07c6, 0x0396 }, /* Greek_ZETA Ζ GREEK CAPITAL LETTER ZETA */
- { 0x07c7, 0x0397 }, /* Greek_ETA Η GREEK CAPITAL LETTER ETA */
- { 0x07c8, 0x0398 }, /* Greek_THETA Θ GREEK CAPITAL LETTER THETA */
- { 0x07c9, 0x0399 }, /* Greek_IOTA Ι GREEK CAPITAL LETTER IOTA */
- { 0x07ca, 0x039a }, /* Greek_KAPPA Κ GREEK CAPITAL LETTER KAPPA */
- { 0x07cb, 0x039b }, /* Greek_LAMBDA Λ GREEK CAPITAL LETTER LAMDA */
- { 0x07cc, 0x039c }, /* Greek_MU Μ GREEK CAPITAL LETTER MU */
- { 0x07cd, 0x039d }, /* Greek_NU Î GREEK CAPITAL LETTER NU */
- { 0x07ce, 0x039e }, /* Greek_XI Ξ GREEK CAPITAL LETTER XI */
- { 0x07cf, 0x039f }, /* Greek_OMICRON Ο GREEK CAPITAL LETTER OMICRON */
- { 0x07d0, 0x03a0 }, /* Greek_PI Π GREEK CAPITAL LETTER PI */
- { 0x07d1, 0x03a1 }, /* Greek_RHO Ρ GREEK CAPITAL LETTER RHO */
- { 0x07d2, 0x03a3 }, /* Greek_SIGMA Σ GREEK CAPITAL LETTER SIGMA */
- { 0x07d4, 0x03a4 }, /* Greek_TAU Τ GREEK CAPITAL LETTER TAU */
- { 0x07d5, 0x03a5 }, /* Greek_UPSILON Υ GREEK CAPITAL LETTER UPSILON */
- { 0x07d6, 0x03a6 }, /* Greek_PHI Φ GREEK CAPITAL LETTER PHI */
- { 0x07d7, 0x03a7 }, /* Greek_CHI Χ GREEK CAPITAL LETTER CHI */
- { 0x07d8, 0x03a8 }, /* Greek_PSI Ψ GREEK CAPITAL LETTER PSI */
- { 0x07d9, 0x03a9 }, /* Greek_OMEGA Ω GREEK CAPITAL LETTER OMEGA */
- { 0x07e1, 0x03b1 }, /* Greek_alpha α GREEK SMALL LETTER ALPHA */
- { 0x07e2, 0x03b2 }, /* Greek_beta β GREEK SMALL LETTER BETA */
- { 0x07e3, 0x03b3 }, /* Greek_gamma γ GREEK SMALL LETTER GAMMA */
- { 0x07e4, 0x03b4 }, /* Greek_delta δ GREEK SMALL LETTER DELTA */
- { 0x07e5, 0x03b5 }, /* Greek_epsilon ε GREEK SMALL LETTER EPSILON */
- { 0x07e6, 0x03b6 }, /* Greek_zeta ζ GREEK SMALL LETTER ZETA */
- { 0x07e7, 0x03b7 }, /* Greek_eta η GREEK SMALL LETTER ETA */
- { 0x07e8, 0x03b8 }, /* Greek_theta θ GREEK SMALL LETTER THETA */
- { 0x07e9, 0x03b9 }, /* Greek_iota ι GREEK SMALL LETTER IOTA */
- { 0x07ea, 0x03ba }, /* Greek_kappa κ GREEK SMALL LETTER KAPPA */
- { 0x07eb, 0x03bb }, /* Greek_lambda λ GREEK SMALL LETTER LAMDA */
- { 0x07ec, 0x03bc }, /* Greek_mu μ GREEK SMALL LETTER MU */
- { 0x07ed, 0x03bd }, /* Greek_nu ν GREEK SMALL LETTER NU */
- { 0x07ee, 0x03be }, /* Greek_xi ξ GREEK SMALL LETTER XI */
- { 0x07ef, 0x03bf }, /* Greek_omicron ο GREEK SMALL LETTER OMICRON */
- { 0x07f0, 0x03c0 }, /* Greek_pi π GREEK SMALL LETTER PI */
- { 0x07f1, 0x03c1 }, /* Greek_rho Ï GREEK SMALL LETTER RHO */
- { 0x07f2, 0x03c3 }, /* Greek_sigma σ GREEK SMALL LETTER SIGMA */
- { 0x07f3, 0x03c2 }, /* Greek_finalsmallsigma Ï‚ GREEK SMALL LETTER FINAL SIGMA */
- { 0x07f4, 0x03c4 }, /* Greek_tau Ï„ GREEK SMALL LETTER TAU */
- { 0x07f5, 0x03c5 }, /* Greek_upsilon Ï… GREEK SMALL LETTER UPSILON */
- { 0x07f6, 0x03c6 }, /* Greek_phi φ GREEK SMALL LETTER PHI */
- { 0x07f7, 0x03c7 }, /* Greek_chi χ GREEK SMALL LETTER CHI */
- { 0x07f8, 0x03c8 }, /* Greek_psi ψ GREEK SMALL LETTER PSI */
- { 0x07f9, 0x03c9 }, /* Greek_omega ω GREEK SMALL LETTER OMEGA */
-/* 0x08a1 leftradical ? ??? */
-/* 0x08a2 topleftradical ? ??? */
-/* 0x08a3 horizconnector ? ??? */
- { 0x08a4, 0x2320 }, /* topintegral ⌠ TOP HALF INTEGRAL */
- { 0x08a5, 0x2321 }, /* botintegral ⌡ BOTTOM HALF INTEGRAL */
- { 0x08a6, 0x2502 }, /* vertconnector │ BOX DRAWINGS LIGHT VERTICAL */
-/* 0x08a7 topleftsqbracket ? ??? */
-/* 0x08a8 botleftsqbracket ? ??? */
-/* 0x08a9 toprightsqbracket ? ??? */
-/* 0x08aa botrightsqbracket ? ??? */
-/* 0x08ab topleftparens ? ??? */
-/* 0x08ac botleftparens ? ??? */
-/* 0x08ad toprightparens ? ??? */
-/* 0x08ae botrightparens ? ??? */
-/* 0x08af leftmiddlecurlybrace ? ??? */
-/* 0x08b0 rightmiddlecurlybrace ? ??? */
-/* 0x08b1 topleftsummation ? ??? */
-/* 0x08b2 botleftsummation ? ??? */
-/* 0x08b3 topvertsummationconnector ? ??? */
-/* 0x08b4 botvertsummationconnector ? ??? */
-/* 0x08b5 toprightsummation ? ??? */
-/* 0x08b6 botrightsummation ? ??? */
-/* 0x08b7 rightmiddlesummation ? ??? */
- { 0x08bc, 0x2264 }, /* lessthanequal ≤ LESS-THAN OR EQUAL TO */
- { 0x08bd, 0x2260 }, /* notequal ≠ NOT EQUAL TO */
- { 0x08be, 0x2265 }, /* greaterthanequal ≥ GREATER-THAN OR EQUAL TO */
- { 0x08bf, 0x222b }, /* integral ∫ INTEGRAL */
- { 0x08c0, 0x2234 }, /* therefore ∴ THEREFORE */
- { 0x08c1, 0x221d }, /* variation ∠PROPORTIONAL TO */
- { 0x08c2, 0x221e }, /* infinity ∞ INFINITY */
- { 0x08c5, 0x2207 }, /* nabla ∇ NABLA */
- { 0x08c8, 0x2245 }, /* approximate ≅ APPROXIMATELY EQUAL TO */
-/* 0x08c9 similarequal ? ??? */
- { 0x08cd, 0x21d4 }, /* ifonlyif ⇔ LEFT RIGHT DOUBLE ARROW */
- { 0x08ce, 0x21d2 }, /* implies ⇒ RIGHTWARDS DOUBLE ARROW */
- { 0x08cf, 0x2261 }, /* identical ≡ IDENTICAL TO */
- { 0x08d6, 0x221a }, /* radical √ SQUARE ROOT */
- { 0x08da, 0x2282 }, /* includedin ⊂ SUBSET OF */
- { 0x08db, 0x2283 }, /* includes ⊃ SUPERSET OF */
- { 0x08dc, 0x2229 }, /* intersection ∩ INTERSECTION */
- { 0x08dd, 0x222a }, /* union ∪ UNION */
- { 0x08de, 0x2227 }, /* logicaland ∧ LOGICAL AND */
- { 0x08df, 0x2228 }, /* logicalor ∨ LOGICAL OR */
- { 0x08ef, 0x2202 }, /* partialderivative ∂ PARTIAL DIFFERENTIAL */
- { 0x08f6, 0x0192 }, /* function Æ’ LATIN SMALL LETTER F WITH HOOK */
- { 0x08fb, 0x2190 }, /* leftarrow ↠LEFTWARDS ARROW */
- { 0x08fc, 0x2191 }, /* uparrow ↑ UPWARDS ARROW */
- { 0x08fd, 0x2192 }, /* rightarrow → RIGHTWARDS ARROW */
- { 0x08fe, 0x2193 }, /* downarrow ↓ DOWNWARDS ARROW */
- { 0x09df, 0x2422 }, /* blank ⢠BLANK SYMBOL */
- { 0x09e0, 0x25c6 }, /* soliddiamond â—† BLACK DIAMOND */
- { 0x09e1, 0x2592 }, /* checkerboard â–’ MEDIUM SHADE */
- { 0x09e2, 0x2409 }, /* ht ≠SYMBOL FOR HORIZONTAL TABULATION */
- { 0x09e3, 0x240c }, /* ff ⌠SYMBOL FOR FORM FEED */
- { 0x09e4, 0x240d }, /* cr â SYMBOL FOR CARRIAGE RETURN */
- { 0x09e5, 0x240a }, /* lf ⊠SYMBOL FOR LINE FEED */
- { 0x09e8, 0x2424 }, /* nl ⤠SYMBOL FOR NEWLINE */
- { 0x09e9, 0x240b }, /* vt â‹ SYMBOL FOR VERTICAL TABULATION */
- { 0x09ea, 0x2518 }, /* lowrightcorner ┘ BOX DRAWINGS LIGHT UP AND LEFT */
- { 0x09eb, 0x2510 }, /* uprightcorner â” BOX DRAWINGS LIGHT DOWN AND LEFT */
- { 0x09ec, 0x250c }, /* upleftcorner ┌ BOX DRAWINGS LIGHT DOWN AND RIGHT */
- { 0x09ed, 0x2514 }, /* lowleftcorner â”” BOX DRAWINGS LIGHT UP AND RIGHT */
- { 0x09ee, 0x253c }, /* crossinglines ┼ BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL */
-/* 0x09ef horizlinescan1 ? ??? */
-/* 0x09f0 horizlinescan3 ? ??? */
- { 0x09f1, 0x2500 }, /* horizlinescan5 ─ BOX DRAWINGS LIGHT HORIZONTAL */
-/* 0x09f2 horizlinescan7 ? ??? */
-/* 0x09f3 horizlinescan9 ? ??? */
- { 0x09f4, 0x251c }, /* leftt ├ BOX DRAWINGS LIGHT VERTICAL AND RIGHT */
- { 0x09f5, 0x2524 }, /* rightt ┤ BOX DRAWINGS LIGHT VERTICAL AND LEFT */
- { 0x09f6, 0x2534 }, /* bott â”´ BOX DRAWINGS LIGHT UP AND HORIZONTAL */
- { 0x09f7, 0x252c }, /* topt ┬ BOX DRAWINGS LIGHT DOWN AND HORIZONTAL */
- { 0x09f8, 0x2502 }, /* vertbar │ BOX DRAWINGS LIGHT VERTICAL */
- { 0x0aa1, 0x2003 }, /* emspace   EM SPACE */
- { 0x0aa2, 0x2002 }, /* enspace   EN SPACE */
- { 0x0aa3, 0x2004 }, /* em3space   THREE-PER-EM SPACE */
- { 0x0aa4, 0x2005 }, /* em4space   FOUR-PER-EM SPACE */
- { 0x0aa5, 0x2007 }, /* digitspace   FIGURE SPACE */
- { 0x0aa6, 0x2008 }, /* punctspace   PUNCTUATION SPACE */
- { 0x0aa7, 0x2009 }, /* thinspace   THIN SPACE */
- { 0x0aa8, 0x200a }, /* hairspace   HAIR SPACE */
- { 0x0aa9, 0x2014 }, /* emdash — EM DASH */
- { 0x0aaa, 0x2013 }, /* endash – EN DASH */
-/* 0x0aac signifblank ? ??? */
- { 0x0aae, 0x2026 }, /* ellipsis … HORIZONTAL ELLIPSIS */
-/* 0x0aaf doubbaselinedot ? ??? */
- { 0x0ab0, 0x2153 }, /* onethird â…“ VULGAR FRACTION ONE THIRD */
- { 0x0ab1, 0x2154 }, /* twothirds â…” VULGAR FRACTION TWO THIRDS */
- { 0x0ab2, 0x2155 }, /* onefifth â…• VULGAR FRACTION ONE FIFTH */
- { 0x0ab3, 0x2156 }, /* twofifths â…– VULGAR FRACTION TWO FIFTHS */
- { 0x0ab4, 0x2157 }, /* threefifths â…— VULGAR FRACTION THREE FIFTHS */
- { 0x0ab5, 0x2158 }, /* fourfifths â…˜ VULGAR FRACTION FOUR FIFTHS */
- { 0x0ab6, 0x2159 }, /* onesixth â…™ VULGAR FRACTION ONE SIXTH */
- { 0x0ab7, 0x215a }, /* fivesixths â…š VULGAR FRACTION FIVE SIXTHS */
- { 0x0ab8, 0x2105 }, /* careof â„… CARE OF */
- { 0x0abb, 0x2012 }, /* figdash ‒ FIGURE DASH */
- { 0x0abc, 0x2329 }, /* leftanglebracket 〈 LEFT-POINTING ANGLE BRACKET */
- { 0x0abd, 0x002e }, /* decimalpoint . FULL STOP */
- { 0x0abe, 0x232a }, /* rightanglebracket 〉 RIGHT-POINTING ANGLE BRACKET */
-/* 0x0abf marker ? ??? */
- { 0x0ac3, 0x215b }, /* oneeighth â…› VULGAR FRACTION ONE EIGHTH */
- { 0x0ac4, 0x215c }, /* threeeighths ⅜ VULGAR FRACTION THREE EIGHTHS */
- { 0x0ac5, 0x215d }, /* fiveeighths â… VULGAR FRACTION FIVE EIGHTHS */
- { 0x0ac6, 0x215e }, /* seveneighths â…ž VULGAR FRACTION SEVEN EIGHTHS */
- { 0x0ac9, 0x2122 }, /* trademark â„¢ TRADE MARK SIGN */
- { 0x0aca, 0x2613 }, /* signaturemark ☓ SALTIRE */
-/* 0x0acb trademarkincircle ? ??? */
- { 0x0acc, 0x25c1 }, /* leftopentriangle â— WHITE LEFT-POINTING TRIANGLE */
- { 0x0acd, 0x25b7 }, /* rightopentriangle â–· WHITE RIGHT-POINTING TRIANGLE */
- { 0x0ace, 0x25cb }, /* emopencircle â—‹ WHITE CIRCLE */
- { 0x0acf, 0x25a1 }, /* emopenrectangle â–¡ WHITE SQUARE */
- { 0x0ad0, 0x2018 }, /* leftsinglequotemark ‘ LEFT SINGLE QUOTATION MARK */
- { 0x0ad1, 0x2019 }, /* rightsinglequotemark ’ RIGHT SINGLE QUOTATION MARK */
- { 0x0ad2, 0x201c }, /* leftdoublequotemark “ LEFT DOUBLE QUOTATION MARK */
- { 0x0ad3, 0x201d }, /* rightdoublequotemark †RIGHT DOUBLE QUOTATION MARK */
- { 0x0ad4, 0x211e }, /* prescription â„ž PRESCRIPTION TAKE */
- { 0x0ad6, 0x2032 }, /* minutes ′ PRIME */
- { 0x0ad7, 0x2033 }, /* seconds ″ DOUBLE PRIME */
- { 0x0ad9, 0x271d }, /* latincross ✠LATIN CROSS */
-/* 0x0ada hexagram ? ??? */
- { 0x0adb, 0x25ac }, /* filledrectbullet â–¬ BLACK RECTANGLE */
- { 0x0adc, 0x25c0 }, /* filledlefttribullet â—€ BLACK LEFT-POINTING TRIANGLE */
- { 0x0add, 0x25b6 }, /* filledrighttribullet â–¶ BLACK RIGHT-POINTING TRIANGLE */
- { 0x0ade, 0x25cf }, /* emfilledcircle â— BLACK CIRCLE */
- { 0x0adf, 0x25a0 }, /* emfilledrect â–  BLACK SQUARE */
- { 0x0ae0, 0x25e6 }, /* enopencircbullet â—¦ WHITE BULLET */
- { 0x0ae1, 0x25ab }, /* enopensquarebullet â–« WHITE SMALL SQUARE */
- { 0x0ae2, 0x25ad }, /* openrectbullet â–­ WHITE RECTANGLE */
- { 0x0ae3, 0x25b3 }, /* opentribulletup â–³ WHITE UP-POINTING TRIANGLE */
- { 0x0ae4, 0x25bd }, /* opentribulletdown â–½ WHITE DOWN-POINTING TRIANGLE */
- { 0x0ae5, 0x2606 }, /* openstar ☆ WHITE STAR */
- { 0x0ae6, 0x2022 }, /* enfilledcircbullet • BULLET */
- { 0x0ae7, 0x25aa }, /* enfilledsqbullet â–ª BLACK SMALL SQUARE */
- { 0x0ae8, 0x25b2 }, /* filledtribulletup â–² BLACK UP-POINTING TRIANGLE */
- { 0x0ae9, 0x25bc }, /* filledtribulletdown â–¼ BLACK DOWN-POINTING TRIANGLE */
- { 0x0aea, 0x261c }, /* leftpointer ☜ WHITE LEFT POINTING INDEX */
- { 0x0aeb, 0x261e }, /* rightpointer ☞ WHITE RIGHT POINTING INDEX */
- { 0x0aec, 0x2663 }, /* club ♣ BLACK CLUB SUIT */
- { 0x0aed, 0x2666 }, /* diamond ♦ BLACK DIAMOND SUIT */
- { 0x0aee, 0x2665 }, /* heart ♥ BLACK HEART SUIT */
- { 0x0af0, 0x2720 }, /* maltesecross ✠ MALTESE CROSS */
- { 0x0af1, 0x2020 }, /* dagger † DAGGER */
- { 0x0af2, 0x2021 }, /* doubledagger ‡ DOUBLE DAGGER */
- { 0x0af3, 0x2713 }, /* checkmark ✓ CHECK MARK */
- { 0x0af4, 0x2717 }, /* ballotcross ✗ BALLOT X */
- { 0x0af5, 0x266f }, /* musicalsharp ♯ MUSIC SHARP SIGN */
- { 0x0af6, 0x266d }, /* musicalflat â™­ MUSIC FLAT SIGN */
- { 0x0af7, 0x2642 }, /* malesymbol ♂ MALE SIGN */
- { 0x0af8, 0x2640 }, /* femalesymbol ♀ FEMALE SIGN */
- { 0x0af9, 0x260e }, /* telephone ☎ BLACK TELEPHONE */
- { 0x0afa, 0x2315 }, /* telephonerecorder ⌕ TELEPHONE RECORDER */
- { 0x0afb, 0x2117 }, /* phonographcopyright â„— SOUND RECORDING COPYRIGHT */
- { 0x0afc, 0x2038 }, /* caret ‸ CARET */
- { 0x0afd, 0x201a }, /* singlelowquotemark ‚ SINGLE LOW-9 QUOTATION MARK */
- { 0x0afe, 0x201e }, /* doublelowquotemark „ DOUBLE LOW-9 QUOTATION MARK */
-/* 0x0aff cursor ? ??? */
- { 0x0ba3, 0x003c }, /* leftcaret < LESS-THAN SIGN */
- { 0x0ba6, 0x003e }, /* rightcaret > GREATER-THAN SIGN */
- { 0x0ba8, 0x2228 }, /* downcaret ∨ LOGICAL OR */
- { 0x0ba9, 0x2227 }, /* upcaret ∧ LOGICAL AND */
- { 0x0bc0, 0x00af }, /* overbar ¯ MACRON */
- { 0x0bc2, 0x22a4 }, /* downtack ⊤ DOWN TACK */
- { 0x0bc3, 0x2229 }, /* upshoe ∩ INTERSECTION */
- { 0x0bc4, 0x230a }, /* downstile ⌊ LEFT FLOOR */
- { 0x0bc6, 0x005f }, /* underbar _ LOW LINE */
- { 0x0bca, 0x2218 }, /* jot ∘ RING OPERATOR */
- { 0x0bcc, 0x2395 }, /* quad ⎕ APL FUNCTIONAL SYMBOL QUAD (Unicode 3.0) */
- { 0x0bce, 0x22a5 }, /* uptack ⊥ UP TACK */
- { 0x0bcf, 0x25cb }, /* circle â—‹ WHITE CIRCLE */
- { 0x0bd3, 0x2308 }, /* upstile ⌈ LEFT CEILING */
- { 0x0bd6, 0x222a }, /* downshoe ∪ UNION */
- { 0x0bd8, 0x2283 }, /* rightshoe ⊃ SUPERSET OF */
- { 0x0bda, 0x2282 }, /* leftshoe ⊂ SUBSET OF */
- { 0x0bdc, 0x22a3 }, /* lefttack ⊣ LEFT TACK */
- { 0x0bfc, 0x22a2 }, /* righttack ⊢ RIGHT TACK */
- { 0x0cdf, 0x2017 }, /* hebrew_doublelowline ‗ DOUBLE LOW LINE */
- { 0x0ce0, 0x05d0 }, /* hebrew_aleph × HEBREW LETTER ALEF */
- { 0x0ce1, 0x05d1 }, /* hebrew_bet ב HEBREW LETTER BET */
- { 0x0ce2, 0x05d2 }, /* hebrew_gimel ×’ HEBREW LETTER GIMEL */
- { 0x0ce3, 0x05d3 }, /* hebrew_dalet ד HEBREW LETTER DALET */
- { 0x0ce4, 0x05d4 }, /* hebrew_he ×” HEBREW LETTER HE */
- { 0x0ce5, 0x05d5 }, /* hebrew_waw ו HEBREW LETTER VAV */
- { 0x0ce6, 0x05d6 }, /* hebrew_zain ×– HEBREW LETTER ZAYIN */
- { 0x0ce7, 0x05d7 }, /* hebrew_chet ×— HEBREW LETTER HET */
- { 0x0ce8, 0x05d8 }, /* hebrew_tet ט HEBREW LETTER TET */
- { 0x0ce9, 0x05d9 }, /* hebrew_yod ×™ HEBREW LETTER YOD */
- { 0x0cea, 0x05da }, /* hebrew_finalkaph ך HEBREW LETTER FINAL KAF */
- { 0x0ceb, 0x05db }, /* hebrew_kaph ×› HEBREW LETTER KAF */
- { 0x0cec, 0x05dc }, /* hebrew_lamed ל HEBREW LETTER LAMED */
- { 0x0ced, 0x05dd }, /* hebrew_finalmem × HEBREW LETTER FINAL MEM */
- { 0x0cee, 0x05de }, /* hebrew_mem מ HEBREW LETTER MEM */
- { 0x0cef, 0x05df }, /* hebrew_finalnun ן HEBREW LETTER FINAL NUN */
- { 0x0cf0, 0x05e0 }, /* hebrew_nun ×  HEBREW LETTER NUN */
- { 0x0cf1, 0x05e1 }, /* hebrew_samech ס HEBREW LETTER SAMEKH */
- { 0x0cf2, 0x05e2 }, /* hebrew_ayin ×¢ HEBREW LETTER AYIN */
- { 0x0cf3, 0x05e3 }, /* hebrew_finalpe ×£ HEBREW LETTER FINAL PE */
- { 0x0cf4, 0x05e4 }, /* hebrew_pe פ HEBREW LETTER PE */
- { 0x0cf5, 0x05e5 }, /* hebrew_finalzade ×¥ HEBREW LETTER FINAL TSADI */
- { 0x0cf6, 0x05e6 }, /* hebrew_zade צ HEBREW LETTER TSADI */
- { 0x0cf7, 0x05e7 }, /* hebrew_qoph ק HEBREW LETTER QOF */
- { 0x0cf8, 0x05e8 }, /* hebrew_resh ר HEBREW LETTER RESH */
- { 0x0cf9, 0x05e9 }, /* hebrew_shin ש HEBREW LETTER SHIN */
- { 0x0cfa, 0x05ea }, /* hebrew_taw ת HEBREW LETTER TAV */
- { 0x0da1, 0x0e01 }, /* Thai_kokai ภTHAI CHARACTER KO KAI */
- { 0x0da2, 0x0e02 }, /* Thai_khokhai ข THAI CHARACTER KHO KHAI */
- { 0x0da3, 0x0e03 }, /* Thai_khokhuat ฃ THAI CHARACTER KHO KHUAT */
- { 0x0da4, 0x0e04 }, /* Thai_khokhwai ค THAI CHARACTER KHO KHWAI */
- { 0x0da5, 0x0e05 }, /* Thai_khokhon ฅ THAI CHARACTER KHO KHON */
- { 0x0da6, 0x0e06 }, /* Thai_khorakhang ฆ THAI CHARACTER KHO RAKHANG */
- { 0x0da7, 0x0e07 }, /* Thai_ngongu ง THAI CHARACTER NGO NGU */
- { 0x0da8, 0x0e08 }, /* Thai_chochan จ THAI CHARACTER CHO CHAN */
- { 0x0da9, 0x0e09 }, /* Thai_choching ฉ THAI CHARACTER CHO CHING */
- { 0x0daa, 0x0e0a }, /* Thai_chochang ช THAI CHARACTER CHO CHANG */
- { 0x0dab, 0x0e0b }, /* Thai_soso ซ THAI CHARACTER SO SO */
- { 0x0dac, 0x0e0c }, /* Thai_chochoe ฌ THAI CHARACTER CHO CHOE */
- { 0x0dad, 0x0e0d }, /* Thai_yoying ภTHAI CHARACTER YO YING */
- { 0x0dae, 0x0e0e }, /* Thai_dochada ฎ THAI CHARACTER DO CHADA */
- { 0x0daf, 0x0e0f }, /* Thai_topatak ภTHAI CHARACTER TO PATAK */
- { 0x0db0, 0x0e10 }, /* Thai_thothan ภTHAI CHARACTER THO THAN */
- { 0x0db1, 0x0e11 }, /* Thai_thonangmontho ฑ THAI CHARACTER THO NANGMONTHO */
- { 0x0db2, 0x0e12 }, /* Thai_thophuthao ฒ THAI CHARACTER THO PHUTHAO */
- { 0x0db3, 0x0e13 }, /* Thai_nonen ณ THAI CHARACTER NO NEN */
- { 0x0db4, 0x0e14 }, /* Thai_dodek ด THAI CHARACTER DO DEK */
- { 0x0db5, 0x0e15 }, /* Thai_totao ต THAI CHARACTER TO TAO */
- { 0x0db6, 0x0e16 }, /* Thai_thothung ถ THAI CHARACTER THO THUNG */
- { 0x0db7, 0x0e17 }, /* Thai_thothahan ท THAI CHARACTER THO THAHAN */
- { 0x0db8, 0x0e18 }, /* Thai_thothong ธ THAI CHARACTER THO THONG */
- { 0x0db9, 0x0e19 }, /* Thai_nonu น THAI CHARACTER NO NU */
- { 0x0dba, 0x0e1a }, /* Thai_bobaimai บ THAI CHARACTER BO BAIMAI */
- { 0x0dbb, 0x0e1b }, /* Thai_popla ป THAI CHARACTER PO PLA */
- { 0x0dbc, 0x0e1c }, /* Thai_phophung ผ THAI CHARACTER PHO PHUNG */
- { 0x0dbd, 0x0e1d }, /* Thai_fofa ภTHAI CHARACTER FO FA */
- { 0x0dbe, 0x0e1e }, /* Thai_phophan พ THAI CHARACTER PHO PHAN */
- { 0x0dbf, 0x0e1f }, /* Thai_fofan ฟ THAI CHARACTER FO FAN */
- { 0x0dc0, 0x0e20 }, /* Thai_phosamphao ภ THAI CHARACTER PHO SAMPHAO */
- { 0x0dc1, 0x0e21 }, /* Thai_moma ม THAI CHARACTER MO MA */
- { 0x0dc2, 0x0e22 }, /* Thai_yoyak ย THAI CHARACTER YO YAK */
- { 0x0dc3, 0x0e23 }, /* Thai_rorua ร THAI CHARACTER RO RUA */
- { 0x0dc4, 0x0e24 }, /* Thai_ru ฤ THAI CHARACTER RU */
- { 0x0dc5, 0x0e25 }, /* Thai_loling ล THAI CHARACTER LO LING */
- { 0x0dc6, 0x0e26 }, /* Thai_lu ฦ THAI CHARACTER LU */
- { 0x0dc7, 0x0e27 }, /* Thai_wowaen ว THAI CHARACTER WO WAEN */
- { 0x0dc8, 0x0e28 }, /* Thai_sosala ศ THAI CHARACTER SO SALA */
- { 0x0dc9, 0x0e29 }, /* Thai_sorusi ษ THAI CHARACTER SO RUSI */
- { 0x0dca, 0x0e2a }, /* Thai_sosua ส THAI CHARACTER SO SUA */
- { 0x0dcb, 0x0e2b }, /* Thai_hohip ห THAI CHARACTER HO HIP */
- { 0x0dcc, 0x0e2c }, /* Thai_lochula ฬ THAI CHARACTER LO CHULA */
- { 0x0dcd, 0x0e2d }, /* Thai_oang อ THAI CHARACTER O ANG */
- { 0x0dce, 0x0e2e }, /* Thai_honokhuk ฮ THAI CHARACTER HO NOKHUK */
- { 0x0dcf, 0x0e2f }, /* Thai_paiyannoi ฯ THAI CHARACTER PAIYANNOI */
- { 0x0dd0, 0x0e30 }, /* Thai_saraa ะ THAI CHARACTER SARA A */
- { 0x0dd1, 0x0e31 }, /* Thai_maihanakat ั THAI CHARACTER MAI HAN-AKAT */
- { 0x0dd2, 0x0e32 }, /* Thai_saraaa า THAI CHARACTER SARA AA */
- { 0x0dd3, 0x0e33 }, /* Thai_saraam ำ THAI CHARACTER SARA AM */
- { 0x0dd4, 0x0e34 }, /* Thai_sarai ิ THAI CHARACTER SARA I */
- { 0x0dd5, 0x0e35 }, /* Thai_saraii ี THAI CHARACTER SARA II */
- { 0x0dd6, 0x0e36 }, /* Thai_saraue ึ THAI CHARACTER SARA UE */
- { 0x0dd7, 0x0e37 }, /* Thai_sarauee ื THAI CHARACTER SARA UEE */
- { 0x0dd8, 0x0e38 }, /* Thai_sarau ุ THAI CHARACTER SARA U */
- { 0x0dd9, 0x0e39 }, /* Thai_sarauu ู THAI CHARACTER SARA UU */
- { 0x0dda, 0x0e3a }, /* Thai_phinthu ฺ THAI CHARACTER PHINTHU */
- { 0x0dde, 0x0e3e }, /* Thai_maihanakat_maitho ฾ ??? */
- { 0x0ddf, 0x0e3f }, /* Thai_baht ฿ THAI CURRENCY SYMBOL BAHT */
- { 0x0de0, 0x0e40 }, /* Thai_sarae เ THAI CHARACTER SARA E */
- { 0x0de1, 0x0e41 }, /* Thai_saraae ๠THAI CHARACTER SARA AE */
- { 0x0de2, 0x0e42 }, /* Thai_sarao โ THAI CHARACTER SARA O */
- { 0x0de3, 0x0e43 }, /* Thai_saraaimaimuan ใ THAI CHARACTER SARA AI MAIMUAN */
- { 0x0de4, 0x0e44 }, /* Thai_saraaimaimalai ไ THAI CHARACTER SARA AI MAIMALAI */
- { 0x0de5, 0x0e45 }, /* Thai_lakkhangyao ๅ THAI CHARACTER LAKKHANGYAO */
- { 0x0de6, 0x0e46 }, /* Thai_maiyamok ๆ THAI CHARACTER MAIYAMOK */
- { 0x0de7, 0x0e47 }, /* Thai_maitaikhu ็ THAI CHARACTER MAITAIKHU */
- { 0x0de8, 0x0e48 }, /* Thai_maiek ่ THAI CHARACTER MAI EK */
- { 0x0de9, 0x0e49 }, /* Thai_maitho ้ THAI CHARACTER MAI THO */
- { 0x0dea, 0x0e4a }, /* Thai_maitri ๊ THAI CHARACTER MAI TRI */
- { 0x0deb, 0x0e4b }, /* Thai_maichattawa ๋ THAI CHARACTER MAI CHATTAWA */
- { 0x0dec, 0x0e4c }, /* Thai_thanthakhat ์ THAI CHARACTER THANTHAKHAT */
- { 0x0ded, 0x0e4d }, /* Thai_nikhahit ๠THAI CHARACTER NIKHAHIT */
- { 0x0df0, 0x0e50 }, /* Thai_leksun ๠THAI DIGIT ZERO */
- { 0x0df1, 0x0e51 }, /* Thai_leknung ๑ THAI DIGIT ONE */
- { 0x0df2, 0x0e52 }, /* Thai_leksong ๒ THAI DIGIT TWO */
- { 0x0df3, 0x0e53 }, /* Thai_leksam ๓ THAI DIGIT THREE */
- { 0x0df4, 0x0e54 }, /* Thai_leksi ๔ THAI DIGIT FOUR */
- { 0x0df5, 0x0e55 }, /* Thai_lekha ๕ THAI DIGIT FIVE */
- { 0x0df6, 0x0e56 }, /* Thai_lekhok ๖ THAI DIGIT SIX */
- { 0x0df7, 0x0e57 }, /* Thai_lekchet ๗ THAI DIGIT SEVEN */
- { 0x0df8, 0x0e58 }, /* Thai_lekpaet ๘ THAI DIGIT EIGHT */
- { 0x0df9, 0x0e59 }, /* Thai_lekkao ๙ THAI DIGIT NINE */
- { 0x0ea1, 0x3131 }, /* Hangul_Kiyeog ㄱ HANGUL LETTER KIYEOK */
- { 0x0ea2, 0x3132 }, /* Hangul_SsangKiyeog ㄲ HANGUL LETTER SSANGKIYEOK */
- { 0x0ea3, 0x3133 }, /* Hangul_KiyeogSios ㄳ HANGUL LETTER KIYEOK-SIOS */
- { 0x0ea4, 0x3134 }, /* Hangul_Nieun ã„´ HANGUL LETTER NIEUN */
- { 0x0ea5, 0x3135 }, /* Hangul_NieunJieuj ㄵ HANGUL LETTER NIEUN-CIEUC */
- { 0x0ea6, 0x3136 }, /* Hangul_NieunHieuh ㄶ HANGUL LETTER NIEUN-HIEUH */
- { 0x0ea7, 0x3137 }, /* Hangul_Dikeud ã„· HANGUL LETTER TIKEUT */
- { 0x0ea8, 0x3138 }, /* Hangul_SsangDikeud ㄸ HANGUL LETTER SSANGTIKEUT */
- { 0x0ea9, 0x3139 }, /* Hangul_Rieul ㄹ HANGUL LETTER RIEUL */
- { 0x0eaa, 0x313a }, /* Hangul_RieulKiyeog ㄺ HANGUL LETTER RIEUL-KIYEOK */
- { 0x0eab, 0x313b }, /* Hangul_RieulMieum ã„» HANGUL LETTER RIEUL-MIEUM */
- { 0x0eac, 0x313c }, /* Hangul_RieulPieub ㄼ HANGUL LETTER RIEUL-PIEUP */
- { 0x0ead, 0x313d }, /* Hangul_RieulSios ㄽ HANGUL LETTER RIEUL-SIOS */
- { 0x0eae, 0x313e }, /* Hangul_RieulTieut ㄾ HANGUL LETTER RIEUL-THIEUTH */
- { 0x0eaf, 0x313f }, /* Hangul_RieulPhieuf ã„¿ HANGUL LETTER RIEUL-PHIEUPH */
- { 0x0eb0, 0x3140 }, /* Hangul_RieulHieuh ã…€ HANGUL LETTER RIEUL-HIEUH */
- { 0x0eb1, 0x3141 }, /* Hangul_Mieum ã… HANGUL LETTER MIEUM */
- { 0x0eb2, 0x3142 }, /* Hangul_Pieub ã…‚ HANGUL LETTER PIEUP */
- { 0x0eb3, 0x3143 }, /* Hangul_SsangPieub ã…ƒ HANGUL LETTER SSANGPIEUP */
- { 0x0eb4, 0x3144 }, /* Hangul_PieubSios ã…„ HANGUL LETTER PIEUP-SIOS */
- { 0x0eb5, 0x3145 }, /* Hangul_Sios ã…… HANGUL LETTER SIOS */
- { 0x0eb6, 0x3146 }, /* Hangul_SsangSios ã…† HANGUL LETTER SSANGSIOS */
- { 0x0eb7, 0x3147 }, /* Hangul_Ieung ã…‡ HANGUL LETTER IEUNG */
- { 0x0eb8, 0x3148 }, /* Hangul_Jieuj ã…ˆ HANGUL LETTER CIEUC */
- { 0x0eb9, 0x3149 }, /* Hangul_SsangJieuj ã…‰ HANGUL LETTER SSANGCIEUC */
- { 0x0eba, 0x314a }, /* Hangul_Cieuc ã…Š HANGUL LETTER CHIEUCH */
- { 0x0ebb, 0x314b }, /* Hangul_Khieuq ã…‹ HANGUL LETTER KHIEUKH */
- { 0x0ebc, 0x314c }, /* Hangul_Tieut ㅌ HANGUL LETTER THIEUTH */
- { 0x0ebd, 0x314d }, /* Hangul_Phieuf ã… HANGUL LETTER PHIEUPH */
- { 0x0ebe, 0x314e }, /* Hangul_Hieuh ã…Ž HANGUL LETTER HIEUH */
- { 0x0ebf, 0x314f }, /* Hangul_A ã… HANGUL LETTER A */
- { 0x0ec0, 0x3150 }, /* Hangul_AE ã… HANGUL LETTER AE */
- { 0x0ec1, 0x3151 }, /* Hangul_YA ã…‘ HANGUL LETTER YA */
- { 0x0ec2, 0x3152 }, /* Hangul_YAE ã…’ HANGUL LETTER YAE */
- { 0x0ec3, 0x3153 }, /* Hangul_EO ã…“ HANGUL LETTER EO */
- { 0x0ec4, 0x3154 }, /* Hangul_E ã…” HANGUL LETTER E */
- { 0x0ec5, 0x3155 }, /* Hangul_YEO ã…• HANGUL LETTER YEO */
- { 0x0ec6, 0x3156 }, /* Hangul_YE ã…– HANGUL LETTER YE */
- { 0x0ec7, 0x3157 }, /* Hangul_O ã…— HANGUL LETTER O */
- { 0x0ec8, 0x3158 }, /* Hangul_WA ã…˜ HANGUL LETTER WA */
- { 0x0ec9, 0x3159 }, /* Hangul_WAE ã…™ HANGUL LETTER WAE */
- { 0x0eca, 0x315a }, /* Hangul_OE ã…š HANGUL LETTER OE */
- { 0x0ecb, 0x315b }, /* Hangul_YO ã…› HANGUL LETTER YO */
- { 0x0ecc, 0x315c }, /* Hangul_U ㅜ HANGUL LETTER U */
- { 0x0ecd, 0x315d }, /* Hangul_WEO ã… HANGUL LETTER WEO */
- { 0x0ece, 0x315e }, /* Hangul_WE ã…ž HANGUL LETTER WE */
- { 0x0ecf, 0x315f }, /* Hangul_WI ã…Ÿ HANGUL LETTER WI */
- { 0x0ed0, 0x3160 }, /* Hangul_YU ã…  HANGUL LETTER YU */
- { 0x0ed1, 0x3161 }, /* Hangul_EU ã…¡ HANGUL LETTER EU */
- { 0x0ed2, 0x3162 }, /* Hangul_YI ã…¢ HANGUL LETTER YI */
- { 0x0ed3, 0x3163 }, /* Hangul_I ã…£ HANGUL LETTER I */
- { 0x0ed4, 0x11a8 }, /* Hangul_J_Kiyeog ᆨ HANGUL JONGSEONG KIYEOK */
- { 0x0ed5, 0x11a9 }, /* Hangul_J_SsangKiyeog ᆩ HANGUL JONGSEONG SSANGKIYEOK */
- { 0x0ed6, 0x11aa }, /* Hangul_J_KiyeogSios ᆪ HANGUL JONGSEONG KIYEOK-SIOS */
- { 0x0ed7, 0x11ab }, /* Hangul_J_Nieun ᆫ HANGUL JONGSEONG NIEUN */
- { 0x0ed8, 0x11ac }, /* Hangul_J_NieunJieuj ᆬ HANGUL JONGSEONG NIEUN-CIEUC */
- { 0x0ed9, 0x11ad }, /* Hangul_J_NieunHieuh ᆭ HANGUL JONGSEONG NIEUN-HIEUH */
- { 0x0eda, 0x11ae }, /* Hangul_J_Dikeud ᆮ HANGUL JONGSEONG TIKEUT */
- { 0x0edb, 0x11af }, /* Hangul_J_Rieul ᆯ HANGUL JONGSEONG RIEUL */
- { 0x0edc, 0x11b0 }, /* Hangul_J_RieulKiyeog ᆰ HANGUL JONGSEONG RIEUL-KIYEOK */
- { 0x0edd, 0x11b1 }, /* Hangul_J_RieulMieum ᆱ HANGUL JONGSEONG RIEUL-MIEUM */
- { 0x0ede, 0x11b2 }, /* Hangul_J_RieulPieub ᆲ HANGUL JONGSEONG RIEUL-PIEUP */
- { 0x0edf, 0x11b3 }, /* Hangul_J_RieulSios ᆳ HANGUL JONGSEONG RIEUL-SIOS */
- { 0x0ee0, 0x11b4 }, /* Hangul_J_RieulTieut ᆴ HANGUL JONGSEONG RIEUL-THIEUTH */
- { 0x0ee1, 0x11b5 }, /* Hangul_J_RieulPhieuf ᆵ HANGUL JONGSEONG RIEUL-PHIEUPH */
- { 0x0ee2, 0x11b6 }, /* Hangul_J_RieulHieuh ᆶ HANGUL JONGSEONG RIEUL-HIEUH */
- { 0x0ee3, 0x11b7 }, /* Hangul_J_Mieum ᆷ HANGUL JONGSEONG MIEUM */
- { 0x0ee4, 0x11b8 }, /* Hangul_J_Pieub ᆸ HANGUL JONGSEONG PIEUP */
- { 0x0ee5, 0x11b9 }, /* Hangul_J_PieubSios ᆹ HANGUL JONGSEONG PIEUP-SIOS */
- { 0x0ee6, 0x11ba }, /* Hangul_J_Sios ᆺ HANGUL JONGSEONG SIOS */
- { 0x0ee7, 0x11bb }, /* Hangul_J_SsangSios ᆻ HANGUL JONGSEONG SSANGSIOS */
- { 0x0ee8, 0x11bc }, /* Hangul_J_Ieung ᆼ HANGUL JONGSEONG IEUNG */
- { 0x0ee9, 0x11bd }, /* Hangul_J_Jieuj ᆽ HANGUL JONGSEONG CIEUC */
- { 0x0eea, 0x11be }, /* Hangul_J_Cieuc ᆾ HANGUL JONGSEONG CHIEUCH */
- { 0x0eeb, 0x11bf }, /* Hangul_J_Khieuq ᆿ HANGUL JONGSEONG KHIEUKH */
- { 0x0eec, 0x11c0 }, /* Hangul_J_Tieut ᇀ HANGUL JONGSEONG THIEUTH */
- { 0x0eed, 0x11c1 }, /* Hangul_J_Phieuf ᇠHANGUL JONGSEONG PHIEUPH */
- { 0x0eee, 0x11c2 }, /* Hangul_J_Hieuh ᇂ HANGUL JONGSEONG HIEUH */
- { 0x0eef, 0x316d }, /* Hangul_RieulYeorinHieuh ã…­ HANGUL LETTER RIEUL-YEORINHIEUH */
- { 0x0ef0, 0x3171 }, /* Hangul_SunkyeongeumMieum ã…± HANGUL LETTER KAPYEOUNMIEUM */
- { 0x0ef1, 0x3178 }, /* Hangul_SunkyeongeumPieub ã…¸ HANGUL LETTER KAPYEOUNPIEUP */
- { 0x0ef2, 0x317f }, /* Hangul_PanSios ã…¿ HANGUL LETTER PANSIOS */
-/* 0x0ef3 Hangul_KkogjiDalrinIeung ? ??? */
- { 0x0ef4, 0x3184 }, /* Hangul_SunkyeongeumPhieuf ㆄ HANGUL LETTER KAPYEOUNPHIEUPH */
- { 0x0ef5, 0x3186 }, /* Hangul_YeorinHieuh ㆆ HANGUL LETTER YEORINHIEUH */
- { 0x0ef6, 0x318d }, /* Hangul_AraeA ㆠHANGUL LETTER ARAEA */
- { 0x0ef7, 0x318e }, /* Hangul_AraeAE ㆎ HANGUL LETTER ARAEAE */
- { 0x0ef8, 0x11eb }, /* Hangul_J_PanSios ᇫ HANGUL JONGSEONG PANSIOS */
-/* 0x0ef9 Hangul_J_KkogjiDalrinIeung ? ??? */
- { 0x0efa, 0x11f9 }, /* Hangul_J_YeorinHieuh ᇹ HANGUL JONGSEONG YEORINHIEUH */
- { 0x0eff, 0x20a9 }, /* Korean_Won â‚© WON SIGN */
- { 0x13bc, 0x0152 }, /* OE Å’ LATIN CAPITAL LIGATURE OE */
- { 0x13bd, 0x0153 }, /* oe Å“ LATIN SMALL LIGATURE OE */
- { 0x13be, 0x0178 }, /* Ydiaeresis Ÿ LATIN CAPITAL LETTER Y WITH DIAERESIS */
- { 0x20a0, 0x20a0 }, /* EcuSign â‚  EURO-CURRENCY SIGN */
- { 0x20a1, 0x20a1 }, /* ColonSign â‚¡ COLON SIGN */
- { 0x20a2, 0x20a2 }, /* CruzeiroSign â‚¢ CRUZEIRO SIGN */
- { 0x20a3, 0x20a3 }, /* FFrancSign â‚£ FRENCH FRANC SIGN */
- { 0x20a4, 0x20a4 }, /* LiraSign ₤ LIRA SIGN */
- { 0x20a5, 0x20a5 }, /* MillSign â‚¥ MILL SIGN */
- { 0x20a6, 0x20a6 }, /* NairaSign ₦ NAIRA SIGN */
- { 0x20a7, 0x20a7 }, /* PesetaSign ₧ PESETA SIGN */
- { 0x20a8, 0x20a8 }, /* RupeeSign ₨ RUPEE SIGN */
- { 0x20a9, 0x20a9 }, /* WonSign â‚© WON SIGN */
- { 0x20aa, 0x20aa }, /* NewSheqelSign ₪ NEW SHEQEL SIGN */
- { 0x20ab, 0x20ab }, /* DongSign â‚« DONG SIGN */
- { 0x20ac, 0x20ac }, /* EuroSign € EURO SIGN */
-};
-
-/**
- * gdk_keyval_to_unicode:
- * @keysym: a GDK key symbol
- *
- * Convert from a GDK key symbol to the corresponding ISO10646 (Unicode)
- * character.
- *
- * Return value: the corresponding unicode character, or 0 if there
- * is no corresponding character.
- **/
-
-guint32
-gdk_keyval_to_unicode (guint keysym)
-{
- int min = 0;
- int max = sizeof (gdk_keysym_to_unicode_tab) / sizeof (gdk_keysym_to_unicode_tab[0]) - 1;
- int mid;
-
- /* First check for Latin-1 characters (1:1 mapping) */
- if ((keysym >= 0x0020 && keysym <= 0x007e) ||
- (keysym >= 0x00a0 && keysym <= 0x00ff))
- return keysym;
-
- /* Also check for directly encoded 24-bit UCS characters:
- */
- if ((keysym & 0xff000000) == 0x01000000)
- return keysym & 0x00ffffff;
-
- /* binary search in table */
- while (max >= min) {
- mid = (min + max) / 2;
- if (gdk_keysym_to_unicode_tab[mid].keysym < keysym)
- min = mid + 1;
- else if (gdk_keysym_to_unicode_tab[mid].keysym > keysym)
- max = mid - 1;
- else {
- /* found it */
- return gdk_keysym_to_unicode_tab[mid].ucs;
- }
- }
-
- /* No matching Unicode value found */
- return 0;
-}
-
-/*
- * Canonical decomposition
- *
- * It is copied here from libunicode, because we do not want malloc
- *
- */
-
-typedef struct
-{
- unsigned short ch;
- unsigned char *expansion;
-} e_decomposition;
-
-static e_decomposition e_decomp_table[] =
-{
- { 0x00c0, "\x00\x41\x03\x00\0" },
- { 0x00c1, "\x00\x41\x03\x01\0" },
- { 0x00c2, "\x00\x41\x03\x02\0" },
- { 0x00c3, "\x00\x41\x03\x03\0" },
- { 0x00c4, "\x00\x41\x03\x08\0" },
- { 0x00c5, "\x00\x41\x03\x0a\0" },
- { 0x00c7, "\x00\x43\x03\x27\0" },
- { 0x00c8, "\x00\x45\x03\x00\0" },
- { 0x00c9, "\x00\x45\x03\x01\0" },
- { 0x00ca, "\x00\x45\x03\x02\0" },
- { 0x00cb, "\x00\x45\x03\x08\0" },
- { 0x00cc, "\x00\x49\x03\x00\0" },
- { 0x00cd, "\x00\x49\x03\x01\0" },
- { 0x00ce, "\x00\x49\x03\x02\0" },
- { 0x00cf, "\x00\x49\x03\x08\0" },
- { 0x00d1, "\x00\x4e\x03\x03\0" },
- { 0x00d2, "\x00\x4f\x03\x00\0" },
- { 0x00d3, "\x00\x4f\x03\x01\0" },
- { 0x00d4, "\x00\x4f\x03\x02\0" },
- { 0x00d5, "\x00\x4f\x03\x03\0" },
- { 0x00d6, "\x00\x4f\x03\x08\0" },
- { 0x00d9, "\x00\x55\x03\x00\0" },
- { 0x00da, "\x00\x55\x03\x01\0" },
- { 0x00db, "\x00\x55\x03\x02\0" },
- { 0x00dc, "\x00\x55\x03\x08\0" },
- { 0x00dd, "\x00\x59\x03\x01\0" },
- { 0x00e0, "\x00\x61\x03\x00\0" },
- { 0x00e1, "\x00\x61\x03\x01\0" },
- { 0x00e2, "\x00\x61\x03\x02\0" },
- { 0x00e3, "\x00\x61\x03\x03\0" },
- { 0x00e4, "\x00\x61\x03\x08\0" },
- { 0x00e5, "\x00\x61\x03\x0a\0" },
- { 0x00e7, "\x00\x63\x03\x27\0" },
- { 0x00e8, "\x00\x65\x03\x00\0" },
- { 0x00e9, "\x00\x65\x03\x01\0" },
- { 0x00ea, "\x00\x65\x03\x02\0" },
- { 0x00eb, "\x00\x65\x03\x08\0" },
- { 0x00ec, "\x00\x69\x03\x00\0" },
- { 0x00ed, "\x00\x69\x03\x01\0" },
- { 0x00ee, "\x00\x69\x03\x02\0" },
- { 0x00ef, "\x00\x69\x03\x08\0" },
- { 0x00f1, "\x00\x6e\x03\x03\0" },
- { 0x00f2, "\x00\x6f\x03\x00\0" },
- { 0x00f3, "\x00\x6f\x03\x01\0" },
- { 0x00f4, "\x00\x6f\x03\x02\0" },
- { 0x00f5, "\x00\x6f\x03\x03\0" },
- { 0x00f6, "\x00\x6f\x03\x08\0" },
- { 0x00f9, "\x00\x75\x03\x00\0" },
- { 0x00fa, "\x00\x75\x03\x01\0" },
- { 0x00fb, "\x00\x75\x03\x02\0" },
- { 0x00fc, "\x00\x75\x03\x08\0" },
- { 0x00fd, "\x00\x79\x03\x01\0" },
- { 0x00ff, "\x00\x79\x03\x08\0" },
- { 0x0100, "\x00\x41\x03\x04\0" },
- { 0x0101, "\x00\x61\x03\x04\0" },
- { 0x0102, "\x00\x41\x03\x06\0" },
- { 0x0103, "\x00\x61\x03\x06\0" },
- { 0x0104, "\x00\x41\x03\x28\0" },
- { 0x0105, "\x00\x61\x03\x28\0" },
- { 0x0106, "\x00\x43\x03\x01\0" },
- { 0x0107, "\x00\x63\x03\x01\0" },
- { 0x0108, "\x00\x43\x03\x02\0" },
- { 0x0109, "\x00\x63\x03\x02\0" },
- { 0x010a, "\x00\x43\x03\x07\0" },
- { 0x010b, "\x00\x63\x03\x07\0" },
- { 0x010c, "\x00\x43\x03\x0c\0" },
- { 0x010d, "\x00\x63\x03\x0c\0" },
- { 0x010e, "\x00\x44\x03\x0c\0" },
- { 0x010f, "\x00\x64\x03\x0c\0" },
- { 0x0112, "\x00\x45\x03\x04\0" },
- { 0x0113, "\x00\x65\x03\x04\0" },
- { 0x0114, "\x00\x45\x03\x06\0" },
- { 0x0115, "\x00\x65\x03\x06\0" },
- { 0x0116, "\x00\x45\x03\x07\0" },
- { 0x0117, "\x00\x65\x03\x07\0" },
- { 0x0118, "\x00\x45\x03\x28\0" },
- { 0x0119, "\x00\x65\x03\x28\0" },
- { 0x011a, "\x00\x45\x03\x0c\0" },
- { 0x011b, "\x00\x65\x03\x0c\0" },
- { 0x011c, "\x00\x47\x03\x02\0" },
- { 0x011d, "\x00\x67\x03\x02\0" },
- { 0x011e, "\x00\x47\x03\x06\0" },
- { 0x011f, "\x00\x67\x03\x06\0" },
- { 0x0120, "\x00\x47\x03\x07\0" },
- { 0x0121, "\x00\x67\x03\x07\0" },
- { 0x0122, "\x00\x47\x03\x27\0" },
- { 0x0123, "\x00\x67\x03\x27\0" },
- { 0x0124, "\x00\x48\x03\x02\0" },
- { 0x0125, "\x00\x68\x03\x02\0" },
- { 0x0128, "\x00\x49\x03\x03\0" },
- { 0x0129, "\x00\x69\x03\x03\0" },
- { 0x012a, "\x00\x49\x03\x04\0" },
- { 0x012b, "\x00\x69\x03\x04\0" },
- { 0x012c, "\x00\x49\x03\x06\0" },
- { 0x012d, "\x00\x69\x03\x06\0" },
- { 0x012e, "\x00\x49\x03\x28\0" },
- { 0x012f, "\x00\x69\x03\x28\0" },
- { 0x0130, "\x00\x49\x03\x07\0" },
- { 0x0134, "\x00\x4a\x03\x02\0" },
- { 0x0135, "\x00\x6a\x03\x02\0" },
- { 0x0136, "\x00\x4b\x03\x27\0" },
- { 0x0137, "\x00\x6b\x03\x27\0" },
- { 0x0139, "\x00\x4c\x03\x01\0" },
- { 0x013a, "\x00\x6c\x03\x01\0" },
- { 0x013b, "\x00\x4c\x03\x27\0" },
- { 0x013c, "\x00\x6c\x03\x27\0" },
- { 0x013d, "\x00\x4c\x03\x0c\0" },
- { 0x013e, "\x00\x6c\x03\x0c\0" },
- { 0x0143, "\x00\x4e\x03\x01\0" },
- { 0x0144, "\x00\x6e\x03\x01\0" },
- { 0x0145, "\x00\x4e\x03\x27\0" },
- { 0x0146, "\x00\x6e\x03\x27\0" },
- { 0x0147, "\x00\x4e\x03\x0c\0" },
- { 0x0148, "\x00\x6e\x03\x0c\0" },
- { 0x014c, "\x00\x4f\x03\x04\0" },
- { 0x014d, "\x00\x6f\x03\x04\0" },
- { 0x014e, "\x00\x4f\x03\x06\0" },
- { 0x014f, "\x00\x6f\x03\x06\0" },
- { 0x0150, "\x00\x4f\x03\x0b\0" },
- { 0x0151, "\x00\x6f\x03\x0b\0" },
- { 0x0154, "\x00\x52\x03\x01\0" },
- { 0x0155, "\x00\x72\x03\x01\0" },
- { 0x0156, "\x00\x52\x03\x27\0" },
- { 0x0157, "\x00\x72\x03\x27\0" },
- { 0x0158, "\x00\x52\x03\x0c\0" },
- { 0x0159, "\x00\x72\x03\x0c\0" },
- { 0x015a, "\x00\x53\x03\x01\0" },
- { 0x015b, "\x00\x73\x03\x01\0" },
- { 0x015c, "\x00\x53\x03\x02\0" },
- { 0x015d, "\x00\x73\x03\x02\0" },
- { 0x015e, "\x00\x53\x03\x27\0" },
- { 0x015f, "\x00\x73\x03\x27\0" },
- { 0x0160, "\x00\x53\x03\x0c\0" },
- { 0x0161, "\x00\x73\x03\x0c\0" },
- { 0x0162, "\x00\x54\x03\x27\0" },
- { 0x0163, "\x00\x74\x03\x27\0" },
- { 0x0164, "\x00\x54\x03\x0c\0" },
- { 0x0165, "\x00\x74\x03\x0c\0" },
- { 0x0168, "\x00\x55\x03\x03\0" },
- { 0x0169, "\x00\x75\x03\x03\0" },
- { 0x016a, "\x00\x55\x03\x04\0" },
- { 0x016b, "\x00\x75\x03\x04\0" },
- { 0x016c, "\x00\x55\x03\x06\0" },
- { 0x016d, "\x00\x75\x03\x06\0" },
- { 0x016e, "\x00\x55\x03\x0a\0" },
- { 0x016f, "\x00\x75\x03\x0a\0" },
- { 0x0170, "\x00\x55\x03\x0b\0" },
- { 0x0171, "\x00\x75\x03\x0b\0" },
- { 0x0172, "\x00\x55\x03\x28\0" },
- { 0x0173, "\x00\x75\x03\x28\0" },
- { 0x0174, "\x00\x57\x03\x02\0" },
- { 0x0175, "\x00\x77\x03\x02\0" },
- { 0x0176, "\x00\x59\x03\x02\0" },
- { 0x0177, "\x00\x79\x03\x02\0" },
- { 0x0178, "\x00\x59\x03\x08\0" },
- { 0x0179, "\x00\x5a\x03\x01\0" },
- { 0x017a, "\x00\x7a\x03\x01\0" },
- { 0x017b, "\x00\x5a\x03\x07\0" },
- { 0x017c, "\x00\x7a\x03\x07\0" },
- { 0x017d, "\x00\x5a\x03\x0c\0" },
- { 0x017e, "\x00\x7a\x03\x0c\0" },
- { 0x01a0, "\x00\x4f\x03\x1b\0" },
- { 0x01a1, "\x00\x6f\x03\x1b\0" },
- { 0x01af, "\x00\x55\x03\x1b\0" },
- { 0x01b0, "\x00\x75\x03\x1b\0" },
- { 0x01cd, "\x00\x41\x03\x0c\0" },
- { 0x01ce, "\x00\x61\x03\x0c\0" },
- { 0x01cf, "\x00\x49\x03\x0c\0" },
- { 0x01d0, "\x00\x69\x03\x0c\0" },
- { 0x01d1, "\x00\x4f\x03\x0c\0" },
- { 0x01d2, "\x00\x6f\x03\x0c\0" },
- { 0x01d3, "\x00\x55\x03\x0c\0" },
- { 0x01d4, "\x00\x75\x03\x0c\0" },
- { 0x01d5, "\x00\x55\x03\x08\x03\x04\0" },
- { 0x01d6, "\x00\x75\x03\x08\x03\x04\0" },
- { 0x01d7, "\x00\x55\x03\x08\x03\x01\0" },
- { 0x01d8, "\x00\x75\x03\x08\x03\x01\0" },
- { 0x01d9, "\x00\x55\x03\x08\x03\x0c\0" },
- { 0x01da, "\x00\x75\x03\x08\x03\x0c\0" },
- { 0x01db, "\x00\x55\x03\x08\x03\x00\0" },
- { 0x01dc, "\x00\x75\x03\x08\x03\x00\0" },
- { 0x01de, "\x00\x41\x03\x08\x03\x04\0" },
- { 0x01df, "\x00\x61\x03\x08\x03\x04\0" },
- { 0x01e0, "\x00\x41\x03\x07\x03\x04\0" },
- { 0x01e1, "\x00\x61\x03\x07\x03\x04\0" },
- { 0x01e2, "\x00\xc6\x03\x04\0" },
- { 0x01e3, "\x00\xe6\x03\x04\0" },
- { 0x01e6, "\x00\x47\x03\x0c\0" },
- { 0x01e7, "\x00\x67\x03\x0c\0" },
- { 0x01e8, "\x00\x4b\x03\x0c\0" },
- { 0x01e9, "\x00\x6b\x03\x0c\0" },
- { 0x01ea, "\x00\x4f\x03\x28\0" },
- { 0x01eb, "\x00\x6f\x03\x28\0" },
- { 0x01ec, "\x00\x4f\x03\x28\x03\x04\0" },
- { 0x01ed, "\x00\x6f\x03\x28\x03\x04\0" },
- { 0x01ee, "\x01\xb7\x03\x0c\0" },
- { 0x01ef, "\x02\x92\x03\x0c\0" },
- { 0x01f0, "\x00\x6a\x03\x0c\0" },
- { 0x01f4, "\x00\x47\x03\x01\0" },
- { 0x01f5, "\x00\x67\x03\x01\0" },
- { 0x01fa, "\x00\x41\x03\x0a\x03\x01\0" },
- { 0x01fb, "\x00\x61\x03\x0a\x03\x01\0" },
- { 0x01fc, "\x00\xc6\x03\x01\0" },
- { 0x01fd, "\x00\xe6\x03\x01\0" },
- { 0x01fe, "\x00\xd8\x03\x01\0" },
- { 0x01ff, "\x00\xf8\x03\x01\0" },
- { 0x0200, "\x00\x41\x03\x0f\0" },
- { 0x0201, "\x00\x61\x03\x0f\0" },
- { 0x0202, "\x00\x41\x03\x11\0" },
- { 0x0203, "\x00\x61\x03\x11\0" },
- { 0x0204, "\x00\x45\x03\x0f\0" },
- { 0x0205, "\x00\x65\x03\x0f\0" },
- { 0x0206, "\x00\x45\x03\x11\0" },
- { 0x0207, "\x00\x65\x03\x11\0" },
- { 0x0208, "\x00\x49\x03\x0f\0" },
- { 0x0209, "\x00\x69\x03\x0f\0" },
- { 0x020a, "\x00\x49\x03\x11\0" },
- { 0x020b, "\x00\x69\x03\x11\0" },
- { 0x020c, "\x00\x4f\x03\x0f\0" },
- { 0x020d, "\x00\x6f\x03\x0f\0" },
- { 0x020e, "\x00\x4f\x03\x11\0" },
- { 0x020f, "\x00\x6f\x03\x11\0" },
- { 0x0210, "\x00\x52\x03\x0f\0" },
- { 0x0211, "\x00\x72\x03\x0f\0" },
- { 0x0212, "\x00\x52\x03\x11\0" },
- { 0x0213, "\x00\x72\x03\x11\0" },
- { 0x0214, "\x00\x55\x03\x0f\0" },
- { 0x0215, "\x00\x75\x03\x0f\0" },
- { 0x0216, "\x00\x55\x03\x11\0" },
- { 0x0217, "\x00\x75\x03\x11\0" },
- { 0x0340, "\x03\x00\0" },
- { 0x0341, "\x03\x01\0" },
- { 0x0343, "\x03\x13\0" },
- { 0x0344, "\x03\x08\x03\x01\0" },
- { 0x0374, "\x02\xb9\0" },
- { 0x037e, "\x00\x3b\0" },
- { 0x0385, "\x00\xa8\x03\x01\0" },
- { 0x0386, "\x03\x91\x03\x01\0" },
- { 0x0387, "\x00\xb7\0" },
- { 0x0388, "\x03\x95\x03\x01\0" },
- { 0x0389, "\x03\x97\x03\x01\0" },
- { 0x038a, "\x03\x99\x03\x01\0" },
- { 0x038c, "\x03\x9f\x03\x01\0" },
- { 0x038e, "\x03\xa5\x03\x01\0" },
- { 0x038f, "\x03\xa9\x03\x01\0" },
- { 0x0390, "\x03\xb9\x03\x08\x03\x01\0" },
- { 0x03aa, "\x03\x99\x03\x08\0" },
- { 0x03ab, "\x03\xa5\x03\x08\0" },
- { 0x03ac, "\x03\xb1\x03\x01\0" },
- { 0x03ad, "\x03\xb5\x03\x01\0" },
- { 0x03ae, "\x03\xb7\x03\x01\0" },
- { 0x03af, "\x03\xb9\x03\x01\0" },
- { 0x03b0, "\x03\xc5\x03\x08\x03\x01\0" },
- { 0x03ca, "\x03\xb9\x03\x08\0" },
- { 0x03cb, "\x03\xc5\x03\x08\0" },
- { 0x03cc, "\x03\xbf\x03\x01\0" },
- { 0x03cd, "\x03\xc5\x03\x01\0" },
- { 0x03ce, "\x03\xc9\x03\x01\0" },
- { 0x03d3, "\x03\xd2\x03\x01\0" },
- { 0x03d4, "\x03\xd2\x03\x08\0" },
- { 0x0401, "\x04\x15\x03\x08\0" },
- { 0x0403, "\x04\x13\x03\x01\0" },
- { 0x0407, "\x04\x06\x03\x08\0" },
- { 0x040c, "\x04\x1a\x03\x01\0" },
- { 0x040e, "\x04\x23\x03\x06\0" },
- { 0x0419, "\x04\x18\x03\x06\0" },
- { 0x0439, "\x04\x38\x03\x06\0" },
- { 0x0451, "\x04\x35\x03\x08\0" },
- { 0x0453, "\x04\x33\x03\x01\0" },
- { 0x0457, "\x04\x56\x03\x08\0" },
- { 0x045c, "\x04\x3a\x03\x01\0" },
- { 0x045e, "\x04\x43\x03\x06\0" },
- { 0x0476, "\x04\x74\x03\x0f\0" },
- { 0x0477, "\x04\x75\x03\x0f\0" },
- { 0x04c1, "\x04\x16\x03\x06\0" },
- { 0x04c2, "\x04\x36\x03\x06\0" },
- { 0x04d0, "\x04\x10\x03\x06\0" },
- { 0x04d1, "\x04\x30\x03\x06\0" },
- { 0x04d2, "\x04\x10\x03\x08\0" },
- { 0x04d3, "\x04\x30\x03\x08\0" },
- { 0x04d6, "\x04\x15\x03\x06\0" },
- { 0x04d7, "\x04\x35\x03\x06\0" },
- { 0x04da, "\x04\xd8\x03\x08\0" },
- { 0x04db, "\x04\xd9\x03\x08\0" },
- { 0x04dc, "\x04\x16\x03\x08\0" },
- { 0x04dd, "\x04\x36\x03\x08\0" },
- { 0x04de, "\x04\x17\x03\x08\0" },
- { 0x04df, "\x04\x37\x03\x08\0" },
- { 0x04e2, "\x04\x18\x03\x04\0" },
- { 0x04e3, "\x04\x38\x03\x04\0" },
- { 0x04e4, "\x04\x18\x03\x08\0" },
- { 0x04e5, "\x04\x38\x03\x08\0" },
- { 0x04e6, "\x04\x1e\x03\x08\0" },
- { 0x04e7, "\x04\x3e\x03\x08\0" },
- { 0x04ea, "\x04\xe8\x03\x08\0" },
- { 0x04eb, "\x04\xe9\x03\x08\0" },
- { 0x04ee, "\x04\x23\x03\x04\0" },
- { 0x04ef, "\x04\x43\x03\x04\0" },
- { 0x04f0, "\x04\x23\x03\x08\0" },
- { 0x04f1, "\x04\x43\x03\x08\0" },
- { 0x04f2, "\x04\x23\x03\x0b\0" },
- { 0x04f3, "\x04\x43\x03\x0b\0" },
- { 0x04f4, "\x04\x27\x03\x08\0" },
- { 0x04f5, "\x04\x47\x03\x08\0" },
- { 0x04f8, "\x04\x2b\x03\x08\0" },
- { 0x04f9, "\x04\x4b\x03\x08\0" },
- { 0x0929, "\x09\x28\x09\x3c\0" },
- { 0x0931, "\x09\x30\x09\x3c\0" },
- { 0x0934, "\x09\x33\x09\x3c\0" },
- { 0x0958, "\x09\x15\x09\x3c\0" },
- { 0x0959, "\x09\x16\x09\x3c\0" },
- { 0x095a, "\x09\x17\x09\x3c\0" },
- { 0x095b, "\x09\x1c\x09\x3c\0" },
- { 0x095c, "\x09\x21\x09\x3c\0" },
- { 0x095d, "\x09\x22\x09\x3c\0" },
- { 0x095e, "\x09\x2b\x09\x3c\0" },
- { 0x095f, "\x09\x2f\x09\x3c\0" },
- { 0x09b0, "\x09\xac\x09\xbc\0" },
- { 0x09cb, "\x09\xc7\x09\xbe\0" },
- { 0x09cc, "\x09\xc7\x09\xd7\0" },
- { 0x09dc, "\x09\xa1\x09\xbc\0" },
- { 0x09dd, "\x09\xa2\x09\xbc\0" },
- { 0x09df, "\x09\xaf\x09\xbc\0" },
- { 0x0a59, "\x0a\x16\x0a\x3c\0" },
- { 0x0a5a, "\x0a\x17\x0a\x3c\0" },
- { 0x0a5b, "\x0a\x1c\x0a\x3c\0" },
- { 0x0a5c, "\x0a\x21\x0a\x3c\0" },
- { 0x0a5e, "\x0a\x2b\x0a\x3c\0" },
- { 0x0b48, "\x0b\x47\x0b\x56\0" },
- { 0x0b4b, "\x0b\x47\x0b\x3e\0" },
- { 0x0b4c, "\x0b\x47\x0b\x57\0" },
- { 0x0b5c, "\x0b\x21\x0b\x3c\0" },
- { 0x0b5d, "\x0b\x22\x0b\x3c\0" },
- { 0x0b5f, "\x0b\x2f\x0b\x3c\0" },
- { 0x0b94, "\x0b\x92\x0b\xd7\0" },
- { 0x0bca, "\x0b\xc6\x0b\xbe\0" },
- { 0x0bcb, "\x0b\xc7\x0b\xbe\0" },
- { 0x0bcc, "\x0b\xc6\x0b\xd7\0" },
- { 0x0c48, "\x0c\x46\x0c\x56\0" },
- { 0x0cc0, "\x0c\xbf\x0c\xd5\0" },
- { 0x0cc7, "\x0c\xc6\x0c\xd5\0" },
- { 0x0cc8, "\x0c\xc6\x0c\xd6\0" },
- { 0x0cca, "\x0c\xc6\x0c\xc2\0" },
- { 0x0ccb, "\x0c\xc6\x0c\xc2\x0c\xd5\0" },
- { 0x0d4a, "\x0d\x46\x0d\x3e\0" },
- { 0x0d4b, "\x0d\x47\x0d\x3e\0" },
- { 0x0d4c, "\x0d\x46\x0d\x57\0" },
- { 0x0e33, "\x0e\x4d\x0e\x32\0" },
- { 0x0eb3, "\x0e\xcd\x0e\xb2\0" },
- { 0x0f43, "\x0f\x42\x0f\xb7\0" },
- { 0x0f4d, "\x0f\x4c\x0f\xb7\0" },
- { 0x0f52, "\x0f\x51\x0f\xb7\0" },
- { 0x0f57, "\x0f\x56\x0f\xb7\0" },
- { 0x0f5c, "\x0f\x5b\x0f\xb7\0" },
- { 0x0f69, "\x0f\x40\x0f\xb5\0" },
- { 0x0f73, "\x0f\x71\x0f\x72\0" },
- { 0x0f75, "\x0f\x71\x0f\x74\0" },
- { 0x0f76, "\x0f\xb2\x0f\x80\0" },
- { 0x0f78, "\x0f\xb3\x0f\x80\0" },
- { 0x0f81, "\x0f\x71\x0f\x80\0" },
- { 0x0f93, "\x0f\x92\x0f\xb7\0" },
- { 0x0f9d, "\x0f\x9c\x0f\xb7\0" },
- { 0x0fa2, "\x0f\xa1\x0f\xb7\0" },
- { 0x0fa7, "\x0f\xa6\x0f\xb7\0" },
- { 0x0fac, "\x0f\xab\x0f\xb7\0" },
- { 0x0fb9, "\x0f\x90\x0f\xb5\0" },
- { 0x1e00, "\x00\x41\x03\x25\0" },
- { 0x1e01, "\x00\x61\x03\x25\0" },
- { 0x1e02, "\x00\x42\x03\x07\0" },
- { 0x1e03, "\x00\x62\x03\x07\0" },
- { 0x1e04, "\x00\x42\x03\x23\0" },
- { 0x1e05, "\x00\x62\x03\x23\0" },
- { 0x1e06, "\x00\x42\x03\x31\0" },
- { 0x1e07, "\x00\x62\x03\x31\0" },
- { 0x1e08, "\x00\x43\x03\x27\x03\x01\0" },
- { 0x1e09, "\x00\x63\x03\x27\x03\x01\0" },
- { 0x1e0a, "\x00\x44\x03\x07\0" },
- { 0x1e0b, "\x00\x64\x03\x07\0" },
- { 0x1e0c, "\x00\x44\x03\x23\0" },
- { 0x1e0d, "\x00\x64\x03\x23\0" },
- { 0x1e0e, "\x00\x44\x03\x31\0" },
- { 0x1e0f, "\x00\x64\x03\x31\0" },
- { 0x1e10, "\x00\x44\x03\x27\0" },
- { 0x1e11, "\x00\x64\x03\x27\0" },
- { 0x1e12, "\x00\x44\x03\x2d\0" },
- { 0x1e13, "\x00\x64\x03\x2d\0" },
- { 0x1e14, "\x00\x45\x03\x04\x03\x00\0" },
- { 0x1e15, "\x00\x65\x03\x04\x03\x00\0" },
- { 0x1e16, "\x00\x45\x03\x04\x03\x01\0" },
- { 0x1e17, "\x00\x65\x03\x04\x03\x01\0" },
- { 0x1e18, "\x00\x45\x03\x2d\0" },
- { 0x1e19, "\x00\x65\x03\x2d\0" },
- { 0x1e1a, "\x00\x45\x03\x30\0" },
- { 0x1e1b, "\x00\x65\x03\x30\0" },
- { 0x1e1c, "\x00\x45\x03\x27\x03\x06\0" },
- { 0x1e1d, "\x00\x65\x03\x27\x03\x06\0" },
- { 0x1e1e, "\x00\x46\x03\x07\0" },
- { 0x1e1f, "\x00\x66\x03\x07\0" },
- { 0x1e20, "\x00\x47\x03\x04\0" },
- { 0x1e21, "\x00\x67\x03\x04\0" },
- { 0x1e22, "\x00\x48\x03\x07\0" },
- { 0x1e23, "\x00\x68\x03\x07\0" },
- { 0x1e24, "\x00\x48\x03\x23\0" },
- { 0x1e25, "\x00\x68\x03\x23\0" },
- { 0x1e26, "\x00\x48\x03\x08\0" },
- { 0x1e27, "\x00\x68\x03\x08\0" },
- { 0x1e28, "\x00\x48\x03\x27\0" },
- { 0x1e29, "\x00\x68\x03\x27\0" },
- { 0x1e2a, "\x00\x48\x03\x2e\0" },
- { 0x1e2b, "\x00\x68\x03\x2e\0" },
- { 0x1e2c, "\x00\x49\x03\x30\0" },
- { 0x1e2d, "\x00\x69\x03\x30\0" },
- { 0x1e2e, "\x00\x49\x03\x08\x03\x01\0" },
- { 0x1e2f, "\x00\x69\x03\x08\x03\x01\0" },
- { 0x1e30, "\x00\x4b\x03\x01\0" },
- { 0x1e31, "\x00\x6b\x03\x01\0" },
- { 0x1e32, "\x00\x4b\x03\x23\0" },
- { 0x1e33, "\x00\x6b\x03\x23\0" },
- { 0x1e34, "\x00\x4b\x03\x31\0" },
- { 0x1e35, "\x00\x6b\x03\x31\0" },
- { 0x1e36, "\x00\x4c\x03\x23\0" },
- { 0x1e37, "\x00\x6c\x03\x23\0" },
- { 0x1e38, "\x00\x4c\x03\x23\x03\x04\0" },
- { 0x1e39, "\x00\x6c\x03\x23\x03\x04\0" },
- { 0x1e3a, "\x00\x4c\x03\x31\0" },
- { 0x1e3b, "\x00\x6c\x03\x31\0" },
- { 0x1e3c, "\x00\x4c\x03\x2d\0" },
- { 0x1e3d, "\x00\x6c\x03\x2d\0" },
- { 0x1e3e, "\x00\x4d\x03\x01\0" },
- { 0x1e3f, "\x00\x6d\x03\x01\0" },
- { 0x1e40, "\x00\x4d\x03\x07\0" },
- { 0x1e41, "\x00\x6d\x03\x07\0" },
- { 0x1e42, "\x00\x4d\x03\x23\0" },
- { 0x1e43, "\x00\x6d\x03\x23\0" },
- { 0x1e44, "\x00\x4e\x03\x07\0" },
- { 0x1e45, "\x00\x6e\x03\x07\0" },
- { 0x1e46, "\x00\x4e\x03\x23\0" },
- { 0x1e47, "\x00\x6e\x03\x23\0" },
- { 0x1e48, "\x00\x4e\x03\x31\0" },
- { 0x1e49, "\x00\x6e\x03\x31\0" },
- { 0x1e4a, "\x00\x4e\x03\x2d\0" },
- { 0x1e4b, "\x00\x6e\x03\x2d\0" },
- { 0x1e4c, "\x00\x4f\x03\x03\x03\x01\0" },
- { 0x1e4d, "\x00\x6f\x03\x03\x03\x01\0" },
- { 0x1e4e, "\x00\x4f\x03\x03\x03\x08\0" },
- { 0x1e4f, "\x00\x6f\x03\x03\x03\x08\0" },
- { 0x1e50, "\x00\x4f\x03\x04\x03\x00\0" },
- { 0x1e51, "\x00\x6f\x03\x04\x03\x00\0" },
- { 0x1e52, "\x00\x4f\x03\x04\x03\x01\0" },
- { 0x1e53, "\x00\x6f\x03\x04\x03\x01\0" },
- { 0x1e54, "\x00\x50\x03\x01\0" },
- { 0x1e55, "\x00\x70\x03\x01\0" },
- { 0x1e56, "\x00\x50\x03\x07\0" },
- { 0x1e57, "\x00\x70\x03\x07\0" },
- { 0x1e58, "\x00\x52\x03\x07\0" },
- { 0x1e59, "\x00\x72\x03\x07\0" },
- { 0x1e5a, "\x00\x52\x03\x23\0" },
- { 0x1e5b, "\x00\x72\x03\x23\0" },
- { 0x1e5c, "\x00\x52\x03\x23\x03\x04\0" },
- { 0x1e5d, "\x00\x72\x03\x23\x03\x04\0" },
- { 0x1e5e, "\x00\x52\x03\x31\0" },
- { 0x1e5f, "\x00\x72\x03\x31\0" },
- { 0x1e60, "\x00\x53\x03\x07\0" },
- { 0x1e61, "\x00\x73\x03\x07\0" },
- { 0x1e62, "\x00\x53\x03\x23\0" },
- { 0x1e63, "\x00\x73\x03\x23\0" },
- { 0x1e64, "\x00\x53\x03\x01\x03\x07\0" },
- { 0x1e65, "\x00\x73\x03\x01\x03\x07\0" },
- { 0x1e66, "\x00\x53\x03\x0c\x03\x07\0" },
- { 0x1e67, "\x00\x73\x03\x0c\x03\x07\0" },
- { 0x1e68, "\x00\x53\x03\x23\x03\x07\0" },
- { 0x1e69, "\x00\x73\x03\x23\x03\x07\0" },
- { 0x1e6a, "\x00\x54\x03\x07\0" },
- { 0x1e6b, "\x00\x74\x03\x07\0" },
- { 0x1e6c, "\x00\x54\x03\x23\0" },
- { 0x1e6d, "\x00\x74\x03\x23\0" },
- { 0x1e6e, "\x00\x54\x03\x31\0" },
- { 0x1e6f, "\x00\x74\x03\x31\0" },
- { 0x1e70, "\x00\x54\x03\x2d\0" },
- { 0x1e71, "\x00\x74\x03\x2d\0" },
- { 0x1e72, "\x00\x55\x03\x24\0" },
- { 0x1e73, "\x00\x75\x03\x24\0" },
- { 0x1e74, "\x00\x55\x03\x30\0" },
- { 0x1e75, "\x00\x75\x03\x30\0" },
- { 0x1e76, "\x00\x55\x03\x2d\0" },
- { 0x1e77, "\x00\x75\x03\x2d\0" },
- { 0x1e78, "\x00\x55\x03\x03\x03\x01\0" },
- { 0x1e79, "\x00\x75\x03\x03\x03\x01\0" },
- { 0x1e7a, "\x00\x55\x03\x04\x03\x08\0" },
- { 0x1e7b, "\x00\x75\x03\x04\x03\x08\0" },
- { 0x1e7c, "\x00\x56\x03\x03\0" },
- { 0x1e7d, "\x00\x76\x03\x03\0" },
- { 0x1e7e, "\x00\x56\x03\x23\0" },
- { 0x1e7f, "\x00\x76\x03\x23\0" },
- { 0x1e80, "\x00\x57\x03\x00\0" },
- { 0x1e81, "\x00\x77\x03\x00\0" },
- { 0x1e82, "\x00\x57\x03\x01\0" },
- { 0x1e83, "\x00\x77\x03\x01\0" },
- { 0x1e84, "\x00\x57\x03\x08\0" },
- { 0x1e85, "\x00\x77\x03\x08\0" },
- { 0x1e86, "\x00\x57\x03\x07\0" },
- { 0x1e87, "\x00\x77\x03\x07\0" },
- { 0x1e88, "\x00\x57\x03\x23\0" },
- { 0x1e89, "\x00\x77\x03\x23\0" },
- { 0x1e8a, "\x00\x58\x03\x07\0" },
- { 0x1e8b, "\x00\x78\x03\x07\0" },
- { 0x1e8c, "\x00\x58\x03\x08\0" },
- { 0x1e8d, "\x00\x78\x03\x08\0" },
- { 0x1e8e, "\x00\x59\x03\x07\0" },
- { 0x1e8f, "\x00\x79\x03\x07\0" },
- { 0x1e90, "\x00\x5a\x03\x02\0" },
- { 0x1e91, "\x00\x7a\x03\x02\0" },
- { 0x1e92, "\x00\x5a\x03\x23\0" },
- { 0x1e93, "\x00\x7a\x03\x23\0" },
- { 0x1e94, "\x00\x5a\x03\x31\0" },
- { 0x1e95, "\x00\x7a\x03\x31\0" },
- { 0x1e96, "\x00\x68\x03\x31\0" },
- { 0x1e97, "\x00\x74\x03\x08\0" },
- { 0x1e98, "\x00\x77\x03\x0a\0" },
- { 0x1e99, "\x00\x79\x03\x0a\0" },
- { 0x1e9b, "\x01\x7f\x03\x07\0" },
- { 0x1ea0, "\x00\x41\x03\x23\0" },
- { 0x1ea1, "\x00\x61\x03\x23\0" },
- { 0x1ea2, "\x00\x41\x03\x09\0" },
- { 0x1ea3, "\x00\x61\x03\x09\0" },
- { 0x1ea4, "\x00\x41\x03\x02\x03\x01\0" },
- { 0x1ea5, "\x00\x61\x03\x02\x03\x01\0" },
- { 0x1ea6, "\x00\x41\x03\x02\x03\x00\0" },
- { 0x1ea7, "\x00\x61\x03\x02\x03\x00\0" },
- { 0x1ea8, "\x00\x41\x03\x02\x03\x09\0" },
- { 0x1ea9, "\x00\x61\x03\x02\x03\x09\0" },
- { 0x1eaa, "\x00\x41\x03\x02\x03\x03\0" },
- { 0x1eab, "\x00\x61\x03\x02\x03\x03\0" },
- { 0x1eac, "\x00\x41\x03\x23\x03\x02\0" },
- { 0x1ead, "\x00\x61\x03\x23\x03\x02\0" },
- { 0x1eae, "\x00\x41\x03\x06\x03\x01\0" },
- { 0x1eaf, "\x00\x61\x03\x06\x03\x01\0" },
- { 0x1eb0, "\x00\x41\x03\x06\x03\x00\0" },
- { 0x1eb1, "\x00\x61\x03\x06\x03\x00\0" },
- { 0x1eb2, "\x00\x41\x03\x06\x03\x09\0" },
- { 0x1eb3, "\x00\x61\x03\x06\x03\x09\0" },
- { 0x1eb4, "\x00\x41\x03\x06\x03\x03\0" },
- { 0x1eb5, "\x00\x61\x03\x06\x03\x03\0" },
- { 0x1eb6, "\x00\x41\x03\x23\x03\x06\0" },
- { 0x1eb7, "\x00\x61\x03\x23\x03\x06\0" },
- { 0x1eb8, "\x00\x45\x03\x23\0" },
- { 0x1eb9, "\x00\x65\x03\x23\0" },
- { 0x1eba, "\x00\x45\x03\x09\0" },
- { 0x1ebb, "\x00\x65\x03\x09\0" },
- { 0x1ebc, "\x00\x45\x03\x03\0" },
- { 0x1ebd, "\x00\x65\x03\x03\0" },
- { 0x1ebe, "\x00\x45\x03\x02\x03\x01\0" },
- { 0x1ebf, "\x00\x65\x03\x02\x03\x01\0" },
- { 0x1ec0, "\x00\x45\x03\x02\x03\x00\0" },
- { 0x1ec1, "\x00\x65\x03\x02\x03\x00\0" },
- { 0x1ec2, "\x00\x45\x03\x02\x03\x09\0" },
- { 0x1ec3, "\x00\x65\x03\x02\x03\x09\0" },
- { 0x1ec4, "\x00\x45\x03\x02\x03\x03\0" },
- { 0x1ec5, "\x00\x65\x03\x02\x03\x03\0" },
- { 0x1ec6, "\x00\x45\x03\x23\x03\x02\0" },
- { 0x1ec7, "\x00\x65\x03\x23\x03\x02\0" },
- { 0x1ec8, "\x00\x49\x03\x09\0" },
- { 0x1ec9, "\x00\x69\x03\x09\0" },
- { 0x1eca, "\x00\x49\x03\x23\0" },
- { 0x1ecb, "\x00\x69\x03\x23\0" },
- { 0x1ecc, "\x00\x4f\x03\x23\0" },
- { 0x1ecd, "\x00\x6f\x03\x23\0" },
- { 0x1ece, "\x00\x4f\x03\x09\0" },
- { 0x1ecf, "\x00\x6f\x03\x09\0" },
- { 0x1ed0, "\x00\x4f\x03\x02\x03\x01\0" },
- { 0x1ed1, "\x00\x6f\x03\x02\x03\x01\0" },
- { 0x1ed2, "\x00\x4f\x03\x02\x03\x00\0" },
- { 0x1ed3, "\x00\x6f\x03\x02\x03\x00\0" },
- { 0x1ed4, "\x00\x4f\x03\x02\x03\x09\0" },
- { 0x1ed5, "\x00\x6f\x03\x02\x03\x09\0" },
- { 0x1ed6, "\x00\x4f\x03\x02\x03\x03\0" },
- { 0x1ed7, "\x00\x6f\x03\x02\x03\x03\0" },
- { 0x1ed8, "\x00\x4f\x03\x23\x03\x02\0" },
- { 0x1ed9, "\x00\x6f\x03\x23\x03\x02\0" },
- { 0x1eda, "\x00\x4f\x03\x1b\x03\x01\0" },
- { 0x1edb, "\x00\x6f\x03\x1b\x03\x01\0" },
- { 0x1edc, "\x00\x4f\x03\x1b\x03\x00\0" },
- { 0x1edd, "\x00\x6f\x03\x1b\x03\x00\0" },
- { 0x1ede, "\x00\x4f\x03\x1b\x03\x09\0" },
- { 0x1edf, "\x00\x6f\x03\x1b\x03\x09\0" },
- { 0x1ee0, "\x00\x4f\x03\x1b\x03\x03\0" },
- { 0x1ee1, "\x00\x6f\x03\x1b\x03\x03\0" },
- { 0x1ee2, "\x00\x4f\x03\x1b\x03\x23\0" },
- { 0x1ee3, "\x00\x6f\x03\x1b\x03\x23\0" },
- { 0x1ee4, "\x00\x55\x03\x23\0" },
- { 0x1ee5, "\x00\x75\x03\x23\0" },
- { 0x1ee6, "\x00\x55\x03\x09\0" },
- { 0x1ee7, "\x00\x75\x03\x09\0" },
- { 0x1ee8, "\x00\x55\x03\x1b\x03\x01\0" },
- { 0x1ee9, "\x00\x75\x03\x1b\x03\x01\0" },
- { 0x1eea, "\x00\x55\x03\x1b\x03\x00\0" },
- { 0x1eeb, "\x00\x75\x03\x1b\x03\x00\0" },
- { 0x1eec, "\x00\x55\x03\x1b\x03\x09\0" },
- { 0x1eed, "\x00\x75\x03\x1b\x03\x09\0" },
- { 0x1eee, "\x00\x55\x03\x1b\x03\x03\0" },
- { 0x1eef, "\x00\x75\x03\x1b\x03\x03\0" },
- { 0x1ef0, "\x00\x55\x03\x1b\x03\x23\0" },
- { 0x1ef1, "\x00\x75\x03\x1b\x03\x23\0" },
- { 0x1ef2, "\x00\x59\x03\x00\0" },
- { 0x1ef3, "\x00\x79\x03\x00\0" },
- { 0x1ef4, "\x00\x59\x03\x23\0" },
- { 0x1ef5, "\x00\x79\x03\x23\0" },
- { 0x1ef6, "\x00\x59\x03\x09\0" },
- { 0x1ef7, "\x00\x79\x03\x09\0" },
- { 0x1ef8, "\x00\x59\x03\x03\0" },
- { 0x1ef9, "\x00\x79\x03\x03\0" },
- { 0x1f00, "\x03\xb1\x03\x13\0" },
- { 0x1f01, "\x03\xb1\x03\x14\0" },
- { 0x1f02, "\x03\xb1\x03\x13\x03\x00\0" },
- { 0x1f03, "\x03\xb1\x03\x14\x03\x00\0" },
- { 0x1f04, "\x03\xb1\x03\x13\x03\x01\0" },
- { 0x1f05, "\x03\xb1\x03\x14\x03\x01\0" },
- { 0x1f06, "\x03\xb1\x03\x13\x03\x42\0" },
- { 0x1f07, "\x03\xb1\x03\x14\x03\x42\0" },
- { 0x1f08, "\x03\x91\x03\x13\0" },
- { 0x1f09, "\x03\x91\x03\x14\0" },
- { 0x1f0a, "\x03\x91\x03\x13\x03\x00\0" },
- { 0x1f0b, "\x03\x91\x03\x14\x03\x00\0" },
- { 0x1f0c, "\x03\x91\x03\x13\x03\x01\0" },
- { 0x1f0d, "\x03\x91\x03\x14\x03\x01\0" },
- { 0x1f0e, "\x03\x91\x03\x13\x03\x42\0" },
- { 0x1f0f, "\x03\x91\x03\x14\x03\x42\0" },
- { 0x1f10, "\x03\xb5\x03\x13\0" },
- { 0x1f11, "\x03\xb5\x03\x14\0" },
- { 0x1f12, "\x03\xb5\x03\x13\x03\x00\0" },
- { 0x1f13, "\x03\xb5\x03\x14\x03\x00\0" },
- { 0x1f14, "\x03\xb5\x03\x13\x03\x01\0" },
- { 0x1f15, "\x03\xb5\x03\x14\x03\x01\0" },
- { 0x1f18, "\x03\x95\x03\x13\0" },
- { 0x1f19, "\x03\x95\x03\x14\0" },
- { 0x1f1a, "\x03\x95\x03\x13\x03\x00\0" },
- { 0x1f1b, "\x03\x95\x03\x14\x03\x00\0" },
- { 0x1f1c, "\x03\x95\x03\x13\x03\x01\0" },
- { 0x1f1d, "\x03\x95\x03\x14\x03\x01\0" },
- { 0x1f20, "\x03\xb7\x03\x13\0" },
- { 0x1f21, "\x03\xb7\x03\x14\0" },
- { 0x1f22, "\x03\xb7\x03\x13\x03\x00\0" },
- { 0x1f23, "\x03\xb7\x03\x14\x03\x00\0" },
- { 0x1f24, "\x03\xb7\x03\x13\x03\x01\0" },
- { 0x1f25, "\x03\xb7\x03\x14\x03\x01\0" },
- { 0x1f26, "\x03\xb7\x03\x13\x03\x42\0" },
- { 0x1f27, "\x03\xb7\x03\x14\x03\x42\0" },
- { 0x1f28, "\x03\x97\x03\x13\0" },
- { 0x1f29, "\x03\x97\x03\x14\0" },
- { 0x1f2a, "\x03\x97\x03\x13\x03\x00\0" },
- { 0x1f2b, "\x03\x97\x03\x14\x03\x00\0" },
- { 0x1f2c, "\x03\x97\x03\x13\x03\x01\0" },
- { 0x1f2d, "\x03\x97\x03\x14\x03\x01\0" },
- { 0x1f2e, "\x03\x97\x03\x13\x03\x42\0" },
- { 0x1f2f, "\x03\x97\x03\x14\x03\x42\0" },
- { 0x1f30, "\x03\xb9\x03\x13\0" },
- { 0x1f31, "\x03\xb9\x03\x14\0" },
- { 0x1f32, "\x03\xb9\x03\x13\x03\x00\0" },
- { 0x1f33, "\x03\xb9\x03\x14\x03\x00\0" },
- { 0x1f34, "\x03\xb9\x03\x13\x03\x01\0" },
- { 0x1f35, "\x03\xb9\x03\x14\x03\x01\0" },
- { 0x1f36, "\x03\xb9\x03\x13\x03\x42\0" },
- { 0x1f37, "\x03\xb9\x03\x14\x03\x42\0" },
- { 0x1f38, "\x03\x99\x03\x13\0" },
- { 0x1f39, "\x03\x99\x03\x14\0" },
- { 0x1f3a, "\x03\x99\x03\x13\x03\x00\0" },
- { 0x1f3b, "\x03\x99\x03\x14\x03\x00\0" },
- { 0x1f3c, "\x03\x99\x03\x13\x03\x01\0" },
- { 0x1f3d, "\x03\x99\x03\x14\x03\x01\0" },
- { 0x1f3e, "\x03\x99\x03\x13\x03\x42\0" },
- { 0x1f3f, "\x03\x99\x03\x14\x03\x42\0" },
- { 0x1f40, "\x03\xbf\x03\x13\0" },
- { 0x1f41, "\x03\xbf\x03\x14\0" },
- { 0x1f42, "\x03\xbf\x03\x13\x03\x00\0" },
- { 0x1f43, "\x03\xbf\x03\x14\x03\x00\0" },
- { 0x1f44, "\x03\xbf\x03\x13\x03\x01\0" },
- { 0x1f45, "\x03\xbf\x03\x14\x03\x01\0" },
- { 0x1f48, "\x03\x9f\x03\x13\0" },
- { 0x1f49, "\x03\x9f\x03\x14\0" },
- { 0x1f4a, "\x03\x9f\x03\x13\x03\x00\0" },
- { 0x1f4b, "\x03\x9f\x03\x14\x03\x00\0" },
- { 0x1f4c, "\x03\x9f\x03\x13\x03\x01\0" },
- { 0x1f4d, "\x03\x9f\x03\x14\x03\x01\0" },
- { 0x1f50, "\x03\xc5\x03\x13\0" },
- { 0x1f51, "\x03\xc5\x03\x14\0" },
- { 0x1f52, "\x03\xc5\x03\x13\x03\x00\0" },
- { 0x1f53, "\x03\xc5\x03\x14\x03\x00\0" },
- { 0x1f54, "\x03\xc5\x03\x13\x03\x01\0" },
- { 0x1f55, "\x03\xc5\x03\x14\x03\x01\0" },
- { 0x1f56, "\x03\xc5\x03\x13\x03\x42\0" },
- { 0x1f57, "\x03\xc5\x03\x14\x03\x42\0" },
- { 0x1f59, "\x03\xa5\x03\x14\0" },
- { 0x1f5b, "\x03\xa5\x03\x14\x03\x00\0" },
- { 0x1f5d, "\x03\xa5\x03\x14\x03\x01\0" },
- { 0x1f5f, "\x03\xa5\x03\x14\x03\x42\0" },
- { 0x1f60, "\x03\xc9\x03\x13\0" },
- { 0x1f61, "\x03\xc9\x03\x14\0" },
- { 0x1f62, "\x03\xc9\x03\x13\x03\x00\0" },
- { 0x1f63, "\x03\xc9\x03\x14\x03\x00\0" },
- { 0x1f64, "\x03\xc9\x03\x13\x03\x01\0" },
- { 0x1f65, "\x03\xc9\x03\x14\x03\x01\0" },
- { 0x1f66, "\x03\xc9\x03\x13\x03\x42\0" },
- { 0x1f67, "\x03\xc9\x03\x14\x03\x42\0" },
- { 0x1f68, "\x03\xa9\x03\x13\0" },
- { 0x1f69, "\x03\xa9\x03\x14\0" },
- { 0x1f6a, "\x03\xa9\x03\x13\x03\x00\0" },
- { 0x1f6b, "\x03\xa9\x03\x14\x03\x00\0" },
- { 0x1f6c, "\x03\xa9\x03\x13\x03\x01\0" },
- { 0x1f6d, "\x03\xa9\x03\x14\x03\x01\0" },
- { 0x1f6e, "\x03\xa9\x03\x13\x03\x42\0" },
- { 0x1f6f, "\x03\xa9\x03\x14\x03\x42\0" },
- { 0x1f70, "\x03\xb1\x03\x00\0" },
- { 0x1f71, "\x03\xb1\x03\x01\0" },
- { 0x1f72, "\x03\xb5\x03\x00\0" },
- { 0x1f73, "\x03\xb5\x03\x01\0" },
- { 0x1f74, "\x03\xb7\x03\x00\0" },
- { 0x1f75, "\x03\xb7\x03\x01\0" },
- { 0x1f76, "\x03\xb9\x03\x00\0" },
- { 0x1f77, "\x03\xb9\x03\x01\0" },
- { 0x1f78, "\x03\xbf\x03\x00\0" },
- { 0x1f79, "\x03\xbf\x03\x01\0" },
- { 0x1f7a, "\x03\xc5\x03\x00\0" },
- { 0x1f7b, "\x03\xc5\x03\x01\0" },
- { 0x1f7c, "\x03\xc9\x03\x00\0" },
- { 0x1f7d, "\x03\xc9\x03\x01\0" },
- { 0x1f80, "\x03\xb1\x03\x13\x03\x45\0" },
- { 0x1f81, "\x03\xb1\x03\x14\x03\x45\0" },
- { 0x1f82, "\x03\xb1\x03\x13\x03\x00\x03\x45\0" },
- { 0x1f83, "\x03\xb1\x03\x14\x03\x00\x03\x45\0" },
- { 0x1f84, "\x03\xb1\x03\x13\x03\x01\x03\x45\0" },
- { 0x1f85, "\x03\xb1\x03\x14\x03\x01\x03\x45\0" },
- { 0x1f86, "\x03\xb1\x03\x13\x03\x42\x03\x45\0" },
- { 0x1f87, "\x03\xb1\x03\x14\x03\x42\x03\x45\0" },
- { 0x1f88, "\x03\x91\x03\x13\x03\x45\0" },
- { 0x1f89, "\x03\x91\x03\x14\x03\x45\0" },
- { 0x1f8a, "\x03\x91\x03\x13\x03\x00\x03\x45\0" },
- { 0x1f8b, "\x03\x91\x03\x14\x03\x00\x03\x45\0" },
- { 0x1f8c, "\x03\x91\x03\x13\x03\x01\x03\x45\0" },
- { 0x1f8d, "\x03\x91\x03\x14\x03\x01\x03\x45\0" },
- { 0x1f8e, "\x03\x91\x03\x13\x03\x42\x03\x45\0" },
- { 0x1f8f, "\x03\x91\x03\x14\x03\x42\x03\x45\0" },
- { 0x1f90, "\x03\xb7\x03\x13\x03\x45\0" },
- { 0x1f91, "\x03\xb7\x03\x14\x03\x45\0" },
- { 0x1f92, "\x03\xb7\x03\x13\x03\x00\x03\x45\0" },
- { 0x1f93, "\x03\xb7\x03\x14\x03\x00\x03\x45\0" },
- { 0x1f94, "\x03\xb7\x03\x13\x03\x01\x03\x45\0" },
- { 0x1f95, "\x03\xb7\x03\x14\x03\x01\x03\x45\0" },
- { 0x1f96, "\x03\xb7\x03\x13\x03\x42\x03\x45\0" },
- { 0x1f97, "\x03\xb7\x03\x14\x03\x42\x03\x45\0" },
- { 0x1f98, "\x03\x97\x03\x13\x03\x45\0" },
- { 0x1f99, "\x03\x97\x03\x14\x03\x45\0" },
- { 0x1f9a, "\x03\x97\x03\x13\x03\x00\x03\x45\0" },
- { 0x1f9b, "\x03\x97\x03\x14\x03\x00\x03\x45\0" },
- { 0x1f9c, "\x03\x97\x03\x13\x03\x01\x03\x45\0" },
- { 0x1f9d, "\x03\x97\x03\x14\x03\x01\x03\x45\0" },
- { 0x1f9e, "\x03\x97\x03\x13\x03\x42\x03\x45\0" },
- { 0x1f9f, "\x03\x97\x03\x14\x03\x42\x03\x45\0" },
- { 0x1fa0, "\x03\xc9\x03\x13\x03\x45\0" },
- { 0x1fa1, "\x03\xc9\x03\x14\x03\x45\0" },
- { 0x1fa2, "\x03\xc9\x03\x13\x03\x00\x03\x45\0" },
- { 0x1fa3, "\x03\xc9\x03\x14\x03\x00\x03\x45\0" },
- { 0x1fa4, "\x03\xc9\x03\x13\x03\x01\x03\x45\0" },
- { 0x1fa5, "\x03\xc9\x03\x14\x03\x01\x03\x45\0" },
- { 0x1fa6, "\x03\xc9\x03\x13\x03\x42\x03\x45\0" },
- { 0x1fa7, "\x03\xc9\x03\x14\x03\x42\x03\x45\0" },
- { 0x1fa8, "\x03\xa9\x03\x13\x03\x45\0" },
- { 0x1fa9, "\x03\xa9\x03\x14\x03\x45\0" },
- { 0x1faa, "\x03\xa9\x03\x13\x03\x00\x03\x45\0" },
- { 0x1fab, "\x03\xa9\x03\x14\x03\x00\x03\x45\0" },
- { 0x1fac, "\x03\xa9\x03\x13\x03\x01\x03\x45\0" },
- { 0x1fad, "\x03\xa9\x03\x14\x03\x01\x03\x45\0" },
- { 0x1fae, "\x03\xa9\x03\x13\x03\x42\x03\x45\0" },
- { 0x1faf, "\x03\xa9\x03\x14\x03\x42\x03\x45\0" },
- { 0x1fb0, "\x03\xb1\x03\x06\0" },
- { 0x1fb1, "\x03\xb1\x03\x04\0" },
- { 0x1fb2, "\x03\xb1\x03\x00\x03\x45\0" },
- { 0x1fb3, "\x03\xb1\x03\x45\0" },
- { 0x1fb4, "\x03\xb1\x03\x01\x03\x45\0" },
- { 0x1fb6, "\x03\xb1\x03\x42\0" },
- { 0x1fb7, "\x03\xb1\x03\x42\x03\x45\0" },
- { 0x1fb8, "\x03\x91\x03\x06\0" },
- { 0x1fb9, "\x03\x91\x03\x04\0" },
- { 0x1fba, "\x03\x91\x03\x00\0" },
- { 0x1fbb, "\x03\x91\x03\x01\0" },
- { 0x1fbc, "\x03\x91\x03\x45\0" },
- { 0x1fbe, "\x03\xb9\0" },
- { 0x1fc1, "\x00\xa8\x03\x42\0" },
- { 0x1fc2, "\x03\xb7\x03\x00\x03\x45\0" },
- { 0x1fc3, "\x03\xb7\x03\x45\0" },
- { 0x1fc4, "\x03\xb7\x03\x01\x03\x45\0" },
- { 0x1fc6, "\x03\xb7\x03\x42\0" },
- { 0x1fc7, "\x03\xb7\x03\x42\x03\x45\0" },
- { 0x1fc8, "\x03\x95\x03\x00\0" },
- { 0x1fc9, "\x03\x95\x03\x01\0" },
- { 0x1fca, "\x03\x97\x03\x00\0" },
- { 0x1fcb, "\x03\x97\x03\x01\0" },
- { 0x1fcc, "\x03\x97\x03\x45\0" },
- { 0x1fcd, "\x1f\xbf\x03\x00\0" },
- { 0x1fce, "\x1f\xbf\x03\x01\0" },
- { 0x1fcf, "\x1f\xbf\x03\x42\0" },
- { 0x1fd0, "\x03\xb9\x03\x06\0" },
- { 0x1fd1, "\x03\xb9\x03\x04\0" },
- { 0x1fd2, "\x03\xb9\x03\x08\x03\x00\0" },
- { 0x1fd3, "\x03\xb9\x03\x08\x03\x01\0" },
- { 0x1fd6, "\x03\xb9\x03\x42\0" },
- { 0x1fd7, "\x03\xb9\x03\x08\x03\x42\0" },
- { 0x1fd8, "\x03\x99\x03\x06\0" },
- { 0x1fd9, "\x03\x99\x03\x04\0" },
- { 0x1fda, "\x03\x99\x03\x00\0" },
- { 0x1fdb, "\x03\x99\x03\x01\0" },
- { 0x1fdd, "\x1f\xfe\x03\x00\0" },
- { 0x1fde, "\x1f\xfe\x03\x01\0" },
- { 0x1fdf, "\x1f\xfe\x03\x42\0" },
- { 0x1fe0, "\x03\xc5\x03\x06\0" },
- { 0x1fe1, "\x03\xc5\x03\x04\0" },
- { 0x1fe2, "\x03\xc5\x03\x08\x03\x00\0" },
- { 0x1fe3, "\x03\xc5\x03\x08\x03\x01\0" },
- { 0x1fe4, "\x03\xc1\x03\x13\0" },
- { 0x1fe5, "\x03\xc1\x03\x14\0" },
- { 0x1fe6, "\x03\xc5\x03\x42\0" },
- { 0x1fe7, "\x03\xc5\x03\x08\x03\x42\0" },
- { 0x1fe8, "\x03\xa5\x03\x06\0" },
- { 0x1fe9, "\x03\xa5\x03\x04\0" },
- { 0x1fea, "\x03\xa5\x03\x00\0" },
- { 0x1feb, "\x03\xa5\x03\x01\0" },
- { 0x1fec, "\x03\xa1\x03\x14\0" },
- { 0x1fed, "\x00\xa8\x03\x00\0" },
- { 0x1fee, "\x00\xa8\x03\x01\0" },
- { 0x1fef, "\x00\x60\0" },
- { 0x1ff2, "\x03\xc9\x03\x00\x03\x45\0" },
- { 0x1ff3, "\x03\xc9\x03\x45\0" },
- { 0x1ff4, "\x03\xc9\x03\x01\x03\x45\0" },
- { 0x1ff6, "\x03\xc9\x03\x42\0" },
- { 0x1ff7, "\x03\xc9\x03\x42\x03\x45\0" },
- { 0x1ff8, "\x03\x9f\x03\x00\0" },
- { 0x1ff9, "\x03\x9f\x03\x01\0" },
- { 0x1ffa, "\x03\xa9\x03\x00\0" },
- { 0x1ffb, "\x03\xa9\x03\x01\0" },
- { 0x1ffc, "\x03\xa9\x03\x45\0" },
- { 0x1ffd, "\x00\xb4\0" },
- { 0x2000, "\x20\x02\0" },
- { 0x2001, "\x20\x03\0" },
- { 0x2126, "\x03\xa9\0" },
- { 0x212a, "\x00\x4b\0" },
- { 0x212b, "\x00\x41\x03\x0a\0" },
- { 0x2204, "\x22\x03\x03\x38\0" },
- { 0x2209, "\x22\x08\x03\x38\0" },
- { 0x220c, "\x22\x0b\x03\x38\0" },
- { 0x2224, "\x22\x23\x03\x38\0" },
- { 0x2226, "\x22\x25\x03\x38\0" },
- { 0x2241, "\x00\x7e\x03\x38\0" },
- { 0x2244, "\x22\x43\x03\x38\0" },
- { 0x2247, "\x22\x45\x03\x38\0" },
- { 0x2249, "\x22\x48\x03\x38\0" },
- { 0x2260, "\x00\x3d\x03\x38\0" },
- { 0x2262, "\x22\x61\x03\x38\0" },
- { 0x226d, "\x22\x4d\x03\x38\0" },
- { 0x226e, "\x00\x3c\x03\x38\0" },
- { 0x226f, "\x00\x3e\x03\x38\0" },
- { 0x2270, "\x22\x64\x03\x38\0" },
- { 0x2271, "\x22\x65\x03\x38\0" },
- { 0x2274, "\x22\x72\x03\x38\0" },
- { 0x2275, "\x22\x73\x03\x38\0" },
- { 0x2278, "\x22\x76\x03\x38\0" },
- { 0x2279, "\x22\x77\x03\x38\0" },
- { 0x2280, "\x22\x7a\x03\x38\0" },
- { 0x2281, "\x22\x7b\x03\x38\0" },
- { 0x2284, "\x22\x82\x03\x38\0" },
- { 0x2285, "\x22\x83\x03\x38\0" },
- { 0x2288, "\x22\x86\x03\x38\0" },
- { 0x2289, "\x22\x87\x03\x38\0" },
- { 0x22ac, "\x22\xa2\x03\x38\0" },
- { 0x22ad, "\x22\xa8\x03\x38\0" },
- { 0x22ae, "\x22\xa9\x03\x38\0" },
- { 0x22af, "\x22\xab\x03\x38\0" },
- { 0x22e0, "\x22\x7c\x03\x38\0" },
- { 0x22e1, "\x22\x7d\x03\x38\0" },
- { 0x22e2, "\x22\x91\x03\x38\0" },
- { 0x22e3, "\x22\x92\x03\x38\0" },
- { 0x22ea, "\x22\xb2\x03\x38\0" },
- { 0x22eb, "\x22\xb3\x03\x38\0" },
- { 0x22ec, "\x22\xb4\x03\x38\0" },
- { 0x22ed, "\x22\xb5\x03\x38\0" },
- { 0x2329, "\x30\x08\0" },
- { 0x232a, "\x30\x09\0" },
- { 0x304c, "\x30\x4b\x30\x99\0" },
- { 0x304e, "\x30\x4d\x30\x99\0" },
- { 0x3050, "\x30\x4f\x30\x99\0" },
- { 0x3052, "\x30\x51\x30\x99\0" },
- { 0x3054, "\x30\x53\x30\x99\0" },
- { 0x3056, "\x30\x55\x30\x99\0" },
- { 0x3058, "\x30\x57\x30\x99\0" },
- { 0x305a, "\x30\x59\x30\x99\0" },
- { 0x305c, "\x30\x5b\x30\x99\0" },
- { 0x305e, "\x30\x5d\x30\x99\0" },
- { 0x3060, "\x30\x5f\x30\x99\0" },
- { 0x3062, "\x30\x61\x30\x99\0" },
- { 0x3065, "\x30\x64\x30\x99\0" },
- { 0x3067, "\x30\x66\x30\x99\0" },
- { 0x3069, "\x30\x68\x30\x99\0" },
- { 0x3070, "\x30\x6f\x30\x99\0" },
- { 0x3071, "\x30\x6f\x30\x9a\0" },
- { 0x3073, "\x30\x72\x30\x99\0" },
- { 0x3074, "\x30\x72\x30\x9a\0" },
- { 0x3076, "\x30\x75\x30\x99\0" },
- { 0x3077, "\x30\x75\x30\x9a\0" },
- { 0x3079, "\x30\x78\x30\x99\0" },
- { 0x307a, "\x30\x78\x30\x9a\0" },
- { 0x307c, "\x30\x7b\x30\x99\0" },
- { 0x307d, "\x30\x7b\x30\x9a\0" },
- { 0x3094, "\x30\x46\x30\x99\0" },
- { 0x309e, "\x30\x9d\x30\x99\0" },
- { 0x30ac, "\x30\xab\x30\x99\0" },
- { 0x30ae, "\x30\xad\x30\x99\0" },
- { 0x30b0, "\x30\xaf\x30\x99\0" },
- { 0x30b2, "\x30\xb1\x30\x99\0" },
- { 0x30b4, "\x30\xb3\x30\x99\0" },
- { 0x30b6, "\x30\xb5\x30\x99\0" },
- { 0x30b8, "\x30\xb7\x30\x99\0" },
- { 0x30ba, "\x30\xb9\x30\x99\0" },
- { 0x30bc, "\x30\xbb\x30\x99\0" },
- { 0x30be, "\x30\xbd\x30\x99\0" },
- { 0x30c0, "\x30\xbf\x30\x99\0" },
- { 0x30c2, "\x30\xc1\x30\x99\0" },
- { 0x30c5, "\x30\xc4\x30\x99\0" },
- { 0x30c7, "\x30\xc6\x30\x99\0" },
- { 0x30c9, "\x30\xc8\x30\x99\0" },
- { 0x30d0, "\x30\xcf\x30\x99\0" },
- { 0x30d1, "\x30\xcf\x30\x9a\0" },
- { 0x30d3, "\x30\xd2\x30\x99\0" },
- { 0x30d4, "\x30\xd2\x30\x9a\0" },
- { 0x30d6, "\x30\xd5\x30\x99\0" },
- { 0x30d7, "\x30\xd5\x30\x9a\0" },
- { 0x30d9, "\x30\xd8\x30\x99\0" },
- { 0x30da, "\x30\xd8\x30\x9a\0" },
- { 0x30dc, "\x30\xdb\x30\x99\0" },
- { 0x30dd, "\x30\xdb\x30\x9a\0" },
- { 0x30f4, "\x30\xa6\x30\x99\0" },
- { 0x30f7, "\x30\xef\x30\x99\0" },
- { 0x30f8, "\x30\xf0\x30\x99\0" },
- { 0x30f9, "\x30\xf1\x30\x99\0" },
- { 0x30fa, "\x30\xf2\x30\x99\0" },
- { 0x30fe, "\x30\xfd\x30\x99\0" },
- { 0xf900, "\x8c\x48\0" },
- { 0xf901, "\x66\xf4\0" },
- { 0xf902, "\x8e\xca\0" },
- { 0xf903, "\x8c\xc8\0" },
- { 0xf904, "\x6e\xd1\0" },
- { 0xf905, "\x4e\x32\0" },
- { 0xf906, "\x53\xe5\0" },
- { 0xf907, "\x9f\x9c\0" },
- { 0xf908, "\x9f\x9c\0" },
- { 0xf909, "\x59\x51\0" },
- { 0xf90a, "\x91\xd1\0" },
- { 0xf90b, "\x55\x87\0" },
- { 0xf90c, "\x59\x48\0" },
- { 0xf90d, "\x61\xf6\0" },
- { 0xf90e, "\x76\x69\0" },
- { 0xf90f, "\x7f\x85\0" },
- { 0xf910, "\x86\x3f\0" },
- { 0xf911, "\x87\xba\0" },
- { 0xf912, "\x88\xf8\0" },
- { 0xf913, "\x90\x8f\0" },
- { 0xf914, "\x6a\x02\0" },
- { 0xf915, "\x6d\x1b\0" },
- { 0xf916, "\x70\xd9\0" },
- { 0xf917, "\x73\xde\0" },
- { 0xf918, "\x84\x3d\0" },
- { 0xf919, "\x91\x6a\0" },
- { 0xf91a, "\x99\xf1\0" },
- { 0xf91b, "\x4e\x82\0" },
- { 0xf91c, "\x53\x75\0" },
- { 0xf91d, "\x6b\x04\0" },
- { 0xf91e, "\x72\x1b\0" },
- { 0xf91f, "\x86\x2d\0" },
- { 0xf920, "\x9e\x1e\0" },
- { 0xf921, "\x5d\x50\0" },
- { 0xf922, "\x6f\xeb\0" },
- { 0xf923, "\x85\xcd\0" },
- { 0xf924, "\x89\x64\0" },
- { 0xf925, "\x62\xc9\0" },
- { 0xf926, "\x81\xd8\0" },
- { 0xf927, "\x88\x1f\0" },
- { 0xf928, "\x5e\xca\0" },
- { 0xf929, "\x67\x17\0" },
- { 0xf92a, "\x6d\x6a\0" },
- { 0xf92b, "\x72\xfc\0" },
- { 0xf92c, "\x90\xce\0" },
- { 0xf92d, "\x4f\x86\0" },
- { 0xf92e, "\x51\xb7\0" },
- { 0xf92f, "\x52\xde\0" },
- { 0xf930, "\x64\xc4\0" },
- { 0xf931, "\x6a\xd3\0" },
- { 0xf932, "\x72\x10\0" },
- { 0xf933, "\x76\xe7\0" },
- { 0xf934, "\x80\x01\0" },
- { 0xf935, "\x86\x06\0" },
- { 0xf936, "\x86\x5c\0" },
- { 0xf937, "\x8d\xef\0" },
- { 0xf938, "\x97\x32\0" },
- { 0xf939, "\x9b\x6f\0" },
- { 0xf93a, "\x9d\xfa\0" },
- { 0xf93b, "\x78\x8c\0" },
- { 0xf93c, "\x79\x7f\0" },
- { 0xf93d, "\x7d\xa0\0" },
- { 0xf93e, "\x83\xc9\0" },
- { 0xf93f, "\x93\x04\0" },
- { 0xf940, "\x9e\x7f\0" },
- { 0xf941, "\x8a\xd6\0" },
- { 0xf942, "\x58\xdf\0" },
- { 0xf943, "\x5f\x04\0" },
- { 0xf944, "\x7c\x60\0" },
- { 0xf945, "\x80\x7e\0" },
- { 0xf946, "\x72\x62\0" },
- { 0xf947, "\x78\xca\0" },
- { 0xf948, "\x8c\xc2\0" },
- { 0xf949, "\x96\xf7\0" },
- { 0xf94a, "\x58\xd8\0" },
- { 0xf94b, "\x5c\x62\0" },
- { 0xf94c, "\x6a\x13\0" },
- { 0xf94d, "\x6d\xda\0" },
- { 0xf94e, "\x6f\x0f\0" },
- { 0xf94f, "\x7d\x2f\0" },
- { 0xf950, "\x7e\x37\0" },
- { 0xf951, "\x96\xfb\0" },
- { 0xf952, "\x52\xd2\0" },
- { 0xf953, "\x80\x8b\0" },
- { 0xf954, "\x51\xdc\0" },
- { 0xf955, "\x51\xcc\0" },
- { 0xf956, "\x7a\x1c\0" },
- { 0xf957, "\x7d\xbe\0" },
- { 0xf958, "\x83\xf1\0" },
- { 0xf959, "\x96\x75\0" },
- { 0xf95a, "\x8b\x80\0" },
- { 0xf95b, "\x62\xcf\0" },
- { 0xf95c, "\x6a\x02\0" },
- { 0xf95d, "\x8a\xfe\0" },
- { 0xf95e, "\x4e\x39\0" },
- { 0xf95f, "\x5b\xe7\0" },
- { 0xf960, "\x60\x12\0" },
- { 0xf961, "\x73\x87\0" },
- { 0xf962, "\x75\x70\0" },
- { 0xf963, "\x53\x17\0" },
- { 0xf964, "\x78\xfb\0" },
- { 0xf965, "\x4f\xbf\0" },
- { 0xf966, "\x5f\xa9\0" },
- { 0xf967, "\x4e\x0d\0" },
- { 0xf968, "\x6c\xcc\0" },
- { 0xf969, "\x65\x78\0" },
- { 0xf96a, "\x7d\x22\0" },
- { 0xf96b, "\x53\xc3\0" },
- { 0xf96c, "\x58\x5e\0" },
- { 0xf96d, "\x77\x01\0" },
- { 0xf96e, "\x84\x49\0" },
- { 0xf96f, "\x8a\xaa\0" },
- { 0xf970, "\x6b\xba\0" },
- { 0xf971, "\x8f\xb0\0" },
- { 0xf972, "\x6c\x88\0" },
- { 0xf973, "\x62\xfe\0" },
- { 0xf974, "\x82\xe5\0" },
- { 0xf975, "\x63\xa0\0" },
- { 0xf976, "\x75\x65\0" },
- { 0xf977, "\x4e\xae\0" },
- { 0xf978, "\x51\x69\0" },
- { 0xf979, "\x51\xc9\0" },
- { 0xf97a, "\x68\x81\0" },
- { 0xf97b, "\x7c\xe7\0" },
- { 0xf97c, "\x82\x6f\0" },
- { 0xf97d, "\x8a\xd2\0" },
- { 0xf97e, "\x91\xcf\0" },
- { 0xf97f, "\x52\xf5\0" },
- { 0xf980, "\x54\x42\0" },
- { 0xf981, "\x59\x73\0" },
- { 0xf982, "\x5e\xec\0" },
- { 0xf983, "\x65\xc5\0" },
- { 0xf984, "\x6f\xfe\0" },
- { 0xf985, "\x79\x2a\0" },
- { 0xf986, "\x95\xad\0" },
- { 0xf987, "\x9a\x6a\0" },
- { 0xf988, "\x9e\x97\0" },
- { 0xf989, "\x9e\xce\0" },
- { 0xf98a, "\x52\x9b\0" },
- { 0xf98b, "\x66\xc6\0" },
- { 0xf98c, "\x6b\x77\0" },
- { 0xf98d, "\x8f\x62\0" },
- { 0xf98e, "\x5e\x74\0" },
- { 0xf98f, "\x61\x90\0" },
- { 0xf990, "\x62\x00\0" },
- { 0xf991, "\x64\x9a\0" },
- { 0xf992, "\x6f\x23\0" },
- { 0xf993, "\x71\x49\0" },
- { 0xf994, "\x74\x89\0" },
- { 0xf995, "\x79\xca\0" },
- { 0xf996, "\x7d\xf4\0" },
- { 0xf997, "\x80\x6f\0" },
- { 0xf998, "\x8f\x26\0" },
- { 0xf999, "\x84\xee\0" },
- { 0xf99a, "\x90\x23\0" },
- { 0xf99b, "\x93\x4a\0" },
- { 0xf99c, "\x52\x17\0" },
- { 0xf99d, "\x52\xa3\0" },
- { 0xf99e, "\x54\xbd\0" },
- { 0xf99f, "\x70\xc8\0" },
- { 0xf9a0, "\x88\xc2\0" },
- { 0xf9a1, "\x8a\xaa\0" },
- { 0xf9a2, "\x5e\xc9\0" },
- { 0xf9a3, "\x5f\xf5\0" },
- { 0xf9a4, "\x63\x7b\0" },
- { 0xf9a5, "\x6b\xae\0" },
- { 0xf9a6, "\x7c\x3e\0" },
- { 0xf9a7, "\x73\x75\0" },
- { 0xf9a8, "\x4e\xe4\0" },
- { 0xf9a9, "\x56\xf9\0" },
- { 0xf9aa, "\x5b\xe7\0" },
- { 0xf9ab, "\x5d\xba\0" },
- { 0xf9ac, "\x60\x1c\0" },
- { 0xf9ad, "\x73\xb2\0" },
- { 0xf9ae, "\x74\x69\0" },
- { 0xf9af, "\x7f\x9a\0" },
- { 0xf9b0, "\x80\x46\0" },
- { 0xf9b1, "\x92\x34\0" },
- { 0xf9b2, "\x96\xf6\0" },
- { 0xf9b3, "\x97\x48\0" },
- { 0xf9b4, "\x98\x18\0" },
- { 0xf9b5, "\x4f\x8b\0" },
- { 0xf9b6, "\x79\xae\0" },
- { 0xf9b7, "\x91\xb4\0" },
- { 0xf9b8, "\x96\xb8\0" },
- { 0xf9b9, "\x60\xe1\0" },
- { 0xf9ba, "\x4e\x86\0" },
- { 0xf9bb, "\x50\xda\0" },
- { 0xf9bc, "\x5b\xee\0" },
- { 0xf9bd, "\x5c\x3f\0" },
- { 0xf9be, "\x65\x99\0" },
- { 0xf9bf, "\x6a\x02\0" },
- { 0xf9c0, "\x71\xce\0" },
- { 0xf9c1, "\x76\x42\0" },
- { 0xf9c2, "\x84\xfc\0" },
- { 0xf9c3, "\x90\x7c\0" },
- { 0xf9c4, "\x9f\x8d\0" },
- { 0xf9c5, "\x66\x88\0" },
- { 0xf9c6, "\x96\x2e\0" },
- { 0xf9c7, "\x52\x89\0" },
- { 0xf9c8, "\x67\x7b\0" },
- { 0xf9c9, "\x67\xf3\0" },
- { 0xf9ca, "\x6d\x41\0" },
- { 0xf9cb, "\x6e\x9c\0" },
- { 0xf9cc, "\x74\x09\0" },
- { 0xf9cd, "\x75\x59\0" },
- { 0xf9ce, "\x78\x6b\0" },
- { 0xf9cf, "\x7d\x10\0" },
- { 0xf9d0, "\x98\x5e\0" },
- { 0xf9d1, "\x51\x6d\0" },
- { 0xf9d2, "\x62\x2e\0" },
- { 0xf9d3, "\x96\x78\0" },
- { 0xf9d4, "\x50\x2b\0" },
- { 0xf9d5, "\x5d\x19\0" },
- { 0xf9d6, "\x6d\xea\0" },
- { 0xf9d7, "\x8f\x2a\0" },
- { 0xf9d8, "\x5f\x8b\0" },
- { 0xf9d9, "\x61\x44\0" },
- { 0xf9da, "\x68\x17\0" },
- { 0xf9db, "\x73\x87\0" },
- { 0xf9dc, "\x96\x86\0" },
- { 0xf9dd, "\x52\x29\0" },
- { 0xf9de, "\x54\x0f\0" },
- { 0xf9df, "\x5c\x65\0" },
- { 0xf9e0, "\x66\x13\0" },
- { 0xf9e1, "\x67\x4e\0" },
- { 0xf9e2, "\x68\xa8\0" },
- { 0xf9e3, "\x6c\xe5\0" },
- { 0xf9e4, "\x74\x06\0" },
- { 0xf9e5, "\x75\xe2\0" },
- { 0xf9e6, "\x7f\x79\0" },
- { 0xf9e7, "\x88\xcf\0" },
- { 0xf9e8, "\x88\xe1\0" },
- { 0xf9e9, "\x91\xcc\0" },
- { 0xf9ea, "\x96\xe2\0" },
- { 0xf9eb, "\x53\x3f\0" },
- { 0xf9ec, "\x6e\xba\0" },
- { 0xf9ed, "\x54\x1d\0" },
- { 0xf9ee, "\x71\xd0\0" },
- { 0xf9ef, "\x74\x98\0" },
- { 0xf9f0, "\x85\xfa\0" },
- { 0xf9f1, "\x96\xa3\0" },
- { 0xf9f2, "\x9c\x57\0" },
- { 0xf9f3, "\x9e\x9f\0" },
- { 0xf9f4, "\x67\x97\0" },
- { 0xf9f5, "\x6d\xcb\0" },
- { 0xf9f6, "\x81\xe8\0" },
- { 0xf9f7, "\x7a\xcb\0" },
- { 0xf9f8, "\x7b\x20\0" },
- { 0xf9f9, "\x7c\x92\0" },
- { 0xf9fa, "\x72\xc0\0" },
- { 0xf9fb, "\x70\x99\0" },
- { 0xf9fc, "\x8b\x58\0" },
- { 0xf9fd, "\x4e\xc0\0" },
- { 0xf9fe, "\x83\x36\0" },
- { 0xf9ff, "\x52\x3a\0" },
- { 0xfa00, "\x52\x07\0" },
- { 0xfa01, "\x5e\xa6\0" },
- { 0xfa02, "\x62\xd3\0" },
- { 0xfa03, "\x7c\xd6\0" },
- { 0xfa04, "\x5b\x85\0" },
- { 0xfa05, "\x6d\x1e\0" },
- { 0xfa06, "\x66\xb4\0" },
- { 0xfa07, "\x8f\x3b\0" },
- { 0xfa08, "\x88\x4c\0" },
- { 0xfa09, "\x96\x4d\0" },
- { 0xfa0a, "\x89\x8b\0" },
- { 0xfa0b, "\x5e\xd3\0" },
- { 0xfa0c, "\x51\x40\0" },
- { 0xfa0d, "\x55\xc0\0" },
- { 0xfa10, "\x58\x5a\0" },
- { 0xfa12, "\x66\x74\0" },
- { 0xfa15, "\x51\xde\0" },
- { 0xfa16, "\x73\x2a\0" },
- { 0xfa17, "\x76\xca\0" },
- { 0xfa18, "\x79\x3c\0" },
- { 0xfa19, "\x79\x5e\0" },
- { 0xfa1a, "\x79\x65\0" },
- { 0xfa1b, "\x79\x8f\0" },
- { 0xfa1c, "\x97\x56\0" },
- { 0xfa1d, "\x7c\xbe\0" },
- { 0xfa1e, "\x7f\xbd\0" },
- { 0xfa20, "\x86\x12\0" },
- { 0xfa22, "\x8a\xf8\0" },
- { 0xfa25, "\x90\x38\0" },
- { 0xfa26, "\x90\xfd\0" },
- { 0xfa2a, "\x98\xef\0" },
- { 0xfa2b, "\x98\xfc\0" },
- { 0xfa2c, "\x99\x28\0" },
- { 0xfa2d, "\x9d\xb4\0" },
- { 0xfb1f, "\x05\xf2\x05\xb7\0" },
- { 0xfb2a, "\x05\xe9\x05\xc1\0" },
- { 0xfb2b, "\x05\xe9\x05\xc2\0" },
- { 0xfb2c, "\x05\xe9\x05\xbc\x05\xc1\0" },
- { 0xfb2d, "\x05\xe9\x05\xbc\x05\xc2\0" },
- { 0xfb2e, "\x05\xd0\x05\xb7\0" },
- { 0xfb2f, "\x05\xd0\x05\xb8\0" },
- { 0xfb30, "\x05\xd0\x05\xbc\0" },
- { 0xfb31, "\x05\xd1\x05\xbc\0" },
- { 0xfb32, "\x05\xd2\x05\xbc\0" },
- { 0xfb33, "\x05\xd3\x05\xbc\0" },
- { 0xfb34, "\x05\xd4\x05\xbc\0" },
- { 0xfb35, "\x05\xd5\x05\xbc\0" },
- { 0xfb36, "\x05\xd6\x05\xbc\0" },
- { 0xfb38, "\x05\xd8\x05\xbc\0" },
- { 0xfb39, "\x05\xd9\x05\xbc\0" },
- { 0xfb3a, "\x05\xda\x05\xbc\0" },
- { 0xfb3b, "\x05\xdb\x05\xbc\0" },
- { 0xfb3c, "\x05\xdc\x05\xbc\0" },
- { 0xfb3e, "\x05\xde\x05\xbc\0" },
- { 0xfb40, "\x05\xe0\x05\xbc\0" },
- { 0xfb41, "\x05\xe1\x05\xbc\0" },
- { 0xfb43, "\x05\xe3\x05\xbc\0" },
- { 0xfb44, "\x05\xe4\x05\xbc\0" },
- { 0xfb46, "\x05\xe6\x05\xbc\0" },
- { 0xfb47, "\x05\xe7\x05\xbc\0" },
- { 0xfb48, "\x05\xe8\x05\xbc\0" },
- { 0xfb49, "\x05\xe9\x05\xbc\0" },
- { 0xfb4a, "\x05\xea\x05\xbc\0" },
- { 0xfb4b, "\x05\xd5\x05\xb9\0" },
- { 0xfb4c, "\x05\xd1\x05\xbf\0" },
- { 0xfb4d, "\x05\xdb\x05\xbf\0" },
- { 0xfb4e, "\x05\xe4\x05\xbf\0" }
-};
-
-/*
- * WARNING!
- *
- * NO BUFFER CHECKING AHEAD!
- *
- */
-
-static gint
-e_canonical_decomposition (gunichar ch, gunichar * buf)
-{
- gint len = 0;
-
- if (ch <= 0xffff)
- {
- int start = 0;
- int end = sizeof (e_decomp_table) / sizeof (e_decomp_table[0]);
- while (start != end)
- {
- int half = (start + end) / 2;
- if (ch == e_decomp_table[half].ch) {
- /* Found it. */
- int i;
- /* We store as a double-nul terminated string. */
- for (len = 0; (e_decomp_table[half].expansion[len] || e_decomp_table[half].expansion[len + 1]); len += 2) ;
-
- /* We've counted twice as many bytes as there are
- characters. */
- len /= 2;
-
- for (i = 0; i < len; i ++) {
- buf[i] = (e_decomp_table[half].expansion[2 * i] << 8) | e_decomp_table[half].expansion[2 * i + 1];
- }
- break;
- } else if (ch > e_decomp_table[half].ch) {
- if (start == half) break;
- start = half;
- } else {
- if (end == half) break;
- end = half;
- }
- }
- }
-
- if (len == 0)
- {
- /* Not in our table. */
- *buf = ch;
- len = 1;
- }
-
- /* Supposedly following the Unicode 2.1.9 table means that the
- decompositions come out in canonical order. I haven't tested
- this, but we rely on it here. */
- return len;
-}
-
-static gunichar
-e_stripped_char (gunichar ch)
-{
- gunichar decomp[MAX_DECOMP];
- GUnicodeType utype;
- gint dlen;
-
- utype = g_unichar_type (ch);
-
- switch (utype) {
- case G_UNICODE_CONTROL:
- case G_UNICODE_FORMAT:
- case G_UNICODE_UNASSIGNED:
- case G_UNICODE_COMBINING_MARK:
- /* Ignore those */
- return 0;
- break;
- default:
- /* Convert to lowercase, fall through */
- ch = g_unichar_tolower (ch);
- case G_UNICODE_LOWERCASE_LETTER:
- dlen = e_canonical_decomposition (ch, decomp);
- if (dlen > 0) return *decomp;
- break;
- }
-
- return 0;
-}
-
-gchar *
-e_xml_get_translated_utf8_string_prop_by_name (const xmlNode *parent, const xmlChar *prop_name)
-{
- xmlChar *prop;
- gchar *ret_val = NULL;
- gchar *combined_name;
-
- g_return_val_if_fail (parent != NULL, 0);
- g_return_val_if_fail (prop_name != NULL, 0);
-
- prop = xmlGetProp ((xmlNode *) parent, prop_name);
- if (prop != NULL) {
- ret_val = g_strdup (prop);
- xmlFree (prop);
- return ret_val;
- }
-
- combined_name = g_strdup_printf("_%s", prop_name);
- prop = xmlGetProp ((xmlNode *) parent, combined_name);
- if (prop != NULL) {
- ret_val = e_utf8_from_locale_string (gettext (prop));
- xmlFree (prop);
- }
- g_free(combined_name);
-
- return ret_val;
-}
diff --git a/widgets/misc/e-unicode.h b/widgets/misc/e-unicode.h
deleted file mode 100644
index 0782407e89..0000000000
--- a/widgets/misc/e-unicode.h
+++ /dev/null
@@ -1,135 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-unicode.h - utf-8 support functions for gal
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Lauris Kaplinski <lauris@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_UNICODE_H_
-#define _E_UNICODE_H_
-
-#include <sys/types.h>
-#include <glib.h>
-#include <gtk/gtkclist.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtkmenu.h>
-#include <gtk/gtkwidget.h>
-#include <libgnome/gnome-defs.h>
-#include <gnome-xml/tree.h>
-#include <gal/unicode/gunicode.h>
-#include <iconv.h>
-
-BEGIN_GNOME_DECLS
-
-#define G_UTF8_IN_GAL
-
-/*
- * UTF-8 searching implementations
- *
- * e_utf8_strstrcase - case insensitive search
- * e_utf8_strstrcasedecomp - case insensitive and decompositing search (i.e. accented
- * letters are treated equal to their base letters, explicit accent marks (unicode
- * not ascii/iso ones) are ignored).
- */
-
-const gchar *e_utf8_strstrcase (const gchar *haystack,
- const gchar *needle);
-const gchar *e_utf8_strstrcasedecomp (const gchar *haystack,
- const gchar *needle);
-gchar *e_utf8_from_gtk_event_key (GtkWidget *widget,
- guint keyval,
- const gchar *string);
-gchar *e_utf8_from_iconv_string (iconv_t ic,
- const gchar *string);
-gchar *e_utf8_from_iconv_string_sized (iconv_t ic,
- const gchar *string,
- gint bytes);
-gchar *e_utf8_to_iconv_string (iconv_t ic,
- const gchar *string);
-gchar *e_utf8_to_iconv_string_sized (iconv_t ic,
- const gchar *string,
- gint bytes);
-gchar *e_utf8_from_charset_string (const gchar *charset,
- const gchar *string);
-gchar *e_utf8_from_charset_string_sized (const gchar *charset,
- const gchar *string,
- gint bytes);
-gchar *e_utf8_to_charset_string (const gchar *charset,
- const gchar *string);
-gchar *e_utf8_to_charset_string_sized (const gchar *charset,
- const gchar *string,
- gint bytes);
-gchar *e_utf8_from_gtk_string (GtkWidget *widget,
- const gchar *string);
-gchar *e_utf8_from_gtk_string_sized (GtkWidget *widget,
- const gchar *string,
- gint bytes);
-gchar *e_utf8_to_gtk_string (GtkWidget *widget,
- const gchar *string);
-gchar *e_utf8_to_gtk_string_sized (GtkWidget *widget,
- const gchar *string,
- gint bytes);
-gchar *e_utf8_from_locale_string (const gchar *string);
-gchar *e_utf8_from_locale_string_sized (const gchar *string,
- gint bytes);
-gchar *e_utf8_to_locale_string (const gchar *string);
-gchar *e_utf8_to_locale_string_sized (const gchar *string,
- gint bytes);
-gboolean e_utf8_is_ascii (const gchar *string);
-/*
- * These are simple wrappers that save us some typing
- */
-
-/* NB! This return newly allocated string, not const as gtk+ one */
-gchar *e_utf8_gtk_entry_get_text (GtkEntry *entry);
-void e_utf8_gtk_entry_set_text (GtkEntry *entry,
- const gchar *text);
-gchar *e_utf8_gtk_editable_get_text (GtkEditable *editable);
-void e_utf8_gtk_editable_set_text (GtkEditable *editable,
- const gchar *text);
-gchar *e_utf8_gtk_editable_get_chars (GtkEditable *editable,
- gint start,
- gint end);
-void e_utf8_gtk_editable_insert_text (GtkEditable *editable,
- const gchar *text,
- gint length,
- gint *position);
-GtkWidget *e_utf8_gtk_menu_item_new_with_label (GtkMenu *menu,
- const gchar *label);
-void e_utf8_gtk_clist_set_text (GtkCList *clist,
- gint row,
- gint col,
- const gchar *text);
-gint e_utf8_gtk_clist_append (GtkCList *clist,
- gchar *text[]);
-gchar *e_utf8_xml1_decode (const gchar *text);
-gchar *e_utf8_xml1_encode (const gchar *text);
-gint e_unichar_to_utf8 (gint c,
- gchar *outbuf);
-gchar *e_unicode_get_utf8 (const gchar *text,
- gunichar *out);
-guint32 gdk_keyval_to_unicode (guint keysym);
-gchar *e_xml_get_translated_utf8_string_prop_by_name (const xmlNode *parent,
- const xmlChar *prop_name);
-
-END_GNOME_DECLS
-
-#endif
-
-
diff --git a/widgets/misc/gal-categories.glade b/widgets/misc/gal-categories.glade
deleted file mode 100644
index 42141d466d..0000000000
--- a/widgets/misc/gal-categories.glade
+++ /dev/null
@@ -1,197 +0,0 @@
-<?xml version="1.0"?>
-<GTK-Interface>
-
-<project>
- <name>categories</name>
- <program_name>categories</program_name>
- <directory></directory>
- <source_directory>src</source_directory>
- <pixmaps_directory>pixmaps</pixmaps_directory>
- <language>C</language>
- <gnome_support>True</gnome_support>
- <gettext_support>False</gettext_support>
- <output_main_file>False</output_main_file>
- <output_support_files>False</output_support_files>
- <output_build_files>False</output_build_files>
- <backup_source_files>False</backup_source_files>
- <output_translatable_strings>True</output_translatable_strings>
- <translatable_strings_file>gal-categories.glade.h</translatable_strings_file>
-</project>
-
-<widget>
- <class>GnomeDialog</class>
- <name>categories</name>
- <visible>False</visible>
- <title>categories</title>
- <type>GTK_WINDOW_TOPLEVEL</type>
- <position>GTK_WIN_POS_NONE</position>
- <modal>False</modal>
- <allow_shrink>False</allow_shrink>
- <allow_grow>True</allow_grow>
- <auto_shrink>False</auto_shrink>
- <auto_close>False</auto_close>
- <hide_on_close>False</hide_on_close>
-
- <widget>
- <class>GtkVBox</class>
- <child_name>GnomeDialog:vbox</child_name>
- <name>dialog-vbox1</name>
- <homogeneous>False</homogeneous>
- <spacing>8</spacing>
- <child>
- <padding>4</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkHButtonBox</class>
- <child_name>GnomeDialog:action_area</child_name>
- <name>dialog-action_area1</name>
- <layout_style>GTK_BUTTONBOX_END</layout_style>
- <spacing>8</spacing>
- <child_min_width>85</child_min_width>
- <child_min_height>27</child_min_height>
- <child_ipad_x>7</child_ipad_x>
- <child_ipad_y>0</child_ipad_y>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- <pack>GTK_PACK_END</pack>
- </child>
-
- <widget>
- <class>GtkButton</class>
- <name>button3</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button4</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
- </widget>
- </widget>
-
- <widget>
- <class>GtkTable</class>
- <name>table-categories</name>
- <rows>5</rows>
- <columns>1</columns>
- <homogeneous>False</homogeneous>
- <row_spacing>0</row_spacing>
- <column_spacing>0</column_spacing>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkEntry</class>
- <name>entry-categories</name>
- <can_focus>True</can_focus>
- <editable>True</editable>
- <text_visible>True</text_visible>
- <text_max_length>0</text_max_length>
- <text></text>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>1</top_attach>
- <bottom_attach>2</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label-header</name>
- <label>Item(s) belong to these _categories:</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <focus_target>entry-categories</focus_target>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label2</name>
- <label>_Available Categories:</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>2</top_attach>
- <bottom_attach>3</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button-ecmld</name>
- <can_focus>True</can_focus>
- <label>Edit Master Category List...</label>
- <relief>GTK_RELIEF_NORMAL</relief>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>4</top_attach>
- <bottom_attach>5</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
- </widget>
- </widget>
-</widget>
-
-</GTK-Interface>
diff --git a/widgets/misc/pixmaps/.cvsignore b/widgets/misc/pixmaps/.cvsignore
deleted file mode 100644
index 3dda72986f..0000000000
--- a/widgets/misc/pixmaps/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-Makefile.in
-Makefile
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/misc/test-color.c b/widgets/misc/test-color.c
deleted file mode 100644
index c61dc26889..0000000000
--- a/widgets/misc/test-color.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * test-color.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <gnome.h>
-#include "widget-color-combo.h"
-#include "color-palette.h"
-#include "e-colors.h"
-#include "pixmaps/cursor_hand_open.xpm"
-
-/* To compile (from src/widgets):
-
-gcc -I.. -I../.. -L. -Wall -o tester tester.c ../color.c `gnome-config --cflags --libs gnome gnomeui` -lwidgets
-
-*/
-
-gint
-main ( gint argc, gchar* argv[] )
-{
- GtkWidget * dialog;
- GtkWidget * T;
- ColorGroup *cg;
-
- gnome_init ("tester", "1.0", argc, argv);
-
- dialog = gnome_dialog_new ("TESTER", GNOME_STOCK_BUTTON_OK,
- GNOME_STOCK_BUTTON_CANCEL, NULL);
- cg = color_group_fetch ("fore_color_group", dialog);
- T = color_palette_new ("Color Palette", NULL, cg);
-
- gtk_box_pack_start(GTK_BOX (GNOME_DIALOG (dialog)-> vbox ),
- T, TRUE, TRUE, 5);
- gtk_widget_show_all (T);
-
- cg = color_group_fetch ("fore_color_group", dialog);
- T = color_combo_new (cursor_hand_open_xpm, _("Automatic"),
- &e_black, cg);
- gtk_box_pack_start(GTK_BOX (GNOME_DIALOG (dialog)-> vbox ),
- T, TRUE, TRUE, 5);
- gtk_widget_show_all (T);
-
- cg = color_group_fetch ("back_color_group", dialog);
- T = color_combo_new (cursor_hand_open_xpm, _("Automatic"),
- &e_black, cg);
- gtk_box_pack_start(GTK_BOX (GNOME_DIALOG (dialog)-> vbox ),
- T, TRUE, TRUE, 5);
- gtk_widget_show_all (T);
-
- gnome_dialog_run_and_close ( GNOME_DIALOG (dialog) );
- return 0;
-}
diff --git a/widgets/table/.cvsignore b/widgets/table/.cvsignore
deleted file mode 100644
index b1004fee2c..0000000000
--- a/widgets/table/.cvsignore
+++ /dev/null
@@ -1,13 +0,0 @@
-.deps
-.libs
-.pure
-Makefile
-Makefile.in
-*.lo
-*.la
-table-test
-table-example-1
-table-example-2
-table-size-test
-tree-example-1
-tree-example-2
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/arrow-down.xpm b/widgets/table/arrow-down.xpm
deleted file mode 100644
index f1e6cb4b3c..0000000000
--- a/widgets/table/arrow-down.xpm
+++ /dev/null
@@ -1,21 +0,0 @@
-/* XPM */
-static const char * arrow_down_xpm[] = {
-"13 16 2 1",
-" c None",
-". c #FF0000",
-" ... ",
-" ... ",
-" ... ",
-" ... ",
-" ... ",
-" ... ",
-" ... ",
-" ... ",
-" ... ",
-".............",
-" ........... ",
-" ......... ",
-" ....... ",
-" ..... ",
-" ... ",
-" . "};
diff --git a/widgets/table/arrow-up.xpm b/widgets/table/arrow-up.xpm
deleted file mode 100644
index 0cc5b9a00c..0000000000
--- a/widgets/table/arrow-up.xpm
+++ /dev/null
@@ -1,21 +0,0 @@
-/* XPM */
-static const char * arrow_up_xpm[] = {
-"13 16 2 1",
-" c None",
-". c #FF0000",
-" . ",
-" ... ",
-" ..... ",
-" ....... ",
-" ......... ",
-" ........... ",
-".............",
-" ... ",
-" ... ",
-" ... ",
-" ... ",
-" ... ",
-" ... ",
-" ... ",
-" ... ",
-" ... "};
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
--- a/widgets/table/clip.png
+++ /dev/null
Binary files differ
diff --git a/widgets/table/e-cell-checkbox.c b/widgets/table/e-cell-checkbox.c
deleted file mode 100644
index f00d63c2dc..0000000000
--- a/widgets/table/e-cell-checkbox.c
+++ /dev/null
@@ -1,67 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-cell-checkbox.c: Checkbox cell renderer
- * Copyright 1999, 2000, Ximian, Inc.
- *
- * Authors:
- * Miguel de Icaza <miguel@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-#include <config.h>
-#include <gtk/gtkenums.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtkwindow.h>
-#include <gtk/gtksignal.h>
-#include <gdk/gdkkeysyms.h>
-#include <libgnomeui/gnome-canvas.h>
-#include "e-cell-checkbox.h"
-#include "gal/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);
-
-/**
- * e_cell_checkbox_new:
- *
- * Creates a new ECell renderer that can be used to render check
- * boxes. the data provided from the model is cast to an integer.
- * zero is used for the off display, and non-zero for checked status.
- *
- * Returns: an ECell object that can be used to render checkboxes.
- */
-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 7d19b5f3c1..0000000000
--- a/widgets/table/e-cell-checkbox.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-cell-checkbox.h: Checkbox cell renderer
- * Copyright 1999, 2000, Ximian, Inc.
- *
- * Authors:
- * Miguel de Icaza <miguel@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-#ifndef _E_CELL_CHECKBOX_H_
-#define _E_CELL_CHECKBOX_H_
-
-#include <gal/e-table/e-cell-toggle.h>
-#include <libgnome/gnome-defs.h>
-
-BEGIN_GNOME_DECLS
-
-#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);
-
-END_GNOME_DECLS
-
-#endif /* _E_CELL_CHECKBOX_H_ */
-
diff --git a/widgets/table/e-cell-combo.c b/widgets/table/e-cell-combo.c
deleted file mode 100644
index 1844c5c81f..0000000000
--- a/widgets/table/e-cell-combo.c
+++ /dev/null
@@ -1,656 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-cell-combo.c: Combo cell renderer
- * Copyright 2001, Ximian, Inc.
- *
- * Authors:
- * Damon Chaplin <damon@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-/*
- * ECellCombo - a subclass of ECellPopup used to support popup lists like a
- * GtkCombo widget. It only supports a basic popup list of strings at present,
- * with no auto-completion.
- */
-
-/*
- * Notes: (handling pointer grabs and GTK+ grabs is a nightmare!)
- *
- * o We must grab the pointer when we show the popup, so that if any buttons
- * are pressed outside the application we hide the popup.
- *
- * o We have to be careful when popping up any widgets which also grab the
- * pointer at some point, since we will lose our own pointer grab.
- * When we pop up a list it will grab the pointer itself when an item is
- * selected, and release the grab when the button is released.
- * Fortunately we hide the popup at this point, so it isn't a problem.
- * But for other types of widgets in the popup it could cause trouble.
- * - I think GTK+ should provide help for this (nested pointer grabs?).
- *
- * o We must set the 'owner_events' flag of the pointer grab to TRUE so that
- * pointer events get reported to all the application windows as normal.
- * If we don't do this then the widgets in the popup may not work properly.
- *
- * o We must do a gtk_grab_add() so that we only allow events to go to the
- * widgets within the popup (though some special events still get reported
- * to the widget owning the window). Doing th gtk_grab_add() on the toplevel
- * popup window should be fine. We can then check for any events that should
- * close the popup, like the Escape key, or a button press outside the popup.
- */
-
-#include <config.h>
-#include <string.h> /* strcmp() */
-#include <gdk/gdkkeysyms.h>
-#include "gal/util/e-util.h"
-#include "gal/widgets/e-unicode.h"
-#include "e-table-item.h"
-#include "e-cell-combo.h"
-#include "e-cell-text.h"
-
-#define d(x)
-
-
-/* The height to make the popup list if there aren't any items in it. */
-#define E_CELL_COMBO_LIST_EMPTY_HEIGHT 15
-
-/* The object data key used to store the UTF-8 text of the popup list items. */
-#define E_CELL_COMBO_UTF8_KEY "UTF-8-TEXT"
-
-
-static void e_cell_combo_class_init (GtkObjectClass *object_class);
-static void e_cell_combo_init (ECellCombo *ecc);
-static void e_cell_combo_destroy (GtkObject *object);
-
-static gint e_cell_combo_do_popup (ECellPopup *ecp,
- GdkEvent *event,
- int row,
- int view_col);
-static void e_cell_combo_select_matching_item (ECellCombo *ecc);
-static void e_cell_combo_show_popup (ECellCombo *ecc,
- int row,
- int view_col);
-static void e_cell_combo_get_popup_pos (ECellCombo *ecc,
- int row,
- int view_col,
- gint *x,
- gint *y,
- gint *height,
- gint *width);
-
-static gint e_cell_combo_button_press (GtkWidget *popup_window,
- GdkEvent *event,
- ECellCombo *ecc);
-static gint e_cell_combo_button_release (GtkWidget *popup_window,
- GdkEventButton *event,
- ECellCombo *ecc);
-static int e_cell_combo_key_press (GtkWidget *popup_window,
- GdkEventKey *event,
- ECellCombo *ecc);
-
-static void e_cell_combo_update_cell (ECellCombo *ecc);
-static void e_cell_combo_restart_edit (ECellCombo *ecc);
-
-
-static ECellPopupClass *parent_class;
-
-
-E_MAKE_TYPE (e_cell_combo, "ECellCombo", ECellCombo,
- e_cell_combo_class_init, e_cell_combo_init,
- e_cell_popup_get_type());
-
-
-static void
-e_cell_combo_class_init (GtkObjectClass *object_class)
-{
- ECellPopupClass *ecpc = (ECellPopupClass *) object_class;
-
- object_class->destroy = e_cell_combo_destroy;
-
- ecpc->popup = e_cell_combo_do_popup;
-
- parent_class = gtk_type_class (e_cell_popup_get_type ());
-}
-
-
-static void
-e_cell_combo_init (ECellCombo *ecc)
-{
- GtkWidget *frame;
-
- /* We create one popup window for the ECell, since there will only
- ever be one popup in use at a time. */
- ecc->popup_window = gtk_window_new (GTK_WINDOW_POPUP);
-
- gtk_window_set_policy (GTK_WINDOW (ecc->popup_window),
- TRUE, TRUE, FALSE);
-
- frame = gtk_frame_new (NULL);
- gtk_container_add (GTK_CONTAINER (ecc->popup_window), frame);
- gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_OUT);
- gtk_widget_show (frame);
-
- ecc->popup_scrolled_window = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (ecc->popup_scrolled_window),
- GTK_POLICY_AUTOMATIC,
- GTK_POLICY_AUTOMATIC);
- GTK_WIDGET_UNSET_FLAGS (GTK_SCROLLED_WINDOW (ecc->popup_scrolled_window)->hscrollbar, GTK_CAN_FOCUS);
- GTK_WIDGET_UNSET_FLAGS (GTK_SCROLLED_WINDOW (ecc->popup_scrolled_window)->vscrollbar, GTK_CAN_FOCUS);
- gtk_container_add (GTK_CONTAINER (frame), ecc->popup_scrolled_window);
- gtk_widget_show (ecc->popup_scrolled_window);
-
- ecc->popup_list = gtk_list_new ();
- gtk_list_set_selection_mode (GTK_LIST (ecc->popup_list),
- GTK_SELECTION_BROWSE);
- gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (ecc->popup_scrolled_window), ecc->popup_list);
- gtk_container_set_focus_vadjustment (GTK_CONTAINER (ecc->popup_list),
- gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (ecc->popup_scrolled_window)));
- gtk_container_set_focus_hadjustment (GTK_CONTAINER (ecc->popup_list),
- gtk_scrolled_window_get_hadjustment (GTK_SCROLLED_WINDOW (ecc->popup_scrolled_window)));
- gtk_widget_show (ecc->popup_list);
-
- gtk_signal_connect (GTK_OBJECT (ecc->popup_window),
- "button_press_event",
- GTK_SIGNAL_FUNC (e_cell_combo_button_press),
- ecc);
- /* We use connect_after here so the list updates the selection before
- we hide the popup and update the cell. */
- gtk_signal_connect_after (GTK_OBJECT (ecc->popup_window),
- "button_release_event",
- GTK_SIGNAL_FUNC (e_cell_combo_button_release),
- ecc);
- gtk_signal_connect (GTK_OBJECT (ecc->popup_window),
- "key_press_event",
- GTK_SIGNAL_FUNC (e_cell_combo_key_press), ecc);
-}
-
-
-/**
- * e_cell_combo_new:
- *
- * Creates a new ECellCombo renderer.
- *
- * Returns: an ECellCombo object.
- */
-ECell *
-e_cell_combo_new (void)
-{
- ECellCombo *ecc = gtk_type_new (e_cell_combo_get_type ());
-
- return (ECell*) ecc;
-}
-
-
-/*
- * GtkObject::destroy method
- */
-static void
-e_cell_combo_destroy (GtkObject *object)
-{
- ECellCombo *ecc = E_CELL_COMBO (object);
-
- gtk_widget_destroy (ecc->popup_window);
- ecc->popup_window = NULL;
-
- GTK_OBJECT_CLASS (parent_class)->destroy (object);
-}
-
-
-
-void
-e_cell_combo_set_popdown_strings (ECellCombo *ecc,
- GList *strings)
-{
- GList *elem;
- GtkWidget *listitem;
-
- g_return_if_fail (E_IS_CELL_COMBO (ecc));
- g_return_if_fail (strings != NULL);
-
- gtk_list_clear_items (GTK_LIST (ecc->popup_list), 0, -1);
- elem = strings;
- while (elem) {
- char *utf8_text = elem->data;
-
- /* We store a copy of the UTF-8 text as data inside the
- listitem, but convert it to the current locale to go in
- the listitem widget. */
- char *locale_text = e_utf8_to_locale_string (utf8_text);
-
- listitem = gtk_list_item_new_with_label (locale_text);
- g_free (locale_text);
-
- gtk_widget_show (listitem);
- gtk_container_add (GTK_CONTAINER (ecc->popup_list), listitem);
-
- gtk_object_set_data_full (GTK_OBJECT (listitem),
- E_CELL_COMBO_UTF8_KEY,
- g_strdup (utf8_text), g_free);
-
- elem = elem->next;
- }
-}
-
-
-static gint
-e_cell_combo_do_popup (ECellPopup *ecp,
- GdkEvent *event,
- int row,
- int view_col)
-{
- ECellCombo *ecc = E_CELL_COMBO (ecp);
- guint32 time;
- gint error_code;
-
- e_cell_combo_show_popup (ecc, row, view_col);
- e_cell_combo_select_matching_item (ecc);
-
- if (event->type == GDK_BUTTON_PRESS) {
- GTK_LIST (ecc->popup_list)->drag_selection = TRUE;
- time = event->button.time;
- } else {
- time = event->key.time;
- }
-
- error_code = gdk_pointer_grab (ecc->popup_list->window, TRUE,
- GDK_ENTER_NOTIFY_MASK |
- GDK_BUTTON_PRESS_MASK |
- GDK_BUTTON_RELEASE_MASK |
- GDK_POINTER_MOTION_HINT_MASK |
- GDK_BUTTON1_MOTION_MASK,
- NULL, NULL, time);
- if (error_code != 0)
- g_warning ("Failed to get pointer grab (%i)", error_code);
- gtk_grab_add (ecc->popup_window);
-
- return TRUE;
-}
-
-
-static void
-e_cell_combo_select_matching_item (ECellCombo *ecc)
-{
- ECellPopup *ecp = E_CELL_POPUP (ecc);
- ECellView *ecv = (ECellView*) ecp->popup_cell_view;
- ECellText *ecell_text = E_CELL_TEXT (ecp->child);
- ETableItem *eti = E_TABLE_ITEM (ecp->popup_cell_view->cell_view.e_table_item_view);
- ETableCol *ecol;
- GtkList *list;
- GtkWidget *listitem;
- GList *elem;
- gboolean found = FALSE;
- char *cell_text, *list_item_text;
-
- ecol = e_table_header_get_column (eti->header, ecp->popup_view_col);
- cell_text = e_cell_text_get_text (ecell_text, ecv->e_table_model,
- ecol->col_idx, ecp->popup_row);
-
- list = GTK_LIST (ecc->popup_list);
- elem = list->children;
- while (elem) {
- listitem = GTK_WIDGET (elem->data);
-
- /* We need to compare against the UTF-8 text. */
- list_item_text = gtk_object_get_data (GTK_OBJECT (listitem),
- E_CELL_COMBO_UTF8_KEY);
-
- if (list_item_text && !strcmp (list_item_text, cell_text)) {
- found = TRUE;
- gtk_list_select_child (list, listitem);
- gtk_widget_grab_focus (listitem);
- break;
- }
-
- elem = elem->next;
- }
-
- if (!found) {
- gtk_list_unselect_all (list);
- if (list->children)
- gtk_widget_grab_focus (GTK_WIDGET (list->children->data));
- }
-
- e_cell_text_free_text (ecell_text, cell_text);
-}
-
-
-static void
-e_cell_combo_show_popup (ECellCombo *ecc, int row, int view_col)
-{
- gint x, y, width, height, old_width, old_height;
-
- /* This code is practically copied from GtkCombo. */
- old_width = ecc->popup_window->allocation.width;
- old_height = ecc->popup_window->allocation.height;
-
- e_cell_combo_get_popup_pos (ecc, row, view_col, &x, &y, &height, &width);
-
- /* workaround for gtk_scrolled_window_size_allocate bug */
- if (old_width != width || old_height != height) {
- gtk_widget_hide (GTK_SCROLLED_WINDOW (ecc->popup_scrolled_window)->hscrollbar);
- gtk_widget_hide (GTK_SCROLLED_WINDOW (ecc->popup_scrolled_window)->vscrollbar);
- }
-
- gtk_widget_set_uposition (ecc->popup_window, x, y);
- gtk_widget_set_usize (ecc->popup_window, width, height);
- gtk_widget_realize (ecc->popup_window);
- gdk_window_resize (ecc->popup_window->window, width, height);
- gtk_widget_show (ecc->popup_window);
-
- e_cell_popup_set_shown (E_CELL_POPUP (ecc), TRUE);
- d(g_print("%s: popup_shown = TRUE\n", __FUNCTION__));
-}
-
-
-/* Calculates the size and position of the popup window (like GtkCombo). */
-static void
-e_cell_combo_get_popup_pos (ECellCombo *ecc,
- int row,
- int view_col,
- gint *x,
- gint *y,
- gint *height,
- gint *width)
-{
- ECellPopup *ecp = E_CELL_POPUP (ecc);
- ETableItem *eti = E_TABLE_ITEM (ecp->popup_cell_view->cell_view.e_table_item_view);
- GtkWidget *canvas = GTK_WIDGET (GNOME_CANVAS_ITEM (eti)->canvas);
- GtkBin *popwin;
- GtkScrolledWindow *popup;
- GtkRequisition list_requisition;
- gboolean show_vscroll = FALSE, show_hscroll = FALSE;
- gint avail_height, avail_width, min_height, work_height, screen_width;
- gint column_width, row_height, scrollbar_width;
- double x1, y1;
- double wx, wy;
-
- /* This code is practically copied from GtkCombo. */
- popup = GTK_SCROLLED_WINDOW (ecc->popup_scrolled_window);
- popwin = GTK_BIN (ecc->popup_window);
-
- gdk_window_get_origin (canvas->window, x, y);
-
- x1 = e_table_header_col_diff (eti->header, 0, view_col + 1);
- y1 = e_table_item_row_diff (eti, 0, row + 1);
- column_width = e_table_header_col_diff (eti->header, view_col,
- view_col + 1);
- row_height = e_table_item_row_diff (eti, row,
- row + 1);
- gnome_canvas_item_i2w (GNOME_CANVAS_ITEM (eti), &x1, &y1);
-
- gnome_canvas_world_to_window (GNOME_CANVAS (canvas),
- x1,
- y1,
- &wx,
- &wy);
- x1 = wx;
- y1 = wy;
-
- *x += x1;
- /* The ETable positions don't include the grid lines, I think, so we
- add 1. */
- *y += y1 + 1;
-
- scrollbar_width = popup->vscrollbar->requisition.width
- + GTK_SCROLLED_WINDOW_CLASS (GTK_OBJECT (popup)->klass)->scrollbar_spacing;
-
- avail_height = gdk_screen_height () - *y;
-
- /* We'll use the entire screen width if needed, but we save space for
- the vertical scrollbar in case we need to show that. */
- screen_width = gdk_screen_width ();
- avail_width = screen_width - scrollbar_width;
-
- gtk_widget_size_request (ecc->popup_list, &list_requisition);
- min_height = MIN (list_requisition.height,
- popup->vscrollbar->requisition.height);
- if (!GTK_LIST (ecc->popup_list)->children)
- list_requisition.height += E_CELL_COMBO_LIST_EMPTY_HEIGHT;
-
- /* Calculate the desired width. */
- *width = list_requisition.width
- + 2 * popwin->child->style->klass->xthickness
- + 2 * GTK_CONTAINER (popwin->child)->border_width
- + 2 * GTK_CONTAINER (popup)->border_width
- + 2 * GTK_CONTAINER (GTK_BIN (popup)->child)->border_width
- + 2 * GTK_BIN (popup)->child->style->klass->xthickness;
-
- /* Use at least the same width as the column. */
- if (*width < column_width)
- *width = column_width;
-
- /* If it is larger than the available width, use that instead and show
- the horizontal scrollbar. */
- if (*width > avail_width) {
- *width = avail_width;
- show_hscroll = TRUE;
- }
-
- /* Calculate all the borders etc. that we need to add to the height. */
- work_height = (2 * popwin->child->style->klass->ythickness
- + 2 * GTK_CONTAINER (popwin->child)->border_width
- + 2 * GTK_CONTAINER (popup)->border_width
- + 2 * GTK_CONTAINER (GTK_BIN (popup)->child)->border_width
- + 2 * GTK_BIN (popup)->child->style->klass->xthickness);
-
- /* Add on the height of the horizontal scrollbar if we need it. */
- if (show_hscroll)
- work_height += popup->hscrollbar->requisition.height +
- GTK_SCROLLED_WINDOW_CLASS (GTK_OBJECT (popup)->klass)->scrollbar_spacing;
-
- /* Check if it fits in the available height. */
- if (work_height + list_requisition.height > avail_height) {
- /* It doesn't fit, so we see if we have the minimum space
- needed. */
- if (work_height + min_height > avail_height
- && *y - row_height > avail_height) {
- /* We don't, so we show the popup above the cell
- instead of below it. */
- avail_height = *y - row_height;
- *y -= (work_height + list_requisition.height
- + row_height);
- if (*y < 0)
- *y = 0;
- }
- }
-
- /* Check if we still need the vertical scrollbar. */
- if (work_height + list_requisition.height > avail_height) {
- *width += scrollbar_width;
- show_vscroll = TRUE;
- }
-
- /* We try to line it up with the right edge of the column, but we don't
- want it to go off the edges of the screen. */
- if (*x > screen_width)
- *x = screen_width;
- *x -= *width;
- if (*x < 0)
- *x = 0;
-
- if (show_vscroll)
- *height = avail_height;
- else
- *height = work_height + list_requisition.height;
-}
-
-
-
-
-/* This handles button press events in the popup window.
- Note that since we have a pointer grab on this window, we also get button
- press events for windows outside the application here, so we hide the popup
- window if that happens. We also get propagated events from child widgets
- which we ignore. */
-static gint
-e_cell_combo_button_press (GtkWidget *popup_window,
- GdkEvent *event,
- ECellCombo *ecc)
-{
- GtkWidget *event_widget;
-
- event_widget = gtk_get_event_widget (event);
-
- /* If the button press was for a widget inside the popup list, but
- not the popup window itself, then we ignore the event and return
- FALSE. Otherwise we will hide the popup.
- Note that since we have a pointer grab on the popup list, button
- presses outside the application will be reported to this window,
- which is why we hide the popup in this case. */
- while (event_widget) {
- event_widget = event_widget->parent;
- if (event_widget == ecc->popup_list)
- return FALSE;
- }
-
- gtk_grab_remove (ecc->popup_window);
- gdk_pointer_ungrab (event->button.time);
- gtk_widget_hide (ecc->popup_window);
-
- e_cell_popup_set_shown (E_CELL_POPUP (ecc), FALSE);
- d(g_print("%s: popup_shown = FALSE\n", __FUNCTION__));
-
- /* We don't want to update the cell here. Since the list is in browse
- mode there will always be one item selected, so when we popup the
- list one item is selected even if it doesn't match the current text
- in the cell. So if you click outside the popup (which is what has
- happened here) it is better to not update the cell. */
- /*e_cell_combo_update_cell (ecc);*/
- e_cell_combo_restart_edit (ecc);
-
- return TRUE;
-}
-
-
-/* This handles button release events in the popup window. If the button is
- released inside the list, we want to hide the popup window and update the
- cell with the new selection. */
-static gint
-e_cell_combo_button_release (GtkWidget *popup_window,
- GdkEventButton *event,
- ECellCombo *ecc)
-{
- GtkWidget *event_widget;
-
- event_widget = gtk_get_event_widget ((GdkEvent*) event);
-
- /* See if the button was released in the list (or its children). */
- while (event_widget && event_widget != ecc->popup_list)
- event_widget = event_widget->parent;
-
- /* If it wasn't, then we just ignore the event. */
- if (event_widget != ecc->popup_list)
- return FALSE;
-
- /* The button was released inside the list, so we hide the popup and
- update the cell to reflect the new selection. */
- gtk_grab_remove (ecc->popup_window);
- gdk_pointer_ungrab (event->time);
- gtk_widget_hide (ecc->popup_window);
-
- e_cell_popup_set_shown (E_CELL_POPUP (ecc), FALSE);
- d(g_print("%s: popup_shown = FALSE\n", __FUNCTION__));
-
- e_cell_combo_update_cell (ecc);
- e_cell_combo_restart_edit (ecc);
-
- return TRUE;
-}
-
-
-/* This handles key press events in the popup window. If the Escape key is
- pressed we hide the popup, and do not change the cell contents. */
-static int
-e_cell_combo_key_press (GtkWidget *popup_window,
- GdkEventKey *event,
- ECellCombo *ecc)
-{
- /* If the Escape key is pressed we hide the popup. */
- if (event->keyval != GDK_Escape
- && event->keyval != GDK_Return
- && event->keyval != GDK_KP_Enter
- && event->keyval != GDK_ISO_Enter
- && event->keyval != GDK_3270_Enter)
- return FALSE;
-
- gtk_grab_remove (ecc->popup_window);
- gdk_pointer_ungrab (event->time);
- gtk_widget_hide (ecc->popup_window);
-
- e_cell_popup_set_shown (E_CELL_POPUP (ecc), FALSE);
- d(g_print("%s: popup_shown = FALSE\n", __FUNCTION__));
-
- if (event->keyval != GDK_Escape)
- e_cell_combo_update_cell (ecc);
-
- e_cell_combo_restart_edit (ecc);
-
- return TRUE;
-}
-
-
-static void
-e_cell_combo_update_cell (ECellCombo *ecc)
-{
- ECellPopup *ecp = E_CELL_POPUP (ecc);
- ECellView *ecv = (ECellView*) ecp->popup_cell_view;
- ECellText *ecell_text = E_CELL_TEXT (ecp->child);
- ETableItem *eti = E_TABLE_ITEM (ecv->e_table_item_view);
- ETableCol *ecol;
- GtkList *list = GTK_LIST (ecc->popup_list);
- GtkListItem *listitem;
- gchar *text, *old_text;
-
- /* Return if no item is selected. */
- if (list->selection == NULL)
- return;
-
- /* Get the text of the selected item. */
- listitem = list->selection->data;
- text = gtk_object_get_data (GTK_OBJECT (listitem),
- E_CELL_COMBO_UTF8_KEY);
- g_return_if_fail (text != NULL);
-
- /* Compare it with the existing cell contents. */
- ecol = e_table_header_get_column (eti->header, ecp->popup_view_col);
-
- old_text = e_cell_text_get_text (ecell_text, ecv->e_table_model,
- ecol->col_idx, ecp->popup_row);
-
- /* If they are different, update the cell contents. */
- if (old_text && strcmp (old_text, text)) {
- e_cell_text_set_value (ecell_text, ecv->e_table_model,
- ecol->col_idx, ecp->popup_row, text);
- }
-
- e_cell_text_free_text (ecell_text, old_text);
-}
-
-
-static void
-e_cell_combo_restart_edit (ECellCombo *ecc)
-{
- /* This doesn't work. ETable stops the edit straight-away again. */
-#if 0
- ECellView *ecv = (ECellView*) ecc->popup_cell_view;
- ETableItem *eti = E_TABLE_ITEM (ecv->e_table_item_view);
-
- e_table_item_enter_edit (eti, ecc->popup_view_col, ecc->popup_row);
-#endif
-}
-
-
-
diff --git a/widgets/table/e-cell-combo.h b/widgets/table/e-cell-combo.h
deleted file mode 100644
index 6d1490c814..0000000000
--- a/widgets/table/e-cell-combo.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-cell-combo.h: Combo cell renderer
- * Copyright 2001, Ximian, Inc.
- *
- * Author:
- * Damon Chaplin <damon@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-/*
- * ECellCombo - a subclass of ECellPopup used to support popup lists like a
- * GtkCombo widget. It only supports a basic popup list of strings at present,
- * with no auto-completion. The child ECell of the ECellPopup must be an
- * ECellText or subclass.
- */
-
-#ifndef _E_CELL_COMBO_H_
-#define _E_CELL_COMBO_H_
-
-#include <gal/e-table/e-cell-popup.h>
-
-#define E_CELL_COMBO_TYPE (e_cell_combo_get_type ())
-#define E_CELL_COMBO(o) (GTK_CHECK_CAST ((o), E_CELL_COMBO_TYPE, ECellCombo))
-#define E_CELL_COMBO_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_CELL_COMBO_TYPE, ECellComboClass))
-#define E_IS_CELL_COMBO(o) (GTK_CHECK_TYPE ((o), E_CELL_COMBO_TYPE))
-#define E_IS_CELL_COMBO_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_CELL_COMBO_TYPE))
-
-
-typedef struct {
- ECellPopup parent;
-
- GtkWidget *popup_window;
- GtkWidget *popup_scrolled_window;
- GtkWidget *popup_list;
-} ECellCombo;
-
-typedef struct {
- ECellPopupClass parent_class;
-} ECellComboClass;
-
-
-GtkType e_cell_combo_get_type (void);
-ECell *e_cell_combo_new (void);
-
-/* These must be UTF-8. */
-void e_cell_combo_set_popdown_strings (ECellCombo *ecc,
- GList *strings);
-
-#endif /* _E_CELL_COMBO_H_ */
diff --git a/widgets/table/e-cell-date.c b/widgets/table/e-cell-date.c
deleted file mode 100644
index e08efc84de..0000000000
--- a/widgets/table/e-cell-date.c
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * e-cell-date.c - Date item for e-table.
- * Copyright 2001, Ximian, Inc.
- *
- * Author:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-
-#include "e-cell-date.h"
-
-#include <sys/time.h>
-#include <time.h>
-#include <unistd.h>
-#include <string.h>
-#include <gal/util/e-util.h>
-#include <gal/widgets/e-unicode.h>
-#include <gal/util/e-i18n.h>
-
-#define PARENT_TYPE e_cell_text_get_type ()
-
-static ECellTextClass *parent_class;
-
-static char *
-ecd_get_text(ECellText *cell, ETableModel *model, int col, int row)
-{
- time_t date = GPOINTER_TO_INT (e_table_model_value_at(model, col, row));
- time_t nowdate = time(NULL);
- time_t yesdate;
- struct tm then, now, yesterday;
- char buf[26];
- char *temp, *ret_val;
- gboolean done = FALSE;
-
- if (date == 0) {
- return e_utf8_from_locale_string (_("?"));
- }
-
- localtime_r (&date, &then);
- localtime_r (&nowdate, &now);
-
- if (nowdate - date < 60 * 60 * 8 && nowdate > date) {
- e_strftime_fix_am_pm (buf, 26, _("%l:%M %p"), &then);
- done = TRUE;
- }
-
- if (!done) {
- if (then.tm_mday == now.tm_mday &&
- then.tm_mon == now.tm_mon &&
- then.tm_year == now.tm_year) {
- e_strftime_fix_am_pm (buf, 26, _("Today %l:%M %p"), &then);
- done = TRUE;
- }
- }
- if (!done) {
- yesdate = nowdate - 60 * 60 * 24;
- localtime_r (&yesdate, &yesterday);
- if (then.tm_mday == yesterday.tm_mday &&
- then.tm_mon == yesterday.tm_mon &&
- then.tm_year == yesterday.tm_year) {
-#if 0
- if (nowdate - date < 60 * 60 * 12) {
- e_strftime_fix_am_pm (buf, 26, _("Late Yesterday %l:%M %p"), &then);
- } else {
-#endif
- e_strftime_fix_am_pm (buf, 26, _("Yesterday %l:%M %p"), &then);
-#if 0
- }
-#endif
- done = TRUE;
- }
- }
- if (!done) {
- int i;
- for (i = 2; i < 7; i++) {
- yesdate = nowdate - 60 * 60 * 24 * i;
- localtime_r (&yesdate, &yesterday);
- if (then.tm_mday == yesterday.tm_mday &&
- then.tm_mon == yesterday.tm_mon &&
- then.tm_year == yesterday.tm_year) {
- e_strftime_fix_am_pm (buf, 26, _("%a %l:%M %p"), &then);
- done = TRUE;
- break;
- }
- }
- }
- if (!done) {
- if (then.tm_year == now.tm_year) {
- e_strftime_fix_am_pm (buf, 26, _("%b %d %l:%M %p"), &then);
- } else {
- e_strftime_fix_am_pm (buf, 26, _("%b %d %Y"), &then);
- }
- }
-#if 0
-#ifdef CTIME_R_THREE_ARGS
- ctime_r (&date, buf, 26);
-#else
- ctime_r (&date, buf);
-#endif
-#endif
- temp = buf;
- while ((temp = strstr (temp, " "))) {
- memmove (temp, temp + 1, strlen (temp));
- }
- temp = e_strdup_strip (buf);
- ret_val = e_utf8_from_locale_string (temp);
- g_free (temp);
- return ret_val;
-}
-
-static void
-ecd_free_text(ECellText *cell, char *text)
-{
- g_free(text);
-}
-
-static void
-e_cell_date_class_init (GtkObjectClass *object_class)
-{
- ECellTextClass *ectc = (ECellTextClass *) object_class;
-
- parent_class = gtk_type_class (PARENT_TYPE);
-
- ectc->get_text = ecd_get_text;
- ectc->free_text = ecd_free_text;
-}
-
-static void
-e_cell_date_init (GtkObject *object)
-{
-}
-
-/**
- * e_cell_date_new:
- * @fontname: font to be used to render on the screen
- * @justify: Justification of the string in the cell.
- *
- * Creates a new ECell renderer that can be used to render dates that
- * that come from the model. The value returned from the model is
- * interpreted as being a time_t.
- *
- * The ECellDate object support a large set of properties that can be
- * configured through the Gtk argument system and allows the user to have
- * a finer control of the way the string is displayed. The arguments supported
- * allow the control of strikeout, bold, color and a date filter.
- *
- * The arguments "strikeout_column", "bold_column" and "color_column" set
- * and return an integer that points to a column in the model that controls
- * these settings. So controlling the way things are rendered is achieved
- * by having special columns in the model that will be used to flag whether
- * the date should be rendered with strikeout, or bolded. In the case of
- * the "color_column" argument, the column in the model is expected to have
- * a string that can be parsed by gdk_color_parse().
- *
- * Returns: an ECell object that can be used to render dates.
- */
-ECell *
-e_cell_date_new (const char *fontname, GtkJustification justify)
-{
- ECellDate *ecd = gtk_type_new (e_cell_date_get_type ());
-
- e_cell_text_construct(E_CELL_TEXT(ecd), fontname, justify);
-
- return (ECell *) ecd;
-}
-
-E_MAKE_TYPE(e_cell_date, "ECellDate", ECellDate, e_cell_date_class_init, e_cell_date_init, PARENT_TYPE);
diff --git a/widgets/table/e-cell-date.h b/widgets/table/e-cell-date.h
deleted file mode 100644
index 2fff8ed1c6..0000000000
--- a/widgets/table/e-cell-date.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * e-cell-date.h - Date item for e-table.
- * Copyright 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_CELL_DATE_H_
-#define _E_CELL_DATE_H_
-
-#include <gal/e-table/e-cell-text.h>
-#include <libgnome/gnome-defs.h>
-
-BEGIN_GNOME_DECLS
-
-#define E_CELL_DATE_TYPE (e_cell_date_get_type ())
-#define E_CELL_DATE(o) (GTK_CHECK_CAST ((o), E_CELL_DATE_TYPE, ECellDate))
-#define E_CELL_DATE_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_CELL_DATE_TYPE, ECellDateClass))
-#define E_IS_CELL_DATE(o) (GTK_CHECK_TYPE ((o), E_CELL_DATE_TYPE))
-#define E_IS_CELL_DATE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_CELL_DATE_TYPE))
-
-typedef struct {
- ECellText base;
-} ECellDate;
-
-typedef struct {
- ECellTextClass parent_class;
-} ECellDateClass;
-
-GtkType e_cell_date_get_type (void);
-ECell *e_cell_date_new (const char *fontname, GtkJustification justify);
-
-END_GNOME_DECLS
-
-#endif /* _E_CELL_DATE_H_ */
diff --git a/widgets/table/e-cell-float.c b/widgets/table/e-cell-float.c
deleted file mode 100644
index b393c1193a..0000000000
--- a/widgets/table/e-cell-float.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * e-cell-float.c - Float item for e-table.
- * Copyright 2001, CodeFactory AB
- * Copyright 2001, Mikael Hallendal <micke@codefactory.se>
- *
- * Derived from e-cell-number by Chris Lahey <clahey@ximian.com>
- * ECellFloat - Float item for e-table.
- *
- * Author:
- * Mikael Hallendal <micke@codefactory.se>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <sys/time.h>
-#include <unistd.h>
-#include <gal/util/e-util.h>
-#include <gal/util/e-i18n.h>
-#include "e-cell-float.h"
-
-#define PARENT_TYPE e_cell_text_get_type ()
-
-static ECellTextClass *parent_class;
-
-static char *
-ecf_get_text(ECellText *cell, ETableModel *model, int col, int row)
-{
- gfloat *fvalue;
-
- fvalue = e_table_model_value_at (model, col, row);
-
- return e_format_number_float (*fvalue);
-}
-
-static void
-ecf_free_text(ECellText *cell, char *text)
-{
- g_free(text);
-}
-
-static void
-e_cell_float_class_init (GtkObjectClass *object_class)
-{
- ECellTextClass *ectc = (ECellTextClass *) object_class;
-
- parent_class = gtk_type_class (PARENT_TYPE);
-
- ectc->get_text = ecf_get_text;
- ectc->free_text = ecf_free_text;
-}
-
-static void
-e_cell_float_init (GtkObject *object)
-{
-}
-
-/**
- * e_cell_float_new:
- * @fontname: font to be used to render on the screen
- * @justify: Justification of the string in the cell.
- *
- * Creates a new ECell renderer that can be used to render floats that
- * that come from the model. The value returned from the model is
- * interpreted as being an int.
- *
- * See ECellText for other features.
- *
- * Returns: an ECell object that can be used to render floats.
- */
-ECell *
-e_cell_float_new (const char *fontname, GtkJustification justify)
-{
- ECellFloat *ecn = gtk_type_new (e_cell_float_get_type ());
-
- e_cell_text_construct(E_CELL_TEXT(ecn), fontname, justify);
-
- return (ECell *) ecn;
-}
-
-E_MAKE_TYPE(e_cell_float, "ECellFloat", ECellFloat, e_cell_float_class_init, e_cell_float_init, PARENT_TYPE);
diff --git a/widgets/table/e-cell-float.h b/widgets/table/e-cell-float.h
deleted file mode 100644
index 5ad547fc22..0000000000
--- a/widgets/table/e-cell-float.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * e-cell-float.h - Float item for e-table.
- * Copyright 2001, CodeFactory AB
- * Copyright 2001, Mikael Hallendal <micke@codefactory.se>
- *
- * Derived from e-cell-number by Chris Lahey <clahey@ximian.com>
- * ECellFloat - Float item for e-table.
- *
- * Author:
- * Mikael Hallendal <micke@codefactory.se>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_CELL_FLOAT_H_
-#define _E_CELL_FLOAT_H_
-
-#include <gal/e-table/e-cell-text.h>
-#include <libgnome/gnome-defs.h>
-
-BEGIN_GNOME_DECLS
-
-#define E_CELL_FLOAT_TYPE (e_cell_float_get_type ())
-#define E_CELL_FLOAT(o) (GTK_CHECK_CAST ((o), E_CELL_FLOAT_TYPE, ECellFloat))
-#define E_CELL_FLOAT_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_CELL_FLOAT_TYPE, ECellFloatClass))
-#define E_IS_CELL_FLOAT(o) (GTK_CHECK_TYPE ((o), E_CELL_FLOAT_TYPE))
-#define E_IS_CELL_FLOAT_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_CELL_FLOAT_TYPE))
-
-typedef struct {
- ECellText base;
-} ECellFloat;
-
-typedef struct {
- ECellTextClass parent_class;
-} ECellFloatClass;
-
-GtkType e_cell_float_get_type (void);
-ECell *e_cell_float_new (const char *fontname, GtkJustification justify);
-
-END_GNOME_DECLS
-
-#endif /* _E_CELL_FLOAT_H_ */
diff --git a/widgets/table/e-cell-number.c b/widgets/table/e-cell-number.c
deleted file mode 100644
index 77866f3e36..0000000000
--- a/widgets/table/e-cell-number.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * e-cell-number.c - Number item for e-table.
- * Copyright 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <sys/time.h>
-#include <unistd.h>
-#include <gal/util/e-util.h>
-#include <gal/util/e-i18n.h>
-#include "e-cell-number.h"
-
-#define PARENT_TYPE e_cell_text_get_type ()
-
-static ECellTextClass *parent_class;
-
-static char *
-ecn_get_text(ECellText *cell, ETableModel *model, int col, int row)
-{
- return e_format_number(GPOINTER_TO_INT (e_table_model_value_at(model, col, row)));
-}
-
-static void
-ecn_free_text(ECellText *cell, char *text)
-{
- g_free(text);
-}
-
-static void
-e_cell_number_class_init (GtkObjectClass *object_class)
-{
- ECellTextClass *ectc = (ECellTextClass *) object_class;
-
- parent_class = gtk_type_class (PARENT_TYPE);
-
- ectc->get_text = ecn_get_text;
- ectc->free_text = ecn_free_text;
-}
-
-static void
-e_cell_number_init (GtkObject *object)
-{
-}
-
-/**
- * e_cell_number_new:
- * @fontname: font to be used to render on the screen
- * @justify: Justification of the string in the cell.
- *
- * Creates a new ECell renderer that can be used to render numbers that
- * that come from the model. The value returned from the model is
- * interpreted as being an int.
- *
- * See ECellText for other features.
- *
- * Returns: an ECell object that can be used to render numbers.
- */
-ECell *
-e_cell_number_new (const char *fontname, GtkJustification justify)
-{
- ECellNumber *ecn = gtk_type_new (e_cell_number_get_type ());
-
- e_cell_text_construct(E_CELL_TEXT(ecn), fontname, justify);
-
- return (ECell *) ecn;
-}
-
-E_MAKE_TYPE(e_cell_number, "ECellNumber", ECellNumber, e_cell_number_class_init, e_cell_number_init, PARENT_TYPE);
diff --git a/widgets/table/e-cell-number.h b/widgets/table/e-cell-number.h
deleted file mode 100644
index 8ea312d4b2..0000000000
--- a/widgets/table/e-cell-number.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * e-cell-number.h - Number item for e-table.
- * Copyright 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_CELL_NUMBER_H_
-#define _E_CELL_NUMBER_H_
-
-#include <gal/e-table/e-cell-text.h>
-#include <libgnome/gnome-defs.h>
-
-BEGIN_GNOME_DECLS
-
-#define E_CELL_NUMBER_TYPE (e_cell_number_get_type ())
-#define E_CELL_NUMBER(o) (GTK_CHECK_CAST ((o), E_CELL_NUMBER_TYPE, ECellNumber))
-#define E_CELL_NUMBER_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_CELL_NUMBER_TYPE, ECellNumberClass))
-#define E_IS_CELL_NUMBER(o) (GTK_CHECK_TYPE ((o), E_CELL_NUMBER_TYPE))
-#define E_IS_CELL_NUMBER_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_CELL_NUMBER_TYPE))
-
-typedef struct {
- ECellText base;
-} ECellNumber;
-
-typedef struct {
- ECellTextClass parent_class;
-} ECellNumberClass;
-
-GtkType e_cell_number_get_type (void);
-ECell *e_cell_number_new (const char *fontname, GtkJustification justify);
-
-END_GNOME_DECLS
-
-#endif /* _E_CELL_NUMBER_H_ */
diff --git a/widgets/table/e-cell-pixbuf.c b/widgets/table/e-cell-pixbuf.c
deleted file mode 100644
index 9294e4a703..0000000000
--- a/widgets/table/e-cell-pixbuf.c
+++ /dev/null
@@ -1,344 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-cell-pixbuf.c - An ECell that displays a GdkPixbuf
- * Copyright 2001, Ximian, Inc.
- *
- * Authors:
- * Vladimir Vukicevic <vladimir@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <stdio.h>
-#include <libgnomeui/gnome-canvas.h>
-#include "e-cell-pixbuf.h"
-
-static ECellClass *parent_class;
-
-typedef struct _ECellPixbufView ECellPixbufView;
-
-struct _ECellPixbufView {
- ECellView cell_view;
- GnomeCanvas *canvas;
-};
-
-/* Object argument IDs */
-enum {
- ARG_0,
-
- ARG_SELECTED_COLUMN,
- ARG_FOCUSED_COLUMN,
- ARG_UNSELECTED_COLUMN
-};
-
-/*
- * ECellPixbuf functions
- */
-
-ECell *
-e_cell_pixbuf_new (void)
-{
- ECellPixbuf *ecp;
-
- ecp = gtk_type_new (E_CELL_PIXBUF_TYPE);
- e_cell_pixbuf_construct (ecp);
-
- return (ECell *) ecp;
-}
-
-void
-e_cell_pixbuf_construct (ECellPixbuf *ecp)
-{
- /* noop */
- return;
-}
-
-/*
- * ECell methods
- */
-
-static ECellView *
-pixbuf_new_view (ECell *ecell, ETableModel *table_model, void *e_table_item_view)
-{
- ECellPixbufView *pixbuf_view = g_new0 (ECellPixbufView, 1);
- ETableItem *eti = E_TABLE_ITEM (e_table_item_view);
- GnomeCanvas *canvas = GNOME_CANVAS_ITEM (eti)->canvas;
-
- pixbuf_view->cell_view.ecell = ecell;
- pixbuf_view->cell_view.e_table_model = table_model;
- pixbuf_view->cell_view.e_table_item_view = e_table_item_view;
- pixbuf_view->canvas = canvas;
-
- return (ECellView *) pixbuf_view;
-}
-
-static void
-pixbuf_kill_view (ECellView *ecell_view)
-{
- ECellPixbufView *pixbuf_view = (ECellPixbufView *) ecell_view;
-
- g_free (pixbuf_view);
-}
-
-static void
-pixbuf_draw (ECellView *ecell_view, GdkDrawable *drawable,
- int model_col, int view_col, int row, ECellFlags flags,
- int x1, int y1, int x2, int y2)
-{
- GdkPixbuf *cell_pixbuf;
- int real_x, real_y, real_w, real_h;
- int pix_w, pix_h;
- ECellPixbuf *ecp;
-
- cell_pixbuf = NULL;
-
- ecp = E_CELL_PIXBUF (ecell_view->ecell);
-
- if (flags & E_CELL_SELECTED) {
- if (GTK_WIDGET_HAS_FOCUS (GNOME_CANVAS_ITEM (ecell_view->e_table_item_view)->canvas)) {
- if (ecp->focused_column != -1)
- cell_pixbuf = (GdkPixbuf *) e_table_model_value_at (ecell_view->e_table_model,
- ecp->focused_column, row);
- } else {
- if (ecp->selected_column != -1)
- cell_pixbuf = (GdkPixbuf *) e_table_model_value_at (ecell_view->e_table_model,
- ecp->selected_column, row);
- }
- } else {
- if (ecp->unselected_column != -1)
- cell_pixbuf = e_table_model_value_at (ecell_view->e_table_model,
- ecp->unselected_column, row);
- }
-
- if (cell_pixbuf == NULL)
- cell_pixbuf = e_table_model_value_at (ecell_view->e_table_model,
- model_col, row);
- /* we can't make sure we really got a pixbuf since, well, it's a Gdk thing */
-
- if (x2 - x1 == 0)
- return;
-
- if (!cell_pixbuf)
- return;
-
- pix_w = gdk_pixbuf_get_width (cell_pixbuf);
- pix_h = gdk_pixbuf_get_height (cell_pixbuf);
-
- /* We center the pixbuf within our allocated space */
- if (x2 - x1 > pix_w) {
- int diff = (x2 - x1) - pix_w;
- real_x = x1 + diff/2;
- real_w = pix_w;
- } else {
- real_x = x1;
- real_w = x2 - x1;
- }
-
- if (y2 - y1 > pix_h) {
- int diff = (y2 - y1) - pix_h;
- real_y = y1 + diff/2;
- real_h = pix_h;
- } else {
- real_y = y1;
- real_h = y2 - y1;
- }
-
-
- gdk_pixbuf_render_to_drawable_alpha (cell_pixbuf,
- drawable,
- 0, 0,
- real_x, real_y,
- real_w, real_h,
- GDK_PIXBUF_ALPHA_FULL,
- 127,
- GDK_RGB_DITHER_NORMAL,
- 0, 0);
-}
-
-static gint
-pixbuf_event (ECellView *ecell_view, GdkEvent *event,
- int model_col, int view_col, int row,
- ECellFlags flags, ECellActions *actions)
-{
- /* noop */
-
- return FALSE;
-}
-
-static gint
-pixbuf_height (ECellView *ecell_view, int model_col, int view_col, int row)
-{
- GdkPixbuf *pixbuf;
- if (row == -1) {
- if (e_table_model_row_count (ecell_view->e_table_model) > 0) {
- row = 0;
- } else {
- return 6;
- }
- }
-
- pixbuf = (GdkPixbuf *) e_table_model_value_at (ecell_view->e_table_model, model_col, row);
- if (!pixbuf)
- return 0;
-
- /* We give ourselves 3 pixels of padding on either side */
- return gdk_pixbuf_get_height (pixbuf) + 6;
-}
-
-static gint
-pixbuf_max_width (ECellView *ecell_view, int model_col, int view_col)
-{
- int pw;
- gint num_rows, i;
- gint max_width = -1;
-
- if (model_col == 0) {
- num_rows = e_table_model_row_count (ecell_view->e_table_model);
-
- for (i = 0; i <= num_rows; i++) {
- GdkPixbuf *pixbuf = (GdkPixbuf *) e_table_model_value_at
- (ecell_view->e_table_model,
- model_col,
- i);
- if (!pixbuf)
- continue;
- pw = gdk_pixbuf_get_width (pixbuf);
- if (max_width < pw)
- max_width = pw;
- }
- } else {
- return -1;
- }
-
- return max_width;
-}
-
-static void
-pixbuf_destroy (GtkObject *object)
-{
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-static void
-pixbuf_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- ECellPixbuf *pixbuf;
-
- pixbuf = E_CELL_PIXBUF (object);
-
- switch (arg_id) {
- case ARG_SELECTED_COLUMN:
- pixbuf->selected_column = GTK_VALUE_INT (*arg);
- break;
-
- case ARG_FOCUSED_COLUMN:
- pixbuf->focused_column = GTK_VALUE_INT (*arg);
- break;
-
- case ARG_UNSELECTED_COLUMN:
- pixbuf->unselected_column = GTK_VALUE_INT (*arg);
- break;
-
- default:
- return;
- }
-}
-
-/* Get_arg handler for the pixbuf item */
-static void
-pixbuf_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- ECellPixbuf *pixbuf;
-
- pixbuf = E_CELL_PIXBUF (object);
-
- switch (arg_id) {
- case ARG_SELECTED_COLUMN:
- GTK_VALUE_INT (*arg) = pixbuf->selected_column;
- break;
-
- case ARG_FOCUSED_COLUMN:
- GTK_VALUE_INT (*arg) = pixbuf->focused_column;
- break;
-
- case ARG_UNSELECTED_COLUMN:
- GTK_VALUE_INT (*arg) = pixbuf->unselected_column;
- break;
-
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-static void
-e_cell_pixbuf_init (GtkObject *object)
-{
- ECellPixbuf *ecp = E_CELL_PIXBUF (object);
-
- ecp->selected_column = -1;
- ecp->focused_column = -1;
- ecp->unselected_column = -1;
-}
-
-static void
-e_cell_pixbuf_class_init (GtkObjectClass *object_class)
-{
- ECellClass *ecc = (ECellClass *) object_class;
-
- object_class->destroy = pixbuf_destroy;
- object_class->set_arg = pixbuf_set_arg;
- object_class->get_arg = pixbuf_get_arg;
-
- ecc->new_view = pixbuf_new_view;
- ecc->kill_view = pixbuf_kill_view;
- ecc->draw = pixbuf_draw;
- ecc->event = pixbuf_event;
- ecc->height = pixbuf_height;
- ecc->max_width = pixbuf_max_width;
-
- parent_class = gtk_type_class (E_CELL_TYPE);
-
- gtk_object_add_arg_type ("ECellPixbuf::selected_column",
- GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_SELECTED_COLUMN);
- gtk_object_add_arg_type ("ECellPixbuf::focused_column",
- GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_FOCUSED_COLUMN);
- gtk_object_add_arg_type ("ECellPixbuf::unselected_column",
- GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_UNSELECTED_COLUMN);
-}
-
-guint
-e_cell_pixbuf_get_type (void)
-{
- static guint type = 0;
-
- if (!type) {
- GtkTypeInfo type_info = {
- "ECellPixbuf",
- sizeof (ECellPixbuf),
- sizeof (ECellPixbufClass),
- (GtkClassInitFunc) e_cell_pixbuf_class_init,
- (GtkObjectInitFunc) e_cell_pixbuf_init,
- (GtkArgSetFunc) NULL,
- (GtkArgGetFunc) NULL,
- };
-
- type = gtk_type_unique (e_cell_get_type (), &type_info);
- }
-
- return type;
-}
-
diff --git a/widgets/table/e-cell-pixbuf.h b/widgets/table/e-cell-pixbuf.h
deleted file mode 100644
index 938cb84bb4..0000000000
--- a/widgets/table/e-cell-pixbuf.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * e-cell-pixbuf.h - An ECell that displays a GdkPixbuf
- * Copyright 2001, Ximian, Inc.
- *
- * Authors:
- * Vladimir Vukicevic <vladimir@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_CELL_PIXBUF_H_
-#define _E_CELL_PIXBUF_H_
-
-#include <gal/e-table/e-table.h>
-
-#define E_CELL_PIXBUF_TYPE (e_cell_pixbuf_get_type ())
-#define E_CELL_PIXBUF(o) (GTK_CHECK_CAST ((o), E_CELL_PIXBUF_TYPE, ECellPixbuf))
-#define E_CELL_PIXBUF_CLASS(k) (GTK_CHECK_CAST_CLASS ((k), E_CELL_PIXBUF_TYPE, ECellPixbufClass))
-#define E_IS_CELL_PIXBUF(o) (GTK_CHECK_TYPE ((o), E_CELL_PIXBUF_TYPE))
-#define E_IS_CELL_PIXBUF_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_CELL_PIXBUF_TYPE))
-
-typedef struct _ECellPixbuf ECellPixbuf;
-typedef struct _ECellPixbufClass ECellPixbufClass;
-
-struct _ECellPixbuf {
- ECell parent;
-
- int selected_column;
- int focused_column;
- int unselected_column;
-};
-
-struct _ECellPixbufClass {
- ECellClass parent_class;
-};
-
-GtkType e_cell_pixbuf_get_type (void);
-ECell *e_cell_pixbuf_new (void);
-void e_cell_pixbuf_construct (ECellPixbuf *ecp);
-
-#endif
diff --git a/widgets/table/e-cell-popup.c b/widgets/table/e-cell-popup.c
deleted file mode 100644
index bf0104758f..0000000000
--- a/widgets/table/e-cell-popup.c
+++ /dev/null
@@ -1,528 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-cell-popup.c: Popup cell renderer
- * Copyright 2001, Ximian, Inc.
- *
- * Authors:
- * Damon Chaplin <damon@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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. */
-
-/*
- * ECellPopup - an abstract ECell class used to support popup selections like
- * a GtkCombo widget. It contains a child ECell, e.g. an ECellText, but when
- * selected it displays an arrow on the right edge which the user can click to
- * show a popup. Subclasses implement the popup class function to show the
- * popup.
- */
-
-#include <config.h>
-#include <gdk/gdkkeysyms.h>
-#include "gal/util/e-util.h"
-#include "e-table-item.h"
-#include "e-cell-popup.h"
-
-
-#define E_CELL_POPUP_ARROW_WIDTH 16
-#define E_CELL_POPUP_ARROW_XPAD 3
-#define E_CELL_POPUP_ARROW_YPAD 3
-
-
-static void e_cell_popup_class_init (GtkObjectClass *object_class);
-static void e_cell_popup_init (ECellPopup *ecp);
-static void e_cell_popup_destroy (GtkObject *object);
-
-
-static ECellView* ecp_new_view (ECell *ecell,
- ETableModel *table_model,
- void *e_table_item_view);
-static void ecp_kill_view (ECellView *ecv);
-static void ecp_realize (ECellView *ecv);
-static void ecp_unrealize (ECellView *ecv);
-static void ecp_draw (ECellView *ecv,
- GdkDrawable *drawable,
- int model_col,
- int view_col,
- int row,
- ECellFlags flags,
- int x1,
- int y1,
- int x2,
- int y2);
-static gint ecp_event (ECellView *ecv,
- GdkEvent *event,
- int model_col,
- int view_col,
- int row,
- ECellFlags flags,
- ECellActions *actions);
-static int ecp_height (ECellView *ecv,
- int model_col,
- int view_col,
- int row);
-static void* ecp_enter_edit (ECellView *ecv,
- int model_col,
- int view_col,
- int row);
-static void ecp_leave_edit (ECellView *ecv,
- int model_col,
- int view_col,
- int row,
- void *edit_context);
-static void ecp_print (ECellView *ecv,
- GnomePrintContext *context,
- int model_col,
- int view_col,
- int row,
- double width,
- double height);
-static gdouble ecp_print_height (ECellView *ecv,
- GnomePrintContext *context,
- int model_col,
- int view_col,
- int row,
- double width);
-static int ecp_max_width (ECellView *ecv,
- int model_col,
- int view_col);
-static void ecp_show_tooltip (ECellView *ecv,
- int model_col,
- int view_col,
- int row,
- int col_width,
- ETableTooltip *tooltip);
-static char *ecp_get_bg_color (ECellView *ecell_view, int row);
-
-static gint e_cell_popup_do_popup (ECellPopupView *ecp_view,
- GdkEvent *event,
- int row,
- int model_col);
-
-static ECellClass *parent_class;
-
-
-E_MAKE_TYPE (e_cell_popup, "ECellPopup", ECellPopup, e_cell_popup_class_init,
- e_cell_popup_init, e_cell_get_type());
-
-
-static void
-e_cell_popup_class_init (GtkObjectClass *object_class)
-{
- ECellClass *ecc = (ECellClass *) object_class;
-
- object_class->destroy = e_cell_popup_destroy;
-
- ecc->new_view = ecp_new_view;
- ecc->kill_view = ecp_kill_view;
- ecc->realize = ecp_realize;
- ecc->unrealize = ecp_unrealize;
- ecc->draw = ecp_draw;
- ecc->event = ecp_event;
- ecc->height = ecp_height;
- ecc->enter_edit = ecp_enter_edit;
- ecc->leave_edit = ecp_leave_edit;
- ecc->print = ecp_print;
- ecc->print_height = ecp_print_height;
- ecc->max_width = ecp_max_width;
- ecc->show_tooltip = ecp_show_tooltip;
- ecc->get_bg_color = ecp_get_bg_color;
-
- parent_class = gtk_type_class (e_cell_get_type ());
-}
-
-
-static void
-e_cell_popup_init (ECellPopup *ecp)
-{
- ecp->popup_shown = FALSE;
- ecp->popup_model = NULL;
-}
-
-
-/**
- * e_cell_popup_new:
- *
- * Creates a new ECellPopup renderer.
- *
- * Returns: an ECellPopup object.
- */
-ECell *
-e_cell_popup_new (void)
-{
- ECellPopup *ecp = gtk_type_new (e_cell_popup_get_type ());
-
- return (ECell*) ecp;
-}
-
-
-/*
- * GtkObject::destroy method
- */
-static void
-e_cell_popup_destroy (GtkObject *object)
-{
- ECellPopup *ecp = E_CELL_POPUP (object);
-
- gtk_object_unref (GTK_OBJECT (ecp->child));
-
- GTK_OBJECT_CLASS (parent_class)->destroy (object);
-}
-
-
-
-/*
- * ECell::new_view method
- */
-static ECellView *
-ecp_new_view (ECell *ecell, ETableModel *table_model, void *e_table_item_view)
-{
- ECellPopup *ecp = E_CELL_POPUP (ecell);
- ECellPopupView *ecp_view;
-
- /* We must have a child ECell before we create any views. */
- g_return_val_if_fail (ecp->child != NULL, NULL);
-
- ecp_view = g_new0 (ECellPopupView, 1);
-
- ecp_view->cell_view.ecell = ecell;
- ecp_view->cell_view.e_table_model = table_model;
- ecp_view->cell_view.e_table_item_view = e_table_item_view;
-
- ecp_view->child_view = e_cell_new_view (ecp->child, table_model,
- e_table_item_view);
-
- return (ECellView*) ecp_view;
-}
-
-
-/*
- * ECell::kill_view method
- */
-static void
-ecp_kill_view (ECellView *ecv)
-{
- ECellPopupView *ecp_view = (ECellPopupView *) ecv;
-
- if (ecp_view->child_view)
- e_cell_kill_view (ecp_view->child_view);
- g_free (ecp_view);
-}
-
-
-/*
- * ECell::realize method
- */
-static void
-ecp_realize (ECellView *ecv)
-{
- ECellPopupView *ecp_view = (ECellPopupView *) ecv;
-
- e_cell_realize (ecp_view->child_view);
-
- if (parent_class->realize)
- (* parent_class->realize) (ecv);
-}
-
-
-/*
- * ECell::unrealize method
- */
-static void
-ecp_unrealize (ECellView *ecv)
-{
- ECellPopupView *ecp_view = (ECellPopupView *) ecv;
-
- e_cell_unrealize (ecp_view->child_view);
-
- if (parent_class->unrealize)
- (* parent_class->unrealize) (ecv);
-}
-
-
-/*
- * ECell::draw method
- */
-static void
-ecp_draw (ECellView *ecv, GdkDrawable *drawable,
- int model_col, int view_col, int row, ECellFlags flags,
- int x1, int y1, int x2, int y2)
-{
- ECellPopup *ecp = E_CELL_POPUP (ecv->ecell);
- ECellPopupView *ecp_view = (ECellPopupView *) ecv;
- GtkWidget *canvas = GTK_WIDGET (GNOME_CANVAS_ITEM (ecv->e_table_item_view)->canvas);
- GtkShadowType shadow;
- GdkRectangle rect;
- gboolean show_popup_arrow = FALSE;
-
- /* Display the popup arrow if we are the cursor cell, or the popup
- is shown for this cell. */
- if (flags & E_CELL_CURSOR) {
- show_popup_arrow = TRUE;
- ecp->popup_arrow_shown = TRUE;
- } else if (ecp->popup_shown && ecp->popup_view_col == view_col
- && ecp->popup_row == row && ecp->popup_model == ((ECellView *) ecp_view)->e_table_model) {
- show_popup_arrow = TRUE;
- }
-
-#if 0
- g_print ("In ecp_draw row:%i col: %i %i,%i %i,%i Show Arrow:%i\n",
- row, view_col, x1, y1, x2, y2, show_popup_arrow);
-#endif
-
- if (show_popup_arrow) {
- e_cell_draw (ecp_view->child_view, drawable, model_col,
- view_col, row, flags,
- x1, y1, x2 - E_CELL_POPUP_ARROW_WIDTH, y2);
-
- rect.x = x2 - E_CELL_POPUP_ARROW_WIDTH;
- rect.y = y1 + 1;
- rect.width = E_CELL_POPUP_ARROW_WIDTH;
- rect.height = y2 - y1 - 2;
-
- if (ecp->popup_shown)
- shadow = GTK_SHADOW_IN;
- else
- shadow = GTK_SHADOW_OUT;
-
- gtk_paint_box (canvas->style, drawable,
- GTK_STATE_NORMAL, shadow,
- &rect, canvas, "ecellpopup",
- rect.x, rect.y, rect.width, rect.height);
- gtk_paint_arrow (canvas->style, drawable,
- GTK_STATE_NORMAL, shadow,
- &rect, canvas, NULL,
- GTK_ARROW_DOWN, TRUE,
- rect.x + E_CELL_POPUP_ARROW_XPAD,
- rect.y + E_CELL_POPUP_ARROW_YPAD,
- rect.width - E_CELL_POPUP_ARROW_XPAD * 2,
- rect.height - E_CELL_POPUP_ARROW_YPAD * 2);
- } else {
- e_cell_draw (ecp_view->child_view, drawable, model_col,
- view_col, row, flags, x1, y1, x2, y2);
- }
-}
-
-
-/*
- * ECell::event method
- */
-static gint
-ecp_event (ECellView *ecv, GdkEvent *event, int model_col, int view_col,
- int row, ECellFlags flags, ECellActions *actions)
-{
- ECellPopupView *ecp_view = (ECellPopupView *) ecv;
- ECellPopup *ecp = E_CELL_POPUP (ecp_view->cell_view.ecell);
- ETableItem *eti = E_TABLE_ITEM (ecv->e_table_item_view);
- int width;
-
- switch (event->type) {
- case GDK_BUTTON_PRESS:
- if (flags & E_CELL_CURSOR
- && ecp->popup_arrow_shown) {
- width = e_table_header_col_diff (eti->header, view_col,
- view_col + 1);
-
- g_print ("Event in item popup width: %i button: %g,%g\n",
- width, event->button.x, event->button.y);
-
- /* FIXME: The event coords seem to be relative to the
- text within the cell, so we have to add 4. */
- if (event->button.x + 4 >= width - E_CELL_POPUP_ARROW_WIDTH) {
- return e_cell_popup_do_popup (ecp_view, event, row, view_col);
- }
- }
- break;
- case GDK_BUTTON_RELEASE:
- break;
- case GDK_KEY_PRESS:
- if (event->key.state & GDK_MOD1_MASK
- && event->key.keyval == GDK_Down) {
- g_print ("## Alt-Down pressed\n");
- return e_cell_popup_do_popup (ecp_view, event, row, view_col);
- }
- g_print ("Key Press Event ECellPopup\n");
- break;
- default:
- break;
- }
-
- return e_cell_event (ecp_view->child_view, event, model_col, view_col,
- row, flags, actions);
-}
-
-
-/*
- * ECell::height method
- */
-static int
-ecp_height (ECellView *ecv, int model_col, int view_col, int row)
-{
- ECellPopupView *ecp_view = (ECellPopupView *) ecv;
-
- return e_cell_height (ecp_view->child_view, model_col, view_col, row);
-}
-
-
-/*
- * ECellView::enter_edit method
- */
-static void *
-ecp_enter_edit (ECellView *ecv, int model_col, int view_col, int row)
-{
- ECellPopupView *ecp_view = (ECellPopupView *) ecv;
-
- g_print ("In ecp_enter_edit model_col: %i view_col: %i row: %i\n",
- model_col, view_col, row);
-
- return e_cell_enter_edit (ecp_view->child_view, model_col, view_col, row);
-}
-
-
-/*
- * ECellView::leave_edit method
- */
-static void
-ecp_leave_edit (ECellView *ecv, int model_col, int view_col, int row,
- void *edit_context)
-{
- ECellPopupView *ecp_view = (ECellPopupView *) ecv;
-
- g_print ("In ecp_leave_edit model_col: %i view_col: %i row: %i\n",
- model_col, view_col, row);
-
- e_cell_leave_edit (ecp_view->child_view, model_col, view_col, row,
- edit_context);
-}
-
-
-static void
-ecp_print (ECellView *ecv, GnomePrintContext *context,
- int model_col, int view_col, int row, double width, double height)
-{
- ECellPopupView *ecp_view = (ECellPopupView *) ecv;
-
- e_cell_print (ecp_view->child_view, context, model_col, view_col, row,
- width, height);
-}
-
-
-static gdouble
-ecp_print_height (ECellView *ecv, GnomePrintContext *context,
- int model_col, int view_col, int row,
- double width)
-{
- ECellPopupView *ecp_view = (ECellPopupView *) ecv;
-
- return e_cell_print_height (ecp_view->child_view, context, model_col,
- view_col, row, width);
-}
-
-
-static int
-ecp_max_width (ECellView *ecv,
- int model_col,
- int view_col)
-{
- ECellPopupView *ecp_view = (ECellPopupView *) ecv;
-
- return e_cell_max_width (ecp_view->child_view, model_col, view_col);
-}
-
-
-static void
-ecp_show_tooltip (ECellView *ecv,
- int model_col,
- int view_col,
- int row,
- int col_width,
- ETableTooltip *tooltip)
-{
- ECellPopupView *ecp_view = (ECellPopupView *) ecv;
-
- e_cell_show_tooltip (ecp_view->child_view, model_col, view_col, row,
- col_width, tooltip);
-}
-
-static char *
-ecp_get_bg_color (ECellView *ecell_view, int row)
-{
- ECellPopupView *ecp_view = (ECellPopupView *) ecell_view;
-
- return e_cell_get_bg_color (ecp_view->child_view, row);
-}
-
-
-
-ECell*
-e_cell_popup_get_child (ECellPopup *ecp)
-{
- g_return_val_if_fail (E_IS_CELL_POPUP (ecp), NULL);
-
- return ecp->child;
-}
-
-
-void
-e_cell_popup_set_child (ECellPopup *ecp,
- ECell *child)
-{
- g_return_if_fail (E_IS_CELL_POPUP (ecp));
-
- if (ecp->child)
- gtk_object_unref (GTK_OBJECT (ecp->child));
-
- ecp->child = child;
- gtk_object_ref (GTK_OBJECT (child));
-}
-
-
-static gint
-e_cell_popup_do_popup (ECellPopupView *ecp_view,
- GdkEvent *event,
- int row,
- int view_col)
-{
- ECellPopup *ecp = E_CELL_POPUP (ecp_view->cell_view.ecell);
- gint (*popup_func) (ECellPopup *ecp, GdkEvent *event, int row, int view_col);
-
- ecp->popup_cell_view = ecp_view;
-
- popup_func = E_CELL_POPUP_CLASS (GTK_OBJECT (ecp)->klass)->popup;
-
- ecp->popup_view_col = view_col;
- ecp->popup_row = row;
- ecp->popup_model = ((ECellView *) ecp_view)->e_table_model;
-
- return popup_func ? popup_func (ecp, event, row, view_col) : FALSE;
-}
-
-/* This redraws the popup cell. Only use this if you know popup_view_col and
- popup_row are valid. */
-void
-e_cell_popup_queue_cell_redraw (ECellPopup *ecp)
-{
- ETableItem *eti = E_TABLE_ITEM (ecp->popup_cell_view->cell_view.e_table_item_view);
-
- e_table_item_redraw_range (eti, ecp->popup_view_col, ecp->popup_row,
- ecp->popup_view_col, ecp->popup_row);
-}
-
-void
-e_cell_popup_set_shown (ECellPopup *ecp,
- gboolean shown)
-{
- ecp->popup_shown = shown;
- e_cell_popup_queue_cell_redraw (ecp);
-}
diff --git a/widgets/table/e-cell-popup.h b/widgets/table/e-cell-popup.h
deleted file mode 100644
index eba0d941df..0000000000
--- a/widgets/table/e-cell-popup.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-cell-popup.h: Popup cell renderer
- * Copyright 2001, Ximian, Inc.
- *
- * Authors:
- * Damon Chaplin <damon@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-/*
- * ECellPopup - an ECell used to support popup selections like a GtkCombo
- * widget. It contains a child ECell, e.g. an ECellText, but when selected it
- * displays an arrow on the right edge which the user can click to show a
- * popup. It will support subclassing or signals so that different types of
- * popup can be provided.
- */
-
-#ifndef _E_CELL_POPUP_H_
-#define _E_CELL_POPUP_H_
-
-#include <libgnomeui/gnome-canvas.h>
-#include <gal/e-table/e-cell.h>
-
-#define E_CELL_POPUP_TYPE (e_cell_popup_get_type ())
-#define E_CELL_POPUP(o) (GTK_CHECK_CAST ((o), E_CELL_POPUP_TYPE, ECellPopup))
-#define E_CELL_POPUP_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_CELL_POPUP_TYPE, ECellPopupClass))
-#define E_IS_CELL_POPUP(o) (GTK_CHECK_TYPE ((o), E_CELL_POPUP_TYPE))
-#define E_IS_CELL_POPUP_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_CELL_POPUP_TYPE))
-
-typedef struct _ECellPopupView ECellPopupView;
-
-typedef struct {
- ECell parent;
-
- ECell *child;
-
- /* This is TRUE if the popup window is shown for the cell being
- edited. While shown we display the arrow indented. */
- gboolean popup_shown;
-
- /* This is TRUE if the popup arrow is shown for the cell being edited.
- This is needed to stop the first click on the cell from popping up
- the popup window. We only popup the window after we have drawn the
- arrow. */
- gboolean popup_arrow_shown;
-
- /* The view in which the popup is shown. */
- ECellPopupView *popup_cell_view;
-
- gint popup_view_col;
- gint popup_row;
- ETableModel *popup_model;
-} ECellPopup;
-
-
-typedef struct {
- ECellClass parent_class;
-
- /* Virtual function for subclasses to override. */
- gint (*popup) (ECellPopup *ecp, GdkEvent *event, int row, int view_col);
-} ECellPopupClass;
-
-
-struct _ECellPopupView {
- ECellView cell_view;
-
- ECellView *child_view;
-};
-
-
-GtkType e_cell_popup_get_type (void);
-ECell *e_cell_popup_new (void);
-
-/* Get and set the child ECell. */
-ECell *e_cell_popup_get_child (ECellPopup *ecp);
-void e_cell_popup_set_child (ECellPopup *ecp,
- ECell *child);
-
-void e_cell_popup_set_shown (ECellPopup *ecp,
- gboolean shown);
-void e_cell_popup_queue_cell_redraw (ECellPopup *ecp);
-
-#endif /* _E_CELL_POPUP_H_ */
diff --git a/widgets/table/e-cell-progress.c b/widgets/table/e-cell-progress.c
deleted file mode 100644
index 41edac7ef3..0000000000
--- a/widgets/table/e-cell-progress.c
+++ /dev/null
@@ -1,450 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-cell-progress.c - Progress display cell object.
- * Copyright 1999-2002, Ximian, Inc.
- * Copyright 2001, 2002, Krisztian Pifko <monsta@users.sourceforge.net>
- *
- * Authors:
- * Krisztian Pifko <monsta@users.sourceforge.net>
- *
- * A cell type for displaying progress bars.
- *
- * Derived from ECellToggle of Miguel de Icaza <miguel@ximian.com>.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <gtk/gtkenums.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtkwindow.h>
-#include <gtk/gtksignal.h>
-#include <gdk/gdkkeysyms.h>
-#include <libgnomeui/gnome-canvas.h>
-#include "e-cell-progress.h"
-#include "gal/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;
-} ECellProgressView;
-
-static ECellClass *parent_class;
-
-static void
-eprog_queue_redraw (ECellProgressView *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 *
-eprog_new_view (ECell *ecell, ETableModel *table_model, void *e_table_item_view)
-{
- ECellProgressView *progress_view = g_new0 (ECellProgressView, 1);
- ETableItem *eti = E_TABLE_ITEM (e_table_item_view);
- GnomeCanvas *canvas = GNOME_CANVAS_ITEM (eti)->canvas;
-
- progress_view->cell_view.ecell = ecell;
- progress_view->cell_view.e_table_model = table_model;
- progress_view->cell_view.e_table_item_view = e_table_item_view;
- progress_view->canvas = canvas;
-
- return (ECellView *) progress_view;
-}
-
-static void
-eprog_kill_view (ECellView *ecell_view)
-{
- g_free (ecell_view);
-}
-
-static void
-eprog_realize (ECellView *ecell_view)
-{
- ECellProgressView *progress_view = (ECellProgressView *) ecell_view;
-
- progress_view->gc = gdk_gc_new (GTK_WIDGET (progress_view->canvas)->window);
-}
-
-/*
- * ECell::unrealize method
- */
-static void
-eprog_unrealize (ECellView *ecv)
-{
- ECellProgressView *progress_view = (ECellProgressView *) ecv;
-
- gdk_gc_unref (progress_view->gc);
- progress_view->gc = NULL;
-}
-
-static void
-eprog_clear (ECellProgress *progress)
-{
- memset(progress->buffer,0x00,progress->width*progress->height*4);
-}
-
-static void
-eprog_draw_border (ECellProgress *progress, guchar red, guchar green, guchar blue)
-{
- gint i, j, w4, p4, pw4, wpb4, hp1;
-
-/*
- * some speedup
- */
- w4=progress->width*4;
- p4=progress->padding*4;
- pw4=w4*progress->padding;
- wpb4=(progress->width-progress->padding-progress->border)*4;
- hp1=(progress->height-progress->padding-1);
-
- for (i=progress->padding*4;i<(progress->width-progress->padding)*4;i+=4){
- for (j=0;j<progress->border;j++){
- progress->buffer[pw4+j*w4+i]=red;
- progress->buffer[pw4+j*w4+i+1]=green;
- progress->buffer[pw4+j*w4+i+2]=blue;
- progress->buffer[pw4+j*w4+i+3]=255;
- progress->buffer[(progress->height-1-progress->padding)*w4-j*w4+i]=red;
- progress->buffer[(progress->height-1-progress->padding)*w4-j*w4+i+1]=green;
- progress->buffer[(progress->height-1-progress->padding)*w4-j*w4+i+2]=blue;
- progress->buffer[(progress->height-1-progress->padding)*w4-j*w4+i+3]=255;
- }
- }
- for (i=progress->padding+progress->border;i<progress->height-progress->padding-progress->border;i++){
- for (j=0;j<4*progress->border;j+=4){
- progress->buffer[p4+i*w4+j]=red;
- progress->buffer[p4+i*w4+j+1]=green;
- progress->buffer[p4+i*w4+j+2]=blue;
- progress->buffer[p4+i*w4+j+3]=255;
- progress->buffer[i*w4+wpb4+j]=red;
- progress->buffer[i*w4+wpb4+j+1]=green;
- progress->buffer[i*w4+wpb4+j+2]=blue;
- progress->buffer[i*w4+wpb4+j+3]=255;
- }
- }
-}
-
-static void
-eprog_draw_bar (ECellProgress *progress, guchar red, guchar green, guchar blue, gint value)
-{
- gint i, j, w;
-
- w=value*(progress->width-2*(progress->padding+progress->border+1))/progress->max;
- for (i=(progress->padding+progress->border+1)*4;i<(progress->padding+progress->border+1+w)*4;i+=4){
- for (j=0;j<progress->height-2*(progress->padding+progress->border+1);j++){
- progress->buffer[(progress->width*(progress->padding+progress->border+1)*4)+j*progress->width*4+i]=red;
- progress->buffer[(progress->width*(progress->padding+progress->border+1)*4)+j*progress->width*4+i+1]=green;
- progress->buffer[(progress->width*(progress->padding+progress->border+1)*4)+j*progress->width*4+i+2]=blue;
- progress->buffer[(progress->width*(progress->padding+progress->border+1)*4)+j*progress->width*4+i+3]=255;
- }
- }
-}
-
-/*
- * ECell::draw method
- */
-static void
-eprog_draw (ECellView *ecell_view, GdkDrawable *drawable,
- int model_col, int view_col, int row, ECellFlags flags,
- int x1, int y1, int x2, int y2)
-{
- ECellProgress *progress = E_CELL_PROGRESS (ecell_view->ecell);
- gboolean selected;
- GdkPixbuf *image;
- int x, y, width, height;
-
- const int value = GPOINTER_TO_INT (
- e_table_model_value_at (ecell_view->e_table_model, model_col, row));
-
- selected = flags & E_CELL_SELECTED;
-
- if ((value > progress->max)||(value < progress->min)){
- g_warning ("Value from the table model is %d, the states we support are [%d..%d]\n",
- value, progress->min, progress->max);
- return;
- }
-
- image = progress->image;
-
- if ((x2 - x1) < progress->width){
- x = x1;
- width = x2 - x1;
- } else {
- x = x1 + ((x2 - x1) - progress->width) / 2;
- width = progress->width;
- }
-
- if ((y2 - y1) < progress->height){
- y = y1;
- height = y2 - y1;
- } else {
- y = y1 + ((y2 - y1) - progress->height) / 2;
- height = progress->height;
- }
-
- eprog_clear(progress);
-
- eprog_draw_border(progress, progress->red, progress->green, progress->blue);
-
- eprog_draw_bar(progress, progress->red, progress->green, progress->blue, value);
-
- gdk_pixbuf_render_to_drawable_alpha (progress->image, drawable,
- 0, 0,
- x, y,
- progress->width, progress->height,
- GDK_PIXBUF_ALPHA_BILEVEL,
- 128,
- GDK_RGB_DITHER_NORMAL,
- x, y);
-}
-
-static void
-eprog_set_value (ECellProgressView *progress_view, int model_col, int view_col, int row, int value)
-{
- ECell *ecell = progress_view->cell_view.ecell;
- ECellProgress *progress = E_CELL_PROGRESS (ecell);
-
- if (value > progress->max){
- value = progress->max;
- }else if (value < progress->min){
- value = progress->min;
- }
- e_table_model_set_value_at (progress_view->cell_view.e_table_model,
- model_col, row, GINT_TO_POINTER (value));
- eprog_queue_redraw (progress_view, view_col, row);
-}
-
-/*
- * ECell::event method
- */
-static gint
-eprog_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row, ECellFlags flags, ECellActions *actions)
-{
- ECellProgressView *progress_view = (ECellProgressView *) ecell_view;
- void *_value = e_table_model_value_at (ecell_view->e_table_model, model_col, row);
- const int value = GPOINTER_TO_INT (_value);
-
-#if 0
- if (!(flags & E_CELL_EDITING))
- return FALSE;
-#endif
-
- switch (event->type){
- case GDK_KEY_PRESS:
- if (event->key.keyval != GDK_space)
- return FALSE;
- /* Fall through */
- case GDK_BUTTON_PRESS:
- if (!e_table_model_is_cell_editable(ecell_view->e_table_model, model_col, row))
- return FALSE;
-
- eprog_set_value (progress_view, model_col, view_col, row, value + 1);
- return TRUE;
-
- default:
- return FALSE;
- }
- return TRUE;
-}
-
-/*
- * ECell::height method
- */
-static int
-eprog_height (ECellView *ecell_view, int model_col, int view_col, int row)
-{
- ECellProgress *progress = E_CELL_PROGRESS (ecell_view->ecell);
-
- return progress->height;
-}
-
-/*
- * ECell::max_width method
- */
-static int
-eprog_max_width (ECellView *ecell_view, int model_col, int view_col)
-{
- ECellProgress *progress = E_CELL_PROGRESS (ecell_view->ecell);
-
- return progress->width;
-}
-
-static void
-eprog_destroy (GtkObject *object)
-{
- ECellProgress *eprog = E_CELL_PROGRESS (object);
-
- gdk_pixbuf_unref (eprog->image);
- g_free (eprog->image);
- g_free (eprog->buffer);
-
- GTK_OBJECT_CLASS (parent_class)->destroy (object);
-}
-
-static void
-e_cell_progress_class_init (GtkObjectClass *object_class)
-{
- ECellClass *ecc = (ECellClass *) object_class;
-
- object_class->destroy = eprog_destroy;
-
- ecc->new_view = eprog_new_view;
- ecc->kill_view = eprog_kill_view;
- ecc->realize = eprog_realize;
- ecc->unrealize = eprog_unrealize;
- ecc->draw = eprog_draw;
- ecc->event = eprog_event;
- ecc->height = eprog_height;
- ecc->max_width = eprog_max_width;
-
- parent_class = gtk_type_class (PARENT_TYPE);
-}
-
-E_MAKE_TYPE(e_cell_progress, "ECellProgress", ECellProgress, e_cell_progress_class_init, NULL, PARENT_TYPE);
-
-/**
- * e_cell_progress_construct:
- * @eprog: a fresh ECellProgress object
- * @padding: number of pixels used as a padding
- * @border: number of pixels used as a border
- * @min: the minimum value
- * @max: the maximum value
- * @width: the width of the progress bar in pixels
- * @height: the height of the progress bar in pixels
- * @red: the red component of the progress bars rgb color
- * @green: the green component of the progress bars rgb color
- * @blue: the blue component of the progress bars rgb color
- *
- * Constructs the @eprog object with the arguments
- */
-void
-e_cell_progress_construct (ECellProgress *eprog, int padding, int border, int min, int max, int width, int height, guchar red, guchar green, guchar blue)
-{
- eprog->padding = padding;
- eprog->border = border;
- eprog->min = min;
- eprog->max = max;
- eprog->red = red;
- eprog->green = green;
- eprog->blue = blue;
-
- eprog->width = (width<((padding+border)*2+5)) ? ((padding+border)*2+5) : width;
- eprog->height = (height<((padding+border)*2+5)) ? ((padding+border)*2+5) : height;
-
- eprog->buffer=g_new(guchar, eprog->width*eprog->height*4);
-
- eprog_clear(eprog);
- eprog_draw_border(eprog, red, green, blue);
-
- eprog->image = gdk_pixbuf_new_from_data (eprog->buffer,GDK_COLORSPACE_RGB, TRUE, 8, eprog->width, eprog->height, eprog->width*4, NULL, NULL);
-}
-
-/**
- * e_cell_progress_new:
- * @min: the minimum value
- * @max: the maximum value
- * @width: the width of the progress bar in pixels
- * @height: the height of the progress bar in pixels
- *
- * Creates a new ECell renderer that can be used to render progress
- * bars displaying the percentage of the current value between min
- * and max.
- *
- * Returns: an ECell object that can be used to render progress cells.
- */
-ECell *
-e_cell_progress_new (int min, int max, int width, int height)
-{
- ECellProgress *eprog = gtk_type_new (e_cell_progress_get_type ());
-
- e_cell_progress_construct (eprog, 1, 1, min, max, (width<9) ? 9 : width, (height<9) ? 9 : height, 0x00, 0x00, 0x00);
-
- return (ECell *) eprog;
-}
-
-/**
- * e_cell_progress_set_padding:
- * @eprog: an ECellProgress object
- * @padding: number of pixels used as a padding
- *
- * Sets the padding around the progress bar in the cell.
- */
-void
-e_cell_progress_set_padding (ECellProgress *eprog, int padding)
-{
- eprog->padding = padding;
-
- eprog->width = (eprog->width<((padding+eprog->border)*2+5)) ? ((padding+eprog->border)*2+5) : eprog->width;
- eprog->height = (eprog->height<((padding+eprog->border)*2+5)) ? ((padding+eprog->border)*2+5) : eprog->height;
-
- g_free (eprog->buffer);
- eprog->buffer=g_new (guchar, eprog->width*eprog->height*4);
-
- eprog_clear (eprog);
- eprog_draw_border (eprog, eprog->red, eprog->green, eprog->blue);
-
- eprog->image = gdk_pixbuf_new_from_data (eprog->buffer,GDK_COLORSPACE_RGB, TRUE, 8, eprog->width, eprog->height, eprog->width*4, NULL, NULL);
-}
-
-/**
- * e_cell_progress_set_border:
- * @eprog: an ECellProgress object
- * @border: number of pixels used as a border
- *
- * Sets the border around the progress bar in the cell.
- */
-void
-e_cell_progress_set_border (ECellProgress *eprog, int border)
-{
- eprog->border = border;
-
- eprog->width = (eprog->width<((eprog->padding+border)*2+5)) ? ((eprog->padding+border)*2+5) : eprog->width;
- eprog->height = (eprog->height<((eprog->padding+border)*2+5)) ? ((eprog->padding+border)*2+5) : eprog->height;
-
- g_free (eprog->buffer);
- eprog->buffer=g_new (guchar, eprog->width*eprog->height*4);
-
- eprog_clear (eprog);
- eprog_draw_border (eprog, eprog->red, eprog->green, eprog->blue);
-
- eprog->image = gdk_pixbuf_new_from_data (eprog->buffer,GDK_COLORSPACE_RGB, TRUE, 8, eprog->width, eprog->height, eprog->width*4, NULL, NULL);
-}
-
-/**
- * e_cell_progress_set_color:
- * @eprog: a fresh ECellProgress object
- * @red: the red component of the progress bars rgb color
- * @green: the green component of the progress bars rgb color
- * @blue: the blue component of the progress bars rgb color
- */
-void
-e_cell_progress_set_color (ECellProgress *eprog, guchar red, guchar green, guchar blue)
-{
- eprog->red = red;
- eprog->green = green;
- eprog->blue = blue;
-
- eprog_clear (eprog);
- eprog_draw_border (eprog, red, green, blue);
-}
diff --git a/widgets/table/e-cell-progress.h b/widgets/table/e-cell-progress.h
deleted file mode 100644
index 4cd09ed0de..0000000000
--- a/widgets/table/e-cell-progress.h
+++ /dev/null
@@ -1,74 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-cell-progress.h - Progress display cell object.
- * Copyright 1999-2002, Ximian, Inc.
- * Copyright 2001, 2002, Krisztian Pifko <monsta@users.sourceforge.net>
- *
- * Authors:
- * Krisztian Pifko <monsta@users.sourceforge.net>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_CELL_PROGRESS_H_
-#define _E_CELL_PROGRESS_H_
-
-#include <libgnomeui/gnome-canvas.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <gal/e-table/e-cell.h>
-
-BEGIN_GNOME_DECLS
-
-#define E_CELL_PROGRESS_TYPE (e_cell_progress_get_type ())
-#define E_CELL_PROGRESS(o) (GTK_CHECK_CAST ((o), E_CELL_PROGRESS_TYPE, ECellProgress))
-#define E_CELL_PROGRESS_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_CELL_PROGRESS_TYPE, ECellProgressClass))
-#define E_IS_CELL_PROGRESS(o) (GTK_CHECK_TYPE ((o), E_CELL_PROGRESS_TYPE))
-#define E_IS_CELL_PROGRESS_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_CELL_PROGRESS_TYPE))
-
-typedef struct {
- ECell parent;
-
- int padding;
- int border;
- int min;
- int max;
- guchar red;
- guchar green;
- guchar blue;
-
- guchar *buffer;
- GdkPixbuf *image;
-
- int width;
- int height;
-} ECellProgress;
-
-typedef struct {
- ECellClass parent_class;
-} ECellProgressClass;
-
-GtkType e_cell_progress_get_type (void);
-ECell *e_cell_progress_new (int min, int max, int width, int height);
-void e_cell_progress_construct (ECellProgress *eprog, int padding, int border,
- int min, int max, int width, int height, guchar red, guchar green, guchar blue);
-void e_cell_progress_set_padding (ECellProgress *eprog, int padding);
-void e_cell_progress_set_border (ECellProgress *eprog, int border);
-void e_cell_progress_set_color (ECellProgress *eprog, guchar red, guchar green, guchar blue);
-
-END_GNOME_DECLS
-
-#endif /* _E_CELL_PROGRESS_H_ */
-
-
diff --git a/widgets/table/e-cell-size.c b/widgets/table/e-cell-size.c
deleted file mode 100644
index e24382a6e5..0000000000
--- a/widgets/table/e-cell-size.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-cell-size.c: Size item for e-table.
- * Copyright 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <sys/time.h>
-#include <unistd.h>
-#include <gal/util/e-util.h>
-#include "e-cell-size.h"
-
-#define PARENT_TYPE e_cell_text_get_type ()
-
-static ECellTextClass *parent_class;
-
-static char *
-ecd_get_text(ECellText *cell, ETableModel *model, int col, int row)
-{
- gint size = GPOINTER_TO_INT(e_table_model_value_at(model, col, row));
- gfloat fsize;
-
- if (size < 1024) {
- return g_strdup_printf ("%d bytes", size);
- } else {
- fsize = ((gfloat) size) / 1024.0;
- if (fsize < 1024.0) {
- return g_strdup_printf ("%d K", (int)fsize);
- } else {
- fsize /= 1024.0;
- return g_strdup_printf ("%.1f MB", fsize);
- }
- }
-}
-
-static void
-ecd_free_text(ECellText *cell, char *text)
-{
- g_free(text);
-}
-
-static void
-e_cell_size_class_init (GtkObjectClass *object_class)
-{
- ECellTextClass *ectc = (ECellTextClass *) object_class;
-
- parent_class = gtk_type_class (PARENT_TYPE);
-
- ectc->get_text = ecd_get_text;
- ectc->free_text = ecd_free_text;
-}
-
-static void
-e_cell_size_init (GtkObject *object)
-{
-}
-
-/**
- * e_cell_size_new:
- * @fontname: font to be used to render on the screen
- * @justify: Justification of the string in the cell.
- *
- * Creates a new ECell renderer that can be used to render file sizes
- * that that come from the model. The value returned from the model
- * is interpreted as being a time_t.
- *
- * The ECellSize object support a large set of properties that can be
- * configured through the Gtk argument system and allows the user to have
- * a finer control of the way the string is displayed. The arguments supported
- * allow the control of strikeout, bold, color and a size filter.
- *
- * The arguments "strikeout_column", "bold_column" and "color_column" set
- * and return an integer that points to a column in the model that controls
- * these settings. So controlling the way things are rendered is achieved
- * by having special columns in the model that will be used to flag whether
- * the size should be rendered with strikeout, or bolded. In the case of
- * the "color_column" argument, the column in the model is expected to have
- * a string that can be parsed by gdk_color_parse().
- *
- * Returns: an ECell object that can be used to render file sizes. */
-ECell *
-e_cell_size_new (const char *fontname, GtkJustification justify)
-{
- ECellSize *ecd = gtk_type_new (e_cell_size_get_type ());
-
- e_cell_text_construct(E_CELL_TEXT(ecd), fontname, justify);
-
- return (ECell *) ecd;
-}
-
-E_MAKE_TYPE(e_cell_size, "ECellSize", ECellSize, e_cell_size_class_init, e_cell_size_init, PARENT_TYPE);
diff --git a/widgets/table/e-cell-size.h b/widgets/table/e-cell-size.h
deleted file mode 100644
index 3316b2a5ff..0000000000
--- a/widgets/table/e-cell-size.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-cell-size.h: Size item for e-table.
- * Copyright 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-#ifndef _E_CELL_SIZE_H_
-#define _E_CELL_SIZE_H_
-
-#include <gal/e-table/e-cell-text.h>
-#include <libgnome/gnome-defs.h>
-
-BEGIN_GNOME_DECLS
-
-#define E_CELL_SIZE_TYPE (e_cell_size_get_type ())
-#define E_CELL_SIZE(o) (GTK_CHECK_CAST ((o), E_CELL_SIZE_TYPE, ECellSize))
-#define E_CELL_SIZE_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_CELL_SIZE_TYPE, ECellSizeClass))
-#define E_IS_CELL_SIZE(o) (GTK_CHECK_TYPE ((o), E_CELL_SIZE_TYPE))
-#define E_IS_CELL_SIZE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_CELL_SIZE_TYPE))
-
-typedef struct {
- ECellText base;
-} ECellSize;
-
-typedef struct {
- ECellTextClass parent_class;
-} ECellSizeClass;
-
-GtkType e_cell_size_get_type (void);
-ECell *e_cell_size_new (const char *fontname, GtkJustification justify);
-
-END_GNOME_DECLS
-
-#endif /* _E_CELL_SIZE_H_ */
diff --git a/widgets/table/e-cell-spin-button.c b/widgets/table/e-cell-spin-button.c
deleted file mode 100644
index 4cbd9f63a8..0000000000
--- a/widgets/table/e-cell-spin-button.c
+++ /dev/null
@@ -1,674 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-cell-spin-button.c: Spin button item for e-table.
- * Copyright 2001, CodeFactory AB
- * Copyright 2001, Mikael Hallendal <micke@codefactory.se>
- *
- * Authors:
- * Mikael Hallendal <micke@codefactory.se>
- *
- * Celltype for drawing a spinbutton in a cell.
- *
- * Used ECellPopup by Damon Chaplin <damon@ximian.com> as base for
- * buttondrawings.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <gtk/gtksignal.h>
-#include <gal/e-table/e-table-item.h>
-#include <gal/e-table/e-table-model.h>
-#include <gal/e-table/e-cell-float.h>
-#include <gal/e-table/e-cell-number.h>
-#include <gal/util/e-util.h>
-#include "e-cell-spin-button.h"
-
-#define E_CELL_SPIN_BUTTON_ARROW_WIDTH 16
-#define PARENT_TYPE e_cell_get_type ()
-
-static void e_cell_spin_button_class_init (GtkObjectClass *klass);
-static void e_cell_spin_button_init (GtkObject *object);
-
-static void ecsb_destroy (GtkObject *object);
-
-/* ECell Functions */
-static ECellView * ecsb_new_view (ECell *ecell,
- ETableModel *etm,
- void *eti_view);
-static void ecsb_realize (ECellView *ecv);
-static void ecsb_kill_view (ECellView *ecv);
-static void ecsb_unrealize (ECellView *ecv);
-static void ecsb_draw (ECellView *ecv,
- GdkDrawable *drawable,
- int model_col,
- int view_col,
- int row,
- ECellFlags flags,
- int x1,
- int y1,
- int x2,
- int y2);
-
-static gint ecsb_event (ECellView *ecv,
- GdkEvent *event,
- int model_col,
- int view_col,
- int row,
- ECellFlags flags,
- ECellActions *actions);
-
-static gint ecsb_height (ECellView *ecv,
- int model_col,
- int view_col,
- int row);
-
-static void * ecsb_enter_edit (ECellView *ecv,
- int model_col,
- int view_col,
- int row);
-
-static void ecsb_leave_edit (ECellView *ecv,
- int model_col,
- int view_col,
- int row,
- void *context);
-static void ecsb_focus (ECellView *ecell_view,
- int model_col,
- int view_col,
- int row,
- int x1,
- int y1,
- int x2,
- int y2);
-static void ecsb_unfocus (ECellView *ecell_view);
-
-static void ecsb_show_tooltip (ECellView *ecv,
- int model_col,
- int view_col,
- int row,
- int col_width,
- ETableTooltip *tooltip);
-
-typedef struct {
- ECellView cell_view;
-
- ECellView *child_view;
-} ECellSpinButtonView;
-
-enum {
- STEP,
- LAST_SIGNAL
-};
-
-static gint signals[LAST_SIGNAL] = { 0 };
-static ECell *parent_class;
-
-static void
-e_cell_spin_button_class_init (GtkObjectClass *klass)
-{
- ECellClass *ecc = (ECellClass *) klass;
- ECellSpinButtonClass *ecsbc = (ECellSpinButtonClass *) klass;
-
- klass->destroy = ecsb_destroy;
-
- ecc->realize = ecsb_realize;
- ecc->unrealize = ecsb_unrealize;
- ecc->new_view = ecsb_new_view;
- ecc->kill_view = ecsb_kill_view;
- ecc->draw = ecsb_draw;
- ecc->event = ecsb_event;
- ecc->height = ecsb_height;
- ecc->enter_edit = ecsb_enter_edit;
- ecc->leave_edit = ecsb_leave_edit;
- ecc->focus = ecsb_focus;
- ecc->unfocus = ecsb_unfocus; ecc->print = NULL;
- ecc->print_height = NULL;
- ecc->max_width = NULL;
- ecc->show_tooltip = ecsb_show_tooltip;
-
- ecsbc->step = NULL;
-
- parent_class = gtk_type_class (E_CELL_TYPE);
-
- signals[STEP] =
- gtk_signal_new ("step",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (klass),
- GTK_SIGNAL_OFFSET (ECellSpinButtonClass, step),
- e_marshal_NONE__POINTER_INT_INT_INT,
- GTK_TYPE_NONE,
- 4, GTK_TYPE_POINTER, GTK_TYPE_INT,
- GTK_TYPE_INT, GTK_TYPE_INT);
-
- E_OBJECT_CLASS_ADD_SIGNALS (klass, signals, LAST_SIGNAL);
-}
-
-static void
-e_cell_spin_button_init (GtkObject *object)
-{
- ECellSpinButton *ecsb;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (M_IS_CELL_SPIN_BUTTON (object));
-
- ecsb = E_CELL_SPIN_BUTTON (object);
-
- ecsb->up_pressed = FALSE;
- ecsb->down_pressed = FALSE;
-}
-
-static ECellView *
-ecsb_new_view (ECell *ecell,
- ETableModel *etm,
- void *eti_view)
-{
- ECellSpinButton *ecsb = E_CELL_SPIN_BUTTON (ecell);
- ECellSpinButtonView *ecsb_view;
-
- g_return_val_if_fail (ecsb->child != NULL, NULL);
-
- ecsb_view = g_new0 (ECellSpinButtonView, 1);
-
- ecsb_view->cell_view.ecell = ecell;
- ecsb_view->cell_view.e_table_model = etm;
- ecsb_view->cell_view.e_table_item_view = eti_view;
-
- ecsb_view->child_view = e_cell_new_view (ecsb->child, etm, eti_view);
-
- return (ECellView *) ecsb_view;
-}
-
-static void
-ecsb_realize (ECellView *ecv)
-{
- ECellSpinButtonView *ecsb_view;
-
- g_return_if_fail (ecv != NULL);
-
- ecsb_view = (ECellSpinButtonView *) ecv;
-
- e_cell_realize (ecsb_view->child_view);
-}
-
-static void
-ecsb_kill_view (ECellView *ecv)
-{
- ECellSpinButtonView *ecsb_view;
-
- g_return_if_fail (ecv != NULL);
-
- ecsb_view = (ECellSpinButtonView *) ecv;
-
- if (ecsb_view->child_view) {
- e_cell_kill_view (ecsb_view->child_view);
- }
-
- g_free (ecsb_view);
-}
-
-static void
-ecsb_unrealize (ECellView *ecv)
-{
- ECellSpinButtonView *ecsb_view;
-
- g_return_if_fail (ecv != NULL);
-
- ecsb_view = (ECellSpinButtonView *) ecv;
-
- e_cell_unrealize (ecsb_view->child_view);
-}
-
-static void
-ecsb_draw (ECellView *ecv,
- GdkDrawable *drawable,
- int model_col,
- int view_col,
- int row,
- ECellFlags flags,
- int x1,
- int y1,
- int x2,
- int y2)
-{
- ECellSpinButton *ecsb;
- ECellSpinButtonView *ecsb_view;
- ETableItem *eti;
- GtkWidget *canvas;
- GtkShadowType shadow = GTK_SHADOW_OUT;
- GdkRectangle rect;
-
- g_return_if_fail (ecv != NULL);
-
- ecsb_view = (ECellSpinButtonView *) ecv;
- ecsb = E_CELL_SPIN_BUTTON (ecsb_view->cell_view.ecell);
-
- eti = E_TABLE_ITEM (ecsb_view->cell_view.e_table_item_view);
- canvas = GTK_WIDGET (GNOME_CANVAS_ITEM (eti)->canvas);
-
- if (eti->editing_col == view_col &&
- eti->editing_row == row) {
-
- /* Draw child (Whats shown under the buttons) */
- e_cell_draw (ecsb_view->child_view,
- drawable, model_col, view_col,
- row, flags,
- x1, y1,
- x2 - E_CELL_SPIN_BUTTON_ARROW_WIDTH, y2);
-
- /* Draw down-arrow */
- rect.x = x2 - E_CELL_SPIN_BUTTON_ARROW_WIDTH;
- rect.y = y1 + (y2 - y1) / 2;
- rect.width = E_CELL_SPIN_BUTTON_ARROW_WIDTH;
- rect.height = (y2 - y1) / 2;
-
- if (ecsb->down_pressed) {
- shadow = GTK_SHADOW_IN;
- } else {
- shadow = GTK_SHADOW_OUT;
- }
-
- gtk_paint_box (canvas->style, drawable,
- GTK_STATE_NORMAL, shadow,
- &rect, canvas, "ecellspinbutton_down",
- rect.x, rect.y, rect.width, rect.height);
-
- gtk_paint_arrow (canvas->style, drawable,
- GTK_STATE_NORMAL, shadow,
- &rect, canvas, NULL,
- GTK_ARROW_DOWN, TRUE,
- rect.x,
- rect.y,
- rect.width,
- rect.height);
-
- /* Draw up-arrow */
- rect.y = y1;
-
- if (ecsb->up_pressed) {
- shadow = GTK_SHADOW_IN;
- } else {
- shadow = GTK_SHADOW_OUT;
- }
-
- gtk_paint_box (canvas->style, drawable,
- GTK_STATE_NORMAL, shadow,
- &rect, canvas, "ecellspinbutton_up",
- rect.x, rect.y, rect.width, rect.height);
-
- gtk_paint_arrow (canvas->style, drawable,
- GTK_STATE_NORMAL, shadow,
- &rect, canvas, NULL,
- GTK_ARROW_UP, TRUE,
- rect.x,
- rect.y,
- rect.width,
- rect.height);
- } else {
- /* Draw child */
- e_cell_draw (ecsb_view->child_view,
- drawable, model_col, view_col,
- row, flags,
- x1, y1,
- x2, y2);
- }
-}
-
-static gint
-ecsb_event (ECellView *ecv,
- GdkEvent *event,
- int model_col,
- int view_col,
- int row,
- ECellFlags flags,
- ECellActions *actions)
-{
- ECellSpinButton *ecsb;
- ECellSpinButtonClass *ecsb_class;
- ECellSpinButtonView *ecsb_view;
- ETableItem *eti;
- gint height, width;
-
- g_return_val_if_fail (ecv != NULL, FALSE);
-
- ecsb_view = (ECellSpinButtonView *) ecv;
- ecsb = E_CELL_SPIN_BUTTON (ecsb_view->cell_view.ecell);
- ecsb_class = E_CELL_SPIN_BUTTON_CLASS (GTK_OBJECT(ecsb)->klass);
- eti = E_TABLE_ITEM (ecsb_view->cell_view.e_table_item_view);
-
- switch (event->type) {
- case GDK_BUTTON_PRESS:
- if (eti->editing_col == view_col &&
- eti->editing_row == row) {
- width = e_table_header_col_diff (eti->header,
- view_col,
- view_col + 1);
- height = e_table_item_row_diff (eti, row, row + 1);
-
- /* Check if inside a button */
- if (event->button.x >= width - E_CELL_SPIN_BUTTON_ARROW_WIDTH) {
- /* Yep, which one? */
- if (event->button.y <= height / 2) {
- ecsb->up_pressed = TRUE;
- gtk_signal_emit (GTK_OBJECT(ecsb),
- signals[STEP],
- ecv,
- STEP_UP,
- view_col,
- row);
- } else {
- ecsb->down_pressed = TRUE;
- gtk_signal_emit (GTK_OBJECT(ecsb),
- signals[STEP],
- ecv,
- STEP_DOWN,
- view_col,
- row);
- }
-
- e_table_item_redraw_range (eti,
- view_col,
- row,
- view_col,
- row);
-
- }
- }
-
- break;
- case GDK_BUTTON_RELEASE:
- ecsb->up_pressed = FALSE;
- ecsb->down_pressed = FALSE;
- e_table_item_redraw_range (eti,
- view_col,
- row,
- view_col,
- row);
- break;
- case GDK_KEY_PRESS:
- break;
- default:
- break;
- }
-
- return e_cell_event (ecsb_view->child_view, event, model_col,
- view_col, row, flags, actions);
-}
-
-static gint
-ecsb_height (ECellView *ecv,
- int model_col,
- int view_col,
- int row)
-{
- ECellSpinButtonView *ecsb_view;
-
- g_return_val_if_fail (ecv != NULL, -1);
-
- ecsb_view = (ECellSpinButtonView *) ecv;
-
- return e_cell_height (ecsb_view->child_view, model_col, view_col, row);
-}
-
-static void *
-ecsb_enter_edit (ECellView *ecv,
- int model_col,
- int view_col,
- int row)
-{
- ECellSpinButtonView *ecsb_view;
-
- g_return_val_if_fail (ecv != NULL, NULL);
-
- ecsb_view = (ECellSpinButtonView *) ecv;
-
- return e_cell_enter_edit (ecsb_view->child_view, model_col,
- view_col, row);
-}
-
-
-static void
-ecsb_leave_edit (ECellView *ecv,
- int model_col,
- int view_col,
- int row,
- void *context)
-{
- ECellSpinButtonView *ecsb_view;
-
- g_return_if_fail (ecv != NULL);
-
- ecsb_view = (ECellSpinButtonView *) ecv;
-
- e_cell_leave_edit (ecsb_view->child_view, model_col, view_col,
- row, context);
-}
-
-static void
-ecsb_focus (ECellView *ecell_view,
- int model_col,
- int view_col,
- int row,
- int x1,
- int y1,
- int x2,
- int y2)
-{
- ECellClass *klass;
- ECellSpinButtonView *ecsb_view;
-
- ecsb_view = (ECellSpinButtonView *) ecell_view;
-
- klass = E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass);
-
- if (klass->focus) {
- klass->focus (ecell_view, model_col, view_col, row,
- x1, y1, x2, y2);
- }
-}
-
-static void
-ecsb_unfocus (ECellView *ecell_view)
-{
- ECellClass *klass;
- ECellSpinButtonView *ecsb_view;
-
- ecsb_view = (ECellSpinButtonView *) ecell_view;
- klass = E_CELL_CLASS (GTK_OBJECT (ecell_view->ecell)->klass);
-
- if (klass->unfocus) {
- klass->unfocus (ecell_view);
- }
-
-}
-
-static void
-ecsb_show_tooltip (ECellView *ecv,
- int model_col,
- int view_col,
- int row,
- int col_width,
- ETableTooltip *tooltip)
-{
- ECellSpinButtonView *ecsb_view;
-
- g_return_if_fail (ecv != NULL);
-
- ecsb_view = (ECellSpinButtonView *) ecv;
-
- e_cell_show_tooltip (ecsb_view->child_view, model_col, view_col,
- row, col_width, tooltip);
-}
-
-static void
-ecsb_destroy (GtkObject *object)
-{
- ECellSpinButton *mcsp;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (M_IS_CELL_SPIN_BUTTON (object));
-
- mcsp = E_CELL_SPIN_BUTTON (object);
-
- GTK_OBJECT_CLASS (parent_class)->destroy (object);
-}
-
-ECell *
-e_cell_spin_button_new (gint min,
- gint max,
- gint step,
- ECell *child_cell)
-{
- ECellSpinButton *ecsb;
-
- ecsb = gtk_type_new (E_CELL_SPIN_BUTTON_TYPE);
-
- if (!child_cell) {
- child_cell = e_cell_number_new (NULL,
- GTK_JUSTIFY_LEFT);
-
- gtk_signal_connect (GTK_OBJECT (ecsb), "step",
- e_cell_spin_button_step,
- NULL);
- }
-
- ecsb->child = child_cell;
- ecsb->min.i = min;
- ecsb->max.i = max;
- ecsb->step.i = step;
-
- return E_CELL (ecsb);
-}
-
-ECell *
-e_cell_spin_button_new_float (gfloat min,
- gfloat max,
- gfloat step,
- ECell *child_cell)
-{
- ECellSpinButton *ecsb;
-
- ecsb = gtk_type_new (E_CELL_SPIN_BUTTON_TYPE);
-
- if (!child_cell) {
- child_cell = e_cell_float_new (NULL, GTK_JUSTIFY_LEFT);
- gtk_signal_connect (GTK_OBJECT (ecsb), "step",
- e_cell_spin_button_step_float,
- NULL);
- }
-
- ecsb->child = child_cell;
- ecsb->min.f = min;
- ecsb->max.f = max;
- ecsb->step.f = step;
-
- return E_CELL (ecsb);
-}
-
-void
-e_cell_spin_button_step (ECellSpinButton *ecsb,
- ECellView *ecv,
- ECellSpinButtonStep direction,
- gint col,
- gint row)
-{
- ECellSpinButtonView *ecsb_view;
-
- ETableModel *etm;
- gint value;
- gint new_value;
- gchar *str_value;
-
- g_return_if_fail (ecsb != NULL);
- g_return_if_fail (M_IS_CELL_SPIN_BUTTON (ecsb));
- g_return_if_fail (ecv != NULL);
-
- ecsb_view = (ECellSpinButtonView *) ecv;
- etm = ecsb_view->cell_view.e_table_model;
-
- value = GPOINTER_TO_INT (e_table_model_value_at (etm, col, row));
- new_value = value;
-
- switch (direction) {
- case STEP_UP:
- new_value = CLAMP (value + ecsb->step.i,
- ecsb->min.i, ecsb->max.i);
- break;
- case STEP_DOWN:
- new_value = CLAMP (value - ecsb->step.i,
- ecsb->min.i, ecsb->max.i);
- break;
- default:
- break;
- };
-
- str_value = g_strdup_printf ("%d", new_value);
-
- e_table_model_set_value_at (etm, col, row, str_value);
-
- g_free (str_value);
-}
-
-void
-e_cell_spin_button_step_float (ECellSpinButton *ecsb,
- ECellView *ecv,
- ECellSpinButtonStep direction,
- gint col,
- gint row)
-{
- ECellSpinButtonView *ecsb_view;
-
- ETableModel *etm;
- gfloat value;
- gfloat new_value;
- gchar *str_value;
-
- g_return_if_fail (ecsb != NULL);
- g_return_if_fail (M_IS_CELL_SPIN_BUTTON (ecsb));
- g_return_if_fail (ecv != NULL);
-
- ecsb_view = (ECellSpinButtonView *) ecv;
- etm = ecsb_view->cell_view.e_table_model;
-
- value = *(gfloat *) e_table_model_value_at (etm, col, row);
-
- switch (direction) {
- case STEP_UP:
- new_value = CLAMP (value + ecsb->step.f,
- ecsb->min.f, ecsb->max.f);
- break;
- case STEP_DOWN:
- new_value = CLAMP (value - ecsb->step.f,
- ecsb->min.f, ecsb->max.f);
- break;
- default:
- new_value = value;
- break;
- };
-
- str_value = g_strdup_printf ("%f", new_value);
-
- e_table_model_set_value_at (etm, col, row, str_value);
-
- g_free (str_value);
-}
-
-E_MAKE_TYPE (e_cell_spin_button, "ECellSpinButton", ECellSpinButton,
- e_cell_spin_button_class_init, e_cell_spin_button_init,
- PARENT_TYPE);
-
diff --git a/widgets/table/e-cell-spin-button.h b/widgets/table/e-cell-spin-button.h
deleted file mode 100644
index 8ffaab09f1..0000000000
--- a/widgets/table/e-cell-spin-button.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-cell-spin-button.h: Spin button item for e-table.
- * Copyright 2001, CodeFactory AB
- * Copyright 2001, Mikael Hallendal <micke@codefactory.se>
- *
- * Authors:
- * Mikael Hallendal <micke@codefactory.se>
- *
- * Celltype for drawing a spinbutton in a cell.
- *
- * Used ECellPopup by Damon Chaplin <damon@ximian.com> as base for
- * buttondrawings.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef __E_CELL_SPIN_BUTTON_H__
-#define __E_CELL_SPIN_BUTTON_H__
-
-#include <glib.h>
-#include <gtk/gtktypeutils.h>
-#include <gal/e-table/e-cell.h>
-
-#define E_CELL_SPIN_BUTTON_TYPE (e_cell_spin_button_get_type ())
-#define E_CELL_SPIN_BUTTON(o) (GTK_CHECK_CAST ((o), E_CELL_SPIN_BUTTON_TYPE, ECellSpinButton))
-#define E_CELL_SPIN_BUTTON_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_CELL_SPIN_BUTTON_TYPE, ECellSpinButtonClass))
-#define M_IS_CELL_SPIN_BUTTON(o) (GTK_CHECK_TYPE ((o), E_CELL_SPIN_BUTTON_TYPE))
-#define M_IS_CELL_SPIN_BUTTON_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_CELL_SPIN_BUTTON_TYPE))
-
-typedef union {
- gint i;
- gfloat f;
-} ECellSpinButtonData;
-
-typedef enum {
- STEP_UP,
- STEP_DOWN
-} ECellSpinButtonStep;
-
-typedef struct {
- ECell parent;
-
- ECell *child;
-
- ECellSpinButtonData min;
- ECellSpinButtonData max;
- ECellSpinButtonData step;
-
- gboolean up_pressed;
- gboolean down_pressed;
-
-} ECellSpinButton;
-
-typedef struct {
- ECellClass parent_class;
-
- /* Functions */
- void (*step) (ECellSpinButton *mcsb,
- ECellView *ecv,
- ECellSpinButtonStep direction,
- gint col,
- gint row);
-} ECellSpinButtonClass;
-
-GtkType e_cell_spin_button_get_type (void);
-ECell * e_cell_spin_button_new (gint min,
- gint max,
- gint step,
- ECell *child_cell);
-
-ECell * e_cell_spin_button_new_float (gfloat min,
- gfloat max,
- gfloat step,
- ECell *child_cell);
-
-
-void e_cell_spin_button_step (ECellSpinButton *mcsb,
- ECellView *ecv,
- ECellSpinButtonStep direction,
- gint col,
- gint row);
-
-void e_cell_spin_button_step_float (ECellSpinButton *mcsb,
- ECellView *ecv,
- ECellSpinButtonStep direction,
- gint col,
- gint row);
-
-#endif /* __E_CELL_SPIN_BUTTON__ */
-
diff --git a/widgets/table/e-cell-text.c b/widgets/table/e-cell-text.c
deleted file mode 100644
index 0d89b28b87..0000000000
--- a/widgets/table/e-cell-text.c
+++ /dev/null
@@ -1,2670 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-cell-text.c: Text cell renderer.
- * Copyright 1999, 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Miguel de Icaza <miguel@ximian.com>
- * Chris Lahey <clahey@ximian.com>
- *
- * A lot 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 <federico@nuclecu.unam.mx>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <stdio.h>
-#include <ctype.h>
-#include <math.h>
-#include <string.h>
-#include <gdk/gdkx.h> /* for BlackPixel */
-#include <gtk/gtkenums.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtkwindow.h>
-#include <gtk/gtkinvisible.h>
-#include <gtk/gtksignal.h>
-#include <gdk/gdkkeysyms.h>
-#include <gtk/gtkwidget.h>
-#include <libgnomeui/gnome-canvas.h>
-#include <libgnomeui/gnome-canvas-rect-ellipse.h>
-#include "e-cell-text.h"
-#include "gal/util/e-util.h"
-#include "gal/widgets/e-canvas.h"
-#include "gal/widgets/e-font.h"
-#include "gal/widgets/e-unicode.h"
-#include "e-table-item.h"
-#include "gal/util/e-text-event-processor.h"
-#include "gal/e-text/e-text.h"
-#include "gal/util/e-text-event-processor-emacs-like.h"
-#include "e-table-tooltip.h"
-
-#define d(x)
-
-#if d(!)0
-#define e_table_item_leave_edit_(x) (e_table_item_leave_edit((x)), g_print ("%s: e_table_item_leave_edit\n", __FUNCTION__))
-#else
-#define e_table_item_leave_edit_(x) (e_table_item_leave_edit((x)))
-#endif
-
-#define ECT_CLASS(c) (E_CELL_TEXT_CLASS(GTK_OBJECT((c))->klass))
-
-/* This defines a line of text */
-struct line {
- char *text; /* Line's text UTF-8, it is a pointer into the text->text string */
- int length; /* Line's length in BYTES */
- int width; /* Line's width in pixels */
- int ellipsis_length; /* Length before adding ellipsis in BYTES */
-};
-
-/* Object argument IDs */
-enum {
- ARG_0,
-
- ARG_STRIKEOUT_COLUMN,
- ARG_BOLD_COLUMN,
- ARG_COLOR_COLUMN,
- ARG_EDITABLE,
- ARG_BG_COLOR_COLUMN
-};
-
-
-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;
- EFont *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[2]; /* The width of the ellipsis. */
-
-} ECellTextView;
-
-typedef struct _CurrentCell{
- ECellTextView *text_view;
- int width;
- char *text;
- int model_col, view_col, row;
- ECellTextLineBreaks *breaks;
- EFontStyle style;
-} 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 - IN BYTES */
- int selection_end; /* End of selection - IN BYTES */
- 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 in BYTES */
- gchar *clipboard_selection; /* Clipboard selection text */
- gint clipboard_length; /* Clipboard selection text length in BYTES */
-
- guint pointer_in : 1;
- guint default_cursor_shown : 1;
-
- ECellActions actions;
-};
-
-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, char *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 int number_of_lines (char *text);
-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 unbuild_current_cell (CurrentCell *cell);
-static void calc_ellipsis (ECellTextView *text_view);
-static void ect_free_color (gchar *color_spec, GdkColor *color, GdkColormap *colormap);
-static GdkColor* e_cell_text_get_color (ECellTextView *cell_view, gchar *color_spec);
-
-static ECellClass *parent_class;
-
-char *
-e_cell_text_get_text (ECellText *cell, ETableModel *model, int col, int row)
-{
- if (ECT_CLASS(cell)->get_text)
- return ECT_CLASS(cell)->get_text (cell, model, col, row);
- else
- return NULL;
-}
-
-void
-e_cell_text_free_text (ECellText *cell, char *text)
-{
- if (ECT_CLASS(cell)->free_text)
- ECT_CLASS(cell)->free_text (cell, text);
-}
-
-void
-e_cell_text_set_value (ECellText *cell, ETableModel *model, int col, int row,
- const char *text)
-{
- if (ECT_CLASS(cell)->set_value)
- ECT_CLASS(cell)->set_value (cell, model, col, row, text);
-}
-
-static char *
-ect_real_get_text (ECellText *cell, ETableModel *model, int col, int row)
-{
- return e_table_model_value_at(model, col, row);
-}
-
-static void
-ect_real_free_text (ECellText *cell, char *text)
-{
-}
-
-/* This is the default method for setting the ETableModel value based on
- the text in the ECellText. This simply uses the text as it is - it assumes
- the value in the model is a char*. Subclasses may parse the text into
- data structures to pass to the model. */
-static void
-ect_real_set_value (ECellText *cell, ETableModel *model, int col, int row,
- const char *text)
-{
- e_table_model_set_value_at (model, col, row, text);
-}
-
-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);
-}
-
-/*
- * Shuts down the editing process
- */
-static void
-ect_stop_editing (ECellTextView *text_view, gboolean commit)
-{
- CellEdit *edit = text_view->edit;
- int row, view_col, model_col;
- char *old_text, *text;
- CurrentCell *cell = (CurrentCell *) text_view->edit;
-
- if (!edit)
- return;
-
- row = cell->row;
- view_col = cell->view_col;
- model_col = cell->model_col;
-
- old_text = edit->old_text;
- text = cell->text;
- 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;
- if (commit) {
- /*
- * Accept the currently edited text. if it's the same as what's in the cell, do nothing.
- */
- ECellView *ecell_view = (ECellView *) text_view;
- ECellText *ect = (ECellText *) ecell_view->ecell;
-
- if (strcmp (old_text, text)) {
- e_cell_text_set_value (ect, ecell_view->e_table_model,
- model_col, row, text);
- }
- }
- g_free (text);
- g_free (old_text);
-
- ect_queue_redraw (text_view, view_col, row);
-}
-
-/*
- * Cancels the edits
- */
-static void
-ect_cancel_edit (ECellTextView *text_view)
-{
- ect_stop_editing (text_view, FALSE);
- e_table_item_leave_edit_ (text_view->cell_view.e_table_item_view);
-}
-
-/*
- * ECell::new_view method
- */
-static ECellView *
-ect_new_view (ECell *ecell, ETableModel *table_model, void *e_table_item_view)
-{
- 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;
-
- 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;
- ECellText *ect = (ECellText *) ecell_view->ecell;
-
- text_view->gc = gdk_gc_new (GTK_WIDGET (text_view->canvas)->window);
-
- text_view->i_cursor = gdk_cursor_new (GDK_XTERM);
-
- if (ect->font_name){
- text_view->font = e_font_from_gdk_name (ect->font_name);
- }
- if (!text_view->font){
- gdk_font_ref (GTK_WIDGET (text_view->canvas)->style->font);
- text_view->font = e_font_from_gdk_font (GTK_WIDGET (text_view->canvas)->style->font);
- }
-
- 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;
- ECellText *ect = (ECellText*) ecv->ecell;
- GdkColormap *colormap;
-
- gdk_gc_unref (text_view->gc);
- text_view->gc = NULL;
-
- if (text_view->edit){
- ect_cancel_edit (text_view);
- }
-
- if (text_view->font)
- e_font_unref (text_view->font);
- text_view->font = NULL;
-
- if (text_view->stipple)
- gdk_bitmap_unref (text_view->stipple);
-
- gdk_cursor_destroy (text_view->i_cursor);
-
- if (ect->colors) {
- colormap = gtk_widget_get_colormap (GTK_WIDGET (text_view->canvas));
- g_hash_table_foreach (ect->colors, (GHFunc) ect_free_color,
- colormap);
- g_hash_table_destroy (ect->colors);
- ect->colors = NULL;
- }
-
- if (parent_class->unrealize)
- (* parent_class->unrealize) (ecv);
-}
-
-static void
-ect_free_color (gchar *color_spec, GdkColor *color, GdkColormap *colormap)
-{
-
- g_free (color_spec);
-
- /* This frees the color. Note we don't free it if it is the special
- value. */
- if (color != (GdkColor*) 1) {
- gdk_colors_free (colormap, &color->pixel, 1, 0);
-
- /* This frees the memory for the GdkColor. */
- gdk_color_free (color);
- }
-}
-
-static void
-set_style(ECellView *ecell_view, CurrentCell *cell, int row)
-{
- EFontStyle style = E_FONT_PLAIN;
- ECellText *ect = E_CELL_TEXT (ecell_view->ecell);
-
- if (ect->bold_column >= 0 && e_table_model_value_at(ecell_view->e_table_model, ect->bold_column, row))
- style = E_FONT_BOLD;
-
- cell->style = style;
-}
-
-/*
- * ECell::draw method
- */
-static void
-ect_draw (ECellView *ecell_view, GdkDrawable *drawable,
- int model_col, int view_col, int row, ECellFlags flags,
- 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;
- EFont *font = text_view->font;
- const int height = e_font_height (text_view->font);
- CellEdit *edit = text_view->edit;
- gboolean edit_display = FALSE;
- ECellTextLineBreaks *linebreaks;
- GdkColor *foreground, *cell_foreground, *cursor_color;
- gchar *color_spec;
- gboolean selected;
- EFontStyle style = E_FONT_PLAIN;
-
- selected = flags & E_CELL_SELECTED;
-
- 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 = &rect;
-
- if (selected){
- if (flags & E_CELL_FOCUSED)
- foreground = &canvas->style->text [GTK_STATE_SELECTED];
- else
- foreground = &canvas->style->text [GTK_STATE_ACTIVE];
- } else {
- foreground = &canvas->style->text [GTK_STATE_NORMAL];
- }
-
- cursor_color = foreground;
-
- if (ect->color_column != -1 && ! selected) {
- color_spec = e_table_model_value_at (ecell_view->e_table_model,
- ect->color_column, row);
- cell_foreground = e_cell_text_get_color (text_view,
- color_spec);
- if (cell_foreground)
- foreground = cell_foreground;
- }
-
- gdk_gc_set_foreground (text_view->gc, foreground);
-
- 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 = &rect;
-
- if (edit_display){
- CellEdit *edit = text_view->edit;
- CurrentCell *cell = CURRENT_CELL(edit);
-
- set_style(ecell_view, cell, row);
-
- style = cell->style;
-
- cell->width = x2 - x1;
-
- split_into_lines (cell);
-
- linebreaks = cell->breaks;
-
- lines = linebreaks->lines;
- ypos = get_line_ypos (cell, lines);
- ypos += e_font_ascent (text_view->font);
- ypos -= edit->yofs_edit;
-
- for (i = 0; i < linebreaks->num_lines; i++) {
- xpos = get_line_xpos (cell, lines);
- xpos -= edit->xofs_edit;
-
- /* start_char, end_char, sel_start and sel_end are IN BYTES */
-
- 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 + e_font_utf8_text_width (font, style, lines->text, sel_start - start_char);
- sel_rect.y = ypos + y1 - e_font_ascent (font);
- sel_rect.width = e_font_utf8_text_width (font, style,
- 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);
-
- e_font_draw_utf8_text (drawable, font, style, text_view->gc, xpos + x1, ypos + y1,
- lines->text,
- sel_start - start_char);
- e_font_draw_utf8_text (drawable, font, style, fg_gc,
- xpos + x1 + e_font_utf8_text_width (font, style, lines->text, sel_start - start_char),
- ypos + y1,
- lines->text + sel_start - start_char,
- sel_end - sel_start);
- e_font_draw_utf8_text (drawable, font, style, text_view->gc,
- xpos + x1 + e_font_utf8_text_width (font, style, lines->text, sel_end - start_char),
- ypos + y1,
- lines->text + sel_end - start_char,
- end_char - sel_end);
- } else {
- e_font_draw_utf8_text (drawable, font, style, 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_gc_set_foreground (text_view->gc, cursor_color);
- gdk_draw_rectangle (drawable,
- text_view->gc,
- TRUE,
- xpos + x1 + e_font_utf8_text_width (font, style, lines->text, sel_start - start_char),
- ypos + y1 - e_font_ascent (font),
- 1,
- height);
- }
- if (ect->strikeout_column >= 0 && e_table_model_value_at(ecell_view->e_table_model, ect->strikeout_column, row)) {
- gdk_draw_rectangle (drawable,
- text_view->gc,
- TRUE,
- x1, ypos + y1 - (e_font_ascent (font) / 2),
- x2 - x1,
- 1);
- }
- ypos += height;
- lines ++;
- }
- unref_lines (cell);
- } else {
-
- ECellTextLineBreaks *linebreaks;
- CurrentCell cell;
- build_current_cell (&cell, text_view, model_col, view_col, row);
-
- set_style(ecell_view, &cell, row);
-
- style = cell.style;
-
- cell.width = x2 - x1;
-
- split_into_lines (&cell);
-
- linebreaks = cell.breaks;
- lines = linebreaks->lines;
- ypos = get_line_ypos (&cell, lines);
- ypos += e_font_ascent (text_view->font);
-
-
- for (i = 0; i < linebreaks->num_lines; i++) {
- xpos = get_line_xpos (&cell, lines);
- if (ect->use_ellipsis && lines->ellipsis_length < lines->length) {
- e_font_draw_utf8_text (drawable, font, style, text_view->gc,
- xpos + x1, ypos + y1,
- lines->text,
- lines->ellipsis_length);
- e_font_draw_utf8_text (drawable, font, style, text_view->gc,
- xpos + x1 + lines->width - text_view->ellipsis_width[style],
- ypos + y1,
- ect->ellipsis ? ect->ellipsis : "...",
- ect->ellipsis ? strlen (ect->ellipsis) : 3);
- } else {
- e_font_draw_utf8_text (drawable, font, style, text_view->gc,
- xpos + x1,
- ypos + y1,
- lines->text,
- lines->length);
- }
- if (ect->strikeout_column >= 0 && e_table_model_value_at(ecell_view->e_table_model, ect->strikeout_column, row)) {
- gdk_draw_rectangle (drawable,
- text_view->gc,
- TRUE,
- x1, ypos + y1 - (e_font_ascent (font) / 2),
- x2 - x1,
- 1);
- }
- ypos += height;
- lines++;
- }
- unref_lines (&cell);
- unbuild_current_cell (&cell);
- }
-
- gdk_gc_set_clip_rectangle (text_view->gc, NULL);
- gdk_gc_set_clip_rectangle (fg_gc, NULL);
-}
-
-
-/*
- * Get the background color
- */
-static gchar *
-ect_get_bg_color(ECellView *ecell_view, int row)
-{
- ECellText *ect = E_CELL_TEXT (ecell_view->ecell);
- gchar *color_spec;
-
- if (ect->bg_color_column == -1)
- return NULL;
-
- color_spec = e_table_model_value_at (ecell_view->e_table_model,
- ect->bg_color_column, row);
-
- return color_spec;
-}
-
-
-
-/*
- * 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);
-}
-
-static gboolean
-key_begins_editing (GdkEventKey *event)
-{
- if (event->length == 0)
- return FALSE;
-
- return TRUE;
-}
-
-/*
- * ECell::event method
- */
-static gint
-ect_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row, ECellFlags flags, ECellActions *actions)
-{
- ECellTextView *text_view = (ECellTextView *) ecell_view;
- 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;
- d(gboolean press = FALSE);
-
- if (!(flags & E_CELL_EDITING))
- return 0;
-
- 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;
- }
-
- set_style(ecell_view, cellptr, row);
-
- 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_val = TRUE;
- break;
- }
-
- if ((!edit_display) &&
- e_table_model_is_cell_editable (ecell_view->e_table_model, model_col, row) &&
- key_begins_editing (&event->key)) {
- 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;
-
- /* This is probably ugly hack, but we have to handle UTF-8 input somehow */
-#if 0
- e_tep_event.key.length = key.length;
- e_tep_event.key.string = key.string;
-#else
- e_tep_event.key.string = e_utf8_from_gtk_event_key (canvas, key.keyval, key.string);
- if (e_tep_event.key.string != NULL) {
- e_tep_event.key.length = strlen (e_tep_event.key.string);
- } else {
- e_tep_event.key.length = 0;
- }
-#endif
-
- _get_tep (edit);
- edit->actions = 0;
- return_val = e_text_event_processor_handle_event (edit->tep, &e_tep_event);
- *actions = edit->actions;
- if (e_tep_event.key.string) g_free (e_tep_event.key.string);
- break;
- }
- }
-
- break;
- case GDK_BUTTON_PRESS: /* Fall Through */
- d(press = TRUE);
- case GDK_BUTTON_RELEASE:
- d(g_print ("%s: %s\n", __FUNCTION__, press ? "GDK_BUTTON_PRESS" : "GDK_BUTTON_RELEASE"));
- event->button.x -= 4;
- event->button.y -= 1;
- if ((!edit_display)
- && e_table_model_is_cell_editable (ecell_view->e_table_model, model_col, row)
- && 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);
- edit->actions = 0;
- return_val = e_text_event_processor_handle_event (edit->tep,
- &e_tep_event);
- *actions = edit->actions;
- 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);
- edit->actions = 0;
- return_val = e_text_event_processor_handle_event (edit->tep,
- &e_tep_event);
- *actions = edit->actions;
- 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);
- edit->actions = 0;
- return_val = e_text_event_processor_handle_event (edit->tep,
- &e_tep_event);
- *actions = edit->actions;
- 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;
- }
-
- unbuild_current_cell (&cell);
- 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;
-
-}
-
-/*
- * ECell::height method
- */
-static int
-ect_height (ECellView *ecell_view, int model_col, int view_col, int row)
-{
- ECellTextView *text_view = (ECellTextView *) ecell_view;
- EFont *font;
- ECellText *ect = E_CELL_TEXT(ecell_view->ecell);
- gchar *string;
- gint value;
-
- font = text_view->font;
-
- if (row == -1) {
- value = e_font_height (font) + TEXT_PAD;
- } else {
- string = e_cell_text_get_text(ect, ecell_view->e_table_model, model_col, row);
- value = e_font_height (font) * number_of_lines(string) + TEXT_PAD;
- e_cell_text_free_text(ect, string);
- }
-
- return value;
-}
-
-/*
- * 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;
- CellEdit *edit;
- ECellText *ect = E_CELL_TEXT(ecell_view->ecell);
- char *temp;
-
- edit = g_new (CellEdit, 1);
- text_view->edit = edit;
-
- build_current_cell (CURRENT_CELL(edit), text_view, model_col, view_col, row);
-
- set_style(ecell_view, CURRENT_CELL(edit), 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;
-
- temp = e_cell_text_get_text(ect, ecell_view->e_table_model, model_col, row);
- edit->old_text = g_strdup (temp);
- e_cell_text_free_text(ect, temp);
- edit->cell.text = g_strdup (edit->old_text);
-
-#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_stop_editing (text_view, TRUE);
- /* FIXME: edit is freed in ect_stop_editing() so I've
- commented this out - Damon. */
- /*unbuild_current_cell (CURRENT_CELL(edit));*/
- } else {
- /*
- * We did invoke this leave edit internally
- */
- }
-}
-
-/*
- * ECellView::save_state method
- */
-static void *
-ect_save_state (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;
-
- int *save_state = g_new (int, 2);
-
- save_state[0] = edit->selection_start;
- save_state[1] = edit->selection_end;
- return save_state;
-}
-
-/*
- * ECellView::load_state method
- */
-static void
-ect_load_state (ECellView *ecell_view, int model_col, int view_col, int row, void *edit_context, void *save_state)
-{
- ECellTextView *text_view = (ECellTextView *) ecell_view;
- CellEdit *edit = text_view->edit;
- int length;
- int *selection = save_state;
-
- length = strlen (edit->cell.text);
-
- edit->selection_start = MIN (selection[0], length);
- edit->selection_end = MIN (selection[1], length);
-
- ect_queue_redraw (text_view, view_col, row);
-}
-
-/*
- * ECellView::free_state method
- */
-static void
-ect_free_state (ECellView *ecell_view, int model_col, int view_col, int row, void *save_state)
-{
- g_free (save_state);
-}
-
-static void
-ect_print (ECellView *ecell_view, GnomePrintContext *context,
- int model_col, int view_col, int row,
- double width, double height)
-{
- GnomeFont *font = gnome_font_new ("Helvetica", 12);
- char *string;
- ECellText *ect = E_CELL_TEXT(ecell_view->ecell);
- string = e_cell_text_get_text(ect, ecell_view->e_table_model, model_col, row);
- gnome_print_gsave(context);
- if (gnome_print_moveto(context, 2, 2) == -1)
- /* FIXME */;
- if (gnome_print_lineto(context, width - 2, 2) == -1)
- /* FIXME */;
- if (gnome_print_lineto(context, width - 2, height - 2) == -1)
- /* FIXME */;
- if (gnome_print_lineto(context, 2, height - 2) == -1)
- /* FIXME */;
- if (gnome_print_lineto(context, 2, 2) == -1)
- /* FIXME */;
- if (gnome_print_clip(context) == -1)
- /* FIXME */;
- gnome_print_moveto(context, 2, (height - gnome_font_get_ascender(font) + gnome_font_get_descender(font)) / 2);
- gnome_print_setfont(context, font);
- gnome_print_show(context, string);
- gnome_print_grestore(context);
- e_cell_text_free_text(ect, string);
-}
-
-static gdouble
-ect_print_height (ECellView *ecell_view, GnomePrintContext *context,
- int model_col, int view_col, int row,
- double width)
-{
- return 16;
-}
-
-static int
-ect_max_width (ECellView *ecell_view,
- int model_col,
- int view_col)
-{
- /* New ECellText */
- ECellTextView *text_view = (ECellTextView *) ecell_view;
- EFont *font;
- int row;
- int number_of_rows;
- int max_width = 0;
-
- font = text_view->font;
- number_of_rows = e_table_model_row_count (ecell_view->e_table_model);
-
- for (row = 0; row < number_of_rows; row++) {
- CurrentCell cell;
- struct line *line;
- int width;
-
- build_current_cell (&cell, text_view, model_col, view_col, row);
- split_into_lines (&cell);
- calc_line_widths (&cell);
-
- line = (struct line *)cell.breaks->lines;
- width = e_font_utf8_text_width (font, cell.style,
- line->text, line->length);
- max_width = MAX (max_width, width);
- unref_lines (&cell);
- unbuild_current_cell (&cell);
- }
-
- return max_width;
-}
-
-static int
-ect_max_width_by_row (ECellView *ecell_view,
- int model_col,
- int view_col,
- int row)
-{
- /* New ECellText */
- ECellTextView *text_view = (ECellTextView *) ecell_view;
- CurrentCell cell;
- struct line *line;
- int width;
-
- if (row >= e_table_model_row_count (ecell_view->e_table_model))
- return 0;
-
- build_current_cell (&cell, text_view, model_col, view_col, row);
- split_into_lines (&cell);
- calc_line_widths (&cell);
-
- line = (struct line *)cell.breaks->lines;
- width = e_font_utf8_text_width (text_view->font, cell.style,
- line->text, line->length);
- unref_lines (&cell);
- unbuild_current_cell (&cell);
-
- return width;
-}
-
-static gint
-tooltip_event (GtkWidget *window,
- GdkEvent *event,
- ETableTooltip *tooltip)
-{
- gint ret_val = FALSE;
-
- switch (event->type) {
- case GDK_LEAVE_NOTIFY:
- e_canvas_hide_tooltip (E_CANVAS(GNOME_CANVAS_ITEM(tooltip->eti)->canvas));
- break;
- case GDK_BUTTON_PRESS:
- case GDK_BUTTON_RELEASE:
- if (event->type == GDK_BUTTON_RELEASE) {
- e_canvas_hide_tooltip (E_CANVAS(GNOME_CANVAS_ITEM(tooltip->eti)->canvas));
- }
-
- event->button.x = tooltip->cx;
- event->button.y = tooltip->cy;
- gtk_signal_emit_by_name (GTK_OBJECT (tooltip->eti), "event",
- event, &ret_val);
- if (!ret_val)
- gtk_propagate_event (GTK_WIDGET(GNOME_CANVAS_ITEM(tooltip->eti)->canvas), event);
- ret_val = TRUE;
- break;
- case GDK_KEY_PRESS:
- e_canvas_hide_tooltip (E_CANVAS(GNOME_CANVAS_ITEM(tooltip->eti)->canvas));
- gtk_signal_emit_by_name (GTK_OBJECT (tooltip->eti), "event",
- event, &ret_val);
- if (!ret_val)
- gtk_propagate_event (GTK_WIDGET(GNOME_CANVAS_ITEM(tooltip->eti)->canvas), event);
- ret_val = TRUE;
- break;
- default:
- break;
- }
-
- return ret_val;
-}
-
-static void
-ect_show_tooltip (ECellView *ecell_view,
- int model_col,
- int view_col,
- int row,
- int col_width,
- ETableTooltip *tooltip)
-{
- ECellTextView *text_view = (ECellTextView *) ecell_view;
- CurrentCell cell;
- struct line *lines;
- GtkWidget *canvas;
- int i;
- gdouble max_width;
- gboolean cut_off;
- double i2c[6];
- ArtPoint origin = {0, 0};
- ArtPoint pixel_origin;
- int canvas_x, canvas_y;
- GnomeCanvasItem *tooltip_text;
- double tooltip_width;
- double tooltip_height;
- double tooltip_x;
- double tooltip_y;
- GnomeCanvasItem *rect;
- double text_height;
- ECellText *ect = E_CELL_TEXT(ecell_view->ecell);
- GtkWidget *window;
-
- tooltip->timer = 0;
-
- build_current_cell (&cell, text_view, model_col, view_col, row);
-
- set_style(ecell_view, &cell, row);
-
- cell.width = col_width - 8;
- split_into_lines (&cell);
- calc_line_widths (&cell);
-
- cut_off = FALSE;
- for (lines = cell.breaks->lines, i = 0; i < cell.breaks->num_lines;
- lines++, i++) {
- if (lines->length > lines->ellipsis_length) {
- cut_off = TRUE;
- break;
- }
- }
-
- if (!cut_off) {
- tooltip->timer = 0;
- unref_lines (&cell);
- unbuild_current_cell (&cell);
- return;
- }
-
- gnome_canvas_item_i2c_affine (GNOME_CANVAS_ITEM (tooltip->eti), i2c);
- art_affine_point (&pixel_origin, &origin, i2c);
-
- gdk_window_get_origin (GTK_WIDGET (text_view->canvas)->window,
- &canvas_x, &canvas_y);
- pixel_origin.x += canvas_x;
- pixel_origin.y += canvas_y;
- pixel_origin.x -= (int) gtk_layout_get_hadjustment (GTK_LAYOUT (text_view->canvas))->value;
- pixel_origin.y -= (int) gtk_layout_get_vadjustment (GTK_LAYOUT (text_view->canvas))->value;
-
- window = gtk_window_new (GTK_WINDOW_POPUP);
- gtk_container_set_border_width (GTK_CONTAINER (window), 1);
-
- canvas = e_canvas_new ();
- gtk_container_add (GTK_CONTAINER (window), canvas);
- GTK_WIDGET_UNSET_FLAGS (canvas, GTK_CAN_FOCUS);
- GTK_WIDGET_UNSET_FLAGS (window, GTK_CAN_FOCUS);
-
- max_width = 0.0;
- for (lines = cell.breaks->lines, i = 0; i < cell.breaks->num_lines;
- lines++, i++) {
- gdouble line_width;
-
- line_width = e_font_utf8_text_width (text_view->font,
- cell.style, lines->text,
- lines->length);
- max_width = MAX (max_width, line_width);
- }
-
- text_height = e_font_height (text_view->font) * cell.breaks->num_lines + 4;
- rect = gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS (canvas)),
- gnome_canvas_rect_get_type (),
- "x1", (double) 0.0,
- "y1", (double) 0.0,
- "x2", (double) max_width + 4,
- "y2", (double) text_height,
- "fill_color_gdk", tooltip->background,
- NULL);
-
- tooltip_text = gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS (canvas)),
- e_text_get_type (),
- "anchor", GTK_ANCHOR_NW,
-/* "font_gdk", text_view->font, */
- "bold", (gboolean) ect->bold_column >= 0 && e_table_model_value_at(ecell_view->e_table_model, ect->bold_column, row),
- "strikeout", (gboolean) ect->strikeout_column >= 0 && e_table_model_value_at(ecell_view->e_table_model, ect->strikeout_column, row),
- "fill_color_gdk", tooltip->foreground,
- "text", cell.text,
- "editable", FALSE,
- "clip_width", max_width,
- "clip_height", (double) text_height,
- "clip", TRUE,
- "line_wrap", FALSE,
- "justification", E_CELL_TEXT (text_view->cell_view.ecell)->justify,
- "draw_background", FALSE,
- NULL);
-
- tooltip_width = max_width;
- tooltip_height = text_height;
- tooltip_y = tooltip->y;
-
- switch (E_CELL_TEXT (text_view->cell_view.ecell)->justify) {
- case GTK_JUSTIFY_CENTER:
- tooltip_x = - tooltip_width / 2;
- break;
- case GTK_JUSTIFY_RIGHT:
- tooltip_x = tooltip_width / 2;
- break;
- case GTK_JUSTIFY_FILL:
- case GTK_JUSTIFY_LEFT:
- tooltip_x = tooltip->x;
- break;
- }
-
- gnome_canvas_item_move (tooltip_text, 3.0, 1.0);
- gnome_canvas_item_set (rect,
- "x2", (double) tooltip_width + 6,
- "y2", (double) tooltip->row_height + 1,
- NULL);
- gtk_widget_set_usize (window, tooltip_width + 6,
- tooltip->row_height + 1);
- gnome_canvas_set_scroll_region (GNOME_CANVAS (canvas), 0.0, 0.0,
- (double) tooltip_width + 6,
- (double) tooltip_height);
- gtk_widget_show (canvas);
- gtk_widget_realize (window);
- gtk_signal_connect (GTK_OBJECT (window), "event",
- GTK_SIGNAL_FUNC (tooltip_event), tooltip);
-
- e_canvas_popup_tooltip (E_CANVAS(text_view->canvas), window, pixel_origin.x + tooltip->x,
- pixel_origin.y + tooltip->y - 1);
-
- unref_lines (&cell);
- unbuild_current_cell (&cell);
-
- return;
-}
-
-/*
- * 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);
-}
-/* Set_arg handler for the text item */
-static void
-ect_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- ECellText *text;
-
- text = E_CELL_TEXT (object);
-
- switch (arg_id) {
- case ARG_STRIKEOUT_COLUMN:
- text->strikeout_column = GTK_VALUE_INT (*arg);
- break;
-
- case ARG_BOLD_COLUMN:
- text->bold_column = GTK_VALUE_INT (*arg);
- break;
-
- case ARG_COLOR_COLUMN:
- text->color_column = GTK_VALUE_INT (*arg);
- break;
-
- case ARG_EDITABLE:
- text->editable = GTK_VALUE_BOOL (*arg) ? TRUE : FALSE;
- break;
-
- case ARG_BG_COLOR_COLUMN:
- text->bg_color_column = GTK_VALUE_INT (*arg);
- break;
-
- default:
- return;
- }
-}
-
-/* Get_arg handler for the text item */
-static void
-ect_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- ECellText *text;
-
- text = E_CELL_TEXT (object);
-
- switch (arg_id) {
- case ARG_STRIKEOUT_COLUMN:
- GTK_VALUE_INT (*arg) = text->strikeout_column;
- break;
-
- case ARG_BOLD_COLUMN:
- GTK_VALUE_INT (*arg) = text->bold_column;
- break;
-
- case ARG_COLOR_COLUMN:
- GTK_VALUE_INT (*arg) = text->color_column;
- break;
-
- case ARG_EDITABLE:
- GTK_VALUE_BOOL (*arg) = text->editable ? TRUE : FALSE;
- break;
-
- case ARG_BG_COLOR_COLUMN:
- GTK_VALUE_INT (*arg) = text->bg_color_column;
- break;
-
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-static void
-e_cell_text_class_init (GtkObjectClass *object_class)
-{
- ECellClass *ecc = (ECellClass *) object_class;
- ECellTextClass *ectc = (ECellTextClass *) 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;
- ecc->save_state = ect_save_state;
- ecc->load_state = ect_load_state;
- ecc->free_state = ect_free_state;
- ecc->print = ect_print;
- ecc->print_height = ect_print_height;
- ecc->max_width = ect_max_width;
- ecc->max_width_by_row = ect_max_width_by_row;
- ecc->show_tooltip = ect_show_tooltip;
- ecc->get_bg_color = ect_get_bg_color;
-
- ectc->get_text = ect_real_get_text;
- ectc->free_text = ect_real_free_text;
- ectc->set_value = ect_real_set_value;
-
- object_class->get_arg = ect_get_arg;
- object_class->set_arg = ect_set_arg;
-
- parent_class = gtk_type_class (PARENT_TYPE);
-
- gtk_object_add_arg_type ("ECellText::strikeout_column",
- GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_STRIKEOUT_COLUMN);
- gtk_object_add_arg_type ("ECellText::bold_column",
- GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_BOLD_COLUMN);
- gtk_object_add_arg_type ("ECellText::color_column",
- GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_COLOR_COLUMN);
- gtk_object_add_arg_type ("ECellText::editable",
- GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_EDITABLE);
- gtk_object_add_arg_type ("ECellText::bg_color_column",
- GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_BG_COLOR_COLUMN);
-
- if (!clipboard_atom)
- clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE);
-}
-
-static void
-e_cell_text_init (ECellText *ect)
-{
- ect->ellipsis = NULL;
- ect->use_ellipsis = TRUE;
- ect->strikeout_column = -1;
- ect->bold_column = -1;
- ect->color_column = -1;
- ect->bg_color_column = -1;
- ect->editable = TRUE;
-}
-
-E_MAKE_TYPE(e_cell_text, "ECellText", ECellText, e_cell_text_class_init, e_cell_text_init, PARENT_TYPE);
-
-/**
- * e_cell_text_construct:
- * @cell: The cell to construct
- * @fontname: font to be used to render on the screen
- * @justify: Justification of the string in the cell
- *
- * constructs the ECellText. To be used by subclasses and language
- * bindings.
- *
- * Returns: The ECellText.
- */
-ECell *
-e_cell_text_construct (ECellText *cell, const char *fontname, GtkJustification justify)
-{
- cell->font_name = g_strdup (fontname);
- cell->justify = justify;
- return E_CELL(cell);
-}
-
-/**
- * e_cell_text_new:
- * @fontname: font to be used to render on the screen
- * @justify: Justification of the string in the cell.
- *
- * Creates a new ECell renderer that can be used to render strings that
- * that come from the model. The value returned from the model is
- * interpreted as being a char *.
- *
- * The ECellText object support a large set of properties that can be
- * configured through the Gtk argument system and allows the user to have
- * a finer control of the way the string is displayed. The arguments supported
- * allow the control of strikeout, bold, and color.
- *
- * The arguments "strikeout_column", "bold_column" and "color_column" set
- * and return an integer that points to a column in the model that controls
- * these settings. So controlling the way things are rendered is achieved
- * by having special columns in the model that will be used to flag whether
- * the text should be rendered with strikeout, or bolded. In the case of
- * the "color_column" argument, the column in the model is expected to have
- * a string that can be parsed by gdk_color_parse().
- *
- * Returns: an ECell object that can be used to render strings.
- */
-ECell *
-e_cell_text_new (const char *fontname, GtkJustification justify)
-{
- ECellText *ect = gtk_type_new (e_cell_text_get_type ());
-
- e_cell_text_construct(ect, fontname, 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;
-
- EFont *font;
-
- font = text_view->font;
-
- y = text_view->yofs + ect->y;
- y += (line - lines) * e_font_height (font);
-
- return y;
-}
-
-/* fixme: Handle Font attributes */
-/* position is in BYTES */
-
-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;
- ECellTextLineBreaks *linebreaks;
- EFont *font;
-
- font = text_view->font;
-
- 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 += e_font_height (font);
- }
- lines --;
- y -= e_font_descent (font);
-
- x += e_font_utf8_text_width (font, cell->style,
- 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;
- gchar *p;
-
- ECellTextView *text_view = cell->text_view;
- ECellTextLineBreaks *linebreaks;
- EFont *font;
-
- font = text_view->font;
-
- 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 += e_font_height (font);
- 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 (p = lines->text; p < lines->text + lines->length && g_unichar_validate (g_utf8_get_char (p)); p = g_utf8_next_char (p)) {
- gint charwidth;
-
- charwidth = e_font_utf8_char_width (font, cell->style, p);
-
- xpos += charwidth / 2;
- if (xpos > x) {
- break;
- }
- xpos += (charwidth + 1) / 2;
- }
-
- return_val = p - cell->text;
-
- unref_lines (cell);
-
- return return_val;
-}
-
-#define SCROLL_WAIT_TIME 30000
-
-static gboolean
-_blink_scroll_timeout (gpointer data)
-{
- ECellTextView *text_view = (ECellTextView *) data;
- ECellText *ect = E_CELL_TEXT (((ECellView *)text_view)->ecell);
- CellEdit *edit = text_view->edit;
- CurrentCell *cell = CURRENT_CELL(edit);
-
- gulong current_time;
- gboolean scroll = FALSE;
- gboolean redraw = FALSE;
-
- g_timer_elapsed (edit->timer, &current_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) {
- ECellTextLineBreaks *linebreaks;
- split_into_lines (cell);
- linebreaks = cell->breaks;
- if (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;
- }
- unref_lines (cell);
- }
- 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
-next_word (CellEdit *edit, int start)
-{
- CurrentCell *cell = CURRENT_CELL(edit);
- char *p;
- int length;
-
- length = strlen (cell->text);
- if (start >= length)
- return length;
-
- p = g_utf8_next_char (cell->text + start);
-
- while (*p && g_unichar_validate (g_utf8_get_char (p))) {
- gunichar unival = g_utf8_get_char (p);
- if (g_unichar_isspace (unival))
- return p - cell->text;
- p = g_utf8_next_char (p);
- }
-
- return p - cell->text;
-}
-
-static int
-_get_position (ECellTextView *text_view, ETextEventProcessorCommand *command)
-{
- int length;
- int x, y;
- CellEdit *edit = text_view->edit;
- CurrentCell *cell = CURRENT_CELL(edit);
- EFont *font;
- gchar *p;
- int unival;
-
- font = text_view->font;
-
- 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;
-
- /* fixme: this probably confuses TEP */
-
- case E_TEP_END_OF_BUFFER:
- return strlen (cell->text);
-
- case E_TEP_START_OF_LINE:
-
- if (edit->selection_end < 1) return 0;
-
- p = g_utf8_find_prev_char (cell->text, cell->text + edit->selection_end);
-
- if (p == cell->text) return 0;
-
- p = g_utf8_find_prev_char (cell->text, p);
-
- while (p && p > cell->text) {
- if (*p == '\n') return p - cell->text + 1;
- p = g_utf8_find_prev_char (cell->text, p);
- }
-
- return 0;
-
- case E_TEP_END_OF_LINE:
-
- length = strlen (cell->text);
- if (edit->selection_end >= length) return length;
-
- p = g_utf8_next_char (cell->text + edit->selection_end);
-
- while (*p && g_unichar_validate (g_utf8_get_char (p))) {
- if (*p == '\n') return p - cell->text;
- p = g_utf8_next_char (p);
- }
-
- return p - cell->text;
-
- case E_TEP_FORWARD_CHARACTER:
-
- length = strlen (cell->text);
- if (edit->selection_end >= length) return length;
-
- p = g_utf8_next_char (cell->text + edit->selection_end);
-
- return p - cell->text;
-
- case E_TEP_BACKWARD_CHARACTER:
-
- if (edit->selection_end < 1) return 0;
-
- p = g_utf8_find_prev_char (cell->text, cell->text + edit->selection_end);
-
- if (p == NULL) return 0;
-
- return p - cell->text;
-
- case E_TEP_FORWARD_WORD:
- return next_word (edit, edit->selection_end);
-
- case E_TEP_BACKWARD_WORD:
-
- if (edit->selection_end < 1) return 0;
-
- p = g_utf8_find_prev_char (cell->text, cell->text + edit->selection_end);
-
- if (p == cell->text) return 0;
-
- p = g_utf8_find_prev_char (cell->text, p);
-
- while (p && p > cell->text && g_unichar_validate (g_utf8_get_char (p))) {
- unival = g_utf8_get_char (p);
- if (g_unichar_isspace (unival)) {
- return (g_utf8_next_char (p) - cell->text);
- }
- p = g_utf8_find_prev_char (cell->text, p);
- }
-
- return 0;
-
- case E_TEP_FORWARD_LINE:
- _get_xy_from_position (cell, edit->selection_end, &x, &y);
- y += e_font_height (font);
- return _get_position_from_xy (cell, x, y);
- case E_TEP_BACKWARD_LINE:
- _get_xy_from_position (cell, edit->selection_end, &x, &y);
- y -= e_font_height (font);
- 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;
- }
- g_assert_not_reached ();
- return 0; /* Kill warning */
-}
-
-static void
-_delete_selection (ECellTextView *text_view)
-{
- CellEdit *edit = text_view->edit;
- CurrentCell *cell = CURRENT_CELL(edit);
- gint length;
- gchar *sp, *ep;
-
- 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;
- }
-
- sp = cell->text + edit->selection_start;
- ep = cell->text + edit->selection_end;
- length = strlen (ep) + 1;
-
- memmove (sp, ep, length);
-
- edit->selection_end = edit->selection_start;
-}
-
-/* fixme: */
-/* NB! We expect value to be length IN BYTES */
-
-static void
-_insert (ECellTextView *text_view, char *string, int value)
-{
- CellEdit *edit = text_view->edit;
- CurrentCell *cell = CURRENT_CELL(edit);
- char *temp;
-
- if (value <= 0) return;
-
- temp = g_new (gchar, strlen (cell->text) + 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_end);
-
- g_free (cell->text);
-
- cell->text = temp;
-
- edit->selection_start += value;
- edit->selection_end = edit->selection_start;
-}
-
-static void
-capitalize (CellEdit *edit, int start, int end, ETextEventProcessorCaps type)
-{
- CurrentCell *cell = CURRENT_CELL(edit);
- ECellTextView *text_view = cell->text_view;
-
- gboolean first = TRUE;
- int character_length = g_utf8_strlen (cell->text + start, start - end);
- const char *p = cell->text + start;
- const char *text_end = cell->text + end;
- char *new_text = g_new0 (char, character_length * 6 + 1);
- char *output = new_text;
-
- while (p && *p && p < text_end && g_unichar_validate (g_utf8_get_char (p))) {
- gunichar unival = g_utf8_get_char (p);
- gunichar newval = unival;
-
- switch (type) {
- case E_TEP_CAPS_UPPER:
- newval = g_unichar_toupper (unival);
- break;
- case E_TEP_CAPS_LOWER:
- newval = g_unichar_tolower (unival);
- break;
- case E_TEP_CAPS_TITLE:
- if (g_unichar_isalpha (unival)) {
- if (first)
- newval = g_unichar_totitle (unival);
- else
- newval = g_unichar_tolower (unival);
- first = FALSE;
- } else {
- first = TRUE;
- }
- break;
- }
- g_unichar_to_utf8 (newval, output);
- output = g_utf8_next_char (output);
-
- p = g_utf8_next_char (p);
- }
- *output = 0;
-
- edit->selection_end = end;
- edit->selection_start = start;
- _delete_selection (text_view);
-
- _insert (text_view, new_text, output - new_text);
-
- g_free (new_text);
-}
-
-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;
- ECellText *ect = E_CELL_TEXT (text_view->cell_view.ecell);
-
- gboolean change = FALSE;
- gboolean redraw = FALSE;
-
- int sel_start, sel_end;
- EFont *font;
-
- font = text_view->font;
-
- /* If the EText isn't editable, then ignore any commands that would
- modify the text. */
- if (!ect->editable && (command->action == E_TEP_DELETE
- || command->action == E_TEP_INSERT
- || command->action == E_TEP_PASTE
- || command->action == E_TEP_GET_SELECTION))
- return;
-
- 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:
- edit->actions = E_CELL_GRAB;
- break;
- case E_TEP_UNGRAB:
- edit->actions = E_CELL_UNGRAB;
- break;
- case E_TEP_CAPS:
- if (edit->selection_start == edit->selection_end) {
- capitalize (edit, edit->selection_start, next_word (edit, edit->selection_start), command->value);
- } else {
- int selection_start = MIN (edit->selection_start, edit->selection_end);
- int selection_end = edit->selection_start + edit->selection_end - selection_start; /* Slightly faster than MAX */
- capitalize (edit, selection_start, selection_end, command->value);
- }
- if (edit->timer) {
- g_timer_reset (edit->timer);
- }
- redraw = TRUE;
- change = TRUE;
- break;
- 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 = e_font_utf8_text_width (font, cell->style,
- 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;
- }
-}
-
-/* fixme: What happens, if delivered string is not UTF-8? */
-
-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, char *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);
- }
-}
-
-static int
-number_of_lines (char *text)
-{
- int num_lines = 0;
- gchar *p;
-
- if (!text) return 0;
-
- for (p = text; *p && g_unichar_validate (g_utf8_get_char (p)); p = g_utf8_next_char (p)) {
- if (*p == '\n') num_lines++;
- }
-
- num_lines++;
- return num_lines;
-}
-
-/* Splits the text of the text item into lines */
-static void
-split_into_lines (CurrentCell *cell)
-{
- char *p;
- struct line *lines;
- gint len;
-
- char *text = cell->text;
- ECellTextLineBreaks *linebreaks;
-
- 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 */
-
- linebreaks->num_lines = number_of_lines(cell->text);
-
- /* Allocate array of lines and calculate split positions */
-
- linebreaks->lines = lines = g_new0 (struct line, linebreaks->num_lines);
-
- len = 0;
- for (p = text; *p && g_unichar_validate (g_utf8_get_char (p)); p = g_utf8_next_char (p)) {
- if (len == 0) lines->text = p;
- if (*p == '\n') {
- lines->length = p - lines->text;
- lines++;
- len = 0;
- } else
- len++;
- }
-
- if (len == 0)
- lines->text = p;
- lines->length = p - lines->text;
-
- 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);
- EFont *font;
-
- font = text_view->font;
- if (font) {
- text_view->ellipsis_width[E_FONT_PLAIN] =
- e_font_utf8_text_width (font, E_FONT_PLAIN,
- ect->ellipsis ? ect->ellipsis : "...",
- ect->ellipsis ? strlen (ect->ellipsis) : 3);
- text_view->ellipsis_width[E_FONT_BOLD] =
- e_font_utf8_text_width (font, E_FONT_BOLD,
- 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);
- ECellTextLineBreaks *linebreaks = cell->breaks;
- struct line *lines;
- int i;
- int j;
- EFont *font;
-
- font = text_view->font;
-
- 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 = e_font_utf8_text_width (font, cell->style,
- 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 (e_font_utf8_text_width (font, cell->style, lines->text, j) +
- text_view->ellipsis_width[cell->style] < cell->width) {
- lines->ellipsis_length = j;
- }
- else
- break;
- }
- }
- else
- lines->ellipsis_length = 0;
- lines->width = e_font_utf8_text_width (font, cell->style, lines->text, lines->ellipsis_length) +
- text_view->ellipsis_width[cell->style];
- }
- 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;
- ECellText *ect = E_CELL_TEXT (ecell_view->ecell);
- char *temp;
-
- cell->text_view = text_view;
- cell->model_col = model_col;
- cell->view_col = view_col;
- cell->row = row;
- cell->breaks = NULL;
-
- temp = e_cell_text_get_text(ect, ecell_view->e_table_model, model_col, row);
- cell->text = g_strdup(temp);
- e_cell_text_free_text(ect, temp);
-
- cell->width = e_table_header_get_column (
- ((ETableItem *)ecell_view->e_table_item_view)->header,
- view_col)->width - 8;
- cell->style = 0;
-}
-
-static void
-unbuild_current_cell (CurrentCell *cell)
-{
- g_free(cell->text);
- cell->text = NULL;
-}
-
-
-static GdkColor*
-e_cell_text_get_color (ECellTextView *cell_view, gchar *color_spec)
-{
- ECellText *ect = E_CELL_TEXT (((ECellView*) cell_view)->ecell);
- GdkColormap *colormap;
- GdkColor *color, tmp_color;
-
- /* If the color spec is NULL we use the default color. */
- if (color_spec == NULL)
- return NULL;
-
- /* Create the hash table if we haven't already. */
- if (!ect->colors)
- ect->colors = g_hash_table_new (g_str_hash, g_str_equal);
-
- /* See if we've already allocated the color. Note that we use a
- special value of (GdkColor*) 1 in the hash to indicate that we've
- already tried and failed to allocate the color, so we don't keep
- trying to allocate it. */
- color = g_hash_table_lookup (ect->colors, color_spec);
- if (color == (GdkColor*) 1)
- return NULL;
- if (color)
- return color;
-
- /* Try to parse the color. */
- if (gdk_color_parse (color_spec, &tmp_color)) {
- colormap = gtk_widget_get_colormap (GTK_WIDGET (cell_view->canvas));
-
- /* Try to allocate the color. */
- if (gdk_color_alloc (colormap, &tmp_color))
- color = gdk_color_copy (&tmp_color);
- }
-
- g_hash_table_insert (ect->colors, g_strdup (color_spec),
- color ? color : (GdkColor*) 1);
- return color;
-}
-
diff --git a/widgets/table/e-cell-text.h b/widgets/table/e-cell-text.h
deleted file mode 100644
index 476e40c51e..0000000000
--- a/widgets/table/e-cell-text.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-cell-text.h: Text cell renderer.
- * Copyright 1999, 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Miguel de Icaza <miguel@ximian.com>
- * Chris Lahey <clahey@ximian.com>
- *
- * A lot 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 <federico@nuclecu.unam.mx>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_CELL_TEXT_H_
-#define _E_CELL_TEXT_H_
-
-#include <libgnomeui/gnome-canvas.h>
-#include <gal/e-table/e-cell.h>
-#include <libgnome/gnome-defs.h>
-
-BEGIN_GNOME_DECLS
-
-#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; /* Whether the text can be edited. */
-
- int strikeout_column;
- int bold_column;
-
- /* This column in the ETable should return a string specifying a color,
- either a color name like "red" or a color spec like "rgb:F/0/0".
- See the XParseColor man page for the formats available. */
- int color_column;
- int bg_color_column;
-
- /* This stores the colors we have allocated. */
- GHashTable *colors;
-} ECellText;
-
-typedef struct {
- ECellClass parent_class;
-
- char *(*get_text) (ECellText *cell, ETableModel *model, int col, int row);
- void (*free_text) (ECellText *cell, char *text);
- void (*set_value) (ECellText *cell, ETableModel *model, int col, int row, const char *text);
-} ECellTextClass;
-
-GtkType e_cell_text_get_type (void);
-ECell *e_cell_text_new (const char *fontname, GtkJustification justify);
-ECell *e_cell_text_construct(ECellText *cell, const char *fontname, GtkJustification justify);
-
-/* Gets the value from the model and converts it into a string. In ECellText
- itself, the value is assumed to be a char* and so needs no conversion.
- In subclasses the ETableModel value may be a more complicated datatype. */
-char *e_cell_text_get_text (ECellText *cell, ETableModel *model, int col, int row);
-
-/* Frees the value returned by e_cell_text_get_text(). */
-void e_cell_text_free_text (ECellText *cell, char *text);
-
-/* Sets the ETableModel value, based on the given string. */
-void e_cell_text_set_value (ECellText *cell, ETableModel *model, int col, int row, const char *text);
-
-END_GNOME_DECLS
-
-#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 0961b077ba..0000000000
--- a/widgets/table/e-cell-toggle.c
+++ /dev/null
@@ -1,441 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-cell-toggle.c - Multi-state image toggle cell object.
- * Copyright 1999, 2000, Ximian, Inc.
- *
- * Authors:
- * Miguel de Icaza <miguel@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <gtk/gtkenums.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtkwindow.h>
-#include <gtk/gtksignal.h>
-#include <gdk/gdkkeysyms.h>
-#include <libgnomeui/gnome-canvas.h>
-#include "e-cell-toggle.h"
-#include "gal/util/e-util.h"
-#include "gal/widgets/e-hsv-utils.h"
-#include "e-table-item.h"
-
-#define PARENT_TYPE e_cell_get_type ()
-
-typedef struct {
- ECellView cell_view;
- GdkGC *gc;
- GnomeCanvas *canvas;
- GdkPixmap **pixmap_cache;
-} ECellToggleView;
-
-static ECellClass *parent_class;
-
-#define CACHE_SEQ_COUNT 6
-
-/*
- * 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;
- ECellToggle *etog = E_CELL_TOGGLE (ecell);
- int i;
-
- 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;
- toggle_view->pixmap_cache = g_new (GdkPixmap *, etog->n_states * CACHE_SEQ_COUNT);
- for (i = 0; i < etog->n_states * CACHE_SEQ_COUNT; i++)
- toggle_view->pixmap_cache[i] = NULL;
-
- return (ECellView *) toggle_view;
-}
-
-static void
-etog_kill_view (ECellView *ecell_view)
-{
- ECellToggle *etog = E_CELL_TOGGLE (ecell_view->ecell);
- ECellToggleView *toggle_view = (ECellToggleView *) ecell_view;
- int i;
-
- for (i = 0; i < etog->n_states * CACHE_SEQ_COUNT; i++)
- if (toggle_view->pixmap_cache[i])
- gdk_pixmap_unref (toggle_view->pixmap_cache[i]);
- 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;
-}
-
-#define PIXMAP_CACHE(toggle_view, cache_seq, image_seq) ((toggle_view)->pixmap_cache[(cache_seq) * E_CELL_TOGGLE (((ECellView *) (toggle_view))->ecell)->n_states + (image_seq)])
-
-#define RGB_COLOR(color) (((color).red & 0xff00) << 8 | \
- ((color).green & 0xff00) | \
- ((color).blue & 0xff00) >> 8)
-
-static void
-check_cache (ECellToggleView *toggle_view, int image_seq, int cache_seq)
-{
- ECellView *ecell_view = (ECellView *) toggle_view;
- ECellToggle *etog = E_CELL_TOGGLE (ecell_view->ecell);
-
- if (PIXMAP_CACHE (toggle_view, cache_seq, image_seq) == NULL) {
- GdkPixbuf *image = etog->images[image_seq];
- GdkPixbuf *flat;
- guint32 color = 0xffffff;
- int width = gdk_pixbuf_get_width (image);
- int height = gdk_pixbuf_get_height (image);
-
- PIXMAP_CACHE (toggle_view, cache_seq, image_seq) =
- gdk_pixmap_new (toggle_view->canvas->layout.bin_window, width, height,
- gtk_widget_get_visual (GTK_WIDGET (toggle_view->canvas))->depth);
-
-
- switch (cache_seq % 3) {
- case 0:
- color = RGB_COLOR (GTK_WIDGET (toggle_view->canvas)->style->bg [GTK_STATE_SELECTED]);
- break;
- case 1:
- color = RGB_COLOR (GTK_WIDGET (toggle_view->canvas)->style->bg [GTK_STATE_ACTIVE]);
- break;
- case 2:
- color = RGB_COLOR (GTK_WIDGET (toggle_view->canvas)->style->base [GTK_STATE_NORMAL]);
- break;
- }
-
- if (cache_seq >= 3) {
- double r, g, b, h, s, v;
- r = ((color >> 16) & 0xff) / 255.0f;
- g = ((color >> 8) & 0xff) / 255.0f;
- b = (color & 0xff) / 255.0f;
-
- e_rgb_to_hsv (r, g, b, &h, &s, &v);
-
- if (v - 0.05f < 0) {
- v += 0.05f;
- } else {
- v -= 0.05f;
- }
-
- e_hsv_to_rgb (h, s, v, &r, &g, &b);
-
- color = ((((int)(r * 255.0f)) & 0xff) << 16) +
- ((((int)(g * 255.0f)) & 0xff) << 8) +
- (((int)(b * 255.0f)) & 0xff);
- }
-
- flat = gdk_pixbuf_composite_color_simple (image,
- width, height,
- GDK_INTERP_BILINEAR,
- 255,
- 1,
- color, color);
-
- gdk_pixbuf_render_to_drawable (flat, PIXMAP_CACHE (toggle_view, cache_seq, image_seq),
- toggle_view->gc,
- 0, 0,
- 0, 0,
- width, height,
- GDK_RGB_DITHER_NORMAL,
- 0, 0);
- gdk_pixbuf_unref (flat);
- }
-}
-
-/*
- * ECell::draw method
- */
-static void
-etog_draw (ECellView *ecell_view, GdkDrawable *drawable,
- int model_col, int view_col, int row, ECellFlags flags,
- int x1, int y1, int x2, int y2)
-{
- ECellToggle *toggle = E_CELL_TOGGLE (ecell_view->ecell);
- gboolean selected;
- ECellToggleView *toggle_view = (ECellToggleView *) ecell_view;
- GdkPixmap *pixmap;
- GdkPixbuf *image;
- int x, y, width, height;
- int cache_seq;
-
- const int value = GPOINTER_TO_INT (
- e_table_model_value_at (ecell_view->e_table_model, model_col, row));
-
- selected = flags & E_CELL_SELECTED;
-
- 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;
- }
-
- if (flags & E_CELL_SELECTED) {
- if (GTK_WIDGET_HAS_FOCUS (toggle_view->canvas))
- cache_seq = 0;
- else
- cache_seq = 1;
- } else
- cache_seq = 2;
-
- if (E_TABLE_ITEM (ecell_view->e_table_item_view)->alternating_row_colors && (row % 2) == 0)
- cache_seq += 3;
-
- check_cache (toggle_view, value, cache_seq);
-
- pixmap = PIXMAP_CACHE (toggle_view, cache_seq, value);
- image = toggle->images[value];
-
- if ((x2 - x1) < gdk_pixbuf_get_width (image)){
- x = x1;
- width = x2 - x1;
- } else {
- x = x1 + ((x2 - x1) - gdk_pixbuf_get_width (image)) / 2;
- width = gdk_pixbuf_get_width (image);
- }
-
- if ((y2 - y1) < gdk_pixbuf_get_height (image)){
- y = y1;
- height = y2 - y1;
- } else {
- y = y1 + ((y2 - y1) - gdk_pixbuf_get_height (image)) / 2;
- height = gdk_pixbuf_get_height (image);
- }
-
- gdk_draw_pixmap (drawable, toggle_view->gc,
- pixmap,
- 0, 0,
- x, y,
- width, height);
-}
-
-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));
-}
-
-/*
- * ECell::event method
- */
-static gint
-etog_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row, ECellFlags flags, ECellActions *actions)
-{
- 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);
-
-#if 0
- if (!(flags & E_CELL_EDITING))
- return FALSE;
-#endif
-
- switch (event->type){
- case GDK_KEY_PRESS:
- if (event->key.keyval != GDK_space)
- return FALSE;
- /* Fall through */
- case GDK_BUTTON_PRESS:
- if (!e_table_model_is_cell_editable(ecell_view->e_table_model, model_col, row))
- return FALSE;
-
- etog_set_value (toggle_view, model_col, view_col, row, value + 1);
- return TRUE;
-
- 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;
-}
-
-/*
- * ECell::max_width method
- */
-static int
-etog_max_width (ECellView *ecell_view, int model_col, int view_col)
-{
- ECellToggle *toggle = E_CELL_TOGGLE (ecell_view->ecell);
- int max_width = 0;
- int number_of_rows;
- int row;
-
- number_of_rows = e_table_model_row_count (ecell_view->e_table_model);
- for (row = 0; row < number_of_rows; row++) {
- void *value = e_table_model_value_at (ecell_view->e_table_model,
- model_col, row);
- max_width = MAX (max_width, gdk_pixbuf_get_width (toggle->images[GPOINTER_TO_INT (value)]));
- }
-
- return max_width;
-}
-
-static void
-etog_style_set (ECellView *ecell_view, GtkStyle *previous_style)
-{
- ECellToggle *toggle = E_CELL_TOGGLE (ecell_view->ecell);
- ECellToggleView *toggle_view = (ECellToggleView *) ecell_view;
- int i;
-
- for (i = 0; i < toggle->n_states * CACHE_SEQ_COUNT; i++) {
- if (toggle_view->pixmap_cache[i]) {
- gdk_pixmap_unref (toggle_view->pixmap_cache[i]);
- toggle_view->pixmap_cache[i] = NULL;
- }
- }
-}
-
-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);
-
- etog->images = NULL;
- etog->n_states = 0;
-
- 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;
- ecc->max_width = etog_max_width;
- ecc->style_set = etog_style_set;
-
- parent_class = gtk_type_class (PARENT_TYPE);
-}
-
-static void
-e_cell_toggle_init (GtkObject *object)
-{
- ECellToggle *etog = (ECellToggle *) object;
-
- etog->images = NULL;
- etog->n_states = 0;
-}
-
-E_MAKE_TYPE(e_cell_toggle, "ECellToggle", ECellToggle, e_cell_toggle_class_init, e_cell_toggle_init, PARENT_TYPE);
-
-/**
- * e_cell_toggle_construct:
- * @etog: a fresh ECellToggle object
- * @border: number of pixels used as a border
- * @n_states: number of states the toggle will have
- * @images: a collection of @n_states images, one for each state.
- *
- * Constructs the @etog object with the @border, @n_staes, and @images
- * arguments.
- */
-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 (gdk_pixbuf_get_height (images [i]) > max_height)
- max_height = gdk_pixbuf_get_height (images [i]);
- }
-
- etog->height = max_height;
-}
-
-/**
- * e_cell_checkbox_new:
- * @border: number of pixels used as a border
- * @n_states: number of states the toggle will have
- * @images: a collection of @n_states images, one for each state.
- *
- * Creates a new ECell renderer that can be used to render toggle
- * buttons with the images specified in @images. The value returned
- * by ETableModel::get_value is typecase into an integer and clamped
- * to the [0..n_states) range. That will select the image rendered.
- *
- * Returns: an ECell object that can be used to render multi-state
- * toggle cells.
- */
-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 da60321259..0000000000
--- a/widgets/table/e-cell-toggle.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-cell-toggle.h - Multi-state image toggle cell object.
- * Copyright 1999, 2000, Ximian, Inc.
- *
- * Authors:
- * Miguel de Icaza <miguel@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_CELL_TOGGLE_H_
-#define _E_CELL_TOGGLE_H_
-
-#include <libgnomeui/gnome-canvas.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <gal/e-table/e-cell.h>
-#include <libgnome/gnome-defs.h>
-
-BEGIN_GNOME_DECLS
-
-#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);
-
-END_GNOME_DECLS
-
-#endif /* _E_CELL_TOGGLE_H_ */
-
-
diff --git a/widgets/table/e-cell-tree.c b/widgets/table/e-cell-tree.c
deleted file mode 100644
index f581dab0fa..0000000000
--- a/widgets/table/e-cell-tree.c
+++ /dev/null
@@ -1,767 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-cell-tree.c - Tree cell object.
- * Copyright 1999, 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Toshok <toshok@ximian.com>
- *
- * A majority of code taken from:
- *
- * the ECellText renderer.
- * Copyright 1998, The Free Software Foundation
- * Copyright 1999, 2000, Ximian, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-
-#include <ctype.h>
-#include <math.h>
-#include <stdio.h>
-
-#include <gdk/gdkx.h> /* for BlackPixel */
-#include <gtk/gtkenums.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtkwindow.h>
-#include <gtk/gtkinvisible.h>
-#include <gtk/gtksignal.h>
-#include <gdk/gdkkeysyms.h>
-#include <libgnomeui/gnome-canvas.h>
-
-#include "e-tree-table-adapter.h"
-#include "e-tree-model.h"
-#include "gal/util/e-util.h"
-#include "e-table-item.h"
-#include "e-cell-tree.h"
-
-#include "tree-expanded.xpm"
-#include "tree-unexpanded.xpm"
-
-#define PARENT_TYPE e_cell_get_type ()
-
-typedef struct {
- ECellView cell_view;
- ECellView *subcell_view;
- GdkGC *gc;
-
- GnomeCanvas *canvas;
-
-} ECellTreeView;
-
-static ECellClass *parent_class;
-
-#define INDENT_AMOUNT 16
-
-static ETreePath
-e_cell_tree_get_node (ETableModel *table_model, int row)
-{
- return e_table_model_value_at (table_model, -1, row);
-}
-
-static ETreeModel*
-e_cell_tree_get_tree_model (ETableModel *table_model, int row)
-{
- return e_table_model_value_at (table_model, -2, row);
-}
-
-static ETreeTableAdapter *
-e_cell_tree_get_tree_table_adapter (ETableModel *table_model, int row)
-{
- return e_table_model_value_at (table_model, -3, row);
-}
-
-static int
-visible_depth_of_node (ETableModel *model, int row)
-{
- ETreeModel *tree_model = e_cell_tree_get_tree_model(model, row);
- ETreeTableAdapter *adapter = e_cell_tree_get_tree_table_adapter(model, row);
- ETreePath path = e_cell_tree_get_node(model, row);
- return (e_tree_model_node_depth (tree_model, path)
- - (e_tree_table_adapter_root_node_is_visible (adapter) ? 0 : 1));
-}
-
-/* If this is changed to not include the width of the expansion pixmap
- if the path is not expandable, then max_width needs to change as
- well. */
-static gint
-offset_of_node (ETableModel *table_model, int row)
-{
- ETreeModel *tree_model = e_cell_tree_get_tree_model(table_model, row);
- ETreePath path = e_cell_tree_get_node(table_model, row);
-
- if (visible_depth_of_node (table_model, row) > 0 ||
- e_tree_model_node_is_expandable(tree_model, path)) {
- return (visible_depth_of_node(table_model, row) + 1) * INDENT_AMOUNT;
- } else {
- return 0;
- }
-}
-
-/*
- * ECell::new_view method
- */
-static ECellView *
-ect_new_view (ECell *ecell, ETableModel *table_model, void *e_table_item_view)
-{
- ECellTree *ect = E_CELL_TREE (ecell);
- ECellTreeView *tree_view = g_new0 (ECellTreeView, 1);
- GnomeCanvas *canvas = GNOME_CANVAS_ITEM (e_table_item_view)->canvas;
-
- tree_view->cell_view.ecell = ecell;
- tree_view->cell_view.e_table_model = table_model;
- tree_view->cell_view.e_table_item_view = e_table_item_view;
-
- /* create our subcell view */
- tree_view->subcell_view = e_cell_new_view (ect->subcell, table_model, e_table_item_view /* XXX */);
-
- tree_view->canvas = canvas;
-
- return (ECellView *)tree_view;
-}
-
-/*
- * ECell::kill_view method
- */
-static void
-ect_kill_view (ECellView *ecv)
-{
- ECellTreeView *tree_view = (ECellTreeView *) ecv;
-
- /* kill our subcell view */
- e_cell_kill_view (tree_view->subcell_view);
-
- g_free (tree_view);
-}
-
-/*
- * ECell::realize method
- */
-static void
-ect_realize (ECellView *ecell_view)
-{
- ECellTreeView *tree_view = (ECellTreeView *) ecell_view;
-
- /* realize our subcell view */
- e_cell_realize (tree_view->subcell_view);
-
- tree_view->gc = gdk_gc_new (GTK_WIDGET (tree_view->canvas)->window);
-
- gdk_gc_set_line_attributes (tree_view->gc, 1,
- GDK_LINE_ON_OFF_DASH, None, None);
- gdk_gc_set_dashes (tree_view->gc, 0, "\1\1", 2);
-
- if (parent_class->realize)
- (* parent_class->realize) (ecell_view);
-}
-
-/*
- * ECell::unrealize method
- */
-static void
-ect_unrealize (ECellView *ecv)
-{
- ECellTreeView *tree_view = (ECellTreeView *) ecv;
-
- /* unrealize our subcell view. */
- e_cell_unrealize (tree_view->subcell_view);
-
- gdk_gc_unref (tree_view->gc);
- tree_view->gc = NULL;
-
- 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, ECellFlags flags,
- int x1, int y1, int x2, int y2)
-{
- ECellTreeView *tree_view = (ECellTreeView *)ecell_view;
- ETreeModel *tree_model = e_cell_tree_get_tree_model(ecell_view->e_table_model, row);
- ETreeTableAdapter *tree_table_adapter = e_cell_tree_get_tree_table_adapter(ecell_view->e_table_model, row);
- ETreePath node;
- GdkRectangle rect, *clip_rect;
- GtkWidget *canvas = GTK_WIDGET (tree_view->canvas);
- GdkGC *fg_gc = canvas->style->fg_gc[GTK_STATE_ACTIVE];
- GdkColor *foreground;
- gboolean selected;
-
- int offset, subcell_offset;
-
- selected = flags & E_CELL_SELECTED;
-
- /* only draw the tree effects if we're the active sort */
- if (/* XXX */ TRUE) {
- GdkPixbuf *node_image;
- int node_image_width = 0, node_image_height = 0;
- ETreePath parent_node;
-
- node = e_cell_tree_get_node (ecell_view->e_table_model, row);
-
- offset = offset_of_node (ecell_view->e_table_model, row);
- subcell_offset = offset;
-
- node_image = e_tree_model_icon_at (tree_model, node);
-
- if (node_image) {
- node_image_width = gdk_pixbuf_get_width (node_image);
- node_image_height = gdk_pixbuf_get_height (node_image);
- }
-
- /*
- * Be a nice citizen: clip to the region we are supposed to draw on
- */
- rect.x = x1;
- rect.y = y1;
- rect.width = subcell_offset + node_image_width;
- rect.height = y2 - y1;
-
- gdk_gc_set_clip_rectangle (tree_view->gc, &rect);
- gdk_gc_set_clip_rectangle (fg_gc, &rect);
- clip_rect = &rect;
-
- if (selected) {
- foreground = &canvas->style->text [GTK_STATE_SELECTED];
- } else {
- foreground = &canvas->style->text [GTK_STATE_NORMAL];
- }
-
- gdk_gc_set_foreground (tree_view->gc, foreground);
-
- /* draw our lines */
- if (E_CELL_TREE(tree_view->cell_view.ecell)->draw_lines) {
-
- int depth;
-
- if (visible_depth_of_node (ecell_view->e_table_model, row) > 0
- || e_tree_model_node_get_children (tree_model, node, NULL) > 0)
- gdk_draw_line (drawable, tree_view->gc,
- rect.x + offset - INDENT_AMOUNT / 2 + 1,
- rect.y + rect.height / 2,
- rect.x + offset,
- rect.y + rect.height / 2);
-
- if (visible_depth_of_node (ecell_view->e_table_model, row) != 0) {
- gdk_draw_line (drawable, tree_view->gc,
- rect.x + offset - INDENT_AMOUNT / 2,
- rect.y,
- rect.x + offset - INDENT_AMOUNT / 2,
- (e_tree_model_node_get_next (tree_model, node)
- ? rect.y + rect.height
- : rect.y + rect.height / 2));
- }
-
- /* now traverse back up to the root of the tree, checking at
- each level if the node has siblings, and drawing the
- correct vertical pipe for it's configuration. */
- parent_node = e_tree_model_node_get_parent (tree_model, node);
- offset -= INDENT_AMOUNT;
- depth = visible_depth_of_node (ecell_view->e_table_model, row) - 1;
- while (parent_node && depth != 0) {
- if (e_tree_model_node_get_next(tree_model, parent_node)) {
- gdk_draw_line (drawable, tree_view->gc,
- rect.x + offset - INDENT_AMOUNT / 2,
- rect.y,
- rect.x + offset - INDENT_AMOUNT / 2,
- rect.y + rect.height);
- }
- parent_node = e_tree_model_node_get_parent (tree_model, parent_node);
- depth --;
- offset -= INDENT_AMOUNT;
- }
- }
-
- /* now draw our icon if we're expandable */
- if (e_tree_model_node_is_expandable (tree_model, node)) {
- GdkPixbuf *image;
- int image_width, image_height;
-
- image = (e_tree_table_adapter_node_is_expanded (tree_table_adapter, node)
- ? E_CELL_TREE(tree_view->cell_view.ecell)->open_pixbuf
- : E_CELL_TREE(tree_view->cell_view.ecell)->closed_pixbuf);
-
- image_width = gdk_pixbuf_get_width(image);
- image_height = gdk_pixbuf_get_height(image);
-
- gdk_pixbuf_render_to_drawable_alpha (image,
- drawable,
- 0, 0,
- x1 + subcell_offset - INDENT_AMOUNT / 2 - image_width / 2,
- y1 + (y2 - y1) / 2 - image_height / 2,
- image_width, image_height,
- GDK_PIXBUF_ALPHA_BILEVEL,
- 128,
- GDK_RGB_DITHER_NORMAL,
- image_width, 0);
- }
-
- if (node_image) {
- gdk_pixbuf_render_to_drawable_alpha (node_image,
- drawable,
- 0, 0,
- x1 + subcell_offset,
- y1 + (y2 - y1) / 2 - node_image_height / 2,
- node_image_width, node_image_height,
- GDK_PIXBUF_ALPHA_BILEVEL,
- 128,
- GDK_RGB_DITHER_NORMAL,
- node_image_width, 0);
- subcell_offset += node_image_width;
- }
- }
-
- /* Now cause our subcell to draw its contents, shifted by
- subcell_offset pixels */
- e_cell_draw (tree_view->subcell_view, drawable,
- model_col, view_col, row, flags,
- x1 + subcell_offset, y1, x2, y2);
-}
-
-/*
- * ECell::event method
- */
-static gint
-ect_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row, ECellFlags flags, ECellActions *actions)
-{
- ECellTreeView *tree_view = (ECellTreeView *) ecell_view;
- ETreeModel *tree_model = e_cell_tree_get_tree_model (ecell_view->e_table_model, row);
- ETreeTableAdapter *tree_table_adapter = e_cell_tree_get_tree_table_adapter(ecell_view->e_table_model, row);
- ETreePath node = e_cell_tree_get_node (ecell_view->e_table_model, row);
- int offset = offset_of_node (ecell_view->e_table_model, row);
-
- switch (event->type) {
- case GDK_BUTTON_PRESS: {
- /* if the event happened in our area of control (and
- we care about it), handle it. */
-
- /* only activate the tree control if the click/release happens in the icon's area. */
- if (event->button.x > (offset - INDENT_AMOUNT) && event->button.x < offset) {
- if (e_tree_model_node_is_expandable (tree_model, node)) {
- e_tree_table_adapter_node_set_expanded (tree_table_adapter,
- node,
- !e_tree_table_adapter_node_is_expanded(tree_table_adapter, node));
- return TRUE;
- }
- }
- else if (event->button.x < (offset - INDENT_AMOUNT))
- return FALSE;
- }
- default: {
- gint return_value;
-
- /* modify the event and pass it off to our subcell_view */
- switch (event->type) {
- case GDK_BUTTON_PRESS:
- case GDK_BUTTON_RELEASE:
- case GDK_2BUTTON_PRESS:
- case GDK_3BUTTON_PRESS:
- event->button.x -= offset;
- break;
- case GDK_MOTION_NOTIFY:
- event->motion.x -= offset;
- break;
- default:
- /* nada */
- break;
- }
-
- return_value = e_cell_event(tree_view->subcell_view, event, model_col, view_col, row, flags, actions);
-
- /* modify the event and pass it off to our subcell_view */
- switch (event->type) {
- case GDK_BUTTON_PRESS:
- case GDK_BUTTON_RELEASE:
- case GDK_2BUTTON_PRESS:
- case GDK_3BUTTON_PRESS:
- event->button.x += offset;
- break;
- case GDK_MOTION_NOTIFY:
- event->motion.x += offset;
- break;
- default:
- /* nada */
- break;
- }
-
- return return_value;
- }
- }
-}
-
-/*
- * ECell::height method
- */
-static int
-ect_height (ECellView *ecell_view, int model_col, int view_col, int row)
-{
- ECellTreeView *tree_view = (ECellTreeView *) ecell_view;
-
- return (((e_cell_height (tree_view->subcell_view, model_col, view_col, row)) + 1) / 2) * 2;
-}
-
-/*
- * ECell::max_width method
- */
-static int
-ect_max_width (ECellView *ecell_view, int model_col, int view_col)
-{
- ECellTreeView *tree_view = (ECellTreeView *) ecell_view;
- int row;
- int number_of_rows;
- int max_width = 0;
- int width = 0;
- int subcell_max_width = 0;
- gboolean per_row = e_cell_max_width_by_row_implemented (tree_view->subcell_view);
-
- number_of_rows = e_table_model_row_count (ecell_view->e_table_model);
-
- if (!per_row)
- subcell_max_width = e_cell_max_width (tree_view->subcell_view, model_col, view_col);
-
- for (row = 0; row < number_of_rows; row++) {
- ETreeModel *tree_model = e_cell_tree_get_tree_model(ecell_view->e_table_model, row);
- ETreePath node;
- GdkPixbuf *node_image;
- int node_image_width = 0, node_image_height = 0;
-
- int offset, subcell_offset;
-#if 0
- gboolean expanded, expandable;
- ETreeTableAdapter *tree_table_adapter = e_cell_tree_get_tree_table_adapter(ecell_view->e_table_model, row);
-#endif
-
- node = e_cell_tree_get_node (ecell_view->e_table_model, row);
-
- offset = offset_of_node (ecell_view->e_table_model, row);
- subcell_offset = offset;
-
- node_image = e_tree_model_icon_at (tree_model, node);
-
- if (node_image) {
- node_image_width = gdk_pixbuf_get_width (node_image);
- node_image_height = gdk_pixbuf_get_height (node_image);
- }
-
- width = subcell_offset + node_image_width;
-
- if (per_row)
- width += e_cell_max_width_by_row (tree_view->subcell_view, model_col, view_col, row);
- else
- width += subcell_max_width;
-
-#if 0
- expandable = e_tree_model_node_is_expandable (tree_model, node);
- expanded = e_tree_table_adapter_node_is_expanded (tree_table_adapter, node);
-
- /* This is unnecessary since this is already handled
- by the offset_of_node function. If that changes,
- this will have to change too. */
-
- if (expandable) {
- GdkPixbuf *image;
-
- image = (expanded
- ? E_CELL_TREE(tree_view->cell_view.ecell)->open_pixbuf
- : E_CELL_TREE(tree_view->cell_view.ecell)->closed_pixbuf);
-
- width += gdk_pixbuf_get_width(image);
- }
-#endif
-
- max_width = MAX (max_width, width);
- }
-
- return max_width;
-}
-
-/*
- * ECellView::show_tooltip method
- */
-static void
-ect_show_tooltip (ECellView *ecell_view, int model_col, int view_col, int row,
- int col_width, ETableTooltip *tooltip)
-{
- ECellTreeView *tree_view = (ECellTreeView *) ecell_view;
- ETreeModel *tree_model = e_cell_tree_get_tree_model (ecell_view->e_table_model, row);
- ETreePath node = e_cell_tree_get_node (ecell_view->e_table_model, row);
- int offset = offset_of_node (ecell_view->e_table_model, row);
- GdkPixbuf *node_image;
-
- node_image = e_tree_model_icon_at (tree_model, node);
- if (node_image)
- offset += gdk_pixbuf_get_width (node_image);
-
- tooltip->x += offset;
- e_cell_show_tooltip (tree_view->subcell_view, model_col, view_col, row, col_width - offset, tooltip);
-}
-
-/*
- * ECellView::get_bg_color method
- */
-static char *
-ect_get_bg_color (ECellView *ecell_view, int row)
-{
- ECellTreeView *tree_view = (ECellTreeView *) ecell_view;
-
- return e_cell_get_bg_color (tree_view->subcell_view, row);
-}
-
-/*
- * ECellView::enter_edit method
- */
-static void *
-ect_enter_edit (ECellView *ecell_view, int model_col, int view_col, int row)
-{
- /* just defer to our subcell's view */
- ECellTreeView *tree_view = (ECellTreeView *) ecell_view;
-
- return e_cell_enter_edit (tree_view->subcell_view, model_col, view_col, row);
-}
-
-/*
- * ECellView::leave_edit method
- */
-static void
-ect_leave_edit (ECellView *ecell_view, int model_col, int view_col, int row, void *edit_context)
-{
- /* just defer to our subcell's view */
- ECellTreeView *tree_view = (ECellTreeView *) ecell_view;
-
- e_cell_leave_edit (tree_view->subcell_view, model_col, view_col, row, edit_context);
-}
-
-static void
-ect_print (ECellView *ecell_view, GnomePrintContext *context,
- int model_col, int view_col, int row,
- double width, double height)
-{
- ECellTreeView *tree_view = (ECellTreeView *) ecell_view;
-
- if (/* XXX only if we're the active sort */ TRUE) {
- ETreeModel *tree_model = e_cell_tree_get_tree_model (ecell_view->e_table_model, row);
- ETreeTableAdapter *tree_table_adapter = e_cell_tree_get_tree_table_adapter(ecell_view->e_table_model, row);
- ETreePath node = e_cell_tree_get_node (ecell_view->e_table_model, row);
- int offset = offset_of_node (ecell_view->e_table_model, row);
- int subcell_offset = offset;
- gboolean expandable = e_tree_model_node_is_expandable (tree_model, node);
- gboolean expanded = e_tree_table_adapter_node_is_expanded (tree_table_adapter, node);
-
- /* draw our lines */
- if (E_CELL_TREE(tree_view->cell_view.ecell)->draw_lines) {
- int depth;
-
- if (!e_tree_model_node_is_root (tree_model, node)
- || e_tree_model_node_get_children (tree_model, node, NULL) > 0) {
- gnome_print_moveto (context,
- offset - INDENT_AMOUNT / 2,
- height / 2);
-
- gnome_print_lineto (context,
- offset,
- height / 2);
- }
-
- if (visible_depth_of_node (ecell_view->e_table_model, row) != 0) {
- gnome_print_moveto (context,
- offset - INDENT_AMOUNT / 2,
- height);
- gnome_print_lineto (context,
- offset - INDENT_AMOUNT / 2,
- (e_tree_model_node_get_next (tree_model, node)
- ? 0
- : height / 2));
- }
-
- /* now traverse back up to the root of the tree, checking at
- each level if the node has siblings, and drawing the
- correct vertical pipe for it's configuration. */
- node = e_tree_model_node_get_parent (tree_model, node);
- depth = visible_depth_of_node (ecell_view->e_table_model, row) - 1;
- offset -= INDENT_AMOUNT;
- while (node && depth != 0) {
- if (e_tree_model_node_get_next(tree_model, node)) {
- gnome_print_moveto (context,
- offset - INDENT_AMOUNT / 2,
- height);
- gnome_print_lineto (context,
- offset - INDENT_AMOUNT / 2,
- 0);
- }
- node = e_tree_model_node_get_parent (tree_model, node);
- depth --;
- offset -= INDENT_AMOUNT;
- }
- }
-
- /* now draw our icon if we're expandable */
- if (expandable) {
- double image_matrix [6] = {16, 0, 0, 16, 0, 0};
- GdkPixbuf *image = (expanded
- ? E_CELL_TREE(tree_view->cell_view.ecell)->open_pixbuf
- : E_CELL_TREE(tree_view->cell_view.ecell)->closed_pixbuf);
- int image_width, image_height, image_rowstride;
- guchar *image_pixels;
-
- image_width = gdk_pixbuf_get_width(image);
- image_height = gdk_pixbuf_get_height(image);
- image_pixels = gdk_pixbuf_get_pixels(image);
- image_rowstride = gdk_pixbuf_get_rowstride(image);
-
- image_matrix [4] = subcell_offset - INDENT_AMOUNT / 2 - image_width / 2;
- image_matrix [5] = height / 2 - image_height / 2;
-
- gnome_print_gsave (context);
- gnome_print_concat (context, image_matrix);
-
- gnome_print_rgbaimage (context, image_pixels, image_width, image_height, image_rowstride);
- gnome_print_grestore (context);
- }
-
- gnome_print_stroke (context);
-
- if (gnome_print_translate(context, subcell_offset, 0) == -1)
- /* FIXME */;
- width -= subcell_offset;
- }
-
-
- e_cell_print (tree_view->subcell_view, context, model_col, view_col, row, width, height);
-}
-
-static gdouble
-ect_print_height (ECellView *ecell_view, GnomePrintContext *context,
- int model_col, int view_col, int row,
- double width)
-{
- return 12; /* XXX */
-}
-
-/*
- * GtkObject::destroy method
- */
-static void
-ect_destroy (GtkObject *object)
-{
- ECellTree *ect = E_CELL_TREE (object);
-
- /* destroy our subcell */
- if (ect->subcell)
- gtk_object_unref (GTK_OBJECT (ect->subcell));
- ect->subcell = NULL;
-
- gdk_pixbuf_unref (ect->open_pixbuf);
- gdk_pixbuf_unref (ect->closed_pixbuf);
-
- GTK_OBJECT_CLASS (parent_class)->destroy (object);
-}
-
-static void
-e_cell_tree_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;
- ecc->print = ect_print;
- ecc->print_height = ect_print_height;
- ecc->max_width = ect_max_width;
- ecc->show_tooltip = ect_show_tooltip;
- ecc->get_bg_color = ect_get_bg_color;
-
- parent_class = gtk_type_class (PARENT_TYPE);
-}
-
-E_MAKE_TYPE(e_cell_tree, "ECellTree", ECellTree, e_cell_tree_class_init, NULL, PARENT_TYPE);
-
-/**
- * e_cell_tree_construct:
- * @ect: the ECellTree we're constructing.
- * @open_pixbuf: pixbuf to be used instead of the '-' icon.
- * @closed_pixbuf: pixbuf to be used instead of the '+' icon.
- * @draw_lines: whether or not to draw the lines between parents/children/siblings.
- * @subcell: the ECell to render to the right of the tree effects.
- *
- * Constructs an ECellTree. used by subclasses that need to
- * initialize a nested ECellTree. See e_cell_tree_new() for more info.
- *
- **/
-void
-e_cell_tree_construct (ECellTree *ect,
- GdkPixbuf *open_pixbuf,
- GdkPixbuf *closed_pixbuf,
- gboolean draw_lines,
- ECell *subcell)
-{
- ect->subcell = subcell;
- if (subcell) {
- gtk_object_ref (GTK_OBJECT (subcell));
- gtk_object_sink (GTK_OBJECT (subcell));
- }
- if (open_pixbuf)
- ect->open_pixbuf = open_pixbuf;
- else
- ect->open_pixbuf = gdk_pixbuf_new_from_xpm_data ((const char **)tree_expanded_xpm);
- if (closed_pixbuf)
- ect->closed_pixbuf = closed_pixbuf;
- else
- ect->closed_pixbuf = gdk_pixbuf_new_from_xpm_data ((const char **)tree_unexpanded_xpm);
-
- ect->draw_lines = draw_lines;
-}
-
-
-/**
- * e_cell_tree_new:
- * @open_pixbuf: pixbuf to be used instead of the '-' icon.
- * @closed_pixbuf: pixbuf to be used instead of the '+' icon.
- * @draw_lines: whether or not to draw the lines between parents/children/siblings.
- * @subcell: the ECell to render to the right of the tree effects.
- *
- * Creates a new ECell renderer that can be used to render tree
- * effects that come from an ETreeModel. Various assumptions are made
- * as to the fact that the ETableModel the ETable this cell is
- * associated with is in fact an ETreeModel. The cell uses special
- * columns to get at structural information (needed to draw the
- * lines/icons.
- *
- * Return value: an ECell object that can be used to render trees.
- **/
-ECell *
-e_cell_tree_new (GdkPixbuf *open_pixbuf,
- GdkPixbuf *closed_pixbuf,
- gboolean draw_lines,
- ECell *subcell)
-{
- ECellTree *ect = gtk_type_new (e_cell_tree_get_type ());
-
- e_cell_tree_construct (ect, open_pixbuf, closed_pixbuf, draw_lines, subcell);
-
- return (ECell *) ect;
-}
diff --git a/widgets/table/e-cell-tree.h b/widgets/table/e-cell-tree.h
deleted file mode 100644
index c821a35fe7..0000000000
--- a/widgets/table/e-cell-tree.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-cell-tree.h - Tree cell object.
- * Copyright 1999, 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Toshok <toshok@ximian.com>
- *
- * A majority of code taken from:
- *
- * the ECellText renderer.
- * Copyright 1998, The Free Software Foundation
- * Copyright 1999, 2000, Ximian, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_CELL_TREE_H_
-#define _E_CELL_TREE_H_
-
-#include <libgnomeui/gnome-canvas.h>
-#include <gal/e-table/e-cell.h>
-#include <libgnome/gnome-defs.h>
-
-BEGIN_GNOME_DECLS
-
-#define E_CELL_TREE_TYPE (e_cell_tree_get_type ())
-#define E_CELL_TREE(o) (GTK_CHECK_CAST ((o), E_CELL_TREE_TYPE, ECellTree))
-#define E_CELL_TREE_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_CELL_TREE_TYPE, ECellTreeClass))
-#define E_IS_CELL_TREE(o) (GTK_CHECK_TYPE ((o), E_CELL_TREE_TYPE))
-#define E_IS_CELL_TREE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_CELL_TREE_TYPE))
-
-typedef struct {
- ECell parent;
-
- gboolean draw_lines;
-
- GdkPixbuf *open_pixbuf;
- GdkPixbuf *closed_pixbuf;
-
- ECell *subcell;
-} ECellTree;
-
-typedef struct {
- ECellClass parent_class;
-} ECellTreeClass;
-
-GtkType e_cell_tree_get_type (void);
-ECell *e_cell_tree_new (GdkPixbuf *open_pixbuf,
- GdkPixbuf *closed_pixbuf,
- gboolean draw_lines,
- ECell *subcell);
-void e_cell_tree_construct (ECellTree *ect,
- GdkPixbuf *open_pixbuf,
- GdkPixbuf *closed_pixbuf,
- gboolean draw_lines,
- ECell *subcell);
-
-
-END_GNOME_DECLS
-
-#endif /* _E_CELL_TREE_H_ */
-
-
diff --git a/widgets/table/e-cell-vbox.c b/widgets/table/e-cell-vbox.c
deleted file mode 100644
index a854c2dae1..0000000000
--- a/widgets/table/e-cell-vbox.c
+++ /dev/null
@@ -1,489 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-cell-vbox.c - Vbox cell object.
- * Copyright 1999, 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Toshok <toshok@ximian.com>
- * Chris Lahey <clahey@ximian.com>
- *
- * A majority of code taken from:
- *
- * the ECellText renderer.
- * Copyright 1999, 2000, Ximian, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-
-#include <ctype.h>
-#include <math.h>
-#include <stdio.h>
-
-#include <gdk/gdkx.h> /* for BlackPixel */
-#include <gtk/gtkenums.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtkwindow.h>
-#include <gtk/gtkinvisible.h>
-#include <gtk/gtksignal.h>
-#include <gdk/gdkkeysyms.h>
-
-#include "gal/util/e-util.h"
-#include "e-table-item.h"
-#include "e-cell-vbox.h"
-
-#define PARENT_TYPE e_cell_get_type ()
-
-typedef struct {
- ECellView cell_view;
- int subcell_view_count;
- ECellView **subcell_views;
- int *model_cols;
-} ECellVboxView;
-
-static ECellClass *parent_class;
-
-#define INDENT_AMOUNT 16
-
-/*
- * ECell::new_view method
- */
-static ECellView *
-ecv_new_view (ECell *ecell, ETableModel *table_model, void *e_table_item_view)
-{
- ECellVbox *ecv = E_CELL_VBOX (ecell);
- ECellVboxView *vbox_view = g_new0 (ECellVboxView, 1);
- int i;
-
- vbox_view->cell_view.ecell = ecell;
- vbox_view->cell_view.e_table_model = table_model;
- vbox_view->cell_view.e_table_item_view = e_table_item_view;
-
- /* create our subcell view */
- vbox_view->subcell_view_count = ecv->subcell_count;
- vbox_view->subcell_views = g_new (ECellView *, vbox_view->subcell_view_count);
- vbox_view->model_cols = g_new (int, vbox_view->subcell_view_count);
-
- for (i = 0; i < vbox_view->subcell_view_count; i++) {
- vbox_view->subcell_views[i] = e_cell_new_view (ecv->subcells[i], table_model, e_table_item_view /* XXX */);
- vbox_view->model_cols[i] = ecv->model_cols[i];
- }
-
- return (ECellView *)vbox_view;
-}
-
-/*
- * ECell::kill_view method
- */
-static void
-ecv_kill_view (ECellView *ecv)
-{
- ECellVboxView *vbox_view = (ECellVboxView *) ecv;
- int i;
-
- /* kill our subcell view */
- for (i = 0; i < vbox_view->subcell_view_count; i++)
- e_cell_kill_view (vbox_view->subcell_views[i]);
-
- g_free (vbox_view->model_cols);
- g_free (vbox_view->subcell_views);
- g_free (vbox_view);
-}
-
-/*
- * ECell::realize method
- */
-static void
-ecv_realize (ECellView *ecell_view)
-{
- ECellVboxView *vbox_view = (ECellVboxView *) ecell_view;
- int i;
-
- /* realize our subcell view */
- for (i = 0; i < vbox_view->subcell_view_count; i++)
- e_cell_realize (vbox_view->subcell_views[i]);
-
- if (parent_class->realize)
- (* parent_class->realize) (ecell_view);
-}
-
-/*
- * ECell::unrealize method
- */
-static void
-ecv_unrealize (ECellView *ecv)
-{
- ECellVboxView *vbox_view = (ECellVboxView *) ecv;
- int i;
-
- /* unrealize our subcell view. */
- for (i = 0; i < vbox_view->subcell_view_count; i++)
- e_cell_unrealize (vbox_view->subcell_views[i]);
-
- if (parent_class->unrealize)
- (* parent_class->unrealize) (ecv);
-}
-
-/*
- * ECell::draw method
- */
-static void
-ecv_draw (ECellView *ecell_view, GdkDrawable *drawable,
- int model_col, int view_col, int row, ECellFlags flags,
- int x1, int y1, int x2, int y2)
-{
- ECellVboxView *vbox_view = (ECellVboxView *)ecell_view;
-
- int subcell_offset = 0;
- int i;
-
- for (i = 0; i < vbox_view->subcell_view_count; i++) {
- /* Now cause our subcells to draw their contents,
- shifted by subcell_offset pixels */
- int height = e_cell_height (vbox_view->subcell_views[i], vbox_view->model_cols[i], view_col, row);
- e_cell_draw (vbox_view->subcell_views[i], drawable,
- vbox_view->model_cols[i], view_col, row, flags,
- x1, y1 + subcell_offset, x2, y1 + subcell_offset + height);
-
- subcell_offset += e_cell_height (vbox_view->subcell_views[i], vbox_view->model_cols[i], view_col, row);
- }
-}
-
-/*
- * ECell::event method
- */
-static gint
-ecv_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row, ECellFlags flags, ECellActions *actions)
-{
- ECellVboxView *vbox_view = (ECellVboxView *)ecell_view;
- int y = 0;
- int i;
- int subcell_offset = 0;
-
- switch (event->type) {
- case GDK_BUTTON_PRESS:
- case GDK_BUTTON_RELEASE:
- case GDK_2BUTTON_PRESS:
- case GDK_3BUTTON_PRESS:
- y = event->button.y;
- break;
- case GDK_MOTION_NOTIFY:
- y = event->motion.y;
- break;
- default:
- /* nada */
- break;
- }
-
-
- for (i = 0; i < vbox_view->subcell_view_count; i++) {
- int height = e_cell_height (vbox_view->subcell_views[i], vbox_view->model_cols[i], view_col, row);
- if (y < subcell_offset + height)
- return e_cell_event(vbox_view->subcell_views[i], event, vbox_view->model_cols[i], view_col, row, flags, actions);
- subcell_offset += height;
- }
- return 0;
-}
-
-/*
- * ECell::height method
- */
-static int
-ecv_height (ECellView *ecell_view, int model_col, int view_col, int row)
-{
- ECellVboxView *vbox_view = (ECellVboxView *)ecell_view;
- int height = 0;
- int i;
-
- for (i = 0; i < vbox_view->subcell_view_count; i++) {
- height += e_cell_height (vbox_view->subcell_views[i], vbox_view->model_cols[i], view_col, row);
- }
- return height;
-}
-
-/*
- * ECell::max_width method
- */
-static int
-ecv_max_width (ECellView *ecell_view, int model_col, int view_col)
-{
- ECellVboxView *vbox_view = (ECellVboxView *)ecell_view;
- int max_width = 0;
- int i;
-
- for (i = 0; i < vbox_view->subcell_view_count; i++) {
- int width = e_cell_max_width (vbox_view->subcell_views[i], vbox_view->model_cols[i], view_col);
- max_width = MAX(width, max_width);
- }
-
- return max_width;
-}
-
-#if 0
-/*
- * ECellView::show_tooltip method
- */
-static void
-ecv_show_tooltip (ECellView *ecell_view, int model_col, int view_col, int row,
- int col_width, ETableTooltip *tooltip)
-{
- ECellVboxView *vbox_view = (ECellVboxView *) ecell_view;
- EVboxModel *vbox_model = e_cell_vbox_get_vbox_model (ecell_view->e_table_model, row);
- EVboxPath node = e_cell_vbox_get_node (ecell_view->e_table_model, row);
- int offset = offset_of_node (ecell_view->e_table_model, row);
- GdkPixbuf *node_image;
-
- node_image = e_vbox_model_icon_at (vbox_model, node);
- if (node_image)
- offset += gdk_pixbuf_get_width (node_image);
-
- tooltip->x += offset;
- e_cell_show_tooltip (vbox_view->subcell_view, model_col, view_col, row, col_width - offset, tooltip);
-}
-
-/*
- * ECellView::get_bg_color method
- */
-static char *
-ecv_get_bg_color (ECellView *ecell_view, int row)
-{
- ECellVboxView *vbox_view = (ECellVboxView *) ecell_view;
-
- return e_cell_get_bg_color (vbox_view->subcell_views[0], row);
-}
-
-/*
- * ECellView::enter_edit method
- */
-static void *
-ecv_enter_edit (ECellView *ecell_view, int model_col, int view_col, int row)
-{
- /* just defer to our subcell's view */
- ECellVboxView *vbox_view = (ECellVboxView *) ecell_view;
-
- return e_cell_enter_edit (vbox_view->subcell_view, model_col, view_col, row);
-}
-
-/*
- * ECellView::leave_edit method
- */
-static void
-ecv_leave_edit (ECellView *ecell_view, int model_col, int view_col, int row, void *edit_context)
-{
- /* just defer to our subcell's view */
- ECellVboxView *vbox_view = (ECellVboxView *) ecell_view;
-
- e_cell_leave_edit (vbox_view->subcell_view, model_col, view_col, row, edit_context);
-}
-
-static void
-ecv_print (ECellView *ecell_view, GnomePrintContext *context,
- int model_col, int view_col, int row,
- double width, double height)
-{
- ECellVboxView *vbox_view = (ECellVboxView *) ecell_view;
-
- if (/* XXX only if we're the active sort */ TRUE) {
- EVboxModel *vbox_model = e_cell_vbox_get_vbox_model (ecell_view->e_table_model, row);
- EVboxTableAdapter *vbox_table_adapter = e_cell_vbox_get_vbox_table_adapter(ecell_view->e_table_model, row);
- EVboxPath node = e_cell_vbox_get_node (ecell_view->e_table_model, row);
- int offset = offset_of_node (ecell_view->e_table_model, row);
- int subcell_offset = offset;
- gboolean expandable = e_vbox_model_node_is_expandable (vbox_model, node);
- gboolean expanded = e_vbox_table_adapter_node_is_expanded (vbox_table_adapter, node);
-
- /* draw our lines */
- if (E_CELL_VBOX(vbox_view->cell_view.ecell)->draw_lines) {
- int depth;
-
- if (!e_vbox_model_node_is_root (vbox_model, node)
- || e_vbox_model_node_get_children (vbox_model, node, NULL) > 0) {
- gnome_print_moveto (context,
- offset - INDENT_AMOUNT / 2,
- height / 2);
-
- gnome_print_lineto (context,
- offset,
- height / 2);
- }
-
- if (visible_depth_of_node (ecell_view->e_table_model, row) != 0) {
- gnome_print_moveto (context,
- offset - INDENT_AMOUNT / 2,
- height);
- gnome_print_lineto (context,
- offset - INDENT_AMOUNT / 2,
- (e_vbox_model_node_get_next (vbox_model, node)
- ? 0
- : height / 2));
- }
-
- /* now traverse back up to the root of the vbox, checking at
- each level if the node has siblings, and drawing the
- correct vertical pipe for it's configuration. */
- node = e_vbox_model_node_get_parent (vbox_model, node);
- depth = visible_depth_of_node (ecell_view->e_table_model, row) - 1;
- offset -= INDENT_AMOUNT;
- while (node && depth != 0) {
- if (e_vbox_model_node_get_next(vbox_model, node)) {
- gnome_print_moveto (context,
- offset - INDENT_AMOUNT / 2,
- height);
- gnome_print_lineto (context,
- offset - INDENT_AMOUNT / 2,
- 0);
- }
- node = e_vbox_model_node_get_parent (vbox_model, node);
- depth --;
- offset -= INDENT_AMOUNT;
- }
- }
-
- /* now draw our icon if we're expandable */
- if (expandable) {
- double image_matrix [6] = {16, 0, 0, 16, 0, 0};
- GdkPixbuf *image = (expanded
- ? E_CELL_VBOX(vbox_view->cell_view.ecell)->open_pixbuf
- : E_CELL_VBOX(vbox_view->cell_view.ecell)->closed_pixbuf);
- int image_width, image_height, image_rowstride;
- guchar *image_pixels;
-
- image_width = gdk_pixbuf_get_width(image);
- image_height = gdk_pixbuf_get_height(image);
- image_pixels = gdk_pixbuf_get_pixels(image);
- image_rowstride = gdk_pixbuf_get_rowstride(image);
-
- image_matrix [4] = subcell_offset - INDENT_AMOUNT / 2 - image_width / 2;
- image_matrix [5] = height / 2 - image_height / 2;
-
- gnome_print_gsave (context);
- gnome_print_concat (context, image_matrix);
-
- gnome_print_rgbaimage (context, image_pixels, image_width, image_height, image_rowstride);
- gnome_print_grestore (context);
- }
-
- gnome_print_stroke (context);
-
- if (gnome_print_translate(context, subcell_offset, 0) == -1)
- /* FIXME */;
- width -= subcell_offset;
- }
-
-
- e_cell_print (vbox_view->subcell_view, context, model_col, view_col, row, width, height);
-}
-
-static gdouble
-ecv_print_height (ECellView *ecell_view, GnomePrintContext *context,
- int model_col, int view_col, int row,
- double width)
-{
- return 12; /* XXX */
-}
-#endif
-
-/*
- * GtkObject::destroy method
- */
-static void
-ecv_destroy (GtkObject *object)
-{
- ECellVbox *ecv = E_CELL_VBOX (object);
- int i;
-
- /* destroy our subcell */
- for (i = 0; i < ecv->subcell_count; i++)
- if (ecv->subcells[i])
- gtk_object_unref (GTK_OBJECT (ecv->subcells[i]));
- g_free (ecv->subcells);
- ecv->subcells = NULL;
- ecv->subcell_count = 0;
-
- GTK_OBJECT_CLASS (parent_class)->destroy (object);
-}
-
-static void
-e_cell_vbox_class_init (GtkObjectClass *object_class)
-{
- ECellClass *ecc = (ECellClass *) object_class;
-
- object_class->destroy = ecv_destroy;
-
- ecc->new_view = ecv_new_view;
- ecc->kill_view = ecv_kill_view;
- ecc->realize = ecv_realize;
- ecc->unrealize = ecv_unrealize;
- ecc->draw = ecv_draw;
- ecc->event = ecv_event;
- ecc->height = ecv_height;
-#if 0
- ecc->enter_edit = ecv_enter_edit;
- ecc->leave_edit = ecv_leave_edit;
- ecc->print = ecv_print;
- ecc->print_height = ecv_print_height;
-#endif
- ecc->max_width = ecv_max_width;
-#if 0
- ecc->show_tooltip = ecv_show_tooltip;
- ecc->get_bg_color = ecv_get_bg_color;
-#endif
-
- parent_class = gtk_type_class (PARENT_TYPE);
-}
-
-static void
-e_cell_vbox_init (GtkObject *object)
-{
- ECellVbox *ecv = E_CELL_VBOX (object);
-
- ecv->subcells = NULL;
- ecv->subcell_count = 0;
-}
-
-E_MAKE_TYPE(e_cell_vbox, "ECellVbox", ECellVbox, e_cell_vbox_class_init, e_cell_vbox_init, PARENT_TYPE);
-
-/**
- * e_cell_vbox_new:
- *
- * Creates a new ECell renderer that can be used to render multiple
- * child cells.
- *
- * Return value: an ECell object that can be used to render multiple
- * child cells.
- **/
-ECell *
-e_cell_vbox_new (void)
-{
- ECellVbox *ecv = gtk_type_new (e_cell_vbox_get_type ());
-
- return (ECell *) ecv;
-}
-
-void
-e_cell_vbox_append (ECellVbox *vbox, ECell *subcell, int model_col)
-{
- vbox->subcell_count ++;
-
- vbox->subcells = g_renew (ECell *, vbox->subcells, vbox->subcell_count);
- vbox->model_cols = g_renew (int, vbox->model_cols, vbox->subcell_count);
-
- vbox->subcells[vbox->subcell_count - 1] = subcell;
- vbox->model_cols[vbox->subcell_count - 1] = model_col;
-
- if (subcell)
- gtk_object_ref (GTK_OBJECT (subcell));
-}
diff --git a/widgets/table/e-cell-vbox.h b/widgets/table/e-cell-vbox.h
deleted file mode 100644
index c5207561f5..0000000000
--- a/widgets/table/e-cell-vbox.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-cell-vbox.h - Vbox cell object.
- * Copyright 1999 - 2002, Ximian, Inc.
- *
- * Authors:
- * Chris Toshok <toshok@ximian.com>
- * Chris Lahey <clahey@ximina.com
- *
- * A majority of code taken from:
- *
- * the ECellText renderer.
- * Copyright 1999, 2000, Ximian, Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_CELL_VBOX_H_
-#define _E_CELL_VBOX_H_
-
-#include <libgnomeui/gnome-canvas.h>
-#include <gal/e-table/e-cell.h>
-#include <libgnome/gnome-defs.h>
-
-BEGIN_GNOME_DECLS
-
-#define E_CELL_VBOX_TYPE (e_cell_vbox_get_type ())
-#define E_CELL_VBOX(o) (GTK_CHECK_CAST ((o), E_CELL_VBOX_TYPE, ECellVbox))
-#define E_CELL_VBOX_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_CELL_VBOX_TYPE, ECellVboxClass))
-#define E_IS_CELL_VBOX(o) (GTK_CHECK_TYPE ((o), E_CELL_VBOX_TYPE))
-#define E_IS_CELL_VBOX_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_CELL_VBOX_TYPE))
-
-typedef struct {
- ECell parent;
-
- int subcell_count;
- ECell **subcells;
- int *model_cols;
-} ECellVbox;
-
-typedef struct {
- ECellClass parent_class;
-} ECellVboxClass;
-
-GtkType e_cell_vbox_get_type (void);
-ECell *e_cell_vbox_new (void);
-void e_cell_vbox_append (ECellVbox *vbox,
- ECell *subcell,
- int model_col);
-
-
-END_GNOME_DECLS
-
-#endif /* _E_CELL_VBOX_H_ */
-
-
diff --git a/widgets/table/e-cell.c b/widgets/table/e-cell.c
deleted file mode 100644
index b440370fb3..0000000000
--- a/widgets/table/e-cell.c
+++ /dev/null
@@ -1,499 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-cell.c - base class for cell renderers in e-table
- * Copyright 1999, 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Miguel de Icaza <miguel@ximian.com>
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include "e-cell.h"
-#include "gal/util/e-util.h"
-
-#define PARENT_TYPE gtk_object_get_type ()
-
-#define ECVIEW_EC_CLASS(v) (E_CELL_CLASS (GTK_OBJECT ((v)->ecell)->klass))
-
-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, ECellFlags flags,
- 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, ECellFlags flags, ECellActions *actions)
-{
- 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-height 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 *
-ec_save_state (ECellView *ecell_view, int model_col, int view_col, int row, void *context)
-{
- return NULL;
-}
-
-static void
-ec_load_state (ECellView *ecell_view, int model_col, int view_col, int row, void *context, void *save_state)
-{
-}
-
-static void
-ec_free_state (ECellView *ecell_view, int model_col, int view_col, int row, void *save_state)
-{
-}
-
-static void
-ec_show_tooltip (ECellView *ecell_view, int model_col, int view_col, int row, int col_width, ETableTooltip *tooltip)
-{
- /* Do nothing */
-}
-
-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;
- ecc->save_state = ec_save_state;
- ecc->load_state = ec_load_state;
- ecc->free_state = ec_free_state;
- ecc->print = NULL;
- ecc->print_height = NULL;
- ecc->max_width = NULL;
- ecc->max_width_by_row = NULL;
- ecc->show_tooltip = ec_show_tooltip;
-}
-
-static void
-e_cell_init (GtkObject *object)
-{
-}
-
-E_MAKE_TYPE(e_cell, "ECell", ECell, e_cell_class_init, e_cell_init, PARENT_TYPE);
-
-/**
- * e_cell_event:
- * @ecell_view: The ECellView where the event will be dispatched
- * @event: The GdkEvent.
- * @model_col: the column in the model
- * @view_col: the column in the view
- * @row: the row
- * @flags: flags about the current state
- * @actions: A second return value in case the cell wants to take some action (specifically grabbing & ungrabbing)
- *
- * Dispatches the event @event to the @ecell_view for.
- *
- * Returns: processing state from the GdkEvent handling.
- */
-gint
-e_cell_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row, ECellFlags flags, ECellActions *actions)
-{
- return ECVIEW_EC_CLASS(ecell_view)->event (
- ecell_view, event, model_col, view_col, row, flags, actions);
-}
-
-/**
- * e_cell_new_view:
- * @ecell: the Ecell that will create the new view
- * @table_model: the table model the ecell is bound to
- * @e_table_item_view: An ETableItem object (the CanvasItem that reprensents the view of the table)
- *
- * ECell renderers new to be bound to a table_model and to the actual view
- * during their life time to actually render the data. This method is invoked
- * by the ETableItem canvas item to instatiate a new view of the ECell.
- *
- * This is invoked when the ETableModel is attached to the ETableItem (a CanvasItem
- * that can render ETableModels in the screen).
- *
- * Returns: a new ECellView for this @ecell on the @table_model displayed on the @e_table_item_view.
- */
-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);
-}
-
-/**
- * e_cell_realize:
- * @ecell_view: The ECellView to be realized.
- *
- * This function is invoked to give a chance to the ECellView to allocate
- * any resources it needs from Gdk, equivalent to the GtkWidget::realize
- * signal.
- */
-void
-e_cell_realize (ECellView *ecell_view)
-{
- ECVIEW_EC_CLASS(ecell_view)->realize (ecell_view);
-}
-
-/**
- * e_cell_kill_view:
- * @ecell_view: view to be destroyed.
- *
- * This method it used to destroy a view of an ECell renderer
- */
-void
-e_cell_kill_view (ECellView *ecell_view)
-{
- ECVIEW_EC_CLASS(ecell_view)->kill_view (ecell_view);
-}
-
-/**
- * e_cell_unrealize:
- * @ecell_view: The ECellView to be unrealized.
- *
- * This function is invoked to give a chance to the ECellView to
- * release any resources it allocated during the realize method,
- * equivalent to the GtkWidget::unrealize signal.
- */
-void
-e_cell_unrealize (ECellView *ecell_view)
-{
- ECVIEW_EC_CLASS(ecell_view)->unrealize (ecell_view);
-}
-
-/**
- * e_cell_draw:
- * @ecell_view: the ECellView to redraw
- * @drawable: draw desination
- * @model_col: the column in the model being drawn.
- * @view_col: the column in the view being drawn (what the model maps to).
- * @row: the row being drawn
- * @flags: rendering flags.
- * @x1: boudary for the rendering
- * @y1: boudary for the rendering
- * @x2: boudary for the rendering
- * @y2: boudary for the rendering
- *
- * This instructs the ECellView to render itself into the drawable. The
- * region to be drawn in given by (x1,y1)-(x2,y2).
- *
- * The most important flags are %E_CELL_SELECTED and %E_CELL_FOCUSED, other
- * flags include alignments and justifications.
- */
-void
-e_cell_draw (ECellView *ecell_view, GdkDrawable *drawable,
- int model_col, int view_col, int row, ECellFlags flags,
- int x1, int y1, int x2, int y2)
-{
- g_return_if_fail (ecell_view != NULL);
- g_return_if_fail (row >= 0);
- g_return_if_fail (row < e_table_model_row_count(ecell_view->e_table_model));
-
- ECVIEW_EC_CLASS(ecell_view)->draw (ecell_view, drawable, model_col, view_col, row, flags, x1, y1, x2, y2);
-}
-
-/**
- * e_cell_print:
- * @ecell_view: the ECellView to redraw
- * @context: The GnomePrintContext where we output our printed data.
- * @model_col: the column in the model being drawn.
- * @view_col: the column in the view being drawn (what the model maps to).
- * @row: the row being drawn
- * @width: width
- * @height: height
- *
- * FIXME:
- */
-void
-e_cell_print (ECellView *ecell_view, GnomePrintContext *context,
- int model_col, int view_col, int row,
- double width, double height)
-{
- if (ECVIEW_EC_CLASS(ecell_view)->print)
- ECVIEW_EC_CLASS(ecell_view)->print (ecell_view, context, model_col, view_col, row, width, height);
-}
-
-/**
- * e_cell_print:
- *
- * FIXME:
- */
-gdouble
-e_cell_print_height (ECellView *ecell_view, GnomePrintContext *context,
- int model_col, int view_col, int row,
- double width)
-{
- if (ECVIEW_EC_CLASS(ecell_view)->print_height)
- return ECVIEW_EC_CLASS(ecell_view)->print_height
- (ecell_view, context, model_col, view_col, row, width);
- else
- return 0.0;
-}
-
-/**
- * e_cell_height:
- * @ecell_view: the ECellView.
- * @model_col: the column in the model
- * @view_col: the column in the view.
- * @row: the row to me measured
- *
- * Returns: the height of the cell at @model_col, @row rendered at
- * @view_col, @row.
- */
-int
-e_cell_height (ECellView *ecell_view, int model_col, int view_col, int row)
-{
- return ECVIEW_EC_CLASS(ecell_view)->height (ecell_view, model_col, view_col, row);
-}
-
-/**
- * e_cell_enter_edit:
- * @ecell_view: the ECellView that will enter editing
- * @model_col: the column in the model
- * @view_col: the column in the view
- * @row: the row
- *
- * Notifies the ECellView that it is about to enter editing mode for
- * @model_col, @row rendered at @view_col, @row.
- */
-void *
-e_cell_enter_edit (ECellView *ecell_view, int model_col, int view_col, int row)
-{
- return ECVIEW_EC_CLASS(ecell_view)->enter_edit (ecell_view, model_col, view_col, row);
-}
-
-/**
- * e_cell_leave_edit:
- * @ecell_view: the ECellView that will leave editing
- * @model_col: the column in the model
- * @view_col: the column in the view
- * @row: the row
- * @edit_context: the editing context
- *
- * Notifies the ECellView that editing is finished at @model_col, @row
- * rendered at @view_col, @row.
- */
-void
-e_cell_leave_edit (ECellView *ecell_view, int model_col, int view_col, int row, void *edit_context)
-{
- ECVIEW_EC_CLASS(ecell_view)->leave_edit (ecell_view, model_col, view_col, row, edit_context);
-}
-
-/**
- * e_cell_save_state:
- * @ecell_view: the ECellView to save
- * @model_col: the column in the model
- * @view_col: the column in the view
- * @row: the row
- * @edit_context: the editing context
- *
- * Returns: The save state.
- *
- * Requests that the ECellView return a void * representing the state
- * of the ECell. This is primarily intended for things like selection
- * or scrolling.
- */
-void *
-e_cell_save_state (ECellView *ecell_view, int model_col, int view_col, int row, void *edit_context)
-{
- if (ECVIEW_EC_CLASS(ecell_view)->save_state)
- return ECVIEW_EC_CLASS(ecell_view)->save_state (ecell_view, model_col, view_col, row, edit_context);
- else
- return NULL;
-}
-
-/**
- * e_cell_load_state:
- * @ecell_view: the ECellView to load
- * @model_col: the column in the model
- * @view_col: the column in the view
- * @row: the row
- * @edit_context: the editing context
- * @save_state: the save state to load from
- *
- * Requests that the ECellView load from the given save state.
- */
-void
-e_cell_load_state (ECellView *ecell_view, int model_col, int view_col, int row, void *edit_context, void *save_state)
-{
- if (ECVIEW_EC_CLASS(ecell_view)->load_state)
- ECVIEW_EC_CLASS(ecell_view)->load_state (ecell_view, model_col, view_col, row, edit_context, save_state);
-}
-
-/**
- * e_cell_load_state:
- * @ecell_view: the ECellView
- * @model_col: the column in the model
- * @view_col: the column in the view
- * @row: the row
- * @edit_context: the editing context
- * @save_state: the save state to free
- *
- * Requests that the ECellView free the given save state.
- */
-void
-e_cell_free_state (ECellView *ecell_view, int model_col, int view_col, int row, void *save_state)
-{
- if (ECVIEW_EC_CLASS(ecell_view)->free_state)
- ECVIEW_EC_CLASS(ecell_view)->free_state (ecell_view, model_col, view_col, row, save_state);
-}
-
-/**
- * e_cell_max_width:
- * @ecell_view: the ECellView that will leave editing
- * @model_col: the column in the model
- * @view_col: the column in the view.
- *
- * Returns: the maximum width for the ECellview at @model_col which
- * is being rendered as @view_col
- */
-int
-e_cell_max_width (ECellView *ecell_view, int model_col, int view_col)
-{
- return ECVIEW_EC_CLASS(ecell_view)->max_width
- (ecell_view, model_col, view_col);
-}
-
-/**
- * e_cell_max_width_by_row:
- * @ecell_view: the ECellView that we are curious about
- * @model_col: the column in the model
- * @view_col: the column in the view.
- * @row: The row in the model.
- *
- * Returns: the maximum width for the ECellview at @model_col which
- * is being rendered as @view_col for the data in @row.
- */
-int
-e_cell_max_width_by_row (ECellView *ecell_view, int model_col, int view_col, int row)
-{
- if (ECVIEW_EC_CLASS(ecell_view)->max_width_by_row)
- return ECVIEW_EC_CLASS(ecell_view)->max_width_by_row
- (ecell_view, model_col, view_col, row);
- else
- return e_cell_max_width (ecell_view, model_col, view_col);
-}
-
-/**
- * e_cell_max_width_by_row_implemented:
- * @ecell_view: the ECellView that we are curious about
- * @model_col: the column in the model
- * @view_col: the column in the view.
- * @row: The row in the model.
- *
- * Returns: the maximum width for the ECellview at @model_col which
- * is being rendered as @view_col for the data in @row.
- */
-gboolean
-e_cell_max_width_by_row_implemented (ECellView *ecell_view)
-{
- return (ECVIEW_EC_CLASS(ecell_view)->max_width_by_row != NULL);
-}
-
-void
-e_cell_show_tooltip (ECellView *ecell_view, int model_col, int view_col,
- int row, int col_width, ETableTooltip *tooltip)
-{
- ECVIEW_EC_CLASS(ecell_view)->show_tooltip
- (ecell_view, model_col, view_col, row, col_width, tooltip);
-}
-
-gchar *
-e_cell_get_bg_color(ECellView *ecell_view, int row)
-{
- if (ECVIEW_EC_CLASS(ecell_view)->get_bg_color)
- return ECVIEW_EC_CLASS(ecell_view)->get_bg_color (ecell_view, row);
- else
- return NULL;
-}
-
-void
-e_cell_style_set(ECellView *ecell_view, GtkStyle *previous_style)
-{
- if (ECVIEW_EC_CLASS(ecell_view)->style_set)
- ECVIEW_EC_CLASS(ecell_view)->style_set (ecell_view, previous_style);
-}
-
diff --git a/widgets/table/e-cell.h b/widgets/table/e-cell.h
deleted file mode 100644
index bc04f32f58..0000000000
--- a/widgets/table/e-cell.h
+++ /dev/null
@@ -1,222 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-cell.h
- * Copyright 1999, 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Miguel de Icaza <miguel@ximian.com>
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_CELL_H_
-#define _E_CELL_H_
-
-#include <gdk/gdktypes.h>
-#include <libgnomeprint/gnome-print.h>
-#include <gal/e-table/e-table-model.h>
-#include <gal/e-table/e-table-tooltip.h>
-#include <libgnome/gnome-defs.h>
-
-BEGIN_GNOME_DECLS
-
-#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 gboolean (*ETableSearchFunc) (gconstpointer haystack,
- const char *needle);
-
-typedef enum {
- E_CELL_SELECTED = 1 << 0,
-
- E_CELL_JUSTIFICATION = 3 << 1,
- E_CELL_JUSTIFY_CENTER = 0 << 1,
- E_CELL_JUSTIFY_LEFT = 1 << 1,
- E_CELL_JUSTIFY_RIGHT = 2 << 1,
- E_CELL_JUSTIFY_FILL = 3 << 1,
-
- E_CELL_ALIGN_LEFT = 1 << 1,
- E_CELL_ALIGN_RIGHT = 1 << 2,
-
- E_CELL_FOCUSED = 1 << 3,
-
- E_CELL_EDITING = 1 << 4,
-
- E_CELL_CURSOR = 1 << 5,
-} ECellFlags;
-
-typedef enum {
- E_CELL_GRAB = 1 << 0,
- E_CELL_UNGRAB = 1 << 1,
-} ECellActions;
-
-typedef struct {
- GtkObject object;
-} ECell;
-
-typedef struct {
- 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;
-} ECellView;
-
-#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,
- ECellFlags flags, int x1, int y1, int x2, int y2);
- gint (*event) (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row, ECellFlags flags, ECellActions *actions);
- 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);
- void *(*save_state) (ECellView *ecell_view, int model_col, int view_col, int row, void *context);
- void (*load_state) (ECellView *ecell_view, int model_col, int view_col, int row, void *context, void *save_state);
- void (*free_state) (ECellView *ecell_view, int model_col, int view_col, int row, void *save_state);
- void (*print) (ECellView *ecell_view, GnomePrintContext *context,
- int model_col, int view_col, int row,
- gdouble width, gdouble height);
- gdouble (*print_height) (ECellView *ecell_view, GnomePrintContext *context,
- int model_col, int view_col, int row, gdouble width);
- int (*max_width) (ECellView *ecell_view, int model_col, int view_col);
- int (*max_width_by_row) (ECellView *ecell_view, int model_col, int view_col, int row);
- void (*show_tooltip) (ECellView *ecell_view, int model_col, int view_col, int row, int col_width, ETableTooltip *tooltip);
- gchar *(*get_bg_color) (ECellView *ecell_view, int row);
-
- void (*style_set) (ECellView *ecell_view, GtkStyle *previous_style);
-} ECellClass;
-
-GtkType e_cell_get_type (void);
-
-/* View creation methods. */
-ECellView *e_cell_new_view (ECell *ecell,
- ETableModel *table_model,
- void *e_table_item_view);
-void e_cell_kill_view (ECellView *ecell_view);
-
-/* Cell View methods. */
-gint e_cell_event (ECellView *ecell_view,
- GdkEvent *event,
- int model_col,
- int view_col,
- int row,
- ECellFlags flags,
- ECellActions *actions);
-void e_cell_realize (ECellView *ecell_view);
-void e_cell_unrealize (ECellView *ecell_view);
-void e_cell_draw (ECellView *ecell_view,
- GdkDrawable *drawable,
- int model_col,
- int view_col,
- int row,
- ECellFlags flags,
- 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);
-gdouble e_cell_print_height (ECellView *ecell_view,
- GnomePrintContext *context,
- int model_col,
- int view_col,
- int row,
- gdouble width);
-int e_cell_max_width (ECellView *ecell_view,
- int model_col,
- int view_col);
-int e_cell_max_width_by_row (ECellView *ecell_view,
- int model_col,
- int view_col,
- int row);
-gboolean e_cell_max_width_by_row_implemented (ECellView *ecell_view);
-void e_cell_show_tooltip (ECellView *ecell_view,
- int model_col,
- int view_col,
- int row,
- int col_width,
- ETableTooltip *tooltip);
-gchar *e_cell_get_bg_color (ECellView *ecell_view,
- int row);
-void e_cell_style_set (ECellView *ecell_view,
- GtkStyle *previous_style);
-
-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);
-void *e_cell_save_state (ECellView *ecell_view,
- int model_col,
- int view_col,
- int row,
- void *edit_context);
-void e_cell_load_state (ECellView *ecell_view,
- int model_col,
- int view_col,
- int row,
- void *edit_context,
- void *state);
-void e_cell_free_state (ECellView *ecell_view,
- int model_col,
- int view_col,
- int row,
- void *state);
-
-
-END_GNOME_DECLS
-
-#endif /* _E_CELL_H_ */
diff --git a/widgets/table/e-table-click-to-add.c b/widgets/table/e-table-click-to-add.c
deleted file mode 100644
index 7c42b8c2e1..0000000000
--- a/widgets/table/e-table-click-to-add.c
+++ /dev/null
@@ -1,550 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-click-to-add.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <gdk/gdkkeysyms.h>
-#include <gtk/gtksignal.h>
-#include <libgnomeui/gnome-canvas.h>
-#include <libgnomeui/gnome-canvas-util.h>
-#include <libgnomeui/gnome-canvas-rect-ellipse.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
-
-#include "e-table-header.h"
-#include "e-table-click-to-add.h"
-#include "e-table-defines.h"
-#include "e-table-one.h"
-#include "gal/e-text/e-text.h"
-#include "gal/widgets/e-canvas.h"
-#include "gal/widgets/e-canvas-utils.h"
-#include "gal/util/e-util.h"
-
-enum {
- CURSOR_CHANGE,
- LAST_SIGNAL
-};
-
-static gint etcta_signals [LAST_SIGNAL] = { 0, };
-
-#define PARENT_OBJECT_TYPE gnome_canvas_group_get_type ()
-
-#define ELEMENTS(x) (sizeof (x) / sizeof (x[0]))
-
-static GnomeCanvasGroupClass *etcta_parent_class;
-
-enum {
- ARG_0,
- ARG_HEADER,
- ARG_MODEL,
- ARG_MESSAGE,
- ARG_WIDTH,
- ARG_HEIGHT,
-};
-
-static void
-etcta_cursor_change (GtkObject *object, gint row, gint col, ETableClickToAdd *etcta)
-{
- gtk_signal_emit (GTK_OBJECT (etcta),
- etcta_signals [CURSOR_CHANGE],
- row, col);
-}
-
-static void
-etcta_add_table_header (ETableClickToAdd *etcta, ETableHeader *header)
-{
- etcta->eth = header;
- if (etcta->eth)
- gtk_object_ref (GTK_OBJECT (etcta->eth));
- if (etcta->row)
- gnome_canvas_item_set(GNOME_CANVAS_ITEM(etcta->row),
- "ETableHeader", header,
- NULL);
-}
-
-static void
-etcta_drop_table_header (ETableClickToAdd *etcta)
-{
- GtkObject *header;
-
- if (!etcta->eth)
- return;
-
- header = GTK_OBJECT (etcta->eth);
-
- gtk_object_unref (header);
- etcta->eth = NULL;
-}
-
-static void
-etcta_add_one (ETableClickToAdd *etcta, ETableModel *one)
-{
- etcta->one = one;
- if (etcta->one)
- gtk_object_ref (GTK_OBJECT(etcta->one));
- if (etcta->row)
- gnome_canvas_item_set(GNOME_CANVAS_ITEM(etcta->row),
- "ETableModel", one,
- NULL);
- gtk_object_set(GTK_OBJECT(etcta->selection),
- "model", one,
- NULL);
-}
-
-static void
-etcta_drop_one (ETableClickToAdd *etcta)
-{
- if (!etcta->one)
- return;
- gtk_object_unref (GTK_OBJECT(etcta->one));
- etcta->one = NULL;
- gtk_object_set(GTK_OBJECT(etcta->selection),
- "model", NULL,
- NULL);
-}
-
-static void
-etcta_add_model (ETableClickToAdd *etcta, ETableModel *model)
-{
- etcta->model = model;
- if (etcta->model)
- gtk_object_ref (GTK_OBJECT(etcta->model));
-}
-
-static void
-etcta_drop_model (ETableClickToAdd *etcta)
-{
- etcta_drop_one (etcta);
- if (!etcta->model)
- return;
- gtk_object_unref (GTK_OBJECT(etcta->model));
- etcta->model = NULL;
-}
-
-static void
-etcta_add_message (ETableClickToAdd *etcta, char *message)
-{
- etcta->message = g_strdup(message);
-}
-
-static void
-etcta_drop_message (ETableClickToAdd *etcta)
-{
- g_free(etcta->message);
- etcta->message = NULL;
-}
-
-
-static void
-etcta_destroy (GtkObject *object){
- ETableClickToAdd *etcta = E_TABLE_CLICK_TO_ADD (object);
-
- etcta_drop_table_header (etcta);
- etcta_drop_model (etcta);
- etcta_drop_message (etcta);
- gtk_object_unref(GTK_OBJECT(etcta->selection));
-
- if (GTK_OBJECT_CLASS (etcta_parent_class)->destroy)
- (*GTK_OBJECT_CLASS (etcta_parent_class)->destroy) (object);
-}
-
-static void
-etcta_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- GnomeCanvasItem *item;
- ETableClickToAdd *etcta;
-
- item = GNOME_CANVAS_ITEM (o);
- etcta = E_TABLE_CLICK_TO_ADD (o);
-
- switch (arg_id){
- case ARG_HEADER:
- etcta_drop_table_header (etcta);
- etcta_add_table_header (etcta, E_TABLE_HEADER(GTK_VALUE_OBJECT (*arg)));
- break;
- case ARG_MODEL:
- etcta_drop_model (etcta);
- etcta_add_model (etcta, E_TABLE_MODEL(GTK_VALUE_OBJECT (*arg)));
- break;
- case ARG_MESSAGE:
- etcta_drop_message (etcta);
- etcta_add_message (etcta, GTK_VALUE_STRING (*arg));
- break;
- case ARG_WIDTH:
- etcta->width = GTK_VALUE_DOUBLE (*arg);
- if (etcta->row)
- gnome_canvas_item_set(etcta->row,
- "minimum_width", etcta->width,
- NULL);
- if (etcta->text)
- gnome_canvas_item_set(etcta->text,
- "width", etcta->width - 4,
- NULL);
- if (etcta->rect)
- gnome_canvas_item_set(etcta->rect,
- "x2", etcta->width - 1,
- NULL);
- break;
- }
- gnome_canvas_item_request_update(item);
-}
-
-static void
-etcta_get_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- ETableClickToAdd *etcta;
-
- etcta = E_TABLE_CLICK_TO_ADD (o);
-
- switch (arg_id){
- case ARG_HEADER:
- GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(etcta->eth);
- break;
- case ARG_MODEL:
- GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(etcta->model);
- break;
- case ARG_MESSAGE:
- GTK_VALUE_STRING (*arg) = g_strdup(etcta->message);
- break;
- case ARG_WIDTH:
- GTK_VALUE_DOUBLE (*arg) = etcta->width;
- break;
- case ARG_HEIGHT:
- GTK_VALUE_DOUBLE (*arg) = etcta->height;
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-static void
-etcta_realize (GnomeCanvasItem *item)
-{
- ETableClickToAdd *etcta = E_TABLE_CLICK_TO_ADD (item);
-
- etcta->rect = gnome_canvas_item_new(GNOME_CANVAS_GROUP(item),
- gnome_canvas_rect_get_type(),
- "x1", (double) 0,
- "y1", (double) 0,
- "x2", (double) etcta->width - 1,
- "y2", (double) etcta->height - 1,
- "outline_color", "black",
- "fill_color", "white",
- NULL);
-
- etcta->text = gnome_canvas_item_new(GNOME_CANVAS_GROUP(item),
- e_text_get_type(),
- "text", etcta->message ? etcta->message : "",
- "anchor", GTK_ANCHOR_NW,
- "width", etcta->width - 4,
- "draw_background", FALSE,
- NULL);
- e_canvas_item_move_absolute (etcta->text, 2, 2);
-
- if (GNOME_CANVAS_ITEM_CLASS (etcta_parent_class)->realize)
- (*GNOME_CANVAS_ITEM_CLASS (etcta_parent_class)->realize)(item);
-}
-
-static void
-etcta_unrealize (GnomeCanvasItem *item)
-{
- if (GNOME_CANVAS_ITEM_CLASS (etcta_parent_class)->unrealize)
- (*GNOME_CANVAS_ITEM_CLASS (etcta_parent_class)->unrealize)(item);
-}
-
-static void finish_editing (ETableClickToAdd *etcta);
-
-static int
-item_key_press (ETableItem *item, int row, int col, GdkEvent *event, ETableClickToAdd *etcta)
-{
- switch (event->key.keyval) {
- case GDK_Return:
- case GDK_KP_Enter:
- case GDK_ISO_Enter:
- case GDK_3270_Enter:
- finish_editing(etcta);
- return TRUE;
- }
- return FALSE;
-}
-
-static void
-set_initial_selection (ETableClickToAdd *etcta)
-{
- e_selection_model_do_something (E_SELECTION_MODEL(etcta->selection),
- 0, e_table_header_prioritized_column (etcta->eth),
- 0);
-}
-
-static void
-finish_editing (ETableClickToAdd *etcta)
-{
- if (etcta->row) {
- ETableModel *one;
-
- e_table_one_commit(E_TABLE_ONE(etcta->one));
- etcta_drop_one (etcta);
- gtk_object_destroy(GTK_OBJECT(etcta->row));
- etcta->row = NULL;
-
- one = e_table_one_new(etcta->model);
- etcta_add_one (etcta, one);
- gtk_object_unref(GTK_OBJECT(one));
-
- e_selection_model_clear(E_SELECTION_MODEL(etcta->selection));
-
- etcta->row = gnome_canvas_item_new(GNOME_CANVAS_GROUP(etcta),
- e_table_item_get_type(),
- "ETableHeader", etcta->eth,
- "ETableModel", etcta->one,
- "minimum_width", etcta->width,
- "horizontal_draw_grid", FALSE,
- "vertical_draw_grid", TRUE,
- "selection_model", etcta->selection,
- "cursor_mode", E_CURSOR_SPREADSHEET,
- NULL);
-
- gtk_signal_connect(GTK_OBJECT(etcta->row), "key_press",
- GTK_SIGNAL_FUNC(item_key_press), etcta);
-
- set_initial_selection (etcta);
- }
-}
-
-/*
- * Handles the events on the ETableClickToAdd, particularly it creates the ETableItem and passes in some events.
- */
-static int
-etcta_event (GnomeCanvasItem *item, GdkEvent *e)
-{
- ETableClickToAdd *etcta = E_TABLE_CLICK_TO_ADD (item);
-
- switch (e->type){
- case GDK_BUTTON_PRESS:
- if (etcta->text) {
- gtk_object_destroy(GTK_OBJECT(etcta->text));
- etcta->text = NULL;
- }
- if (etcta->rect) {
- gtk_object_destroy(GTK_OBJECT(etcta->rect));
- etcta->rect = NULL;
- }
- if (!etcta->row) {
- ETableModel *one;
-
- one = e_table_one_new(etcta->model);
- etcta_add_one (etcta, one);
- gtk_object_unref(GTK_OBJECT(one));
-
- e_selection_model_clear(E_SELECTION_MODEL(etcta->selection));
-
- etcta->row = gnome_canvas_item_new(GNOME_CANVAS_GROUP(item),
- e_table_item_get_type(),
- "ETableHeader", etcta->eth,
- "ETableModel", etcta->one,
- "minimum_width", etcta->width,
- "horizontal_draw_grid", FALSE,
- "vertical_draw_grid", TRUE,
- "selection_model", etcta->selection,
- "cursor_mode", E_CURSOR_SPREADSHEET,
- NULL);
-
- gtk_signal_connect(GTK_OBJECT(etcta->row), "key_press",
- GTK_SIGNAL_FUNC(item_key_press), etcta);
-
- e_canvas_item_grab_focus (GNOME_CANVAS_ITEM(etcta->row), TRUE);
-
- set_initial_selection (etcta);
- }
- break;
-
- case GDK_KEY_PRESS:
- switch (e->key.keyval) {
- case GDK_Tab:
- case GDK_KP_Tab:
- case GDK_ISO_Left_Tab:
- finish_editing (etcta);
- break;
- default:
- return FALSE;
- break;
- }
-
- default:
- return FALSE;
- }
- return TRUE;
-}
-
-static void
-etcta_reflow (GnomeCanvasItem *item, int flags)
-{
- ETableClickToAdd *etcta = E_TABLE_CLICK_TO_ADD (item);
-
- double old_height = etcta->height;
-
- if (etcta->text) {
- gtk_object_get(GTK_OBJECT(etcta->text),
- "height", &etcta->height,
- NULL);
- etcta->height += 6;
- }
- if (etcta->row) {
- gtk_object_get(GTK_OBJECT(etcta->row),
- "height", &etcta->height,
- NULL);
- }
-
- if (etcta->rect) {
- gtk_object_set(GTK_OBJECT(etcta->rect),
- "y2", etcta->height - 1,
- NULL);
- }
- if (old_height != etcta->height)
- e_canvas_item_request_parent_reflow(item);
-}
-
-static void
-etcta_class_init (ETableClickToAddClass *klass)
-{
- GnomeCanvasItemClass *item_class = GNOME_CANVAS_ITEM_CLASS(klass);
- GtkObjectClass *object_class = GTK_OBJECT_CLASS(klass);
-
- etcta_parent_class = gtk_type_class (PARENT_OBJECT_TYPE);
-
- klass->cursor_change = NULL;
-
- object_class->destroy = etcta_destroy;
- object_class->set_arg = etcta_set_arg;
- object_class->get_arg = etcta_get_arg;
-
- item_class->realize = etcta_realize;
- item_class->unrealize = etcta_unrealize;
- item_class->event = etcta_event;
-
- gtk_object_add_arg_type ("ETableClickToAdd::header", GTK_TYPE_OBJECT,
- GTK_ARG_READWRITE, ARG_HEADER);
- gtk_object_add_arg_type ("ETableClickToAdd::model", GTK_TYPE_OBJECT,
- GTK_ARG_READWRITE, ARG_MODEL);
- gtk_object_add_arg_type ("ETableClickToAdd::message", GTK_TYPE_STRING,
- GTK_ARG_READWRITE, ARG_MESSAGE);
- gtk_object_add_arg_type ("ETableClickToAdd::width", GTK_TYPE_DOUBLE,
- GTK_ARG_READWRITE, ARG_WIDTH);
- gtk_object_add_arg_type ("ETableClickToAdd::height", GTK_TYPE_DOUBLE,
- GTK_ARG_READABLE, ARG_HEIGHT);
-
- etcta_signals [CURSOR_CHANGE] =
- gtk_signal_new ("cursor_change",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETableClickToAddClass, cursor_change),
- gtk_marshal_NONE__INT_INT,
- GTK_TYPE_NONE, 2, GTK_TYPE_INT, GTK_TYPE_INT);
-
- E_OBJECT_CLASS_ADD_SIGNALS (object_class, etcta_signals, LAST_SIGNAL);
-}
-
-static void
-etcta_init (GnomeCanvasItem *item)
-{
- ETableClickToAdd *etcta = E_TABLE_CLICK_TO_ADD (item);
-
- etcta->one = NULL;
- etcta->model = NULL;
- etcta->eth = NULL;
-
- etcta->message = NULL;
-
- etcta->row = NULL;
- etcta->text = NULL;
- etcta->rect = NULL;
-
- etcta->selection = e_table_selection_model_new();
- gtk_signal_connect(GTK_OBJECT(etcta->selection), "cursor_changed",
- GTK_SIGNAL_FUNC(etcta_cursor_change), etcta);
-
- e_canvas_item_set_reflow_callback(item, etcta_reflow);
-}
-
-GtkType
-e_table_click_to_add_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type){
- GtkTypeInfo info = {
- "ETableClickToAdd",
- sizeof (ETableClickToAdd),
- sizeof (ETableClickToAddClass),
- (GtkClassInitFunc) etcta_class_init,
- (GtkObjectInitFunc) etcta_init,
- NULL, /* reserved 1 */
- NULL, /* reserved 2 */
- (GtkClassInitFunc) NULL
- };
-
- type = gtk_type_unique (PARENT_OBJECT_TYPE, &info);
- }
-
- return type;
-}
-
-
-/* The colors in this need to be themefied. */
-/**
- * e_table_click_to_add_commit:
- * @etcta: The %ETableClickToAdd to commit.
- *
- * This routine commits the current thing being edited and returns to
- * just displaying the click to add message.
- **/
-void
-e_table_click_to_add_commit (ETableClickToAdd *etcta)
-{
- if (etcta->row) {
- e_table_one_commit(E_TABLE_ONE(etcta->one));
- etcta_drop_one (etcta);
- gtk_object_destroy(GTK_OBJECT(etcta->row));
- etcta->row = NULL;
- }
- if (!etcta->rect) {
- etcta->rect = gnome_canvas_item_new(GNOME_CANVAS_GROUP(etcta),
- gnome_canvas_rect_get_type(),
- "x1", (double) 0,
- "y1", (double) 0,
- "x2", (double) etcta->width - 1,
- "y2", (double) etcta->height - 1,
- "outline_color", "black",
- "fill_color", "white",
- NULL);
- }
- if (!etcta->text) {
- etcta->text = gnome_canvas_item_new(GNOME_CANVAS_GROUP(etcta),
- e_text_get_type(),
- "text", etcta->message ? etcta->message : "",
- "anchor", GTK_ANCHOR_NW,
- "width", etcta->width - 4,
- "draw_background", FALSE,
- NULL);
- e_canvas_item_move_absolute (etcta->text, 3, 3);
- }
-}
diff --git a/widgets/table/e-table-click-to-add.h b/widgets/table/e-table-click-to-add.h
deleted file mode 100644
index 694b52a7aa..0000000000
--- a/widgets/table/e-table-click-to-add.h
+++ /dev/null
@@ -1,78 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-click-to-add.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_TABLE_CLICK_TO_ADD_H_
-#define _E_TABLE_CLICK_TO_ADD_H_
-
-#include <gnome-xml/tree.h>
-#include <libgnomeui/gnome-canvas.h>
-#include <gal/e-table/e-table-header.h>
-#include <gal/e-table/e-table-sort-info.h>
-#include <gal/e-table/e-table-item.h>
-#include <gal/e-table/e-table-selection-model.h>
-#include <libgnome/gnome-defs.h>
-
-BEGIN_GNOME_DECLS
-
-#define E_TABLE_CLICK_TO_ADD_TYPE (e_table_click_to_add_get_type ())
-#define E_TABLE_CLICK_TO_ADD(o) (GTK_CHECK_CAST ((o), E_TABLE_CLICK_TO_ADD_TYPE, ETableClickToAdd))
-#define E_TABLE_CLICK_TO_ADD_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_CLICK_TO_ADD_TYPE, ETableClickToAddClass))
-#define E_IS_TABLE_CLICK_TO_ADD(o) (GTK_CHECK_TYPE ((o), E_TABLE_CLICK_TO_ADD_TYPE))
-#define E_IS_TABLE_CLICK_TO_ADD_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_CLICK_TO_ADD_TYPE))
-
-typedef struct {
- GnomeCanvasGroup parent;
-
- ETableModel *one; /* The ETableOne. */
-
- ETableModel *model; /* The backend model. */
- ETableHeader *eth; /* This is just to give to the ETableItem. */
-
- char *message;
-
- GnomeCanvasItem *row; /* If row is NULL, we're sitting with no data and a "Click here" message. */
- GnomeCanvasItem *text; /* If text is NULL, row shouldn't be. */
- GnomeCanvasItem *rect; /* What the heck. Why not. */
-
- gdouble width;
- gdouble height;
-
- ETableSelectionModel *selection;
-} ETableClickToAdd;
-
-typedef struct {
- GnomeCanvasGroupClass parent_class;
-
- /*
- * signals
- */
- void (*cursor_change) (ETableClickToAdd *etcta, gint row, gint col);
-} ETableClickToAddClass;
-
-GtkType e_table_click_to_add_get_type (void);
-
-void e_table_click_to_add_commit (ETableClickToAdd *etcta);
-
-END_GNOME_DECLS
-
-#endif /* _E_TABLE_CLICK_TO_ADD_H_ */
diff --git a/widgets/table/e-table-col-dnd.h b/widgets/table/e-table-col-dnd.h
deleted file mode 100644
index ebc6f76431..0000000000
--- a/widgets/table/e-table-col-dnd.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-col-dnd.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_TABLE_COL_DND_H_
-#define _E_TABLE_COL_DND_H_
-
-#include <libgnome/gnome-defs.h>
-
-BEGIN_GNOME_DECLS
-
-#define TARGET_ETABLE_COL_TYPE "application/x-etable-column-header"
-
-enum {
- TARGET_ETABLE_COL_HEADER
-};
-
-END_GNOME_DECLS
-
-#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 9b147b198d..0000000000
--- a/widgets/table/e-table-col.c
+++ /dev/null
@@ -1,227 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-col.c
- * Copyright 1999, 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Miguel de Icaza <miguel@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <gtk/gtkobject.h>
-#include <gtk/gtksignal.h>
-#include "e-table-col.h"
-#include "gal/util/e-util.h"
-
-#define PARENT_TYPE (gtk_object_get_type ())
-
-static GtkObjectClass *parent_class;
-
-
-enum {
- ARG_0,
- ARG_SORTABLE,
-};
-
-static void
-etc_destroy (GtkObject *object)
-{
- ETableCol *etc = E_TABLE_COL (object);
-
- gtk_object_unref (GTK_OBJECT(etc->ecell));
-
- if (etc->pixbuf)
- gdk_pixbuf_unref (etc->pixbuf);
- if (etc->text)
- g_free (etc->text);
-
- (*parent_class->destroy)(object);
-}
-
-
-static void
-etc_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- ETableCol *etc = E_TABLE_COL (o);
-
- switch (arg_id){
- case ARG_SORTABLE:
- etc->sortable = GTK_VALUE_BOOL(*arg);
- break;
- }
-}
-
-static void
-etc_get_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- ETableCol *etc = E_TABLE_COL (o);
-
- switch (arg_id){
- case ARG_SORTABLE:
- GTK_VALUE_BOOL(*arg) = etc->sortable;
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-static void
-e_table_col_class_init (GtkObjectClass *object_class)
-{
- parent_class = gtk_type_class (PARENT_TYPE);
- object_class->destroy = etc_destroy;
- object_class->get_arg = etc_get_arg;
- object_class->set_arg = etc_set_arg;
-
- gtk_object_add_arg_type ("ETableCol::sortable",
- GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_SORTABLE);
-}
-
-static void
-e_table_col_init (ETableCol *etc)
-{
- etc->width = 0;
- etc->sortable = 1;
- etc->groupable = 1;
- etc->justification = GTK_JUSTIFY_LEFT;
- etc->priority = 0;
-}
-
-E_MAKE_TYPE(e_table_col, "ETableCol", ETableCol, e_table_col_class_init, e_table_col_init, PARENT_TYPE);
-
-/**
- * e_table_col_new:
- * @col_idx: the column we represent in the model
- * @text: a title for this column
- * @expansion: FIXME
- * @min_width: minimum width in pixels for this column
- * @ecell: the renderer to be used for this column
- * @compare: comparision function for the elements stored in this column
- * @resizable: whether the column can be resized interactively by the user
- * @priority: FIXME
- *
- * The ETableCol represents a column to be used inside an ETable. The
- * ETableCol objects are inserted inside an ETableHeader (which is just a collection
- * of ETableCols). The ETableHeader is the definition of the order in which
- * columns are shown to the user.
- *
- * The @text argument is the the text that will be shown as a header to the
- * user. @col_idx reflects where the data for this ETableCol object will
- * be fetch from an ETableModel. So even if the user changes the order
- * of the columns being viewed (the ETableCols in the ETableHeader), the
- * column will always point to the same column inside the ETableModel.
- *
- * The @ecell argument is an ECell object that needs to know how to render the
- * data in the ETableModel for this specific row.
- *
- * Returns: the newly created ETableCol object.
- */
-ETableCol *
-e_table_col_new (int col_idx, const char *text, double expansion, int min_width,
- ECell *ecell, GCompareFunc compare, gboolean resizable, gboolean disabled, int priority)
-{
- ETableCol *etc;
-
- g_return_val_if_fail (expansion >= 0, NULL);
- g_return_val_if_fail (min_width >= 0, NULL);
- g_return_val_if_fail (ecell != NULL, NULL);
- g_return_val_if_fail (compare != NULL, NULL);
- g_return_val_if_fail (text != 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->expansion = expansion;
- etc->min_width = min_width;
- etc->ecell = ecell;
- etc->compare = compare;
- etc->disabled = disabled;
- etc->priority = priority;
-
- etc->selected = 0;
- etc->resizable = resizable;
-
- gtk_object_ref (GTK_OBJECT(etc->ecell));
-
- return etc;
-}
-
-/**
- * e_table_col_new_with_pixbuf:
- * @col_idx: the column we represent in the model
- * @pixbuf: the image to be used for the header
- * @expansion: FIXME
- * @min_width: minimum width in pixels for this column
- * @ecell: the renderer to be used for this column
- * @compare: comparision function for the elements stored in this column
- * @resizable: whether the column can be resized interactively by the user
- *
- * The ETableCol represents a column to be used inside an ETable. The
- * ETableCol objects are inserted inside an ETableHeader (which is just a collection
- * of ETableCols). The ETableHeader is the definition of the order in which
- * columns are shown to the user.
- *
- * The @text argument is the the text that will be shown as a header to the
- * user. @col_idx reflects where the data for this ETableCol object will
- * be fetch from an ETableModel. So even if the user changes the order
- * of the columns being viewed (the ETableCols in the ETableHeader), the
- * column will always point to the same column inside the ETableModel.
- *
- * The @ecell argument is an ECell object that needs to know how to render the
- * data in the ETableModel for this specific row.
- *
- * Returns: the newly created ETableCol object.
- */
-ETableCol *
-e_table_col_new_with_pixbuf (int col_idx, const char *text, GdkPixbuf *pixbuf, double expansion, int min_width,
- ECell *ecell, GCompareFunc compare, gboolean resizable, gboolean disabled, int priority)
-{
- ETableCol *etc;
-
- g_return_val_if_fail (expansion >= 0, NULL);
- g_return_val_if_fail (min_width >= 0, NULL);
- g_return_val_if_fail (ecell != NULL, NULL);
- g_return_val_if_fail (compare != NULL, NULL);
- g_return_val_if_fail (pixbuf != NULL, NULL);
-
- etc = gtk_type_new (E_TABLE_COL_TYPE);
-
- etc->is_pixbuf = TRUE;
-
- etc->col_idx = col_idx;
- etc->text = g_strdup(text);
- etc->pixbuf = pixbuf;
- etc->expansion = expansion;
- etc->min_width = min_width;
- etc->ecell = ecell;
- etc->compare = compare;
- etc->disabled = disabled;
- etc->priority = priority;
-
- etc->selected = 0;
- etc->resizable = resizable;
-
- gtk_object_ref (GTK_OBJECT(etc->ecell));
- gdk_pixbuf_ref (etc->pixbuf);
-
- return etc;
-}
diff --git a/widgets/table/e-table-col.h b/widgets/table/e-table-col.h
deleted file mode 100644
index 485bd2d84c..0000000000
--- a/widgets/table/e-table-col.h
+++ /dev/null
@@ -1,106 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-col.h
- * Copyright 1999, 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Miguel de Icaza <miguel@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_TABLE_COL_H_
-#define _E_TABLE_COL_H_
-
-#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <gal/e-table/e-cell.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#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 enum {
- E_TABLE_COL_ARROW_NONE = 0,
- E_TABLE_COL_ARROW_UP,
- E_TABLE_COL_ARROW_DOWN
-} ETableColArrow;
-
-/*
- * Information about a single column
- */
-typedef struct {
- GtkObject base;
- char *text;
- GdkPixbuf *pixbuf;
- int min_width;
- int width;
- double expansion;
- short x;
- GCompareFunc compare;
- ETableSearchFunc search;
- unsigned int is_pixbuf:1;
- unsigned int selected:1;
- unsigned int resizable:1;
- unsigned int disabled:1;
- unsigned int sortable:1;
- unsigned int groupable:1;
- int col_idx;
- int priority;
-
- GtkJustification justification;
-
- ECell *ecell;
-} ETableCol;
-
-typedef struct {
- GtkObjectClass parent_class;
-} ETableColClass;
-
-GtkType e_table_col_get_type (void);
-ETableCol *e_table_col_new (int col_idx,
- const char *text,
- double expansion,
- int min_width,
- ECell *ecell,
- GCompareFunc compare,
- gboolean resizable,
- gboolean disabled,
- int priority);
-ETableCol *e_table_col_new_with_pixbuf (int col_idx,
- const char *text,
- GdkPixbuf *pixbuf,
- double expansion,
- int min_width,
- ECell *ecell,
- GCompareFunc compare,
- gboolean resizable,
- gboolean disabled,
- int priority);
-void e_table_col_destroy (ETableCol *etc);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* _E_TABLE_COL_H_ */
-
diff --git a/widgets/table/e-table-column-specification.c b/widgets/table/e-table-column-specification.c
deleted file mode 100644
index 30bb80c779..0000000000
--- a/widgets/table/e-table-column-specification.c
+++ /dev/null
@@ -1,144 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-column-specification.c - Savable specification of a column.
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <stdlib.h>
-#include <gtk/gtksignal.h>
-#include <gnome-xml/parser.h>
-#include <gnome-xml/xmlmemory.h>
-#include "gal/util/e-xml-utils.h"
-#include "gal/util/e-util.h"
-#include "e-table-column-specification.h"
-
-#define PARENT_TYPE (gtk_object_get_type())
-
-static GtkObjectClass *etcs_parent_class;
-
-static void
-free_strings (ETableColumnSpecification *etcs)
-{
- g_free(etcs->title);
- g_free(etcs->pixbuf);
- g_free(etcs->cell);
- g_free(etcs->compare);
- g_free(etcs->search);
-}
-
-static void
-etcs_destroy (GtkObject *object)
-{
- ETableColumnSpecification *etcs = E_TABLE_COLUMN_SPECIFICATION (object);
-
- free_strings(etcs);
-
- GTK_OBJECT_CLASS (etcs_parent_class)->destroy (object);
-}
-
-static void
-etcs_class_init (GtkObjectClass *klass)
-{
- etcs_parent_class = gtk_type_class (PARENT_TYPE);
-
- klass->destroy = etcs_destroy;
-}
-
-static void
-etcs_init (ETableColumnSpecification *specification)
-{
- specification->model_col = 0;
- specification->title = g_strdup("");
- specification->pixbuf = NULL;
-
- specification->expansion = 0;
- specification->minimum_width = 0;
- specification->resizable = FALSE;
- specification->disabled = FALSE;
-
- specification->cell = NULL;
- specification->compare = NULL;
- specification->search = NULL;
- specification->priority = 0;
-}
-
-E_MAKE_TYPE(e_table_column_specification, "ETableColumnSpecification", ETableColumnSpecification, etcs_class_init, etcs_init, PARENT_TYPE);
-
-ETableColumnSpecification *
-e_table_column_specification_new (void)
-{
- ETableColumnSpecification *etcs = gtk_type_new (E_TABLE_COLUMN_SPECIFICATION_TYPE);
-
- return (ETableColumnSpecification *) etcs;
-}
-
-void
-e_table_column_specification_load_from_node (ETableColumnSpecification *etcs,
- const xmlNode *node)
-{
- free_strings(etcs);
-
- etcs->model_col = e_xml_get_integer_prop_by_name (node, "model_col");
- etcs->title = e_xml_get_string_prop_by_name (node, "_title");
- etcs->pixbuf = e_xml_get_string_prop_by_name (node, "pixbuf");
-
- etcs->expansion = e_xml_get_double_prop_by_name (node, "expansion");
- etcs->minimum_width = e_xml_get_integer_prop_by_name (node, "minimum_width");
- etcs->resizable = e_xml_get_bool_prop_by_name (node, "resizable");
- etcs->disabled = e_xml_get_bool_prop_by_name (node, "disabled");
-
- etcs->cell = e_xml_get_string_prop_by_name (node, "cell");
- etcs->compare = e_xml_get_string_prop_by_name (node, "compare");
- etcs->search = e_xml_get_string_prop_by_name (node, "search");
- etcs->priority = e_xml_get_integer_prop_by_name_with_default (node, "priority", 0);
-
- if (etcs->title == NULL)
- etcs->title = g_strdup("");
-}
-
-xmlNode *
-e_table_column_specification_save_to_node (ETableColumnSpecification *specification,
- xmlNode *parent)
-{
- xmlNode *node;
- if (parent)
- node = xmlNewChild(parent, NULL, "ETableColumn", NULL);
- else
- node = xmlNewNode(NULL, "ETableColumn");
-
- e_xml_set_integer_prop_by_name(node, "model_col", specification->model_col);
- e_xml_set_string_prop_by_name(node, "_title", specification->title);
- e_xml_set_string_prop_by_name(node, "pixbuf", specification->pixbuf);
-
- e_xml_set_double_prop_by_name(node, "expansion", specification->expansion);
- e_xml_set_integer_prop_by_name(node, "minimum_width", specification->minimum_width);
- e_xml_set_bool_prop_by_name(node, "resizable", specification->resizable);
- e_xml_set_bool_prop_by_name(node, "disabled", specification->disabled);
-
- e_xml_set_string_prop_by_name(node, "cell", specification->cell);
- e_xml_set_string_prop_by_name(node, "compare", specification->compare);
- e_xml_set_string_prop_by_name(node, "search", specification->search);
- if (specification->priority != 0)
- e_xml_set_integer_prop_by_name (node, "priority", specification->priority);
-
- return node;
-}
-
diff --git a/widgets/table/e-table-column-specification.h b/widgets/table/e-table-column-specification.h
deleted file mode 100644
index bcd2889dc1..0000000000
--- a/widgets/table/e-table-column-specification.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-column-specification.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_TABLE_COLUMN_SPECIFICATION_H_
-#define _E_TABLE_COLUMN_SPECIFICATION_H_
-
-#include <glib.h>
-#include <gtk/gtkobject.h>
-#include <gnome-xml/tree.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define E_TABLE_COLUMN_SPECIFICATION_TYPE (e_table_column_specification_get_type ())
-#define E_TABLE_COLUMN_SPECIFICATION(o) (GTK_CHECK_CAST ((o), E_TABLE_COLUMN_SPECIFICATION_TYPE, ETableColumnSpecification))
-#define E_TABLE_COLUMN_SPECIFICATION_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_COLUMN_SPECIFICATION_TYPE, ETableColumnSpecificationClass))
-#define E_IS_TABLE_COLUMN_SPECIFICATION(o) (GTK_CHECK_TYPE ((o), E_TABLE_COLUMN_SPECIFICATION_TYPE))
-#define E_IS_TABLE_COLUMN_SPECIFICATION_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_COLUMN_SPECIFICATION_TYPE))
-
-typedef struct {
- GtkObject base;
- int model_col;
- char *title;
- char *pixbuf;
-
- double expansion;
- int minimum_width;
- guint resizable : 1;
- guint disabled : 1;
-
- char *cell;
- char *compare;
- char *search;
- int priority;
-} ETableColumnSpecification;
-
-typedef struct {
- GtkObjectClass parent_class;
-} ETableColumnSpecificationClass;
-
-GtkType e_table_column_specification_get_type (void);
-
-ETableColumnSpecification *e_table_column_specification_new (void);
-
-void e_table_column_specification_load_from_node (ETableColumnSpecification *state,
- const xmlNode *node);
-xmlNode *e_table_column_specification_save_to_node (ETableColumnSpecification *state,
- xmlNode *parent);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _E_TABLE_COLUMN_SPECIFICATION_H_ */
diff --git a/widgets/table/e-table-column.c b/widgets/table/e-table-column.c
deleted file mode 100644
index 2736a4381b..0000000000
--- a/widgets/table/e-table-column.c
+++ /dev/null
@@ -1,308 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-column.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include "e-table-column.h"
-
-enum {
- STRUCTURE_CHANGE,
- DIMENSION_CHANGE,
- LAST_SIGNAL
-};
-
-static guint etc_signals [LAST_SIGNAL] = { 0, };
-
-static GtkObjectClass *e_table_column_parent_class;
-
-static void
-e_table_column_destroy (GtkObject *object)
-{
- ETableColumn *etc = E_TABLE_COLUMN (object);
- const int cols = etc->col_count;
-
- /*
- * Destroy listeners
- */
- for (l = etc->listeners; l; l = l->next)
- g_free (l->data);
- g_slist_free (etc->listeners);
- etc->listeners = NULL;
-
- /*
- * Destroy columns
- */
- for (i = 0; i < cols; i++)
- e_table_column_remove (etc, i);
-
- if (e_table_column_parent_class->destroy)
- e_table_column_parent_class->destroy (object);
-}
-
-static void
-e_table_column_class_init (GtkObjectClass *object_class)
-{
- object_class->destroy = e_table_column_destroy;
-
- e_table_column_parent_class = (gtk_type_class (gtk_object_get_type ()));
-
- etc_signals [STRUCTURE_CHANGE] =
- gtk_signal_new ("structure_change",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- 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,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETableColumn, dimension_change),
- gtk_marshal_NONE__INT,
- GTK_TYPE_NONE, 1, GTK_TYPE_INT);
-
- E_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-config-field.c b/widgets/table/e-table-config-field.c
deleted file mode 100644
index 0416c5dcd2..0000000000
--- a/widgets/table/e-table-config-field.c
+++ /dev/null
@@ -1,292 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-config-field.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <stdlib.h>
-#include "gal/util/e-util.h"
-#include "e-table-config-field.h"
-
-#define PARENT_TYPE (gtk_vbox_get_type())
-
-static GtkVBoxClass *etcf_parent_class;
-
-static void
-etcf_destroy (GtkObject *object)
-{
- ETableConfigField *etcf = E_TABLE_CONFIG_FIELD (object);
-
- gtk_object_unref(GTK_OBJECT(etcf->spec));
- gtk_object_unref(GTK_OBJECT(etcf->sort_info));
-
- GTK_OBJECT_CLASS (etcf_parent_class)->destroy (object);
-}
-
-static void
-etcf_class_init (GtkObjectClass *klass)
-{
- etcf_parent_class = gtk_type_class (PARENT_TYPE);
-
- klass->destroy = etcf_destroy;
-}
-
-static void
-etcf_init (ETableConfigField *etcf)
-{
- etcf->spec = NULL;
- etcf->sort_info = NULL;
-
- etcf->combo = NULL;
- etcf->radio_ascending = NULL;
- etcf->radio_descending = NULL;
- etcf->child_fields = NULL;
-}
-
-E_MAKE_TYPE(e_table_config_field, "ETableConfigField", ETableConfigField, etcf_class_init, etcf_init, PARENT_TYPE);
-
-ETableConfigField *
-e_table_config_field_new (ETableSpecification *spec,
- ETableSortInfo *sort_info,
- gboolean grouping)
-{
- ETableConfigField *etcf = gtk_type_new (E_TABLE_CONFIG_FIELD_TYPE);
-
- e_table_config_field_construct (etcf, spec, sort_info, grouping);
-
- return (ETableConfigField *) etcf;
-}
-
-inline static int
-etcf_get_count (ETableConfigField *etcf)
-{
- if (etcf->grouping)
- return e_table_sort_info_grouping_get_count(etcf->sort_info);
- else
- return e_table_sort_info_sorting_get_count(etcf->sort_info);
-}
-
-inline static ETableSortColumn
-etcf_get_nth (ETableConfigField *etcf)
-{
- if (etcf->grouping)
- return e_table_sort_info_grouping_get_nth(etcf->sort_info, etcf->n);
- else
- return e_table_sort_info_sorting_get_nth(etcf->sort_info, etcf->n);
-}
-
-inline static void
-etcf_set_nth (ETableConfigField *etcf, ETableSortColumn column)
-{
- if (etcf->grouping)
- e_table_sort_info_grouping_set_nth(etcf->sort_info, etcf->n, column);
- else
- e_table_sort_info_sorting_set_nth(etcf->sort_info, etcf->n, column);
-}
-
-inline static void
-etcf_truncate (ETableConfigField *etcf)
-{
- if (etcf->grouping)
- e_table_sort_info_grouping_truncate(etcf->sort_info, etcf->n);
- else
- e_table_sort_info_sorting_truncate(etcf->sort_info, etcf->n);
-}
-
-static void
-etcf_set_sensitivity(ETableConfigField *etcf)
-{
- int count = etcf_get_count(etcf);
-
- if (etcf->n >= count) {
- gtk_widget_set_sensitive(etcf->radio_ascending, FALSE);
- gtk_widget_set_sensitive(etcf->radio_descending, FALSE);
- if (etcf->child_fields)
- gtk_widget_set_sensitive(etcf->child_fields, FALSE);
- } else {
- gtk_widget_set_sensitive(etcf->radio_ascending, TRUE);
- gtk_widget_set_sensitive(etcf->radio_descending, TRUE);
- if (etcf->child_fields)
- gtk_widget_set_sensitive(etcf->child_fields, TRUE);
- }
-}
-
-static void
-toggled(GtkWidget *widget, ETableConfigField *etcf)
-{
- int count;
-
- count = etcf_get_count(etcf);
- if (count > etcf->n) {
- ETableSortColumn sort_column;
-
- sort_column = etcf_get_nth(etcf);
- sort_column.ascending = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(etcf->radio_ascending));
- etcf_set_nth(etcf, sort_column);
- }
-}
-
-static void
-changed(GtkWidget *widget, ETableConfigField *etcf)
-{
- ETableColumnSpecification **column;
- gchar *text;
-
- text = gtk_entry_get_text(GTK_ENTRY(GTK_COMBO(etcf->combo)->entry));
- for (column = etcf->spec->columns; *column; column++) {
- if (!strcmp((*column)->title_, text)) {
- ETableSortColumn sort_column;
-
- sort_column.ascending = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(etcf->radio_ascending));
- sort_column.column = (*column)->model_col;
-
- etcf_set_nth(etcf, sort_column);
- etcf_set_sensitivity(etcf);
- return;
- }
- }
- etcf_truncate(etcf);
- etcf_set_sensitivity(etcf);
-}
-
-static void
-etcf_setup(ETableConfigField *etcf)
-{
- int count;
- GList *list = NULL;
- ETableColumnSpecification **column;
- ETableColumnSpecification *chosen_column = NULL;
- int model_col = -1;
-
- etcf_set_sensitivity(etcf);
-
- count = etcf_get_count(etcf);
-
- if (count > etcf->n) {
- ETableSortColumn sort_column;
-
- sort_column = etcf_get_nth(etcf);
- model_col = sort_column.column;
- if (sort_column.ascending)
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(etcf->radio_ascending), TRUE);
- else
- gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(etcf->radio_descending), TRUE);
- }
-
- for (column = etcf->spec->columns; *column; column++) {
- list = g_list_prepend(list, (*column)->title_);
- if (count > etcf->n && chosen_column == NULL && (*column)->model_col == model_col) {
- chosen_column = *column;
- }
- }
- list = g_list_reverse(list);
- list = g_list_prepend(list, "None");
-
- gtk_combo_set_popdown_strings(GTK_COMBO(etcf->combo), list);
- g_list_free(list);
-
- if (chosen_column) {
- gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(etcf->combo)->entry), chosen_column->title_);
- } else {
- gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(etcf->combo)->entry), "None");
- }
-
- gtk_signal_connect(GTK_OBJECT(GTK_COMBO(etcf->combo)->entry), "changed",
- GTK_SIGNAL_FUNC(changed), etcf);
- gtk_signal_connect(GTK_OBJECT(etcf->radio_ascending), "toggled",
- GTK_SIGNAL_FUNC(toggled), etcf);
- gtk_signal_connect(GTK_OBJECT(etcf->radio_descending), "toggled",
- GTK_SIGNAL_FUNC(toggled), etcf);
-}
-
-static ETableConfigField *
-e_table_config_field_construct_nth (ETableConfigField *etcf,
- ETableSpecification *spec,
- ETableSortInfo *sort_info,
- gboolean grouping,
- int n)
-{
- GtkWidget *frame;
- GtkWidget *internal_hbox;
- GtkWidget *internal_vbox1;
- GtkWidget *internal_vbox2;
-
- etcf->spec = spec;
- gtk_object_ref(GTK_OBJECT(spec));
-
- etcf->sort_info = sort_info;
- gtk_object_ref(GTK_OBJECT(sort_info));
-
- etcf->grouping = grouping;
- etcf->n = n;
-
- gtk_box_set_spacing(GTK_BOX(etcf), 6);
-
- frame = gtk_frame_new(n > 0 ? _("Then By") : (grouping ? _("Group By") : _("Sort By")));
- gtk_box_pack_start(GTK_BOX(etcf), frame, FALSE, FALSE, 0);
-
- internal_hbox = gtk_hbox_new(FALSE, 6);
- gtk_container_add(GTK_CONTAINER(frame), internal_hbox);
- gtk_container_set_border_width(GTK_CONTAINER(internal_hbox), 6);
-
- internal_vbox1 = gtk_vbox_new(FALSE, 6);
- gtk_box_pack_start(GTK_BOX(internal_hbox), internal_vbox1, FALSE, FALSE, 0);
-
- etcf->combo = gtk_combo_new();
- gtk_box_pack_start(GTK_BOX(internal_vbox1), etcf->combo, FALSE, FALSE, 0);
-
- internal_vbox2 = gtk_vbox_new(FALSE, 6);
- gtk_box_pack_start(GTK_BOX(internal_hbox), internal_vbox2, FALSE, FALSE, 0);
-
- etcf->radio_ascending = gtk_radio_button_new_with_label (NULL, _("Ascending"));
- gtk_box_pack_start(GTK_BOX(internal_vbox2), etcf->radio_ascending, FALSE, FALSE, 0);
-
- etcf->radio_descending = gtk_radio_button_new_with_label_from_widget (GTK_RADIO_BUTTON(etcf->radio_ascending), _("Descending"));
- gtk_box_pack_start(GTK_BOX(internal_vbox2), etcf->radio_descending, FALSE, FALSE, 0);
-
- if (n < 3) {
- etcf->child_fields = GTK_WIDGET(gtk_type_new (E_TABLE_CONFIG_FIELD_TYPE));
- e_table_config_field_construct_nth(E_TABLE_CONFIG_FIELD(etcf->child_fields), spec, sort_info, grouping, n + 1);
- gtk_box_pack_start(GTK_BOX(etcf), etcf->child_fields, FALSE, FALSE, 0);
- gtk_widget_show(etcf->child_fields);
- } else
- etcf->child_fields = NULL;
-
- etcf_setup(etcf);
-
- gtk_widget_show(etcf->radio_descending);
- gtk_widget_show(etcf->radio_ascending);
- gtk_widget_show(internal_vbox2);
- gtk_widget_show(etcf->combo);
- gtk_widget_show(internal_vbox1);
- gtk_widget_show(internal_hbox);
- gtk_widget_show(frame);
- return etcf;
-}
-
-ETableConfigField *
-e_table_config_field_construct (ETableConfigField *etcf,
- ETableSpecification *spec,
- ETableSortInfo *sort_info,
- gboolean grouping)
-{
- return e_table_config_field_construct_nth(etcf, spec, sort_info, grouping, 0);
-}
diff --git a/widgets/table/e-table-config-field.h b/widgets/table/e-table-config-field.h
deleted file mode 100644
index 495c29a76a..0000000000
--- a/widgets/table/e-table-config-field.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-config-field.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_TABLE_CONFIG_FIELD_H_
-#define _E_TABLE_CONFIG_FIELD_H_
-
-#include <gtk/gtkvbox.h>
-#include <gal/e-table/e-table-sort-info.h>
-#include <gal/e-table/e-table-specification.h>
-#include <libgnome/gnome-defs.h>
-
-BEGIN_GNOME_DECLS
-
-#define E_TABLE_CONFIG_FIELD_TYPE (e_table_config_field_get_type ())
-#define E_TABLE_CONFIG_FIELD(o) (GTK_CHECK_CAST ((o), E_TABLE_CONFIG_FIELD_TYPE, ETableConfigField))
-#define E_TABLE_CONFIG_FIELD_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_CONFIG_FIELD_TYPE, ETableConfigFieldClass))
-#define E_IS_TABLE_CONFIG_FIELD(o) (GTK_CHECK_TYPE ((o), E_TABLE_CONFIG_FIELD_TYPE))
-#define E_IS_TABLE_CONFIG_FIELD_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_CONFIG_FIELD_TYPE))
-
-typedef struct {
- GtkVBox base;
-
- ETableSpecification *spec;
- ETableSortInfo *sort_info;
- guint grouping : 1;
- int n;
-
- GtkWidget *combo;
- GtkWidget *radio_ascending;
- GtkWidget *radio_descending;
-
- GtkWidget *child_fields;
-} ETableConfigField;
-
-typedef struct {
- GtkVBoxClass parent_class;
-} ETableConfigFieldClass;
-
-GtkType e_table_config_field_get_type (void);
-ETableConfigField *e_table_config_field_new (ETableSpecification *spec,
- ETableSortInfo *sort_info,
- gboolean grouping);
-ETableConfigField *e_table_config_field_construct (ETableConfigField *field,
- ETableSpecification *spec,
- ETableSortInfo *sort_info,
- gboolean grouping);
-
-END_GNOME_DECLS
-
-#endif /* _E_TABLE_CONFIG_FIELD_H_ */
diff --git a/widgets/table/e-table-config-no-group.glade b/widgets/table/e-table-config-no-group.glade
deleted file mode 100644
index 1e49a59a06..0000000000
--- a/widgets/table/e-table-config-no-group.glade
+++ /dev/null
@@ -1,1761 +0,0 @@
-<?xml version="1.0"?>
-<GTK-Interface>
-
-<project>
- <name>E-table</name>
- <program_name>e-table</program_name>
- <directory></directory>
- <source_directory></source_directory>
- <pixmaps_directory></pixmaps_directory>
- <language>C</language>
- <gnome_support>True</gnome_support>
- <gettext_support>True</gettext_support>
- <output_main_file>False</output_main_file>
- <output_support_files>False</output_support_files>
- <output_build_files>False</output_build_files>
-</project>
-
-<widget>
- <class>GnomeDialog</class>
- <name>dialog-show-fields</name>
- <visible>False</visible>
- <title>Show Fields</title>
- <type>GTK_WINDOW_TOPLEVEL</type>
- <position>GTK_WIN_POS_NONE</position>
- <modal>False</modal>
- <allow_shrink>False</allow_shrink>
- <allow_grow>True</allow_grow>
- <auto_shrink>False</auto_shrink>
- <auto_close>False</auto_close>
- <hide_on_close>True</hide_on_close>
-
- <widget>
- <class>GtkVBox</class>
- <child_name>GnomeDialog:vbox</child_name>
- <name>dialog-vbox3</name>
- <homogeneous>False</homogeneous>
- <spacing>8</spacing>
- <child>
- <padding>4</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkHButtonBox</class>
- <child_name>GnomeDialog:action_area</child_name>
- <name>dialog-action_area3</name>
- <layout_style>GTK_BUTTONBOX_END</layout_style>
- <spacing>8</spacing>
- <child_min_width>85</child_min_width>
- <child_min_height>27</child_min_height>
- <child_ipad_x>7</child_ipad_x>
- <child_ipad_y>0</child_ipad_y>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- <pack>GTK_PACK_END</pack>
- </child>
-
- <widget>
- <class>GtkButton</class>
- <name>button20</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button22</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
- </widget>
- </widget>
-
- <widget>
- <class>GtkVBox</class>
- <name>vbox2</name>
- <homogeneous>False</homogeneous>
- <spacing>6</spacing>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkTable</class>
- <name>table2</name>
- <rows>1</rows>
- <columns>5</columns>
- <homogeneous>True</homogeneous>
- <row_spacing>6</row_spacing>
- <column_spacing>6</column_spacing>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkLabel</class>
- <name>label-available</name>
- <label>A_vailable Fields:</label>
- <justify>GTK_JUSTIFY_LEFT</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <left_attach>0</left_attach>
- <right_attach>2</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label-displayed</name>
- <label>Sh_ow these fields in order:</label>
- <justify>GTK_JUSTIFY_LEFT</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <left_attach>3</left_attach>
- <right_attach>5</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
- </widget>
-
- <widget>
- <class>GtkTable</class>
- <name>table3</name>
- <rows>1</rows>
- <columns>5</columns>
- <homogeneous>True</homogeneous>
- <row_spacing>6</row_spacing>
- <column_spacing>6</column_spacing>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkVBox</class>
- <name>vbox4</name>
- <homogeneous>False</homogeneous>
- <spacing>6</spacing>
- <child>
- <left_attach>0</left_attach>
- <right_attach>2</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>True</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>Custom</class>
- <name>custom-available</name>
- <creation_function>e_table_proxy_etable_available_new</creation_function>
- <int1>0</int1>
- <int2>0</int2>
- <last_modification_time>Thu, 21 Feb 2002 05:42:43 GMT</last_modification_time>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
- </widget>
- </widget>
-
- <widget>
- <class>GtkVBox</class>
- <name>vbox5</name>
- <homogeneous>False</homogeneous>
- <spacing>6</spacing>
- <child>
- <left_attach>3</left_attach>
- <right_attach>5</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>True</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>Custom</class>
- <name>custom-shown</name>
- <creation_function>e_table_proxy_etable_shown_new</creation_function>
- <int1>0</int1>
- <int2>0</int2>
- <last_modification_time>Thu, 21 Feb 2002 15:52:40 GMT</last_modification_time>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkHBox</class>
- <name>hbox4</name>
- <homogeneous>True</homogeneous>
- <spacing>6</spacing>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkButton</class>
- <name>button-up</name>
- <can_focus>True</can_focus>
- <label>Move _Up</label>
- <relief>GTK_RELIEF_NORMAL</relief>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button-down</name>
- <can_focus>True</can_focus>
- <label>Move _Down</label>
- <relief>GTK_RELIEF_NORMAL</relief>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- </child>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GtkVBox</class>
- <name>vbox6</name>
- <homogeneous>False</homogeneous>
- <spacing>6</spacing>
- <child>
- <left_attach>2</left_attach>
- <right_attach>3</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>True</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>GtkButton</class>
- <name>button-add</name>
- <can_focus>True</can_focus>
- <label>_Add -&gt;</label>
- <relief>GTK_RELIEF_NORMAL</relief>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button-remove</name>
- <can_focus>True</can_focus>
- <label>&lt;- _Remove</label>
- <relief>GTK_RELIEF_NORMAL</relief>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>Placeholder</class>
- </widget>
- </widget>
- </widget>
- </widget>
- </widget>
-</widget>
-
-<widget>
- <class>GnomeDialog</class>
- <name>dialog-group-by</name>
- <visible>False</visible>
- <title>Group</title>
- <type>GTK_WINDOW_TOPLEVEL</type>
- <position>GTK_WIN_POS_NONE</position>
- <modal>False</modal>
- <allow_shrink>False</allow_shrink>
- <allow_grow>True</allow_grow>
- <auto_shrink>False</auto_shrink>
- <auto_close>False</auto_close>
- <hide_on_close>True</hide_on_close>
-
- <widget>
- <class>GtkVBox</class>
- <child_name>GnomeDialog:vbox</child_name>
- <name>dialog-vbox4</name>
- <homogeneous>False</homogeneous>
- <spacing>8</spacing>
- <child>
- <padding>4</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkHButtonBox</class>
- <child_name>GnomeDialog:action_area</child_name>
- <name>dialog-action_area4</name>
- <layout_style>GTK_BUTTONBOX_END</layout_style>
- <spacing>8</spacing>
- <child_min_width>85</child_min_width>
- <child_min_height>27</child_min_height>
- <child_ipad_x>7</child_ipad_x>
- <child_ipad_y>0</child_ipad_y>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- <pack>GTK_PACK_END</pack>
- </child>
-
- <widget>
- <class>GtkButton</class>
- <name>button39</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <label>Clear All</label>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button41</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button42</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
- </widget>
- </widget>
-
- <widget>
- <class>GtkVBox</class>
- <name>vbox24</name>
- <homogeneous>False</homogeneous>
- <spacing>0</spacing>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkHBox</class>
- <name>hbox13</name>
- <homogeneous>False</homogeneous>
- <spacing>6</spacing>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkFrame</class>
- <name>frame-group-1</name>
- <label>Group Items By</label>
- <label_xalign>0</label_xalign>
- <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkHBox</class>
- <name>hbox5</name>
- <homogeneous>False</homogeneous>
- <spacing>6</spacing>
-
- <widget>
- <class>GtkVBox</class>
- <name>vbox7</name>
- <homogeneous>False</homogeneous>
- <spacing>0</spacing>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>Custom</class>
- <name>group-combo-1</name>
- <creation_function>e_table_proxy_gtk_combo_text_new</creation_function>
- <int1>0</int1>
- <int2>0</int2>
- <last_modification_time>Fri, 19 Jan 2001 04:52:09 GMT</last_modification_time>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkCheckButton</class>
- <name>checkbutton-group-1</name>
- <can_focus>True</can_focus>
- <label>Show field in View</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
- </widget>
-
- <widget>
- <class>GtkVBox</class>
- <name>vbox8</name>
- <homogeneous>False</homogeneous>
- <spacing>0</spacing>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkRadioButton</class>
- <name>radiobutton-ascending-group-1</name>
- <can_focus>True</can_focus>
- <label>Ascending</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <group>g-group-1</group>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkRadioButton</class>
- <name>radiobutton-descending-group-1</name>
- <can_focus>True</can_focus>
- <label>Descending</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <group>g-group-1</group>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label8</name>
- <label></label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label9</name>
- <label></label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label10</name>
- <label></label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
- </widget>
-
- <widget>
- <class>GtkHBox</class>
- <name>hbox14</name>
- <homogeneous>False</homogeneous>
- <spacing>6</spacing>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkLabel</class>
- <name>label11</name>
- <label></label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkFrame</class>
- <name>frame-group-2</name>
- <label>Then By</label>
- <label_xalign>0</label_xalign>
- <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkHBox</class>
- <name>hbox6</name>
- <homogeneous>False</homogeneous>
- <spacing>6</spacing>
-
- <widget>
- <class>GtkVBox</class>
- <name>vbox9</name>
- <homogeneous>False</homogeneous>
- <spacing>0</spacing>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>Custom</class>
- <name>group-combo-2</name>
- <creation_function>e_table_proxy_gtk_combo_text_new</creation_function>
- <int1>0</int1>
- <int2>0</int2>
- <last_modification_time>Fri, 19 Jan 2001 04:52:14 GMT</last_modification_time>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkCheckButton</class>
- <name>checkbutton-group-2</name>
- <can_focus>True</can_focus>
- <label>Show field in View</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
- </widget>
-
- <widget>
- <class>GtkVBox</class>
- <name>vbox10</name>
- <homogeneous>False</homogeneous>
- <spacing>0</spacing>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkRadioButton</class>
- <name>radiobutton-ascending-group-2</name>
- <can_focus>True</can_focus>
- <label>Ascending</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <group>g-group-2</group>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkRadioButton</class>
- <name>radiobutton-descending-group-2</name>
- <can_focus>True</can_focus>
- <label>Descending</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <group>g-group-2</group>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label19</name>
- <label></label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label18</name>
- <label></label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
- </widget>
-
- <widget>
- <class>GtkHBox</class>
- <name>hbox15</name>
- <homogeneous>False</homogeneous>
- <spacing>6</spacing>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkLabel</class>
- <name>label13</name>
- <label></label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label12</name>
- <label></label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkFrame</class>
- <name>frame-group-3</name>
- <label>Then By</label>
- <label_xalign>0</label_xalign>
- <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkHBox</class>
- <name>hbox7</name>
- <homogeneous>False</homogeneous>
- <spacing>6</spacing>
-
- <widget>
- <class>GtkVBox</class>
- <name>vbox11</name>
- <homogeneous>False</homogeneous>
- <spacing>0</spacing>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>Custom</class>
- <name>group-combo-3</name>
- <creation_function>e_table_proxy_gtk_combo_text_new</creation_function>
- <int1>0</int1>
- <int2>0</int2>
- <last_modification_time>Fri, 19 Jan 2001 04:52:18 GMT</last_modification_time>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkCheckButton</class>
- <name>checkbutton-group-3</name>
- <can_focus>True</can_focus>
- <label>Show field in View</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
- </widget>
-
- <widget>
- <class>GtkVBox</class>
- <name>vbox12</name>
- <homogeneous>False</homogeneous>
- <spacing>0</spacing>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkRadioButton</class>
- <name>radiobutton-ascending-group-3</name>
- <can_focus>True</can_focus>
- <label>Ascending</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <group>g-group-3</group>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkRadioButton</class>
- <name>radiobutton-descending-group-3</name>
- <can_focus>True</can_focus>
- <label>Descending</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <group>g-group-3</group>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label17</name>
- <label></label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
- </widget>
-
- <widget>
- <class>GtkHBox</class>
- <name>hbox16</name>
- <homogeneous>False</homogeneous>
- <spacing>6</spacing>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkLabel</class>
- <name>label14</name>
- <label></label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label16</name>
- <label></label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label15</name>
- <label></label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkFrame</class>
- <name>frame-group-4</name>
- <label>Then By</label>
- <label_xalign>0</label_xalign>
- <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkHBox</class>
- <name>hbox8</name>
- <homogeneous>False</homogeneous>
- <spacing>6</spacing>
-
- <widget>
- <class>GtkVBox</class>
- <name>vbox13</name>
- <homogeneous>False</homogeneous>
- <spacing>0</spacing>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>Custom</class>
- <name>group-combo-4</name>
- <creation_function>e_table_proxy_gtk_combo_text_new</creation_function>
- <int1>0</int1>
- <int2>0</int2>
- <last_modification_time>Fri, 19 Jan 2001 04:52:21 GMT</last_modification_time>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkCheckButton</class>
- <name>checkbutton-group-4</name>
- <can_focus>True</can_focus>
- <label>Show field in View</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
- </widget>
-
- <widget>
- <class>GtkVBox</class>
- <name>vbox14</name>
- <homogeneous>False</homogeneous>
- <spacing>0</spacing>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkRadioButton</class>
- <name>radiobutton-ascending-group-4</name>
- <can_focus>True</can_focus>
- <label>Ascending</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <group>g-group-4</group>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkRadioButton</class>
- <name>radiobutton-descending-group-4</name>
- <can_focus>True</can_focus>
- <label>Descending</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <group>g-group-4</group>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
- </widget>
- </widget>
- </widget>
- </widget>
- </widget>
- </widget>
-</widget>
-
-<widget>
- <class>GnomeDialog</class>
- <name>dialog-sort</name>
- <visible>False</visible>
- <title>Sort</title>
- <type>GTK_WINDOW_TOPLEVEL</type>
- <position>GTK_WIN_POS_NONE</position>
- <modal>False</modal>
- <allow_shrink>False</allow_shrink>
- <allow_grow>True</allow_grow>
- <auto_shrink>False</auto_shrink>
- <auto_close>False</auto_close>
- <hide_on_close>True</hide_on_close>
-
- <widget>
- <class>GtkVBox</class>
- <child_name>GnomeDialog:vbox</child_name>
- <name>vbox15</name>
- <homogeneous>False</homogeneous>
- <spacing>8</spacing>
- <child>
- <padding>4</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkHButtonBox</class>
- <child_name>GnomeDialog:action_area</child_name>
- <name>hbuttonbox1</name>
- <layout_style>GTK_BUTTONBOX_END</layout_style>
- <spacing>8</spacing>
- <child_min_width>85</child_min_width>
- <child_min_height>27</child_min_height>
- <child_ipad_x>7</child_ipad_x>
- <child_ipad_y>0</child_ipad_y>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- <pack>GTK_PACK_END</pack>
- </child>
-
- <widget>
- <class>GtkButton</class>
- <name>button43</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <label>Clear All</label>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button44</name>
- <can_default>True</can_default>
- <has_default>True</has_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button45</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
- </widget>
- </widget>
-
- <widget>
- <class>GtkTable</class>
- <name>table5</name>
- <rows>4</rows>
- <columns>1</columns>
- <homogeneous>False</homogeneous>
- <row_spacing>6</row_spacing>
- <column_spacing>6</column_spacing>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkFrame</class>
- <name>frame-sort-4</name>
- <label>Then By</label>
- <label_xalign>0</label_xalign>
- <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>3</top_attach>
- <bottom_attach>4</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>GtkHBox</class>
- <name>hbox9</name>
- <homogeneous>False</homogeneous>
- <spacing>6</spacing>
-
- <widget>
- <class>GtkAlignment</class>
- <name>alignment1</name>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xscale>1</xscale>
- <yscale>0</yscale>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>Custom</class>
- <name>sort-combo-4</name>
- <creation_function>e_table_proxy_gtk_combo_text_new</creation_function>
- <int1>0</int1>
- <int2>0</int2>
- <last_modification_time>Tue, 16 Jan 2001 08:33:52 GMT</last_modification_time>
- </widget>
- </widget>
-
- <widget>
- <class>GtkVBox</class>
- <name>vbox17</name>
- <homogeneous>False</homogeneous>
- <spacing>0</spacing>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkRadioButton</class>
- <name>radiobutton-ascending-sort-4</name>
- <can_focus>True</can_focus>
- <label>Ascending</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <group>group-4</group>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkRadioButton</class>
- <name>radiobutton-descending-sort-4</name>
- <can_focus>True</can_focus>
- <label>Descending</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <group>group-4</group>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GtkFrame</class>
- <name>frame-sort-3</name>
- <label>Then By</label>
- <label_xalign>0</label_xalign>
- <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>2</top_attach>
- <bottom_attach>3</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>GtkHBox</class>
- <name>hbox10</name>
- <homogeneous>False</homogeneous>
- <spacing>6</spacing>
-
- <widget>
- <class>GtkAlignment</class>
- <name>alignment2</name>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xscale>1</xscale>
- <yscale>0</yscale>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>Custom</class>
- <name>sort-combo-3</name>
- <creation_function>e_table_proxy_gtk_combo_text_new</creation_function>
- <int1>0</int1>
- <int2>0</int2>
- <last_modification_time>Tue, 16 Jan 2001 05:22:22 GMT</last_modification_time>
- </widget>
- </widget>
-
- <widget>
- <class>GtkVBox</class>
- <name>vbox19</name>
- <homogeneous>False</homogeneous>
- <spacing>0</spacing>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkRadioButton</class>
- <name>radiobutton-ascending-sort-3</name>
- <can_focus>True</can_focus>
- <label>Ascending</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <group>group-3</group>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkRadioButton</class>
- <name>radiobutton-descending-sort-3</name>
- <can_focus>True</can_focus>
- <label>Descending</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <group>group-3</group>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GtkFrame</class>
- <name>frame-sort-2</name>
- <label>Then By</label>
- <label_xalign>0</label_xalign>
- <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>1</top_attach>
- <bottom_attach>2</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>GtkHBox</class>
- <name>hbox11</name>
- <homogeneous>False</homogeneous>
- <spacing>6</spacing>
-
- <widget>
- <class>GtkAlignment</class>
- <name>alignment3</name>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xscale>1</xscale>
- <yscale>0</yscale>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>Custom</class>
- <name>sort-combo-2</name>
- <creation_function>e_table_proxy_gtk_combo_text_new</creation_function>
- <int1>0</int1>
- <int2>0</int2>
- <last_modification_time>Tue, 16 Jan 2001 05:22:15 GMT</last_modification_time>
- </widget>
- </widget>
-
- <widget>
- <class>GtkVBox</class>
- <name>vbox21</name>
- <homogeneous>False</homogeneous>
- <spacing>0</spacing>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkRadioButton</class>
- <name>radiobutton-ascending-sort-2</name>
- <can_focus>True</can_focus>
- <label>Ascending</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <group>group-2</group>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkRadioButton</class>
- <name>radiobutton-descending-sort-2</name>
- <can_focus>True</can_focus>
- <label>Descending</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <group>group-2</group>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GtkFrame</class>
- <name>frame-sort-1</name>
- <label>Sort Items By</label>
- <label_xalign>0</label_xalign>
- <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>GtkHBox</class>
- <name>hbox12</name>
- <homogeneous>False</homogeneous>
- <spacing>6</spacing>
-
- <widget>
- <class>GtkAlignment</class>
- <name>alignment4</name>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xscale>1</xscale>
- <yscale>0</yscale>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>Custom</class>
- <name>sort-combo-1</name>
- <can_focus>True</can_focus>
- <has_focus>True</has_focus>
- <creation_function>e_table_proxy_gtk_combo_text_new</creation_function>
- <int1>0</int1>
- <int2>0</int2>
- <last_modification_time>Tue, 16 Jan 2001 05:22:00 GMT</last_modification_time>
- </widget>
- </widget>
-
- <widget>
- <class>GtkVBox</class>
- <name>vbox23</name>
- <homogeneous>False</homogeneous>
- <spacing>0</spacing>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkRadioButton</class>
- <name>radiobutton-ascending-sort-1</name>
- <can_focus>True</can_focus>
- <label>Ascending</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <group>group-1</group>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkRadioButton</class>
- <name>radiobutton-descending-sort-1</name>
- <can_focus>True</can_focus>
- <label>Descending</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <group>group-1</group>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
- </widget>
- </widget>
- </widget>
- </widget>
- </widget>
-</widget>
-
-<widget>
- <class>GnomePropertyBox</class>
- <name>e-table-config</name>
- <visible>False</visible>
- <position>GTK_WIN_POS_NONE</position>
- <modal>False</modal>
- <allow_shrink>False</allow_shrink>
- <allow_grow>False</allow_grow>
- <auto_shrink>False</auto_shrink>
-
- <widget>
- <class>GtkNotebook</class>
- <child_name>GnomePropertyBox:notebook</child_name>
- <name>notebook1</name>
- <show_tabs>False</show_tabs>
- <show_border>True</show_border>
- <tab_pos>GTK_POS_TOP</tab_pos>
- <scrollable>False</scrollable>
- <tab_hborder>2</tab_hborder>
- <tab_vborder>2</tab_vborder>
- <popup_enable>False</popup_enable>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkFrame</class>
- <name>top-frame</name>
- <border_width>2</border_width>
- <label>Description</label>
- <label_xalign>0</label_xalign>
- <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
-
- <widget>
- <class>GtkTable</class>
- <name>table1</name>
- <border_width>2</border_width>
- <rows>2</rows>
- <columns>3</columns>
- <homogeneous>False</homogeneous>
- <row_spacing>2</row_spacing>
- <column_spacing>4</column_spacing>
-
- <widget>
- <class>GtkButton</class>
- <name>button-sort</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <signal>
- <name>clicked</name>
- <handler>on_sort_clicked</handler>
- <last_modification_time>Tue, 03 Oct 2000 22:10:58 GMT</last_modification_time>
- </signal>
- <label>_Sort...</label>
- <relief>GTK_RELIEF_NORMAL</relief>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>1</top_attach>
- <bottom_attach>2</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label-sort</name>
- <label></label>
- <justify>GTK_JUSTIFY_LEFT</justify>
- <wrap>True</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <left_attach>1</left_attach>
- <right_attach>2</right_attach>
- <top_attach>1</top_attach>
- <bottom_attach>2</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label4</name>
- <label></label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <left_attach>2</left_attach>
- <right_attach>3</right_attach>
- <top_attach>1</top_attach>
- <bottom_attach>2</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label21</name>
- <label></label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <left_attach>2</left_attach>
- <right_attach>3</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label-fields</name>
- <label></label>
- <justify>GTK_JUSTIFY_LEFT</justify>
- <wrap>True</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <left_attach>1</left_attach>
- <right_attach>2</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button-fields</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <signal>
- <name>clicked</name>
- <handler>on_sort_clicked</handler>
- <last_modification_time>Tue, 03 Oct 2000 22:10:58 GMT</last_modification_time>
- </signal>
- <label>_Fields Shown...</label>
- <relief>GTK_RELIEF_NORMAL</relief>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <child_name>Notebook:tab</child_name>
- <name>label20</name>
- <label>label20</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- </widget>
- </widget>
-</widget>
-
-</GTK-Interface>
diff --git a/widgets/table/e-table-config.c b/widgets/table/e-table-config.c
deleted file mode 100644
index 6b9ec94159..0000000000
--- a/widgets/table/e-table-config.c
+++ /dev/null
@@ -1,1137 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-config.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- * Miguel de Icaza <miguel@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-/*
- * FIXME:
- * Sort Dialog: when text is selected, the toggle button switches state.
- * Make Clear all work.
- */
-
-#include <config.h>
-
-#include "e-table-config.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtknotebook.h>
-#include <gtk/gtksignal.h>
-#include <gtk/gtktogglebutton.h>
-#include <libgnomeui/gnome-dialog.h>
-#include <libgnomeui/gnome-propertybox.h>
-#include <glade/glade.h>
-#include "gal/util/e-util.h"
-#include "gal/util/e-i18n.h"
-
-#include <e-table-scrolled.h>
-#include <e-table-without.h>
-#include <e-table-memory-store.h>
-
-
-#define PARENT_TYPE (gtk_object_get_type())
-
-static GtkObjectClass *config_parent_class;
-
-enum {
- CHANGED,
- LAST_SIGNAL
-};
-
-enum {
- ARG_0,
- ARG_STATE,
-};
-
-static guint e_table_config_signals [LAST_SIGNAL] = { 0, };
-
-static void
-config_destroy (GtkObject *object)
-{
- ETableConfig *config = E_TABLE_CONFIG (object);
-
- gtk_object_destroy (GTK_OBJECT (config->state));
- gtk_object_unref (GTK_OBJECT (config->source_state));
- gtk_object_unref (GTK_OBJECT (config->source_spec));
- g_free (config->header);
-
- g_slist_free (config->column_names);
- config->column_names = NULL;
-
- GTK_OBJECT_CLASS (config_parent_class)->destroy (object);
-}
-
-static void
-config_get_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- ETableConfig *config = E_TABLE_CONFIG (o);
-
- switch (arg_id){
- case ARG_STATE:
- GTK_VALUE_OBJECT (*arg) = (GtkObject *) config->state;
- break;
-
- default:
- break;
- }
-}
-
-static void
-e_table_config_changed (ETableConfig *config, ETableState *state)
-{
- g_return_if_fail (config != NULL);
- g_return_if_fail (E_IS_TABLE_CONFIG (config));
-
-
- gtk_signal_emit(GTK_OBJECT(config),
- e_table_config_signals [CHANGED],
- state);
-}
-
-static void
-config_class_init (GtkObjectClass *object_class)
-{
- ETableConfigClass *klass = E_TABLE_CONFIG_CLASS(object_class);
-
- config_parent_class = gtk_type_class (PARENT_TYPE);
-
- klass->changed = NULL;
-
- object_class->get_arg = config_get_arg;
- object_class->destroy = config_destroy;
-
- e_table_config_signals [CHANGED] =
- gtk_signal_new ("changed",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETableConfigClass, changed),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- E_OBJECT_CLASS_ADD_SIGNALS (object_class, e_table_config_signals, LAST_SIGNAL);
-
- gtk_object_add_arg_type ("ETableConfig::state", E_TABLE_STATE_TYPE,
- GTK_ARG_READABLE, ARG_STATE);
-}
-
-static ETableColumnSpecification *
-find_column_in_spec (ETableSpecification *spec, int model_col)
-{
- ETableColumnSpecification **column;
-
- for (column = spec->columns; *column; column++){
- if ((*column)->disabled)
- continue;
- if ((*column)->model_col != model_col)
- continue;
-
- return *column;
- }
-
- return NULL;
-}
-
-static int
-find_model_column_by_name (ETableSpecification *spec, const char *s)
-{
- ETableColumnSpecification **column;
-
- for (column = spec->columns; *column; column++){
-
- if ((*column)->disabled)
- continue;
- if (g_strcasecmp ((*column)->title, s) == 0)
- return (*column)->model_col;
- }
- return -1;
-}
-
-static void
-update_sort_and_group_config_dialog (ETableConfig *config, gboolean is_sort)
-{
- ETableConfigSortWidgets *widgets;
- int count, i;
-
- if (is_sort){
- count = e_table_sort_info_sorting_get_count (
- config->temp_state->sort_info);
- widgets = &config->sort [0];
- } else {
- count = e_table_sort_info_grouping_get_count (
- config->temp_state->sort_info);
- widgets = &config->group [0];
- }
-
- for (i = 0; i < 4; i++){
- gboolean sensitive = (i <= count);
- char *text = "";
-
- gtk_widget_set_sensitive (widgets [i].frames, sensitive);
-
- /*
- * Sorting is set, auto select the text
- */
- gtk_signal_handler_block (
- GTK_OBJECT (widgets [i].radio_ascending),
- widgets [i].toggled_id);
- gtk_signal_handler_block (
- GTK_OBJECT (widgets [i].combo->entry),
- widgets [i].changed_id);
-
- if (i < count){
- GtkToggleButton *a, *d;
- ETableSortColumn col =
- is_sort
- ? e_table_sort_info_sorting_get_nth (
- config->temp_state->sort_info,
- i)
- : e_table_sort_info_grouping_get_nth (
- config->temp_state->sort_info,
- i);
-
- ETableColumnSpecification *column =
- find_column_in_spec (config->source_spec, col.column);
-
- if (!column){
- /*
- * This is a bug in the programmer
- * stuff, but by the time we arrive
- * here, the user has been given a
- * warning
- */
- continue;
- }
-
- text = gettext (column->title);
-
- /*
- * Update radio buttons
- */
- a = GTK_TOGGLE_BUTTON (
- widgets [i].radio_ascending);
- d = GTK_TOGGLE_BUTTON (
- widgets [i].radio_descending);
-
- gtk_toggle_button_set_active (col.ascending ? a:d, 1);
- } else {
- GtkToggleButton *t;
-
- t = GTK_TOGGLE_BUTTON (
- widgets [i].radio_ascending);
-
- if (is_sort)
- g_assert (widgets [i].radio_ascending != config->group [i].radio_ascending);
- else
- g_assert (widgets [i].radio_ascending != config->sort [i].radio_ascending);
- gtk_toggle_button_set_active (t, 1);
- }
-
- /* Set the text */
- gtk_combo_text_set_text (widgets [i].combo, text);
-
- gtk_signal_handler_unblock (
- GTK_OBJECT (widgets [i].radio_ascending),
- widgets [i].toggled_id);
- gtk_signal_handler_unblock (
- GTK_OBJECT (widgets [i].combo->entry),
- widgets [i].changed_id);
- }
-}
-
-static void
-config_sort_info_update (ETableConfig *config)
-{
- ETableSortInfo *info = config->state->sort_info;
- GString *res;
- int count, i;
-
- count = e_table_sort_info_sorting_get_count (info);
- res = g_string_new ("");
-
- for (i = 0; i < count; i++) {
- ETableSortColumn col = e_table_sort_info_sorting_get_nth (info, i);
- ETableColumnSpecification *column;
-
- column = find_column_in_spec (config->source_spec, col.column);
- if (!column){
- g_warning ("Could not find column model in specification");
- continue;
- }
-
- g_string_append (res, gettext ((column)->title));
- g_string_append_c (res, ' ');
- g_string_append (
- res,
- col.ascending ?
- _("(Ascending)") : _("(Descending)"));
-
- if ((i + 1) != count)
- g_string_append (res, ", ");
- }
-
- if (res->str [0] == 0)
- g_string_append (res, _("Not sorted"));
-
- gtk_label_set_text (GTK_LABEL(config->sort_label), res->str);
-
- g_string_free (res, TRUE);
-}
-
-static void
-config_group_info_update (ETableConfig *config)
-{
- ETableSortInfo *info = config->state->sort_info;
- GString *res;
- int count, i;
-
- if (!e_table_sort_info_get_can_group (info))
- return;
-
- count = e_table_sort_info_grouping_get_count (info);
- res = g_string_new ("");
-
- for (i = 0; i < count; i++) {
- ETableSortColumn col = e_table_sort_info_grouping_get_nth (info, i);
- ETableColumnSpecification *column;
-
- column = find_column_in_spec (config->source_spec, col.column);
- if (!column){
- g_warning ("Could not find model column in specification");
- continue;
- }
-
- g_string_append (res, gettext ((column)->title));
- g_string_append_c (res, ' ');
- g_string_append (
- res,
- col.ascending ?
- _("(Ascending)") : _("(Descending)"));
-
- if ((i+1) != count)
- g_string_append (res, ", ");
- }
- if (res->str [0] == 0)
- g_string_append (res, _("No grouping"));
-
- gtk_label_set_text (GTK_LABEL (config->group_label), res->str);
- g_string_free (res, TRUE);
-}
-
-static void
-setup_fields (ETableConfig *config)
-{
- int i;
-
- e_table_without_show_all (config->available_model);
- e_table_subset_variable_clear (config->shown_model);
-
- if (config->temp_state) {
- for (i = 0; i < config->temp_state->col_count; i++) {
- e_table_subset_variable_add (config->shown_model, config->temp_state->columns[i]);
- e_table_without_hide (config->available_model, (void *) config->temp_state->columns[i]);
- }
- }
-}
-
-static void
-config_fields_info_update (ETableConfig *config)
-{
- ETableColumnSpecification **column;
- GString *res = g_string_new ("");
- int i;
-
- for (i = 0; i < config->state->col_count; i++){
- for (column = config->source_spec->columns; *column; column++){
-
- if ((*column)->disabled)
- continue;
-
- if (config->state->columns [i] != (*column)->model_col)
- continue;
-
- g_string_append (res, gettext ((*column)->title));
- if (column [1])
- g_string_append (res, ", ");
- }
- }
-
- gtk_label_set_text (GTK_LABEL (config->fields_label), res->str);
- g_string_free (res, TRUE);
-}
-
-static void
-do_sort_and_group_config_dialog (ETableConfig *config, gboolean is_sort)
-{
- GnomeDialog *dialog;
- int button, running = 1;
-
- config->temp_state = e_table_state_duplicate (config->state);
-
- update_sort_and_group_config_dialog (config, is_sort);
-
- gtk_widget_grab_focus (GTK_WIDGET (
- is_sort
- ? config->sort [0].combo
- : config->group [0].combo));
-
-
- if (is_sort)
- dialog = GNOME_DIALOG (config->dialog_sort);
- else
- dialog = GNOME_DIALOG (config->dialog_group_by);
-
- do {
- button = gnome_dialog_run (dialog);
- switch (button){
- case 0:
- if (is_sort){
- e_table_sort_info_sorting_truncate (
- config->temp_state->sort_info, 0);
- } else {
- e_table_sort_info_grouping_truncate (
- config->temp_state->sort_info, 0);
- }
- update_sort_and_group_config_dialog (config, is_sort);
- continue;
-
- /* OK */
- case 1:
- gtk_object_unref (GTK_OBJECT (config->state));
- config->state = config->temp_state;
- config->temp_state = 0;
- running = 0;
- gnome_property_box_changed (
- GNOME_PROPERTY_BOX (config->dialog_toplevel));
- break;
-
- /* CANCEL */
- case 2:
- gtk_object_unref (GTK_OBJECT (config->temp_state));
- config->temp_state = 0;
- running = 0;
- break;
- }
-
- } while (running);
- gnome_dialog_close (GNOME_DIALOG (dialog));
-
- if (is_sort)
- config_sort_info_update (config);
- else
- config_group_info_update (config);
-}
-
-static void
-do_fields_config_dialog (ETableConfig *config)
-{
- int button, running = 1;
-
- config->temp_state = e_table_state_duplicate (config->state);
-
- setup_fields (config);
-
- do {
- button = gnome_dialog_run (GNOME_DIALOG(config->dialog_show_fields));
- switch (button){
- /* OK */
- case 0:
- gtk_object_unref (GTK_OBJECT (config->state));
- config->state = config->temp_state;
- config->temp_state = 0;
- running = 0;
- gnome_property_box_changed (
- GNOME_PROPERTY_BOX (config->dialog_toplevel));
- break;
-
- /* CANCEL */
- case 1:
- gtk_object_unref (GTK_OBJECT (config->temp_state));
- config->temp_state = 0;
- running = 0;
- break;
- }
-
- } while (running);
- gnome_dialog_close (GNOME_DIALOG (config->dialog_show_fields));
-
- config_fields_info_update (config);
-}
-
-
-ETableMemoryStoreColumnInfo store_columns[] = {
- E_TABLE_MEMORY_STORE_STRING,
- E_TABLE_MEMORY_STORE_TERMINATOR
-};
-
-static ETableModel *global_store; /* Glade better not be reentrant any time soon. */
-
-static void
-create_global_store (ETableConfig *config)
-{
- int i;
-
- global_store = e_table_memory_store_new (store_columns);
- for (i = 0; config->source_spec->columns[i]; i++) {
- e_table_memory_store_insert (E_TABLE_MEMORY_STORE (global_store), i, (void **) &config->source_spec->columns[i]->title, NULL);
- }
-}
-
-char *spec = "<ETableSpecification no-headers=\"true\" cursor-mode=\"line\" draw-grid=\"false\" draw-focus=\"true\" selection-mode=\"browse\"> \
- <ETableColumn model_col= \"0\" _title=\"Name\" minimum_width=\"30\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
- <ETableState> <column source=\"0\"/> \
- <grouping/> \
- </ETableState> \
- </ETableSpecification>";
-
-GtkWidget *e_table_proxy_etable_shown_new (void);
-
-GtkWidget *
-e_table_proxy_etable_shown_new (void)
-{
- ETableModel *model = NULL;
-
- model = e_table_subset_variable_new (global_store);
-
- return e_table_scrolled_new (model, NULL, spec, NULL);
-}
-
-GtkWidget *e_table_proxy_etable_available_new (void);
-
-GtkWidget *
-e_table_proxy_etable_available_new (void)
-{
- ETableModel *model;
-
- model = e_table_without_new (global_store,
- NULL, NULL, NULL, NULL, NULL, NULL, NULL);
-
- e_table_without_show_all (E_TABLE_WITHOUT (model));
-
- return e_table_scrolled_new (model, NULL, spec, NULL);
-}
-
-static void
-config_button_fields (GtkWidget *widget, ETableConfig *config)
-{
- do_fields_config_dialog (config);
-}
-
-static void
-config_button_sort (GtkWidget *widget, ETableConfig *config)
-{
- do_sort_and_group_config_dialog (config, TRUE);
-}
-
-static void
-config_button_group (GtkWidget *widget, ETableConfig *config)
-{
- do_sort_and_group_config_dialog (config, FALSE);
-}
-
-static void
-dialog_destroyed (GtkObject *dialog, ETableConfig *config)
-{
- gtk_object_destroy (GTK_OBJECT (config));
-}
-
-static void
-dialog_apply (GnomePropertyBox *pbox, gint page_num, ETableConfig *config)
-{
- if (page_num != -1)
- return;
-
- e_table_config_changed (config, config->state);
-}
-
-/*
- * Invoked by the Glade auto-connect code
- */
-GtkWidget *e_table_proxy_gtk_combo_text_new (void);
-GtkWidget *
-e_table_proxy_gtk_combo_text_new (void)
-{
- return gtk_combo_text_new (TRUE);
-}
-
-#if 0
-static GtkWidget *
-configure_dialog (GladeXML *gui, const char *widget_name, ETableConfig *config)
-{
- GtkWidget *w;
-
- w = glade_xml_get_widget (gui, widget_name);
-
- return w;
-}
-#endif
-
-static void
-connect_button (ETableConfig *config, GladeXML *gui, const char *widget_name, void *cback)
-{
- GtkWidget *button = glade_xml_get_widget (gui, widget_name);
-
- if (button) {
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (cback), config);
- }
-}
-
-static void
-sort_entry_changed (GtkEntry *entry, ETableConfigSortWidgets *sort)
-{
- ETableConfig *config = sort->e_table_config;
- ETableSortInfo *sort_info = config->temp_state->sort_info;
- ETableConfigSortWidgets *base = &config->sort[0];
- int idx = sort - base;
-
- char *s = gtk_entry_get_text (entry);
-
- if (s && s [0] && g_hash_table_lookup (sort->combo->elements, s)){
- ETableSortColumn c;
- int col;
-
- col = find_model_column_by_name (config->source_spec, s);
- if (col == -1){
- g_warning ("sort: This should not happen (%s)", s);
- return;
- }
-
- c.ascending = GTK_TOGGLE_BUTTON (
- config->sort [idx].radio_ascending)->active;
- c.column = col;
- e_table_sort_info_sorting_set_nth (sort_info, idx, c);
-
- update_sort_and_group_config_dialog (config, TRUE);
- } else {
- e_table_sort_info_sorting_truncate (sort_info, idx);
- update_sort_and_group_config_dialog (config, TRUE);
- }
-}
-
-static void
-sort_ascending_toggled (GtkToggleButton *t, ETableConfigSortWidgets *sort)
-{
- ETableConfig *config = sort->e_table_config;
- ETableSortInfo *si = config->temp_state->sort_info;
- ETableConfigSortWidgets *base = &config->sort[0];
- int idx = sort - base;
- ETableSortColumn c;
-
- c = e_table_sort_info_sorting_get_nth (si, idx);
- c.ascending = t->active;
- e_table_sort_info_sorting_set_nth (si, idx, c);
-}
-
-static void
-configure_sort_dialog (ETableConfig *config, GladeXML *gui)
-{
- GSList *l;
- int i;
-
- for (i = 0; i < 4; i++){
- char buffer [80];
-
- snprintf (buffer, sizeof (buffer), "sort-combo-%d", i + 1);
- config->sort [i].combo = GTK_COMBO_TEXT (
- glade_xml_get_widget (gui, buffer));
-
- gtk_combo_text_add_item (config->sort [i].combo, "", "");
-
- snprintf (buffer, sizeof (buffer), "frame-sort-%d", i + 1);
- config->sort [i].frames =
- glade_xml_get_widget (gui, buffer);
-
- snprintf (
- buffer, sizeof (buffer),
- "radiobutton-ascending-sort-%d", i+1);
- config->sort [i].radio_ascending = glade_xml_get_widget (
- gui, buffer);
-
- snprintf (
- buffer, sizeof (buffer),
- "radiobutton-descending-sort-%d", i+1);
- config->sort [i].radio_descending = glade_xml_get_widget (
- gui, buffer);
-
- config->sort [i].e_table_config = config;
- }
-
- for (l = config->column_names; l; l = l->next){
- char *label = l->data;
-
- for (i = 0; i < 4; i++){
- gtk_combo_text_add_item (
- config->sort [i].combo,
- gettext (label), label);
- }
- }
-
- /*
- * After we have runtime modified things, signal connect
- */
- for (i = 0; i < 4; i++){
- config->sort [i].changed_id = gtk_signal_connect (
- GTK_OBJECT (config->sort [i].combo->entry),
- "changed", sort_entry_changed, &config->sort [i]);
-
- config->sort [i].toggled_id = gtk_signal_connect (
- GTK_OBJECT (config->sort [i].radio_ascending),
- "toggled", sort_ascending_toggled, &config->sort [i]);
- }
-}
-
-static void
-group_entry_changed (GtkEntry *entry, ETableConfigSortWidgets *group)
-{
- ETableConfig *config = group->e_table_config;
- ETableSortInfo *sort_info = config->temp_state->sort_info;
- ETableConfigSortWidgets *base = &config->group[0];
- int idx = group - base;
- char *s = gtk_entry_get_text (entry);
-
- if (s && s [0] && g_hash_table_lookup (group->combo->elements, s)){
- ETableSortColumn c;
- int col;
-
- col = find_model_column_by_name (config->source_spec, s);
- if (col == -1){
- g_warning ("grouping: this should not happen, %s", s);
- return;
- }
-
- c.ascending = GTK_TOGGLE_BUTTON (
- config->group [idx].radio_ascending)->active;
- c.column = col;
- e_table_sort_info_grouping_set_nth (sort_info, idx, c);
-
- update_sort_and_group_config_dialog (config, FALSE);
- } else {
- e_table_sort_info_grouping_truncate (sort_info, idx);
- update_sort_and_group_config_dialog (config, FALSE);
- }
-}
-
-static void
-group_ascending_toggled (GtkToggleButton *t, ETableConfigSortWidgets *group)
-{
- ETableConfig *config = group->e_table_config;
- ETableSortInfo *si = config->temp_state->sort_info;
- ETableConfigSortWidgets *base = &config->group[0];
- int idx = group - base;
- ETableSortColumn c;
-
- c = e_table_sort_info_grouping_get_nth (si, idx);
- c.ascending = t->active;
- e_table_sort_info_grouping_set_nth (si, idx, c);
-}
-
-static void
-configure_group_dialog (ETableConfig *config, GladeXML *gui)
-{
- GSList *l;
- int i;
-
- for (i = 0; i < 4; i++){
- char buffer [80];
-
- snprintf (buffer, sizeof (buffer), "group-combo-%d", i + 1);
- config->group [i].combo = GTK_COMBO_TEXT (
- glade_xml_get_widget (gui, buffer));
-
- gtk_combo_text_add_item (config->group [i].combo, "", "");
-
- snprintf (buffer, sizeof (buffer), "frame-group-%d", i + 1);
- config->group [i].frames =
- glade_xml_get_widget (gui, buffer);
-
- snprintf (
- buffer, sizeof (buffer),
- "radiobutton-ascending-group-%d", i+1);
- config->group [i].radio_ascending = glade_xml_get_widget (
- gui, buffer);
-
- snprintf (
- buffer, sizeof (buffer),
- "radiobutton-descending-group-%d", i+1);
- config->group [i].radio_descending = glade_xml_get_widget (
- gui, buffer);
-
- snprintf (
- buffer, sizeof (buffer),
- "checkbutton-group-%d", i+1);
- config->group [i].view_check = glade_xml_get_widget (
- gui, buffer);
-
- config->group [i].e_table_config = config;
- }
-
-
- for (l = config->column_names; l; l = l->next){
- char *label = l->data;
-
- for (i = 0; i < 4; i++){
- gtk_combo_text_add_item (
- config->group [i].combo,
- gettext (label), label);
- }
- }
-
- /*
- * After we have runtime modified things, signal connect
- */
- for (i = 0; i < 4; i++){
- config->group [i].changed_id = gtk_signal_connect (
- GTK_OBJECT (config->group [i].combo->entry),
- "changed", group_entry_changed, &config->group [i]);
-
- config->group [i].toggled_id = gtk_signal_connect (
- GTK_OBJECT (config->group [i].radio_ascending),
- "toggled", group_ascending_toggled, &config->group [i]);
- }
-}
-
-static void
-add_column (int model_row, gpointer closure)
-{
- GList **columns = closure;
- *columns = g_list_prepend (*columns, GINT_TO_POINTER (model_row));
-}
-
-static void
-config_button_add (GtkWidget *widget, ETableConfig *config)
-{
- GList *columns = NULL;
- GList *column;
- int count;
- int i;
-
- e_table_selected_row_foreach (config->available, add_column, &columns);
- columns = g_list_reverse (columns);
-
- count = g_list_length (columns);
-
- config->temp_state->columns = g_renew (int, config->temp_state->columns, config->temp_state->col_count + count);
- config->temp_state->expansions = g_renew (double, config->temp_state->expansions, config->temp_state->col_count + count);
- i = config->temp_state->col_count;
- for (column = columns; column; column = column->next) {
- config->temp_state->columns[i] = e_table_subset_view_to_model_row (E_TABLE_SUBSET (config->available_model), GPOINTER_TO_INT (column->data));
- config->temp_state->expansions[i] = config->source_spec->columns[config->temp_state->columns[i]]->expansion;
- i++;
- }
- config->temp_state->col_count += count;
-
- g_list_free (columns);
-
- setup_fields (config);
-}
-
-static void
-config_button_remove (GtkWidget *widget, ETableConfig *config)
-{
- GList *columns = NULL;
- GList *column;
-
- e_table_selected_row_foreach (config->shown, add_column, &columns);
-
- for (column = columns; column; column = column->next) {
- int row = GPOINTER_TO_INT (column->data);
-
- memmove (config->temp_state->columns + row, config->temp_state->columns + row + 1, sizeof (int) * (config->temp_state->col_count - row - 1));
- memmove (config->temp_state->expansions + row, config->temp_state->expansions + row + 1, sizeof (double) * (config->temp_state->col_count - row - 1));
- config->temp_state->col_count --;
- }
- config->temp_state->columns = g_renew (int, config->temp_state->columns, config->temp_state->col_count);
- config->temp_state->expansions = g_renew (double, config->temp_state->expansions, config->temp_state->col_count);
-
- g_list_free (columns);
-
- setup_fields (config);
-}
-
-static void
-config_button_up (GtkWidget *widget, ETableConfig *config)
-{
- GList *columns = NULL;
- GList *column;
- int *new_shown;
- double *new_expansions;
- int next_col;
- double next_expansion;
- int i;
-
- e_table_selected_row_foreach (config->shown, add_column, &columns);
- columns = g_list_reverse (columns);
-
- new_shown = g_new (int, config->temp_state->col_count);
- new_expansions = g_new (double, config->temp_state->col_count);
-
- column = columns;
-
- next_col = config->temp_state->columns[0];
- next_expansion = config->temp_state->expansions[0];
-
- for (i = 1; i < config->temp_state->col_count; i++) {
- if (column && (GPOINTER_TO_INT (column->data) == i)) {
- new_expansions[i - 1] = config->temp_state->expansions[i];
- new_shown[i - 1] = config->temp_state->columns[i];
- column = column->next;
- } else {
- new_shown[i - 1] = next_col;
- next_col = config->temp_state->columns[i];
-
- new_expansions[i - 1] = next_expansion;
- next_expansion = config->temp_state->expansions[i];
- }
- }
-
- new_shown[i - 1] = next_col;
- new_expansions[i - 1] = next_expansion;
-
- g_free (config->temp_state->columns);
- g_free (config->temp_state->expansions);
-
- config->temp_state->columns = new_shown;
- config->temp_state->expansions = new_expansions;
-
- g_list_free (columns);
-
- setup_fields (config);
-}
-
-static void
-config_button_down (GtkWidget *widget, ETableConfig *config)
-{
- GList *columns = NULL;
- GList *column;
- int *new_shown;
- double *new_expansions;
- int next_col;
- double next_expansion;
- int i;
-
- e_table_selected_row_foreach (config->shown, add_column, &columns);
-
- new_shown = g_new (int, config->temp_state->col_count);
- new_expansions = g_new (double, config->temp_state->col_count);
-
- column = columns;
-
- next_col = config->temp_state->columns[config->temp_state->col_count - 1];
- next_expansion = config->temp_state->expansions[config->temp_state->col_count - 1];
-
- for (i = config->temp_state->col_count - 1; i > 0; i--) {
- if (column && (GPOINTER_TO_INT (column->data) == i - 1)) {
- new_expansions[i] = config->temp_state->expansions[i - 1];
- new_shown[i] = config->temp_state->columns[i - 1];
- column = column->next;
- } else {
- new_shown[i] = next_col;
- next_col = config->temp_state->columns[i - 1];
-
- new_expansions[i] = next_expansion;
- next_expansion = config->temp_state->expansions[i - 1];
- }
- }
-
- new_shown[0] = next_col;
- new_expansions[0] = next_expansion;
-
- g_free (config->temp_state->columns);
- g_free (config->temp_state->expansions);
-
- config->temp_state->columns = new_shown;
- config->temp_state->expansions = new_expansions;
-
- g_list_free (columns);
-
- setup_fields (config);
-}
-
-static void
-configure_fields_dialog (ETableConfig *config, GladeXML *gui)
-{
- config->available = e_table_scrolled_get_table (E_TABLE_SCROLLED (glade_xml_get_widget (gui, "custom-available")));
- gtk_object_get (GTK_OBJECT (config->available),
- "model", &config->available_model,
- NULL);
-
- config->shown = e_table_scrolled_get_table (E_TABLE_SCROLLED (glade_xml_get_widget (gui, "custom-shown")));
- gtk_object_get (GTK_OBJECT (config->shown),
- "model", &config->shown_model,
- NULL);
-
- connect_button (config, gui, "button-add", config_button_add);
- connect_button (config, gui, "button-remove", config_button_remove);
- connect_button (config, gui, "button-up", config_button_up);
- connect_button (config, gui, "button-down", config_button_down);
-
- setup_fields (config);
-}
-
-static void
-setup_gui (ETableConfig *config)
-{
- GladeXML *gui;
-
- create_global_store (config);
-
- if (e_table_sort_info_get_can_group (config->state->sort_info)) {
- gui = glade_xml_new_with_domain (ETABLE_GLADEDIR "/e-table-config.glade", NULL, PACKAGE);
- } else {
- gui = glade_xml_new_with_domain (ETABLE_GLADEDIR "/e-table-config-no-group.glade", NULL, PACKAGE);
- }
-
- gtk_object_unref (GTK_OBJECT (global_store));
-
- config->dialog_toplevel = glade_xml_get_widget (
- gui, "e-table-config");
-
- if (config->header)
- gtk_window_set_title (GTK_WINDOW (config->dialog_toplevel), config->header);
-
- gtk_widget_hide (GNOME_PROPERTY_BOX(config->dialog_toplevel)->help_button);
-
- gtk_notebook_set_show_tabs (
- GTK_NOTEBOOK (GNOME_PROPERTY_BOX (
- config->dialog_toplevel)->notebook),
- FALSE);
-
- config->dialog_show_fields = glade_xml_get_widget (
- gui, "dialog-show-fields");
- config->dialog_group_by = glade_xml_get_widget (
- gui, "dialog-group-by");
- config->dialog_sort = glade_xml_get_widget (
- gui, "dialog-sort");
-
- config->sort_label = glade_xml_get_widget (
- gui, "label-sort");
- config->group_label = glade_xml_get_widget (
- gui, "label-group");
- config->fields_label = glade_xml_get_widget (
- gui, "label-fields");
-
- connect_button (config, gui, "button-sort", config_button_sort);
- connect_button (config, gui, "button-group", config_button_group);
- connect_button (config, gui, "button-fields", config_button_fields);
-
- configure_sort_dialog (config, gui);
- configure_group_dialog (config, gui);
- configure_fields_dialog (config, gui);
-
- gtk_signal_connect (
- GTK_OBJECT (config->dialog_toplevel), "destroy",
- GTK_SIGNAL_FUNC (dialog_destroyed), config);
-
- gtk_signal_connect (
- GTK_OBJECT (config->dialog_toplevel), "apply",
- GTK_SIGNAL_FUNC (dialog_apply), config);
-
- gtk_object_unref (GTK_OBJECT (gui));
-}
-
-static void
-config_init (ETableConfig *config)
-{
- glade_gnome_init ();
-}
-
-ETableConfig *
-e_table_config_construct (ETableConfig *config,
- const char *header,
- ETableSpecification *spec,
- ETableState *state)
-{
- ETableColumnSpecification **column;
-
- g_return_val_if_fail (config != NULL, NULL);
- g_return_val_if_fail (header != NULL, NULL);
- g_return_val_if_fail (spec != NULL, NULL);
- g_return_val_if_fail (state != NULL, NULL);
-
- config->source_spec = spec;
- config->source_state = state;
- config->header = g_strdup (header);
-
- gtk_object_ref (GTK_OBJECT (config->source_spec));
- gtk_object_ref (GTK_OBJECT (config->source_state));
-
- config->state = e_table_state_duplicate (state);
-
- for (column = config->source_spec->columns; *column; column++){
- char *label = (*column)->title;
-
- if ((*column)->disabled)
- continue;
-
- config->column_names = g_slist_append (
- config->column_names, label);
- }
-
- setup_gui (config);
-
- config_sort_info_update (config);
- config_group_info_update (config);
- config_fields_info_update (config);
-
- return E_TABLE_CONFIG (config);
-}
-
-/**
- * e_table_config_new:
- * @header: The title of the dialog for the ETableConfig.
- * @spec: The specification for the columns to allow.
- * @state: The current state of the configuration.
- *
- * Creates a new ETable config object.
- *
- * Returns: The config object.
- */
-ETableConfig *
-e_table_config_new (const char *header,
- ETableSpecification *spec,
- ETableState *state)
-{
- ETableConfig *config = gtk_type_new (E_TABLE_CONFIG_TYPE);
-
- if (e_table_config_construct (config, header, spec, state) == NULL){
- gtk_object_destroy (GTK_OBJECT (config));
- return NULL;
- }
-
- gtk_widget_show (config->dialog_toplevel);
- return E_TABLE_CONFIG (config);
-}
-
-/**
- * e_table_config_raise:
- * @config: The ETableConfig object.
- *
- * Raises the dialog associated with this ETableConfig object.
- */
-void
-e_table_config_raise (ETableConfig *config)
-{
- gdk_window_raise (GTK_WIDGET (config->dialog_toplevel)->window);
-}
-
-E_MAKE_TYPE(e_table_config, "ETableConfig", ETableConfig, config_class_init, config_init, PARENT_TYPE);
diff --git a/widgets/table/e-table-config.glade b/widgets/table/e-table-config.glade
deleted file mode 100644
index f7f0683f7e..0000000000
--- a/widgets/table/e-table-config.glade
+++ /dev/null
@@ -1,1841 +0,0 @@
-<?xml version="1.0"?>
-<GTK-Interface>
-
-<project>
- <name>E-table</name>
- <program_name>e-table</program_name>
- <directory></directory>
- <source_directory></source_directory>
- <pixmaps_directory></pixmaps_directory>
- <language>C</language>
- <gnome_support>True</gnome_support>
- <gettext_support>True</gettext_support>
- <output_main_file>False</output_main_file>
- <output_support_files>False</output_support_files>
- <output_build_files>False</output_build_files>
-</project>
-
-<widget>
- <class>GnomeDialog</class>
- <name>dialog-show-fields</name>
- <visible>False</visible>
- <title>Show Fields</title>
- <type>GTK_WINDOW_TOPLEVEL</type>
- <position>GTK_WIN_POS_NONE</position>
- <modal>False</modal>
- <allow_shrink>False</allow_shrink>
- <allow_grow>True</allow_grow>
- <auto_shrink>False</auto_shrink>
- <auto_close>False</auto_close>
- <hide_on_close>True</hide_on_close>
-
- <widget>
- <class>GtkVBox</class>
- <child_name>GnomeDialog:vbox</child_name>
- <name>dialog-vbox3</name>
- <homogeneous>False</homogeneous>
- <spacing>8</spacing>
- <child>
- <padding>4</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkHButtonBox</class>
- <child_name>GnomeDialog:action_area</child_name>
- <name>dialog-action_area3</name>
- <layout_style>GTK_BUTTONBOX_END</layout_style>
- <spacing>8</spacing>
- <child_min_width>85</child_min_width>
- <child_min_height>27</child_min_height>
- <child_ipad_x>7</child_ipad_x>
- <child_ipad_y>0</child_ipad_y>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- <pack>GTK_PACK_END</pack>
- </child>
-
- <widget>
- <class>GtkButton</class>
- <name>button20</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button22</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
- </widget>
- </widget>
-
- <widget>
- <class>GtkVBox</class>
- <name>vbox2</name>
- <homogeneous>False</homogeneous>
- <spacing>6</spacing>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkTable</class>
- <name>table2</name>
- <rows>1</rows>
- <columns>5</columns>
- <homogeneous>True</homogeneous>
- <row_spacing>6</row_spacing>
- <column_spacing>6</column_spacing>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkLabel</class>
- <name>label-available</name>
- <label>A_vailable Fields:</label>
- <justify>GTK_JUSTIFY_LEFT</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <left_attach>0</left_attach>
- <right_attach>2</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label-displayed</name>
- <label>Sh_ow these fields in order:</label>
- <justify>GTK_JUSTIFY_LEFT</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <left_attach>3</left_attach>
- <right_attach>5</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
- </widget>
-
- <widget>
- <class>GtkTable</class>
- <name>table3</name>
- <rows>1</rows>
- <columns>5</columns>
- <homogeneous>True</homogeneous>
- <row_spacing>6</row_spacing>
- <column_spacing>6</column_spacing>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkVBox</class>
- <name>vbox4</name>
- <homogeneous>False</homogeneous>
- <spacing>6</spacing>
- <child>
- <left_attach>0</left_attach>
- <right_attach>2</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>True</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>Custom</class>
- <name>custom-available</name>
- <creation_function>e_table_proxy_etable_available_new</creation_function>
- <int1>0</int1>
- <int2>0</int2>
- <last_modification_time>Thu, 21 Feb 2002 16:09:53 GMT</last_modification_time>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
- </widget>
- </widget>
-
- <widget>
- <class>GtkVBox</class>
- <name>vbox5</name>
- <homogeneous>False</homogeneous>
- <spacing>6</spacing>
- <child>
- <left_attach>3</left_attach>
- <right_attach>5</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>True</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>Custom</class>
- <name>custom-shown</name>
- <creation_function>e_table_proxy_etable_shown_new</creation_function>
- <int1>0</int1>
- <int2>0</int2>
- <last_modification_time>Thu, 21 Feb 2002 16:09:58 GMT</last_modification_time>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkHBox</class>
- <name>hbox4</name>
- <homogeneous>True</homogeneous>
- <spacing>6</spacing>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkButton</class>
- <name>button-up</name>
- <can_focus>True</can_focus>
- <label>Move _Up</label>
- <relief>GTK_RELIEF_NORMAL</relief>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button-down</name>
- <can_focus>True</can_focus>
- <label>Move _Down</label>
- <relief>GTK_RELIEF_NORMAL</relief>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- </child>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GtkVBox</class>
- <name>vbox6</name>
- <homogeneous>False</homogeneous>
- <spacing>6</spacing>
- <child>
- <left_attach>2</left_attach>
- <right_attach>3</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>True</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>GtkButton</class>
- <name>button-add</name>
- <can_focus>True</can_focus>
- <label>_Add -&gt;</label>
- <relief>GTK_RELIEF_NORMAL</relief>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button-remove</name>
- <can_focus>True</can_focus>
- <label>&lt;- _Remove</label>
- <relief>GTK_RELIEF_NORMAL</relief>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>Placeholder</class>
- </widget>
- </widget>
- </widget>
- </widget>
- </widget>
-</widget>
-
-<widget>
- <class>GnomeDialog</class>
- <name>dialog-group-by</name>
- <visible>False</visible>
- <title>Group</title>
- <type>GTK_WINDOW_TOPLEVEL</type>
- <position>GTK_WIN_POS_NONE</position>
- <modal>False</modal>
- <allow_shrink>False</allow_shrink>
- <allow_grow>True</allow_grow>
- <auto_shrink>False</auto_shrink>
- <auto_close>False</auto_close>
- <hide_on_close>True</hide_on_close>
-
- <widget>
- <class>GtkVBox</class>
- <child_name>GnomeDialog:vbox</child_name>
- <name>dialog-vbox4</name>
- <homogeneous>False</homogeneous>
- <spacing>8</spacing>
- <child>
- <padding>4</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkHButtonBox</class>
- <child_name>GnomeDialog:action_area</child_name>
- <name>dialog-action_area4</name>
- <layout_style>GTK_BUTTONBOX_END</layout_style>
- <spacing>8</spacing>
- <child_min_width>85</child_min_width>
- <child_min_height>27</child_min_height>
- <child_ipad_x>7</child_ipad_x>
- <child_ipad_y>0</child_ipad_y>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- <pack>GTK_PACK_END</pack>
- </child>
-
- <widget>
- <class>GtkButton</class>
- <name>button39</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <label>Clear All</label>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button41</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button42</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
- </widget>
- </widget>
-
- <widget>
- <class>GtkVBox</class>
- <name>vbox24</name>
- <homogeneous>False</homogeneous>
- <spacing>0</spacing>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkHBox</class>
- <name>hbox13</name>
- <homogeneous>False</homogeneous>
- <spacing>6</spacing>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkFrame</class>
- <name>frame-group-1</name>
- <label>Group Items By</label>
- <label_xalign>0</label_xalign>
- <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkHBox</class>
- <name>hbox5</name>
- <homogeneous>False</homogeneous>
- <spacing>6</spacing>
-
- <widget>
- <class>GtkVBox</class>
- <name>vbox7</name>
- <homogeneous>False</homogeneous>
- <spacing>0</spacing>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>Custom</class>
- <name>group-combo-1</name>
- <creation_function>e_table_proxy_gtk_combo_text_new</creation_function>
- <int1>0</int1>
- <int2>0</int2>
- <last_modification_time>Fri, 19 Jan 2001 04:52:09 GMT</last_modification_time>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkCheckButton</class>
- <name>checkbutton-group-1</name>
- <can_focus>True</can_focus>
- <label>Show field in View</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
- </widget>
-
- <widget>
- <class>GtkVBox</class>
- <name>vbox8</name>
- <homogeneous>False</homogeneous>
- <spacing>0</spacing>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkRadioButton</class>
- <name>radiobutton-ascending-group-1</name>
- <can_focus>True</can_focus>
- <label>Ascending</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <group>g-group-1</group>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkRadioButton</class>
- <name>radiobutton-descending-group-1</name>
- <can_focus>True</can_focus>
- <label>Descending</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <group>g-group-1</group>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label8</name>
- <label></label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label9</name>
- <label></label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label10</name>
- <label></label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
- </widget>
-
- <widget>
- <class>GtkHBox</class>
- <name>hbox14</name>
- <homogeneous>False</homogeneous>
- <spacing>6</spacing>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkLabel</class>
- <name>label11</name>
- <label></label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkFrame</class>
- <name>frame-group-2</name>
- <label>Then By</label>
- <label_xalign>0</label_xalign>
- <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkHBox</class>
- <name>hbox6</name>
- <homogeneous>False</homogeneous>
- <spacing>6</spacing>
-
- <widget>
- <class>GtkVBox</class>
- <name>vbox9</name>
- <homogeneous>False</homogeneous>
- <spacing>0</spacing>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>Custom</class>
- <name>group-combo-2</name>
- <creation_function>e_table_proxy_gtk_combo_text_new</creation_function>
- <int1>0</int1>
- <int2>0</int2>
- <last_modification_time>Fri, 19 Jan 2001 04:52:14 GMT</last_modification_time>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkCheckButton</class>
- <name>checkbutton-group-2</name>
- <can_focus>True</can_focus>
- <label>Show field in View</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
- </widget>
-
- <widget>
- <class>GtkVBox</class>
- <name>vbox10</name>
- <homogeneous>False</homogeneous>
- <spacing>0</spacing>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkRadioButton</class>
- <name>radiobutton-ascending-group-2</name>
- <can_focus>True</can_focus>
- <label>Ascending</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <group>g-group-2</group>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkRadioButton</class>
- <name>radiobutton-descending-group-2</name>
- <can_focus>True</can_focus>
- <label>Descending</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <group>g-group-2</group>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label19</name>
- <label></label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label18</name>
- <label></label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
- </widget>
-
- <widget>
- <class>GtkHBox</class>
- <name>hbox15</name>
- <homogeneous>False</homogeneous>
- <spacing>6</spacing>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkLabel</class>
- <name>label13</name>
- <label></label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label12</name>
- <label></label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkFrame</class>
- <name>frame-group-3</name>
- <label>Then By</label>
- <label_xalign>0</label_xalign>
- <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkHBox</class>
- <name>hbox7</name>
- <homogeneous>False</homogeneous>
- <spacing>6</spacing>
-
- <widget>
- <class>GtkVBox</class>
- <name>vbox11</name>
- <homogeneous>False</homogeneous>
- <spacing>0</spacing>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>Custom</class>
- <name>group-combo-3</name>
- <creation_function>e_table_proxy_gtk_combo_text_new</creation_function>
- <int1>0</int1>
- <int2>0</int2>
- <last_modification_time>Fri, 19 Jan 2001 04:52:18 GMT</last_modification_time>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkCheckButton</class>
- <name>checkbutton-group-3</name>
- <can_focus>True</can_focus>
- <label>Show field in View</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
- </widget>
-
- <widget>
- <class>GtkVBox</class>
- <name>vbox12</name>
- <homogeneous>False</homogeneous>
- <spacing>0</spacing>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkRadioButton</class>
- <name>radiobutton-ascending-group-3</name>
- <can_focus>True</can_focus>
- <label>Ascending</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <group>g-group-3</group>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkRadioButton</class>
- <name>radiobutton-descending-group-3</name>
- <can_focus>True</can_focus>
- <label>Descending</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <group>g-group-3</group>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label17</name>
- <label></label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
- </widget>
-
- <widget>
- <class>GtkHBox</class>
- <name>hbox16</name>
- <homogeneous>False</homogeneous>
- <spacing>6</spacing>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkLabel</class>
- <name>label14</name>
- <label></label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label16</name>
- <label></label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label15</name>
- <label></label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkFrame</class>
- <name>frame-group-4</name>
- <label>Then By</label>
- <label_xalign>0</label_xalign>
- <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkHBox</class>
- <name>hbox8</name>
- <homogeneous>False</homogeneous>
- <spacing>6</spacing>
-
- <widget>
- <class>GtkVBox</class>
- <name>vbox13</name>
- <homogeneous>False</homogeneous>
- <spacing>0</spacing>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>Custom</class>
- <name>group-combo-4</name>
- <creation_function>e_table_proxy_gtk_combo_text_new</creation_function>
- <int1>0</int1>
- <int2>0</int2>
- <last_modification_time>Fri, 19 Jan 2001 04:52:21 GMT</last_modification_time>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkCheckButton</class>
- <name>checkbutton-group-4</name>
- <can_focus>True</can_focus>
- <label>Show field in View</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
- </widget>
-
- <widget>
- <class>GtkVBox</class>
- <name>vbox14</name>
- <homogeneous>False</homogeneous>
- <spacing>0</spacing>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkRadioButton</class>
- <name>radiobutton-ascending-group-4</name>
- <can_focus>True</can_focus>
- <label>Ascending</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <group>g-group-4</group>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkRadioButton</class>
- <name>radiobutton-descending-group-4</name>
- <can_focus>True</can_focus>
- <label>Descending</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <group>g-group-4</group>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
- </widget>
- </widget>
- </widget>
- </widget>
- </widget>
- </widget>
-</widget>
-
-<widget>
- <class>GnomeDialog</class>
- <name>dialog-sort</name>
- <visible>False</visible>
- <title>Sort</title>
- <type>GTK_WINDOW_TOPLEVEL</type>
- <position>GTK_WIN_POS_NONE</position>
- <modal>False</modal>
- <allow_shrink>False</allow_shrink>
- <allow_grow>True</allow_grow>
- <auto_shrink>False</auto_shrink>
- <auto_close>False</auto_close>
- <hide_on_close>True</hide_on_close>
-
- <widget>
- <class>GtkVBox</class>
- <child_name>GnomeDialog:vbox</child_name>
- <name>vbox15</name>
- <homogeneous>False</homogeneous>
- <spacing>8</spacing>
- <child>
- <padding>4</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkHButtonBox</class>
- <child_name>GnomeDialog:action_area</child_name>
- <name>hbuttonbox1</name>
- <layout_style>GTK_BUTTONBOX_END</layout_style>
- <spacing>8</spacing>
- <child_min_width>85</child_min_width>
- <child_min_height>27</child_min_height>
- <child_ipad_x>7</child_ipad_x>
- <child_ipad_y>0</child_ipad_y>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- <pack>GTK_PACK_END</pack>
- </child>
-
- <widget>
- <class>GtkButton</class>
- <name>button43</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <label>Clear All</label>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button44</name>
- <can_default>True</can_default>
- <has_default>True</has_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button45</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
- </widget>
- </widget>
-
- <widget>
- <class>GtkTable</class>
- <name>table5</name>
- <rows>4</rows>
- <columns>1</columns>
- <homogeneous>False</homogeneous>
- <row_spacing>6</row_spacing>
- <column_spacing>6</column_spacing>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkFrame</class>
- <name>frame-sort-4</name>
- <label>Then By</label>
- <label_xalign>0</label_xalign>
- <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>3</top_attach>
- <bottom_attach>4</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>GtkHBox</class>
- <name>hbox9</name>
- <homogeneous>False</homogeneous>
- <spacing>6</spacing>
-
- <widget>
- <class>GtkAlignment</class>
- <name>alignment1</name>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xscale>1</xscale>
- <yscale>0</yscale>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>Custom</class>
- <name>sort-combo-4</name>
- <creation_function>e_table_proxy_gtk_combo_text_new</creation_function>
- <int1>0</int1>
- <int2>0</int2>
- <last_modification_time>Tue, 16 Jan 2001 08:33:52 GMT</last_modification_time>
- </widget>
- </widget>
-
- <widget>
- <class>GtkVBox</class>
- <name>vbox17</name>
- <homogeneous>False</homogeneous>
- <spacing>0</spacing>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkRadioButton</class>
- <name>radiobutton-ascending-sort-4</name>
- <can_focus>True</can_focus>
- <label>Ascending</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <group>group-4</group>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkRadioButton</class>
- <name>radiobutton-descending-sort-4</name>
- <can_focus>True</can_focus>
- <label>Descending</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <group>group-4</group>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GtkFrame</class>
- <name>frame-sort-3</name>
- <label>Then By</label>
- <label_xalign>0</label_xalign>
- <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>2</top_attach>
- <bottom_attach>3</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>GtkHBox</class>
- <name>hbox10</name>
- <homogeneous>False</homogeneous>
- <spacing>6</spacing>
-
- <widget>
- <class>GtkAlignment</class>
- <name>alignment2</name>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xscale>1</xscale>
- <yscale>0</yscale>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>Custom</class>
- <name>sort-combo-3</name>
- <creation_function>e_table_proxy_gtk_combo_text_new</creation_function>
- <int1>0</int1>
- <int2>0</int2>
- <last_modification_time>Tue, 16 Jan 2001 05:22:22 GMT</last_modification_time>
- </widget>
- </widget>
-
- <widget>
- <class>GtkVBox</class>
- <name>vbox19</name>
- <homogeneous>False</homogeneous>
- <spacing>0</spacing>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkRadioButton</class>
- <name>radiobutton-ascending-sort-3</name>
- <can_focus>True</can_focus>
- <label>Ascending</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <group>group-3</group>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkRadioButton</class>
- <name>radiobutton-descending-sort-3</name>
- <can_focus>True</can_focus>
- <label>Descending</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <group>group-3</group>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GtkFrame</class>
- <name>frame-sort-2</name>
- <label>Then By</label>
- <label_xalign>0</label_xalign>
- <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>1</top_attach>
- <bottom_attach>2</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>GtkHBox</class>
- <name>hbox11</name>
- <homogeneous>False</homogeneous>
- <spacing>6</spacing>
-
- <widget>
- <class>GtkAlignment</class>
- <name>alignment3</name>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xscale>1</xscale>
- <yscale>0</yscale>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>Custom</class>
- <name>sort-combo-2</name>
- <creation_function>e_table_proxy_gtk_combo_text_new</creation_function>
- <int1>0</int1>
- <int2>0</int2>
- <last_modification_time>Tue, 16 Jan 2001 05:22:15 GMT</last_modification_time>
- </widget>
- </widget>
-
- <widget>
- <class>GtkVBox</class>
- <name>vbox21</name>
- <homogeneous>False</homogeneous>
- <spacing>0</spacing>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkRadioButton</class>
- <name>radiobutton-ascending-sort-2</name>
- <can_focus>True</can_focus>
- <label>Ascending</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <group>group-2</group>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkRadioButton</class>
- <name>radiobutton-descending-sort-2</name>
- <can_focus>True</can_focus>
- <label>Descending</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <group>group-2</group>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GtkFrame</class>
- <name>frame-sort-1</name>
- <label>Sort Items By</label>
- <label_xalign>0</label_xalign>
- <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>GtkHBox</class>
- <name>hbox12</name>
- <homogeneous>False</homogeneous>
- <spacing>6</spacing>
-
- <widget>
- <class>GtkAlignment</class>
- <name>alignment4</name>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xscale>1</xscale>
- <yscale>0</yscale>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>Custom</class>
- <name>sort-combo-1</name>
- <can_focus>True</can_focus>
- <has_focus>True</has_focus>
- <creation_function>e_table_proxy_gtk_combo_text_new</creation_function>
- <int1>0</int1>
- <int2>0</int2>
- <last_modification_time>Tue, 16 Jan 2001 05:22:00 GMT</last_modification_time>
- </widget>
- </widget>
-
- <widget>
- <class>GtkVBox</class>
- <name>vbox23</name>
- <homogeneous>False</homogeneous>
- <spacing>0</spacing>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkRadioButton</class>
- <name>radiobutton-ascending-sort-1</name>
- <can_focus>True</can_focus>
- <label>Ascending</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <group>group-1</group>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkRadioButton</class>
- <name>radiobutton-descending-sort-1</name>
- <can_focus>True</can_focus>
- <label>Descending</label>
- <active>False</active>
- <draw_indicator>True</draw_indicator>
- <group>group-1</group>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
- </widget>
- </widget>
- </widget>
- </widget>
- </widget>
-</widget>
-
-<widget>
- <class>GnomePropertyBox</class>
- <name>e-table-config</name>
- <visible>False</visible>
- <position>GTK_WIN_POS_NONE</position>
- <modal>False</modal>
- <allow_shrink>False</allow_shrink>
- <allow_grow>False</allow_grow>
- <auto_shrink>False</auto_shrink>
-
- <widget>
- <class>GtkNotebook</class>
- <child_name>GnomePropertyBox:notebook</child_name>
- <name>notebook1</name>
- <show_tabs>False</show_tabs>
- <show_border>True</show_border>
- <tab_pos>GTK_POS_TOP</tab_pos>
- <scrollable>False</scrollable>
- <tab_hborder>2</tab_hborder>
- <tab_vborder>2</tab_vborder>
- <popup_enable>False</popup_enable>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkFrame</class>
- <name>top-frame</name>
- <border_width>2</border_width>
- <label>Description</label>
- <label_xalign>0</label_xalign>
- <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
-
- <widget>
- <class>GtkTable</class>
- <name>table1</name>
- <border_width>2</border_width>
- <rows>3</rows>
- <columns>3</columns>
- <homogeneous>False</homogeneous>
- <row_spacing>2</row_spacing>
- <column_spacing>4</column_spacing>
-
- <widget>
- <class>GtkButton</class>
- <name>button-sort</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <signal>
- <name>clicked</name>
- <handler>on_sort_clicked</handler>
- <last_modification_time>Tue, 03 Oct 2000 22:10:58 GMT</last_modification_time>
- </signal>
- <label>_Sort...</label>
- <relief>GTK_RELIEF_NORMAL</relief>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>2</top_attach>
- <bottom_attach>3</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button-group</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <signal>
- <name>clicked</name>
- <handler>on_group_by_clicked</handler>
- <last_modification_time>Tue, 03 Oct 2000 22:10:50 GMT</last_modification_time>
- </signal>
- <label>_Group By...</label>
- <relief>GTK_RELIEF_NORMAL</relief>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>1</top_attach>
- <bottom_attach>2</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label-group</name>
- <label></label>
- <justify>GTK_JUSTIFY_LEFT</justify>
- <wrap>True</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <left_attach>1</left_attach>
- <right_attach>2</right_attach>
- <top_attach>1</top_attach>
- <bottom_attach>2</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label-sort</name>
- <label></label>
- <justify>GTK_JUSTIFY_LEFT</justify>
- <wrap>True</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <left_attach>1</left_attach>
- <right_attach>2</right_attach>
- <top_attach>2</top_attach>
- <bottom_attach>3</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button-fields</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <signal>
- <name>clicked</name>
- <handler>on_group_by_clicked</handler>
- <last_modification_time>Tue, 03 Oct 2000 22:10:50 GMT</last_modification_time>
- </signal>
- <label>_Fields Shown...</label>
- <relief>GTK_RELIEF_NORMAL</relief>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>False</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label-fields</name>
- <label></label>
- <justify>GTK_JUSTIFY_LEFT</justify>
- <wrap>True</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <left_attach>1</left_attach>
- <right_attach>2</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label3</name>
- <label></label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <left_attach>2</left_attach>
- <right_attach>3</right_attach>
- <top_attach>1</top_attach>
- <bottom_attach>2</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label4</name>
- <label></label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <left_attach>2</left_attach>
- <right_attach>3</right_attach>
- <top_attach>2</top_attach>
- <bottom_attach>3</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <name>label22</name>
- <label></label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <left_attach>2</left_attach>
- <right_attach>3</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>False</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GtkLabel</class>
- <child_name>Notebook:tab</child_name>
- <name>label20</name>
- <label>label20</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- </widget>
- </widget>
-</widget>
-
-</GTK-Interface>
diff --git a/widgets/table/e-table-config.h b/widgets/table/e-table-config.h
deleted file mode 100644
index 46bf1507ac..0000000000
--- a/widgets/table/e-table-config.h
+++ /dev/null
@@ -1,111 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-config.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- * Miguel de Icaza <miguel@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_TABLE_CONFIG_H_
-#define _E_TABLE_CONFIG_H_
-
-#include <libgnome/gnome-defs.h>
-#include <gal/e-table/e-table-sort-info.h>
-#include <gal/e-table/e-table-specification.h>
-#include <gal/widgets/gtk-combo-text.h>
-#include <gal/e-table/e-table-without.h>
-#include <gal/e-table/e-table-subset-variable.h>
-#include <gal/e-table/e-table.h>
-
-BEGIN_GNOME_DECLS
-
-#define E_TABLE_CONFIG_TYPE (e_table_config_get_type ())
-#define E_TABLE_CONFIG(o) (GTK_CHECK_CAST ((o), E_TABLE_CONFIG_TYPE, ETableConfig))
-#define E_TABLE_CONFIG_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_CONFIG_TYPE, ETableConfigClass))
-#define E_IS_TABLE_CONFIG(o) (GTK_CHECK_TYPE ((o), E_TABLE_CONFIG_TYPE))
-#define E_IS_TABLE_CONFIG_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_CONFIG_TYPE))
-
-typedef struct {
- GtkComboText *combo;
- GtkWidget *frames;
- GtkWidget *radio_ascending;
- GtkWidget *radio_descending;
- GtkWidget *view_check; /* Only for group dialog */
- guint changed_id, toggled_id;
- void *e_table_config;
-} ETableConfigSortWidgets;
-
-
-typedef struct {
- GtkObject parent;
-
- char *header;
-
- /*
- * Our various dialog boxes
- */
- GtkWidget *dialog_toplevel;
- GtkWidget *dialog_show_fields;
- GtkWidget *dialog_group_by;
- GtkWidget *dialog_sort;
-
- /*
- * The state we manipulate
- */
- ETableSpecification *source_spec;
- ETableState *source_state, *state, *temp_state;
-
- GtkWidget *sort_label;
- GtkWidget *group_label;
- GtkWidget *fields_label;
-
- ETableConfigSortWidgets sort [4];
- ETableConfigSortWidgets group [4];
-
- ETable *available;
- ETableWithout *available_model;
- ETable *shown;
- ETableSubsetVariable *shown_model;
-
- /*
- * List of valid column names
- */
- GSList *column_names;
-} ETableConfig;
-
-typedef struct {
- GtkObjectClass parent_class;
-
- /* Signals */
- void (*changed) (ETableConfig *config);
-} ETableConfigClass;
-
-GtkType e_table_config_get_type (void);
-ETableConfig *e_table_config_new (const char *header,
- ETableSpecification *spec,
- ETableState *state);
-ETableConfig *e_table_config_construct (ETableConfig *etco,
- const char *header,
- ETableSpecification *spec,
- ETableState *state);
-void e_table_config_raise (ETableConfig *config);
-
-END_GNOME_DECLS
-
-#endif /* _E_TABLE_CONFIG_H */
diff --git a/widgets/table/e-table-defines.h b/widgets/table/e-table-defines.h
deleted file mode 100644
index 34585789d4..0000000000
--- a/widgets/table/e-table-defines.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-defines.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef __E_TABLE_DEFINES__
-#define __E_TABLE_DEFINES__ 1
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#define BUTTON_HEIGHT 10
-#define BUTTON_PADDING 2
-#define GROUP_INDENT (BUTTON_HEIGHT + (BUTTON_PADDING * 2))
-
-/* Padding around the contents of a header button */
-#define HEADER_PADDING 1
-
-#define MIN_ARROW_SIZE 10
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif
diff --git a/widgets/table/e-table-example-1.c b/widgets/table/e-table-example-1.c
deleted file mode 100644
index 37ac85770f..0000000000
--- a/widgets/table/e-table-example-1.c
+++ /dev/null
@@ -1,308 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-example-1.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-/* This code is GPL. */
-#include <stdio.h>
-#include <string.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
-
-#include "gal/e-util/e-cursors.h"
-#include "e-table-simple.h"
-#include "e-table-header.h"
-#include "e-table-header-item.h"
-#include "e-table-item.h"
-#include "e-cell-text.h"
-#include "e-cell-checkbox.h"
-#include "e-table.h"
-
-#include "table-test.h"
-
-/*
- * One way in which we make it simpler to build an ETableModel is through
- * the ETableSimple class. Instead of creating your own ETableModel
- * class, you simply create a new object of the ETableSimple class. You
- * give it a bunch of functions that act as callbacks.
- *
- * You also get to pass a void * to ETableSimple and it gets passed to
- * your callbacks. This would be for having multiple models of the same
- * type. This is just an example though, so we statically define all the
- * data and ignore the void *data parameter.
- *
- * In our example we will be creating a table model with 6 columns and 10
- * rows. This corresponds to having 6 different types of information and
- * 10 different sets of data in our database.
- *
- * The headers will be hard coded, as will be the example data.
- *
- */
-
-/*
- * There are two different meanings to the word "column". The first is
- * the model column. A model column corresponds to a specific type of
- * data. This is very much like the usage in a database table where a
- * column is a field in the database.
- *
- * The second type of column is a view column. A view column
- * corresponds to a visually displayed column. Each view column
- * corresponds to a specific model column, though a model column may
- * have any number of view columns associated with it, from zero to
- * greater than one.
- *
- * Also, a view column doesn't necessarily depend on only one model
- * column. In some cases, the view column renderer can be given a
- * reference to another column to get extra information about its
- * display.
-*/
-
-#define ROWS 10
-#define COLS 4
-
-#define IMPORTANCE_COLUMN 4
-#define COLOR_COLUMN 5
-
-/*
- * Here we define the initial layout of the table. This is an xml
- * format that allows you to change the initial ordering of the
- * columns or to do sorting or grouping initially. This specification
- * shows all 5 columns, but moves the importance column nearer to the
- * front. It also sorts by the "Full Name" column (ascending.)
- * Sorting and grouping take the model column as their arguments
- * (sorting is specified by the "column" argument to the leaf elemnt.
- */
-
-#define INITIAL_SPEC "<ETableSpecification> \
- <columns-shown> \
- <column> 0 </column> \
- <column> 4 </column> \
- <column> 1 </column> \
- <column> 2 </column> \
- <column> 3 </column> \
- </columns-shown> \
- <grouping> <leaf column=\"1\" ascending=\"true\"/> </grouping> \
-</ETableSpecification>"
-
-char *headers [COLS] = {
- "Email",
- "Full Name",
- "Address",
- "Phone"
-};
-
-/*
- * Virtual Column list:
- * 0 Email
- * 1 Full Name
- * 2 Address
- * 3 Phone
- */
-
-char *table_data [ROWS] [COLS];
-
-/*
- * ETableSimple callbacks
- * These are the callbacks that define the behavior of our custom model.
- */
-
-/*
- * Since our model is a constant size, we can just return its size in
- * the column and row count fields.
- */
-
-/* This function returns the number of columns in our ETableModel. */
-static int
-my_col_count (ETableModel *etc, void *data)
-{
- return COLS;
-}
-
-/* This function returns the number of rows in our ETableModel. */
-static int
-my_row_count (ETableModel *etc, void *data)
-{
- return ROWS;
-}
-
-/* This function returns the value at a particular point in our ETableModel. */
-static void *
-my_value_at (ETableModel *etc, int col, int row, void *data)
-{
- return (void *) table_data [row] [col];
-}
-
-/* This function sets the value at a particular point in our ETableModel. */
-static void
-my_set_value_at (ETableModel *etc, int col, int row, const void *val, void *data)
-{
- g_free (table_data [row] [col]);
- table_data [row] [col] = g_strdup (val);
-}
-
-/* This function returns whether a particular cell is editable. */
-static gboolean
-my_is_cell_editable (ETableModel *etc, int col, int row, void *data)
-{
- return TRUE;
-}
-
-/* This function duplicates the value passed to it. */
-static void *
-my_duplicate_value (ETableModel *etc, int col, const void *value, void *data)
-{
- return g_strdup (value);
-}
-
-/* This function frees the value passed to it. */
-static void
-my_free_value (ETableModel *etc, int col, void *value, void *data)
-{
- g_free (value);
-}
-
-/* This function creates an empty value. */
-static void *
-my_initialize_value (ETableModel *etc, int col, void *data)
-{
- return g_strdup ("");
-}
-
-/* This function reports if a value is empty. */
-static gboolean
-my_value_is_empty (ETableModel *etc, int col, const void *value, void *data)
-{
- return !(value && *(char *)value);
-}
-
-/* This function reports if a value is empty. */
-static char *
-my_value_to_string (ETableModel *etc, int col, const void *value, void *data)
-{
- return g_strdup(value);
-}
-
-/* We create a window containing our new table. */
-static void
-create_table (void)
-{
- GtkWidget *e_table, *window, *frame;
- ECell *cell_left_just;
- ETableHeader *e_table_header;
- int i, j;
- ETableModel *e_table_model = NULL;
-
- /* First we fill in the simple data. */
- for (i = 0; i < ROWS; i++){
- for (j = 0; j < COLS; j++)
- table_data [i] [j] = g_strdup ("");
- }
- /* Next we create our model. This uses the functions we defined
- earlier. */
- e_table_model = e_table_simple_new (
- my_col_count, my_row_count, my_value_at,
- my_set_value_at, my_is_cell_editable,
- my_duplicate_value, my_free_value,
- my_initialize_value, my_value_is_empty,
- my_value_to_string,
- NULL);
- /*
- * Next we create a header. The ETableHeader is used in two
- * different way. The first is the full_header. This is the
- * list of possible columns in the view. The second use is
- * completely internal. Many of the ETableHeader functions are
- * for that purpose. The only functions we really need are
- * e_table_header_new and e_table_header_add_col.
- *
- * First we create the header.
- */
- e_table_header = e_table_header_new ();
-
- /*
- * Next we have to build renderers for all of the columns.
- * Since all our columns are text columns, we can simply use
- * the same renderer over and over again. If we had different
- * types of columns, we could use a different renderer for
- * each column.
- */
- cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT);
-
- /*
- * Next we create a column object for each view column and add
- * them to the header. We don't create a column object for
- * the importance column since it will not be shown.
- */
- for (i = 0; i < COLS; i++) {
- /* Create the column. */
- ETableCol *ecol = e_table_col_new (
- i, headers [i],
- 1.0, 20, cell_left_just,
- g_str_compare, TRUE);
- /* Add it to the header. */
- e_table_header_add_column (e_table_header, ecol, i);
- }
-
- /*
- * Here we create a window for our new table. This window
- * will get shown and the person will be able to test their
- * item.
- */
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- /* This frame is simply to get a bevel around our table. */
- frame = gtk_frame_new (NULL);
-
- /*
- * Here we create the table. We give it the three pieces of
- * the table we've created, the header, the model, and the
- * initial layout. It does the rest.
- */
- e_table = e_table_new (e_table_header, e_table_model, INITIAL_SPEC);
-
- /* Build the gtk widget hierarchy. */
- gtk_container_add (GTK_CONTAINER (frame), e_table);
- gtk_container_add (GTK_CONTAINER (window), frame);
-
- /* Size the initial window. */
- gtk_widget_set_usize (window, 200, 200);
-
- /* Show it all. */
- gtk_widget_show_all (window);
-}
-
-/* This is the main function which just initializes gnome and call our create_table function */
-
-int
-main (int argc, char *argv [])
-{
- gnome_init ("TableExample", "TableExample", argc, argv);
- e_cursors_init ();
-
- gtk_widget_push_visual (gdk_rgb_get_visual ());
- gtk_widget_push_colormap (gdk_rgb_get_cmap ());
-
- create_table ();
-
- gtk_main ();
-
- e_cursors_shutdown ();
- return 0;
-}
-
diff --git a/widgets/table/e-table-example-2.c b/widgets/table/e-table-example-2.c
deleted file mode 100644
index 257867ebed..0000000000
--- a/widgets/table/e-table-example-2.c
+++ /dev/null
@@ -1,350 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-example-2.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
-
-#include "gal/e-util/e-cursors.h"
-#include "e-table-simple.h"
-#include "e-table-header.h"
-#include "e-table-header-item.h"
-#include "e-table-item.h"
-#include "e-cell-text.h"
-#include "e-cell-checkbox.h"
-#include "e-table.h"
-
-#include "table-test.h"
-
-/*
-One way in which we make it simpler to build an ETableModel is through
-the ETableSimple class. Instead of creating your own ETableModel
-class, you simply create a new object of the ETableSimple class. You
-give it a bunch of functions that act as callbacks.
-
-You also get to pass a void * to ETableSimple and it gets passed to
-your callbacks. This would be for having multiple models of the same
-type. This is just an example though, so we statically define all the
-data and ignore the void *data parameter.
-
-In our example we will be creating a table model with 6 columns and 10
-rows. This corresponds to having 6 different types of information and
-10 different sets of data in our database.
-
-The headers will be hard coded, as will be the example data.
-
-*/
-
-/*
- There are two different meanings to the word "column". The first is
- the model column. A model column corresponds to a specific type of
- data. This is very much like the usage in a database table where a
- column is a field in the database.
-
- The second type of column is a view column. A view column
- corresponds to a visually displayed column. Each view column
- corresponds to a specific model column, though a model column may
- have any number of view columns associated with it, from zero to
- greater than one.
-
- Also, a view column doesn't necessarily depend on only one model
- column. In some cases, the view column renderer can be given a
- reference to another column to get extra information about its
- display.
-*/
-
-#define ROWS 10
-#define VIEW_COLS 4
-#define PHYSICAL_COLS 5
-#define VIRTUAL_COLS 6
-
-#define IMPORTANCE_COLUMN 4
-#define COLOR_COLUMN 5
-
-/* Here we define the initial layout of the table. This is an xml
- format that allows you to change the initial ordering of the
- columns or to do sorting or grouping initially. This specification
- shows all 5 columns, but moves the importance column nearer to the
- front. It also sorts by the "Full Name" column (ascending.)
- Sorting and grouping take the model column as their arguments
- (sorting is specified by the "column" argument to the leaf elemnt. */
-#define INITIAL_SPEC "<ETableSpecification> \
- <columns-shown> \
- <column> 0 </column> \
- <column> 4 </column> \
- <column> 1 </column> \
- <column> 2 </column> \
- <column> 3 </column> \
- </columns-shown> \
- <grouping> <leaf column=\"1\" ascending=\"true\"/> </grouping> \
-</ETableSpecification>"
-
-char *headers[VIEW_COLS] = {
- "Email",
- "Full Name",
- "Address",
- "Phone"
-};
-
-/* Virtual Column list:
- 0 Full Name
- 1 Email
- 2 Address
- 3 Phone
- 4 Importance field. This field will be a boolean. It also has a
- special header, so doesn't appear in the headers list.
- 5 Color field. This column is also not displayed. It is also
- not stored in the database. It's calculated based on the
- Importance field.
-*/
-
-char *table_data[ROWS][VIEW_COLS];
-gboolean importance_data[ROWS];
-
-/*
- * ETableSimple callbacks
- * These are the callbacks that define the behavior of our custom model.
- */
-
-/* Since our model is a constant size, we can just return its size in
- the column and row count fields. */
-
-static GdkColor *color1;
-static GdkColor *color2;
-
-static int
-my_col_count (ETableModel *etc, void *data)
-{
- return VIRTUAL_COLS;
-}
-
-static int
-my_row_count (ETableModel *etc, void *data)
-{
- return ROWS;
-}
-
-static void *
-my_value_at (ETableModel *etc, int col, int row, void *data)
-{
- if (col == COLOR_COLUMN){
- if (importance_data[row]){
- return color1;
- } else {
- return color2;
- }
- } else if (col == IMPORTANCE_COLUMN){
- return (gpointer) importance_data[row];
- } else {
- return (void *) table_data [row][col];
- }
-}
-
-static void
-my_set_value_at (ETableModel *etc, int col, int row, const void *val, void *data)
-{
- if (col == COLOR_COLUMN){
- } else if (col == IMPORTANCE_COLUMN){
- importance_data[row] = (gboolean) val;
- } else {
- g_free (table_data [row][col]);
- table_data [row][col] = g_strdup (val);
- }
-}
-
-static gboolean
-my_is_cell_editable (ETableModel *etc, int col, int row, void *data)
-{
- if (col == IMPORTANCE_COLUMN)
- return FALSE;
- else
- return TRUE;
-}
-
-static void *
-my_duplicate_value (ETableModel *etc, int col, const void *value, void *data)
-{
- if (col == COLOR_COLUMN){
- return (void *) value;
- } else if (col == IMPORTANCE_COLUMN){
- return (void *) value;
- } else {
- return g_strdup (value);
- }
-}
-
-static void
-my_free_value (ETableModel *etc, int col, void *value, void *data)
-{
- if (col == COLOR_COLUMN){
- } else if (col == IMPORTANCE_COLUMN){
- } else {
- g_free (value);
- }
-}
-
-static void *
-my_initialize_value (ETableModel *etc, int col, void *data)
-{
- if (col == COLOR_COLUMN){
- return NULL;
- } else if (col == IMPORTANCE_COLUMN){
- return NULL;
- } else {
- return g_strdup ("");
- }
-}
-
-static gboolean
-my_value_is_empty (ETableModel *etc, int col, const void *value, void *data)
-{
- if (col == COLOR_COLUMN){
- return value == NULL;
- } else if (col == IMPORTANCE_COLUMN){
- return value == NULL;
- } else {
- return !(value && *(char *)value);
- }
-}
-
-static char *
-my_value_to_string (ETableModel *etc, int col, const void *value, void *data)
-{
- if (col == COLOR_COLUMN){
- return g_strdup_printf("%d", (int) value);
- } else if (col == IMPORTANCE_COLUMN){
- return g_strdup_printf("%d", (int) value);
- } else {
- return g_strdup(value);
- }
-}
-
-/* We create a window containing our new table. */
-static void
-create_table ()
-{
- GtkWidget *e_table, *window, *frame;
- ECell *cell_left_just;
- ECell *cell_checkbox;
- ETableHeader *e_table_header;
- int i, j;
- ETableModel *e_table_model = NULL;
- ETableCol *ecol;
- GdkPixbuf *pixbuf;
-
- /* First we fill in the simple data. */
- for (i = 0; i < ROWS; i++){
- for (j = 0; j < VIEW_COLS; j++){
- table_data[i][j] = g_strdup ("");
- }
- importance_data[i] = FALSE;
- }
- /* Next we create our model. This uses the functions we defined
- earlier. */
- e_table_model = e_table_simple_new (
- my_col_count, my_row_count, my_value_at,
- my_set_value_at, my_is_cell_editable,
- my_duplicate_value, my_free_value,
- my_initialize_value, my_value_is_empty,
- my_value_to_string,
- NULL);
- /*
- Next we create a header. The ETableHeader is used in two
- different way. The first is the full_header. This is the
- list of possible columns in the view. The second use is
- completely internal. Many of the ETableHeader functions are
- for that purpose. The only functions we really need are
- e_table_header_new and e_table_header_add_col.
-
- First we create the header. */
- e_table_header = e_table_header_new ();
-
- /* Next we have to build renderers for all of the columns.
- Since all our columns are text columns, we can simply use
- the same renderer over and over again. If we had different
- types of columns, we could use a different renderer for
- each column. */
- cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT);
-
- /* Next we create a column object for each view column and add
- them to the header. We don't create a column object for
- the importance column since it will not be shown. */
- for (i = 0; i < VIEW_COLS; i++){
- /* Create the column. */
- ETableCol *ecol = e_table_col_new (
- i, headers [i],
- 1.0, 20, cell_left_just,
- g_str_compare, TRUE);
- /* Add it to the header. */
- e_table_header_add_column (e_table_header, ecol, i);
- }
-
- /* Next we add a special column for the check box. */
-
- cell_checkbox = e_cell_checkbox_new ();
- pixbuf = gdk_pixbuf_new_from_file ("clip.png");
- ecol = e_table_col_new_with_pixbuf (i, pixbuf, 0.0, 18, cell_checkbox, g_int_compare, TRUE);
- e_table_header_add_column (e_table_header, ecol, i);
-
- /*
- * Setup GUI
- */
- /* Here we create a window for our new table. This window
- will get shown and the person will be able to test their
- item. */
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- /* This frame is simply to get a bevel around our table. */
- frame = gtk_frame_new (NULL);
- /* Here we create the table. We give it the three pieces of
- the table we've created, the header, the model, and the
- initial layout. It does the rest. */
- e_table = e_table_new (e_table_header, e_table_model, INITIAL_SPEC);
-
- /* Build the gtk widget hierarchy. */
- gtk_container_add (GTK_CONTAINER (frame), e_table);
- gtk_container_add (GTK_CONTAINER (window), frame);
-
- /* Size the initial window. */
- gtk_widget_set_usize (window, 200, 200);
- /* Show it all. */
- gtk_widget_show_all (window);
-}
-
-
-
-int
-main (int argc, char *argv [])
-{
- gnome_init ("TableExample", "TableExample", argc, argv);
- e_cursors_init ();
-
- gtk_widget_push_visual (gdk_rgb_get_visual ());
- gtk_widget_push_colormap (gdk_rgb_get_cmap ());
-
- create_table ();
-
- gtk_main ();
-
- e_cursors_shutdown ();
- return 0;
-}
diff --git a/widgets/table/e-table-extras.c b/widgets/table/e-table-extras.c
deleted file mode 100644
index e9a18b4f8e..0000000000
--- a/widgets/table/e-table-extras.c
+++ /dev/null
@@ -1,249 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-extras.c - Set of hash table sort of thingies.
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <stdlib.h>
-#include <gtk/gtksignal.h>
-#include "gal/util/e-util.h"
-#include "gal/e-table/e-cell-text.h"
-#include "gal/e-table/e-cell-checkbox.h"
-#include "gal/e-table/e-cell-date.h"
-#include "gal/e-table/e-cell-number.h"
-#include "gal/e-table/e-cell-pixbuf.h"
-#include "gal/e-table/e-cell-size.h"
-#include "gal/e-table/e-cell-tree.h"
-#include "e-table-extras.h"
-#include <string.h>
-
-#define PARENT_TYPE (gtk_object_get_type())
-
-static GtkObjectClass *ete_parent_class;
-
-static void
-cell_hash_free(gchar *key,
- ECell *cell,
- gpointer user_data)
-{
- g_free(key);
- if (cell)
- gtk_object_unref( GTK_OBJECT (cell));
-}
-
-static void
-pixbuf_hash_free(gchar *key,
- GdkPixbuf *pixbuf,
- gpointer user_data)
-{
- g_free(key);
- if (pixbuf)
- gdk_pixbuf_unref(pixbuf);
-}
-
-static void
-ete_destroy (GtkObject *object)
-{
- ETableExtras *ete = E_TABLE_EXTRAS (object);
-
- g_hash_table_foreach (ete->cells, (GHFunc) cell_hash_free, NULL);
- g_hash_table_foreach (ete->compares, (GHFunc) g_free, NULL);
- g_hash_table_foreach (ete->searches, (GHFunc) g_free, NULL);
- g_hash_table_foreach (ete->pixbufs, (GHFunc) pixbuf_hash_free, NULL);
-
- g_hash_table_destroy (ete->cells);
- g_hash_table_destroy (ete->compares);
- g_hash_table_destroy (ete->searches);
- g_hash_table_destroy (ete->pixbufs);
-
- ete->cells = NULL;
- ete->compares = NULL;
- ete->searches = NULL;
- ete->pixbufs = NULL;
-
- GTK_OBJECT_CLASS (ete_parent_class)->destroy (object);
-}
-
-static void
-ete_class_init (GtkObjectClass *klass)
-{
- ete_parent_class = gtk_type_class (PARENT_TYPE);
-
- klass->destroy = ete_destroy;
-}
-
-static gint
-e_strint_compare(gconstpointer data1, gconstpointer data2)
-{
- int int1 = atoi(data1);
- int int2 = atoi(data2);
-
- return g_int_compare(GINT_TO_POINTER(int1), GINT_TO_POINTER(int2));
-}
-
-static gboolean
-e_string_search(gconstpointer haystack, const char *needle)
-{
- int length;
- if (haystack == NULL)
- return FALSE;
-
- length = g_utf8_strlen (needle, -1);
- if (g_utf8_strncasecmp (haystack, needle, length) == 0)
- return TRUE;
- else
- return FALSE;
-}
-
-static void
-ete_init (ETableExtras *extras)
-{
- extras->cells = g_hash_table_new(g_str_hash, g_str_equal);
- extras->compares = g_hash_table_new(g_str_hash, g_str_equal);
- extras->searches = g_hash_table_new(g_str_hash, g_str_equal);
- extras->pixbufs = g_hash_table_new(g_str_hash, g_str_equal);
-
- e_table_extras_add_compare(extras, "string", g_str_compare);
- e_table_extras_add_compare(extras, "integer", g_int_compare);
- e_table_extras_add_compare(extras, "string-integer", e_strint_compare);
-
- e_table_extras_add_search(extras, "string", e_string_search);
-
- e_table_extras_add_cell(extras, "checkbox", e_cell_checkbox_new());
- e_table_extras_add_cell(extras, "date", e_cell_date_new (NULL, GTK_JUSTIFY_LEFT));
- e_table_extras_add_cell(extras, "number", e_cell_number_new (NULL, GTK_JUSTIFY_RIGHT));
- e_table_extras_add_cell(extras, "pixbuf", e_cell_pixbuf_new ());
- e_table_extras_add_cell(extras, "size", e_cell_size_new (NULL, GTK_JUSTIFY_RIGHT));
- e_table_extras_add_cell(extras, "string", e_cell_text_new (NULL, GTK_JUSTIFY_LEFT));
- e_table_extras_add_cell(extras, "tree-string", e_cell_tree_new (NULL, NULL, TRUE, e_cell_text_new (NULL, GTK_JUSTIFY_LEFT)));
-}
-
-E_MAKE_TYPE(e_table_extras, "ETableExtras", ETableExtras, ete_class_init, ete_init, PARENT_TYPE);
-
-ETableExtras *
-e_table_extras_new (void)
-{
- ETableExtras *ete = gtk_type_new (E_TABLE_EXTRAS_TYPE);
-
- return (ETableExtras *) ete;
-}
-
-void
-e_table_extras_add_cell (ETableExtras *extras,
- char *id,
- ECell *cell)
-{
- gchar *old_key;
- ECell *old_cell;
-
- if (g_hash_table_lookup_extended (extras->cells, id, (gpointer *)&old_key, (gpointer *)&old_cell)) {
- g_hash_table_remove (extras->cells, old_key);
- g_free (old_key);
- if (old_cell)
- gtk_object_unref (GTK_OBJECT(old_cell));
- }
-
- if (cell) {
- gtk_object_ref (GTK_OBJECT (cell));
- gtk_object_sink (GTK_OBJECT (cell));
- }
- g_hash_table_insert (extras->cells, g_strdup(id), cell);
-}
-
-ECell *
-e_table_extras_get_cell (ETableExtras *extras,
- char *id)
-{
- return g_hash_table_lookup(extras->cells, id);
-}
-
-void
-e_table_extras_add_compare (ETableExtras *extras,
- char *id,
- GCompareFunc compare)
-{
- gchar *old_key;
- GCompareFunc old_compare;
-
- if (g_hash_table_lookup_extended (extras->compares, id, (gpointer *)&old_key, (gpointer *)&old_compare)) {
- g_hash_table_remove (extras->compares, old_key);
- g_free (old_key);
- }
-
- g_hash_table_insert(extras->compares, g_strdup(id), compare);
-}
-
-GCompareFunc
-e_table_extras_get_compare (ETableExtras *extras,
- char *id)
-{
- return g_hash_table_lookup(extras->compares, id);
-}
-
-void
-e_table_extras_add_search (ETableExtras *extras,
- char *id,
- ETableSearchFunc search)
-{
- gchar *old_key;
- ETableSearchFunc old_search;
-
- if (g_hash_table_lookup_extended (extras->searches, id, (gpointer *)&old_key, (gpointer *)&old_search)) {
- g_hash_table_remove (extras->searches, old_key);
- g_free (old_key);
- }
-
- g_hash_table_insert(extras->searches, g_strdup(id), search);
-}
-
-ETableSearchFunc
-e_table_extras_get_search (ETableExtras *extras,
- char *id)
-{
- return g_hash_table_lookup(extras->searches, id);
-}
-
-void
-e_table_extras_add_pixbuf (ETableExtras *extras,
- char *id,
- GdkPixbuf *pixbuf)
-{
- gchar *old_key;
- GdkPixbuf *old_pixbuf;
-
- if (g_hash_table_lookup_extended (extras->pixbufs, id, (gpointer *)&old_key, (gpointer *)&old_pixbuf)) {
- g_hash_table_remove (extras->cells, old_key);
- g_free (old_key);
- if (old_pixbuf)
- gdk_pixbuf_unref (old_pixbuf);
- }
-
- if (pixbuf)
- gdk_pixbuf_ref(pixbuf);
- g_hash_table_insert (extras->pixbufs, g_strdup(id), pixbuf);
-}
-
-GdkPixbuf *
-e_table_extras_get_pixbuf (ETableExtras *extras,
- char *id)
-{
- return g_hash_table_lookup(extras->pixbufs, id);
-}
diff --git a/widgets/table/e-table-extras.h b/widgets/table/e-table-extras.h
deleted file mode 100644
index a077319aec..0000000000
--- a/widgets/table/e-table-extras.h
+++ /dev/null
@@ -1,82 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-extras.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_TABLE_EXTRAS_H_
-#define _E_TABLE_EXTRAS_H_
-
-#include <gtk/gtkobject.h>
-#include <gal/e-table/e-cell.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <libgnome/gnome-defs.h>
-
-BEGIN_GNOME_DECLS
-
-#define E_TABLE_EXTRAS_TYPE (e_table_extras_get_type ())
-#define E_TABLE_EXTRAS(o) (GTK_CHECK_CAST ((o), E_TABLE_EXTRAS_TYPE, ETableExtras))
-#define E_TABLE_EXTRAS_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_EXTRAS_TYPE, ETableExtrasClass))
-#define E_IS_TABLE_EXTRAS(o) (GTK_CHECK_TYPE ((o), E_TABLE_EXTRAS_TYPE))
-#define E_IS_TABLE_EXTRAS_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_EXTRAS_TYPE))
-
-typedef struct {
- GtkObject base;
-
- GHashTable *cells;
- GHashTable *compares;
- GHashTable *pixbufs;
- GHashTable *searches;
-} ETableExtras;
-
-typedef struct {
- GtkObjectClass parent_class;
-} ETableExtrasClass;
-
-GtkType e_table_extras_get_type (void);
-ETableExtras *e_table_extras_new (void);
-
-void e_table_extras_add_cell (ETableExtras *extras,
- char *id,
- ECell *cell);
-ECell *e_table_extras_get_cell (ETableExtras *extras,
- char *id);
-
-void e_table_extras_add_compare (ETableExtras *extras,
- char *id,
- GCompareFunc compare);
-GCompareFunc e_table_extras_get_compare (ETableExtras *extras,
- char *id);
-
-void e_table_extras_add_search (ETableExtras *extras,
- char *id,
- ETableSearchFunc search);
-ETableSearchFunc e_table_extras_get_search (ETableExtras *extras,
- char *id);
-
-void e_table_extras_add_pixbuf (ETableExtras *extras,
- char *id,
- GdkPixbuf *pixbuf);
-GdkPixbuf *e_table_extras_get_pixbuf (ETableExtras *extras,
- char *id);
-
-END_GNOME_DECLS
-
-#endif /* _E_TABLE_EXTRAS_H_ */
diff --git a/widgets/table/e-table-field-chooser-dialog.c b/widgets/table/e-table-field-chooser-dialog.c
deleted file mode 100644
index 813478798c..0000000000
--- a/widgets/table/e-table-field-chooser-dialog.c
+++ /dev/null
@@ -1,219 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-field-chooser-dialog.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include "e-table-field-chooser-dialog.h"
-#include <libgnomeui/gnome-stock.h>
-#include "gal/util/e-i18n.h"
-
-static void e_table_field_chooser_dialog_init (ETableFieldChooserDialog *card);
-static void e_table_field_chooser_dialog_class_init (ETableFieldChooserDialogClass *klass);
-static void e_table_field_chooser_dialog_set_arg (GtkObject *o, GtkArg *arg, guint arg_id);
-static void e_table_field_chooser_dialog_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
-static void e_table_field_chooser_dialog_destroy (GtkObject *object);
-static void e_table_field_chooser_dialog_clicked (GnomeDialog *dialog, gint button);
-
-static GnomeDialogClass *parent_class = NULL;
-
-/* The arguments we take */
-enum {
- ARG_0,
- ARG_DND_CODE,
- ARG_FULL_HEADER,
- ARG_HEADER,
-};
-
-GtkType
-e_table_field_chooser_dialog_get_type (void)
-{
- static GtkType table_field_chooser_dialog_type = 0;
-
- if (!table_field_chooser_dialog_type)
- {
- static const GtkTypeInfo table_field_chooser_dialog_info =
- {
-
- "ETableFieldChooserDialog",
- sizeof (ETableFieldChooserDialog),
- sizeof (ETableFieldChooserDialogClass),
- (GtkClassInitFunc) e_table_field_chooser_dialog_class_init,
- (GtkObjectInitFunc) e_table_field_chooser_dialog_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- table_field_chooser_dialog_type = gtk_type_unique (gnome_dialog_get_type (), &table_field_chooser_dialog_info);
- }
-
- return table_field_chooser_dialog_type;
-}
-
-static void
-e_table_field_chooser_dialog_class_init (ETableFieldChooserDialogClass *klass)
-{
- GtkObjectClass *object_class;
- GnomeDialogClass *dialog_class;
-
- object_class = (GtkObjectClass*) klass;
- dialog_class = GNOME_DIALOG_CLASS (klass);
-
- parent_class = gtk_type_class (gnome_dialog_get_type ());
-
- object_class->destroy = e_table_field_chooser_dialog_destroy;
- object_class->set_arg = e_table_field_chooser_dialog_set_arg;
- object_class->get_arg = e_table_field_chooser_dialog_get_arg;
-
- dialog_class->clicked = e_table_field_chooser_dialog_clicked;
-
- gtk_object_add_arg_type ("ETableFieldChooserDialog::dnd_code", GTK_TYPE_STRING,
- GTK_ARG_READWRITE, ARG_DND_CODE);
- gtk_object_add_arg_type ("ETableFieldChooserDialog::full_header", GTK_TYPE_OBJECT,
- GTK_ARG_READWRITE, ARG_FULL_HEADER);
- gtk_object_add_arg_type ("ETableFieldChooserDialog::header", GTK_TYPE_OBJECT,
- GTK_ARG_READWRITE, ARG_HEADER);
-}
-
-static void
-e_table_field_chooser_dialog_init (ETableFieldChooserDialog *e_table_field_chooser_dialog)
-{
- GtkWidget *widget;
-
- e_table_field_chooser_dialog->etfc = NULL;
- e_table_field_chooser_dialog->dnd_code = g_strdup("");
- e_table_field_chooser_dialog->full_header = NULL;
- e_table_field_chooser_dialog->header = NULL;
-
- gnome_dialog_append_buttons(GNOME_DIALOG(e_table_field_chooser_dialog),
- GNOME_STOCK_BUTTON_CLOSE,
- NULL);
-
- gtk_window_set_policy(GTK_WINDOW(e_table_field_chooser_dialog), FALSE, TRUE, FALSE);
-
- widget = e_table_field_chooser_new();
- e_table_field_chooser_dialog->etfc = E_TABLE_FIELD_CHOOSER(widget);
-
- gtk_object_set(GTK_OBJECT(widget),
- "dnd_code", e_table_field_chooser_dialog->dnd_code,
- "full_header", e_table_field_chooser_dialog->full_header,
- "header", e_table_field_chooser_dialog->header,
- NULL);
-
- gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(e_table_field_chooser_dialog)->vbox),
- widget, TRUE, TRUE, 0);
-
- gtk_widget_show(GTK_WIDGET(widget));
-
- gtk_window_set_title (GTK_WINDOW (e_table_field_chooser_dialog), _("Add a column..."));
-}
-
-GtkWidget*
-e_table_field_chooser_dialog_new (void)
-{
- GtkWidget *widget = GTK_WIDGET (gtk_type_new (e_table_field_chooser_dialog_get_type ()));
- return widget;
-}
-
-static void
-e_table_field_chooser_dialog_destroy (GtkObject *object)
-{
- ETableFieldChooserDialog *etfcd = E_TABLE_FIELD_CHOOSER_DIALOG (object);
- g_free(etfcd->dnd_code);
- if (etfcd->full_header)
- gtk_object_unref(GTK_OBJECT(etfcd->full_header));
- if (etfcd->header)
- gtk_object_unref(GTK_OBJECT(etfcd->header));
-}
-
-static void
-e_table_field_chooser_dialog_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- ETableFieldChooserDialog *etfcd = E_TABLE_FIELD_CHOOSER_DIALOG(object);
- switch (arg_id){
- case ARG_DND_CODE:
- g_free(etfcd->dnd_code);
- etfcd->dnd_code = g_strdup(GTK_VALUE_STRING (*arg));
- if (etfcd->etfc)
- gtk_object_set(GTK_OBJECT(etfcd->etfc),
- "dnd_code", etfcd->dnd_code,
- NULL);
- break;
- case ARG_FULL_HEADER:
- if (etfcd->full_header)
- gtk_object_unref(GTK_OBJECT(etfcd->full_header));
- if (GTK_VALUE_OBJECT(*arg))
- etfcd->full_header = E_TABLE_HEADER(GTK_VALUE_OBJECT(*arg));
- else
- etfcd->full_header = NULL;
- if (etfcd->full_header)
- gtk_object_ref(GTK_OBJECT(etfcd->full_header));
- if (etfcd->etfc)
- gtk_object_set(GTK_OBJECT(etfcd->etfc),
- "full_header", etfcd->full_header,
- NULL);
- break;
- case ARG_HEADER:
- if (etfcd->header)
- gtk_object_unref(GTK_OBJECT(etfcd->header));
- if (GTK_VALUE_OBJECT(*arg))
- etfcd->header = E_TABLE_HEADER(GTK_VALUE_OBJECT(*arg));
- else
- etfcd->header = NULL;
- if (etfcd->header)
- gtk_object_ref(GTK_OBJECT(etfcd->header));
- if (etfcd->etfc)
- gtk_object_set(GTK_OBJECT(etfcd->etfc),
- "header", etfcd->header,
- NULL);
- break;
- default:
- break;
- }
-}
-
-static void
-e_table_field_chooser_dialog_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- ETableFieldChooserDialog *etfcd = E_TABLE_FIELD_CHOOSER_DIALOG(object);
- switch (arg_id) {
- case ARG_DND_CODE:
- GTK_VALUE_STRING (*arg) = g_strdup (etfcd->dnd_code);
- break;
- case ARG_FULL_HEADER:
- GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(etfcd->full_header);
- break;
- case ARG_HEADER:
- GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(etfcd->header);
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-static void
-e_table_field_chooser_dialog_clicked (GnomeDialog *dialog, int button)
-{
- if (button == 0)
- gnome_dialog_close(dialog);
-}
diff --git a/widgets/table/e-table-field-chooser-dialog.h b/widgets/table/e-table-field-chooser-dialog.h
deleted file mode 100644
index 10843e579c..0000000000
--- a/widgets/table/e-table-field-chooser-dialog.h
+++ /dev/null
@@ -1,79 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-field-chooser-dialog.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef __E_TABLE_FIELD_CHOOSER_DIALOG_H__
-#define __E_TABLE_FIELD_CHOOSER_DIALOG_H__
-
-#include <libgnomeui/gnome-dialog.h>
-#include <gal/e-table/e-table-field-chooser.h>
-#include <gal/e-table/e-table-header.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-/* ETableFieldChooserDialog - A dialog displaying information about a contact.
- *
- * The following arguments are available:
- *
- * name type read/write description
- * --------------------------------------------------------------------------------
- */
-
-#define E_TABLE_FIELD_CHOOSER_DIALOG_TYPE (e_table_field_chooser_dialog_get_type ())
-#define E_TABLE_FIELD_CHOOSER_DIALOG(obj) (GTK_CHECK_CAST ((obj), E_TABLE_FIELD_CHOOSER_DIALOG_TYPE, ETableFieldChooserDialog))
-#define E_TABLE_FIELD_CHOOSER_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TABLE_FIELD_CHOOSER_DIALOG_TYPE, ETableFieldChooserDialogClass))
-#define E_IS_TABLE_FIELD_CHOOSER_DIALOG(obj) (GTK_CHECK_TYPE ((obj), E_TABLE_FIELD_CHOOSER_DIALOG_TYPE))
-#define E_IS_TABLE_FIELD_CHOOSER_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TABLE_FIELD_CHOOSER_DIALOG_TYPE))
-
-
-typedef struct _ETableFieldChooserDialog ETableFieldChooserDialog;
-typedef struct _ETableFieldChooserDialogClass ETableFieldChooserDialogClass;
-
-struct _ETableFieldChooserDialog
-{
- GnomeDialog parent;
-
- /* item specific fields */
- ETableFieldChooser *etfc;
- gchar *dnd_code;
- ETableHeader *full_header;
- ETableHeader *header;
-};
-
-struct _ETableFieldChooserDialogClass
-{
- GnomeDialogClass parent_class;
-};
-
-
-GtkWidget *e_table_field_chooser_dialog_new(void);
-GtkType e_table_field_chooser_dialog_get_type (void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __E_TABLE_FIELD_CHOOSER_DIALOG_H__ */
diff --git a/widgets/table/e-table-field-chooser-item.c b/widgets/table/e-table-field-chooser-item.c
deleted file mode 100644
index 5bd71a1fbc..0000000000
--- a/widgets/table/e-table-field-chooser-item.c
+++ /dev/null
@@ -1,691 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-field-chooser-item.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <string.h>
-#include <gtk/gtksignal.h>
-#include <gtk/gtkdnd.h>
-#include <libgnomeui/gnome-canvas.h>
-#include <libgnomeui/gnome-canvas-util.h>
-#include <libgnomeui/gnome-canvas-polygon.h>
-#include <libgnomeui/gnome-canvas-rect-ellipse.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
-
-#include "gal/util/e-util.h"
-#include "gal/util/e-xml-utils.h"
-#include "gal/widgets/e-canvas.h"
-
-#include "e-table-header.h"
-#include "e-table-col-dnd.h"
-#include "e-table-defines.h"
-#include "e-table-header-utils.h"
-
-#include "e-table-field-chooser-item.h"
-
-#if 0
-enum {
- BUTTON_PRESSED,
- LAST_SIGNAL
-};
-
-static guint etfci_signals [LAST_SIGNAL] = { 0, };
-#endif
-
-#define PARENT_OBJECT_TYPE gnome_canvas_item_get_type ()
-
-#define ELEMENTS(x) (sizeof (x) / sizeof (x[0]))
-
-static GnomeCanvasItemClass *etfci_parent_class;
-
-static void etfci_drop_table_header (ETableFieldChooserItem *etfci);
-static void etfci_drop_full_header (ETableFieldChooserItem *etfci);
-
-enum {
- ARG_0,
- ARG_FULL_HEADER,
- ARG_HEADER,
- ARG_DND_CODE,
- ARG_WIDTH,
- ARG_HEIGHT,
-};
-
-static void
-etfci_destroy (GtkObject *object){
- ETableFieldChooserItem *etfci = E_TABLE_FIELD_CHOOSER_ITEM (object);
-
- etfci_drop_table_header (etfci);
- etfci_drop_full_header (etfci);
- if (etfci->combined_header != NULL)
- gtk_object_unref (GTK_OBJECT (etfci->combined_header));
-
- gdk_font_unref(etfci->font);
-
- if (GTK_OBJECT_CLASS (etfci_parent_class)->destroy)
- (*GTK_OBJECT_CLASS (etfci_parent_class)->destroy) (object);
-}
-
-static gint
-etfci_find_button (ETableFieldChooserItem *etfci, double loc)
-{
- int i;
- int count;
- double height = 0;
- GtkStyle *style;
-
- style = GTK_WIDGET (GNOME_CANVAS_ITEM (etfci)->canvas)->style;
-
- count = e_table_header_count(etfci->combined_header);
- for (i = 0; i < count; i++) {
- ETableCol *ecol;
-
- ecol = e_table_header_get_column (etfci->combined_header, i);
- if (ecol->disabled)
- continue;
- height += e_table_header_compute_height (ecol, style, etfci->font);
- if (height > loc)
- return i;
- }
- return MAX(0, count - 1);
-}
-
-static void
-etfci_rebuild_combined (ETableFieldChooserItem *etfci)
-{
- int count;
- GHashTable *hash;
- int i;
-
- if (etfci->combined_header != NULL)
- gtk_object_unref (GTK_OBJECT (etfci->combined_header));
-
- etfci->combined_header = e_table_header_new ();
-
- hash = g_hash_table_new (NULL, NULL);
-
- count = e_table_header_count (etfci->header);
- for (i = 0; i < count; i++) {
- ETableCol *ecol = e_table_header_get_column (etfci->header, i);
- if (ecol->disabled)
- continue;
- g_hash_table_insert (hash, GINT_TO_POINTER (ecol->col_idx), GINT_TO_POINTER (1));
- }
-
- count = e_table_header_count (etfci->full_header);
- for (i = 0; i < count; i++) {
- ETableCol *ecol = e_table_header_get_column (etfci->full_header, i);
- if (ecol->disabled)
- continue;
- if (! (GPOINTER_TO_INT (g_hash_table_lookup (hash, GINT_TO_POINTER (ecol->col_idx)))))
- e_table_header_add_column (etfci->combined_header, ecol, -1);
- }
-
- g_hash_table_destroy (hash);
-}
-
-static void
-etfci_reflow (GnomeCanvasItem *item, gint flags)
-{
- ETableFieldChooserItem *etfci = E_TABLE_FIELD_CHOOSER_ITEM (item);
- double old_height;
- int i;
- int count;
- double height = 0;
- GtkStyle *style;
-
- etfci_rebuild_combined (etfci);
-
- style = GTK_WIDGET (GNOME_CANVAS_ITEM (etfci)->canvas)->style;
-
- old_height = etfci->height;
-
- count = e_table_header_count(etfci->combined_header);
- for (i = 0; i < count; i++) {
- ETableCol *ecol;
-
- ecol = e_table_header_get_column (etfci->combined_header, i);
- if (ecol->disabled)
- continue;
- height += e_table_header_compute_height (ecol, style, etfci->font);
- }
-
- etfci->height = height;
-
- if (old_height != etfci->height)
- e_canvas_item_request_parent_reflow(item);
-
- gnome_canvas_item_request_update(item);
-}
-
-static void
-etfci_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags)
-{
- ETableFieldChooserItem *etfci = E_TABLE_FIELD_CHOOSER_ITEM (item);
- double i2c [6];
- ArtPoint c1, c2, i1, i2;
-
- if (GNOME_CANVAS_ITEM_CLASS (etfci_parent_class)->update)
- (*GNOME_CANVAS_ITEM_CLASS (etfci_parent_class)->update)(item, affine, clip_path, flags);
-
- i1.x = i1.y = 0;
- i2.x = etfci->width;
- i2.y = etfci->height;
-
- gnome_canvas_item_i2c_affine (item, i2c);
- art_affine_point (&c1, &i1, i2c);
- art_affine_point (&c2, &i2, i2c);
-
- if (item->x1 != c1.x ||
- item->y1 != c1.y ||
- item->x2 != c2.x ||
- item->y2 != c2.y)
- {
- gnome_canvas_request_redraw (item->canvas, item->x1, item->y1, item->x2, item->y2);
- item->x1 = c1.x;
- item->y1 = c1.y;
- item->x2 = c2.x;
- item->y2 = c2.y;
-
- gnome_canvas_group_child_bounds (GNOME_CANVAS_GROUP (item->parent), item);
- }
- gnome_canvas_request_redraw (item->canvas, item->x1, item->y1, item->x2, item->y2);
-}
-
-static void
-etfci_font_load (ETableFieldChooserItem *etfci)
-{
- if (etfci->font)
- gdk_font_unref (etfci->font);
-
- etfci->font = GTK_WIDGET(GNOME_CANVAS_ITEM(etfci)->canvas)->style->font;
- gdk_font_ref(etfci->font);
-}
-
-static void
-etfci_drop_full_header (ETableFieldChooserItem *etfci)
-{
- GtkObject *header;
-
- if (!etfci->full_header)
- return;
-
- header = GTK_OBJECT (etfci->full_header);
- if (etfci->full_header_structure_change_id)
- gtk_signal_disconnect (header, etfci->full_header_structure_change_id);
- if (etfci->full_header_dimension_change_id)
- gtk_signal_disconnect (header, etfci->full_header_dimension_change_id);
- etfci->full_header_structure_change_id = 0;
- etfci->full_header_dimension_change_id = 0;
-
- if (header)
- gtk_object_unref (header);
- etfci->full_header = NULL;
- etfci->height = 0;
- e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(etfci));
-}
-
-static void
-full_header_structure_changed (ETableHeader *header, ETableFieldChooserItem *etfci)
-{
- e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(etfci));
-}
-
-static void
-full_header_dimension_changed (ETableHeader *header, int col, ETableFieldChooserItem *etfci)
-{
- e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(etfci));
-}
-
-static void
-etfci_add_full_header (ETableFieldChooserItem *etfci, ETableHeader *header)
-{
- etfci->full_header = header;
- gtk_object_ref (GTK_OBJECT (etfci->full_header));
-
- etfci->full_header_structure_change_id = gtk_signal_connect (
- GTK_OBJECT (header), "structure_change",
- GTK_SIGNAL_FUNC(full_header_structure_changed), etfci);
- etfci->full_header_dimension_change_id = gtk_signal_connect (
- GTK_OBJECT (header), "dimension_change",
- GTK_SIGNAL_FUNC(full_header_dimension_changed), etfci);
- e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(etfci));
-}
-
-static void
-etfci_drop_table_header (ETableFieldChooserItem *etfci)
-{
- GtkObject *header;
-
- if (!etfci->header)
- return;
-
- header = GTK_OBJECT (etfci->header);
- if (etfci->table_header_structure_change_id)
- gtk_signal_disconnect (header, etfci->table_header_structure_change_id);
- if (etfci->table_header_dimension_change_id)
- gtk_signal_disconnect (header, etfci->table_header_dimension_change_id);
- etfci->table_header_structure_change_id = 0;
- etfci->table_header_dimension_change_id = 0;
-
- if (header)
- gtk_object_unref (header);
- etfci->header = NULL;
- etfci->height = 0;
- e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(etfci));
-}
-
-static void
-table_header_structure_changed (ETableHeader *header, ETableFieldChooserItem *etfci)
-{
- e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(etfci));
-}
-
-static void
-table_header_dimension_changed (ETableHeader *header, int col, ETableFieldChooserItem *etfci)
-{
- e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(etfci));
-}
-
-static void
-etfci_add_table_header (ETableFieldChooserItem *etfci, ETableHeader *header)
-{
- etfci->header = header;
- gtk_object_ref (GTK_OBJECT (etfci->header));
-
- etfci->table_header_structure_change_id = gtk_signal_connect (
- GTK_OBJECT (header), "structure_change",
- GTK_SIGNAL_FUNC(table_header_structure_changed), etfci);
- etfci->table_header_dimension_change_id = gtk_signal_connect (
- GTK_OBJECT (header), "dimension_change",
- GTK_SIGNAL_FUNC(table_header_dimension_changed), etfci);
- e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(etfci));
-}
-
-static void
-etfci_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- GnomeCanvasItem *item;
- ETableFieldChooserItem *etfci;
-
- item = GNOME_CANVAS_ITEM (o);
- etfci = E_TABLE_FIELD_CHOOSER_ITEM (o);
-
- switch (arg_id){
- case ARG_FULL_HEADER:
- etfci_drop_full_header (etfci);
- if (GTK_VALUE_OBJECT (*arg))
- etfci_add_full_header (etfci, E_TABLE_HEADER(GTK_VALUE_OBJECT (*arg)));
- break;
-
- case ARG_HEADER:
- etfci_drop_table_header (etfci);
- if (GTK_VALUE_OBJECT (*arg))
- etfci_add_table_header (etfci, E_TABLE_HEADER(GTK_VALUE_OBJECT (*arg)));
- break;
-
- case ARG_DND_CODE:
- g_free(etfci->dnd_code);
- etfci->dnd_code = g_strdup(GTK_VALUE_STRING (*arg));
- break;
-
- case ARG_WIDTH:
- etfci->width = GTK_VALUE_DOUBLE (*arg);
- gnome_canvas_item_request_update(item);
- break;
- }
-}
-
-static void
-etfci_get_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- GnomeCanvasItem *item;
- ETableFieldChooserItem *etfci;
-
- item = GNOME_CANVAS_ITEM (o);
- etfci = E_TABLE_FIELD_CHOOSER_ITEM (o);
-
- switch (arg_id){
-
- case ARG_DND_CODE:
- GTK_VALUE_STRING (*arg) = g_strdup (etfci->dnd_code);
- break;
- case ARG_WIDTH:
- GTK_VALUE_DOUBLE (*arg) = etfci->width;
- break;
- case ARG_HEIGHT:
- GTK_VALUE_DOUBLE (*arg) = etfci->height;
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-static void
-etfci_drag_data_get (GtkWidget *widget,
- GdkDragContext *context,
- GtkSelectionData *selection_data,
- guint info,
- guint time,
- ETableFieldChooserItem *etfci)
-{
- if (etfci->drag_col != -1) {
- gchar *string = g_strdup_printf("%d", etfci->drag_col);
- gtk_selection_data_set(selection_data,
- GDK_SELECTION_TYPE_STRING,
- sizeof(string[0]),
- string,
- strlen(string));
- g_free(string);
- }
-}
-
-static void
-etfci_drag_end (GtkWidget *canvas,
- GdkDragContext *context,
- ETableFieldChooserItem *etfci)
-{
- etfci->drag_col = -1;
-}
-
-static void
-etfci_realize (GnomeCanvasItem *item)
-{
- ETableFieldChooserItem *etfci = E_TABLE_FIELD_CHOOSER_ITEM (item);
- GdkWindow *window;
-
- if (GNOME_CANVAS_ITEM_CLASS (etfci_parent_class)-> realize)
- (*GNOME_CANVAS_ITEM_CLASS (etfci_parent_class)->realize)(item);
-
- window = GTK_WIDGET (item->canvas)->window;
-
- if (!etfci->font)
- etfci_font_load (etfci);
-
- etfci->drag_end_id = gtk_signal_connect (
- GTK_OBJECT (item->canvas), "drag_end",
- GTK_SIGNAL_FUNC (etfci_drag_end), etfci);
- etfci->drag_data_get_id = gtk_signal_connect (
- GTK_OBJECT (item->canvas), "drag_data_get",
- GTK_SIGNAL_FUNC (etfci_drag_data_get), etfci);
- e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(etfci));
-}
-
-static void
-etfci_unrealize (GnomeCanvasItem *item)
-{
- ETableFieldChooserItem *etfci = E_TABLE_FIELD_CHOOSER_ITEM (item);
-
- if (etfci->font)
- gdk_font_unref (etfci->font);
- etfci->font = NULL;
-
- gtk_signal_disconnect (GTK_OBJECT (item->canvas), etfci->drag_end_id);
- etfci->drag_end_id = 0;
- gtk_signal_disconnect (GTK_OBJECT (item->canvas), etfci->drag_data_get_id);
- etfci->drag_data_get_id = 0;
-
- if (GNOME_CANVAS_ITEM_CLASS (etfci_parent_class)->unrealize)
- (*GNOME_CANVAS_ITEM_CLASS (etfci_parent_class)->unrealize)(item);
-}
-
-static void
-etfci_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width, int height)
-{
- ETableFieldChooserItem *etfci = E_TABLE_FIELD_CHOOSER_ITEM (item);
- GnomeCanvas *canvas = item->canvas;
- int rows;
- int y1, y2;
- int row;
- GtkStyle *style;
- GtkStateType state;
-
- if (etfci->combined_header == NULL)
- return;
-
- rows = e_table_header_count (etfci->combined_header);
-
- style = GTK_WIDGET (canvas)->style;
- state = GTK_WIDGET_STATE (canvas);
-
- y1 = y2 = 0;
- for (row = 0; row < rows; row++, y1 = y2){
- ETableCol *ecol;
-
- ecol = e_table_header_get_column (etfci->combined_header, row);
-
- if (ecol->disabled)
- continue;
-
- y2 += e_table_header_compute_height (ecol, style, etfci->font);
-
- if (y1 > (y + height))
- break;
-
- if (y2 < y)
- continue;
-
- e_table_header_draw_button (drawable, ecol,
- style, etfci->font, state,
- GTK_WIDGET (canvas),
- -x, y1 - y,
- width, height,
- etfci->width, y2 - y1,
- E_TABLE_COL_ARROW_NONE);
- }
-}
-
-static double
-etfci_point (GnomeCanvasItem *item, double x, double y, int cx, int cy,
- GnomeCanvasItem **actual_item)
-{
- *actual_item = item;
- return 0.0;
-}
-
-static gboolean
-etfci_maybe_start_drag (ETableFieldChooserItem *etfci, double x, double y)
-{
- if (!etfci->maybe_drag)
- return FALSE;
-
- if (MAX (abs (etfci->click_x - x),
- abs (etfci->click_y - y)) <= 3)
- return FALSE;
-
- return TRUE;
-}
-
-static void
-etfci_start_drag (ETableFieldChooserItem *etfci, GdkEvent *event, double x, double y)
-{
- GtkWidget *widget = GTK_WIDGET (GNOME_CANVAS_ITEM (etfci)->canvas);
- GtkTargetList *list;
- GdkDragContext *context;
- ETableCol *ecol;
- GdkPixmap *pixmap;
- int drag_col;
- int button_height;
-
- GtkTargetEntry etfci_drag_types [] = {
- { TARGET_ETABLE_COL_TYPE, 0, TARGET_ETABLE_COL_HEADER },
- };
-
- if (etfci->combined_header == NULL)
- return;
-
- drag_col = etfci_find_button(etfci, y);
-
- if (drag_col < 0 || drag_col > e_table_header_count(etfci->combined_header))
- return;
-
- ecol = e_table_header_get_column (etfci->combined_header, drag_col);
-
- if (ecol->disabled)
- return;
-
- etfci->drag_col = ecol->col_idx;
-
- etfci_drag_types[0].target = g_strdup_printf("%s-%s", etfci_drag_types[0].target, etfci->dnd_code);
- list = gtk_target_list_new (etfci_drag_types, ELEMENTS (etfci_drag_types));
- context = gtk_drag_begin (widget, list, GDK_ACTION_MOVE, 1, event);
- g_free(etfci_drag_types[0].target);
-
- button_height = e_table_header_compute_height (ecol, widget->style, etfci->font);
- pixmap = gdk_pixmap_new (widget->window, etfci->width, button_height, -1);
-
- e_table_header_draw_button (pixmap, ecol,
- widget->style, etfci->font, GTK_WIDGET_STATE (widget),
- widget,
- 0, 0,
- etfci->width, button_height,
- etfci->width, button_height,
- E_TABLE_COL_ARROW_NONE);
-
- gtk_drag_set_icon_pixmap (context,
- gdk_window_get_colormap (widget->window),
- pixmap,
- NULL,
- etfci->width / 2,
- button_height / 2);
- gdk_pixmap_unref (pixmap);
- etfci->maybe_drag = FALSE;
-}
-
-/*
- * Handles the events on the ETableFieldChooserItem
- */
-static int
-etfci_event (GnomeCanvasItem *item, GdkEvent *e)
-{
- ETableFieldChooserItem *etfci = E_TABLE_FIELD_CHOOSER_ITEM (item);
- GnomeCanvas *canvas = item->canvas;
- int x, y;
-
- switch (e->type){
- case GDK_MOTION_NOTIFY:
- gnome_canvas_w2c (canvas, e->motion.x, e->motion.y, &x, &y);
-
- if (etfci_maybe_start_drag (etfci, x, y))
- etfci_start_drag (etfci, e, x, y);
- break;
-
- case GDK_BUTTON_PRESS:
- gnome_canvas_w2c (canvas, e->button.x, e->button.y, &x, &y);
-
- if (e->button.button == 1){
- etfci->click_x = x;
- etfci->click_y = y;
- etfci->maybe_drag = TRUE;
- }
- break;
-
- case GDK_BUTTON_RELEASE: {
- etfci->maybe_drag = FALSE;
- break;
- }
-
- default:
- return FALSE;
- }
- return TRUE;
-}
-
-static void
-etfci_class_init (GtkObjectClass *object_class)
-{
- GnomeCanvasItemClass *item_class = (GnomeCanvasItemClass *) object_class;
-
- etfci_parent_class = gtk_type_class (PARENT_OBJECT_TYPE);
-
- object_class->destroy = etfci_destroy;
- object_class->set_arg = etfci_set_arg;
- object_class->get_arg = etfci_get_arg;
-
- item_class->update = etfci_update;
- item_class->realize = etfci_realize;
- item_class->unrealize = etfci_unrealize;
- item_class->draw = etfci_draw;
- item_class->point = etfci_point;
- item_class->event = etfci_event;
-
- gtk_object_add_arg_type ("ETableFieldChooserItem::dnd_code", GTK_TYPE_STRING,
- GTK_ARG_READWRITE, ARG_DND_CODE);
- gtk_object_add_arg_type ("ETableFieldChooserItem::full_header", GTK_TYPE_OBJECT,
- GTK_ARG_WRITABLE, ARG_FULL_HEADER);
- gtk_object_add_arg_type ("ETableFieldChooserItem::header", GTK_TYPE_OBJECT,
- GTK_ARG_WRITABLE, ARG_HEADER);
- gtk_object_add_arg_type ("ETableFieldChooserItem::width", GTK_TYPE_DOUBLE,
- GTK_ARG_READWRITE, ARG_WIDTH);
- gtk_object_add_arg_type ("ETableFieldChooserItem::height", GTK_TYPE_DOUBLE,
- GTK_ARG_READABLE, ARG_HEIGHT);
-}
-
-static void
-etfci_init (GnomeCanvasItem *item)
-{
- ETableFieldChooserItem *etfci = E_TABLE_FIELD_CHOOSER_ITEM (item);
-
- etfci->full_header = NULL;
- etfci->header = NULL;
- etfci->combined_header = NULL;
-
- etfci->height = etfci->width = 0;
-
- etfci->font = NULL;
-
- etfci->full_header_structure_change_id = 0;
- etfci->full_header_dimension_change_id = 0;
- etfci->table_header_structure_change_id = 0;
- etfci->table_header_dimension_change_id = 0;
-
- etfci->dnd_code = NULL;
-
- etfci->maybe_drag = 0;
- etfci->drag_end_id = 0;
-
- e_canvas_item_set_reflow_callback(item, etfci_reflow);
-}
-
-GtkType
-e_table_field_chooser_item_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type){
- GtkTypeInfo info = {
- "ETableFieldChooserItem",
- sizeof (ETableFieldChooserItem),
- sizeof (ETableFieldChooserItemClass),
- (GtkClassInitFunc) etfci_class_init,
- (GtkObjectInitFunc) etfci_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-field-chooser-item.h b/widgets/table/e-table-field-chooser-item.h
deleted file mode 100644
index 77a15b8811..0000000000
--- a/widgets/table/e-table-field-chooser-item.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-field-chooser-item.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_TABLE_FIELD_CHOOSER_ITEM_H_
-#define _E_TABLE_FIELD_CHOOSER_ITEM_H_
-
-#include <libgnomeui/gnome-canvas.h>
-#include <gnome-xml/tree.h>
-#include <gal/e-table/e-table-header.h>
-#include <libgnome/gnome-defs.h>
-
-BEGIN_GNOME_DECLS
-
-#define E_TABLE_FIELD_CHOOSER_ITEM_TYPE (e_table_field_chooser_item_get_type ())
-#define E_TABLE_FIELD_CHOOSER_ITEM(o) (GTK_CHECK_CAST ((o), E_TABLE_FIELD_CHOOSER_ITEM_TYPE, ETableFieldChooserItem))
-#define E_TABLE_FIELD_CHOOSER_ITEM_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_FIELD_CHOOSER_ITEM_TYPE, ETableFieldChooserItemClass))
-#define E_IS_TABLE_FIELD_CHOOSER_ITEM(o) (GTK_CHECK_TYPE ((o), E_TABLE_FIELD_CHOOSER_ITEM_TYPE))
-#define E_IS_TABLE_FIELD_CHOOSER_ITEM_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_FIELD_CHOOSER_ITEM_TYPE))
-
-typedef struct {
- GnomeCanvasItem parent;
- ETableHeader *full_header;
- ETableHeader *header;
- ETableHeader *combined_header;
-
- double height, width;
-
- GdkFont *font;
-
- /*
- * Ids
- */
- int full_header_structure_change_id, full_header_dimension_change_id;
- int table_header_structure_change_id, table_header_dimension_change_id;
-
- gchar *dnd_code;
-
- /*
- * For dragging columns
- */
- guint maybe_drag:1;
- int click_x, click_y;
- int drag_col;
- guint drag_data_get_id;
- guint drag_end_id;
-} ETableFieldChooserItem;
-
-typedef struct {
- GnomeCanvasItemClass parent_class;
-} ETableFieldChooserItemClass;
-
-GtkType e_table_field_chooser_item_get_type (void);
-
-END_GNOME_DECLS
-
-#endif /* _E_TABLE_FIELD_CHOOSER_ITEM_H_ */
diff --git a/widgets/table/e-table-field-chooser.c b/widgets/table/e-table-field-chooser.c
deleted file mode 100644
index 6f11fad849..0000000000
--- a/widgets/table/e-table-field-chooser.c
+++ /dev/null
@@ -1,275 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-field-chooser.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <libgnomeui/gnome-canvas-rect-ellipse.h>
-#include "e-table-field-chooser.h"
-#include "e-table-field-chooser-item.h"
-
-static void e_table_field_chooser_init (ETableFieldChooser *card);
-static void e_table_field_chooser_class_init (ETableFieldChooserClass *klass);
-static void e_table_field_chooser_set_arg (GtkObject *o, GtkArg *arg, guint arg_id);
-static void e_table_field_chooser_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
-static void e_table_field_chooser_destroy (GtkObject *object);
-
-static GtkVBoxClass *parent_class = NULL;
-
-/* The arguments we take */
-enum {
- ARG_0,
- ARG_FULL_HEADER,
- ARG_HEADER,
- ARG_DND_CODE,
-};
-
-GtkType
-e_table_field_chooser_get_type (void)
-{
- static GtkType table_field_chooser_type = 0;
-
- if (!table_field_chooser_type)
- {
- static const GtkTypeInfo table_field_chooser_info =
- {
- "ETableFieldChooser",
- sizeof (ETableFieldChooser),
- sizeof (ETableFieldChooserClass),
- (GtkClassInitFunc) e_table_field_chooser_class_init,
- (GtkObjectInitFunc) e_table_field_chooser_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- table_field_chooser_type = gtk_type_unique (gtk_vbox_get_type (), &table_field_chooser_info);
- }
-
- return table_field_chooser_type;
-}
-
-static void
-e_table_field_chooser_class_init (ETableFieldChooserClass *klass)
-{
- GtkObjectClass *object_class;
- GtkVBoxClass *vbox_class;
-
- object_class = (GtkObjectClass*) klass;
- vbox_class = (GtkVBoxClass *) klass;
-
- glade_gnome_init();
-
- parent_class = gtk_type_class (gtk_vbox_get_type ());
-
- object_class->set_arg = e_table_field_chooser_set_arg;
- object_class->get_arg = e_table_field_chooser_get_arg;
- object_class->destroy = e_table_field_chooser_destroy;
- gtk_object_add_arg_type ("ETableFieldChooser::dnd_code", GTK_TYPE_STRING,
- GTK_ARG_READWRITE, ARG_DND_CODE);
- gtk_object_add_arg_type ("ETableFieldChooser::full_header", GTK_TYPE_OBJECT,
- GTK_ARG_READWRITE, ARG_FULL_HEADER);
- gtk_object_add_arg_type ("ETableFieldChooser::header", GTK_TYPE_OBJECT,
- GTK_ARG_READWRITE, ARG_HEADER);
-}
-
-static void allocate_callback(GtkWidget *canvas, GtkAllocation *allocation, ETableFieldChooser *etfc)
-{
- double height;
- etfc->last_alloc = *allocation;
- gnome_canvas_item_set( etfc->item,
- "width", (double) allocation->width,
- NULL );
- gtk_object_get(GTK_OBJECT(etfc->item),
- "height", &height,
- NULL);
- height = MAX(height, allocation->height);
- gnome_canvas_set_scroll_region(GNOME_CANVAS( etfc->canvas ), 0, 0, allocation->width - 1, height - 1);
- gnome_canvas_item_set( etfc->rect,
- "x2", (double) allocation->width,
- "y2", (double) height,
- NULL );
-}
-
-static void resize(GnomeCanvas *canvas, ETableFieldChooser *etfc)
-{
- double height;
- gtk_object_get(GTK_OBJECT(etfc->item),
- "height", &height,
- NULL);
-
- height = MAX(height, etfc->last_alloc.height);
-
- gnome_canvas_set_scroll_region (GNOME_CANVAS(etfc->canvas), 0, 0, etfc->last_alloc.width - 1, height - 1);
- gnome_canvas_item_set( etfc->rect,
- "x2", (double) etfc->last_alloc.width,
- "y2", (double) height,
- NULL );
-}
-
-static void
-e_table_field_chooser_init (ETableFieldChooser *etfc)
-{
- GladeXML *gui;
- GtkWidget *widget;
-
- gui = glade_xml_new_with_domain (ETABLE_GLADEDIR "/e-table-field-chooser.glade", NULL, PACKAGE);
- etfc->gui = gui;
-
- widget = glade_xml_get_widget(gui, "vbox-top");
- if (!widget) {
- return;
- }
- gtk_widget_reparent(widget,
- GTK_WIDGET(etfc));
-
- gtk_widget_push_visual (gdk_rgb_get_visual ());
- gtk_widget_push_colormap (gdk_rgb_get_cmap ());
-
- etfc->canvas = GNOME_CANVAS(glade_xml_get_widget(gui, "canvas-buttons"));
-
- etfc->rect = gnome_canvas_item_new(gnome_canvas_root( GNOME_CANVAS( etfc->canvas ) ),
- gnome_canvas_rect_get_type(),
- "x1", (double) 0,
- "y1", (double) 0,
- "x2", (double) 100,
- "y2", (double) 100,
- "fill_color", "white",
- NULL );
-
- etfc->item = gnome_canvas_item_new(gnome_canvas_root(etfc->canvas),
- e_table_field_chooser_item_get_type(),
- "width", (double) 100,
- "full_header", etfc->full_header,
- "header", etfc->header,
- "dnd_code", etfc->dnd_code,
- NULL );
-
- gtk_signal_connect( GTK_OBJECT( etfc->canvas ), "reflow",
- GTK_SIGNAL_FUNC( resize ),
- etfc);
-
- gnome_canvas_set_scroll_region ( GNOME_CANVAS( etfc->canvas ),
- 0, 0,
- 100, 100 );
-
- /* Connect the signals */
- gtk_signal_connect (GTK_OBJECT (etfc->canvas), "size_allocate",
- GTK_SIGNAL_FUNC (allocate_callback),
- etfc);
-
- gtk_widget_pop_visual ();
- gtk_widget_pop_colormap ();
- gtk_widget_show(widget);
-}
-
-static void
-e_table_field_chooser_destroy (GtkObject *object)
-{
- ETableFieldChooser *etfc = E_TABLE_FIELD_CHOOSER(object);
-
- g_free(etfc->dnd_code);
- if (etfc->full_header)
- gtk_object_unref(GTK_OBJECT(etfc->full_header));
- if (etfc->header)
- gtk_object_unref(GTK_OBJECT(etfc->header));
-
- if (etfc->gui)
- gtk_object_unref(GTK_OBJECT(etfc->gui));
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-GtkWidget*
-e_table_field_chooser_new (void)
-{
- GtkWidget *widget = GTK_WIDGET (gtk_type_new (e_table_field_chooser_get_type ()));
- return widget;
-}
-
-static void
-e_table_field_chooser_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- ETableFieldChooser *etfc = E_TABLE_FIELD_CHOOSER(object);
-
- switch (arg_id){
- case ARG_DND_CODE:
- g_free(etfc->dnd_code);
- etfc->dnd_code = g_strdup(GTK_VALUE_STRING (*arg));
- if (etfc->item)
- gtk_object_set(GTK_OBJECT(etfc->item),
- "dnd_code", etfc->dnd_code,
- NULL);
- break;
- case ARG_FULL_HEADER:
- if (etfc->full_header)
- gtk_object_unref(GTK_OBJECT(etfc->full_header));
- if (GTK_VALUE_OBJECT(*arg))
- etfc->full_header = E_TABLE_HEADER(GTK_VALUE_OBJECT(*arg));
- else
- etfc->full_header = NULL;
- if (etfc->full_header)
- gtk_object_ref(GTK_OBJECT(etfc->full_header));
- if (etfc->item)
- gtk_object_set(GTK_OBJECT(etfc->item),
- "full_header", etfc->full_header,
- NULL);
- break;
- case ARG_HEADER:
- if (etfc->header)
- gtk_object_unref(GTK_OBJECT(etfc->header));
- if (GTK_VALUE_OBJECT(*arg))
- etfc->header = E_TABLE_HEADER(GTK_VALUE_OBJECT(*arg));
- else
- etfc->header = NULL;
- if (etfc->header)
- gtk_object_ref(GTK_OBJECT(etfc->header));
- if (etfc->item)
- gtk_object_set(GTK_OBJECT(etfc->item),
- "header", etfc->header,
- NULL);
- break;
- default:
- break;
- }
-}
-
-static void
-e_table_field_chooser_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- ETableFieldChooser *etfc = E_TABLE_FIELD_CHOOSER(object);
-
- switch (arg_id) {
- case ARG_DND_CODE:
- GTK_VALUE_STRING (*arg) = g_strdup (etfc->dnd_code);
- break;
- case ARG_FULL_HEADER:
- GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(etfc->full_header);
- break;
- case ARG_HEADER:
- GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(etfc->header);
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
diff --git a/widgets/table/e-table-field-chooser.glade b/widgets/table/e-table-field-chooser.glade
deleted file mode 100644
index e09d618a7f..0000000000
--- a/widgets/table/e-table-field-chooser.glade
+++ /dev/null
@@ -1,129 +0,0 @@
-<?xml version="1.0"?>
-<GTK-Interface>
-
-<project>
- <name>e-table-field-chooser</name>
- <program_name>e-table-field-chooser</program_name>
- <directory></directory>
- <source_directory>src</source_directory>
- <pixmaps_directory>pixmaps</pixmaps_directory>
- <language>C</language>
- <gnome_support>True</gnome_support>
- <gettext_support>True</gettext_support>
- <use_widget_names>True</use_widget_names>
- <output_main_file>False</output_main_file>
- <output_support_files>False</output_support_files>
- <output_build_files>False</output_build_files>
- <gnome_help_support>True</gnome_help_support>
-</project>
-
-<widget>
- <class>GnomeDialog</class>
- <name>dialog-field-chooser</name>
- <visible>False</visible>
- <title>Field Chooser</title>
- <type>GTK_WINDOW_TOPLEVEL</type>
- <position>GTK_WIN_POS_NONE</position>
- <modal>False</modal>
- <allow_shrink>False</allow_shrink>
- <allow_grow>True</allow_grow>
- <auto_shrink>False</auto_shrink>
- <auto_close>False</auto_close>
- <hide_on_close>False</hide_on_close>
-
- <widget>
- <class>GtkVBox</class>
- <child_name>GnomeDialog:vbox</child_name>
- <name>dialog-vbox1</name>
- <homogeneous>False</homogeneous>
- <spacing>8</spacing>
- <child>
- <padding>4</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkHButtonBox</class>
- <child_name>GnomeDialog:action_area</child_name>
- <name>dialog-action_area1</name>
- <layout_style>GTK_BUTTONBOX_END</layout_style>
- <spacing>8</spacing>
- <child_min_width>85</child_min_width>
- <child_min_height>27</child_min_height>
- <child_ipad_x>7</child_ipad_x>
- <child_ipad_y>0</child_ipad_y>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>True</fill>
- <pack>GTK_PACK_END</pack>
- </child>
-
- <widget>
- <class>GtkButton</class>
- <name>button3</name>
- <can_default>True</can_default>
- <can_focus>True</can_focus>
- <stock_button>GNOME_STOCK_BUTTON_CLOSE</stock_button>
- </widget>
- </widget>
-
- <widget>
- <class>GtkVBox</class>
- <name>vbox-top</name>
- <homogeneous>False</homogeneous>
- <spacing>4</spacing>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>GtkLabel</class>
- <name>label1</name>
- <label>To add a column to your table, drag it into
-the location in which you want it to appear.</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkScrolledWindow</class>
- <name>scrolledwindow1</name>
- <width>200</width>
- <height>200</height>
- <hscrollbar_policy>GTK_POLICY_AUTOMATIC</hscrollbar_policy>
- <vscrollbar_policy>GTK_POLICY_AUTOMATIC</vscrollbar_policy>
- <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
- <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
- <child>
- <padding>0</padding>
- <expand>True</expand>
- <fill>True</fill>
- </child>
-
- <widget>
- <class>Custom</class>
- <name>canvas-buttons</name>
- <creation_function>e_canvas_new</creation_function>
- <int1>0</int1>
- <int2>0</int2>
- <last_modification_time>Thu, 08 Jun 2000 07:27:33 GMT</last_modification_time>
- </widget>
- </widget>
- </widget>
- </widget>
-</widget>
-
-</GTK-Interface>
diff --git a/widgets/table/e-table-field-chooser.h b/widgets/table/e-table-field-chooser.h
deleted file mode 100644
index c5e5ae34e4..0000000000
--- a/widgets/table/e-table-field-chooser.h
+++ /dev/null
@@ -1,84 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-field-chooser.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef __E_TABLE_FIELD_CHOOSER_H__
-#define __E_TABLE_FIELD_CHOOSER_H__
-
-#include <glade/glade.h>
-#include <gal/e-table/e-table-header.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-/* ETableFieldChooser - A dialog displaying information about a contact.
- *
- * The following arguments are available:
- *
- * name type read/write description
- * --------------------------------------------------------------------------------
- */
-
-#define E_TABLE_FIELD_CHOOSER_TYPE (e_table_field_chooser_get_type ())
-#define E_TABLE_FIELD_CHOOSER(obj) (GTK_CHECK_CAST ((obj), E_TABLE_FIELD_CHOOSER_TYPE, ETableFieldChooser))
-#define E_TABLE_FIELD_CHOOSER_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TABLE_FIELD_CHOOSER_TYPE, ETableFieldChooserClass))
-#define E_IS_TABLE_FIELD_CHOOSER(obj) (GTK_CHECK_TYPE ((obj), E_TABLE_FIELD_CHOOSER_TYPE))
-#define E_IS_TABLE_FIELD_CHOOSER_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TABLE_FIELD_CHOOSER_TYPE))
-
-
-typedef struct _ETableFieldChooser ETableFieldChooser;
-typedef struct _ETableFieldChooserClass ETableFieldChooserClass;
-
-struct _ETableFieldChooser
-{
- GtkVBox parent;
-
- /* item specific fields */
- GladeXML *gui;
- GnomeCanvas *canvas;
- GnomeCanvasItem *item;
-
- GnomeCanvasItem *rect;
- GtkAllocation last_alloc;
-
- gchar *dnd_code;
- ETableHeader *full_header;
- ETableHeader *header;
-};
-
-struct _ETableFieldChooserClass
-{
- GtkVBoxClass parent_class;
-};
-
-
-GtkWidget *e_table_field_chooser_new(void);
-GtkType e_table_field_chooser_get_type (void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __E_TABLE_FIELD_CHOOSER_H__ */
diff --git a/widgets/table/e-table-group-container.c b/widgets/table/e-table-group-container.c
deleted file mode 100644
index 6f2ef9ea35..0000000000
--- a/widgets/table/e-table-group-container.c
+++ /dev/null
@@ -1,1449 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-group-container.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <gdk/gdkkeysyms.h>
-#include <gtk/gtksignal.h>
-#include <libgnome/libgnome.h>
-#include <libgnomeui/gnome-canvas-rect-ellipse.h>
-#include "e-table-group-container.h"
-#include "e-table-group-leaf.h"
-#include "e-table-item.h"
-#include "gal/util/e-util.h"
-#include "gal/util/e-unicode-i18n.h"
-#include "gal/widgets/e-canvas.h"
-#include "gal/widgets/e-canvas-utils.h"
-#include "gal/widgets/e-unicode.h"
-#include "gal/e-text/e-text.h"
-#include "e-table-defines.h"
-
-#define TITLE_HEIGHT 16
-
-#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_MINIMUM_WIDTH,
- ARG_FROZEN,
- ARG_TABLE_ALTERNATING_ROW_COLORS,
- ARG_TABLE_HORIZONTAL_DRAW_GRID,
- ARG_TABLE_VERTICAL_DRAW_GRID,
- ARG_TABLE_DRAW_FOCUS,
- ARG_CURSOR_MODE,
- ARG_SELECTION_MODEL,
- ARG_LENGTH_THRESHOLD,
- ARG_UNIFORM_ROW_HEIGHT,
-};
-
-typedef struct {
- ETableGroup *child;
- void *key;
- char *string;
- GnomeCanvasItem *text;
- GnomeCanvasItem *rect;
- gint count;
-} ETableGroupContainerChildNode;
-
-static EPrintable *
-etgc_get_printable (ETableGroup *etg);
-
-
-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);
- g_free(child_node->string);
- 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;
-
- 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->sort_info)
- gtk_object_unref (GTK_OBJECT(etgc->sort_info));
-
- if (etgc->selection_model)
- gtk_object_unref (GTK_OBJECT(etgc->selection_model));
-
- 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);
-}
-
-/**
- * e_table_group_container_construct
- * @parent: The %GnomeCanvasGroup to create a child of.
- * @etgc: The %ETableGroupContainer.
- * @full_header: The full header of the %ETable.
- * @header: The current header of the %ETable.
- * @model: The %ETableModel of the %ETable.
- * @sort_info: The %ETableSortInfo of the %ETable.
- * @n: Which grouping level this is (Starts at 0 and sends n + 1 to any child %ETableGroups.
- *
- * This routine constructs the new %ETableGroupContainer.
- */
-void
-e_table_group_container_construct (GnomeCanvasGroup *parent, ETableGroupContainer *etgc,
- ETableHeader *full_header,
- ETableHeader *header,
- ETableModel *model, ETableSortInfo *sort_info, int n)
-{
- ETableCol *col;
- ETableSortColumn column = e_table_sort_info_grouping_get_nth(sort_info, n);
-
- col = e_table_header_get_column_by_col_idx(full_header, column.column);
- if (col == NULL)
- col = e_table_header_get_column (full_header, e_table_header_count (full_header) - 1);
-
- e_table_group_construct (parent, E_TABLE_GROUP (etgc), full_header, header, model);
- etgc->ecol = col;
- gtk_object_ref (GTK_OBJECT(etgc->ecol));
- etgc->sort_info = sort_info;
- gtk_object_ref (GTK_OBJECT(etgc->sort_info));
- etgc->n = n;
- etgc->ascending = column.ascending;
-
- etgc->font = GTK_WIDGET (GNOME_CANVAS_ITEM (etgc)->canvas)->style->font;
-
- gdk_font_ref (etgc->font);
-
- etgc->open = TRUE;
-}
-
-/**
- * e_table_group_container_new
- * @parent: The %GnomeCanvasGroup to create a child of.
- * @full_header: The full header of the %ETable.
- * @header: The current header of the %ETable.
- * @model: The %ETableModel of the %ETable.
- * @sort_info: The %ETableSortInfo of the %ETable.
- * @n: Which grouping level this is (Starts at 0 and sends n + 1 to any child %ETableGroups.
- *
- * %ETableGroupContainer is an %ETableGroup which groups by the nth
- * grouping of the %ETableSortInfo. It creates %ETableGroups as
- * children.
- *
- * Returns: The new %ETableGroupContainer.
- */
-ETableGroup *
-e_table_group_container_new (GnomeCanvasGroup *parent, ETableHeader *full_header,
- ETableHeader *header,
- ETableModel *model, ETableSortInfo *sort_info, int n)
-{
- ETableGroupContainer *etgc;
-
- g_return_val_if_fail (parent != NULL, NULL);
-
- etgc = gtk_type_new (e_table_group_container_get_type ());
-
- e_table_group_container_construct (parent, etgc, full_header, header,
- model, sort_info, n);
- return E_TABLE_GROUP (etgc);
-}
-
-
-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;
- ETableGroup *child;
-
- child_node = (ETableGroupContainerChildNode *)list->data;
- 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;
- }
- }
- }
- if (direction == E_FOCUS_END)
- list = g_list_last(etgc->children);
- else
- list = etgc->children;
- if (list) {
- ETableGroupContainerChildNode *child_node;
- ETableGroup *child;
-
- child_node = (ETableGroupContainerChildNode *)list->data;
- child = child_node->child;
-
- if (start_col == -1)
- start_col = e_table_header_count (e_table_group_get_header (child)) - 1;
-
- e_table_group_set_focus (child, direction, start_col);
- return 1;
- }
- }
- return_val = FALSE;
- break;
- default:
- return_val = FALSE;
- break;
- }
- 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);
-
- e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (etgc));
-}
-
-/* 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)
-{
- gchar *text;
-
- if (etgc->ecol->text) {
- text = g_strdup_printf ((child_node->count == 1)
- ? U_("%s : %s (%d item)")
- : U_("%s : %s (%d items)"),
- etgc->ecol->text, child_node->string,
- (gint) child_node->count);
- } else {
- text = g_strdup_printf ((child_node->count == 1)
- ? U_("%s (%d item)")
- : U_("%s (%d items)"),
- child_node->string,
- (gint) child_node->count);
- }
- gnome_canvas_item_set (child_node->text,
- "text", text,
- NULL);
- g_free (text);
-}
-
-static void
-child_cursor_change (ETableGroup *etg, int row,
- ETableGroupContainer *etgc)
-{
- e_table_group_cursor_change (E_TABLE_GROUP (etgc), row);
-}
-
-static void
-child_cursor_activated (ETableGroup *etg, int row,
- ETableGroupContainer *etgc)
-{
- e_table_group_cursor_activated (E_TABLE_GROUP (etgc), row);
-}
-
-static void
-child_double_click (ETableGroup *etg, int row, int col, GdkEvent *event,
- ETableGroupContainer *etgc)
-{
- e_table_group_double_click (E_TABLE_GROUP (etgc), row, col, event);
-}
-
-static gint
-child_right_click (ETableGroup *etg, int row, int col, GdkEvent *event,
- ETableGroupContainer *etgc)
-{
- return e_table_group_right_click (E_TABLE_GROUP (etgc), row, col, event);
-}
-
-static gint
-child_click (ETableGroup *etg, int row, int col, GdkEvent *event,
- ETableGroupContainer *etgc)
-{
- return e_table_group_click (E_TABLE_GROUP (etgc), row, col, event);
-}
-
-static gint
-child_key_press (ETableGroup *etg, int row, int col, GdkEvent *event,
- ETableGroupContainer *etgc)
-{
- return e_table_group_key_press (E_TABLE_GROUP (etgc), row, col, event);
-}
-
-static gint
-child_start_drag (ETableGroup *etg, int row, int col, GdkEvent *event,
- ETableGroupContainer *etgc)
-{
- return e_table_group_start_drag (E_TABLE_GROUP (etgc), row, col, event);
-}
-
-static ETableGroupContainerChildNode *
-create_child_node (ETableGroupContainer *etgc, void *val)
-{
- ETableGroup *child;
- ETableGroupContainerChildNode *child_node;
- ETableGroup *etg = E_TABLE_GROUP(etgc);
-
- 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,
- "fill_color", "black",
- "draw_background", FALSE,
- NULL);
- child = e_table_group_new (GNOME_CANVAS_GROUP (etgc), etg->full_header,
- etg->header, etg->model, etgc->sort_info, etgc->n + 1);
- gnome_canvas_item_set(GNOME_CANVAS_ITEM(child),
- "alternating_row_colors", etgc->alternating_row_colors,
- "horizontal_draw_grid", etgc->horizontal_draw_grid,
- "vertical_draw_grid", etgc->vertical_draw_grid,
- "drawfocus", etgc->draw_focus,
- "cursor_mode", etgc->cursor_mode,
- "selection_model", etgc->selection_model,
- "length_threshold", etgc->length_threshold,
- "uniform_row_height", etgc->uniform_row_height,
- "minimum_width", etgc->minimum_width - GROUP_INDENT,
- NULL);
-
- gtk_signal_connect (GTK_OBJECT (child), "cursor_change",
- GTK_SIGNAL_FUNC (child_cursor_change), etgc);
- gtk_signal_connect (GTK_OBJECT (child), "cursor_activated",
- GTK_SIGNAL_FUNC (child_cursor_activated), etgc);
- gtk_signal_connect (GTK_OBJECT (child), "double_click",
- GTK_SIGNAL_FUNC (child_double_click), etgc);
- gtk_signal_connect (GTK_OBJECT (child), "right_click",
- GTK_SIGNAL_FUNC (child_right_click), etgc);
- gtk_signal_connect (GTK_OBJECT (child), "click",
- GTK_SIGNAL_FUNC (child_click), etgc);
- gtk_signal_connect (GTK_OBJECT (child), "key_press",
- GTK_SIGNAL_FUNC (child_key_press), etgc);
- gtk_signal_connect (GTK_OBJECT (child), "start_drag",
- GTK_SIGNAL_FUNC (child_start_drag), etgc);
- child_node->child = child;
- child_node->key = e_table_model_duplicate_value (etg->model, etgc->ecol->col_idx, val);
- child_node->string = e_table_model_value_to_string (etg->model, etgc->ecol->col_idx, val);
- child_node->count = 0;
-
- return child_node;
-}
-
-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 = 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 = create_child_node (etgc, val);
- child = child_node->child;
- 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);
- e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (etgc));
-}
-
-static void
-etgc_add_array (ETableGroup *etg, const int *array, int count)
-{
- int i;
- ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER (etg);
- void *lastval = 0;
- int laststart = 0;
- GCompareFunc comp = etgc->ecol->compare;
- ETableGroupContainerChildNode *child_node;
- ETableGroup *child;
-
- if (count <= 0)
- return;
-
- e_table_group_container_list_free (etgc);
- etgc->children = NULL;
-
- lastval = e_table_model_value_at (etg->model, etgc->ecol->col_idx, array[0]);
-
- for (i = 1; i < count; i++) {
- void *val = e_table_model_value_at (etg->model, etgc->ecol->col_idx, array[i]);
- int comp_val;
-
- comp_val = (*comp)(lastval, val);
- if (comp_val != 0) {
- child_node = create_child_node(etgc, lastval);
- child = child_node->child;
-
- e_table_group_add_array(child, array + laststart, i - laststart);
- child_node->count = i - laststart;
-
- etgc->children = g_list_append (etgc->children, child_node);
- compute_text (etgc, child_node);
- laststart = i;
- lastval = val;
- }
- }
-
- child_node = create_child_node(etgc, lastval);
- child = child_node->child;
-
- e_table_group_add_array(child, array + laststart, i - laststart);
- child_node->count = i - laststart;
-
- etgc->children = g_list_append (etgc->children, child_node);
- compute_text (etgc, child_node);
-
- e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (etgc));
-}
-
-static void
-etgc_add_all (ETableGroup *etg)
-{
- ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER (etg);
- ESorter *sorter = etgc->selection_model->sorter;
- int *array;
- int count;
-
- e_sorter_get_sorted_to_model_array(sorter, &array, &count);
-
- etgc_add_array(etg, array, count);
-}
-
-static gboolean
-etgc_remove (ETableGroup *etg, gint row)
-{
- ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(etg);
- GList *list;
-
- for (list = etgc->children ; list; list = g_list_next (list)) {
- ETableGroupContainerChildNode *child_node = 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);
-
- e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (etgc));
-
- return TRUE;
- }
- }
- return FALSE;
-}
-
-static int
-etgc_row_count (ETableGroup *etg)
-{
- ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(etg);
- GList *list;
- gint count = 0;
- for (list = etgc->children; list; list = g_list_next(list)) {
- ETableGroup *group = ((ETableGroupContainerChildNode *)list->data)->child;
- gint this_count = e_table_group_row_count(group);
- count += this_count;
- }
- return count;
-}
-
-static void
-etgc_increment (ETableGroup *etg, gint position, gint amount)
-{
- ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(etg);
- GList *list = etgc->children;
-
- for (list = etgc->children ; list; list = g_list_next (list))
- e_table_group_increment (((ETableGroupContainerChildNode *)list->data)->child,
- position, amount);
-}
-
-static void
-etgc_decrement (ETableGroup *etg, gint position, gint amount)
-{
- ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(etg);
- GList *list = etgc->children;
-
- for (list = etgc->children ; list; list = g_list_next (list))
- e_table_group_decrement (((ETableGroupContainerChildNode *)list->data)->child,
- position, amount);
-}
-
-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);
- }
-}
-
-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_compute_location (ETableGroup *etg, int *x, int *y, int *row, int *col)
-{
- ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(etg);
-
- if (row)
- *row = -1;
- if (col)
- *col = -1;
-
- *x -= GROUP_INDENT;
- *y -= TITLE_HEIGHT;
-
- if (*x >= 0 && *y >= 0 && etgc->children) {
- GList *list;
- for (list = etgc->children; list; list = list->next) {
- ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *)list->data;
- ETableGroup *child = child_node->child;
-
- e_table_group_compute_location (child, x, y, row, col);
- if ((*row != -1) && (*col != -1))
- return;
- }
- }
-}
-
-static void
-etgc_get_cell_geometry (ETableGroup *etg, int *row, int *col, int *x, int *y, int *width, int *height)
-{
- ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(etg);
-
- int ypos;
-
- ypos = 0;
-
- if (etgc->children) {
- GList *list;
- for (list = etgc->children; list; list = list->next) {
- ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *)list->data;
- ETableGroup *child = child_node->child;
- int thisy;
-
- e_table_group_get_cell_geometry (child, row, col, x, &thisy, width, height);
- ypos += thisy;
- if ((*row == -1) || (*col == -1)) {
- ypos += TITLE_HEIGHT;
- *x += GROUP_INDENT;
- *y = ypos;
- return;
- }
- }
- }
-}
-
-static void etgc_thaw (ETableGroup *etg)
-{
- e_canvas_item_request_reflow (GNOME_CANVAS_ITEM(etg));
-}
-
-static void
-etgc_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- ETableGroup *etg = E_TABLE_GROUP (object);
- ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER (object);
- GList *list;
-
- switch (arg_id) {
- case ARG_FROZEN:
- if (GTK_VALUE_BOOL (*arg))
- etg->frozen = TRUE;
- else {
- etg->frozen = FALSE;
- etgc_thaw (etg);
- }
- break;
- case ARG_MINIMUM_WIDTH:
- case ARG_WIDTH:
- etgc->minimum_width = GTK_VALUE_DOUBLE(*arg);
-
- for (list = etgc->children; list; list = g_list_next (list)) {
- ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *)list->data;
- gtk_object_set (GTK_OBJECT(child_node->child),
- "minimum_width", etgc->minimum_width - GROUP_INDENT,
- NULL);
- }
- break;
- case ARG_LENGTH_THRESHOLD:
- etgc->length_threshold = GTK_VALUE_INT (*arg);
- for (list = etgc->children; list; list = g_list_next (list)) {
- ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *)list->data;
- gtk_object_set (GTK_OBJECT(child_node->child),
- "length_threshold", GTK_VALUE_INT (*arg),
- NULL);
- }
- break;
- case ARG_UNIFORM_ROW_HEIGHT:
- etgc->uniform_row_height = GTK_VALUE_BOOL (*arg);
- for (list = etgc->children; list; list = g_list_next (list)) {
- ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *)list->data;
- gtk_object_set (GTK_OBJECT(child_node->child),
- "uniform_row_height", GTK_VALUE_BOOL (*arg),
- NULL);
- }
- break;
-
- case ARG_SELECTION_MODEL:
- if (etgc->selection_model)
- gtk_object_unref(GTK_OBJECT(etgc->selection_model));
- etgc->selection_model = E_SELECTION_MODEL(GTK_VALUE_OBJECT (*arg));
- if (etgc->selection_model)
- gtk_object_ref(GTK_OBJECT(etgc->selection_model));
- for (list = etgc->children; list; list = g_list_next (list)) {
- ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *)list->data;
- gtk_object_set (GTK_OBJECT(child_node->child),
- "selection_model", etgc->selection_model,
- NULL);
- }
- break;
-
- case ARG_TABLE_ALTERNATING_ROW_COLORS:
- etgc->alternating_row_colors = GTK_VALUE_BOOL (*arg);
- for (list = etgc->children; list; list = g_list_next (list)) {
- ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *)list->data;
- gtk_object_set (GTK_OBJECT(child_node->child),
- "alternating_row_colors", GTK_VALUE_BOOL (*arg),
- NULL);
- }
- break;
-
- case ARG_TABLE_HORIZONTAL_DRAW_GRID:
- etgc->horizontal_draw_grid = GTK_VALUE_BOOL (*arg);
- for (list = etgc->children; list; list = g_list_next (list)) {
- ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *)list->data;
- gtk_object_set (GTK_OBJECT(child_node->child),
- "horizontal_draw_grid", GTK_VALUE_BOOL (*arg),
- NULL);
- }
- break;
-
- case ARG_TABLE_VERTICAL_DRAW_GRID:
- etgc->vertical_draw_grid = GTK_VALUE_BOOL (*arg);
- for (list = etgc->children; list; list = g_list_next (list)) {
- ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *)list->data;
- gtk_object_set (GTK_OBJECT(child_node->child),
- "vertical_draw_grid", GTK_VALUE_BOOL (*arg),
- NULL);
- }
- break;
-
- case ARG_TABLE_DRAW_FOCUS:
- etgc->draw_focus = GTK_VALUE_BOOL (*arg);
- for (list = etgc->children; list; list = g_list_next (list)) {
- ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *)list->data;
- gtk_object_set (GTK_OBJECT(child_node->child),
- "drawfocus", GTK_VALUE_BOOL (*arg),
- NULL);
- }
- break;
-
- case ARG_CURSOR_MODE:
- etgc->cursor_mode = GTK_VALUE_INT (*arg);
- for (list = etgc->children; list; list = g_list_next (list)) {
- ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *)list->data;
- gtk_object_set (GTK_OBJECT(child_node->child),
- "cursor_mode", GTK_VALUE_INT (*arg),
- NULL);
- }
- break;
- default:
- break;
- }
-}
-
-static void
-etgc_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- ETableGroup *etg = E_TABLE_GROUP (object);
- ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER (object);
-
- switch (arg_id) {
- case ARG_FROZEN:
- GTK_VALUE_BOOL (*arg) = etg->frozen;
- break;
- case ARG_HEIGHT:
- GTK_VALUE_DOUBLE (*arg) = etgc->height;
- break;
- case ARG_WIDTH:
- GTK_VALUE_DOUBLE (*arg) = etgc->width;
- break;
- case ARG_MINIMUM_WIDTH:
- GTK_VALUE_DOUBLE(*arg) = etgc->minimum_width;
- break;
- case ARG_UNIFORM_ROW_HEIGHT:
- GTK_VALUE_BOOL(*arg) = etgc->uniform_row_height;
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-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->add_array = etgc_add_array;
- e_group_class->add_all = etgc_add_all;
- e_group_class->remove = etgc_remove;
- e_group_class->increment = etgc_increment;
- e_group_class->decrement = etgc_decrement;
- e_group_class->row_count = etgc_row_count;
- e_group_class->set_focus = etgc_set_focus;
- e_group_class->get_focus_column = etgc_get_focus_column;
- e_group_class->get_printable = etgc_get_printable;
- e_group_class->compute_location = etgc_compute_location;
- e_group_class->get_cell_geometry = etgc_get_cell_geometry;
-
- gtk_object_add_arg_type ("ETableGroupContainer::alternating_row_colors", GTK_TYPE_BOOL,
- GTK_ARG_WRITABLE, ARG_TABLE_ALTERNATING_ROW_COLORS);
- gtk_object_add_arg_type ("ETableGroupContainer::horizontal_draw_grid", GTK_TYPE_BOOL,
- GTK_ARG_WRITABLE, ARG_TABLE_HORIZONTAL_DRAW_GRID);
- gtk_object_add_arg_type ("ETableGroupContainer::vertical_draw_grid", GTK_TYPE_BOOL,
- GTK_ARG_WRITABLE, ARG_TABLE_VERTICAL_DRAW_GRID);
- gtk_object_add_arg_type ("ETableGroupContainer::drawfocus", GTK_TYPE_BOOL,
- GTK_ARG_WRITABLE, ARG_TABLE_DRAW_FOCUS);
- gtk_object_add_arg_type ("ETableGroupContainer::cursor_mode", GTK_TYPE_INT,
- GTK_ARG_WRITABLE, ARG_CURSOR_MODE);
- gtk_object_add_arg_type ("ETableGroupContainer::selection_model", E_SELECTION_MODEL_TYPE,
- GTK_ARG_WRITABLE, ARG_SELECTION_MODEL);
- gtk_object_add_arg_type ("ETableGroupContainer::length_threshold", GTK_TYPE_INT,
- GTK_ARG_WRITABLE, ARG_LENGTH_THRESHOLD);
- gtk_object_add_arg_type ("ETableGroupContainer::uniform_row_height", GTK_TYPE_BOOL,
- GTK_ARG_READWRITE, ARG_UNIFORM_ROW_HEIGHT);
-
- gtk_object_add_arg_type ("ETableGroupContainer::frozen", GTK_TYPE_BOOL,
- GTK_ARG_READWRITE, ARG_FROZEN);
- 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::minimum_width", GTK_TYPE_DOUBLE,
- GTK_ARG_READWRITE, ARG_MINIMUM_WIDTH);
-}
-
-static void
-etgc_reflow (GnomeCanvasItem *item, gint flags)
-{
- ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(item);
- gboolean frozen;
-
- gtk_object_get (GTK_OBJECT(etgc),
- "frozen", &frozen,
- NULL);
-
- if (frozen)
- return;
-
-
- if (GTK_OBJECT_FLAGS(etgc)& GNOME_CANVAS_ITEM_REALIZED){
- gdouble running_height = 0;
- gdouble running_width = 0;
- gdouble old_height;
- gdouble old_width;
-
- old_height = etgc->height;
- old_width = etgc->width;
- if (etgc->children == NULL){
- } else {
- GList *list;
- gdouble extra_height = 0;
- gdouble item_height = 0;
- gdouble item_width = 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;
-
- for ( list = etgc->children; list; list = g_list_next (list)){
- ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *) list->data;
- ETableGroup *child = child_node->child;
-
- gtk_object_get (GTK_OBJECT(child),
- "width", &item_width,
- NULL);
-
- if (item_width > running_width)
- running_width = item_width;
- }
- for ( list = etgc->children; 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) running_width + GROUP_INDENT,
- "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 || running_width != old_width) {
- etgc->height = running_height;
- etgc->width = running_width;
- e_canvas_item_request_parent_reflow (item);
- }
- }
-}
-
-static void
-etgc_init (GtkObject *object)
-{
- ETableGroupContainer *container = E_TABLE_GROUP_CONTAINER(object);
- container->children = FALSE;
-
- e_canvas_item_set_reflow_callback (GNOME_CANVAS_ITEM(object), etgc_reflow);
-
- container->alternating_row_colors = 1;
- container->horizontal_draw_grid = 1;
- container->vertical_draw_grid = 1;
- container->draw_focus = 1;
- container->cursor_mode = E_CURSOR_SIMPLE;
- container->length_threshold = -1;
- container->selection_model = NULL;
- container->uniform_row_height = FALSE;
-}
-
-E_MAKE_TYPE (e_table_group_container, "ETableGroupContainer", ETableGroupContainer, etgc_class_init, etgc_init, PARENT_TYPE);
-
-void
-e_table_group_apply_to_leafs (ETableGroup *etg, ETableGroupLeafFn fn, void *closure)
-{
- if (E_IS_TABLE_GROUP_CONTAINER (etg)){
- ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER (etg);
- GList *list = etgc->children;
-
- /* Protect from unrefs in the callback functions */
- gtk_object_ref (GTK_OBJECT (etg));
-
- for (list = etgc->children; list; list = list->next){
- ETableGroupContainerChildNode *child_node = list->data;
-
- e_table_group_apply_to_leafs (child_node->child, fn, closure);
- }
-
- gtk_object_unref (GTK_OBJECT (etg));
- } else if (E_IS_TABLE_GROUP_LEAF (etg)){
- (*fn) (E_TABLE_GROUP_LEAF (etg)->item, closure);
- } else {
- g_error ("Unknown ETableGroup found: %s",
- gtk_type_name (GTK_OBJECT (etg)->klass->type));
- }
-}
-
-
-typedef struct {
- ETableGroupContainer *etgc;
- GList *child;
- EPrintable *child_printable;
-} ETGCPrintContext;
-
-#if 0
-#define CHECK(x) if((x) == -1) return -1;
-
-static gint
-gp_draw_rect (GnomePrintContext *context, gdouble x, gdouble y, gdouble width, gdouble height, gdouble r, gdouble g, gdouble b)
-{
- CHECK(gnome_print_moveto(context, x, y));
- CHECK(gnome_print_lineto(context, x + width, y));
- CHECK(gnome_print_lineto(context, x + width, y - height));
- CHECK(gnome_print_lineto(context, x, y - height));
- CHECK(gnome_print_lineto(context, x, y));
- return gnome_print_fill(context);
-}
-#endif
-
-#define CHECK(x) if((x) == -1) return -1;
-
-static gint
-gp_draw_rect (GnomePrintContext *context, gdouble x, gdouble y, gdouble width, gdouble height)
-{
- CHECK(gnome_print_moveto(context, x, y));
- CHECK(gnome_print_lineto(context, x + width, y));
- CHECK(gnome_print_lineto(context, x + width, y - height));
- CHECK(gnome_print_lineto(context, x, y - height));
- CHECK(gnome_print_lineto(context, x, y));
- return gnome_print_fill(context);
-}
-
-#define TEXT_HEIGHT (12)
-#define TEXT_AREA_HEIGHT (TEXT_HEIGHT + 4)
-
-static void
-e_table_group_container_print_page (EPrintable *ep,
- GnomePrintContext *context,
- gdouble width,
- gdouble height,
- gboolean quantize,
- ETGCPrintContext *groupcontext)
-{
- gdouble yd = height;
- gdouble child_height;
- ETableGroupContainerChildNode *child_node;
- GList *child;
- EPrintable *child_printable;
- gchar *string;
-
- GnomeFont *font = gnome_font_new ("Helvetica", TEXT_HEIGHT);
-
- child_printable = groupcontext->child_printable;
- child = groupcontext->child;
-
- if (child_printable) {
- if (child)
- child_node = child->data;
- else
- child_node = NULL;
- gtk_object_ref(GTK_OBJECT(child_printable));
- } else {
- if (!child) {
- return;
- } else {
- child_node = child->data;
- child_printable = e_table_group_get_printable(child_node->child);
- if (child_printable)
- gtk_object_ref(GTK_OBJECT(child_printable));
- e_printable_reset(child_printable);
- }
- }
-
- while (1) {
- child_height = e_printable_height(child_printable, context, width - 36, yd - TEXT_AREA_HEIGHT, quantize);
-
- if (gnome_print_gsave(context) == -1)
- /* FIXME */;
- if (gnome_print_moveto(context, 0, yd - child_height - TEXT_AREA_HEIGHT) == -1)
- /* FIXME */;
- if (gnome_print_lineto(context, 36, yd - child_height - TEXT_AREA_HEIGHT) == -1)
- /* FIXME */;
- if (gnome_print_lineto(context, 36, yd - TEXT_AREA_HEIGHT) == -1)
- /* FIXME */;
- if (gnome_print_lineto(context, width, yd - TEXT_AREA_HEIGHT) == -1)
- /* FIXME */;
- if (gnome_print_lineto(context, width, yd) == -1)
- /* FIXME */;
- if (gnome_print_lineto(context, 0, yd) == -1)
- /* FIXME */;
- if (gnome_print_lineto(context, 0, yd - child_height - TEXT_AREA_HEIGHT) == -1)
- /* FIXME */;
- if (gnome_print_setrgbcolor(context, .7, .7, .7) == -1)
- /* FIXME */;
- if (gnome_print_fill(context) == -1)
- /* FIXME */;
- if (gnome_print_grestore(context) == -1)
- /* FIXME */;
-
- if (gnome_print_gsave(context) == -1)
- /* FIXME */;
- if (gnome_print_moveto(context, 0, yd - TEXT_AREA_HEIGHT) == -1)
- /* FIXME */;
- if (gnome_print_lineto(context, width, yd - TEXT_AREA_HEIGHT) == -1)
- /* FIXME */;
- if (gnome_print_lineto(context, width, yd) == -1)
- /* FIXME */;
- if (gnome_print_lineto(context, 0, yd) == -1)
- /* FIXME */;
- if (gnome_print_lineto(context, 0, yd - TEXT_AREA_HEIGHT) == -1)
- /* FIXME */;
- if (gnome_print_clip(context) == -1)
- /* FIXME */;
-
- if (gnome_print_moveto(context, 2, yd - (TEXT_AREA_HEIGHT + gnome_font_get_ascender(font) - gnome_font_get_descender(font)) / 2) == -1)
- /* FIXME */;
- if (gnome_print_setfont(context, font))
- /* FIXME */;
- if (groupcontext->etgc->ecol->text)
- string = g_strdup_printf ("%s : %s (%d item%s)",
- groupcontext->etgc->ecol->text,
- child_node->string,
- (gint) child_node->count,
- child_node->count == 1 ? "" : "s");
- else
- string = g_strdup_printf ("%s (%d item%s)",
- child_node->string,
- (gint) child_node->count,
- child_node->count == 1 ? "" : "s");
- if (gnome_print_show(context, string))
- /* FIXME */;
- g_free(string);
- if (gnome_print_grestore(context) == -1)
- /* FIXME */;
-
- if (gnome_print_gsave(context) == -1)
- /* FIXME */;
- if (gnome_print_translate(context, 36, yd - TEXT_AREA_HEIGHT - child_height) == -1)
- /* FIXME */;
- if (gnome_print_moveto(context, 0, 0) == -1)
- /* FIXME */;
- if (gnome_print_lineto(context, width - 36, 0) == -1)
- /* FIXME */;
- if (gnome_print_lineto(context, width - 36, child_height) == -1)
- /* FIXME */;
- if (gnome_print_lineto(context, 0, child_height) == -1)
- /* FIXME */;
- if (gnome_print_lineto(context, 0, 0) == -1)
- /* FIXME */;
- if (gnome_print_clip(context) == -1)
- /* FIXME */;
- e_printable_print_page(child_printable, context, width - 36, child_height, quantize);
- if (gnome_print_grestore(context) == -1)
- /* FIXME */;
-
- gp_draw_rect(context, 0, yd - child_height - TEXT_AREA_HEIGHT + 1, width, 1);
- gp_draw_rect(context, width - 1, yd, 1, yd - child_height - TEXT_AREA_HEIGHT);
- gp_draw_rect(context, 0, yd, 1, yd - child_height - TEXT_AREA_HEIGHT);
-
- yd -= child_height + TEXT_AREA_HEIGHT;
-
- if (e_printable_data_left(child_printable))
- break;
-
- child = child->next;
- if (!child) {
- child_printable = NULL;
- break;
- }
-
- child_node = child->data;
- if (child_printable)
- gtk_object_unref(GTK_OBJECT(child_printable));
- child_printable = e_table_group_get_printable(child_node->child);
- if (child_printable)
- gtk_object_ref(GTK_OBJECT(child_printable));
- e_printable_reset(child_printable);
- }
-
- gp_draw_rect(context, 0, height, width, 1);
-
- if (groupcontext->child_printable)
- gtk_object_unref(GTK_OBJECT(groupcontext->child_printable));
- groupcontext->child_printable = child_printable;
- groupcontext->child = child;
-
-}
-
-static gboolean
-e_table_group_container_data_left (EPrintable *ep,
- ETGCPrintContext *groupcontext)
-{
- gtk_signal_emit_stop_by_name(GTK_OBJECT(ep), "data_left");
- return groupcontext->child != NULL;
-}
-
-static void
-e_table_group_container_reset (EPrintable *ep,
- ETGCPrintContext *groupcontext)
-{
- groupcontext->child = groupcontext->etgc->children;
- if (groupcontext->child_printable)
- gtk_object_unref(GTK_OBJECT(groupcontext->child_printable));
- groupcontext->child_printable = NULL;
-}
-
-static gdouble
-e_table_group_container_height (EPrintable *ep,
- GnomePrintContext *context,
- gdouble width,
- gdouble max_height,
- gboolean quantize,
- ETGCPrintContext *groupcontext)
-{
- gdouble height = 0;
- gdouble child_height;
- gdouble yd = max_height;
- ETableGroupContainerChildNode *child_node;
- GList *child;
- EPrintable *child_printable;
-
- child_printable = groupcontext->child_printable;
- child = groupcontext->child;
-
- if (child_printable)
- gtk_object_ref(GTK_OBJECT(child_printable));
- else {
- if (!child) {
- gtk_signal_emit_stop_by_name(GTK_OBJECT(ep), "height");
- return 0;
- } else {
- child_node = child->data;
- child_printable = e_table_group_get_printable(child_node->child);
- if (child_printable)
- gtk_object_ref(GTK_OBJECT(child_printable));
- e_printable_reset(child_printable);
- }
- }
-
- if (yd != -1 && yd < TEXT_AREA_HEIGHT)
- return 0;
-
- while (1) {
- child_height = e_printable_height(child_printable, context, width - 36, yd - (yd == -1 ? 0 : TEXT_AREA_HEIGHT), quantize);
-
- height += child_height + TEXT_AREA_HEIGHT;
-
- if (yd != -1) {
- if (!e_printable_will_fit(child_printable, context, width - 36, yd - (yd == -1 ? 0 : TEXT_AREA_HEIGHT), quantize)) {
- break;
- }
-
- yd -= child_height + TEXT_AREA_HEIGHT;
- }
-
- child = child->next;
- if (!child) {
- break;
- }
-
- child_node = child->data;
- if (child_printable)
- gtk_object_unref(GTK_OBJECT(child_printable));
- child_printable = e_table_group_get_printable(child_node->child);
- if (child_printable)
- gtk_object_ref(GTK_OBJECT(child_printable));
- e_printable_reset(child_printable);
- }
- if (child_printable)
- gtk_object_unref(GTK_OBJECT(child_printable));
- gtk_signal_emit_stop_by_name(GTK_OBJECT(ep), "height");
- return height;
-}
-
-static gboolean
-e_table_group_container_will_fit (EPrintable *ep,
- GnomePrintContext *context,
- gdouble width,
- gdouble max_height,
- gboolean quantize,
- ETGCPrintContext *groupcontext)
-{
- gboolean will_fit = TRUE;
- gdouble child_height;
- gdouble yd = max_height;
- ETableGroupContainerChildNode *child_node;
- GList *child;
- EPrintable *child_printable;
-
- child_printable = groupcontext->child_printable;
- child = groupcontext->child;
-
- if (child_printable)
- gtk_object_ref(GTK_OBJECT(child_printable));
- else {
- if (!child) {
- gtk_signal_emit_stop_by_name(GTK_OBJECT(ep), "will_fit");
- return will_fit;
- } else {
- child_node = child->data;
- child_printable = e_table_group_get_printable(child_node->child);
- if (child_printable)
- gtk_object_ref(GTK_OBJECT(child_printable));
- e_printable_reset(child_printable);
- }
- }
-
- if (yd != -1 && yd < TEXT_AREA_HEIGHT)
- will_fit = FALSE;
- else {
- while (1) {
- child_height = e_printable_height(child_printable, context, width - 36, yd - (yd == -1 ? 0 : TEXT_AREA_HEIGHT), quantize);
-
- if (yd != -1) {
- if (!e_printable_will_fit(child_printable, context, width - 36, yd - (yd == -1 ? 0 : TEXT_AREA_HEIGHT), quantize)) {
- will_fit = FALSE;
- break;
- }
-
- yd -= child_height + TEXT_AREA_HEIGHT;
- }
-
- child = child->next;
- if (!child) {
- break;
- }
-
- child_node = child->data;
- if (child_printable)
- gtk_object_unref(GTK_OBJECT(child_printable));
- child_printable = e_table_group_get_printable(child_node->child);
- if (child_printable)
- gtk_object_ref(GTK_OBJECT(child_printable));
- e_printable_reset(child_printable);
- }
- }
-
- if (child_printable)
- gtk_object_unref(GTK_OBJECT(child_printable));
-
- gtk_signal_emit_stop_by_name(GTK_OBJECT(ep), "will_fit");
- return will_fit;
-}
-
-static void
-e_table_group_container_printable_destroy (GtkObject *object,
- ETGCPrintContext *groupcontext)
-{
- gtk_object_unref(GTK_OBJECT(groupcontext->etgc));
- if (groupcontext->child_printable)
- gtk_object_ref(GTK_OBJECT(groupcontext->child_printable));
- g_free(groupcontext);
-}
-
-static EPrintable *
-etgc_get_printable (ETableGroup *etg)
-{
- ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(etg);
- EPrintable *printable = e_printable_new();
- ETGCPrintContext *groupcontext;
-
- groupcontext = g_new(ETGCPrintContext, 1);
- groupcontext->etgc = etgc;
- gtk_object_ref(GTK_OBJECT(etgc));
- groupcontext->child = etgc->children;
- groupcontext->child_printable = NULL;
-
- gtk_signal_connect (GTK_OBJECT(printable),
- "print_page",
- GTK_SIGNAL_FUNC(e_table_group_container_print_page),
- groupcontext);
- gtk_signal_connect (GTK_OBJECT(printable),
- "data_left",
- GTK_SIGNAL_FUNC(e_table_group_container_data_left),
- groupcontext);
- gtk_signal_connect (GTK_OBJECT(printable),
- "reset",
- GTK_SIGNAL_FUNC(e_table_group_container_reset),
- groupcontext);
- gtk_signal_connect (GTK_OBJECT(printable),
- "height",
- GTK_SIGNAL_FUNC(e_table_group_container_height),
- groupcontext);
- gtk_signal_connect (GTK_OBJECT(printable),
- "will_fit",
- GTK_SIGNAL_FUNC(e_table_group_container_will_fit),
- groupcontext);
- gtk_signal_connect (GTK_OBJECT(printable),
- "destroy",
- GTK_SIGNAL_FUNC(e_table_group_container_printable_destroy),
- groupcontext);
-
- return printable;
-}
diff --git a/widgets/table/e-table-group-container.h b/widgets/table/e-table-group-container.h
deleted file mode 100644
index 7bb9a706da..0000000000
--- a/widgets/table/e-table-group-container.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-group-container.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_TABLE_GROUP_CONTAINER_H_
-#define _E_TABLE_GROUP_CONTAINER_H_
-
-#include <libgnomeui/gnome-canvas.h>
-#include <gal/e-table/e-table-model.h>
-#include <gal/e-table/e-table-header.h>
-#include <gal/e-table/e-table-group.h>
-#include <gal/e-table/e-table-item.h>
-#include <libgnome/gnome-defs.h>
-
-BEGIN_GNOME_DECLS
-
-#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, minimum_width;
-
- ETableSortInfo *sort_info;
- int n;
- int length_threshold;
-
- ESelectionModel *selection_model;
-
- guint alternating_row_colors : 1;
- guint horizontal_draw_grid : 1;
- guint vertical_draw_grid : 1;
- guint draw_focus : 1;
- guint uniform_row_height : 1;
- ECursorMode cursor_mode;
-
- /*
- * 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, ETableSortInfo *sort_info, int n);
-void e_table_group_container_construct (GnomeCanvasGroup *parent, ETableGroupContainer *etgc,
- ETableHeader *full_header,
- ETableHeader *header,
- ETableModel *model, ETableSortInfo *sort_info, int n);
-
-GtkType e_table_group_container_get_type (void);
-
-END_GNOME_DECLS
-
-#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 48e0d28650..0000000000
--- a/widgets/table/e-table-group-leaf.c
+++ /dev/null
@@ -1,633 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-group-leaf.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <gtk/gtksignal.h>
-#include <libgnomeui/gnome-canvas-rect-ellipse.h>
-#include "e-table-group-leaf.h"
-#include "e-table-item.h"
-#include "e-table-sorted-variable.h"
-#include "e-table-sorted.h"
-#include "gal/util/e-util.h"
-#include "gal/widgets/e-canvas.h"
-
-#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_MINIMUM_WIDTH,
- ARG_FROZEN,
- ARG_TABLE_ALTERNATING_ROW_COLORS,
- ARG_TABLE_HORIZONTAL_DRAW_GRID,
- ARG_TABLE_VERTICAL_DRAW_GRID,
- ARG_TABLE_DRAW_FOCUS,
- ARG_CURSOR_MODE,
- ARG_LENGTH_THRESHOLD,
- ARG_SELECTION_MODEL,
- ARG_UNIFORM_ROW_HEIGHT,
-};
-
-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);
-
- if (etgl->ets) {
- gtk_object_unref (GTK_OBJECT(etgl->ets));
- etgl->ets = NULL;
- }
-
- if (etgl->item) {
- if (etgl->etgl_cursor_change_id != 0)
- gtk_signal_disconnect (GTK_OBJECT (etgl->item),
- etgl->etgl_cursor_change_id);
- if (etgl->etgl_cursor_activated_id != 0)
- gtk_signal_disconnect (GTK_OBJECT (etgl->item),
- etgl->etgl_cursor_activated_id);
- if (etgl->etgl_double_click_id != 0)
- gtk_signal_disconnect (GTK_OBJECT (etgl->item),
- etgl->etgl_double_click_id);
- if (etgl->etgl_right_click_id != 0)
- gtk_signal_disconnect (GTK_OBJECT (etgl->item),
- etgl->etgl_right_click_id);
- if (etgl->etgl_click_id != 0)
- gtk_signal_disconnect (GTK_OBJECT (etgl->item),
- etgl->etgl_click_id);
- if (etgl->etgl_key_press_id != 0)
- gtk_signal_disconnect (GTK_OBJECT (etgl->item),
- etgl->etgl_key_press_id);
- if (etgl->etgl_start_drag_id != 0)
- gtk_signal_disconnect (GTK_OBJECT (etgl->item),
- etgl->etgl_start_drag_id);
-
- etgl->etgl_cursor_change_id = 0;
- etgl->etgl_cursor_activated_id = 0;
- etgl->etgl_double_click_id = 0;
- etgl->etgl_right_click_id = 0;
- etgl->etgl_click_id = 0;
- etgl->etgl_key_press_id = 0;
- etgl->etgl_start_drag_id = 0;
-
- gtk_object_destroy (GTK_OBJECT(etgl->item));
- etgl->item = NULL;
- }
-
- if (etgl->selection_model) {
- gtk_object_unref (GTK_OBJECT(etgl->selection_model));
- etgl->selection_model = NULL;
- }
-
- 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,
- ETableSortInfo *sort_info)
-{
- etgl->is_grouped = e_table_sort_info_grouping_get_count(sort_info) > 0 ? TRUE : FALSE;
-
- if (etgl->is_grouped)
- etgl->ets = E_TABLE_SUBSET(e_table_sorted_variable_new (model,
- full_header,
- sort_info));
- else
- etgl->ets = E_TABLE_SUBSET(e_table_sorted_new (model,
- full_header,
- sort_info));
-
- e_table_group_construct (parent, E_TABLE_GROUP (etgl), full_header, header, model);
-}
-
-/**
- * e_table_group_leaf_new
- * @parent: The %GnomeCanvasGroup to create a child of.
- * @full_header: The full header of the %ETable.
- * @header: The current header of the %ETable.
- * @model: The %ETableModel of the %ETable.
- * @sort_info: The %ETableSortInfo of the %ETable.
- *
- * %ETableGroupLeaf is an %ETableGroup which simply contains an
- * %ETableItem.
- *
- * Returns: The new %ETableGroupLeaf.
- */
-ETableGroup *
-e_table_group_leaf_new (GnomeCanvasGroup *parent,
- ETableHeader *full_header,
- ETableHeader *header,
- ETableModel *model,
- ETableSortInfo *sort_info)
-{
- 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, sort_info);
- return E_TABLE_GROUP (etgl);
-}
-
-static void
-etgl_cursor_change (GtkObject *object, gint row, ETableGroupLeaf *etgl)
-{
- if (row < E_TABLE_SUBSET(etgl->ets)->n_map)
- e_table_group_cursor_change (E_TABLE_GROUP(etgl),
- E_TABLE_SUBSET(etgl->ets)->map_table[row]);
-}
-
-static void
-etgl_cursor_activated (GtkObject *object, gint view_row, ETableGroupLeaf *etgl)
-{
- if (view_row < E_TABLE_SUBSET(etgl->ets)->n_map)
- e_table_group_cursor_activated (E_TABLE_GROUP(etgl),
- E_TABLE_SUBSET(etgl->ets)->map_table[view_row]);
-}
-
-static void
-etgl_double_click (GtkObject *object, gint model_row, gint model_col, GdkEvent *event,
- ETableGroupLeaf *etgl)
-{
- e_table_group_double_click (E_TABLE_GROUP(etgl), model_row, model_col, event);
-}
-
-static gint
-etgl_key_press (GtkObject *object, gint row, gint col, GdkEvent *event, ETableGroupLeaf *etgl)
-{
- if (row < E_TABLE_SUBSET(etgl->ets)->n_map && row >= 0)
- return e_table_group_key_press (E_TABLE_GROUP(etgl),
- E_TABLE_SUBSET(etgl->ets)->map_table[row],
- col,
- event);
- else
- return 0;
-}
-
-static gint
-etgl_start_drag (GtkObject *object, gint model_row, gint model_col, GdkEvent *event,
- ETableGroupLeaf *etgl)
-{
- return e_table_group_start_drag (E_TABLE_GROUP(etgl), model_row, model_col, event);
-}
-
-static gint
-etgl_right_click (GtkObject *object, gint view_row, gint model_col, GdkEvent *event,
- ETableGroupLeaf *etgl)
-{
- if (view_row < E_TABLE_SUBSET(etgl->ets)->n_map)
- return e_table_group_right_click (E_TABLE_GROUP(etgl),
- E_TABLE_SUBSET(etgl->ets)->map_table[view_row],
- model_col,
- event);
- else
- return 0;
-}
-
-static gint
-etgl_click (GtkObject *object, gint row, gint col, GdkEvent *event, ETableGroupLeaf *etgl)
-{
- if (row < E_TABLE_SUBSET(etgl->ets)->n_map)
- return e_table_group_click (E_TABLE_GROUP(etgl),
- E_TABLE_SUBSET(etgl->ets)->map_table[row],
- col,
- event);
- else
- return 0;
-}
-
-static void
-etgl_reflow (GnomeCanvasItem *item, gint flags)
-{
- ETableGroupLeaf *leaf = E_TABLE_GROUP_LEAF(item);
-
- gtk_object_get(GTK_OBJECT(leaf->item),
- "height", &leaf->height,
- NULL);
- gtk_object_get(GTK_OBJECT(leaf->item),
- "width", &leaf->width,
- NULL);
-
- e_canvas_item_request_parent_reflow (item);
-}
-
-static void
-etgl_realize (GnomeCanvasItem *item)
-{
- ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF(item);
-
- 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->ets,
- "alternating_row_colors", etgl->alternating_row_colors,
- "horizontal_draw_grid", etgl->horizontal_draw_grid,
- "vertical_draw_grid", etgl->vertical_draw_grid,
- "drawfocus", etgl->draw_focus,
- "cursor_mode", etgl->cursor_mode,
- "minimum_width", etgl->minimum_width,
- "length_threshold", etgl->length_threshold,
- "selection_model", etgl->selection_model,
- "uniform_row_height", etgl->uniform_row_height,
- NULL));
-
- etgl->etgl_cursor_change_id = gtk_signal_connect (GTK_OBJECT(etgl->item),
- "cursor_change",
- GTK_SIGNAL_FUNC(etgl_cursor_change),
- etgl);
- etgl->etgl_cursor_activated_id = gtk_signal_connect (GTK_OBJECT(etgl->item),
- "cursor_activated",
- GTK_SIGNAL_FUNC(etgl_cursor_activated),
- etgl);
- etgl->etgl_double_click_id = gtk_signal_connect (GTK_OBJECT(etgl->item),
- "double_click",
- GTK_SIGNAL_FUNC(etgl_double_click),
- etgl);
-
- etgl->etgl_right_click_id = gtk_signal_connect (GTK_OBJECT(etgl->item),
- "right_click",
- GTK_SIGNAL_FUNC(etgl_right_click),
- etgl);
- etgl->etgl_click_id = gtk_signal_connect (GTK_OBJECT(etgl->item),
- "click",
- GTK_SIGNAL_FUNC(etgl_click),
- etgl);
- etgl->etgl_key_press_id = gtk_signal_connect (GTK_OBJECT(etgl->item),
- "key_press",
- GTK_SIGNAL_FUNC(etgl_key_press),
- etgl);
- etgl->etgl_start_drag_id = gtk_signal_connect (GTK_OBJECT(etgl->item),
- "start_drag",
- GTK_SIGNAL_FUNC(etgl_start_drag),
- etgl);
-
- e_canvas_item_request_reflow(item);
-}
-
-static void
-etgl_add (ETableGroup *etg, gint row)
-{
- ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg);
-
- if (E_IS_TABLE_SUBSET_VARIABLE(etgl->ets)) {
- e_table_subset_variable_add (E_TABLE_SUBSET_VARIABLE(etgl->ets), row);
- }
-}
-
-static void
-etgl_add_array (ETableGroup *etg, const gint *array, gint count)
-{
- ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg);
-
- if (E_IS_TABLE_SUBSET_VARIABLE(etgl->ets)) {
- e_table_subset_variable_add_array (E_TABLE_SUBSET_VARIABLE(etgl->ets), array, count);
- }
-}
-
-static void
-etgl_add_all (ETableGroup *etg)
-{
- ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg);
-
- if (E_IS_TABLE_SUBSET_VARIABLE(etgl->ets)) {
- e_table_subset_variable_add_all (E_TABLE_SUBSET_VARIABLE(etgl->ets));
- }
-}
-
-static gboolean
-etgl_remove (ETableGroup *etg, gint row)
-{
- ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg);
-
- if (E_IS_TABLE_SUBSET_VARIABLE(etgl->ets)) {
- return e_table_subset_variable_remove (E_TABLE_SUBSET_VARIABLE(etgl->ets), row);
- }
- return FALSE;
-}
-
-static void
-etgl_increment (ETableGroup *etg, gint position, gint amount)
-{
- ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg);
-
- if (E_IS_TABLE_SUBSET_VARIABLE(etgl->ets)) {
- e_table_subset_variable_increment (E_TABLE_SUBSET_VARIABLE(etgl->ets), position, amount);
- }
-}
-
-static void
-etgl_decrement (ETableGroup *etg, gint position, gint amount)
-{
- ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg);
-
- if (E_IS_TABLE_SUBSET_VARIABLE(etgl->ets)) {
- e_table_subset_variable_decrement (E_TABLE_SUBSET_VARIABLE(etgl->ets), position, amount);
- }
-}
-
-static int
-etgl_row_count (ETableGroup *etg)
-{
- ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg);
-
- return e_table_model_row_count(E_TABLE_MODEL(etgl->ets));
-}
-
-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_set_cursor (etgl->item, view_col, e_table_model_row_count(E_TABLE_MODEL(etgl->ets)) - 1);
- } else {
- e_table_item_set_cursor (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 EPrintable *
-etgl_get_printable (ETableGroup *etg)
-{
- ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg);
-
- return e_table_item_get_printable (etgl->item);
-}
-
-static void
-etgl_compute_location (ETableGroup *etg, int *x, int *y, int *row, int *col)
-{
- ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg);
-
- e_table_item_compute_location (etgl->item, x, y, row, col);
-}
-
-static void
-etgl_get_cell_geometry (ETableGroup *etg, int *row, int *col, int *x, int *y, int *width, int *height)
-{
- ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (etg);
-
- e_table_item_get_cell_geometry (etgl->item, row, col, x, y, width, height);
-}
-
-static void
-etgl_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- ETableGroup *etg = E_TABLE_GROUP (object);
- ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (object);
-
- switch (arg_id) {
- case ARG_FROZEN:
- if (GTK_VALUE_BOOL (*arg))
- etg->frozen = TRUE;
- else {
- etg->frozen = FALSE;
- }
- break;
- case ARG_MINIMUM_WIDTH:
- case ARG_WIDTH:
- etgl->minimum_width = GTK_VALUE_DOUBLE(*arg);
- if (etgl->item) {
- gnome_canvas_item_set (GNOME_CANVAS_ITEM(etgl->item),
- "minimum_width", etgl->minimum_width,
- NULL);
- }
- break;
- case ARG_LENGTH_THRESHOLD:
- etgl->length_threshold = GTK_VALUE_INT (*arg);
- if (etgl->item) {
- gnome_canvas_item_set (GNOME_CANVAS_ITEM(etgl->item),
- "length_threshold", GTK_VALUE_INT (*arg),
- NULL);
- }
- break;
- case ARG_SELECTION_MODEL:
- if (etgl->selection_model)
- gtk_object_unref(GTK_OBJECT(etgl->selection_model));
- etgl->selection_model = E_SELECTION_MODEL(GTK_VALUE_OBJECT (*arg));
- if (etgl->selection_model)
- gtk_object_ref(GTK_OBJECT(etgl->selection_model));
- if (etgl->item) {
- gnome_canvas_item_set (GNOME_CANVAS_ITEM(etgl->item),
- "selection_model", etgl->selection_model,
- NULL);
- }
- break;
-
- case ARG_UNIFORM_ROW_HEIGHT:
- etgl->uniform_row_height = GTK_VALUE_BOOL (*arg);
- if (etgl->item) {
- gnome_canvas_item_set (GNOME_CANVAS_ITEM(etgl->item),
- "uniform_row_height", etgl->uniform_row_height,
- NULL);
- }
- break;
-
- case ARG_TABLE_ALTERNATING_ROW_COLORS:
- etgl->alternating_row_colors = GTK_VALUE_BOOL (*arg);
- if (etgl->item) {
- gnome_canvas_item_set (GNOME_CANVAS_ITEM(etgl->item),
- "alternating_row_colors", GTK_VALUE_BOOL (*arg),
- NULL);
- }
- break;
-
- case ARG_TABLE_HORIZONTAL_DRAW_GRID:
- etgl->horizontal_draw_grid = GTK_VALUE_BOOL (*arg);
- if (etgl->item) {
- gnome_canvas_item_set (GNOME_CANVAS_ITEM(etgl->item),
- "horizontal_draw_grid", GTK_VALUE_BOOL (*arg),
- NULL);
- }
- break;
-
- case ARG_TABLE_VERTICAL_DRAW_GRID:
- etgl->vertical_draw_grid = GTK_VALUE_BOOL (*arg);
- if (etgl->item) {
- gnome_canvas_item_set (GNOME_CANVAS_ITEM(etgl->item),
- "vertical_draw_grid", GTK_VALUE_BOOL (*arg),
- NULL);
- }
- break;
-
- case ARG_TABLE_DRAW_FOCUS:
- etgl->draw_focus = GTK_VALUE_BOOL (*arg);
- if (etgl->item) {
- gnome_canvas_item_set (GNOME_CANVAS_ITEM(etgl->item),
- "drawfocus", GTK_VALUE_BOOL (*arg),
- NULL);
- }
- break;
-
- case ARG_CURSOR_MODE:
- etgl->cursor_mode = GTK_VALUE_INT (*arg);
- if (etgl->item) {
- gnome_canvas_item_set (GNOME_CANVAS_ITEM(etgl->item),
- "cursor_mode", GTK_VALUE_INT (*arg),
- NULL);
- }
- break;
- default:
- break;
- }
-}
-
-static void
-etgl_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- ETableGroup *etg = E_TABLE_GROUP (object);
- ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (object);
-
- switch (arg_id) {
- case ARG_FROZEN:
- GTK_VALUE_BOOL (*arg) = etg->frozen;
- break;
- case ARG_HEIGHT:
- GTK_VALUE_DOUBLE (*arg) = etgl->height;
- break;
- case ARG_WIDTH:
- GTK_VALUE_DOUBLE (*arg) = etgl->width;
- break;
- case ARG_MINIMUM_WIDTH:
- GTK_VALUE_DOUBLE (*arg) = etgl->minimum_width;
- break;
- case ARG_UNIFORM_ROW_HEIGHT:
- GTK_VALUE_BOOL (*arg) = etgl->uniform_row_height;
- 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;
-
- etgl_parent_class = gtk_type_class (PARENT_TYPE);
-
- e_group_class->add = etgl_add;
- e_group_class->add_array = etgl_add_array;
- e_group_class->add_all = etgl_add_all;
- e_group_class->remove = etgl_remove;
- e_group_class->increment = etgl_increment;
- e_group_class->decrement = etgl_decrement;
- e_group_class->row_count = etgl_row_count;
- e_group_class->set_focus = etgl_set_focus;
- e_group_class->get_focus_column = etgl_get_focus_column;
- e_group_class->get_printable = etgl_get_printable;
- e_group_class->compute_location = etgl_compute_location;
- e_group_class->get_cell_geometry = etgl_get_cell_geometry;
-
- gtk_object_add_arg_type ("ETableGroupLeaf::alternating_row_colors", GTK_TYPE_BOOL,
- GTK_ARG_WRITABLE, ARG_TABLE_ALTERNATING_ROW_COLORS);
- gtk_object_add_arg_type ("ETableGroupLeaf::horizontal_draw_grid", GTK_TYPE_BOOL,
- GTK_ARG_WRITABLE, ARG_TABLE_HORIZONTAL_DRAW_GRID);
- gtk_object_add_arg_type ("ETableGroupLeaf::vertical_draw_grid", GTK_TYPE_BOOL,
- GTK_ARG_WRITABLE, ARG_TABLE_VERTICAL_DRAW_GRID);
- gtk_object_add_arg_type ("ETableGroupLeaf::drawfocus", GTK_TYPE_BOOL,
- GTK_ARG_WRITABLE, ARG_TABLE_DRAW_FOCUS);
- gtk_object_add_arg_type ("ETableGroupLeaf::cursor_mode", GTK_TYPE_INT,
- GTK_ARG_WRITABLE, ARG_CURSOR_MODE);
- gtk_object_add_arg_type ("ETableGroupLeaf::length_threshold", GTK_TYPE_INT,
- GTK_ARG_WRITABLE, ARG_LENGTH_THRESHOLD);
- gtk_object_add_arg_type ("ETableGroupLeaf::selection_model", E_SELECTION_MODEL_TYPE,
- GTK_ARG_WRITABLE, ARG_SELECTION_MODEL);
-
- 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::minimum_width", GTK_TYPE_DOUBLE,
- GTK_ARG_READWRITE, ARG_MINIMUM_WIDTH);
- gtk_object_add_arg_type ("ETableGroupLeaf::frozen", GTK_TYPE_BOOL,
- GTK_ARG_READWRITE, ARG_FROZEN);
- gtk_object_add_arg_type ("ETableGroupLeaf::uniform_row_height", GTK_TYPE_BOOL,
- GTK_ARG_READWRITE, ARG_UNIFORM_ROW_HEIGHT);
-}
-
-static void
-etgl_init (GtkObject *object)
-{
- ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (object);
-
- etgl->width = 1;
- etgl->height = 1;
- etgl->minimum_width = 0;
-
- etgl->ets = NULL;
- etgl->item = NULL;
-
- etgl->etgl_cursor_change_id = 0;
- etgl->etgl_cursor_activated_id = 0;
- etgl->etgl_double_click_id = 0;
- etgl->etgl_right_click_id = 0;
- etgl->etgl_click_id = 0;
- etgl->etgl_key_press_id = 0;
- etgl->etgl_start_drag_id = 0;
-
- etgl->alternating_row_colors = 1;
- etgl->horizontal_draw_grid = 1;
- etgl->vertical_draw_grid = 1;
- etgl->draw_focus = 1;
- etgl->cursor_mode = E_CURSOR_SIMPLE;
- etgl->length_threshold = -1;
-
- etgl->selection_model = NULL;
- etgl->uniform_row_height = FALSE;
-
- e_canvas_item_set_reflow_callback (GNOME_CANVAS_ITEM(object), etgl_reflow);
-}
-
-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 afb0e51cf6..0000000000
--- a/widgets/table/e-table-group-leaf.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-group-leaf.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_TABLE_GROUP_LEAF_H_
-#define _E_TABLE_GROUP_LEAF_H_
-
-#include <libgnomeui/gnome-canvas.h>
-#include <gal/e-table/e-table-group.h>
-#include <gal/e-table/e-table-subset.h>
-#include <gal/e-table/e-table-item.h>
-#include <libgnome/gnome-defs.h>
-
-BEGIN_GNOME_DECLS
-
-#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 height;
- gdouble width;
- gdouble minimum_width;
-
- int length_threshold;
-
- ETableSubset *ets;
- guint is_grouped : 1;
-
- guint alternating_row_colors : 1;
- guint horizontal_draw_grid : 1;
- guint vertical_draw_grid : 1;
- guint draw_focus : 1;
- guint uniform_row_height : 1;
- ECursorMode cursor_mode;
-
- int etgl_cursor_change_id;
- int etgl_cursor_activated_id;
- int etgl_double_click_id;
- int etgl_right_click_id;
- int etgl_click_id;
- int etgl_key_press_id;
- int etgl_start_drag_id;
-
- ESelectionModel *selection_model;
-} ETableGroupLeaf;
-
-typedef struct {
- ETableGroupClass parent_class;
-} ETableGroupLeafClass;
-
-ETableGroup *e_table_group_leaf_new (GnomeCanvasGroup *parent,
- ETableHeader *full_header,
- ETableHeader *header,
- ETableModel *model,
- ETableSortInfo *sort_info);
-GtkType e_table_group_leaf_get_type (void);
-
-
-END_GNOME_DECLS
-
-#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 8606502154..0000000000
--- a/widgets/table/e-table-group.c
+++ /dev/null
@@ -1,702 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-group.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <gtk/gtksignal.h>
-#include <libgnomeui/gnome-canvas-rect-ellipse.h>
-#include "e-table-group.h"
-#include "e-table-group-container.h"
-#include "e-table-group-leaf.h"
-#include "e-table-item.h"
-#include "gal/util/e-util.h"
-
-#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 {
- CURSOR_CHANGE,
- CURSOR_ACTIVATED,
- DOUBLE_CLICK,
- RIGHT_CLICK,
- CLICK,
- KEY_PRESS,
- START_DRAG,
- LAST_SIGNAL
-};
-
-static gint etg_signals [LAST_SIGNAL] = { 0, };
-
-static gboolean etg_get_focus (ETableGroup *etg);
-static void etg_destroy (GtkObject *object);
-
-static void
-etg_destroy (GtkObject *object)
-{
- ETableGroup *etg = E_TABLE_GROUP(object);
-
- if (etg->header) {
- gtk_object_unref (GTK_OBJECT(etg->header));
- etg->header = NULL;
- }
-
- if (etg->full_header) {
- gtk_object_unref (GTK_OBJECT(etg->full_header));
- etg->full_header = NULL;
- }
-
- if (etg->model) {
- gtk_object_unref (GTK_OBJECT(etg->model));
- etg->model = NULL;
- }
-
- if (GTK_OBJECT_CLASS (etg_parent_class)->destroy)
- GTK_OBJECT_CLASS (etg_parent_class)->destroy (object);
-}
-
-/**
- * e_table_group_new
- * @parent: The %GnomeCanvasGroup to create a child of.
- * @full_header: The full header of the %ETable.
- * @header: The current header of the %ETable.
- * @model: The %ETableModel of the %ETable.
- * @sort_info: The %ETableSortInfo of the %ETable.
- * @n: The grouping information object to group by.
- *
- * %ETableGroup is a collection of rows of an %ETable. It's a
- * %GnomeCanvasItem. There are two different forms. If n < the
- * number of groupings in the given %ETableSortInfo, then the
- * %ETableGroup will need to contain other %ETableGroups, thus it
- * creates an %ETableGroupContainer. Otherwise, it will just contain
- * an %ETableItem, and thus it creates an %ETableGroupLeaf.
- *
- * Returns: The new %ETableGroup.
- */
-ETableGroup *
-e_table_group_new (GnomeCanvasGroup *parent,
- ETableHeader *full_header,
- ETableHeader *header,
- ETableModel *model,
- ETableSortInfo *sort_info,
- int n)
-{
- g_return_val_if_fail (model != NULL, NULL);
-
- if (n < e_table_sort_info_grouping_get_count(sort_info)) {
- return e_table_group_container_new (parent, full_header, header, model, sort_info, n);
- } else {
- return e_table_group_leaf_new (parent, full_header, header, model, sort_info);
- }
- return NULL;
-}
-
-/**
- * e_table_group_construct
- * @parent: The %GnomeCanvasGroup to create a child of.
- * @etg: The %ETableGroup to construct.
- * @full_header: The full header of the %ETable.
- * @header: The current header of the %ETable.
- * @model: The %ETableModel of the %ETable.
- *
- * This routine does the base construction of the %ETableGroup.
- */
-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);
-}
-
-/**
- * e_table_group_add
- * @etg: The %ETableGroup to add a row to
- * @row: The row to add.
- *
- * This routine adds the given row from the %ETableModel to this set
- * of rows.
- */
-void
-e_table_group_add (ETableGroup *etg,
- gint row)
-{
- g_return_if_fail (etg != NULL);
- g_return_if_fail (E_IS_TABLE_GROUP (etg));
-
- g_assert (ETG_CLASS (etg)->add != NULL);
- ETG_CLASS (etg)->add (etg, row);
-}
-
-/**
- * e_table_group_add_array
- * @etg: The %ETableGroup to add to
- * @array: The array to add.
- * @count: The number of times to add
- *
- * This routine adds all the rows in the array to this set of rows.
- * It assumes that the array is already sorted properly.
- */
-void
-e_table_group_add_array (ETableGroup *etg,
- const int *array,
- int count)
-{
- g_return_if_fail (etg != NULL);
- g_return_if_fail (E_IS_TABLE_GROUP (etg));
-
- g_assert (ETG_CLASS (etg)->add_array != NULL);
- ETG_CLASS (etg)->add_array (etg, array, count);
-}
-
-/**
- * e_table_group_add_all
- * @etg: The %ETableGroup to add to
- *
- * This routine adds all the rows from the %ETableModel to this set
- * of rows.
- */
-void
-e_table_group_add_all (ETableGroup *etg)
-{
- g_return_if_fail (etg != NULL);
- g_return_if_fail (E_IS_TABLE_GROUP (etg));
-
- g_assert (ETG_CLASS (etg)->add_all != NULL);
- ETG_CLASS (etg)->add_all (etg);
-}
-
-/**
- * e_table_group_remove
- * @etg: The %ETableGroup to remove a row from
- * @row: The row to remove.
- *
- * This routine removes the given row from the %ETableModel from this
- * set of rows.
- *
- * Returns: TRUE if the row was deleted and FALSE if the row was not
- * found.
- */
-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);
-
- g_assert (ETG_CLASS (etg)->remove != NULL);
- return ETG_CLASS (etg)->remove (etg, row);
-}
-
-/**
- * e_table_group_increment
- * @etg: The %ETableGroup to increment
- * @position: The position to increment from
- * @amount: The amount to increment.
- *
- * This routine adds amount to all rows greater than or equal to
- * position. This is to handle when a row gets inserted into the
- * model.
- */
-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));
-
- g_assert (ETG_CLASS (etg)->increment != NULL);
- ETG_CLASS (etg)->increment (etg, position, amount);
-}
-
-/**
- * e_table_group_increment
- * @etg: The %ETableGroup to decrement
- * @position: The position to decrement from
- * @amount: The amount to decrement
- *
- * This routine removes amount from all rows greater than or equal to
- * position. This is to handle when a row gets deleted from the
- * model.
- */
-void
-e_table_group_decrement (ETableGroup *etg,
- gint position,
- gint amount)
-{
- g_return_if_fail (etg != NULL);
- g_return_if_fail (E_IS_TABLE_GROUP (etg));
-
- g_assert (ETG_CLASS (etg)->decrement != NULL);
- ETG_CLASS (etg)->decrement (etg, position, amount);
-}
-
-/**
- * e_table_group_increment
- * @etg: The %ETableGroup to count
- *
- * This routine calculates the number of rows shown in this group.
- *
- * Returns: The number of rows.
- */
-gint
-e_table_group_row_count (ETableGroup *etg)
-{
- g_return_val_if_fail (etg != NULL, 0);
- g_return_val_if_fail (E_IS_TABLE_GROUP (etg), -1);
-
- g_assert (ETG_CLASS (etg)->row_count != NULL);
- return ETG_CLASS (etg)->row_count (etg);
-}
-
-/**
- * e_table_group_set_focus
- * @etg: The %ETableGroup to set
- * @direction: The direction the focus is coming from.
- * @view_col: The column to set the focus in.
- *
- * Sets the focus to this widget. Places the focus in the view column
- * coming from direction direction.
- */
-void
-e_table_group_set_focus (ETableGroup *etg,
- EFocus direction,
- gint view_col)
-{
- g_return_if_fail (etg != NULL);
- g_return_if_fail (E_IS_TABLE_GROUP (etg));
-
- g_assert (ETG_CLASS (etg)->set_focus != NULL);
- ETG_CLASS (etg)->set_focus (etg, direction, view_col);
-}
-
-/**
- * e_table_group_get_focus
- * @etg: The %ETableGroup to check
- *
- * Calculates if this group has the focus.
- *
- * Returns: TRUE if this group has the focus.
- */
-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);
-
- g_assert (ETG_CLASS (etg)->get_focus != NULL);
- return ETG_CLASS (etg)->get_focus (etg);
-}
-
-/**
- * e_table_group_get_focus_column
- * @etg: The %ETableGroup to check
- *
- * Calculates which column in this group has the focus.
- *
- * Returns: The column index (view column).
- */
-gint
-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), -1);
-
- g_assert (ETG_CLASS (etg)->get_focus_column != NULL);
- return ETG_CLASS (etg)->get_focus_column (etg);
-}
-
-/**
- * e_table_group_get_printable
- * @etg: %ETableGroup which will be printed
- *
- * This routine creates and returns an %EPrintable that can be used to
- * print the given %ETableGroup.
- *
- * Returns: The %EPrintable.
- */
-EPrintable *
-e_table_group_get_printable (ETableGroup *etg)
-{
- g_return_val_if_fail (etg != NULL, NULL);
- g_return_val_if_fail (E_IS_TABLE_GROUP (etg), NULL);
-
- g_assert (ETG_CLASS (etg)->get_printable != NULL);
- return ETG_CLASS (etg)->get_printable (etg);
-}
-
-/**
- * e_table_group_compute_location
- * @eti: %ETableGroup to look in.
- * @x: A pointer to the x location to find in the %ETableGroup.
- * @y: A pointer to the y location to find in the %ETableGroup.
- * @row: A pointer to the location to store the found row in.
- * @col: A pointer to the location to store the found col in.
- *
- * This routine locates the pixel location (*x, *y) in the
- * %ETableGroup. If that location is in the %ETableGroup, *row and
- * *col are set to the view row and column where it was found. If
- * that location is not in the %ETableGroup, the height of the
- * %ETableGroup is removed from the value y points to.
- */
-void
-e_table_group_compute_location (ETableGroup *etg, int *x, int *y, int *row, int *col)
-{
- g_return_if_fail (etg != NULL);
- g_return_if_fail (E_IS_TABLE_GROUP (etg));
-
- g_assert (ETG_CLASS (etg)->compute_location != NULL);
- ETG_CLASS (etg)->compute_location (etg, x, y, row, col);
-}
-
-/**
- * e_table_group_get_position
- * @eti: %ETableGroup to look in.
- * @x: A pointer to the location to store the found x location in.
- * @y: A pointer to the location to store the found y location in.
- * @row: A pointer to the row number to find.
- * @col: A pointer to the col number to find.
- *
- * This routine finds the view cell (row, col) in the #ETableGroup.
- * If that location is in the #ETableGroup *@x and *@y are set to the
- * upper left hand corner of the cell found. If that location is not
- * in the #ETableGroup, the number of rows in the #ETableGroup is
- * removed from the value row points to.
- */
-void
-e_table_group_get_cell_geometry (ETableGroup *etg,
- int *row,
- int *col,
- int *x,
- int *y,
- int *width,
- int *height)
-{
- g_return_if_fail (etg != NULL);
- g_return_if_fail (E_IS_TABLE_GROUP (etg));
-
- g_assert (ETG_CLASS (etg)->get_cell_geometry != NULL);
- ETG_CLASS (etg)->get_cell_geometry (etg, row, col, x, y, width, height);
-}
-
-/**
- * e_table_group_cursor_change
- * @eti: %ETableGroup to emit the signal on
- * @row: The new cursor row (model row)
- *
- * This routine emits the "cursor_change" signal.
- */
-void
-e_table_group_cursor_change (ETableGroup *e_table_group, gint row)
-{
- 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 [CURSOR_CHANGE],
- row);
-}
-
-/**
- * e_table_group_cursor_activated
- * @eti: %ETableGroup to emit the signal on
- * @row: The cursor row (model row)
- *
- * This routine emits the "cursor_activated" signal.
- */
-void
-e_table_group_cursor_activated (ETableGroup *e_table_group, gint row)
-{
- 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 [CURSOR_ACTIVATED],
- row);
-}
-
-/**
- * e_table_group_double_click
- * @eti: %ETableGroup to emit the signal on
- * @row: The row clicked on (model row)
- * @col: The col clicked on (model col)
- * @event: The event that caused this signal
- *
- * This routine emits the "double_click" signal.
- */
-void
-e_table_group_double_click (ETableGroup *e_table_group, gint row, gint col, GdkEvent *event)
-{
- 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 [DOUBLE_CLICK],
- row, col, event);
-}
-
-/**
- * e_table_group_right_click
- * @eti: %ETableGroup to emit the signal on
- * @row: The row clicked on (model row)
- * @col: The col clicked on (model col)
- * @event: The event that caused this signal
- *
- * This routine emits the "right_click" signal.
- */
-gint
-e_table_group_right_click (ETableGroup *e_table_group, gint row, gint col, GdkEvent *event)
-{
- gint return_val = 0;
-
- g_return_val_if_fail (e_table_group != NULL, 0);
- g_return_val_if_fail (E_IS_TABLE_GROUP (e_table_group), 0);
-
- gtk_signal_emit (GTK_OBJECT (e_table_group),
- etg_signals [RIGHT_CLICK],
- row, col, event, &return_val);
-
- return return_val;
-}
-
-/**
- * e_table_group_click
- * @eti: %ETableGroup to emit the signal on
- * @row: The row clicked on (model row)
- * @col: The col clicked on (model col)
- * @event: The event that caused this signal
- *
- * This routine emits the "click" signal.
- */
-gint
-e_table_group_click (ETableGroup *e_table_group, gint row, gint col, GdkEvent *event)
-{
- gint return_val = 0;
-
- g_return_val_if_fail (e_table_group != NULL, 0);
- g_return_val_if_fail (E_IS_TABLE_GROUP (e_table_group), 0);
-
- gtk_signal_emit (GTK_OBJECT (e_table_group),
- etg_signals [CLICK],
- row, col, event, &return_val);
-
- return return_val;
-}
-
-/**
- * e_table_group_key_press
- * @eti: %ETableGroup to emit the signal on
- * @row: The cursor row (model row)
- * @col: The cursor col (model col)
- * @event: The event that caused this signal
- *
- * This routine emits the "key_press" signal.
- */
-gint
-e_table_group_key_press (ETableGroup *e_table_group, gint row, gint col, GdkEvent *event)
-{
- gint return_val = 0;
-
- g_return_val_if_fail (e_table_group != NULL, 0);
- g_return_val_if_fail (E_IS_TABLE_GROUP (e_table_group), 0);
-
- gtk_signal_emit (GTK_OBJECT (e_table_group),
- etg_signals [KEY_PRESS],
- row, col, event, &return_val);
-
- return return_val;
-}
-
-/**
- * e_table_group_start_drag
- * @eti: %ETableGroup to emit the signal on
- * @row: The cursor row (model row)
- * @col: The cursor col (model col)
- * @event: The event that caused this signal
- *
- * This routine emits the "start_drag" signal.
- */
-gint
-e_table_group_start_drag (ETableGroup *e_table_group, gint row, gint col, GdkEvent *event)
-{
- gint return_val = 0;
-
- g_return_val_if_fail (e_table_group != NULL, 0);
- g_return_val_if_fail (E_IS_TABLE_GROUP (e_table_group), 0);
-
- gtk_signal_emit (GTK_OBJECT (e_table_group),
- etg_signals [START_DRAG],
- row, col, event, &return_val);
-
- return return_val;
-}
-
-/**
- * e_table_group_get_header
- * @eti: %ETableGroup to check
- *
- * This routine returns the %ETableGroup's header.
- *
- * Returns: The %ETableHeader.
- */
-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 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->destroy = etg_destroy;
-
- item_class->event = etg_event;
-
- klass->cursor_change = NULL;
- klass->cursor_activated = NULL;
- klass->double_click = NULL;
- klass->right_click = NULL;
- klass->click = NULL;
- klass->key_press = NULL;
- klass->start_drag = NULL;
-
- klass->add = NULL;
- klass->add_array = NULL;
- klass->add_all = NULL;
- klass->remove = NULL;
- klass->row_count = NULL;
- klass->increment = NULL;
- klass->decrement = NULL;
- klass->set_focus = NULL;
- klass->get_focus = etg_get_focus;
- klass->get_printable = NULL;
- klass->compute_location = NULL;
- klass->get_cell_geometry = NULL;
-
- etg_parent_class = gtk_type_class (PARENT_TYPE);
-
- etg_signals [CURSOR_CHANGE] =
- gtk_signal_new ("cursor_change",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETableGroupClass, cursor_change),
- gtk_marshal_NONE__INT,
- GTK_TYPE_NONE, 1, GTK_TYPE_INT);
-
- etg_signals [CURSOR_ACTIVATED] =
- gtk_signal_new ("cursor_activated",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETableGroupClass, cursor_activated),
- gtk_marshal_NONE__INT,
- GTK_TYPE_NONE, 1, GTK_TYPE_INT);
-
- etg_signals [DOUBLE_CLICK] =
- gtk_signal_new ("double_click",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETableGroupClass, double_click),
- gtk_marshal_NONE__INT_INT_POINTER,
- GTK_TYPE_NONE, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT);
-
- etg_signals [RIGHT_CLICK] =
- gtk_signal_new ("right_click",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETableGroupClass, right_click),
- e_marshal_INT__INT_INT_POINTER,
- GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT);
-
- etg_signals [CLICK] =
- gtk_signal_new ("click",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETableGroupClass, click),
- e_marshal_INT__INT_INT_POINTER,
- GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT);
-
- etg_signals [KEY_PRESS] =
- gtk_signal_new ("key_press",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETableGroupClass, key_press),
- e_marshal_INT__INT_INT_POINTER,
- GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT);
-
- etg_signals [START_DRAG] =
- gtk_signal_new ("start_drag",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETableGroupClass, start_drag),
- e_marshal_INT__INT_INT_POINTER,
- GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT);
-
- E_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.glade b/widgets/table/e-table-group.glade
deleted file mode 100644
index 20ab88cfca..0000000000
--- a/widgets/table/e-table-group.glade
+++ /dev/null
@@ -1,206 +0,0 @@
-<?xml version="1.0"?>
-<GTK-Interface>
-
-<project>
- <directory></directory>
- <source_directory>src</source_directory>
- <pixmaps_directory>pixmaps</pixmaps_directory>
- <language>C</language>
- <gnome_support>True</gnome_support>
- <gettext_support>True</gettext_support>
- <use_widget_names>False</use_widget_names>
- <output_main_file>False</output_main_file>
- <output_support_files>False</output_support_files>
- <output_build_files>False</output_build_files>
- <backup_source_files>False</backup_source_files>
- <main_source_file>interface.c</main_source_file>
- <main_header_file>interface.h</main_header_file>
- <handler_source_file>callbacks.c</handler_source_file>
- <handler_header_file>callbacks.h</handler_header_file>
- <support_source_file>support.c</support_source_file>
- <support_header_file>support.h</support_header_file>
-</project>
-
-<widget>
- <class>GtkWindow</class>
- <name>window1</name>
- <title>window1</title>
- <type>GTK_WINDOW_TOPLEVEL</type>
- <position>GTK_WIN_POS_NONE</position>
- <modal>False</modal>
- <allow_shrink>False</allow_shrink>
- <allow_grow>True</allow_grow>
- <auto_shrink>False</auto_shrink>
-
- <widget>
- <class>GtkTable</class>
- <name>table1</name>
- <rows>3</rows>
- <columns>3</columns>
- <homogeneous>False</homogeneous>
- <row_spacing>0</row_spacing>
- <column_spacing>0</column_spacing>
-
- <widget>
- <class>GtkFrame</class>
- <name>frame1</name>
- <border_width>4</border_width>
- <label>Available fields</label>
- <label_xalign>0</label_xalign>
- <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
- <child>
- <left_attach>0</left_attach>
- <right_attach>1</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>True</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>GtkScrolledWindow</class>
- <name>scrolledwindow1</name>
- <hscrollbar_policy>GTK_POLICY_ALWAYS</hscrollbar_policy>
- <vscrollbar_policy>GTK_POLICY_ALWAYS</vscrollbar_policy>
- <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
- <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
-
- <widget>
- <class>GtkCList</class>
- <name>clist1</name>
- <can_focus>True</can_focus>
- <columns>1</columns>
- <column_widths>80</column_widths>
- <selection_mode>GTK_SELECTION_SINGLE</selection_mode>
- <show_titles>False</show_titles>
- <shadow_type>GTK_SHADOW_NONE</shadow_type>
-
- <widget>
- <class>GtkLabel</class>
- <child_name>CList:title</child_name>
- <name>label1</name>
- <label>label1</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- </widget>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GtkFrame</class>
- <name>frame2</name>
- <border_width>4</border_width>
- <label>Show in this order</label>
- <label_xalign>0</label_xalign>
- <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
- <child>
- <left_attach>2</left_attach>
- <right_attach>3</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>0</xpad>
- <ypad>0</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>True</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>GtkScrolledWindow</class>
- <name>scrolledwindow2</name>
- <hscrollbar_policy>GTK_POLICY_ALWAYS</hscrollbar_policy>
- <vscrollbar_policy>GTK_POLICY_ALWAYS</vscrollbar_policy>
- <hupdate_policy>GTK_UPDATE_CONTINUOUS</hupdate_policy>
- <vupdate_policy>GTK_UPDATE_CONTINUOUS</vupdate_policy>
-
- <widget>
- <class>GtkCList</class>
- <name>clist2</name>
- <can_focus>True</can_focus>
- <columns>1</columns>
- <column_widths>80</column_widths>
- <selection_mode>GTK_SELECTION_SINGLE</selection_mode>
- <show_titles>False</show_titles>
- <shadow_type>GTK_SHADOW_NONE</shadow_type>
-
- <widget>
- <class>GtkLabel</class>
- <child_name>CList:title</child_name>
- <name>label2</name>
- <label>label2</label>
- <justify>GTK_JUSTIFY_CENTER</justify>
- <wrap>False</wrap>
- <xalign>0.5</xalign>
- <yalign>0.5</yalign>
- <xpad>0</xpad>
- <ypad>0</ypad>
- </widget>
- </widget>
- </widget>
- </widget>
-
- <widget>
- <class>GtkVBox</class>
- <name>vbox1</name>
- <border_width>4</border_width>
- <homogeneous>False</homogeneous>
- <spacing>0</spacing>
- <child>
- <left_attach>1</left_attach>
- <right_attach>2</right_attach>
- <top_attach>0</top_attach>
- <bottom_attach>1</bottom_attach>
- <xpad>4</xpad>
- <ypad>4</ypad>
- <xexpand>True</xexpand>
- <yexpand>False</yexpand>
- <xshrink>False</xshrink>
- <yshrink>False</yshrink>
- <xfill>False</xfill>
- <yfill>True</yfill>
- </child>
-
- <widget>
- <class>GtkButton</class>
- <name>button1</name>
- <border_width>4</border_width>
- <can_focus>True</can_focus>
- <label>Add &gt;&gt;</label>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
-
- <widget>
- <class>GtkButton</class>
- <name>button2</name>
- <border_width>4</border_width>
- <can_focus>True</can_focus>
- <label>&lt;&lt; Remove</label>
- <child>
- <padding>0</padding>
- <expand>False</expand>
- <fill>False</fill>
- </child>
- </widget>
- </widget>
- </widget>
-</widget>
-
-</GTK-Interface>
diff --git a/widgets/table/e-table-group.h b/widgets/table/e-table-group.h
deleted file mode 100644
index 6cad768d57..0000000000
--- a/widgets/table/e-table-group.h
+++ /dev/null
@@ -1,179 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-group.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_TABLE_GROUP_H_
-#define _E_TABLE_GROUP_H_
-
-#include <libgnomeui/gnome-canvas.h>
-#include <gal/e-table/e-table-model.h>
-#include <gal/e-table/e-table-header.h>
-#include <gal/e-table/e-table-sort-info.h>
-#include <gal/e-table/e-table-defines.h>
-#include <gal/util/e-util.h>
-#include <gal/widgets/e-printable.h>
-#include <libgnome/gnome-defs.h>
-
-BEGIN_GNOME_DECLS
-
-#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;
-
- /* Signals */
- void (*cursor_change) (ETableGroup *etg, int row);
- void (*cursor_activated) (ETableGroup *etg, int row);
- void (*double_click) (ETableGroup *etg, int row, int col, GdkEvent *event);
- gint (*right_click) (ETableGroup *etg, int row, int col, GdkEvent *event);
- gint (*click) (ETableGroup *etg, int row, int col, GdkEvent *event);
- gint (*key_press) (ETableGroup *etg, int row, int col, GdkEvent *event);
- gint (*start_drag) (ETableGroup *etg, int row, int col, GdkEvent *event);
-
- /* Virtual functions. */
- void (*add) (ETableGroup *etg, gint row);
- void (*add_array) (ETableGroup *etg, const int *array, int count);
- void (*add_all) (ETableGroup *etg);
- gboolean (*remove) (ETableGroup *etg, gint row);
- gint (*row_count) (ETableGroup *etg);
- void (*increment) (ETableGroup *etg, gint position, gint amount);
- void (*decrement) (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);
- EPrintable *(*get_printable) (ETableGroup *etg);
- void (*compute_location) (ETableGroup *etg, int *x, int *y, int *row, int *col);
- void (*get_cell_geometry) (ETableGroup *etg, int *row, int *col, int *x, int *y, int *width, int *height);
-
-} ETableGroupClass;
-
-/* Virtual functions */
-void e_table_group_add (ETableGroup *etg,
- gint row);
-void e_table_group_add_array (ETableGroup *etg,
- const int *array,
- int count);
-void e_table_group_add_all (ETableGroup *etg);
-gboolean e_table_group_remove (ETableGroup *etg,
- gint row);
-void e_table_group_increment (ETableGroup *etg,
- gint position,
- gint amount);
-void e_table_group_decrement (ETableGroup *etg,
- gint position,
- gint amount);
-gint e_table_group_row_count (ETableGroup *etg);
-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);
-EPrintable *e_table_group_get_printable (ETableGroup *etg);
-void e_table_group_compute_location (ETableGroup *etg,
- int *x,
- int *y,
- int *row,
- int *col);
-void e_table_group_get_cell_geometry (ETableGroup *etg,
- int *row,
- int *col,
- int *x,
- int *y,
- int *width,
- int *height);
-ETableGroup *e_table_group_new (GnomeCanvasGroup *parent,
- ETableHeader *full_header,
- ETableHeader *header,
- ETableModel *model,
- ETableSortInfo *sort_info,
- int n);
-void e_table_group_construct (GnomeCanvasGroup *parent,
- ETableGroup *etg,
- ETableHeader *full_header,
- ETableHeader *header,
- ETableModel *model);
-
-/* For emitting the signals */
-void e_table_group_cursor_change (ETableGroup *etg,
- gint row);
-void e_table_group_cursor_activated (ETableGroup *etg,
- gint row);
-void e_table_group_double_click (ETableGroup *etg,
- gint row,
- gint col,
- GdkEvent *event);
-gint e_table_group_right_click (ETableGroup *etg,
- gint row,
- gint col,
- GdkEvent *event);
-gint e_table_group_click (ETableGroup *etg,
- gint row,
- gint col,
- GdkEvent *event);
-gint e_table_group_key_press (ETableGroup *etg,
- gint row,
- gint col,
- GdkEvent *event);
-gint e_table_group_start_drag (ETableGroup *etg,
- gint row,
- gint col,
- GdkEvent *event);
-GtkType e_table_group_get_type (void);
-
-typedef void (*ETableGroupLeafFn) (void *e_table_item, void *closure);
-void e_table_group_apply_to_leafs (ETableGroup *etg,
- ETableGroupLeafFn fn,
- void *closure);
-
-END_GNOME_DECLS
-
-#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 87b499fb93..0000000000
--- a/widgets/table/e-table-header-item.c
+++ /dev/null
@@ -1,1801 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-header-item.c
- * Copyright 1999, 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- * Miguel de Icaza (miguel@gnu.org)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-
-#include "e-table-header-item.h"
-
-#include <string.h>
-#include <gtk/gtksignal.h>
-#include <gtk/gtkdnd.h>
-#include <libgnomeui/gnome-canvas.h>
-#include <libgnomeui/gnome-canvas-util.h>
-#include <libgnomeui/gnome-canvas-polygon.h>
-#include <libgnomeui/gnome-canvas-rect-ellipse.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
-#include "gal/widgets/e-cursors.h"
-#include "gal/util/e-i18n.h"
-#include "gal/util/e-util.h"
-#include "gal/util/e-xml-utils.h"
-#include "gal/widgets/e-canvas.h"
-#include "gal/widgets/e-popup-menu.h"
-#include "gal/widgets/e-gui-utils.h"
-#include "e-table-header.h"
-#include "e-table-header-utils.h"
-#include "e-table-col-dnd.h"
-#include "e-table-defines.h"
-#include "e-table-field-chooser-dialog.h"
-#include "e-table-config.h"
-#include "e-table.h"
-
-#include "add-col.xpm"
-#include "remove-col.xpm"
-#include "arrow-up.xpm"
-#include "arrow-down.xpm"
-
-enum {
- BUTTON_PRESSED,
- LAST_SIGNAL
-};
-
-static guint ethi_signals [LAST_SIGNAL] = { 0, };
-
-#define ARROW_DOWN_HEIGHT 16
-#define ARROW_PTR 7
-
-/* Defines the tolerance for proximity of the column division to the cursor position */
-#define TOLERANCE 4
-
-#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]))
-#define d(x)
-
-static GnomeCanvasItemClass *ethi_parent_class;
-
-static void ethi_drop_table_header (ETableHeaderItem *ethi);
-
-/*
- * They display the arrows for the drop location.
- */
-
-static GtkWidget *arrow_up, *arrow_down;
-
-/*
- * 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_FULL_HEADER,
- ARG_DND_CODE,
- ARG_TABLE_FONTSET,
- ARG_SORT_INFO,
- ARG_TABLE,
- ARG_TREE,
-};
-
-enum {
- ET_SCROLL_UP = 1 << 0,
- ET_SCROLL_DOWN = 1 << 1,
- ET_SCROLL_LEFT = 1 << 2,
- ET_SCROLL_RIGHT = 1 << 3
-};
-
-static void scroll_off (ETableHeaderItem *ethi);
-static void scroll_on (ETableHeaderItem *ethi, guint scroll_direction);
-
-static void
-ethi_destroy (GtkObject *object){
- ETableHeaderItem *ethi = E_TABLE_HEADER_ITEM (object);
-
- ethi_drop_table_header (ethi);
-
- scroll_off (ethi);
-
- if (ethi->dnd_code) {
- g_free (ethi->dnd_code);
- ethi->dnd_code = NULL;
- }
-
- if (ethi->sort_info) {
- if (ethi->sort_info_changed_id)
- gtk_signal_disconnect (GTK_OBJECT(ethi->sort_info), ethi->sort_info_changed_id);
- if (ethi->group_info_changed_id)
- gtk_signal_disconnect (GTK_OBJECT(ethi->sort_info), ethi->group_info_changed_id);
- gtk_object_unref (GTK_OBJECT(ethi->sort_info));
- ethi->sort_info = NULL;
- }
-
- if (ethi->full_header)
- gtk_object_unref (GTK_OBJECT(ethi->full_header));
-
- if (ethi->config)
- gtk_object_destroy (GTK_OBJECT (ethi->config));
-
- if (GTK_OBJECT_CLASS (ethi_parent_class)->destroy)
- (*GTK_OBJECT_CLASS (ethi_parent_class)->destroy) (object);
-}
-
-static int
-e_table_header_item_get_height (ETableHeaderItem *ethi)
-{
- ETableHeader *eth;
- int numcols, col;
- int maxheight;
- GtkStyle *style;
-
- g_return_val_if_fail (ethi != NULL, 0);
- g_return_val_if_fail (E_IS_TABLE_HEADER_ITEM (ethi), 0);
-
- eth = ethi->eth;
- numcols = e_table_header_count (eth);
-
- maxheight = 0;
-
- style = GTK_WIDGET (GNOME_CANVAS_ITEM (ethi)->canvas)->style;
-
- for (col = 0; col < numcols; col++) {
- ETableCol *ecol = e_table_header_get_column (eth, col);
- int height;
-
- height = e_table_header_compute_height (ecol, style, ethi->font);
-
- if (height > maxheight)
- maxheight = height;
- }
-
- return maxheight;
-}
-
-static void
-ethi_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags)
-{
- ETableHeaderItem *ethi = E_TABLE_HEADER_ITEM (item);
-
- double i2c [6];
- ArtPoint c1, c2, i1, i2;
-
- if (GNOME_CANVAS_ITEM_CLASS (ethi_parent_class)->update)
- (*GNOME_CANVAS_ITEM_CLASS (ethi_parent_class)->update)(item, affine, clip_path, flags);
-
- if (ethi->sort_info)
- ethi->group_indent_width = e_table_sort_info_grouping_get_count(ethi->sort_info) * GROUP_INDENT;
- else
- ethi->group_indent_width = 0;
-
- ethi->width = e_table_header_total_width (ethi->eth) + ethi->group_indent_width;
-
- i1.x = i1.y = 0;
- i2.x = ethi->width;
- i2.y = ethi->height;
-
- gnome_canvas_item_i2c_affine (item, i2c);
- art_affine_point (&c1, &i1, i2c);
- art_affine_point (&c2, &i2, i2c);
-
- if (item->x1 != c1.x ||
- item->y1 != c1.y ||
- item->x2 != c2.x ||
- item->y2 != c2.y)
- {
- gnome_canvas_request_redraw (item->canvas, item->x1, item->y1, item->x2, item->y2);
- item->x1 = c1.x;
- item->y1 = c1.y;
- item->x2 = c2.x;
- item->y2 = c2.y;
-
- gnome_canvas_group_child_bounds (GNOME_CANVAS_GROUP (item->parent), item);
- }
- gnome_canvas_request_redraw (item->canvas, item->x1, item->y1, item->x2, item->y2);
-}
-
-static void
-ethi_font_set (ETableHeaderItem *ethi, GdkFont *font)
-{
- if (ethi->font)
- gdk_font_unref (ethi->font);
-
- ethi->font = font;
- gdk_font_ref (font);
-
- ethi->height = e_table_header_item_get_height (ethi);
- e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(ethi));
-}
-
-static void
-ethi_font_load (ETableHeaderItem *ethi, char *fontname)
-{
- GdkFont *font = NULL;
-
- if (fontname != NULL)
- font = gdk_fontset_load (fontname);
-
- if (font == NULL) {
- font = GTK_WIDGET (GNOME_CANVAS_ITEM (ethi)->canvas)->style->font;
- gdk_font_ref (font);
- }
-
- ethi_font_set (ethi, font);
- gdk_font_unref (font);
-}
-
-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)
-{
- gnome_canvas_item_request_update(GNOME_CANVAS_ITEM(ethi));
-}
-
-static void
-dimension_changed (ETableHeader *header, int col, ETableHeaderItem *ethi)
-{
- gnome_canvas_item_request_update(GNOME_CANVAS_ITEM(ethi));
-}
-
-static void
-ethi_add_table_header (ETableHeaderItem *ethi, ETableHeader *header)
-{
- ethi->eth = header;
- gtk_object_ref (GTK_OBJECT (ethi->eth));
-
- ethi->height = e_table_header_item_get_height (ethi);
-
- 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);
- e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(ethi));
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(ethi));
-}
-
-static void
-ethi_sort_info_changed (ETableSortInfo *sort_info, ETableHeaderItem *ethi)
-{
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(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, E_TABLE_HEADER(GTK_VALUE_OBJECT (*arg)));
- break;
-
- case ARG_FULL_HEADER:
- if (ethi->full_header)
- gtk_object_unref(GTK_OBJECT(ethi->full_header));
- ethi->full_header = E_TABLE_HEADER(GTK_VALUE_OBJECT (*arg));
- if (ethi->full_header)
- gtk_object_ref(GTK_OBJECT(ethi->full_header));
- break;
-
- case ARG_DND_CODE:
- g_free(ethi->dnd_code);
- ethi->dnd_code = g_strdup (GTK_VALUE_STRING (*arg));
- break;
-
- case ARG_TABLE_FONTSET:
- ethi_font_load (ethi, GTK_VALUE_STRING (*arg));
- break;
-
- case ARG_SORT_INFO:
- if (ethi->sort_info){
- if (ethi->sort_info_changed_id)
- gtk_signal_disconnect (
- GTK_OBJECT(ethi->sort_info),
- ethi->sort_info_changed_id);
-
- if (ethi->group_info_changed_id)
- gtk_signal_disconnect (
- GTK_OBJECT(ethi->sort_info),
- ethi->group_info_changed_id);
- gtk_object_unref (GTK_OBJECT(ethi->sort_info));
- }
- ethi->sort_info = GTK_VALUE_POINTER (*arg);
- gtk_object_ref (GTK_OBJECT(ethi->sort_info));
- ethi->sort_info_changed_id =
- gtk_signal_connect (
- GTK_OBJECT(ethi->sort_info), "sort_info_changed",
- GTK_SIGNAL_FUNC(ethi_sort_info_changed), ethi);
- ethi->group_info_changed_id =
- gtk_signal_connect (
- GTK_OBJECT(ethi->sort_info), "group_info_changed",
- GTK_SIGNAL_FUNC(ethi_sort_info_changed), ethi);
- break;
- case ARG_TABLE:
- if (GTK_VALUE_OBJECT(*arg))
- ethi->table = E_TABLE(GTK_VALUE_OBJECT(*arg));
- else
- ethi->table = NULL;
- break;
- case ARG_TREE:
- if (GTK_VALUE_OBJECT(*arg))
- ethi->tree = E_TREE(GTK_VALUE_OBJECT(*arg));
- else
- ethi->tree = NULL;
- break;
- }
- gnome_canvas_item_request_update(item);
-}
-
-static void
-ethi_get_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- ETableHeaderItem *ethi;
-
- ethi = E_TABLE_HEADER_ITEM (o);
-
- switch (arg_id){
- case ARG_FULL_HEADER:
- GTK_VALUE_OBJECT (*arg) = GTK_OBJECT (ethi->full_header);
- break;
- case ARG_DND_CODE:
- GTK_VALUE_STRING (*arg) = g_strdup (ethi->dnd_code);
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-static int
-ethi_find_col_by_x (ETableHeaderItem *ethi, int x)
-{
- const int cols = e_table_header_count (ethi->eth);
- int x1 = 0;
- int col;
-
- d(g_print ("%s:%d: x = %d, x1 = %d\n", __FUNCTION__, __LINE__, x, x1));
-
- x1 += ethi->group_indent_width;
-
- if (x < x1) {
- d(g_print ("%s:%d: Returning 0\n", __FUNCTION__, __LINE__));
- return 0;
- }
-
- for (col = 0; col < cols; col++){
- ETableCol *ecol = e_table_header_get_column (ethi->eth, col);
-
- if ((x >= x1) && (x <= x1 + ecol->width)) {
- d(g_print ("%s:%d: Returning %d\n", __FUNCTION__, __LINE__, col));
- return col;
- }
-
- x1 += ecol->width;
- }
- d(g_print ("%s:%d: Returning %d\n", __FUNCTION__, __LINE__, cols - 1));
- return cols - 1;
-}
-
-static int
-ethi_find_col_by_x_nearest (ETableHeaderItem *ethi, int x)
-{
- const int cols = e_table_header_count (ethi->eth);
- int x1 = 0;
- int col;
-
- x1 += ethi->group_indent_width;
-
- if (x < x1)
- return 0;
-
- for (col = 0; col < cols; col++){
- ETableCol *ecol = e_table_header_get_column (ethi->eth, col);
-
- x1 += (ecol->width / 2);
-
- if (x <= x1)
- return col;
-
- x1 += (ecol->width + 1) / 2;
- }
- return col;
-}
-
-static void
-ethi_remove_drop_marker (ETableHeaderItem *ethi)
-{
- if (ethi->drag_mark == -1)
- return;
-
- gtk_widget_hide (arrow_up);
- gtk_widget_hide (arrow_down);
-
- ethi->drag_mark = -1;
-}
-
-static GtkWidget *
-make_shaped_window_from_xpm (const char **xpm)
-{
- GdkPixbuf *pixbuf;
- GdkPixmap *pixmap;
- GdkBitmap *bitmap;
- GtkWidget *win, *pix;
-
- pixbuf = gdk_pixbuf_new_from_xpm_data (xpm);
- gdk_pixbuf_render_pixmap_and_mask (pixbuf, &pixmap, &bitmap, 128);
- gdk_pixbuf_unref (pixbuf);
-
- gtk_widget_push_visual (gdk_rgb_get_visual ());
- gtk_widget_push_colormap (gdk_rgb_get_cmap ());
- win = gtk_window_new (GTK_WINDOW_POPUP);
- pix = gtk_pixmap_new (pixmap, bitmap);
- gtk_widget_realize (win);
- gtk_container_add (GTK_CONTAINER (win), pix);
- gtk_widget_shape_combine_mask (win, bitmap, 0, 0);
- gtk_widget_pop_visual ();
- gtk_widget_pop_colormap ();
-
- gdk_pixmap_unref (pixmap);
- gdk_bitmap_unref (bitmap);
-
- return win;
-}
-
-static void
-ethi_add_drop_marker (ETableHeaderItem *ethi, int col, gboolean recreate)
-{
- int rx, ry;
- int x;
-
- if (!recreate && ethi->drag_mark == col)
- return;
-
- ethi->drag_mark = col;
-
- x = e_table_header_col_diff (ethi->eth, 0, col);
- if (col > 0)
- x += ethi->group_indent_width;
-
- if (!arrow_up){
- arrow_up = make_shaped_window_from_xpm (arrow_up_xpm);
- arrow_down = make_shaped_window_from_xpm (arrow_down_xpm);
- }
-
- gdk_window_get_origin (
- GTK_WIDGET (GNOME_CANVAS_ITEM (ethi)->canvas)->window,
- &rx, &ry);
-
- rx -= gtk_layout_get_hadjustment (GTK_LAYOUT (GNOME_CANVAS_ITEM (ethi)->canvas))->value;
- ry -= gtk_layout_get_vadjustment (GTK_LAYOUT (GNOME_CANVAS_ITEM (ethi)->canvas))->value;
-
- gtk_widget_set_uposition (arrow_down, rx + x - ARROW_PTR, ry - ARROW_DOWN_HEIGHT);
- gtk_widget_show_all (arrow_down);
-
- gtk_widget_set_uposition (arrow_up, rx + x - ARROW_PTR, ry + ethi->height);
- gtk_widget_show_all (arrow_up);
-}
-
-#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 = (double) e_table_header_col_diff (ethi->eth, 0, ethi->drag_col);
- if (ethi->drag_col > 0)
- x1 += ethi->group_indent_width;
-
- 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) 1,
- "x2", (double) x1 + e_table_header_col_diff (
- ethi->eth, ethi->drag_col, ethi->drag_col+1) - 2,
-
- "y2", (double) 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;
-}
-
-#if 0
-static gboolean
-moved (ETableHeaderItem *ethi, guint col, guint model_col)
-{
- if (col == -1)
- return TRUE;
- ecol = e_table_header_get_column (ethi->eth, col);
- if (ecol->col_idx == model_col)
- return FALSE;
- if (col > 0) {
- ecol = e_table_header_get_column (ethi->eth, col - 1);
- if (ecol->col_idx == model_col)
- return FALSE;
- }
- return TRUE;
-}
-#endif
-
-static void
-do_drag_motion(ETableHeaderItem *ethi,
- GdkDragContext *context,
- gint x,
- gint y,
- guint time,
- gboolean recreate)
-{
- if ((x >= 0) && (x <= (ethi->width)) &&
- (y >= 0) && (y <= (ethi->height))){
- int col;
-
- col = ethi_find_col_by_x_nearest (ethi, x);
-
- if (ethi->drag_col != -1 && (col == ethi->drag_col || col == ethi->drag_col + 1)) {
- if (ethi->drag_col != -1)
- ethi_remove_destroy_marker (ethi);
-
- ethi_remove_drop_marker (ethi);
- gdk_drag_status (context, context->suggested_action, time);
- }
- else if (col != -1){
- if (ethi->drag_col != -1)
- ethi_remove_destroy_marker (ethi);
-
- ethi_add_drop_marker (ethi, col, recreate);
- gdk_drag_status (context, context->suggested_action, time);
- } else {
- ethi_remove_drop_marker (ethi);
- if (ethi->drag_col != -1)
- ethi_add_destroy_marker (ethi);
- }
- } else {
- ethi_remove_drop_marker (ethi);
- if (ethi->drag_col != -1)
- ethi_add_destroy_marker (ethi);
- }
-}
-
-static gboolean
-scroll_timeout (gpointer data)
-{
- ETableHeaderItem *ethi = data;
- int dx = 0;
- GtkAdjustment *h, *v;
- double value;
-
- if (ethi->scroll_direction & ET_SCROLL_RIGHT)
- dx += 20;
- if (ethi->scroll_direction & ET_SCROLL_LEFT)
- dx -= 20;
-
- h = GTK_LAYOUT(GNOME_CANVAS_ITEM (ethi)->canvas)->hadjustment;
- v = GTK_LAYOUT(GNOME_CANVAS_ITEM (ethi)->canvas)->vadjustment;
-
- value = h->value;
-
- gtk_adjustment_set_value(h, CLAMP(h->value + dx, h->lower, h->upper - h->page_size));
-
- if (h->value != value)
- do_drag_motion(ethi,
- ethi->last_drop_context,
- ethi->last_drop_x + h->value,
- ethi->last_drop_y + v->value,
- ethi->last_drop_time,
- TRUE);
-
- return TRUE;
-}
-
-static void
-scroll_on (ETableHeaderItem *ethi, guint scroll_direction)
-{
- if (ethi->scroll_idle_id == 0 || scroll_direction != ethi->scroll_direction) {
- if (ethi->scroll_idle_id != 0)
- g_source_remove (ethi->scroll_idle_id);
- ethi->scroll_direction = scroll_direction;
- ethi->scroll_idle_id = g_timeout_add (100, scroll_timeout, ethi);
- }
-}
-
-static void
-scroll_off (ETableHeaderItem *ethi)
-{
- if (ethi->scroll_idle_id) {
- g_source_remove (ethi->scroll_idle_id);
- ethi->scroll_idle_id = 0;
- }
-}
-
-static void
-context_destroyed (gpointer data)
-{
- ETableHeaderItem *ethi = data;
- if (!GTK_OBJECT_DESTROYED (ethi)) {
- ethi->last_drop_x = 0;
- ethi->last_drop_y = 0;
- ethi->last_drop_time = 0;
- ethi->last_drop_context = NULL;
- scroll_off (ethi);
- }
- gtk_object_unref (GTK_OBJECT (ethi));
-}
-
-static void
-context_connect (ETableHeaderItem *ethi, GdkDragContext *context)
-{
- if (g_dataset_get_data (context, "e-table-header-item") == NULL) {
- gtk_object_ref (GTK_OBJECT (ethi));
- g_dataset_set_data_full (context, "e-table-header-item", ethi, context_destroyed);
- }
-}
-
-static gboolean
-ethi_drag_motion (GtkWidget *widget, GdkDragContext *context,
- gint x, gint y, guint time,
- ETableHeaderItem *ethi)
-{
- char *droptype, *headertype;
- guint direction = 0;
-
- gdk_drag_status (context, 0, time);
-
- droptype = gdk_atom_name (GPOINTER_TO_INT (context->targets->data));
- headertype = g_strdup_printf ("%s-%s", TARGET_ETABLE_COL_TYPE,
- ethi->dnd_code);
-
- if (strcmp (droptype, headertype) != 0) {
- g_free (headertype);
- return FALSE;
- }
-
- g_free (headertype);
-
- x -= widget->allocation.x;
- y -= widget->allocation.y;
-
- if (x < 20)
- direction |= ET_SCROLL_LEFT;
- if (x > widget->allocation.width - 20)
- direction |= ET_SCROLL_RIGHT;
-
- ethi->last_drop_x = x;
- ethi->last_drop_y = y;
- ethi->last_drop_time = time;
- ethi->last_drop_context = context;
- context_connect (ethi, context);
-
- do_drag_motion (ethi,
- context,
- x + GTK_LAYOUT(widget)->hadjustment->value,
- y + GTK_LAYOUT(widget)->vadjustment->value,
- time,
- FALSE);
-
- if (direction != 0)
- scroll_on (ethi, direction);
- else
- scroll_off (ethi);
-
- return TRUE;
-}
-
-static void
-ethi_drag_end (GtkWidget *canvas, GdkDragContext *context, ETableHeaderItem *ethi)
-{
- if (context->action == 0) {
- e_table_header_remove (ethi->eth, ethi->drag_col);
- gnome_canvas_item_request_update(GNOME_CANVAS_ITEM(ethi));
- }
- ethi_remove_drop_marker (ethi);
- ethi_remove_destroy_marker (ethi);
- ethi->drag_col = -1;
- scroll_off (ethi);
-}
-
-static void
-ethi_drag_data_received (GtkWidget *canvas,
- GdkDragContext *drag_context,
- gint x,
- gint y,
- GtkSelectionData *data,
- guint info,
- guint time,
- ETableHeaderItem *ethi)
-{
- int found = FALSE;
- int count;
- int column;
- int drop_col;
- int i;
-
- if (data->data) {
- count = e_table_header_count(ethi->eth);
- column = atoi(data->data);
- drop_col = ethi->drop_col;
- ethi->drop_col = -1;
-
- if (column >= 0) {
- for (i = 0; i < count; i++) {
- ETableCol *ecol = e_table_header_get_column (ethi->eth, i);
- if (ecol->col_idx == column) {
- e_table_header_move(ethi->eth, i, drop_col);
- found = TRUE;
- break;
- }
- }
- if (!found) {
- count = e_table_header_count(ethi->full_header);
- for (i = 0; i < count; i++) {
- ETableCol *ecol = e_table_header_get_column (ethi->full_header, i);
- if (ecol->col_idx == column) {
- e_table_header_add_column (ethi->eth, ecol, drop_col);
- break;
- }
- }
- }
- }
- }
- ethi_remove_drop_marker (ethi);
- gnome_canvas_item_request_update(GNOME_CANVAS_ITEM(ethi));
-}
-
-static void
-ethi_drag_data_get (GtkWidget *canvas,
- GdkDragContext *context,
- GtkSelectionData *selection_data,
- guint info,
- guint time,
- ETableHeaderItem *ethi)
-{
- if (ethi->drag_col != -1) {
- ETableCol *ecol = e_table_header_get_column (ethi->eth, ethi->drag_col);
-
- gchar *string = g_strdup_printf("%d", ecol->col_idx);
- gtk_selection_data_set(selection_data,
- GDK_SELECTION_TYPE_STRING,
- sizeof(string[0]),
- string,
- strlen(string));
- g_free(string);
- }
-}
-
-static gboolean
-ethi_drag_drop (GtkWidget *canvas,
- GdkDragContext *context,
- gint x,
- gint y,
- guint time,
- ETableHeaderItem *ethi)
-{
- gboolean successful = FALSE;
-
- if ((x >= 0) && (x <= (ethi->width)) &&
- (y >= 0) && (y <= (ethi->height))){
- int col;
-
- col = ethi_find_col_by_x_nearest (ethi, x);
-
- ethi_add_drop_marker (ethi, col, FALSE);
-
- ethi->drop_col = col;
-
- if (col != -1) {
- char *target = g_strdup_printf ("%s-%s", TARGET_ETABLE_COL_TYPE, ethi->dnd_code);
- gtk_drag_get_data (canvas, context, gdk_atom_intern(target, FALSE), time);
- g_free (target);
- }
- }
- gtk_drag_finish (context, successful, successful, time);
- scroll_off (ethi);
- return successful;
-}
-
-static void
-ethi_drag_leave (GtkWidget *widget, GdkDragContext *context, guint time, ETableHeaderItem *ethi)
-{
- ethi_remove_drop_marker (ethi);
- if (ethi->drag_col != -1)
- ethi_add_destroy_marker (ethi);
-}
-
-static void
-ethi_realize (GnomeCanvasItem *item)
-{
- ETableHeaderItem *ethi = E_TABLE_HEADER_ITEM (item);
- GdkWindow *window;
- GtkTargetEntry ethi_drop_types [] = {
- { TARGET_ETABLE_COL_TYPE, 0, TARGET_ETABLE_COL_HEADER },
- };
-
-
- if (GNOME_CANVAS_ITEM_CLASS (ethi_parent_class)-> realize)
- (*GNOME_CANVAS_ITEM_CLASS (ethi_parent_class)->realize)(item);
-
- window = GTK_WIDGET (item->canvas)->window;
-
- if (!ethi->font)
- ethi_font_set (ethi, GTK_WIDGET (item->canvas)->style->font);
-
- /*
- * Now, configure DnD
- */
- ethi_drop_types[0].target = g_strdup_printf("%s-%s", ethi_drop_types[0].target, ethi->dnd_code);
- gtk_drag_dest_set (GTK_WIDGET (item->canvas), 0,
- ethi_drop_types, ELEMENTS (ethi_drop_types),
- GDK_ACTION_MOVE);
- g_free(ethi_drop_types[0].target);
-
- /* Drop signals */
- 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_drop_id = gtk_signal_connect (GTK_OBJECT (item->canvas), "drag_drop",
- GTK_SIGNAL_FUNC (ethi_drag_drop), ethi);
- ethi->drag_data_received_id = gtk_signal_connect (GTK_OBJECT (item->canvas), "drag_data_received",
- GTK_SIGNAL_FUNC (ethi_drag_data_received), ethi);
-
- /* Drag signals */
- ethi->drag_end_id = gtk_signal_connect (GTK_OBJECT (item->canvas), "drag_end",
- GTK_SIGNAL_FUNC (ethi_drag_end), ethi);
- ethi->drag_data_get_id = gtk_signal_connect (GTK_OBJECT (item->canvas), "drag_data_get",
- GTK_SIGNAL_FUNC (ethi_drag_data_get), ethi);
-
-}
-
-static void
-ethi_unrealize (GnomeCanvasItem *item)
-{
- ETableHeaderItem *ethi = E_TABLE_HEADER_ITEM (item);
-
- gdk_font_unref (ethi->font);
-
- gtk_signal_disconnect (GTK_OBJECT (item->canvas), ethi->drag_motion_id);
- gtk_signal_disconnect (GTK_OBJECT (item->canvas), ethi->drag_leave_id);
- gtk_signal_disconnect (GTK_OBJECT (item->canvas), ethi->drag_drop_id);
- gtk_signal_disconnect (GTK_OBJECT (item->canvas), ethi->drag_data_received_id);
-
- gtk_signal_disconnect (GTK_OBJECT (item->canvas), ethi->drag_end_id);
- gtk_signal_disconnect (GTK_OBJECT (item->canvas), ethi->drag_data_get_id);
-
- gtk_drag_dest_unset (GTK_WIDGET (item->canvas));
-
- 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
-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;
- const int cols = e_table_header_count (ethi->eth);
- int x1, x2;
- int col;
- GHashTable *arrows = g_hash_table_new (NULL, NULL);
-
-
- if (ethi->sort_info) {
- int length = e_table_sort_info_grouping_get_count(ethi->sort_info);
- int i;
- for (i = 0; i < length; i++) {
- ETableSortColumn column = e_table_sort_info_grouping_get_nth(ethi->sort_info, i);
- g_hash_table_insert (arrows,
- GINT_TO_POINTER (column.column),
- GINT_TO_POINTER (column.ascending ?
- E_TABLE_COL_ARROW_UP :
- E_TABLE_COL_ARROW_DOWN));
- }
- length = e_table_sort_info_sorting_get_count(ethi->sort_info);
- for (i = 0; i < length; i++) {
- ETableSortColumn column = e_table_sort_info_sorting_get_nth(ethi->sort_info, i);
- g_hash_table_insert (arrows,
- GINT_TO_POINTER (column.column),
- GINT_TO_POINTER (column.ascending ?
- E_TABLE_COL_ARROW_UP :
- E_TABLE_COL_ARROW_DOWN));
- }
- }
-
- ethi->width = e_table_header_total_width (ethi->eth) + ethi->group_indent_width;
- x1 = x2 = 0;
- x2 += ethi->group_indent_width;
- for (col = 0; col < cols; col++, x1 = x2){
- ETableCol *ecol = e_table_header_get_column (ethi->eth, col);
- int col_width;
-
- col_width = ecol->width;
-
- x2 += col_width;
-
- if (x1 > (x + width))
- break;
-
- if (x2 < x)
- continue;
-
- if (x2 <= x1)
- continue;
-
- e_table_header_draw_button (drawable, ecol,
- GTK_WIDGET (canvas)->style, ethi->font,
- GTK_WIDGET_STATE (canvas),
- GTK_WIDGET (canvas),
- x1 - x, -y,
- width, height,
- x2 - x1, ethi->height,
- (ETableColArrow) g_hash_table_lookup (
- arrows, GINT_TO_POINTER (ecol->col_idx)));
- }
-
- g_hash_table_destroy (arrows);
-}
-
-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);
-
- if (col == 0)
- total += ethi->group_indent_width;
-
- 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)
-{
- int col;
- GtkWidget *canvas = GTK_WIDGET (GNOME_CANVAS_ITEM (ethi)->canvas);
- gboolean resizable = FALSE;
-
- /* We might be invoked before we are realized */
- if (!canvas->window)
- return;
-
- if (is_pointer_on_division (ethi, pos, NULL, &col)) {
- int last_col = ethi->eth->col_count - 1;
- ETableCol *ecol = e_table_header_get_column (ethi->eth, col);
-
- /* Last column is not resizable */
- if (ecol->resizable && col != last_col) {
- int c = col + 1;
-
- /* Column is not resizable if all columns after it
- are also not resizable */
- for (; c <= last_col; c++){
- ETableCol *ecol2;
-
- ecol2 = e_table_header_get_column (ethi->eth, c);
- if (ecol2->resizable) {
- resizable = TRUE;
- break;
- }
- }
- }
- }
-
- if (resizable)
- e_cursor_set (canvas->window, E_CURSOR_SIZE_X);
- else
- gdk_window_set_cursor (canvas->window, NULL);
- /* e_cursor_set (canvas->window, E_CURSOR_ARROW);*/
-}
-
-static void
-ethi_end_resize (ETableHeaderItem *ethi)
-{
- ethi->resize_col = -1;
- ethi->resize_guide = GINT_TO_POINTER (0);
-
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(ethi));
-}
-
-static gboolean
-ethi_maybe_start_drag (ETableHeaderItem *ethi, GdkEventMotion *event)
-{
- if (!ethi->maybe_drag)
- return FALSE;
-
- if (ethi->eth->col_count < 2) {
- ethi->maybe_drag = FALSE;
- 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;
- int group_indent = 0;
- GHashTable *arrows = g_hash_table_new (NULL, NULL);
-
- GtkTargetEntry ethi_drag_types [] = {
- { TARGET_ETABLE_COL_TYPE, 0, TARGET_ETABLE_COL_HEADER },
- };
-
- ethi->drag_col = ethi_find_col_by_x (ethi, event->motion.x);
-
- if (ethi->drag_col == -1)
- return;
-
- if (ethi->sort_info) {
- int length = e_table_sort_info_grouping_get_count(ethi->sort_info);
- int i;
- for (i = 0; i < length; i++) {
- ETableSortColumn column =
- e_table_sort_info_grouping_get_nth(
- ethi->sort_info, i);
- group_indent ++;
- g_hash_table_insert (
- arrows,
- GINT_TO_POINTER (column.column),
- GINT_TO_POINTER (column.ascending ?
- E_TABLE_COL_ARROW_UP :
- E_TABLE_COL_ARROW_DOWN));
- }
- length = e_table_sort_info_sorting_get_count(ethi->sort_info);
- for (i = 0; i < length; i++) {
- ETableSortColumn column =
- e_table_sort_info_sorting_get_nth (
- ethi->sort_info, i);
-
- g_hash_table_insert (
- arrows,
- GINT_TO_POINTER (column.column),
- GINT_TO_POINTER (column.ascending ?
- E_TABLE_COL_ARROW_UP :
- E_TABLE_COL_ARROW_DOWN));
- }
- }
-
- ethi_drag_types[0].target = g_strdup_printf(
- "%s-%s", ethi_drag_types[0].target, ethi->dnd_code);
- list = gtk_target_list_new (
- ethi_drag_types, ELEMENTS (ethi_drag_types));
- context = gtk_drag_begin (widget, list, GDK_ACTION_MOVE, 1, event);
- g_free(ethi_drag_types[0].target);
-
- ecol = e_table_header_get_column (ethi->eth, ethi->drag_col);
- col_width = ecol->width;
- pixmap = gdk_pixmap_new (widget->window, col_width, ethi->height, -1);
-
- e_table_header_draw_button (
- pixmap, ecol,
- widget->style, ethi->font,
- GTK_WIDGET_STATE (widget),
- widget,
- 0, 0,
- col_width, ethi->height,
- col_width, ethi->height,
- (ETableColArrow) g_hash_table_lookup (
- arrows, GINT_TO_POINTER (ecol->col_idx)));
- 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;
- g_hash_table_destroy (arrows);
-}
-
-typedef struct {
- ETableHeaderItem *ethi;
- int col;
-} EthiHeaderInfo;
-
-static void
-ethi_popup_sort_ascending(GtkWidget *widget, EthiHeaderInfo *info)
-{
- ETableCol *col;
- int model_col;
- int length;
- int i;
- int found = FALSE;
- ETableHeaderItem *ethi = info->ethi;
-
- col = e_table_header_get_column (ethi->eth, info->col);
- model_col = col->col_idx;
-
- length = e_table_sort_info_grouping_get_count(ethi->sort_info);
- for (i = 0; i < length; i++) {
- ETableSortColumn column = e_table_sort_info_grouping_get_nth (
- ethi->sort_info, i);
-
- if (model_col == column.column){
- column.ascending = 1;
- e_table_sort_info_grouping_set_nth (
- ethi->sort_info, i, column);
- found = 1;
- break;
- }
- }
- if (!found) {
- length = e_table_sort_info_sorting_get_count (
- ethi->sort_info);
- for (i = 0; i < length; i++) {
- ETableSortColumn column =
- e_table_sort_info_sorting_get_nth(
- ethi->sort_info, i);
- if (model_col == column.column){
- column.ascending = 1;
- e_table_sort_info_sorting_set_nth (
- ethi->sort_info, i, column);
- found = 1;
- break;
- }
- }
- }
- if (!found) {
- ETableSortColumn column;
- column.column = model_col;
- column.ascending = 1;
- length = e_table_sort_info_sorting_get_count(ethi->sort_info);
- if (length == 0)
- length++;
- e_table_sort_info_sorting_set_nth(ethi->sort_info, length - 1, column);
- }
-}
-
-static void
-ethi_popup_sort_descending(GtkWidget *widget, EthiHeaderInfo *info)
-{
- ETableCol *col;
- int model_col;
- int length;
- int i;
- int found = FALSE;
- ETableHeaderItem *ethi = info->ethi;
-
- col = e_table_header_get_column (ethi->eth, info->col);
- model_col = col->col_idx;
-
- length = e_table_sort_info_grouping_get_count(ethi->sort_info);
- for (i = 0; i < length; i++) {
- ETableSortColumn column = e_table_sort_info_grouping_get_nth(
- ethi->sort_info, i);
- if (model_col == column.column){
- column.ascending = 0;
- e_table_sort_info_grouping_set_nth(
- ethi->sort_info, i, column);
- found = 1;
- break;
- }
- }
- if (!found) {
- length = e_table_sort_info_sorting_get_count (ethi->sort_info);
- for (i = 0; i < length; i++) {
- ETableSortColumn column =
- e_table_sort_info_sorting_get_nth(
- ethi->sort_info, i);
-
- if (model_col == column.column){
- column.ascending = 0;
- e_table_sort_info_sorting_set_nth (
- ethi->sort_info, i, column);
- found = 1;
- break;
- }
- }
- }
- if (!found) {
- ETableSortColumn column;
- column.column = model_col;
- column.ascending = 0;
- length = e_table_sort_info_sorting_get_count (ethi->sort_info);
- if (length == 0)
- length++;
- e_table_sort_info_sorting_set_nth (
- ethi->sort_info, length - 1, column);
- }
-}
-
-static void
-ethi_popup_unsort(GtkWidget *widget, EthiHeaderInfo *info)
-{
- ETableHeaderItem *ethi = info->ethi;
-
- e_table_sort_info_grouping_truncate(ethi->sort_info, 0);
- e_table_sort_info_sorting_truncate(ethi->sort_info, 0);
-}
-
-static void
-ethi_popup_group_field(GtkWidget *widget, EthiHeaderInfo *info)
-{
- ETableCol *col;
- int model_col;
- ETableHeaderItem *ethi = info->ethi;
- ETableSortColumn column;
-
- col = e_table_header_get_column (ethi->eth, info->col);
- model_col = col->col_idx;
-
- column.column = model_col;
- column.ascending = 1;
- e_table_sort_info_grouping_set_nth(ethi->sort_info, 0, column);
- e_table_sort_info_grouping_truncate(ethi->sort_info, 1);
-}
-
-static void
-ethi_popup_group_box(GtkWidget *widget, EthiHeaderInfo *info)
-{
-}
-
-static void
-ethi_popup_remove_column(GtkWidget *widget, EthiHeaderInfo *info)
-{
- e_table_header_remove(info->ethi->eth, info->col);
-}
-
-static void
-ethi_popup_field_chooser(GtkWidget *widget, EthiHeaderInfo *info)
-{
- GtkWidget *etfcd = e_table_field_chooser_dialog_new();
- gtk_object_set(GTK_OBJECT(etfcd),
- "full_header", info->ethi->full_header,
- "header", info->ethi->eth,
- "dnd_code", info->ethi->dnd_code,
- NULL);
- gtk_widget_show(etfcd);
-}
-
-static void
-ethi_popup_alignment(GtkWidget *widget, EthiHeaderInfo *info)
-{
-}
-
-static void
-ethi_popup_best_fit(GtkWidget *widget, EthiHeaderInfo *info)
-{
- ETableHeaderItem *ethi = info->ethi;
- int width;
-
- gtk_signal_emit_by_name (GTK_OBJECT (ethi->eth),
- "request_width",
- info->col, &width);
- /* Add 10 to stop it from "..."ing */
- e_table_header_set_size (ethi->eth, info->col, width + 10);
-
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(ethi));
-
-}
-
-static void
-ethi_popup_format_columns(GtkWidget *widget, EthiHeaderInfo *info)
-{
-}
-
-static void
-config_destroyed (GtkObject *object, ETableHeaderItem *ethi)
-{
- ethi->config = NULL;
-}
-
-static void
-apply_changes (ETableConfig *config, ETableHeaderItem *ethi)
-{
- char *state = e_table_state_save_to_string (config->state);
-
- if (ethi->table)
- e_table_set_state (ethi->table, state);
- if (ethi->tree)
- e_tree_set_state (ethi->tree, state);
- g_free (state);
-}
-
-static void
-ethi_popup_customize_view(GtkWidget *widget, EthiHeaderInfo *info)
-{
- ETableHeaderItem *ethi = info->ethi;
- ETableState *state;
- ETableSpecification *spec;
-
- if (ethi->config)
- e_table_config_raise (E_TABLE_CONFIG (ethi->config));
- else {
- if (ethi->table) {
- state = e_table_get_state_object(ethi->table);
- spec = ethi->table->spec;
- } else if (ethi->tree) {
- state = e_tree_get_state_object(ethi->tree);
- spec = e_tree_get_spec (ethi->tree);
- } else
- return;
-
- ethi->config = e_table_config_new (
- _("Customize Current View"),
- spec, state);
- gtk_signal_connect (
- GTK_OBJECT (ethi->config), "destroy",
- GTK_SIGNAL_FUNC (config_destroyed), ethi);
- gtk_signal_connect (
- GTK_OBJECT (ethi->config), "changed",
- GTK_SIGNAL_FUNC (apply_changes), ethi);
- }
-}
-
-static void
-free_popup_info (GtkWidget *w, EthiHeaderInfo *info)
-{
- g_free (info);
-}
-
-/* Bit 1 is always disabled. */
-/* Bit 2 is disabled if not "sortable". */
-/* Bit 4 is disabled if we don't have a pointer to our table object. */
-static EPopupMenu ethi_context_menu [] = {
- E_POPUP_ITEM (N_("Sort Ascending"), GTK_SIGNAL_FUNC(ethi_popup_sort_ascending), 2),
- E_POPUP_ITEM (N_("Sort Descending"), GTK_SIGNAL_FUNC(ethi_popup_sort_descending), 2),
- E_POPUP_ITEM (N_("Unsort"), GTK_SIGNAL_FUNC(ethi_popup_unsort), 0),
- E_POPUP_SEPARATOR,
- E_POPUP_ITEM (N_("Group By This Field"), GTK_SIGNAL_FUNC(ethi_popup_group_field), 16),
- E_POPUP_ITEM (N_("Group By Box"), GTK_SIGNAL_FUNC(ethi_popup_group_box), 128),
- E_POPUP_SEPARATOR,
- E_POPUP_ITEM (N_("Remove This Column"), GTK_SIGNAL_FUNC(ethi_popup_remove_column), 8),
- E_POPUP_ITEM (N_("Add a Column..."), GTK_SIGNAL_FUNC(ethi_popup_field_chooser), 0),
- E_POPUP_SEPARATOR,
- E_POPUP_ITEM (N_("Alignment"), GTK_SIGNAL_FUNC(ethi_popup_alignment), 128),
- E_POPUP_ITEM (N_("Best Fit"), GTK_SIGNAL_FUNC(ethi_popup_best_fit), 2),
- E_POPUP_ITEM (N_("Format Columns..."), GTK_SIGNAL_FUNC(ethi_popup_format_columns), 128),
- E_POPUP_SEPARATOR,
- E_POPUP_ITEM (N_("Customize Current View..."), GTK_SIGNAL_FUNC(ethi_popup_customize_view), 4),
- E_POPUP_TERMINATOR
-};
-
-static void
-ethi_header_context_menu (ETableHeaderItem *ethi, GdkEventButton *event)
-{
- EthiHeaderInfo *info = g_new(EthiHeaderInfo, 1);
- ETableCol *col;
- GtkMenu *popup;
- info->ethi = ethi;
- info->col = ethi_find_col_by_x (ethi, event->x);
- col = e_table_header_get_column (ethi->eth, info->col);
-
- popup = e_popup_menu_create (ethi_context_menu,
- 1 +
- (col->sortable ? 0 : 2) +
- ((ethi->table || ethi->tree) ? 0 : 4) +
- ((e_table_header_count (ethi->eth) > 1) ? 0 : 8),
- ((e_table_sort_info_get_can_group (ethi->sort_info)) ? 0 : 16) +
- 128, info);
- gtk_signal_connect (GTK_OBJECT (popup), "selection-done",
- GTK_SIGNAL_FUNC (free_popup_info), info);
- e_popup_menu (popup, (GdkEvent *) event);
-}
-
-static void
-ethi_button_pressed (ETableHeaderItem *ethi, GdkEventButton *event)
-{
- gtk_signal_emit (GTK_OBJECT (ethi),
- ethi_signals [BUTTON_PRESSED], event);
-}
-
-static void
-ethi_change_sort_state (ETableHeaderItem *ethi, gdouble x)
-{
- ETableCol *col;
- int model_col;
- int length;
- int i;
- int found = FALSE;
-
- col = e_table_header_get_column (ethi->eth, ethi_find_col_by_x (ethi, x));
-
- if (col == NULL)
- return;
-
- model_col = col->col_idx;
-
- length = e_table_sort_info_grouping_get_count(ethi->sort_info);
- for (i = 0; i < length; i++) {
- ETableSortColumn column = e_table_sort_info_grouping_get_nth(ethi->sort_info, i);
- if (model_col == column.column){
- int ascending = column.ascending;
- ascending = ! ascending;
- column.ascending = ascending;
- e_table_sort_info_grouping_set_nth(ethi->sort_info, i, column);
- found = 1;
- break;
- }
- }
-
- if (!col->sortable)
- return;
-
- if (!found) {
- length = e_table_sort_info_sorting_get_count(ethi->sort_info);
- for (i = 0; i < length; i++) {
- ETableSortColumn column = e_table_sort_info_sorting_get_nth(ethi->sort_info, i);
-
- if (model_col == column.column){
- int ascending = column.ascending;
-
- if (ascending == 0){
- /*
- * This means the user has clicked twice
- * already, lets kill sorting now.
- */
- e_table_sort_info_sorting_truncate (ethi->sort_info, i);
- } else {
- ascending = !ascending;
- column.ascending = ascending;
- e_table_sort_info_sorting_set_nth(ethi->sort_info, i, column);
- }
- found = 1;
- break;
- }
- }
- }
-
- if (!found) {
- ETableSortColumn column;
- column.column = model_col;
- column.ascending = 1;
- length = e_table_sort_info_sorting_get_count(ethi->sort_info);
- if (length == 0)
- length++;
- e_table_sort_info_sorting_set_nth(ethi->sort_info, length - 1, column);
- }
-}
-
-/*
- * 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;
- int was_maybe_drag = 0;
-
- 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:
- gdk_window_set_cursor (GTK_WIDGET (canvas)->window, NULL);
- /* 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;
-
- e_table_header_set_size (ethi->eth, ethi->resize_col, new_width);
-
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(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:
- if (e->button.button > 3)
- return FALSE;
-
- convert (canvas, e->button.x, e->button.y, &x, &y);
-
- if (is_pointer_on_division (ethi, x, &start, &col) && e->button.button == 1){
- 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->resizable)
- break;
- ethi->resize_col = col;
- 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;
- } else if (e->button.button == 3){
- ethi_header_context_menu (ethi, &e->button);
- } else
- ethi_button_pressed (ethi, &e->button);
- }
- break;
-
- case GDK_2BUTTON_PRESS:
- if (!resizing)
- break;
-
- if (e->button.button != 1)
- break;
- else {
- int width = 0;
- gtk_signal_emit_by_name (GTK_OBJECT (ethi->eth),
- "request_width",
- (int)ethi->resize_col, &width);
- /* Add 10 to stop it from "..."ing */
- e_table_header_set_size (ethi->eth, ethi->resize_col, width + 10);
-
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(ethi));
- ethi->maybe_drag = FALSE;
- }
- break;
-
- case GDK_BUTTON_RELEASE: {
- gboolean needs_ungrab = FALSE;
-
- was_maybe_drag = ethi->maybe_drag;
-
- ethi->maybe_drag = FALSE;
-
- if (ethi->resize_col != -1){
- needs_ungrab = (ethi->resize_guide != NULL);
- ethi_end_resize (ethi);
- } else if (was_maybe_drag && ethi->sort_info)
- ethi_change_sort_state (ethi, e->button.x);
-
- if (needs_ungrab)
- gnome_canvas_item_ungrab (item, e->button.time);
-
- 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;
- object_class->get_arg = ethi_get_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_OBJECT,
- GTK_ARG_WRITABLE, ARG_TABLE_HEADER);
- gtk_object_add_arg_type ("ETableHeaderItem::full_header", GTK_TYPE_OBJECT,
- GTK_ARG_READWRITE, ARG_FULL_HEADER);
- gtk_object_add_arg_type ("ETableHeaderItem::dnd_code", GTK_TYPE_STRING,
- GTK_ARG_READWRITE, ARG_DND_CODE);
- gtk_object_add_arg_type ("ETableHeaderItem::fontset", GTK_TYPE_STRING,
- GTK_ARG_WRITABLE, ARG_TABLE_FONTSET);
- gtk_object_add_arg_type ("ETableHeaderItem::sort_info", GTK_TYPE_OBJECT,
- GTK_ARG_WRITABLE, ARG_SORT_INFO);
- gtk_object_add_arg_type ("ETableHeaderItem::table", GTK_TYPE_OBJECT,
- GTK_ARG_WRITABLE, ARG_TABLE);
- gtk_object_add_arg_type ("ETableHeaderItem::tree", E_TREE_TYPE,
- GTK_ARG_WRITABLE, ARG_TREE);
-
- /*
- * 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);
-
- ethi_signals [BUTTON_PRESSED] =
- gtk_signal_new ("button_pressed",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETableHeaderItemClass, button_pressed),
- gtk_marshal_NONE__POINTER,
- GTK_TYPE_NONE, 1, GTK_TYPE_GDK_EVENT);
-
- E_OBJECT_CLASS_ADD_SIGNALS (object_class, ethi_signals, LAST_SIGNAL);
-}
-
-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;
-
- ethi->sort_info = NULL;
-
- ethi->sort_info_changed_id = 0;
- ethi->group_info_changed_id = 0;
-
- ethi->group_indent_width = 0;
- ethi->table = NULL;
- ethi->tree = NULL;
-}
-
-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 7371a20540..0000000000
--- a/widgets/table/e-table-header-item.h
+++ /dev/null
@@ -1,115 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-header-item.h
- * Copyright 1999, 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- * Miguel de Icaza (miguel@gnu.org)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_TABLE_HEADER_ITEM_H_
-#define _E_TABLE_HEADER_ITEM_H_
-
-#include <gal/e-table/e-table.h>
-#include <gal/e-table/e-tree.h>
-#include <libgnomeui/gnome-canvas.h>
-#include <gnome-xml/tree.h>
-#include <gal/e-table/e-table-header.h>
-#include <gal/e-table/e-table-sort-info.h>
-#include <libgnome/gnome-defs.h>
-
-BEGIN_GNOME_DECLS
-
-#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;
-
- GdkCursor *change_cursor;
-
- short height, width;
- GdkFont *font;
-
- /*
- * Used during resizing; Could be shorts
- */
- int resize_col;
- int resize_start_pos;
- int resize_min_width;
-
- GtkObject *resize_guide;
-
- int group_indent_width;
-
- /*
- * 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, drop_col, drag_mark;
- guint drag_motion_id, drag_end_id, drag_leave_id, drag_drop_id, drag_data_received_id, drag_data_get_id;
- guint sort_info_changed_id, group_info_changed_id;
- GnomeCanvasItem *remove_item;
- GdkBitmap *stipple;
-
- gchar *dnd_code;
-
- /*
- * For column sorting info
- */
- ETableSortInfo *sort_info;
-
- guint scroll_direction : 4;
- int last_drop_x;
- int last_drop_y;
- int last_drop_time;
- GdkDragContext *last_drop_context;
- int scroll_idle_id;
-
- /* For adding fields. */
- ETableHeader *full_header;
- ETable *table;
- ETree *tree;
- void *config;
-} ETableHeaderItem;
-
-typedef struct {
- GnomeCanvasItemClass parent_class;
-
- /*
- * signals
- */
- void (*button_pressed) (ETableHeaderItem *ethi, GdkEventButton *button);
-} ETableHeaderItemClass;
-
-GtkType e_table_header_item_get_type (void);
-
-END_GNOME_DECLS
-
-#endif /* _E_TABLE_HEADER_ITEM_H_ */
diff --git a/widgets/table/e-table-header-utils.c b/widgets/table/e-table-header-utils.c
deleted file mode 100644
index d5000a9800..0000000000
--- a/widgets/table/e-table-header-utils.c
+++ /dev/null
@@ -1,467 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-header-utils.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- * Miguel de Icaza <miguel@ximian.com>
- * Federico Mena-Quintero <federico@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h> /* strlen() */
-#include <glib.h>
-#include "e-table-defines.h"
-#include "e-table-header-utils.h"
-
-
-
-/**
- * e_table_header_compute_height:
- * @ecol: Table column description.
- * @style: Style for the button's bevel.
- * @font: Font for the button's text, or NULL if no font is available.
- *
- * Computes the minimum height required for a table header button.
- *
- * Return value: The height of the button, in pixels.
- **/
-double
-e_table_header_compute_height (ETableCol *ecol, GtkStyle *style, GdkFont *font)
-{
- int ythick;
- int height;
-
- g_return_val_if_fail (ecol != NULL, -1);
- g_return_val_if_fail (E_IS_TABLE_COL (ecol), -1);
- g_return_val_if_fail (style != NULL, -1);
-
- ythick = style->klass->ythickness;
-
- if (font)
- height = font->ascent + font->descent;
- else
- height = 16; /* FIXME: default? */
-
- if (ecol->is_pixbuf) {
- g_assert (ecol->pixbuf != NULL);
- height = MAX (height, gdk_pixbuf_get_height (ecol->pixbuf));
- }
-
- height = MAX (height, MIN_ARROW_SIZE);
-
- height += 2 * (ythick + HEADER_PADDING);
-
- return height;
-}
-
-double
-e_table_header_width_extras (GtkStyle *style)
-{
- g_return_val_if_fail (style != NULL, -1);
-
- return 2 * (style->klass->xthickness + HEADER_PADDING);
-}
-
-/* Creates a pixmap that is a composite of a background color and the upper-left
- * corner rectangle of a pixbuf.
- */
-static GdkPixmap *
-make_composite_pixmap (GdkDrawable *drawable, GdkGC *gc,
- GdkPixbuf *pixbuf, GdkColor *bg, int width, int height,
- int dither_xofs, int dither_yofs)
-{
- int pwidth, pheight;
- GdkPixmap *pixmap;
- GdkPixbuf *tmp;
- int color;
-
- pwidth = gdk_pixbuf_get_width (pixbuf);
- pheight = gdk_pixbuf_get_height (pixbuf);
- g_assert (width <= pwidth && height <= pheight);
-
- color = ((bg->red & 0xff00) << 8) | (bg->green & 0xff00) | ((bg->blue & 0xff00) >> 8);
-
- if (width >= pwidth && height >= pheight) {
- tmp = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, width, height);
- if (!tmp)
- return NULL;
-
- gdk_pixbuf_composite_color (pixbuf, tmp,
- 0, 0,
- width, height,
- 0, 0,
- 1.0, 1.0,
- GDK_INTERP_NEAREST,
- 255,
- 0, 0,
- 16,
- color, color);
- } else {
- int x, y, rowstride;
- GdkPixbuf *fade;
- guchar *pixels;
-
- /* Do a nice fade of the pixbuf down and to the right */
-
- fade = gdk_pixbuf_new (GDK_COLORSPACE_RGB, TRUE, 8, width, height);
- if (!fade)
- return NULL;
-
- gdk_pixbuf_copy_area (pixbuf,
- 0, 0,
- width, height,
- fade,
- 0, 0);
-
- rowstride = gdk_pixbuf_get_rowstride (fade);
- pixels = gdk_pixbuf_get_pixels (fade);
-
- for (y = 0; y < height; y++) {
- guchar *p;
- int yfactor;
-
- p = pixels + y * rowstride;
-
- if (height < pheight)
- yfactor = height - y;
- else
- yfactor = height;
-
- for (x = 0; x < width; x++) {
- int xfactor;
-
- if (width < pwidth)
- xfactor = width - x;
- else
- xfactor = width;
-
- p[3] = ((int) p[3] * xfactor * yfactor / (width * height));
- p += 4;
- }
- }
-
- tmp = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8, width, height);
- if (!tmp) {
- gdk_pixbuf_unref (fade);
- return NULL;
- }
-
- gdk_pixbuf_composite_color (fade, tmp,
- 0, 0,
- width, height,
- 0, 0,
- 1.0, 1.0,
- GDK_INTERP_NEAREST,
- 255,
- 0, 0,
- 16,
- color, color);
-
- gdk_pixbuf_unref (fade);
- }
-
- pixmap = gdk_pixmap_new (drawable, width, height, gdk_rgb_get_visual ()->depth);
- gdk_draw_rgb_image_dithalign (pixmap, gc,
- 0, 0,
- width, height,
- GDK_RGB_DITHER_NORMAL,
- gdk_pixbuf_get_pixels (tmp),
- gdk_pixbuf_get_rowstride (tmp),
- dither_xofs, dither_yofs);
- gdk_pixbuf_unref (tmp);
-
- return pixmap;
-}
-
-static GtkWidget *g_label;
-
-/**
- * e_table_header_draw_button:
- * @drawable: Destination drawable.
- * @ecol: Table column for the header information.
- * @style: Style to use for drawing the button.
- * @font: Font for the button's text.
- * @state: State of the table widget.
- * @widget: The table widget.
- * @gc: GC to use for drawing.
- * @x: Leftmost coordinate of the button.
- * @y: Topmost coordinate of the button.
- * @width: Width of the region to draw.
- * @height: Height of the region to draw.
- * @button_width: Width for the complete button.
- * @button_height: Height for the complete button.
- * @arrow: Arrow type to use as a sort indicator.
- *
- * Draws a button suitable for a table header.
- **/
-void
-e_table_header_draw_button (GdkDrawable *drawable, ETableCol *ecol,
- GtkStyle *style, GdkFont *font, GtkStateType state,
- GtkWidget *widget,
- int x, int y, int width, int height,
- int button_width, int button_height,
- ETableColArrow arrow)
-{
- int xthick, ythick;
- int inner_x, inner_y;
- int inner_width, inner_height;
- GdkGC *gc;
-
- g_return_if_fail (drawable != NULL);
- g_return_if_fail (ecol != NULL);
- g_return_if_fail (E_IS_TABLE_COL (ecol));
- g_return_if_fail (style != NULL);
- g_return_if_fail (font != NULL);
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GTK_IS_WIDGET (widget));
- g_return_if_fail (button_width > 0 && button_height > 0);
-
- if (g_label == NULL) {
- GtkWidget *button = gtk_button_new_with_label("Hi");
- GtkWidget *window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
- g_label = GTK_BIN(button)->child;
- gtk_container_add (GTK_CONTAINER (window), button);
- gtk_widget_ensure_style (window);
- gtk_widget_ensure_style (button);
- gtk_widget_ensure_style (g_label);
- }
-
- gc = g_label->style->fg_gc[GTK_STATE_NORMAL];
-
- xthick = style->klass->xthickness;
- ythick = style->klass->ythickness;
-
- /* Button bevel */
-
- gtk_paint_box (style, drawable, state, GTK_SHADOW_OUT,
- NULL, widget, "button",
- x, y, button_width, button_height);
-
- /* Inside area */
-
- inner_width = button_width - 2 * (xthick + HEADER_PADDING);
- inner_height = button_height - 2 * (ythick + HEADER_PADDING);
-
- if (inner_width < 1 || inner_height < 1)
- return; /* nothing fits */
-
- inner_x = x + xthick + HEADER_PADDING;
- inner_y = y + ythick + HEADER_PADDING;
-
- /* Arrow */
-
- switch (arrow) {
- case E_TABLE_COL_ARROW_NONE:
- break;
-
- case E_TABLE_COL_ARROW_UP:
- case E_TABLE_COL_ARROW_DOWN: {
- int arrow_width, arrow_height;
-
- arrow_width = MIN (MIN_ARROW_SIZE, inner_width);
- arrow_height = MIN (MIN_ARROW_SIZE, inner_height);
-
- gtk_paint_arrow (style, drawable, state,
- GTK_SHADOW_IN, NULL, widget, "header",
- (arrow == E_TABLE_COL_ARROW_UP) ? GTK_ARROW_UP : GTK_ARROW_DOWN,
- TRUE,
- inner_x + inner_width - arrow_width,
- inner_y + (inner_height - arrow_height) / 2,
- arrow_width, arrow_height);
-
- inner_width -= arrow_width + HEADER_PADDING;
- break;
- }
-
- default:
- g_assert_not_reached ();
- return;
- }
-
- if (inner_width < 1)
- return; /* nothing else fits */
-
- /* Pixbuf or label */
-
- if (ecol->is_pixbuf) {
- int pwidth, pheight;
- int clip_width, clip_height;
- int xpos;
- GdkPixmap *pixmap;
-
- g_assert (ecol->pixbuf != NULL);
-
- pwidth = gdk_pixbuf_get_width (ecol->pixbuf);
- pheight = gdk_pixbuf_get_height (ecol->pixbuf);
-
- clip_width = MIN (pwidth, inner_width);
- clip_height = MIN (pheight, inner_height);
-
- xpos = inner_x;
-
- if (inner_width - pwidth > 11) {
- int rbearing;
- int width;
- int ypos;
-
- gdk_string_extents (font, ecol->text, NULL, &rbearing, &width, NULL, NULL);
- if (rbearing < inner_width - (pwidth + 1)) {
- xpos = inner_x + (inner_width - width - (pwidth + 1)) / 2;
- }
-
- ypos = inner_y + (inner_height - font->ascent - font->descent) / 2 + font->ascent;
-
- e_table_draw_elided_string (drawable, font, gc,
- xpos + pwidth + 1, ypos,
- ecol->text, inner_width - (xpos - inner_x), FALSE);
- }
-
- pixmap = make_composite_pixmap (drawable, gc,
- ecol->pixbuf, &style->bg[state],
- clip_width, clip_height,
- xpos,
- inner_y + (inner_height - clip_height) / 2);
- if (pixmap) {
- gdk_draw_pixmap (drawable, gc, pixmap,
- 0, 0,
- xpos,
- inner_y + (inner_height - clip_height) / 2,
- clip_width, clip_height);
- gdk_pixmap_unref (pixmap);
- }
- } else {
- int ypos;
-
- ypos = inner_y + (inner_height - font->ascent - font->descent) / 2 + font->ascent;
-
- e_table_draw_elided_string (drawable, font, gc,
- inner_x, ypos,
- ecol->text, inner_width, TRUE);
- }
-}
-
-/* Computes the length of a string that needs to be trimmed for elision */
-static int
-compute_elision_length (GdkFont *font, const char *str, int max_width)
-{
- int len;
- int l = 0, left, right;
- int rbearing;
-
- len = strlen (str);
-
- if (len <= 0)
- return 0;
-
- left = 0;
- right = len;
-
- while (left < right) {
- l = (left + right) / 2;
- gdk_text_extents (font, str, l, NULL, &rbearing, NULL, NULL, NULL);
-
- if (rbearing < max_width)
- left = l + 1;
- else if (rbearing > max_width)
- right = l;
- else
- return l;
- }
-
- if (rbearing > max_width)
- return MAX (0, l - 1);
- else
- return l;
-}
-
-/* Default width of the elision arrow in pixels */
-#define ARROW_WIDTH 4
-
-/**
- * e_table_draw_elided_string:
- * @drawable: Destination drawable.
- * @font: Font for the text.
- * @gc: GC to use for drawing.
- * @x: X insertion point for the string.
- * @y: Y insertion point for the string's baseline.
- * @str: String to draw.
- * @max_width: Maximum width in which the string must fit.
- * @center: Whether to center the string in the available area if it does fit.
- *
- * Draws a string, possibly trimming it so that it fits inside the specified
- * maximum width. If it does not fit, an elision indicator is drawn after the
- * last character that does fit.
- **/
-void
-e_table_draw_elided_string (GdkDrawable *drawable, GdkFont *font, GdkGC *gc,
- int x, int y, const char *str, int max_width, gboolean center)
-{
- int rbearing;
- int width;
-
- g_return_if_fail (drawable != NULL);
- g_return_if_fail (font != NULL);
- g_return_if_fail (gc != NULL);
- g_return_if_fail (str != NULL);
- g_return_if_fail (max_width >= 0);
-
- gdk_string_extents (font, str, NULL, &rbearing, &width, NULL, NULL);
-
- if (rbearing <= max_width) {
- int xpos;
-
- if (center)
- xpos = x + (max_width - width) / 2;
- else
- xpos = x;
-
- gdk_draw_string (drawable, font, gc, xpos, y, str);
- } else {
- int arrow_width;
- int len;
- int i;
-
- if (max_width < ARROW_WIDTH + 1)
- arrow_width = max_width - 1;
- else
- arrow_width = ARROW_WIDTH;
-
- len = compute_elision_length (font, str, max_width - arrow_width - 1);
- gdk_draw_text (drawable, font, gc, x, y, str, len);
-
- gdk_text_extents (font, str, len, NULL, &rbearing, NULL, NULL, NULL);
-
- y -= font->ascent;
-
- for (i = 0; i < arrow_width; i++) {
- int h;
-
- h = 2 * i + 1;
-
- gdk_draw_line (drawable, gc,
- x + rbearing + arrow_width - i,
- y + (font->ascent + font->descent - h) / 2,
- x + rbearing + arrow_width - i,
- y + (font->ascent + font->descent - h) / 2 + h - 1);
- }
- }
-}
diff --git a/widgets/table/e-table-header-utils.h b/widgets/table/e-table-header-utils.h
deleted file mode 100644
index 4d14652f48..0000000000
--- a/widgets/table/e-table-header-utils.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-header-utils.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- * Miguel de Icaza <miguel@ximian.com>
- * Federico Mena-Quintero <federico@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef E_TABLE_HEADER_UTILS_H
-#define E_TABLE_HEADER_UTILS_H
-
-#include <gal/e-table/e-table-col.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-double e_table_header_compute_height (ETableCol *ecol,
- GtkStyle *style,
- GdkFont *font);
-double e_table_header_width_extras (GtkStyle *style);
-void e_table_header_draw_button (GdkDrawable *drawable,
- ETableCol *ecol,
- GtkStyle *style,
- GdkFont *font,
- GtkStateType state,
- GtkWidget *widget,
- int x,
- int y,
- int width,
- int height,
- int button_width,
- int button_height,
- ETableColArrow arrow);
-void e_table_draw_elided_string (GdkDrawable *drawable,
- GdkFont *font,
- GdkGC *gc,
- int x,
- int y,
- const char *str,
- int max_width,
- gboolean center);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif
diff --git a/widgets/table/e-table-header.c b/widgets/table/e-table-header.c
deleted file mode 100644
index e5eda9fd42..0000000000
--- a/widgets/table/e-table-header.c
+++ /dev/null
@@ -1,931 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-header.c
- * Copyright 1999, 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- * Miguel de Icaza <miguel@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <string.h>
-#include <gtk/gtkobject.h>
-#include <gtk/gtksignal.h>
-#include "e-table-header.h"
-#include "e-table-defines.h"
-#include "gal/util/e-util.h"
-
-/* The arguments we take */
-enum {
- ARG_0,
- ARG_SORT_INFO,
- ARG_WIDTH,
- ARG_WIDTH_EXTRAS,
-};
-
-enum {
- STRUCTURE_CHANGE,
- DIMENSION_CHANGE,
- EXPANSION_CHANGE,
- REQUEST_WIDTH,
- LAST_SIGNAL
-};
-
-static void eth_set_size (ETableHeader *eth, int idx, int size);
-static void eth_calc_widths (ETableHeader *eth);
-
-static guint eth_signals [LAST_SIGNAL] = { 0, };
-
-static GtkObjectClass *e_table_header_parent_class;
-
-struct two_ints {
- int column;
- int width;
-};
-
-static void
-eth_set_width (ETableHeader *eth, int width)
-{
- eth->width = width;
-}
-
-static void
-dequeue (ETableHeader *eth, int *column, int *width)
-{
- GSList *head;
- struct two_ints *store;
- head = eth->change_queue;
- eth->change_queue = eth->change_queue->next;
- if (!eth->change_queue)
- eth->change_tail = NULL;
- store = head->data;
- g_slist_free_1(head);
- if (column)
- *column = store->column;
- if (width)
- *width = store->width;
- g_free(store);
-}
-
-static gboolean
-dequeue_idle (ETableHeader *eth)
-{
- int column, width;
-
- dequeue (eth, &column, &width);
- while (eth->change_queue && ((struct two_ints *) eth->change_queue->data)->column == column)
- dequeue (eth, &column, &width);
-
- if (column == -1)
- eth_set_width (eth, width);
- else if (column < eth->col_count)
- eth_set_size (eth, column, width);
- if (eth->change_queue)
- return TRUE;
- else {
- eth_calc_widths (eth);
- eth->idle = 0;
- return FALSE;
- }
-}
-
-static void
-enqueue (ETableHeader *eth, int column, int width)
-{
- struct two_ints *store;
- store = g_new(struct two_ints, 1);
- store->column = column;
- store->width = width;
-
- eth->change_tail = g_slist_last(g_slist_append(eth->change_tail, store));
- if (!eth->change_queue)
- eth->change_queue = eth->change_tail;
-
- if (!eth->idle) {
- eth->idle = g_idle_add_full(G_PRIORITY_LOW, (GSourceFunc) dequeue_idle, eth, NULL);
- }
-}
-
-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));
-
- enqueue (eth, idx, size);
-}
-
-static void
-eth_do_remove (ETableHeader *eth, int idx, gboolean do_unref)
-{
- if (do_unref)
- gtk_object_unref (GTK_OBJECT (eth->columns [idx]));
-
- memmove (&eth->columns [idx], &eth->columns [idx+1],
- sizeof (ETableCol *) * (eth->col_count - idx - 1));
- eth->col_count--;
-}
-
-static void
-eth_destroy (GtkObject *object)
-{
- ETableHeader *eth = E_TABLE_HEADER (object);
- const int cols = eth->col_count;
- int i;
-
- if (eth->sort_info) {
- if (eth->sort_info_group_change_id)
- gtk_signal_disconnect(GTK_OBJECT(eth->sort_info),
- eth->sort_info_group_change_id);
- gtk_object_unref(GTK_OBJECT(eth->sort_info));
- }
-
- if (eth->idle)
- g_source_remove(eth->idle);
- g_slist_foreach(eth->change_queue, (GFunc) g_free, NULL);
- g_slist_free(eth->change_queue);
-
- /*
- * Destroy columns
- */
- for (i = cols - 1; i >= 0; i--){
- eth_do_remove (eth, i, TRUE);
- }
- g_free (eth->columns);
-
- if (e_table_header_parent_class->destroy)
- e_table_header_parent_class->destroy (object);
-}
-
-static void
-eth_group_info_changed(ETableSortInfo *info, ETableHeader *eth)
-{
- enqueue(eth, -1, eth->nominal_width);
-}
-
-static void
-eth_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- ETableHeader *eth = E_TABLE_HEADER (object);
-
- switch (arg_id) {
- case ARG_WIDTH:
- eth->nominal_width = GTK_VALUE_DOUBLE (*arg);
- enqueue(eth, -1, GTK_VALUE_DOUBLE (*arg));
- break;
- case ARG_WIDTH_EXTRAS:
- eth->width_extras = GTK_VALUE_DOUBLE (*arg);
- enqueue(eth, -1, eth->nominal_width);
- break;
- case ARG_SORT_INFO:
- if (eth->sort_info) {
- if (eth->sort_info_group_change_id)
- gtk_signal_disconnect(GTK_OBJECT(eth->sort_info), eth->sort_info_group_change_id);
- gtk_object_unref(GTK_OBJECT(eth->sort_info));
- }
- eth->sort_info = E_TABLE_SORT_INFO(GTK_VALUE_OBJECT (*arg));
- if (eth->sort_info) {
- gtk_object_ref(GTK_OBJECT(eth->sort_info));
- eth->sort_info_group_change_id
- = gtk_signal_connect(GTK_OBJECT(eth->sort_info), "group_info_changed",
- GTK_SIGNAL_FUNC(eth_group_info_changed), eth);
- }
- enqueue(eth, -1, eth->nominal_width);
- break;
- default:
- break;
- }
-}
-
-static void
-eth_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- ETableHeader *eth = E_TABLE_HEADER (object);
-
- switch (arg_id) {
- case ARG_SORT_INFO:
- GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(eth->sort_info);
- break;
- case ARG_WIDTH:
- GTK_VALUE_DOUBLE (*arg) = eth->nominal_width;
- break;
- case ARG_WIDTH_EXTRAS:
- GTK_VALUE_DOUBLE (*arg) = eth->width_extras;
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-static void
-e_table_header_class_init (GtkObjectClass *object_class)
-{
- ETableHeaderClass *klass = E_TABLE_HEADER_CLASS (object_class);
-
- object_class->destroy = eth_destroy;
- object_class->set_arg = eth_set_arg;
- object_class->get_arg = eth_get_arg;
-
- e_table_header_parent_class = (gtk_type_class (gtk_object_get_type ()));
-
- gtk_object_add_arg_type ("ETableHeader::width", GTK_TYPE_DOUBLE,
- GTK_ARG_READWRITE, ARG_WIDTH);
- gtk_object_add_arg_type ("ETableHeader::width_extras", GTK_TYPE_DOUBLE,
- GTK_ARG_READWRITE, ARG_WIDTH_EXTRAS);
- gtk_object_add_arg_type ("ETableHeader::sort_info", GTK_TYPE_OBJECT,
- GTK_ARG_READWRITE, ARG_SORT_INFO);
-
- eth_signals [STRUCTURE_CHANGE] =
- gtk_signal_new ("structure_change",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- 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,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETableHeaderClass, dimension_change),
- gtk_marshal_NONE__INT,
- GTK_TYPE_NONE, 1, GTK_TYPE_INT);
- eth_signals [EXPANSION_CHANGE] =
- gtk_signal_new ("expansion_change",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETableHeaderClass, expansion_change),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
- eth_signals [REQUEST_WIDTH] =
- gtk_signal_new ("request_width",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETableHeaderClass, request_width),
- gtk_marshal_INT__INT,
- GTK_TYPE_INT, 1, GTK_TYPE_INT);
-
- E_OBJECT_CLASS_ADD_SIGNALS (object_class, eth_signals, LAST_SIGNAL);
-
- klass->structure_change = NULL;
- klass->dimension_change = NULL;
- klass->expansion_change = NULL;
- klass->request_width = NULL;
-}
-
-static void
-e_table_header_init (ETableHeader *eth)
-{
- eth->col_count = 0;
- eth->width = 0;
-
- eth->sort_info = NULL;
- eth->sort_info_group_change_id = 0;
-
- eth->columns = NULL;
-
- eth->change_queue = NULL;
- eth->change_tail = NULL;
-
- eth->width_extras = 0;
-}
-
-/**
- * e_table_header_new:
- *
- * Returns: A new @ETableHeader object.
- */
-ETableHeader *
-e_table_header_new (void)
-{
- ETableHeader *eth;
-
- eth = gtk_type_new (e_table_header_get_type ());
-
- return eth;
-}
-
-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;
- }
-}
-
-static void
-eth_do_insert (ETableHeader *eth, int pos, ETableCol *val)
-{
- memmove (&eth->columns [pos+1], &eth->columns [pos],
- sizeof (ETableCol *) * (eth->col_count - pos));
- eth->columns [pos] = val;
- eth->col_count ++;
-}
-
-/**
- * e_table_header_add_column:
- * @eth: the table header to add the column to.
- * @tc: the ETableCol definition
- * @pos: position where the ETableCol will go.
- *
- * This function adds the @tc ETableCol definition into the @eth ETableHeader
- * at position @pos. This is the way you add new ETableCols to the
- * ETableHeader. The header will assume ownership of the @tc; you should not
- * unref it after you add it.
- *
- * This function will emit the "structure_change" signal on the @eth object.
- * The ETableCol is assumed
- */
-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);
-
- enqueue(eth, -1, eth->nominal_width);
- gtk_signal_emit (GTK_OBJECT (eth), eth_signals [STRUCTURE_CHANGE]);
-}
-
-/**
- * e_table_header_get_column:
- * @eth: the ETableHeader to query
- * @column: the column inside the @eth.
- *
- * Returns: The ETableCol at @column in the @eth object
- */
-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];
-}
-
-/**
- * e_table_header_get_column_by_col_id:
- * @eth: the ETableHeader to query
- * @col_id: the col_id to search for.
- *
- * Returns: The ETableCol with col_idx = @col_idx in the @eth object
- */
-ETableCol *
-e_table_header_get_column_by_col_idx (ETableHeader *eth, int col_idx)
-{
- int i;
- g_return_val_if_fail (eth != NULL, NULL);
- g_return_val_if_fail (E_IS_TABLE_HEADER (eth), NULL);
-
- for (i = 0; i < eth->col_count; i++) {
- if (eth->columns[i]->col_idx == col_idx) {
- return eth->columns [i];
- }
- }
-
- return NULL;
-}
-
-/**
- * e_table_header_count:
- * @eth: the ETableHeader to query
- *
- * Returns: the number of columns in this ETableHeader.
- */
-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;
-}
-
-/**
- * e_table_header_index:
- * @eth: the ETableHeader to query
- * @col: the column to fetch.
- *
- * ETableHeaders contain the visual list of columns that the user will
- * view. The visible columns will typically map to different columns
- * in the ETableModel (because the user reordered the data for
- * example).
- *
- * Returns: the column in the model that the @col column
- * in the ETableHeader points to. */
-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 >= 0 && col < eth->col_count, -1);
-
- return eth->columns [col]->col_idx;
-}
-
-/**
- * e_table_header_get_index_at:
- * @eth: the ETableHeader to query
- * @x_offset: a pixel count from the beginning of the ETableHeader
- *
- * This will return the ETableHeader column that would contain
- * the @x_offset pixel.
- *
- * Returns: the column that contains pixel @x_offset, or -1
- * if no column inside this ETableHeader contains that pixel.
- */
-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;
-}
-
-/**
- * e_table_header_get_columns:
- * @eth: The ETableHeader to query
- *
- * Returns: A NULL terminated array of the ETableCols
- * contained in the ETableHeader @eth. Note that every
- * returned ETableCol in the array has been referenced, to release
- * this information you need to g_free the buffer returned
- * and you need to gtk_object_unref every element returned
- */
-ETableCol **
-e_table_header_get_columns (ETableHeader *eth)
-{
- ETableCol **ret;
- int i;
-
- 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;
-
- for (i = 0; i < eth->col_count; i++) {
- gtk_object_ref(GTK_OBJECT(ret[i]));
- }
-
- return ret;
-}
-
-/**
- * e_table_header_get_selected:
- * @eth: The ETableHeader to query
- *
- * Returns: The number of selected columns in the @eth object.
- */
-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;
-}
-
-/**
- * e_table_header_total_width:
- * @eth: The ETableHeader to query
- *
- * Returns: the number of pixels used by the @eth object
- * when rendered on screen
- */
-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;
-}
-
-/**
- * e_table_header_min_width:
- * @eth: The ETableHeader to query
- *
- * Returns: the minimum number of pixels required by the @eth object.
- **/
-int
-e_table_header_min_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]->min_width;
-
- return total;
-}
-
-/**
- * e_table_header_move:
- * @eth: The ETableHeader to operate on.
- * @source_index: the source column to move.
- * @target_index: the target location for the column
- *
- * This function moves the column @source_index to @target_index
- * inside the @eth ETableHeader. The signals "dimension_change"
- * and "structure_change" will be emmited
- */
-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 + 1); /* Can be moved beyond the last item. */
-
- if (source_index < target_index)
- target_index --;
-
- 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 [DIMENSION_CHANGE], eth->width);
- gtk_signal_emit (GTK_OBJECT (eth), eth_signals [STRUCTURE_CHANGE]);
-}
-
-/**
- * e_table_header_remove:
- * @eth: The ETableHeader to operate on.
- * @idx: the index to the column to be removed.
- *
- * Removes the column at @idx position in the ETableHeader @eth.
- * This emmits the "structure_change" signal on the @eth object.
- */
-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);
- enqueue(eth, -1, eth->nominal_width);
- gtk_signal_emit (GTK_OBJECT (eth), eth_signals [STRUCTURE_CHANGE]);
-}
-
-/*
- * FIXME: deprecated?
- */
-void
-e_table_header_set_selection (ETableHeader *eth, gboolean allow_selection)
-{
- g_return_if_fail (eth != NULL);
- g_return_if_fail (E_IS_TABLE_HEADER (eth));
-}
-
-static void
-eth_set_size (ETableHeader *eth, int idx, int size)
-{
- double expansion;
- double old_expansion;
- int min_width;
- int left_width;
- int total_extra;
- int expandable_count;
- int usable_width;
- int i;
- 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);
-
- /* If this column is not resizable, don't do anything. */
- if (!eth->columns[idx]->resizable)
- return;
-
- expansion = 0;
- min_width = 0;
- left_width = 0;
- expandable_count = -1;
-
- /* Calculate usable area. */
- for (i = 0; i < idx; i++) {
- left_width += eth->columns[i]->width;
- }
- /* - 1 to account for the last pixel border. */
- usable_width = eth->width - left_width - 1;
-
- if (eth->sort_info)
- usable_width -= e_table_sort_info_grouping_get_count(eth->sort_info) * GROUP_INDENT;
-
- /* Calculate minimum_width of stuff on the right as well as
- * total usable expansion on the right.
- */
- for (; i < eth->col_count; i++) {
- min_width += eth->columns[i]->min_width + eth->width_extras;
- if (eth->columns[i]->resizable) {
- expansion += eth->columns[i]->expansion;
- expandable_count ++;
- }
- }
- /* If there's no room for anything, don't change. */
- if (expansion == 0)
- return;
-
- /* (1) If none of the columns to the right are expandable, use
- * all the expansion space in this column.
- */
- if(expandable_count == 0) {
- eth->columns[idx]->expansion = expansion;
- for (i = idx + 1; i < eth->col_count; i++) {
- eth->columns[i]->expansion = 0;
- }
-
- gtk_signal_emit (GTK_OBJECT (eth), eth_signals [EXPANSION_CHANGE]);
- return;
- }
-
- total_extra = usable_width - min_width;
- /* If there's no extra space, set all expansions to 0. */
- if (total_extra <= 0) {
- for (i = idx; i < eth->col_count; i++) {
- eth->columns[i]->expansion = 0;
- }
- gtk_signal_emit (GTK_OBJECT (eth), eth_signals [EXPANSION_CHANGE]);
- return;
- }
-
- /* If you try to resize smaller than the minimum width, it
- * uses the minimum. */
- if (size < eth->columns[idx]->min_width + eth->width_extras)
- size = eth->columns[idx]->min_width + eth->width_extras;
-
- /* If all the extra space will be used up in this column, use
- * all the expansion and set all others to 0.
- */
- if (size >= total_extra + eth->columns[idx]->min_width + eth->width_extras) {
- eth->columns[idx]->expansion = expansion;
- for (i = idx + 1; i < eth->col_count; i++) {
- eth->columns[i]->expansion = 0;
- }
- gtk_signal_emit (GTK_OBJECT (eth), eth_signals [EXPANSION_CHANGE]);
- return;
- }
-
- /* The old_expansion used by columns to the right. */
- old_expansion = expansion;
- old_expansion -= eth->columns[idx]->expansion;
- /* Set the new expansion so that it will generate the desired size. */
- eth->columns[idx]->expansion = expansion * (((double)(size - (eth->columns[idx]->min_width + eth->width_extras)))/((double)total_extra));
- /* The expansion left for the columns on the right. */
- expansion -= eth->columns[idx]->expansion;
-
- /* (2) If the old columns to the right didn't have any
- * expansion before, expand them evenly. old_expansion > 0 by
- * expansion = SUM(i=idx to col_count -1,
- * columns[i]->min_width) - columns[idx]->min_width) =
- * SUM(non-negatives).
- */
- if (old_expansion == 0) {
- for (i = idx + 1; i < eth->col_count; i++) {
- if (eth->columns[idx]->resizable) {
- /* expandable_count != 0 by (1) */
- eth->columns[i]->expansion = expansion / expandable_count;
- }
- }
- gtk_signal_emit (GTK_OBJECT (eth), eth_signals [EXPANSION_CHANGE]);
- return;
- }
-
- /* Remove from total_extra the amount used for this column. */
- total_extra -= size - (eth->columns[idx]->min_width + eth->width_extras);
- for (i = idx + 1; i < eth->col_count; i++) {
- if (eth->columns[idx]->resizable) {
- /* old_expansion != 0 by (2) */
- eth->columns[i]->expansion *= expansion / old_expansion;
- }
- }
- gtk_signal_emit (GTK_OBJECT (eth), eth_signals [EXPANSION_CHANGE]);
-}
-
-/**
- * e_table_header_col_diff:
- * @eth: the ETableHeader to query.
- * @start_col: the starting column
- * @end_col: the ending column.
- *
- * Computes the number of pixels between the columns @start_col and
- * @end_col.
- *
- * Returns: the number of pixels between @start_col and @end_col on the
- * @eth ETableHeader object
- */
-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;
-
- total = 0;
- for (col = start_col; col < end_col; col++){
-
- total += eth->columns [col]->width;
- }
-
- return total;
-}
-
-static void
-eth_calc_widths (ETableHeader *eth)
-{
- int i;
- int extra;
- double expansion;
- int last_position = 0;
- double next_position = 0;
- int last_resizable = -1;
- int *widths;
- gboolean changed;
-
- widths = g_new (int, eth->col_count);
-
- /* - 1 to account for the last pixel border. */
- extra = eth->width - 1;
- expansion = 0;
- for (i = 0; i < eth->col_count; i++) {
- extra -= eth->columns[i]->min_width + eth->width_extras;
- if (eth->columns[i]->resizable && eth->columns[i]->expansion > 0)
- last_resizable = i;
- expansion += eth->columns[i]->resizable ? eth->columns[i]->expansion : 0;
- widths[i] = eth->columns[i]->min_width + eth->width_extras;
- }
- if (eth->sort_info)
- extra -= e_table_sort_info_grouping_get_count(eth->sort_info) * GROUP_INDENT;
- if (expansion != 0 && extra > 0) {
- for (i = 0; i < last_resizable; i++) {
- next_position += extra * (eth->columns[i]->resizable ? eth->columns[i]->expansion : 0)/expansion;
- widths[i] += next_position - last_position;
- last_position = next_position;
- }
- widths[i] += extra - last_position;
- }
-
- changed = FALSE;
-
- for (i = 0; i < eth->col_count; i++) {
- if (eth->columns[i]->width != widths[i]) {
- changed = TRUE;
- eth->columns[i]->width = widths[i];
- }
- }
- g_free (widths);
- if (changed)
- gtk_signal_emit (GTK_OBJECT (eth), eth_signals [DIMENSION_CHANGE], eth->width);
- eth_update_offsets (eth);
-}
-
-void
-e_table_header_update_horizontal (ETableHeader *eth)
-{
- int i;
- int cols;
-
- cols = eth->col_count;
-
- for (i = 0; i < cols; i++) {
- int width = 0;
-
- gtk_signal_emit_by_name (GTK_OBJECT (eth),
- "request_width",
- i, &width);
- eth->columns[i]->min_width = width + 10;
- eth->columns[i]->expansion = 1;
- }
- enqueue(eth, -1, eth->nominal_width);
- gtk_signal_emit (GTK_OBJECT (eth), eth_signals [EXPANSION_CHANGE]);
-}
-
-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) e_table_header_init,
- NULL, /* reserved 1 */
- NULL, /* reserved 2 */
- (GtkClassInitFunc) NULL
- };
-
- type = gtk_type_unique (gtk_object_get_type (), &info);
- }
-
- return type;
-}
-
-int
-e_table_header_prioritized_column (ETableHeader *eth)
-{
- int best_model_col = 0;
- int best_priority;
- int i;
- int count;
-
- count = e_table_header_count (eth);
- if (count == 0)
- return -1;
- best_priority = e_table_header_get_column (eth, 0)->priority;
- best_model_col = e_table_header_get_column (eth, 0)->col_idx;
- for (i = 1; i < count; i++) {
- int priority = e_table_header_get_column (eth, i)->priority;
- if (priority > best_priority) {
- best_priority = priority;
- best_model_col = e_table_header_get_column (eth, i)->col_idx;
- }
- }
- return best_model_col;
-}
diff --git a/widgets/table/e-table-header.h b/widgets/table/e-table-header.h
deleted file mode 100644
index b30bca47cd..0000000000
--- a/widgets/table/e-table-header.h
+++ /dev/null
@@ -1,120 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-header.h
- * Copyright 1999, 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- * Miguel de Icaza <miguel@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_TABLE_COLUMN_H_
-#define _E_TABLE_COLUMN_H_
-
-#include <gtk/gtkobject.h>
-#include <gdk/gdk.h>
-#include <gal/e-table/e-table-sort-info.h>
-#include <gal/e-table/e-table-col.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-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;
- int width;
- int nominal_width;
- int width_extras;
-
- ETableSortInfo *sort_info;
- int sort_info_group_change_id;
-
- ETableCol **columns;
-
- GSList *change_queue, *change_tail;
- gint idle;
-};
-
-typedef struct {
- GtkObjectClass parent_class;
-
- void (*structure_change) (ETableHeader *eth);
- void (*dimension_change) (ETableHeader *eth, int width);
- void (*expansion_change) (ETableHeader *eth);
- int (*request_width) (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);
-ETableCol *e_table_header_get_column_by_col_idx (ETableHeader *eth,
- int col_idx);
-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);
-int e_table_header_get_selected (ETableHeader *eth);
-
-int e_table_header_total_width (ETableHeader *eth);
-int e_table_header_min_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);
-
-void e_table_header_calc_widths (ETableHeader *eth);
-GList *e_table_header_get_selected_indexes (ETableHeader *eth);
-
-void e_table_header_update_horizontal (ETableHeader *eth);
-int e_table_header_prioritized_column (ETableHeader *eth);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#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 754234868e..0000000000
--- a/widgets/table/e-table-item.c
+++ /dev/null
@@ -1,3513 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-item.c
- * Copyright 1999, 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- * Miguel de Icaza <miguel@gnu.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-/*
- * TODO:
- * Add a border to the thing, so that focusing works properly.
- */
-#include <config.h>
-
-#include "e-table-item.h"
-
-#include <math.h>
-#include <stdio.h>
-#include <gtk/gtksignal.h>
-#include <gdk/gdkkeysyms.h>
-#include "e-table-subset.h"
-#include "e-cell.h"
-#include "gal/widgets/e-hsv-utils.h"
-#include "gal/widgets/e-canvas.h"
-#include "gal/widgets/e-canvas-utils.h"
-#include "gal/util/e-util.h"
-#include <string.h>
-#include <stdlib.h>
-
-#define PARENT_OBJECT_TYPE gnome_canvas_item_get_type ()
-
-#define FOCUSED_BORDER 2
-
-#define d(x)
-
-#if d(!)0
-#define e_table_item_leave_edit_(x) (e_table_item_leave_edit((x)), g_print ("%s: e_table_item_leave_edit\n", __FUNCTION__))
-#else
-#define e_table_item_leave_edit_(x) (e_table_item_leave_edit((x)))
-#endif
-
-/* FIXME: Do an analysis of which cell functions are needed before
- realize and make sure that all of them are doable by all the cells
- and that all of the others are only done after realization. */
-
-static GnomeCanvasItemClass *eti_parent_class;
-
-enum {
- CURSOR_CHANGE,
- CURSOR_ACTIVATED,
- DOUBLE_CLICK,
- RIGHT_CLICK,
- CLICK,
- KEY_PRESS,
- START_DRAG,
- STYLE_SET,
- LAST_SIGNAL
-};
-
-static gint eti_signals [LAST_SIGNAL] = { 0, };
-
-enum {
- ARG_0,
- ARG_TABLE_HEADER,
- ARG_TABLE_MODEL,
- ARG_SELECTION_MODEL,
- ARG_TABLE_ALTERNATING_ROW_COLORS,
- ARG_TABLE_HORIZONTAL_DRAW_GRID,
- ARG_TABLE_VERTICAL_DRAW_GRID,
- ARG_TABLE_DRAW_FOCUS,
- ARG_CURSOR_MODE,
- ARG_LENGTH_THRESHOLD,
- ARG_CURSOR_ROW,
- ARG_UNIFORM_ROW_HEIGHT,
-
- ARG_MINIMUM_WIDTH,
- ARG_WIDTH,
- ARG_HEIGHT,
-};
-
-#define DOUBLE_CLICK_TIME 250
-#define TRIPLE_CLICK_TIME 500
-
-
-static int eti_get_height (ETableItem *eti);
-static int eti_row_height (ETableItem *eti, int row);
-static void e_table_item_focus (ETableItem *eti, int col, int row, GdkModifierType state);
-static void eti_cursor_change (ESelectionModel *selection, int row, int col, ETableItem *eti);
-static void eti_cursor_activated (ESelectionModel *selection, int row, int col, ETableItem *eti);
-static void eti_selection_change (ESelectionModel *selection, ETableItem *eti);
-static void eti_selection_row_change (ESelectionModel *selection, int row, ETableItem *eti);
-static void e_table_item_redraw_row (ETableItem *eti, int row);
-
-#define ETI_SINGLE_ROW_HEIGHT(eti) ((eti)->uniform_row_height_cache != -1 ? (eti)->uniform_row_height_cache : eti_row_height((eti), -1))
-#define ETI_MULTIPLE_ROW_HEIGHT(eti,row) ((eti)->height_cache && (eti)->height_cache[(row)] != -1 ? (eti)->height_cache[(row)] : eti_row_height((eti),(row)))
-#define ETI_ROW_HEIGHT(eti,row) ((eti)->uniform_row_height ? ETI_SINGLE_ROW_HEIGHT ((eti)) : ETI_MULTIPLE_ROW_HEIGHT((eti),(row)))
-
-inline static gint
-model_to_view_row(ETableItem *eti, int row)
-{
- int i;
- if (row == -1)
- return -1;
- if (eti->uses_source_model) {
- ETableSubset *etss = E_TABLE_SUBSET(eti->table_model);
- if (eti->row_guess >= 0 && eti->row_guess < etss->n_map) {
- if (etss->map_table[eti->row_guess] == row) {
- return eti->row_guess;
- }
- }
- for (i = 0; i < etss->n_map; i++) {
- if (etss->map_table[i] == row)
- return i;
- }
- return -1;
- } else
- return row;
-}
-
-inline static gint
-view_to_model_row(ETableItem *eti, int row)
-{
- if (eti->uses_source_model) {
- ETableSubset *etss = E_TABLE_SUBSET(eti->table_model);
- if (row >= 0 && row < etss->n_map) {
- eti->row_guess = row;
- return etss->map_table[row];
- } else
- return -1;
- } else
- return row;
-}
-
-inline static gint
-model_to_view_col(ETableItem *eti, int col)
-{
- int i;
- if (col == -1)
- return -1;
- for (i = 0; i < eti->cols; i++) {
- ETableCol *ecol = e_table_header_get_column (eti->header, i);
- if (ecol->col_idx == col)
- return i;
- }
- return -1;
-}
-
-inline static gint
-view_to_model_col(ETableItem *eti, int col)
-{
- ETableCol *ecol = e_table_header_get_column (eti->header, col);
- return ecol ? ecol->col_idx : -1;
-}
-
-inline static void
-eti_grab (ETableItem *eti, guint32 time)
-{
- GnomeCanvasItem *item = GNOME_CANVAS_ITEM (eti);
- d(g_print ("%s: time: %d\n", __FUNCTION__, time));
- if (eti->grabbed_count == 0) {
- eti->gtk_grabbed = FALSE;
- if (!gnome_canvas_item_grab(item,
- GDK_BUTTON1_MOTION_MASK | GDK_BUTTON2_MOTION_MASK | GDK_BUTTON3_MOTION_MASK
- | GDK_POINTER_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK,
- NULL, time)) {
- d(g_print ("%s: gtk_grab_add\n", __FUNCTION__));
- gtk_grab_add (GTK_WIDGET (item->canvas));
- eti->gtk_grabbed = TRUE;
- }
- }
- eti->grabbed_count ++;
-}
-
-inline static void
-eti_ungrab (ETableItem *eti, guint32 time)
-{
- GnomeCanvasItem *item = GNOME_CANVAS_ITEM (eti);
- d(g_print ("%s: time: %d\n", __FUNCTION__, time));
- eti->grabbed_count --;
- if (eti->grabbed_count == 0) {
- if (eti->gtk_grabbed) {
- d(g_print ("%s: gtk_grab_remove\n", __FUNCTION__));
- gtk_grab_remove (GTK_WIDGET (item->canvas));
- }
- gnome_canvas_item_ungrab(item, time);
- }
-}
-
-inline static gboolean
-eti_editing (ETableItem *eti)
-{
- d(g_print("%s: %s\n", __FUNCTION__, (eti->editing_col == -1) ? "false":"true"));
-
- if (eti->editing_col == -1)
- return FALSE;
- else
- return TRUE;
-}
-
-inline static GdkColor *
-eti_get_cell_background_color (ETableItem *eti, int row, int col, gboolean selected, gboolean *allocatedp)
-{
- ECellView *ecell_view = eti->cell_views [col];
- GtkWidget *canvas = GTK_WIDGET(GNOME_CANVAS_ITEM(eti)->canvas);
- GdkColor *background, bg;
- gchar *color_spec = NULL;
- gboolean allocated = FALSE;
-
- if (selected){
- if (GTK_WIDGET_HAS_FOCUS(canvas))
- background = &canvas->style->bg [GTK_STATE_SELECTED];
- else
- background = &canvas->style->bg [GTK_STATE_ACTIVE];
- } else {
- background = &canvas->style->base [GTK_STATE_NORMAL];
- }
-
- color_spec = e_cell_get_bg_color (ecell_view, row);
-
- if (color_spec != NULL) {
- if (gdk_color_parse (color_spec, &bg)) {
- background = gdk_color_copy (&bg);
- allocated = TRUE;
- }
- }
-
- if (eti->alternating_row_colors) {
- if (row % 2) {
-
- } else {
- if (!allocated) {
- background = gdk_color_copy (background);
- allocated = TRUE;
- }
- e_hsv_tweak (background, 0.0f, 0.0f, -0.05f);
- gdk_color_alloc (gtk_widget_get_colormap (GTK_WIDGET (canvas)), background);
- }
- }
- if (allocatedp)
- *allocatedp = allocated;
-
- return background;
-}
-
-inline static GdkColor *
-eti_get_cell_foreground_color (ETableItem *eti, int row, int col, gboolean selected, gboolean *allocated)
-{
- GtkWidget *canvas = GTK_WIDGET(GNOME_CANVAS_ITEM(eti)->canvas);
- GdkColor *foreground;
-
- if (allocated)
- *allocated = FALSE;
-
- if (selected){
- if (GTK_WIDGET_HAS_FOCUS (canvas))
- foreground = &canvas->style->text [GTK_STATE_SELECTED];
- else
- foreground = &canvas->style->text [GTK_STATE_ACTIVE];
- } else {
- foreground = &canvas->style->text [GTK_STATE_NORMAL];
- }
-
- return foreground;
-}
-
-static void
-eti_free_save_state (ETableItem *eti)
-{
- if (eti->save_row == -1 ||
- !eti->cell_views_realized)
- return;
-
- e_cell_free_state (eti->cell_views [eti->save_col], view_to_model_col(eti, eti->save_col),
- eti->save_col, eti->save_row, eti->save_state);
- eti->save_row = -1;
- eti->save_col = -1;
- eti->save_state = NULL;
-}
-
-/*
- * 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;
-
- if (eti->cell_views_realized)
- return;
-
- if (!(GTK_OBJECT_FLAGS(eti) & GNOME_CANVAS_ITEM_REALIZED))
- return;
-
- for (i = 0; i < eti->n_cells; i++)
- e_cell_realize (eti->cell_views [i]);
- eti->cell_views_realized = 1;
-}
-
-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 *ecol = e_table_header_get_column (eti->header, i);
-
- eti->cell_views [i] = e_cell_new_view (ecol->ecell, eti->table_model, eti);
- }
-
- eti->needs_compute_height = 1;
- e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (eti));
- eti->needs_redraw = 1;
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (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;
-
- eti_free_save_state (eti);
-
- 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;
-
- eti_free_save_state (eti);
-
- 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);
-
- /* Wrong BBox's are the source of redraw nightmares */
-
- gnome_canvas_item_i2c_affine (GNOME_CANVAS_ITEM (eti), 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);
-
- *x1 = c1.x;
- *y1 = c1.y;
- *x2 = c2.x + 1;
- *y2 = c2.y + 1;
-}
-
-static void
-eti_reflow (GnomeCanvasItem *item, gint flags)
-{
- ETableItem *eti = E_TABLE_ITEM (item);
-
- if (eti->needs_compute_height) {
- int new_height = eti_get_height (eti);
-
- if (new_height != eti->height) {
- eti->height = new_height;
- e_canvas_item_request_parent_reflow (GNOME_CANVAS_ITEM (eti));
- eti->needs_redraw = 1;
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (eti));
- }
- eti->needs_compute_height = 0;
- }
- if (eti->needs_compute_width) {
- int new_width = e_table_header_total_width(eti->header);
- if (new_width != eti->width) {
- eti->width = new_width;
- e_canvas_item_request_parent_reflow (GNOME_CANVAS_ITEM (eti));
- eti->needs_redraw = 1;
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (eti));
- }
- eti->needs_compute_width = 0;
- }
-}
-
-/*
- * GnomeCanvasItem::update method
- */
-static void
-eti_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags)
-{
- ArtPoint o1, o2;
- ETableItem *eti = E_TABLE_ITEM (item);
-
- if (GNOME_CANVAS_ITEM_CLASS (eti_parent_class)->update)
- (*GNOME_CANVAS_ITEM_CLASS (eti_parent_class)->update)(item, affine, clip_path, flags);
-
- o1.x = item->x1;
- o1.y = item->y1;
- o2.x = item->x2;
- o2.y = item->y2;
-
- eti_bounds (item, &item->x1, &item->y1, &item->x2, &item->y2);
- if (item->x1 != o1.x ||
- item->y1 != o1.y ||
- item->x2 != o2.x ||
- item->y2 != o2.y) {
- gnome_canvas_request_redraw (item->canvas, o1.x, o1.y, o2.x, o2.y);
- eti->needs_redraw = 1;
- }
-
- if (eti->needs_redraw) {
- gnome_canvas_request_redraw (item->canvas, item->x1, item->y1,
- item->x2, item->y2);
- eti->needs_redraw = 0;
- }
-}
-
-/*
- * 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_pre_change_id);
- gtk_signal_disconnect (GTK_OBJECT (eti->table_model),
- eti->table_model_no_change_id);
- 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_signal_disconnect (GTK_OBJECT (eti->table_model),
- eti->table_model_cell_change_id);
- gtk_signal_disconnect (GTK_OBJECT (eti->table_model),
- eti->table_model_rows_inserted_id);
- gtk_signal_disconnect (GTK_OBJECT (eti->table_model),
- eti->table_model_rows_deleted_id);
- gtk_object_unref (GTK_OBJECT (eti->table_model));
- if (eti->source_model)
- gtk_object_unref (GTK_OBJECT (eti->source_model));
-
- eti->table_model_pre_change_id = 0;
- eti->table_model_no_change_id = 0;
- eti->table_model_change_id = 0;
- eti->table_model_row_change_id = 0;
- eti->table_model_cell_change_id = 0;
- eti->table_model_rows_inserted_id = 0;
- eti->table_model_rows_deleted_id = 0;
- eti->table_model = NULL;
- eti->source_model = NULL;
- eti->uses_source_model = 0;
-}
-
-/*
- * eti_remove_table_model:
- *
- * Invoked to release the table model associated with this ETableItem
- */
-static void
-eti_remove_selection_model (ETableItem *eti)
-{
- if (!eti->selection)
- return;
-
- gtk_signal_disconnect (GTK_OBJECT (eti->selection),
- eti->selection_change_id);
- gtk_signal_disconnect (GTK_OBJECT (eti->selection),
- eti->selection_row_change_id);
- gtk_signal_disconnect (GTK_OBJECT (eti->selection),
- eti->cursor_change_id);
- gtk_signal_disconnect (GTK_OBJECT (eti->selection),
- eti->cursor_activated_id);
- gtk_object_unref (GTK_OBJECT (eti->selection));
-
- eti->selection_change_id = 0;
- eti->selection_row_change_id = 0;
- eti->cursor_activated_id = 0;
- eti->selection = NULL;
-}
-
-/*
- * eti_remove_header_model:
- *
- * Invoked to release the header model associated with this ETableItem
- */
-static void
-eti_remove_header_model (ETableItem *eti)
-{
- if (!eti->header)
- return;
-
- gtk_signal_disconnect (GTK_OBJECT (eti->header),
- eti->header_structure_change_id);
- gtk_signal_disconnect (GTK_OBJECT (eti->header),
- eti->header_dim_change_id);
- gtk_signal_disconnect (GTK_OBJECT (eti->header),
- eti->header_request_width_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_request_width_id = 0;
- eti->header = NULL;
-}
-
-/*
- * eti_row_height_real:
- *
- * 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_real (ETableItem *eti, int row)
-{
- const int cols = e_table_header_count (eti->header);
- int col;
- int h, max_h;
-
- g_assert (cols == 0 || eti->cell_views);
-
- max_h = 0;
-
- for (col = 0; col < cols; col++){
- h = e_cell_height (eti->cell_views [col], view_to_model_col(eti, col), col, row);
-
- if (h > max_h)
- max_h = h;
- }
- return max_h;
-}
-
-static void
-confirm_height_cache (ETableItem *eti)
-{
- int i;
-
- if (eti->uniform_row_height || eti->height_cache)
- return;
- eti->height_cache = g_new(int, eti->rows);
- for (i = 0; i < eti->rows; i++) {
- eti->height_cache[i] = -1;
- }
-}
-
-static gboolean
-height_cache_idle(ETableItem *eti)
-{
- int changed = 0;
- int i;
- confirm_height_cache(eti);
- for (i = eti->height_cache_idle_count; i < eti->rows; i++) {
- if (eti->height_cache[i] == -1) {
- eti_row_height(eti, i);
- changed ++;
- if (changed >= 20)
- break;
- }
- }
- if (changed >= 20) {
- eti->height_cache_idle_count = i;
- return TRUE;
- }
- eti->height_cache_idle_id = 0;
- return FALSE;
-}
-
-static void
-free_height_cache (ETableItem *eti)
-{
- if (GNOME_CANVAS_ITEM_REALIZED & GTK_OBJECT_FLAGS (eti)) {
- if (eti->height_cache)
- g_free (eti->height_cache);
- eti->height_cache = NULL;
- eti->height_cache_idle_count = 0;
- eti->uniform_row_height_cache = -1;
-
- if (eti->uniform_row_height && eti->height_cache_idle_id != 0) {
- g_source_remove(eti->height_cache_idle_id);
- eti->height_cache_idle_id = 0;
- }
-
- if ((!eti->uniform_row_height) && eti->height_cache_idle_id == 0)
- eti->height_cache_idle_id = g_idle_add_full(G_PRIORITY_LOW, (GSourceFunc) height_cache_idle, eti, NULL);
- }
-}
-
-static void
-calculate_height_cache (ETableItem *eti)
-{
- free_height_cache(eti);
- confirm_height_cache(eti);
-}
-
-
-/*
- * 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)
-{
- if (eti->uniform_row_height) {
- eti->uniform_row_height_cache = eti_row_height_real (eti, -1);
- return eti->uniform_row_height_cache;
- } else {
- if (!eti->height_cache) {
- calculate_height_cache (eti);
- }
- if (eti->height_cache[row] == -1) {
- eti->height_cache[row] = eti_row_height_real(eti, row);
- if (row > 0 &&
- eti->length_threshold != -1 &&
- eti->rows > eti->length_threshold &&
- eti->height_cache[row] != eti_row_height(eti, 0)) {
- eti->needs_compute_height = 1;
- e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(eti));
- }
- }
- return eti->height_cache[row];
- }
-}
-
-/*
- * 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 height_extra = eti->horizontal_draw_grid ? 1 : 0;
-
- if (rows == 0)
- return 0;
-
- if (eti->uniform_row_height) {
- int row_height = eti_row_height(eti, -1);
- return ((row_height + height_extra) * rows + height_extra);
- } else {
- int height;
- int row;
- if (eti->length_threshold != -1){
- if (rows > eti->length_threshold){
- int row_height = eti_row_height(eti, 0);
- if (eti->height_cache) {
- height = 0;
- for (row = 0; row < rows; row++) {
- if (eti->height_cache[row] == -1) {
- height += (row_height + height_extra) * (rows - row);
- break;
- }
- else
- height += eti->height_cache[row] + height_extra;
- }
- } else
- height = (eti_row_height (eti, 0) + height_extra) * rows;
-
- /*
- * 1 pixel at the top
- */
- return height + height_extra;
- }
- }
-
- height = height_extra;
- for (row = 0; row < rows; row++)
- height += eti_row_height (eti, row) + height_extra;
-
- return 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);
-}
-
-/*
- * Computes the distance between @start_row and @end_row in pixels
- */
-int
-e_table_item_row_diff (ETableItem *eti, int start_row, int end_row)
-{
- int height_extra = eti->horizontal_draw_grid ? 1 : 0;
-
- if (start_row < 0)
- start_row = 0;
- if (end_row > eti->rows)
- end_row = eti->rows;
-
- if (eti->uniform_row_height) {
- return ((end_row - start_row) * (eti_row_height(eti, -1) + height_extra));
- } else {
- int row, total;
- total = 0;
- for (row = start_row; row < end_row; row++)
- total += eti_row_height (eti, row) + height_extra;
-
- return total;
- }
-}
-
-static void
-eti_get_region (ETableItem *eti,
- int start_col, int start_row,
- int end_col, int end_row,
- int *x1p, int *y1p,
- int *x2p, int *y2p)
-{
- int x1, y1, x2, y2;
-
- x1 = e_table_header_col_diff (eti->header, 0, start_col);
- y1 = e_table_item_row_diff (eti, 0, start_row);
- x2 = x1 + e_table_header_col_diff (eti->header, start_col, end_col + 1);
- y2 = y1 + e_table_item_row_diff (eti, start_row, end_row + 1);
- if (x1p)
- *x1p = x1;
- if (y1p)
- *y1p = y1;
- if (x2p)
- *x2p = x2;
- if (y2p)
- *y2p = y2;
-}
-
-/*
- * 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, x2, y2;
-
- if (eti->rows > 0) {
-
- eti_get_region (eti,
- start_col, start_row,
- end_col, end_row,
- &x1, &y1, &x2, &y2);
-
- eti_item_region_redraw (eti, eti->x1 + x1 - border,
- eti->y1 + y1 - border,
- eti->x1 + x2 + 1 + border,
- eti->y1 + y2 + 1 + border);
- }
-}
-
-/*
- * eti_request_region_show
- *
- * Request a canvas show on the range (start_col, start_row) to (end_col, end_row).
- * This is inclusive (ie, you can use: 0,0-0,0 to show the first cell).
- */
-static void
-eti_request_region_show (ETableItem *eti,
- int start_col, int start_row,
- int end_col, int end_row, int delay)
-{
- int x1, y1, x2, y2;
-
- eti_get_region (eti,
- start_col, start_row,
- end_col, end_row,
- &x1, &y1, &x2, &y2);
-
- if (delay)
- e_canvas_item_show_area_delayed(GNOME_CANVAS_ITEM(eti), x1, y1, x2, y2, delay);
- else
- e_canvas_item_show_area(GNOME_CANVAS_ITEM(eti), x1, y1, x2, y2);
-}
-
-static void
-eti_show_cursor (ETableItem *eti, int delay)
-{
- int cursor_row;
-
- if (!((GTK_OBJECT_FLAGS(eti) & GNOME_CANVAS_ITEM_REALIZED) && eti->cell_views_realized))
- return;
-
- if (eti->frozen_count > 0) {
- eti->queue_show_cursor = TRUE;
- return;
- }
-
- gtk_object_get(GTK_OBJECT(eti->selection),
- "cursor_row", &cursor_row,
- NULL);
-
- d(g_print ("%s: cursor row: %d\n", __FUNCTION__, cursor_row));
-
- if (cursor_row != -1) {
- cursor_row = model_to_view_row (eti, cursor_row);
- eti_request_region_show (eti,
- 0, cursor_row, eti->cols - 1, cursor_row,
- delay);
- }
-}
-
-static void
-eti_check_cursor_on_screen (ETableItem *eti)
-{
- if (eti->cursor_x1 == -1 ||
- eti->cursor_y1 == -1 ||
- eti->cursor_x2 == -1 ||
- eti->cursor_y2 == -1)
- return;
-
- eti->cursor_on_screen = e_canvas_item_area_shown (GNOME_CANVAS_ITEM(eti),
- eti->cursor_x1,
- eti->cursor_y1,
- eti->cursor_x2,
- eti->cursor_y2);
-
- d(g_print ("%s: cursor on screen: %s\n", __FUNCTION__, eti->cursor_on_screen ? "TRUE" : "FALSE"));
-}
-
-static void
-eti_check_cursor_bounds (ETableItem *eti)
-{
- int x1, y1, x2, y2;
- int cursor_row;
-
- if (!((GTK_OBJECT_FLAGS(eti) & GNOME_CANVAS_ITEM_REALIZED) && eti->cell_views_realized))
- return;
-
- if (eti->frozen_count > 0) {
- return;
- }
-
- gtk_object_get(GTK_OBJECT(eti->selection),
- "cursor_row", &cursor_row,
- NULL);
-
- if (cursor_row == -1) {
- eti->cursor_x1 = -1;
- eti->cursor_y1 = -1;
- eti->cursor_x2 = -1;
- eti->cursor_y2 = -1;
- eti->cursor_on_screen = TRUE;
- return;
- }
-
- d(g_print ("%s: model cursor row: %d\n", __FUNCTION__, cursor_row));
-
- cursor_row = model_to_view_row (eti, cursor_row);
-
- d(g_print ("%s: cursor row: %d\n", __FUNCTION__, cursor_row));
-
- eti_get_region (eti,
- 0, cursor_row, eti->cols - 1, cursor_row,
- &x1, &y1, &x2, &y2);
- eti->cursor_x1 = x1;
- eti->cursor_y1 = y1;
- eti->cursor_x2 = x2;
- eti->cursor_y2 = y2;
- eti->cursor_on_screen = e_canvas_item_area_shown (GNOME_CANVAS_ITEM(eti), x1, y1, x2, y2);
-
- d(g_print ("%s: cursor on screen: %s\n", __FUNCTION__, eti->cursor_on_screen ? "TRUE" : "FALSE"));
-}
-
-static void
-eti_maybe_show_cursor(ETableItem *eti, int delay)
-{
- d(g_print ("%s: cursor on screen: %s\n", __FUNCTION__, eti->cursor_on_screen ? "TRUE" : "FALSE"));
- if (eti->cursor_on_screen)
- eti_show_cursor (eti, delay);
- eti_check_cursor_bounds (eti);
-}
-
-static gboolean
-eti_idle_show_cursor_cb (gpointer data)
-{
- ETableItem *eti = data;
- if (!GTK_OBJECT_DESTROYED (eti)) {
- eti_show_cursor (eti, 0);
- eti_check_cursor_bounds (eti);
- }
- gtk_object_unref (GTK_OBJECT (eti));
- return FALSE;
-}
-
-static void
-eti_idle_maybe_show_cursor(ETableItem *eti)
-{
- d(g_print ("%s: cursor on screen: %s\n", __FUNCTION__, eti->cursor_on_screen ? "TRUE" : "FALSE"));
- if (eti->cursor_on_screen) {
- gtk_object_ref (GTK_OBJECT (eti));
- g_idle_add (eti_idle_show_cursor_cb, eti);
- }
-}
-
-static void
-eti_cancel_drag_due_to_model_change (ETableItem *eti)
-{
- if (eti->maybe_in_drag) {
- eti->maybe_in_drag = FALSE;
- if (!eti->maybe_did_something)
- e_selection_model_do_something(E_SELECTION_MODEL (eti->selection), eti->drag_row, eti->drag_col, eti->drag_state);
- }
- if (eti->in_drag) {
- eti->in_drag = FALSE;
- }
-}
-
-static void
-eti_freeze (ETableItem *eti)
-{
- eti->frozen_count ++;
- d(g_print ("%s: %d\n", __FUNCTION__, eti->frozen_count));
-}
-
-static void
-eti_unfreeze (ETableItem *eti)
-{
- g_return_if_fail (eti->frozen_count > 0);
- eti->frozen_count --;
- d(g_print ("%s: %d\n", __FUNCTION__, eti->frozen_count));
- if (eti->frozen_count == 0 && eti->queue_show_cursor) {
- eti_show_cursor (eti, 0);
- eti_check_cursor_bounds (eti);
- eti->queue_show_cursor = FALSE;
- }
-}
-
-/*
- * Callback routine: invoked before the ETableModel suffers a change
- */
-static void
-eti_table_model_pre_change (ETableModel *table_model, ETableItem *eti)
-{
- eti_cancel_drag_due_to_model_change (eti);
- eti_check_cursor_bounds (eti);
- if (eti_editing (eti))
- e_table_item_leave_edit_(eti);
- eti_freeze (eti);
-}
-
-/*
- * Callback routine: invoked when the ETableModel has not suffered a change
- */
-static void
-eti_table_model_no_change (ETableModel *table_model, ETableItem *eti)
-{
- eti_unfreeze (eti);
-}
-
-/*
- * Callback routine: invoked when the ETableModel has suffered a change
- */
-
-static void
-eti_table_model_changed (ETableModel *table_model, ETableItem *eti)
-{
- if (!(GTK_OBJECT_FLAGS(eti) & GNOME_CANVAS_ITEM_REALIZED)) {
- eti_unfreeze (eti);
- return;
- }
-
- eti->rows = e_table_model_row_count (eti->table_model);
-
- free_height_cache(eti);
-
- eti_unfreeze (eti);
-
- eti->needs_compute_height = 1;
- e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (eti));
- eti->needs_redraw = 1;
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (eti));
-
- eti_idle_maybe_show_cursor(eti);
-}
-
-static void
-eti_table_model_row_changed (ETableModel *table_model, int row, ETableItem *eti)
-{
- if (!(GTK_OBJECT_FLAGS(eti) & GNOME_CANVAS_ITEM_REALIZED)) {
- eti_unfreeze (eti);
- return;
- }
-
- if ((!eti->uniform_row_height) && eti->height_cache && eti->height_cache[row] != -1 && eti_row_height_real(eti, row) != eti->height_cache[row]) {
- eti_table_model_changed (table_model, eti);
- return;
- }
-
- eti_unfreeze (eti);
-
- e_table_item_redraw_row (eti, row);
-}
-
-static void
-eti_table_model_cell_changed (ETableModel *table_model, int col, int row, ETableItem *eti)
-{
- if (!(GTK_OBJECT_FLAGS(eti) & GNOME_CANVAS_ITEM_REALIZED)) {
- eti_unfreeze (eti);
- return;
- }
-
- if ((!eti->uniform_row_height) && eti->height_cache && eti->height_cache[row] != -1 && eti_row_height_real(eti, row) != eti->height_cache[row]) {
- eti_table_model_changed (table_model, eti);
- return;
- }
-
- eti_unfreeze (eti);
-
- e_table_item_redraw_row (eti, row);
-}
-
-static void
-eti_table_model_rows_inserted (ETableModel *table_model, int row, int count, ETableItem *eti)
-{
- if (!(GTK_OBJECT_FLAGS(eti) & GNOME_CANVAS_ITEM_REALIZED)) {
- eti_unfreeze (eti);
- return;
- }
- eti->rows = e_table_model_row_count (eti->table_model);
-
- if (eti->height_cache) {
- int i;
- eti->height_cache = g_renew(int, eti->height_cache, eti->rows);
- memmove(eti->height_cache + row + count, eti->height_cache + row, (eti->rows - count - row) * sizeof(int));
- for (i = row; i < row + count; i++)
- eti->height_cache[i] = -1;
- }
-
- eti_unfreeze (eti);
-
- eti_idle_maybe_show_cursor(eti);
-
- eti->needs_compute_height = 1;
- e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (eti));
- eti->needs_redraw = 1;
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (eti));
-}
-
-static void
-eti_table_model_rows_deleted (ETableModel *table_model, int row, int count, ETableItem *eti)
-{
- if (!(GTK_OBJECT_FLAGS(eti) & GNOME_CANVAS_ITEM_REALIZED)) {
- eti_unfreeze (eti);
- return;
- }
-
- g_assert (eti->rows == -1 || row + count <= eti->rows);
-
- eti->rows = e_table_model_row_count (eti->table_model);
-
- g_assert (row <= eti->rows);
-
- if (eti->height_cache) {
- memmove(eti->height_cache + row, eti->height_cache + row + count, (eti->rows - row) * sizeof(int));
- }
-
- eti_unfreeze (eti);
-
- eti_idle_maybe_show_cursor(eti);
-
- eti->needs_compute_height = 1;
- e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (eti));
- eti->needs_redraw = 1;
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (eti));
-}
-
-/**
- * e_table_item_redraw_range
- * @eti: %ETableItem which will be redrawn
- * @start_col: The first col to redraw.
- * @start_row: The first row to redraw.
- * @end_col: The last col to redraw.
- * @end_row: The last row to redraw.
- *
- * This routine redraws the given %ETableItem in the range given. The
- * range is inclusive at both ends.
- */
-void
-e_table_item_redraw_range (ETableItem *eti,
- int start_col, int start_row,
- int end_col, int end_row)
-{
- int border;
- int cursor_col, cursor_row;
-
- g_return_if_fail (eti != NULL);
- g_return_if_fail (E_IS_TABLE_ITEM (eti));
-
- gtk_object_get(GTK_OBJECT(eti->selection),
- "cursor_col", &cursor_col,
- "cursor_row", &cursor_row,
- NULL);
-
- if ((start_col == cursor_col) ||
- (end_col == cursor_col) ||
- (view_to_model_row(eti, start_row) == cursor_row) ||
- (view_to_model_row(eti, end_row) == cursor_row))
- border = 2;
- else
- border = 0;
-
- eti_request_region_redraw(eti, start_col, start_row, end_col, end_row, border);
-}
-
-static void
-e_table_item_redraw_row (ETableItem *eti,
- int row)
-{
- e_table_item_redraw_range (eti, 0, row, eti->cols - 1, row);
-}
-
-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_pre_change_id = gtk_signal_connect (
- GTK_OBJECT (table_model), "model_pre_change",
- GTK_SIGNAL_FUNC (eti_table_model_pre_change), eti);
-
- eti->table_model_no_change_id = gtk_signal_connect (
- GTK_OBJECT (table_model), "model_no_change",
- GTK_SIGNAL_FUNC (eti_table_model_no_change), eti);
-
- eti->table_model_change_id = gtk_signal_connect (
- GTK_OBJECT (table_model), "model_changed",
- GTK_SIGNAL_FUNC (eti_table_model_changed), eti);
-
- eti->table_model_row_change_id = gtk_signal_connect (
- GTK_OBJECT (table_model), "model_row_changed",
- GTK_SIGNAL_FUNC (eti_table_model_row_changed), eti);
-
- eti->table_model_cell_change_id = gtk_signal_connect (
- GTK_OBJECT (table_model), "model_cell_changed",
- GTK_SIGNAL_FUNC (eti_table_model_cell_changed), eti);
-
- eti->table_model_rows_inserted_id = gtk_signal_connect (
- GTK_OBJECT (table_model), "model_rows_inserted",
- GTK_SIGNAL_FUNC (eti_table_model_rows_inserted), eti);
-
- eti->table_model_rows_deleted_id = gtk_signal_connect (
- GTK_OBJECT (table_model), "model_rows_deleted",
- GTK_SIGNAL_FUNC (eti_table_model_rows_deleted), eti);
-
- if (eti->header) {
- eti_detach_cell_views (eti);
- eti_attach_cell_views (eti);
- }
-
- if (E_IS_TABLE_SUBSET(table_model)) {
- eti->uses_source_model = 1;
- eti->source_model = E_TABLE_SUBSET(table_model)->source;
- if (eti->source_model)
- gtk_object_ref(GTK_OBJECT(eti->source_model));
- }
-
- eti_freeze (eti);
- eti_table_model_changed (table_model, eti);
-}
-
-static void
-eti_add_selection_model (ETableItem *eti, ESelectionModel *selection)
-{
- g_assert (eti->selection == NULL);
-
- eti->selection = selection;
- gtk_object_ref (GTK_OBJECT (eti->selection));
-
- eti->selection_change_id = gtk_signal_connect (
- GTK_OBJECT (selection), "selection_changed",
- GTK_SIGNAL_FUNC (eti_selection_change), eti);
-
- eti->selection_row_change_id = gtk_signal_connect (
- GTK_OBJECT (selection), "selection_row_changed",
- GTK_SIGNAL_FUNC (eti_selection_row_change), eti);
-
- eti->cursor_change_id = gtk_signal_connect (
- GTK_OBJECT (selection), "cursor_changed",
- GTK_SIGNAL_FUNC (eti_cursor_change), eti);
-
- eti->cursor_activated_id = gtk_signal_connect (
- GTK_OBJECT (selection), "cursor_activated",
- GTK_SIGNAL_FUNC (eti_cursor_activated), eti);
-
- eti_selection_change(selection, eti);
-}
-
-static void
-eti_header_dim_changed (ETableHeader *eth, int col, ETableItem *eti)
-{
- eti->needs_compute_width = 1;
- e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (eti));
- eti->needs_redraw = 1;
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (eti));
-}
-
-static void
-eti_header_structure_changed (ETableHeader *eth, ETableItem *eti)
-{
- eti->cols = e_table_header_count (eti->header);
-
- /*
- * There should be at least one column
- * BUT: then you can't remove all columns from a header and add new ones.
- */
- /*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_attach_cell_views (eti);
- eti_realize_cell_views (eti);
- }
- }
- eti->needs_compute_width = 1;
- e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (eti));
- eti->needs_redraw = 1;
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (eti));
-}
-
-static int
-eti_request_column_width (ETableHeader *eth, int col, ETableItem *eti)
-{
- int width = 0;
-
- if (eti->cell_views && eti->cell_views_realized) {
- width = e_cell_max_width (eti->cell_views[col], view_to_model_col(eti, col), col);
- }
-
- return width;
-}
-
-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);
-
- eti->header_request_width_id = gtk_signal_connect
- (GTK_OBJECT (header), "request_width",
- GTK_SIGNAL_FUNC (eti_request_column_width), 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);
- eti_remove_selection_model (eti);
-
- if (eti->height_cache_idle_id) {
- g_source_remove(eti->height_cache_idle_id);
- eti->height_cache_idle_id = 0;
- }
-
- if (eti->height_cache)
- g_free (eti->height_cache);
- eti->height_cache = NULL;
- eti->height_cache_idle_count = 0;
-
- e_canvas_hide_tooltip (E_CANVAS(GNOME_CANVAS_ITEM(eti)->canvas));
- if (eti->tooltip) {
- if (eti->tooltip->background)
- gdk_color_free (eti->tooltip->background);
- if (eti->tooltip->foreground)
- gdk_color_free (eti->tooltip->foreground);
- if (eti->tooltip->timer) {
- gtk_timeout_remove (eti->tooltip->timer);
- eti->tooltip->timer = 0;
- }
- g_free (eti->tooltip);
- }
- eti->tooltip = NULL;
-
- 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;
- int cursor_col;
-
- 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, E_TABLE_HEADER(GTK_VALUE_OBJECT (*arg)));
- break;
-
- case ARG_TABLE_MODEL:
- eti_remove_table_model (eti);
- eti_add_table_model (eti, E_TABLE_MODEL(GTK_VALUE_OBJECT (*arg)));
- break;
-
- case ARG_SELECTION_MODEL:
- eti_remove_selection_model (eti);
- if (GTK_VALUE_OBJECT (*arg))
- eti_add_selection_model (eti, E_SELECTION_MODEL(GTK_VALUE_OBJECT (*arg)));
- break;
-
- case ARG_LENGTH_THRESHOLD:
- eti->length_threshold = GTK_VALUE_INT (*arg);
- break;
-
- case ARG_TABLE_ALTERNATING_ROW_COLORS:
- eti->alternating_row_colors = GTK_VALUE_BOOL (*arg);
- break;
-
- case ARG_TABLE_HORIZONTAL_DRAW_GRID:
- eti->horizontal_draw_grid = GTK_VALUE_BOOL (*arg);
- break;
-
- case ARG_TABLE_VERTICAL_DRAW_GRID:
- eti->vertical_draw_grid = GTK_VALUE_BOOL (*arg);
- break;
-
- case ARG_TABLE_DRAW_FOCUS:
- eti->draw_focus = GTK_VALUE_BOOL (*arg);
- break;
-
- case ARG_CURSOR_MODE:
- eti->cursor_mode = GTK_VALUE_INT (*arg);
- break;
-
- case ARG_MINIMUM_WIDTH:
- case ARG_WIDTH:
- if ((eti->minimum_width == eti->width && GTK_VALUE_DOUBLE (*arg) > eti->width) ||
- GTK_VALUE_DOUBLE (*arg) < eti->width) {
- eti->needs_compute_width = 1;
- e_canvas_item_request_reflow (GNOME_CANVAS_ITEM(eti));
- }
- eti->minimum_width = GTK_VALUE_DOUBLE (*arg);
- break;
- case ARG_CURSOR_ROW:
- gtk_object_get(GTK_OBJECT(eti->selection),
- "cursor_col", &cursor_col,
- NULL);
-
- e_table_item_focus (eti, cursor_col != -1 ? cursor_col : 0, view_to_model_row(eti, GTK_VALUE_INT (*arg)), 0);
- break;
- case ARG_UNIFORM_ROW_HEIGHT:
- if (eti->uniform_row_height != GTK_VALUE_BOOL (*arg)) {
- eti->uniform_row_height = GTK_VALUE_BOOL (*arg);
- if (GTK_OBJECT_FLAGS(eti) & GNOME_CANVAS_ITEM_REALIZED) {
- free_height_cache(eti);
- eti->needs_compute_height = 1;
- e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (eti));
- eti->needs_redraw = 1;
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (eti));
- }
- }
- break;
- }
- eti->needs_redraw = 1;
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(eti));
-}
-
-static void
-eti_get_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- GnomeCanvasItem *item;
- ETableItem *eti;
- int row;
-
- 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;
- case ARG_MINIMUM_WIDTH:
- GTK_VALUE_DOUBLE (*arg) = eti->minimum_width;
- break;
- case ARG_CURSOR_ROW:
- gtk_object_get(GTK_OBJECT(eti->selection),
- "cursor_row", &row,
- NULL);
- GTK_VALUE_INT (*arg) = model_to_view_row(eti, row);
- break;
- case ARG_UNIFORM_ROW_HEIGHT:
- GTK_VALUE_BOOL (*arg) = eti->uniform_row_height;
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-static void
-eti_init (GnomeCanvasItem *item)
-{
- ETableItem *eti = E_TABLE_ITEM (item);
-
- eti->editing_col = -1;
- eti->editing_row = -1;
- eti->height = 0;
- eti->width = 0;
- eti->minimum_width = 0;
-
- eti->save_col = -1;
- eti->save_row = -1;
- eti->save_state = NULL;
-
- eti->click_count = 0;
-
- eti->height_cache = NULL;
- eti->height_cache_idle_id = 0;
- eti->height_cache_idle_count = 0;
-
- eti->length_threshold = -1;
- eti->uniform_row_height = FALSE;
-
- eti->uses_source_model = 0;
- eti->source_model = NULL;
-
- eti->row_guess = -1;
- eti->cursor_mode = E_CURSOR_SIMPLE;
-
- eti->selection_change_id = 0;
- eti->selection_row_change_id = 0;
- eti->cursor_change_id = 0;
- eti->cursor_activated_id = 0;
- eti->selection = NULL;
-
- eti->old_cursor_row = -1;
-
- eti->needs_redraw = 0;
- eti->needs_compute_height = 0;
-
- eti->in_key_press = 0;
-
- eti->tooltip = g_new0 (ETableTooltip, 1);
- eti->tooltip->timer = 0;
- eti->tooltip->eti = GNOME_CANVAS_ITEM (eti);
- eti->tooltip->background = NULL;
- eti->tooltip->foreground = NULL;
-
- eti->maybe_did_something = TRUE;
-
- eti->grabbed_count = 0;
- eti->gtk_grabbed = 0;
-
- eti->in_drag = 0;
- eti->maybe_in_drag = 0;
- eti->grabbed = 0;
-
- eti->grabbed_col = -1;
- eti->grabbed_row = -1;
-
- eti->cursor_on_screen = FALSE;
- eti->cursor_x1 = -1;
- eti->cursor_y1 = -1;
- eti->cursor_x2 = -1;
- eti->cursor_y2 = -1;
-
- eti->rows = -1;
-
- eti->frozen_count = 0;
- eti->queue_show_cursor = FALSE;
-
- e_canvas_item_set_reflow_callback (GNOME_CANVAS_ITEM (eti), eti_reflow);
-}
-
-#define gray50_width 2
-#define gray50_height 2
-static const char gray50_bits[] = {
- 0x02, 0x01, };
-
-static void
-adjustment_changed (GtkAdjustment *adjustment, ETableItem *eti)
-{
- eti_check_cursor_on_screen (eti);
-}
-
-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);
-
-
- eti->rows = e_table_model_row_count (eti->table_model);
-
- /*
- * Gdk Resource allocation
- */
- window = canvas_widget->window;
-
- eti->fill_gc = gdk_gc_new (window);
-
- eti->grid_gc = gdk_gc_new (window);
- gdk_gc_set_foreground (eti->grid_gc, &canvas_widget->style->dark [GTK_STATE_NORMAL]);
- eti->focus_gc = gdk_gc_new (window);
- gdk_gc_set_foreground (eti->focus_gc, &canvas_widget->style->bg [GTK_STATE_NORMAL]);
- gdk_gc_set_background (eti->focus_gc, &canvas_widget->style->fg [GTK_STATE_NORMAL]);
- eti->stipple = gdk_bitmap_create_from_data (NULL, gray50_bits, gray50_width, gray50_height);
- gdk_gc_set_ts_origin (eti->focus_gc, 0, 0);
- gdk_gc_set_stipple (eti->focus_gc, eti->stipple);
- gdk_gc_set_fill (eti->focus_gc, GDK_OPAQUE_STIPPLED);
-
- eti->hadjustment_change_id =
- gtk_signal_connect(GTK_OBJECT(gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas))), "changed",
- GTK_SIGNAL_FUNC (adjustment_changed), eti);
- eti->hadjustment_value_change_id =
- gtk_signal_connect(GTK_OBJECT(gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas))), "value_changed",
- GTK_SIGNAL_FUNC (adjustment_changed), eti);
- eti->vadjustment_change_id =
- gtk_signal_connect(GTK_OBJECT(gtk_layout_get_vadjustment(GTK_LAYOUT(item->canvas))), "changed",
- GTK_SIGNAL_FUNC (adjustment_changed), eti);
- eti->vadjustment_value_change_id =
- gtk_signal_connect(GTK_OBJECT(gtk_layout_get_vadjustment(GTK_LAYOUT(item->canvas))), "value_changed",
- GTK_SIGNAL_FUNC (adjustment_changed), eti);
-
- if (eti->cell_views == NULL)
- eti_attach_cell_views (eti);
-
- eti_realize_cell_views (eti);
-
- free_height_cache(eti);
-
- eti->needs_compute_height = 1;
- eti->needs_compute_width = 1;
- e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (eti));
- eti->needs_redraw = 1;
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (eti));
-}
-
-static void
-eti_unrealize (GnomeCanvasItem *item)
-{
- ETableItem *eti = E_TABLE_ITEM (item);
-
- if (eti->grabbed) {
- eti->grabbed = FALSE;
- d(g_print ("%s: eti_ungrab\n", __FUNCTION__));
- eti_ungrab (eti, -1);
- }
-
- if (eti_editing (eti))
- e_table_item_leave_edit_(eti);
-
- if (eti->height_cache_idle_id) {
- g_source_remove(eti->height_cache_idle_id);
- eti->height_cache_idle_id = 0;
- }
-
- if (eti->height_cache)
- g_free (eti->height_cache);
- eti->height_cache = NULL;
- eti->height_cache_idle_count = 0;
-
- e_canvas_hide_tooltip (E_CANVAS(GNOME_CANVAS_ITEM(eti)->canvas));
- if (eti->tooltip->background) {
- gdk_color_free (eti->tooltip->background);
- eti->tooltip->background = NULL;
- }
- if (eti->tooltip->foreground) {
- gdk_color_free (eti->tooltip->foreground);
- eti->tooltip->foreground = NULL;
- }
- if (eti->tooltip->timer) {
- gtk_timeout_remove (eti->tooltip->timer);
- eti->tooltip->timer = 0;
- }
-
- 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;
-
- gtk_signal_disconnect(GTK_OBJECT(gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas))),
- eti->hadjustment_change_id);
- gtk_signal_disconnect(GTK_OBJECT(gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas))),
- eti->hadjustment_value_change_id);
- gtk_signal_disconnect(GTK_OBJECT(gtk_layout_get_vadjustment(GTK_LAYOUT(item->canvas))),
- eti->vadjustment_change_id);
- gtk_signal_disconnect(GTK_OBJECT(gtk_layout_get_vadjustment(GTK_LAYOUT(item->canvas))),
- eti->vadjustment_value_change_id);
-
- 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;
- 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, lower_right;
- GtkWidget *canvas = GTK_WIDGET(item->canvas);
- int height_extra = eti->horizontal_draw_grid ? 1 : 0;
-
- /*
- * 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);
-
- eti_base_item.x = eti->x1 + eti->width;
- eti_base_item.y = eti->y1 + eti->height;
- art_affine_point (&lower_right, &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.
- */
- if (eti->uniform_row_height) {
- first_row = (y - floor (eti_base.y) - height_extra) / (eti_row_height (eti, -1) + height_extra);
- last_row = (y + height - floor (eti_base.y) ) / (eti_row_height (eti, -1) + height_extra) + 1;
- if (first_row > last_row)
- return;
- y_offset = floor (eti_base.y) - y + height_extra + first_row * (eti_row_height (eti, -1) + height_extra);
- if (first_row < 0)
- first_row = 0;
- if (last_row > eti->rows)
- last_row = eti->rows;
- } else {
- int y1, y2;
-
- y_offset = 0;
- first_row = -1;
-
- y1 = y2 = floor (eti_base.y) + height_extra;
- for (row = 0; row < rows; row++, y1 = y2){
-
- y2 += ETI_ROW_HEIGHT (eti, row) + height_extra;
-
- 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->horizontal_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 += height_extra;
-
- for (row = first_row; row < last_row; row++){
- int xd, height;
- gboolean selected;
- gint cursor_col, cursor_row;
-
- height = ETI_ROW_HEIGHT (eti, row);
-
- xd = x_offset;
-/* printf ("paint: %d %d\n", yd, yd + height); */
-
- selected = e_selection_model_is_row_selected(E_SELECTION_MODEL (eti->selection), view_to_model_row(eti,row));
-
- gtk_object_get(GTK_OBJECT(eti->selection),
- "cursor_col", &cursor_col,
- "cursor_row", &cursor_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];
- gboolean col_selected = selected;
- gboolean cursor = FALSE;
- ECellFlags flags;
- gboolean free_background;
- GdkColor *background;
-
- switch (eti->cursor_mode) {
- case E_CURSOR_SIMPLE:
- case E_CURSOR_SPREADSHEET:
- if (cursor_col == ecol->col_idx && cursor_row == view_to_model_row(eti, row)) {
- col_selected = !col_selected;
- cursor = TRUE;
- }
- break;
- case E_CURSOR_LINE:
- /* Nothing */
- break;
- }
-
- background = eti_get_cell_background_color (eti, row, col, col_selected, &free_background);
-
- gdk_gc_set_foreground (eti->fill_gc, background);
- gdk_draw_rectangle (drawable, eti->fill_gc, TRUE,
- xd, yd, ecol->width, height);
-
- if (free_background)
- gdk_color_free (background);
-
- flags = col_selected ? E_CELL_SELECTED : 0;
- flags |= GTK_WIDGET_HAS_FOCUS(canvas) ? E_CELL_FOCUSED : 0;
- flags |= cursor ? E_CELL_CURSOR : 0;
-
- switch (ecol->justification) {
- case GTK_JUSTIFY_LEFT:
- flags |= E_CELL_JUSTIFY_LEFT;
- break;
- case GTK_JUSTIFY_RIGHT:
- flags |= E_CELL_JUSTIFY_RIGHT;
- break;
- case GTK_JUSTIFY_CENTER:
- flags |= E_CELL_JUSTIFY_CENTER;
- break;
- case GTK_JUSTIFY_FILL:
- flags |= E_CELL_JUSTIFY_FILL;
- break;
- }
-
- e_cell_draw (ecell_view, drawable, ecol->col_idx, col, row, flags,
- xd, yd, xd + ecol->width, yd + height);
-
- if (!f_found) {
- switch (eti->cursor_mode) {
- case E_CURSOR_LINE:
- if (view_to_model_row(eti, row) == cursor_row) {
- f_x1 = floor (eti_base.x) - x;
- f_x2 = floor (lower_right.x) - x;
- f_y1 = yd;
- f_y2 = yd + height;
- f_found = TRUE;
- }
- break;
- case E_CURSOR_SIMPLE:
- case E_CURSOR_SPREADSHEET:
- if (view_to_model_col(eti, col) == cursor_col && view_to_model_row(eti, row) == cursor_row) {
- f_x1 = xd;
- f_x2 = xd + ecol->width;
- f_y1 = yd;
- f_y2 = yd + height;
- f_found = TRUE;
- }
- break;
- }
- }
-
- xd += ecol->width;
- }
- yd += height;
-
- if (eti->horizontal_draw_grid) {
- gdk_draw_line (
- drawable, eti->grid_gc,
- eti_base.x - x, yd, eti_base.x + eti->width - x, yd);
-
- yd++;
- }
- }
-
- if (eti->vertical_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 (eti->draw_focus && f_found) {
- gdk_gc_set_ts_origin (eti->focus_gc, f_x1, f_y1);
- gdk_draw_rectangle (drawable, eti->focus_gc, FALSE,
- f_x1, f_y1, f_x2 - f_x1 - 1, 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 *view_col_res, int *view_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;
-
- int height_extra = eti->horizontal_draw_grid ? 1 : 0;
-
- /* FIXME: this routine is inneficient, fix later */
-
- if (eti->grabbed_col >= 0 && eti->grabbed_row >= 0) {
- *view_col_res = eti->grabbed_col;
- *view_row_res = eti->grabbed_row;
- *x1_res = x - eti->x1 - e_table_header_col_diff (eti->header, 0, eti->grabbed_col);
- *y1_res = y - eti->y1 - e_table_item_row_diff (eti, 0, eti->grabbed_row);
- return TRUE;
- }
-
- if (cols == 0 || rows == 0)
- return FALSE;
-
- x -= eti->x1;
- y -= eti->y1;
-
- x1 = 0;
- for (col = 0; col < cols - 1; 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)
- break;
- }
-
- if (eti->uniform_row_height) {
- if (y < height_extra)
- return FALSE;
- row = (y - height_extra) / (eti_row_height (eti, -1) + height_extra);
- y1 = row * (eti_row_height (eti, -1) + height_extra) + height_extra;
- if (row >= eti->rows)
- return FALSE;
- } else {
- y1 = y2 = height_extra;
- if (y < height_extra)
- return FALSE;
- for (row = 0; row < rows - 1; row++, y1 = y2){
- y2 += ETI_ROW_HEIGHT (eti, row) + height_extra;
-
- if (y <= y2)
- break;
- }
- }
- *view_col_res = col;
- if (x1_res)
- *x1_res = x - x1;
- *view_row_res = row;
- if (y1_res)
- *y1_res = y - y1;
- return TRUE;
-}
-
-static void
-eti_cursor_move (ETableItem *eti, gint row, gint column)
-{
- e_table_item_leave_edit_(eti);
- e_table_item_focus (eti, view_to_model_col(eti, column), view_to_model_row(eti, row), 0);
-}
-
-static void
-eti_cursor_move_left (ETableItem *eti)
-{
- int cursor_col, cursor_row;
- gtk_object_get(GTK_OBJECT(eti->selection),
- "cursor_col", &cursor_col,
- "cursor_row", &cursor_row,
- NULL);
-
- eti_cursor_move (eti, model_to_view_row(eti, cursor_row), model_to_view_col(eti, cursor_col) - 1);
-}
-
-static void
-eti_cursor_move_right (ETableItem *eti)
-{
- int cursor_col, cursor_row;
- gtk_object_get(GTK_OBJECT(eti->selection),
- "cursor_col", &cursor_col,
- "cursor_row", &cursor_row,
- NULL);
-
- eti_cursor_move (eti, model_to_view_row(eti, cursor_row), model_to_view_col(eti, cursor_col) + 1);
-}
-
-#ifdef DO_TOOLTIPS
-static int
-_do_tooltip (ETableItem *eti)
-{
- ECellView *ecell_view;
- gboolean free_color;
- ETableCol *ecol;
- gboolean selected;
- int cursor_row, cursor_col;
-
- e_canvas_hide_tooltip (E_CANVAS(GNOME_CANVAS_ITEM(eti)->canvas));
-
- if (eti_editing (eti))
- return FALSE;
-
- ecell_view = eti->cell_views[eti->tooltip->col];
-
- eti->tooltip->x = e_table_header_col_diff (eti->header, 0, eti->tooltip->col);
-
- eti->tooltip->y = e_table_item_row_diff (eti, 0, eti->tooltip->row);
- eti->tooltip->row_height = ETI_ROW_HEIGHT (eti, eti->tooltip->row);
-
- selected = e_selection_model_is_row_selected(E_SELECTION_MODEL (eti->selection), view_to_model_row(eti,eti->tooltip->row));
-
- if (eti->tooltip->foreground)
- gdk_color_free (eti->tooltip->foreground);
- if (eti->tooltip->background)
- gdk_color_free (eti->tooltip->background);
-
- switch (eti->cursor_mode) {
- case E_CURSOR_SIMPLE:
- case E_CURSOR_SPREADSHEET:
- ecol = e_table_header_get_column (eti->header, eti->tooltip->col);
-
- gtk_object_get(GTK_OBJECT(eti->selection),
- "cursor_row", &cursor_row,
- "cursor_col", &cursor_col,
- NULL);
-
- if (cursor_col == ecol->col_idx && cursor_row == view_to_model_row(eti, eti->tooltip->row))
- selected = !selected;
- break;
- case E_CURSOR_LINE:
- /* Nothing */
- break;
- }
-
- eti->tooltip->background = eti_get_cell_background_color (eti, eti->tooltip->row, eti->tooltip->col, selected, &free_color);
- if (!free_color)
- eti->tooltip->background = gdk_color_copy(eti->tooltip->background);
-
- eti->tooltip->foreground = eti_get_cell_foreground_color (eti, eti->tooltip->row, eti->tooltip->col, selected, &free_color);
- if (!free_color)
- eti->tooltip->foreground = gdk_color_copy(eti->tooltip->foreground);
-
- e_cell_show_tooltip (ecell_view,
- view_to_model_col (eti, eti->tooltip->col),
- eti->tooltip->col,
- eti->tooltip->row,
- eti->header->columns[eti->tooltip->col]->width,
- eti->tooltip);
- return FALSE;
-}
-#endif
-
-static gint
-eti_e_cell_event (ETableItem *item, ECellView *ecell_view, GdkEvent *event, int time, int model_col, int view_col, int row, ECellFlags flags)
-{
- ECellActions actions = 0;
- gint ret_val;
-
- ret_val = e_cell_event (ecell_view, event, model_col, view_col, row, flags, &actions);
-
- if (actions & E_CELL_GRAB) {
- d(g_print ("%s: eti_grab\n", __FUNCTION__));
- eti_grab (item, time);
- item->grabbed_col = view_col;
- item->grabbed_row = row;
- }
-
- if (actions & E_CELL_UNGRAB) {
- d(g_print ("%s: eti_ungrab\n", __FUNCTION__));
- eti_ungrab (item, time);
- item->grabbed_col = -1;
- item->grabbed_row = -1;
- }
-
- return ret_val;
-}
-
-/* FIXME: cursor */
-static int
-eti_event (GnomeCanvasItem *item, GdkEvent *e)
-{
- ETableItem *eti = E_TABLE_ITEM (item);
- ECellView *ecell_view;
- gint return_val = TRUE;
-#if d(!)0
- gboolean leave = FALSE;
-#endif
-
- switch (e->type){
- case GDK_BUTTON_PRESS: {
- double x1, y1;
- double realx, realy;
- GdkEventButton button;
- int col, row;
- gint cursor_row, cursor_col;
- gint new_cursor_row, new_cursor_col;
- ECellFlags flags = 0;
-
- d(g_print("%s: GDK_BUTTON_PRESS received, button %d\n", __FUNCTION__, e->button.button));
-
- if (eti->tooltip->timer) {
- gtk_timeout_remove (eti->tooltip->timer);
- eti->tooltip->timer = 0;
- }
-
- switch (e->button.button) {
- case 1: /* Fall through. */
- case 2:
- e_canvas_item_grab_focus(GNOME_CANVAS_ITEM(eti), TRUE);
- gnome_canvas_item_w2i (item, &e->button.x, &e->button.y);
-
- realx = e->button.x;
- realy = e->button.y;
-
- if (!find_cell (eti, realx, realy, &col, &row, &x1, &y1)) {
- if (eti_editing (eti))
- e_table_item_leave_edit_(eti);
- return TRUE;
- }
-
- ecell_view = eti->cell_views [col];
- button = *(GdkEventButton *)e;
- button.x = x1;
- button.y = y1;
-
- gtk_object_get(GTK_OBJECT(eti->selection),
- "cursor_row", &cursor_row,
- "cursor_col", &cursor_col,
- NULL);
-
- if (cursor_col == view_to_model_col (eti, col) && cursor_row == view_to_model_row(eti, row)) {
- flags = E_CELL_CURSOR;
- } else {
- flags = 0;
- }
-
- return_val = eti_e_cell_event (eti, ecell_view, (GdkEvent *) &button, button.time, view_to_model_col(eti, col), col, row, flags);
- if (return_val)
- return TRUE;
-
- gtk_signal_emit (GTK_OBJECT (eti), eti_signals [CLICK],
- row, view_to_model_col(eti, col), &button, &return_val);
-
- if (return_val) {
- eti->click_count = 0;
- return TRUE;
- }
-
- gtk_object_get(GTK_OBJECT(eti->selection),
- "cursor_row", &cursor_row,
- "cursor_col", &cursor_col,
- NULL);
-
- eti->maybe_did_something =
- e_selection_model_maybe_do_something(E_SELECTION_MODEL (eti->selection), view_to_model_row(eti, row), view_to_model_col(eti, col), button.state);
- gtk_object_get(GTK_OBJECT(eti->selection),
- "cursor_row", &new_cursor_row,
- "cursor_col", &new_cursor_col,
- NULL);
-
- if (cursor_row != new_cursor_row || cursor_col != new_cursor_col) {
- eti->click_count = 1;
- } else {
- eti->click_count ++;
- eti->row_guess = row;
-
- if ((!eti_editing(eti)) && e_table_model_is_cell_editable(eti->table_model, cursor_col, row)) {
- e_table_item_enter_edit (eti, col, row);
- }
-
- /*
- * Adjust the event positions
- */
-
- if (eti_editing (eti)) {
- return_val = eti_e_cell_event (eti, ecell_view, (GdkEvent *) &button, button.time,
- view_to_model_col(eti, col), col, row, E_CELL_EDITING | E_CELL_CURSOR);
- if (return_val)
- return TRUE;
- }
- }
-
- if (e->button.button == 1) {
- return_val = TRUE;
-
- eti->maybe_in_drag = TRUE;
- eti->drag_row = new_cursor_row;
- eti->drag_col = new_cursor_col;
- eti->drag_x = realx;
- eti->drag_y = realy;
- eti->drag_state = e->button.state;
- eti->grabbed = TRUE;
- d(g_print ("%s: eti_grab\n", __FUNCTION__));
- eti_grab (eti, e->button.time);
- }
-
- break;
- case 3:
- e_canvas_item_grab_focus(GNOME_CANVAS_ITEM(eti), TRUE);
- 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;
-
- e_selection_model_right_click_down(E_SELECTION_MODEL (eti->selection), view_to_model_row(eti, row), view_to_model_col(eti, col), 0);
-
- gtk_signal_emit (GTK_OBJECT (eti), eti_signals [RIGHT_CLICK],
- row, view_to_model_col(eti, col), e, &return_val);
- if (!return_val)
- e_selection_model_right_click_up(E_SELECTION_MODEL (eti->selection));
- break;
- case 4:
- case 5:
- return FALSE;
- break;
-
- }
- break;
- }
-
- case GDK_BUTTON_RELEASE: {
- double x1, y1;
- int col, row;
- gint cursor_row, cursor_col;
-
- d(g_print("%s: GDK_BUTTON_RELEASE received, button %d\n", __FUNCTION__, e->button.button));
-
- if (eti->grabbed) {
- d(g_print ("%s: eti_ungrab\n", __FUNCTION__));
- eti_ungrab (eti, e->button.time);
- eti->grabbed = FALSE;
- }
-
- if (e->button.button == 1) {
- if (eti->maybe_in_drag) {
- eti->maybe_in_drag = FALSE;
- if (!eti->maybe_did_something)
- e_selection_model_do_something(E_SELECTION_MODEL (eti->selection), eti->drag_row, eti->drag_col, eti->drag_state);
- }
- if (eti->in_drag) {
- eti->in_drag = FALSE;
- }
- }
-
- if (eti->tooltip->timer) {
- gtk_timeout_remove (eti->tooltip->timer);
- eti->tooltip->timer = 0;
- }
- e_canvas_hide_tooltip (E_CANVAS(GNOME_CANVAS_ITEM(eti)->canvas));
- switch (e->button.button) {
- case 1: /* Fall through. */
- case 2:
-
- gnome_canvas_item_w2i (item, &e->button.x, &e->button.y);
-#if d(!)0
- {
- gboolean cell_found = find_cell (eti, e->button.x, e->button.y, &col, &row, &x1, &y1);
- g_print("%s: find_cell(%f, %f) = %s(%d, %d, %f, %f)\n", __FUNCTION__, e->button.x, e->button.y,
- cell_found?"true":"false", col, row, x1, y1);
- }
-#endif
-
- if (!find_cell (eti, e->button.x, e->button.y, &col, &row, &x1, &y1))
- return TRUE;
-
- gtk_object_get(GTK_OBJECT(eti->selection),
- "cursor_row", &cursor_row,
- "cursor_col", &cursor_col,
- NULL);
-
-
- d(g_print("%s: GDK_BUTTON_RELEASE received, button %d, line: %d\n"
- "eti_editing: %s, row:%d:%d, col:%d:%d\n", __FUNCTION__, e->button.button, __LINE__,
- eti_editing(eti)?"true":"false", cursor_row, view_to_model_row(eti, row), cursor_col, view_to_model_col(eti, col)));
-
- if (eti_editing (eti) && cursor_row == view_to_model_row(eti, row) && cursor_col == view_to_model_col(eti, col)){
-
- d(g_print("%s: GDK_BUTTON_RELEASE received, button %d, line: %d\n", __FUNCTION__, e->button.button, __LINE__))
-;
-
- ecell_view = eti->cell_views [col];
-
- /*
- * Adjust the event positions
- */
- e->button.x = x1;
- e->button.y = y1;
-
- return_val = eti_e_cell_event (eti, ecell_view, e, e->button.time,
- view_to_model_col(eti, col), col, row, E_CELL_EDITING | E_CELL_CURSOR);
- }
- break;
- case 3:
- e_selection_model_right_click_up(E_SELECTION_MODEL (eti->selection));
- return_val = TRUE;
- break;
- case 4:
- case 5:
- return FALSE;
- break;
-
- }
- break;
- }
-
- case GDK_2BUTTON_PRESS: {
- int model_col, model_row;
-#if 0
- double x1, y1;
-#endif
-
- d(g_print("%s: GDK_2BUTTON_PRESS received, button %d\n", __FUNCTION__, e->button.button));
-
- if (e->button.button == 5 ||
- e->button.button == 4)
- return FALSE;
-
- /*
- * click_count is so that if you click on two
- * different rows we don't send a double click signal.
- */
-
- if (eti->click_count >= 2) {
-
- gnome_canvas_item_w2i (item, &e->button.x, &e->button.y);
-
-#if 0
- if (!find_cell (eti, e->button.x, e->button.y, &current_col, &current_row, &x1, &y1))
- return TRUE;
-#endif
-
- gtk_object_get(GTK_OBJECT(eti->selection),
- "cursor_row", &model_row,
- "cursor_col", &model_col,
- NULL);
-
- e->button.x -= e_table_header_col_diff (eti->header, 0, model_to_view_col (eti, model_col));
- e->button.y -= e_table_item_row_diff (eti, 0, model_to_view_row (eti, model_row));
-
-#if 0
- button.x = x1;
- button.y = y1;
-#endif
-
- if (e->button.button == 1) {
- if (eti->maybe_in_drag) {
- eti->maybe_in_drag = FALSE;
- if (!eti->maybe_did_something)
- e_selection_model_do_something(E_SELECTION_MODEL (eti->selection), eti->drag_row, eti->drag_col, eti->drag_state);
- }
- if (eti->in_drag) {
- eti->in_drag = FALSE;
- }
- }
-
- if (eti->grabbed) {
- d(g_print ("%s: eti_ungrab\n", __FUNCTION__));
- eti_ungrab (eti, e->button.time);
- eti->grabbed = FALSE;
- }
-
- if (model_row != -1 && model_col != -1) {
- gtk_signal_emit (GTK_OBJECT (eti), eti_signals [DOUBLE_CLICK],
- model_row, model_col, e);
- }
- }
- break;
- }
- case GDK_MOTION_NOTIFY: {
- int col, row;
- double x1, y1;
- gint cursor_col, cursor_row;
-
- gnome_canvas_item_w2i (item, &e->motion.x, &e->motion.y);
-
- if (eti->maybe_in_drag) {
- if (abs (e->motion.x - eti->drag_x) >= 3 ||
- abs (e->motion.y - eti->drag_y) >= 3) {
- gint drag_handled;
-
- eti->maybe_in_drag = 0;
- gtk_signal_emit (GTK_OBJECT (eti), eti_signals [START_DRAG],
- eti->drag_row, eti->drag_col, e, &drag_handled);
- if (drag_handled)
- eti->in_drag = 1;
- else
- eti->in_drag = 0;
- }
- }
-
- if (!find_cell (eti, e->motion.x, e->motion.y, &col, &row, &x1, &y1))
- return TRUE;
-
- gtk_object_get(GTK_OBJECT(eti->selection),
- "cursor_row", &cursor_row,
- "cursor_col", &cursor_col,
- NULL);
-
- e_canvas_hide_tooltip (E_CANVAS(GNOME_CANVAS_ITEM(eti)->canvas));
-
-#ifdef DO_TOOLTIPS
- if (!g_getenv ("GAL_DONT_DO_TOOLTIPS")) {
- if (eti->tooltip->timer > 0)
- gtk_timeout_remove (eti->tooltip->timer);
- eti->tooltip->col = col;
- eti->tooltip->row = row;
- eti->tooltip->cx = e->motion.x;
- eti->tooltip->cy = e->motion.y;
- eti->tooltip->timer = gtk_timeout_add (100, (GSourceFunc)_do_tooltip, eti);
- }
-#endif
-
- if (cursor_row == view_to_model_row(eti, row) && cursor_col == view_to_model_col(eti, col)){
- ecell_view = eti->cell_views [col];
-
- /*
- * Adjust the event positions
- */
- e->motion.x = x1;
- e->motion.y = y1;
-
- return_val = eti_e_cell_event (eti, ecell_view, e, e->motion.time,
- view_to_model_col(eti, col), col, row, E_CELL_EDITING | E_CELL_CURSOR);
- }
- break;
- }
-
- case GDK_KEY_PRESS: {
- gint cursor_row, cursor_col;
- gint handled = TRUE;
-
- d(g_print("%s: GDK_KEY_PRESS received, keyval: %d\n", __FUNCTION__, (int) e->key.keyval));
-
- gtk_object_get(GTK_OBJECT(eti->selection),
- "cursor_row", &cursor_row,
- "cursor_col", &cursor_col,
- NULL);
-
- if (eti->tooltip->timer) {
- gtk_timeout_remove (eti->tooltip->timer);
- eti->tooltip->timer = 0;
- }
- e_canvas_hide_tooltip (E_CANVAS(GNOME_CANVAS_ITEM(eti)->canvas));
-
- if (cursor_col == -1)
- return FALSE;
-
- eti->in_key_press = TRUE;
-
- switch (e->key.keyval){
- case GDK_Left:
- case GDK_KP_Left:
- if (eti_editing (eti)) {
- handled = FALSE;
- break;
- }
-
- gtk_signal_emit (GTK_OBJECT (eti), eti_signals [KEY_PRESS],
- model_to_view_row(eti, cursor_row), cursor_col, e, &return_val);
- if ((!return_val) && eti->cursor_mode != E_CURSOR_LINE && cursor_col != view_to_model_col(eti, 0))
- eti_cursor_move_left (eti);
- return_val = 1;
- break;
-
- case GDK_Right:
- case GDK_KP_Right:
- if (eti_editing (eti)) {
- handled = FALSE;
- break;
- }
-
- gtk_signal_emit (GTK_OBJECT (eti), eti_signals [KEY_PRESS],
- model_to_view_row(eti, cursor_row), cursor_col, e, &return_val);
- if ((!return_val) && eti->cursor_mode != E_CURSOR_LINE && cursor_col != view_to_model_col(eti, eti->cols - 1))
- eti_cursor_move_right (eti);
- return_val = 1;
- break;
-
- case GDK_Up:
- case GDK_KP_Up:
- case GDK_Down:
- case GDK_KP_Down:
- return_val = e_selection_model_key_press(E_SELECTION_MODEL (eti->selection), (GdkEventKey *) e);
- break;
- case GDK_Home:
- case GDK_KP_Home:
- if (eti->cursor_mode != E_CURSOR_LINE) {
- eti_cursor_move (eti, model_to_view_row(eti, cursor_row), 0);
- return_val = TRUE;
- } else
- return_val = e_selection_model_key_press(E_SELECTION_MODEL (eti->selection), (GdkEventKey *) e);
- break;
- case GDK_End:
- case GDK_KP_End:
- if (eti->cursor_mode != E_CURSOR_LINE) {
- eti_cursor_move (eti, model_to_view_row(eti, cursor_row), eti->cols - 1);
- return_val = TRUE;
- } else
- return_val = e_selection_model_key_press(E_SELECTION_MODEL (eti->selection), (GdkEventKey *) e);
- break;
- case GDK_Tab:
- case GDK_KP_Tab:
- case GDK_ISO_Left_Tab:
- if (eti->cursor_mode == E_CURSOR_SPREADSHEET) {
- if ((e->key.state & GDK_SHIFT_MASK) != 0){
- /* shift tab */
- if (cursor_col != view_to_model_col(eti, 0))
- eti_cursor_move_left (eti);
- else if (cursor_row != view_to_model_row(eti, 0))
- eti_cursor_move (eti, model_to_view_row(eti, cursor_row) - 1, eti->cols - 1);
- else
- return_val = FALSE;
- } else {
- if (cursor_col != view_to_model_col (eti, eti->cols - 1))
- eti_cursor_move_right (eti);
- else if (cursor_row != view_to_model_row(eti, eti->rows - 1))
- eti_cursor_move (eti, model_to_view_row(eti, cursor_row) + 1, 0);
- else
- return_val = FALSE;
- }
- gtk_object_get(GTK_OBJECT(eti->selection),
- "cursor_row", &cursor_row,
- "cursor_col", &cursor_col,
- NULL);
-
- if (cursor_col >= 0 && cursor_row >= 0 && return_val &&
- (!eti_editing(eti)) && e_table_model_is_cell_editable(eti->table_model, cursor_col, model_to_view_row (eti, cursor_row))) {
- e_table_item_enter_edit (eti, model_to_view_col(eti, cursor_col), model_to_view_row(eti, cursor_row));
- }
- break;
- } else {
- /* Let tab send you to the next widget. */
- return_val = FALSE;
- break;
- }
-
- case GDK_Return:
- case GDK_KP_Enter:
- case GDK_ISO_Enter:
- case GDK_3270_Enter:
- if (eti_editing (eti)){
- e_table_item_leave_edit_(eti);
-#if 0
- ecell_view = eti->cell_views [eti->editing_col];
- return_val = eti_e_cell_event (eti, ecell_view, e, e->key.time,
- view_to_model_col(eti, eti->editing_col),
- eti->editing_col, eti->editing_row, E_CELL_EDITING | E_CELL_CURSOR);
-#endif
- }
- gtk_signal_emit (GTK_OBJECT (eti), eti_signals [KEY_PRESS],
- model_to_view_row(eti, cursor_row), cursor_col, e, &return_val);
- if (!return_val)
- return_val = e_selection_model_key_press(E_SELECTION_MODEL (eti->selection), (GdkEventKey *) e);
- break;
-
- default:
- handled = FALSE;
- break;
- }
-
- if (!handled) {
- switch (e->key.keyval) {
- case GDK_Scroll_Lock:
- case GDK_Sys_Req:
- case GDK_Shift_L:
- case GDK_Shift_R:
- case GDK_Control_L:
- case GDK_Control_R:
- case GDK_Caps_Lock:
- case GDK_Shift_Lock:
- case GDK_Meta_L:
- case GDK_Meta_R:
- case GDK_Alt_L:
- case GDK_Alt_R:
- case GDK_Super_L:
- case GDK_Super_R:
- case GDK_Hyper_L:
- case GDK_Hyper_R:
- case GDK_ISO_Lock:
- break;
-
- default:
- if (!eti_editing (eti)){
- gint col, row;
- row = model_to_view_row(eti, cursor_row);
- col = model_to_view_col(eti, cursor_col);
- if (col != -1 && row != -1 && e_table_model_is_cell_editable(eti->table_model, cursor_col, row)) {
- e_table_item_enter_edit (eti, col, row);
- }
- }
- if (!eti_editing (eti)){
- gtk_signal_emit (GTK_OBJECT (eti), eti_signals [KEY_PRESS],
- model_to_view_row(eti, cursor_row), cursor_col, e, &return_val);
- if (!return_val)
- e_selection_model_key_press(E_SELECTION_MODEL (eti->selection), (GdkEventKey *) e);
- } else {
- ecell_view = eti->cell_views [eti->editing_col];
- return_val = eti_e_cell_event (eti, ecell_view, e, e->key.time,
- view_to_model_col(eti, eti->editing_col),
- eti->editing_col, eti->editing_row, E_CELL_EDITING | E_CELL_CURSOR);
- if (!return_val)
- e_selection_model_key_press(E_SELECTION_MODEL (eti->selection), (GdkEventKey *) e);
- }
- break;
- }
- }
- eti->in_key_press = FALSE;
- break;
- }
-
- case GDK_KEY_RELEASE: {
- gint cursor_row, cursor_col;
-
- d(g_print("%s: GDK_KEY_RELEASE received, keyval: %d\n", __FUNCTION__, (int) e->key.keyval));
-
- gtk_object_get(GTK_OBJECT(eti->selection),
- "cursor_row", &cursor_row,
- "cursor_col", &cursor_col,
- NULL);
-
- if (cursor_col == -1)
- return FALSE;
-
- if (eti_editing (eti)){
- ecell_view = eti->cell_views [eti->editing_col];
- return_val = eti_e_cell_event (eti, ecell_view, e, e->key.time,
- view_to_model_col(eti, eti->editing_col),
- eti->editing_col, eti->editing_row, E_CELL_EDITING | E_CELL_CURSOR);
- }
- break;
- }
-
- case GDK_LEAVE_NOTIFY:
- d(leave = TRUE);
- case GDK_ENTER_NOTIFY:
- d(g_print("%s: %s received\n", __FUNCTION__, leave ? "GDK_LEAVE_NOTIFY" : "GDK_ENTER_NOTIFY"));
- if (eti->tooltip->timer > 0)
- gtk_timeout_remove (eti->tooltip->timer);
- eti->tooltip->timer = 0;
- break;
-
- case GDK_FOCUS_CHANGE:
- d(g_print("%s: GDK_FOCUS_CHANGE received, %s\n", __FUNCTION__, e->focus_change.in ? "in": "out"));
- if (e->focus_change.in) {
- if (eti->save_row != -1 &&
- eti->save_col != -1 &&
- !eti_editing (eti) &&
- e_table_model_is_cell_editable(eti->table_model, view_to_model_col (eti, eti->save_col), eti->save_row)) {
- e_table_item_enter_edit (eti, eti->save_col, eti->save_row);
- e_cell_load_state (eti->cell_views [eti->editing_col], view_to_model_col(eti, eti->save_col),
- eti->save_col, eti->save_row, eti->edit_ctx, eti->save_state);
- eti_free_save_state (eti);
- }
- } else {
- if (eti_editing (eti)) {
- eti_free_save_state (eti);
-
- eti->save_row = eti->editing_row;
- eti->save_col = eti->editing_col;
- eti->save_state = e_cell_save_state (eti->cell_views [eti->editing_col], view_to_model_col(eti, eti->editing_col),
- eti->editing_col, eti->editing_row, eti->edit_ctx);
- e_table_item_leave_edit_(eti);
- }
- }
-
- default:
- return_val = FALSE;
- }
- /* d(g_print("%s: returning: %s\n", __FUNCTION__, return_val?"true":"false"));*/
-
- return return_val;
-}
-
-static void
-eti_style_set (ETableItem *eti, GtkStyle *previous_style)
-{
- if (eti->cell_views_realized) {
- int i;
- int n_cells = eti->n_cells;
-
- for (i = 0; i < n_cells; i++) {
- e_cell_style_set (eti->cell_views[i], previous_style);
- }
- }
-}
-
-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;
-
- eti_class->cursor_change = NULL;
- eti_class->cursor_activated = NULL;
- eti_class->double_click = NULL;
- eti_class->right_click = NULL;
- eti_class->click = NULL;
- eti_class->key_press = NULL;
- eti_class->start_drag = NULL;
- eti_class->style_set = eti_style_set;
-
- gtk_object_add_arg_type ("ETableItem::ETableHeader", E_TABLE_HEADER_TYPE,
- GTK_ARG_WRITABLE, ARG_TABLE_HEADER);
- gtk_object_add_arg_type ("ETableItem::ETableModel", E_TABLE_MODEL_TYPE,
- GTK_ARG_WRITABLE, ARG_TABLE_MODEL);
- gtk_object_add_arg_type ("ETableItem::selection_model", E_SELECTION_MODEL_TYPE,
- GTK_ARG_WRITABLE, ARG_SELECTION_MODEL);
- gtk_object_add_arg_type ("ETableItem::alternating_row_colors", GTK_TYPE_BOOL,
- GTK_ARG_WRITABLE, ARG_TABLE_ALTERNATING_ROW_COLORS);
- gtk_object_add_arg_type ("ETableItem::horizontal_draw_grid", GTK_TYPE_BOOL,
- GTK_ARG_WRITABLE, ARG_TABLE_HORIZONTAL_DRAW_GRID);
- gtk_object_add_arg_type ("ETableItem::vertical_draw_grid", GTK_TYPE_BOOL,
- GTK_ARG_WRITABLE, ARG_TABLE_VERTICAL_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::cursor_mode", GTK_TYPE_INT,
- GTK_ARG_WRITABLE, ARG_CURSOR_MODE);
- gtk_object_add_arg_type ("ETableItem::length_threshold", GTK_TYPE_INT,
- GTK_ARG_WRITABLE, ARG_LENGTH_THRESHOLD);
-
- gtk_object_add_arg_type ("ETableItem::minimum_width", GTK_TYPE_DOUBLE,
- GTK_ARG_READWRITE, ARG_MINIMUM_WIDTH);
- 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::cursor_row", GTK_TYPE_INT,
- GTK_ARG_READWRITE, ARG_CURSOR_ROW);
- gtk_object_add_arg_type ("ETableItem::uniform_row_height", GTK_TYPE_BOOL,
- GTK_ARG_READWRITE, ARG_UNIFORM_ROW_HEIGHT);
-
- eti_signals [CURSOR_CHANGE] =
- gtk_signal_new ("cursor_change",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETableItemClass, cursor_change),
- gtk_marshal_NONE__INT,
- GTK_TYPE_NONE, 1, GTK_TYPE_INT);
-
- eti_signals [CURSOR_ACTIVATED] =
- gtk_signal_new ("cursor_activated",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETableItemClass, cursor_activated),
- gtk_marshal_NONE__INT,
- GTK_TYPE_NONE, 1, GTK_TYPE_INT);
-
- eti_signals [DOUBLE_CLICK] =
- gtk_signal_new ("double_click",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETableItemClass, double_click),
- gtk_marshal_NONE__INT_INT_POINTER,
- GTK_TYPE_NONE, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT);
-
- eti_signals [START_DRAG] =
- gtk_signal_new ("start_drag",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETableItemClass, start_drag),
- e_marshal_INT__INT_INT_POINTER,
- GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT);
-
- eti_signals [RIGHT_CLICK] =
- gtk_signal_new ("right_click",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETableItemClass, right_click),
- e_marshal_INT__INT_INT_POINTER,
- GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT);
-
- eti_signals [CLICK] =
- gtk_signal_new ("click",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETableItemClass, click),
- e_marshal_INT__INT_INT_POINTER,
- GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT);
-
- eti_signals [KEY_PRESS] =
- gtk_signal_new ("key_press",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETableItemClass, key_press),
- e_marshal_INT__INT_INT_POINTER,
- GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT);
-
- eti_signals [STYLE_SET] =
- gtk_signal_new ("style_set",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETableItemClass, style_set),
- gtk_marshal_NONE__POINTER,
- GTK_TYPE_NONE, 1, GTK_TYPE_STYLE);
-
- E_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;
-}
-
-/**
- * e_table_item_set_cursor:
- * @eti: %ETableItem which will have the cursor set.
- * @col: Column to select. -1 means the last column.
- * @row: Row to select. -1 means the last row.
- *
- * This routine sets the cursor of the %ETableItem canvas item.
- */
-void
-e_table_item_set_cursor (ETableItem *eti, int col, int row)
-{
- e_table_item_focus(eti, col, view_to_model_row(eti, row), 0);
-}
-
-static void
-e_table_item_focus (ETableItem *eti, int col, int row, GdkModifierType state)
-{
- g_return_if_fail (eti != NULL);
- g_return_if_fail (E_IS_TABLE_ITEM (eti));
-
- if (row == -1) {
- row = view_to_model_row(eti, eti->rows - 1);
- }
-
- if (col == -1) {
- col = eti->cols - 1;
- }
-
- if (row != -1) {
- e_selection_model_do_something(E_SELECTION_MODEL (eti->selection),
- row, col,
- state);
- }
-}
-
-/**
- * e_table_item_get_focused_column:
- * @eti: %ETableItem which will have the cursor retrieved.
- *
- * This routine gets the cursor of the %ETableItem canvas item.
- *
- * Returns: The current cursor column.
- */
-gint
-e_table_item_get_focused_column (ETableItem *eti)
-{
- int cursor_col;
-
- g_return_val_if_fail (eti != NULL, -1);
- g_return_val_if_fail (E_IS_TABLE_ITEM (eti), -1);
-
- gtk_object_get(GTK_OBJECT(eti->selection),
- "cursor_col", &cursor_col,
- NULL);
-
- return cursor_col;
-}
-
-static void
-eti_cursor_change (ESelectionModel *selection, int row, int col, ETableItem *eti)
-{
- int view_row;
- int view_col;
-
- if (!(GTK_OBJECT_FLAGS(eti) & GNOME_CANVAS_ITEM_REALIZED))
- return;
-
- view_row = model_to_view_row(eti, row);
- view_col = model_to_view_col(eti, col);
-
- if (view_row == -1 || view_col == -1) {
- e_table_item_leave_edit_(eti);
- eti->old_cursor_row = -1;
- return;
- }
-
- if (! e_table_model_has_change_pending (eti->table_model)) {
- if (!eti->in_key_press) {
- eti_maybe_show_cursor(eti, DOUBLE_CLICK_TIME + 10);
- } else {
- eti_maybe_show_cursor(eti, 0);
- }
- }
-
- e_canvas_item_grab_focus(GNOME_CANVAS_ITEM(eti), FALSE);
- if (eti_editing(eti))
- e_table_item_leave_edit_(eti);
- gtk_signal_emit (GTK_OBJECT (eti), eti_signals [CURSOR_CHANGE],
- view_row);
- if (eti->old_cursor_row != -1) {
- e_table_item_redraw_row (eti, eti->old_cursor_row);
- e_table_item_redraw_row (eti, view_row);
- } else {
- eti->needs_redraw = TRUE;
- gnome_canvas_item_request_update(GNOME_CANVAS_ITEM(eti));
- }
- eti->old_cursor_row = view_row;
-}
-
-static void
-eti_cursor_activated (ESelectionModel *selection, int row, int col, ETableItem *eti)
-{
- int view_row;
- int view_col;
-
- if (!(GTK_OBJECT_FLAGS(eti) & GNOME_CANVAS_ITEM_REALIZED))
- return;
-
- view_row = model_to_view_row(eti, row);
- view_col = model_to_view_col(eti, col);
-
- if (view_row != -1 && view_col != -1) {
- if (! e_table_model_has_change_pending (eti->table_model)) {
- if (!eti->in_key_press) {
- eti_show_cursor(eti, DOUBLE_CLICK_TIME + 10);
- } else {
- eti_show_cursor(eti, 0);
- }
- eti_check_cursor_bounds (eti);
- }
- }
-
- if (eti_editing(eti))
- e_table_item_leave_edit_(eti);
- gtk_signal_emit (GTK_OBJECT (eti), eti_signals [CURSOR_ACTIVATED],
- view_row);
-}
-
-static void
-eti_selection_change (ESelectionModel *selection, ETableItem *eti)
-{
- if (!(GTK_OBJECT_FLAGS(eti) & GNOME_CANVAS_ITEM_REALIZED))
- return;
-
- eti->needs_redraw = TRUE;
- gnome_canvas_item_request_update(GNOME_CANVAS_ITEM(eti));
-}
-
-static void
-eti_selection_row_change (ESelectionModel *selection, int row, ETableItem *eti)
-{
- if (!(GTK_OBJECT_FLAGS(eti) & GNOME_CANVAS_ITEM_REALIZED))
- return;
-
- if (!eti->needs_redraw) {
- e_table_item_redraw_row (eti, model_to_view_row(eti, row));
- }
-}
-
-
-/**
- * e_table_item_enter_edit
- * @eti: %ETableItem which will start being edited
- * @col: The view col to edit.
- * @row: The view row to edit.
- *
- * This routine starts the given %ETableItem editing at the given view
- * column and row.
- */
-void
-e_table_item_enter_edit (ETableItem *eti, int col, int row)
-{
- g_return_if_fail (eti != NULL);
- g_return_if_fail (E_IS_TABLE_ITEM (eti));
-
- d(g_print("%s: %d, %d, eti_editing() = %s\n", __FUNCTION__, col, row, eti_editing(eti)?"true":"false"));
-
- if (eti_editing (eti))
- e_table_item_leave_edit_(eti);
-
- eti->editing_col = col;
- eti->editing_row = row;
-
- eti->edit_ctx = e_cell_enter_edit (eti->cell_views [col], view_to_model_col(eti, col), col, row);
-}
-
-/**
- * e_table_item_leave_edit_
- * @eti: %ETableItem which will stop being edited
- *
- * This routine stops the given %ETableItem from editing.
- */
-void
-e_table_item_leave_edit (ETableItem *eti)
-{
- int col, row;
- void *edit_ctx;
-
- g_return_if_fail (eti != NULL);
- g_return_if_fail (E_IS_TABLE_ITEM (eti));
-
- d(g_print("%s: eti_editing() = %s\n", __FUNCTION__, eti_editing(eti)?"true":"false"));
-
- if (!eti_editing (eti))
- return;
-
- col = eti->editing_col;
- row = eti->editing_row;
- edit_ctx = eti->edit_ctx;
-
- eti->editing_col = -1;
- eti->editing_row = -1;
- eti->edit_ctx = NULL;
-
- e_cell_leave_edit (eti->cell_views [col],
- view_to_model_col(eti, col),
- col, row, edit_ctx);
-}
-
-/**
- * e_table_item_compute_location
- * @eti: %ETableItem to look in.
- * @x: A pointer to the x location to find in the %ETableItem.
- * @y: A pointer to the y location to find in the %ETableItem.
- * @row: A pointer to the location to store the found row in.
- * @col: A pointer to the location to store the found col in.
- *
- * This routine locates the pixel location (*x, *y) in the
- * %ETableItem. If that location is in the %ETableItem, *row and *col
- * are set to the view row and column where it was found. If that
- * location is not in the %ETableItem, the height of the %ETableItem
- * is removed from the value y points to.
- */
-void
-e_table_item_compute_location (ETableItem *eti,
- int *x,
- int *y,
- int *row,
- int *col)
-{
- /* Save the grabbed row but make sure that we don't get flawed
- results because the cursor is grabbed. */
- int grabbed_row = eti->grabbed_row;
- eti->grabbed_row = -1;
-
- if (!find_cell (eti, *x, *y, col, row, NULL, NULL)) {
- *y -= eti_get_height(eti);
- }
-
- eti->grabbed_row = grabbed_row;
-}
-
-void
-e_table_item_get_cell_geometry (ETableItem *eti,
- int *row,
- int *col,
- int *x,
- int *y,
- int *width,
- int *height)
-{
- if (eti->rows > *row) {
- if (x)
- *x = e_table_header_col_diff (eti->header, 0, *col);
- if (y)
- *y = e_table_item_row_diff (eti, 0, *row);
- if (width)
- *width = e_table_header_col_diff (eti->header, *col, *col + 1);
- if (height)
- *height = ETI_ROW_HEIGHT (eti, *row);
- *row = -1;
- *col = -1;
- } else {
- *row -= eti->rows;
- }
-}
-
-typedef struct {
- ETableItem *item;
- int rows_printed;
-} ETableItemPrintContext;
-
-static gdouble *
-e_table_item_calculate_print_widths (ETableHeader *eth, gdouble width)
-{
- int i;
- double extra;
- double expansion;
- int last_resizable = -1;
- gdouble scale = 300.0L / 70.0L;
- gdouble *widths = g_new(gdouble, e_table_header_count(eth));
- /* - 1 to account for the last pixel border. */
- extra = width - 1;
- expansion = 0;
- for (i = 0; i < eth->col_count; i++) {
- extra -= eth->columns[i]->min_width * scale;
- if (eth->columns[i]->resizable && eth->columns[i]->expansion > 0)
- last_resizable = i;
- expansion += eth->columns[i]->resizable ? eth->columns[i]->expansion : 0;
- widths[i] = eth->columns[i]->min_width * scale;
- }
- for (i = 0; i <= last_resizable; i++) {
- widths[i] += extra * (eth->columns[i]->resizable ? eth->columns[i]->expansion : 0)/expansion;
- }
-
- return widths;
-}
-
-static gdouble
-eti_printed_row_height (ETableItem *eti, gdouble *widths, GnomePrintContext *context, gint row)
-{
- int col;
- int cols = eti->cols;
- gdouble height = 0;
- for (col = 0; col < cols; col++) {
- ECellView *ecell_view = eti->cell_views [col];
- gdouble this_height = e_cell_print_height (ecell_view, context, view_to_model_col(eti, col), col, row,
- widths[col] - 1);
- if (this_height > height)
- height = this_height;
- }
- return height;
-}
-
-#define CHECK(x) if((x) == -1) return -1;
-
-static gint
-gp_draw_rect (GnomePrintContext *context, gdouble x, gdouble y, gdouble width, gdouble height)
-{
- CHECK(gnome_print_moveto(context, x, y));
- CHECK(gnome_print_lineto(context, x + width, y));
- CHECK(gnome_print_lineto(context, x + width, y - height));
- CHECK(gnome_print_lineto(context, x, y - height));
- CHECK(gnome_print_lineto(context, x, y));
- return gnome_print_fill(context);
-}
-
-static void
-e_table_item_print_page (EPrintable *ep,
- GnomePrintContext *context,
- gdouble width,
- gdouble height,
- gboolean quantize,
- ETableItemPrintContext *itemcontext)
-{
- ETableItem *eti = itemcontext->item;
- const int rows = eti->rows;
- const int cols = eti->cols;
- int rows_printed = itemcontext->rows_printed;
- gdouble *widths;
- int row, col;
- gdouble yd = height;
-
- widths = e_table_item_calculate_print_widths (itemcontext->item->header, width);
-
- /*
- * Draw cells
- */
- if (eti->horizontal_draw_grid){
- gp_draw_rect(context, 0, yd, width, 1);
- }
- yd--;
-
- for (row = rows_printed; row < rows; row++){
- gdouble xd = 1, row_height;
-
- row_height = eti_printed_row_height(eti, widths, context, row);
- if (quantize) {
- if (yd - row_height - 1 < 0 && row != rows_printed) {
- break;
- }
- } else {
- if (yd < 0) {
- break;
- }
- }
-
- for (col = 0; col < cols; col++){
- ECellView *ecell_view = eti->cell_views [col];
-
- if (gnome_print_gsave(context) == -1)
- /* FIXME */;
- if (gnome_print_translate(context, xd, yd - row_height) == -1)
- /* FIXME */;
-
- if (gnome_print_moveto(context, 0, 0) == -1)
- /* FIXME */;
- if (gnome_print_lineto(context, widths[col] - 1, 0) == -1)
- /* FIXME */;
- if (gnome_print_lineto(context, widths[col] - 1, row_height) == -1)
- /* FIXME */;
- if (gnome_print_lineto(context, 0, row_height) == -1)
- /* FIXME */;
- if (gnome_print_lineto(context, 0, 0) == -1)
- /* FIXME */;
- if (gnome_print_clip(context) == -1)
- /* FIXME */;
-
- e_cell_print (ecell_view, context, view_to_model_col(eti, col), col, row,
- widths[col] - 1, row_height);
-
- if (gnome_print_grestore(context) == -1)
- /* FIXME */;
-
- xd += widths[col];
- }
- yd -= row_height;
-
- if (eti->horizontal_draw_grid){
- gp_draw_rect(context, 0, yd, width, 1);
- }
- yd--;
- }
-
- itemcontext->rows_printed = row;
-
- if (eti->vertical_draw_grid){
- gdouble xd = 0;
-
- for (col = 0; col < cols; col++){
- gp_draw_rect(context, xd, height, 1, height - yd);
-
- xd += widths[col];
- }
- gp_draw_rect(context, xd, height, 1, height - yd);
- }
-
- g_free (widths);
-}
-
-static gboolean
-e_table_item_data_left (EPrintable *ep,
- ETableItemPrintContext *itemcontext)
-{
- ETableItem *item = itemcontext->item;
- int rows_printed = itemcontext->rows_printed;
-
- gtk_signal_emit_stop_by_name(GTK_OBJECT(ep), "data_left");
- return rows_printed < item->rows;
-}
-
-static void
-e_table_item_reset (EPrintable *ep,
- ETableItemPrintContext *itemcontext)
-{
- itemcontext->rows_printed = 0;
-}
-
-static gdouble
-e_table_item_height (EPrintable *ep,
- GnomePrintContext *context,
- gdouble width,
- gdouble max_height,
- gboolean quantize,
- ETableItemPrintContext *itemcontext)
-{
- ETableItem *item = itemcontext->item;
- const int rows = item->rows;
- int rows_printed = itemcontext->rows_printed;
- gdouble *widths;
- int row;
- gdouble yd = 0;
-
- widths = e_table_item_calculate_print_widths (itemcontext->item->header, width);
-
- /*
- * Draw cells
- */
- yd++;
-
- for (row = rows_printed; row < rows; row++){
- gdouble row_height;
-
- row_height = eti_printed_row_height(item, widths, context, row);
- if (quantize) {
- if (max_height != -1 && yd + row_height + 1 > max_height && row != rows_printed) {
- break;
- }
- } else {
- if (max_height != -1 && yd > max_height) {
- break;
- }
- }
-
- yd += row_height;
-
- yd++;
- }
-
- g_free (widths);
-
- if (max_height != -1 && (!quantize) && yd > max_height)
- yd = max_height;
-
- gtk_signal_emit_stop_by_name(GTK_OBJECT(ep), "height");
- return yd;
-}
-
-static gboolean
-e_table_item_will_fit (EPrintable *ep,
- GnomePrintContext *context,
- gdouble width,
- gdouble max_height,
- gboolean quantize,
- ETableItemPrintContext *itemcontext)
-{
- ETableItem *item = itemcontext->item;
- const int rows = item->rows;
- int rows_printed = itemcontext->rows_printed;
- gdouble *widths;
- int row;
- gdouble yd = 0;
- gboolean ret_val = TRUE;
-
- widths = e_table_item_calculate_print_widths (itemcontext->item->header, width);
-
- /*
- * Draw cells
- */
- yd++;
-
- for (row = rows_printed; row < rows; row++){
- gdouble row_height;
-
- row_height = eti_printed_row_height(item, widths, context, row);
- if (quantize) {
- if (max_height != -1 && yd + row_height + 1 > max_height && row != rows_printed) {
- ret_val = FALSE;
- break;
- }
- } else {
- if (max_height != -1 && yd > max_height) {
- ret_val = FALSE;
- break;
- }
- }
-
- yd += row_height;
-
- yd++;
- }
-
- g_free (widths);
-
- gtk_signal_emit_stop_by_name(GTK_OBJECT(ep), "will_fit");
- return ret_val;
-}
-
-static void
-e_table_item_printable_destroy (GtkObject *object,
- ETableItemPrintContext *itemcontext)
-{
- gtk_object_unref(GTK_OBJECT(itemcontext->item));
- g_free(itemcontext);
-}
-
-/**
- * e_table_item_get_printable
- * @eti: %ETableItem which will be printed
- *
- * This routine creates and returns an %EPrintable that can be used to
- * print the given %ETableItem.
- *
- * Returns: The %EPrintable.
- */
-EPrintable *
-e_table_item_get_printable (ETableItem *item)
-{
- EPrintable *printable = e_printable_new();
- ETableItemPrintContext *itemcontext;
-
- itemcontext = g_new(ETableItemPrintContext, 1);
- itemcontext->item = item;
- gtk_object_ref(GTK_OBJECT(item));
- itemcontext->rows_printed = 0;
-
- gtk_signal_connect (GTK_OBJECT(printable),
- "print_page",
- GTK_SIGNAL_FUNC(e_table_item_print_page),
- itemcontext);
- gtk_signal_connect (GTK_OBJECT(printable),
- "data_left",
- GTK_SIGNAL_FUNC(e_table_item_data_left),
- itemcontext);
- gtk_signal_connect (GTK_OBJECT(printable),
- "reset",
- GTK_SIGNAL_FUNC(e_table_item_reset),
- itemcontext);
- gtk_signal_connect (GTK_OBJECT(printable),
- "height",
- GTK_SIGNAL_FUNC(e_table_item_height),
- itemcontext);
- gtk_signal_connect (GTK_OBJECT(printable),
- "will_fit",
- GTK_SIGNAL_FUNC(e_table_item_will_fit),
- itemcontext);
- gtk_signal_connect (GTK_OBJECT(printable),
- "destroy",
- GTK_SIGNAL_FUNC(e_table_item_printable_destroy),
- itemcontext);
-
- return printable;
-}
diff --git a/widgets/table/e-table-item.h b/widgets/table/e-table-item.h
deleted file mode 100644
index 793379b837..0000000000
--- a/widgets/table/e-table-item.h
+++ /dev/null
@@ -1,225 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-item.h
- * Copyright 1999, 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- * Miguel de Icaza <miguel@gnu.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_TABLE_ITEM_H_
-#define _E_TABLE_ITEM_H_
-
-#include <libgnomeui/gnome-canvas.h>
-#include <gal/e-table/e-table-model.h>
-#include <gal/e-table/e-table-header.h>
-#include <gal/e-table/e-table-defines.h>
-#include <gal/e-table/e-table-tooltip.h>
-#include <gal/widgets/e-selection-model.h>
-#include <gal/widgets/e-printable.h>
-#include <libgnome/gnome-defs.h>
-
-BEGIN_GNOME_DECLS
-
-#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;
-
- ETableModel *source_model;
- ESelectionModel *selection;
-
- int x1, y1;
- int minimum_width, width, height;
-
- int cols, rows;
-
- int click_count;
-
- /*
- * Ids for the signals we connect to
- */
- int header_dim_change_id;
- int header_structure_change_id;
- int header_request_width_id;
- int table_model_pre_change_id;
- int table_model_no_change_id;
- int table_model_change_id;
- int table_model_row_change_id;
- int table_model_cell_change_id;
- int table_model_rows_inserted_id;
- int table_model_rows_deleted_id;
-
- int selection_change_id;
- int selection_row_change_id;
- int cursor_change_id;
- int cursor_activated_id;
-
- /* View row, -1 means unknown */
- int old_cursor_row;
-
- int hadjustment_change_id;
- int hadjustment_value_change_id;
- int vadjustment_change_id;
- int vadjustment_value_change_id;
-
- GdkGC *fill_gc;
- GdkGC *grid_gc;
- GdkGC *focus_gc;
- GdkBitmap *stipple;
-
- guint alternating_row_colors:1;
- guint horizontal_draw_grid:1;
- guint vertical_draw_grid:1;
- guint draw_focus:1;
- guint uniform_row_height:1;
- guint cell_views_realized:1;
-
- guint needs_redraw : 1;
- guint needs_compute_height : 1;
- guint needs_compute_width : 1;
-
- guint uses_source_model : 1;
-
- guint in_key_press : 1;
-
- guint maybe_in_drag : 1;
- guint in_drag : 1;
- guint grabbed : 1;
-
- guint maybe_did_something : 1;
-
- guint cursor_on_screen : 1;
- guint gtk_grabbed : 1;
-
- guint queue_show_cursor : 1;
-
- int frozen_count;
-
- int cursor_x1;
- int cursor_y1;
- int cursor_x2;
- int cursor_y2;
-
- int drag_col;
- int drag_row;
- int drag_x;
- int drag_y;
- guint drag_state;
-
- /*
- * Realized views, per column
- */
- ECellView **cell_views;
- int n_cells;
-
- int *height_cache;
- int uniform_row_height_cache;
- int height_cache_idle_id;
- int height_cache_idle_count;
-
- /*
- * Lengh Threshold: above this, we stop computing correctly
- * the size
- */
- int length_threshold;
-
- gint row_guess;
- ECursorMode cursor_mode;
-
- /*
- * During editing
- */
- int editing_col, editing_row;
- void *edit_ctx;
-
- int save_col, save_row;
- void *save_state;
-
- int grabbed_col, grabbed_row;
- int grabbed_count;
-
- /*
- * Tooltip
- */
- ETableTooltip *tooltip;
-
-} ETableItem;
-
-typedef struct {
- GnomeCanvasItemClass parent_class;
-
- void (*cursor_change) (ETableItem *eti, int row);
- void (*cursor_activated) (ETableItem *eti, int row);
- void (*double_click) (ETableItem *eti, int row, int col, GdkEvent *event);
- gint (*right_click) (ETableItem *eti, int row, int col, GdkEvent *event);
- gint (*click) (ETableItem *eti, int row, int col, GdkEvent *event);
- gint (*key_press) (ETableItem *eti, int row, int col, GdkEvent *event);
- gint (*start_drag) (ETableItem *eti, int row, int col, GdkEvent *event);
- void (*style_set) (ETableItem *eti, GtkStyle *previous_style);
-} ETableItemClass;
-GtkType e_table_item_get_type (void);
-
-
-/*
- * Focus
- */
-void e_table_item_set_cursor (ETableItem *eti,
- int col,
- int row);
-
-gint e_table_item_get_focused_column (ETableItem *eti);
-
-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);
-
-EPrintable *e_table_item_get_printable (ETableItem *eti);
-void e_table_item_compute_location (ETableItem *eti,
- int *x,
- int *y,
- int *row,
- int *col);
-void e_table_item_get_cell_geometry (ETableItem *eti,
- int *row,
- int *col,
- int *x,
- int *y,
- int *width,
- int *height);
-
-int e_table_item_row_diff (ETableItem *eti,
- int start_row,
- int end_row);
-
-END_GNOME_DECLS
-
-#endif /* _E_TABLE_ITEM_H_ */
diff --git a/widgets/table/e-table-memory-callbacks.c b/widgets/table/e-table-memory-callbacks.c
deleted file mode 100644
index 8cbbc3a0b4..0000000000
--- a/widgets/table/e-table-memory-callbacks.c
+++ /dev/null
@@ -1,265 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-memory-callbacks.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include "e-table-memory-callbacks.h"
-
-enum {
- ARG_0,
- ARG_APPEND_ROW,
-};
-
-#define PARENT_TYPE e_table_memory_get_type ()
-
-static int
-etmc_column_count (ETableModel *etm)
-{
- ETableMemoryCalbacks *etmc = E_TABLE_MEMORY_CALLBACKS(etm);
-
- if (etmc->col_count)
- return etmc->col_count (etm, etmc->data);
- else
- return 0;
-}
-
-static void *
-etmc_value_at (ETableModel *etm, int col, int row)
-{
- ETableMemoryCalbacks *etmc = E_TABLE_MEMORY_CALLBACKS(etm);
-
- if (etmc->value_at)
- return etmc->value_at (etm, col, row, etmc->data);
- else
- return NULL;
-}
-
-static void
-etmc_set_value_at (ETableModel *etm, int col, int row, const void *val)
-{
- ETableMemoryCalbacks *etmc = E_TABLE_MEMORY_CALLBACKS(etm);
-
- if (etmc->set_value_at)
- etmc->set_value_at (etm, col, row, val, etmc->data);
-}
-
-static gboolean
-etmc_is_cell_editable (ETableModel *etm, int col, int row)
-{
- ETableMemoryCalbacks *etmc = E_TABLE_MEMORY_CALLBACKS(etm);
-
- if (etmc->is_cell_editable)
- return etmc->is_cell_editable (etm, col, row, etmc->data);
- else
- return FALSE;
-}
-
-/* The default for etmc_duplicate_value is to return the raw value. */
-static void *
-etmc_duplicate_value (ETableModel *etm, int col, const void *value)
-{
- ETableMemoryCalbacks *etmc = E_TABLE_MEMORY_CALLBACKS(etm);
-
- if (etmc->duplicate_value)
- return etmc->duplicate_value (etm, col, value, etmc->data);
- else
- return (void *)value;
-}
-
-static void
-etmc_free_value (ETableModel *etm, int col, void *value)
-{
- ETableMemoryCalbacks *etmc = E_TABLE_MEMORY_CALLBACKS(etm);
-
- if (etmc->free_value)
- etmc->free_value (etm, col, value, etmc->data);
-}
-
-static void *
-etmc_initialize_value (ETableModel *etm, int col)
-{
- ETableMemoryCalbacks *etmc = E_TABLE_MEMORY_CALLBACKS(etm);
-
- if (etmc->initialize_value)
- return etmc->initialize_value (etm, col, etmc->data);
- else
- return NULL;
-}
-
-static gboolean
-etmc_value_is_empty (ETableModel *etm, int col, const void *value)
-{
- ETableMemoryCalbacks *etmc = E_TABLE_MEMORY_CALLBACKS(etm);
-
- if (etmc->value_is_empty)
- return etmc->value_is_empty (etm, col, value, etmc->data);
- else
- return FALSE;
-}
-
-static char *
-etmc_value_to_string (ETableModel *etm, int col, const void *value)
-{
- ETableMemoryCalbacks *etmc = E_TABLE_MEMORY_CALLBACKS(etm);
-
- if (etmc->value_to_string)
- return etmc->value_to_string (etm, col, value, etmc->data);
- else
- return g_strdup ("");
-}
-
-static void
-etmc_append_row (ETableModel *etm, ETableModel *source, int row)
-{
- ETableMemoryCalbacks *etmc = E_TABLE_MEMORY_CALLBACKS(etm);
-
- if (etmc->append_row)
- etmc->append_row (etm, source, row, etmc->data);
-}
-
-static void
-etmc_get_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- ETableMemoryCalbacks *etmc = E_TABLE_MEMORY_CALLBACKS (o);
-
- switch (arg_id){
- case ARG_APPEND_ROW:
- GTK_VALUE_POINTER(*arg) = etmc->append_row;
- break;
- }
-}
-
-static void
-etmc_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- ETableMemoryCalbacks *etmc = E_TABLE_MEMORY_CALLBACKS (o);
-
- switch (arg_id){
- case ARG_APPEND_ROW:
- etmc->append_row = GTK_VALUE_POINTER(*arg);
- break;
- default:
- arg->type = GTK_TYPE_INVALID;
- }
-}
-
-static void
-e_table_memory_callbacks_class_init (GtkObjectClass *object_class)
-{
- ETableModelClass *model_class = (ETableModelClass *) object_class;
-
- object_class->set_arg = etmc_set_arg;
- object_class->get_arg = etmc_get_arg;
-
- model_class->column_count = etmc_column_count;
- model_class->value_at = etmc_value_at;
- model_class->set_value_at = etmc_set_value_at;
- model_class->is_cell_editable = etmc_is_cell_editable;
- model_class->duplicate_value = etmc_duplicate_value;
- model_class->free_value = etmc_free_value;
- model_class->initialize_value = etmc_initialize_value;
- model_class->value_is_empty = etmc_value_is_empty;
- model_class->value_to_string = etmc_value_to_string;
- model_class->append_row = etmc_append_row;
-
- gtk_object_add_arg_type ("ETableMemoryCalbacks::append_row", GTK_TYPE_POINTER,
- GTK_ARG_READWRITE, ARG_APPEND_ROW);
-}
-
-GtkType
-e_table_memory_callbacks_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type){
- GtkTypeInfo info = {
- "ETableMemoryCalbacks",
- sizeof (ETableMemoryCalbacks),
- sizeof (ETableMemoryCalbacksClass),
- (GtkClassInitFunc) e_table_memory_callbacks_class_init,
- (GtkObjectInitFunc) NULL,
- NULL, /* reserved 1 */
- NULL, /* reserved 2 */
- (GtkClassInitFunc) NULL
- };
-
- type = gtk_type_unique (PARENT_TYPE, &info);
- }
-
- return type;
-}
-
-/**
- * e_table_memory_callbacks_new:
- * @col_count:
- * @value_at:
- * @set_value_at:
- * @is_cell_editable:
- * @duplicate_value:
- * @free_value:
- * @initialize_value:
- * @value_is_empty:
- * @value_to_string:
- * @data: closure pointer.
- *
- * This initializes a new ETableMemoryCalbacksModel object. ETableMemoryCalbacksModel is
- * an implementaiton of the abstract class ETableModel. The ETableMemoryCalbacksModel
- * is designed to allow people to easily create ETableModels without having
- * to create a new GtkType derived from ETableModel every time they need one.
- *
- * Instead, ETableMemoryCalbacksModel uses a setup based in callback functions, every
- * callback function signature mimics the signature of each ETableModel method
- * and passes the extra @data pointer to each one of the method to provide them
- * with any context they might want to use.
- *
- * Returns: An ETableMemoryCalbacksModel object (which is also an ETableModel
- * object).
- */
-ETableModel *
-e_table_memory_callbacks_new (ETableMemoryCalbacksColumnCountFn col_count,
- ETableMemoryCalbacksValueAtFn value_at,
- ETableMemoryCalbacksSetValueAtFn set_value_at,
- ETableMemoryCalbacksIsCellEditableFn is_cell_editable,
- ETableMemoryCalbacksDuplicateValueFn duplicate_value,
- ETableMemoryCalbacksFreeValueFn free_value,
- ETableMemoryCalbacksInitializeValueFn initialize_value,
- ETableMemoryCalbacksValueIsEmptyFn value_is_empty,
- ETableMemoryCalbacksValueToStringFn value_to_string,
- void *data)
-{
- ETableMemoryCalbacks *et;
-
- et = gtk_type_new (e_table_memory_callbacks_get_type ());
-
- et->col_count = col_count;
- et->value_at = value_at;
- et->set_value_at = set_value_at;
- et->is_cell_editable = is_cell_editable;
- et->duplicate_value = duplicate_value;
- et->free_value = free_value;
- et->initialize_value = initialize_value;
- et->value_is_empty = value_is_empty;
- et->value_to_string = value_to_string;
- et->data = data;
-
- return (ETableModel *) et;
- }
diff --git a/widgets/table/e-table-memory-callbacks.h b/widgets/table/e-table-memory-callbacks.h
deleted file mode 100644
index a90e3ab9bb..0000000000
--- a/widgets/table/e-table-memory-callbacks.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-memory-callbacks.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_TABLE_MEMORY_CALLBACKS_H_
-#define _E_TABLE_MEMORY_CALLBACKS_H_
-
-#include <gal/e-table/e-table-memory.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#define E_TABLE_MEMORY_CALLBACKS_TYPE (e_table_memory_callbacks_get_type ())
-#define E_TABLE_MEMORY_CALLBACKS(o) (GTK_CHECK_CAST ((o), E_TABLE_MEMORY_CALLBACKS_TYPE, ETableMemoryCalbacks))
-#define E_TABLE_MEMORY_CALLBACKS_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_MEMORY_CALLBACKS_TYPE, ETableMemoryCalbacksClass))
-#define E_IS_TABLE_MEMORY_CALLBACKS(o) (GTK_CHECK_TYPE ((o), E_TABLE_MEMORY_CALLBACKS_TYPE))
-#define E_IS_TABLE_MEMORY_CALLBACKS_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_MEMORY_CALLBACKS_TYPE))
-
-typedef int (*ETableMemoryCalbacksColumnCountFn) (ETableModel *etm, void *data);
-typedef void (*ETableMemoryCalbacksAppendRowFn) (ETableModel *etm, ETableModel *model, int row, void *data);
-
-typedef void *(*ETableMemoryCalbacksValueAtFn) (ETableModel *etm, int col, int row, void *data);
-typedef void (*ETableMemoryCalbacksSetValueAtFn) (ETableModel *etm, int col, int row, const void *val, void *data);
-typedef gboolean (*ETableMemoryCalbacksIsCellEditableFn) (ETableModel *etm, int col, int row, void *data);
-
-typedef void *(*ETableMemoryCalbacksDuplicateValueFn) (ETableModel *etm, int col, const void *val, void *data);
-typedef void (*ETableMemoryCalbacksFreeValueFn) (ETableModel *etm, int col, void *val, void *data);
-typedef void *(*ETableMemoryCalbacksInitializeValueFn) (ETableModel *etm, int col, void *data);
-typedef gboolean (*ETableMemoryCalbacksValueIsEmptyFn) (ETableModel *etm, int col, const void *val, void *data);
-typedef char *(*ETableMemoryCalbacksValueToStringFn) (ETableModel *etm, int col, const void *val, void *data);
-
-typedef struct {
- ETableMemory parent;
-
- ETableMemoryCalbacksColumnCountFn col_count;
- ETableMemoryCalbacksAppendRowFn append_row;
-
- ETableMemoryCalbacksValueAtFn value_at;
- ETableMemoryCalbacksSetValueAtFn set_value_at;
- ETableMemoryCalbacksIsCellEditableFn is_cell_editable;
-
- ETableMemoryCalbacksDuplicateValueFn duplicate_value;
- ETableMemoryCalbacksFreeValueFn free_value;
- ETableMemoryCalbacksInitializeValueFn initialize_value;
- ETableMemoryCalbacksValueIsEmptyFn value_is_empty;
- ETableMemoryCalbacksValueToStringFn value_to_string;
- void *data;
-} ETableMemoryCalbacks;
-
-typedef struct {
- ETableMemoryClass parent_class;
-} ETableMemoryCalbacksClass;
-
-GtkType e_table_memory_callbacks_get_type (void);
-
-ETableModel *e_table_memory_callbacks_new (ETableMemoryCalbacksColumnCountFn col_count,
-
- ETableMemoryCalbacksValueAtFn value_at,
- ETableMemoryCalbacksSetValueAtFn set_value_at,
- ETableMemoryCalbacksIsCellEditableFn is_cell_editable,
-
- ETableMemoryCalbacksDuplicateValueFn duplicate_value,
- ETableMemoryCalbacksFreeValueFn free_value,
- ETableMemoryCalbacksInitializeValueFn initialize_value,
- ETableMemoryCalbacksValueIsEmptyFn value_is_empty,
- ETableMemoryCalbacksValueToStringFn value_to_string,
- void *data);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _E_TABLE_MEMORY_CALLBACKS_H_ */
-
diff --git a/widgets/table/e-table-memory-store.c b/widgets/table/e-table-memory-store.c
deleted file mode 100644
index f3f29e54ee..0000000000
--- a/widgets/table/e-table-memory-store.c
+++ /dev/null
@@ -1,412 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-memory-store.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <string.h>
-#include "e-table-memory-store.h"
-
-#define PARENT_TYPE e_table_memory_get_type ()
-
-#define STORE_LOCATOR(etms, col, row) (*((etms)->priv->store + (row) * (etms)->priv->col_count + (col)))
-
-struct _ETableMemoryStorePrivate {
- int col_count;
- ETableMemoryStoreColumnInfo *columns;
- void **store;
-};
-
-static void *
-duplicate_value (ETableMemoryStore *etms, int col, const void *val)
-{
- switch (etms->priv->columns[col].type) {
- case E_TABLE_MEMORY_STORE_COLUMN_TYPE_STRING:
- return g_strdup (val);
- case E_TABLE_MEMORY_STORE_COLUMN_TYPE_PIXBUF:
- if (val)
- gdk_pixbuf_ref ((void *) val);
- return (void *) val;
- case E_TABLE_MEMORY_STORE_COLUMN_TYPE_OBJECT:
- if (val)
- gtk_object_ref ((void *) val);
- return (void *) val;
- case E_TABLE_MEMORY_STORE_COLUMN_TYPE_CUSTOM:
- if (etms->priv->columns[col].custom.duplicate_value)
- return etms->priv->columns[col].custom.duplicate_value (E_TABLE_MODEL (etms), col, val, NULL);
- break;
- default:
- break;
- }
- return (void *) val;
-}
-
-static int
-etms_column_count (ETableModel *etm)
-{
- ETableMemoryStore *etms = E_TABLE_MEMORY_STORE(etm);
-
- return etms->priv->col_count;
-}
-
-static void *
-etms_value_at (ETableModel *etm, int col, int row)
-{
- ETableMemoryStore *etms = E_TABLE_MEMORY_STORE(etm);
-
- return STORE_LOCATOR (etms, col, row);
-}
-
-static void
-etms_set_value_at (ETableModel *etm, int col, int row, const void *val)
-{
- ETableMemoryStore *etms = E_TABLE_MEMORY_STORE(etm);
-
- STORE_LOCATOR (etms, col, row) = duplicate_value (etms, col, val);
-
- e_table_model_cell_changed (etm, col, row);
-}
-
-static gboolean
-etms_is_cell_editable (ETableModel *etm, int col, int row)
-{
- ETableMemoryStore *etms = E_TABLE_MEMORY_STORE(etm);
-
- return etms->priv->columns[col].editable;
-}
-
-/* The default for etms_duplicate_value is to return the raw value. */
-static void *
-etms_duplicate_value (ETableModel *etm, int col, const void *value)
-{
- ETableMemoryStore *etms = E_TABLE_MEMORY_STORE(etm);
-
- return duplicate_value (etms, col, value);
-}
-
-static void
-etms_free_value (ETableModel *etm, int col, void *value)
-{
- ETableMemoryStore *etms = E_TABLE_MEMORY_STORE(etm);
-
- switch (etms->priv->columns[col].type) {
- case E_TABLE_MEMORY_STORE_COLUMN_TYPE_STRING:
- g_free (value);
- break;
- case E_TABLE_MEMORY_STORE_COLUMN_TYPE_PIXBUF:
- if (value)
- gdk_pixbuf_unref (value);
- break;
- case E_TABLE_MEMORY_STORE_COLUMN_TYPE_OBJECT:
- if (value)
- gtk_object_unref (value);
- break;
- case E_TABLE_MEMORY_STORE_COLUMN_TYPE_CUSTOM:
- if (etms->priv->columns[col].custom.free_value)
- etms->priv->columns[col].custom.free_value (E_TABLE_MODEL (etms), col, value, NULL);
- break;
- default:
- break;
- }
-}
-
-static void *
-etms_initialize_value (ETableModel *etm, int col)
-{
- ETableMemoryStore *etms = E_TABLE_MEMORY_STORE(etm);
-
- switch (etms->priv->columns[col].type) {
- case E_TABLE_MEMORY_STORE_COLUMN_TYPE_STRING:
- return g_strdup ("");
- case E_TABLE_MEMORY_STORE_COLUMN_TYPE_PIXBUF:
- return NULL;
- case E_TABLE_MEMORY_STORE_COLUMN_TYPE_CUSTOM:
- case E_TABLE_MEMORY_STORE_COLUMN_TYPE_OBJECT:
- if (etms->priv->columns[col].custom.initialize_value)
- return etms->priv->columns[col].custom.initialize_value (E_TABLE_MODEL (etms), col, NULL);
- break;
- default:
- break;
- }
- return 0;
-}
-
-static gboolean
-etms_value_is_empty (ETableModel *etm, int col, const void *value)
-{
- ETableMemoryStore *etms = E_TABLE_MEMORY_STORE(etm);
-
- switch (etms->priv->columns[col].type) {
- case E_TABLE_MEMORY_STORE_COLUMN_TYPE_STRING:
- return !(value && *(char *) value);
- case E_TABLE_MEMORY_STORE_COLUMN_TYPE_PIXBUF:
- return value == NULL;
- case E_TABLE_MEMORY_STORE_COLUMN_TYPE_CUSTOM:
- case E_TABLE_MEMORY_STORE_COLUMN_TYPE_OBJECT:
- if (etms->priv->columns[col].custom.value_is_empty)
- return etms->priv->columns[col].custom.value_is_empty (E_TABLE_MODEL (etms), col, value, NULL);
- break;
- default:
- break;
- }
- return value == 0;
-}
-
-static char *
-etms_value_to_string (ETableModel *etm, int col, const void *value)
-{
- ETableMemoryStore *etms = E_TABLE_MEMORY_STORE(etm);
-
- switch (etms->priv->columns[col].type) {
- case E_TABLE_MEMORY_STORE_COLUMN_TYPE_STRING:
- return g_strdup (value);
- case E_TABLE_MEMORY_STORE_COLUMN_TYPE_PIXBUF:
- return g_strdup ("");
- case E_TABLE_MEMORY_STORE_COLUMN_TYPE_CUSTOM:
- case E_TABLE_MEMORY_STORE_COLUMN_TYPE_OBJECT:
- if (etms->priv->columns[col].custom.value_is_empty)
- return etms->priv->columns[col].custom.value_to_string (E_TABLE_MODEL (etms), col, value, NULL);
- break;
- default:
- break;
- }
- return g_strdup_printf ("%d", GPOINTER_TO_INT (value));
-}
-
-static void
-etms_append_row (ETableModel *etm, ETableModel *source, int row)
-{
- ETableMemoryStore *etms = E_TABLE_MEMORY_STORE(etm);
- void **new_data;
- int i;
- int row_count;
-
- new_data = g_new (void *, etms->priv->col_count);
-
- for (i = 0; i < etms->priv->col_count; i++) {
- new_data[i] = e_table_model_value_at (source, i, row);
- }
-
- row_count = e_table_model_row_count (E_TABLE_MODEL (etms));
-
- e_table_memory_store_insert (etms, row_count, new_data, NULL);
-}
-
-static void
-e_table_memory_store_init (ETableMemoryStore *etms)
-{
- etms->priv = g_new (ETableMemoryStorePrivate, 1);
-
- etms->priv->col_count = 0;
- etms->priv->columns = NULL;
- etms->priv->store = NULL;
-}
-
-static void
-e_table_memory_store_class_init (GtkObjectClass *object_class)
-{
- ETableModelClass *model_class = (ETableModelClass *) object_class;
-
- model_class->column_count = etms_column_count;
- model_class->value_at = etms_value_at;
- model_class->set_value_at = etms_set_value_at;
- model_class->is_cell_editable = etms_is_cell_editable;
- model_class->duplicate_value = etms_duplicate_value;
- model_class->free_value = etms_free_value;
- model_class->initialize_value = etms_initialize_value;
- model_class->value_is_empty = etms_value_is_empty;
- model_class->value_to_string = etms_value_to_string;
- model_class->append_row = etms_append_row;
-}
-
-GtkType
-e_table_memory_store_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type){
- GtkTypeInfo info = {
- "ETableMemoryStore",
- sizeof (ETableMemoryStore),
- sizeof (ETableMemoryStoreClass),
- (GtkClassInitFunc) e_table_memory_store_class_init,
- (GtkObjectInitFunc) e_table_memory_store_init,
- NULL, /* reserved 1 */
- NULL, /* reserved 2 */
- (GtkClassInitFunc) NULL
- };
-
- type = gtk_type_unique (PARENT_TYPE, &info);
- }
-
- return type;
-}
-
-/**
- * e_table_memory_store_new:
- * @col_count:
- * @value_at:
- * @set_value_at:
- * @is_cell_editable:
- * @duplicate_value:
- * @free_value:
- * @initialize_value:
- * @value_is_empty:
- * @value_to_string:
- * @data: closure pointer.
- *
- * This initializes a new ETableMemoryStoreModel object. ETableMemoryStoreModel is
- * an implementaiton of the abstract class ETableModel. The ETableMemoryStoreModel
- * is designed to allow people to easily create ETableModels without having
- * to create a new GtkType derived from ETableModel every time they need one.
- *
- * Instead, ETableMemoryStoreModel uses a setup based in callback functions, every
- * callback function signature mimics the signature of each ETableModel method
- * and passes the extra @data pointer to each one of the method to provide them
- * with any context they might want to use.
- *
- * Returns: An ETableMemoryStoreModel object (which is also an ETableModel
- * object).
- */
-ETableModel *
-e_table_memory_store_new (ETableMemoryStoreColumnInfo *columns)
-{
- ETableMemoryStore *et;
-
- et = gtk_type_new (e_table_memory_store_get_type ());
-
- if (e_table_memory_store_construct (et, columns)) {
- return (ETableModel *) et;
- } else {
- gtk_object_unref (GTK_OBJECT (et));
- return NULL;
- }
-}
-
-ETableModel *
-e_table_memory_store_construct (ETableMemoryStore *etms, ETableMemoryStoreColumnInfo *columns)
-{
- int i;
- for (i = 0; columns[i].type != E_TABLE_MEMORY_STORE_COLUMN_TYPE_TERMINATOR; i++)
- /* Intentionally blank */;
- etms->priv->col_count = i;
-
- etms->priv->columns = g_new (ETableMemoryStoreColumnInfo, etms->priv->col_count + 1);
-
- memcpy (etms->priv->columns, columns, (etms->priv->col_count + 1) * sizeof (ETableMemoryStoreColumnInfo));
-
- return E_TABLE_MODEL (etms);
-}
-
-
-void
-e_table_memory_store_adopt_value_at (ETableMemoryStore *etms, int col, int row, void *value)
-{
- STORE_LOCATOR (etms, col, row) = value;
-
- e_table_model_cell_changed (E_TABLE_MODEL (etms), col, row);
-}
-
-/* The size of these arrays is the number of columns. */
-void
-e_table_memory_store_insert (ETableMemoryStore *etms, int row, void **store, gpointer data)
-{
- int row_count;
- int i;
-
- row_count = e_table_model_row_count (E_TABLE_MODEL (etms)) + 1;
- if (row == -1)
- row = row_count - 1;
- etms->priv->store = g_realloc (etms->priv->store, etms->priv->col_count * row_count * sizeof (void *));
- memmove (etms->priv->store + etms->priv->col_count * (row + 1),
- etms->priv->store + etms->priv->col_count * row,
- etms->priv->col_count * (row_count - row - 1) * sizeof (void *));
-
- for (i = 0; i < etms->priv->col_count; i++) {
- STORE_LOCATOR(etms, i, row) = duplicate_value(etms, i, store[i]);
- }
-
- e_table_memory_insert (E_TABLE_MEMORY (etms), row, data);
-}
-
-void
-e_table_memory_store_insert_list (ETableMemoryStore *etms, int row, gpointer data, ...)
-{
- void **store;
- va_list args;
- int i;
-
- store = g_new (void *, etms->priv->col_count + 1);
-
- va_start (args, data);
- for (i = 0; i < etms->priv->col_count; i++) {
- store[i] = va_arg (args, void *);
- }
- va_end (args);
-
- e_table_memory_store_insert (etms, row, store, data);
-
- g_free (store);
-}
-
-void
-e_table_memory_store_insert_adopt (ETableMemoryStore *etms, int row, void **store, gpointer data)
-{
- int row_count;
- int i;
-
- row_count = e_table_model_row_count (E_TABLE_MODEL (etms)) + 1;
- if (row == -1)
- row = row_count - 1;
- etms->priv->store = g_realloc (etms->priv->store, etms->priv->col_count * row_count * sizeof (void *));
- memmove (etms->priv->store + etms->priv->col_count * (row + 1),
- etms->priv->store + etms->priv->col_count * row,
- etms->priv->col_count * (row_count - row - 1) * sizeof (void *));
-
- for (i = 0; i < etms->priv->col_count; i++) {
- STORE_LOCATOR(etms, i, row) = store[i];
- }
-
- e_table_memory_insert (E_TABLE_MEMORY (etms), row, data);
-}
-
-void
-e_table_memory_store_remove (ETableMemoryStore *etms, int row)
-{
- int row_count;
-
- row_count = e_table_model_row_count (E_TABLE_MODEL (etms)) - 1;
- memmove (etms->priv->store + etms->priv->col_count * row,
- etms->priv->store + etms->priv->col_count * (row + 1),
- etms->priv->col_count * (row_count - row) * sizeof (void *));
- etms->priv->store = g_realloc (etms->priv->store, etms->priv->col_count * row_count * sizeof (void *));
-
- e_table_memory_remove (E_TABLE_MEMORY (etms), row);
-}
-
-void
-e_table_memory_store_clear (ETableMemoryStore *etms)
-{
- e_table_memory_clear (E_TABLE_MEMORY (etms));
-
- g_free (etms->priv->store);
- etms->priv->store = NULL;
-}
diff --git a/widgets/table/e-table-memory-store.h b/widgets/table/e-table-memory-store.h
deleted file mode 100644
index 60bd037758..0000000000
--- a/widgets/table/e-table-memory-store.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-memory-store.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_TABLE_MEMORY_STORE_H_
-#define _E_TABLE_MEMORY_STORE_H_
-
-#include <gal/e-table/e-table-memory.h>
-#include <gal/e-table/e-table-memory-callbacks.h>
-#include <libgnome/gnome-defs.h>
-
-BEGIN_GNOME_DECLS
-
-#define E_TABLE_MEMORY_STORE_TYPE (e_table_memory_store_get_type ())
-#define E_TABLE_MEMORY_STORE(o) (GTK_CHECK_CAST ((o), E_TABLE_MEMORY_STORE_TYPE, ETableMemoryStore))
-#define E_TABLE_MEMORY_STORE_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_MEMORY_STORE_TYPE, ETableMemoryStoreClass))
-#define E_IS_TABLE_MEMORY_STORE(o) (GTK_CHECK_TYPE ((o), E_TABLE_MEMORY_STORE_TYPE))
-#define E_IS_TABLE_MEMORY_STORE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_MEMORY_STORE_TYPE))
-
-typedef enum {
- E_TABLE_MEMORY_STORE_COLUMN_TYPE_TERMINATOR,
- E_TABLE_MEMORY_STORE_COLUMN_TYPE_INTEGER,
- E_TABLE_MEMORY_STORE_COLUMN_TYPE_STRING,
- E_TABLE_MEMORY_STORE_COLUMN_TYPE_PIXBUF,
- E_TABLE_MEMORY_STORE_COLUMN_TYPE_OBJECT,
- E_TABLE_MEMORY_STORE_COLUMN_TYPE_CUSTOM
-} ETableMemoryStoreColumnType;
-
-typedef struct {
- ETableMemoryCalbacksDuplicateValueFn duplicate_value;
- ETableMemoryCalbacksFreeValueFn free_value;
- ETableMemoryCalbacksInitializeValueFn initialize_value;
- ETableMemoryCalbacksValueIsEmptyFn value_is_empty;
- ETableMemoryCalbacksValueToStringFn value_to_string;
-} ETableMemoryStoreCustomColumn;
-
-typedef struct {
- ETableMemoryStoreColumnType type;
- ETableMemoryStoreCustomColumn custom;
- guint editable : 1;
-} ETableMemoryStoreColumnInfo;
-
-#define E_TABLE_MEMORY_STORE_TERMINATOR { E_TABLE_MEMORY_STORE_COLUMN_TYPE_TERMINATOR, { NULL }, FALSE }
-#define E_TABLE_MEMORY_STORE_INTEGER { E_TABLE_MEMORY_STORE_COLUMN_TYPE_INTEGER, { NULL }, FALSE }
-#define E_TABLE_MEMORY_STORE_STRING { E_TABLE_MEMORY_STORE_COLUMN_TYPE_STRING, { NULL }, FALSE }
-#define E_TABLE_MEMORY_STORE_PIXBUF { E_TABLE_MEMORY_STORE_COLUMN_TYPE_PIXBUF, { NULL }, FALSE }
-#define E_TABLE_MEMORY_STORE_EDITABLE_STRING { E_TABLE_MEMORY_STORE_COLUMN_TYPE_STRING, { NULL }, TRUE }
-#define E_TABLE_MEMORY_STORE_CUSTOM(editable, duplicate, free, initialize, empty, string) \
- { E_TABLE_MEMORY_STORE_COLUMN_TYPE_CUSTOM, \
- { (duplicate), (free), (initialize), (empty), (string) }, editable }
-#define E_TABLE_MEMORY_STORE_OBJECT(editable, initialize, empty, string) \
- { E_TABLE_MEMORY_STORE_COLUMN_TYPE_CUSTOM, \
- { NULL, NULL, (initialize), (empty), (string) }, editable }
-
-typedef struct _ETableMemoryStorePrivate ETableMemoryStorePrivate;
-
-typedef struct {
- ETableMemory parent;
-
- ETableMemoryStorePrivate *priv;
-} ETableMemoryStore;
-
-typedef struct {
- ETableMemoryClass parent_class;
-} ETableMemoryStoreClass;
-
-GtkType e_table_memory_store_get_type (void);
-
-/* Object Creation */
-ETableModel *e_table_memory_store_new (ETableMemoryStoreColumnInfo *columns);
-ETableModel *e_table_memory_store_construct (ETableMemoryStore *store,
- ETableMemoryStoreColumnInfo *columns);
-
-/* Adopt a value instead of copying it. */
-void e_table_memory_store_adopt_value_at (ETableMemoryStore *etms,
- int col,
- int row,
- void *value);
-
-/* The size of these arrays is the number of columns. */
-void e_table_memory_store_insert (ETableMemoryStore *etms,
- int row,
- void **store,
- gpointer data);
-void e_table_memory_store_insert_list (ETableMemoryStore *etms,
- int row,
- gpointer data,
- ...);
-void e_table_memory_store_insert_adopt (ETableMemoryStore *etms,
- int row,
- void **store,
- gpointer data);
-void e_table_memory_store_remove (ETableMemoryStore *etms,
- int row);
-void e_table_memory_store_clear (ETableMemoryStore *etms);
-
-END_GNOME_DECLS
-
-#endif /* _E_TABLE_MEMORY_STORE_H_ */
diff --git a/widgets/table/e-table-memory.c b/widgets/table/e-table-memory.c
deleted file mode 100644
index 84e9fe3378..0000000000
--- a/widgets/table/e-table-memory.c
+++ /dev/null
@@ -1,295 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-memory.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-
-#include "e-table-memory.h"
-
-#include <stdio.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <fcntl.h>
-
-#include <gtk/gtksignal.h>
-#include <gnome-xml/parser.h>
-#include <gnome-xml/xmlmemory.h>
-
-#include "gal/util/e-util.h"
-#include "gal/util/e-xml-utils.h"
-#include <string.h>
-
-#define PARENT_TYPE E_TABLE_MODEL_TYPE
-
-static ETableModel *parent_class;
-
-struct ETableMemoryPriv {
- gpointer *data;
- int num_rows;
- gint frozen;
-};
-
-
-/* virtual methods */
-
-static void
-etmm_destroy (GtkObject *object)
-{
- ETableMemory *etmm = E_TABLE_MEMORY (object);
- ETableMemoryPriv *priv = etmm->priv;
-
- /* XXX lots of stuff to free here */
-
- g_free (priv->data);
- g_free (priv);
-
- GTK_OBJECT_CLASS (parent_class)->destroy (object);
-}
-
-static int
-etmm_row_count (ETableModel *etm)
-{
- ETableMemory *etmm = E_TABLE_MEMORY (etm);
-
- return etmm->priv->num_rows;
-}
-
-
-static void
-e_table_memory_class_init (GtkObjectClass *klass)
-{
- ETableModelClass *table_class = (ETableModelClass *) klass;
-
- parent_class = gtk_type_class (PARENT_TYPE);
-
- klass->destroy = etmm_destroy;
-
- table_class->row_count = etmm_row_count;
-}
-
-static void
-e_table_memory_init (GtkObject *object)
-{
- ETableMemory *etmm = (ETableMemory *)object;
-
- ETableMemoryPriv *priv;
-
- priv = g_new0 (ETableMemoryPriv, 1);
- etmm->priv = priv;
-
- priv->data = NULL;
- priv->num_rows = 0;
- priv->frozen = 0;
-}
-
-E_MAKE_TYPE(e_table_memory, "ETableMemory", ETableMemory, e_table_memory_class_init, e_table_memory_init, PARENT_TYPE)
-
-
-
-/**
- * e_table_memory_construct:
- * @etable:
- *
- *
- **/
-void
-e_table_memory_construct (ETableMemory *etmm)
-{
-}
-
-/**
- * e_table_memory_new
- *
- * XXX docs here.
- *
- * return values: a newly constructed ETableMemory.
- */
-ETableMemory *
-e_table_memory_new (void)
-{
- ETableMemory *etmm;
-
- etmm = gtk_type_new (e_table_memory_get_type ());
-
- e_table_memory_construct(etmm);
-
- return etmm;
-}
-
-/**
- * e_table_memory_get_data:
- * @etmm:
- * @row:
- *
- *
- *
- * Return value:
- **/
-gpointer
-e_table_memory_get_data (ETableMemory *etmm, int row)
-{
- g_return_val_if_fail(row >= 0, NULL);
- g_return_val_if_fail(row < etmm->priv->num_rows, NULL);
-
- return etmm->priv->data[row];
-}
-
-/**
- * e_table_memory_set_data:
- * @etmm:
- * @row:
- * @data:
- *
- *
- **/
-void
-e_table_memory_set_data (ETableMemory *etmm, int row, gpointer data)
-{
- g_return_if_fail(row >= 0);
- g_return_if_fail(row < etmm->priv->num_rows);
-
- etmm->priv->data[row] = data;
-}
-
-/**
- * e_table_memory_insert:
- * @table_model:
- * @parent_path:
- * @position:
- * @data:
- *
- *
- *
- * Return value:
- **/
-void
-e_table_memory_insert (ETableMemory *etmm,
- int row,
- gpointer data)
-{
- g_return_if_fail(row >= -1);
- g_return_if_fail(row <= etmm->priv->num_rows);
-
- if (!etmm->priv->frozen)
- e_table_model_pre_change(E_TABLE_MODEL(etmm));
-
- if (row == -1)
- row = etmm->priv->num_rows;
- etmm->priv->data = g_renew(gpointer, etmm->priv->data, etmm->priv->num_rows + 1);
- memmove(etmm->priv->data + row + 1, etmm->priv->data + row, (etmm->priv->num_rows - row) * sizeof (gpointer));
- etmm->priv->data[row] = data;
- etmm->priv->num_rows ++;
- if (!etmm->priv->frozen)
- e_table_model_row_inserted(E_TABLE_MODEL(etmm), row);
-}
-
-
-
-/**
- * e_table_memory_remove:
- * @etable:
- * @path:
- *
- *
- *
- * Return value:
- **/
-gpointer
-e_table_memory_remove (ETableMemory *etmm, int row)
-{
- gpointer ret;
-
- g_return_val_if_fail(row >= 0, NULL);
- g_return_val_if_fail(row < etmm->priv->num_rows, NULL);
-
- if (!etmm->priv->frozen)
- e_table_model_pre_change(E_TABLE_MODEL(etmm));
- ret = etmm->priv->data[row];
- memmove(etmm->priv->data + row, etmm->priv->data + row + 1, (etmm->priv->num_rows - row - 1) * sizeof (gpointer));
- etmm->priv->num_rows --;
- if (!etmm->priv->frozen)
- e_table_model_row_deleted(E_TABLE_MODEL(etmm), row);
- return ret;
-}
-
-/**
- * e_table_memory_clear:
- * @etable:
- * @path:
- *
- *
- *
- * Return value:
- **/
-void
-e_table_memory_clear (ETableMemory *etmm)
-{
- if (!etmm->priv->frozen)
- e_table_model_pre_change(E_TABLE_MODEL(etmm));
- g_free(etmm->priv->data);
- etmm->priv->data = NULL;
- etmm->priv->num_rows = 0;
- if (!etmm->priv->frozen)
- e_table_model_changed(E_TABLE_MODEL(etmm));
-}
-
-/**
- * e_table_memory_freeze:
- * @etmm: the ETableModel to freeze.
- *
- * This function prepares an ETableModel for a period of much change.
- * All signals regarding changes to the table are deferred until we
- * thaw the table.
- *
- **/
-void
-e_table_memory_freeze(ETableMemory *etmm)
-{
- ETableMemoryPriv *priv = etmm->priv;
-
- if (priv->frozen == 0)
- e_table_model_pre_change(E_TABLE_MODEL(etmm));
-
- priv->frozen ++;
-}
-
-/**
- * e_table_memory_thaw:
- * @etmm: the ETableMemory to thaw.
- *
- * This function thaws an ETableMemory. All the defered signals can add
- * up to a lot, we don't know - so we just emit a model_changed
- * signal.
- *
- **/
-void
-e_table_memory_thaw(ETableMemory *etmm)
-{
- ETableMemoryPriv *priv = etmm->priv;
-
- if (priv->frozen > 0)
- priv->frozen --;
- if (priv->frozen == 0) {
- e_table_model_changed(E_TABLE_MODEL(etmm));
- }
-}
diff --git a/widgets/table/e-table-memory.h b/widgets/table/e-table-memory.h
deleted file mode 100644
index a251f0dc0b..0000000000
--- a/widgets/table/e-table-memory.h
+++ /dev/null
@@ -1,80 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-memory.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_TABLE_MEMORY_H_
-#define _E_TABLE_MEMORY_H_
-
-#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <gal/e-table/e-table-model.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define E_TABLE_MEMORY_TYPE (e_table_memory_get_type ())
-#define E_TABLE_MEMORY(o) (GTK_CHECK_CAST ((o), E_TABLE_MEMORY_TYPE, ETableMemory))
-#define E_TABLE_MEMORY_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_MEMORY_TYPE, ETableMemoryClass))
-#define E_IS_TABLE_MEMORY(o) (GTK_CHECK_TYPE ((o), E_TABLE_MEMORY_TYPE))
-#define E_IS_TABLE_MEMORY_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_MEMORY_TYPE))
-
-typedef struct ETableMemory ETableMemory;
-typedef struct ETableMemoryPriv ETableMemoryPriv;
-typedef struct ETableMemoryClass ETableMemoryClass;
-
-struct ETableMemory {
- ETableModel base;
- ETableMemoryPriv *priv;
-};
-
-struct ETableMemoryClass {
- ETableModelClass parent_class;
-};
-
-
-GtkType e_table_memory_get_type (void);
-void e_table_memory_construct (ETableMemory *etable);
-ETableMemory *e_table_memory_new (void);
-
-/* row operations */
-void e_table_memory_insert (ETableMemory *etable,
- int row,
- gpointer data);
-gpointer e_table_memory_remove (ETableMemory *etable,
- int row);
-void e_table_memory_clear (ETableMemory *etable);
-
-/* Freeze and thaw */
-void e_table_memory_freeze (ETableMemory *etable);
-void e_table_memory_thaw (ETableMemory *etable);
-gpointer e_table_memory_get_data (ETableMemory *etm,
- int row);
-void e_table_memory_set_data (ETableMemory *etm,
- int row,
- gpointer data);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _E_TABLE_MEMORY_H */
diff --git a/widgets/table/e-table-model.c b/widgets/table/e-table-model.c
deleted file mode 100644
index 89dce2756c..0000000000
--- a/widgets/table/e-table-model.c
+++ /dev/null
@@ -1,593 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-model.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <gtk/gtksignal.h>
-#include "e-table-model.h"
-#include "gal/util/e-util.h"
-
-#define ETM_CLASS(e) ((ETableModelClass *)((GtkObject *)e)->klass)
-
-#define PARENT_TYPE gtk_object_get_type ()
-
-#define d(x)
-
-d(static gint depth = 0);
-
-
-static GtkObjectClass *e_table_model_parent_class;
-
-enum {
- MODEL_NO_CHANGE,
- MODEL_CHANGED,
- MODEL_PRE_CHANGE,
- MODEL_ROW_CHANGED,
- MODEL_CELL_CHANGED,
- MODEL_ROWS_INSERTED,
- MODEL_ROWS_DELETED,
- ROW_SELECTION,
- LAST_SIGNAL
-};
-
-static guint e_table_model_signals [LAST_SIGNAL] = { 0, };
-
-/**
- * e_table_model_column_count:
- * @e_table_model: The e-table-model to operate on
- *
- * Returns: the number of columns in the table model.
- */
-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);
-}
-
-
-/**
- * e_table_model_row_count:
- * @e_table_model: the e-table-model to operate on
- *
- * Returns: the number of rows in the 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);
-}
-
-/**
- * e_table_model_append_row:
- * @e_table_model: the table model to append the a row to.
- * @source:
- * @row:
- *
- */
-void
-e_table_model_append_row (ETableModel *e_table_model, ETableModel *source, int row)
-{
- 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)->append_row)
- ETM_CLASS (e_table_model)->append_row (e_table_model, source, row);
-}
-
-/**
- * e_table_value_at:
- * @e_table_model: the e-table-model to operate on
- * @col: column in the model to pull data from.
- * @row: row in the model to pull data from.
- *
- * Return value: This function returns the value that is stored
- * by the @e_table_model in column @col and row @row. The data
- * returned can be a pointer or any data value that can be stored
- * inside a pointer.
- *
- * The data returned is typically used by an ECell renderer
- */
-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);
-}
-
-/**
- * e_table_model_set_value_at:
- * @e_table_model: the table model to operate on.
- * @col: the column where the data will be stored in the model.
- * @row: the row where the data will be stored in the model.
- * @value: the data to be stored.
- *
- * This function instructs the model to store the value in @data in the
- * the @e_table_model at column @col and row @row. The @data typically
- * comes from one of the ECell rendering objects.
- *
- * There should be an agreement between the Table Model and the user
- * of this function about the data being stored. Typically it will
- * be a pointer to a set of data, or a datum that fits inside a void *.
- */
-void
-e_table_model_set_value_at (ETableModel *e_table_model, int col, int row, const void *value)
-{
- 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, value);
-}
-
-/**
- * e_table_model_is_cell_editable:
- * @e_table_model: the table model to query.
- * @col: column to query.
- * @row: row to query.
- *
- * Returns: %TRUE if the cell in @e_table_model at @col,@row can be
- * edited, %FALSE otherwise
- */
-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);
-}
-
-gboolean
-e_table_model_has_save_id (ETableModel *e_table_model)
-{
- g_return_val_if_fail (e_table_model != NULL, FALSE);
- g_return_val_if_fail (E_IS_TABLE_MODEL (e_table_model), FALSE);
-
- if (ETM_CLASS (e_table_model)->has_save_id)
- return ETM_CLASS (e_table_model)->has_save_id (e_table_model);
- else
- return FALSE;
-}
-
-char *
-e_table_model_get_save_id (ETableModel *e_table_model, int row)
-{
- g_return_val_if_fail (e_table_model != NULL, "/");
- g_return_val_if_fail (E_IS_TABLE_MODEL (e_table_model), "/");
-
- if (ETM_CLASS (e_table_model)->get_save_id)
- return ETM_CLASS (e_table_model)->get_save_id (e_table_model, row);
- else
- return NULL;
-}
-
-gboolean
-e_table_model_has_change_pending(ETableModel *e_table_model)
-{
- g_return_val_if_fail (e_table_model != NULL, FALSE);
- g_return_val_if_fail (E_IS_TABLE_MODEL (e_table_model), FALSE);
-
- if (ETM_CLASS (e_table_model)->has_change_pending)
- return ETM_CLASS (e_table_model)->has_change_pending (e_table_model);
- else
- return FALSE;
-}
-
-void *
-e_table_model_initialize_value (ETableModel *e_table_model, int col)
-{
- 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)->initialize_value)
- return ETM_CLASS (e_table_model)->initialize_value (e_table_model, col);
- else
- return NULL;
-}
-
-gboolean
-e_table_model_value_is_empty (ETableModel *e_table_model, int col, const void *value)
-{
- g_return_val_if_fail (e_table_model != NULL, FALSE);
- g_return_val_if_fail (E_IS_TABLE_MODEL (e_table_model), FALSE);
-
- if (ETM_CLASS (e_table_model)->value_is_empty)
- return ETM_CLASS (e_table_model)->value_is_empty (e_table_model, col, value);
- else
- return FALSE;
-}
-
-char *
-e_table_model_value_to_string (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)->value_to_string)
- return ETM_CLASS (e_table_model)->value_to_string (e_table_model, col, value);
- else
- return g_strdup("");
-}
-
-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)
-{
- ETableModelClass *klass = E_TABLE_MODEL_CLASS(object_class);
- e_table_model_parent_class = gtk_type_class (PARENT_TYPE);
-
- object_class->destroy = e_table_model_destroy;
-
- e_table_model_signals [MODEL_NO_CHANGE] =
- gtk_signal_new ("model_no_change",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETableModelClass, model_no_change),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
-
- e_table_model_signals [MODEL_CHANGED] =
- gtk_signal_new ("model_changed",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETableModelClass, model_changed),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- e_table_model_signals [MODEL_PRE_CHANGE] =
- gtk_signal_new ("model_pre_change",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETableModelClass, model_pre_change),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- e_table_model_signals [MODEL_ROW_CHANGED] =
- gtk_signal_new ("model_row_changed",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- 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,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETableModelClass, model_cell_changed),
- gtk_marshal_NONE__INT_INT,
- GTK_TYPE_NONE, 2, GTK_TYPE_INT, GTK_TYPE_INT);
-
- e_table_model_signals [MODEL_ROWS_INSERTED] =
- gtk_signal_new ("model_rows_inserted",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETableModelClass, model_rows_inserted),
- gtk_marshal_NONE__INT_INT,
- GTK_TYPE_NONE, 2, GTK_TYPE_INT, GTK_TYPE_INT);
-
- e_table_model_signals [MODEL_ROWS_DELETED] =
- gtk_signal_new ("model_rows_deleted",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETableModelClass, model_rows_deleted),
- gtk_marshal_NONE__INT_INT,
- GTK_TYPE_NONE, 2, GTK_TYPE_INT, GTK_TYPE_INT);
-
- E_OBJECT_CLASS_ADD_SIGNALS (object_class, e_table_model_signals, LAST_SIGNAL);
-
- klass->column_count = NULL;
- klass->row_count = NULL;
- klass->append_row = NULL;
-
- klass->value_at = NULL;
- klass->set_value_at = NULL;
- klass->is_cell_editable = NULL;
-
- klass->has_save_id = NULL;
- klass->get_save_id = NULL;
-
- klass->has_change_pending = NULL;
-
- klass->duplicate_value = NULL;
- klass->free_value = NULL;
- klass->initialize_value = NULL;
- klass->value_is_empty = NULL;
- klass->value_to_string = NULL;
-
- klass->model_no_change = NULL;
- klass->model_changed = NULL;
- klass->model_row_changed = NULL;
- klass->model_cell_changed = NULL;
- klass->model_rows_inserted = NULL;
- klass->model_rows_deleted = NULL;
-}
-
-
-guint
-e_table_model_get_type (void)
-{
- static guint type = 0;
-
- if (!type)
- {
- GtkTypeInfo info =
- {
- "ETableModel",
- sizeof (ETableModel),
- sizeof (ETableModelClass),
- (GtkClassInitFunc) e_table_model_class_init,
- NULL,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- type = gtk_type_unique (PARENT_TYPE, &info);
- }
-
- return type;
-}
-
-#if d(!)0
-static void
-print_tabs (void)
-{
- int i;
- for (i = 0; i < depth; i++)
- g_print("\t");
-}
-#endif
-
-void
-e_table_model_pre_change (ETableModel *e_table_model)
-{
- g_return_if_fail (e_table_model != NULL);
- g_return_if_fail (E_IS_TABLE_MODEL (e_table_model));
-
- d(print_tabs());
- d(g_print("Emitting pre_change on model 0x%p, a %s.\n", e_table_model, gtk_type_name (GTK_OBJECT(e_table_model)->klass->type)));
- d(depth++);
- gtk_signal_emit (GTK_OBJECT (e_table_model),
- e_table_model_signals [MODEL_PRE_CHANGE]);
- d(depth--);
-}
-
-/**
- * e_table_model_no_change:
- * @e_table_model: the table model to notify of the lack of a change
- *
- * Use this function to notify any views of this table model that
- * the contents of the table model have changed. This will emit
- * the signal "model_no_change" on the @e_table_model object.
- *
- * It is preferable to use the e_table_model_row_changed() and
- * the e_table_model_cell_changed() to notify of smaller changes
- * than to invalidate the entire model, as the views might have
- * ways of caching the information they render from the model.
- */
-void
-e_table_model_no_change (ETableModel *e_table_model)
-{
- g_return_if_fail (e_table_model != NULL);
- g_return_if_fail (E_IS_TABLE_MODEL (e_table_model));
-
- d(print_tabs());
- d(g_print("Emitting model_no_change on model 0x%p, a %s.\n", e_table_model, gtk_type_name (GTK_OBJECT(e_table_model)->klass->type)));
- d(depth++);
- gtk_signal_emit (GTK_OBJECT (e_table_model),
- e_table_model_signals [MODEL_NO_CHANGE]);
- d(depth--);
-}
-
-/**
- * e_table_model_changed:
- * @e_table_model: the table model to notify of the change
- *
- * Use this function to notify any views of this table model that
- * the contents of the table model have changed. This will emit
- * the signal "model_changed" on the @e_table_model object.
- *
- * It is preferable to use the e_table_model_row_changed() and
- * the e_table_model_cell_changed() to notify of smaller changes
- * than to invalidate the entire model, as the views might have
- * ways of caching the information they render from the model.
- */
-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));
-
- d(print_tabs());
- d(g_print("Emitting model_changed on model 0x%p, a %s.\n", e_table_model, gtk_type_name (GTK_OBJECT(e_table_model)->klass->type)));
- d(depth++);
- gtk_signal_emit (GTK_OBJECT (e_table_model),
- e_table_model_signals [MODEL_CHANGED]);
- d(depth--);
-}
-
-/**
- * e_table_model_row_changed:
- * @e_table_model: the table model to notify of the change
- * @row: the row that was changed in the model.
- *
- * Use this function to notify any views of the table model that
- * the contents of row @row have changed in model. This function
- * will emit the "model_row_changed" signal on the @e_table_model
- * object
- */
-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));
-
- d(print_tabs());
- d(g_print("Emitting row_changed on model 0x%p, a %s, row %d.\n", e_table_model, gtk_type_name (GTK_OBJECT(e_table_model)->klass->type), row));
- d(depth++);
- gtk_signal_emit (GTK_OBJECT (e_table_model),
- e_table_model_signals [MODEL_ROW_CHANGED], row);
- d(depth--);
-}
-
-/**
- * e_table_model_cell_changed:
- * @e_table_model: the table model to notify of the change
- * @col: the column.
- * @row: the row
- *
- * Use this function to notify any views of the table model that
- * contents of the cell at @col,@row has changed. This will emit
- * the "model_cell_changed" signal on the @e_table_model
- * object
- */
-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));
-
- d(print_tabs());
- d(g_print("Emitting cell_changed on model 0x%p, a %s, row %d, col %d.\n", e_table_model, gtk_type_name (GTK_OBJECT(e_table_model)->klass->type), row, col));
- d(depth++);
- gtk_signal_emit (GTK_OBJECT (e_table_model),
- e_table_model_signals [MODEL_CELL_CHANGED], col, row);
- d(depth--);
-}
-
-/**
- * e_table_model_rows_inserted:
- * @e_table_model: the table model to notify of the change
- * @row: the row that was inserted into the model.
- * @count: The number of rows that were inserted.
- *
- * Use this function to notify any views of the table model that
- * @count rows at row @row have been inserted into the model. This
- * function will emit the "model_rows_inserted" signal on the
- * @e_table_model object
- */
-void
-e_table_model_rows_inserted (ETableModel *e_table_model, int row, int count)
-{
- g_return_if_fail (e_table_model != NULL);
- g_return_if_fail (E_IS_TABLE_MODEL (e_table_model));
-
- d(print_tabs());
- d(g_print("Emitting row_inserted on model 0x%p, a %s, row %d.\n", e_table_model, gtk_type_name (GTK_OBJECT(e_table_model)->klass->type), row));
- d(depth++);
- gtk_signal_emit (GTK_OBJECT (e_table_model),
- e_table_model_signals [MODEL_ROWS_INSERTED], row, count);
- d(depth--);
-}
-
-/**
- * e_table_model_row_inserted:
- * @e_table_model: the table model to notify of the change
- * @row: the row that was inserted into the model.
- *
- * Use this function to notify any views of the table model that the
- * row @row has been inserted into the model. This function will emit
- * the "model_rows_inserted" signal on the @e_table_model object
- */
-void
-e_table_model_row_inserted (ETableModel *e_table_model, int row)
-{
- e_table_model_rows_inserted(e_table_model, row, 1);
-}
-
-/**
- * e_table_model_row_deleted:
- * @e_table_model: the table model to notify of the change
- * @row: the row that was deleted
- * @count: The number of rows deleted
- *
- * Use this function to notify any views of the table model that
- * @count rows at row @row have been deleted from the model. This
- * function will emit the "model_rows_deleted" signal on the
- * @e_table_model object
- */
-void
-e_table_model_rows_deleted (ETableModel *e_table_model, int row, int count)
-{
- g_return_if_fail (e_table_model != NULL);
- g_return_if_fail (E_IS_TABLE_MODEL (e_table_model));
-
- d(print_tabs());
- d(g_print("Emitting row_deleted on model 0x%p, a %s, row %d.\n", e_table_model, gtk_type_name (GTK_OBJECT(e_table_model)->klass->type), row));
- d(depth++);
- gtk_signal_emit (GTK_OBJECT (e_table_model),
- e_table_model_signals [MODEL_ROWS_DELETED], row, count);
- d(depth--);
-}
-
-/**
- * e_table_model_row_deleted:
- * @e_table_model: the table model to notify of the change
- * @row: the row that was deleted
- *
- * Use this function to notify any views of the table model that the
- * row @row has been deleted from the model. This function will emit
- * the "model_rows_deleted" signal on the @e_table_model object
- */
-void
-e_table_model_row_deleted (ETableModel *e_table_model, int row)
-{
- e_table_model_rows_deleted(e_table_model, row, 1);
-}
diff --git a/widgets/table/e-table-model.h b/widgets/table/e-table-model.h
deleted file mode 100644
index 45731added..0000000000
--- a/widgets/table/e-table-model.h
+++ /dev/null
@@ -1,173 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-model.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_TABLE_MODEL_H_
-#define _E_TABLE_MODEL_H_
-
-#include <gtk/gtkobject.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#define E_TABLE_MODEL_TYPE (e_table_model_get_type ())
-#define E_TABLE_MODEL(o) (GTK_CHECK_CAST ((o), E_TABLE_MODEL_TYPE, ETableModel))
-#define E_TABLE_MODEL_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_MODEL_TYPE, ETableModelClass))
-#define E_IS_TABLE_MODEL(o) (GTK_CHECK_TYPE ((o), E_TABLE_MODEL_TYPE))
-#define E_IS_TABLE_MODEL_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_MODEL_TYPE))
-
-typedef struct {
- GtkObject base;
-} ETableModel;
-
-typedef struct {
- GtkObjectClass parent_class;
-
- /*
- * Virtual methods
- */
- int (*column_count) (ETableModel *etm);
- int (*row_count) (ETableModel *etm);
- void (*append_row) (ETableModel *etm, ETableModel *source, int row);
-
- 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);
-
- gboolean (*has_save_id) (ETableModel *etm);
- char *(*get_save_id) (ETableModel *etm, int row);
-
- gboolean (*has_change_pending) (ETableModel *etm);
-
- /* Allocate a copy of the given value. */
- void *(*duplicate_value) (ETableModel *etm, int col, const void *value);
- /* Free an allocated value. */
- void (*free_value) (ETableModel *etm, int col, void *value);
- /* Return an allocated empty value. */
- void *(*initialize_value) (ETableModel *etm, int col);
- /* Return TRUE if value is equivalent to an empty cell. */
- gboolean (*value_is_empty) (ETableModel *etm, int col, const void *value);
- /* Return an allocated string. */
- char *(*value_to_string) (ETableModel *etm, int col, const void *value);
-
-
- /*
- * Signals
- */
-
- /*
- * These all come after the change has been made.
- * No changes, cancel pre_change: no_change
- * Major structural changes: model_changed
- * Changes only in a row: row_changed
- * Only changes in a cell: cell_changed
- * A row inserted: row_inserted
- * A row deleted: row_deleted
- */
- void (*model_pre_change) (ETableModel *etm);
-
- void (*model_no_change) (ETableModel *etm);
- void (*model_changed) (ETableModel *etm);
- void (*model_row_changed) (ETableModel *etm, int row);
- void (*model_cell_changed) (ETableModel *etm, int col, int row);
- void (*model_rows_inserted) (ETableModel *etm, int row, int count);
- void (*model_rows_deleted) (ETableModel *etm, int row, int count);
-} 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_append_row (ETableModel *e_table_model,
- ETableModel *source,
- int row);
-
-/**/
-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);
-
-/**/
-gboolean e_table_model_has_save_id (ETableModel *etm);
-char *e_table_model_get_save_id (ETableModel *etm,
- int row);
-
-/**/
-gboolean e_table_model_has_change_pending (ETableModel *etm);
-
-
-/**/
-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_initialize_value (ETableModel *e_table_model,
- int col);
-gboolean e_table_model_value_is_empty (ETableModel *e_table_model,
- int col,
- const void *value);
-char *e_table_model_value_to_string (ETableModel *e_table_model,
- int col,
- const void *value);
-
-/*
- * Routines for emitting signals on the e_table
- */
-void e_table_model_pre_change (ETableModel *e_table_model);
-void e_table_model_no_change (ETableModel *e_table_model);
-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);
-void e_table_model_rows_inserted (ETableModel *e_table_model,
-int row,
-int count);
-void e_table_model_rows_deleted (ETableModel *e_table_model,
-int row,
-int count);
-
-/**/
-void e_table_model_row_inserted (ETableModel *e_table_model,
-int row);
-void e_table_model_row_deleted (ETableModel *e_table_model,
-int row);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _E_TABLE_MODEL_H_ */
diff --git a/widgets/table/e-table-one.c b/widgets/table/e-table-one.c
deleted file mode 100644
index cd6be49753..0000000000
--- a/widgets/table/e-table-one.c
+++ /dev/null
@@ -1,254 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-one.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include "e-table-one.h"
-
-#define PARENT_TYPE e_table_model_get_type ()
-
-static ETableModelClass *parent_class = NULL;
-
-static int
-one_column_count (ETableModel *etm)
-{
- ETableOne *one = E_TABLE_ONE(etm);
-
- if (one->source)
- return e_table_model_column_count(one->source);
- else
- return 0;
-}
-
-static int
-one_row_count (ETableModel *etm)
-{
- return 1;
-}
-
-static void *
-one_value_at (ETableModel *etm, int col, int row)
-{
- ETableOne *one = E_TABLE_ONE(etm);
-
- if (one->data)
- return one->data[col];
- else
- return NULL;
-}
-
-static void
-one_set_value_at (ETableModel *etm, int col, int row, const void *val)
-{
- ETableOne *one = E_TABLE_ONE(etm);
-
- if (one->data && one->source) {
- e_table_model_free_value(one->source, col, one->data[col]);
- one->data[col] = e_table_model_duplicate_value(one->source, col, val);
- }
-}
-
-static gboolean
-one_is_cell_editable (ETableModel *etm, int col, int row)
-{
- ETableOne *one = E_TABLE_ONE(etm);
-
- if (one->source)
- return e_table_model_is_cell_editable(one->source, col, -1);
- else
- return FALSE;
-}
-
-/* The default for one_duplicate_value is to return the raw value. */
-static void *
-one_duplicate_value (ETableModel *etm, int col, const void *value)
-{
- ETableOne *one = E_TABLE_ONE(etm);
-
- if (one->source)
- return e_table_model_duplicate_value(one->source, col, value);
- else
- return (void *)value;
-}
-
-static void
-one_free_value (ETableModel *etm, int col, void *value)
-{
- ETableOne *one = E_TABLE_ONE(etm);
-
- if (one->source)
- e_table_model_free_value(one->source, col, value);
-}
-
-static void *
-one_initialize_value (ETableModel *etm, int col)
-{
- ETableOne *one = E_TABLE_ONE(etm);
-
- if (one->source)
- return e_table_model_initialize_value (one->source, col);
- else
- return NULL;
-}
-
-static gboolean
-one_value_is_empty (ETableModel *etm, int col, const void *value)
-{
- ETableOne *one = E_TABLE_ONE(etm);
-
- if (one->source)
- return e_table_model_value_is_empty (one->source, col, value);
- else
- return FALSE;
-}
-
-static char *
-one_value_to_string (ETableModel *etm, int col, const void *value)
-{
- ETableOne *one = E_TABLE_ONE(etm);
-
- if (one->source)
- return e_table_model_value_to_string (one->source, col, value);
- else
- return g_strdup("");
-}
-
-static void
-one_destroy (GtkObject *object)
-{
- ETableOne *one = E_TABLE_ONE(object);
-
- if (one->source) {
- int i;
- int col_count;
-
- col_count = e_table_model_column_count(one->source);
-
- if (one->data) {
- for (i = 0; i < col_count; i++) {
- e_table_model_free_value(one->source, i, one->data[i]);
- }
- }
-
- gtk_object_unref(GTK_OBJECT(one->source));
- }
-
- g_free(one->data);
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-static void
-e_table_one_class_init (GtkObjectClass *object_class)
-{
- ETableModelClass *model_class = (ETableModelClass *) object_class;
-
- parent_class = gtk_type_class (E_TABLE_MODEL_TYPE);
-
- model_class->column_count = one_column_count;
- model_class->row_count = one_row_count;
- model_class->value_at = one_value_at;
- model_class->set_value_at = one_set_value_at;
- model_class->is_cell_editable = one_is_cell_editable;
- model_class->duplicate_value = one_duplicate_value;
- model_class->free_value = one_free_value;
- model_class->initialize_value = one_initialize_value;
- model_class->value_is_empty = one_value_is_empty;
- model_class->value_to_string = one_value_to_string;
-
- object_class->destroy = one_destroy;
-}
-
-static void
-e_table_one_init (GtkObject *object)
-{
- ETableOne *one = E_TABLE_ONE(object);
-
- one->source = NULL;
- one->data = NULL;
-}
-
-GtkType
-e_table_one_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type){
- GtkTypeInfo info = {
- "ETableOne",
- sizeof (ETableOne),
- sizeof (ETableOneClass),
- (GtkClassInitFunc) e_table_one_class_init,
- (GtkObjectInitFunc) e_table_one_init,
- NULL, /* reserved 1 */
- NULL, /* reserved 2 */
- (GtkClassInitFunc) NULL
- };
-
- type = gtk_type_unique (PARENT_TYPE, &info);
- }
-
- return type;
-}
-
-ETableModel *
-e_table_one_new (ETableModel *source)
-{
- ETableOne *eto;
- int col_count;
- int i;
-
- eto = gtk_type_new (e_table_one_get_type ());
-
- eto->source = source;
-
- col_count = e_table_model_column_count(source);
- eto->data = g_new(void *, col_count);
- for (i = 0; i < col_count; i++) {
- eto->data[i] = e_table_model_initialize_value(source, i);
- }
-
- if (source)
- gtk_object_ref(GTK_OBJECT(source));
-
- return (ETableModel *) eto;
-}
-
-void
-e_table_one_commit (ETableOne *one)
-{
- if (one->source) {
- int empty = TRUE;
- int col;
- int cols = e_table_model_column_count(one->source);
- for (col = 0; col < cols; col++) {
- if (!e_table_model_value_is_empty(one->source, col, one->data[col])) {
- empty = FALSE;
- break;
- }
- }
- if (!empty) {
- e_table_model_append_row(one->source, E_TABLE_MODEL(one), 0);
- }
- }
-}
diff --git a/widgets/table/e-table-one.h b/widgets/table/e-table-one.h
deleted file mode 100644
index 40dedba16d..0000000000
--- a/widgets/table/e-table-one.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-one.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_TABLE_ONE_H_
-#define _E_TABLE_ONE_H_
-
-#include <gal/e-table/e-table-model.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define E_TABLE_ONE_TYPE (e_table_one_get_type ())
-#define E_TABLE_ONE(o) (GTK_CHECK_CAST ((o), E_TABLE_ONE_TYPE, ETableOne))
-#define E_TABLE_ONE_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_ONE_TYPE, ETableOneClass))
-#define E_IS_TABLE_ONE(o) (GTK_CHECK_TYPE ((o), E_TABLE_ONE_TYPE))
-#define E_IS_TABLE_ONE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_ONE_TYPE))
-
-typedef struct {
- ETableModel parent;
-
- ETableModel *source;
- void **data;
-} ETableOne;
-
-typedef struct {
- ETableModelClass parent_class;
-} ETableOneClass;
-
-GtkType e_table_one_get_type (void);
-
-ETableModel *e_table_one_new (ETableModel *source);
-void e_table_one_commit (ETableOne *one);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _E_TABLE_ONE_H_ */
-
diff --git a/widgets/table/e-table-scrolled.c b/widgets/table/e-table-scrolled.c
deleted file mode 100644
index e5bd0f1f58..0000000000
--- a/widgets/table/e-table-scrolled.c
+++ /dev/null
@@ -1,224 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-scrolled.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdio.h>
-#include <libgnomeui/gnome-canvas.h>
-#include <gtk/gtksignal.h>
-#include <gnome-xml/parser.h>
-#include <gnome-xml/xmlmemory.h>
-
-#include "e-table.h"
-#include "e-table-scrolled.h"
-
-#define COLUMN_HEADER_HEIGHT 16
-
-#define PARENT_TYPE e_scroll_frame_get_type ()
-
-static GtkObjectClass *parent_class;
-
-enum {
- ARG_0,
- ARG_TABLE,
-};
-
-static void
-e_table_scrolled_init (GtkObject *object)
-{
- ETableScrolled *ets;
- EScrollFrame *scroll_frame;
-
- ets = E_TABLE_SCROLLED (object);
- scroll_frame = E_SCROLL_FRAME (object);
-
- GTK_WIDGET_SET_FLAGS (ets, GTK_CAN_FOCUS);
-
- ets->table = gtk_type_new(e_table_get_type());
-
- e_scroll_frame_set_policy (scroll_frame, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- e_scroll_frame_set_shadow_type (scroll_frame, GTK_SHADOW_IN);
-}
-
-static void
-e_table_scrolled_real_construct (ETableScrolled *ets)
-{
- gtk_container_add(GTK_CONTAINER(ets), GTK_WIDGET(ets->table));
-
- gtk_widget_show(GTK_WIDGET(ets->table));
-}
-
-ETableScrolled *e_table_scrolled_construct (ETableScrolled *ets,
- ETableModel *etm,
- ETableExtras *ete,
- const char *spec,
- const char *state)
-{
- g_return_val_if_fail(ets != NULL, NULL);
- g_return_val_if_fail(E_IS_TABLE_SCROLLED(ets), NULL);
- g_return_val_if_fail(etm != NULL, NULL);
- g_return_val_if_fail(E_IS_TABLE_MODEL(etm), NULL);
- g_return_val_if_fail(ete == NULL || E_IS_TABLE_EXTRAS(ete), NULL);
- g_return_val_if_fail(spec != NULL, NULL);
-
- e_table_construct(ets->table, etm, ete, spec, state);
-
- e_table_scrolled_real_construct(ets);
-
- return ets;
-}
-
-GtkWidget *e_table_scrolled_new (ETableModel *etm,
- ETableExtras *ete,
- const char *spec,
- const char *state)
-{
- ETableScrolled *ets;
-
- g_return_val_if_fail(etm != NULL, NULL);
- g_return_val_if_fail(E_IS_TABLE_MODEL(etm), NULL);
- g_return_val_if_fail(ete == NULL || E_IS_TABLE_EXTRAS(ete), NULL);
- g_return_val_if_fail(spec != NULL, NULL);
-
- ets = E_TABLE_SCROLLED (gtk_widget_new (e_table_scrolled_get_type (),
- "hadjustment", NULL,
- "vadjustment", NULL,
- NULL));
-
- ets = e_table_scrolled_construct (ets, etm, ete, spec, state);
-
- return GTK_WIDGET (ets);
-}
-
-ETableScrolled *e_table_scrolled_construct_from_spec_file (ETableScrolled *ets,
- ETableModel *etm,
- ETableExtras *ete,
- const char *spec_fn,
- const char *state_fn)
-{
- g_return_val_if_fail(ets != NULL, NULL);
- g_return_val_if_fail(E_IS_TABLE_SCROLLED(ets), NULL);
- g_return_val_if_fail(etm != NULL, NULL);
- g_return_val_if_fail(E_IS_TABLE_MODEL(etm), NULL);
- g_return_val_if_fail(ete == NULL || E_IS_TABLE_EXTRAS(ete), NULL);
- g_return_val_if_fail(spec_fn != NULL, NULL);
-
- e_table_construct_from_spec_file(ets->table, etm, ete, spec_fn, state_fn);
-
- e_table_scrolled_real_construct(ets);
-
- return ets;
-}
-
-GtkWidget *e_table_scrolled_new_from_spec_file (ETableModel *etm,
- ETableExtras *ete,
- const char *spec_fn,
- const char *state_fn)
-{
- ETableScrolled *ets;
-
- g_return_val_if_fail(etm != NULL, NULL);
- g_return_val_if_fail(E_IS_TABLE_MODEL(etm), NULL);
- g_return_val_if_fail(ete == NULL || E_IS_TABLE_EXTRAS(ete), NULL);
- g_return_val_if_fail(spec_fn != NULL, NULL);
-
- ets = E_TABLE_SCROLLED (gtk_widget_new (e_table_scrolled_get_type (),
- "hadjustment", NULL,
- "vadjustment", NULL,
- NULL));
-
- ets = e_table_scrolled_construct_from_spec_file (ets, etm, ete, spec_fn, state_fn);
-
- return GTK_WIDGET (ets);
-}
-
-ETable *
-e_table_scrolled_get_table (ETableScrolled *ets)
-{
- return ets->table;
-}
-
-static void
-ets_get_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- ETableScrolled *ets = E_TABLE_SCROLLED (o);
-
- switch (arg_id){
- case ARG_TABLE:
- if (ets->table)
- GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(ets->table);
- else
- GTK_VALUE_OBJECT (*arg) = NULL;
- break;
- }
-}
-
-/* Grab_focus handler for the scrolled ETable */
-static void
-ets_grab_focus (GtkWidget *widget)
-{
- ETableScrolled *ets;
-
- ets = E_TABLE_SCROLLED (widget);
-
- gtk_widget_grab_focus (GTK_WIDGET (ets->table));
-}
-
-/* Focus handler for the scrolled ETable */
-static gint
-ets_focus (GtkContainer *container, GtkDirectionType direction)
-{
- ETableScrolled *ets;
-
- ets = E_TABLE_SCROLLED (container);
-
- return gtk_container_focus (GTK_CONTAINER (ets->table), direction);
-}
-
-static void
-e_table_scrolled_class_init (ETableScrolledClass *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 (PARENT_TYPE);
-
- object_class->get_arg = ets_get_arg;
-
- widget_class->grab_focus = ets_grab_focus;
-
- container_class->focus = ets_focus;
-
- gtk_object_add_arg_type ("ETableScrolled::table", GTK_TYPE_OBJECT,
- GTK_ARG_READABLE, ARG_TABLE);
-}
-
-E_MAKE_TYPE(e_table_scrolled, "ETableScrolled", ETableScrolled, e_table_scrolled_class_init, e_table_scrolled_init, PARENT_TYPE);
-
diff --git a/widgets/table/e-table-scrolled.h b/widgets/table/e-table-scrolled.h
deleted file mode 100644
index ce12a8cefd..0000000000
--- a/widgets/table/e-table-scrolled.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-scrolled.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_TABLE_SCROLLED_H_
-#define _E_TABLE_SCROLLED_H_
-
-#include <gal/widgets/e-scroll-frame.h>
-#include <gal/e-table/e-table-model.h>
-#include <gal/e-table/e-table.h>
-#include <libgnome/gnome-defs.h>
-
-BEGIN_GNOME_DECLS
-
-#define E_TABLE_SCROLLED_TYPE (e_table_scrolled_get_type ())
-#define E_TABLE_SCROLLED(o) (GTK_CHECK_CAST ((o), E_TABLE_SCROLLED_TYPE, ETableScrolled))
-#define E_TABLE_SCROLLED_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_SCROLLED_TYPE, ETableScrolledClass))
-#define E_IS_TABLE_SCROLLED(o) (GTK_CHECK_TYPE ((o), E_TABLE_SCROLLED_TYPE))
-#define E_IS_TABLE_SCROLLED_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_SCROLLED_TYPE))
-
-typedef struct {
- EScrollFrame parent;
-
- ETable *table;
-} ETableScrolled;
-
-typedef struct {
- EScrollFrameClass parent_class;
-} ETableScrolledClass;
-
-GtkType e_table_scrolled_get_type (void);
-
-ETableScrolled *e_table_scrolled_construct (ETableScrolled *ets,
- ETableModel *etm,
- ETableExtras *ete,
- const char *spec,
- const char *state);
-GtkWidget *e_table_scrolled_new (ETableModel *etm,
- ETableExtras *ete,
- const char *spec,
- const char *state);
-
-ETableScrolled *e_table_scrolled_construct_from_spec_file (ETableScrolled *ets,
- ETableModel *etm,
- ETableExtras *ete,
- const char *spec_fn,
- const char *state_fn);
-GtkWidget *e_table_scrolled_new_from_spec_file (ETableModel *etm,
- ETableExtras *ete,
- const char *spec_fn,
- const char *state_fn);
-
-ETable *e_table_scrolled_get_table (ETableScrolled *ets);
-
-END_GNOME_DECLS
-
-#endif /* _E_TABLE_SCROLLED_H_ */
-
diff --git a/widgets/table/e-table-search.c b/widgets/table/e-table-search.c
deleted file mode 100644
index ec27d9769e..0000000000
--- a/widgets/table/e-table-search.c
+++ /dev/null
@@ -1,242 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-search.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <gtk/gtksignal.h>
-#include "e-table-search.h"
-#include "gal/util/e-util.h"
-
-#define ETS_CLASS(e) ((ETableSearchClass *)((GtkObject *)e)->klass)
-
-#define PARENT_TYPE gtk_object_get_type ()
-
-#define d(x)
-
-d(static gint depth = 0);
-
-struct _ETableSearchPrivate {
- guint timeout_id;
-
- char *search_string;
- gunichar last_character;
-};
-
-static GtkObjectClass *e_table_search_parent_class;
-
-enum {
- SEARCH_SEARCH,
- SEARCH_ACCEPT,
- LAST_SIGNAL
-};
-
-static guint e_table_search_signals [LAST_SIGNAL] = { 0, };
-
-static gboolean
-e_table_search_search (ETableSearch *e_table_search, char *string, ETableSearchFlags flags)
-{
- gboolean ret_val;
- g_return_val_if_fail (e_table_search != NULL, FALSE);
- g_return_val_if_fail (E_IS_TABLE_SEARCH (e_table_search), FALSE);
-
- gtk_signal_emit (GTK_OBJECT (e_table_search),
- e_table_search_signals [SEARCH_SEARCH], string, flags, &ret_val);
-
- return ret_val;
-}
-
-static void
-e_table_search_accept (ETableSearch *e_table_search)
-{
- g_return_if_fail (e_table_search != NULL);
- g_return_if_fail (E_IS_TABLE_SEARCH (e_table_search));
-
- gtk_signal_emit (GTK_OBJECT (e_table_search),
- e_table_search_signals [SEARCH_ACCEPT]);
-}
-
-static gboolean
-ets_accept (gpointer data)
-{
- ETableSearch *ets = data;
- e_table_search_accept (ets);
- g_free (ets->priv->search_string);
-
- ets->priv->timeout_id = 0;
- ets->priv->search_string = g_strdup ("");
- ets->priv->last_character = 0;
-
- return FALSE;
-}
-
-static void
-drop_timeout (ETableSearch *ets)
-{
- if (ets->priv->timeout_id) {
- g_source_remove (ets->priv->timeout_id);
- }
- ets->priv->timeout_id = 0;
-}
-
-static void
-add_timeout (ETableSearch *ets)
-{
- drop_timeout (ets);
- ets->priv->timeout_id = g_timeout_add (1000, ets_accept, ets);
-}
-
-static void
-e_table_search_destroy (GtkObject *object)
-{
- if (e_table_search_parent_class->destroy)
- (*e_table_search_parent_class->destroy)(object);
-}
-
-static void
-e_table_search_class_init (GtkObjectClass *object_class)
-{
- ETableSearchClass *klass = E_TABLE_SEARCH_CLASS(object_class);
- e_table_search_parent_class = gtk_type_class (PARENT_TYPE);
-
- object_class->destroy = e_table_search_destroy;
-
- e_table_search_signals [SEARCH_SEARCH] =
- gtk_signal_new ("search",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETableSearchClass, search),
- e_marshal_BOOL__STRING_ENUM,
- GTK_TYPE_BOOL, 2, GTK_TYPE_STRING, GTK_TYPE_ENUM);
-
- e_table_search_signals [SEARCH_ACCEPT] =
- gtk_signal_new ("accept",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETableSearchClass, accept),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- E_OBJECT_CLASS_ADD_SIGNALS (object_class, e_table_search_signals, LAST_SIGNAL);
-
- klass->search = NULL;
- klass->accept = NULL;
-}
-
-static void
-e_table_search_init (ETableSearch *ets)
-{
- ets->priv = g_new (ETableSearchPrivate, 1);
-
- ets->priv->timeout_id = 0;
- ets->priv->search_string = g_strdup ("");
- ets->priv->last_character = 0;
-}
-
-
-guint
-e_table_search_get_type (void)
-{
- static guint type = 0;
-
- if (!type)
- {
- GtkTypeInfo info =
- {
- "ETableSearch",
- sizeof (ETableSearch),
- sizeof (ETableSearchClass),
- (GtkClassInitFunc) e_table_search_class_init,
- (GtkObjectInitFunc) e_table_search_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
- };
-
- type = gtk_type_unique (PARENT_TYPE, &info);
- }
-
- return type;
-}
-
-ETableSearch *
-e_table_search_new (void)
-{
- ETableSearch *ets = gtk_type_new (e_table_search_get_type());
-
- return ets;
-}
-
-/**
- * e_table_search_column_count:
- * @e_table_search: The e-table-search to operate on
- *
- * Returns: the number of columns in the table search.
- */
-void
-e_table_search_input_character (ETableSearch *ets, gunichar character)
-{
- char character_utf8[7];
- char *temp_string;
-
- g_return_if_fail (ets != NULL);
- g_return_if_fail (E_IS_TABLE_SEARCH (ets));
-
- character_utf8 [g_unichar_to_utf8 (character, character_utf8)] = 0;
-
- temp_string = g_strdup_printf ("%s%s", ets->priv->search_string, character_utf8);
- if (e_table_search_search (ets, temp_string,
- ets->priv->last_character != 0 ? E_TABLE_SEARCH_FLAGS_CHECK_CURSOR_FIRST : 0)) {
- g_free (ets->priv->search_string);
- ets->priv->search_string = temp_string;
- add_timeout (ets);
- ets->priv->last_character = character;
- return;
- } else {
- g_free (temp_string);
- }
-
- if (character == ets->priv->last_character) {
- if (ets->priv->search_string && e_table_search_search (ets, ets->priv->search_string, 0)) {
- add_timeout (ets);
- }
- }
-}
-
-gboolean
-e_table_search_backspace (ETableSearch *ets)
-{
- char *end;
-
- g_return_val_if_fail (ets != NULL, FALSE);
- g_return_val_if_fail (E_IS_TABLE_SEARCH (ets), FALSE);
-
- if (!ets->priv->search_string ||
- !*ets->priv->search_string)
- return FALSE;
-
- end = ets->priv->search_string + strlen (ets->priv->search_string);
- end = g_utf8_prev_char (end);
- *end = 0;
- ets->priv->last_character = 0;
- add_timeout (ets);
- return TRUE;
-}
diff --git a/widgets/table/e-table-search.h b/widgets/table/e-table-search.h
deleted file mode 100644
index bd614206a0..0000000000
--- a/widgets/table/e-table-search.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-search.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_TABLE_SEARCH_H_
-#define _E_TABLE_SEARCH_H_
-
-#include <gtk/gtkobject.h>
-#include <libgnome/gnome-defs.h>
-#include <gal/unicode/gunicode.h>
-
-BEGIN_GNOME_DECLS
-
-#define E_TABLE_SEARCH_TYPE (e_table_search_get_type ())
-#define E_TABLE_SEARCH(o) (GTK_CHECK_CAST ((o), E_TABLE_SEARCH_TYPE, ETableSearch))
-#define E_TABLE_SEARCH_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_SEARCH_TYPE, ETableSearchClass))
-#define E_IS_TABLE_SEARCH(o) (GTK_CHECK_TYPE ((o), E_TABLE_SEARCH_TYPE))
-#define E_IS_TABLE_SEARCH_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_SEARCH_TYPE))
-
-typedef struct _ETableSearchPrivate ETableSearchPrivate;
-
-typedef enum {
- E_TABLE_SEARCH_FLAGS_CHECK_CURSOR_FIRST = 1 << 0
-} ETableSearchFlags;
-
-typedef struct {
- GtkObject base;
-
- ETableSearchPrivate *priv;
-} ETableSearch;
-
-typedef struct {
- GtkObjectClass parent_class;
-
- /*
- * Signals
- */
- gboolean (*search) (ETableSearch *ets, char *string /* utf8 */, ETableSearchFlags flags);
- void (*accept) (ETableSearch *ets);
-} ETableSearchClass;
-
-GtkType e_table_search_get_type (void);
-ETableSearch *e_table_search_new (void);
-
-/**/
-void e_table_search_input_character (ETableSearch *e_table_search,
- gunichar character);
-gboolean e_table_search_backspace (ETableSearch *e_table_search);
-void e_table_search_cancel (ETableSearch *e_table_search);
-
-END_GNOME_DECLS
-
-#endif /* _E_TABLE_SEARCH_H_ */
diff --git a/widgets/table/e-table-selection-model.c b/widgets/table/e-table-selection-model.c
deleted file mode 100644
index 5d61904161..0000000000
--- a/widgets/table/e-table-selection-model.c
+++ /dev/null
@@ -1,338 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-selection-model.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include "e-table-selection-model.h"
-
-#include <string.h>
-#include <gdk/gdkkeysyms.h>
-#include <gtk/gtksignal.h>
-
-#include "gal/util/e-util.h"
-
-#define ETSM_CLASS(e) ((ETableSelectionModelClass *)((GtkObject *)e)->klass)
-
-#define PARENT_TYPE e_selection_model_array_get_type ()
-
-static ESelectionModelArray *parent_class;
-
-static gint etsm_get_row_count (ESelectionModelArray *esm);
-
-enum {
- ARG_0,
- ARG_MODEL,
- ARG_HEADER,
-};
-
-static void
-save_to_hash(int model_row, gpointer closure)
-{
- ETableSelectionModel *etsm = closure;
- gchar *key = e_table_model_get_save_id(etsm->model, model_row);
-
- g_hash_table_insert(etsm->hash, key, key);
-}
-
-static void
-free_key(gpointer key, gpointer value, gpointer closure)
-{
- g_free(key);
-}
-
-static void
-free_hash(ETableSelectionModel *etsm)
-{
- if (etsm->hash) {
- g_hash_table_foreach(etsm->hash, free_key, NULL);
- g_hash_table_destroy(etsm->hash);
- etsm->hash = NULL;
- }
- g_free(etsm->cursor_id);
- etsm->cursor_id = NULL;
-}
-
-static void
-model_pre_change (ETableModel *etm, ETableSelectionModel *etsm)
-{
- free_hash(etsm);
-
- if (etsm->model && e_table_model_has_save_id (etsm->model)) {
- gint cursor_row;
-
- etsm->hash = g_hash_table_new(g_str_hash, g_str_equal);
- e_selection_model_foreach(E_SELECTION_MODEL(etsm), save_to_hash, etsm);
-
- gtk_object_get(GTK_OBJECT(etsm),
- "cursor_row", &cursor_row,
- NULL);
- g_free (etsm->cursor_id);
- if (cursor_row != -1)
- etsm->cursor_id = e_table_model_get_save_id(etm, cursor_row);
- else
- etsm->cursor_id = NULL;
- }
-}
-
-static gint
-model_changed_idle(ETableSelectionModel *etsm)
-{
- ETableModel *etm = etsm->model;
-
- e_selection_model_clear(E_SELECTION_MODEL(etsm));
-
- if (etsm->cursor_id && etm && e_table_model_has_save_id(etm)) {
- int row_count = e_table_model_row_count(etm);
- int cursor_row = -1;
- int cursor_col = -1;
- int i;
- e_selection_model_array_confirm_row_count(E_SELECTION_MODEL_ARRAY(etsm));
- for (i = 0; i < row_count; i++) {
- char *save_id = e_table_model_get_save_id(etm, i);
- if (g_hash_table_lookup(etsm->hash, save_id))
- e_selection_model_change_one_row(E_SELECTION_MODEL(etsm), i, TRUE);
-
- if (etsm->cursor_id && !strcmp(etsm->cursor_id, save_id)) {
- cursor_row = i;
- cursor_col = e_selection_model_cursor_col(E_SELECTION_MODEL(etsm));
- if (cursor_col == -1) {
- if (etsm->eth) {
- cursor_col = e_table_header_prioritized_column (etsm->eth);
- } else
- cursor_col = 0;
- }
- e_selection_model_change_cursor(E_SELECTION_MODEL(etsm), cursor_row, cursor_col);
- g_free(etsm->cursor_id);
- etsm->cursor_id = NULL;
- }
- g_free(save_id);
- }
- free_hash(etsm);
- e_selection_model_cursor_changed (E_SELECTION_MODEL(etsm), cursor_row, cursor_col);
- e_selection_model_selection_changed (E_SELECTION_MODEL(etsm));
- }
- etsm->model_changed_idle_id = 0;
- return FALSE;
-}
-
-static void
-model_changed(ETableModel *etm, ETableSelectionModel *etsm)
-{
- e_selection_model_clear(E_SELECTION_MODEL(etsm));
- if (!etsm->model_changed_idle_id && etm && e_table_model_has_save_id(etm)) {
- etsm->model_changed_idle_id = g_idle_add_full(G_PRIORITY_HIGH, (GSourceFunc) model_changed_idle, etsm, NULL);
- }
-}
-
-static void
-model_row_changed(ETableModel *etm, int row, ETableSelectionModel *etsm)
-{
- free_hash(etsm);
-}
-
-static void
-model_cell_changed(ETableModel *etm, int col, int row, ETableSelectionModel *etsm)
-{
- free_hash(etsm);
-}
-
-#if 1
-static void
-model_rows_inserted(ETableModel *etm, int row, int count, ETableSelectionModel *etsm)
-{
- e_selection_model_array_insert_rows(E_SELECTION_MODEL_ARRAY(etsm), row, count);
- free_hash(etsm);
-}
-
-static void
-model_rows_deleted(ETableModel *etm, int row, int count, ETableSelectionModel *etsm)
-{
- e_selection_model_array_delete_rows(E_SELECTION_MODEL_ARRAY(etsm), row, count);
- free_hash(etsm);
-}
-
-#else
-
-static void
-model_rows_inserted(ETableModel *etm, int row, int count, ETableSelectionModel *etsm)
-{
- model_changed(etm, etsm);
-}
-
-static void
-model_rows_deleted(ETableModel *etm, int row, int count, ETableSelectionModel *etsm)
-{
- model_changed(etm, etsm);
-}
-#endif
-
-inline static void
-add_model(ETableSelectionModel *etsm, ETableModel *model)
-{
- etsm->model = model;
- if (model) {
- gtk_object_ref(GTK_OBJECT(model));
- etsm->model_pre_change_id = gtk_signal_connect(GTK_OBJECT(model), "model_pre_change",
- GTK_SIGNAL_FUNC(model_pre_change), etsm);
- etsm->model_changed_id = gtk_signal_connect(GTK_OBJECT(model), "model_changed",
- GTK_SIGNAL_FUNC(model_changed), etsm);
- etsm->model_row_changed_id = gtk_signal_connect(GTK_OBJECT(model), "model_row_changed",
- GTK_SIGNAL_FUNC(model_row_changed), etsm);
- etsm->model_cell_changed_id = gtk_signal_connect(GTK_OBJECT(model), "model_cell_changed",
- GTK_SIGNAL_FUNC(model_cell_changed), etsm);
- etsm->model_rows_inserted_id = gtk_signal_connect(GTK_OBJECT(model), "model_rows_inserted",
- GTK_SIGNAL_FUNC(model_rows_inserted), etsm);
- etsm->model_rows_deleted_id = gtk_signal_connect(GTK_OBJECT(model), "model_rows_deleted",
- GTK_SIGNAL_FUNC(model_rows_deleted), etsm);
- }
- e_selection_model_array_confirm_row_count(E_SELECTION_MODEL_ARRAY(etsm));
-}
-
-inline static void
-drop_model(ETableSelectionModel *etsm)
-{
- if (etsm->model) {
- gtk_signal_disconnect(GTK_OBJECT(etsm->model),
- etsm->model_pre_change_id);
- gtk_signal_disconnect(GTK_OBJECT(etsm->model),
- etsm->model_changed_id);
- gtk_signal_disconnect(GTK_OBJECT(etsm->model),
- etsm->model_row_changed_id);
- gtk_signal_disconnect(GTK_OBJECT(etsm->model),
- etsm->model_cell_changed_id);
- gtk_signal_disconnect(GTK_OBJECT(etsm->model),
- etsm->model_rows_inserted_id);
- gtk_signal_disconnect(GTK_OBJECT(etsm->model),
- etsm->model_rows_deleted_id);
-
- gtk_object_unref(GTK_OBJECT(etsm->model));
- }
- etsm->model = NULL;
-}
-
-static void
-etsm_destroy (GtkObject *object)
-{
- ETableSelectionModel *etsm;
-
- etsm = E_TABLE_SELECTION_MODEL (object);
-
- if (etsm->model_changed_idle_id) {
- g_source_remove(etsm->model_changed_idle_id);
- }
- drop_model(etsm);
- free_hash(etsm);
-
- if (GTK_OBJECT_CLASS(parent_class)->destroy)
- GTK_OBJECT_CLASS(parent_class)->destroy (object);
-}
-
-static void
-etsm_get_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- ETableSelectionModel *etsm = E_TABLE_SELECTION_MODEL (o);
-
- switch (arg_id){
- case ARG_MODEL:
- GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(etsm->model);
- break;
- case ARG_HEADER:
- GTK_VALUE_OBJECT (*arg) = (GtkObject *)etsm->eth;
- break;
- }
-}
-
-static void
-etsm_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- ETableSelectionModel *etsm = E_TABLE_SELECTION_MODEL (o);
-
- switch (arg_id){
- case ARG_MODEL:
- drop_model(etsm);
- add_model(etsm, GTK_VALUE_OBJECT (*arg) ? E_TABLE_MODEL(GTK_VALUE_OBJECT (*arg)) : NULL);
- break;
- case ARG_HEADER:
- etsm->eth = (ETableHeader *)GTK_VALUE_OBJECT (*arg);
- break;
- }
-}
-
-static void
-e_table_selection_model_init (ETableSelectionModel *selection)
-{
- selection->model = NULL;
- selection->hash = NULL;
- selection->cursor_id = NULL;
-
- selection->model_changed_idle_id = 0;
-}
-
-static void
-e_table_selection_model_class_init (ETableSelectionModelClass *klass)
-{
- GtkObjectClass *object_class;
- ESelectionModelArrayClass *esma_class;
-
- parent_class = gtk_type_class (PARENT_TYPE);
-
- object_class = GTK_OBJECT_CLASS(klass);
- esma_class = E_SELECTION_MODEL_ARRAY_CLASS(klass);
-
- object_class->destroy = etsm_destroy;
- object_class->get_arg = etsm_get_arg;
- object_class->set_arg = etsm_set_arg;
-
- esma_class->get_row_count = etsm_get_row_count;
-
- gtk_object_add_arg_type ("ETableSelectionModel::model", GTK_TYPE_OBJECT,
- GTK_ARG_READWRITE, ARG_MODEL);
- gtk_object_add_arg_type ("ETableSelectionModel::header", E_TABLE_HEADER_TYPE,
- GTK_ARG_READWRITE, ARG_HEADER);
-}
-
-E_MAKE_TYPE(e_table_selection_model, "ETableSelectionModel", ETableSelectionModel,
- e_table_selection_model_class_init, e_table_selection_model_init, PARENT_TYPE);
-
-/**
- * e_table_selection_model_new
- *
- * This routine creates a new #ETableSelectionModel.
- *
- * Returns: The new #ETableSelectionModel.
- */
-ETableSelectionModel *
-e_table_selection_model_new (void)
-{
- return gtk_type_new (e_table_selection_model_get_type ());
-}
-
-static gint
-etsm_get_row_count (ESelectionModelArray *esma)
-{
- ETableSelectionModel *etsm = E_TABLE_SELECTION_MODEL(esma);
-
- if (etsm->model)
- return e_table_model_row_count (etsm->model);
- else
- return 0;
-}
diff --git a/widgets/table/e-table-selection-model.h b/widgets/table/e-table-selection-model.h
deleted file mode 100644
index 93cd6df94e..0000000000
--- a/widgets/table/e-table-selection-model.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-selection-model.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_TABLE_SELECTION_MODEL_H_
-#define _E_TABLE_SELECTION_MODEL_H_
-
-#include <gtk/gtkobject.h>
-#include <gal/widgets/e-selection-model-array.h>
-#include <gal/e-table/e-table-model.h>
-#include <gal/e-table/e-table-header.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#define E_TABLE_SELECTION_MODEL_TYPE (e_table_selection_model_get_type ())
-#define E_TABLE_SELECTION_MODEL(o) (GTK_CHECK_CAST ((o), E_TABLE_SELECTION_MODEL_TYPE, ETableSelectionModel))
-#define E_TABLE_SELECTION_MODEL_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_SELECTION_MODEL_TYPE, ETableSelectionModelClass))
-#define E_IS_TABLE_SELECTION_MODEL(o) (GTK_CHECK_TYPE ((o), E_TABLE_SELECTION_MODEL_TYPE))
-#define E_IS_TABLE_SELECTION_MODEL_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_SELECTION_MODEL_TYPE))
-
-typedef struct {
- ESelectionModelArray base;
-
- ETableModel *model;
- ETableHeader *eth;
-
- guint model_pre_change_id;
- guint model_changed_id;
- guint model_row_changed_id;
- guint model_cell_changed_id;
- guint model_rows_inserted_id;
- guint model_rows_deleted_id;
-
- guint model_changed_idle_id;
-
- guint selection_model_changed : 1;
- guint group_info_changed : 1;
-
- GHashTable *hash;
- char *cursor_id;
-} ETableSelectionModel;
-
-typedef struct {
- ESelectionModelArrayClass parent_class;
-} ETableSelectionModelClass;
-
-GtkType e_table_selection_model_get_type (void);
-ETableSelectionModel *e_table_selection_model_new (void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* _E_TABLE_SELECTION_MODEL_H_ */
diff --git a/widgets/table/e-table-simple.c b/widgets/table/e-table-simple.c
deleted file mode 100644
index 11cfafd01f..0000000000
--- a/widgets/table/e-table-simple.c
+++ /dev/null
@@ -1,313 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-simple.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- * Miguel de Icaza <miguel.ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include "e-table-simple.h"
-
-#define PARENT_TYPE e_table_model_get_type ()
-
-static int
-simple_column_count (ETableModel *etm)
-{
- ETableSimple *simple = E_TABLE_SIMPLE(etm);
-
- if (simple->col_count)
- return simple->col_count (etm, simple->data);
- else
- return 0;
-}
-
-static int
-simple_row_count (ETableModel *etm)
-{
- ETableSimple *simple = E_TABLE_SIMPLE(etm);
-
- if (simple->row_count)
- return simple->row_count (etm, simple->data);
- else
- return 0;
-}
-
-static void
-simple_append_row (ETableModel *etm, ETableModel *source, int row)
-{
- ETableSimple *simple = E_TABLE_SIMPLE(etm);
-
- if (simple->append_row)
- simple->append_row (etm, source, row, simple->data);
-}
-
-static void *
-simple_value_at (ETableModel *etm, int col, int row)
-{
- ETableSimple *simple = E_TABLE_SIMPLE(etm);
-
- if (simple->value_at)
- return simple->value_at (etm, col, row, simple->data);
- else
- return NULL;
-}
-
-static void
-simple_set_value_at (ETableModel *etm, int col, int row, const void *val)
-{
- ETableSimple *simple = E_TABLE_SIMPLE(etm);
-
- if (simple->set_value_at)
- simple->set_value_at (etm, col, row, val, simple->data);
-}
-
-static gboolean
-simple_is_cell_editable (ETableModel *etm, int col, int row)
-{
- ETableSimple *simple = E_TABLE_SIMPLE(etm);
-
- if (simple->is_cell_editable)
- return simple->is_cell_editable (etm, col, row, simple->data);
- else
- return FALSE;
-}
-
-static gboolean
-simple_has_save_id (ETableModel *etm)
-{
- ETableSimple *simple = E_TABLE_SIMPLE(etm);
-
- if (simple->has_save_id)
- return simple->has_save_id (etm, simple->data);
- else
- return FALSE;
-}
-
-static char *
-simple_get_save_id (ETableModel *etm, int row)
-{
- ETableSimple *simple = E_TABLE_SIMPLE(etm);
-
- if (simple->get_save_id)
- return simple->get_save_id (etm, row, simple->data);
- else
- return NULL;
-}
-
-/* The default for simple_duplicate_value is to return the raw value. */
-static void *
-simple_duplicate_value (ETableModel *etm, int col, const void *value)
-{
- ETableSimple *simple = E_TABLE_SIMPLE(etm);
-
- if (simple->duplicate_value)
- return simple->duplicate_value (etm, col, value, simple->data);
- else
- return (void *)value;
-}
-
-static void
-simple_free_value (ETableModel *etm, int col, void *value)
-{
- ETableSimple *simple = E_TABLE_SIMPLE(etm);
-
- if (simple->free_value)
- simple->free_value (etm, col, value, simple->data);
-}
-
-static void *
-simple_initialize_value (ETableModel *etm, int col)
-{
- ETableSimple *simple = E_TABLE_SIMPLE(etm);
-
- if (simple->initialize_value)
- return simple->initialize_value (etm, col, simple->data);
- else
- return NULL;
-}
-
-static gboolean
-simple_value_is_empty (ETableModel *etm, int col, const void *value)
-{
- ETableSimple *simple = E_TABLE_SIMPLE(etm);
-
- if (simple->value_is_empty)
- return simple->value_is_empty (etm, col, value, simple->data);
- else
- return FALSE;
-}
-
-static char *
-simple_value_to_string (ETableModel *etm, int col, const void *value)
-{
- ETableSimple *simple = E_TABLE_SIMPLE(etm);
-
- if (simple->value_to_string)
- return simple->value_to_string (etm, col, value, simple->data);
- else
- return g_strdup ("");
-}
-
-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->append_row = simple_append_row;
-
- 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->has_save_id = simple_has_save_id;
- model_class->get_save_id = simple_get_save_id;
-
- model_class->duplicate_value = simple_duplicate_value;
- model_class->free_value = simple_free_value;
- model_class->initialize_value = simple_initialize_value;
- model_class->value_is_empty = simple_value_is_empty;
- model_class->value_to_string = simple_value_to_string;
-}
-
-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;
-}
-
-/**
- * e_table_simple_new:
- * @col_count:
- * @row_count:
- * @value_at:
- * @set_value_at:
- * @is_cell_editable:
- * @duplicate_value:
- * @free_value:
- * @initialize_value:
- * @value_is_empty:
- * @value_to_string:
- * @data: closure pointer.
- *
- * This initializes a new ETableSimpleModel object. ETableSimpleModel is
- * an implementaiton of the abstract class ETableModel. The ETableSimpleModel
- * is designed to allow people to easily create ETableModels without having
- * to create a new GtkType derived from ETableModel every time they need one.
- *
- * Instead, ETableSimpleModel uses a setup based in callback functions, every
- * callback function signature mimics the signature of each ETableModel method
- * and passes the extra @data pointer to each one of the method to provide them
- * with any context they might want to use.
- *
- * Returns: An ETableSimpleModel object (which is also an ETableModel
- * object).
- */
-ETableModel *
-e_table_simple_new (ETableSimpleColumnCountFn col_count,
- ETableSimpleRowCountFn row_count,
- ETableSimpleAppendRowFn append_row,
-
- ETableSimpleValueAtFn value_at,
- ETableSimpleSetValueAtFn set_value_at,
- ETableSimpleIsCellEditableFn is_cell_editable,
-
- ETableSimpleHasSaveIdFn has_save_id,
- ETableSimpleGetSaveIdFn get_save_id,
-
- ETableSimpleDuplicateValueFn duplicate_value,
- ETableSimpleFreeValueFn free_value,
- ETableSimpleInitializeValueFn initialize_value,
- ETableSimpleValueIsEmptyFn value_is_empty,
- ETableSimpleValueToStringFn value_to_string,
- void *data)
-{
- ETableSimple *et;
-
- et = gtk_type_new (e_table_simple_get_type ());
-
- et->col_count = col_count;
- et->row_count = row_count;
- et->append_row = append_row;
-
- et->value_at = value_at;
- et->set_value_at = set_value_at;
- et->is_cell_editable = is_cell_editable;
-
- et->has_save_id = has_save_id;
- et->get_save_id = get_save_id;
-
- et->duplicate_value = duplicate_value;
- et->free_value = free_value;
- et->initialize_value = initialize_value;
- et->value_is_empty = value_is_empty;
- et->value_to_string = value_to_string;
- et->data = data;
-
- return (ETableModel *) et;
-}
-
-void *
-e_table_simple_string_duplicate_value (ETableModel *etm, int col, const void *val, void *data)
-{
- return g_strdup (val);
-}
-
-void
-e_table_simple_string_free_value (ETableModel *etm, int col, void *val, void *data)
-{
- g_free (val);
-}
-
-void *
-e_table_simple_string_initialize_value (ETableModel *etm, int col, void *data)
-{
- return g_strdup ("");
-}
-
-gboolean
-e_table_simple_string_value_is_empty (ETableModel *etm, int col, const void *val, void *data)
-{
- return !(val && * (char *) val);
-}
-
-char *
-e_table_simple_string_value_to_string (ETableModel *etm, int col, const void *val, void *data)
-{
- return g_strdup (val);
-}
diff --git a/widgets/table/e-table-simple.h b/widgets/table/e-table-simple.h
deleted file mode 100644
index 6dfe28f573..0000000000
--- a/widgets/table/e-table-simple.h
+++ /dev/null
@@ -1,123 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-simple.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- * Miguel de Icaza <miguel@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_TABLE_SIMPLE_H_
-#define _E_TABLE_SIMPLE_H_
-
-#include <gal/e-table/e-table-model.h>
-#include <libgnome/gnome-defs.h>
-
-BEGIN_GNOME_DECLS
-
-#define E_TABLE_SIMPLE_TYPE (e_table_simple_get_type ())
-#define E_TABLE_SIMPLE(o) (GTK_CHECK_CAST ((o), E_TABLE_SIMPLE_TYPE, ETableSimple))
-#define E_TABLE_SIMPLE_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_SIMPLE_TYPE, ETableSimpleClass))
-#define E_IS_TABLE_SIMPLE(o) (GTK_CHECK_TYPE ((o), E_TABLE_SIMPLE_TYPE))
-#define E_IS_TABLE_SIMPLE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_SIMPLE_TYPE))
-
-typedef int (*ETableSimpleColumnCountFn) (ETableModel *etm, void *data);
-typedef int (*ETableSimpleRowCountFn) (ETableModel *etm, void *data);
-typedef void (*ETableSimpleAppendRowFn) (ETableModel *etm, ETableModel *model, int row, 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 gboolean (*ETableSimpleHasSaveIdFn) (ETableModel *etm, void *data);
-typedef char *(*ETableSimpleGetSaveIdFn) (ETableModel *etm, 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 *(*ETableSimpleInitializeValueFn) (ETableModel *etm, int col, void *data);
-typedef gboolean (*ETableSimpleValueIsEmptyFn) (ETableModel *etm, int col, const void *val, void *data);
-typedef char *(*ETableSimpleValueToStringFn) (ETableModel *etm, int col, const void *val, void *data);
-
-typedef struct {
- ETableModel parent;
-
- ETableSimpleColumnCountFn col_count;
- ETableSimpleRowCountFn row_count;
- ETableSimpleAppendRowFn append_row;
-
- ETableSimpleValueAtFn value_at;
- ETableSimpleSetValueAtFn set_value_at;
- ETableSimpleIsCellEditableFn is_cell_editable;
-
- ETableSimpleHasSaveIdFn has_save_id;
- ETableSimpleGetSaveIdFn get_save_id;
-
- ETableSimpleDuplicateValueFn duplicate_value;
- ETableSimpleFreeValueFn free_value;
- ETableSimpleInitializeValueFn initialize_value;
- ETableSimpleValueIsEmptyFn value_is_empty;
- ETableSimpleValueToStringFn value_to_string;
- 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,
- ETableSimpleAppendRowFn append_row,
- ETableSimpleValueAtFn value_at,
- ETableSimpleSetValueAtFn set_value_at,
- ETableSimpleIsCellEditableFn is_cell_editable,
- ETableSimpleHasSaveIdFn has_save_id,
- ETableSimpleGetSaveIdFn get_save_id,
- ETableSimpleDuplicateValueFn duplicate_value,
- ETableSimpleFreeValueFn free_value,
- ETableSimpleInitializeValueFn initialize_value,
- ETableSimpleValueIsEmptyFn value_is_empty,
- ETableSimpleValueToStringFn value_to_string,
- void *data);
-
-
-/* Helper functions for if your values are all just strings. */
-void *e_table_simple_string_duplicate_value (ETableModel *etm,
- int col,
- const void *val,
- void *data);
-void e_table_simple_string_free_value (ETableModel *etm,
- int col,
- void *val,
- void *data);
-void *e_table_simple_string_initialize_value (ETableModel *etm,
- int col,
- void *data);
-gboolean e_table_simple_string_value_is_empty (ETableModel *etm,
- int col,
- const void *val,
- void *data);
-char *e_table_simple_string_value_to_string (ETableModel *etm,
- int col,
- const void *val,
- void *data);
-
-END_GNOME_DECLS
-
-#endif /* _E_TABLE_SIMPLE_H_ */
-
diff --git a/widgets/table/e-table-size-test.c b/widgets/table/e-table-size-test.c
deleted file mode 100644
index a523bcf6d9..0000000000
--- a/widgets/table/e-table-size-test.c
+++ /dev/null
@@ -1,308 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-size-test.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <gnome.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
-#include "gal/e-util/e-cursors.h"
-#include "e-table-simple.h"
-#include "e-table-header.h"
-#include "e-table-header-item.h"
-#include "e-table-item.h"
-#include "e-cell-text.h"
-#include "e-cell-checkbox.h"
-#include "e-table.h"
-
-#include "table-test.h"
-
-/*
- * One way in which we make it simpler to build an ETableModel is through
- * the ETableSimple class. Instead of creating your own ETableModel
- * class, you simply create a new object of the ETableSimple class. You
- * give it a bunch of functions that act as callbacks.
- *
- * You also get to pass a void * to ETableSimple and it gets passed to
- * your callbacks. This would be for having multiple models of the same
- * type. This is just an example though, so we statically define all the
- * data and ignore the void *data parameter.
- *
- * In our example we will be creating a table model with 6 columns and 10
- * rows. This corresponds to having 6 different types of information and
- * 10 different sets of data in our database.
- *
- * The headers will be hard coded, as will be the example data.
- *
- */
-
-/*
- * There are two different meanings to the word "column". The first is
- * the model column. A model column corresponds to a specific type of
- * data. This is very much like the usage in a database table where a
- * column is a field in the database.
- *
- * The second type of column is a view column. A view column
- * corresponds to a visually displayed column. Each view column
- * corresponds to a specific model column, though a model column may
- * have any number of view columns associated with it, from zero to
- * greater than one.
- *
- * Also, a view column doesn't necessarily depend on only one model
- * column. In some cases, the view column renderer can be given a
- * reference to another column to get extra information about its
- * display.
-*/
-
-#define ROWS 5000
-#define COLS 4
-
-#define IMPORTANCE_COLUMN 4
-#define COLOR_COLUMN 5
-
-/*
- * Here we define the initial layout of the table. This is an xml
- * format that allows you to change the initial ordering of the
- * columns or to do sorting or grouping initially. This specification
- * shows all 5 columns, but moves the importance column nearer to the
- * front. It also sorts by the "Full Name" column (ascending.)
- * Sorting and grouping take the model column as their arguments
- * (sorting is specified by the "column" argument to the leaf elemnt.
- */
-
-#define INITIAL_SPEC "<ETableSpecification> \
- <columns-shown> \
- <column> 0 </column> \
- <column> 4 </column> \
- <column> 1 </column> \
- <column> 2 </column> \
- <column> 3 </column> \
- </columns-shown> \
- <grouping> <leaf column=\"1\" ascending=\"true\"/> </grouping> \
-</ETableSpecification>"
-
-char *headers [COLS] = {
- "Email",
- "Full Name",
- "Address",
- "Phone"
-};
-
-/*
- * Virtual Column list:
- * 0 Email
- * 1 Full Name
- * 2 Address
- * 3 Phone
- */
-
-/*
- * ETableSimple callbacks
- * These are the callbacks that define the behavior of our custom model.
- */
-
-/*
- * Since our model is a constant size, we can just return its size in
- * the column and row count fields.
- */
-
-/* This function returns the number of columns in our ETableModel. */
-static int
-my_col_count (ETableModel *etc, void *data)
-{
- return COLS;
-}
-
-/* This function returns the number of rows in our ETableModel. */
-static int
-my_row_count (ETableModel *etc, void *data)
-{
- return ROWS;
-}
-
-/* This function returns the value at a particular point in our ETableModel. */
-static void *
-my_value_at (ETableModel *etc, int col, int row, void *data)
-{
- static guchar t[] = {'A', 0xc3, 0x84, 0xc3, 0x95, 0xc3, 0x94, 0xc3, 0xb5, 0x00};
-
-#if 0
- if (col == 1) return "toshok@ximian.com";
-#else
- if (col == 1) return t;
-#endif
- else if (col == 2) return "Chris Toshok";
- else if (col == 3) return "43 Vicksburg, SF";
- else if (col == 4) return "415-867-5309";
- else return NULL;
-}
-
-/* This function sets the value at a particular point in our ETableModel. */
-static void
-my_set_value_at (ETableModel *etc, int col, int row, const void *val, void *data)
-{
-}
-
-/* This function returns whether a particular cell is editable. */
-static gboolean
-my_is_cell_editable (ETableModel *etc, int col, int row, void *data)
-{
- return FALSE;
-}
-
-/* This function duplicates the value passed to it. */
-static void *
-my_duplicate_value (ETableModel *etc, int col, const void *value, void *data)
-{
- return g_strdup (value);
-}
-
-/* This function frees the value passed to it. */
-static void
-my_free_value (ETableModel *etc, int col, void *value, void *data)
-{
- g_free (value);
-}
-
-/* This function creates an empty value. */
-static void *
-my_initialize_value (ETableModel *etc, int col, void *data)
-{
- return g_strdup ("");
-}
-
-/* This function reports if a value is empty. */
-static gboolean
-my_value_is_empty (ETableModel *etc, int col, const void *value, void *data)
-{
- return !(value && *(char *)value);
-}
-
-/* This function reports if a value is empty. */
-static char *
-my_value_to_string (ETableModel *etc, int col, const void *value, void *data)
-{
- return g_strdup(value);
-}
-
-/* We create a window containing our new table. */
-static void
-create_table (void)
-{
- GtkWidget *e_table, *window, *frame;
- ECell *cell_left_just;
- ETableHeader *e_table_header;
- ETableModel *e_table_model = NULL;
- int i;
-
- /* Next we create our model. This uses the functions we defined
- earlier. */
- e_table_model = e_table_simple_new (
- my_col_count, my_row_count, my_value_at,
- my_set_value_at, my_is_cell_editable,
- my_duplicate_value, my_free_value,
- my_initialize_value, my_value_is_empty,
- my_value_to_string,
- NULL);
- /*
- * Next we create a header. The ETableHeader is used in two
- * different way. The first is the full_header. This is the
- * list of possible columns in the view. The second use is
- * completely internal. Many of the ETableHeader functions are
- * for that purpose. The only functions we really need are
- * e_table_header_new and e_table_header_add_col.
- *
- * First we create the header.
- */
- e_table_header = e_table_header_new ();
-
- /*
- * Next we have to build renderers for all of the columns.
- * Since all our columns are text columns, we can simply use
- * the same renderer over and over again. If we had different
- * types of columns, we could use a different renderer for
- * each column.
- */
- cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT);
-
- /*
- * Next we create a column object for each view column and add
- * them to the header. We don't create a column object for
- * the importance column since it will not be shown.
- */
- for (i = 0; i < COLS; i++) {
- /* Create the column. */
- ETableCol *ecol = e_table_col_new (
- i, headers [i],
- 1.0, 20, cell_left_just,
- g_str_compare, TRUE);
- /* Add it to the header. */
- e_table_header_add_column (e_table_header, ecol, i);
- }
-
- /*
- * Here we create a window for our new table. This window
- * will get shown and the person will be able to test their
- * item.
- */
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- /* This frame is simply to get a bevel around our table. */
- frame = gtk_frame_new (NULL);
-
- /*
- * Here we create the table. We give it the three pieces of
- * the table we've created, the header, the model, and the
- * initial layout. It does the rest.
- */
- e_table = e_table_new (e_table_header, e_table_model, INITIAL_SPEC);
-
- /* Build the gtk widget hierarchy. */
- gtk_container_add (GTK_CONTAINER (frame), e_table);
- gtk_container_add (GTK_CONTAINER (window), frame);
-
- /* Size the initial window. */
- gtk_widget_set_usize (window, 300, 200);
-
- /* Show it all. */
- gtk_widget_show_all (window);
-}
-
-/* This is the main function which just initializes gnome and call our create_table function */
-
-int
-main (int argc, char *argv [])
-{
- gnome_init ("TableExample", "TableExample", argc, argv);
- e_cursors_init ();
-
- gtk_widget_push_visual (gdk_rgb_get_visual ());
- gtk_widget_push_colormap (gdk_rgb_get_cmap ());
-
- create_table ();
-
- gtk_main ();
-
- e_cursors_shutdown ();
- return 0;
-}
-
diff --git a/widgets/table/e-table-sort-info.c b/widgets/table/e-table-sort-info.c
deleted file mode 100644
index b57d0fc275..0000000000
--- a/widgets/table/e-table-sort-info.c
+++ /dev/null
@@ -1,488 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-sort-info.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-
-#include "e-table-sort-info.h"
-
-#include <gtk/gtksignal.h>
-#include "gal/util/e-util.h"
-#include "gal/util/e-xml-utils.h"
-#include <string.h>
-
-#define ETM_CLASS(e) ((ETableSortInfoClass *)((GtkObject *)e)->klass)
-
-#define PARENT_TYPE gtk_object_get_type ()
-
-
-static GtkObjectClass *e_table_sort_info_parent_class;
-
-enum {
- SORT_INFO_CHANGED,
- GROUP_INFO_CHANGED,
- LAST_SIGNAL
-};
-
-static guint e_table_sort_info_signals [LAST_SIGNAL] = { 0, };
-
-static void
-etsi_destroy (GtkObject *object)
-{
- ETableSortInfo *etsi;
-
- etsi = E_TABLE_SORT_INFO (object);
-
- if (etsi->groupings)
- g_free(etsi->groupings);
- if (etsi->sortings)
- g_free(etsi->sortings);
-
- GTK_OBJECT_CLASS (e_table_sort_info_parent_class)->destroy (object);
-}
-
-static void
-e_table_sort_info_init (ETableSortInfo *info)
-{
- GTK_OBJECT_UNSET_FLAGS (GTK_OBJECT (info), GTK_FLOATING);
-
- info->group_count = 0;
- info->groupings = NULL;
- info->sort_count = 0;
- info->sortings = NULL;
- info->frozen = 0;
- info->sort_info_changed = 0;
- info->group_info_changed = 0;
- info->can_group = 1;
-}
-
-static void
-e_table_sort_info_class_init (ETableSortInfoClass *klass)
-{
- GtkObjectClass *object_class;
-
- e_table_sort_info_parent_class = gtk_type_class (gtk_object_get_type ());
-
- object_class = GTK_OBJECT_CLASS(klass);
-
- object_class->destroy = etsi_destroy;
-
- e_table_sort_info_signals [SORT_INFO_CHANGED] =
- gtk_signal_new ("sort_info_changed",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETableSortInfoClass, sort_info_changed),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- e_table_sort_info_signals [GROUP_INFO_CHANGED] =
- gtk_signal_new ("group_info_changed",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETableSortInfoClass, group_info_changed),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- klass->sort_info_changed = NULL;
- klass->group_info_changed = NULL;
-
- E_OBJECT_CLASS_ADD_SIGNALS (object_class, e_table_sort_info_signals, LAST_SIGNAL);
-}
-
-E_MAKE_TYPE(e_table_sort_info, "ETableSortInfo", ETableSortInfo,
- e_table_sort_info_class_init, e_table_sort_info_init, PARENT_TYPE);
-
-static void
-e_table_sort_info_sort_info_changed (ETableSortInfo *info)
-{
- g_return_if_fail (info != NULL);
- g_return_if_fail (E_IS_TABLE_SORT_INFO (info));
-
- if (info->frozen) {
- info->sort_info_changed = 1;
- } else {
- gtk_signal_emit (GTK_OBJECT (info),
- e_table_sort_info_signals [SORT_INFO_CHANGED]);
- }
-}
-
-static void
-e_table_sort_info_group_info_changed (ETableSortInfo *info)
-{
- g_return_if_fail (info != NULL);
- g_return_if_fail (E_IS_TABLE_SORT_INFO (info));
-
- if (info->frozen) {
- info->group_info_changed = 1;
- } else {
- gtk_signal_emit (GTK_OBJECT (info),
- e_table_sort_info_signals [GROUP_INFO_CHANGED]);
- }
-}
-
-/**
- * e_table_sort_info_freeze:
- * @info: The ETableSortInfo object
- *
- * This functions allows the programmer to cluster various changes to the
- * ETableSortInfo (grouping and sorting) without having the object emit
- * "group_info_changed" or "sort_info_changed" signals on each change.
- *
- * To thaw, invoke the e_table_sort_info_thaw() function, which will
- * trigger any signals that might have been queued.
- */
-void
-e_table_sort_info_freeze (ETableSortInfo *info)
-{
- info->frozen++;
-}
-
-/**
- * e_table_sort_info_thaw:
- * @info: The ETableSortInfo object
- *
- * This functions allows the programmer to cluster various changes to the
- * ETableSortInfo (grouping and sorting) without having the object emit
- * "group_info_changed" or "sort_info_changed" signals on each change.
- *
- * This function will flush any pending signals that might be emited by
- * this object.
- */
-void
-e_table_sort_info_thaw (ETableSortInfo *info)
-{
- info->frozen--;
- if (info->frozen != 0)
- return;
-
- if (info->sort_info_changed) {
- info->sort_info_changed = 0;
- e_table_sort_info_sort_info_changed(info);
- }
- if (info->group_info_changed) {
- info->group_info_changed = 0;
- e_table_sort_info_group_info_changed(info);
- }
-}
-
-/**
- * e_table_sort_info_grouping_get_count:
- * @info: The ETableSortInfo object
- *
- * Returns: the number of grouping criteria in the object.
- */
-guint
-e_table_sort_info_grouping_get_count (ETableSortInfo *info)
-{
- if (info->can_group)
- return info->group_count;
- else
- return 0;
-}
-
-static void
-e_table_sort_info_grouping_real_truncate (ETableSortInfo *info, int length)
-{
- if (length < info->group_count) {
- info->group_count = length;
- }
- if (length > info->group_count) {
- info->groupings = g_realloc(info->groupings, length * sizeof(ETableSortColumn));
- info->group_count = length;
- }
-}
-
-/**
- * e_table_sort_info_grouping_truncate:
- * @info: The ETableSortInfo object
- * @lenght: position where the truncation happens.
- *
- * This routine can be used to reduce or grow the number of grouping
- * criteria in the object.
- */
-void
-e_table_sort_info_grouping_truncate (ETableSortInfo *info, int length)
-{
- e_table_sort_info_grouping_real_truncate(info, length);
- e_table_sort_info_group_info_changed(info);
-}
-
-/**
- * e_table_sort_info_grouping_get_nth:
- * @info: The ETableSortInfo object
- * @n: Item information to fetch.
- *
- * Returns: the description of the @n-th grouping criteria in the @info object.
- */
-ETableSortColumn
-e_table_sort_info_grouping_get_nth (ETableSortInfo *info, int n)
-{
- if (info->can_group && n < info->group_count) {
- return info->groupings[n];
- } else {
- ETableSortColumn fake = {0, 0};
- return fake;
- }
-}
-
-/**
- * e_table_sort_info_grouping_set_nth:
- * @info: The ETableSortInfo object
- * @n: Item information to fetch.
- * @column: new values for the grouping
- *
- * Sets the grouping criteria for index @n to be given by @column (a column number and
- * whether it is ascending or descending).
- */
-void
-e_table_sort_info_grouping_set_nth (ETableSortInfo *info, int n, ETableSortColumn column)
-{
- if (n >= info->group_count) {
- e_table_sort_info_grouping_real_truncate(info, n + 1);
- }
- info->groupings[n] = column;
- e_table_sort_info_group_info_changed(info);
-}
-
-
-/**
- * e_table_sort_info_get_count:
- * @info: The ETableSortInfo object
- *
- * Returns: the number of sorting criteria in the object.
- */
-guint
-e_table_sort_info_sorting_get_count (ETableSortInfo *info)
-{
- return info->sort_count;
-}
-
-static void
-e_table_sort_info_sorting_real_truncate (ETableSortInfo *info, int length)
-{
- if (length < info->sort_count) {
- info->sort_count = length;
- }
- if (length > info->sort_count) {
- info->sortings = g_realloc(info->sortings, length * sizeof(ETableSortColumn));
- info->sort_count = length;
- }
-}
-
-/**
- * e_table_sort_info_sorting_truncate:
- * @info: The ETableSortInfo object
- * @lenght: position where the truncation happens.
- *
- * This routine can be used to reduce or grow the number of sort
- * criteria in the object.
- */
-void
-e_table_sort_info_sorting_truncate (ETableSortInfo *info, int length)
-{
- e_table_sort_info_sorting_real_truncate (info, length);
- e_table_sort_info_sort_info_changed(info);
-}
-
-/**
- * e_table_sort_info_sorting_get_nth:
- * @info: The ETableSortInfo object
- * @n: Item information to fetch.
- *
- * Returns: the description of the @n-th grouping criteria in the @info object.
- */
-ETableSortColumn
-e_table_sort_info_sorting_get_nth (ETableSortInfo *info, int n)
-{
- if (n < info->sort_count) {
- return info->sortings[n];
- } else {
- ETableSortColumn fake = {0, 0};
- return fake;
- }
-}
-
-/**
- * e_table_sort_info_sorting_get_nth:
- * @info: The ETableSortInfo object
- * @n: Item information to fetch.
- * @column: new values for the sorting
- *
- * Sets the sorting criteria for index @n to be given by @column (a
- * column number and whether it is ascending or descending).
- */
-void
-e_table_sort_info_sorting_set_nth (ETableSortInfo *info, int n, ETableSortColumn column)
-{
- if (n >= info->sort_count) {
- e_table_sort_info_sorting_real_truncate(info, n + 1);
- }
- info->sortings[n] = column;
- e_table_sort_info_sort_info_changed(info);
-}
-
-/**
- * e_table_sort_info_new:
- *
- * This creates a new e_table_sort_info object that contains no
- * grouping and no sorting defined as of yet. This object is used
- * to keep track of multi-level sorting and multi-level grouping of
- * the ETable.
- *
- * Returns: A new %ETableSortInfo object
- */
-ETableSortInfo *
-e_table_sort_info_new (void)
-{
- return gtk_type_new (e_table_sort_info_get_type ());
-}
-
-/**
- * e_table_sort_info_load_from_node:
- * @info: The ETableSortInfo object
- * @node: pointer to the xmlNode that describes the sorting and grouping information
- * @state_version:
- *
- * This loads the state for the %ETableSortInfo object @info from the
- * xml node @node.
- */
-void
-e_table_sort_info_load_from_node (ETableSortInfo *info,
- xmlNode *node,
- gdouble state_version)
-{
- int i;
- xmlNode *grouping;
-
- if (state_version <= 0.05) {
- i = 0;
- for (grouping = node->xmlChildrenNode; grouping && !strcmp (grouping->name, "group"); grouping = grouping->xmlChildrenNode) {
- ETableSortColumn column;
- column.column = e_xml_get_integer_prop_by_name (grouping, "column");
- column.ascending = e_xml_get_bool_prop_by_name (grouping, "ascending");
- e_table_sort_info_grouping_set_nth(info, i++, column);
- }
- i = 0;
- for (; grouping && !strcmp (grouping->name, "leaf"); grouping = grouping->xmlChildrenNode) {
- ETableSortColumn column;
- column.column = e_xml_get_integer_prop_by_name (grouping, "column");
- column.ascending = e_xml_get_bool_prop_by_name (grouping, "ascending");
- e_table_sort_info_sorting_set_nth(info, i++, column);
- }
- } else {
- i = 0;
- for (grouping = node->xmlChildrenNode; grouping && !strcmp (grouping->name, "group"); grouping = grouping->next) {
- ETableSortColumn column;
- column.column = e_xml_get_integer_prop_by_name (grouping, "column");
- column.ascending = e_xml_get_bool_prop_by_name (grouping, "ascending");
- e_table_sort_info_grouping_set_nth(info, i++, column);
- }
- i = 0;
- for (; grouping && !strcmp (grouping->name, "leaf"); grouping = grouping->next) {
- ETableSortColumn column;
- column.column = e_xml_get_integer_prop_by_name (grouping, "column");
- column.ascending = e_xml_get_bool_prop_by_name (grouping, "ascending");
- e_table_sort_info_sorting_set_nth(info, i++, column);
- }
- }
- gtk_signal_emit (GTK_OBJECT (info),
- e_table_sort_info_signals [SORT_INFO_CHANGED]);
-
-}
-
-/**
- * e_table_sort_info_save_to_node:
- * @info: The ETableSortInfo object
- * @parent: xmlNode that will be hosting the saved state of the @info object.
- *
- * This function is used
- *
- * Returns: the node that has been appended to @parent as a child containing
- * the sorting and grouping information for this ETableSortInfo object.
- */
-xmlNode *
-e_table_sort_info_save_to_node (ETableSortInfo *info,
- xmlNode *parent)
-{
- xmlNode *grouping;
- xmlNode *node;
- int i;
- const int sort_count = e_table_sort_info_sorting_get_count (info);
- const int group_count = e_table_sort_info_grouping_get_count (info);
-
- grouping = xmlNewChild (parent, NULL, "grouping", NULL);
-
- for (i = 0; i < group_count; i++) {
- ETableSortColumn column = e_table_sort_info_grouping_get_nth(info, i);
- xmlNode *new_node = xmlNewChild(grouping, NULL, "group", NULL);
-
- e_xml_set_integer_prop_by_name (new_node, "column", column.column);
- e_xml_set_bool_prop_by_name (new_node, "ascending", column.ascending);
- node = new_node;
- }
-
- for (i = 0; i < sort_count; i++) {
- ETableSortColumn column = e_table_sort_info_sorting_get_nth(info, i);
- xmlNode *new_node = xmlNewChild(grouping, NULL, "leaf", NULL);
-
- e_xml_set_integer_prop_by_name (new_node, "column", column.column);
- e_xml_set_bool_prop_by_name (new_node, "ascending", column.ascending);
- node = new_node;
- }
-
- return grouping;
-}
-
-ETableSortInfo *
-e_table_sort_info_duplicate (ETableSortInfo *info)
-{
- ETableSortInfo *new_info;
-
- new_info = e_table_sort_info_new();
-
- new_info->group_count = info->group_count;
- new_info->groupings = g_new(ETableSortColumn, new_info->group_count);
- memmove(new_info->groupings, info->groupings, sizeof (ETableSortColumn) * new_info->group_count);
-
- new_info->sort_count = info->sort_count;
- new_info->sortings = g_new(ETableSortColumn, new_info->sort_count);
- memmove(new_info->sortings, info->sortings, sizeof (ETableSortColumn) * new_info->sort_count);
-
- new_info->can_group = info->can_group;
-
- return new_info;
-}
-
-void
-e_table_sort_info_set_can_group (ETableSortInfo *info,
- gboolean can_group)
-{
- info->can_group = can_group;
-}
-
-gboolean
-e_table_sort_info_get_can_group (ETableSortInfo *info)
-{
- return info->can_group;
-}
-
-
diff --git a/widgets/table/e-table-sort-info.h b/widgets/table/e-table-sort-info.h
deleted file mode 100644
index e7f7bea5cb..0000000000
--- a/widgets/table/e-table-sort-info.h
+++ /dev/null
@@ -1,110 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-sort-info.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_TABLE_SORT_INFO_H_
-#define _E_TABLE_SORT_INFO_H_
-
-#include <gtk/gtkobject.h>
-#include <gnome-xml/tree.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#define E_TABLE_SORT_INFO_TYPE (e_table_sort_info_get_type ())
-#define E_TABLE_SORT_INFO(o) (GTK_CHECK_CAST ((o), E_TABLE_SORT_INFO_TYPE, ETableSortInfo))
-#define E_TABLE_SORT_INFO_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_SORT_INFO_TYPE, ETableSortInfoClass))
-#define E_IS_TABLE_SORT_INFO(o) (GTK_CHECK_TYPE ((o), E_TABLE_SORT_INFO_TYPE))
-#define E_IS_TABLE_SORT_INFO_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_SORT_INFO_TYPE))
-
-typedef struct _ETableSortColumn ETableSortColumn;
-
-struct _ETableSortColumn {
- guint column : 31;
- guint ascending : 1;
-};
-
-typedef struct {
- GtkObject base;
-
- gint group_count;
- ETableSortColumn *groupings;
- gint sort_count;
- ETableSortColumn *sortings;
-
- guint frozen : 1;
- guint sort_info_changed : 1;
- guint group_info_changed : 1;
-
- guint can_group : 1;
-} ETableSortInfo;
-
-typedef struct {
- GtkObjectClass parent_class;
-
- /*
- * Signals
- */
- void (*sort_info_changed) (ETableSortInfo *info);
- void (*group_info_changed) (ETableSortInfo *info);
-} ETableSortInfoClass;
-
-GtkType e_table_sort_info_get_type (void);
-
-void e_table_sort_info_freeze (ETableSortInfo *info);
-void e_table_sort_info_thaw (ETableSortInfo *info);
-
-guint e_table_sort_info_grouping_get_count (ETableSortInfo *info);
-void e_table_sort_info_grouping_truncate (ETableSortInfo *info,
- int length);
-ETableSortColumn e_table_sort_info_grouping_get_nth (ETableSortInfo *info,
- int n);
-void e_table_sort_info_grouping_set_nth (ETableSortInfo *info,
- int n,
- ETableSortColumn column);
-
-guint e_table_sort_info_sorting_get_count (ETableSortInfo *info);
-void e_table_sort_info_sorting_truncate (ETableSortInfo *info,
- int length);
-ETableSortColumn e_table_sort_info_sorting_get_nth (ETableSortInfo *info,
- int n);
-void e_table_sort_info_sorting_set_nth (ETableSortInfo *info,
- int n,
- ETableSortColumn column);
-
-ETableSortInfo *e_table_sort_info_new (void);
-void e_table_sort_info_load_from_node (ETableSortInfo *info,
- xmlNode *node,
- gdouble state_version);
-xmlNode *e_table_sort_info_save_to_node (ETableSortInfo *info,
- xmlNode *parent);
-ETableSortInfo *e_table_sort_info_duplicate (ETableSortInfo *info);
-void e_table_sort_info_set_can_group (ETableSortInfo *info,
- gboolean can_group);
-gboolean e_table_sort_info_get_can_group (ETableSortInfo *info);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _E_TABLE_SORT_INFO_H_ */
diff --git a/widgets/table/e-table-sorted-variable.c b/widgets/table/e-table-sorted-variable.c
deleted file mode 100644
index 520e7c3c69..0000000000
--- a/widgets/table/e-table-sorted-variable.c
+++ /dev/null
@@ -1,224 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-sorted-variable.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <stdlib.h>
-#include <gtk/gtksignal.h>
-#include <string.h>
-#include "gal/util/e-util.h"
-#include "e-table-sorted-variable.h"
-#include "e-table-sorting-utils.h"
-
-#define d(x)
-
-#define PARENT_TYPE E_TABLE_SUBSET_VARIABLE_TYPE
-
-#define INCREMENT_AMOUNT 100
-
-/* maximum insertions between an idle event that we will do without scheduling an idle sort */
-#define ETSV_INSERT_MAX (4)
-
-static ETableSubsetVariableClass *etsv_parent_class;
-
-static void etsv_sort_info_changed (ETableSortInfo *info, ETableSortedVariable *etsv);
-static void etsv_sort (ETableSortedVariable *etsv);
-static void etsv_add (ETableSubsetVariable *etssv, gint row);
-static void etsv_add_all (ETableSubsetVariable *etssv);
-
-static void
-etsv_destroy (GtkObject *object)
-{
- ETableSortedVariable *etsv = E_TABLE_SORTED_VARIABLE (object);
-
- gtk_signal_disconnect (GTK_OBJECT (etsv->sort_info),
- etsv->sort_info_changed_id);
-
- if (etsv->sort_idle_id) {
- g_source_remove(etsv->sort_idle_id);
- }
- if (etsv->insert_idle_id) {
- g_source_remove(etsv->insert_idle_id);
- }
-
- if (etsv->sort_info)
- gtk_object_unref(GTK_OBJECT(etsv->sort_info));
- if (etsv->full_header)
- gtk_object_unref(GTK_OBJECT(etsv->full_header));
-
- 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;
- etssv_class->add_all = etsv_add_all;
-}
-
-static void
-etsv_init (ETableSortedVariable *etsv)
-{
- etsv->full_header = NULL;
- etsv->sort_info = NULL;
-
- etsv->sort_info_changed_id = 0;
-
- etsv->sort_idle_id = 0;
- etsv->insert_count = 0;
-}
-
-E_MAKE_TYPE(e_table_sorted_variable, "ETableSortedVariable", ETableSortedVariable, etsv_class_init, etsv_init, PARENT_TYPE);
-
-static gboolean
-etsv_sort_idle(ETableSortedVariable *etsv)
-{
- gtk_object_ref(GTK_OBJECT(etsv));
- etsv_sort(etsv);
- etsv->sort_idle_id = 0;
- etsv->insert_count = 0;
- gtk_object_unref(GTK_OBJECT(etsv));
- return FALSE;
-}
-
-static gboolean
-etsv_insert_idle(ETableSortedVariable *etsv)
-{
- etsv->insert_count = 0;
- etsv->insert_idle_id = 0;
- return FALSE;
-}
-
-
-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;
-
- if (etss->n_map + 1 > etssv->n_vals_allocated) {
- etssv->n_vals_allocated += INCREMENT_AMOUNT;
- etss->map_table = g_realloc (etss->map_table, (etssv->n_vals_allocated) * sizeof(int));
- }
- i = etss->n_map;
- if (etsv->sort_idle_id == 0) {
- /* this is to see if we're inserting a lot of things between idle loops.
- If we are, we're busy, its faster to just append and perform a full sort later */
- etsv->insert_count++;
- if (etsv->insert_count > ETSV_INSERT_MAX) {
- /* schedule a sort, and append instead */
- etsv->sort_idle_id = g_idle_add_full(50, (GSourceFunc) etsv_sort_idle, etsv, NULL);
- } else {
- /* make sure we have an idle handler to reset the count every now and then */
- if (etsv->insert_idle_id == 0) {
- etsv->insert_idle_id = g_idle_add_full(40, (GSourceFunc) etsv_insert_idle, etsv, NULL);
- }
- i = e_table_sorting_utils_insert(etss->source, etsv->sort_info, etsv->full_header, etss->map_table, etss->n_map, row);
- memmove(etss->map_table + i + 1, etss->map_table + i, (etss->n_map - i) * sizeof(int));
- }
- }
- etss->map_table[i] = row;
- etss->n_map++;
-
- e_table_model_row_inserted (etm, i);
-}
-
-static void
-etsv_add_all (ETableSubsetVariable *etssv)
-{
- ETableModel *etm = E_TABLE_MODEL(etssv);
- ETableSubset *etss = E_TABLE_SUBSET(etssv);
- ETableSortedVariable *etsv = E_TABLE_SORTED_VARIABLE (etssv);
- int rows;
- int i;
-
- e_table_model_pre_change(etm);
-
- rows = e_table_model_row_count(etss->source);
-
- if (etss->n_map + rows > etssv->n_vals_allocated){
- etssv->n_vals_allocated += MAX(INCREMENT_AMOUNT, rows);
- etss->map_table = g_realloc (etss->map_table, etssv->n_vals_allocated * sizeof(int));
- }
- for (i = 0; i < rows; i++)
- etss->map_table[etss->n_map++] = i;
-
- if (etsv->sort_idle_id == 0) {
- etsv->sort_idle_id = g_idle_add_full(50, (GSourceFunc) etsv_sort_idle, etsv, NULL);
- }
-
- e_table_model_changed (etm);
-}
-
-ETableModel *
-e_table_sorted_variable_new (ETableModel *source, ETableHeader *full_header, ETableSortInfo *sort_info)
-{
- 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_unref (GTK_OBJECT (etsv));
- return NULL;
- }
-
- etsv->sort_info = sort_info;
- gtk_object_ref(GTK_OBJECT(etsv->sort_info));
- etsv->full_header = full_header;
- gtk_object_ref(GTK_OBJECT(etsv->full_header));
-
- etsv->sort_info_changed_id = gtk_signal_connect (GTK_OBJECT (sort_info), "sort_info_changed",
- GTK_SIGNAL_FUNC (etsv_sort_info_changed), etsv);
-
- return E_TABLE_MODEL(etsv);
-}
-
-static void
-etsv_sort_info_changed (ETableSortInfo *info, ETableSortedVariable *etsv)
-{
- etsv_sort(etsv);
-}
-
-static void
-etsv_sort(ETableSortedVariable *etsv)
-{
- ETableSubset *etss = E_TABLE_SUBSET(etsv);
- static int reentering = 0;
- if (reentering)
- return;
- reentering = 1;
-
- e_table_model_pre_change(E_TABLE_MODEL(etsv));
-
- e_table_sorting_utils_sort(etss->source, etsv->sort_info, etsv->full_header, etss->map_table, etss->n_map);
-
- e_table_model_changed (E_TABLE_MODEL(etsv));
- reentering = 0;
-}
diff --git a/widgets/table/e-table-sorted-variable.h b/widgets/table/e-table-sorted-variable.h
deleted file mode 100644
index 02b342d3a4..0000000000
--- a/widgets/table/e-table-sorted-variable.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-sorted-variable.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_TABLE_SORTED_VARIABLE_H_
-#define _E_TABLE_SORTED_VARIABLE_H_
-
-#include <gtk/gtkobject.h>
-#include <gal/e-table/e-table-model.h>
-#include <gal/e-table/e-table-subset-variable.h>
-#include <gal/e-table/e-table-sort-info.h>
-#include <gal/e-table/e-table-header.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#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;
-
- ETableSortInfo *sort_info;
-
- ETableHeader *full_header;
-
- int sort_info_changed_id;
- int sort_idle_id;
- int insert_idle_id;
- int insert_count;
-
-} ETableSortedVariable;
-
-typedef struct {
- ETableSubsetVariableClass parent_class;
-} ETableSortedVariableClass;
-
-GtkType e_table_sorted_variable_get_type (void);
-ETableModel *e_table_sorted_variable_new (ETableModel *etm, ETableHeader *header, ETableSortInfo *sort_info);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#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 ae42022162..0000000000
--- a/widgets/table/e-table-sorted.c
+++ /dev/null
@@ -1,310 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-sorted.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <stdlib.h>
-#include <gtk/gtksignal.h>
-#include <string.h>
-#include "gal/util/e-util.h"
-#include "e-table-sorted.h"
-#include "e-table-sorting-utils.h"
-
-#define d(x)
-
-#define PARENT_TYPE E_TABLE_SUBSET_TYPE
-
-#define INCREMENT_AMOUNT 100
-
-/* maximum insertions between an idle event that we will do without scheduling an idle sort */
-#define ETS_INSERT_MAX (4)
-
-static ETableSubsetClass *ets_parent_class;
-
-static void ets_sort_info_changed (ETableSortInfo *info, ETableSorted *ets);
-static void ets_sort (ETableSorted *ets);
-static void ets_proxy_model_changed (ETableSubset *etss, ETableModel *source);
-static void ets_proxy_model_row_changed (ETableSubset *etss, ETableModel *source, int row);
-static void ets_proxy_model_cell_changed (ETableSubset *etss, ETableModel *source, int col, int row);
-static void ets_proxy_model_rows_inserted (ETableSubset *etss, ETableModel *source, int row, int count);
-static void ets_proxy_model_rows_deleted (ETableSubset *etss, ETableModel *source, int row, int count);
-
-static void
-ets_destroy (GtkObject *object)
-{
- ETableSorted *ets = E_TABLE_SORTED (object);
-
- if (ets->sort_idle_id) {
- g_source_remove(ets->sort_idle_id);
- }
- if (ets->insert_idle_id) {
- g_source_remove(ets->insert_idle_id);
- }
-
- if (ets->sort_info) {
- gtk_signal_disconnect (GTK_OBJECT (ets->sort_info),
- ets->sort_info_changed_id);
- gtk_object_unref(GTK_OBJECT(ets->sort_info));
- }
-
- if (ets->full_header)
- gtk_object_unref(GTK_OBJECT(ets->full_header));
-
- GTK_OBJECT_CLASS (ets_parent_class)->destroy (object);
-}
-
-static void
-ets_class_init (GtkObjectClass *object_class)
-{
- ETableSubsetClass *etss_class = E_TABLE_SUBSET_CLASS(object_class);
-
- ets_parent_class = gtk_type_class (PARENT_TYPE);
-
- etss_class->proxy_model_changed = ets_proxy_model_changed;
- etss_class->proxy_model_row_changed = ets_proxy_model_row_changed;
- etss_class->proxy_model_cell_changed = ets_proxy_model_cell_changed;
- etss_class->proxy_model_rows_inserted = ets_proxy_model_rows_inserted;
- etss_class->proxy_model_rows_deleted = ets_proxy_model_rows_deleted;
-
- object_class->destroy = ets_destroy;
-}
-
-static void
-ets_init (ETableSorted *ets)
-{
- ets->full_header = NULL;
- ets->sort_info = NULL;
-
- ets->sort_info_changed_id = 0;
-
- ets->sort_idle_id = 0;
- ets->insert_count = 0;
-}
-
-E_MAKE_TYPE(e_table_sorted, "ETableSorted", ETableSorted, ets_class_init, ets_init, PARENT_TYPE);
-
-static gboolean
-ets_sort_idle(ETableSorted *ets)
-{
- gtk_object_ref(GTK_OBJECT(ets));
- ets_sort(ets);
- ets->sort_idle_id = 0;
- ets->insert_count = 0;
- gtk_object_unref(GTK_OBJECT(ets));
- return FALSE;
-}
-
-static gboolean
-ets_insert_idle(ETableSorted *ets)
-{
- ets->insert_count = 0;
- ets->insert_idle_id = 0;
- return FALSE;
-}
-
-ETableModel *
-e_table_sorted_new (ETableModel *source, ETableHeader *full_header, ETableSortInfo *sort_info)
-{
- ETableSorted *ets = gtk_type_new (E_TABLE_SORTED_TYPE);
- ETableSubset *etss = E_TABLE_SUBSET (ets);
-
- if (ets_parent_class->proxy_model_pre_change)
- (ets_parent_class->proxy_model_pre_change) (etss, source);
-
- if (e_table_subset_construct (etss, source, 0) == NULL){
- gtk_object_unref (GTK_OBJECT (ets));
- return NULL;
- }
-
- ets->sort_info = sort_info;
- gtk_object_ref(GTK_OBJECT(ets->sort_info));
- ets->full_header = full_header;
- gtk_object_ref(GTK_OBJECT(ets->full_header));
-
- ets_proxy_model_changed(etss, source);
-
- ets->sort_info_changed_id = gtk_signal_connect (GTK_OBJECT (sort_info), "sort_info_changed",
- GTK_SIGNAL_FUNC (ets_sort_info_changed), ets);
-
- return E_TABLE_MODEL(ets);
-}
-
-static void
-ets_sort_info_changed (ETableSortInfo *info, ETableSorted *ets)
-{
- ets_sort(ets);
-}
-
-static void
-ets_proxy_model_changed (ETableSubset *subset, ETableModel *source)
-{
- int rows, i;
-
- rows = e_table_model_row_count(source);
-
- g_free(subset->map_table);
- subset->n_map = rows;
- subset->map_table = g_new(int, rows);
-
- for (i = 0; i < rows; i++) {
- subset->map_table[i] = i;
- }
-
- if (!E_TABLE_SORTED(subset)->sort_idle_id)
- E_TABLE_SORTED(subset)->sort_idle_id = g_idle_add_full(50, (GSourceFunc) ets_sort_idle, subset, NULL);
-
- e_table_model_changed(E_TABLE_MODEL(subset));
-}
-
-static void
-ets_proxy_model_row_changed (ETableSubset *subset, ETableModel *source, int row)
-{
- if (!E_TABLE_SORTED(subset)->sort_idle_id)
- E_TABLE_SORTED(subset)->sort_idle_id = g_idle_add_full(50, (GSourceFunc) ets_sort_idle, subset, NULL);
-
- if (ets_parent_class->proxy_model_row_changed)
- (ets_parent_class->proxy_model_row_changed) (subset, source, row);
-}
-
-static void
-ets_proxy_model_cell_changed (ETableSubset *subset, ETableModel *source, int col, int row)
-{
- ETableSorted *ets = E_TABLE_SORTED(subset);
- if (e_table_sorting_utils_affects_sort(ets->sort_info, ets->full_header, col))
- ets_proxy_model_row_changed(subset, source, row);
- else if (ets_parent_class->proxy_model_cell_changed)
- (ets_parent_class->proxy_model_cell_changed) (subset, source, col, row);
-}
-
-static void
-ets_proxy_model_rows_inserted (ETableSubset *etss, ETableModel *source, int row, int count)
-{
- ETableModel *etm = E_TABLE_MODEL(etss);
- ETableSorted *ets = E_TABLE_SORTED(etss);
- int i;
- gboolean full_change = FALSE;
-
- if (count == 0) {
- e_table_model_no_change (etm);
- return;
- }
-
- if (row != etss->n_map) {
- full_change = TRUE;
- for (i = 0; i < etss->n_map; i++) {
- if (etss->map_table[i] >= row) {
- etss->map_table[i] += count;
- }
- }
- }
-
- etss->map_table = g_realloc (etss->map_table, (etss->n_map + count) * sizeof(int));
-
- for (; count > 0; count --) {
- if (!full_change)
- e_table_model_pre_change (etm);
- i = etss->n_map;
- if (ets->sort_idle_id == 0) {
- /* this is to see if we're inserting a lot of things between idle loops.
- If we are, we're busy, its faster to just append and perform a full sort later */
- ets->insert_count++;
- if (ets->insert_count > ETS_INSERT_MAX) {
- /* schedule a sort, and append instead */
- ets->sort_idle_id = g_idle_add_full(50, (GSourceFunc) ets_sort_idle, ets, NULL);
- } else {
- /* make sure we have an idle handler to reset the count every now and then */
- if (ets->insert_idle_id == 0) {
- ets->insert_idle_id = g_idle_add_full(40, (GSourceFunc) ets_insert_idle, ets, NULL);
- }
- i = e_table_sorting_utils_insert(etss->source, ets->sort_info, ets->full_header, etss->map_table, etss->n_map, row);
- 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 (!full_change) {
- e_table_model_row_inserted (etm, i);
- }
-
- d(g_print("inserted row %d", row));
- row++;
- }
- if (full_change)
- e_table_model_changed (etm);
- else
- e_table_model_no_change (etm);
- d(e_table_subset_print_debugging(etss));
-}
-
-static void
-ets_proxy_model_rows_deleted (ETableSubset *etss, ETableModel *source, int row, int count)
-{
- ETableModel *etm = E_TABLE_MODEL(etss);
- int i;
- gboolean shift;
- int j;
-
- shift = row == etss->n_map - count;
-
- for (j = 0; j < count; j++) {
- for (i = 0; i < etss->n_map; i++){
- if (etss->map_table[i] == row + j) {
- if (shift)
- e_table_model_pre_change (etm);
- memmove (etss->map_table + i, etss->map_table + i + 1, (etss->n_map - i - 1) * sizeof(int));
- etss->n_map --;
- if (shift)
- e_table_model_row_deleted (etm, i);
- }
- }
- }
- if (!shift) {
- for (i = 0; i < etss->n_map; i++) {
- if (etss->map_table[i] >= row)
- etss->map_table[i] -= count;
- }
-
- e_table_model_changed (etm);
- } else {
- e_table_model_no_change (etm);
- }
-
- d(g_print("deleted row %d count %d", row, count));
- d(e_table_subset_print_debugging(etss));
-}
-
-static void
-ets_sort(ETableSorted *ets)
-{
- ETableSubset *etss = E_TABLE_SUBSET(ets);
- static int reentering = 0;
- if (reentering)
- return;
- reentering = 1;
-
- e_table_model_pre_change(E_TABLE_MODEL(ets));
-
- e_table_sorting_utils_sort(etss->source, ets->sort_info, ets->full_header, etss->map_table, etss->n_map);
-
- e_table_model_changed (E_TABLE_MODEL(ets));
- reentering = 0;
-}
diff --git a/widgets/table/e-table-sorted.h b/widgets/table/e-table-sorted.h
deleted file mode 100644
index 80c7507acc..0000000000
--- a/widgets/table/e-table-sorted.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-sorted.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_TABLE_SORTED_H_
-#define _E_TABLE_SORTED_H_
-
-#include <gtk/gtkobject.h>
-#include <gal/e-table/e-table-model.h>
-#include <gal/e-table/e-table-subset.h>
-#include <gal/e-table/e-table-sort-info.h>
-#include <gal/e-table/e-table-header.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#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;
-
- ETableSortInfo *sort_info;
-
- ETableHeader *full_header;
-
- int sort_info_changed_id;
- int sort_idle_id;
- int insert_idle_id;
- int insert_count;
-
-} ETableSorted;
-
-typedef struct {
- ETableSubsetClass parent_class;
-} ETableSortedClass;
-
-GtkType e_table_sorted_get_type (void);
-ETableModel *e_table_sorted_new (ETableModel *etm, ETableHeader *header, ETableSortInfo *sort_info);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _E_TABLE_SORTED_H_ */
diff --git a/widgets/table/e-table-sorter.c b/widgets/table/e-table-sorter.c
deleted file mode 100644
index 6afafb6824..0000000000
--- a/widgets/table/e-table-sorter.c
+++ /dev/null
@@ -1,445 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-sorter.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <stdlib.h>
-#include <string.h>
-#include <gtk/gtksignal.h>
-#include "gal/util/e-util.h"
-#include "e-table-sorter.h"
-
-#define d(x)
-
-/* The arguments we take */
-enum {
- ARG_0,
- ARG_SORT_INFO
-};
-
-#define PARENT_TYPE e_sorter_get_type()
-
-#define INCREMENT_AMOUNT 100
-
-static ESorterClass *parent_class;
-
-static void ets_model_changed (ETableModel *etm, ETableSorter *ets);
-static void ets_model_row_changed (ETableModel *etm, int row, ETableSorter *ets);
-static void ets_model_cell_changed (ETableModel *etm, int col, int row, ETableSorter *ets);
-static void ets_model_rows_inserted (ETableModel *etm, int row, int count, ETableSorter *ets);
-static void ets_model_rows_deleted (ETableModel *etm, int row, int count, ETableSorter *ets);
-static void ets_sort_info_changed (ETableSortInfo *info, ETableSorter *ets);
-static void ets_clean (ETableSorter *ets);
-static void ets_sort (ETableSorter *ets);
-static void ets_backsort (ETableSorter *ets);
-
-static gint ets_model_to_sorted (ESorter *sorter, int row);
-static gint ets_sorted_to_model (ESorter *sorter, int row);
-static void ets_get_model_to_sorted_array (ESorter *sorter, int **array, int *count);
-static void ets_get_sorted_to_model_array (ESorter *sorter, int **array, int *count);
-static gboolean ets_needs_sorting (ESorter *ets);
-
-static void
-ets_destroy (GtkObject *object)
-{
- ETableSorter *ets = E_TABLE_SORTER (object);
-
- gtk_signal_disconnect (GTK_OBJECT (ets->source),
- ets->table_model_changed_id);
- gtk_signal_disconnect (GTK_OBJECT (ets->source),
- ets->table_model_row_changed_id);
- gtk_signal_disconnect (GTK_OBJECT (ets->source),
- ets->table_model_cell_changed_id);
- gtk_signal_disconnect (GTK_OBJECT (ets->source),
- ets->table_model_rows_inserted_id);
- gtk_signal_disconnect (GTK_OBJECT (ets->source),
- ets->table_model_rows_deleted_id);
- gtk_signal_disconnect (GTK_OBJECT (ets->sort_info),
- ets->sort_info_changed_id);
- gtk_signal_disconnect (GTK_OBJECT (ets->sort_info),
- ets->group_info_changed_id);
-
- ets->table_model_changed_id = 0;
- ets->table_model_row_changed_id = 0;
- ets->table_model_cell_changed_id = 0;
- ets->table_model_rows_inserted_id = 0;
- ets->table_model_rows_deleted_id = 0;
- ets->sort_info_changed_id = 0;
- ets->group_info_changed_id = 0;
-
- if (ets->sort_info)
- gtk_object_unref(GTK_OBJECT(ets->sort_info));
- if (ets->full_header)
- gtk_object_unref(GTK_OBJECT(ets->full_header));
- if (ets->source)
- gtk_object_unref(GTK_OBJECT(ets->source));
-
- GTK_OBJECT_CLASS (parent_class)->destroy (object);
-}
-
-static void
-ets_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- ETableSorter *ets = E_TABLE_SORTER (object);
-
- switch (arg_id) {
- case ARG_SORT_INFO:
- if (ets->sort_info) {
- if (ets->sort_info_changed_id)
- gtk_signal_disconnect(GTK_OBJECT(ets->sort_info), ets->sort_info_changed_id);
- if (ets->group_info_changed_id)
- gtk_signal_disconnect(GTK_OBJECT(ets->sort_info), ets->group_info_changed_id);
- gtk_object_unref(GTK_OBJECT(ets->sort_info));
- }
-
- ets->sort_info = E_TABLE_SORT_INFO(GTK_VALUE_OBJECT (*arg));
- gtk_object_ref(GTK_OBJECT(ets->sort_info));
- ets->sort_info_changed_id = gtk_signal_connect (GTK_OBJECT (ets->sort_info), "sort_info_changed",
- GTK_SIGNAL_FUNC (ets_sort_info_changed), ets);
- ets->group_info_changed_id = gtk_signal_connect (GTK_OBJECT (ets->sort_info), "group_info_changed",
- GTK_SIGNAL_FUNC (ets_sort_info_changed), ets);
-
- ets_clean (ets);
- break;
- default:
- break;
- }
-}
-
-static void
-ets_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- ETableSorter *ets = E_TABLE_SORTER (object);
- switch (arg_id) {
- case ARG_SORT_INFO:
- GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(ets->sort_info);
- break;
- }
-}
-
-static void
-ets_class_init (ETableSorterClass *klass)
-{
- GtkObjectClass *object_class = GTK_OBJECT_CLASS(klass);
- ESorterClass *sorter_class = E_SORTER_CLASS(klass);
-
- parent_class = gtk_type_class (PARENT_TYPE);
-
- object_class->destroy = ets_destroy;
- object_class->set_arg = ets_set_arg;
- object_class->get_arg = ets_get_arg;
-
- sorter_class->model_to_sorted = ets_model_to_sorted ;
- sorter_class->sorted_to_model = ets_sorted_to_model ;
- sorter_class->get_model_to_sorted_array = ets_get_model_to_sorted_array ;
- sorter_class->get_sorted_to_model_array = ets_get_sorted_to_model_array ;
- sorter_class->needs_sorting = ets_needs_sorting ;
-
- gtk_object_add_arg_type ("ETableSorter::sort_info", GTK_TYPE_OBJECT,
- GTK_ARG_READWRITE, ARG_SORT_INFO);
-}
-
-static void
-ets_init (ETableSorter *ets)
-{
- ets->full_header = NULL;
- ets->sort_info = NULL;
- ets->source = NULL;
-
- ets->needs_sorting = -1;
-
- ets->table_model_changed_id = 0;
- ets->table_model_row_changed_id = 0;
- ets->table_model_cell_changed_id = 0;
- ets->table_model_rows_inserted_id = 0;
- ets->table_model_rows_deleted_id = 0;
- ets->sort_info_changed_id = 0;
- ets->group_info_changed_id = 0;
-}
-
-E_MAKE_TYPE(e_table_sorter, "ETableSorter", ETableSorter, ets_class_init, ets_init, PARENT_TYPE);
-
-ETableSorter *
-e_table_sorter_new (ETableModel *source, ETableHeader *full_header, ETableSortInfo *sort_info)
-{
- ETableSorter *ets = gtk_type_new (E_TABLE_SORTER_TYPE);
-
- ets->sort_info = sort_info;
- gtk_object_ref(GTK_OBJECT(ets->sort_info));
- ets->full_header = full_header;
- gtk_object_ref(GTK_OBJECT(ets->full_header));
- ets->source = source;
- gtk_object_ref(GTK_OBJECT(ets->source));
-
- ets->table_model_changed_id = gtk_signal_connect (GTK_OBJECT (source), "model_changed",
- GTK_SIGNAL_FUNC (ets_model_changed), ets);
- ets->table_model_row_changed_id = gtk_signal_connect (GTK_OBJECT (source), "model_row_changed",
- GTK_SIGNAL_FUNC (ets_model_row_changed), ets);
- ets->table_model_cell_changed_id = gtk_signal_connect (GTK_OBJECT (source), "model_cell_changed",
- GTK_SIGNAL_FUNC (ets_model_cell_changed), ets);
- ets->table_model_rows_inserted_id = gtk_signal_connect (GTK_OBJECT (source), "model_rows_inserted",
- GTK_SIGNAL_FUNC (ets_model_rows_inserted), ets);
- ets->table_model_rows_deleted_id = gtk_signal_connect (GTK_OBJECT (source), "model_rows_deleted",
- GTK_SIGNAL_FUNC (ets_model_rows_deleted), ets);
- ets->sort_info_changed_id = gtk_signal_connect (GTK_OBJECT (sort_info), "sort_info_changed",
- GTK_SIGNAL_FUNC (ets_sort_info_changed), ets);
- ets->group_info_changed_id = gtk_signal_connect (GTK_OBJECT (sort_info), "group_info_changed",
- GTK_SIGNAL_FUNC (ets_sort_info_changed), ets);
-
- return ets;
-}
-
-static void
-ets_model_changed (ETableModel *etm, ETableSorter *ets)
-{
- ets_clean(ets);
-}
-
-static void
-ets_model_row_changed (ETableModel *etm, int row, ETableSorter *ets)
-{
- ets_clean(ets);
-}
-
-static void
-ets_model_cell_changed (ETableModel *etm, int col, int row, ETableSorter *ets)
-{
- ets_clean(ets);
-}
-
-static void
-ets_model_rows_inserted (ETableModel *etm, int row, int count, ETableSorter *ets)
-{
- ets_clean(ets);
-}
-
-static void
-ets_model_rows_deleted (ETableModel *etm, int row, int count, ETableSorter *ets)
-{
- ets_clean(ets);
-}
-
-static void
-ets_sort_info_changed (ETableSortInfo *info, ETableSorter *ets)
-{
- d(g_print ("sort info changed\n"));
- ets_clean(ets);
-}
-
-static ETableSorter *ets_closure;
-static void **vals_closure;
-static int cols_closure;
-static int *ascending_closure;
-static GCompareFunc *compare_closure;
-
-/* FIXME: Make it not cache the second and later columns (as if anyone cares.) */
-
-static int
-qsort_callback(const void *data1, const void *data2)
-{
- gint row1 = *(int *)data1;
- gint row2 = *(int *)data2;
- int j;
- int sort_count = e_table_sort_info_sorting_get_count(ets_closure->sort_info) + e_table_sort_info_grouping_get_count(ets_closure->sort_info);
- int comp_val = 0;
- int ascending = 1;
- for (j = 0; j < sort_count; j++) {
- comp_val = (*(compare_closure[j]))(vals_closure[cols_closure * row1 + j], vals_closure[cols_closure * row2 + j]);
- ascending = ascending_closure[j];
- if (comp_val != 0)
- break;
- }
- if (comp_val == 0) {
- if (row1 < row2)
- comp_val = -1;
- if (row1 > row2)
- comp_val = 1;
- }
- if (!ascending)
- comp_val = -comp_val;
- return comp_val;
-}
-
-static void
-ets_clean(ETableSorter *ets)
-{
- g_free(ets->sorted);
- ets->sorted = NULL;
-
- g_free(ets->backsorted);
- ets->backsorted = NULL;
-
- ets->needs_sorting = -1;
-}
-
-
-static void
-ets_sort(ETableSorter *ets)
-{
- int rows;
- int i;
- int j;
- int cols;
- int group_cols;
-
- if (ets->sorted)
- return;
-
- rows = e_table_model_row_count(ets->source);
- group_cols = e_table_sort_info_grouping_get_count(ets->sort_info);
- cols = e_table_sort_info_sorting_get_count(ets->sort_info) + group_cols;
-
- ets->sorted = g_new(int, rows);
- for (i = 0; i < rows; i++)
- ets->sorted[i] = i;
-
- cols_closure = cols;
- ets_closure = ets;
-
- vals_closure = g_new(void *, rows * cols);
- ascending_closure = g_new(int, cols);
- compare_closure = g_new(GCompareFunc, cols);
-
- for (j = 0; j < cols; j++) {
- ETableSortColumn column;
- ETableCol *col;
-
- if (j < group_cols)
- column = e_table_sort_info_grouping_get_nth(ets->sort_info, j);
- else
- column = e_table_sort_info_sorting_get_nth(ets->sort_info, j - group_cols);
-
- col = e_table_header_get_column_by_col_idx(ets->full_header, column.column);
- if (col == NULL)
- col = e_table_header_get_column (ets->full_header, e_table_header_count (ets->full_header) - 1);
-
- for (i = 0; i < rows; i++) {
- vals_closure[i * cols + j] = e_table_model_value_at (ets->source, col->col_idx, i);
- }
-
- compare_closure[j] = col->compare;
- ascending_closure[j] = column.ascending;
- }
-
- qsort(ets->sorted, rows, sizeof(int), qsort_callback);
-
- g_free(vals_closure);
- g_free(ascending_closure);
- g_free(compare_closure);
-}
-
-static void
-ets_backsort(ETableSorter *ets)
-{
- int i, rows;
-
- if (ets->backsorted)
- return;
-
- ets_sort(ets);
-
- rows = e_table_model_row_count(ets->source);
- ets->backsorted = g_new0(int, rows);
-
- for (i = 0; i < rows; i++) {
- ets->backsorted[ets->sorted[i]] = i;
- }
-}
-
-
-static gint
-ets_model_to_sorted (ESorter *es, int row)
-{
- ETableSorter *ets = E_TABLE_SORTER(es);
- int rows = e_table_model_row_count(ets->source);
-
- g_return_val_if_fail(row >= 0, -1);
- g_return_val_if_fail(row < rows, -1);
-
- if (ets_needs_sorting(es))
- ets_backsort(ets);
-
- if (ets->backsorted)
- return ets->backsorted[row];
- else
- return row;
-}
-
-static gint
-ets_sorted_to_model (ESorter *es, int row)
-{
- ETableSorter *ets = E_TABLE_SORTER(es);
- int rows = e_table_model_row_count(ets->source);
-
- g_return_val_if_fail(row >= 0, -1);
- g_return_val_if_fail(row < rows, -1);
-
- if (ets_needs_sorting(es))
- ets_sort(ets);
-
- if (ets->sorted)
- return ets->sorted[row];
- else
- return row;
-}
-
-static void
-ets_get_model_to_sorted_array (ESorter *es, int **array, int *count)
-{
- ETableSorter *ets = E_TABLE_SORTER(es);
- if (array || count) {
- ets_backsort(ets);
-
- if (array)
- *array = ets->backsorted;
- if (count)
- *count = e_table_model_row_count(ets->source);
- }
-}
-
-static void
-ets_get_sorted_to_model_array (ESorter *es, int **array, int *count)
-{
- ETableSorter *ets = E_TABLE_SORTER(es);
- if (array || count) {
- ets_sort(ets);
-
- if (array)
- *array = ets->sorted;
- if (count)
- *count = e_table_model_row_count(ets->source);
- }
-}
-
-
-static gboolean
-ets_needs_sorting(ESorter *es)
-{
- ETableSorter *ets = E_TABLE_SORTER(es);
- if (ets->needs_sorting < 0) {
- if (e_table_sort_info_sorting_get_count(ets->sort_info) + e_table_sort_info_grouping_get_count(ets->sort_info))
- ets->needs_sorting = 1;
- else
- ets->needs_sorting = 0;
- }
- return ets->needs_sorting;
-}
diff --git a/widgets/table/e-table-sorter.h b/widgets/table/e-table-sorter.h
deleted file mode 100644
index b0097b9155..0000000000
--- a/widgets/table/e-table-sorter.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-sorter.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_TABLE_SORTER_H_
-#define _E_TABLE_SORTER_H_
-
-#include <gtk/gtkobject.h>
-#include <gal/util/e-sorter.h>
-#include <gal/e-table/e-table-model.h>
-#include <gal/e-table/e-table-subset-variable.h>
-#include <gal/e-table/e-table-sort-info.h>
-#include <gal/e-table/e-table-header.h>
-#include <libgnome/gnome-defs.h>
-
-BEGIN_GNOME_DECLS
-
-#define E_TABLE_SORTER_TYPE (e_table_sorter_get_type ())
-#define E_TABLE_SORTER(o) (GTK_CHECK_CAST ((o), E_TABLE_SORTER_TYPE, ETableSorter))
-#define E_TABLE_SORTER_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_SORTER_TYPE, ETableSorterClass))
-#define E_IS_TABLE_SORTER(o) (GTK_CHECK_TYPE ((o), E_TABLE_SORTER_TYPE))
-#define E_IS_TABLE_SORTER_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_SORTER_TYPE))
-
-typedef struct {
- ESorter base;
-
- ETableModel *source;
- ETableHeader *full_header;
- ETableSortInfo *sort_info;
-
- /* If needs_sorting is 0, then model_to_sorted and sorted_to_model are no-ops. */
- int needs_sorting;
-
- int *sorted;
- int *backsorted;
-
- int table_model_changed_id;
- int table_model_row_changed_id;
- int table_model_cell_changed_id;
- int table_model_rows_inserted_id;
- int table_model_rows_deleted_id;
- int sort_info_changed_id;
- int group_info_changed_id;
-} ETableSorter;
-
-typedef struct {
- ESorterClass parent_class;
-} ETableSorterClass;
-
-GtkType e_table_sorter_get_type (void);
-ETableSorter *e_table_sorter_new (ETableModel *etm,
- ETableHeader *full_header,
- ETableSortInfo *sort_info);
-END_GNOME_DECLS
-
-#endif /* _E_TABLE_SORTER_H_ */
diff --git a/widgets/table/e-table-sorting-utils.c b/widgets/table/e-table-sorting-utils.c
deleted file mode 100644
index fac9666384..0000000000
--- a/widgets/table/e-table-sorting-utils.c
+++ /dev/null
@@ -1,349 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-sorting-utils.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <string.h>
-#include <e-table-sorting-utils.h>
-#include <gal/util/e-util.h>
-
-#define d(x)
-
-/* This takes source rows. */
-static int
-etsu_compare(ETableModel *source, ETableSortInfo *sort_info, ETableHeader *full_header, int row1, int row2)
-{
- int j;
- int sort_count = e_table_sort_info_sorting_get_count(sort_info);
- int comp_val = 0;
- int ascending = 1;
-
- for (j = 0; j < sort_count; j++) {
- ETableSortColumn column = e_table_sort_info_sorting_get_nth(sort_info, j);
- ETableCol *col;
- col = e_table_header_get_column_by_col_idx(full_header, column.column);
- if (col == NULL)
- col = e_table_header_get_column (full_header, e_table_header_count (full_header) - 1);
- comp_val = (*col->compare)(e_table_model_value_at (source, col->col_idx, row1),
- e_table_model_value_at (source, col->col_idx, row2));
- ascending = column.ascending;
- if (comp_val != 0)
- break;
- }
- if (comp_val == 0) {
- if (row1 < row2)
- comp_val = -1;
- if (row1 > row2)
- comp_val = 1;
- }
- if (!ascending)
- comp_val = -comp_val;
- return comp_val;
-}
-
-typedef struct {
- int cols;
- void **vals;
- int *ascending;
- GCompareFunc *compare;
-} ETableSortClosure;
-
-typedef struct {
- ETreeModel *tree;
- ETableSortInfo *sort_info;
- ETableHeader *full_header;
-} ETreeSortClosure;
-
-/* FIXME: Make it not cache the second and later columns (as if anyone cares.) */
-
-static int
-e_sort_callback(const void *data1, const void *data2, gpointer user_data)
-{
- gint row1 = *(int *)data1;
- gint row2 = *(int *)data2;
- ETableSortClosure *closure = user_data;
- int j;
- int sort_count = closure->cols;
- int comp_val = 0;
- int ascending = 1;
- for (j = 0; j < sort_count; j++) {
- comp_val = (*(closure->compare[j]))(closure->vals[closure->cols * row1 + j], closure->vals[closure->cols * row2 + j]);
- ascending = closure->ascending[j];
- if (comp_val != 0)
- break;
- }
- if (comp_val == 0) {
- if (row1 < row2)
- comp_val = -1;
- if (row1 > row2)
- comp_val = 1;
- }
- if (!ascending)
- comp_val = -comp_val;
- return comp_val;
-}
-
-void
-e_table_sorting_utils_sort(ETableModel *source, ETableSortInfo *sort_info, ETableHeader *full_header, int *map_table, int rows)
-{
- int total_rows;
- int i;
- int j;
- int cols;
- ETableSortClosure closure;
-
- g_return_if_fail(source != NULL);
- g_return_if_fail(E_IS_TABLE_MODEL(source));
- g_return_if_fail(sort_info != NULL);
- g_return_if_fail(E_IS_TABLE_SORT_INFO(sort_info));
- g_return_if_fail(full_header != NULL);
- g_return_if_fail(E_IS_TABLE_HEADER(full_header));
-
- total_rows = e_table_model_row_count(source);
- cols = e_table_sort_info_sorting_get_count(sort_info);
- closure.cols = cols;
-
- closure.vals = g_new(void *, total_rows * cols);
- closure.ascending = g_new(int, cols);
- closure.compare = g_new(GCompareFunc, cols);
-
- for (j = 0; j < cols; j++) {
- ETableSortColumn column = e_table_sort_info_sorting_get_nth(sort_info, j);
- ETableCol *col;
- col = e_table_header_get_column_by_col_idx(full_header, column.column);
- if (col == NULL)
- col = e_table_header_get_column (full_header, e_table_header_count (full_header) - 1);
- for (i = 0; i < rows; i++) {
- closure.vals[map_table[i] * cols + j] = e_table_model_value_at (source, col->col_idx, map_table[i]);
- }
- closure.compare[j] = col->compare;
- closure.ascending[j] = column.ascending;
- }
-
- e_sort(map_table, rows, sizeof(int), e_sort_callback, &closure);
-
- g_free(closure.vals);
- g_free(closure.ascending);
- g_free(closure.compare);
-}
-
-gboolean
-e_table_sorting_utils_affects_sort (ETableSortInfo *sort_info,
- ETableHeader *full_header,
- int col)
-{
- int j;
- int cols;
-
- g_return_val_if_fail(sort_info != NULL, TRUE);
- g_return_val_if_fail(E_IS_TABLE_SORT_INFO(sort_info), TRUE);
- g_return_val_if_fail(full_header != NULL, TRUE);
- g_return_val_if_fail(E_IS_TABLE_HEADER(full_header), TRUE);
-
- cols = e_table_sort_info_sorting_get_count(sort_info);
-
- for (j = 0; j < cols; j++) {
- ETableSortColumn column = e_table_sort_info_sorting_get_nth(sort_info, j);
- ETableCol *tablecol;
- tablecol = e_table_header_get_column_by_col_idx(full_header, column.column);
- if (tablecol == NULL)
- tablecol = e_table_header_get_column (full_header, e_table_header_count (full_header) - 1);
- if (col == tablecol->col_idx)
- return TRUE;
- }
- return FALSE;
-}
-
-
-/* FIXME: This could be done in time log n instead of time n with a binary search. */
-int
-e_table_sorting_utils_insert(ETableModel *source, ETableSortInfo *sort_info, ETableHeader *full_header, int *map_table, int rows, int row)
-{
- int i;
-
- i = 0;
- /* handle insertions when we have a 'sort group' */
- while (i < rows && etsu_compare(source, sort_info, full_header, map_table[i], row) < 0)
- i++;
-
- return i;
-}
-
-/* FIXME: This could be done in time log n instead of time n with a binary search. */
-int
-e_table_sorting_utils_check_position (ETableModel *source, ETableSortInfo *sort_info, ETableHeader *full_header, int *map_table, int rows, int view_row)
-{
- int i;
- int row;
-
- i = view_row;
- row = map_table[i];
-
- i = view_row;
- if (i < rows - 1 && etsu_compare(source, sort_info, full_header, map_table[i + 1], row) < 0) {
- i ++;
- while (i < rows - 1 && etsu_compare(source, sort_info, full_header, map_table[i], row) < 0)
- i ++;
- } else if (i > 0 && etsu_compare(source, sort_info, full_header, map_table[i - 1], row) > 0) {
- i --;
- while (i > 0 && etsu_compare(source, sort_info, full_header, map_table[i], row) > 0)
- i --;
- }
- return i;
-}
-
-
-
-
-/* This takes source rows. */
-static int
-etsu_tree_compare(ETreeModel *source, ETableSortInfo *sort_info, ETableHeader *full_header, ETreePath path1, ETreePath path2)
-{
- int j;
- int sort_count = e_table_sort_info_sorting_get_count(sort_info);
- int comp_val = 0;
- int ascending = 1;
-
- for (j = 0; j < sort_count; j++) {
- ETableSortColumn column = e_table_sort_info_sorting_get_nth(sort_info, j);
- ETableCol *col;
- col = e_table_header_get_column_by_col_idx(full_header, column.column);
- if (col == NULL)
- col = e_table_header_get_column (full_header, e_table_header_count (full_header) - 1);
- comp_val = (*col->compare)(e_tree_model_value_at (source, path1, col->col_idx),
- e_tree_model_value_at (source, path2, col->col_idx));
- ascending = column.ascending;
- if (comp_val != 0)
- break;
- }
- if (!ascending)
- comp_val = -comp_val;
- return comp_val;
-}
-
-static int
-e_sort_tree_callback(const void *data1, const void *data2, gpointer user_data)
-{
- ETreePath *path1 = *(ETreePath *)data1;
- ETreePath *path2 = *(ETreePath *)data2;
- ETreeSortClosure *closure = user_data;
-
- return etsu_tree_compare(closure->tree, closure->sort_info, closure->full_header, path1, path2);
-}
-
-void
-e_table_sorting_utils_tree_sort(ETreeModel *source, ETableSortInfo *sort_info, ETableHeader *full_header, ETreePath *map_table, int count)
-{
- ETableSortClosure closure;
- int cols;
- int i, j;
- int *map;
- ETreePath *map_copy;
- g_return_if_fail(source != NULL);
- g_return_if_fail(E_IS_TREE_MODEL(source));
- g_return_if_fail(sort_info != NULL);
- g_return_if_fail(E_IS_TABLE_SORT_INFO(sort_info));
- g_return_if_fail(full_header != NULL);
- g_return_if_fail(E_IS_TABLE_HEADER(full_header));
-
- cols = e_table_sort_info_sorting_get_count(sort_info);
- closure.cols = cols;
-
- closure.vals = g_new(void *, count * cols);
- closure.ascending = g_new(int, cols);
- closure.compare = g_new(GCompareFunc, cols);
-
- for (j = 0; j < cols; j++) {
- ETableSortColumn column = e_table_sort_info_sorting_get_nth(sort_info, j);
- ETableCol *col;
-
- col = e_table_header_get_column_by_col_idx(full_header, column.column);
- if (col == NULL)
- col = e_table_header_get_column (full_header, e_table_header_count (full_header) - 1);
-
- for (i = 0; i < count; i++) {
- closure.vals[i * cols + j] = e_tree_model_value_at (source, map_table[i], col->col_idx);
- }
- closure.ascending[j] = column.ascending;
- closure.compare[j] = col->compare;
- }
-
- map = g_new(int, count);
- for (i = 0; i < count; i++) {
- map[i] = i;
- }
-
- e_sort(map, count, sizeof(int), e_sort_callback, &closure);
-
- map_copy = g_new(ETreePath, count);
- for (i = 0; i < count; i++) {
- map_copy[i] = map_table[i];
- }
- for (i = 0; i < count; i++) {
- map_table[i] = map_copy[map[i]];
- }
-
- g_free(map);
- g_free(map_copy);
-
- g_free(closure.vals);
- g_free(closure.ascending);
- g_free(closure.compare);
-}
-
-/* FIXME: This could be done in time log n instead of time n with a binary search. */
-int
-e_table_sorting_utils_tree_check_position (ETreeModel *source, ETableSortInfo *sort_info, ETableHeader *full_header, ETreePath *map_table, int count, int old_index)
-{
- int i;
- ETreePath path;
-
- i = old_index;
- path = map_table[i];
-
- if (i < count - 1 && etsu_tree_compare(source, sort_info, full_header, map_table[i + 1], path) < 0) {
- i ++;
- while (i < count - 1 && etsu_tree_compare(source, sort_info, full_header, map_table[i], path) < 0)
- i ++;
- } else if (i > 0 && etsu_tree_compare(source, sort_info, full_header, map_table[i - 1], path) > 0) {
- i --;
- while (i > 0 && etsu_tree_compare(source, sort_info, full_header, map_table[i], path) > 0)
- i --;
- }
- return i;
-}
-
-/* FIXME: This does not pay attention to making sure that it's a stable insert. This needs to be fixed. */
-int
-e_table_sorting_utils_tree_insert(ETreeModel *source, ETableSortInfo *sort_info, ETableHeader *full_header, ETreePath *map_table, int count, ETreePath path)
-{
- size_t start;
- size_t end;
- ETreeSortClosure closure;
-
- closure.tree = source;
- closure.sort_info = sort_info;
- closure.full_header = full_header;
-
- e_bsearch(&path, map_table, count, sizeof(ETreePath), e_sort_tree_callback, &closure, &start, &end);
- return end;
-}
diff --git a/widgets/table/e-table-sorting-utils.h b/widgets/table/e-table-sorting-utils.h
deleted file mode 100644
index 794ead0ac9..0000000000
--- a/widgets/table/e-table-sorting-utils.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-sorting-utils.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_TABLE_SORTING_UTILS_H_
-#define _E_TABLE_SORTING_UTILS_H_
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#include <gal/e-table/e-table-model.h>
-#include <gal/e-table/e-tree-model.h>
-#include <gal/e-table/e-table-sort-info.h>
-#include <gal/e-table/e-table-header.h>
-gboolean e_table_sorting_utils_affects_sort (ETableSortInfo *sort_info,
- ETableHeader *full_header,
- int col);
-
-
-
-void e_table_sorting_utils_sort (ETableModel *source,
- ETableSortInfo *sort_info,
- ETableHeader *full_header,
- int *map_table,
- int rows);
-int e_table_sorting_utils_insert (ETableModel *source,
- ETableSortInfo *sort_info,
- ETableHeader *full_header,
- int *map_table,
- int rows,
- int row);
-int e_table_sorting_utils_check_position (ETableModel *source,
- ETableSortInfo *sort_info,
- ETableHeader *full_header,
- int *map_table,
- int rows,
- int view_row);
-
-
-
-void e_table_sorting_utils_tree_sort (ETreeModel *source,
- ETableSortInfo *sort_info,
- ETableHeader *full_header,
- ETreePath *map_table,
- int count);
-int e_table_sorting_utils_tree_check_position (ETreeModel *source,
- ETableSortInfo *sort_info,
- ETableHeader *full_header,
- ETreePath *map_table,
- int count,
- int old_index);
-int e_table_sorting_utils_tree_insert (ETreeModel *source,
- ETableSortInfo *sort_info,
- ETableHeader *full_header,
- ETreePath *map_table,
- int count,
- ETreePath path);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _E_TABLE_SORTING_UTILS_H_ */
diff --git a/widgets/table/e-table-specification.c b/widgets/table/e-table-specification.c
deleted file mode 100644
index cabd5b9084..0000000000
--- a/widgets/table/e-table-specification.c
+++ /dev/null
@@ -1,401 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-specification.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-
-#include "e-table-specification.h"
-
-#include <stdlib.h>
-#include <string.h>
-#include <gtk/gtksignal.h>
-#include <gnome-xml/parser.h>
-#include <gnome-xml/xmlmemory.h>
-#include "gal/util/e-util.h"
-#include "gal/util/e-xml-utils.h"
-
-#define PARENT_TYPE (gtk_object_get_type ())
-
-static GtkObjectClass *etsp_parent_class;
-
-static void
-etsp_destroy (GtkObject *object)
-{
- ETableSpecification *etsp = E_TABLE_SPECIFICATION (object);
- int i;
-
- if (etsp->columns) {
- for (i = 0; etsp->columns[i]; i++) {
- gtk_object_unref (GTK_OBJECT (etsp->columns[i]));
- }
- g_free (etsp->columns);
- }
-
- if (etsp->state)
- gtk_object_unref (GTK_OBJECT (etsp->state));
- g_free (etsp->click_to_add_message);
-
- etsp->columns = NULL;
- etsp->state = NULL;
- etsp->click_to_add_message = NULL;
-
- GTK_OBJECT_CLASS (etsp_parent_class)->destroy (object);
-}
-
-static void
-etsp_class_init (GtkObjectClass *klass)
-{
- etsp_parent_class = gtk_type_class (PARENT_TYPE);
-
- klass->destroy = etsp_destroy;
-}
-
-static void
-etsp_init (ETableSpecification *etsp)
-{
- etsp->columns = NULL;
- etsp->state = NULL;
-
- etsp->alternating_row_colors = TRUE;
- etsp->no_headers = FALSE;
- etsp->click_to_add = FALSE;
- etsp->click_to_add_end = FALSE;
- etsp->horizontal_draw_grid = FALSE;
- etsp->vertical_draw_grid = FALSE;
- etsp->draw_focus = TRUE;
- etsp->horizontal_scrolling = FALSE;
- etsp->horizontal_resize = FALSE;
- etsp->allow_grouping = TRUE;
-
- etsp->cursor_mode = E_CURSOR_SIMPLE;
- etsp->selection_mode = GTK_SELECTION_MULTIPLE;
-
- etsp->click_to_add_message = NULL;
-}
-
-E_MAKE_TYPE (e_table_specification, "ETableSpecification", ETableSpecification, etsp_class_init, etsp_init, PARENT_TYPE);
-
-/**
- * e_table_specification_new:
- *
- * Creates a new %ETableSpecification object. This object is used to hold the
- * information about the rendering information for ETable.
- *
- * Returns: a newly created %ETableSpecification object.
- */
-ETableSpecification *
-e_table_specification_new (void)
-{
- ETableSpecification *etsp = gtk_type_new (E_TABLE_SPECIFICATION_TYPE);
-
- return (ETableSpecification *) etsp;
-}
-
-/**
- * e_table_specification_load_from_file:
- * @specification: An ETableSpecification that you want to modify
- * @filename: a filename that contains an ETableSpecification
- *
- * This routine modifies @specification to reflect the state described
- * by the file @filename.
- *
- * Returns: TRUE on success, FALSE on failure.
- */
-gboolean
-e_table_specification_load_from_file (ETableSpecification *specification,
- const char *filename)
-{
- xmlDoc *doc;
- doc = xmlParseFile (filename);
- if (doc) {
- xmlNode *node = xmlDocGetRootElement (doc);
- e_table_specification_load_from_node (specification, node);
- xmlFreeDoc (doc);
- return TRUE;
- }
- return FALSE;
-}
-
-/**
- * e_table_specification_load_from_string:
- * @specification: An ETableSpecification that you want to modify
- * @xml: a stringified representation of an ETableSpecification description.
- *
- * This routine modifies @specification to reflect the state described
- * by @xml. @xml is typically returned by e_table_specification_save_to_string
- * or it can be embedded in your source code.
- *
- * Returns: TRUE on success, FALSE on failure.
- */
-gboolean
-e_table_specification_load_from_string (ETableSpecification *specification,
- const char *xml)
-{
- xmlDoc *doc;
- doc = xmlParseMemory ( (char *) xml, strlen (xml));
- if (doc) {
- xmlNode *node = xmlDocGetRootElement (doc);
- e_table_specification_load_from_node (specification, node);
- xmlFreeDoc (doc);
- return TRUE;
- }
-
- return FALSE;
-}
-
-/**
- * e_table_specification_load_from_node:
- * @specification: An ETableSpecification that you want to modify
- * @node: an xmlNode with an XML ETableSpecification description.
- *
- * This routine modifies @specification to reflect the state described
- * by @node.
- */
-void
-e_table_specification_load_from_node (ETableSpecification *specification,
- const xmlNode *node)
-{
- char *temp;
- xmlNode *children;
- GList *list = NULL, *list2;
- int i;
-
- specification->no_headers = e_xml_get_bool_prop_by_name (node, "no-headers");
- specification->click_to_add = e_xml_get_bool_prop_by_name (node, "click-to-add");
- specification->click_to_add_end = e_xml_get_bool_prop_by_name (node, "click-to-add-end") && specification->click_to_add;
- specification->alternating_row_colors = e_xml_get_bool_prop_by_name_with_default (node, "alternating-row-colors", TRUE);
- specification->horizontal_draw_grid = e_xml_get_bool_prop_by_name (node, "horizontal-draw-grid");
- specification->vertical_draw_grid = e_xml_get_bool_prop_by_name (node, "vertical-draw-grid");
- if (e_xml_get_bool_prop_by_name_with_default(node, "draw-grid", TRUE) ==
- e_xml_get_bool_prop_by_name_with_default(node, "draw-grid", FALSE)) {
- specification->horizontal_draw_grid =
- specification->vertical_draw_grid = e_xml_get_bool_prop_by_name (node, "draw-grid");
- }
- specification->draw_focus = e_xml_get_bool_prop_by_name_with_default (node, "draw-focus", TRUE);
- specification->horizontal_scrolling = e_xml_get_bool_prop_by_name_with_default (node, "horizontal-scrolling", FALSE);
- specification->horizontal_resize = e_xml_get_bool_prop_by_name_with_default (node, "horizontal-resize", FALSE);
- specification->allow_grouping = e_xml_get_bool_prop_by_name_with_default (node, "allow-grouping", TRUE);
-
- specification->selection_mode = GTK_SELECTION_MULTIPLE;
- temp = e_xml_get_string_prop_by_name (node, "selection-mode");
- if (temp && !g_strcasecmp (temp, "single")) {
- specification->selection_mode = GTK_SELECTION_SINGLE;
- } else if (temp && !g_strcasecmp (temp, "browse")) {
- specification->selection_mode = GTK_SELECTION_BROWSE;
- } else if (temp && !g_strcasecmp (temp, "extended")) {
- specification->selection_mode = GTK_SELECTION_EXTENDED;
- }
- g_free (temp);
-
- specification->cursor_mode = E_CURSOR_SIMPLE;
- temp = e_xml_get_string_prop_by_name (node, "cursor-mode");
- if (temp && !g_strcasecmp (temp, "line")) {
- specification->cursor_mode = E_CURSOR_LINE;
- } else if (temp && !g_strcasecmp (temp, "spreadsheet")) {
- specification->cursor_mode = E_CURSOR_SPREADSHEET;
- }
- g_free (temp);
- g_free (specification->click_to_add_message);
-
- specification->click_to_add_message =
- e_xml_get_string_prop_by_name (
- node, "_click-to-add-message");
-
- if (specification->state)
- gtk_object_unref (GTK_OBJECT (specification->state));
- specification->state = NULL;
- if (specification->columns) {
- for (i = 0; specification->columns[i]; i++) {
- gtk_object_unref (GTK_OBJECT (specification->columns[i]));
- }
- g_free (specification->columns);
- }
- specification->columns = NULL;
-
- for (children = node->xmlChildrenNode; children; children = children->next) {
- if (!strcmp (children->name, "ETableColumn")) {
- ETableColumnSpecification *col_spec = e_table_column_specification_new ();
-
- e_table_column_specification_load_from_node (col_spec, children);
- list = g_list_append (list, col_spec);
- } else if (specification->state == NULL && !strcmp (children->name, "ETableState")) {
- specification->state = e_table_state_new ();
- e_table_state_load_from_node (specification->state, children);
- e_table_sort_info_set_can_group (specification->state->sort_info, specification->allow_grouping);
- }
- }
-
- specification->columns = g_new (ETableColumnSpecification *, g_list_length (list) + 1);
- for (list2 = list, i = 0; list2; list2 = g_list_next (list2), i++) {
- specification->columns[i] = list2->data;
- }
- specification->columns[i] = NULL;
- g_list_free (list);
-}
-
-/**
- * e_table_specification_save_to_file:
- * @specification: An %ETableSpecification that you want to save
- * @filename: a file name to store the specification.
- *
- * This routine stores the @specification into @filename.
- *
- * Returns: the number of bytes written or -1 on error.
- */
-int
-e_table_specification_save_to_file (ETableSpecification *specification,
- const char *filename)
-{
- xmlDoc *doc;
-
- g_return_val_if_fail (specification != NULL, -1);
- g_return_val_if_fail (filename != NULL, -1);
- g_return_val_if_fail (E_IS_TABLE_SPECIFICATION (specification), -1);
-
- doc = xmlNewDoc ("1.0");
- xmlDocSetRootElement (doc, e_table_specification_save_to_node (specification, doc));
- return xmlSaveFile (filename, doc);
-}
-
-/**
- * e_table_specification_save_to_string:
- * @specification: An %ETableSpecification that you want to stringify
- *
- * Saves the state of @specification to a string.
- *
- * Returns: an g_alloc() allocated string containing the stringified
- * representation of @specification. This stringified representation
- * uses XML as a convenience.
- */
-char *
-e_table_specification_save_to_string (ETableSpecification *specification)
-{
- char *ret_val;
- xmlChar *string;
- int length;
- xmlDoc *doc;
-
- g_return_val_if_fail (specification != NULL, NULL);
- g_return_val_if_fail (E_IS_TABLE_SPECIFICATION (specification), NULL);
-
- doc = xmlNewDoc ("1.0");
- xmlDocSetRootElement (doc, e_table_specification_save_to_node (specification, doc));
- xmlDocDumpMemory (doc, &string, &length);
-
- ret_val = g_strdup (string);
- xmlFree (string);
- return ret_val;
-}
-
-/**
- * e_table_specification_save_to_node:
- * @specification: An ETableSpecification that you want to store.
- * @doc: Node where the specification is saved
- *
- * This routine saves the %ETableSpecification state in the object @specification
- * into the xmlDoc represented by @doc.
- *
- * Returns: The node that has been attached to @doc with the contents
- * of the ETableSpecification.
- */
-xmlNode *
-e_table_specification_save_to_node (ETableSpecification *specification,
- xmlDoc *doc)
-{
- xmlNode *node;
- char *s;
-
- g_return_val_if_fail (doc != NULL, NULL);
- g_return_val_if_fail (specification != NULL, NULL);
- g_return_val_if_fail (E_IS_TABLE_SPECIFICATION (specification), NULL);
-
- node = xmlNewNode (NULL, "ETableSpecification");
- e_xml_set_bool_prop_by_name (node, "no-headers", specification->no_headers);
- e_xml_set_bool_prop_by_name (node, "click-to-add", specification->click_to_add);
- e_xml_set_bool_prop_by_name (node, "click-to-add-end", specification->click_to_add_end && specification->click_to_add);
- e_xml_set_bool_prop_by_name (node, "alternating-row-colors", specification->alternating_row_colors);
- e_xml_set_bool_prop_by_name (node, "horizontal-draw-grid", specification->horizontal_draw_grid);
- e_xml_set_bool_prop_by_name (node, "vertical-draw-grid", specification->vertical_draw_grid);
- e_xml_set_bool_prop_by_name (node, "draw-focus", specification->draw_focus);
- e_xml_set_bool_prop_by_name (node, "horizontal-scrolling", specification->horizontal_scrolling);
- e_xml_set_bool_prop_by_name (node, "horizontal-resize", specification->horizontal_resize);
- e_xml_set_bool_prop_by_name (node, "allow-grouping", specification->allow_grouping);
-
- switch (specification->selection_mode){
- case GTK_SELECTION_SINGLE:
- s = "single";
- break;
- case GTK_SELECTION_BROWSE:
- s = "browse";
- break;
- default:
- case GTK_SELECTION_EXTENDED:
- s = "extended";
- }
- xmlSetProp (node, "selection-mode", s);
- if (specification->cursor_mode == E_CURSOR_LINE)
- s = "line";
- else
- s = "cell";
- xmlSetProp (node, "cursor-mode", s);
-
- xmlSetProp (node, "_click-to-add-message", specification->click_to_add_message);
-
- if (specification->columns){
- int i;
-
- for (i = 0; specification->columns [i]; i++)
- e_table_column_specification_save_to_node (
- specification->columns [i],
- node);
- }
-
- if (specification->state)
- e_table_state_save_to_node (specification->state, node);
-
- return node;
-}
-
-/**
- * e_table_specification_duplicate:
- * @spec: specification to duplicate
- *
- * This creates a copy of the %ETableSpecification @spec
- *
- * Returns: The duplicated %ETableSpecification.
- */
-ETableSpecification *
-e_table_specification_duplicate (ETableSpecification *spec)
-{
- ETableSpecification *new_spec;
- char *spec_str;
-
- g_return_val_if_fail (spec != NULL, NULL);
- g_return_val_if_fail (E_IS_TABLE_SPECIFICATION (spec), NULL);
-
- new_spec = e_table_specification_new ();
- spec_str = e_table_specification_save_to_string (spec);
- e_table_specification_load_from_string (new_spec, spec_str);
- g_free (spec_str);
-
- return new_spec;
-}
diff --git a/widgets/table/e-table-specification.h b/widgets/table/e-table-specification.h
deleted file mode 100644
index 35425fe0af..0000000000
--- a/widgets/table/e-table-specification.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-specification.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_TABLE_SPECIFICATION_H_
-#define _E_TABLE_SPECIFICATION_H_
-
-#include <gtk/gtkobject.h>
-#include <gnome-xml/tree.h>
-#include <gal/widgets/e-selection-model.h>
-#include <gal/e-table/e-table-state.h>
-#include <gal/e-table/e-table-column-specification.h>
-#include <gal/e-table/e-table-defines.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#define E_TABLE_SPECIFICATION_TYPE (e_table_specification_get_type ())
-#define E_TABLE_SPECIFICATION(o) (GTK_CHECK_CAST ((o), E_TABLE_SPECIFICATION_TYPE, ETableSpecification))
-#define E_TABLE_SPECIFICATION_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_SPECIFICATION_TYPE, ETableSpecificationClass))
-#define E_IS_TABLE_SPECIFICATION(o) (GTK_CHECK_TYPE ((o), E_TABLE_SPECIFICATION_TYPE))
-#define E_IS_TABLE_SPECIFICATION_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_SPECIFICATION_TYPE))
-
-typedef struct {
- GtkObject base;
-
- ETableColumnSpecification **columns;
- ETableState *state;
-
- guint alternating_row_colors : 1;
- guint no_headers : 1;
- guint click_to_add : 1;
- guint click_to_add_end : 1;
- guint horizontal_draw_grid : 1;
- guint vertical_draw_grid : 1;
- guint draw_focus : 1;
- guint horizontal_scrolling : 1;
- guint horizontal_resize : 1;
- guint allow_grouping : 1;
- GtkSelectionMode selection_mode;
- ECursorMode cursor_mode;
-
- char *click_to_add_message;
-} ETableSpecification;
-
-typedef struct {
- GtkObjectClass parent_class;
-} ETableSpecificationClass;
-
-GtkType e_table_specification_get_type (void);
-ETableSpecification *e_table_specification_new (void);
-
-gboolean e_table_specification_load_from_file (ETableSpecification *specification,
- const char *filename);
-gboolean e_table_specification_load_from_string (ETableSpecification *specification,
- const char *xml);
-void e_table_specification_load_from_node (ETableSpecification *specification,
- const xmlNode *node);
-
-int e_table_specification_save_to_file (ETableSpecification *specification,
- const char *filename);
-char *e_table_specification_save_to_string (ETableSpecification *specification);
-xmlNode *e_table_specification_save_to_node (ETableSpecification *specification,
- xmlDoc *doc);
-ETableSpecification *e_table_specification_duplicate (ETableSpecification *spec);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _E_TABLE_SPECIFICATION_H_ */
diff --git a/widgets/table/e-table-state.c b/widgets/table/e-table-state.c
deleted file mode 100644
index fa846d6517..0000000000
--- a/widgets/table/e-table-state.c
+++ /dev/null
@@ -1,261 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-state.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <stdlib.h>
-#include <string.h>
-#include <gtk/gtksignal.h>
-#include <gtk/gtkobject.h>
-#include <gnome-xml/parser.h>
-#include <gnome-xml/xmlmemory.h>
-#include "gal/util/e-util.h"
-#include "gal/util/e-xml-utils.h"
-#include "e-table-state.h"
-
-
-#define PARENT_TYPE (gtk_object_get_type())
-
-#define STATE_VERSION 0.1
-
-static GtkObjectClass *etst_parent_class;
-
-static void
-etst_destroy (GtkObject *object)
-{
- ETableState *etst = E_TABLE_STATE (object);
-
- gtk_object_unref (GTK_OBJECT (etst->sort_info));
- if (etst->columns) {
- g_free (etst->columns);
- etst->columns = NULL;
- }
-
- if (etst->expansions) {
- g_free (etst->expansions);
- etst->expansions = NULL;
- }
-
- GTK_OBJECT_CLASS (etst_parent_class)->destroy (object);
-}
-
-static void
-etst_class_init (GtkObjectClass *klass)
-{
- etst_parent_class = gtk_type_class (PARENT_TYPE);
-
- klass->destroy = etst_destroy;
-}
-
-static void
-etst_init (ETableState *state)
-{
- GTK_OBJECT_UNSET_FLAGS (GTK_OBJECT (state), GTK_FLOATING);
-
- state->columns = NULL;
- state->expansions = NULL;
- state->sort_info = e_table_sort_info_new();
-}
-
-E_MAKE_TYPE(e_table_state, "ETableState", ETableState, etst_class_init, etst_init, PARENT_TYPE);
-
-ETableState *
-e_table_state_new (void)
-{
- ETableState *etst = gtk_type_new (E_TABLE_STATE_TYPE);
-
- return (ETableState *) etst;
-}
-
-gboolean
-e_table_state_load_from_file (ETableState *state,
- const char *filename)
-{
- xmlDoc *doc;
- doc = xmlParseFile (filename);
- if (doc) {
- xmlNode *node = xmlDocGetRootElement(doc);
- e_table_state_load_from_node(state, node);
- xmlFreeDoc(doc);
- return TRUE;
- }
- return FALSE;
-}
-
-void
-e_table_state_load_from_string (ETableState *state,
- const char *xml)
-{
- xmlDoc *doc;
- doc = xmlParseMemory ((char *) xml, strlen(xml));
- if (doc) {
- xmlNode *node = xmlDocGetRootElement(doc);
- e_table_state_load_from_node(state, node);
- xmlFreeDoc(doc);
- }
-}
-
-typedef struct {
- int column;
- double expansion;
-} int_and_double;
-
-void
-e_table_state_load_from_node (ETableState *state,
- const xmlNode *node)
-{
- xmlNode *children;
- GList *list = NULL, *iterator;
- gdouble state_version;
- int i;
-
- state_version = e_xml_get_double_prop_by_name_with_default (
- node, "state-version", STATE_VERSION);
-
- if (state->sort_info)
- gtk_object_unref (GTK_OBJECT(state->sort_info));
-
- state->sort_info = NULL;
- children = node->xmlChildrenNode;
- for (; children; children = children->next) {
- if (!strcmp (children->name, "column")) {
- int_and_double *column_info = g_new(int_and_double, 1);
-
- column_info->column = e_xml_get_integer_prop_by_name(
- children, "source");
- column_info->expansion =
- e_xml_get_double_prop_by_name_with_default(
- children, "expansion", 1);
-
- list = g_list_append (list, column_info);
- } else if (state->sort_info == NULL &&
- !strcmp (children->name, "grouping")) {
- state->sort_info = e_table_sort_info_new();
- e_table_sort_info_load_from_node(
- state->sort_info, children, state_version);
- }
- }
- g_free(state->columns);
- g_free(state->expansions);
- state->col_count = g_list_length(list);
- state->columns = g_new(int, state->col_count);
- state->expansions = g_new(double, state->col_count);
-
- for (iterator = list, i = 0; iterator; i++) {
- int_and_double *column_info = iterator->data;
-
- state->columns [i] = column_info->column;
- state->expansions [i] = column_info->expansion;
- g_free (column_info);
- iterator = g_list_next (iterator);
- }
- g_list_free(list);
-}
-
-void
-e_table_state_save_to_file (ETableState *state,
- const char *filename)
-{
- xmlDoc *doc;
- doc = xmlNewDoc("1.0");
- xmlDocSetRootElement(doc, e_table_state_save_to_node(state, NULL));
- xmlSaveFile(filename, doc);
- xmlFreeDoc(doc);
-}
-
-char *
-e_table_state_save_to_string (ETableState *state)
-{
- char *ret_val;
- xmlChar *string;
- int length;
- xmlDoc *doc;
-
- doc = xmlNewDoc("1.0");
- xmlDocSetRootElement(doc, e_table_state_save_to_node(state, NULL));
- xmlDocDumpMemory(doc, &string, &length);
- xmlFreeDoc(doc);
-
- ret_val = g_strdup(string);
- xmlFree(string);
- return ret_val;
-}
-
-xmlNode *
-e_table_state_save_to_node (ETableState *state,
- xmlNode *parent)
-{
- int i;
- xmlNode *node;
-
- if (parent)
- node = xmlNewChild (parent, NULL, "ETableState", NULL);
- else
- node = xmlNewNode (NULL, "ETableState");
-
- e_xml_set_double_prop_by_name(node, "state-version", STATE_VERSION);
-
- for (i = 0; i < state->col_count; i++) {
- int column = state->columns[i];
- double expansion = state->expansions[i];
- xmlNode *new_node;
-
- new_node = xmlNewChild(node, NULL, "column", NULL);
- e_xml_set_integer_prop_by_name (new_node, "source", column);
- if (expansion >= -1)
- e_xml_set_double_prop_by_name(new_node, "expansion", expansion);
- }
-
-
- e_table_sort_info_save_to_node(state->sort_info, node);
-
- return node;
-}
-
-/**
- * e_table_state_duplicate:
- * @state: The ETableState to duplicate
- *
- * This creates a copy of the %ETableState @state
- *
- * Returns: The duplicated %ETableState.
- */
-ETableState *
-e_table_state_duplicate (ETableState *state)
-{
- ETableState *new_state;
- char *copy;
-
- g_return_val_if_fail (state != NULL, NULL);
- g_return_val_if_fail (E_IS_TABLE_STATE (state), NULL);
-
- new_state = e_table_state_new ();
- copy = e_table_state_save_to_string (state);
- e_table_state_load_from_string (new_state, copy);
- g_free (copy);
-
- e_table_sort_info_set_can_group
- (new_state->sort_info,
- e_table_sort_info_get_can_group (state->sort_info));
-
- return new_state;
-}
diff --git a/widgets/table/e-table-state.h b/widgets/table/e-table-state.h
deleted file mode 100644
index b4d64ad453..0000000000
--- a/widgets/table/e-table-state.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-state.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_TABLE_STATE_H_
-#define _E_TABLE_STATE_H_
-
-#include <gtk/gtkobject.h>
-#include <gnome-xml/tree.h>
-#include <gal/e-table/e-table-sort-info.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define E_TABLE_STATE_TYPE (e_table_state_get_type ())
-#define E_TABLE_STATE(o) (GTK_CHECK_CAST ((o), E_TABLE_STATE_TYPE, ETableState))
-#define E_TABLE_STATE_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_STATE_TYPE, ETableStateClass))
-#define E_IS_TABLE_STATE(o) (GTK_CHECK_TYPE ((o), E_TABLE_STATE_TYPE))
-#define E_IS_TABLE_STATE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_STATE_TYPE))
-
-typedef struct {
- GtkObject base;
-
- ETableSortInfo *sort_info;
- int col_count;
- int *columns;
- double *expansions;
-} ETableState;
-
-typedef struct {
- GtkObjectClass parent_class;
-} ETableStateClass;
-
-GtkType e_table_state_get_type (void);
-ETableState *e_table_state_new (void);
-
-gboolean e_table_state_load_from_file (ETableState *state,
- const char *filename);
-void e_table_state_load_from_string (ETableState *state,
- const char *xml);
-void e_table_state_load_from_node (ETableState *state,
- const xmlNode *node);
-
-void e_table_state_save_to_file (ETableState *state,
- const char *filename);
-char *e_table_state_save_to_string (ETableState *state);
-xmlNode *e_table_state_save_to_node (ETableState *state,
- xmlNode *parent);
-ETableState *e_table_state_duplicate (ETableState *state);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _E_TABLE_STATE_H_ */
diff --git a/widgets/table/e-table-subset-variable.c b/widgets/table/e-table-subset-variable.c
deleted file mode 100644
index 6d298d6050..0000000000
--- a/widgets/table/e-table-subset-variable.c
+++ /dev/null
@@ -1,256 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-subset-variable.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <stdlib.h>
-#include <string.h>
-#include <gtk/gtksignal.h>
-#include "gal/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);
-
- e_table_model_pre_change(etm);
-
- if (etss->n_map + 1 > etssv->n_vals_allocated){
- etssv->n_vals_allocated += INCREMENT_AMOUNT;
- etss->map_table = g_realloc (etss->map_table, etssv->n_vals_allocated * sizeof(int));
- }
-
- etss->map_table[etss->n_map++] = row;
-
- e_table_model_row_inserted (etm, etss->n_map - 1);
-}
-
-static void
-etssv_add_array (ETableSubsetVariable *etssv,
- const gint *array,
- gint count)
-{
- ETableModel *etm = E_TABLE_MODEL(etssv);
- ETableSubset *etss = E_TABLE_SUBSET(etssv);
- int i;
-
- e_table_model_pre_change(etm);
-
- if (etss->n_map + count > etssv->n_vals_allocated){
- etssv->n_vals_allocated += MAX(INCREMENT_AMOUNT, count);
- etss->map_table = g_realloc (etss->map_table, etssv->n_vals_allocated * sizeof(int));
- }
- for (i = 0; i < count; i++)
- etss->map_table[etss->n_map++] = array[i];
-
- e_table_model_changed (etm);
-}
-
-static void
-etssv_add_all (ETableSubsetVariable *etssv)
-{
- ETableModel *etm = E_TABLE_MODEL(etssv);
- ETableSubset *etss = E_TABLE_SUBSET(etssv);
- int rows;
- int i;
-
- e_table_model_pre_change(etm);
-
- rows = e_table_model_row_count(etss->source);
- if (etss->n_map + rows > etssv->n_vals_allocated){
- etssv->n_vals_allocated += MAX(INCREMENT_AMOUNT, rows);
- etss->map_table = g_realloc (etss->map_table, etssv->n_vals_allocated * sizeof(int));
- }
- for (i = 0; i < rows; i++)
- etss->map_table[etss->n_map++] = i;
-
- 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) {
- e_table_model_pre_change (etm);
- memmove (etss->map_table + i, etss->map_table + i + 1, (etss->n_map - i - 1) * sizeof(int));
- etss->n_map --;
-
- e_table_model_row_deleted (etm, i);
- 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->add_array = etssv_add_array;
- klass->add_all = etssv_add_all;
- 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_unref (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);
-}
-
-void
-e_table_subset_variable_add_array (ETableSubsetVariable *etssv,
- const gint *array,
- gint count)
-{
- g_return_if_fail (etssv != NULL);
- g_return_if_fail (E_IS_TABLE_SUBSET_VARIABLE(etssv));
-
- if (ETSSV_CLASS(etssv)->add_array)
- ETSSV_CLASS (etssv)->add_array (etssv, array, count);
-}
-
-void
-e_table_subset_variable_add_all (ETableSubsetVariable *etssv)
-{
- g_return_if_fail (etssv != NULL);
- g_return_if_fail (E_IS_TABLE_SUBSET_VARIABLE(etssv));
-
- if (ETSSV_CLASS(etssv)->add_all)
- ETSSV_CLASS (etssv)->add_all (etssv);
-}
-
-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_clear (ETableSubsetVariable *etssv)
-{
- ETableModel *etm = E_TABLE_MODEL(etssv);
- ETableSubset *etss = E_TABLE_SUBSET(etssv);
-
- e_table_model_pre_change (etm);
- etss->n_map = 0;
- g_free (etss->map_table);
- etss->map_table = g_new (unsigned int, 1);
- etssv->n_vals_allocated = 1;
-
- e_table_model_changed (etm);
-}
-
-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_decrement (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 eae291b1d2..0000000000
--- a/widgets/table/e-table-subset-variable.h
+++ /dev/null
@@ -1,86 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-subset-variable.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_TABLE_SUBSET_VARIABLE_H_
-#define _E_TABLE_SUBSET_VARIABLE_H_
-
-#include <gtk/gtkobject.h>
-#include <gal/e-table/e-table-subset.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#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);
- void (*add_array) (ETableSubsetVariable *ets,
- const gint *array,
- gint count);
- void (*add_all) (ETableSubsetVariable *ets);
- 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);
-void e_table_subset_variable_add_array (ETableSubsetVariable *ets,
- const gint *array,
- gint count);
-void e_table_subset_variable_add_all (ETableSubsetVariable *ets);
-gboolean e_table_subset_variable_remove (ETableSubsetVariable *ets,
- gint row);
-void e_table_subset_variable_clear (ETableSubsetVariable *ets);
-void e_table_subset_variable_increment (ETableSubsetVariable *ets,
- gint position,
- gint amount);
-void e_table_subset_variable_decrement (ETableSubsetVariable *ets,
- gint position,
- gint amount);
-void e_table_subset_variable_set_allocation (ETableSubsetVariable *ets,
- gint total);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#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 c5399ce402..0000000000
--- a/widgets/table/e-table-subset.c
+++ /dev/null
@@ -1,461 +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.
- * Copyright 1999, 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- * Miguel de Icaza <miguel@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <stdlib.h>
-#include <gtk/gtksignal.h>
-#include "gal/util/e-util.h"
-#include "e-table-subset.h"
-
-static void etss_proxy_model_pre_change_real (ETableSubset *etss, ETableModel *etm);
-static void etss_proxy_model_no_change_real (ETableSubset *etss, ETableModel *etm);
-static void etss_proxy_model_changed_real (ETableSubset *etss, ETableModel *etm);
-static void etss_proxy_model_row_changed_real (ETableSubset *etss, ETableModel *etm, int row);
-static void etss_proxy_model_cell_changed_real (ETableSubset *etss, ETableModel *etm, int col, int row);
-static void etss_proxy_model_rows_inserted_real (ETableSubset *etss, ETableModel *etm, int row, int count);
-static void etss_proxy_model_rows_deleted_real (ETableSubset *etss, ETableModel *etm, int row, int count);
-
-#define PARENT_TYPE E_TABLE_MODEL_TYPE
-#define d(x)
-
-static ETableModelClass *etss_parent_class;
-
-#define ETSS_CLASS(object) (E_TABLE_SUBSET_CLASS(GTK_OBJECT(object)->klass))
-
-static gint
-etss_get_view_row (ETableSubset *etss, int row)
-{
- const int n = etss->n_map;
- const int * const map_table = etss->map_table;
- int i;
-
- int end = MIN(etss->n_map, etss->last_access + 10);
- int start = MAX(0, etss->last_access - 10);
- int initial = MAX (MIN (etss->last_access, end), start);
-
- for (i = initial; i < end; i++) {
- if (map_table [i] == row){
- d(g_print("a) Found %d from %d\n", i, etss->last_access));
- etss->last_access = i;
- return i;
- }
- }
-
- for (i = initial - 1; i >= start; i--) {
- if (map_table [i] == row){
- d(g_print("b) Found %d from %d\n", i, etss->last_access));
- etss->last_access = i;
- return i;
- }
- }
-
- for (i = 0; i < n; i++){
- if (map_table [i] == row){
- d(g_print("c) Found %d from %d\n", i, etss->last_access));
- etss->last_access = i;
- return i;
- }
- }
- return -1;
-}
-
-static void
-etss_destroy (GtkObject *object)
-{
- ETableSubset *etss = E_TABLE_SUBSET (object);
-
- if (etss->source) {
- gtk_signal_disconnect (GTK_OBJECT (etss->source),
- etss->table_model_pre_change_id);
- gtk_signal_disconnect (GTK_OBJECT (etss->source),
- etss->table_model_no_change_id);
- 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);
- gtk_signal_disconnect (GTK_OBJECT (etss->source),
- etss->table_model_rows_inserted_id);
- gtk_signal_disconnect (GTK_OBJECT (etss->source),
- etss->table_model_rows_deleted_id);
-
- gtk_object_unref (GTK_OBJECT (etss->source));
- etss->source = NULL;
-
- etss->table_model_changed_id = 0;
- etss->table_model_row_changed_id = 0;
- etss->table_model_cell_changed_id = 0;
- etss->table_model_rows_inserted_id = 0;
- etss->table_model_rows_deleted_id = 0;
- }
-
- g_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;
-
- etss->last_access = row;
- d(g_print("g) Setting last_access to %d\n", row));
- 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;
-
- etss->last_access = row;
- d(g_print("h) Setting last_access to %d\n", row));
- 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 gboolean
-etss_has_save_id (ETableModel *etm)
-{
- return TRUE;
-}
-
-static char *
-etss_get_save_id (ETableModel *etm, int row)
-{
- ETableSubset *etss = (ETableSubset *)etm;
-
- if (e_table_model_has_save_id (etss->source))
- return e_table_model_get_save_id (etss->source, etss->map_table [row]);
- else
- return g_strdup_printf ("%d", etss->map_table[row]);
-}
-
-static void
-etss_append_row (ETableModel *etm, ETableModel *source, int row)
-{
- ETableSubset *etss = (ETableSubset *)etm;
- e_table_model_append_row (etss->source, source, 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_initialize_value (ETableModel *etm, int col)
-{
- ETableSubset *etss = (ETableSubset *)etm;
-
- return e_table_model_initialize_value (etss->source, col);
-}
-
-static gboolean
-etss_value_is_empty (ETableModel *etm, int col, const void *value)
-{
- ETableSubset *etss = (ETableSubset *)etm;
-
- return e_table_model_value_is_empty (etss->source, col, value);
-}
-
-static char *
-etss_value_to_string (ETableModel *etm, int col, const void *value)
-{
- ETableSubset *etss = (ETableSubset *)etm;
-
- return e_table_model_value_to_string (etss->source, col, value);
-}
-
-static void
-etss_class_init (GtkObjectClass *object_class)
-{
- ETableSubsetClass *klass = (ETableSubsetClass *) object_class;
- ETableModelClass *table_class = (ETableModelClass *) object_class;
-
- etss_parent_class = gtk_type_class (PARENT_TYPE);
-
- object_class->destroy = etss_destroy;
-
- table_class->column_count = etss_column_count;
- table_class->row_count = etss_row_count;
- table_class->append_row = etss_append_row;
-
- 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->has_save_id = etss_has_save_id;
- table_class->get_save_id = etss_get_save_id;
-
- table_class->duplicate_value = etss_duplicate_value;
- table_class->free_value = etss_free_value;
- table_class->initialize_value = etss_initialize_value;
- table_class->value_is_empty = etss_value_is_empty;
- table_class->value_to_string = etss_value_to_string;
-
- klass->proxy_model_pre_change = etss_proxy_model_pre_change_real;
- klass->proxy_model_no_change = etss_proxy_model_no_change_real;
- klass->proxy_model_changed = etss_proxy_model_changed_real;
- klass->proxy_model_row_changed = etss_proxy_model_row_changed_real;
- klass->proxy_model_cell_changed = etss_proxy_model_cell_changed_real;
- klass->proxy_model_rows_inserted = etss_proxy_model_rows_inserted_real;
- klass->proxy_model_rows_deleted = etss_proxy_model_rows_deleted_real;
-}
-
-static void
-etss_init (ETableSubset *etss)
-{
- etss->last_access = 0;
-}
-
-E_MAKE_TYPE(e_table_subset, "ETableSubset", ETableSubset, etss_class_init, etss_init, PARENT_TYPE);
-
-static void
-etss_proxy_model_pre_change_real (ETableSubset *etss, ETableModel *etm)
-{
- e_table_model_pre_change (E_TABLE_MODEL (etss));
-}
-
-static void
-etss_proxy_model_no_change_real (ETableSubset *etss, ETableModel *etm)
-{
- e_table_model_no_change (E_TABLE_MODEL (etss));
-}
-
-static void
-etss_proxy_model_changed_real (ETableSubset *etss, ETableModel *etm)
-{
- e_table_model_changed (E_TABLE_MODEL (etss));
-}
-
-static void
-etss_proxy_model_row_changed_real (ETableSubset *etss, ETableModel *etm, int row)
-{
- int view_row = etss_get_view_row (etss, row);
- if (view_row != -1)
- e_table_model_row_changed (E_TABLE_MODEL (etss), view_row);
- else
- e_table_model_no_change (E_TABLE_MODEL (etss));
-}
-
-static void
-etss_proxy_model_cell_changed_real (ETableSubset *etss, ETableModel *etm, int col, int row)
-{
- int view_row = etss_get_view_row (etss, row);
- if (view_row != -1)
- e_table_model_cell_changed (E_TABLE_MODEL (etss), col, view_row);
- else
- e_table_model_no_change (E_TABLE_MODEL (etss));
-}
-
-static void
-etss_proxy_model_rows_inserted_real (ETableSubset *etss, ETableModel *etm, int row, int count)
-{
- e_table_model_no_change (E_TABLE_MODEL (etss));
-}
-
-static void
-etss_proxy_model_rows_deleted_real (ETableSubset *etss, ETableModel *etm, int row, int count)
-{
- e_table_model_no_change (E_TABLE_MODEL (etss));
-}
-
-static void
-etss_proxy_model_pre_change (ETableModel *etm, ETableSubset *etss)
-{
- if (ETSS_CLASS(etss)->proxy_model_pre_change)
- (ETSS_CLASS(etss)->proxy_model_pre_change) (etss, etm);
-}
-
-static void
-etss_proxy_model_no_change (ETableModel *etm, ETableSubset *etss)
-{
- if (ETSS_CLASS(etss)->proxy_model_no_change)
- (ETSS_CLASS(etss)->proxy_model_no_change) (etss, etm);
-}
-
-static void
-etss_proxy_model_changed (ETableModel *etm, ETableSubset *etss)
-{
- if (ETSS_CLASS(etss)->proxy_model_changed)
- (ETSS_CLASS(etss)->proxy_model_changed) (etss, etm);
-}
-
-static void
-etss_proxy_model_row_changed (ETableModel *etm, int row, ETableSubset *etss)
-{
- if (ETSS_CLASS(etss)->proxy_model_row_changed)
- (ETSS_CLASS(etss)->proxy_model_row_changed) (etss, etm, row);
-}
-
-static void
-etss_proxy_model_cell_changed (ETableModel *etm, int row, int col, ETableSubset *etss)
-{
- if (ETSS_CLASS(etss)->proxy_model_cell_changed)
- (ETSS_CLASS(etss)->proxy_model_cell_changed) (etss, etm, col, row);
-}
-
-static void
-etss_proxy_model_rows_inserted (ETableModel *etm, int row, int col, ETableSubset *etss)
-{
- if (ETSS_CLASS(etss)->proxy_model_rows_inserted)
- (ETSS_CLASS(etss)->proxy_model_rows_inserted) (etss, etm, row, col);
-}
-
-static void
-etss_proxy_model_rows_deleted (ETableModel *etm, int row, int col, ETableSubset *etss)
-{
- if (ETSS_CLASS(etss)->proxy_model_rows_deleted)
- (ETSS_CLASS(etss)->proxy_model_rows_deleted) (etss, etm, row, col);
-}
-
-ETableModel *
-e_table_subset_construct (ETableSubset *etss, ETableModel *source, int nvals)
-{
- unsigned int *buffer;
- int i;
-
- if (nvals) {
- buffer = (unsigned int *) g_malloc (sizeof (unsigned int) * nvals);
- if (buffer == NULL)
- return NULL;
- } else
- buffer = 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_pre_change_id = gtk_signal_connect (GTK_OBJECT (source), "model_pre_change",
- GTK_SIGNAL_FUNC (etss_proxy_model_pre_change), etss);
- etss->table_model_no_change_id = gtk_signal_connect (GTK_OBJECT (source), "model_no_change",
- GTK_SIGNAL_FUNC (etss_proxy_model_no_change), etss);
- 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);
- etss->table_model_rows_inserted_id = gtk_signal_connect (GTK_OBJECT (source), "model_rows_inserted",
- GTK_SIGNAL_FUNC (etss_proxy_model_rows_inserted), etss);
- etss->table_model_rows_deleted_id = gtk_signal_connect (GTK_OBJECT (source), "model_rows_deleted",
- GTK_SIGNAL_FUNC (etss_proxy_model_rows_deleted), 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_unref (GTK_OBJECT (etss));
- return NULL;
- }
-
- return (ETableModel *) etss;
-}
-
-int e_table_subset_model_to_view_row (ETableSubset *ets,
- int model_row)
-{
- int i;
- for (i = 0; i < ets->n_map; i++) {
- if (ets->map_table[i] == model_row)
- return i;
- }
- return -1;
-}
-
-int e_table_subset_view_to_model_row (ETableSubset *ets,
- int view_row)
-{
- if (view_row >= 0 && view_row < ets->n_map)
- return ets->map_table[view_row];
- else
- return -1;
-}
-
-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;
-}
-
-void
-e_table_subset_print_debugging (ETableSubset *table_model)
-{
- int i;
- for (i = 0; i < table_model->n_map; i++) {
- g_print("%8d\n", table_model->map_table[i]);
- }
-}
diff --git a/widgets/table/e-table-subset.h b/widgets/table/e-table-subset.h
deleted file mode 100644
index d677583249..0000000000
--- a/widgets/table/e-table-subset.h
+++ /dev/null
@@ -1,92 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-subset.h - Implements a table that contains a subset of another table.
- * Copyright 1999, 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- * Miguel de Icaza <miguel@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_TABLE_SUBSET_H_
-#define _E_TABLE_SUBSET_H_
-
-#include <gtk/gtkobject.h>
-#include <gal/e-table/e-table-model.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#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 last_access;
-
- int table_model_pre_change_id;
- int table_model_no_change_id;
- int table_model_changed_id;
- int table_model_row_changed_id;
- int table_model_cell_changed_id;
- int table_model_rows_inserted_id;
- int table_model_rows_deleted_id;
-} ETableSubset;
-
-typedef struct {
- ETableModelClass parent_class;
-
- void (*proxy_model_pre_change) (ETableSubset *etss, ETableModel *etm);
- void (*proxy_model_no_change) (ETableSubset *etss, ETableModel *etm);
- void (*proxy_model_changed) (ETableSubset *etss, ETableModel *etm);
- void (*proxy_model_row_changed) (ETableSubset *etss, ETableModel *etm, int row);
- void (*proxy_model_cell_changed) (ETableSubset *etss, ETableModel *etm, int col, int row);
- void (*proxy_model_rows_inserted) (ETableSubset *etss, ETableModel *etm, int row, int count);
- void (*proxy_model_rows_deleted) (ETableSubset *etss, ETableModel *etm, int row, int count);
-} 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);
-
-int e_table_subset_model_to_view_row (ETableSubset *ets,
- int model_row);
-int e_table_subset_view_to_model_row (ETableSubset *ets,
- int view_row);
-
-ETableModel *e_table_subset_get_toplevel (ETableSubset *table_model);
-
-void e_table_subset_print_debugging (ETableSubset *table_model);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _E_TABLE_SUBSET_H_ */
-
diff --git a/widgets/table/e-table-tooltip.h b/widgets/table/e-table-tooltip.h
deleted file mode 100644
index 0438b52f40..0000000000
--- a/widgets/table/e-table-tooltip.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-tooltip.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_TABLE_TOOLTIP_H_
-#define _E_TABLE_TOOLTIP_H_
-
-#include <libgnomeui/gnome-canvas.h>
-#include <libgnome/gnome-defs.h>
-
-BEGIN_GNOME_DECLS
-
-typedef struct {
- gint timer;
- int col, row;
- int row_height;
- int x, y;
- int cx, cy;
- GdkColor *foreground;
- GdkColor *background;
- GnomeCanvasItem *eti;
-} ETableTooltip;
-
-END_GNOME_DECLS
-
-#endif
diff --git a/widgets/table/e-table-tree.h b/widgets/table/e-table-tree.h
deleted file mode 100644
index b99372a474..0000000000
--- a/widgets/table/e-table-tree.h
+++ /dev/null
@@ -1,49 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-tree.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_TABLE_TREE_H_
-#define _E_TABLE_TREE_H_
-
-#include <gal/e-table/e-table-model.h>
-#include <libgnome/gnome-defs.h>
-
-BEGIN_GNOME_DECLS
-
-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);
-
-END_GNOME_DECLS
-
-#endif /* _E_TABLE_TREE_H_ */
diff --git a/widgets/table/e-table-utils.c b/widgets/table/e-table-utils.c
deleted file mode 100644
index a155d49b0a..0000000000
--- a/widgets/table/e-table-utils.c
+++ /dev/null
@@ -1,131 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-utils.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include "gal/util/e-i18n.h"
-#include "gal/util/e-util.h"
-#include "e-table-utils.h"
-#include "e-table-header-utils.h"
-
-ETableHeader *
-e_table_state_to_header (GtkWidget *widget, ETableHeader *full_header, ETableState *state)
-{
- ETableHeader *nh;
- const int max_cols = e_table_header_count (full_header);
- int column;
-
- g_return_val_if_fail (widget, NULL);
- g_return_val_if_fail (full_header, NULL);
- g_return_val_if_fail (state, NULL);
-
- nh = e_table_header_new ();
-
- gtk_object_set(GTK_OBJECT(nh),
- "width_extras", e_table_header_width_extras(widget->style),
- NULL);
-
- for (column = 0; column < state->col_count; column++) {
- int col;
- double expansion;
- ETableCol *table_col;
-
- col = state->columns[column];
- expansion = state->expansions[column];
-
- if (col >= max_cols)
- continue;
-
- table_col = e_table_header_get_column (full_header, col);
-
- if (expansion >= -1)
- table_col->expansion = expansion;
-
- e_table_header_add_column (nh, table_col, -1);
- }
-
- return nh;
-}
-
-static ETableCol *
-et_col_spec_to_col (ETableColumnSpecification *col_spec,
- ETableExtras *ete)
-{
- ETableCol *col = NULL;
- ECell *cell = NULL;
- GCompareFunc compare = NULL;
- ETableSearchFunc search = NULL;
-
- if (col_spec->cell)
- cell = e_table_extras_get_cell(ete, col_spec->cell);
- if (col_spec->compare)
- compare = e_table_extras_get_compare(ete, col_spec->compare);
- if (col_spec->search)
- search = e_table_extras_get_search(ete, col_spec->search);
-
- if (cell && compare) {
- if (col_spec->pixbuf && *col_spec->pixbuf) {
- GdkPixbuf *pixbuf;
-
- pixbuf = e_table_extras_get_pixbuf(
- ete, col_spec->pixbuf);
- if (pixbuf) {
- col = e_table_col_new_with_pixbuf (
- col_spec->model_col, gettext (col_spec->title),
- pixbuf, col_spec->expansion,
- col_spec->minimum_width,
- cell, compare, col_spec->resizable, col_spec->disabled, col_spec->priority);
- }
- }
- if (col == NULL && col_spec->title && *col_spec->title) {
- col = e_table_col_new (
- col_spec->model_col, gettext (col_spec->title),
- col_spec->expansion, col_spec->minimum_width,
- cell, compare, col_spec->resizable, col_spec->disabled, col_spec->priority);
- }
- col->search = search;
- }
- return col;
-}
-
-ETableHeader *
-e_table_spec_to_full_header (ETableSpecification *spec,
- ETableExtras *ete)
-{
- ETableHeader *nh;
- int column;
-
- g_return_val_if_fail (spec, NULL);
- g_return_val_if_fail (ete, NULL);
-
- nh = e_table_header_new ();
-
- for (column = 0; spec->columns[column]; column++) {
- ETableCol *col = et_col_spec_to_col (
- spec->columns[column], ete);
-
- if (col)
- e_table_header_add_column (nh, col, -1);
- }
-
- return nh;
-}
diff --git a/widgets/table/e-table-utils.h b/widgets/table/e-table-utils.h
deleted file mode 100644
index e5ac1d8a72..0000000000
--- a/widgets/table/e-table-utils.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-utils.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_TABLE_UTILS_H_
-#define _E_TABLE_UTILS_H_
-
-#include <gal/e-table/e-table-header.h>
-#include <gal/e-table/e-table-state.h>
-#include <gal/e-table/e-table-specification.h>
-#include <gal/e-table/e-table-extras.h>
-#include <libgnome/gnome-defs.h>
-
-BEGIN_GNOME_DECLS
-
-ETableHeader *e_table_state_to_header (GtkWidget *widget,
- ETableHeader *full_header,
- ETableState *state);
-
-ETableHeader *e_table_spec_to_full_header (ETableSpecification *spec,
- ETableExtras *ete);
-
-END_GNOME_DECLS
-
-#endif /* _E_TABLE_UTILS_H_ */
-
diff --git a/widgets/table/e-table-without.c b/widgets/table/e-table-without.c
deleted file mode 100644
index f6d4fe3b86..0000000000
--- a/widgets/table/e-table-without.c
+++ /dev/null
@@ -1,395 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-without.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <stdlib.h>
-#include <string.h>
-#include <gtk/gtksignal.h>
-#include "gal/util/e-util.h"
-#include "e-table-without.h"
-
-#define ETW_CLASS(e) ((ETableWithoutClass *)((GtkObject *)e)->klass)
-
-#define PARENT_TYPE E_TABLE_SUBSET_TYPE
-
-#define INCREMENT_AMOUNT 10
-
-static ETableSubsetClass *parent_class;
-
-struct _ETableWithoutPrivate {
- GHashTable *hash;
-
- GHashFunc hash_func;
- GCompareFunc compare_func;
-
- ETableWithoutGetKeyFunc get_key_func;
- ETableWithoutDuplicateKeyFunc duplicate_key_func;
- ETableWithoutFreeKeyFunc free_gotten_key_func;
- ETableWithoutFreeKeyFunc free_duplicated_key_func;
-
- void *closure;
-};
-
-static gboolean
-check (ETableWithout *etw, int model_row)
-{
- gboolean ret_val;
- void *key;
- ETableSubset *etss = E_TABLE_SUBSET (etw);
-
- if (etw->priv->get_key_func)
- key = etw->priv->get_key_func (etss->source, model_row, etw->priv->closure);
- else
- key = GINT_TO_POINTER (model_row);
- ret_val = (g_hash_table_lookup (etw->priv->hash, key) != NULL);
- if (etw->priv->free_gotten_key_func)
- etw->priv->free_gotten_key_func (key, etw->priv->closure);
- return ret_val;
-}
-
-static gboolean
-check_with_key (ETableWithout *etw, void *key, int model_row)
-{
- gboolean ret_val;
- void *key2;
- ETableSubset *etss = E_TABLE_SUBSET (etw);
-
- if (etw->priv->get_key_func)
- key2 = etw->priv->get_key_func (etss->source, model_row, etw->priv->closure);
- else
- key2 = GINT_TO_POINTER (model_row);
- if (etw->priv->compare_func)
- ret_val = (etw->priv->compare_func (key, key2));
- else
- ret_val = (key == key2);
- if (etw->priv->free_gotten_key_func)
- etw->priv->free_gotten_key_func (key2, etw->priv->closure);
- return ret_val;
-}
-
-static gint
-etw_view_to_model_row (ETableWithout *etw, int view_row)
-{
- ETableSubset *etss = E_TABLE_SUBSET (etw);
- return etss->map_table[view_row];
-}
-
-static void
-add_row (ETableWithout *etw, int model_row)
-{
- ETableSubset *etss = E_TABLE_SUBSET (etw);
-
- e_table_model_pre_change (E_TABLE_MODEL (etw));
-
- etss->map_table = g_renew (int, etss->map_table, etss->n_map + 1);
-
- etss->map_table[etss->n_map++] = model_row;
-
- e_table_model_row_inserted (E_TABLE_MODEL (etw), etss->n_map - 1);
-}
-
-static void
-remove_row (ETableWithout *etw, int view_row)
-{
- ETableSubset *etss = E_TABLE_SUBSET (etw);
-
- e_table_model_pre_change (E_TABLE_MODEL (etw));
- memmove (etss->map_table + view_row, etss->map_table + view_row + 1, (etss->n_map - view_row - 1) * sizeof (int));
- etss->n_map --;
- e_table_model_row_deleted (E_TABLE_MODEL (etw), view_row);
-}
-
-static void
-delete_hash_element (gpointer key,
- gpointer value,
- gpointer closure)
-{
- ETableWithout *etw = closure;
- if (etw->priv->free_duplicated_key_func)
- etw->priv->free_duplicated_key_func (key, etw->priv->closure);
-}
-
-static void
-etw_destroy (GtkObject *object)
-{
- ETableWithout *etw = E_TABLE_WITHOUT (object);
-
- if (etw->priv) {
- if (etw->priv->hash) {
- g_hash_table_foreach (etw->priv->hash, delete_hash_element, etw);
- g_hash_table_destroy (etw->priv->hash);
- etw->priv->hash = NULL;
- }
- g_free (etw->priv);
- etw->priv = NULL;
- }
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-static void
-etw_proxy_model_rows_inserted (ETableSubset *etss, ETableModel *etm, int model_row, int count)
-{
- int i;
- ETableWithout *etw = E_TABLE_WITHOUT (etss);
- gboolean shift = FALSE;
-
- /* i is View row */
- if (model_row != etss->n_map) {
- for (i = 0; i < etss->n_map; i++) {
- if (etss->map_table[i] > model_row)
- etss->map_table[i] += count;
- }
- shift = TRUE;
- }
-
- /* i is Model row */
- for (i = model_row; i < model_row + count; i++) {
- if (!check (etw, i)) {
- add_row (etw, i);
- }
- }
- if (shift)
- e_table_model_changed (E_TABLE_MODEL (etw));
- else
- e_table_model_no_change (E_TABLE_MODEL (etw));
-}
-
-static void
-etw_proxy_model_rows_deleted (ETableSubset *etss, ETableModel *etm, int model_row, int count)
-{
- int i; /* View row */
- ETableWithout *etw = E_TABLE_WITHOUT (etss);
- gboolean shift = FALSE;
-
- for (i = 0; i < etss->n_map; i++) {
- if (etss->map_table[i] >= model_row && etss->map_table[i] < model_row + count) {
- remove_row (etw, i);
- i--;
- } else if (etss->map_table[i] >= model_row + count) {
- etss->map_table[i] -= count;
- shift = TRUE;
- }
- }
- if (shift)
- e_table_model_changed (E_TABLE_MODEL (etw));
- else
- e_table_model_no_change (E_TABLE_MODEL (etw));
-}
-
-static void
-etw_proxy_model_changed (ETableSubset *etss, ETableModel *etm)
-{
- int i; /* Model row */
- int j; /* View row */
- int row_count;
- ETableWithout *etw = E_TABLE_WITHOUT (etss);
-
- g_free (etss->map_table);
- row_count = e_table_model_row_count (etm);
- etss->map_table = g_new (int, row_count);
-
- for (i = 0, j = 0; i < row_count; i++) {
- if (!check (etw, i)) {
- etss->map_table[j++] = i;
- }
- }
- etss->n_map = j;
-
- if (parent_class->proxy_model_changed)
- parent_class->proxy_model_changed (etss, etm);
-}
-
-static void
-etw_class_init (ETableWithoutClass *klass)
-{
- ETableSubsetClass *etss_class = E_TABLE_SUBSET_CLASS (klass);
- GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
-
- parent_class = gtk_type_class (PARENT_TYPE);
-
- object_class->destroy = etw_destroy;
-
- etss_class->proxy_model_rows_inserted = etw_proxy_model_rows_inserted;
- etss_class->proxy_model_rows_deleted = etw_proxy_model_rows_deleted;
- etss_class->proxy_model_changed = etw_proxy_model_changed;
-}
-
-static void
-etw_init (ETableWithout *etw)
-{
- etw->priv = g_new (ETableWithoutPrivate, 1);
- etw->priv->hash_func = NULL;
- etw->priv->compare_func = NULL;
- etw->priv->get_key_func = NULL;
- etw->priv->duplicate_key_func = NULL;
- etw->priv->free_gotten_key_func = NULL;
- etw->priv->free_duplicated_key_func = NULL;
-}
-
-E_MAKE_TYPE(e_table_without, "ETableWithout", ETableWithout, etw_class_init, etw_init, PARENT_TYPE);
-
-ETableModel *
-e_table_without_construct (ETableWithout *etw,
- ETableModel *source,
- GHashFunc hash_func,
- GCompareFunc compare_func,
- ETableWithoutGetKeyFunc get_key_func,
- ETableWithoutDuplicateKeyFunc duplicate_key_func,
- ETableWithoutFreeKeyFunc free_gotten_key_func,
- ETableWithoutFreeKeyFunc free_duplicated_key_func,
- void *closure)
-{
- if (e_table_subset_construct (E_TABLE_SUBSET(etw), source, 1) == NULL)
- return NULL;
- E_TABLE_SUBSET(etw)->n_map = 0;
-
- etw->priv->hash_func = hash_func;
- etw->priv->compare_func = compare_func;
- etw->priv->get_key_func = get_key_func;
- etw->priv->duplicate_key_func = duplicate_key_func;
- etw->priv->free_gotten_key_func = free_gotten_key_func;
- etw->priv->free_duplicated_key_func = free_duplicated_key_func;
- etw->priv->closure = closure;
-
- etw->priv->hash = g_hash_table_new (etw->priv->hash_func, etw->priv->compare_func);
-
- return E_TABLE_MODEL (etw);
-}
-
-ETableModel *
-e_table_without_new (ETableModel *source,
- GHashFunc hash_func,
- GCompareFunc compare_func,
- ETableWithoutGetKeyFunc get_key_func,
- ETableWithoutDuplicateKeyFunc duplicate_key_func,
- ETableWithoutFreeKeyFunc free_gotten_key_func,
- ETableWithoutFreeKeyFunc free_duplicated_key_func,
- void *closure)
-{
- ETableWithout *etw = gtk_type_new (E_TABLE_WITHOUT_TYPE);
-
- if (e_table_without_construct (etw,
- source,
- hash_func,
- compare_func,
- get_key_func,
- duplicate_key_func,
- free_gotten_key_func,
- free_duplicated_key_func,
- closure)
- == NULL) {
- gtk_object_unref (GTK_OBJECT (etw));
- return NULL;
- }
-
- return (ETableModel *) etw;
-}
-
-void e_table_without_hide (ETableWithout *etw,
- void *key)
-{
- int i; /* View row */
- ETableSubset *etss = E_TABLE_SUBSET (etw);
-
- if (etw->priv->duplicate_key_func)
- key = etw->priv->duplicate_key_func (key, etw->priv->closure);
-
- g_hash_table_insert (etw->priv->hash, key, key);
- for (i = 0; i < etss->n_map; i++) {
- if (check_with_key (etw, key, etw_view_to_model_row (etw, i))) {
- remove_row (etw, i);
- i --;
- }
- }
-}
-
-/* An adopted key will later be freed using the free_duplicated_key function. */
-void e_table_without_hide_adopt (ETableWithout *etw,
- void *key)
-{
- int i; /* View row */
- ETableSubset *etss = E_TABLE_SUBSET (etw);
-
- g_hash_table_insert (etw->priv->hash, key, key);
- for (i = 0; i < etss->n_map; i++) {
- if (check_with_key (etw, key, etw_view_to_model_row (etw, i))) {
- remove_row (etw, i);
- i --;
- }
- }
-}
-
-void
-e_table_without_show (ETableWithout *etw,
- void *key)
-{
- int i; /* Model row */
- ETableSubset *etss = E_TABLE_SUBSET (etw);
- int count;
- void *old_key;
-
- count = e_table_model_row_count (etss->source);
-
- for (i = 0; i < count; i++) {
- if (check_with_key (etw, key, i)) {
- add_row (etw, i);
- }
- }
- if (g_hash_table_lookup_extended (etw->priv->hash, key, &old_key, NULL)) {
-#if 0
- if (etw->priv->free_duplicated_key_func)
- etw->priv->free_duplicated_key_func (key, etw->priv->closure);
-#endif
- g_hash_table_remove (etw->priv->hash, key);
- }
-}
-
-void
-e_table_without_show_all (ETableWithout *etw)
-{
- int i; /* Model row */
- int row_count;
- ETableSubset *etss = E_TABLE_SUBSET (etw);
-
- e_table_model_pre_change (E_TABLE_MODEL (etw));
-
- if (etw->priv->hash) {
- g_hash_table_foreach (etw->priv->hash, delete_hash_element, etw);
- g_hash_table_destroy (etw->priv->hash);
- etw->priv->hash = NULL;
- }
- etw->priv->hash = g_hash_table_new (etw->priv->hash_func, etw->priv->compare_func);
-
- row_count = e_table_model_row_count (E_TABLE_MODEL(etss->source));
- g_free (etss->map_table);
- etss->map_table = g_new (int, row_count);
-
- for (i = 0; i < row_count; i++) {
- etss->map_table[i] = i;
- }
- etss->n_map = row_count;
-
- e_table_model_changed (E_TABLE_MODEL (etw));
-}
diff --git a/widgets/table/e-table-without.h b/widgets/table/e-table-without.h
deleted file mode 100644
index 90ab93df9f..0000000000
--- a/widgets/table/e-table-without.h
+++ /dev/null
@@ -1,90 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-without.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_TABLE_WITHOUT_H_
-#define _E_TABLE_WITHOUT_H_
-
-#include <gtk/gtkobject.h>
-#include <gal/e-table/e-table-subset.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#define E_TABLE_WITHOUT_TYPE (e_table_without_get_type ())
-#define E_TABLE_WITHOUT(o) (GTK_CHECK_CAST ((o), E_TABLE_WITHOUT_TYPE, ETableWithout))
-#define E_TABLE_WITHOUT_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_WITHOUT_TYPE, ETableWithoutClass))
-#define E_IS_TABLE_WITHOUT(o) (GTK_CHECK_TYPE ((o), E_TABLE_WITHOUT_TYPE))
-#define E_IS_TABLE_WITHOUT_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_WITHOUT_TYPE))
-
-typedef struct _ETableWithoutPrivate ETableWithoutPrivate;
-typedef void *(*ETableWithoutGetKeyFunc) (ETableModel *source,
- int row,
- void *closure);
-typedef void *(*ETableWithoutDuplicateKeyFunc) (const void *key,
- void *closure);
-typedef void (*ETableWithoutFreeKeyFunc) (void *key,
- void *closure);
-
-typedef struct {
- ETableSubset base;
-
- ETableWithoutPrivate *priv;
-} ETableWithout;
-
-typedef struct {
- ETableSubsetClass parent_class;
-
-} ETableWithoutClass;
-GtkType e_table_without_get_type (void);
-ETableModel *e_table_without_new (ETableModel *source,
- GHashFunc hash_func,
- GCompareFunc compare_func,
- ETableWithoutGetKeyFunc get_key_func,
- ETableWithoutDuplicateKeyFunc duplicate_key_func,
- ETableWithoutFreeKeyFunc free_gotten_key_func,
- ETableWithoutFreeKeyFunc free_duplicated_key_func,
- void *closure);
-ETableModel *e_table_without_construct (ETableWithout *etw,
- ETableModel *source,
- GHashFunc hash_func,
- GCompareFunc compare_func,
- ETableWithoutGetKeyFunc get_key_func,
- ETableWithoutDuplicateKeyFunc duplicate_key_func,
- ETableWithoutFreeKeyFunc free_gotten_key_func,
- ETableWithoutFreeKeyFunc free_duplicated_key_func,
- void *closure);
-void e_table_without_hide (ETableWithout *etw,
- void *key);
-void e_table_without_hide_adopt (ETableWithout *etw,
- void *key);
-void e_table_without_show (ETableWithout *etw,
- void *key);
-void e_table_without_show_all (ETableWithout *etw);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* _E_TABLE_WITHOUT_H_ */
-
diff --git a/widgets/table/e-table.c b/widgets/table/e-table.c
deleted file mode 100644
index 3a321eee00..0000000000
--- a/widgets/table/e-table.c
+++ /dev/null
@@ -1,3147 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table.c - A graphical view of a Table.
- * Copyright 1999, 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- * Miguel de Icaza <miguel@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdio.h>
-#include <gdk/gdkkeysyms.h>
-#include <gtk/gtksignal.h>
-#include <libgnomeui/gnome-canvas.h>
-#include <libgnomeui/gnome-canvas-rect-ellipse.h>
-
-#include "gal/util/e-i18n.h"
-#include "gal/util/e-util.h"
-#include "gal/widgets/e-canvas.h"
-#include "gal/widgets/e-canvas-vbox.h"
-#include "gal/widgets/e-unicode.h"
-#include "e-table.h"
-#include "e-table-header-item.h"
-#include "e-table-header-utils.h"
-#include "e-table-subset.h"
-#include "e-table-item.h"
-#include "e-table-group.h"
-#include "e-table-group-leaf.h"
-#include "e-table-click-to-add.h"
-#include "e-table-specification.h"
-#include "e-table-state.h"
-#include "e-table-column-specification.h"
-
-#include "e-table-utils.h"
-
-#define COLUMN_HEADER_HEIGHT 16
-
-#define PARENT_TYPE gtk_table_get_type ()
-
-#define d(x)
-
-#if d(!)0
-#define e_table_item_leave_edit_(x) (e_table_item_leave_edit((x)), g_print ("%s: e_table_item_leave_edit\n", __FUNCTION__))
-#else
-#define e_table_item_leave_edit_(x) (e_table_item_leave_edit((x)))
-#endif
-
-static GtkObjectClass *parent_class;
-
-enum {
- CURSOR_CHANGE,
- CURSOR_ACTIVATED,
- SELECTION_CHANGE,
- DOUBLE_CLICK,
- RIGHT_CLICK,
- CLICK,
- KEY_PRESS,
- START_DRAG,
- STATE_CHANGE,
- WHITE_SPACE_EVENT,
-
- TABLE_DRAG_BEGIN,
- TABLE_DRAG_END,
- TABLE_DRAG_DATA_GET,
- TABLE_DRAG_DATA_DELETE,
-
- TABLE_DRAG_LEAVE,
- TABLE_DRAG_MOTION,
- TABLE_DRAG_DROP,
- TABLE_DRAG_DATA_RECEIVED,
-
- LAST_SIGNAL
-};
-
-enum {
- ARG_0,
- ARG_LENGTH_THRESHOLD,
- ARG_MODEL,
- ARG_UNIFORM_ROW_HEIGHT,
-};
-
-enum {
- ET_SCROLL_UP = 1 << 0,
- ET_SCROLL_DOWN = 1 << 1,
- ET_SCROLL_LEFT = 1 << 2,
- ET_SCROLL_RIGHT = 1 << 3
-};
-
-static gint et_signals [LAST_SIGNAL] = { 0, };
-
-static void e_table_fill_table (ETable *e_table, ETableModel *model);
-static gboolean changed_idle (gpointer data);
-
-static void et_grab_focus (GtkWidget *widget);
-
-static void et_drag_begin (GtkWidget *widget,
- GdkDragContext *context,
- ETable *et);
-static void et_drag_end (GtkWidget *widget,
- GdkDragContext *context,
- ETable *et);
-static void et_drag_data_get(GtkWidget *widget,
- GdkDragContext *context,
- GtkSelectionData *selection_data,
- guint info,
- guint time,
- ETable *et);
-static void et_drag_data_delete(GtkWidget *widget,
- GdkDragContext *context,
- ETable *et);
-
-static void et_drag_leave(GtkWidget *widget,
- GdkDragContext *context,
- guint time,
- ETable *et);
-static gboolean et_drag_motion(GtkWidget *widget,
- GdkDragContext *context,
- gint x,
- gint y,
- guint time,
- ETable *et);
-static gboolean et_drag_drop(GtkWidget *widget,
- GdkDragContext *context,
- gint x,
- gint y,
- guint time,
- ETable *et);
-static void et_drag_data_received(GtkWidget *widget,
- GdkDragContext *context,
- gint x,
- gint y,
- GtkSelectionData *selection_data,
- guint info,
- guint time,
- ETable *et);
-
-static gint et_focus (GtkContainer *container, GtkDirectionType direction);
-
-static void scroll_off (ETable *et);
-static void scroll_on (ETable *et, guint scroll_direction);
-
-static void
-et_disconnect_model (ETable *et)
-{
- if (et->model == NULL)
- return;
-
- if (et->table_model_change_id != 0)
- gtk_signal_disconnect (GTK_OBJECT (et->model),
- et->table_model_change_id);
- if (et->table_row_change_id != 0)
- gtk_signal_disconnect (GTK_OBJECT (et->model),
- et->table_row_change_id);
- if (et->table_cell_change_id != 0)
- gtk_signal_disconnect (GTK_OBJECT (et->model),
- et->table_cell_change_id);
- if (et->table_rows_inserted_id != 0)
- gtk_signal_disconnect (GTK_OBJECT (et->model),
- et->table_rows_inserted_id);
- if (et->table_rows_deleted_id != 0)
- gtk_signal_disconnect (GTK_OBJECT (et->model),
- et->table_rows_deleted_id);
-
- et->table_model_change_id = 0;
- et->table_row_change_id = 0;
- et->table_cell_change_id = 0;
- et->table_rows_inserted_id = 0;
- et->table_rows_deleted_id = 0;
-}
-
-static void
-e_table_state_change (ETable *et)
-{
- gtk_signal_emit (GTK_OBJECT (et),
- et_signals [STATE_CHANGE]);
-}
-
-#define CHECK_HORIZONTAL(et) if ((et)->horizontal_scrolling || (et)->horizontal_resize) e_table_header_update_horizontal (et->header);
-
-static void
-et_size_request (GtkWidget *widget, GtkRequisition *request)
-{
- ETable *et = E_TABLE (widget);
- if (GTK_WIDGET_CLASS (parent_class)->size_request)
- GTK_WIDGET_CLASS (parent_class)->size_request (widget, request);
- if (et->horizontal_resize)
- request->width = MAX (request->width, et->header_width);
-}
-
-static void
-set_header_width (ETable *et)
-{
- if (et->horizontal_resize) {
- et->header_width = e_table_header_min_width (et->header);
- gtk_widget_queue_resize (GTK_WIDGET (et));
- }
-}
-
-static void
-structure_changed (ETableHeader *header, ETable *et)
-{
- e_table_state_change (et);
- set_header_width (et);
-}
-
-static void
-expansion_changed (ETableHeader *header, ETable *et)
-{
- e_table_state_change (et);
- set_header_width (et);
-}
-
-static void
-dimension_changed (ETableHeader *header, int total_width, ETable *et)
-{
- set_header_width (et);
-}
-
-static void
-disconnect_header (ETable *e_table)
-{
- if (e_table->header == NULL)
- return;
-
- if (e_table->structure_change_id)
- gtk_signal_disconnect (GTK_OBJECT (e_table->header),
- e_table->structure_change_id);
- if (e_table->expansion_change_id)
- gtk_signal_disconnect (GTK_OBJECT (e_table->header),
- e_table->expansion_change_id);
- if (e_table->dimension_change_id)
- gtk_signal_disconnect (GTK_OBJECT (e_table->header),
- e_table->dimension_change_id);
-
- gtk_object_unref(GTK_OBJECT(e_table->header));
- e_table->header = NULL;
-}
-
-static void
-connect_header (ETable *e_table, ETableState *state)
-{
- if (e_table->header != NULL)
- disconnect_header (e_table);
-
- e_table->header = e_table_state_to_header (GTK_WIDGET(e_table), e_table->full_header, state);
-
- e_table->structure_change_id =
- gtk_signal_connect (GTK_OBJECT (e_table->header), "structure_change",
- structure_changed, e_table);
- e_table->expansion_change_id =
- gtk_signal_connect (GTK_OBJECT (e_table->header), "expansion_change",
- expansion_changed, e_table);
- e_table->dimension_change_id =
- gtk_signal_connect (GTK_OBJECT (e_table->header), "dimension_change",
- dimension_changed, e_table);
-}
-
-static void
-et_destroy (GtkObject *object)
-{
- ETable *et = E_TABLE (object);
-
- et_disconnect_model (et);
-
- if (et->search) {
- if (et->search_search_id)
- gtk_signal_disconnect (GTK_OBJECT (et->search),
- et->search_search_id);
- if (et->search_accept_id)
- gtk_signal_disconnect (GTK_OBJECT (et->search),
- et->search_accept_id);
- gtk_object_unref (GTK_OBJECT (et->search));
- }
-
- if (et->group_info_change_id)
- gtk_signal_disconnect (GTK_OBJECT (et->sort_info),
- et->group_info_change_id);
- if (et->sort_info_change_id)
- gtk_signal_disconnect (GTK_OBJECT (et->sort_info),
- et->sort_info_change_id);
-
- if (et->reflow_idle_id)
- g_source_remove(et->reflow_idle_id);
- et->reflow_idle_id = 0;
-
- scroll_off (et);
-
- disconnect_header (et);
-
- gtk_object_unref (GTK_OBJECT (et->model));
- gtk_object_unref (GTK_OBJECT (et->full_header));
- gtk_object_unref (GTK_OBJECT (et->sort_info));
- gtk_object_unref (GTK_OBJECT (et->sorter));
- gtk_object_unref (GTK_OBJECT (et->selection));
- if (et->spec)
- gtk_object_unref (GTK_OBJECT (et->spec));
-
- if (et->header_canvas != NULL)
- gtk_widget_destroy (GTK_WIDGET (et->header_canvas));
-
- if (et->site != NULL)
- e_table_drag_source_unset (et);
-
- gtk_widget_destroy (GTK_WIDGET (et->table_canvas));
-
- if (et->rebuild_idle_id) {
- g_source_remove (et->rebuild_idle_id);
- et->rebuild_idle_id = 0;
- }
-
- g_free(et->click_to_add_message);
-
- (*parent_class->destroy)(object);
-}
-
-static void
-et_unrealize (GtkWidget *widget)
-{
- scroll_off (E_TABLE (widget));
-
- if (GTK_WIDGET_CLASS (parent_class)->unrealize)
- GTK_WIDGET_CLASS (parent_class)->unrealize (widget);
-}
-
-static gboolean
-check_row (ETable *et, int model_row, int col, ETableSearchFunc search, char *string)
-{
- const void *value;
-
- value = e_table_model_value_at (et->model, col, model_row);
-
- return search (value, string);
-}
-
-static gboolean
-et_search_search (ETableSearch *search, char *string, ETableSearchFlags flags, ETable *et)
-{
- int cursor;
- int rows;
- int i;
- int col;
- ETableSearchFunc search_func;
-
- col = et->current_search_col;
- if (col == -1)
- return FALSE;
-
- rows = e_table_model_row_count (et->model);
-
- search_func = et->current_search;
-
- gtk_object_get(GTK_OBJECT(et->selection),
- "cursor_row", &cursor,
- NULL);
-
- if ((flags & E_TABLE_SEARCH_FLAGS_CHECK_CURSOR_FIRST) && cursor < rows && cursor >= 0 && check_row (et, cursor, col, search_func, string))
- return TRUE;
-
- cursor = e_sorter_model_to_sorted (E_SORTER (et->sorter), cursor);
-
- for (i = cursor + 1; i < rows; i++) {
- int model_row = e_sorter_sorted_to_model (E_SORTER (et->sorter), i);
- if (check_row (et, model_row, col, search_func, string)) {
- e_selection_model_select_as_key_press(E_SELECTION_MODEL (et->selection), model_row, col, GDK_CONTROL_MASK);
- return TRUE;
- }
- }
-
- for (i = 0; i < cursor; i++) {
- int model_row = e_sorter_sorted_to_model (E_SORTER (et->sorter), i);
- if (check_row (et, model_row, col, search_func, string)) {
- e_selection_model_select_as_key_press(E_SELECTION_MODEL (et->selection), model_row, col, GDK_CONTROL_MASK);
- return TRUE;
- }
- }
-
- cursor = e_sorter_sorted_to_model (E_SORTER (et->sorter), cursor);
-
- /* Check if the cursor row is the only matching row. */
- return (!(flags & E_TABLE_SEARCH_FLAGS_CHECK_CURSOR_FIRST) && cursor < rows && cursor >= 0 && check_row (et, cursor, col, search_func, string));
-}
-
-static void
-et_search_accept (ETableSearch *search, ETable *et)
-{
- int col, cursor;
-
- col = et->current_search_col;
- if (col == -1)
- return;
-
- gtk_object_get(GTK_OBJECT(et->selection),
- "cursor_row", &cursor,
- NULL);
- e_selection_model_select_as_key_press(E_SELECTION_MODEL (et->selection), cursor, col, 0);
-}
-
-static void
-e_table_init (GtkObject *object)
-{
- ETable *e_table = E_TABLE (object);
- GtkTable *gtk_table = GTK_TABLE (object);
-
- GTK_WIDGET_SET_FLAGS (e_table, GTK_CAN_FOCUS);
-
- gtk_table->homogeneous = FALSE;
-
- e_table->sort_info = NULL;
- e_table->group_info_change_id = 0;
- e_table->sort_info_change_id = 0;
- e_table->structure_change_id = 0;
- e_table->expansion_change_id = 0;
- e_table->dimension_change_id = 0;
- e_table->reflow_idle_id = 0;
- e_table->scroll_idle_id = 0;
-
- e_table->alternating_row_colors = 1;
- e_table->horizontal_draw_grid = 1;
- e_table->vertical_draw_grid = 1;
- e_table->draw_focus = 1;
- e_table->cursor_mode = E_CURSOR_SIMPLE;
- e_table->length_threshold = 200;
- e_table->uniform_row_height = FALSE;
-
- e_table->need_rebuild = 0;
- e_table->rebuild_idle_id = 0;
-
- e_table->horizontal_scrolling = FALSE;
- e_table->horizontal_resize = FALSE;
-
- e_table->click_to_add_message = NULL;
-
- e_table->drag_get_data_row = -1;
- e_table->drag_get_data_col = -1;
- e_table->drop_row = -1;
- e_table->drop_col = -1;
- e_table->site = NULL;
-
- e_table->do_drag = 0;
-
- e_table->sorter = NULL;
- e_table->selection = e_table_selection_model_new();
- e_table->cursor_loc = E_TABLE_CURSOR_LOC_NONE;
- e_table->spec = NULL;
-
- e_table->search = e_table_search_new();
-
- e_table->search_search_id =
- gtk_signal_connect (GTK_OBJECT (e_table->search), "search",
- GTK_SIGNAL_FUNC (et_search_search), e_table);
- e_table->search_accept_id =
- gtk_signal_connect (GTK_OBJECT (e_table->search), "accept",
- GTK_SIGNAL_FUNC (et_search_accept), e_table);
-
- e_table->current_search = NULL;
- e_table->current_search_col = -1;
-
- e_table->header_width = 0;
-}
-
-/* Grab_focus handler for the ETable */
-static void
-et_grab_focus (GtkWidget *widget)
-{
- ETable *e_table;
-
- e_table = E_TABLE (widget);
-
- gtk_widget_grab_focus (GTK_WIDGET (e_table->table_canvas));
-}
-
-/* Focus handler for the ETable */
-static gint
-et_focus (GtkContainer *container, GtkDirectionType direction)
-{
- ETable *e_table;
-
- e_table = E_TABLE (container);
-
- if (container->focus_child) {
- gtk_container_set_focus_child (container, NULL);
- return FALSE;
- }
-
- return gtk_container_focus (GTK_CONTAINER (e_table->table_canvas), direction);
-}
-
-static void
-set_header_canvas_width (ETable *e_table)
-{
- double oldwidth, oldheight, width;
-
- if (!(e_table->header_item && e_table->header_canvas && e_table->table_canvas))
- return;
-
- gnome_canvas_get_scroll_region (GNOME_CANVAS (e_table->table_canvas),
- NULL, NULL, &width, NULL);
- gnome_canvas_get_scroll_region (GNOME_CANVAS (e_table->header_canvas),
- NULL, NULL, &oldwidth, &oldheight);
-
- if (oldwidth != width ||
- oldheight != E_TABLE_HEADER_ITEM (e_table->header_item)->height - 1)
- gnome_canvas_set_scroll_region (
- GNOME_CANVAS (e_table->header_canvas),
- 0, 0, width, /* COLUMN_HEADER_HEIGHT - 1 */
- E_TABLE_HEADER_ITEM (e_table->header_item)->height - 1);
-
-}
-
-static void
-header_canvas_size_allocate (GtkWidget *widget, GtkAllocation *alloc, ETable *e_table)
-{
- set_header_canvas_width (e_table);
-
- /* When the header item is created ->height == 0,
- as the font is only created when everything is realized.
- So we set the usize here as well, so that the size of the
- header is correct */
- if (GTK_WIDGET (e_table->header_canvas)->allocation.height !=
- E_TABLE_HEADER_ITEM (e_table->header_item)->height)
- gtk_widget_set_usize (GTK_WIDGET (e_table->header_canvas), -2,
- E_TABLE_HEADER_ITEM (e_table->header_item)->height);
-}
-
-static void
-group_info_changed (ETableSortInfo *info, ETable *et)
-{
- gboolean will_be_grouped = e_table_sort_info_grouping_get_count(info) > 0;
- if (et->is_grouped || will_be_grouped) {
- et->need_rebuild = TRUE;
- if (!et->rebuild_idle_id) {
- gtk_object_destroy (GTK_OBJECT (et->group));
- et->group = NULL;
- et->rebuild_idle_id = g_idle_add_full (20, changed_idle, et, NULL);
- }
- }
- e_table_state_change (et);
-}
-
-static void
-sort_info_changed (ETableSortInfo *info, ETable *et)
-{
- e_table_state_change (et);
-}
-
-static void
-e_table_setup_header (ETable *e_table)
-{
- char *pointer;
- e_table->header_canvas = GNOME_CANVAS (e_canvas_new ());
- GTK_WIDGET_UNSET_FLAGS (e_table->header_canvas, GTK_CAN_FOCUS);
-
- gtk_widget_show (GTK_WIDGET (e_table->header_canvas));
-
- pointer = g_strdup_printf("%p", e_table);
-
- 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,
- "full_header", e_table->full_header,
- "sort_info", e_table->sort_info,
- "dnd_code", pointer,
- "table", e_table,
- NULL);
-
- g_free(pointer);
-
- gtk_signal_connect (
- GTK_OBJECT (e_table->header_canvas), "size_allocate",
- GTK_SIGNAL_FUNC (header_canvas_size_allocate), e_table);
-
- gtk_widget_set_usize (GTK_WIDGET (e_table->header_canvas), -2,
- E_TABLE_HEADER_ITEM (e_table->header_item)->height);
-}
-
-static gboolean
-table_canvas_reflow_idle (ETable *e_table)
-{
- gdouble height, width;
- gdouble item_height;
- gdouble oldheight, oldwidth;
- GtkAllocation *alloc = &(GTK_WIDGET (e_table->table_canvas)->allocation);
-
- gtk_object_get (GTK_OBJECT (e_table->canvas_vbox),
- "height", &height,
- "width", &width,
- NULL);
- item_height = height;
- height = MAX ((int)height, alloc->height);
- width = MAX((int)width, alloc->width);
- /* I have no idea why this needs to be -1, but it works. */
- gnome_canvas_get_scroll_region (GNOME_CANVAS (e_table->table_canvas),
- NULL, NULL, &oldwidth, &oldheight);
-
- if (oldwidth != width - 1 ||
- oldheight != height - 1) {
- gnome_canvas_set_scroll_region (GNOME_CANVAS (e_table->table_canvas),
- 0, 0, width - 1, height - 1);
- set_header_canvas_width (e_table);
- }
- gtk_object_set (GTK_OBJECT (e_table->white_item),
- "y1", item_height,
- "x2", width,
- "y2", height,
- NULL);
- e_table->reflow_idle_id = 0;
- return FALSE;
-}
-
-static void
-table_canvas_size_allocate (GtkWidget *widget, GtkAllocation *alloc,
- ETable *e_table)
-{
- gdouble width;
- gdouble height;
- gdouble item_height;
-
- width = alloc->width;
- gtk_object_get (GTK_OBJECT (e_table->canvas_vbox),
- "height", &height,
- NULL);
- item_height = height;
- height = MAX ((int)height, alloc->height);
-
- gtk_object_set (GTK_OBJECT (e_table->canvas_vbox),
- "width", width,
- NULL);
- gtk_object_set (GTK_OBJECT (e_table->header),
- "width", width,
- NULL);
- gtk_object_set (GTK_OBJECT (e_table->white_item),
- "y1", item_height + 1,
- "x2", width,
- "y2", height,
- NULL);
- if (e_table->reflow_idle_id)
- g_source_remove(e_table->reflow_idle_id);
- table_canvas_reflow_idle(e_table);
-}
-
-static void
-table_canvas_reflow (GnomeCanvas *canvas, ETable *e_table)
-{
- if (!e_table->reflow_idle_id)
- e_table->reflow_idle_id = g_idle_add_full (400, (GSourceFunc) table_canvas_reflow_idle, e_table, NULL);
-}
-
-static void
-click_to_add_cursor_change (ETableClickToAdd *etcta, int row, int col, ETable *et)
-{
- if (et->cursor_loc == E_TABLE_CURSOR_LOC_TABLE) {
- e_selection_model_clear(E_SELECTION_MODEL (et->selection));
- }
- et->cursor_loc = E_TABLE_CURSOR_LOC_ETCTA;
-}
-
-static void
-group_cursor_change (ETableGroup *etg, int row, ETable *et)
-{
- ETableCursorLoc old_cursor_loc;
-
- old_cursor_loc = et->cursor_loc;
-
- et->cursor_loc = E_TABLE_CURSOR_LOC_TABLE;
- gtk_signal_emit (GTK_OBJECT (et),
- et_signals [CURSOR_CHANGE],
- row);
-
- if (old_cursor_loc == E_TABLE_CURSOR_LOC_ETCTA && et->click_to_add)
- e_table_click_to_add_commit(E_TABLE_CLICK_TO_ADD(et->click_to_add));
-}
-
-static void
-group_cursor_activated (ETableGroup *etg, int row, ETable *et)
-{
- gtk_signal_emit (GTK_OBJECT (et),
- et_signals [CURSOR_ACTIVATED],
- row);
-}
-
-static void
-group_double_click (ETableGroup *etg, int row, int col, GdkEvent *event, ETable *et)
-{
- gtk_signal_emit (GTK_OBJECT (et),
- et_signals [DOUBLE_CLICK],
- row, col, event);
-}
-
-static gint
-group_right_click (ETableGroup *etg, int row, int col, GdkEvent *event, ETable *et)
-{
- int return_val = 0;
- gtk_signal_emit (GTK_OBJECT (et),
- et_signals [RIGHT_CLICK],
- row, col, event, &return_val);
- return return_val;
-}
-
-static gint
-group_click (ETableGroup *etg, int row, int col, GdkEvent *event, ETable *et)
-{
- int return_val = 0;
- gtk_signal_emit (GTK_OBJECT (et),
- et_signals [CLICK],
- row, col, event, &return_val);
- return return_val;
-}
-
-static gint
-group_key_press (ETableGroup *etg, int row, int col, GdkEvent *event, ETable *et)
-{
- int return_val = 0;
- GdkEventKey *key = (GdkEventKey *) event;
- int y, row_local, col_local;
- GtkAdjustment *vadj;
-
- switch (key->keyval) {
- case GDK_Page_Down:
- case GDK_KP_Page_Down:
- vadj = gtk_layout_get_vadjustment (GTK_LAYOUT (et->table_canvas));
- y = CLAMP(vadj->value + (2 * vadj->page_size - 50), 0, vadj->upper);
- y -= vadj->value;
- e_table_get_cell_at (et, 30, y, &row_local, &col_local);
-
- if (row_local == -1)
- row_local = e_table_model_row_count (et->model) - 1;
-
- row_local = e_table_view_to_model_row (et, row_local);
- col_local = e_selection_model_cursor_col (E_SELECTION_MODEL (et->selection));
- e_selection_model_select_as_key_press (E_SELECTION_MODEL (et->selection), row_local, col_local, key->state);
- return_val = 1;
- break;
- case GDK_Page_Up:
- case GDK_KP_Page_Up:
- vadj = gtk_layout_get_vadjustment (GTK_LAYOUT (et->table_canvas));
- y = CLAMP(vadj->value - (vadj->page_size - 50), 0, vadj->upper);
- y -= vadj->value;
- e_table_get_cell_at (et, 30, y, &row_local, &col_local);
-
- if (row_local == -1)
- row_local = 0;
-
- row_local = e_table_view_to_model_row (et, row_local);
- col_local = e_selection_model_cursor_col (E_SELECTION_MODEL (et->selection));
- e_selection_model_select_as_key_press (E_SELECTION_MODEL (et->selection), row_local, col_local, key->state);
- return_val = 1;
- break;
- case GDK_BackSpace:
- if (e_table_search_backspace (et->search))
- return TRUE;
- /* Fall through */
- default:
- if ((key->state & ~(GDK_SHIFT_MASK | GDK_LOCK_MASK)) == 0
- && ((key->keyval >= GDK_a && key->keyval <= GDK_z) ||
- (key->keyval >= GDK_A && key->keyval <= GDK_Z) ||
- (key->keyval >= GDK_0 && key->keyval <= GDK_9))) {
- e_table_search_input_character (et->search, key->keyval);
- }
- gtk_signal_emit (GTK_OBJECT (et),
- et_signals [KEY_PRESS],
- row, col, event, &return_val);
- break;
- }
- return return_val;
-}
-
-static gint
-group_start_drag (ETableGroup *etg, int row, int col, GdkEvent *event, ETable *et)
-{
- int return_val = 0;
- gtk_signal_emit (GTK_OBJECT (et),
- et_signals [START_DRAG],
- row, col, event, &return_val);
- return return_val;
-}
-
-static void
-et_table_model_changed (ETableModel *model, ETable *et)
-{
- et->need_rebuild = TRUE;
- if (!et->rebuild_idle_id) {
- gtk_object_destroy (GTK_OBJECT (et->group));
- et->group = NULL;
- et->rebuild_idle_id = g_idle_add_full (20, changed_idle, et, NULL);
- }
-}
-
-static void
-et_table_row_changed (ETableModel *table_model, int row, ETable *et)
-{
- if (!et->need_rebuild) {
- if (e_table_group_remove (et->group, row))
- e_table_group_add (et->group, row);
- CHECK_HORIZONTAL(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
-et_table_rows_inserted (ETableModel *table_model, int row, int count, ETable *et)
-{
- /* This number has already been decremented. */
- int row_count = e_table_model_row_count(table_model);
- if (!et->need_rebuild) {
- int i;
- if (row != row_count - count)
- e_table_group_increment(et->group, row, count);
- for (i = 0; i < count; i++)
- e_table_group_add (et->group, row + i);
- CHECK_HORIZONTAL(et);
- }
-}
-
-static void
-et_table_rows_deleted (ETableModel *table_model, int row, int count, ETable *et)
-{
- int row_count = e_table_model_row_count(table_model);
- if (!et->need_rebuild) {
- int i;
- for (i = 0; i < count; i++)
- e_table_group_remove (et->group, row + i);
- if (row != row_count)
- e_table_group_decrement(et->group, row, count);
- CHECK_HORIZONTAL(et);
- }
-}
-
-static void
-et_build_groups (ETable *et)
-{
- gboolean was_grouped = et->is_grouped;
-
- et->is_grouped = e_table_sort_info_grouping_get_count(et->sort_info) > 0;
-
- et->group = e_table_group_new (GNOME_CANVAS_GROUP (et->canvas_vbox),
- et->full_header,
- et->header,
- et->model,
- et->sort_info,
- 0);
-
- if (et->use_click_to_add_end)
- e_canvas_vbox_add_item_start(E_CANVAS_VBOX(et->canvas_vbox), GNOME_CANVAS_ITEM(et->group));
- else
- e_canvas_vbox_add_item(E_CANVAS_VBOX(et->canvas_vbox), GNOME_CANVAS_ITEM(et->group));
-
- gnome_canvas_item_set(GNOME_CANVAS_ITEM(et->group),
- "alternating_row_colors", et->alternating_row_colors,
- "horizontal_draw_grid", et->horizontal_draw_grid,
- "vertical_draw_grid", et->vertical_draw_grid,
- "drawfocus", et->draw_focus,
- "cursor_mode", et->cursor_mode,
- "length_threshold", et->length_threshold,
- "uniform_row_height", et->uniform_row_height,
- "selection_model", et->selection,
- NULL);
-
- gtk_signal_connect (GTK_OBJECT (et->group), "cursor_change",
- GTK_SIGNAL_FUNC (group_cursor_change), et);
- gtk_signal_connect (GTK_OBJECT (et->group), "cursor_activated",
- GTK_SIGNAL_FUNC (group_cursor_activated), et);
- gtk_signal_connect (GTK_OBJECT (et->group), "double_click",
- GTK_SIGNAL_FUNC (group_double_click), et);
- gtk_signal_connect (GTK_OBJECT (et->group), "right_click",
- GTK_SIGNAL_FUNC (group_right_click), et);
- gtk_signal_connect (GTK_OBJECT (et->group), "click",
- GTK_SIGNAL_FUNC (group_click), et);
- gtk_signal_connect (GTK_OBJECT (et->group), "key_press",
- GTK_SIGNAL_FUNC (group_key_press), et);
- gtk_signal_connect (GTK_OBJECT (et->group), "start_drag",
- GTK_SIGNAL_FUNC (group_start_drag), et);
-
-
- if (!(et->is_grouped) && was_grouped)
- et_disconnect_model (et);
-
- if (et->is_grouped && (!was_grouped)) {
- et->table_model_change_id = gtk_signal_connect (GTK_OBJECT (et->model), "model_changed",
- GTK_SIGNAL_FUNC (et_table_model_changed), et);
-
- et->table_row_change_id = gtk_signal_connect (GTK_OBJECT (et->model), "model_row_changed",
- GTK_SIGNAL_FUNC (et_table_row_changed), et);
-
- et->table_cell_change_id = gtk_signal_connect (GTK_OBJECT (et->model), "model_cell_changed",
- GTK_SIGNAL_FUNC (et_table_cell_changed), et);
-
- et->table_rows_inserted_id = gtk_signal_connect (GTK_OBJECT (et->model), "model_rows_inserted",
- GTK_SIGNAL_FUNC (et_table_rows_inserted), et);
-
- et->table_rows_deleted_id = gtk_signal_connect (GTK_OBJECT (et->model), "model_rows_deleted",
- GTK_SIGNAL_FUNC (et_table_rows_deleted), et);
-
- }
-
- if (et->is_grouped)
- e_table_fill_table (et, et->model);
-}
-
-static gboolean
-changed_idle (gpointer data)
-{
- ETable *et = E_TABLE (data);
-
- if (et->need_rebuild) {
- if (et->group)
- gtk_object_destroy (GTK_OBJECT (et->group));
- et_build_groups(et);
- gtk_object_set (GTK_OBJECT (et->canvas_vbox),
- "width", (double) GTK_WIDGET (et->table_canvas)->allocation.width,
- NULL);
-
- if (GTK_WIDGET_REALIZED(et->table_canvas))
- table_canvas_size_allocate (GTK_WIDGET(et->table_canvas), &GTK_WIDGET(et->table_canvas)->allocation, et);
- }
-
- et->need_rebuild = 0;
- et->rebuild_idle_id = 0;
-
- CHECK_HORIZONTAL(et);
-
- return FALSE;
-}
-
-static void
-et_canvas_realize (GtkWidget *canvas, ETable *e_table)
-{
- gnome_canvas_item_set(
- e_table->white_item,
- "fill_color_gdk", &GTK_WIDGET(e_table->table_canvas)->style->base[GTK_STATE_NORMAL],
- NULL);
-
- CHECK_HORIZONTAL(e_table);
- set_header_width (e_table);
-}
-
-static gint
-white_item_event (GnomeCanvasItem *white_item, GdkEvent *event, ETable *e_table)
-{
- int return_val = 0;
- gtk_signal_emit (GTK_OBJECT (e_table),
- et_signals [WHITE_SPACE_EVENT],
- event, &return_val);
- return return_val;
-}
-
-static void
-et_eti_leave_edit (ETable *et)
-{
- GnomeCanvas *canvas = et->table_canvas;
- if (GTK_WIDGET_HAS_FOCUS(canvas)) {
- GnomeCanvasItem *item = GNOME_CANVAS(canvas)->focused_item;
-
- if (E_IS_TABLE_ITEM(item)) {
- e_table_item_leave_edit_(E_TABLE_ITEM(item));
- }
- }
-}
-
-static gint
-et_canvas_root_event (GnomeCanvasItem *root, GdkEvent *event, ETable *e_table)
-{
- switch (event->type) {
- case GDK_BUTTON_PRESS:
- case GDK_2BUTTON_PRESS:
- case GDK_BUTTON_RELEASE:
- if (event->button.button != 4 && event->button.button != 5) {
- et_eti_leave_edit (e_table);
- return TRUE;
- }
- break;
- default:
- break;
- }
-
- return FALSE;
-}
-
-/* Finds the first descendant of the group that is an ETableItem and focuses it */
-static void
-focus_first_etable_item (ETableGroup *group)
-{
- GnomeCanvasGroup *cgroup;
- GList *l;
-
- cgroup = GNOME_CANVAS_GROUP (group);
-
- for (l = cgroup->item_list; l; l = l->next) {
- GnomeCanvasItem *i;
-
- i = GNOME_CANVAS_ITEM (l->data);
-
- if (E_IS_TABLE_GROUP (i))
- focus_first_etable_item (E_TABLE_GROUP (i));
- else if (E_IS_TABLE_ITEM (i)) {
- e_table_item_set_cursor (E_TABLE_ITEM (i), 0, 0);
- gnome_canvas_item_grab_focus (i);
- }
- }
-}
-
-/* Handler for focus events in the table_canvas; we have to repaint ourselves
- * always, and also give the focus to some ETableItem if we get focused.
- */
-static gint
-table_canvas_focus_event_cb (GtkWidget *widget, GdkEventFocus *event, gpointer data)
-{
- GnomeCanvas *canvas;
- ETable *etable;
-
- gtk_widget_queue_draw (widget);
-
- if (!event->in)
- return TRUE;
-
- canvas = GNOME_CANVAS (widget);
- etable = E_TABLE (data);
-
- if (!canvas->focused_item && etable->group)
- focus_first_etable_item (etable->group);
-
- return TRUE;
-}
-
-static void
-e_table_setup_table (ETable *e_table, ETableHeader *full_header, ETableHeader *header,
- ETableModel *model)
-{
- e_table->table_canvas = GNOME_CANVAS (e_canvas_new ());
- gtk_signal_connect (
- GTK_OBJECT (e_table->table_canvas), "size_allocate",
- GTK_SIGNAL_FUNC (table_canvas_size_allocate), e_table);
- gtk_signal_connect (
- GTK_OBJECT (e_table->table_canvas), "focus_in_event",
- GTK_SIGNAL_FUNC (table_canvas_focus_event_cb), e_table);
- gtk_signal_connect (
- GTK_OBJECT (e_table->table_canvas), "focus_out_event",
- GTK_SIGNAL_FUNC (table_canvas_focus_event_cb), e_table);
-
- gtk_signal_connect (
- GTK_OBJECT (e_table), "drag_begin",
- GTK_SIGNAL_FUNC (et_drag_begin), e_table);
- gtk_signal_connect (
- GTK_OBJECT (e_table), "drag_end",
- GTK_SIGNAL_FUNC (et_drag_end), e_table);
- gtk_signal_connect (
- GTK_OBJECT (e_table), "drag_data_get",
- GTK_SIGNAL_FUNC (et_drag_data_get), e_table);
- gtk_signal_connect (
- GTK_OBJECT (e_table), "drag_data_delete",
- GTK_SIGNAL_FUNC (et_drag_data_delete), e_table);
- gtk_signal_connect (
- GTK_OBJECT (e_table), "drag_motion",
- GTK_SIGNAL_FUNC (et_drag_motion), e_table);
- gtk_signal_connect (
- GTK_OBJECT (e_table), "drag_leave",
- GTK_SIGNAL_FUNC (et_drag_leave), e_table);
- gtk_signal_connect (
- GTK_OBJECT (e_table), "drag_drop",
- GTK_SIGNAL_FUNC (et_drag_drop), e_table);
- gtk_signal_connect (
- GTK_OBJECT (e_table), "drag_data_received",
- GTK_SIGNAL_FUNC (et_drag_data_received), e_table);
-
- gtk_signal_connect (GTK_OBJECT(e_table->table_canvas), "reflow",
- GTK_SIGNAL_FUNC (table_canvas_reflow), e_table);
-
- gtk_widget_show (GTK_WIDGET (e_table->table_canvas));
-
-
- e_table->white_item = gnome_canvas_item_new(
- gnome_canvas_root(e_table->table_canvas),
- gnome_canvas_rect_get_type(),
- "x1", (double) 0,
- "y1", (double) 0,
- "x2", (double) 100,
- "y2", (double) 100,
- "fill_color_gdk", &GTK_WIDGET(e_table->table_canvas)->style->base[GTK_STATE_NORMAL],
- NULL);
-
- gtk_signal_connect (GTK_OBJECT (e_table->white_item), "event",
- GTK_SIGNAL_FUNC (white_item_event), e_table);
-
- gtk_signal_connect (GTK_OBJECT(e_table->table_canvas), "realize",
- GTK_SIGNAL_FUNC(et_canvas_realize), e_table);
-
- gtk_signal_connect (GTK_OBJECT(gnome_canvas_root (e_table->table_canvas)), "event",
- GTK_SIGNAL_FUNC(et_canvas_root_event), e_table);
-
- e_table->canvas_vbox = gnome_canvas_item_new(
- gnome_canvas_root(e_table->table_canvas),
- e_canvas_vbox_get_type(),
- "spacing", 10.0,
- NULL);
-
- et_build_groups(e_table);
-
- if (e_table->use_click_to_add) {
- e_table->click_to_add = gnome_canvas_item_new (
- GNOME_CANVAS_GROUP(e_table->canvas_vbox),
- e_table_click_to_add_get_type (),
- "header", e_table->header,
- "model", e_table->model,
- "message", e_table->click_to_add_message,
- NULL);
-
- if (e_table->use_click_to_add_end)
- e_canvas_vbox_add_item (
- E_CANVAS_VBOX(e_table->canvas_vbox),
- e_table->click_to_add);
- else
- e_canvas_vbox_add_item_start (
- E_CANVAS_VBOX(e_table->canvas_vbox),
- e_table->click_to_add);
-
- gtk_signal_connect (
- GTK_OBJECT (e_table->click_to_add), "cursor_change",
- GTK_SIGNAL_FUNC(click_to_add_cursor_change), e_table);
- }
-}
-
-static void
-e_table_fill_table (ETable *e_table, ETableModel *model)
-{
- e_table_group_add_all (e_table->group);
-}
-
-/**
- * e_table_set_state_object:
- * @e_table: The #ETable object to modify
- * @state: The #ETableState to use
- *
- * This routine sets the state of the #ETable from the given
- * #ETableState.
- *
- **/
-void
-e_table_set_state_object(ETable *e_table, ETableState *state)
-{
- connect_header (e_table, state);
- gtk_object_set (GTK_OBJECT (e_table->header),
- "width", (double) (GTK_WIDGET(e_table->table_canvas)->allocation.width),
- NULL);
-
- if (e_table->sort_info) {
- if (e_table->group_info_change_id)
- gtk_signal_disconnect (GTK_OBJECT (e_table->sort_info),
- e_table->group_info_change_id);
- if (e_table->sort_info_change_id)
- gtk_signal_disconnect (GTK_OBJECT (e_table->sort_info),
- e_table->sort_info_change_id);
- gtk_object_unref(GTK_OBJECT(e_table->sort_info));
- }
- if (state->sort_info) {
- e_table->sort_info = e_table_sort_info_duplicate(state->sort_info);
- e_table_sort_info_set_can_group (e_table->sort_info, e_table->allow_grouping);
- e_table->group_info_change_id =
- gtk_signal_connect (GTK_OBJECT (e_table->sort_info),
- "group_info_changed",
- GTK_SIGNAL_FUNC (group_info_changed),
- e_table);
- e_table->sort_info_change_id =
- gtk_signal_connect (GTK_OBJECT (e_table->sort_info),
- "sort_info_changed",
- GTK_SIGNAL_FUNC (sort_info_changed),
- e_table);
- }
- else
- e_table->sort_info = NULL;
-
- if (e_table->sorter)
- gtk_object_set(GTK_OBJECT(e_table->sorter),
- "sort_info", e_table->sort_info,
- NULL);
- if (e_table->header_item)
- gtk_object_set(GTK_OBJECT(e_table->header_item),
- "ETableHeader", e_table->header,
- "sort_info", e_table->sort_info,
- NULL);
- if (e_table->click_to_add)
- gtk_object_set(GTK_OBJECT(e_table->click_to_add),
- "header", e_table->header,
- NULL);
-
- e_table->need_rebuild = TRUE;
- if (!e_table->rebuild_idle_id)
- e_table->rebuild_idle_id = g_idle_add_full (20, changed_idle, e_table, NULL);
-}
-
-/**
- * e_table_set_state:
- * @e_table: The #ETable object to modify
- * @state_str: a string representing an #ETableState
- *
- * This routine sets the state of the #ETable from a string.
- *
- **/
-void
-e_table_set_state (ETable *e_table,
- const gchar *state_str)
-{
- ETableState *state;
-
- g_return_if_fail(e_table != NULL);
- g_return_if_fail(E_IS_TABLE(e_table));
- g_return_if_fail(state_str != NULL);
-
- state = e_table_state_new();
- e_table_state_load_from_string(state, state_str);
-
- if (state->col_count > 0)
- e_table_set_state_object(e_table, state);
-
- gtk_object_unref(GTK_OBJECT(state));
-}
-
-/**
- * e_table_load_state:
- * @e_table: The #ETable object to modify
- * @filename: name of the file to use
- *
- * This routine sets the state of the #ETable from a file.
- *
- **/
-void
-e_table_load_state (ETable *e_table,
- const gchar *filename)
-{
- ETableState *state;
-
- g_return_if_fail(e_table != NULL);
- g_return_if_fail(E_IS_TABLE(e_table));
- g_return_if_fail(filename != NULL);
-
- state = e_table_state_new();
- e_table_state_load_from_file(state, filename);
-
- if (state->col_count > 0)
- e_table_set_state_object(e_table, state);
-
- gtk_object_unref(GTK_OBJECT(state));
-}
-
-/**
- * e_table_get_state_object:
- * @e_table: #ETable object to act on
- *
- * Builds an #ETableState corresponding to the current state of the
- * #ETable.
- *
- * Return value:
- * The %ETableState object generated.
- **/
-ETableState *
-e_table_get_state_object (ETable *e_table)
-{
- ETableState *state;
- int full_col_count;
- int i, j;
-
- state = e_table_state_new();
- state->sort_info = e_table->sort_info;
- gtk_object_ref(GTK_OBJECT(state->sort_info));
-
-
- state->col_count = e_table_header_count (e_table->header);
- full_col_count = e_table_header_count (e_table->full_header);
- state->columns = g_new(int, state->col_count);
- state->expansions = g_new(double, state->col_count);
- for (i = 0; i < state->col_count; i++) {
- ETableCol *col = e_table_header_get_column(e_table->header, i);
- state->columns[i] = -1;
- for (j = 0; j < full_col_count; j++) {
- if (col->col_idx == e_table_header_index(e_table->full_header, j)) {
- state->columns[i] = j;
- break;
- }
- }
- state->expansions[i] = col->expansion;
- }
-
- return state;
-}
-
-/**
- * e_table_get_state:
- * @e_table: The #ETable to act on.
- *
- * Builds a state object based on the current state and returns the
- * string corresponding to that state.
- *
- * Return value:
- * A string describing the current state of the #ETable.
- **/
-gchar *e_table_get_state (ETable *e_table)
-{
- ETableState *state;
- gchar *string;
-
- state = e_table_get_state_object(e_table);
- string = e_table_state_save_to_string(state);
- gtk_object_unref(GTK_OBJECT(state));
- return string;
-}
-
-/**
- * e_table_save_state:
- * @e_table: The #ETable to act on
- * @filename: name of the file to save to
- *
- * Saves the state of the @e_table object into the file pointed by
- * @filename.
- *
- **/
-void
-e_table_save_state (ETable *e_table,
- const gchar *filename)
-{
- ETableState *state;
-
- state = e_table_get_state_object(e_table);
- e_table_state_save_to_file(state, filename);
- gtk_object_unref(GTK_OBJECT(state));
-}
-
-static void
-et_selection_model_selection_changed (ETableGroup *etg, ETable *et)
-{
- gtk_signal_emit (GTK_OBJECT (et),
- et_signals [SELECTION_CHANGE]);
-}
-
-static void
-et_selection_model_selection_row_changed (ETableGroup *etg, int row, ETable *et)
-{
- gtk_signal_emit (GTK_OBJECT (et),
- et_signals [SELECTION_CHANGE]);
-}
-
-static ETable *
-et_real_construct (ETable *e_table, ETableModel *etm, ETableExtras *ete,
- ETableSpecification *specification, ETableState *state)
-{
- int row = 0;
- int col_count, i;
-
- if (ete)
- gtk_object_ref(GTK_OBJECT(ete));
- else
- ete = e_table_extras_new();
-
- e_table->use_click_to_add = specification->click_to_add;
- e_table->use_click_to_add_end = specification->click_to_add_end;
- e_table->click_to_add_message = e_utf8_from_locale_string (gettext (specification->click_to_add_message));
- e_table->alternating_row_colors = specification->alternating_row_colors;
- e_table->horizontal_draw_grid = specification->horizontal_draw_grid;
- e_table->vertical_draw_grid = specification->vertical_draw_grid;
- e_table->draw_focus = specification->draw_focus;
- e_table->cursor_mode = specification->cursor_mode;
- e_table->full_header = e_table_spec_to_full_header(specification, ete);
-
- col_count = e_table_header_count (e_table->full_header);
- for (i = 0; i < col_count; i++) {
- ETableCol *col = e_table_header_get_column(e_table->full_header, i);
- if (col && col->search) {
- e_table->current_search_col = col->col_idx;
- e_table->current_search = col->search;
- break;
- }
- }
-
- gtk_object_set(GTK_OBJECT(e_table->selection),
- "selection_mode", specification->selection_mode,
- "cursor_mode", specification->cursor_mode,
- NULL);
-
- e_table->model = etm;
- gtk_object_ref (GTK_OBJECT (etm));
-
- gtk_widget_push_visual (gdk_rgb_get_visual ());
- gtk_widget_push_colormap (gdk_rgb_get_cmap ());
-
- connect_header (e_table, state);
- e_table->horizontal_scrolling = specification->horizontal_scrolling;
- e_table->horizontal_resize = specification->horizontal_resize;
- e_table->allow_grouping = specification->allow_grouping;
-
- e_table->sort_info = state->sort_info;
- gtk_object_ref (GTK_OBJECT (state->sort_info));
- e_table_sort_info_set_can_group (e_table->sort_info, e_table->allow_grouping);
-
- e_table->group_info_change_id =
- gtk_signal_connect (GTK_OBJECT (e_table->sort_info), "group_info_changed",
- GTK_SIGNAL_FUNC (group_info_changed), e_table);
-
- e_table->sort_info_change_id =
- gtk_signal_connect (GTK_OBJECT (e_table->sort_info), "sort_info_changed",
- GTK_SIGNAL_FUNC (sort_info_changed), e_table);
-
-
- gtk_object_set(GTK_OBJECT(e_table->header),
- "sort_info", e_table->sort_info,
- NULL);
-
- e_table->sorter = e_table_sorter_new(etm, e_table->full_header, e_table->sort_info);
-
- gtk_object_set (GTK_OBJECT (e_table->selection),
- "model", etm,
- "sorter", e_table->sorter,
- "header", e_table->header,
- NULL);
-
- gtk_signal_connect(GTK_OBJECT(e_table->selection), "selection_changed",
- GTK_SIGNAL_FUNC(et_selection_model_selection_changed), e_table);
- gtk_signal_connect(GTK_OBJECT(e_table->selection), "selection_row_changed",
- GTK_SIGNAL_FUNC(et_selection_model_selection_row_changed), e_table);
-
- if (!specification->no_headers) {
- e_table_setup_header (e_table);
- }
- e_table_setup_table (e_table, e_table->full_header, e_table->header, etm);
- e_table_fill_table (e_table, etm);
-
- gtk_layout_get_vadjustment (GTK_LAYOUT (e_table->table_canvas))->step_increment = 20;
- gtk_adjustment_changed(gtk_layout_get_vadjustment (GTK_LAYOUT (e_table->table_canvas)));
- gtk_layout_get_hadjustment (GTK_LAYOUT (e_table->table_canvas))->step_increment = 20;
- gtk_adjustment_changed(gtk_layout_get_hadjustment (GTK_LAYOUT (e_table->table_canvas)));
-
- if (!specification->no_headers) {
- /*
- * The header
- */
- gtk_table_attach (GTK_TABLE (e_table), GTK_WIDGET (e_table->header_canvas),
- 0, 1, 0 + row, 1 + row,
- GTK_FILL | GTK_EXPAND,
- GTK_FILL, 0, 0);
- row ++;
- }
- gtk_table_attach (GTK_TABLE (e_table), GTK_WIDGET (e_table->table_canvas),
- 0, 1, 0 + row, 1 + row,
- GTK_FILL | GTK_EXPAND,
- GTK_FILL | GTK_EXPAND,
- 0, 0);
-
- gtk_widget_pop_colormap ();
- gtk_widget_pop_visual ();
-
- gtk_object_unref(GTK_OBJECT(ete));
-
- return e_table;
-}
-
-/**
- * e_table_construct:
- * @e_table: The newly created #ETable object.
- * @etm: The model for this table.
- * @ete: An optional #ETableExtras. (%NULL is valid.)
- * @spec_str: The spec.
- * @state_str: An optional state. (%NULL is valid.)
- *
- * This is the internal implementation of e_table_new() for use by
- * subclasses or language bindings. See e_table_new() for details.
- *
- * Return value:
- * The passed in value @e_table or %NULL if there's an error.
- **/
-ETable *
-e_table_construct (ETable *e_table, ETableModel *etm, ETableExtras *ete,
- const char *spec_str, const char *state_str)
-{
- ETableSpecification *specification;
- ETableState *state;
-
- g_return_val_if_fail(e_table != NULL, NULL);
- g_return_val_if_fail(E_IS_TABLE(e_table), NULL);
- g_return_val_if_fail(etm != NULL, NULL);
- g_return_val_if_fail(E_IS_TABLE_MODEL(etm), NULL);
- g_return_val_if_fail(ete == NULL || E_IS_TABLE_EXTRAS(ete), NULL);
- g_return_val_if_fail(spec_str != NULL, NULL);
-
- specification = e_table_specification_new();
- e_table_specification_load_from_string(specification, spec_str);
- if (state_str) {
- state = e_table_state_new();
- e_table_state_load_from_string(state, state_str);
- if (state->col_count <= 0) {
- gtk_object_unref(GTK_OBJECT(state));
- state = specification->state;
- gtk_object_ref(GTK_OBJECT(state));
- }
- } else {
- state = specification->state;
- gtk_object_ref(GTK_OBJECT(state));
- }
-
- e_table = et_real_construct (e_table, etm, ete, specification, state);
-
- e_table->spec = specification;
- gtk_object_unref(GTK_OBJECT(state));
-
- return e_table;
-}
-
-/**
- * e_table_construct_from_spec_file:
- * @e_table: The newly created #ETable object.
- * @etm: The model for this table.
- * @ete: An optional #ETableExtras. (%NULL is valid.)
- * @spec_fn: The filename of the spec.
- * @state_fn: An optional state file. (%NULL is valid.)
- *
- * This is the internal implementation of e_table_new_from_spec_file()
- * for use by subclasses or language bindings. See
- * e_table_new_from_spec_file() for details.
- *
- * Return value:
- * The passed in value @e_table or %NULL if there's an error.
- **/
-ETable *
-e_table_construct_from_spec_file (ETable *e_table, ETableModel *etm, ETableExtras *ete,
- const char *spec_fn, const char *state_fn)
-{
- ETableSpecification *specification;
- ETableState *state;
-
- g_return_val_if_fail(e_table != NULL, NULL);
- g_return_val_if_fail(E_IS_TABLE(e_table), NULL);
- g_return_val_if_fail(etm != NULL, NULL);
- g_return_val_if_fail(E_IS_TABLE_MODEL(etm), NULL);
- g_return_val_if_fail(ete == NULL || E_IS_TABLE_EXTRAS(ete), NULL);
- g_return_val_if_fail(spec_fn != NULL, NULL);
-
- specification = e_table_specification_new();
- if (!e_table_specification_load_from_file(specification, spec_fn)) {
- gtk_object_unref(GTK_OBJECT(specification));
- return NULL;
- }
-
- if (state_fn) {
- state = e_table_state_new();
- if (!e_table_state_load_from_file(state, state_fn)) {
- gtk_object_unref(GTK_OBJECT(state));
- state = specification->state;
- gtk_object_ref(GTK_OBJECT(state));
- }
- if (state->col_count <= 0) {
- gtk_object_unref(GTK_OBJECT(state));
- state = specification->state;
- gtk_object_ref(GTK_OBJECT(state));
- }
- } else {
- state = specification->state;
- gtk_object_ref(GTK_OBJECT(state));
- }
-
- e_table = et_real_construct (e_table, etm, ete, specification, state);
-
- e_table->spec = specification;
- gtk_object_unref(GTK_OBJECT(state));
-
- return e_table;
-}
-
-/**
- * e_table_new:
- * @etm: The model for this table.
- * @ete: An optional #ETableExtras. (%NULL is valid.)
- * @spec: The spec.
- * @state: An optional state. (%NULL is valid.)
- *
- * This function creates an #ETable from the given parameters. The
- * #ETableModel is a table model to be represented. The #ETableExtras
- * is an optional set of pixbufs, cells, and sorting functions to be
- * used when interpreting the spec. If you pass in %NULL it uses the
- * default #ETableExtras. (See e_table_extras_new()).
- *
- * @spec is the specification of the set of viewable columns and the
- * default sorting state and such. @state is an optional string
- * specifying the current sorting state and such. If @state is NULL,
- * then the default state from the spec will be used.
- *
- * Return value:
- * The newly created #ETable or %NULL if there's an error.
- **/
-GtkWidget *
-e_table_new (ETableModel *etm, ETableExtras *ete, const char *spec, const char *state)
-{
- ETable *e_table;
-
- g_return_val_if_fail(etm != NULL, NULL);
- g_return_val_if_fail(E_IS_TABLE_MODEL(etm), NULL);
- g_return_val_if_fail(ete == NULL || E_IS_TABLE_EXTRAS(ete), NULL);
- g_return_val_if_fail(spec != NULL, NULL);
-
- e_table = gtk_type_new (e_table_get_type ());
-
- e_table = e_table_construct (e_table, etm, ete, spec, state);
-
- return GTK_WIDGET (e_table);
-}
-
-/**
- * e_table_new_from_spec_file:
- * @etm: The model for this table.
- * @ete: An optional #ETableExtras. (%NULL is valid.)
- * @spec_fn: The filename of the spec.
- * @state_fn: An optional state file. (%NULL is valid.)
- *
- * This is very similar to e_table_new(), except instead of passing in
- * strings you pass in the file names of the spec and state to load.
- *
- * @spec_fn is the filename of the spec to load. If this file doesn't
- * exist, e_table_new_from_spec_file will return %NULL.
- *
- * @state_fn is the filename of the initial state to load. If this is
- * %NULL or if the specified file doesn't exist, the default state
- * from the spec file is used.
- *
- * Return value:
- * The newly created #ETable or %NULL if there's an error.
- **/
-GtkWidget *
-e_table_new_from_spec_file (ETableModel *etm, ETableExtras *ete, const char *spec_fn, const char *state_fn)
-{
- ETable *e_table;
-
- g_return_val_if_fail(etm != NULL, NULL);
- g_return_val_if_fail(E_IS_TABLE_MODEL(etm), NULL);
- g_return_val_if_fail(ete == NULL || E_IS_TABLE_EXTRAS(ete), NULL);
- g_return_val_if_fail(spec_fn != NULL, NULL);
-
- e_table = gtk_type_new (e_table_get_type ());
-
- e_table = e_table_construct_from_spec_file (e_table, etm, ete, spec_fn, state_fn);
-
- return GTK_WIDGET (e_table);
-}
-
-#if 0
-static xmlNode *
-et_build_column_spec (ETable *e_table)
-{
- xmlNode *columns_shown;
- gint i;
- gint col_count;
-
- columns_shown = xmlNewNode (NULL, "columns-shown");
-
- col_count = e_table_header_count (e_table->header);
- for (i = 0; i < col_count; i++){
- gchar *text = g_strdup_printf ("%d", e_table_header_index(e_table->header, i));
- xmlNewChild (columns_shown, NULL, "column", text);
- g_free (text);
- }
-
- return columns_shown;
-}
-
-static xmlNode *
-et_build_grouping_spec (ETable *e_table)
-{
- xmlNode *node;
- xmlNode *grouping;
- int i;
- const int sort_count = e_table_sort_info_sorting_get_count (e_table->sort_info);
- const int group_count = e_table_sort_info_grouping_get_count (e_table->sort_info);
-
- grouping = xmlNewNode (NULL, "grouping");
- node = grouping;
-
- for (i = 0; i < group_count; i++) {
- ETableSortColumn column = e_table_sort_info_grouping_get_nth(e_table->sort_info, i);
- xmlNode *new_node = xmlNewChild(node, NULL, "group", NULL);
-
- e_xml_set_integer_prop_by_name (new_node, "column", column.column);
- e_xml_set_integer_prop_by_name (new_node, "ascending", column.ascending);
- node = new_node;
- }
-
- for (i = 0; i < sort_count; i++) {
- ETableSortColumn column = e_table_sort_info_sorting_get_nth(e_table->sort_info, i);
- xmlNode *new_node = xmlNewChild(node, NULL, "leaf", NULL);
-
- e_xml_set_integer_prop_by_name (new_node, "column", column.column);
- e_xml_set_integer_prop_by_name (new_node, "ascending", column.ascending);
- node = new_node;
- }
-
- return grouping;
-}
-
-static xmlDoc *
-et_build_tree (ETable *e_table)
-{
- xmlDoc *doc;
- xmlNode *root;
-
- doc = xmlNewDoc ("1.0");
- if (doc == NULL)
- return NULL;
-
- root = xmlNewDocNode (doc, NULL, "ETableSpecification", NULL);
- xmlDocSetRootElement (doc, root);
- xmlAddChild (root, et_build_column_spec (e_table));
- xmlAddChild (root, et_build_grouping_spec (e_table));
-
- return doc;
-}
-
-gchar *
-e_table_get_specification (ETable *e_table)
-{
- xmlDoc *doc;
- xmlChar *buffer;
- gint size;
-
- g_return_val_if_fail(e_table != NULL, NULL);
- g_return_val_if_fail(E_IS_TABLE(e_table), NULL);
-
- doc = et_build_tree (e_table);
- xmlDocDumpMemory (doc, &buffer, &size);
- xmlFreeDoc (doc);
-
- return buffer;
-}
-
-int
-e_table_set_specification (ETable *e_table, const char *spec)
-{
- xmlDoc *xmlSpec;
- int ret;
-
- g_return_val_if_fail(e_table != NULL, -1);
- g_return_val_if_fail(E_IS_TABLE(e_table), -1);
- g_return_val_if_fail(spec != NULL, -1);
-
- /* doesn't work yet, sigh */
- xmlSpec = xmlParseMemory ((char *)spec, strlen(spec));
- ret = et_real_set_specification(e_table, xmlSpec);
- xmlFreeDoc (xmlSpec);
-
- return ret;
-}
-
-void
-e_table_save_specification (ETable *e_table, gchar *filename)
-{
- xmlDoc *doc = et_build_tree (e_table);
-
- g_return_if_fail(e_table != NULL);
- g_return_if_fail(E_IS_TABLE(e_table));
- g_return_if_fail(filename != NULL);
-
- xmlSaveFile (filename, doc);
- xmlFreeDoc (doc);
-}
-
-int
-e_table_load_specification (ETable *e_table, gchar *filename)
-{
- xmlDoc *xmlSpec;
- int ret;
-
- g_return_val_if_fail(e_table != NULL, -1);
- g_return_val_if_fail(E_IS_TABLE(e_table), -1);
- g_return_val_if_fail(filename != NULL, -1);
-
- /* doesn't work yet, yay */
- xmlSpec = xmlParseFile (filename);
- ret = et_real_set_specification(e_table, xmlSpec);
- xmlFreeDoc (xmlSpec);
-
- return ret;
-}
-#endif
-
-/**
- * e_table_set_cursor_row:
- * @e_table: The #ETable to set the cursor row of
- * @row: The row number
- *
- * Sets the cursor row and the selection to the given row number.
- **/
-void
-e_table_set_cursor_row (ETable *e_table, int row)
-{
- g_return_if_fail(e_table != NULL);
- g_return_if_fail(E_IS_TABLE(e_table));
- g_return_if_fail(row >= 0);
-
- gtk_object_set(GTK_OBJECT(e_table->selection),
- "cursor_row", row,
- NULL);
-}
-
-/**
- * e_table_get_cursor_row:
- * @e_table: The #ETable to query
- *
- * Calculates the cursor row. -1 means that we don't have a cursor.
- *
- * Return value:
- * Cursor row
- **/
-int
-e_table_get_cursor_row (ETable *e_table)
-{
- int row;
- g_return_val_if_fail(e_table != NULL, -1);
- g_return_val_if_fail(E_IS_TABLE(e_table), -1);
-
- gtk_object_get(GTK_OBJECT(e_table->selection),
- "cursor_row", &row,
- NULL);
- return row;
-}
-
-/**
- * e_table_selected_row_foreach:
- * @e_table: The #ETable to act on
- * @callback: The callback function to call
- * @closure: The value passed to the callback's closure argument
- *
- * Calls the given @callback function once for every selected row.
- *
- * If you change the selection or delete or add rows to the table
- * during these callbacks, problems can occur. A standard thing to do
- * is to create a list of rows or objects the function is called upon
- * and then act upon that list. (In inverse order if it's rows.)
- **/
-void
-e_table_selected_row_foreach (ETable *e_table,
- EForeachFunc callback,
- gpointer closure)
-{
- g_return_if_fail(e_table != NULL);
- g_return_if_fail(E_IS_TABLE(e_table));
-
- e_selection_model_foreach(E_SELECTION_MODEL (e_table->selection),
- callback,
- closure);
-}
-
-/**
- * e_table_selected_count:
- * @e_table: The #ETable to query
- *
- * Counts the number of selected rows.
- *
- * Return value:
- * The number of rows selected.
- **/
-gint
-e_table_selected_count (ETable *e_table)
-{
- g_return_val_if_fail(e_table != NULL, -1);
- g_return_val_if_fail(E_IS_TABLE(e_table), -1);
-
- return e_selection_model_selected_count(E_SELECTION_MODEL (e_table->selection));
-}
-
-/**
- * e_table_select_all:
- * @table: The #ETable to modify
- *
- * Selects all the rows in @table.
- **/
-void
-e_table_select_all (ETable *table)
-{
- g_return_if_fail (table != NULL);
- g_return_if_fail (E_IS_TABLE (table));
-
- e_selection_model_select_all (E_SELECTION_MODEL (table->selection));
-}
-
-/**
- * e_table_invert_selection:
- * @table: The #ETable to modify
- *
- * Inverts the selection in @table.
- **/
-void
-e_table_invert_selection (ETable *table)
-{
- g_return_if_fail (table != NULL);
- g_return_if_fail (E_IS_TABLE (table));
-
- e_selection_model_invert_selection (E_SELECTION_MODEL (table->selection));
-}
-
-
-/**
- * e_table_get_printable:
- * @e_table: #ETable to query
- *
- * Used for printing your #ETable.
- *
- * Return value:
- * The #EPrintable to print.
- **/
-EPrintable *
-e_table_get_printable (ETable *e_table)
-{
- g_return_val_if_fail(e_table != NULL, NULL);
- g_return_val_if_fail(E_IS_TABLE(e_table), NULL);
-
- return e_table_group_get_printable(e_table->group);
-}
-
-/**
- * e_table_right_click_up:
- * @table: The #ETable to modify.
- *
- * Call this function when you're done handling the right click if you
- * return TRUE from the "right_click" signal.
- **/
-void
-e_table_right_click_up (ETable *table)
-{
- e_selection_model_right_click_up(E_SELECTION_MODEL(table->selection));
-}
-
-/**
- * e_table_commit_click_to_add:
- * @table: The #ETable to modify
- *
- * Commits the current values in the click to add to the table.
- **/
-void
-e_table_commit_click_to_add (ETable *table)
-{
- et_eti_leave_edit (table);
- if (table->click_to_add)
- e_table_click_to_add_commit(E_TABLE_CLICK_TO_ADD(table->click_to_add));
-}
-
-static void
-et_get_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- ETable *etable = E_TABLE (o);
-
- switch (arg_id){
- case ARG_MODEL:
- GTK_VALUE_OBJECT (*arg) = (GtkObject *) etable->model;
- break;
- case ARG_UNIFORM_ROW_HEIGHT:
- GTK_VALUE_BOOL (*arg) = etable->uniform_row_height;
- break;
- default:
- break;
- }
-}
-
-typedef struct {
- char *arg;
- gboolean setting;
-} bool_closure;
-
-static void
-et_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- ETable *etable = E_TABLE (o);
-
- switch (arg_id){
- case ARG_LENGTH_THRESHOLD:
- etable->length_threshold = GTK_VALUE_INT (*arg);
- if (etable->group) {
- gnome_canvas_item_set (GNOME_CANVAS_ITEM(etable->group),
- "length_threshold", GTK_VALUE_INT (*arg),
- NULL);
- }
- break;
- case ARG_UNIFORM_ROW_HEIGHT:
- etable->uniform_row_height = GTK_VALUE_BOOL (*arg);
- if (etable->group) {
- gnome_canvas_item_set (GNOME_CANVAS_ITEM(etable->group),
- "uniform_row_height", GTK_VALUE_BOOL (*arg),
- NULL);
- }
- break;
- }
-}
-
-static void
-set_scroll_adjustments (ETable *table,
- GtkAdjustment *hadjustment,
- GtkAdjustment *vadjustment)
-{
- if (vadjustment != NULL) {
- vadjustment->step_increment = 20;
- gtk_adjustment_changed(vadjustment);
- }
- if (hadjustment != NULL) {
- hadjustment->step_increment = 20;
- gtk_adjustment_changed(hadjustment);
- }
-
- gtk_layout_set_hadjustment (GTK_LAYOUT(table->table_canvas),
- hadjustment);
- gtk_layout_set_vadjustment (GTK_LAYOUT(table->table_canvas),
- vadjustment);
-
- if (table->header_canvas != NULL)
- gtk_layout_set_hadjustment (GTK_LAYOUT(table->header_canvas),
- hadjustment);
-}
-
-/**
- * e_table_get_next_row:
- * @e_table: The #ETable to query
- * @model_row: The model row to go from
- *
- * This function is used when your table is sorted, but you're using
- * model row numbers. It returns the next row in sorted order as a model row.
- *
- * Return value:
- * The model row number.
- **/
-gint
-e_table_get_next_row (ETable *e_table,
- gint model_row)
-{
- g_return_val_if_fail(e_table != NULL, -1);
- g_return_val_if_fail(E_IS_TABLE(e_table), -1);
-
- if (e_table->sorter) {
- int i;
- i = e_sorter_model_to_sorted(E_SORTER (e_table->sorter), model_row);
- i++;
- if (i < e_table_model_row_count(e_table->model)) {
- return e_sorter_sorted_to_model(E_SORTER (e_table->sorter), i);
- } else
- return -1;
- } else
- if (model_row < e_table_model_row_count(e_table->model) - 1)
- return model_row + 1;
- else
- return -1;
-}
-
-/**
- * e_table_get_prev_row:
- * @e_table: The #ETable to query
- * @model_row: The model row to go from
- *
- * This function is used when your table is sorted, but you're using
- * model row numbers. It returns the previous row in sorted order as
- * a model row.
- *
- * Return value:
- * The model row number.
- **/
-gint
-e_table_get_prev_row (ETable *e_table,
- gint model_row)
-{
- g_return_val_if_fail(e_table != NULL, -1);
- g_return_val_if_fail(E_IS_TABLE(e_table), -1);
-
- if (e_table->sorter) {
- int i;
- i = e_sorter_model_to_sorted(E_SORTER (e_table->sorter), model_row);
- i--;
- if (i >= 0)
- return e_sorter_sorted_to_model(E_SORTER (e_table->sorter), i);
- else
- return -1;
- } else
- return model_row - 1;
-}
-
-/**
- * e_table_model_to_view_row:
- * @e_table: The #ETable to query
- * @model_row: The model row number
- *
- * Turns a model row into a view row.
- *
- * Return value:
- * The view row number.
- **/
-gint
-e_table_model_to_view_row (ETable *e_table,
- gint model_row)
-{
- g_return_val_if_fail(e_table != NULL, -1);
- g_return_val_if_fail(E_IS_TABLE(e_table), -1);
-
- if (e_table->sorter)
- return e_sorter_model_to_sorted(E_SORTER (e_table->sorter), model_row);
- else
- return model_row;
-}
-
-/**
- * e_table_view_to_model_row:
- * @e_table: The #ETable to query
- * @view_row: The view row number
- *
- * Turns a view row into a model row.
- *
- * Return value:
- * The model row number.
- **/
-gint
-e_table_view_to_model_row (ETable *e_table,
- gint view_row)
-{
- g_return_val_if_fail(e_table != NULL, -1);
- g_return_val_if_fail(E_IS_TABLE(e_table), -1);
-
- if (e_table->sorter)
- return e_sorter_sorted_to_model (E_SORTER (e_table->sorter), view_row);
- else
- return view_row;
-}
-
-/**
- * e_table_get_cell_at:
- * @table: An #ETable widget
- * @x: X coordinate for the pixel
- * @y: Y coordinate for the pixel
- * @row_return: Pointer to return the row value
- * @col_return: Pointer to return the column value
- *
- * Return the row and column for the cell in which the pixel at (@x, @y) is
- * contained.
- **/
-void
-e_table_get_cell_at (ETable *table,
- int x, int y,
- int *row_return, int *col_return)
-{
- g_return_if_fail (table != NULL);
- g_return_if_fail (E_IS_TABLE (table));
- g_return_if_fail (row_return != NULL);
- g_return_if_fail (col_return != NULL);
-
- /* FIXME it would be nice if it could handle a NULL row_return or
- * col_return gracefully. */
-
- x += GTK_LAYOUT(table->table_canvas)->hadjustment->value;
- y += GTK_LAYOUT(table->table_canvas)->vadjustment->value;
- e_table_group_compute_location(table->group, &x, &y, row_return, col_return);
-}
-
-/**
- * e_table_get_cell_geometry:
- * @table: The #ETable.
- * @row: The row to get the geometry of.
- * @col: The col to get the geometry of.
- * @x_return: Returns the x coordinate of the upper left hand corner of the cell with respect to the widget.
- * @y_return: Returns the y coordinate of the upper left hand corner of the cell with respect to the widget.
- * @width_return: Returns the width of the cell.
- * @height_return: Returns the height of the cell.
- *
- * Returns the x, y, width, and height of the given cell. These can
- * all be #NULL and they just won't be set.
- **/
-void
-e_table_get_cell_geometry (ETable *table,
- int row, int col,
- int *x_return, int *y_return,
- int *width_return, int *height_return)
-{
- g_return_if_fail (table != NULL);
- g_return_if_fail (E_IS_TABLE (table));
-
- e_table_group_get_cell_geometry(table->group, &row, &col, x_return, y_return, width_return, height_return);
-
- if (x_return)
- (*x_return) -= GTK_LAYOUT(table->table_canvas)->hadjustment->value;
- if (y_return) {
- (*y_return) -= GTK_LAYOUT(table->table_canvas)->vadjustment->value;
- (*y_return) += GTK_WIDGET(table->header_canvas)->allocation.height;
- }
-}
-
-/**
- * e_table_get_selection_model:
- * @table: The #ETable to query
- *
- * Returns the table's #ESelectionModel in case you want to access it
- * directly.
- *
- * Return value:
- * The #ESelectionModel.
- **/
-ESelectionModel *
-e_table_get_selection_model (ETable *table)
-{
- g_return_val_if_fail (table != NULL, NULL);
- g_return_val_if_fail (E_IS_TABLE (table), NULL);
-
- return E_SELECTION_MODEL (table->selection);
-}
-
-struct _ETableDragSourceSite
-{
- GdkModifierType start_button_mask;
- GtkTargetList *target_list; /* Targets for drag data */
- GdkDragAction actions; /* Possible actions */
- GdkColormap *colormap; /* Colormap for drag icon */
- GdkPixmap *pixmap; /* Icon for drag data */
- GdkBitmap *mask;
-
- /* Stored button press information to detect drag beginning */
- gint state;
- gint x, y;
- gint row, col;
-};
-
-typedef enum
-{
- GTK_DRAG_STATUS_DRAG,
- GTK_DRAG_STATUS_WAIT,
- GTK_DRAG_STATUS_DROP
-} GtkDragStatus;
-
-typedef struct _GtkDragDestInfo GtkDragDestInfo;
-typedef struct _GtkDragSourceInfo GtkDragSourceInfo;
-
-struct _GtkDragDestInfo
-{
- GtkWidget *widget; /* Widget in which drag is in */
- GdkDragContext *context; /* Drag context */
- GtkDragSourceInfo *proxy_source; /* Set if this is a proxy drag */
- GtkSelectionData *proxy_data; /* Set while retrieving proxied data */
- gboolean dropped : 1; /* Set after we receive a drop */
- guint32 proxy_drop_time; /* Timestamp for proxied drop */
- gboolean proxy_drop_wait : 1; /* Set if we are waiting for a
- * status reply before sending
- * a proxied drop on.
- */
- gint drop_x, drop_y; /* Position of drop */
-};
-
-struct _GtkDragSourceInfo
-{
- GtkWidget *widget;
- GtkTargetList *target_list; /* Targets for drag data */
- GdkDragAction possible_actions; /* Actions allowed by source */
- GdkDragContext *context; /* drag context */
- GtkWidget *icon_window; /* Window for drag */
- GtkWidget *ipc_widget; /* GtkInvisible for grab, message passing */
- GdkCursor *cursor; /* Cursor for drag */
- gint hot_x, hot_y; /* Hot spot for drag */
- gint button; /* mouse button starting drag */
-
- GtkDragStatus status; /* drag status */
- GdkEvent *last_event; /* motion event waiting for response */
-
- gint start_x, start_y; /* Initial position */
- gint cur_x, cur_y; /* Current Position */
-
- GList *selections; /* selections we've claimed */
-
- GtkDragDestInfo *proxy_dest; /* Set if this is a proxy drag */
-
- guint drop_timeout; /* Timeout for aborting drop */
- guint destroy_icon : 1; /* If true, destroy icon_window
- */
-};
-
-/* Drag & drop stuff. */
-/* Target */
-
-/**
- * e_table_drag_get_data:
- * @table:
- * @row:
- * @col:
- * @context:
- * @target:
- * @time:
- *
- *
- **/
-void
-e_table_drag_get_data (ETable *table,
- int row,
- int col,
- GdkDragContext *context,
- GdkAtom target,
- guint32 time)
-{
- g_return_if_fail(table != NULL);
- g_return_if_fail(E_IS_TABLE(table));
-
- table->drag_get_data_row = row;
- table->drag_get_data_col = col;
- gtk_drag_get_data(GTK_WIDGET(table),
- context,
- target,
- time);
-}
-
-/**
- * e_table_drag_highlight:
- * @table: The #ETable to highlight
- * @row: The row number of the cell to highlight
- * @col: The column number of the cell to highlight
- *
- * Set col to -1 to highlight the entire row. If row is -1, this is
- * identical to e_table_drag_unhighlight().
- **/
-void
-e_table_drag_highlight (ETable *table,
- int row,
- int col)
-{
- g_return_if_fail(table != NULL);
- g_return_if_fail(E_IS_TABLE(table));
-
- if (row != -1) {
- int x, y, width, height;
- if (col == -1) {
- e_table_get_cell_geometry (table, row, 0, &x, &y, &width, &height);
- x = 0;
- width = GTK_WIDGET (table->table_canvas)->allocation.width;
- } else {
- e_table_get_cell_geometry (table, row, col, &x, &y, &width, &height);
- x += GTK_LAYOUT(table->table_canvas)->hadjustment->value;
- }
- y += GTK_LAYOUT(table->table_canvas)->vadjustment->value;
-
- if (table->drop_highlight == NULL) {
- table->drop_highlight =
- gnome_canvas_item_new (gnome_canvas_root (table->table_canvas),
- gnome_canvas_rect_get_type (),
- "fill_color", NULL,
- /* "outline_color", "black",
- "width_pixels", 1,*/
- "outline_color_gdk", &(GTK_WIDGET (table)->style->fg[GTK_STATE_NORMAL]),
- NULL);
- }
- gnome_canvas_item_set (table->drop_highlight,
- "x1", (double) x,
- "x2", (double) x + width - 1,
- "y1", (double) y,
- "y2", (double) y + height - 1,
- NULL);
- } else {
- gtk_object_destroy (GTK_OBJECT (table->drop_highlight));
- table->drop_highlight = NULL;
- }
-}
-
-/**
- * e_table_drag_unhighlight:
- * @table: The #ETable to unhighlight
- *
- * Removes the highlight from an #ETable.
- **/
-void
-e_table_drag_unhighlight (ETable *table)
-{
- g_return_if_fail(table != NULL);
- g_return_if_fail(E_IS_TABLE(table));
-
- if (table->drop_highlight) {
- gtk_object_destroy (GTK_OBJECT (table->drop_highlight));
- table->drop_highlight = NULL;
- }
-}
-
-void e_table_drag_dest_set (ETable *table,
- GtkDestDefaults flags,
- const GtkTargetEntry *targets,
- gint n_targets,
- GdkDragAction actions)
-{
- g_return_if_fail(table != NULL);
- g_return_if_fail(E_IS_TABLE(table));
-
- gtk_drag_dest_set(GTK_WIDGET(table),
- flags,
- targets,
- n_targets,
- actions);
-}
-
-void e_table_drag_dest_set_proxy (ETable *table,
- GdkWindow *proxy_window,
- GdkDragProtocol protocol,
- gboolean use_coordinates)
-{
- g_return_if_fail(table != NULL);
- g_return_if_fail(E_IS_TABLE(table));
-
- gtk_drag_dest_set_proxy(GTK_WIDGET(table),
- proxy_window,
- protocol,
- use_coordinates);
-}
-
-/*
- * There probably should be functions for setting the targets
- * as a GtkTargetList
- */
-
-void
-e_table_drag_dest_unset (GtkWidget *widget)
-{
- g_return_if_fail(widget != NULL);
- g_return_if_fail(E_IS_TABLE(widget));
-
- gtk_drag_dest_unset(widget);
-}
-
-/* Source side */
-
-static gint
-et_real_start_drag (ETable *table, int row, int col, GdkEvent *event)
-{
- GtkDragSourceInfo *info;
- GdkDragContext *context;
- ETableDragSourceSite *site;
-
- if (table->do_drag) {
- site = table->site;
-
- site->state = 0;
- context = e_table_drag_begin (table, row, col,
- site->target_list,
- site->actions,
- 1, event);
-
- if (context) {
- info = g_dataset_get_data (context, "gtk-info");
-
- if (info && !info->icon_window) {
- if (site->pixmap)
- gtk_drag_set_icon_pixmap (context,
- site->colormap,
- site->pixmap,
- site->mask, -2, -2);
- else
- gtk_drag_set_icon_default (context);
- }
- }
- return TRUE;
- }
- return FALSE;
-}
-
-/**
- * e_table_drag_source_set:
- * @table: The #ETable to set up as a drag site
- * @start_button_mask: Mask of allowed buttons to start drag
- * @targets: Table of targets for this source
- * @n_targets: Number of targets in @targets
- * @actions: Actions allowed for this source
- *
- * Registers this table as a drag site, and possibly adds default behaviors.
- **/
-void
-e_table_drag_source_set (ETable *table,
- GdkModifierType start_button_mask,
- const GtkTargetEntry *targets,
- gint n_targets,
- GdkDragAction actions)
-{
- ETableDragSourceSite *site;
- GtkWidget *canvas;
-
- g_return_if_fail(table != NULL);
- g_return_if_fail(E_IS_TABLE(table));
-
- canvas = GTK_WIDGET(table->table_canvas);
- site = table->site;
-
- gtk_widget_add_events (canvas,
- gtk_widget_get_events (canvas) |
- GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
- GDK_BUTTON_MOTION_MASK | GDK_STRUCTURE_MASK);
-
- table->do_drag = TRUE;
-
- if (site) {
- if (site->target_list)
- gtk_target_list_unref (site->target_list);
- } else {
- site = g_new0 (ETableDragSourceSite, 1);
- table->site = site;
- }
-
- site->start_button_mask = start_button_mask;
-
- if (targets)
- site->target_list = gtk_target_list_new (targets, n_targets);
- else
- site->target_list = NULL;
-
- site->actions = actions;
-}
-
-/**
- * e_table_drag_source_unset:
- * @table: The #ETable to un set up as a drag site
- *
- * Unregisters this #ETable as a drag site.
- **/
-void
-e_table_drag_source_unset (ETable *table)
-{
- ETableDragSourceSite *site;
-
- g_return_if_fail (table != NULL);
- g_return_if_fail (E_IS_TABLE(table));
-
- site = table->site;
-
- if (site) {
- g_free (site);
- table->site = NULL;
- }
- table->do_drag = FALSE;
-}
-
-/* There probably should be functions for setting the targets
- * as a GtkTargetList
- */
-
-/**
- * e_table_drag_begin:
- * @table: The #ETable to drag from
- * @row: The row number of the cell
- * @col: The col number of the cell
- * @targets: The list of targets supported by the drag
- * @actions: The available actions supported by the drag
- * @button: The button held down for the drag
- * @event: The event that initiated the drag
- *
- * Start a drag from this cell.
- *
- * Return value:
- * The drag context.
- **/
-GdkDragContext *
-e_table_drag_begin (ETable *table,
- int row,
- int col,
- GtkTargetList *targets,
- GdkDragAction actions,
- gint button,
- GdkEvent *event)
-{
- g_return_val_if_fail (table != NULL, NULL);
- g_return_val_if_fail (E_IS_TABLE(table), NULL);
-
- table->drag_row = row;
- table->drag_col = col;
-
- return gtk_drag_begin(GTK_WIDGET(table),
- targets,
- actions,
- button,
- event);
-}
-
-static void
-et_drag_begin (GtkWidget *widget,
- GdkDragContext *context,
- ETable *et)
-{
- gtk_signal_emit (GTK_OBJECT (et),
- et_signals [TABLE_DRAG_BEGIN],
- et->drag_row,
- et->drag_col,
- context);
-}
-
-static void
-et_drag_end (GtkWidget *widget,
- GdkDragContext *context,
- ETable *et)
-{
- gtk_signal_emit (GTK_OBJECT (et),
- et_signals [TABLE_DRAG_END],
- et->drag_row,
- et->drag_col,
- context);
-}
-
-static void
-et_drag_data_get(GtkWidget *widget,
- GdkDragContext *context,
- GtkSelectionData *selection_data,
- guint info,
- guint time,
- ETable *et)
-{
- gtk_signal_emit (GTK_OBJECT (et),
- et_signals [TABLE_DRAG_DATA_GET],
- et->drag_row,
- et->drag_col,
- context,
- selection_data,
- info,
- time);
-}
-
-static void
-et_drag_data_delete(GtkWidget *widget,
- GdkDragContext *context,
- ETable *et)
-{
- gtk_signal_emit (GTK_OBJECT (et),
- et_signals [TABLE_DRAG_DATA_DELETE],
- et->drag_row,
- et->drag_col,
- context);
-}
-
-static gboolean
-do_drag_motion(ETable *et,
- GdkDragContext *context,
- gint x,
- gint y,
- guint time)
-{
- gboolean ret_val;
- int row, col;
- GtkWidget *widget;
-
- widget = GTK_WIDGET (et);
-
- x -= widget->allocation.x;
- y -= widget->allocation.y;
-
- e_table_get_cell_at (et, x, y, &row, &col);
-
- if (row != et->drop_row && col != et->drop_row) {
- gtk_signal_emit (GTK_OBJECT (et),
- et_signals [TABLE_DRAG_LEAVE],
- et->drop_row,
- et->drop_col,
- context,
- time);
- }
- et->drop_row = row;
- et->drop_col = col;
- gtk_signal_emit (GTK_OBJECT (et),
- et_signals [TABLE_DRAG_MOTION],
- et->drop_row,
- et->drop_col,
- context,
- x,
- y,
- time,
- &ret_val);
-
- return ret_val;
-}
-
-static gboolean
-scroll_timeout (gpointer data)
-{
- ETable *et = data;
- int dx = 0, dy = 0;
- GtkAdjustment *h, *v;
- double hvalue, vvalue;
-
- if (et->scroll_direction & ET_SCROLL_DOWN)
- dy += 20;
- if (et->scroll_direction & ET_SCROLL_UP)
- dy -= 20;
-
- if (et->scroll_direction & ET_SCROLL_RIGHT)
- dx += 20;
- if (et->scroll_direction & ET_SCROLL_LEFT)
- dx -= 20;
-
- h = GTK_LAYOUT(et->table_canvas)->hadjustment;
- v = GTK_LAYOUT(et->table_canvas)->vadjustment;
-
- hvalue = h->value;
- vvalue = v->value;
-
- gtk_adjustment_set_value(h, CLAMP(h->value + dx, h->lower, h->upper - h->page_size));
- gtk_adjustment_set_value(v, CLAMP(v->value + dy, v->lower, v->upper - v->page_size));
-
- if (h->value != hvalue ||
- v->value != vvalue)
- do_drag_motion(et,
- et->last_drop_context,
- et->last_drop_x,
- et->last_drop_y,
- et->last_drop_time);
-
-
- return TRUE;
-}
-
-static void
-scroll_on (ETable *et, guint scroll_direction)
-{
- if (et->scroll_idle_id == 0 || scroll_direction != et->scroll_direction) {
- if (et->scroll_idle_id != 0)
- g_source_remove (et->scroll_idle_id);
- et->scroll_direction = scroll_direction;
- et->scroll_idle_id = g_timeout_add (100, scroll_timeout, et);
- }
-}
-
-static void
-scroll_off (ETable *et)
-{
- if (et->scroll_idle_id) {
- g_source_remove (et->scroll_idle_id);
- et->scroll_idle_id = 0;
- }
-}
-
-static void
-context_destroyed (gpointer data)
-{
- ETable *et = data;
- if (!GTK_OBJECT_DESTROYED (et)) {
- et->last_drop_x = 0;
- et->last_drop_y = 0;
- et->last_drop_time = 0;
- et->last_drop_context = NULL;
- scroll_off (et);
- }
- gtk_object_unref (GTK_OBJECT (et));
-}
-
-static void
-context_connect (ETable *et, GdkDragContext *context)
-{
- if (g_dataset_get_data (context, "e-table") == NULL) {
- gtk_object_ref (GTK_OBJECT (et));
- g_dataset_set_data_full (context, "e-table", et, context_destroyed);
- }
-}
-
-static void
-et_drag_leave(GtkWidget *widget,
- GdkDragContext *context,
- guint time,
- ETable *et)
-{
- gtk_signal_emit (GTK_OBJECT (et),
- et_signals [TABLE_DRAG_LEAVE],
- et->drop_row,
- et->drop_col,
- context,
- time);
- et->drop_row = -1;
- et->drop_col = -1;
-
- scroll_off (et);
-}
-
-static gboolean
-et_drag_motion(GtkWidget *widget,
- GdkDragContext *context,
- gint x,
- gint y,
- guint time,
- ETable *et)
-{
- gboolean ret_val;
- guint direction = 0;
-
- et->last_drop_x = x;
- et->last_drop_y = y;
- et->last_drop_time = time;
- et->last_drop_context = context;
- context_connect (et, context);
-
- ret_val = do_drag_motion (et,
- context,
- x,
- y,
- time);
-
-
- x -= widget->allocation.x;
- y -= widget->allocation.y;
-
- if (y < 20)
- direction |= ET_SCROLL_UP;
- if (y > widget->allocation.height - 20)
- direction |= ET_SCROLL_DOWN;
- if (x < 20)
- direction |= ET_SCROLL_LEFT;
- if (x > widget->allocation.width - 20)
- direction |= ET_SCROLL_RIGHT;
-
- if (direction != 0)
- scroll_on (et, direction);
- else
- scroll_off (et);
-
- return ret_val;
-}
-
-static gboolean
-et_drag_drop(GtkWidget *widget,
- GdkDragContext *context,
- gint x,
- gint y,
- guint time,
- ETable *et)
-{
- gboolean ret_val;
- int row, col;
-
- x -= widget->allocation.x;
- y -= widget->allocation.y;
-
- e_table_get_cell_at (et, x, y, &row, &col);
-
- if (row != et->drop_row && col != et->drop_row) {
- gtk_signal_emit (GTK_OBJECT (et),
- et_signals [TABLE_DRAG_LEAVE],
- et->drop_row,
- et->drop_col,
- context,
- time);
- gtk_signal_emit (GTK_OBJECT (et),
- et_signals [TABLE_DRAG_MOTION],
- row,
- col,
- context,
- x,
- y,
- time,
- &ret_val);
- }
- et->drop_row = row;
- et->drop_col = col;
- gtk_signal_emit (GTK_OBJECT (et),
- et_signals [TABLE_DRAG_DROP],
- et->drop_row,
- et->drop_col,
- context,
- x,
- y,
- time,
- &ret_val);
- et->drop_row = -1;
- et->drop_col = -1;
-
- scroll_off (et);
-
- return ret_val;
-}
-
-static void
-et_drag_data_received(GtkWidget *widget,
- GdkDragContext *context,
- gint x,
- gint y,
- GtkSelectionData *selection_data,
- guint info,
- guint time,
- ETable *et)
-{
- int row, col;
-
- x -= widget->allocation.x;
- y -= widget->allocation.y;
-
- e_table_get_cell_at (et, x, y, &row, &col);
-
- gtk_signal_emit (GTK_OBJECT (et),
- et_signals [TABLE_DRAG_DATA_RECEIVED],
- row,
- col,
- context,
- x,
- y,
- selection_data,
- info,
- time);
-}
-
-static void
-e_table_class_init (ETableClass *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 (PARENT_TYPE);
-
- object_class->destroy = et_destroy;
- object_class->set_arg = et_set_arg;
- object_class->get_arg = et_get_arg;
-
- widget_class->grab_focus = et_grab_focus;
- widget_class->unrealize = et_unrealize;
- widget_class->size_request = et_size_request;
-
- container_class->focus = et_focus;
-
- class->cursor_change = NULL;
- class->cursor_activated = NULL;
- class->selection_change = NULL;
- class->double_click = NULL;
- class->right_click = NULL;
- class->click = NULL;
- class->key_press = NULL;
- class->start_drag = et_real_start_drag;
- class->state_change = NULL;
- class->white_space_event = NULL;
-
- class->table_drag_begin = NULL;
- class->table_drag_end = NULL;
- class->table_drag_data_get = NULL;
- class->table_drag_data_delete = NULL;
-
- class->table_drag_leave = NULL;
- class->table_drag_motion = NULL;
- class->table_drag_drop = NULL;
- class->table_drag_data_received = NULL;
-
- et_signals [CURSOR_CHANGE] =
- gtk_signal_new ("cursor_change",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETableClass, cursor_change),
- gtk_marshal_NONE__INT,
- GTK_TYPE_NONE, 1, GTK_TYPE_INT);
-
- et_signals [CURSOR_ACTIVATED] =
- gtk_signal_new ("cursor_activated",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETableClass, cursor_activated),
- gtk_marshal_NONE__INT,
- GTK_TYPE_NONE, 1, GTK_TYPE_INT);
-
- et_signals [SELECTION_CHANGE] =
- gtk_signal_new ("selection_change",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETableClass, selection_change),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- et_signals [DOUBLE_CLICK] =
- gtk_signal_new ("double_click",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETableClass, double_click),
- gtk_marshal_NONE__INT_INT_POINTER,
- GTK_TYPE_NONE, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT);
-
- et_signals [RIGHT_CLICK] =
- gtk_signal_new ("right_click",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETableClass, right_click),
- e_marshal_INT__INT_INT_POINTER,
- GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT);
-
- et_signals [CLICK] =
- gtk_signal_new ("click",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETableClass, click),
- e_marshal_INT__INT_INT_POINTER,
- GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT);
-
- et_signals [KEY_PRESS] =
- gtk_signal_new ("key_press",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETableClass, key_press),
- e_marshal_INT__INT_INT_POINTER,
- GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT);
-
- et_signals [START_DRAG] =
- gtk_signal_new ("start_drag",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETableClass, start_drag),
- e_marshal_INT__INT_INT_POINTER,
- GTK_TYPE_INT, 3, GTK_TYPE_INT, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT);
-
- et_signals [STATE_CHANGE] =
- gtk_signal_new ("state_change",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETableClass, state_change),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- et_signals [WHITE_SPACE_EVENT] =
- gtk_signal_new ("white_space_event",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETableClass, white_space_event),
- gtk_marshal_INT__POINTER,
- GTK_TYPE_INT, 1, GTK_TYPE_GDK_EVENT);
-
- et_signals[TABLE_DRAG_BEGIN] =
- gtk_signal_new ("table_drag_begin",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETableClass, table_drag_begin),
- gtk_marshal_NONE__INT_INT_POINTER,
- GTK_TYPE_NONE, 3,
- GTK_TYPE_INT,
- GTK_TYPE_INT,
- GTK_TYPE_GDK_DRAG_CONTEXT);
- et_signals[TABLE_DRAG_END] =
- gtk_signal_new ("table_drag_end",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETableClass, table_drag_end),
- gtk_marshal_NONE__INT_INT_POINTER,
- GTK_TYPE_NONE, 3,
- GTK_TYPE_INT,
- GTK_TYPE_INT,
- GTK_TYPE_GDK_DRAG_CONTEXT);
- et_signals[TABLE_DRAG_DATA_GET] =
- gtk_signal_new ("table_drag_data_get",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETableClass, table_drag_data_get),
- e_marshal_NONE__INT_INT_POINTER_POINTER_UINT_UINT,
- GTK_TYPE_NONE, 6,
- GTK_TYPE_INT,
- GTK_TYPE_INT,
- GTK_TYPE_GDK_DRAG_CONTEXT,
- GTK_TYPE_SELECTION_DATA,
- GTK_TYPE_UINT,
- GTK_TYPE_UINT);
- et_signals[TABLE_DRAG_DATA_DELETE] =
- gtk_signal_new ("table_drag_data_delete",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETableClass, table_drag_data_delete),
- gtk_marshal_NONE__INT_INT_POINTER,
- GTK_TYPE_NONE, 3,
- GTK_TYPE_INT,
- GTK_TYPE_INT,
- GTK_TYPE_GDK_DRAG_CONTEXT);
-
- et_signals[TABLE_DRAG_LEAVE] =
- gtk_signal_new ("table_drag_leave",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETableClass, table_drag_leave),
- e_marshal_NONE__INT_INT_POINTER_UINT,
- GTK_TYPE_NONE, 4,
- GTK_TYPE_INT,
- GTK_TYPE_INT,
- GTK_TYPE_GDK_DRAG_CONTEXT,
- GTK_TYPE_UINT);
- et_signals[TABLE_DRAG_MOTION] =
- gtk_signal_new ("table_drag_motion",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETableClass, table_drag_motion),
- e_marshal_BOOL__INT_INT_POINTER_INT_INT_UINT,
- GTK_TYPE_BOOL, 6,
- GTK_TYPE_INT,
- GTK_TYPE_INT,
- GTK_TYPE_GDK_DRAG_CONTEXT,
- GTK_TYPE_INT,
- GTK_TYPE_INT,
- GTK_TYPE_UINT);
- et_signals[TABLE_DRAG_DROP] =
- gtk_signal_new ("table_drag_drop",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETableClass, table_drag_drop),
- e_marshal_BOOL__INT_INT_POINTER_INT_INT_UINT,
- GTK_TYPE_BOOL, 6,
- GTK_TYPE_INT,
- GTK_TYPE_INT,
- GTK_TYPE_GDK_DRAG_CONTEXT,
- GTK_TYPE_INT,
- GTK_TYPE_INT,
- GTK_TYPE_UINT);
- et_signals[TABLE_DRAG_DATA_RECEIVED] =
- gtk_signal_new ("table_drag_data_received",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETableClass, table_drag_data_received),
- e_marshal_NONE__INT_INT_POINTER_INT_INT_POINTER_UINT_UINT,
- GTK_TYPE_NONE, 8,
- GTK_TYPE_INT,
- GTK_TYPE_INT,
- GTK_TYPE_GDK_DRAG_CONTEXT,
- GTK_TYPE_INT,
- GTK_TYPE_INT,
- GTK_TYPE_SELECTION_DATA,
- GTK_TYPE_UINT,
- GTK_TYPE_UINT);
-
- E_OBJECT_CLASS_ADD_SIGNALS (object_class, et_signals, LAST_SIGNAL);
-
- class->set_scroll_adjustments = set_scroll_adjustments;
-
- widget_class->set_scroll_adjustments_signal =
- gtk_signal_new ("set_scroll_adjustments",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETableClass, set_scroll_adjustments),
- gtk_marshal_NONE__POINTER_POINTER,
- GTK_TYPE_NONE, 2, GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT);
-
- gtk_object_add_arg_type ("ETable::length_threshold", GTK_TYPE_INT,
- GTK_ARG_WRITABLE, ARG_LENGTH_THRESHOLD);
- gtk_object_add_arg_type ("ETable::uniform_row_height", GTK_TYPE_BOOL,
- GTK_ARG_READWRITE, ARG_UNIFORM_ROW_HEIGHT);
- gtk_object_add_arg_type ("ETable::model", E_TABLE_MODEL_TYPE,
- GTK_ARG_READABLE, ARG_MODEL);
-}
-
-E_MAKE_TYPE(e_table, "ETable", ETable, e_table_class_init, e_table_init, PARENT_TYPE);
diff --git a/widgets/table/e-table.dia b/widgets/table/e-table.dia
deleted file mode 100644
index 5aeb01228c..0000000000
--- a/widgets/table/e-table.dia
+++ /dev/null
Binary files differ
diff --git a/widgets/table/e-table.h b/widgets/table/e-table.h
deleted file mode 100644
index d288db73e0..0000000000
--- a/widgets/table/e-table.h
+++ /dev/null
@@ -1,355 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table.h - A graphical view of a Table.
- * Copyright 1999, 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- * Miguel de Icaza <miguel@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_TABLE_H_
-#define _E_TABLE_H_
-
-#include <libgnomeui/gnome-canvas.h>
-#include <gtk/gtktable.h>
-#include <gnome-xml/tree.h>
-#include <gal/e-table/e-table-model.h>
-#include <gal/e-table/e-table-header.h>
-#include <gal/e-table/e-table-group.h>
-#include <gal/e-table/e-table-sort-info.h>
-#include <gal/e-table/e-table-item.h>
-#include <gal/e-table/e-table-selection-model.h>
-#include <gal/e-table/e-table-extras.h>
-#include <gal/e-table/e-table-specification.h>
-#include <gal/widgets/e-printable.h>
-#include <gal/e-table/e-table-state.h>
-#include <gal/e-table/e-table-sorter.h>
-#include <gal/e-table/e-table-search.h>
-#include <libgnome/gnome-defs.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 _ETableDragSourceSite ETableDragSourceSite;
-
-typedef enum {
- E_TABLE_CURSOR_LOC_NONE = 0,
- E_TABLE_CURSOR_LOC_ETCTA = 1 << 0,
- E_TABLE_CURSOR_LOC_TABLE = 1 << 1,
-} ETableCursorLoc;
-
-typedef struct {
- GtkTable parent;
-
- ETableModel *model;
-
- ETableHeader *full_header, *header;
-
- GnomeCanvasItem *canvas_vbox;
- ETableGroup *group;
-
- ETableSortInfo *sort_info;
- ETableSorter *sorter;
-
- ETableSelectionModel *selection;
- ETableCursorLoc cursor_loc;
- ETableSpecification *spec;
-
- ETableSearch *search;
-
- ETableSearchFunc current_search;
- int current_search_col;
-
- guint search_search_id;
- guint search_accept_id;
-
- int table_model_change_id;
- int table_row_change_id;
- int table_cell_change_id;
- int table_rows_inserted_id;
- int table_rows_deleted_id;
-
- int group_info_change_id;
- int sort_info_change_id;
-
- int structure_change_id;
- int expansion_change_id;
- int dimension_change_id;
-
- int reflow_idle_id;
- int scroll_idle_id;
-
- GnomeCanvas *header_canvas, *table_canvas;
-
- GnomeCanvasItem *header_item, *root;
-
- GnomeCanvasItem *white_item;
-
- gint length_threshold;
-
- gint rebuild_idle_id;
- guint need_rebuild:1;
-
- /*
- * Configuration settings
- */
- guint alternating_row_colors : 1;
- guint horizontal_draw_grid : 1;
- guint vertical_draw_grid : 1;
- guint draw_focus : 1;
- guint row_selection_active : 1;
-
- guint horizontal_scrolling : 1;
- guint horizontal_resize : 1;
-
- guint is_grouped : 1;
-
- guint scroll_direction : 4;
-
- guint do_drag : 1;
-
- guint uniform_row_height : 1;
- guint allow_grouping : 1;
-
- char *click_to_add_message;
- GnomeCanvasItem *click_to_add;
- gboolean use_click_to_add;
- gboolean use_click_to_add_end;
-
- ECursorMode cursor_mode;
-
- int drag_get_data_row;
- int drag_get_data_col;
-
- int drop_row;
- int drop_col;
- GnomeCanvasItem *drop_highlight;
- int last_drop_x;
- int last_drop_y;
- int last_drop_time;
- GdkDragContext *last_drop_context;
-
- int drag_row;
- int drag_col;
- ETableDragSourceSite *site;
-
- int header_width;
-} ETable;
-
-typedef struct {
- GtkTableClass parent_class;
-
- void (*cursor_change) (ETable *et, int row);
- void (*cursor_activated) (ETable *et, int row);
- void (*selection_change) (ETable *et);
- void (*double_click) (ETable *et, int row, int col, GdkEvent *event);
- gint (*right_click) (ETable *et, int row, int col, GdkEvent *event);
- gint (*click) (ETable *et, int row, int col, GdkEvent *event);
- gint (*key_press) (ETable *et, int row, int col, GdkEvent *event);
- gint (*start_drag) (ETable *et, int row, int col, GdkEvent *event);
- void (*state_change) (ETable *et);
- gint (*white_space_event) (ETable *et, GdkEvent *event);
-
- void (*set_scroll_adjustments) (ETable *table,
- GtkAdjustment *hadjustment,
- GtkAdjustment *vadjustment);
-
- /* Source side drag signals */
- void (* table_drag_begin) (ETable *table,
- int row,
- int col,
- GdkDragContext *context);
- void (* table_drag_end) (ETable *table,
- int row,
- int col,
- GdkDragContext *context);
- void (* table_drag_data_get) (ETable *table,
- int row,
- int col,
- GdkDragContext *context,
- GtkSelectionData *selection_data,
- guint info,
- guint time);
- void (* table_drag_data_delete) (ETable *table,
- int row,
- int col,
- GdkDragContext *context);
-
- /* Target side drag signals */
- void (* table_drag_leave) (ETable *table,
- int row,
- int col,
- GdkDragContext *context,
- guint time);
- gboolean (* table_drag_motion) (ETable *table,
- int row,
- int col,
- GdkDragContext *context,
- gint x,
- gint y,
- guint time);
- gboolean (* table_drag_drop) (ETable *table,
- int row,
- int col,
- GdkDragContext *context,
- gint x,
- gint y,
- guint time);
- void (* table_drag_data_received) (ETable *table,
- int row,
- int col,
- GdkDragContext *context,
- gint x,
- gint y,
- GtkSelectionData *selection_data,
- guint info,
- guint time);
-} ETableClass;
-GtkType e_table_get_type (void);
-ETable *e_table_construct (ETable *e_table,
- ETableModel *etm,
- ETableExtras *ete,
- const char *spec,
- const char *state);
-GtkWidget *e_table_new (ETableModel *etm,
- ETableExtras *ete,
- const char *spec,
- const char *state);
-
-/* Create an ETable using files. */
-ETable *e_table_construct_from_spec_file (ETable *e_table,
- ETableModel *etm,
- ETableExtras *ete,
- const char *spec_fn,
- const char *state_fn);
-GtkWidget *e_table_new_from_spec_file (ETableModel *etm,
- ETableExtras *ete,
- const char *spec_fn,
- const char *state_fn);
-
-/* To save the state */
-gchar *e_table_get_state (ETable *e_table);
-void e_table_save_state (ETable *e_table,
- const gchar *filename);
-ETableState *e_table_get_state_object (ETable *e_table);
-
-/* note that it is more efficient to provide the state at creation time */
-void e_table_set_state (ETable *e_table,
- const gchar *state);
-void e_table_set_state_object (ETable *e_table,
- ETableState *state);
-void e_table_load_state (ETable *e_table,
- const gchar *filename);
-void e_table_set_cursor_row (ETable *e_table,
- int row);
-
-/* -1 means we don't have the cursor. This is in model rows. */
-int e_table_get_cursor_row (ETable *e_table);
-void e_table_selected_row_foreach (ETable *e_table,
- EForeachFunc callback,
- gpointer closure);
-gint e_table_selected_count (ETable *e_table);
-EPrintable *e_table_get_printable (ETable *e_table);
-gint e_table_get_next_row (ETable *e_table,
- gint model_row);
-gint e_table_get_prev_row (ETable *e_table,
- gint model_row);
-gint e_table_model_to_view_row (ETable *e_table,
- gint model_row);
-gint e_table_view_to_model_row (ETable *e_table,
- gint view_row);
-void e_table_get_cell_at (ETable *table,
- int x,
- int y,
- int *row_return,
- int *col_return);
-void e_table_get_cell_geometry (ETable *table,
- int row,
- int col,
- int *x_return,
- int *y_return,
- int *width_return,
- int *height_return);
-
-/* Useful accessor functions. */
-ESelectionModel *e_table_get_selection_model (ETable *table);
-
-/* Drag & drop stuff. */
-/* Target */
-void e_table_drag_get_data (ETable *table,
- int row,
- int col,
- GdkDragContext *context,
- GdkAtom target,
- guint32 time);
-void e_table_drag_highlight (ETable *table,
- int row,
- int col); /* col == -1 to highlight entire row. */
-void e_table_drag_unhighlight (ETable *table);
-void e_table_drag_dest_set (ETable *table,
- GtkDestDefaults flags,
- const GtkTargetEntry *targets,
- gint n_targets,
- GdkDragAction actions);
-void e_table_drag_dest_set_proxy (ETable *table,
- GdkWindow *proxy_window,
- GdkDragProtocol protocol,
- gboolean use_coordinates);
-
-/* There probably should be functions for setting the targets
- * as a GtkTargetList
- */
-void e_table_drag_dest_unset (GtkWidget *widget);
-
-/* Source side */
-void e_table_drag_source_set (ETable *table,
- GdkModifierType start_button_mask,
- const GtkTargetEntry *targets,
- gint n_targets,
- GdkDragAction actions);
-void e_table_drag_source_unset (ETable *table);
-
-/* There probably should be functions for setting the targets
- * as a GtkTargetList
- */
-GdkDragContext *e_table_drag_begin (ETable *table,
- int row,
- int col,
- GtkTargetList *targets,
- GdkDragAction actions,
- gint button,
- GdkEvent *event);
-
-/* selection stuff */
-void e_table_select_all (ETable *table);
-void e_table_invert_selection (ETable *table);
-
-/* This function is only needed in single_selection_mode. */
-void e_table_right_click_up (ETable *table);
-
-void e_table_commit_click_to_add (ETable *table);
-
-END_GNOME_DECLS
-
-#endif /* _E_TABLE_H_ */
-
diff --git a/widgets/table/e-tree-memory-callbacks.c b/widgets/table/e-tree-memory-callbacks.c
deleted file mode 100644
index e129891656..0000000000
--- a/widgets/table/e-tree-memory-callbacks.c
+++ /dev/null
@@ -1,275 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-tree-memory-callbacks.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <gtk/gtksignal.h>
-#include "gal/util/e-util.h"
-#include "e-tree-memory-callbacks.h"
-
-#define PARENT_TYPE E_TREE_MEMORY_TYPE
-
-static GdkPixbuf *
-etmc_icon_at (ETreeModel *etm, ETreePath node)
-{
- ETreeMemoryCallbacks *etmc = E_TREE_MEMORY_CALLBACKS(etm);
-
- return etmc->icon_at (etm, node, etmc->model_data);
-}
-
-static int
-etmc_column_count (ETreeModel *etm)
-{
- ETreeMemoryCallbacks *etmc = E_TREE_MEMORY_CALLBACKS(etm);
-
- if (etmc->column_count)
- return etmc->column_count (etm, etmc->model_data);
- else
- return 0;
-}
-
-
-static gboolean
-etmc_has_save_id (ETreeModel *etm)
-{
- ETreeMemoryCallbacks *etmc = E_TREE_MEMORY_CALLBACKS(etm);
-
- if (etmc->has_save_id)
- return etmc->has_save_id (etm, etmc->model_data);
- else
- return FALSE;
-}
-
-static char *
-etmc_get_save_id (ETreeModel *etm, ETreePath node)
-{
- ETreeMemoryCallbacks *etmc = E_TREE_MEMORY_CALLBACKS(etm);
-
- if (etmc->get_save_id)
- return etmc->get_save_id (etm, node, etmc->model_data);
- else
- return NULL;
-}
-
-static gboolean
-etmc_has_get_node_by_id (ETreeModel *etm)
-{
- ETreeMemoryCallbacks *etmc = E_TREE_MEMORY_CALLBACKS(etm);
-
- if (etmc->has_get_node_by_id)
- return etmc->has_get_node_by_id (etm, etmc->model_data);
- else
- return FALSE;
-}
-
-static ETreePath
-etmc_get_node_by_id (ETreeModel *etm, const char *save_id)
-{
- ETreeMemoryCallbacks *etmc = E_TREE_MEMORY_CALLBACKS(etm);
-
- if (etmc->get_node_by_id)
- return etmc->get_node_by_id (etm, save_id, etmc->model_data);
- else
- return NULL;
-}
-
-
-static void *
-etmc_value_at (ETreeModel *etm, ETreePath node, int col)
-{
- ETreeMemoryCallbacks *etmc = E_TREE_MEMORY_CALLBACKS(etm);
-
- return etmc->value_at (etm, node, col, etmc->model_data);
-}
-
-static void
-etmc_set_value_at (ETreeModel *etm, ETreePath node, int col, const void *val)
-{
- ETreeMemoryCallbacks *etmc = E_TREE_MEMORY_CALLBACKS(etm);
-
- etmc->set_value_at (etm, node, col, val, etmc->model_data);
-}
-
-static gboolean
-etmc_is_editable (ETreeModel *etm, ETreePath node, int col)
-{
- ETreeMemoryCallbacks *etmc = E_TREE_MEMORY_CALLBACKS(etm);
-
- return etmc->is_editable (etm, node, col, etmc->model_data);
-}
-
-
-/* The default for etmc_duplicate_value is to return the raw value. */
-static void *
-etmc_duplicate_value (ETreeModel *etm, int col, const void *value)
-{
- ETreeMemoryCallbacks *etmc = E_TREE_MEMORY_CALLBACKS(etm);
-
- if (etmc->duplicate_value)
- return etmc->duplicate_value (etm, col, value, etmc->model_data);
- else
- return (void *)value;
-}
-
-static void
-etmc_free_value (ETreeModel *etm, int col, void *value)
-{
- ETreeMemoryCallbacks *etmc = E_TREE_MEMORY_CALLBACKS(etm);
-
- if (etmc->free_value)
- etmc->free_value (etm, col, value, etmc->model_data);
-}
-
-static void *
-etmc_initialize_value (ETreeModel *etm, int col)
-{
- ETreeMemoryCallbacks *etmc = E_TREE_MEMORY_CALLBACKS(etm);
-
- if (etmc->initialize_value)
- return etmc->initialize_value (etm, col, etmc->model_data);
- else
- return NULL;
-}
-
-static gboolean
-etmc_value_is_empty (ETreeModel *etm, int col, const void *value)
-{
- ETreeMemoryCallbacks *etmc = E_TREE_MEMORY_CALLBACKS(etm);
-
- if (etmc->value_is_empty)
- return etmc->value_is_empty (etm, col, value, etmc->model_data);
- else
- return FALSE;
-}
-
-static char *
-etmc_value_to_string (ETreeModel *etm, int col, const void *value)
-{
- ETreeMemoryCallbacks *etmc = E_TREE_MEMORY_CALLBACKS(etm);
-
- if (etmc->value_to_string)
- return etmc->value_to_string (etm, col, value, etmc->model_data);
- else
- return g_strdup ("");
-}
-
-static void
-e_tree_memory_callbacks_class_init (GtkObjectClass *object_class)
-{
- ETreeModelClass *model_class = (ETreeModelClass *) object_class;
-
- model_class->icon_at = etmc_icon_at;
-
- model_class->column_count = etmc_column_count;
-
- model_class->has_save_id = etmc_has_save_id;
- model_class->get_save_id = etmc_get_save_id;
-
- model_class->has_get_node_by_id = etmc_has_get_node_by_id;
- model_class->get_node_by_id = etmc_get_node_by_id;
-
- model_class->value_at = etmc_value_at;
- model_class->set_value_at = etmc_set_value_at;
- model_class->is_editable = etmc_is_editable;
-
- model_class->duplicate_value = etmc_duplicate_value;
- model_class->free_value = etmc_free_value;
- model_class->initialize_value = etmc_initialize_value;
- model_class->value_is_empty = etmc_value_is_empty;
- model_class->value_to_string = etmc_value_to_string;
-}
-
-E_MAKE_TYPE(e_tree_memory_callbacks, "ETreeMemoryCallbacks", ETreeMemoryCallbacks, e_tree_memory_callbacks_class_init, NULL, PARENT_TYPE)
-
-/**
- * e_tree_memory_callbacks_new:
- *
- * This initializes a new ETreeMemoryCallbacksModel object.
- * ETreeMemoryCallbacksModel is an implementaiton of the somewhat
- * abstract class ETreeMemory. The ETreeMemoryCallbacksModel is
- * designed to allow people to easily create ETreeMemorys without
- * having to create a new GtkType derived from ETreeMemory every time
- * they need one.
- *
- * Instead, ETreeMemoryCallbacksModel uses a setup based in callback functions, every
- * callback function signature mimics the signature of each ETreeModel method
- * and passes the extra @data pointer to each one of the method to provide them
- * with any context they might want to use.
- *
- * ETreeMemoryCallbacks is to ETreeMemory as ETableSimple is to ETableModel.
- *
- * Return value: An ETreeMemoryCallbacks object (which is also an
- * ETreeMemory and thus an ETreeModel object).
- *
- */
-ETreeModel *
-e_tree_memory_callbacks_new (ETreeMemoryCallbacksIconAtFn icon_at,
-
- ETreeMemoryCallbacksColumnCountFn column_count,
-
- ETreeMemoryCallbacksHasSaveIdFn has_save_id,
- ETreeMemoryCallbacksGetSaveIdFn get_save_id,
-
- ETreeMemoryCallbacksHasGetNodeByIdFn has_get_node_by_id,
- ETreeMemoryCallbacksGetNodeByIdFn get_node_by_id,
-
- ETreeMemoryCallbacksValueAtFn value_at,
- ETreeMemoryCallbacksSetValueAtFn set_value_at,
- ETreeMemoryCallbacksIsEditableFn is_editable,
-
- ETreeMemoryCallbacksDuplicateValueFn duplicate_value,
- ETreeMemoryCallbacksFreeValueFn free_value,
- ETreeMemoryCallbacksInitializeValueFn initialize_value,
- ETreeMemoryCallbacksValueIsEmptyFn value_is_empty,
- ETreeMemoryCallbacksValueToStringFn value_to_string,
-
- gpointer model_data)
-{
- ETreeMemoryCallbacks *etmc;
-
- etmc = gtk_type_new (e_tree_memory_callbacks_get_type ());
-
- etmc->icon_at = icon_at;
-
- etmc->column_count = column_count;
-
- etmc->has_save_id = has_save_id;
- etmc->get_save_id = get_save_id;
-
- etmc->has_get_node_by_id = has_get_node_by_id;
- etmc->get_node_by_id = get_node_by_id;
-
- etmc->value_at = value_at;
- etmc->set_value_at = set_value_at;
- etmc->is_editable = is_editable;
-
- etmc->duplicate_value = duplicate_value;
- etmc->free_value = free_value;
- etmc->initialize_value = initialize_value;
- etmc->value_is_empty = value_is_empty;
- etmc->value_to_string = value_to_string;
-
- etmc->model_data = model_data;
-
- return (ETreeModel*)etmc;
-}
-
diff --git a/widgets/table/e-tree-memory-callbacks.h b/widgets/table/e-tree-memory-callbacks.h
deleted file mode 100644
index 7d8f38cec0..0000000000
--- a/widgets/table/e-tree-memory-callbacks.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-tree-memory-callbacks.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-
-#ifndef _E_TREE_MEMORY_CALLBACKS_H_
-#define _E_TREE_MEMORY_CALLBACKS_H_
-
-#include <gal/e-table/e-tree-memory.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#define E_TREE_MEMORY_CALLBACKS_TYPE (e_tree_memory_callbacks_get_type ())
-#define E_TREE_MEMORY_CALLBACKS(o) (GTK_CHECK_CAST ((o), E_TREE_MEMORY_CALLBACKS_TYPE, ETreeMemoryCallbacks))
-#define E_TREE_MEMORY_CALLBACKS_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TREE_MEMORY_CALLBACKS_TYPE, ETreeMemoryCallbacksClass))
-#define E_IS_TREE_MEMORY_CALLBACKS(o) (GTK_CHECK_TYPE ((o), E_TREE_MEMORY_CALLBACKS_TYPE))
-#define E_IS_TREE_MEMORY_CALLBACKS_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TREE_MEMORY_CALLBACKS_TYPE))
-
-
-typedef GdkPixbuf* (*ETreeMemoryCallbacksIconAtFn) (ETreeModel *etree, ETreePath path, void *model_data);
-
-typedef gint (*ETreeMemoryCallbacksColumnCountFn) (ETreeModel *etree, void *model_data);
-
-typedef gboolean (*ETreeMemoryCallbacksHasSaveIdFn) (ETreeModel *etree, void *model_data);
-typedef gchar *(*ETreeMemoryCallbacksGetSaveIdFn) (ETreeModel *etree, ETreePath path, void *model_data);
-
-typedef gboolean (*ETreeMemoryCallbacksHasGetNodeByIdFn) (ETreeModel *etree, void *model_data);
-typedef ETreePath (*ETreeMemoryCallbacksGetNodeByIdFn) (ETreeModel *etree, const char *save_id, void *model_data);
-
-typedef void* (*ETreeMemoryCallbacksValueAtFn) (ETreeModel *etree, ETreePath path, int col, void *model_data);
-typedef void (*ETreeMemoryCallbacksSetValueAtFn) (ETreeModel *etree, ETreePath path, int col, const void *val, void *model_data);
-typedef gboolean (*ETreeMemoryCallbacksIsEditableFn) (ETreeModel *etree, ETreePath path, int col, void *model_data);
-
-typedef void *(*ETreeMemoryCallbacksDuplicateValueFn) (ETreeModel *etm, int col, const void *val, void *data);
-typedef void (*ETreeMemoryCallbacksFreeValueFn) (ETreeModel *etm, int col, void *val, void *data);
-typedef void *(*ETreeMemoryCallbacksInitializeValueFn) (ETreeModel *etm, int col, void *data);
-typedef gboolean (*ETreeMemoryCallbacksValueIsEmptyFn) (ETreeModel *etm, int col, const void *val, void *data);
-typedef char *(*ETreeMemoryCallbacksValueToStringFn) (ETreeModel *etm, int col, const void *val, void *data);
-
-typedef struct {
- ETreeMemory parent;
-
- ETreeMemoryCallbacksIconAtFn icon_at;
-
- ETreeMemoryCallbacksColumnCountFn column_count;
-
- ETreeMemoryCallbacksHasSaveIdFn has_save_id;
- ETreeMemoryCallbacksGetSaveIdFn get_save_id;
-
- ETreeMemoryCallbacksHasGetNodeByIdFn has_get_node_by_id;
- ETreeMemoryCallbacksGetNodeByIdFn get_node_by_id;
-
- ETreeMemoryCallbacksValueAtFn value_at;
- ETreeMemoryCallbacksSetValueAtFn set_value_at;
- ETreeMemoryCallbacksIsEditableFn is_editable;
-
- ETreeMemoryCallbacksDuplicateValueFn duplicate_value;
- ETreeMemoryCallbacksFreeValueFn free_value;
- ETreeMemoryCallbacksInitializeValueFn initialize_value;
- ETreeMemoryCallbacksValueIsEmptyFn value_is_empty;
- ETreeMemoryCallbacksValueToStringFn value_to_string;
-
- gpointer model_data;
-} ETreeMemoryCallbacks;
-
-typedef struct {
- ETreeMemoryClass parent_class;
-} ETreeMemoryCallbacksClass;
-
-GtkType e_tree_memory_callbacks_get_type (void);
-
-ETreeModel *e_tree_memory_callbacks_new (ETreeMemoryCallbacksIconAtFn icon_at,
-
- ETreeMemoryCallbacksColumnCountFn column_count,
-
- ETreeMemoryCallbacksHasSaveIdFn has_save_id,
- ETreeMemoryCallbacksGetSaveIdFn get_save_id,
-
- ETreeMemoryCallbacksHasGetNodeByIdFn has_get_node_by_id,
- ETreeMemoryCallbacksGetNodeByIdFn get_node_by_id,
-
- ETreeMemoryCallbacksValueAtFn value_at,
- ETreeMemoryCallbacksSetValueAtFn set_value_at,
- ETreeMemoryCallbacksIsEditableFn is_editable,
-
- ETreeMemoryCallbacksDuplicateValueFn duplicate_value,
- ETreeMemoryCallbacksFreeValueFn free_value,
- ETreeMemoryCallbacksInitializeValueFn initialize_value,
- ETreeMemoryCallbacksValueIsEmptyFn value_is_empty,
- ETreeMemoryCallbacksValueToStringFn value_to_string,
-
- gpointer model_data);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _E_TREE_MEMORY_CALLBACKS_H_ */
diff --git a/widgets/table/e-tree-memory.c b/widgets/table/e-tree-memory.c
deleted file mode 100644
index 27948727f7..0000000000
--- a/widgets/table/e-tree-memory.c
+++ /dev/null
@@ -1,725 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-tree-memory.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- * Chris Toshok <toshok@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-
-#include <stdio.h>
-#include <errno.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <stdlib.h>
-
-#include <gnome-xml/parser.h>
-#include <gnome-xml/xmlmemory.h>
-
-#include <gtk/gtksignal.h>
-#include "gal/util/e-util.h"
-#include "gal/util/e-xml-utils.h"
-#include "e-tree-memory.h"
-
-#define PARENT_TYPE E_TREE_MODEL_TYPE
-
-#define TREEPATH_CHUNK_AREA_SIZE (30 * sizeof (ETreeMemoryPath))
-
-static ETreeModelClass *parent_class;
-static GMemChunk *node_chunk;
-
-enum {
- FILL_IN_CHILDREN,
- LAST_SIGNAL
-};
-
-static guint signals [LAST_SIGNAL] = { 0, };
-
-typedef struct ETreeMemoryPath ETreeMemoryPath;
-
-struct ETreeMemoryPath {
- gpointer node_data;
-
- guint children_computed : 1;
-
- /* parent/child/sibling pointers */
- ETreeMemoryPath *parent;
- ETreeMemoryPath *next_sibling;
- ETreeMemoryPath *prev_sibling;
- ETreeMemoryPath *first_child;
- ETreeMemoryPath *last_child;
-
- gint num_children;
-};
-
-struct ETreeMemoryPriv {
- ETreeMemoryPath *root;
- gboolean expanded_default; /* whether nodes are created expanded or collapsed by default */
- gint frozen;
- GFunc destroy_func;
- gpointer destroy_user_data;
-};
-
-
-/* ETreeMemoryPath functions */
-
-static inline void
-check_children (ETreeMemory *memory, ETreePath node)
-{
- ETreeMemoryPath *path = node;
- if (!path->children_computed) {
- gtk_signal_emit (GTK_OBJECT (memory),
- signals[FILL_IN_CHILDREN], node);
- path->children_computed = TRUE;
- }
-}
-
-static int
-e_tree_memory_path_depth (ETreeMemoryPath *path)
-{
- int depth = 0;
-
- g_return_val_if_fail(path != NULL, -1);
-
- for ( path = path->parent; path; path = path->parent)
- depth ++;
- return depth;
-}
-
-static void
-e_tree_memory_path_insert (ETreeMemoryPath *parent, int position, ETreeMemoryPath *child)
-{
- g_return_if_fail (position <= parent->num_children && position >= -1);
-
- child->parent = parent;
-
- if (parent->first_child == NULL)
- parent->first_child = child;
-
- if (position == -1 || position == parent->num_children) {
- child->prev_sibling = parent->last_child;
- if (parent->last_child)
- parent->last_child->next_sibling = child;
- parent->last_child = child;
- } else {
- ETreeMemoryPath *c;
- for (c = parent->first_child; c; c = c->next_sibling) {
- if (position == 0) {
- child->next_sibling = c;
- child->prev_sibling = c->prev_sibling;
-
- if (child->next_sibling)
- child->next_sibling->prev_sibling = child;
- if (child->prev_sibling)
- child->prev_sibling->next_sibling = child;
-
- if (parent->first_child == c)
- parent->first_child = child;
- break;
- }
- position --;
- }
- }
-
- parent->num_children++;
-}
-
-static void
-e_tree_path_unlink (ETreeMemoryPath *path)
-{
- ETreeMemoryPath *parent = path->parent;
-
- /* unlink first/last child if applicable */
- if (parent) {
- if (path == parent->first_child)
- parent->first_child = path->next_sibling;
- if (path == parent->last_child)
- parent->last_child = path->prev_sibling;
-
- parent->num_children --;
- }
-
- /* unlink prev/next sibling links */
- if (path->next_sibling)
- path->next_sibling->prev_sibling = path->prev_sibling;
- if (path->prev_sibling)
- path->prev_sibling->next_sibling = path->next_sibling;
-
- path->parent = NULL;
- path->next_sibling = NULL;
- path->prev_sibling = NULL;
-}
-
-
-
-/**
- * e_tree_memory_freeze:
- * @etmm: the ETreeModel to freeze.
- *
- * This function prepares an ETreeModel for a period of much change.
- * All signals regarding changes to the tree are deferred until we
- * thaw the tree.
- *
- **/
-void
-e_tree_memory_freeze(ETreeMemory *etmm)
-{
- ETreeMemoryPriv *priv = etmm->priv;
-
- if (priv->frozen == 0)
- e_tree_model_pre_change(E_TREE_MODEL(etmm));
-
- priv->frozen ++;
-}
-
-/**
- * e_tree_memory_thaw:
- * @etmm: the ETreeMemory to thaw.
- *
- * This function thaws an ETreeMemory. All the defered signals can add
- * up to a lot, we don't know - so we just emit a model_changed
- * signal.
- *
- **/
-void
-e_tree_memory_thaw(ETreeMemory *etmm)
-{
- ETreeMemoryPriv *priv = etmm->priv;
-
- if (priv->frozen > 0)
- priv->frozen --;
- if (priv->frozen == 0) {
- e_tree_model_node_changed(E_TREE_MODEL(etmm), priv->root);
- }
-}
-
-
-/* virtual methods */
-
-static void
-etmm_destroy (GtkObject *object)
-{
- ETreeMemory *etmm = E_TREE_MEMORY (object);
- ETreeMemoryPriv *priv = etmm->priv;
-
- /* XXX lots of stuff to free here */
-
- if (priv->root)
- e_tree_memory_node_remove (etmm, priv->root);
-
- g_free (priv);
-
- GTK_OBJECT_CLASS (parent_class)->destroy (object);
-}
-
-static ETreePath
-etmm_get_root (ETreeModel *etm)
-{
- ETreeMemoryPriv *priv = E_TREE_MEMORY(etm)->priv;
- return priv->root;
-}
-
-static ETreePath
-etmm_get_parent (ETreeModel *etm, ETreePath node)
-{
- ETreeMemoryPath *path = node;
- return path->parent;
-}
-
-static ETreePath
-etmm_get_first_child (ETreeModel *etm, ETreePath node)
-{
- ETreeMemoryPath *path = node;
-
- check_children (E_TREE_MEMORY (etm), node);
- return path->first_child;
-}
-
-static ETreePath
-etmm_get_last_child (ETreeModel *etm, ETreePath node)
-{
- ETreeMemoryPath *path = node;
-
- check_children (E_TREE_MEMORY (etm), node);
- return path->last_child;
-}
-
-static ETreePath
-etmm_get_next (ETreeModel *etm, ETreePath node)
-{
- ETreeMemoryPath *path = node;
- return path->next_sibling;
-}
-
-static ETreePath
-etmm_get_prev (ETreeModel *etm, ETreePath node)
-{
- ETreeMemoryPath *path = node;
- return path->prev_sibling;
-}
-
-static gboolean
-etmm_is_root (ETreeModel *etm, ETreePath node)
-{
- ETreeMemoryPath *path = node;
- return e_tree_memory_path_depth (path) == 0;
-}
-
-static gboolean
-etmm_is_expandable (ETreeModel *etm, ETreePath node)
-{
- ETreeMemoryPath *path = node;
-
- check_children (E_TREE_MEMORY (etm), node);
- return path->first_child != NULL;
-}
-
-static guint
-etmm_get_children (ETreeModel *etm, ETreePath node, ETreePath **nodes)
-{
- ETreeMemoryPath *path = node;
- guint n_children;
-
- check_children (E_TREE_MEMORY (etm), node);
-
- n_children = path->num_children;
-
- if (nodes) {
- ETreeMemoryPath *p;
- int i = 0;
-
- (*nodes) = g_new (ETreePath, n_children);
- for (p = path->first_child; p; p = p->next_sibling) {
- (*nodes)[i++] = p;
- }
- }
-
- return n_children;
-}
-
-static guint
-etmm_depth (ETreeModel *etm, ETreePath path)
-{
- return e_tree_memory_path_depth(path);
-}
-
-static gboolean
-etmm_get_expanded_default (ETreeModel *etm)
-{
- ETreeMemory *etmm = E_TREE_MEMORY (etm);
- ETreeMemoryPriv *priv = etmm->priv;
-
- return priv->expanded_default;
-}
-
-static void
-etmm_clear_children_computed (ETreeMemoryPath *path)
-{
- for (path = path->first_child; path; path = path->next_sibling) {
- path->children_computed = FALSE;
- etmm_clear_children_computed (path);
- }
-}
-
-static void
-etmm_node_request_collapse (ETreeModel *etm, ETreePath node)
-{
- if (node)
- etmm_clear_children_computed (node);
-
- if (parent_class->node_request_collapse) {
- parent_class->node_request_collapse (etm, node);
- }
-}
-
-
-static void
-e_tree_memory_class_init (ETreeMemoryClass *klass)
-{
- ETreeModelClass *tree_class = (ETreeModelClass *) klass;
- GtkObjectClass *object_class = (GtkObjectClass *) klass;
-
- parent_class = gtk_type_class (PARENT_TYPE);
-
- node_chunk = g_mem_chunk_create (ETreeMemoryPath, TREEPATH_CHUNK_AREA_SIZE, G_ALLOC_AND_FREE);
-
- signals [FILL_IN_CHILDREN] =
- gtk_signal_new ("fill_in_children",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETreeMemoryClass, fill_in_children),
- gtk_marshal_NONE__POINTER,
- GTK_TYPE_NONE, 1, GTK_TYPE_POINTER);
-
- E_OBJECT_CLASS_ADD_SIGNALS (object_class, signals, LAST_SIGNAL);
-
- object_class->destroy = etmm_destroy;
-
- tree_class->get_root = etmm_get_root;
- tree_class->get_prev = etmm_get_prev;
- tree_class->get_next = etmm_get_next;
- tree_class->get_first_child = etmm_get_first_child;
- tree_class->get_last_child = etmm_get_last_child;
- tree_class->get_parent = etmm_get_parent;
-
- tree_class->is_root = etmm_is_root;
- tree_class->is_expandable = etmm_is_expandable;
- tree_class->get_children = etmm_get_children;
- tree_class->depth = etmm_depth;
- tree_class->get_expanded_default = etmm_get_expanded_default;
-
- tree_class->node_request_collapse = etmm_node_request_collapse;
-
- klass->fill_in_children = NULL;
-}
-
-static void
-e_tree_memory_init (GtkObject *object)
-{
- ETreeMemory *etmm = (ETreeMemory *)object;
-
- ETreeMemoryPriv *priv;
-
- priv = g_new0 (ETreeMemoryPriv, 1);
- etmm->priv = priv;
-
- priv->root = NULL;
- priv->frozen = 0;
- priv->expanded_default = 0;
- priv->destroy_func = NULL;
- priv->destroy_user_data = NULL;
-}
-
-E_MAKE_TYPE(e_tree_memory, "ETreeMemory", ETreeMemory, e_tree_memory_class_init, e_tree_memory_init, PARENT_TYPE)
-
-
-
-/**
- * e_tree_memory_construct:
- * @etree:
- *
- *
- **/
-void
-e_tree_memory_construct (ETreeMemory *etmm)
-{
-}
-
-/**
- * e_tree_memory_new
- *
- * XXX docs here.
- *
- * return values: a newly constructed ETreeMemory.
- */
-ETreeMemory *
-e_tree_memory_new (void)
-{
- ETreeMemory *etmm;
-
- etmm = gtk_type_new (e_tree_memory_get_type ());
-
- e_tree_memory_construct(etmm);
-
- return etmm;
-}
-
-void
-e_tree_memory_set_expanded_default (ETreeMemory *etree, gboolean expanded)
-{
- etree->priv->expanded_default = expanded;
-}
-
-/**
- * e_tree_memory_node_get_data:
- * @etmm:
- * @node:
- *
- *
- *
- * Return value:
- **/
-gpointer
-e_tree_memory_node_get_data (ETreeMemory *etmm, ETreePath node)
-{
- ETreeMemoryPath *path = node;
-
- g_return_val_if_fail (path, NULL);
-
- return path->node_data;
-}
-
-/**
- * e_tree_memory_node_set_data:
- * @etmm:
- * @node:
- * @node_data:
- *
- *
- **/
-void
-e_tree_memory_node_set_data (ETreeMemory *etmm, ETreePath node, gpointer node_data)
-{
- ETreeMemoryPath *path = node;
-
- g_return_if_fail (path);
-
- path->node_data = node_data;
-}
-
-/**
- * e_tree_memory_node_insert:
- * @tree_model:
- * @parent_path:
- * @position:
- * @node_data:
- *
- *
- *
- * Return value:
- **/
-ETreePath
-e_tree_memory_node_insert (ETreeMemory *tree_model,
- ETreePath parent_node,
- int position,
- gpointer node_data)
-{
- ETreeMemoryPriv *priv;
- ETreeMemoryPath *new_path;
- ETreeMemoryPath *parent_path = parent_node;
-
- g_return_val_if_fail(tree_model != NULL, NULL);
-
- priv = tree_model->priv;
-
- g_return_val_if_fail (parent_path != NULL || priv->root == NULL, NULL);
-
- priv = tree_model->priv;
-
- if (!tree_model->priv->frozen)
- e_tree_model_pre_change(E_TREE_MODEL(tree_model));
-
- new_path = g_chunk_new0 (ETreeMemoryPath, node_chunk);
-
- new_path->node_data = node_data;
- new_path->children_computed = FALSE;
-
- if (parent_path != NULL) {
- e_tree_memory_path_insert (parent_path, position, new_path);
- if (!tree_model->priv->frozen)
- e_tree_model_node_inserted (E_TREE_MODEL(tree_model), parent_path, new_path);
- } else {
- priv->root = new_path;
- if (!tree_model->priv->frozen)
- e_tree_model_node_changed(E_TREE_MODEL(tree_model), new_path);
- }
-
- return new_path;
-}
-
-ETreePath e_tree_memory_node_insert_id (ETreeMemory *etree, ETreePath parent, int position, gpointer node_data, char *id)
-{
- return e_tree_memory_node_insert(etree, parent, position, node_data);
-}
-
-/**
- * e_tree_memory_node_insert_before:
- * @etree:
- * @parent:
- * @sibling:
- * @node_data:
- *
- *
- *
- * Return value:
- **/
-ETreePath
-e_tree_memory_node_insert_before (ETreeMemory *etree,
- ETreePath parent,
- ETreePath sibling,
- gpointer node_data)
-{
- ETreeMemoryPath *child;
- ETreeMemoryPath *parent_path = parent;
- ETreeMemoryPath *sibling_path = sibling;
- int position = 0;
-
- g_return_val_if_fail(etree != NULL, NULL);
-
- if (sibling != NULL) {
- for (child = parent_path->first_child; child; child = child->next_sibling) {
- if (child == sibling_path)
- break;
- position ++;
- }
- } else
- position = parent_path->num_children;
- return e_tree_memory_node_insert (etree, parent, position, node_data);
-}
-
-/* just blows away child data, doesn't take into account unlinking/etc */
-static void
-child_free(ETreeMemory *etree, ETreeMemoryPath *node)
-{
- ETreeMemoryPath *child, *next;
-
- child = node->first_child;
- while (child) {
- next = child->next_sibling;
- child_free(etree, child);
- child = next;
- }
-
- if (etree->priv->destroy_func) {
- etree->priv->destroy_func (node->node_data, etree->priv->destroy_user_data);
- }
-
- g_chunk_free(node, node_chunk);
-}
-
-/**
- * e_tree_memory_node_remove:
- * @etree:
- * @path:
- *
- *
- *
- * Return value:
- **/
-gpointer
-e_tree_memory_node_remove (ETreeMemory *etree, ETreePath node)
-{
- ETreeMemoryPath *path = node;
- ETreeMemoryPath *parent = path->parent;
- ETreeMemoryPath *sibling;
- gpointer ret = path->node_data;
- int old_position = 0;
-
- g_return_val_if_fail(etree != NULL, NULL);
-
- if (!etree->priv->frozen) {
- e_tree_model_pre_change(E_TREE_MODEL(etree));
- for (old_position = 0, sibling = path;
- sibling;
- old_position++, sibling = sibling->prev_sibling)
- /* Empty intentionally*/;
- old_position --;
- }
-
- /* unlink this node - we only have to unlink the root node being removed,
- since the others are only references from this node */
- e_tree_path_unlink (path);
-
- /*printf("removing %d nodes from position %d\n", visible, base);*/
- if (!etree->priv->frozen)
- e_tree_model_node_removed(E_TREE_MODEL(etree), parent, path, old_position);
-
- child_free(etree, path);
-
- if (path == etree->priv->root)
- etree->priv->root = NULL;
-
- if (!etree->priv->frozen)
- e_tree_model_node_deleted(E_TREE_MODEL(etree), path);
-
- return ret;
-}
-
-typedef struct {
- ETreeMemory *memory;
- gpointer closure;
- ETreeMemorySortCallback callback;
-} MemoryAndClosure;
-
-static int
-sort_callback(const void *data1, const void *data2, gpointer user_data)
-{
- ETreePath path1 = *(ETreePath *)data1;
- ETreePath path2 = *(ETreePath *)data2;
- MemoryAndClosure *mac = user_data;
- return (*mac->callback) (mac->memory, path1, path2, mac->closure);
-}
-
-void
-e_tree_memory_sort_node (ETreeMemory *etmm,
- ETreePath node,
- ETreeMemorySortCallback callback,
- gpointer user_data)
-{
- ETreeMemoryPath **children;
- ETreeMemoryPath *child;
- int count;
- int i;
- ETreeMemoryPath *path = node;
- MemoryAndClosure mac;
- ETreeMemoryPath *last;
-
- e_tree_model_pre_change (E_TREE_MODEL (etmm));
-
- i = 0;
- for (child = path->first_child; child; child = child->next_sibling)
- i++;
-
- children = g_new(ETreeMemoryPath *, i);
-
- count = i;
-
- for (child = path->first_child, i = 0;
- child;
- child = child->next_sibling, i++) {
- children[i] = child;
- }
-
- mac.memory = etmm;
- mac.closure = user_data;
- mac.callback = callback;
-
- e_sort (children, count, sizeof (ETreeMemoryPath *), sort_callback, &mac);
-
- path->first_child = NULL;
- last = NULL;
- for (i = 0;
- i < count;
- i++) {
- children[i]->prev_sibling = last;
- if (last)
- last->next_sibling = children[i];
- else
- path->first_child = children[i];
- last = children[i];
- }
- if (last)
- last->next_sibling = NULL;
-
- path->last_child = last;
-
- g_free(children);
-
- e_tree_model_node_changed(E_TREE_MODEL(etmm), node);
-}
-
-void
-e_tree_memory_set_node_destroy_func (ETreeMemory *etmm,
- GFunc destroy_func,
- gpointer user_data)
-{
- etmm->priv->destroy_func = destroy_func;
- etmm->priv->destroy_user_data = user_data;
-}
diff --git a/widgets/table/e-tree-memory.h b/widgets/table/e-tree-memory.h
deleted file mode 100644
index bd43c97fde..0000000000
--- a/widgets/table/e-tree-memory.h
+++ /dev/null
@@ -1,105 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-tree-memory.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- * Chris Toshok <toshok@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_TREE_MEMORY_H_
-#define _E_TREE_MEMORY_H_
-
-#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <gal/e-table/e-tree-model.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define E_TREE_MEMORY_TYPE (e_tree_memory_get_type ())
-#define E_TREE_MEMORY(o) (GTK_CHECK_CAST ((o), E_TREE_MEMORY_TYPE, ETreeMemory))
-#define E_TREE_MEMORY_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TREE_MEMORY_TYPE, ETreeMemoryClass))
-#define E_IS_TREE_MEMORY(o) (GTK_CHECK_TYPE ((o), E_TREE_MEMORY_TYPE))
-#define E_IS_TREE_MEMORY_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TREE_MEMORY_TYPE))
-
-typedef struct ETreeMemory ETreeMemory;
-typedef struct ETreeMemoryPriv ETreeMemoryPriv;
-typedef struct ETreeMemoryClass ETreeMemoryClass;
-
-typedef int (*ETreeMemorySortCallback) (ETreeMemory *etmm, ETreePath path1, ETreePath path2, gpointer closure);
-
-struct ETreeMemory {
- ETreeModel base;
- ETreeMemoryPriv *priv;
-};
-
-struct ETreeMemoryClass {
- ETreeModelClass parent_class;
-
- /* signals */
- void (*fill_in_children) (ETreeMemory *model, ETreePath node);
-};
-
-
-GtkType e_tree_memory_get_type (void);
-void e_tree_memory_construct (ETreeMemory *etree);
-ETreeMemory *e_tree_memory_new (void);
-
-/* node operations */
-ETreePath e_tree_memory_node_insert (ETreeMemory *etree,
- ETreePath parent,
- int position,
- gpointer node_data);
-ETreePath e_tree_memory_node_insert_id (ETreeMemory *etree,
- ETreePath parent,
- int position,
- gpointer node_data,
- char *id);
-ETreePath e_tree_memory_node_insert_before (ETreeMemory *etree,
- ETreePath parent,
- ETreePath sibling,
- gpointer node_data);
-gpointer e_tree_memory_node_remove (ETreeMemory *etree,
- ETreePath path);
-
-/* Freeze and thaw */
-void e_tree_memory_freeze (ETreeMemory *etree);
-void e_tree_memory_thaw (ETreeMemory *etree);
-void e_tree_memory_set_expanded_default (ETreeMemory *etree,
- gboolean expanded);
-gpointer e_tree_memory_node_get_data (ETreeMemory *etm,
- ETreePath node);
-void e_tree_memory_node_set_data (ETreeMemory *etm,
- ETreePath node,
- gpointer node_data);
-void e_tree_memory_sort_node (ETreeMemory *etm,
- ETreePath node,
- ETreeMemorySortCallback callback,
- gpointer user_data);
-void e_tree_memory_set_node_destroy_func (ETreeMemory *etmm,
- GFunc destroy_func,
- gpointer user_data);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _E_TREE_MEMORY_H */
-
diff --git a/widgets/table/e-tree-model.c b/widgets/table/e-tree-model.c
deleted file mode 100644
index 9b205bbc51..0000000000
--- a/widgets/table/e-tree-model.c
+++ /dev/null
@@ -1,1082 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-tree-model.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- * Chris Toshok <toshok@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-
-#include <stdio.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <fcntl.h>
-
-#include <gnome-xml/parser.h>
-#include <gnome-xml/xmlmemory.h>
-
-#include <gtk/gtksignal.h>
-#include "gal/util/e-util.h"
-#include "gal/util/e-xml-utils.h"
-#include "e-tree-model.h"
-
-#define ETM_CLASS(e) ((ETreeModelClass *)((GtkObject *)e)->klass)
-
-#define PARENT_TYPE (gtk_object_get_type())
-
-static GtkObjectClass *parent_class;
-
-enum {
- PRE_CHANGE,
- NO_CHANGE,
- NODE_CHANGED,
- NODE_DATA_CHANGED,
- NODE_COL_CHANGED,
- NODE_INSERTED,
- NODE_REMOVED,
- NODE_DELETED,
- NODE_REQUEST_COLLAPSE,
- LAST_SIGNAL
-};
-
-static guint e_tree_model_signals [LAST_SIGNAL] = {0, };
-
-
-static void
-e_tree_model_class_init (GtkObjectClass *klass)
-{
- ETreeModelClass *tree_class = (ETreeModelClass *) klass;
-
- parent_class = gtk_type_class (PARENT_TYPE);
-
- e_tree_model_signals [PRE_CHANGE] =
- gtk_signal_new ("pre_change",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (klass),
- GTK_SIGNAL_OFFSET (ETreeModelClass, pre_change),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- e_tree_model_signals [NO_CHANGE] =
- gtk_signal_new ("no_change",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (klass),
- GTK_SIGNAL_OFFSET (ETreeModelClass, no_change),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- e_tree_model_signals [NODE_CHANGED] =
- gtk_signal_new ("node_changed",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (klass),
- GTK_SIGNAL_OFFSET (ETreeModelClass, node_changed),
- gtk_marshal_NONE__POINTER,
- GTK_TYPE_NONE, 1, GTK_TYPE_POINTER);
-
- e_tree_model_signals [NODE_DATA_CHANGED] =
- gtk_signal_new ("node_data_changed",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (klass),
- GTK_SIGNAL_OFFSET (ETreeModelClass, node_data_changed),
- gtk_marshal_NONE__POINTER,
- GTK_TYPE_NONE, 1, GTK_TYPE_POINTER);
-
- e_tree_model_signals [NODE_COL_CHANGED] =
- gtk_signal_new ("node_col_changed",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (klass),
- GTK_SIGNAL_OFFSET (ETreeModelClass, node_col_changed),
- gtk_marshal_NONE__POINTER_INT,
- GTK_TYPE_NONE, 2, GTK_TYPE_POINTER, GTK_TYPE_INT);
-
- e_tree_model_signals [NODE_INSERTED] =
- gtk_signal_new ("node_inserted",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (klass),
- GTK_SIGNAL_OFFSET (ETreeModelClass, node_inserted),
- gtk_marshal_NONE__POINTER_POINTER,
- GTK_TYPE_NONE, 2, GTK_TYPE_POINTER, GTK_TYPE_POINTER);
-
- e_tree_model_signals [NODE_REMOVED] =
- gtk_signal_new ("node_removed",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (klass),
- GTK_SIGNAL_OFFSET (ETreeModelClass, node_removed),
- e_marshal_NONE__POINTER_POINTER_INT,
- GTK_TYPE_NONE, 3, GTK_TYPE_POINTER, GTK_TYPE_POINTER, GTK_TYPE_INT);
-
- e_tree_model_signals [NODE_DELETED] =
- gtk_signal_new ("node_deleted",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (klass),
- GTK_SIGNAL_OFFSET (ETreeModelClass, node_deleted),
- gtk_marshal_NONE__POINTER,
- GTK_TYPE_NONE, 1, GTK_TYPE_POINTER);
-
- e_tree_model_signals [NODE_REQUEST_COLLAPSE] =
- gtk_signal_new ("node_request_collapse",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (klass),
- GTK_SIGNAL_OFFSET (ETreeModelClass, node_request_collapse),
- gtk_marshal_NONE__POINTER,
- GTK_TYPE_NONE, 1, GTK_TYPE_POINTER);
-
- E_OBJECT_CLASS_ADD_SIGNALS (klass, e_tree_model_signals, LAST_SIGNAL);
-
- tree_class->get_root = NULL;
-
- tree_class->get_parent = NULL;
- tree_class->get_first_child = NULL;
- tree_class->get_last_child = NULL;
- tree_class->get_next = NULL;
- tree_class->get_prev = NULL;
-
- tree_class->is_root = NULL;
- tree_class->is_expandable = NULL;
- tree_class->get_children = NULL;
- tree_class->depth = NULL;
-
- tree_class->icon_at = NULL;
-
- tree_class->get_expanded_default = NULL;
- tree_class->column_count = NULL;
-
- tree_class->has_save_id = NULL;
- tree_class->get_save_id = NULL;
- tree_class->has_get_node_by_id = NULL;
- tree_class->get_node_by_id = NULL;
-
- tree_class->has_change_pending = NULL;
-
- tree_class->value_at = NULL;
- tree_class->set_value_at = NULL;
- tree_class->is_editable = NULL;
-
- tree_class->duplicate_value = NULL;
- tree_class->free_value = NULL;
- tree_class->initialize_value = NULL;
- tree_class->value_is_empty = NULL;
- tree_class->value_to_string = NULL;
-
- tree_class->pre_change = NULL;
- tree_class->no_change = NULL;
- tree_class->node_changed = NULL;
- tree_class->node_data_changed = NULL;
- tree_class->node_col_changed = NULL;
- tree_class->node_inserted = NULL;
- tree_class->node_removed = NULL;
- tree_class->node_deleted = NULL;
- tree_class->node_request_collapse = NULL;
-}
-
-static void
-e_tree_init (GtkObject *object)
-{
-}
-
-E_MAKE_TYPE(e_tree_model, "ETreeModel", ETreeModel, e_tree_model_class_init, e_tree_init, PARENT_TYPE)
-
-
-/* signals */
-
-/**
- * e_tree_model_node_changed:
- * @tree_model:
- * @node:
- *
- *
- *
- * Return value:
- **/
-void
-e_tree_model_pre_change (ETreeModel *tree_model)
-{
- g_return_if_fail (tree_model != NULL);
- g_return_if_fail (E_IS_TREE_MODEL (tree_model));
-
- gtk_signal_emit (GTK_OBJECT (tree_model),
- e_tree_model_signals [PRE_CHANGE]);
-}
-
-/**
- * e_tree_model_node_changed:
- * @tree_model:
- * @node:
- *
- *
- *
- * Return value:
- **/
-void
-e_tree_model_no_change (ETreeModel *tree_model)
-{
- g_return_if_fail (tree_model != NULL);
- g_return_if_fail (E_IS_TREE_MODEL (tree_model));
-
- gtk_signal_emit (GTK_OBJECT (tree_model),
- e_tree_model_signals [NO_CHANGE]);
-}
-
-/**
- * e_tree_model_node_changed:
- * @tree_model:
- * @node:
- *
- *
- *
- * Return value:
- **/
-void
-e_tree_model_node_changed (ETreeModel *tree_model, ETreePath node)
-{
- g_return_if_fail (tree_model != NULL);
- g_return_if_fail (E_IS_TREE_MODEL (tree_model));
-
- gtk_signal_emit (GTK_OBJECT (tree_model),
- e_tree_model_signals [NODE_CHANGED], node);
-}
-
-/**
- * e_tree_model_node_data_changed:
- * @tree_model:
- * @node:
- *
- *
- *
- * Return value:
- **/
-void
-e_tree_model_node_data_changed (ETreeModel *tree_model, ETreePath node)
-{
- g_return_if_fail (tree_model != NULL);
- g_return_if_fail (E_IS_TREE_MODEL (tree_model));
-
- gtk_signal_emit (GTK_OBJECT (tree_model),
- e_tree_model_signals [NODE_DATA_CHANGED], node);
-}
-
-/**
- * e_tree_model_node_col_changed:
- * @tree_model:
- * @node:
- *
- *
- *
- * Return value:
- **/
-void
-e_tree_model_node_col_changed (ETreeModel *tree_model, ETreePath node, int col)
-{
- g_return_if_fail (tree_model != NULL);
- g_return_if_fail (E_IS_TREE_MODEL (tree_model));
-
- gtk_signal_emit (GTK_OBJECT (tree_model),
- e_tree_model_signals [NODE_COL_CHANGED], node, col);
-}
-
-/**
- * e_tree_model_node_inserted:
- * @tree_model:
- * @parent_node:
- * @inserted_node:
- *
- *
- **/
-void
-e_tree_model_node_inserted (ETreeModel *tree_model,
- ETreePath parent_node,
- ETreePath inserted_node)
-{
- g_return_if_fail (tree_model != NULL);
- g_return_if_fail (E_IS_TREE_MODEL (tree_model));
-
- gtk_signal_emit (GTK_OBJECT (tree_model),
- e_tree_model_signals [NODE_INSERTED],
- parent_node, inserted_node);
-}
-
-/**
- * e_tree_model_node_removed:
- * @tree_model:
- * @parent_node:
- * @removed_node:
- *
- *
- **/
-void
-e_tree_model_node_removed (ETreeModel *tree_model, ETreePath parent_node, ETreePath removed_node, int old_position)
-{
- g_return_if_fail (tree_model != NULL);
- g_return_if_fail (E_IS_TREE_MODEL (tree_model));
-
- gtk_signal_emit (GTK_OBJECT (tree_model),
- e_tree_model_signals [NODE_REMOVED],
- parent_node, removed_node, old_position);
-}
-
-/**
- * e_tree_model_node_deleted:
- * @tree_model:
- * @deleted_node:
- *
- *
- **/
-void
-e_tree_model_node_deleted (ETreeModel *tree_model, ETreePath deleted_node)
-{
- g_return_if_fail (tree_model != NULL);
- g_return_if_fail (E_IS_TREE_MODEL (tree_model));
-
- gtk_signal_emit (GTK_OBJECT (tree_model),
- e_tree_model_signals [NODE_DELETED],
- deleted_node);
-}
-
-/**
- * e_tree_model_node_request_collapse:
- * @tree_model:
- * @collapsed_node:
- *
- *
- **/
-void
-e_tree_model_node_request_collapse (ETreeModel *tree_model, ETreePath collapsed_node)
-{
- g_return_if_fail (tree_model != NULL);
- g_return_if_fail (E_IS_TREE_MODEL (tree_model));
-
- gtk_signal_emit (GTK_OBJECT (tree_model),
- e_tree_model_signals [NODE_REQUEST_COLLAPSE],
- collapsed_node);
-}
-
-
-
-/**
- * e_tree_model_new
- *
- * XXX docs here.
- *
- * return values: a newly constructed ETreeModel.
- */
-ETreeModel *
-e_tree_model_new ()
-{
- ETreeModel *et;
-
- et = gtk_type_new (e_tree_model_get_type ());
-
- return et;
-}
-
-/**
- * e_tree_model_get_root
- * @etree: the ETreeModel of which we want the root node.
- *
- * Accessor for the root node of @etree.
- *
- * return values: the ETreePath corresponding to the root node.
- */
-ETreePath
-e_tree_model_get_root (ETreeModel *etree)
-{
- g_return_val_if_fail (etree != NULL, NULL);
- g_return_val_if_fail (E_IS_TREE_MODEL (etree), NULL);
-
- if (ETM_CLASS(etree)->get_root)
- return ETM_CLASS(etree)->get_root(etree);
- else
- return NULL;
-}
-
-/**
- * e_tree_model_node_get_parent:
- * @etree:
- * @path:
- *
- *
- *
- * Return value:
- **/
-ETreePath
-e_tree_model_node_get_parent (ETreeModel *etree, ETreePath node)
-{
- g_return_val_if_fail(etree != NULL, NULL);
- if (ETM_CLASS(etree)->get_parent)
- return ETM_CLASS(etree)->get_parent(etree, node);
- else
- return NULL;
-}
-
-/**
- * e_tree_model_node_get_first_child:
- * @etree:
- * @node:
- *
- *
- *
- * Return value:
- **/
-ETreePath
-e_tree_model_node_get_first_child (ETreeModel *etree, ETreePath node)
-{
- g_return_val_if_fail (etree != NULL, NULL);
- g_return_val_if_fail (E_IS_TREE_MODEL (etree), NULL);
-
- if (ETM_CLASS(etree)->get_first_child)
- return ETM_CLASS(etree)->get_first_child(etree, node);
- else
- return NULL;
-}
-
-/**
- * e_tree_model_node_get_last_child:
- * @etree:
- * @node:
- *
- *
- *
- * Return value:
- **/
-ETreePath
-e_tree_model_node_get_last_child (ETreeModel *etree, ETreePath node)
-{
- g_return_val_if_fail (etree != NULL, NULL);
- g_return_val_if_fail (E_IS_TREE_MODEL (etree), NULL);
-
- if (ETM_CLASS(etree)->get_last_child)
- return ETM_CLASS(etree)->get_last_child(etree, node);
- else
- return NULL;
-}
-
-
-/**
- * e_tree_model_node_get_next:
- * @etree:
- * @node:
- *
- *
- *
- * Return value:
- **/
-ETreePath
-e_tree_model_node_get_next (ETreeModel *etree, ETreePath node)
-{
- g_return_val_if_fail (etree != NULL, NULL);
- g_return_val_if_fail (E_IS_TREE_MODEL (etree), NULL);
-
- if (ETM_CLASS(etree)->get_next)
- return ETM_CLASS(etree)->get_next(etree, node);
- else
- return NULL;
-}
-
-/**
- * e_tree_model_node_get_prev:
- * @etree:
- * @node:
- *
- *
- *
- * Return value:
- **/
-ETreePath
-e_tree_model_node_get_prev (ETreeModel *etree, ETreePath node)
-{
- g_return_val_if_fail (etree != NULL, NULL);
- g_return_val_if_fail (E_IS_TREE_MODEL (etree), NULL);
-
- if (ETM_CLASS(etree)->get_prev)
- return ETM_CLASS(etree)->get_prev(etree, node);
- else
- return NULL;
-}
-
-/**
- * e_tree_model_node_is_root:
- * @etree:
- * @path:
- *
- *
- *
- * Return value:
- **/
-gboolean
-e_tree_model_node_is_root (ETreeModel *etree, ETreePath node)
-{
- g_return_val_if_fail(etree != NULL, FALSE);
-
- if (ETM_CLASS(etree)->is_root)
- return ETM_CLASS(etree)->is_root(etree, node);
- else
- return FALSE;
-}
-
-/**
- * e_tree_model_node_is_expandable:
- * @etree:
- * @path:
- *
- *
- *
- * Return value:
- **/
-gboolean
-e_tree_model_node_is_expandable (ETreeModel *etree, ETreePath node)
-{
- g_return_val_if_fail(etree != NULL, FALSE);
-
- if (ETM_CLASS(etree)->is_expandable)
- return ETM_CLASS(etree)->is_expandable(etree, node);
- else
- return FALSE;
-}
-
-guint
-e_tree_model_node_get_children (ETreeModel *etree, ETreePath node, ETreePath **nodes)
-{
- g_return_val_if_fail(etree != NULL, 0);
- if (ETM_CLASS(etree)->get_children)
- return ETM_CLASS(etree)->get_children (etree, node, nodes);
- else
- return 0;
-}
-
-/**
- * e_tree_model_node_depth:
- * @etree:
- * @path:
- *
- *
- *
- * Return value:
- **/
-guint
-e_tree_model_node_depth (ETreeModel *etree, ETreePath node)
-{
- g_return_val_if_fail (etree != NULL, 0);
- g_return_val_if_fail (E_IS_TREE_MODEL (etree), 0);
-
- if (ETM_CLASS(etree)->depth)
- return ETM_CLASS(etree)->depth(etree, node);
- else
- return 0;
-}
-
-/**
- * e_tree_model_icon_at
- * @etree: The ETreeModel.
- * @path: The ETreePath to the node we're getting the icon of.
- *
- * XXX docs here.
- *
- * return values: the GdkPixbuf associated with this node.
- */
-GdkPixbuf *
-e_tree_model_icon_at (ETreeModel *etree, ETreePath node)
-{
- g_return_val_if_fail (etree != NULL, NULL);
- g_return_val_if_fail (E_IS_TREE_MODEL (etree), NULL);
-
- if (ETM_CLASS(etree)->icon_at)
- return ETM_CLASS(etree)->icon_at (etree, node);
- else
- return NULL;
-}
-
-/**
- * e_tree_model_get_expanded_default
- * @etree: The ETreeModel.
- *
- * XXX docs here.
- *
- * return values: Whether nodes should be expanded by default.
- */
-gboolean
-e_tree_model_get_expanded_default (ETreeModel *etree)
-{
- g_return_val_if_fail (etree != NULL, FALSE);
- g_return_val_if_fail (E_IS_TREE_MODEL (etree), FALSE);
-
- if (ETM_CLASS(etree)->get_expanded_default)
- return ETM_CLASS(etree)->get_expanded_default (etree);
- else
- return FALSE;
-}
-
-/**
- * e_tree_model_column_count
- * @etree: The ETreeModel.
- *
- * XXX docs here.
- *
- * return values: The number of columns
- */
-gint
-e_tree_model_column_count (ETreeModel *etree)
-{
- g_return_val_if_fail (etree != NULL, 0);
- g_return_val_if_fail (E_IS_TREE_MODEL (etree), 0);
-
- if (ETM_CLASS(etree)->column_count)
- return ETM_CLASS(etree)->column_count (etree);
- else
- return 0;
-}
-
-/**
- * e_tree_model_has_save_id
- * @etree: The ETreeModel.
- *
- * XXX docs here.
- *
- * return values: Whether this tree has valid save id data.
- */
-gboolean
-e_tree_model_has_save_id (ETreeModel *etree)
-{
- g_return_val_if_fail (etree != NULL, FALSE);
- g_return_val_if_fail (E_IS_TREE_MODEL (etree), FALSE);
-
- if (ETM_CLASS(etree)->has_save_id)
- return ETM_CLASS(etree)->has_save_id (etree);
- else
- return FALSE;
-}
-
-/**
- * e_tree_model_get_save_id
- * @etree: The ETreeModel.
- * @node: The ETreePath.
- *
- * XXX docs here.
- *
- * return values: The save id for this path.
- */
-gchar *
-e_tree_model_get_save_id (ETreeModel *etree, ETreePath node)
-{
- g_return_val_if_fail (etree != NULL, NULL);
- g_return_val_if_fail (E_IS_TREE_MODEL (etree), NULL);
-
- if (ETM_CLASS(etree)->get_save_id)
- return ETM_CLASS(etree)->get_save_id (etree, node);
- else
- return NULL;
-}
-
-/**
- * e_tree_model_has_get_node_by_id
- * @etree: The ETreeModel.
- *
- * XXX docs here.
- *
- * return values: Whether this tree can quickly get a node from its save id.
- */
-gboolean
-e_tree_model_has_get_node_by_id (ETreeModel *etree)
-{
- g_return_val_if_fail (etree != NULL, FALSE);
- g_return_val_if_fail (E_IS_TREE_MODEL (etree), FALSE);
-
- if (ETM_CLASS(etree)->has_get_node_by_id)
- return ETM_CLASS(etree)->has_get_node_by_id (etree);
- else
- return FALSE;
-}
-
-/**
- * e_tree_model_get_node_by_id
- * @etree: The ETreeModel.
- * @node: The ETreePath.
- *
- * get_node_by_id(get_save_id(node)) should be the original node.
- * Likewise if get_node_by_id is not NULL, then
- * get_save_id(get_node_by_id(string)) should be a copy of the
- * original string.
- *
- * return values: The path for this save id.
- */
-ETreePath
-e_tree_model_get_node_by_id (ETreeModel *etree, const char *save_id)
-{
- g_return_val_if_fail (etree != NULL, NULL);
- g_return_val_if_fail (E_IS_TREE_MODEL (etree), NULL);
-
- if (ETM_CLASS(etree)->get_node_by_id)
- return ETM_CLASS(etree)->get_node_by_id (etree, save_id);
- else
- return NULL;
-}
-
-/**
- * e_tree_model_has_change_pending
- * @etree: The ETreeModel.
- *
- * XXX docs here.
- *
- * return values: Whether this tree has valid save id data.
- */
-gboolean
-e_tree_model_has_change_pending (ETreeModel *etree)
-{
- g_return_val_if_fail (etree != NULL, FALSE);
- g_return_val_if_fail (E_IS_TREE_MODEL (etree), FALSE);
-
- if (ETM_CLASS(etree)->has_change_pending)
- return ETM_CLASS(etree)->has_change_pending (etree);
- else
- return FALSE;
-}
-
-/**
- * e_tree_model_icon_of_node
- * @etree: The ETreeModel.
- * @path: The ETreePath to the node we're getting the icon of.
- *
- * XXX docs here.
- *
- * return values: the GdkPixbuf associated with this node.
- */
-void *
-e_tree_model_value_at (ETreeModel *etree, ETreePath node, int col)
-{
- g_return_val_if_fail (etree != NULL, NULL);
- g_return_val_if_fail (E_IS_TREE_MODEL (etree), NULL);
-
- if (ETM_CLASS(etree)->value_at)
- return ETM_CLASS(etree)->value_at (etree, node, col);
- else
- return NULL;
-}
-
-/**
- * e_tree_model_icon_of_node
- * @etree: The ETreeModel.
- * @path: The ETreePath to the node we're getting the icon of.
- *
- * XXX docs here.
- *
- * return values: the GdkPixbuf associated with this node.
- */
-void
-e_tree_model_set_value_at (ETreeModel *etree, ETreePath node, int col, const void *val)
-{
- g_return_if_fail (etree != NULL);
- g_return_if_fail (E_IS_TREE_MODEL (etree));
-
- if (ETM_CLASS(etree)->set_value_at)
- ETM_CLASS(etree)->set_value_at (etree, node, col, val);
-}
-
-/**
- * e_tree_model_node_is_editable:
- * @etree:
- * @path:
- *
- *
- *
- * Return value:
- **/
-gboolean
-e_tree_model_node_is_editable (ETreeModel *etree, ETreePath node, int col)
-{
- g_return_val_if_fail(etree != NULL, FALSE);
-
- if (ETM_CLASS(etree)->is_editable)
- return ETM_CLASS(etree)->is_editable(etree, node, col);
- else
- return FALSE;
-}
-
-/**
- * e_tree_model_duplicate_value:
- * @etree:
- * @path:
- *
- *
- *
- * Return value:
- **/
-void *
-e_tree_model_duplicate_value (ETreeModel *etree, int col, const void *value)
-{
- g_return_val_if_fail(etree != NULL, NULL);
-
- if (ETM_CLASS(etree)->duplicate_value)
- return ETM_CLASS(etree)->duplicate_value(etree, col, value);
- else
- return NULL;
-}
-
-/**
- * e_tree_model_free_value:
- * @etree:
- * @path:
- *
- *
- *
- * Return value:
- **/
-void
-e_tree_model_free_value (ETreeModel *etree, int col, void *value)
-{
- g_return_if_fail(etree != NULL);
-
- if (ETM_CLASS(etree)->free_value)
- ETM_CLASS(etree)->free_value(etree, col, value);
-}
-
-/**
- * e_tree_model_initialize_value:
- * @etree:
- * @path:
- *
- *
- *
- * Return value:
- **/
-void *
-e_tree_model_initialize_value (ETreeModel *etree, int col)
-{
- g_return_val_if_fail(etree != NULL, NULL);
-
- if (ETM_CLASS(etree)->initialize_value)
- return ETM_CLASS(etree)->initialize_value(etree, col);
- else
- return NULL;
-}
-
-/**
- * e_tree_model_value_is_empty:
- * @etree:
- * @path:
- *
- *
- *
- * Return value:
- **/
-gboolean
-e_tree_model_value_is_empty (ETreeModel *etree, int col, const void *value)
-{
- g_return_val_if_fail(etree != NULL, TRUE);
-
- if (ETM_CLASS(etree)->value_is_empty)
- return ETM_CLASS(etree)->value_is_empty(etree, col, value);
- else
- return TRUE;
-}
-
-/**
- * e_tree_model_value_to_string:
- * @etree:
- * @path:
- *
- *
- *
- * Return value:
- **/
-char *
-e_tree_model_value_to_string (ETreeModel *etree, int col, const void *value)
-{
- g_return_val_if_fail(etree != NULL, g_strdup(""));
-
- if (ETM_CLASS(etree)->value_to_string)
- return ETM_CLASS(etree)->value_to_string(etree, col, value);
- else
- return g_strdup("");
-}
-
-/**
- * e_tree_model_node_traverse:
- * @model:
- * @path:
- * @func:
- * @data:
- *
- *
- **/
-void
-e_tree_model_node_traverse (ETreeModel *model, ETreePath path, ETreePathFunc func, gpointer data)
-{
- ETreePath child;
-
- g_return_if_fail (model != NULL);
- g_return_if_fail (E_IS_TREE_MODEL (model));
- g_return_if_fail (path != NULL);
-
- child = e_tree_model_node_get_first_child (model, path);
-
- while (child) {
- ETreePath next_child;
-
- next_child = e_tree_model_node_get_next (model, child);
- e_tree_model_node_traverse (model, child, func, data);
- if (func (model, child, data) == TRUE)
- return;
-
- child = next_child;
- }
-}
-
-/**
- * e_tree_model_node_traverse_preorder:
- * @model:
- * @path:
- * @func:
- * @data:
- *
- *
- **/
-void
-e_tree_model_node_traverse_preorder (ETreeModel *model, ETreePath path, ETreePathFunc func, gpointer data)
-{
- ETreePath child;
-
- g_return_if_fail (model != NULL);
- g_return_if_fail (E_IS_TREE_MODEL (model));
- g_return_if_fail (path != NULL);
-
- child = e_tree_model_node_get_first_child (model, path);
-
- while (child) {
- ETreePath next_child;
-
- if (func (model, child, data) == TRUE)
- return;
-
- next_child = e_tree_model_node_get_next (model, child);
- e_tree_model_node_traverse_preorder (model, child, func, data);
-
- child = next_child;
- }
-}
-
-/**
- * e_tree_model_node_traverse_preorder:
- * @model:
- * @path:
- * @func:
- * @data:
- *
- *
- **/
-static ETreePath
-e_tree_model_node_real_traverse (ETreeModel *model, ETreePath path, ETreePath end_path, gboolean forward_direction, ETreePathFunc func, gpointer data)
-{
- ETreePath child;
-
- g_return_val_if_fail (model != NULL, NULL);
- g_return_val_if_fail (E_IS_TREE_MODEL (model), NULL);
- g_return_val_if_fail (path != NULL, NULL);
-
- if (forward_direction)
- child = e_tree_model_node_get_first_child (model, path);
- else
- child = e_tree_model_node_get_last_child (model, path);
-
- while (child) {
- ETreePath result;
-
- if (forward_direction && (child == end_path || func (model, child, data)))
- return child;
-
- if ((result = e_tree_model_node_real_traverse (model, child, end_path, forward_direction, func, data)))
- return result;
-
- if (!forward_direction && (child == end_path || func (model, child, data)))
- return child;
-
- if (forward_direction)
- child = e_tree_model_node_get_next (model, child);
- else
- child = e_tree_model_node_get_prev (model, child);
- }
- return NULL;
-}
-
-/**
- * e_tree_model_node_traverse_preorder:
- * @model:
- * @path:
- * @func:
- * @data:
- *
- *
- **/
-ETreePath
-e_tree_model_node_find (ETreeModel *model, ETreePath path, ETreePath end_path, gboolean forward_direction, ETreePathFunc func, gpointer data)
-{
- ETreePath result;
- ETreePath next;
-
- g_return_val_if_fail (model != NULL, NULL);
- g_return_val_if_fail (E_IS_TREE_MODEL (model), NULL);
-
- /* Just search the whole tree in this case. */
- if (path == NULL) {
- ETreePath root;
- root = e_tree_model_get_root (model);
-
- if (forward_direction && (end_path == root || func (model, root, data)))
- return root;
-
- if ((result = e_tree_model_node_real_traverse (model, root, end_path, forward_direction, func, data)))
- return result;
-
- if (!forward_direction && (end_path == root || func (model, root, data)))
- return root;
-
- return NULL;
- }
-
- while (1) {
-
- if (forward_direction) {
- if ((result = e_tree_model_node_real_traverse (model, path, end_path, forward_direction, func, data)))
- return result;
- next = e_tree_model_node_get_next (model, path);
- } else {
- next = e_tree_model_node_get_prev (model, path);
- if (next && (result = e_tree_model_node_real_traverse (model, next, end_path, forward_direction, func, data)))
- return result;
- }
-
- while (next == NULL) {
- path = e_tree_model_node_get_parent (model, path);
-
- if (path == NULL)
- return NULL;
-
- if (forward_direction)
- next = e_tree_model_node_get_next (model, path);
- else
- next = path;
- }
-
- if (end_path == next || func (model, next, data))
- return next;
-
- path = next;
- }
-}
-
diff --git a/widgets/table/e-tree-model.h b/widgets/table/e-tree-model.h
deleted file mode 100644
index cf4a7ac68c..0000000000
--- a/widgets/table/e-tree-model.h
+++ /dev/null
@@ -1,225 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-tree-model.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- * Chris Toshok <toshok@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_TREE_MODEL_H_
-#define _E_TREE_MODEL_H_
-
-#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <gtk/gtkobject.h>
-#include <libgnome/gnome-defs.h>
-
-BEGIN_GNOME_DECLS
-
-
-#define E_TREE_MODEL_TYPE (e_tree_model_get_type ())
-#define E_TREE_MODEL(o) (GTK_CHECK_CAST ((o), E_TREE_MODEL_TYPE, ETreeModel))
-#define E_TREE_MODEL_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TREE_MODEL_TYPE, ETreeModelClass))
-#define E_IS_TREE_MODEL(o) (GTK_CHECK_TYPE ((o), E_TREE_MODEL_TYPE))
-#define E_IS_TREE_MODEL_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TREE_MODEL_TYPE))
-
-typedef void * ETreePath;
-typedef struct ETreeModel ETreeModel;
-typedef struct ETreeModelClass ETreeModelClass;
-typedef gint (*ETreePathCompareFunc)(ETreeModel *model, ETreePath path1, ETreePath path2);
-typedef gboolean (*ETreePathFunc)(ETreeModel *model, ETreePath path, gpointer data);
-
-struct ETreeModel {
- GtkObject base;
-};
-
-struct ETreeModelClass {
- GtkObjectClass parent_class;
-
- /*
- * Virtual methods
- */
- ETreePath (*get_root) (ETreeModel *etm);
-
- ETreePath (*get_parent) (ETreeModel *etm, ETreePath node);
- ETreePath (*get_first_child) (ETreeModel *etm, ETreePath node);
- ETreePath (*get_last_child) (ETreeModel *etm, ETreePath node);
- ETreePath (*get_next) (ETreeModel *etm, ETreePath node);
- ETreePath (*get_prev) (ETreeModel *etm, ETreePath node);
-
- gboolean (*is_root) (ETreeModel *etm, ETreePath node);
- gboolean (*is_expandable) (ETreeModel *etm, ETreePath node);
- guint (*get_children) (ETreeModel *etm, ETreePath node, ETreePath **paths);
- guint (*depth) (ETreeModel *etm, ETreePath node);
-
- GdkPixbuf *(*icon_at) (ETreeModel *etm, ETreePath node);
-
- gboolean (*get_expanded_default) (ETreeModel *etm);
- gint (*column_count) (ETreeModel *etm);
-
- gboolean (*has_save_id) (ETreeModel *etm);
- gchar *(*get_save_id) (ETreeModel *etm, ETreePath node);
-
- gboolean (*has_get_node_by_id) (ETreeModel *etm);
- ETreePath (*get_node_by_id) (ETreeModel *etm, const char *save_id);
-
- gboolean (*has_change_pending) (ETreeModel *etm);
-
- /*
- * ETable analogs
- */
- void *(*value_at) (ETreeModel *etm, ETreePath node, int col);
- void (*set_value_at) (ETreeModel *etm, ETreePath node, int col, const void *val);
- gboolean (*is_editable) (ETreeModel *etm, ETreePath node, int col);
-
- void *(*duplicate_value) (ETreeModel *etm, int col, const void *value);
- void (*free_value) (ETreeModel *etm, int col, void *value);
- void *(*initialize_value) (ETreeModel *etm, int col);
- gboolean (*value_is_empty) (ETreeModel *etm, int col, const void *value);
- char *(*value_to_string) (ETreeModel *etm, int col, const void *value);
-
- /*
- * Signals
- */
-
- /* During node_remove, the ETreePath of the child is removed
- * from the tree but is still a valid ETreePath. At
- * node_deleted, the ETreePath is no longer valid.
- */
-
- void (*pre_change) (ETreeModel *etm);
- void (*no_change) (ETreeModel *etm);
- void (*node_changed) (ETreeModel *etm, ETreePath node);
- void (*node_data_changed) (ETreeModel *etm, ETreePath node);
- void (*node_col_changed) (ETreeModel *etm, ETreePath node, int col);
- void (*node_inserted) (ETreeModel *etm, ETreePath parent, ETreePath inserted_node);
- void (*node_removed) (ETreeModel *etm, ETreePath parent, ETreePath removed_node, int old_position);
- void (*node_deleted) (ETreeModel *etm, ETreePath deleted_node);
-
- /* This signal requests that any viewers of the tree that
- * collapse and expand nodes collapse this node.
- */
- void (*node_request_collapse) (ETreeModel *etm, ETreePath node);
-};
-
-
-GtkType e_tree_model_get_type (void);
-ETreeModel *e_tree_model_new (void);
-
-/* tree traversal operations */
-ETreePath e_tree_model_get_root (ETreeModel *etree);
-ETreePath e_tree_model_node_get_parent (ETreeModel *etree,
- ETreePath path);
-ETreePath e_tree_model_node_get_first_child (ETreeModel *etree,
- ETreePath path);
-ETreePath e_tree_model_node_get_last_child (ETreeModel *etree,
- ETreePath path);
-ETreePath e_tree_model_node_get_next (ETreeModel *etree,
- ETreePath path);
-ETreePath e_tree_model_node_get_prev (ETreeModel *etree,
- ETreePath path);
-
-/* node accessors */
-gboolean e_tree_model_node_is_root (ETreeModel *etree,
- ETreePath path);
-gboolean e_tree_model_node_is_expandable (ETreeModel *etree,
- ETreePath path);
-guint e_tree_model_node_get_children (ETreeModel *etree,
- ETreePath path,
- ETreePath **paths);
-guint e_tree_model_node_depth (ETreeModel *etree,
- ETreePath path);
-GdkPixbuf *e_tree_model_icon_at (ETreeModel *etree,
- ETreePath path);
-gboolean e_tree_model_get_expanded_default (ETreeModel *model);
-gint e_tree_model_column_count (ETreeModel *model);
-gboolean e_tree_model_has_save_id (ETreeModel *model);
-gchar *e_tree_model_get_save_id (ETreeModel *model,
- ETreePath node);
-gboolean e_tree_model_has_get_node_by_id (ETreeModel *model);
-ETreePath e_tree_model_get_node_by_id (ETreeModel *model,
- const char *save_id);
-gboolean e_tree_model_has_change_pending (ETreeModel *model);
-void *e_tree_model_value_at (ETreeModel *etree,
- ETreePath node,
- int col);
-void e_tree_model_set_value_at (ETreeModel *etree,
- ETreePath node,
- int col,
- const void *val);
-gboolean e_tree_model_node_is_editable (ETreeModel *etree,
- ETreePath node,
- int col);
-void *e_tree_model_duplicate_value (ETreeModel *etree,
- int col,
- const void *value);
-void e_tree_model_free_value (ETreeModel *etree,
- int col,
- void *value);
-void *e_tree_model_initialize_value (ETreeModel *etree,
- int col);
-gboolean e_tree_model_value_is_empty (ETreeModel *etree,
- int col,
- const void *value);
-char *e_tree_model_value_to_string (ETreeModel *etree,
- int col,
- const void *value);
-
-/* depth first traversal of path's descendents, calling func on each one */
-void e_tree_model_node_traverse (ETreeModel *model,
- ETreePath path,
- ETreePathFunc func,
- gpointer data);
-void e_tree_model_node_traverse_preorder (ETreeModel *model,
- ETreePath path,
- ETreePathFunc func,
- gpointer data);
-ETreePath e_tree_model_node_find (ETreeModel *model,
- ETreePath path,
- ETreePath end_path,
- gboolean forward_direction,
- ETreePathFunc func,
- gpointer data);
-
-/*
-** Routines for emitting signals on the ETreeModel
-*/
-void e_tree_model_pre_change (ETreeModel *tree_model);
-void e_tree_model_no_change (ETreeModel *tree_model);
-void e_tree_model_node_changed (ETreeModel *tree_model,
- ETreePath node);
-void e_tree_model_node_data_changed (ETreeModel *tree_model,
- ETreePath node);
-void e_tree_model_node_col_changed (ETreeModel *tree_model,
- ETreePath node,
- int col);
-void e_tree_model_node_inserted (ETreeModel *tree_model,
- ETreePath parent_node,
- ETreePath inserted_node);
-void e_tree_model_node_removed (ETreeModel *tree_model,
- ETreePath parent_node,
- ETreePath removed_node,
- int old_position);
-void e_tree_model_node_deleted (ETreeModel *tree_model,
- ETreePath deleted_node);
-void e_tree_model_node_request_collapse (ETreeModel *tree_model,
- ETreePath deleted_node);
-
-END_GNOME_DECLS
-
-#endif /* _E_TREE_MODEL_H */
diff --git a/widgets/table/e-tree-scrolled.c b/widgets/table/e-tree-scrolled.c
deleted file mode 100644
index 30a6524c98..0000000000
--- a/widgets/table/e-tree-scrolled.c
+++ /dev/null
@@ -1,223 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-tree-scrolled.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdio.h>
-#include <libgnomeui/gnome-canvas.h>
-#include <gtk/gtksignal.h>
-#include <gnome-xml/parser.h>
-#include <gnome-xml/xmlmemory.h>
-#include <gal/util/e-util.h>
-
-#include "e-tree-scrolled.h"
-
-#define COLUMN_HEADER_HEIGHT 16
-
-#define PARENT_TYPE e_scroll_frame_get_type ()
-
-static GtkObjectClass *parent_class;
-
-enum {
- ARG_0,
- ARG_TREE,
-};
-
-static void
-e_tree_scrolled_init (GtkObject *object)
-{
- ETreeScrolled *ets;
- EScrollFrame *scroll_frame;
-
- ets = E_TREE_SCROLLED (object);
- scroll_frame = E_SCROLL_FRAME (object);
-
- GTK_WIDGET_SET_FLAGS (ets, GTK_CAN_FOCUS);
-
- ets->tree = gtk_type_new(e_tree_get_type());
-
- e_scroll_frame_set_policy (scroll_frame, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- e_scroll_frame_set_shadow_type (scroll_frame, GTK_SHADOW_IN);
-}
-
-static void
-e_tree_scrolled_real_construct (ETreeScrolled *ets)
-{
- gtk_container_add(GTK_CONTAINER(ets), GTK_WIDGET(ets->tree));
-
- gtk_widget_show(GTK_WIDGET(ets->tree));
-}
-
-ETreeScrolled *e_tree_scrolled_construct (ETreeScrolled *ets,
- ETreeModel *etm,
- ETableExtras *ete,
- const char *spec,
- const char *state)
-{
- g_return_val_if_fail(ets != NULL, NULL);
- g_return_val_if_fail(E_IS_TREE_SCROLLED(ets), NULL);
- g_return_val_if_fail(etm != NULL, NULL);
- g_return_val_if_fail(E_IS_TREE_MODEL(etm), NULL);
- g_return_val_if_fail(ete == NULL || E_IS_TABLE_EXTRAS(ete), NULL);
- g_return_val_if_fail(spec != NULL, NULL);
-
- e_tree_construct(ets->tree, etm, ete, spec, state);
-
- e_tree_scrolled_real_construct(ets);
-
- return ets;
-}
-
-GtkWidget *e_tree_scrolled_new (ETreeModel *etm,
- ETableExtras *ete,
- const char *spec,
- const char *state)
-{
- ETreeScrolled *ets;
-
- g_return_val_if_fail(etm != NULL, NULL);
- g_return_val_if_fail(E_IS_TREE_MODEL(etm), NULL);
- g_return_val_if_fail(ete == NULL || E_IS_TABLE_EXTRAS(ete), NULL);
- g_return_val_if_fail(spec != NULL, NULL);
-
- ets = E_TREE_SCROLLED (gtk_widget_new (e_tree_scrolled_get_type (),
- "hadjustment", NULL,
- "vadjustment", NULL,
- NULL));
-
- ets = e_tree_scrolled_construct (ets, etm, ete, spec, state);
-
- return GTK_WIDGET (ets);
-}
-
-ETreeScrolled *e_tree_scrolled_construct_from_spec_file (ETreeScrolled *ets,
- ETreeModel *etm,
- ETableExtras *ete,
- const char *spec_fn,
- const char *state_fn)
-{
- g_return_val_if_fail(ets != NULL, NULL);
- g_return_val_if_fail(E_IS_TREE_SCROLLED(ets), NULL);
- g_return_val_if_fail(etm != NULL, NULL);
- g_return_val_if_fail(E_IS_TREE_MODEL(etm), NULL);
- g_return_val_if_fail(ete == NULL || E_IS_TABLE_EXTRAS(ete), NULL);
- g_return_val_if_fail(spec_fn != NULL, NULL);
-
- e_tree_construct_from_spec_file(ets->tree, etm, ete, spec_fn, state_fn);
-
- e_tree_scrolled_real_construct(ets);
-
- return ets;
-}
-
-GtkWidget *e_tree_scrolled_new_from_spec_file (ETreeModel *etm,
- ETableExtras *ete,
- const char *spec_fn,
- const char *state_fn)
-{
- ETreeScrolled *ets;
-
- g_return_val_if_fail(etm != NULL, NULL);
- g_return_val_if_fail(E_IS_TREE_MODEL(etm), NULL);
- g_return_val_if_fail(ete == NULL || E_IS_TABLE_EXTRAS(ete), NULL);
- g_return_val_if_fail(spec_fn != NULL, NULL);
-
- ets = E_TREE_SCROLLED (gtk_widget_new (e_tree_scrolled_get_type (),
- "hadjustment", NULL,
- "vadjustment", NULL,
- NULL));
- ets = e_tree_scrolled_construct_from_spec_file (ets, etm, ete, spec_fn, state_fn);
-
- return GTK_WIDGET (ets);
-}
-
-ETree *
-e_tree_scrolled_get_tree (ETreeScrolled *ets)
-{
- return ets->tree;
-}
-
-static void
-ets_get_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- ETreeScrolled *ets = E_TREE_SCROLLED (o);
-
- switch (arg_id){
- case ARG_TREE:
- if (ets->tree)
- GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(ets->tree);
- else
- GTK_VALUE_OBJECT (*arg) = NULL;
- break;
- }
-}
-
-/* Grab_focus handler for the scrolled ETree */
-static void
-ets_grab_focus (GtkWidget *widget)
-{
- ETreeScrolled *ets;
-
- ets = E_TREE_SCROLLED (widget);
-
- gtk_widget_grab_focus (GTK_WIDGET (ets->tree));
-}
-
-/* Focus handler for the scrolled ETree */
-static gint
-ets_focus (GtkContainer *container, GtkDirectionType direction)
-{
- ETreeScrolled *ets;
-
- ets = E_TREE_SCROLLED (container);
-
- return gtk_container_focus (GTK_CONTAINER (ets->tree), direction);
-}
-
-static void
-e_tree_scrolled_class_init (ETreeScrolledClass *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 (PARENT_TYPE);
-
- object_class->get_arg = ets_get_arg;
-
- widget_class->grab_focus = ets_grab_focus;
-
- container_class->focus = ets_focus;
-
- gtk_object_add_arg_type ("ETreeScrolled::tree", GTK_TYPE_OBJECT,
- GTK_ARG_READABLE, ARG_TREE);
-}
-
-E_MAKE_TYPE(e_tree_scrolled, "ETreeScrolled", ETreeScrolled, e_tree_scrolled_class_init, e_tree_scrolled_init, PARENT_TYPE);
-
diff --git a/widgets/table/e-tree-scrolled.h b/widgets/table/e-tree-scrolled.h
deleted file mode 100644
index c1debd0afb..0000000000
--- a/widgets/table/e-tree-scrolled.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-tree-scrolled.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_TREE_SCROLLED_H_
-#define _E_TREE_SCROLLED_H_
-
-#include <gal/widgets/e-scroll-frame.h>
-#include <gal/e-table/e-tree-model.h>
-#include <gal/e-table/e-tree.h>
-#include <libgnome/gnome-defs.h>
-
-BEGIN_GNOME_DECLS
-
-#define E_TREE_SCROLLED_TYPE (e_tree_scrolled_get_type ())
-#define E_TREE_SCROLLED(o) (GTK_CHECK_CAST ((o), E_TREE_SCROLLED_TYPE, ETreeScrolled))
-#define E_TREE_SCROLLED_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TREE_SCROLLED_TYPE, ETreeScrolledClass))
-#define E_IS_TREE_SCROLLED(o) (GTK_CHECK_TYPE ((o), E_TREE_SCROLLED_TYPE))
-#define E_IS_TREE_SCROLLED_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TREE_SCROLLED_TYPE))
-
-typedef struct {
- EScrollFrame parent;
-
- ETree *tree;
-} ETreeScrolled;
-
-typedef struct {
- EScrollFrameClass parent_class;
-} ETreeScrolledClass;
-
-GtkType e_tree_scrolled_get_type (void);
-
-ETreeScrolled *e_tree_scrolled_construct (ETreeScrolled *ets,
- ETreeModel *etm,
- ETableExtras *ete,
- const char *spec,
- const char *state);
-GtkWidget *e_tree_scrolled_new (ETreeModel *etm,
- ETableExtras *ete,
- const char *spec,
- const char *state);
-
-ETreeScrolled *e_tree_scrolled_construct_from_spec_file (ETreeScrolled *ets,
- ETreeModel *etm,
- ETableExtras *ete,
- const char *spec_fn,
- const char *state_fn);
-GtkWidget *e_tree_scrolled_new_from_spec_file (ETreeModel *etm,
- ETableExtras *ete,
- const char *spec_fn,
- const char *state_fn);
-
-ETree *e_tree_scrolled_get_tree (ETreeScrolled *ets);
-
-END_GNOME_DECLS
-
-#endif /* _E_TREE_SCROLLED_H_ */
-
diff --git a/widgets/table/e-tree-selection-model.c b/widgets/table/e-tree-selection-model.c
deleted file mode 100644
index 7b0e306be0..0000000000
--- a/widgets/table/e-tree-selection-model.c
+++ /dev/null
@@ -1,1393 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-tree-selection-model.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <gdk/gdkkeysyms.h>
-#include <gtk/gtksignal.h>
-#include "e-tree-selection-model.h"
-#include <gal/util/e-bit-array.h>
-#include <gal/util/e-sorter.h>
-#include <gal/util/e-util.h>
-#include <gdk/gdkkeysyms.h>
-#include <gal/e-table/e-tree-sorted.h>
-#include <gal/e-table/e-tree-table-adapter.h>
-
-#define ETSM_CLASS(e) ((ETreeSelectionModelClass *)((GtkObject *)e)->klass)
-
-#define PARENT_TYPE e_selection_model_get_type ()
-
-static ESelectionModelClass *parent_class;
-
-enum {
- ARG_0,
- ARG_CURSOR_ROW,
- ARG_CURSOR_COL,
- ARG_MODEL,
- ARG_ETTA,
- ARG_ETS,
-};
-
-typedef struct ETreeSelectionModelNode {
- guint selected : 1;
- guint all_children_selected : 1;
- guint any_children_selected : 1;
- EBitArray *all_children_selected_array;
- EBitArray *any_children_selected_array;
- struct ETreeSelectionModelNode **children;
- int num_children;
-} ETreeSelectionModelNode;
-
-struct ETreeSelectionModelPriv {
- ETreeTableAdapter *etta;
- ETreeSorted *ets;
- ETreeModel *model;
-
- ETreeSelectionModelNode *root;
-
- ETreePath cursor_path;
- gint cursor_col;
- ETreePath selection_start_path;
-
- char *cursor_save_id;
-
- int frozen_count;
-
- int tree_model_pre_change_id;
- int tree_model_no_change_id;
- int tree_model_node_changed_id;
- int tree_model_node_data_changed_id;
- int tree_model_node_col_changed_id;
- int tree_model_node_inserted_id;
- int tree_model_node_removed_id;
- int tree_model_node_deleted_id;
-
- int sorted_model_node_resorted_id;
-
- /* Anything other than -1 means that the selection is a single
- * row. This being -1 does not impart any information. */
- int selected_row;
- /* Anything other than -1 means that the selection is a all
- * rows between selection_start_path and cursor_path where
- * selected_range_end is the rwo number of cursor_path. This
- * being -1 does not impart any information. */
- int selected_range_end;
-};
-
-/* ETreeSelectionModelNode helpers */
-
-static ETreeSelectionModelNode *
-e_tree_selection_model_node_new (void)
-{
- ETreeSelectionModelNode *node = g_new(ETreeSelectionModelNode, 1);
-
- node->selected = 0;
- node->all_children_selected = 0;
- node->any_children_selected = 0;
- node->all_children_selected_array = NULL;
- node->any_children_selected_array = NULL;
- node->children = NULL;
- node->num_children = -1;
-
- return node;
-}
-
-static void
-e_tree_selection_model_node_fill_children(ETreeSelectionModel *etsm, ETreePath path, ETreeSelectionModelNode *selection_node)
-{
- int i;
- selection_node->num_children = e_tree_sorted_node_num_children(etsm->priv->ets, path);
- selection_node->children = g_new(ETreeSelectionModelNode *, selection_node->num_children);
- for (i = 0; i < selection_node->num_children; i++) {
- selection_node->children[i] = NULL;
- }
-}
-
-static void
-e_tree_selection_model_node_free(ETreeSelectionModelNode *node)
-{
- int i;
-
- if (node->all_children_selected_array)
- gtk_object_unref(GTK_OBJECT(node->all_children_selected_array));
- if (node->any_children_selected_array)
- gtk_object_unref(GTK_OBJECT(node->any_children_selected_array));
-
- for (i = 0; i < node->num_children; i++)
- if (node->children[i])
- e_tree_selection_model_node_free(node->children[i]);
- g_free(node->children);
-
- g_free(node);
-}
-
-
-/* Other helper functions */
-static ETreePath
-etsm_node_at_row(ETreeSelectionModel *etsm, int row)
-{
- ETreePath path;
-
- if (!(row >= 0 && row < e_table_model_row_count(E_TABLE_MODEL(etsm->priv->etta))))
- return NULL;
-
- path = e_tree_table_adapter_node_at_row(etsm->priv->etta, row);
-
- if (path)
- path = e_tree_sorted_view_to_model_path(etsm->priv->ets, path);
-
- return path;
-}
-
-static int
-etsm_row_of_node(ETreeSelectionModel *etsm, ETreePath path)
-{
- path = e_tree_sorted_model_to_view_path(etsm->priv->ets, path);
-
- if (path)
- return e_tree_table_adapter_row_of_node(etsm->priv->etta, path);
- else
- return -1;
-}
-
-static int
-etsm_cursor_row_real (ETreeSelectionModel *etsm)
-{
- if (etsm->priv->cursor_path)
- return etsm_row_of_node(etsm, etsm->priv->cursor_path);
- else
- return -1;
-}
-
-static void
-etsm_real_clear (ETreeSelectionModel *etsm)
-{
- if (etsm->priv->root) {
- e_tree_selection_model_node_free(etsm->priv->root);
- etsm->priv->root = NULL;
- }
-}
-
-static ETreeSelectionModelNode *
-etsm_find_node_unless_equals (ETreeSelectionModel *etsm,
- ETreePath path,
- gboolean grow)
-{
- ETreeSelectionModelNode *selection_node;
- ETreeSorted *ets = etsm->priv->ets;
- ETreePath parent;
-
- parent = e_tree_model_node_get_parent(E_TREE_MODEL(ets), path);
-
- if (parent) {
- selection_node = etsm_find_node_unless_equals(etsm, parent, grow);
- if (selection_node) {
- int position = e_tree_sorted_orig_position(ets, path);
- if (selection_node->all_children_selected && grow)
- return NULL;
- if (!(selection_node->any_children_selected || grow))
- return NULL;
- if (selection_node->all_children_selected_array && e_bit_array_value_at(selection_node->all_children_selected_array, position) && grow)
- return NULL;
- if (selection_node->any_children_selected_array && ! (e_bit_array_value_at(selection_node->any_children_selected_array, position) || grow))
- return NULL;
- if (selection_node->children == NULL) {
- e_tree_selection_model_node_fill_children(etsm, parent, selection_node);
- }
- if (!selection_node->children[position])
- selection_node->children[position] = e_tree_selection_model_node_new();
-
- return selection_node->children[position];
- } else
- return NULL;
- } else {
- if (!etsm->priv->root)
- etsm->priv->root = e_tree_selection_model_node_new();
- return etsm->priv->root;
- }
-}
-
-#if 0
-static ETreeSelectionModelNode *
-find_or_create_node (ETreeSelectionModel *etsm,
- ETreePath path)
-{
- ETreeSelectionModelNode *selection_node;
- ETreeSelectionModelNode **place = NULL;
- ETreeSorted *ets = etsm->priv->ets;
- ETreePath parent;
-
- parent = e_tree_model_node_get_parent(E_TREE_MODEL(ets), path);
-
- if (parent) {
- selection_node = find_or_create_node(etsm, parent);
- if (selection_node) {
- int position = e_tree_sorted_orig_position(ets, path);
- if (!selection_node->children) {
- e_tree_selection_model_node_fill_children(etsm, parent, selection_node);
- }
- if (!selection_node->children[position])
- slection_node->children[position] = e_tree_selection_model_node_new();
-
- return selection_node->children[position];
- } else
- return NULL;
- } else {
- if (!etsm->priv->root)
- etsm->priv->root = e_tree_selection_model_node_new();
- return etsm->priv->root;
- }
-}
-#endif
-
-static void
-update_parents (ETreeSelectionModel *etsm, ETreePath path)
-{
- int i;
- int depth;
- ETreeSorted *ets = etsm->priv->ets;
- int *orig_position_sequence;
- ETreeSelectionModelNode **node_sequence;
- ETreePath parents;
-
- if (!etsm->priv->root)
- return;
-
- depth = e_tree_model_node_depth (E_TREE_MODEL(ets), path);
-
- orig_position_sequence = g_new(int, depth + 1);
- node_sequence = g_new(ETreeSelectionModelNode *, depth + 1);
-
- parents = path;
-
- for (i = depth; i > 0; i--) {
- if (!parents) {
- g_free(orig_position_sequence);
- g_free(node_sequence);
- return;
- }
- orig_position_sequence[i] = e_tree_sorted_orig_position(etsm->priv->ets, parents);
- parents = e_tree_model_node_get_parent(E_TREE_MODEL(etsm->priv->ets), parents);
- }
-
- node_sequence[0] = etsm->priv->root;
- for (i = 0; i < depth; i++) {
- node_sequence[i + 1] = NULL;
-
- if (node_sequence[i]->children)
- node_sequence[i + 1] = node_sequence[i]->children[orig_position_sequence[i + 1]];
-
- if (node_sequence[i + 1] == NULL) {
- g_free(orig_position_sequence);
- g_free(node_sequence);
- return;
- }
- }
-
- if (node_sequence[depth]->num_children == -1)
- e_tree_selection_model_node_fill_children(etsm, path, node_sequence[depth]);
-
- if (!node_sequence[depth]->all_children_selected_array)
- node_sequence[depth]->all_children_selected_array = e_bit_array_new(node_sequence[depth]->num_children);
- if (!node_sequence[depth]->any_children_selected_array)
- node_sequence[depth]->any_children_selected_array = e_bit_array_new(node_sequence[depth]->num_children);
-
- node_sequence[depth]->all_children_selected =
- e_bit_array_cross_and(node_sequence[depth]->all_children_selected_array) &&
- node_sequence[depth]->selected;
-
- node_sequence[depth]->any_children_selected =
- e_bit_array_cross_or(node_sequence[depth]->any_children_selected_array) ||
- node_sequence[depth]->selected;
-
- for (i = depth - 1; i >= 0; i--) {
- gboolean all_children, any_children;
-
- if (!node_sequence[i]->all_children_selected_array)
- node_sequence[i]->all_children_selected_array = e_bit_array_new(node_sequence[i]->num_children);
- if (!node_sequence[i]->any_children_selected_array)
- node_sequence[i]->any_children_selected_array = e_bit_array_new(node_sequence[i]->num_children);
-
- e_bit_array_change_one_row(node_sequence[i]->all_children_selected_array,
- orig_position_sequence[i + 1], node_sequence[i + 1]->all_children_selected);
- e_bit_array_change_one_row(node_sequence[i]->any_children_selected_array,
- orig_position_sequence[i + 1], node_sequence[i + 1]->any_children_selected);
-
- all_children = node_sequence[i]->all_children_selected;
- any_children = node_sequence[i]->any_children_selected;
-
- node_sequence[i]->all_children_selected =
- e_bit_array_cross_and(node_sequence[i]->all_children_selected_array) &&
- node_sequence[i]->selected;
- node_sequence[i]->any_children_selected =
- e_bit_array_cross_or(node_sequence[i]->any_children_selected_array) ||
- node_sequence[i]->selected;
-
- if (all_children == node_sequence[i]->all_children_selected &&
- any_children == node_sequence[i]->any_children_selected)
- break;
- }
-
- g_free(orig_position_sequence);
- g_free(node_sequence);
-}
-
-
-static void
-etsm_change_one_path(ETreeSelectionModel *etsm, ETreePath path, gboolean grow)
-{
- ETreeSelectionModelNode *node;
-
- if (!path)
- return;
-
- path = e_tree_sorted_model_to_view_path(etsm->priv->ets, path);
-
- if (!path)
- return;
-
- node = etsm_find_node_unless_equals (etsm, path, grow);
-
- if (node) {
- node->selected = grow;
- update_parents(etsm, path);
- }
-}
-
-static void
-etsm_real_select_single_path (ETreeSelectionModel *etsm, ETreePath path)
-{
- etsm_real_clear (etsm);
- etsm_change_one_path(etsm, path, TRUE);
- etsm->priv->selection_start_path = path;
- etsm->priv->selected_row = -1;
- etsm->priv->selected_range_end = -1;
-}
-
-
-/* Signal handlers */
-
-static void
-etsm_freeze (ETreeSelectionModel *etsm)
-{
- etsm->priv->frozen_count ++;
-}
-
-static void
-etsm_unfreeze (ETreeSelectionModel *etsm)
-{
- etsm->priv->frozen_count --;
-}
-
-static void
-etsm_pre_change (ETreeModel *etm, ETreeSelectionModel *etsm)
-{
- g_free (etsm->priv->cursor_save_id);
- etsm->priv->cursor_save_id = NULL;
-
- if (e_tree_model_has_get_node_by_id (etm) &&
- e_tree_model_has_save_id (etm) &&
- etsm->priv->cursor_path) {
- etsm->priv->cursor_save_id = e_tree_model_get_save_id (etm, etsm->priv->cursor_path);
- }
-
- etsm_freeze (etsm);
-}
-
-static void
-etsm_no_change (ETreeModel *etm, ETreeSelectionModel *etsm)
-{
- etsm_unfreeze (etsm);
-}
-
-static void
-clear_tree (ETreeSelectionModel *etsm, ETreeModel *etm)
-{
- int cursor_row;
-
- etsm_real_clear (etsm);
- etsm->priv->cursor_path = NULL;
-
- if (e_tree_model_has_get_node_by_id (etm) && etsm->priv->cursor_save_id) {
- ETreePath cursor_path;
-
- cursor_path = e_tree_model_get_node_by_id (etm, etsm->priv->cursor_save_id);
- etsm->priv->cursor_path = cursor_path;
- if (cursor_path != NULL && etsm->priv->cursor_col == -1)
- etsm->priv->cursor_col = 0;
-
- etsm_real_select_single_path(etsm, cursor_path);
- }
-
- cursor_row = etsm_cursor_row_real (etsm);
- etsm->priv->selected_row = -1;
- etsm->priv->selected_range_end = -1;
- e_selection_model_selection_changed(E_SELECTION_MODEL(etsm));
- if (cursor_row != -1)
- e_selection_model_cursor_changed(E_SELECTION_MODEL(etsm), cursor_row, etsm->priv->cursor_col);
- else {
- e_selection_model_cursor_changed(E_SELECTION_MODEL(etsm), -1, -1);
- e_selection_model_cursor_activated(E_SELECTION_MODEL(etsm), -1, -1);
- }
-
- g_free (etsm->priv->cursor_save_id);
- etsm->priv->cursor_save_id = NULL;
-}
-
-static void
-etsm_node_changed (ETreeModel *etm, ETreePath node, ETreeSelectionModel *etsm)
-{
- clear_tree (etsm, etm);
- etsm_unfreeze (etsm);
-}
-
-static void
-etsm_node_data_changed (ETreeModel *etm, ETreePath node, ETreeSelectionModel *etsm)
-{
- g_free (etsm->priv->cursor_save_id);
- etsm->priv->cursor_save_id = NULL;
- etsm_unfreeze (etsm);
-}
-
-static void
-etsm_node_col_changed (ETreeModel *etm, ETreePath node, int col, ETreeSelectionModel *etsm)
-{
- g_free (etsm->priv->cursor_save_id);
- etsm->priv->cursor_save_id = NULL;
- etsm_unfreeze (etsm);
-}
-
-static void
-etsm_node_inserted (ETreeModel *etm, ETreePath parent, ETreePath child, ETreeSelectionModel *etsm)
-{
- clear_tree (etsm, etm);
- etsm_unfreeze (etsm);
-#if 0
- ETreeSelectionModelNode *node;
- ETreePath path;
-
- path = e_tree_sorted_model_to_view_path(etsm->priv->ets, parent);
-
- if (!path)
- return;
-
- node = etsm_find_node_unless_equals (etsm, path, FALSE);
-
- if (node) {
- node->selected = FALSE;
- update_parents(etsm, path);
- }
-#endif
-}
-
-static void
-etsm_node_removed (ETreeModel *etm, ETreePath parent, ETreePath child, int old_position, ETreeSelectionModel *etsm)
-{
-}
-
-static void
-etsm_node_deleted (ETreeModel *etm, ETreePath child, ETreeSelectionModel *etsm)
-{
- clear_tree (etsm, etm);
- etsm_unfreeze (etsm);
-}
-
-
-static void
-etsm_sorted_node_resorted (ETreeModel *etm, ETreePath node, ETreeSelectionModel *etsm)
-{
- int cursor_row = etsm_cursor_row_real (etsm);
-
- etsm->priv->selected_row = -1;
- etsm->priv->selected_range_end = -1;
- e_selection_model_selection_changed(E_SELECTION_MODEL(etsm));
-
- if (cursor_row != -1)
- e_selection_model_cursor_changed(E_SELECTION_MODEL(etsm), cursor_row, etsm->priv->cursor_col);
- else
- e_selection_model_cursor_changed(E_SELECTION_MODEL(etsm), -1, -1);
-}
-
-static void
-add_model(ETreeSelectionModel *etsm, ETreeModel *model)
-{
- ETreeSelectionModelPriv *priv = etsm->priv;
-
- priv->model = model;
-
- if (!priv->model)
- return;
-
- gtk_object_ref(GTK_OBJECT(priv->model));
- priv->tree_model_pre_change_id = gtk_signal_connect_after (GTK_OBJECT (priv->model), "pre_change",
- GTK_SIGNAL_FUNC (etsm_pre_change), etsm);
- priv->tree_model_no_change_id = gtk_signal_connect_after (GTK_OBJECT (priv->model), "no_change",
- GTK_SIGNAL_FUNC (etsm_no_change), etsm);
- priv->tree_model_node_changed_id = gtk_signal_connect_after (GTK_OBJECT (priv->model), "node_changed",
- GTK_SIGNAL_FUNC (etsm_node_changed), etsm);
- priv->tree_model_node_data_changed_id = gtk_signal_connect_after (GTK_OBJECT (priv->model), "node_data_changed",
- GTK_SIGNAL_FUNC (etsm_node_data_changed), etsm);
- priv->tree_model_node_col_changed_id = gtk_signal_connect_after (GTK_OBJECT (priv->model), "node_col_changed",
- GTK_SIGNAL_FUNC (etsm_node_col_changed), etsm);
- priv->tree_model_node_inserted_id = gtk_signal_connect_after (GTK_OBJECT (priv->model), "node_inserted",
- GTK_SIGNAL_FUNC (etsm_node_inserted), etsm);
- priv->tree_model_node_removed_id = gtk_signal_connect_after (GTK_OBJECT (priv->model), "node_removed",
- GTK_SIGNAL_FUNC (etsm_node_removed), etsm);
- priv->tree_model_node_deleted_id = gtk_signal_connect_after (GTK_OBJECT (priv->model), "node_deleted",
- GTK_SIGNAL_FUNC (etsm_node_deleted), etsm);
-}
-
-static void
-drop_model(ETreeSelectionModel *etsm)
-{
- ETreeSelectionModelPriv *priv = etsm->priv;
-
- if (!priv->model)
- return;
-
- gtk_signal_disconnect (GTK_OBJECT (priv->model),
- priv->tree_model_pre_change_id);
- gtk_signal_disconnect (GTK_OBJECT (priv->model),
- priv->tree_model_no_change_id);
- gtk_signal_disconnect (GTK_OBJECT (priv->model),
- priv->tree_model_node_changed_id);
- gtk_signal_disconnect (GTK_OBJECT (priv->model),
- priv->tree_model_node_data_changed_id);
- gtk_signal_disconnect (GTK_OBJECT (priv->model),
- priv->tree_model_node_col_changed_id);
- gtk_signal_disconnect (GTK_OBJECT (priv->model),
- priv->tree_model_node_inserted_id);
- gtk_signal_disconnect (GTK_OBJECT (priv->model),
- priv->tree_model_node_removed_id);
- gtk_signal_disconnect (GTK_OBJECT (priv->model),
- priv->tree_model_node_deleted_id);
-
- gtk_object_unref (GTK_OBJECT (priv->model));
- priv->model = NULL;
-
- priv->tree_model_pre_change_id = 0;
- priv->tree_model_no_change_id = 0;
- priv->tree_model_node_changed_id = 0;
- priv->tree_model_node_data_changed_id = 0;
- priv->tree_model_node_col_changed_id = 0;
- priv->tree_model_node_inserted_id = 0;
- priv->tree_model_node_removed_id = 0;
- priv->tree_model_node_deleted_id = 0;
-}
-
-
-static void
-add_ets(ETreeSelectionModel *etsm, ETreeSorted *ets)
-{
- ETreeSelectionModelPriv *priv = etsm->priv;
-
- priv->ets = ets;
-
- if (!priv->ets)
- return;
-
- gtk_object_ref(GTK_OBJECT(priv->ets));
- priv->sorted_model_node_resorted_id = gtk_signal_connect (GTK_OBJECT (priv->ets), "node_resorted",
- GTK_SIGNAL_FUNC (etsm_sorted_node_resorted), etsm);
-}
-
-static void
-drop_ets(ETreeSelectionModel *etsm)
-{
- ETreeSelectionModelPriv *priv = etsm->priv;
-
- if (!priv->ets)
- return;
-
- gtk_signal_disconnect (GTK_OBJECT (priv->ets),
- priv->sorted_model_node_resorted_id);
-
- gtk_object_unref (GTK_OBJECT (priv->ets));
- priv->ets = NULL;
-
- priv->sorted_model_node_resorted_id = 0;
-}
-
-/* Virtual functions */
-static void
-etsm_destroy (GtkObject *object)
-{
- ETreeSelectionModel *etsm;
-
- etsm = E_TREE_SELECTION_MODEL (object);
-
- etsm_real_clear (etsm);
- etsm->priv->cursor_path = NULL;
- drop_model(etsm);
- drop_ets(etsm);
-
- g_free (etsm->priv->cursor_save_id);
-
- g_free(etsm->priv);
- etsm->priv = NULL;
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-static void
-etsm_get_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL (o);
-
- switch (arg_id){
- case ARG_CURSOR_ROW:
- GTK_VALUE_INT(*arg) = etsm_cursor_row_real(etsm);
- break;
-
- case ARG_CURSOR_COL:
- GTK_VALUE_INT(*arg) = etsm->priv->cursor_col;
- break;
-
- case ARG_MODEL:
- GTK_VALUE_OBJECT(*arg) = (GtkObject *) etsm->priv->model;
- break;
-
- case ARG_ETTA:
- GTK_VALUE_OBJECT(*arg) = (GtkObject *) etsm->priv->etta;
- break;
-
- case ARG_ETS:
- GTK_VALUE_OBJECT(*arg) = (GtkObject *) etsm->priv->ets;
- break;
- }
-}
-
-static void
-etsm_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- ESelectionModel *esm = E_SELECTION_MODEL (o);
- ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL (o);
-
- switch (arg_id){
- case ARG_CURSOR_ROW:
- e_selection_model_do_something(esm, GTK_VALUE_INT(*arg), etsm->priv->cursor_col, 0);
- break;
-
- case ARG_CURSOR_COL:
- e_selection_model_do_something(esm, etsm_cursor_row_real(etsm), GTK_VALUE_INT(*arg), 0);
- break;
-
- case ARG_MODEL:
- drop_model(etsm);
- add_model(etsm, (ETreeModel *) GTK_VALUE_OBJECT(*arg));
- break;
-
- case ARG_ETTA:
- etsm->priv->etta = (ETreeTableAdapter *) GTK_VALUE_OBJECT(*arg);
- break;
-
- case ARG_ETS:
- drop_ets(etsm);
- add_ets(etsm, (ETreeSorted *) GTK_VALUE_OBJECT(*arg));
- break;
- }
-}
-
-static ETreeSelectionModelNode *
-etsm_recurse_is_path_selected (ETreeSelectionModel *etsm,
- ETreePath path,
- gboolean *is_selected)
-{
- ETreeSelectionModelNode *selection_node;
- ETreeSorted *ets = etsm->priv->ets;
- ETreePath parent;
-
- parent = e_tree_model_node_get_parent(E_TREE_MODEL(ets), path);
-
- if (parent) {
- selection_node = etsm_recurse_is_path_selected (etsm, parent, is_selected);
- if (selection_node) {
- int position = e_tree_sorted_orig_position(ets, path);
- if (position < 0 || position >= selection_node->num_children) {
- *is_selected = FALSE;
- return NULL;
- }
- if (selection_node->all_children_selected) {
- *is_selected = TRUE;
- return NULL;
- }
- if (! selection_node->any_children_selected) {
- *is_selected = FALSE;
- return NULL;
- }
- if (selection_node->all_children_selected_array && e_bit_array_value_at(selection_node->all_children_selected_array, position)) {
- *is_selected = TRUE;
- return NULL;
- }
- if (selection_node->any_children_selected_array && ! e_bit_array_value_at(selection_node->any_children_selected_array, position)) {
- *is_selected = FALSE;
- return NULL;
- }
- if (!selection_node->children) {
- *is_selected = FALSE;
- return NULL;
- }
- return selection_node->children[position];
- } else
- return NULL;
- } else {
- if (etsm->priv->root) {
- return etsm->priv->root;
- } else {
- *is_selected = FALSE;
- return NULL;
- }
- }
-}
-
-static gboolean
-etsm_is_path_selected (ETreeSelectionModel *etsm,
- ETreePath path)
-{
- ETreeSelectionModelNode *selection_node;
- gboolean ret_val;
-
- selection_node = etsm_recurse_is_path_selected (etsm, path, &ret_val);
-
- if (selection_node)
- ret_val = selection_node->selected;
-
- return ret_val;
-}
-
-/**
- * e_selection_model_is_row_selected
- * @selection: #ESelectionModel to check
- * @n: The row to check
- *
- * This routine calculates whether the given row is selected.
- *
- * Returns: %TRUE if the given row is selected
- */
-static gboolean
-etsm_is_row_selected (ESelectionModel *selection,
- gint row)
-{
- ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL(selection);
- ETreePath path;
-
- g_return_val_if_fail(row < e_table_model_row_count(E_TABLE_MODEL(etsm->priv->etta)), FALSE);
- g_return_val_if_fail(row >= 0, FALSE);
- g_return_val_if_fail(etsm != NULL, FALSE);
-
- path = e_tree_table_adapter_node_at_row(etsm->priv->etta, row);
- return etsm_is_path_selected (etsm, path);
-}
-
-
-typedef struct {
- ETreeSelectionModel *etsm;
- EForeachFunc callback;
- gpointer closure;
-} ModelAndCallback;
-
-static void
-etsm_row_foreach_cb (ETreePath path, gpointer user_data)
-{
- ModelAndCallback *mac = user_data;
- int row = etsm_row_of_node(mac->etsm, path);
- if (row >= 0)
- mac->callback(row, mac->closure);
-}
-
-/**
- * e_selection_model_foreach
- * @selection: #ESelectionModel to traverse
- * @callback: The callback function to call back.
- * @closure: The closure
- *
- * This routine calls the given callback function once for each
- * selected row, passing closure as the closure.
- */
-static void
-etsm_foreach (ESelectionModel *selection,
- EForeachFunc callback,
- gpointer closure)
-{
- ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL(selection);
- ModelAndCallback mac;
-
- mac.etsm = etsm;
- mac.callback = callback;
- mac.closure = closure;
-
- e_tree_selection_model_foreach(etsm, etsm_row_foreach_cb, &mac);
-}
-
-/**
- * e_selection_model_clear
- * @selection: #ESelectionModel to clear
- *
- * This routine clears the selection to no rows selected.
- */
-static void
-etsm_clear(ESelectionModel *selection)
-{
- ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL(selection);
-
- etsm_real_clear (etsm);
-
- etsm->priv->cursor_path = NULL;
- etsm->priv->cursor_col = -1;
- etsm->priv->selected_row = -1;
- etsm->priv->selected_range_end = -1;
- e_selection_model_selection_changed(E_SELECTION_MODEL(etsm));
- e_selection_model_cursor_changed(E_SELECTION_MODEL(etsm), -1, -1);
-}
-
-/* Standard functions */
-static void
-etsm_selected_count_all_recurse (ETreeSelectionModel *etsm,
- ETreePath path,
- int *count)
-{
- ETreePath child;
-
- (*count) ++;
-
- child = e_tree_model_node_get_first_child(E_TREE_MODEL(etsm->priv->model), path);
- for ( ; child; child = e_tree_model_node_get_next(E_TREE_MODEL(etsm->priv->model), child))
- if (child)
- etsm_selected_count_all_recurse (etsm, child, count);
-}
-
-static void
-etsm_selected_count_recurse (ETreeSelectionModel *etsm,
- ETreeSelectionModelNode *selection_node,
- ETreePath path,
- int *count)
-{
- if (selection_node->all_children_selected) {
- if (path)
- etsm_selected_count_all_recurse(etsm, path, count);
- return;
- }
- if (!selection_node->any_children_selected)
- return;
-
- if (selection_node->selected) {
- (*count) ++;
- }
-
- if (selection_node->children) {
- ETreePath child = e_tree_model_node_get_first_child(E_TREE_MODEL(etsm->priv->model), path);
- int i;
- for (i = 0; child && i < selection_node->num_children; i++, child = e_tree_model_node_get_next(E_TREE_MODEL(etsm->priv->model), child))
- if (selection_node->children[i])
- etsm_selected_count_recurse (etsm, selection_node->children[i], child, count);
- }
-}
-
-/**
- * e_selection_model_selected_count
- * @selection: #ESelectionModel to count
- *
- * This routine calculates the number of rows selected.
- *
- * Returns: The number of rows selected in the given model.
- */
-static gint
-etsm_selected_count (ESelectionModel *selection)
-{
- ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL(selection);
- int count = 0;
- if (etsm->priv->root) {
- ETreePath model_root;
- model_root = e_tree_model_get_root(etsm->priv->model);
- etsm_selected_count_recurse(etsm, etsm->priv->root, model_root, &count);
- if (!e_tree_table_adapter_root_node_is_visible (etsm->priv->etta) && etsm_is_path_selected (etsm, e_tree_model_get_root(E_TREE_MODEL (etsm->priv->ets)))) {
- count --;
- }
- }
- return count;
-}
-
-/**
- * e_selection_model_select_all
- * @selection: #ESelectionModel to select all
- *
- * This routine selects all the rows in the given
- * #ESelectionModel.
- */
-static void
-etsm_select_all (ESelectionModel *selection)
-{
- ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL(selection);
- ETreePath root;
-
- root = e_tree_model_get_root(E_TREE_MODEL(etsm->priv->ets));
- if (root == NULL)
- return;
-
- etsm_real_clear (etsm);
-
- etsm->priv->root = e_tree_selection_model_node_new();
- etsm->priv->root->selected = TRUE;
- etsm->priv->root->all_children_selected = TRUE;
- etsm->priv->root->any_children_selected = TRUE;
-
- e_tree_selection_model_node_fill_children(etsm, root, etsm->priv->root);
- etsm->priv->root->all_children_selected_array = e_bit_array_new(etsm->priv->root->num_children);
- etsm->priv->root->any_children_selected_array = e_bit_array_new(etsm->priv->root->num_children);
- e_bit_array_select_all(etsm->priv->root->all_children_selected_array);
- e_bit_array_select_all(etsm->priv->root->any_children_selected_array);
-
- if (etsm->priv->cursor_col == -1)
- etsm->priv->cursor_col = 0;
- if (etsm->priv->cursor_path == NULL)
- etsm->priv->cursor_path = etsm_node_at_row(etsm, 0);
- etsm->priv->selection_start_path = etsm_node_at_row(etsm, 0);
- etsm->priv->selected_row = -1;
- etsm->priv->selected_range_end = -1;
- e_selection_model_selection_changed(E_SELECTION_MODEL(etsm));
- e_selection_model_cursor_changed(E_SELECTION_MODEL(etsm), etsm_cursor_row_real(etsm), etsm->priv->cursor_col);
-}
-
-static void
-etsm_invert_selection_recurse (ETreeSelectionModel *etsm,
- ETreeSelectionModelNode *selection_node)
-{
- gboolean temp;
- EBitArray *temp_eba;
- selection_node->selected = ! selection_node->selected;
-
- temp = selection_node->all_children_selected;
- selection_node->all_children_selected = ! selection_node->any_children_selected;
- selection_node->any_children_selected = ! temp;
-
- temp_eba = selection_node->all_children_selected_array;
- selection_node->all_children_selected_array = selection_node->any_children_selected_array;
- selection_node->any_children_selected_array = temp_eba;
- if (selection_node->all_children_selected_array)
- e_bit_array_invert_selection(selection_node->all_children_selected_array);
- if (selection_node->any_children_selected_array)
- e_bit_array_invert_selection(selection_node->any_children_selected_array);
- if (selection_node->children) {
- int i;
- for (i = 0; i < selection_node->num_children; i++) {
- if (selection_node->children[i])
- etsm_invert_selection_recurse (etsm, selection_node->children[i]);
- }
- }
-}
-
-/**
- * e_selection_model_invert_selection
- * @selection: #ESelectionModel to invert
- *
- * This routine inverts all the rows in the given
- * #ESelectionModel.
- */
-static void
-etsm_invert_selection (ESelectionModel *selection)
-{
- ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL(selection);
-
- if (etsm->priv->root)
- etsm_invert_selection_recurse (etsm, etsm->priv->root);
-
- etsm->priv->cursor_col = -1;
- etsm->priv->cursor_path = NULL;
- etsm->priv->selection_start_path = etsm_node_at_row(etsm, 0);
- etsm->priv->selected_row = -1;
- etsm->priv->selected_range_end = -1;
- e_selection_model_selection_changed(E_SELECTION_MODEL(etsm));
- e_selection_model_cursor_changed(E_SELECTION_MODEL(etsm), -1, -1);
-}
-
-static int
-etsm_row_count (ESelectionModel *selection)
-{
- ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL(selection);
- return e_table_model_row_count(E_TABLE_MODEL(etsm->priv->etta));
-}
-
-static void
-etsm_change_one_row(ESelectionModel *selection, int row, gboolean grow)
-{
- ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL(selection);
- ETreeSelectionModelNode *node;
- ETreePath path;
-
- g_return_if_fail(row < e_table_model_row_count(E_TABLE_MODEL(etsm->priv->etta)));
- g_return_if_fail(row >= 0);
- g_return_if_fail(selection != NULL);
-
- path = e_tree_table_adapter_node_at_row(etsm->priv->etta, row);
-
- if (!path)
- return;
-
- node = etsm_find_node_unless_equals (etsm, path, grow);
-
- if (node) {
- node->selected = grow;
- update_parents(etsm, path);
- }
-}
-
-static void
-etsm_change_cursor (ESelectionModel *selection, int row, int col)
-{
- ETreeSelectionModel *etsm;
-
- g_return_if_fail(selection != NULL);
- g_return_if_fail(E_IS_SELECTION_MODEL(selection));
-
- etsm = E_TREE_SELECTION_MODEL(selection);
-
- if (row == -1) {
- etsm->priv->cursor_path = NULL;
- } else {
- etsm->priv->cursor_path = etsm_node_at_row(etsm, row);
- }
- etsm->priv->cursor_col = col;
-}
-
-static void
-etsm_change_range(ESelectionModel *selection, int start, int end, gboolean grow)
-{
- int i;
- if (start != end) {
- if (selection->sorter && e_sorter_needs_sorting(selection->sorter)) {
- for ( i = start; i < end; i++) {
- e_selection_model_change_one_row(selection, e_sorter_sorted_to_model(selection->sorter, i), grow);
- }
- } else {
- for ( i = start; i < end; i++) {
- e_selection_model_change_one_row(selection, i, grow);
- }
- }
- }
-}
-
-static int
-etsm_cursor_row (ESelectionModel *selection)
-{
- return etsm_cursor_row_real(E_TREE_SELECTION_MODEL(selection));
-}
-
-static int
-etsm_cursor_col (ESelectionModel *selection)
-{
- ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL(selection);
- return etsm->priv->cursor_col;
-}
-
-static void
-etsm_select_single_row (ESelectionModel *selection, int row)
-{
- ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL(selection);
- int selected_row = etsm->priv->selected_row;
-
- etsm_real_clear (etsm);
- etsm_change_one_row(selection, row, TRUE);
- etsm->priv->selection_start_path = etsm_node_at_row(etsm, row);
-
- etsm->priv->selected_row = row;
- etsm->priv->selected_range_end = -1;
- if (selected_row != -1) {
- if (selected_row != etsm->priv->selected_row) {
- e_selection_model_selection_row_changed(E_SELECTION_MODEL(etsm), selected_row);
- e_selection_model_selection_row_changed(E_SELECTION_MODEL(etsm), row);
- }
- } else {
- e_selection_model_selection_changed(E_SELECTION_MODEL(etsm));
- }
-}
-
-static void
-etsm_toggle_single_row (ESelectionModel *selection, int row)
-{
- ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL(selection);
-
- etsm->priv->selection_start_path = etsm_node_at_row(etsm, row);
-
- etsm_change_one_row(selection, row, !etsm_is_row_selected(selection, row));
-
- etsm->priv->selected_row = -1;
- etsm->priv->selected_range_end = -1;
- e_selection_model_selection_changed(E_SELECTION_MODEL(etsm));
-}
-
-static void
-etsm_real_move_selection_end (ETreeSelectionModel *etsm, int row)
-{
- ESelectionModel *selection = E_SELECTION_MODEL (etsm);
- int old_start;
- int old_end;
- int new_start;
- int new_end;
- int start_row = etsm_row_of_node(etsm, etsm->priv->selection_start_path);
- if (selection->sorter && e_sorter_needs_sorting(selection->sorter)) {
- old_start = MIN (e_sorter_model_to_sorted(selection->sorter, start_row),
- e_sorter_model_to_sorted(selection->sorter, etsm_cursor_row_real(etsm)));
- old_end = MAX (e_sorter_model_to_sorted(selection->sorter, start_row),
- e_sorter_model_to_sorted(selection->sorter, etsm_cursor_row_real(etsm))) + 1;
- new_start = MIN (e_sorter_model_to_sorted(selection->sorter, start_row),
- e_sorter_model_to_sorted(selection->sorter, row));
- new_end = MAX (e_sorter_model_to_sorted(selection->sorter, start_row),
- e_sorter_model_to_sorted(selection->sorter, row)) + 1;
- } else {
- old_start = MIN (start_row, etsm_cursor_row_real(etsm));
- old_end = MAX (start_row, etsm_cursor_row_real(etsm)) + 1;
- new_start = MIN (start_row, row);
- new_end = MAX (start_row, row) + 1;
- }
- /* This wouldn't work nearly so smoothly if one end of the selection weren't held in place. */
- if (old_start < new_start)
- etsm_change_range(selection, old_start, new_start, FALSE);
- if (new_start < old_start)
- etsm_change_range(selection, new_start, old_start, TRUE);
- if (old_end < new_end)
- etsm_change_range(selection, old_end, new_end, TRUE);
- if (new_end < old_end)
- etsm_change_range(selection, new_end, old_end, FALSE);
- etsm->priv->selected_row = -1;
- etsm->priv->selected_range_end = -1;
-}
-
-static void
-etsm_move_selection_end (ESelectionModel *selection, int row)
-{
- ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL(selection);
-
- etsm_real_move_selection_end (etsm, row);
- e_selection_model_selection_changed(E_SELECTION_MODEL(selection));
-}
-
-static void
-etsm_set_selection_end (ESelectionModel *selection, int row)
-{
- ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL(selection);
- int selected_range_end = etsm->priv->selected_range_end;
-
- etsm_real_select_single_path(etsm, etsm->priv->selection_start_path);
- etsm->priv->cursor_path = etsm->priv->selection_start_path;
- etsm_real_move_selection_end(etsm, row);
- etsm->priv->selected_range_end = row;
- if (selected_range_end != -1 && row != -1) {
- if (selected_range_end == row - 1 ||
- selected_range_end == row + 1) {
- e_selection_model_selection_row_changed(E_SELECTION_MODEL(etsm), selected_range_end);
- e_selection_model_selection_row_changed(E_SELECTION_MODEL(etsm), row);
- return;
- }
- }
- e_selection_model_selection_changed(E_SELECTION_MODEL(etsm));
-}
-
-
-/* Standard functions */
-static void
-etsm_foreach_all_recurse (ETreeSelectionModel *etsm,
- ETreePath path,
- ETreeForeachFunc callback,
- gpointer closure)
-{
- ETreePath child;
-
- callback(path, closure);
-
- child = e_tree_model_node_get_first_child(E_TREE_MODEL(etsm->priv->model), path);
- for ( ; child; child = e_tree_model_node_get_next(E_TREE_MODEL(etsm->priv->model), child))
- if (child)
- etsm_foreach_all_recurse (etsm, child, callback, closure);
-}
-
-static void
-etsm_foreach_recurse (ETreeSelectionModel *etsm,
- ETreeSelectionModelNode *selection_node,
- ETreePath path,
- ETreeForeachFunc callback,
- gpointer closure)
-{
- if (selection_node->all_children_selected) {
- if (path)
- etsm_foreach_all_recurse(etsm, path, callback, closure);
- return;
- }
- if (!selection_node->any_children_selected)
- return;
-
- if (selection_node->selected) {
- callback(path, closure);
- }
-
- if (selection_node->children) {
- ETreePath child = e_tree_model_node_get_first_child(E_TREE_MODEL(etsm->priv->model), path);
- int i;
- for (i = 0; i < selection_node->num_children; i++, child = e_tree_model_node_get_next(E_TREE_MODEL(etsm->priv->model), child))
- if (selection_node->children[i])
- etsm_foreach_recurse (etsm, selection_node->children[i], child, callback, closure);
- }
-}
-
-void
-e_tree_selection_model_foreach (ETreeSelectionModel *etsm,
- ETreeForeachFunc callback,
- gpointer closure)
-{
- if (etsm->priv->root) {
- ETreePath model_root;
- model_root = e_tree_model_get_root(etsm->priv->model);
- etsm_foreach_recurse(etsm, etsm->priv->root, model_root, callback, closure);
- }
-}
-
-void
-e_tree_selection_model_select_single_path (ETreeSelectionModel *etsm, ETreePath path)
-{
- etsm_real_select_single_path (etsm, path);
-
- e_selection_model_selection_changed(E_SELECTION_MODEL(etsm));
-}
-
-void
-e_tree_selection_model_add_to_selection (ETreeSelectionModel *etsm, ETreePath path)
-{
- etsm_change_one_path(etsm, path, TRUE);
- etsm->priv->selection_start_path = path;
- etsm->priv->selected_row = -1;
- etsm->priv->selected_range_end = -1;
-
- e_selection_model_selection_changed(E_SELECTION_MODEL(etsm));
-}
-
-void
-e_tree_selection_model_change_cursor (ETreeSelectionModel *etsm, ETreePath path)
-{
- int row;
-
- etsm->priv->cursor_path = path;
-
- row = etsm_cursor_row_real(etsm);
-
- E_SELECTION_MODEL (etsm)->old_selection = -1;
-
- e_selection_model_cursor_changed(E_SELECTION_MODEL(etsm), row, etsm->priv->cursor_col);
- e_selection_model_cursor_activated(E_SELECTION_MODEL(etsm), row, etsm->priv->cursor_col);
-}
-
-ETreePath
-e_tree_selection_model_get_cursor (ETreeSelectionModel *etsm)
-{
- return etsm->priv->cursor_path;
-}
-
-
-static void
-e_tree_selection_model_init (ETreeSelectionModel *etsm)
-{
- ETreeSelectionModelPriv *priv;
- priv = g_new(ETreeSelectionModelPriv, 1);
- etsm->priv = priv;
-
- priv->etta = NULL;
- priv->ets = NULL;
- priv->model = NULL;
-
- priv->root = NULL;
-
- priv->cursor_path = NULL;
- priv->cursor_col = -1;
- priv->selection_start_path = NULL;
-
- priv->cursor_save_id = NULL;
-
- priv->frozen_count = 0;
-
-
- priv->tree_model_pre_change_id = 0;
- priv->tree_model_no_change_id = 0;
- priv->tree_model_node_changed_id = 0;
- priv->tree_model_node_data_changed_id = 0;
- priv->tree_model_node_col_changed_id = 0;
- priv->tree_model_node_inserted_id = 0;
- priv->tree_model_node_removed_id = 0;
- priv->tree_model_node_deleted_id = 0;
-
- priv->sorted_model_node_resorted_id = 0;
-
- priv->selected_row = -1;
- priv->selected_range_end = -1;
-}
-
-static void
-e_tree_selection_model_class_init (ETreeSelectionModelClass *klass)
-{
- GtkObjectClass *object_class;
- ESelectionModelClass *esm_class;
-
- parent_class = gtk_type_class (e_selection_model_get_type ());
-
- object_class = GTK_OBJECT_CLASS(klass);
- esm_class = E_SELECTION_MODEL_CLASS(klass);
-
- object_class->destroy = etsm_destroy;
- object_class->get_arg = etsm_get_arg;
- object_class->set_arg = etsm_set_arg;
-
- esm_class->is_row_selected = etsm_is_row_selected ;
- esm_class->foreach = etsm_foreach ;
- esm_class->clear = etsm_clear ;
- esm_class->selected_count = etsm_selected_count ;
- esm_class->select_all = etsm_select_all ;
- esm_class->invert_selection = etsm_invert_selection ;
- esm_class->row_count = etsm_row_count ;
-
- esm_class->change_one_row = etsm_change_one_row ;
- esm_class->change_cursor = etsm_change_cursor ;
- esm_class->cursor_row = etsm_cursor_row ;
- esm_class->cursor_col = etsm_cursor_col ;
-
- esm_class->select_single_row = etsm_select_single_row ;
- esm_class->toggle_single_row = etsm_toggle_single_row ;
- esm_class->move_selection_end = etsm_move_selection_end ;
- esm_class->set_selection_end = etsm_set_selection_end ;
-
- gtk_object_add_arg_type ("ETreeSelectionModel::cursor_row", GTK_TYPE_INT,
- GTK_ARG_READWRITE, ARG_CURSOR_ROW);
- gtk_object_add_arg_type ("ETreeSelectionModel::cursor_col", GTK_TYPE_INT,
- GTK_ARG_READWRITE, ARG_CURSOR_COL);
- gtk_object_add_arg_type ("ETreeSelectionModel::model", E_TREE_MODEL_TYPE,
- GTK_ARG_READWRITE, ARG_MODEL);
- gtk_object_add_arg_type ("ETreeSelectionModel::etta", E_TREE_TABLE_ADAPTER_TYPE,
- GTK_ARG_READWRITE, ARG_ETTA);
- gtk_object_add_arg_type ("ETreeSelectionModel::ets", E_TREE_SORTED_TYPE,
- GTK_ARG_READWRITE, ARG_ETS);
-}
-
-ESelectionModel *
-e_tree_selection_model_new (void)
-{
- return gtk_type_new(e_tree_selection_model_get_type());
-}
-
-E_MAKE_TYPE(e_tree_selection_model, "ETreeSelectionModel", ETreeSelectionModel,
- e_tree_selection_model_class_init, e_tree_selection_model_init, PARENT_TYPE);
diff --git a/widgets/table/e-tree-selection-model.h b/widgets/table/e-tree-selection-model.h
deleted file mode 100644
index ef396c237c..0000000000
--- a/widgets/table/e-tree-selection-model.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-tree-selection-model.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_TREE_SELECTION_MODEL_H_
-#define _E_TREE_SELECTION_MODEL_H_
-
-#include <gdk/gdktypes.h>
-#include <gtk/gtkobject.h>
-#include <gal/util/e-sorter.h>
-#include <gal/widgets/e-selection-model.h>
-#include <gal/e-table/e-tree-model.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-typedef void (*ETreeForeachFunc) (ETreePath path,
- gpointer closure);
-
-typedef struct ETreeSelectionModelPriv ETreeSelectionModelPriv;
-
-#define E_TREE_SELECTION_MODEL_TYPE (e_tree_selection_model_get_type ())
-#define E_TREE_SELECTION_MODEL(o) (GTK_CHECK_CAST ((o), E_TREE_SELECTION_MODEL_TYPE, ETreeSelectionModel))
-#define E_TREE_SELECTION_MODEL_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TREE_SELECTION_MODEL_TYPE, ETreeSelectionModelClass))
-#define E_IS_TREE_SELECTION_MODEL(o) (GTK_CHECK_TYPE ((o), E_TREE_SELECTION_MODEL_TYPE))
-#define E_IS_TREE_SELECTION_MODEL_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TREE_SELECTION_MODEL_TYPE))
-
-typedef struct {
- ESelectionModel base;
-
- ETreeSelectionModelPriv *priv;
-} ETreeSelectionModel;
-
-typedef struct {
- ESelectionModelClass parent_class;
-} ETreeSelectionModelClass;
-
-
-GtkType e_tree_selection_model_get_type (void);
-ESelectionModel *e_tree_selection_model_new (void);
-void e_tree_selection_model_foreach (ETreeSelectionModel *etsm,
- ETreeForeachFunc callback,
- gpointer closure);
-void e_tree_selection_model_select_single_path (ETreeSelectionModel *etsm,
- ETreePath path);
-void e_tree_selection_model_add_to_selection (ETreeSelectionModel *etsm,
- ETreePath path);
-void e_tree_selection_model_change_cursor (ETreeSelectionModel *etsm,
- ETreePath path);
-ETreePath e_tree_selection_model_get_cursor (ETreeSelectionModel *etsm);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* _E_TREE_SELECTION_MODEL_H_ */
diff --git a/widgets/table/e-tree-simple.c b/widgets/table/e-tree-simple.c
deleted file mode 100644
index 3abea69acf..0000000000
--- a/widgets/table/e-tree-simple.c
+++ /dev/null
@@ -1,213 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-tree-simple.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <gtk/gtksignal.h>
-#include "gal/util/e-util.h"
-#include "e-tree-simple.h"
-
-#define PARENT_TYPE E_TREE_MODEL_TYPE
-
-static int
-simple_column_count (ETableModel *etm)
-{
- ETreeSimple *simple = E_TREE_SIMPLE(etm);
-
- if (simple->col_count)
- return simple->col_count (etm, simple->model_data);
- else
- return 0;
-}
-
-/* The default for simple_duplicate_value is to return the raw value. */
-static void *
-simple_duplicate_value (ETableModel *etm, int col, const void *value)
-{
- ETreeSimple *simple = E_TREE_SIMPLE(etm);
-
- if (simple->duplicate_value)
- return simple->duplicate_value (etm, col, value, simple->model_data);
- else
- return (void *)value;
-}
-
-static void
-simple_free_value (ETableModel *etm, int col, void *value)
-{
- ETreeSimple *simple = E_TREE_SIMPLE(etm);
-
- if (simple->free_value)
- simple->free_value (etm, col, value, simple->model_data);
-}
-
-static void *
-simple_initialize_value (ETableModel *etm, int col)
-{
- ETreeSimple *simple = E_TREE_SIMPLE(etm);
-
- if (simple->initialize_value)
- return simple->initialize_value (etm, col, simple->model_data);
- else
- return NULL;
-}
-
-static gboolean
-simple_value_is_empty (ETableModel *etm, int col, const void *value)
-{
- ETreeSimple *simple = E_TREE_SIMPLE(etm);
-
- if (simple->value_is_empty)
- return simple->value_is_empty (etm, col, value, simple->model_data);
- else
- return FALSE;
-}
-
-static char *
-simple_value_to_string (ETableModel *etm, int col, const void *value)
-{
- ETreeSimple *simple = E_TREE_SIMPLE(etm);
-
- if (simple->value_to_string)
- return simple->value_to_string (etm, col, value, simple->model_data);
- else
- return g_strdup ("");
-}
-
-static void *
-simple_value_at (ETreeModel *etm, ETreePath *node, int col)
-{
- ETreeSimple *simple = E_TREE_SIMPLE(etm);
-
- return simple->value_at (etm, node, col, simple->model_data);
-}
-
-static GdkPixbuf *
-simple_icon_at (ETreeModel *etm, ETreePath *node)
-{
- ETreeSimple *simple = E_TREE_SIMPLE(etm);
-
- return simple->icon_at (etm, node, simple->model_data);
-}
-
-static void
-simple_set_value_at (ETreeModel *etm, ETreePath *node, int col, const void *val)
-{
- ETreeSimple *simple = E_TREE_SIMPLE(etm);
-
- simple->set_value_at (etm, node, col, val, simple->model_data);
-}
-
-static gboolean
-simple_is_editable (ETreeModel *etm, ETreePath *node, int col)
-{
- ETreeSimple *simple = E_TREE_SIMPLE(etm);
-
- return simple->is_editable (etm, node, col, simple->model_data);
-}
-
-static void
-e_tree_simple_class_init (GtkObjectClass *object_class)
-{
- ETreeModelClass *model_class = (ETreeModelClass *) object_class;
- ETableModelClass *table_model_class = (ETableModelClass *) object_class;
-
- table_model_class->column_count = simple_column_count;
- table_model_class->duplicate_value = simple_duplicate_value;
- table_model_class->free_value = simple_free_value;
- table_model_class->initialize_value = simple_initialize_value;
- table_model_class->value_is_empty = simple_value_is_empty;
- table_model_class->value_to_string = simple_value_to_string;
-
- model_class ->icon_at = simple_icon_at;
- model_class ->value_at = simple_value_at;
- model_class ->set_value_at = simple_set_value_at;
- model_class ->is_editable = simple_is_editable;
-}
-
-E_MAKE_TYPE(e_tree_simple, "ETreeSimple", ETreeSimple, e_tree_simple_class_init, NULL, PARENT_TYPE)
-
-/**
- * e_tree_simple_new:
- * @col_count:
- * @duplicate_value:
- * @free_value:
- * @initialize_value:
- * @value_is_empty:
- * @value_to_string:
- * @icon_at:
- * @value_at:
- * @set_value_at:
- * @is_editable:
- * @model_data:
- *
- * This initializes a new ETreeSimpleModel object. ETreeSimpleModel is
- * an implementaiton of the abstract class ETreeModel. The ETreeSimpleModel
- * is designed to allow people to easily create ETreeModels without having
- * to create a new GtkType derived from ETreeModel every time they need one.
- *
- * Instead, ETreeSimpleModel uses a setup based in callback functions, every
- * callback function signature mimics the signature of each ETreeModel method
- * and passes the extra @data pointer to each one of the method to provide them
- * with any context they might want to use.
- *
- * ETreeSimple is to ETreeModel as ETableSimple is to ETableModel.
- *
- * Return value: An ETreeSimple object (which is also an ETreeModel
- * object).
- **/
-ETreeModel *
-e_tree_simple_new (ETableSimpleColumnCountFn col_count,
- ETableSimpleDuplicateValueFn duplicate_value,
- ETableSimpleFreeValueFn free_value,
- ETableSimpleInitializeValueFn initialize_value,
- ETableSimpleValueIsEmptyFn value_is_empty,
- ETableSimpleValueToStringFn value_to_string,
-
- ETreeSimpleIconAtFn icon_at,
- ETreeSimpleValueAtFn value_at,
- ETreeSimpleSetValueAtFn set_value_at,
- ETreeSimpleIsEditableFn is_editable,
-
- gpointer model_data)
-{
- ETreeSimple *etg;
-
- etg = gtk_type_new (e_tree_simple_get_type ());
-
- etg->col_count = col_count;
- etg->duplicate_value = duplicate_value;
- etg->free_value = free_value;
- etg->initialize_value = initialize_value;
- etg->value_is_empty = value_is_empty;
- etg->value_to_string = value_to_string;
-
- etg->icon_at = icon_at;
- etg->value_at = value_at;
- etg->set_value_at = set_value_at;
- etg->is_editable = is_editable;
-
- etg->model_data = model_data;
-
- return (ETreeModel*)etg;
-}
-
diff --git a/widgets/table/e-tree-simple.h b/widgets/table/e-tree-simple.h
deleted file mode 100644
index 212fc78176..0000000000
--- a/widgets/table/e-tree-simple.h
+++ /dev/null
@@ -1,88 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-tree-simple.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_TREE_SIMPLE_H_
-#define _E_TREE_SIMPLE_H_
-
-#include <gal/e-table/e-tree-model.h>
-#include <gal/e-table/e-table-simple.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#define E_TREE_SIMPLE_TYPE (e_tree_simple_get_type ())
-#define E_TREE_SIMPLE(o) (GTK_CHECK_CAST ((o), E_TREE_SIMPLE_TYPE, ETreeSimple))
-#define E_TREE_SIMPLE_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TREE_SIMPLE_TYPE, ETreeSimpleClass))
-#define E_IS_TREE_SIMPLE(o) (GTK_CHECK_TYPE ((o), E_TREE_SIMPLE_TYPE))
-#define E_IS_TREE_SIMPLE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TREE_SIMPLE_TYPE))
-
-
-typedef GdkPixbuf* (*ETreeSimpleIconAtFn) (ETreeModel *etree, ETreePath *path, void *model_data);
-typedef void* (*ETreeSimpleValueAtFn) (ETreeModel *etree, ETreePath *path, int col, void *model_data);
-typedef void (*ETreeSimpleSetValueAtFn) (ETreeModel *etree, ETreePath *path, int col, const void *val, void *model_data);
-typedef gboolean (*ETreeSimpleIsEditableFn) (ETreeModel *etree, ETreePath *path, int col, void *model_data);
-
-typedef struct {
- ETreeModel parent;
-
- /* Table methods */
- ETableSimpleColumnCountFn col_count;
- ETableSimpleDuplicateValueFn duplicate_value;
- ETableSimpleFreeValueFn free_value;
- ETableSimpleInitializeValueFn initialize_value;
- ETableSimpleValueIsEmptyFn value_is_empty;
- ETableSimpleValueToStringFn value_to_string;
-
- /* Tree methods */
- ETreeSimpleIconAtFn icon_at;
- ETreeSimpleValueAtFn value_at;
- ETreeSimpleSetValueAtFn set_value_at;
- ETreeSimpleIsEditableFn is_editable;
-
- gpointer model_data;
-} ETreeSimple;
-
-typedef struct {
- ETreeModelClass parent_class;
-} ETreeSimpleClass;
-
-GtkType e_tree_simple_get_type (void);
-
-ETreeModel *e_tree_simple_new (ETableSimpleColumnCountFn col_count,
- ETableSimpleDuplicateValueFn duplicate_value,
- ETableSimpleFreeValueFn free_value,
- ETableSimpleInitializeValueFn initialize_value,
- ETableSimpleValueIsEmptyFn value_is_empty,
- ETableSimpleValueToStringFn value_to_string,
- ETreeSimpleIconAtFn icon_at,
- ETreeSimpleValueAtFn value_at,
- ETreeSimpleSetValueAtFn set_value_at,
- ETreeSimpleIsEditableFn is_editable,
- gpointer model_data);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _E_TREE_SIMPLE_H_ */
diff --git a/widgets/table/e-tree-sorted-variable.c b/widgets/table/e-tree-sorted-variable.c
deleted file mode 100644
index 18812a7feb..0000000000
--- a/widgets/table/e-tree-sorted-variable.c
+++ /dev/null
@@ -1,472 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-tree-sorted-variable.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <stdlib.h>
-#include <string.h>
-#include <gtk/gtksignal.h>
-#include "gal/util/e-util.h"
-#include "e-tree-sorted-variable.h"
-
-#define d(x)
-
-#define PARENT_TYPE E_TREE_MODEL_TYPE
-
-#define INCREMENT_AMOUNT 100
-
-/* maximum insertions between an idle event that we will do without scheduling an idle sort */
-#define ETSV_INSERT_MAX (4)
-
-static ETreeModelClass *etsv_parent_class;
-
-struct ETreePath {
- GNode node;
-};
-
-struct ETreeSortedVariablePrivate {
- GNode *root;
-};
-
-static void etsv_proxy_model_changed (ETableModel *etm, ETreeSortedVariable *etsv);
-#if 0
-static void etsv_proxy_model_row_changed (ETableModel *etm, int row, ETreeSortedVariable *etsv);
-static void etsv_proxy_model_cell_changed (ETableModel *etm, int col, int row, ETreeSortedVariable *etsv);
-#endif
-static void etsv_sort_info_changed (ETableSortInfo *info, ETreeSortedVariable *etsv);
-static void etsv_sort (ETreeSortedVariable *etsv);
-static void etsv_add (ETreeSortedVariable *etsv, gint row);
-static void etsv_add_all (ETreeSortedVariable *etsv);
-
-static void
-etsv_destroy (GtkObject *object)
-{
- ETreeSortedVariable *etsv = E_TREE_SORTED_VARIABLE (object);
-
- gtk_signal_disconnect (GTK_OBJECT (etss->source),
- etsv->table_model_changed_id);
-#if 0
- 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);
-#endif
- gtk_signal_disconnect (GTK_OBJECT (etsv->sort_info),
- etsv->sort_info_changed_id);
-
- if (etsv->sort_idle_id) {
- g_source_remove(etsv->sort_idle_id);
- }
- if (etsv->insert_idle_id) {
- g_source_remove(etsv->insert_idle_id);
- }
-
- etsv->table_model_changed_id = 0;
- etsv->table_model_row_changed_id = 0;
- etsv->table_model_cell_changed_id = 0;
-
- if (etsv->sort_info)
- gtk_object_unref(GTK_OBJECT(etsv->sort_info));
- if (etsv->full_header)
- gtk_object_unref(GTK_OBJECT(etsv->full_header));
-
- GTK_OBJECT_CLASS (etsv_parent_class)->destroy (object);
-}
-
-static void
-etsv_class_init (GtkObjectClass *object_class)
-{
- ETreeSortedVariableClass *etsv_class = E_TREE_MODEL_CLASS(object_class);
-
- etsv_parent_class = gtk_type_class (PARENT_TYPE);
-
- object_class->destroy = etsv_destroy;
-
- etsv_class->add = etsv_add;
- etsv_class->add_all = etsv_add_all;
-}
-
-static void
-etsv_init (ETreeSortedVariable *etsv)
-{
- etsv->full_header = NULL;
- etsv->sort_info = NULL;
-
- etsv->table_model_changed_id = 0;
- etsv->table_model_row_changed_id = 0;
- etsv->table_model_cell_changed_id = 0;
- etsv->sort_info_changed_id = 0;
-
- etsv->sort_idle_id = 0;
- etsv->insert_count = 0;
-}
-
-E_MAKE_TYPE(e_tree_sorted_variable, "ETreeSortedVariable", ETreeSortedVariable, etsv_class_init, etsv_init, PARENT_TYPE);
-
-static gboolean
-etsv_sort_idle(ETreeSortedVariable *etsv)
-{
- gtk_object_ref(GTK_OBJECT(etsv));
- etsv_sort(etsv);
- etsv->sort_idle_id = 0;
- etsv->insert_count = 0;
- gtk_object_unref(GTK_OBJECT(etsv));
- return FALSE;
-}
-
-static gboolean
-etsv_insert_idle(ETreeSortedVariable *etsv)
-{
- etsv->insert_count = 0;
- etsv->insert_idle_id = 0;
- return FALSE;
-}
-
-
-ETableModel *
-e_tree_sorted_variable_new (ETreeModel *source, ETableHeader *full_header, ETableSortInfo *sort_info)
-{
- ETreeSortedVariable *etsv = gtk_type_new (E_TREE_SORTED_VARIABLE_TYPE);
- ETreeSortedVariable *etsv = E_TABLE_SUBSET_VARIABLE (etsv);
-
- if (e_table_subset_variable_construct (etsv, source) == NULL){
- gtk_object_unref (GTK_OBJECT (etsv));
- return NULL;
- }
-
- etsv->sort_info = sort_info;
- gtk_object_ref(GTK_OBJECT(etsv->sort_info));
- etsv->full_header = full_header;
- gtk_object_ref(GTK_OBJECT(etsv->full_header));
-
- etsv->table_model_changed_id = gtk_signal_connect (GTK_OBJECT (source), "model_changed",
- GTK_SIGNAL_FUNC (etsv_proxy_model_changed), etsv);
-#if 0
- 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);
-#endif
- etsv->sort_info_changed_id = gtk_signal_connect (GTK_OBJECT (sort_info), "sort_info_changed",
- GTK_SIGNAL_FUNC (etsv_sort_info_changed), etsv);
-
- return E_TABLE_MODEL(etsv);
-}
-
-static void
-etsv_proxy_model_changed (ETableModel *etm, ETreeSortedVariable *etsv)
-{
- /* FIXME: do_resort (); */
-}
-#if 0
-static void
-etsv_proxy_model_row_changed (ETableModel *etm, int row, ETreeSortedVariable *etsv)
-{
- ETreeSortedVariable *etsv = E_TABLE_SUBSET_VARIABLE(etsv);
-
- if (e_table_subset_variable_remove(etsv, row))
- e_table_subset_variable_add (etsv, row);
-}
-
-static void
-etsv_proxy_model_cell_changed (ETableModel *etm, int col, int row, ETreeSortedVariable *etsv)
-{
- ETreeSortedVariable *etsv = E_TABLE_SUBSET_VARIABLE(etsv);
-
- if (e_table_subset_variable_remove(etsv, row))
- e_table_subset_variable_add (etsv, row);
-}
-#endif
-
-static void
-etsv_sort_info_changed (ETableSortInfo *info, ETreeSortedVariable *etsv)
-{
- etsv_sort(etsv);
-}
-
-/* This takes source rows. */
-static int
-etsv_compare(ETreeSortedVariable *etsv, const ETreePath *path1, const ETreePath *path2)
-{
- int j;
- int sort_count = e_table_sort_info_sorting_get_count(etsv->sort_info);
- int comp_val = 0;
- int ascending = 1;
-
- for (j = 0; j < sort_count; j++) {
- ETableSortColumn column = e_table_sort_info_sorting_get_nth(etsv->sort_info, j);
- ETableCol *col;
- col = e_table_header_get_column_by_col_idx(etsv->full_header, column.column);
- if (col == NULL)
- col = e_table_header_get_column (etsv->full_header, e_table_header_count (etsv->full_header) - 1);
- comp_val = (*col->compare)(e_tree_model_value_at (etsv->source, path1, col->col_idx),
- e_tree_model_value_at (etsv->source, path2, col->col_idx));
- ascending = column.ascending;
- if (comp_val != 0)
- break;
- }
- if (comp_val == 0) {
- if (row1 < row2)
- comp_val = -1;
- if (row1 > row2)
- comp_val = 1;
- }
- if (!ascending)
- comp_val = -comp_val;
- return comp_val;
-}
-
-
-static ETreeSortedVariable *etsv_closure;
-int cols_closure;
-int *ascending_closure;
-int *col_idx_closure;
-GCompareFunc *compare_closure;
-
-static int
-etsv_compare_closure(const ETreePath *path1, const ETreePath *path2)
-{
- int j;
- int sort_count = e_table_sort_info_sorting_get_count(etsv_closure->sort_info);
- int comp_val = 0;
- int ascending = 1;
- for (j = 0; j < sort_count; j++) {
-
- comp_val = (*(compare_closure[j]))(e_tree_model_value_at (etsv_closure->source, path1, col_idx_closure[j]),
- e_tree_model_value_at (etsv_closure->source, path2, col_idx_closure[j]));
- ascending = ascending_closure[j];
- if (comp_val != 0)
- break;
- }
- if (comp_val == 0) {
- if (row1 < row2)
- comp_val = -1;
- if (row1 > row2)
- comp_val = 1;
- }
- if (!ascending)
- comp_val = -comp_val;
- return comp_val;
-}
-
-static int
-qsort_callback(const void *data1, const void *data2)
-{
- GNode *node1 = *(GNode **)data1;
- GNode *node2 = *(GNode **)data2;
- return etsv_compare_closure(node1->data, node2->data);
-}
-
-static int
-qsort_callback_source(const void *data1, const void *data2)
-{
- return etsv_compare_closure(data1, data2);
-}
-
-static void
-etsv_setup_closures(ETreeSortedVariable *etsv)
-{
- int j;
- int cols;
-
- cols = e_table_sort_info_sorting_get_count(etsv->sort_info);
- cols_closure = cols;
- etsv_closure = etsv;
-
- ascending_closure = g_new(int, cols);
- col_idx_closure = g_new(int, cols);
- compare_closure = g_new(GCompareFunc, cols);
-
- for (j = 0; j < cols; j++) {
- ETableSortColumn column = e_table_sort_info_sorting_get_nth(etsv->sort_info, j);
- ETableCol *col;
-
- col = e_table_header_get_column_by_col_idx(etsv->full_header, column.column);
- if (col == NULL) {
- col = e_table_header_get_column (etsv->full_header, e_table_header_count (etsv->full_header) - 1);
- }
-
- ascending_closure[j] = column.ascending;
- col_idx_closure[j] = col->col_idx;
- compare_closure[j] = col->compare;
- }
-}
-
-static void
-etsv_free_closures(ETreeSortedVariable *etsv)
-{
- g_free(ascending_closure);
- g_free(col_idx_closure);
- g_free(compare_closure);
-
-}
-
-static void
-etsv_sort_node(ETreeSortedVariable *etsv, GNode *node)
-{
- gint n;
- gint i;
- GNode **children;
- GNode *child;
- GNode *prev;
-
- n = g_node_n_children(node);
- children = g_new(GNode *, n);
- for (i = 0, child = node->children; child && i; child = child->next, i++) {
- children[i] = child;
- }
- qsort(children, n, sizeof(GNode *), qsort_callback);
-
- prev = NULL;
- for (i = 0; i < n; i++) {
- children[i]->prev = prev;
- if (prev) prev->next = children[i];
- prev = children[i];
- children[i]->next = NULL;
- }
-}
-
-static void
-etsv_sort_tree(ETreeSortedVariable *etsv, GNode *root)
-{
- GNode *childr;
-
- etsv_sort_node(etsv, node);
-
- for (child = node->child; child; child = child->next) {
- etsv_sort_tree(etsv, child);
- }
-}
-
-static void
-etsv_sort(ETreeSortedVariable *etsv)
-{
- static int reentering = 0;
- if (reentering)
- return;
- reentering = 1;
-
- e_table_model_pre_change(E_TABLE_MODEL(etsv));
-
- etsv_setup_closures(etsv);
-
- etsv_sort_tree(etsv, etsv->root);
-
- etsv_free_closures(etsv);
-
- e_table_model_changed (E_TABLE_MODEL(etsv));
- reentering = 0;
-}
-
-static void
-etsv_add_node (ETreeSortedVariable *etsv, ETreePath *path, GNode *root)
-{
- GNode *node;
- GNode *new_node;
- for (node = root; node; node = node->next) {
- if (e_tree_model_node_is_ancestor(etsv->source, path, node->data)) {
- etsv_add_node(etsv, path, node->data);
- return;
- }
- }
- new_node = g_node_new(path);
- for (node = root; node; ) {
- if (e_tree_model_node_is_ancestor(etsv->source, node->data, path)) {
- GNode *next;
- next = node->next;
- g_node_unlink(node);
- g_node_prepend(new_node, node);
- node = next;
- } else
- node = node->next;
- }
-
- etsv_sort_node(etsv, new_node);
-
-
-#if 0
- g_node_prepend(root, new_node);
- etsv_sort_node(etsv, root);
-#else
- /* Insert sort to be a bit faster than the above prepend and then sort. */
- for (node = root; node; node = node->next) {
- if (etsv_compare(etsv, path, node->data) > 0) {
- g_node_insert_before (root, node, new_node);
- return;
- }
- }
- g_node_append(root, new_node);
-#endif
-}
-
-etsv_add(ETreeSortedVariable *etsv, gint row)
-{
- ETreeModel *source = etsv->source;
- ETreePath *path;
-
- path = e_table_model_value_at (E_TABLE_MODEL(source), -1, row);
- etsv_add_node(etsv, path, etsv->root);
-}
-
-/* Optimize by doing the qsorts as we build. But we'll do that later. */
-static void
-etsv_add_all_node (ETreeSortedVariable *etsv, ETreePath *path, GNode *node)
-{
- ETreeModel *source = etsv->source;
- ETreePath **children;
- int n;
- int i;
-
- n = e_tree_model_node_get_children(source, path, &children);
- qsort(children, n, sizeof(ETreePath *), qsort_callback_source);
-
- for (i = n - 1; i >= 0; i--) {
- GNode *new_child = g_node_new(children[i]);
- g_node_prepend(path, new_child);
- etsv_add_all_node (etsv, children[i], new_child)
- }
-
- g_free(children);
-}
-
-static void
-etsv_add_all (ETreeSortedVariable *etsv)
-{
- GNode *node;
- ETreePath *path;
-
- e_table_model_pre_change(etm);
-
- if (etsv->root)
- g_node_destroy(etsv->root);
-
- etsv_setup_closures(etsv);
-
- path = e_tree_model_get_root(etsv->source);
- node = g_node_new(path);
- etsv_add_all_node(etsv, path, node);
- etsv->root = node;
-
- etsv_free_closures(etsv);
-
- e_tree_model_node_changed (etsv, etsv->root);
-}
diff --git a/widgets/table/e-tree-sorted-variable.h b/widgets/table/e-tree-sorted-variable.h
deleted file mode 100644
index 23d80eed10..0000000000
--- a/widgets/table/e-tree-sorted-variable.h
+++ /dev/null
@@ -1,85 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-tree-sorted-variable.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_TREE_SORTED_VARIABLE_H_
-#define _E_TREE_SORTED_VARIABLE_H_
-
-#include <gtk/gtkobject.h>
-#include <gal/e-tree/e-tree-model.h>
-#include <gal/e-table/e-table-subset-variable.h>
-#include <gal/e-table/e-table-sort-info.h>
-#include <gal/e-table/e-table-header.h>
-#include <libgnome/gnome-defs.h>
-
-BEGIN_GNOME_DECLS
-
-#define E_TREE_SORTED_VARIABLE_TYPE (e_tree_sorted_variable_get_type ())
-#define E_TREE_SORTED_VARIABLE(o) (GTK_CHECK_CAST ((o), E_TREE_SORTED_VARIABLE_TYPE, ETreeSortedVariable))
-#define E_TREE_SORTED_VARIABLE_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TREE_SORTED_VARIABLE_TYPE, ETreeSortedVariableClass))
-#define E_IS_TREE_SORTED_VARIABLE(o) (GTK_CHECK_TYPE ((o), E_TREE_SORTED_VARIABLE_TYPE))
-#define E_IS_TREE_SORTED_VARIABLE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TREE_SORTED_VARIABLE_TYPE))
-
-typedef struct {
- ETreeModel base;
-
- ETableSortInfo *sort_info;
-
- ETableHeader *full_header;
-
- int table_model_changed_id;
- int table_model_row_changed_id;
- int table_model_cell_changed_id;
- int sort_info_changed_id;
- int sort_idle_id;
- int insert_idle_id;
- int insert_count;
-
-} ETreeSortedVariable;
-
-typedef struct {
- ETreeModelClass parent_class;
-} ETreeSortedVariableClass;
-
-GtkType e_tree_sorted_variable_get_type (void);
-ETableModel *e_tree_sorted_variable_new (ETreeModel *etm,
- ETableHeader *header,
- ETableSortInfo *sort_info);
-
-ETreeModel *e_tree_sorted_get_toplevel (ETreeSortedVariable *tree_model);
-
-void e_tree_sorted_variable_add (ETreeSortedVariable *ets,
- gint row);
-void e_tree_sorted_variable_add_all (ETreeSortedVariable *ets);
-gboolean e_tree_sorted_variable_remove (ETreeSortedVariable *ets,
- gint row);
-void e_tree_sorted_variable_increment (ETreeSortedVariable *ets,
- gint position,
- gint amount);
-void e_tree_sorted_variable_decrement (ETreeSortedVariable *ets,
- gint position,
- gint amount);
-void e_tree_sorted_variable_set_allocation (ETreeSortedVariable *ets,
- gint total);
-END_GNOME_DECLS
-
-#endif /* _E_TREE_SORTED_VARIABLE_H_ */
diff --git a/widgets/table/e-tree-sorted.c b/widgets/table/e-tree-sorted.c
deleted file mode 100644
index b65c6cbb1c..0000000000
--- a/widgets/table/e-tree-sorted.c
+++ /dev/null
@@ -1,1408 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-tree-sorted.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- * Chris Toshok <toshok@ximian.com>
- *
- * Adapted from the gtree code and ETableModel.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-/* FIXME: Overall e-tree-sorted.c needs to be made more efficient. */
-
-
-#include <config.h>
-
-#include "e-tree-sorted.h"
-
-#include <stdio.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <string.h>
-
-#include <gnome-xml/parser.h>
-#include <gnome-xml/xmlmemory.h>
-
-#include <gtk/gtksignal.h>
-#include "gal/util/e-util.h"
-#include "gal/util/e-xml-utils.h"
-#include "e-table-sorting-utils.h"
-
-#define PARENT_TYPE E_TREE_MODEL_TYPE
-
-/* maximum insertions between an idle event that we will do without scheduling an idle sort */
-#define ETS_INSERT_MAX (4)
-
-#define TREEPATH_CHUNK_AREA_SIZE (30 * sizeof (ETreeSortedPath))
-
-#define d(x)
-
-static ETreeModel *parent_class;
-static GMemChunk *node_chunk;
-
-enum {
- NODE_RESORTED,
- LAST_SIGNAL
-};
-
-static guint signals [LAST_SIGNAL] = {0, };
-
-typedef struct ETreeSortedPath ETreeSortedPath;
-
-struct ETreeSortedPath {
- ETreePath corresponding;
-
- /* parent/child/sibling pointers */
- ETreeSortedPath *parent;
- gint num_children;
- ETreeSortedPath **children;
- int position;
- int orig_position;
-
- guint needs_resort : 1;
- guint child_needs_resort : 1;
- guint resort_all_children : 1;
- guint needs_regen_to_sort : 1;
-};
-
-struct ETreeSortedPriv {
- ETreeModel *source;
- ETreeSortedPath *root;
-
- ETableSortInfo *sort_info;
- ETableHeader *full_header;
-
- ETreeSortedPath *last_access;
-
- int tree_model_pre_change_id;
- int tree_model_no_change_id;
- int tree_model_node_changed_id;
- int tree_model_node_data_changed_id;
- int tree_model_node_col_changed_id;
- int tree_model_node_inserted_id;
- int tree_model_node_removed_id;
- int tree_model_node_deleted_id;
- int tree_model_node_request_collapse_id;
-
- int sort_info_changed_id;
- int sort_idle_id;
- int insert_idle_id;
- int insert_count;
-
- guint in_resort_idle : 1;
- guint nested_resort_idle : 1;
-};
-
-enum {
- ARG_0,
-
- ARG_SORT_INFO,
-};
-
-static void ets_sort_info_changed (ETableSortInfo *sort_info, ETreeSorted *ets);
-static void resort_node (ETreeSorted *ets, ETreeSortedPath *path, gboolean resort_all_children, gboolean needs_regen, gboolean send_signals);
-static void mark_path_needs_resort (ETreeSorted *ets, ETreeSortedPath *path, gboolean needs_rebuild, gboolean resort_all_children);
-static void schedule_resort (ETreeSorted *ets, ETreeSortedPath *path, gboolean needs_regen, gboolean resort_all_children);
-static void free_path (ETreeSortedPath *path);
-static void generate_children(ETreeSorted *ets, ETreeSortedPath *path);
-static void regenerate_children(ETreeSorted *ets, ETreeSortedPath *path);
-
-
-
-/* idle callbacks */
-
-static gboolean
-ets_sort_idle(gpointer user_data)
-{
- ETreeSorted *ets = user_data;
- if (ets->priv->in_resort_idle) {
- ets->priv->nested_resort_idle = TRUE;
- return FALSE;
- }
- ets->priv->in_resort_idle = TRUE;
- if (ets->priv->root) {
- do {
- ets->priv->nested_resort_idle = FALSE;
- resort_node (ets, ets->priv->root, FALSE, FALSE, TRUE);
- } while (ets->priv->nested_resort_idle);
- }
- ets->priv->in_resort_idle = FALSE;
- ets->priv->sort_idle_id = 0;
- return FALSE;
-}
-
-#define ETS_SORT_IDLE_ACTIVATED(ets) ((ets)->priv->sort_idle_id != 0)
-
-inline static void
-ets_stop_sort_idle (ETreeSorted *ets)
-{
- if (ets->priv->sort_idle_id) {
- g_source_remove(ets->priv->sort_idle_id);
- ets->priv->sort_idle_id = 0;
- }
-}
-
-static gboolean
-ets_insert_idle(ETreeSorted *ets)
-{
- ets->priv->insert_count = 0;
- ets->priv->insert_idle_id = 0;
- return FALSE;
-}
-
-
-
-/* Helper functions */
-
-#define CHECK_AROUND_LAST_ACCESS
-
-static inline ETreeSortedPath *
-check_last_access (ETreeSorted *ets, ETreePath corresponding)
-{
-#ifdef CHECK_AROUND_LAST_ACCESS
- ETreeSortedPath *parent;
-#endif
-
- if (ets->priv->last_access == NULL)
- return NULL;
-
- if (ets->priv->last_access == corresponding) {
- d(g_print("Found last access %p at %p.", ets->priv->last_access, ets->priv->last_access));
- return ets->priv->last_access;
- }
-
-#ifdef CHECK_AROUND_LAST_ACCESS
- parent = ets->priv->last_access->parent;
- if (parent && parent->children) {
- int position = ets->priv->last_access->position;
- int end = MIN(parent->num_children, position + 10);
- int start = MAX(0, position - 10);
- int initial = MAX (MIN (position, end), start);
- int i;
-
- for (i = initial; i < end; i++) {
- if (parent->children[i] && parent->children[i]->corresponding == corresponding) {
- d(g_print("Found last access %p at %p.", ets->priv->last_access, parent->children[i]));
- return parent->children[i];
- }
- }
-
- for (i = initial - 1; i >= start; i--) {
- if (parent->children[i] && parent->children[i]->corresponding == corresponding) {
- d(g_print("Found last access %p at %p.", ets->priv->last_access, parent->children[i]));
- return parent->children[i];
- }
- }
- }
-#endif
- return NULL;
-}
-
-static ETreeSortedPath *
-find_path(ETreeSorted *ets, ETreePath corresponding)
-{
- int depth;
- ETreePath *sequence;
- int i;
- ETreeSortedPath *path;
- ETreeSortedPath *check_last;
-
- if (corresponding == NULL)
- return NULL;
-
- check_last = check_last_access (ets, corresponding);
- if (check_last) {
- d(g_print(" (find_path)\n"));
- return check_last;
- }
-
- depth = e_tree_model_node_depth(ets->priv->source, corresponding);
-
- sequence = g_new(ETreePath, depth + 1);
-
- sequence[0] = corresponding;
-
- for (i = 0; i < depth; i++)
- sequence[i + 1] = e_tree_model_node_get_parent(ets->priv->source, sequence[i]);
-
- path = ets->priv->root;
-
- for (i = depth - 1; i >= 0 && path != NULL; i --) {
- int j;
-
- if (path->num_children == -1) {
- path = NULL;
- break;
- }
-
- for (j = 0; j < path->num_children; j++) {
- if (path->children[j]->corresponding == sequence[i]) {
- break;
- }
- }
-
- if (j < path->num_children) {
- path = path->children[j];
- } else {
- path = NULL;
- }
- }
- g_free (sequence);
-
- d(g_print("Didn't find last access %p. Setting to %p. (find_path)\n", ets->priv->last_access, path));
- ets->priv->last_access = path;
-
- return path;
-}
-
-static ETreeSortedPath *
-find_child_path(ETreeSorted *ets, ETreeSortedPath *parent, ETreePath corresponding)
-{
- int i;
-
- if (corresponding == NULL)
- return NULL;
-
- if (parent->num_children == -1) {
- return NULL;
- }
-
- for (i = 0; i < parent->num_children; i++)
- if (parent->children[i]->corresponding == corresponding)
- return parent->children[i];
-
- return NULL;
-}
-
-static ETreeSortedPath *
-find_or_create_path(ETreeSorted *ets, ETreePath corresponding)
-{
- int depth;
- ETreePath *sequence;
- int i;
- ETreeSortedPath *path;
- ETreeSortedPath *check_last;
-
- if (corresponding == NULL)
- return NULL;
-
- check_last = check_last_access (ets, corresponding);
- if (check_last) {
- d(g_print(" (find_or_create_path)\n"));
- return check_last;
- }
-
- depth = e_tree_model_node_depth(ets->priv->source, corresponding);
-
- sequence = g_new(ETreePath, depth + 1);
-
- sequence[0] = corresponding;
-
- for (i = 0; i < depth; i++)
- sequence[i + 1] = e_tree_model_node_get_parent(ets->priv->source, sequence[i]);
-
- path = ets->priv->root;
-
- for (i = depth - 1; i >= 0 && path != NULL; i --) {
- int j;
-
- if (path->num_children == -1) {
- generate_children(ets, path);
- }
-
- for (j = 0; j < path->num_children; j++) {
- if (path->children[j]->corresponding == sequence[i]) {
- break;
- }
- }
-
- if (j < path->num_children) {
- path = path->children[j];
- } else {
- path = NULL;
- }
- }
- g_free (sequence);
-
- d(g_print("Didn't find last access %p. Setting to %p. (find_or_create_path)\n", ets->priv->last_access, path));
- ets->priv->last_access = path;
-
- return path;
-}
-
-static void
-free_children (ETreeSortedPath *path)
-{
- int i;
-
- if (path == NULL)
- return;
-
- for (i = 0; i < path->num_children; i++) {
- free_path(path->children[i]);
- }
-
- g_free(path->children);
- path->children = NULL;
- path->num_children = -1;
-}
-
-static void
-free_path (ETreeSortedPath *path)
-{
- free_children(path);
- g_chunk_free(path, node_chunk);
-}
-
-static ETreeSortedPath *
-new_path (ETreeSortedPath *parent, ETreePath corresponding)
-{
- ETreeSortedPath *path;
-
- path = g_chunk_new0 (ETreeSortedPath, node_chunk);
-
- path->corresponding = corresponding;
- path->parent = parent;
- path->num_children = -1;
- path->children = NULL;
- path->position = -1;
- path->orig_position = -1;
- path->child_needs_resort = 0;
- path->resort_all_children = 0;
- path->needs_resort = 0;
- path->needs_regen_to_sort = 0;
-
- return path;
-}
-
-static gboolean
-reposition_path (ETreeSorted *ets, ETreeSortedPath *path)
-{
- int new_index;
- int old_index = path->position;
- ETreeSortedPath *parent = path->parent;
- gboolean changed = FALSE;
- if (parent) {
- if (ets->priv->sort_idle_id == 0) {
- if (ets->priv->insert_count > ETS_INSERT_MAX) {
- /* schedule a sort, and append instead */
- schedule_resort(ets, parent, TRUE, FALSE);
- } else {
- /* make sure we have an idle handler to reset the count every now and then */
- if (ets->priv->insert_idle_id == 0) {
- ets->priv->insert_idle_id = g_idle_add_full(40, (GSourceFunc) ets_insert_idle, ets, NULL);
- }
-
- new_index = e_table_sorting_utils_tree_check_position
- (E_TREE_MODEL(ets),
- ets->priv->sort_info,
- ets->priv->full_header,
- (ETreePath *) parent->children,
- parent->num_children,
- old_index);
-
- if (new_index > old_index) {
- int i;
- ets->priv->insert_count++;
- memmove(parent->children + old_index, parent->children + old_index + 1, sizeof (ETreePath) * (new_index - old_index));
- parent->children[new_index] = path;
- for (i = old_index; i <= new_index; i++)
- parent->children[i]->position = i;
- changed = TRUE;
- e_tree_model_node_changed(E_TREE_MODEL(ets), parent);
- e_tree_sorted_node_resorted(ets, parent);
- } else if (new_index < old_index) {
- int i;
- ets->priv->insert_count++;
- memmove(parent->children + new_index + 1, parent->children + new_index, sizeof (ETreePath) * (old_index - new_index));
- parent->children[new_index] = path;
- for (i = new_index; i <= old_index; i++)
- parent->children[i]->position = i;
- changed = TRUE;
- e_tree_model_node_changed(E_TREE_MODEL(ets), parent);
- e_tree_sorted_node_resorted(ets, parent);
- }
- }
- } else
- mark_path_needs_resort(ets, parent, TRUE, FALSE);
- }
- return changed;
-}
-
-static void
-regenerate_children(ETreeSorted *ets, ETreeSortedPath *path)
-{
- ETreeSortedPath **children;
- int i;
-
- children = g_new(ETreeSortedPath *, path->num_children);
- for (i = 0; i < path->num_children; i++)
- children[path->children[i]->orig_position] = path->children[i];
- g_free(path->children);
- path->children = children;
-}
-
-static void
-generate_children(ETreeSorted *ets, ETreeSortedPath *path)
-{
- ETreePath child;
- int i;
- int count;
-
- free_children(path);
-
- count = 0;
- for (child = e_tree_model_node_get_first_child(ets->priv->source, path->corresponding);
- child;
- child = e_tree_model_node_get_next(ets->priv->source, child)) {
- count ++;
- }
-
- path->num_children = count;
- path->children = g_new(ETreeSortedPath *, count);
- for (child = e_tree_model_node_get_first_child(ets->priv->source, path->corresponding), i = 0;
- child;
- child = e_tree_model_node_get_next(ets->priv->source, child), i++) {
- path->children[i] = new_path(path, child);
- path->children[i]->position = i;
- path->children[i]->orig_position = i;
- }
- if (path->num_children > 0)
- schedule_resort (ets, path, FALSE, TRUE);
-}
-
-static void
-resort_node (ETreeSorted *ets, ETreeSortedPath *path, gboolean resort_all_children, gboolean needs_regen, gboolean send_signals)
-{
- gboolean needs_resort;
- if (path) {
- needs_resort = path->needs_resort || resort_all_children;
- needs_regen = path->needs_regen_to_sort || needs_regen;
- if (path->num_children > 0) {
- if (needs_resort && send_signals)
- e_tree_model_pre_change(E_TREE_MODEL(ets));
- if (needs_resort) {
- int i;
- d(g_print("Start sort of node %p\n", path));
- if (needs_regen)
- regenerate_children(ets, path);
- d(g_print("Regened sort of node %p\n", path));
- e_table_sorting_utils_tree_sort (E_TREE_MODEL(ets),
- ets->priv->sort_info,
- ets->priv->full_header,
- (ETreePath *) path->children,
- path->num_children);
- d(g_print("Renumbering sort of node %p\n", path));
- for (i = 0; i < path->num_children; i++) {
- path->children[i]->position = i;
- }
- d(g_print("End sort of node %p\n", path));
- }
- if (path->resort_all_children)
- resort_all_children = TRUE;
- if ((resort_all_children || path->child_needs_resort) && path->num_children >= 0) {
- int i;
- for (i = 0; i < path->num_children; i++) {
- resort_node(ets, path->children[i], resort_all_children, needs_regen, send_signals && !needs_resort);
- }
- path->child_needs_resort = 0;
- }
- }
- path->needs_resort = 0;
- path->child_needs_resort = 0;
- path->needs_regen_to_sort = 0;
- path->resort_all_children = 0;
- if (needs_resort && send_signals && path->num_children > 0) {
- e_tree_model_node_changed(E_TREE_MODEL(ets), path);
- e_tree_sorted_node_resorted(ets, path);
- }
- }
-}
-
-static void
-mark_path_child_needs_resort (ETreeSorted *ets, ETreeSortedPath *path)
-{
- if (path == NULL)
- return;
- if (!path->child_needs_resort) {
- path->child_needs_resort = 1;
- mark_path_child_needs_resort (ets, path->parent);
- }
-}
-
-static void
-mark_path_needs_resort (ETreeSorted *ets, ETreeSortedPath *path, gboolean needs_regen, gboolean resort_all_children)
-{
- if (path == NULL)
- return;
- if (path->num_children == 0)
- return;
- path->needs_resort = 1;
- path->needs_regen_to_sort = needs_regen;
- path->resort_all_children = resort_all_children;
- mark_path_child_needs_resort(ets, path->parent);
-}
-
-static void
-schedule_resort (ETreeSorted *ets, ETreeSortedPath *path, gboolean needs_regen, gboolean resort_all_children)
-{
- ets->priv->insert_count = 0;
- if (ets->priv->insert_idle_id != 0) {
- g_source_remove(ets->priv->insert_idle_id);
- ets->priv->insert_idle_id = 0;
- }
-
- if (path == NULL)
- return;
- if (path->num_children == 0)
- return;
-
- mark_path_needs_resort(ets, path, needs_regen, resort_all_children);
- if (ets->priv->sort_idle_id == 0) {
- ets->priv->sort_idle_id = g_idle_add_full(50, (GSourceFunc) ets_sort_idle, ets, NULL);
- } else if (ets->priv->in_resort_idle) {
- ets->priv->nested_resort_idle = TRUE;
- }
-}
-
-
-
-/* virtual methods */
-
-static void
-ets_destroy (GtkObject *object)
-{
- ETreeSorted *ets = E_TREE_SORTED (object);
- ETreeSortedPriv *priv = ets->priv;
-
- /* FIXME lots of stuff to free here */
-
- if (priv->root)
- free_path(priv->root);
-
- if (priv->source) {
- gtk_signal_disconnect (GTK_OBJECT (priv->source),
- priv->tree_model_pre_change_id);
- gtk_signal_disconnect (GTK_OBJECT (priv->source),
- priv->tree_model_no_change_id);
- gtk_signal_disconnect (GTK_OBJECT (priv->source),
- priv->tree_model_node_changed_id);
- gtk_signal_disconnect (GTK_OBJECT (priv->source),
- priv->tree_model_node_data_changed_id);
- gtk_signal_disconnect (GTK_OBJECT (priv->source),
- priv->tree_model_node_col_changed_id);
- gtk_signal_disconnect (GTK_OBJECT (priv->source),
- priv->tree_model_node_inserted_id);
- gtk_signal_disconnect (GTK_OBJECT (priv->source),
- priv->tree_model_node_removed_id);
- gtk_signal_disconnect (GTK_OBJECT (priv->source),
- priv->tree_model_node_deleted_id);
- gtk_signal_disconnect (GTK_OBJECT (priv->source),
- priv->tree_model_node_request_collapse_id);
-
- gtk_object_unref (GTK_OBJECT (priv->source));
- priv->source = NULL;
-
- priv->tree_model_pre_change_id = 0;
- priv->tree_model_no_change_id = 0;
- priv->tree_model_node_changed_id = 0;
- priv->tree_model_node_data_changed_id = 0;
- priv->tree_model_node_col_changed_id = 0;
- priv->tree_model_node_inserted_id = 0;
- priv->tree_model_node_removed_id = 0;
- priv->tree_model_node_deleted_id = 0;
- priv->tree_model_node_request_collapse_id = 0;
- }
-
- if (priv->sort_info) {
- gtk_signal_disconnect (GTK_OBJECT (priv->sort_info),
- priv->sort_info_changed_id);
-
- gtk_object_unref (GTK_OBJECT (priv->sort_info));
- priv->sort_info = NULL;
-
- priv->sort_info_changed_id = 0;
- }
-
- ets_stop_sort_idle (ets);
- if (ets->priv->insert_idle_id) {
- g_source_remove(ets->priv->insert_idle_id);
- ets->priv->insert_idle_id = 0;
- }
-
- if (priv->full_header)
- gtk_object_unref(GTK_OBJECT(priv->full_header));
-
- g_free (priv);
-
- GTK_OBJECT_CLASS (parent_class)->destroy (object);
-}
-
-/* Set_arg handler for the text item */
-static void
-ets_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- ETreeSorted *ets;
-
- ets = E_TREE_SORTED (object);
-
- switch (arg_id) {
- case ARG_SORT_INFO:
- if (ets->priv->sort_info) {
- gtk_signal_disconnect (GTK_OBJECT (ets->priv->sort_info),
- ets->priv->sort_info_changed_id);
-
- gtk_object_unref (GTK_OBJECT (ets->priv->sort_info));
- ets->priv->sort_info_changed_id = 0;
- }
- if (GTK_VALUE_OBJECT (*arg))
- ets->priv->sort_info = E_TABLE_SORT_INFO(GTK_VALUE_OBJECT (*arg));
- else
- ets->priv->sort_info = NULL;
- if (ets->priv->sort_info) {
- gtk_object_ref(GTK_OBJECT(ets->priv->sort_info));
-
- ets->priv->sort_info_changed_id = gtk_signal_connect (GTK_OBJECT (ets->priv->sort_info), "sort_info_changed",
- GTK_SIGNAL_FUNC (ets_sort_info_changed), ets);
- }
- if (ets->priv->root)
- schedule_resort (ets, ets->priv->root, TRUE, TRUE);
- break;
-
- default:
- return;
- }
-}
-
-/* Get_arg handler for the text item */
-static void
-ets_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
-{
- ETreeSorted *ets;
-
- ets = E_TREE_SORTED (object);
-
- switch (arg_id) {
- case ARG_SORT_INFO:
- if (ets->priv->sort_info)
- GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(ets->priv->sort_info);
- else
- GTK_VALUE_OBJECT (*arg) = NULL;
- break;
-
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-static ETreePath
-ets_get_root (ETreeModel *etm)
-{
- ETreeSortedPriv *priv = E_TREE_SORTED(etm)->priv;
- if (priv->root == NULL) {
- ETreeSorted *ets = E_TREE_SORTED(etm);
- ETreePath corresponding = e_tree_model_get_root(ets->priv->source);
-
- if (corresponding) {
- priv->root = new_path(NULL, corresponding);
- }
- }
- if (priv->root && priv->root->num_children == -1) {
- generate_children(E_TREE_SORTED(etm), priv->root);
- }
-
- return priv->root;
-}
-
-static ETreePath
-ets_get_parent (ETreeModel *etm, ETreePath node)
-{
- ETreeSortedPath *path = node;
- return path->parent;
-}
-
-static ETreePath
-ets_get_first_child (ETreeModel *etm, ETreePath node)
-{
- ETreeSortedPath *path = node;
- ETreeSorted *ets = E_TREE_SORTED(etm);
-
- if (path->num_children == -1)
- generate_children(ets, path);
-
- if (path->num_children > 0)
- return path->children[0];
- else
- return NULL;
-}
-
-static ETreePath
-ets_get_last_child (ETreeModel *etm, ETreePath node)
-{
- ETreeSortedPath *path = node;
- ETreeSorted *ets = E_TREE_SORTED(etm);
-
- if (path->num_children == -1)
- generate_children(ets, path);
-
- if (path->num_children > 0)
- return path->children[path->num_children - 1];
- else
- return NULL;
-}
-
-static ETreePath
-ets_get_next (ETreeModel *etm, ETreePath node)
-{
- ETreeSortedPath *path = node;
- ETreeSortedPath *parent = path->parent;
- if (parent) {
- if (parent->num_children > path->position + 1)
- return parent->children[path->position + 1];
- else
- return NULL;
- } else
- return NULL;
-}
-
-static ETreePath
-ets_get_prev (ETreeModel *etm, ETreePath node)
-{
- ETreeSortedPath *path = node;
- ETreeSortedPath *parent = path->parent;
- if (parent) {
- if (path->position - 1 >= 0)
- return parent->children[path->position - 1];
- else
- return NULL;
- } else
- return NULL;
-}
-
-static gboolean
-ets_is_root (ETreeModel *etm, ETreePath node)
-{
- ETreeSortedPath *path = node;
- ETreeSorted *ets = E_TREE_SORTED(etm);
-
- return e_tree_model_node_is_root (ets->priv->source, path->corresponding);
-}
-
-static gboolean
-ets_is_expandable (ETreeModel *etm, ETreePath node)
-{
- ETreeSortedPath *path = node;
- ETreeSorted *ets = E_TREE_SORTED(etm);
- gboolean expandable = e_tree_model_node_is_expandable (ets->priv->source, path->corresponding);
-
- if (path->num_children == -1) {
- generate_children(ets, node);
- }
-
- return expandable;
-}
-
-static guint
-ets_get_children (ETreeModel *etm, ETreePath node, ETreePath **nodes)
-{
- ETreeSortedPath *path = node;
- guint n_children;
-
- if (path->num_children == -1) {
- generate_children(E_TREE_SORTED(etm), node);
- }
-
- n_children = path->num_children;
-
- if (nodes) {
- int i;
-
- (*nodes) = g_malloc (sizeof (ETreePath) * n_children);
- for (i = 0; i < n_children; i ++) {
- (*nodes)[i] = path->children[i];
- }
- }
-
- return n_children;
-}
-
-static guint
-ets_depth (ETreeModel *etm, ETreePath node)
-{
- ETreeSortedPath *path = node;
- ETreeSorted *ets = E_TREE_SORTED(etm);
-
- return e_tree_model_node_depth(ets->priv->source, path->corresponding);
-}
-
-static GdkPixbuf *
-ets_icon_at (ETreeModel *etm, ETreePath node)
-{
- ETreeSortedPath *path = node;
- ETreeSorted *ets = E_TREE_SORTED(etm);
-
- return e_tree_model_icon_at(ets->priv->source, path->corresponding);
-}
-
-static gboolean
-ets_get_expanded_default (ETreeModel *etm)
-{
- ETreeSorted *ets = E_TREE_SORTED(etm);
-
- return e_tree_model_get_expanded_default(ets->priv->source);
-}
-
-static gint
-ets_column_count (ETreeModel *etm)
-{
- ETreeSorted *ets = E_TREE_SORTED(etm);
-
- return e_tree_model_column_count(ets->priv->source);
-}
-
-
-static gboolean
-ets_has_save_id (ETreeModel *etm)
-{
- return TRUE;
-}
-
-static gchar *
-ets_get_save_id (ETreeModel *etm, ETreePath node)
-{
- ETreeSorted *ets = E_TREE_SORTED(etm);
- ETreeSortedPath *path = node;
-
- if (e_tree_model_has_save_id(ets->priv->source))
- return e_tree_model_get_save_id(ets->priv->source, path->corresponding);
- else
- return g_strdup_printf("%p", path->corresponding);
-}
-
-static gboolean
-ets_has_get_node_by_id (ETreeModel *etm)
-{
- ETreeSorted *ets = E_TREE_SORTED(etm);
- return e_tree_model_has_get_node_by_id(ets->priv->source);
-}
-
-static ETreePath
-ets_get_node_by_id (ETreeModel *etm, const char *save_id)
-{
- ETreeSorted *ets = E_TREE_SORTED(etm);
- ETreePath node;
-
- node = e_tree_model_get_node_by_id (ets->priv->source, save_id);
-
- return find_path(ets, node);
-}
-
-static gboolean
-ets_has_change_pending (ETreeModel *etm)
-{
- ETreeSorted *ets = E_TREE_SORTED(etm);
-
- return ets->priv->sort_idle_id != 0;
-}
-
-
-static void *
-ets_value_at (ETreeModel *etm, ETreePath node, int col)
-{
- ETreeSorted *ets = E_TREE_SORTED(etm);
- ETreeSortedPath *path = node;
-
- return e_tree_model_value_at(ets->priv->source, path->corresponding, col);
-}
-
-static void
-ets_set_value_at (ETreeModel *etm, ETreePath node, int col, const void *val)
-{
- ETreeSorted *ets = E_TREE_SORTED(etm);
- ETreeSortedPath *path = node;
-
- e_tree_model_set_value_at (ets->priv->source, path->corresponding, col, val);
-}
-
-static gboolean
-ets_is_editable (ETreeModel *etm, ETreePath node, int col)
-{
- ETreeSorted *ets = E_TREE_SORTED(etm);
- ETreeSortedPath *path = node;
-
- return e_tree_model_node_is_editable (ets->priv->source, path->corresponding, col);
-}
-
-
-/* The default for ets_duplicate_value is to return the raw value. */
-static void *
-ets_duplicate_value (ETreeModel *etm, int col, const void *value)
-{
- ETreeSorted *ets = E_TREE_SORTED(etm);
-
- return e_tree_model_duplicate_value (ets->priv->source, col, value);
-}
-
-static void
-ets_free_value (ETreeModel *etm, int col, void *value)
-{
- ETreeSorted *ets = E_TREE_SORTED(etm);
-
- e_tree_model_free_value (ets->priv->source, col, value);
-}
-
-static void *
-ets_initialize_value (ETreeModel *etm, int col)
-{
- ETreeSorted *ets = E_TREE_SORTED(etm);
-
- return e_tree_model_initialize_value (ets->priv->source, col);
-}
-
-static gboolean
-ets_value_is_empty (ETreeModel *etm, int col, const void *value)
-{
- ETreeSorted *ets = E_TREE_SORTED(etm);
-
- return e_tree_model_value_is_empty (ets->priv->source, col, value);
-}
-
-static char *
-ets_value_to_string (ETreeModel *etm, int col, const void *value)
-{
- ETreeSorted *ets = E_TREE_SORTED(etm);
-
- return e_tree_model_value_to_string (ets->priv->source, col, value);
-}
-
-
-
-/* Proxy functions */
-
-static void
-ets_proxy_pre_change (ETreeModel *etm, ETreeSorted *ets)
-{
- e_tree_model_pre_change(E_TREE_MODEL(ets));
-}
-
-static void
-ets_proxy_no_change (ETreeModel *etm, ETreeSorted *ets)
-{
- e_tree_model_no_change(E_TREE_MODEL(ets));
-}
-
-static void
-ets_proxy_node_changed (ETreeModel *etm, ETreePath node, ETreeSorted *ets)
-{
- ets->priv->last_access = NULL;
- d(g_print("Setting last access %p. (ets_proxy_node_changed)\n", ets->priv->last_access));
-
- if (e_tree_model_node_is_root(ets->priv->source, node)) {
- ets_stop_sort_idle (ets);
-
- if (ets->priv->root) {
- free_path(ets->priv->root);
- }
- ets->priv->root = new_path(NULL, node);
- e_tree_model_node_changed(E_TREE_MODEL(ets), ets->priv->root);
- } else {
- ETreeSortedPath *path = find_path(ets, node);
-
- if (path) {
- free_children(path);
- if (!reposition_path(ets, path))
- e_tree_model_node_changed(E_TREE_MODEL(ets), path);
- }
- }
-}
-
-static void
-ets_proxy_node_data_changed (ETreeModel *etm, ETreePath node, ETreeSorted *ets)
-{
- ETreeSortedPath *path = find_path(ets, node);
-
- if (path) {
- if (!reposition_path(ets, path))
- e_tree_model_node_data_changed(E_TREE_MODEL(ets), path);
- } else
- e_tree_model_no_change(E_TREE_MODEL(ets));
-}
-
-static void
-ets_proxy_node_col_changed (ETreeModel *etm, ETreePath node, int col, ETreeSorted *ets)
-{
- ETreeSortedPath *path = find_path(ets, node);
-
- if (path) {
- gboolean changed = FALSE;
- if (e_table_sorting_utils_affects_sort(ets->priv->sort_info, ets->priv->full_header, col))
- changed = reposition_path(ets, path);
- if (!changed)
- e_tree_model_node_col_changed(E_TREE_MODEL(ets), path, col);
- } else
- e_tree_model_no_change(E_TREE_MODEL(ets));
-}
-
-static void
-ets_proxy_node_inserted (ETreeModel *etm, ETreePath parent, ETreePath child, ETreeSorted *ets)
-{
- ETreeSortedPath *parent_path = find_path(ets, parent);
-
- if (parent_path && parent_path->num_children != -1) {
- int i;
- int j;
- ETreeSortedPath *path;
- int position = parent_path->num_children;
- ETreePath counter;
-
- for (counter = e_tree_model_node_get_next(etm, child);
- counter;
- counter = e_tree_model_node_get_next(etm, counter))
- position --;
-
- if (position != parent_path->num_children) {
- for (i = 0; i < parent_path->num_children; i++) {
- if (parent_path->children[i]->orig_position >= position)
- parent_path->children[i]->orig_position++;
- }
- }
-
- i = parent_path->num_children;
- path = new_path(parent_path, child);
- path->orig_position = position;
- if (!ETS_SORT_IDLE_ACTIVATED (ets)) {
- ets->priv->insert_count++;
- if (ets->priv->insert_count > ETS_INSERT_MAX) {
- /* schedule a sort, and append instead */
- schedule_resort(ets, parent_path, TRUE, FALSE);
- } else {
- /* make sure we have an idle handler to reset the count every now and then */
- if (ets->priv->insert_idle_id == 0) {
- ets->priv->insert_idle_id = g_idle_add_full(40, (GSourceFunc) ets_insert_idle, ets, NULL);
- }
- i = e_table_sorting_utils_tree_insert
- (ets->priv->source,
- ets->priv->sort_info,
- ets->priv->full_header,
- (ETreePath *) parent_path->children,
- parent_path->num_children,
- path);
- }
- } else {
- mark_path_needs_resort(ets, parent_path, TRUE, FALSE);
- }
- parent_path->num_children ++;
- parent_path->children = g_renew(ETreeSortedPath *, parent_path->children, parent_path->num_children);
- memmove(parent_path->children + i + 1, parent_path->children + i, (parent_path->num_children - 1 - i) * sizeof(int));
- parent_path->children[i] = path;
- for (j = i; j < parent_path->num_children; j++) {
- parent_path->children[j]->position = j;
- }
- e_tree_model_node_inserted(E_TREE_MODEL(ets), parent_path, parent_path->children[i]);
- } else if (ets->priv->root == NULL && parent == NULL) {
- if (child) {
- ets->priv->root = new_path(NULL, child);
- e_tree_model_node_inserted(E_TREE_MODEL(ets), NULL, ets->priv->root);
- }
- }
-}
-
-static void
-ets_proxy_node_removed (ETreeModel *etm, ETreePath parent, ETreePath child, int old_position, ETreeSorted *ets)
-{
- ETreeSortedPath *parent_path = find_path(ets, parent);
- ETreeSortedPath *path;
-
- if (parent_path)
- path = find_child_path(ets, parent_path, child);
- else
- path = find_path(ets, child);
-
- d(g_print("Setting last access %p. (ets_proxy_node_removed)\n ", ets->priv->last_access));
- ets->priv->last_access = NULL;
-
- if (path && parent_path && parent_path->num_children != -1) {
- int i;
- for (i = 0; i < parent_path->num_children; i++) {
- if (parent_path->children[i]->orig_position > old_position)
- parent_path->children[i]->orig_position --;
- }
-
- i = path->position;
-
- parent_path->num_children --;
- memmove(parent_path->children + i, parent_path->children + i + 1, sizeof(ETreeSortedPath *) * (parent_path->num_children - i));
- for (; i < parent_path->num_children; i++) {
- parent_path->children[i]->position = i;
- }
- e_tree_model_node_removed(E_TREE_MODEL(ets), parent_path, path, path->position);
- free_path(path);
- } else if (path && path == ets->priv->root) {
- ets->priv->root = NULL;
- e_tree_model_node_removed(E_TREE_MODEL(ets), NULL, path, -1);
- free_path(path);
- }
-}
-
-static void
-ets_proxy_node_deleted (ETreeModel *etm, ETreePath child, ETreeSorted *ets)
-{
- e_tree_model_node_deleted(E_TREE_MODEL(ets), NULL);
-}
-
-static void
-ets_proxy_node_request_collapse (ETreeModel *etm, ETreePath node, ETreeSorted *ets)
-{
- ETreeSortedPath *path = find_path(ets, node);
- e_tree_model_node_request_collapse(E_TREE_MODEL(ets), path);
-}
-
-static void
-ets_sort_info_changed (ETableSortInfo *sort_info, ETreeSorted *ets)
-{
- schedule_resort(ets, ets->priv->root, TRUE, TRUE);
-}
-
-
-
-/* Initialization and creation */
-
-static void
-e_tree_sorted_class_init (ETreeSortedClass *klass)
-{
- ETreeModelClass *tree_class = E_TREE_MODEL_CLASS (klass);
- GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
-
- parent_class = gtk_type_class (PARENT_TYPE);
-
- node_chunk = g_mem_chunk_create (ETreeSortedPath, TREEPATH_CHUNK_AREA_SIZE, G_ALLOC_AND_FREE);
-
- klass->node_resorted = NULL;
-
- object_class->destroy = ets_destroy;
- object_class->set_arg = ets_set_arg;
- object_class->get_arg = ets_get_arg;
-
- tree_class->get_root = ets_get_root;
- tree_class->get_parent = ets_get_parent;
- tree_class->get_first_child = ets_get_first_child;
- tree_class->get_last_child = ets_get_last_child;
- tree_class->get_prev = ets_get_prev;
- tree_class->get_next = ets_get_next;
-
- tree_class->is_root = ets_is_root;
- tree_class->is_expandable = ets_is_expandable;
- tree_class->get_children = ets_get_children;
- tree_class->depth = ets_depth;
-
- tree_class->icon_at = ets_icon_at;
-
- tree_class->get_expanded_default = ets_get_expanded_default;
- tree_class->column_count = ets_column_count;
-
- tree_class->has_save_id = ets_has_save_id;
- tree_class->get_save_id = ets_get_save_id;
-
- tree_class->has_get_node_by_id = ets_has_get_node_by_id;
- tree_class->get_node_by_id = ets_get_node_by_id;
-
- tree_class->has_change_pending = ets_has_change_pending;
-
-
-
-
- tree_class->value_at = ets_value_at;
- tree_class->set_value_at = ets_set_value_at;
- tree_class->is_editable = ets_is_editable;
-
- tree_class->duplicate_value = ets_duplicate_value;
- tree_class->free_value = ets_free_value;
- tree_class->initialize_value = ets_initialize_value;
- tree_class->value_is_empty = ets_value_is_empty;
- tree_class->value_to_string = ets_value_to_string;
-
- gtk_object_add_arg_type ("ETreeSorted::sort_info", E_TABLE_SORT_INFO_TYPE,
- GTK_ARG_READWRITE, ARG_SORT_INFO);
-
- signals [NODE_RESORTED] =
- gtk_signal_new ("node_resorted",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETreeSortedClass, node_resorted),
- gtk_marshal_NONE__POINTER,
- GTK_TYPE_NONE, 1, GTK_TYPE_POINTER);
-
- E_OBJECT_CLASS_ADD_SIGNALS (object_class, signals, LAST_SIGNAL);
-}
-
-static void
-e_tree_sorted_init (GtkObject *object)
-{
- ETreeSorted *ets = (ETreeSorted *)object;
-
- ETreeSortedPriv *priv;
-
- priv = g_new0 (ETreeSortedPriv, 1);
- ets->priv = priv;
-
- priv->root = NULL;
- priv->source = NULL;
-
- priv->sort_info = NULL;
- priv->full_header = NULL;
-
- priv->last_access = NULL;
-
- priv->tree_model_pre_change_id = 0;
- priv->tree_model_no_change_id = 0;
- priv->tree_model_node_changed_id = 0;
- priv->tree_model_node_data_changed_id = 0;
- priv->tree_model_node_col_changed_id = 0;
- priv->tree_model_node_inserted_id = 0;
- priv->tree_model_node_removed_id = 0;
- priv->tree_model_node_deleted_id = 0;
- priv->tree_model_node_request_collapse_id = 0;
-
- priv->sort_info_changed_id = 0;
- priv->sort_idle_id = 0;
- priv->insert_idle_id = 0;
- priv->insert_count = 0;
-
- priv->in_resort_idle = 0;
- priv->nested_resort_idle = 0;
-}
-
-E_MAKE_TYPE(e_tree_sorted, "ETreeSorted", ETreeSorted, e_tree_sorted_class_init, e_tree_sorted_init, PARENT_TYPE)
-
-/**
- * e_tree_sorted_construct:
- * @etree:
- *
- *
- **/
-void
-e_tree_sorted_construct (ETreeSorted *ets, ETreeModel *source, ETableHeader *full_header, ETableSortInfo *sort_info)
-{
- ets->priv->source = source;
- if (source)
- gtk_object_ref(GTK_OBJECT(source));
-
- ets->priv->full_header = full_header;
- if (full_header)
- gtk_object_ref(GTK_OBJECT(full_header));
-
- ets->priv->sort_info = sort_info;
- if (sort_info)
- gtk_object_ref(GTK_OBJECT(sort_info));
-
- ets->priv->tree_model_pre_change_id = gtk_signal_connect (GTK_OBJECT (source), "pre_change",
- GTK_SIGNAL_FUNC (ets_proxy_pre_change), ets);
- ets->priv->tree_model_no_change_id = gtk_signal_connect (GTK_OBJECT (source), "no_change",
- GTK_SIGNAL_FUNC (ets_proxy_no_change), ets);
- ets->priv->tree_model_node_changed_id = gtk_signal_connect (GTK_OBJECT (source), "node_changed",
- GTK_SIGNAL_FUNC (ets_proxy_node_changed), ets);
- ets->priv->tree_model_node_data_changed_id = gtk_signal_connect (GTK_OBJECT (source), "node_data_changed",
- GTK_SIGNAL_FUNC (ets_proxy_node_data_changed), ets);
- ets->priv->tree_model_node_col_changed_id = gtk_signal_connect (GTK_OBJECT (source), "node_col_changed",
- GTK_SIGNAL_FUNC (ets_proxy_node_col_changed), ets);
- ets->priv->tree_model_node_inserted_id = gtk_signal_connect (GTK_OBJECT (source), "node_inserted",
- GTK_SIGNAL_FUNC (ets_proxy_node_inserted), ets);
- ets->priv->tree_model_node_removed_id = gtk_signal_connect (GTK_OBJECT (source), "node_removed",
- GTK_SIGNAL_FUNC (ets_proxy_node_removed), ets);
- ets->priv->tree_model_node_deleted_id = gtk_signal_connect (GTK_OBJECT (source), "node_deleted",
- GTK_SIGNAL_FUNC (ets_proxy_node_deleted), ets);
- ets->priv->tree_model_node_request_collapse_id = gtk_signal_connect (GTK_OBJECT (source), "node_request_collapse",
- GTK_SIGNAL_FUNC (ets_proxy_node_request_collapse), ets);
-
- ets->priv->sort_info_changed_id = gtk_signal_connect (GTK_OBJECT (sort_info), "sort_info_changed",
- GTK_SIGNAL_FUNC (ets_sort_info_changed), ets);
-}
-
-/**
- * e_tree_sorted_new
- *
- * FIXME docs here.
- *
- * return values: a newly constructed ETreeSorted.
- */
-ETreeSorted *
-e_tree_sorted_new (ETreeModel *source, ETableHeader *full_header, ETableSortInfo *sort_info)
-{
- ETreeSorted *ets;
-
- ets = gtk_type_new (e_tree_sorted_get_type ());
-
- e_tree_sorted_construct(ets, source, full_header, sort_info);
-
- return ets;
-}
-
-ETreePath
-e_tree_sorted_view_to_model_path (ETreeSorted *ets,
- ETreePath view_path)
-{
- ETreeSortedPath *path = view_path;
- if (path) {
- ets->priv->last_access = path;
- d(g_print("Setting last access %p. (e_tree_sorted_view_to_model_path)\n", ets->priv->last_access));
- return path->corresponding;
- } else
- return NULL;
-}
-
-ETreePath
-e_tree_sorted_model_to_view_path (ETreeSorted *ets,
- ETreePath model_path)
-{
- return find_or_create_path(ets, model_path);
-}
-
-int
-e_tree_sorted_orig_position (ETreeSorted *ets,
- ETreePath path)
-{
- ETreeSortedPath *sorted_path = path;
- return sorted_path->orig_position;
-}
-
-int
-e_tree_sorted_node_num_children (ETreeSorted *ets,
- ETreePath path)
-{
- ETreeSortedPath *sorted_path = path;
-
- if (sorted_path->num_children == -1) {
- generate_children(ets, sorted_path);
- }
-
- return sorted_path->num_children;
-}
-
-void
-e_tree_sorted_node_resorted (ETreeSorted *sorted, ETreePath node)
-{
- g_return_if_fail (sorted != NULL);
- g_return_if_fail (E_IS_TREE_SORTED (sorted));
-
- gtk_signal_emit (GTK_OBJECT (sorted),
- signals [NODE_RESORTED], node);
-}
diff --git a/widgets/table/e-tree-sorted.h b/widgets/table/e-tree-sorted.h
deleted file mode 100644
index 529e28257a..0000000000
--- a/widgets/table/e-tree-sorted.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-tree-sorted.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_TREE_SORTED_H_
-#define _E_TREE_SORTED_H_
-
-#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <gal/e-table/e-tree-model.h>
-#include <gal/e-table/e-table-sort-info.h>
-#include <gal/e-table/e-table-header.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-
-#define E_TREE_SORTED_TYPE (e_tree_sorted_get_type ())
-#define E_TREE_SORTED(o) (GTK_CHECK_CAST ((o), E_TREE_SORTED_TYPE, ETreeSorted))
-#define E_TREE_SORTED_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TREE_SORTED_TYPE, ETreeSortedClass))
-#define E_IS_TREE_SORTED(o) (GTK_CHECK_TYPE ((o), E_TREE_SORTED_TYPE))
-#define E_IS_TREE_SORTED_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TREE_SORTED_TYPE))
-
-typedef struct ETreeSorted ETreeSorted;
-typedef struct ETreeSortedPriv ETreeSortedPriv;
-typedef struct ETreeSortedClass ETreeSortedClass;
-
-struct ETreeSorted {
- ETreeModel base;
-
- ETreeSortedPriv *priv;
-};
-
-struct ETreeSortedClass {
- ETreeModelClass parent_class;
-
- /* Signals */
- void (*node_resorted) (ETreeSorted *etm, ETreePath node);
-};
-
-
-GtkType e_tree_sorted_get_type (void);
-void e_tree_sorted_construct (ETreeSorted *etree,
- ETreeModel *source,
- ETableHeader *full_header,
- ETableSortInfo *sort_info);
-ETreeSorted *e_tree_sorted_new (ETreeModel *source,
- ETableHeader *full_header,
- ETableSortInfo *sort_info);
-
-ETreePath e_tree_sorted_view_to_model_path (ETreeSorted *ets,
- ETreePath view_path);
-ETreePath e_tree_sorted_model_to_view_path (ETreeSorted *ets,
- ETreePath model_path);
-int e_tree_sorted_orig_position (ETreeSorted *ets,
- ETreePath path);
-int e_tree_sorted_node_num_children (ETreeSorted *ets,
- ETreePath path);
-
-void e_tree_sorted_node_resorted (ETreeSorted *tree_model,
- ETreePath node);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _E_TREE_SORTED_H */
diff --git a/widgets/table/e-tree-table-adapter.c b/widgets/table/e-tree-table-adapter.c
deleted file mode 100644
index a907efa56b..0000000000
--- a/widgets/table/e-tree-table-adapter.c
+++ /dev/null
@@ -1,1134 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-tree-table-adapter.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- * Chris Toshok <toshok@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <stdlib.h>
-#include <string.h>
-#include <gtk/gtksignal.h>
-#include <gnome-xml/tree.h>
-#include <gnome-xml/parser.h>
-#include "gal/util/e-util.h"
-#include "gal/util/e-xml-utils.h"
-#include "e-tree-table-adapter.h"
-
-#define PARENT_TYPE E_TABLE_MODEL_TYPE
-#define d(x)
-
-#define INCREMENT_AMOUNT 100
-
-static ETableModelClass *parent_class;
-
-
-struct ETreeTableAdapterPriv {
- ETreeModel *source;
- int n_map;
- int n_vals_allocated;
- ETreePath *map_table;
- GHashTable *attributes;
-
- guint root_visible : 1;
-
- int last_access;
-
- int tree_model_pre_change_id;
- int tree_model_no_change_id;
- int tree_model_node_changed_id;
- int tree_model_node_data_changed_id;
- int tree_model_node_col_changed_id;
- int tree_model_node_inserted_id;
- int tree_model_node_removed_id;
- int tree_model_node_request_collapse_id;
-};
-
-typedef struct ETreeTableAdapterNode {
- guint expanded : 1;
- guint expandable : 1;
- guint expandable_set : 1;
-
- /* parent/child/sibling pointers */
- guint32 num_visible_children;
-} ETreeTableAdapterNode;
-
-static ETreeTableAdapterNode *
-find_node(ETreeTableAdapter *adapter, ETreePath path)
-{
- ETreeTableAdapterNode *node;
-
- if (path == NULL)
- return NULL;
-
- if (e_tree_model_has_save_id(adapter->priv->source)) {
- char *save_id;
- save_id = e_tree_model_get_save_id(adapter->priv->source, path);
- node = g_hash_table_lookup(adapter->priv->attributes, save_id);
- g_free(save_id);
- } else {
- node = g_hash_table_lookup(adapter->priv->attributes, path);
- }
- if (node && !node->expandable_set) {
- node->expandable = e_tree_model_node_is_expandable(adapter->priv->source, path);
- node->expandable_set = 1;
- }
-
- return node;
-}
-
-static ETreeTableAdapterNode *
-find_or_create_node(ETreeTableAdapter *etta, ETreePath path)
-{
- ETreeTableAdapterNode *node;
-
- node = find_node(etta, path);
-
- if (!node) {
- node = g_new(ETreeTableAdapterNode, 1);
- if (e_tree_model_node_is_root(etta->priv->source, path))
- node->expanded = TRUE;
- else
- node->expanded = e_tree_model_get_expanded_default(etta->priv->source);
- node->expandable = e_tree_model_node_is_expandable(etta->priv->source, path);
- node->expandable_set = 1;
- node->num_visible_children = 0;
-
- if (e_tree_model_has_save_id(etta->priv->source)) {
- char *save_id;
- save_id = e_tree_model_get_save_id(etta->priv->source, path);
- g_hash_table_insert(etta->priv->attributes, save_id, node);
- } else {
- g_hash_table_insert(etta->priv->attributes, path, node);
- }
- }
-
- return node;
-}
-
-static void
-add_expanded_node(ETreeTableAdapter *etta, char *save_id, gboolean expanded)
-{
- ETreeTableAdapterNode *node;
-
- node = g_hash_table_lookup(etta->priv->attributes, save_id);
-
- if (node) {
- node->expandable_set = 0;
- node->expanded = expanded;
- return;
- }
-
- node = g_new(ETreeTableAdapterNode, 1);
-
- node->expanded = expanded;
- node->expandable = 0;
- node->expandable_set = 0;
- node->num_visible_children = 0;
-
- g_hash_table_insert(etta->priv->attributes, save_id, node);
-}
-
-static void
-etta_expand_to(ETreeTableAdapter *etta, int size)
-{
- if (size > etta->priv->n_vals_allocated) {
- etta->priv->n_vals_allocated = MAX(etta->priv->n_vals_allocated + INCREMENT_AMOUNT, size);
- etta->priv->map_table = g_renew (ETreePath, etta->priv->map_table, etta->priv->n_vals_allocated);
- }
-
-}
-
-static void
-etta_update_parent_child_counts(ETreeTableAdapter *etta, ETreePath path, int change)
-{
- for (path = e_tree_model_node_get_parent(etta->priv->source, path);
- path;
- path = e_tree_model_node_get_parent(etta->priv->source, path)) {
- ETreeTableAdapterNode *node = find_or_create_node(etta, path);
- node->num_visible_children += change;
- }
- etta->priv->n_map += change;
-}
-
-static int
-find_next_node_maybe_deleted(ETreeTableAdapter *adapter, int row)
-{
- ETreePath path = adapter->priv->map_table[row];
- if (path) {
- ETreeTableAdapterNode *current = find_node (adapter, path);
-
- row += (current ? current->num_visible_children : 0) + 1;
- if (row >= adapter->priv->n_map)
- return -1;
- return row;
- } else
- return -1;
-}
-
-static int
-find_first_child_node_maybe_deleted(ETreeTableAdapter *adapter, int row)
-{
- if (row != -1) {
- ETreePath path = adapter->priv->map_table[row];
- ETreeTableAdapterNode *current = find_node (adapter, path);
- if (current && current->expanded) {
- row ++;
- if (row >= adapter->priv->n_map)
- return -1;
- return row;
- } else
- return -1;
- } else
- return 0;
-}
-
-static int
-find_next_node(ETreeTableAdapter *adapter, int row)
-{
- ETreePath path = adapter->priv->map_table[row];
- if (path) {
- ETreePath next_sibling = e_tree_model_node_get_next(adapter->priv->source, path);
- ETreeTableAdapterNode *current = find_node (adapter, path);
- if (next_sibling) {
- row += (current ? current->num_visible_children : 0) + 1;
- if (row >= adapter->priv->n_map)
- return -1;
- return row;
- } else
- return -1;
- } else
- return -1;
-}
-
-static int
-find_first_child_node(ETreeTableAdapter *adapter, int row)
-{
- if (row != -1) {
- ETreePath path = adapter->priv->map_table[row];
- ETreePath first_child = e_tree_model_node_get_first_child(adapter->priv->source, path);
- ETreeTableAdapterNode *current = find_node (adapter, path);
- if (first_child && current && current->expanded) {
- row ++;
- if (row >= adapter->priv->n_map)
- return -1;
- return row;
- } else
- return -1;
- } else
- return 0;
-}
-
-static int
-find_child_row_num_maybe_deleted(ETreeTableAdapter *etta, int row, ETreePath path)
-{
- row = find_first_child_node_maybe_deleted(etta, row);
-
- while (row != -1 && path != etta->priv->map_table[row]) {
- row = find_next_node_maybe_deleted(etta, row);
- }
-
- return row;
-}
-
-static int
-find_row_num(ETreeTableAdapter *etta, ETreePath path)
-{
- int depth;
- ETreePath *sequence;
- int i;
- int row;
-
- if (etta->priv->map_table == NULL)
- return -1;
- if (etta->priv->n_map == 0)
- return -1;
-
- if (path == NULL)
- return -1;
-
- if (etta->priv->last_access != -1) {
- int end = MIN(etta->priv->n_map, etta->priv->last_access + 10);
- int start = MAX(0, etta->priv->last_access - 10);
- int initial = MAX (MIN (etta->priv->last_access, end), start);
- for (i = initial; i < end; i++) {
- if(etta->priv->map_table[i] == path) {
- d(g_print("Found last access %d at row %d. (find_row_num)\n", etta->priv->last_access, i));
- return i;
- }
- }
- for (i = initial - 1; i >= start; i--) {
- if(etta->priv->map_table[i] == path) {
- d(g_print("Found last access %d at row %d. (find_row_num)\n", etta->priv->last_access, i));
- return i;
- }
- }
- }
-
-
- depth = e_tree_model_node_depth(etta->priv->source, path);
-
- sequence = g_new(ETreePath, depth + 1);
-
- sequence[0] = path;
-
- for (i = 0; i < depth; i++) {
- ETreeTableAdapterNode *node;
-
- sequence[i + 1] = e_tree_model_node_get_parent(etta->priv->source, sequence[i]);
-
- node = find_node(etta, sequence[i + 1]);
- if (! ((node && node->expanded) || e_tree_model_get_expanded_default(etta->priv->source))) {
- g_free(sequence);
- return -1;
- }
- }
-
- row = 0;
-
- for (i = depth; i >= 0; i --) {
- while (row != -1 && sequence[i] != etta->priv->map_table[row]) {
- row = find_next_node(etta, row);
- }
- if (row == -1)
- break;
- if (i == 0)
- break;
- row = find_first_child_node(etta, row);
- }
- g_free (sequence);
-
- d(g_print("Didn't find last access %d. Setting to %d. (find_row_num)\n", etta->priv->last_access, row));
- etta->priv->last_access = row;
- return row;
-}
-
-static int
-array_size_from_path(ETreeTableAdapter *etta, ETreePath path)
-{
- int size = 1;
-
- ETreeTableAdapterNode *node = NULL;
-
- if (e_tree_model_node_is_expandable(etta->priv->source, path))
- node = find_or_create_node(etta, path);
-
- if (node && node->expanded) {
- ETreePath children;
-
- for (children = e_tree_model_node_get_first_child(etta->priv->source, path);
- children;
- children = e_tree_model_node_get_next(etta->priv->source, children)) {
- size += array_size_from_path(etta, children);
- }
- }
-
- return size;
-}
-
-static int
-fill_array_from_path(ETreeTableAdapter *etta, ETreePath *array, ETreePath path)
-{
- ETreeTableAdapterNode *node = NULL;
- int index = 0;
-
- array[index] = path;
-
- index ++;
-
- if (e_tree_model_node_is_expandable(etta->priv->source, path))
- node = find_or_create_node(etta, path);
- else
- node = find_node(etta, path);
-
- if (node && node->expanded) {
- ETreePath children;
-
- for (children = e_tree_model_node_get_first_child(etta->priv->source, path);
- children;
- children = e_tree_model_node_get_next(etta->priv->source, children)) {
- index += fill_array_from_path(etta, array + index, children);
- }
- }
-
- if (node)
- node->num_visible_children = index - 1;
-
- return index;
-}
-
-static void
-free_string (gpointer key, gpointer value, gpointer data)
-{
- g_free(key);
-}
-
-static void
-etta_destroy (GtkObject *object)
-{
- ETreeTableAdapter *etta = E_TREE_TABLE_ADAPTER (object);
-
- if (etta->priv->source && e_tree_model_has_save_id(etta->priv->source)) {
- g_hash_table_foreach(etta->priv->attributes, free_string, NULL);
- }
- g_hash_table_destroy (etta->priv->attributes);
-
- if (etta->priv->source) {
- gtk_signal_disconnect (GTK_OBJECT (etta->priv->source),
- etta->priv->tree_model_pre_change_id);
- gtk_signal_disconnect (GTK_OBJECT (etta->priv->source),
- etta->priv->tree_model_no_change_id);
- gtk_signal_disconnect (GTK_OBJECT (etta->priv->source),
- etta->priv->tree_model_node_changed_id);
- gtk_signal_disconnect (GTK_OBJECT (etta->priv->source),
- etta->priv->tree_model_node_data_changed_id);
- gtk_signal_disconnect (GTK_OBJECT (etta->priv->source),
- etta->priv->tree_model_node_col_changed_id);
- gtk_signal_disconnect (GTK_OBJECT (etta->priv->source),
- etta->priv->tree_model_node_inserted_id);
- gtk_signal_disconnect (GTK_OBJECT (etta->priv->source),
- etta->priv->tree_model_node_removed_id);
- gtk_signal_disconnect (GTK_OBJECT (etta->priv->source),
- etta->priv->tree_model_node_request_collapse_id);
-
- gtk_object_unref (GTK_OBJECT (etta->priv->source));
- etta->priv->source = NULL;
-
- etta->priv->tree_model_pre_change_id = 0;
- etta->priv->tree_model_no_change_id = 0;
- etta->priv->tree_model_node_changed_id = 0;
- etta->priv->tree_model_node_data_changed_id = 0;
- etta->priv->tree_model_node_col_changed_id = 0;
- etta->priv->tree_model_node_inserted_id = 0;
- etta->priv->tree_model_node_removed_id = 0;
- etta->priv->tree_model_node_request_collapse_id = 0;
- }
-
- g_free (etta->priv->map_table);
-
- g_free (etta->priv);
-
- GTK_OBJECT_CLASS (parent_class)->destroy (object);
-}
-
-static int
-etta_column_count (ETableModel *etm)
-{
- ETreeTableAdapter *etta = (ETreeTableAdapter *)etm;
-
- return e_tree_model_column_count (etta->priv->source);
-}
-
-static gboolean
-etta_has_save_id (ETableModel *etm)
-{
- ETreeTableAdapter *etta = (ETreeTableAdapter *)etm;
-
- return e_tree_model_has_save_id (etta->priv->source);
-}
-
-static gchar *
-etta_get_save_id (ETableModel *etm, int row)
-{
- ETreeTableAdapter *etta = (ETreeTableAdapter *)etm;
-
- if (etta->priv->root_visible)
- return e_tree_model_get_save_id (etta->priv->source, etta->priv->map_table [row]);
- else
- return e_tree_model_get_save_id (etta->priv->source, etta->priv->map_table [row + 1]);
-}
-
-static gboolean
-etta_has_change_pending (ETableModel *etm)
-{
- ETreeTableAdapter *etta = (ETreeTableAdapter *)etm;
-
- return e_tree_model_has_change_pending (etta->priv->source);
-}
-
-
-static int
-etta_row_count (ETableModel *etm)
-{
- ETreeTableAdapter *etta = (ETreeTableAdapter *)etm;
-
- if (etta->priv->root_visible)
- return etta->priv->n_map;
- else {
- if (etta->priv->n_map > 0)
- return etta->priv->n_map - 1;
- else
- return 0;
- }
-}
-
-static void *
-etta_value_at (ETableModel *etm, int col, int row)
-{
- ETreeTableAdapter *etta = (ETreeTableAdapter *)etm;
-
-#if 0
- etta->priv->last_access = row;
- d(g_print("g) Setting last_access to %d\n", row));
-#endif
-
- switch (col) {
- case -1:
- if (etta->priv->root_visible)
- return etta->priv->map_table [row];
- else
- return etta->priv->map_table [row + 1];
- case -2:
- return etta->priv->source;
- case -3:
- return etta;
- default:
- if (etta->priv->root_visible)
- return e_tree_model_value_at (etta->priv->source, etta->priv->map_table [row], col);
- else
- return e_tree_model_value_at (etta->priv->source, etta->priv->map_table [row + 1], col);
- }
-}
-
-static void
-etta_set_value_at (ETableModel *etm, int col, int row, const void *val)
-{
- ETreeTableAdapter *etta = (ETreeTableAdapter *)etm;
-
- etta->priv->last_access = row;
- d(g_print("h) Setting last_access to %d\n", row));
- if (etta->priv->root_visible)
- e_tree_model_set_value_at (etta->priv->source, etta->priv->map_table [row], col, val);
- else
- e_tree_model_set_value_at (etta->priv->source, etta->priv->map_table [row + 1], col, val);
-}
-
-static gboolean
-etta_is_cell_editable (ETableModel *etm, int col, int row)
-{
- ETreeTableAdapter *etta = (ETreeTableAdapter *)etm;
-
- if (etta->priv->root_visible)
- return e_tree_model_node_is_editable (etta->priv->source, etta->priv->map_table [row], col);
- else
- return e_tree_model_node_is_editable (etta->priv->source, etta->priv->map_table [row + 1], col);
-}
-
-static void
-etta_append_row (ETableModel *etm, ETableModel *source, int row)
-{
-#if 0
- ETreeTableAdapter *etta = (ETreeTableAdapter *)etm;
- e_table_model_append_row (etta->priv->source, source, row);
-#endif
-}
-
-static void *
-etta_duplicate_value (ETableModel *etm, int col, const void *value)
-{
- ETreeTableAdapter *etta = (ETreeTableAdapter *)etm;
-
- return e_tree_model_duplicate_value (etta->priv->source, col, value);
-}
-
-static void
-etta_free_value (ETableModel *etm, int col, void *value)
-{
- ETreeTableAdapter *etta = (ETreeTableAdapter *)etm;
-
- e_tree_model_free_value (etta->priv->source, col, value);
-}
-
-static void *
-etta_initialize_value (ETableModel *etm, int col)
-{
- ETreeTableAdapter *etta = (ETreeTableAdapter *)etm;
-
- return e_tree_model_initialize_value (etta->priv->source, col);
-}
-
-static gboolean
-etta_value_is_empty (ETableModel *etm, int col, const void *value)
-{
- ETreeTableAdapter *etta = (ETreeTableAdapter *)etm;
-
- return e_tree_model_value_is_empty (etta->priv->source, col, value);
-}
-
-static char *
-etta_value_to_string (ETableModel *etm, int col, const void *value)
-{
- ETreeTableAdapter *etta = (ETreeTableAdapter *)etm;
-
- return e_tree_model_value_to_string (etta->priv->source, col, value);
-}
-
-static void
-etta_class_init (ETreeTableAdapterClass *klass)
-{
- ETableModelClass *table_class = (ETableModelClass *) klass;
- GtkObjectClass *object_class = (GtkObjectClass *) klass;
-
- parent_class = gtk_type_class (PARENT_TYPE);
-
- object_class->destroy = etta_destroy;
-
- table_class->column_count = etta_column_count;
- table_class->row_count = etta_row_count;
- table_class->append_row = etta_append_row;
-
- table_class->value_at = etta_value_at;
- table_class->set_value_at = etta_set_value_at;
- table_class->is_cell_editable = etta_is_cell_editable;
-
- table_class->has_save_id = etta_has_save_id;
- table_class->get_save_id = etta_get_save_id;
-
- table_class->has_change_pending = etta_has_change_pending;
- table_class->duplicate_value = etta_duplicate_value;
- table_class->free_value = etta_free_value;
- table_class->initialize_value = etta_initialize_value;
- table_class->value_is_empty = etta_value_is_empty;
- table_class->value_to_string = etta_value_to_string;
-}
-
-static void
-etta_init (ETreeTableAdapter *etta)
-{
- etta->priv = g_new(ETreeTableAdapterPriv, 1);
-
- etta->priv->source = NULL;
-
- etta->priv->n_map = 0;
- etta->priv->n_vals_allocated = 0;
- etta->priv->map_table = NULL;
- etta->priv->attributes = NULL;
-
- etta->priv->root_visible = TRUE;
-
- etta->priv->last_access = 0;
-
- etta->priv->tree_model_pre_change_id = 0;
- etta->priv->tree_model_no_change_id = 0;
- etta->priv->tree_model_node_changed_id = 0;
- etta->priv->tree_model_node_data_changed_id = 0;
- etta->priv->tree_model_node_col_changed_id = 0;
- etta->priv->tree_model_node_inserted_id = 0;
- etta->priv->tree_model_node_removed_id = 0;
- etta->priv->tree_model_node_request_collapse_id = 0;
-}
-
-E_MAKE_TYPE(e_tree_table_adapter, "ETreeTableAdapter", ETreeTableAdapter, etta_class_init, etta_init, PARENT_TYPE);
-
-static void
-etta_proxy_pre_change (ETreeModel *etm, ETreeTableAdapter *etta)
-{
- e_table_model_pre_change(E_TABLE_MODEL(etta));
-}
-
-static void
-etta_proxy_no_change (ETreeModel *etm, ETreeTableAdapter *etta)
-{
- e_table_model_no_change(E_TABLE_MODEL(etta));
-}
-
-static void
-etta_proxy_node_changed (ETreeModel *etm, ETreePath path, ETreeTableAdapter *etta)
-{
- if (e_tree_model_node_is_root(etm, path)) {
- int size;
-
- size = array_size_from_path(etta, path);
- etta_expand_to(etta, size);
- etta->priv->n_map = size;
- fill_array_from_path(etta, etta->priv->map_table, path);
- } else {
- int row = find_row_num(etta, path);
- int size;
- int old_size;
- ETreeTableAdapterNode *node;
-
- if (row == -1)
- return;
-
- size = array_size_from_path(etta, path);
-
- node = find_node(etta, path);
- if (node)
- old_size = node->num_visible_children + 1;
- else
- old_size = 1;
-
- etta_expand_to(etta, etta->priv->n_map + size - old_size);
-
- memmove(etta->priv->map_table + row + size,
- etta->priv->map_table + row + old_size,
- (etta->priv->n_map - row - old_size) * sizeof (ETreePath));
- fill_array_from_path(etta, etta->priv->map_table + row, path);
- etta_update_parent_child_counts(etta, path, size - old_size);
- }
-
- e_table_model_changed(E_TABLE_MODEL(etta));
-}
-
-static void
-etta_proxy_node_data_changed (ETreeModel *etm, ETreePath path, ETreeTableAdapter *etta)
-{
- int row = find_row_num(etta, path);
- if (row != -1) {
- if (etta->priv->root_visible)
- e_table_model_row_changed(E_TABLE_MODEL(etta), row);
- else if (row != 0)
- e_table_model_row_changed(E_TABLE_MODEL(etta), row - 1);
- else
- e_table_model_no_change(E_TABLE_MODEL(etta));
- } else
- e_table_model_no_change(E_TABLE_MODEL(etta));
-}
-
-static void
-etta_proxy_node_col_changed (ETreeModel *etm, ETreePath path, int col, ETreeTableAdapter *etta)
-{
- int row = find_row_num(etta, path);
- if (row != -1) {
- if (etta->priv->root_visible)
- e_table_model_cell_changed(E_TABLE_MODEL(etta), col, row);
- else if (row != 0)
- e_table_model_cell_changed(E_TABLE_MODEL(etta), col, row - 1);
- else
- e_table_model_no_change(E_TABLE_MODEL(etta));
- } else
- e_table_model_no_change(E_TABLE_MODEL(etta));
-}
-
-static void
-etta_proxy_node_inserted (ETreeModel *etm, ETreePath parent, ETreePath child, ETreeTableAdapter *etta)
-{
- int row;
-
- if (e_tree_model_node_is_root(etm, child)) {
- row = 0;
- } else {
- ETreePath children;
- int parent_row;
- ETreeTableAdapterNode *parent_node;
-
- parent_row = find_row_num(etta, parent);
- if (parent_row == -1) {
- e_table_model_no_change(E_TABLE_MODEL(etta));
- return;
- }
-
- parent_node = find_or_create_node(etta, parent);
- if (parent_node->expandable != e_tree_model_node_is_expandable(etta->priv->source, parent)) {
- e_table_model_pre_change(E_TABLE_MODEL(etta));
- parent_node->expandable = e_tree_model_node_is_expandable(etta->priv->source, parent);
- if (etta->priv->root_visible)
- e_table_model_row_changed(E_TABLE_MODEL(etta), parent_row);
- else if (parent_row != 0)
- e_table_model_row_changed(E_TABLE_MODEL(etta), parent_row - 1);
- else
- e_table_model_no_change(E_TABLE_MODEL(etta));
- }
- if (!parent_node->expanded) {
- e_table_model_no_change(E_TABLE_MODEL(etta));
- return;
- }
-
- row = find_first_child_node(etta, parent_row);
- children = e_tree_model_node_get_first_child(etta->priv->source, parent);
-
- while (row != -1 &&
- row <= parent_row + parent_node->num_visible_children &&
- children != NULL &&
- children == etta->priv->map_table[row]) {
- children = e_tree_model_node_get_next(etta->priv->source, children);
- row = find_next_node(etta, row);
- }
- }
-
- if (row != -1) {
- int size;
-
- size = array_size_from_path(etta, child);
-
- etta_expand_to(etta, etta->priv->n_map + size);
-
- memmove(etta->priv->map_table + row + size,
- etta->priv->map_table + row,
- (etta->priv->n_map - row) * sizeof (ETreePath));
-
- fill_array_from_path(etta, etta->priv->map_table + row, child);
- etta_update_parent_child_counts(etta, child, size);
-
- if (etta->priv->root_visible)
- e_table_model_rows_inserted(E_TABLE_MODEL(etta), row, size);
- else if (row != 0)
- e_table_model_rows_inserted(E_TABLE_MODEL(etta), row - 1, size);
- else
- e_table_model_rows_inserted(E_TABLE_MODEL(etta), 0, size - 1);
- } else
- e_table_model_no_change(E_TABLE_MODEL(etta));
-}
-
-static void
-etta_proxy_node_removed (ETreeModel *etm, ETreePath parent, ETreePath child, int old_position, ETreeTableAdapter *etta)
-{
- int parent_row = find_row_num(etta, parent);
- int row = find_child_row_num_maybe_deleted(etta, parent_row, child);
- ETreeTableAdapterNode *parent_node = find_node(etta, parent);
- if (parent_row != -1 && parent_node) {
- if (parent_node->expandable != e_tree_model_node_is_expandable(etta->priv->source, parent)) {
- e_table_model_pre_change(E_TABLE_MODEL(etta));
- parent_node->expandable = e_tree_model_node_is_expandable(etta->priv->source, parent);
- if (etta->priv->root_visible)
- e_table_model_row_changed(E_TABLE_MODEL(etta), parent_row);
- else if (parent_row != 0)
- e_table_model_row_changed(E_TABLE_MODEL(etta), parent_row - 1);
- else
- e_table_model_no_change(E_TABLE_MODEL(etta));
- }
- }
-
- if (row != -1) {
- ETreeTableAdapterNode *node = find_node(etta, child);
- int to_remove = (node ? node->num_visible_children : 0) + 1;
-
- memmove(etta->priv->map_table + row,
- etta->priv->map_table + row + to_remove,
- (etta->priv->n_map - row - to_remove) * sizeof (ETreePath));
-
- if (parent_node)
- parent_node->num_visible_children -= to_remove;
- if (parent)
- etta_update_parent_child_counts(etta, parent, - to_remove);
-
- if (etta->priv->root_visible)
- e_table_model_rows_deleted(E_TABLE_MODEL(etta), row, to_remove);
- else if (row != 0)
- e_table_model_rows_deleted(E_TABLE_MODEL(etta), row - 1, to_remove);
- else
- e_table_model_rows_deleted(E_TABLE_MODEL(etta), 0, to_remove - 1);
- } else
- e_table_model_no_change(E_TABLE_MODEL(etta));
-}
-
-static void
-etta_proxy_node_request_collapse (ETreeModel *etm, ETreePath node, ETreeTableAdapter *etta)
-{
- e_tree_table_adapter_node_set_expanded(etta, node, FALSE);
-}
-
-ETableModel *
-e_tree_table_adapter_construct (ETreeTableAdapter *etta, ETreeModel *source)
-{
- ETreePath root;
-
- etta->priv->source = source;
- gtk_object_ref (GTK_OBJECT (source));
-
- if (e_tree_model_has_save_id(source))
- etta->priv->attributes = g_hash_table_new(g_str_hash, g_str_equal);
- else
- etta->priv->attributes = g_hash_table_new(NULL, NULL);
-
- root = e_tree_model_get_root (source);
-
- if (root) {
- etta->priv->n_map = array_size_from_path(etta, root);
- etta->priv->n_vals_allocated = etta->priv->n_map;
- etta->priv->map_table = g_new(ETreePath, etta->priv->n_map);
- fill_array_from_path(etta, etta->priv->map_table, root);
- }
-
- etta->priv->tree_model_pre_change_id = gtk_signal_connect (GTK_OBJECT (source), "pre_change",
- GTK_SIGNAL_FUNC (etta_proxy_pre_change), etta);
- etta->priv->tree_model_no_change_id = gtk_signal_connect (GTK_OBJECT (source), "no_change",
- GTK_SIGNAL_FUNC (etta_proxy_no_change), etta);
- etta->priv->tree_model_node_changed_id = gtk_signal_connect (GTK_OBJECT (source), "node_changed",
- GTK_SIGNAL_FUNC (etta_proxy_node_changed), etta);
- etta->priv->tree_model_node_data_changed_id = gtk_signal_connect (GTK_OBJECT (source), "node_data_changed",
- GTK_SIGNAL_FUNC (etta_proxy_node_data_changed), etta);
- etta->priv->tree_model_node_col_changed_id = gtk_signal_connect (GTK_OBJECT (source), "node_col_changed",
- GTK_SIGNAL_FUNC (etta_proxy_node_col_changed), etta);
- etta->priv->tree_model_node_inserted_id = gtk_signal_connect (GTK_OBJECT (source), "node_inserted",
- GTK_SIGNAL_FUNC (etta_proxy_node_inserted), etta);
- etta->priv->tree_model_node_removed_id = gtk_signal_connect (GTK_OBJECT (source), "node_removed",
- GTK_SIGNAL_FUNC (etta_proxy_node_removed), etta);
- etta->priv->tree_model_node_request_collapse_id = gtk_signal_connect (GTK_OBJECT (source), "node_request_collapse",
- GTK_SIGNAL_FUNC (etta_proxy_node_request_collapse), etta);
-
- return E_TABLE_MODEL (etta);
-}
-
-ETableModel *
-e_tree_table_adapter_new (ETreeModel *source)
-{
- ETreeTableAdapter *etta = gtk_type_new (E_TREE_TABLE_ADAPTER_TYPE);
-
- e_tree_table_adapter_construct (etta, source);
-
- return (ETableModel *) etta;
-}
-
-typedef struct {
- xmlNode *root;
- ETreeModel *tree;
-} TreeAndRoot;
-
-static void
-save_expanded_state_func (gpointer keyp, gpointer value, gpointer data)
-{
- gchar *key = keyp;
- ETreeTableAdapterNode *node = value;
- TreeAndRoot *tar = data;
- xmlNode *root = tar->root;
- ETreeModel *etm = tar->tree;
- xmlNode *xmlnode;
-
- if (node->expanded != e_tree_model_get_expanded_default(etm)) {
- xmlnode = xmlNewChild (root, NULL, "node", NULL);
- e_xml_set_string_prop_by_name(xmlnode, "id", key);
- }
-}
-
-void
-e_tree_table_adapter_save_expanded_state (ETreeTableAdapter *etta, const char *filename)
-{
- xmlDoc *doc;
- xmlNode *root;
- ETreeTableAdapterPriv *priv;
- TreeAndRoot tar;
-
- g_return_if_fail(etta != NULL);
-
- priv = etta->priv;
-
- doc = xmlNewDoc ((xmlChar*) "1.0");
- root = xmlNewDocNode (doc, NULL,
- (xmlChar *) "expanded_state",
- NULL);
- xmlDocSetRootElement (doc, root);
-
- e_xml_set_integer_prop_by_name(root, "vers", 1);
-
- tar.root = root;
- tar.tree = etta->priv->source;
-
- g_hash_table_foreach (priv->attributes,
- save_expanded_state_func,
- &tar);
-
- xmlSaveFile (filename, doc);
-
- xmlFreeDoc (doc);
-}
-
-void
-e_tree_table_adapter_load_expanded_state (ETreeTableAdapter *etta, const char *filename)
-{
- ETreeTableAdapterPriv *priv;
- xmlDoc *doc;
- xmlNode *root;
- xmlNode *child;
- int vers;
-
- g_return_if_fail(etta != NULL);
-
- priv = etta->priv;
-
- doc = xmlParseFile (filename);
- if (!doc)
- return;
-
- root = xmlDocGetRootElement (doc);
- if (root == NULL || strcmp (root->name, "expanded_state")) {
- xmlFreeDoc (doc);
- return;
- }
-
- vers = e_xml_get_integer_prop_by_name_with_default(root, "vers", 0);
- if (vers != 1) {
- xmlFreeDoc (doc);
- return;
- }
-
- for (child = root->xmlChildrenNode; child; child = child->next) {
- char *id;
-
- if (strcmp (child->name, "node")) {
- d(g_warning ("unknown node '%s' in %s", child->name, filename));
- continue;
- }
-
- id = e_xml_get_string_prop_by_name_with_default (child, "id", "");
-
- if (!strcmp(id, "")) {
- g_free(id);
- return;
- }
-
- add_expanded_node(etta, id, !e_tree_model_get_expanded_default(etta->priv->source));
- }
-
- xmlFreeDoc (doc);
-}
-
-void e_tree_table_adapter_root_node_set_visible (ETreeTableAdapter *etta, gboolean visible)
-{
- if (etta->priv->root_visible == visible)
- return;
-
- e_table_model_pre_change (E_TABLE_MODEL(etta));
-
- etta->priv->root_visible = visible;
- if (!visible) {
- ETreePath root = e_tree_model_get_root(etta->priv->source);
- if (root)
- e_tree_table_adapter_node_set_expanded(etta, root, TRUE);
- }
- e_table_model_changed(E_TABLE_MODEL(etta));
-}
-
-void e_tree_table_adapter_node_set_expanded (ETreeTableAdapter *etta, ETreePath path, gboolean expanded)
-{
- ETreeTableAdapterNode *node;
- int row;
-
- if (e_tree_model_node_is_root (etta->priv->source, path) && !etta->priv->root_visible)
- return;
-
- node = find_or_create_node(etta, path);
-
- if (expanded != node->expanded) {
- node->expanded = expanded;
-
- row = find_row_num(etta, path);
- if (row != -1) {
- e_table_model_pre_change (E_TABLE_MODEL(etta));
-
- if (etta->priv->root_visible) {
- e_table_model_pre_change (E_TABLE_MODEL(etta));
- e_table_model_row_changed(E_TABLE_MODEL(etta), row);
- } else if (row != 0) {
- e_table_model_pre_change (E_TABLE_MODEL(etta));
- e_table_model_row_changed(E_TABLE_MODEL(etta), row - 1);
- }
-
- if (expanded) {
- int num_children = array_size_from_path(etta, path) - 1;
- etta_expand_to(etta, etta->priv->n_map + num_children);
- memmove(etta->priv->map_table + row + 1 + num_children,
- etta->priv->map_table + row + 1,
- (etta->priv->n_map - row - 1) * sizeof (ETreePath));
- fill_array_from_path(etta, etta->priv->map_table + row, path);
- etta_update_parent_child_counts(etta, path, num_children);
- if (num_children != 0) {
- if (etta->priv->root_visible)
- e_table_model_rows_inserted(E_TABLE_MODEL(etta), row + 1, num_children);
- else
- e_table_model_rows_inserted(E_TABLE_MODEL(etta), row, num_children);
- } else
- e_table_model_no_change(E_TABLE_MODEL(etta));
- } else {
- int num_children = node->num_visible_children;
- g_assert (etta->priv->n_map >= row + 1 + num_children);
- memmove(etta->priv->map_table + row + 1,
- etta->priv->map_table + row + 1 + num_children,
- (etta->priv->n_map - row - 1 - num_children) * sizeof (ETreePath));
- node->num_visible_children = 0;
- etta_update_parent_child_counts(etta, path, - num_children);
- if (num_children != 0) {
- if (etta->priv->root_visible)
- e_table_model_rows_deleted(E_TABLE_MODEL(etta), row + 1, num_children);
- else
- e_table_model_rows_deleted(E_TABLE_MODEL(etta), row, num_children);
- } else
- e_table_model_no_change(E_TABLE_MODEL(etta));
- }
- }
- }
-}
-
-void e_tree_table_adapter_node_set_expanded_recurse (ETreeTableAdapter *etta, ETreePath path, gboolean expanded)
-{
- ETreePath children;
-
- e_tree_table_adapter_node_set_expanded(etta, path, expanded);
-
- for (children = e_tree_model_node_get_first_child(etta->priv->source, path);
- children;
- children = e_tree_model_node_get_next(etta->priv->source, children)) {
- e_tree_table_adapter_node_set_expanded_recurse(etta, children, expanded);
- }
-}
-
-ETreePath e_tree_table_adapter_node_at_row (ETreeTableAdapter *etta, int row)
-{
- if (row < 0)
- return NULL;
- if (etta->priv->root_visible) {
- if (row < etta->priv->n_map)
- return etta->priv->map_table[row];
- } else {
- if (row + 1 < etta->priv->n_map)
- return etta->priv->map_table[row + 1];
- }
- return NULL;
-}
-
-int e_tree_table_adapter_row_of_node (ETreeTableAdapter *etta, ETreePath path)
-{
- if (etta->priv->root_visible)
- return find_row_num(etta, path);
- else {
- int row_num = find_row_num (etta, path);
- if (row_num != -1)
- return row_num - 1;
- else
- return row_num;
- }
-}
-
-gboolean e_tree_table_adapter_root_node_is_visible(ETreeTableAdapter *etta)
-{
- return etta->priv->root_visible;
-}
-
-void e_tree_table_adapter_show_node (ETreeTableAdapter *etta, ETreePath path)
-{
- ETreePath parent;
-
- parent = e_tree_model_node_get_parent(etta->priv->source, path);
-
- if (parent) {
- e_tree_table_adapter_node_set_expanded(etta, parent, TRUE);
- e_tree_table_adapter_show_node(etta, parent);
- }
-}
-
-gboolean e_tree_table_adapter_node_is_expanded (ETreeTableAdapter *etta, ETreePath path)
-{
- if (e_tree_model_node_is_expandable(etta->priv->source, path)) {
- ETreeTableAdapterNode *node = find_or_create_node(etta, path);
- return node->expanded;
- } else
- return FALSE;
-}
diff --git a/widgets/table/e-tree-table-adapter.h b/widgets/table/e-tree-table-adapter.h
deleted file mode 100644
index b60970a528..0000000000
--- a/widgets/table/e-tree-table-adapter.h
+++ /dev/null
@@ -1,87 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-tree-table-adapter.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- * Chris Toshok <toshok@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_TREE_TABLE_ADAPTER_H_
-#define _E_TREE_TABLE_ADAPTER_H_
-
-#include <gtk/gtkobject.h>
-#include <gal/e-table/e-table-model.h>
-#include <gal/e-table/e-tree-model.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#define E_TREE_TABLE_ADAPTER_TYPE (e_tree_table_adapter_get_type ())
-#define E_TREE_TABLE_ADAPTER(o) (GTK_CHECK_CAST ((o), E_TREE_TABLE_ADAPTER_TYPE, ETreeTableAdapter))
-#define E_TREE_TABLE_ADAPTER_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TREE_TABLE_ADAPTER_TYPE, ETreeTableAdapterClass))
-#define E_IS_TREE_TABLE_ADAPTER(o) (GTK_CHECK_TYPE ((o), E_TREE_TABLE_ADAPTER_TYPE))
-#define E_IS_TREE_TABLE_ADAPTER_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TREE_TABLE_ADAPTER_TYPE))
-
-typedef struct ETreeTableAdapterPriv ETreeTableAdapterPriv;
-
-typedef struct {
- ETableModel base;
-
- ETreeTableAdapterPriv *priv;
-} ETreeTableAdapter;
-
-typedef struct {
- ETableModelClass parent_class;
-} ETreeTableAdapterClass;
-
-GtkType e_tree_table_adapter_get_type (void);
-ETableModel *e_tree_table_adapter_new (ETreeModel *source);
-ETableModel *e_tree_table_adapter_construct (ETreeTableAdapter *ets,
- ETreeModel *source);
-
-gboolean e_tree_table_adapter_node_is_expanded (ETreeTableAdapter *etta,
- ETreePath path);
-void e_tree_table_adapter_node_set_expanded (ETreeTableAdapter *etta,
- ETreePath path,
- gboolean expanded);
-void e_tree_table_adapter_node_set_expanded_recurse (ETreeTableAdapter *etta,
- ETreePath path,
- gboolean expanded);
-void e_tree_table_adapter_root_node_set_visible (ETreeTableAdapter *etta,
- gboolean visible);
-ETreePath e_tree_table_adapter_node_at_row (ETreeTableAdapter *etta,
- int row);
-int e_tree_table_adapter_row_of_node (ETreeTableAdapter *etta,
- ETreePath path);
-gboolean e_tree_table_adapter_root_node_is_visible (ETreeTableAdapter *etta);
-
-void e_tree_table_adapter_show_node (ETreeTableAdapter *etta,
- ETreePath path);
-
-void e_tree_table_adapter_save_expanded_state (ETreeTableAdapter *etta,
- const char *filename);
-void e_tree_table_adapter_load_expanded_state (ETreeTableAdapter *etta,
- const char *filename);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _E_TREE_TABLE_ADAPTER_H_ */
diff --git a/widgets/table/e-tree.c b/widgets/table/e-tree.c
deleted file mode 100644
index f4000091e1..0000000000
--- a/widgets/table/e-tree.c
+++ /dev/null
@@ -1,3148 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-tree.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <stdio.h>
-#include <gdk/gdkkeysyms.h>
-#include <gtk/gtksignal.h>
-#include <libgnomeui/gnome-canvas-rect-ellipse.h>
-
-#include "gal/util/e-i18n.h"
-#include <gal/util/e-util.h>
-#include <gal/widgets/e-canvas.h>
-
-#include <gal/e-table/e-table-column-specification.h>
-#include <gal/e-table/e-table-header-item.h>
-#include <gal/e-table/e-table-header.h>
-#include <gal/e-table/e-table-item.h>
-#include <gal/e-table/e-table-sort-info.h>
-#include <gal/e-table/e-table-utils.h>
-
-#ifdef E_TREE_USE_TREE_SELECTION
-#include <gal/e-table/e-tree-selection-model.h>
-#else
-#include <gal/e-table/e-table-selection-model.h>
-#endif
-
-#include <gal/e-table/e-tree-sorted.h>
-#include <gal/e-table/e-tree-table-adapter.h>
-
-#include "e-tree.h"
-
-#define COLUMN_HEADER_HEIGHT 16
-
-#define PARENT_TYPE gtk_table_get_type ()
-
-static GtkObjectClass *parent_class;
-
-#define d(x)
-
-#if d(!)0
-#define e_table_item_leave_edit_(x) (e_table_item_leave_edit((x)), g_print ("%s: e_table_item_leave_edit\n", __FUNCTION__))
-#else
-#define e_table_item_leave_edit_(x) (e_table_item_leave_edit((x)))
-#endif
-
-enum {
- CURSOR_CHANGE,
- CURSOR_ACTIVATED,
- SELECTION_CHANGE,
- DOUBLE_CLICK,
- RIGHT_CLICK,
- CLICK,
- KEY_PRESS,
- START_DRAG,
- STATE_CHANGE,
-
- TREE_DRAG_BEGIN,
- TREE_DRAG_END,
- TREE_DRAG_DATA_GET,
- TREE_DRAG_DATA_DELETE,
-
- TREE_DRAG_LEAVE,
- TREE_DRAG_MOTION,
- TREE_DRAG_DROP,
- TREE_DRAG_DATA_RECEIVED,
-
- LAST_SIGNAL
-};
-
-enum {
- ARG_0,
- ARG_LENGTH_THRESHOLD,
- ARG_HORIZONTAL_DRAW_GRID,
- ARG_VERTICAL_DRAW_GRID,
- ARG_DRAW_FOCUS,
- ARG_ETTA,
- ARG_UNIFORM_ROW_HEIGHT,
-};
-
-enum {
- ET_SCROLL_UP = 1 << 0,
- ET_SCROLL_DOWN = 1 << 1,
- ET_SCROLL_LEFT = 1 << 2,
- ET_SCROLL_RIGHT = 1 << 3
-};
-
-struct ETreePriv {
- ETreeModel *model;
- ETreeSorted *sorted;
- ETreeTableAdapter *etta;
-
- ETableHeader *full_header, *header;
-
- guint structure_change_id, expansion_change_id;
-
- ETableSortInfo *sort_info;
- ESorter *sorter;
-
- guint sort_info_change_id, group_info_change_id;
-
- ESelectionModel *selection;
- ETableSpecification *spec;
-
- ETableSearch *search;
-
- ETableSearchFunc current_search;
- int current_search_col;
-
- guint search_search_id;
- guint search_accept_id;
-
- int reflow_idle_id;
- int scroll_idle_id;
- int hover_idle_id;
-
- int table_model_change_id;
- int table_row_change_id;
- int table_cell_change_id;
- int table_rows_inserted_id;
- int table_rows_deleted_id;
-
- GnomeCanvas *header_canvas, *table_canvas;
-
- GnomeCanvasItem *header_item, *root;
-
- GnomeCanvasItem *white_item;
- GnomeCanvasItem *item;
-
- gint length_threshold;
-
- /*
- * Configuration settings
- */
- guint alternating_row_colors : 1;
- guint horizontal_draw_grid : 1;
- guint vertical_draw_grid : 1;
- guint draw_focus : 1;
- guint row_selection_active : 1;
-
- guint horizontal_scrolling : 1;
-
- guint scroll_direction : 4;
-
- guint do_drag : 1;
-
- guint uniform_row_height : 1;
-
- ECursorMode cursor_mode;
-
- int drop_row;
- ETreePath drop_path;
- int drop_col;
-
- GnomeCanvasItem *drop_highlight;
- int last_drop_x;
- int last_drop_y;
- int last_drop_time;
- GdkDragContext *last_drop_context;
-
- int hover_x;
- int hover_y;
-
- int drag_row;
- ETreePath drag_path;
- int drag_col;
- ETreeDragSourceSite *site;
-
- GList *expanded_list;
-};
-
-static gint et_signals [LAST_SIGNAL] = { 0, };
-
-static void et_grab_focus (GtkWidget *widget);
-
-static void et_drag_begin (GtkWidget *widget,
- GdkDragContext *context,
- ETree *et);
-static void et_drag_end (GtkWidget *widget,
- GdkDragContext *context,
- ETree *et);
-static void et_drag_data_get(GtkWidget *widget,
- GdkDragContext *context,
- GtkSelectionData *selection_data,
- guint info,
- guint time,
- ETree *et);
-static void et_drag_data_delete(GtkWidget *widget,
- GdkDragContext *context,
- ETree *et);
-
-static void et_drag_leave(GtkWidget *widget,
- GdkDragContext *context,
- guint time,
- ETree *et);
-static gboolean et_drag_motion(GtkWidget *widget,
- GdkDragContext *context,
- gint x,
- gint y,
- guint time,
- ETree *et);
-static gboolean et_drag_drop(GtkWidget *widget,
- GdkDragContext *context,
- gint x,
- gint y,
- guint time,
- ETree *et);
-static void et_drag_data_received(GtkWidget *widget,
- GdkDragContext *context,
- gint x,
- gint y,
- GtkSelectionData *selection_data,
- guint info,
- guint time,
- ETree *et);
-
-static gint et_focus (GtkContainer *container, GtkDirectionType direction);
-
-static void scroll_off (ETree *et);
-static void scroll_on (ETree *et, guint scroll_direction);
-static void hover_off (ETree *et);
-static void hover_on (ETree *et, int x, int y);
-
-static void
-et_disconnect_from_etta (ETree *et)
-{
- if (et->priv->table_model_change_id != 0)
- gtk_signal_disconnect (GTK_OBJECT (et->priv->etta),
- et->priv->table_model_change_id);
- if (et->priv->table_row_change_id != 0)
- gtk_signal_disconnect (GTK_OBJECT (et->priv->etta),
- et->priv->table_row_change_id);
- if (et->priv->table_cell_change_id != 0)
- gtk_signal_disconnect (GTK_OBJECT (et->priv->etta),
- et->priv->table_cell_change_id);
- if (et->priv->table_rows_inserted_id != 0)
- gtk_signal_disconnect (GTK_OBJECT (et->priv->etta),
- et->priv->table_rows_inserted_id);
- if (et->priv->table_rows_deleted_id != 0)
- gtk_signal_disconnect (GTK_OBJECT (et->priv->etta),
- et->priv->table_rows_deleted_id);
-
- et->priv->table_model_change_id = 0;
- et->priv->table_row_change_id = 0;
- et->priv->table_cell_change_id = 0;
- et->priv->table_rows_inserted_id = 0;
- et->priv->table_rows_deleted_id = 0;
-}
-
-static void
-e_tree_state_change (ETree *et)
-{
- gtk_signal_emit (GTK_OBJECT (et),
- et_signals [STATE_CHANGE]);
-}
-
-static void
-change_trigger (GtkObject *object, ETree *et)
-{
- e_tree_state_change (et);
-}
-
-static void
-disconnect_header (ETree *e_tree)
-{
- if (e_tree->priv->header == NULL)
- return;
-
- if (e_tree->priv->structure_change_id)
- gtk_signal_disconnect (GTK_OBJECT (e_tree->priv->header),
- e_tree->priv->structure_change_id);
- if (e_tree->priv->expansion_change_id)
- gtk_signal_disconnect (GTK_OBJECT (e_tree->priv->header),
- e_tree->priv->expansion_change_id);
- if (e_tree->priv->sort_info) {
- if (e_tree->priv->sort_info_change_id)
- gtk_signal_disconnect (GTK_OBJECT (e_tree->priv->sort_info),
- e_tree->priv->sort_info_change_id);
- if (e_tree->priv->group_info_change_id)
- gtk_signal_disconnect (GTK_OBJECT (e_tree->priv->sort_info),
- e_tree->priv->group_info_change_id);
-
- gtk_object_unref(GTK_OBJECT(e_tree->priv->sort_info));
- }
- gtk_object_unref(GTK_OBJECT(e_tree->priv->header));
- e_tree->priv->header = NULL;
- e_tree->priv->sort_info = NULL;
-}
-
-static void
-connect_header (ETree *e_tree, ETableState *state)
-{
- if (e_tree->priv->header != NULL)
- disconnect_header (e_tree);
-
- e_tree->priv->header = e_table_state_to_header (GTK_WIDGET(e_tree), e_tree->priv->full_header, state);
-
- e_tree->priv->structure_change_id =
- gtk_signal_connect (GTK_OBJECT (e_tree->priv->header), "structure_change",
- change_trigger, e_tree);
- e_tree->priv->expansion_change_id =
- gtk_signal_connect (GTK_OBJECT (e_tree->priv->header), "expansion_change",
- change_trigger, e_tree);
-
- if (state->sort_info) {
- e_tree->priv->sort_info = e_table_sort_info_duplicate(state->sort_info);
- e_table_sort_info_set_can_group (e_tree->priv->sort_info, FALSE);
- e_tree->priv->sort_info_change_id =
- gtk_signal_connect (GTK_OBJECT (e_tree->priv->sort_info), "sort_info_changed",
- change_trigger, e_tree);
- e_tree->priv->group_info_change_id =
- gtk_signal_connect (GTK_OBJECT (e_tree->priv->sort_info), "group_info_changed",
- change_trigger, e_tree);
- } else
- e_tree->priv->sort_info = NULL;
-
- gtk_object_set(GTK_OBJECT(e_tree->priv->header),
- "sort_info", e_tree->priv->sort_info,
- NULL);
-}
-
-static void
-et_destroy (GtkObject *object)
-{
- ETree *et = E_TREE (object);
-
- if (et->priv->search) {
- if (et->priv->search_search_id)
- gtk_signal_disconnect (GTK_OBJECT (et->priv->search),
- et->priv->search_search_id);
- if (et->priv->search_accept_id)
- gtk_signal_disconnect (GTK_OBJECT (et->priv->search),
- et->priv->search_accept_id);
- gtk_object_unref (GTK_OBJECT (et->priv->search));
- }
-
- if (et->priv->reflow_idle_id)
- g_source_remove(et->priv->reflow_idle_id);
- et->priv->reflow_idle_id = 0;
-
- scroll_off (et);
- hover_off (et);
- e_free_string_list (et->priv->expanded_list);
-
- et_disconnect_from_etta (et);
-
- gtk_object_unref (GTK_OBJECT (et->priv->etta));
- gtk_object_unref (GTK_OBJECT (et->priv->model));
- gtk_object_unref (GTK_OBJECT (et->priv->sorted));
- gtk_object_unref (GTK_OBJECT (et->priv->full_header));
- disconnect_header (et);
- gtk_object_unref (GTK_OBJECT (et->priv->selection));
- if (et->priv->spec)
- gtk_object_unref (GTK_OBJECT (et->priv->spec));
-
- if (et->priv->sorter)
- gtk_object_unref (GTK_OBJECT (et->priv->sorter));
-
- if (et->priv->header_canvas)
- gtk_widget_destroy (GTK_WIDGET (et->priv->header_canvas));
-
- if (et->priv->site)
- e_tree_drag_source_unset (et);
-
- gtk_widget_destroy (GTK_WIDGET (et->priv->table_canvas));
-
- g_free(et->priv);
- et->priv = NULL;
-
- (*parent_class->destroy)(object);
-}
-
-static void
-et_unrealize (GtkWidget *widget)
-{
- scroll_off (E_TREE (widget));
- hover_off (E_TREE (widget));
-
- if (GTK_WIDGET_CLASS (parent_class)->unrealize)
- GTK_WIDGET_CLASS (parent_class)->unrealize (widget);
-}
-
-typedef struct {
- ETree *et;
- char *string;
-} SearchSearchStruct;
-
-static gboolean
-search_search_callback (ETreeModel *model, ETreePath path, gpointer data)
-{
- SearchSearchStruct *cb_data = data;
- const void *value;
-
- value = e_tree_model_value_at (model, path, cb_data->et->priv->current_search_col);
-
- return cb_data->et->priv->current_search (value, cb_data->string);
-}
-
-static gboolean
-et_search_search (ETableSearch *search, char *string, ETableSearchFlags flags, ETree *et)
-{
- ETreePath cursor;
- ETreePath found;
- SearchSearchStruct cb_data;
- int col;
-
- col = et->priv->current_search_col;
- if (col == -1)
- return FALSE;
-
- cb_data.et = et;
- cb_data.string = string;
-
- cursor = e_tree_get_cursor (et);
- cursor = e_tree_sorted_model_to_view_path (et->priv->sorted, cursor);
-
- if (flags & E_TABLE_SEARCH_FLAGS_CHECK_CURSOR_FIRST) {
- const void *value;
-
- value = e_tree_model_value_at (E_TREE_MODEL (et->priv->sorted), cursor, et->priv->current_search_col);
-
- if (et->priv->current_search (value, string)) {
- return TRUE;
- }
- }
-
- found = e_tree_model_node_find (E_TREE_MODEL (et->priv->sorted), cursor, NULL, E_TREE_FIND_NEXT_FORWARD, search_search_callback, &cb_data);
- if (found == NULL)
- found = e_tree_model_node_find (E_TREE_MODEL (et->priv->sorted), NULL, cursor, E_TREE_FIND_NEXT_FORWARD, search_search_callback, &cb_data);
-
- if (found && found != cursor) {
- int model_row;
-
- e_tree_table_adapter_show_node (et->priv->etta, found);
- model_row = e_tree_table_adapter_row_of_node (et->priv->etta, found);
-
- cursor = e_tree_sorted_view_to_model_path (et->priv->sorted, found);
-
- e_selection_model_select_as_key_press(E_SELECTION_MODEL (et->priv->selection), model_row, col, GDK_CONTROL_MASK);
- return TRUE;
- } else if (!(flags & E_TABLE_SEARCH_FLAGS_CHECK_CURSOR_FIRST)) {
- const void *value;
-
- value = e_tree_model_value_at (E_TREE_MODEL (et->priv->sorted), cursor, et->priv->current_search_col);
-
- return et->priv->current_search (value, string);
- } else
- return FALSE;
-}
-
-static void
-et_search_accept (ETableSearch *search, ETree *et)
-{
- int col, cursor;
-
- col = et->priv->current_search_col;
- if (col == -1)
- return;
-
- gtk_object_get(GTK_OBJECT(et->priv->selection),
- "cursor_row", &cursor,
- NULL);
- e_selection_model_select_as_key_press(E_SELECTION_MODEL (et->priv->selection), cursor, col, 0);
-}
-
-static void
-e_tree_init (GtkObject *object)
-{
- ETree *e_tree = E_TREE (object);
- GtkTable *gtk_table = GTK_TABLE (object);
-
- GTK_WIDGET_SET_FLAGS (e_tree, GTK_CAN_FOCUS);
-
- gtk_table->homogeneous = FALSE;
-
- e_tree->priv = g_new(ETreePriv, 1);
-
- e_tree->priv->model = NULL;
- e_tree->priv->sorted = NULL;
- e_tree->priv->etta = NULL;
-
- e_tree->priv->full_header = NULL;
- e_tree->priv->header = NULL;
-
- e_tree->priv->structure_change_id = 0;
- e_tree->priv->expansion_change_id = 0;
- e_tree->priv->sort_info_change_id = 0;
- e_tree->priv->group_info_change_id = 0;
-
- e_tree->priv->sort_info = NULL;
- e_tree->priv->sorter = NULL;
- e_tree->priv->reflow_idle_id = 0;
- e_tree->priv->scroll_idle_id = 0;
- e_tree->priv->hover_idle_id = 0;
-
- e_tree->priv->alternating_row_colors = 1;
- e_tree->priv->horizontal_draw_grid = 1;
- e_tree->priv->vertical_draw_grid = 1;
- e_tree->priv->draw_focus = 1;
- e_tree->priv->cursor_mode = E_CURSOR_SIMPLE;
- e_tree->priv->length_threshold = 200;
- e_tree->priv->uniform_row_height = FALSE;
-
- e_tree->priv->row_selection_active = FALSE;
- e_tree->priv->horizontal_scrolling = FALSE;
-
- e_tree->priv->drop_row = -1;
- e_tree->priv->drop_path = NULL;
- e_tree->priv->drop_col = -1;
- e_tree->priv->drop_highlight = NULL;
-
- e_tree->priv->last_drop_x = 0;
- e_tree->priv->last_drop_y = 0;
- e_tree->priv->last_drop_time = 0;
- e_tree->priv->last_drop_context = NULL;
-
- e_tree->priv->hover_x = 0;
- e_tree->priv->hover_y = 0;
-
- e_tree->priv->drag_row = -1;
- e_tree->priv->drag_path = NULL;
- e_tree->priv->drag_col = -1;
-
- e_tree->priv->expanded_list = NULL;
-
- e_tree->priv->site = NULL;
- e_tree->priv->do_drag = FALSE;
-
-#ifdef E_TREE_USE_TREE_SELECTION
- e_tree->priv->selection = E_SELECTION_MODEL(e_tree_selection_model_new());
-#else
- e_tree->priv->selection = E_SELECTION_MODEL(e_table_selection_model_new());
-#endif
- e_tree->priv->spec = NULL;
-
- e_tree->priv->header_canvas = NULL;
- e_tree->priv->table_canvas = NULL;
-
- e_tree->priv->header_item = NULL;
- e_tree->priv->root = NULL;
-
- e_tree->priv->white_item = NULL;
- e_tree->priv->item = NULL;
-
- e_tree->priv->search = e_table_search_new();
-
- e_tree->priv->search_search_id =
- gtk_signal_connect (GTK_OBJECT (e_tree->priv->search), "search",
- GTK_SIGNAL_FUNC (et_search_search), e_tree);
- e_tree->priv->search_accept_id =
- gtk_signal_connect (GTK_OBJECT (e_tree->priv->search), "accept",
- GTK_SIGNAL_FUNC (et_search_accept), e_tree);
-
- e_tree->priv->current_search = NULL;
- e_tree->priv->current_search_col = -1;
-}
-
-/* Grab_focus handler for the ETree */
-static void
-et_grab_focus (GtkWidget *widget)
-{
- ETree *e_tree;
-
- e_tree = E_TREE (widget);
-
- gtk_widget_grab_focus (GTK_WIDGET (e_tree->priv->table_canvas));
-}
-
-/* Focus handler for the ETree */
-static gint
-et_focus (GtkContainer *container, GtkDirectionType direction)
-{
- ETree *e_tree;
-
- e_tree = E_TREE (container);
-
- if (container->focus_child) {
- gtk_container_set_focus_child (container, NULL);
- return FALSE;
- }
-
- return gtk_container_focus (GTK_CONTAINER (e_tree->priv->table_canvas), direction);
-}
-
-static void
-set_header_canvas_width (ETree *e_tree)
-{
- double oldwidth, oldheight, width;
-
- if (!(e_tree->priv->header_item && e_tree->priv->header_canvas && e_tree->priv->table_canvas))
- return;
-
- gnome_canvas_get_scroll_region (GNOME_CANVAS (e_tree->priv->table_canvas),
- NULL, NULL, &width, NULL);
- gnome_canvas_get_scroll_region (GNOME_CANVAS (e_tree->priv->header_canvas),
- NULL, NULL, &oldwidth, &oldheight);
-
- if (oldwidth != width ||
- oldheight != E_TABLE_HEADER_ITEM (e_tree->priv->header_item)->height - 1)
- gnome_canvas_set_scroll_region (
- GNOME_CANVAS (e_tree->priv->header_canvas),
- 0, 0, width, /* COLUMN_HEADER_HEIGHT - 1 */
- E_TABLE_HEADER_ITEM (e_tree->priv->header_item)->height - 1);
-
-}
-
-static void
-header_canvas_size_allocate (GtkWidget *widget, GtkAllocation *alloc, ETree *e_tree)
-{
- set_header_canvas_width (e_tree);
-
- /* When the header item is created ->height == 0,
- as the font is only created when everything is realized.
- So we set the usize here as well, so that the size of the
- header is correct */
- if (GTK_WIDGET (e_tree->priv->header_canvas)->allocation.height !=
- E_TABLE_HEADER_ITEM (e_tree->priv->header_item)->height)
- gtk_widget_set_usize (GTK_WIDGET (e_tree->priv->header_canvas), -1,
- E_TABLE_HEADER_ITEM (e_tree->priv->header_item)->height);
-}
-
-static void
-e_tree_setup_header (ETree *e_tree)
-{
- char *pointer;
- e_tree->priv->header_canvas = GNOME_CANVAS (e_canvas_new ());
- GTK_WIDGET_UNSET_FLAGS (e_tree->priv->header_canvas, GTK_CAN_FOCUS);
-
- gtk_widget_show (GTK_WIDGET (e_tree->priv->header_canvas));
-
- pointer = g_strdup_printf("%p", e_tree);
-
- e_tree->priv->header_item = gnome_canvas_item_new (
- gnome_canvas_root (e_tree->priv->header_canvas),
- e_table_header_item_get_type (),
- "ETableHeader", e_tree->priv->header,
- "full_header", e_tree->priv->full_header,
- "sort_info", e_tree->priv->sort_info,
- "dnd_code", pointer,
- "tree", e_tree,
- NULL);
-
- g_free(pointer);
-
- gtk_signal_connect (
- GTK_OBJECT (e_tree->priv->header_canvas), "size_allocate",
- GTK_SIGNAL_FUNC (header_canvas_size_allocate), e_tree);
-
- gtk_widget_set_usize (GTK_WIDGET (e_tree->priv->header_canvas), -1,
- E_TABLE_HEADER_ITEM (e_tree->priv->header_item)->height);
-}
-
-static gboolean
-tree_canvas_reflow_idle (ETree *e_tree)
-{
- gdouble height, width;
- gdouble item_height;
- gdouble oldheight, oldwidth;
- GtkAllocation *alloc = &(GTK_WIDGET (e_tree->priv->table_canvas)->allocation);
-
- gtk_object_get (GTK_OBJECT (e_tree->priv->item),
- "height", &height,
- "width", &width,
- NULL);
- item_height = height;
- height = MAX ((int)height, alloc->height);
- width = MAX((int)width, alloc->width);
- /* I have no idea why this needs to be -1, but it works. */
- gnome_canvas_get_scroll_region (GNOME_CANVAS (e_tree->priv->table_canvas),
- NULL, NULL, &oldwidth, &oldheight);
-
- if (oldwidth != width - 1 ||
- oldheight != height - 1) {
- gnome_canvas_set_scroll_region (GNOME_CANVAS (e_tree->priv->table_canvas),
- 0, 0, width - 1, height - 1);
- set_header_canvas_width (e_tree);
- }
- gtk_object_set (GTK_OBJECT (e_tree->priv->white_item),
- "y1", item_height,
- "x2", width,
- "y2", height,
- NULL);
- e_tree->priv->reflow_idle_id = 0;
- return FALSE;
-}
-
-static void
-tree_canvas_size_allocate (GtkWidget *widget, GtkAllocation *alloc,
- ETree *e_tree)
-{
- gdouble width;
- gdouble height;
- gdouble item_height;
-
- width = alloc->width;
- gtk_object_get (GTK_OBJECT (e_tree->priv->item),
- "height", &height,
- NULL);
- item_height = height;
- height = MAX ((int)height, alloc->height);
-
- gtk_object_set (GTK_OBJECT (e_tree->priv->item),
- "width", width,
- NULL);
- gtk_object_set (GTK_OBJECT (e_tree->priv->header),
- "width", width,
- NULL);
- if (e_tree->priv->reflow_idle_id)
- g_source_remove(e_tree->priv->reflow_idle_id);
- tree_canvas_reflow_idle(e_tree);
-}
-
-static void
-tree_canvas_reflow (GnomeCanvas *canvas, ETree *e_tree)
-{
- if (!e_tree->priv->reflow_idle_id)
- e_tree->priv->reflow_idle_id = g_idle_add_full (400, (GSourceFunc) tree_canvas_reflow_idle, e_tree, NULL);
-}
-
-static void
-item_cursor_change (ETableItem *eti, int row, ETree *et)
-{
- ETreePath path = e_tree_table_adapter_node_at_row(et->priv->etta, row);
- path = e_tree_sorted_view_to_model_path(et->priv->sorted, path);
- gtk_signal_emit (GTK_OBJECT (et),
- et_signals [CURSOR_CHANGE],
- row, path);
-}
-
-static void
-item_cursor_activated (ETableItem *eti, int row, ETree *et)
-{
- ETreePath path = e_tree_table_adapter_node_at_row(et->priv->etta, row);
- if (path)
- path = e_tree_sorted_view_to_model_path(et->priv->sorted, path);
- gtk_signal_emit (GTK_OBJECT (et),
- et_signals [CURSOR_ACTIVATED],
- row, path);
- d(g_print("%s: Emitted CURSOR_ACTIVATED signal on row: %d and path: 0x%p\n", __FUNCTION__, row, path));
-}
-
-static void
-item_double_click (ETableItem *eti, int row, int col, GdkEvent *event, ETree *et)
-{
- ETreePath path = e_tree_table_adapter_node_at_row(et->priv->etta, row);
- path = e_tree_sorted_view_to_model_path(et->priv->sorted, path);
- gtk_signal_emit (GTK_OBJECT (et),
- et_signals [DOUBLE_CLICK],
- row, path, col, event);
-}
-
-static gint
-item_right_click (ETableItem *eti, int row, int col, GdkEvent *event, ETree *et)
-{
- int return_val = 0;
- ETreePath path = e_tree_table_adapter_node_at_row(et->priv->etta, row);
- path = e_tree_sorted_view_to_model_path(et->priv->sorted, path);
- gtk_signal_emit (GTK_OBJECT (et),
- et_signals [RIGHT_CLICK],
- row, path, col, event, &return_val);
- return return_val;
-}
-
-static gint
-item_click (ETableItem *eti, int row, int col, GdkEvent *event, ETree *et)
-{
- int return_val = 0;
- ETreePath path = e_tree_table_adapter_node_at_row(et->priv->etta, row);
- path = e_tree_sorted_view_to_model_path(et->priv->sorted, path);
- gtk_signal_emit (GTK_OBJECT (et),
- et_signals [CLICK],
- row, path, col, event, &return_val);
- return return_val;
-}
-
-static gint
-item_key_press (ETableItem *eti, int row, int col, GdkEvent *event, ETree *et)
-{
- int return_val = 0;
- GdkEventKey *key = (GdkEventKey *) event;
- ETreePath path;
- int y, row_local, col_local;
- GtkAdjustment *vadj;
-
- switch (key->keyval) {
- case GDK_Page_Down:
- case GDK_KP_Page_Down:
- vadj = gtk_layout_get_vadjustment (GTK_LAYOUT (et->priv->table_canvas));
- y = CLAMP(vadj->value + (2 * vadj->page_size - 50), 0, vadj->upper);
- y -= vadj->value;
- e_tree_get_cell_at (et, 30, y, &row_local, &col_local);
-
- if (row_local == -1)
- row_local = e_table_model_row_count (E_TABLE_MODEL(et->priv->etta)) - 1;
-
- row_local = e_tree_view_to_model_row (et, row_local);
- col_local = e_selection_model_cursor_col (E_SELECTION_MODEL (et->priv->selection));
- e_selection_model_select_as_key_press (E_SELECTION_MODEL (et->priv->selection), row_local, col_local, key->state);
-
- return_val = 1;
- break;
- case GDK_Page_Up:
- case GDK_KP_Page_Up:
- vadj = gtk_layout_get_vadjustment (GTK_LAYOUT (et->priv->table_canvas));
- y = CLAMP(vadj->value - (vadj->page_size - 50), 0, vadj->upper);
- y -= vadj->value;
- e_tree_get_cell_at (et, 30, y, &row_local, &col_local);
-
- if (row_local == -1)
- row_local = e_table_model_row_count (E_TABLE_MODEL(et->priv->etta)) - 1;
-
- row_local = e_tree_view_to_model_row (et, row_local);
- col_local = e_selection_model_cursor_col (E_SELECTION_MODEL (et->priv->selection));
- e_selection_model_select_as_key_press (E_SELECTION_MODEL (et->priv->selection), row_local, col_local, key->state);
-
- return_val = 1;
- break;
- case '=':
- case GDK_Right:
- case GDK_KP_Right:
- if (row != -1) {
- path = e_tree_table_adapter_node_at_row(et->priv->etta, row);
- if (path)
- e_tree_table_adapter_node_set_expanded (et->priv->etta, path, TRUE);
- }
- return_val = 1;
- break;
- case '-':
- case GDK_Left:
- case GDK_KP_Left:
- if (row != -1) {
- path = e_tree_table_adapter_node_at_row(et->priv->etta, row);
- if (path)
- e_tree_table_adapter_node_set_expanded (et->priv->etta, path, FALSE);
- }
- return_val = 1;
- break;
- case GDK_BackSpace:
- if (e_table_search_backspace (et->priv->search))
- return TRUE;
- /* Fallthrough */
- default:
- if ((key->state & ~(GDK_SHIFT_MASK | GDK_LOCK_MASK)) == 0
- && ((key->keyval >= GDK_a && key->keyval <= GDK_z) ||
- (key->keyval >= GDK_A && key->keyval <= GDK_Z) ||
- (key->keyval >= GDK_0 && key->keyval <= GDK_9))) {
- e_table_search_input_character (et->priv->search, key->keyval);
- }
- path = e_tree_table_adapter_node_at_row(et->priv->etta, row);
- path = e_tree_sorted_view_to_model_path(et->priv->sorted, path);
- gtk_signal_emit (GTK_OBJECT (et),
- et_signals [KEY_PRESS],
- row, path, col, event, &return_val);
- break;
- }
- return return_val;
-}
-
-static gint
-item_start_drag (ETableItem *eti, int row, int col, GdkEvent *event, ETree *et)
-{
- ETreePath path;
- gint return_val = 0;
-
- path = e_tree_table_adapter_node_at_row(et->priv->etta, row);
- path = e_tree_sorted_view_to_model_path(et->priv->sorted, path);
-
- gtk_signal_emit (GTK_OBJECT (et),
- et_signals [START_DRAG],
- row, path, col, event, &return_val);
-
- return return_val;
-}
-
-static void
-et_selection_model_selection_changed (ETableSelectionModel *etsm, ETree *et)
-{
- gtk_signal_emit (GTK_OBJECT (et),
- et_signals [SELECTION_CHANGE]);
-}
-
-static void
-et_selection_model_selection_row_changed (ETableSelectionModel *etsm, int row, ETree *et)
-{
- gtk_signal_emit (GTK_OBJECT (et),
- et_signals [SELECTION_CHANGE]);
-}
-
-static void
-et_build_item (ETree *et)
-{
- et->priv->item = gnome_canvas_item_new(GNOME_CANVAS_GROUP (gnome_canvas_root(et->priv->table_canvas)),
- e_table_item_get_type(),
- "ETableHeader", et->priv->header,
- "ETableModel", et->priv->etta,
- "selection_model", et->priv->selection,
- "alternating_row_colors", et->priv->alternating_row_colors,
- "horizontal_draw_grid", et->priv->horizontal_draw_grid,
- "vertical_draw_grid", et->priv->vertical_draw_grid,
- "drawfocus", et->priv->draw_focus,
- "cursor_mode", et->priv->cursor_mode,
- "length_threshold", et->priv->length_threshold,
- "uniform_row_height", et->priv->uniform_row_height,
- NULL);
-
- gtk_signal_connect (GTK_OBJECT (et->priv->item), "cursor_change",
- GTK_SIGNAL_FUNC (item_cursor_change), et);
- gtk_signal_connect (GTK_OBJECT (et->priv->item), "cursor_activated",
- GTK_SIGNAL_FUNC (item_cursor_activated), et);
- gtk_signal_connect (GTK_OBJECT (et->priv->item), "double_click",
- GTK_SIGNAL_FUNC (item_double_click), et);
- gtk_signal_connect (GTK_OBJECT (et->priv->item), "right_click",
- GTK_SIGNAL_FUNC (item_right_click), et);
- gtk_signal_connect (GTK_OBJECT (et->priv->item), "click",
- GTK_SIGNAL_FUNC (item_click), et);
- gtk_signal_connect (GTK_OBJECT (et->priv->item), "key_press",
- GTK_SIGNAL_FUNC (item_key_press), et);
- gtk_signal_connect (GTK_OBJECT (et->priv->item), "start_drag",
- GTK_SIGNAL_FUNC (item_start_drag), et);
-}
-
-static void
-et_canvas_realize (GtkWidget *canvas, ETree *e_tree)
-{
- gnome_canvas_item_set(
- e_tree->priv->white_item,
- "fill_color_gdk", &GTK_WIDGET(e_tree->priv->table_canvas)->style->base[GTK_STATE_NORMAL],
- NULL);
-}
-
-static gint
-et_canvas_root_event (GnomeCanvasItem *root, GdkEvent *event, ETree *e_tree)
-{
- switch (event->type) {
- case GDK_BUTTON_PRESS:
- case GDK_2BUTTON_PRESS:
- case GDK_BUTTON_RELEASE:
- if (event->button.button != 4 && event->button.button != 5) {
- if (GTK_WIDGET_HAS_FOCUS(root->canvas)) {
- GnomeCanvasItem *item = GNOME_CANVAS(root->canvas)->focused_item;
-
- if (E_IS_TABLE_ITEM(item)) {
- e_table_item_leave_edit_(E_TABLE_ITEM(item));
- return TRUE;
- }
- }
- }
- break;
- default:
- break;
- }
-
- return FALSE;
-}
-
-/* Handler for focus events in the table_canvas; we have to repaint ourselves
- * and give the focus to some ETableItem.
- */
-static gint
-table_canvas_focus_event_cb (GtkWidget *widget, GdkEventFocus *event, gpointer data)
-{
- GnomeCanvas *canvas;
- ETree *tree;
-
- gtk_widget_queue_draw (widget);
-
- if (!event->in)
- return TRUE;
-
- canvas = GNOME_CANVAS (widget);
- tree = E_TREE (data);
-
- if (!canvas->focused_item) {
- e_table_item_set_cursor (E_TABLE_ITEM (tree->priv->item), 0, 0);
- gnome_canvas_item_grab_focus (tree->priv->item);
- }
-
- return TRUE;
-}
-
-static void
-e_tree_setup_table (ETree *e_tree)
-{
- e_tree->priv->table_canvas = GNOME_CANVAS (e_canvas_new ());
- gtk_signal_connect (
- GTK_OBJECT (e_tree->priv->table_canvas), "size_allocate",
- GTK_SIGNAL_FUNC (tree_canvas_size_allocate), e_tree);
- gtk_signal_connect (
- GTK_OBJECT (e_tree->priv->table_canvas), "focus_in_event",
- GTK_SIGNAL_FUNC (table_canvas_focus_event_cb), e_tree);
- gtk_signal_connect (
- GTK_OBJECT (e_tree->priv->table_canvas), "focus_out_event",
- GTK_SIGNAL_FUNC (table_canvas_focus_event_cb), e_tree);
-
- gtk_signal_connect (
- GTK_OBJECT (e_tree->priv->table_canvas), "drag_begin",
- GTK_SIGNAL_FUNC (et_drag_begin), e_tree);
- gtk_signal_connect (
- GTK_OBJECT (e_tree->priv->table_canvas), "drag_end",
- GTK_SIGNAL_FUNC (et_drag_end), e_tree);
- gtk_signal_connect (
- GTK_OBJECT (e_tree->priv->table_canvas), "drag_data_get",
- GTK_SIGNAL_FUNC (et_drag_data_get), e_tree);
- gtk_signal_connect (
- GTK_OBJECT (e_tree->priv->table_canvas), "drag_data_delete",
- GTK_SIGNAL_FUNC (et_drag_data_delete), e_tree);
- gtk_signal_connect (
- GTK_OBJECT (e_tree), "drag_motion",
- GTK_SIGNAL_FUNC (et_drag_motion), e_tree);
- gtk_signal_connect (
- GTK_OBJECT (e_tree), "drag_leave",
- GTK_SIGNAL_FUNC (et_drag_leave), e_tree);
- gtk_signal_connect (
- GTK_OBJECT (e_tree), "drag_drop",
- GTK_SIGNAL_FUNC (et_drag_drop), e_tree);
- gtk_signal_connect (
- GTK_OBJECT (e_tree), "drag_data_received",
- GTK_SIGNAL_FUNC (et_drag_data_received), e_tree);
-
- gtk_signal_connect (GTK_OBJECT(e_tree->priv->table_canvas), "reflow",
- GTK_SIGNAL_FUNC (tree_canvas_reflow), e_tree);
-
- gtk_widget_show (GTK_WIDGET (e_tree->priv->table_canvas));
-
- e_tree->priv->white_item = gnome_canvas_item_new(
- gnome_canvas_root(e_tree->priv->table_canvas),
- gnome_canvas_rect_get_type(),
- "x1", (double) 0,
- "y1", (double) 0,
- "x2", (double) 100,
- "y2", (double) 100,
- "fill_color_gdk", &GTK_WIDGET(e_tree->priv->table_canvas)->style->base[GTK_STATE_NORMAL],
- NULL);
-
- gtk_signal_connect (
- GTK_OBJECT(e_tree->priv->table_canvas), "realize",
- GTK_SIGNAL_FUNC(et_canvas_realize), e_tree);
- gtk_signal_connect (
- GTK_OBJECT(gnome_canvas_root (e_tree->priv->table_canvas)), "event",
- GTK_SIGNAL_FUNC(et_canvas_root_event), e_tree);
-
- et_build_item(e_tree);
-}
-
-void
-e_tree_set_state_object(ETree *e_tree, ETableState *state)
-{
- connect_header (e_tree, state);
-
- gtk_object_set (GTK_OBJECT (e_tree->priv->header),
- "width", (double) (GTK_WIDGET(e_tree->priv->table_canvas)->allocation.width),
- NULL);
-
- if (e_tree->priv->header_item)
- gtk_object_set(GTK_OBJECT(e_tree->priv->header_item),
- "ETableHeader", e_tree->priv->header,
- "sort_info", e_tree->priv->sort_info,
- NULL);
-
- if (e_tree->priv->item)
- gtk_object_set(GTK_OBJECT(e_tree->priv->item),
- "ETableHeader", e_tree->priv->header,
- NULL);
-
- if (e_tree->priv->sorted)
- gtk_object_set(GTK_OBJECT(e_tree->priv->sorted),
- "sort_info", e_tree->priv->sort_info,
- NULL);
-}
-
-/**
- * e_tree_set_state:
- * @e_tree: #ETree object that will be modified
- * @state_str: a string with the XML representation of the #ETableState.
- *
- * This routine sets the state (as described by #ETableState) of the
- * #ETree object.
- */
-void
-e_tree_set_state (ETree *e_tree,
- const gchar *state_str)
-{
- ETableState *state;
-
- g_return_if_fail(e_tree != NULL);
- g_return_if_fail(E_IS_TREE(e_tree));
- g_return_if_fail(state_str != NULL);
-
- state = e_table_state_new();
- e_table_state_load_from_string(state, state_str);
-
- if (state->col_count > 0)
- e_tree_set_state_object(e_tree, state);
-
- gtk_object_unref(GTK_OBJECT(state));
-}
-
-/**
- * e_tree_load_state:
- * @e_tree: #ETree object that will be modified
- * @filename: name of the file containing the state to be loaded into the #ETree
- *
- * An #ETableState will be loaded form the file pointed by @filename into the
- * @e_tree object.
- */
-void
-e_tree_load_state (ETree *e_tree,
- const gchar *filename)
-{
- ETableState *state;
-
- g_return_if_fail(e_tree != NULL);
- g_return_if_fail(E_IS_TREE(e_tree));
- g_return_if_fail(filename != NULL);
-
- state = e_table_state_new();
- e_table_state_load_from_file(state, filename);
-
- if (state->col_count > 0)
- e_tree_set_state_object(e_tree, state);
-
- gtk_object_unref(GTK_OBJECT(state));
-}
-
-/**
- * e_tree_get_state_object:
- * @e_tree: #ETree object to act on
- *
- * Builds an #ETableState corresponding to the current state of the
- * #ETree.
- *
- * Return value:
- * The %ETableState object generated.
- **/
-ETableState *
-e_tree_get_state_object (ETree *e_tree)
-{
- ETableState *state;
- int full_col_count;
- int i, j;
-
- state = e_table_state_new();
- state->sort_info = e_tree->priv->sort_info;
- if (state->sort_info)
- gtk_object_ref(GTK_OBJECT(state->sort_info));
-
- state->col_count = e_table_header_count (e_tree->priv->header);
- full_col_count = e_table_header_count (e_tree->priv->full_header);
- state->columns = g_new(int, state->col_count);
- state->expansions = g_new(double, state->col_count);
- for (i = 0; i < state->col_count; i++) {
- ETableCol *col = e_table_header_get_column(e_tree->priv->header, i);
- state->columns[i] = -1;
- for (j = 0; j < full_col_count; j++) {
- if (col->col_idx == e_table_header_index(e_tree->priv->full_header, j)) {
- state->columns[i] = j;
- break;
- }
- }
- state->expansions[i] = col->expansion;
- }
-
- return state;
-}
-
-/**
- * e_tree_get_state:
- * @e_tree: The #ETree to act on
- *
- * Builds a state object based on the current state and returns the
- * string corresponding to that state.
- *
- * Return value:
- * A string describing the current state of the #ETree.
- **/
-gchar *
-e_tree_get_state (ETree *e_tree)
-{
- ETableState *state;
- gchar *string;
-
- state = e_tree_get_state_object(e_tree);
- string = e_table_state_save_to_string(state);
- gtk_object_unref(GTK_OBJECT(state));
- return string;
-}
-
-/**
- * e_tree_save_state:
- * @e_tree: The #ETree to act on
- * @filename: name of the file to save to
- *
- * Saves the state of the @e_tree object into the file pointed by
- * @filename.
- **/
-void
-e_tree_save_state (ETree *e_tree,
- const gchar *filename)
-{
- ETableState *state;
-
- state = e_tree_get_state_object(e_tree);
- e_table_state_save_to_file(state, filename);
- gtk_object_unref(GTK_OBJECT(state));
-}
-
-/**
- * e_tree_get_spec:
- * @e_tree: The #ETree to query
- *
- * Returns the specification object.
- *
- * Return value:
- **/
-ETableSpecification *
-e_tree_get_spec (ETree *e_tree)
-{
- return e_tree->priv->spec;
-}
-
-static void
-et_table_model_changed (ETableModel *model, ETree *et)
-{
- if (et->priv->horizontal_scrolling)
- e_table_header_update_horizontal(et->priv->header);
-}
-
-static void
-et_table_row_changed (ETableModel *table_model, int row, ETree *et)
-{
- et_table_model_changed (table_model, et);
-}
-
-static void
-et_table_cell_changed (ETableModel *table_model, int view_col, int row, ETree *et)
-{
- et_table_model_changed (table_model, et);
-}
-
-static void
-et_table_rows_inserted (ETableModel *table_model, int row, int count, ETree *et)
-{
- et_table_model_changed (table_model, et);
-}
-
-static void
-et_table_rows_deleted (ETableModel *table_model, int row, int count, ETree *et)
-{
- et_table_model_changed (table_model, et);
-}
-
-static void
-et_connect_to_etta (ETree *et)
-{
- et->priv->table_model_change_id = gtk_signal_connect (GTK_OBJECT (et->priv->etta), "model_changed",
- GTK_SIGNAL_FUNC (et_table_model_changed), et);
-
- et->priv->table_row_change_id = gtk_signal_connect (GTK_OBJECT (et->priv->etta), "model_row_changed",
- GTK_SIGNAL_FUNC (et_table_row_changed), et);
-
- et->priv->table_cell_change_id = gtk_signal_connect (GTK_OBJECT (et->priv->etta), "model_cell_changed",
- GTK_SIGNAL_FUNC (et_table_cell_changed), et);
-
- et->priv->table_rows_inserted_id = gtk_signal_connect (GTK_OBJECT (et->priv->etta), "model_rows_inserted",
- GTK_SIGNAL_FUNC (et_table_rows_inserted), et);
-
- et->priv->table_rows_deleted_id = gtk_signal_connect (GTK_OBJECT (et->priv->etta), "model_rows_deleted",
- GTK_SIGNAL_FUNC (et_table_rows_deleted), et);
-
-}
-
-static ETree *
-et_real_construct (ETree *e_tree, ETreeModel *etm, ETableExtras *ete,
- ETableSpecification *specification, ETableState *state)
-{
- int row = 0;
- int i, col_count;
-
- if (ete)
- gtk_object_ref(GTK_OBJECT(ete));
- else
- ete = e_table_extras_new();
-
- e_tree->priv->alternating_row_colors = specification->alternating_row_colors;
- e_tree->priv->horizontal_draw_grid = specification->horizontal_draw_grid;
- e_tree->priv->vertical_draw_grid = specification->vertical_draw_grid;
- e_tree->priv->draw_focus = specification->draw_focus;
- e_tree->priv->cursor_mode = specification->cursor_mode;
- e_tree->priv->full_header = e_table_spec_to_full_header(specification, ete);
-
- col_count = e_table_header_count (e_tree->priv->full_header);
- for (i = 0; i < col_count; i++) {
- ETableCol *col = e_table_header_get_column(e_tree->priv->full_header, i);
- if (col && col->search) {
- e_tree->priv->current_search_col = col->col_idx;
- e_tree->priv->current_search = col->search;
- break;
- }
- }
-
- connect_header (e_tree, state);
- e_tree->priv->horizontal_scrolling = specification->horizontal_scrolling;
-
- e_tree->priv->model = etm;
- gtk_object_ref (GTK_OBJECT (etm));
-
- e_tree->priv->sorted = e_tree_sorted_new(etm, e_tree->priv->full_header, e_tree->priv->sort_info);
-
- e_tree->priv->etta = E_TREE_TABLE_ADAPTER(e_tree_table_adapter_new(E_TREE_MODEL(e_tree->priv->sorted)));
-
- et_connect_to_etta (e_tree);
-
- gtk_widget_push_visual (gdk_rgb_get_visual ());
- gtk_widget_push_colormap (gdk_rgb_get_cmap ());
-
- e_tree->priv->sorter = e_sorter_new();
-
- gtk_object_set (GTK_OBJECT (e_tree->priv->selection),
- "sorter", e_tree->priv->sorter,
-#ifdef E_TREE_USE_TREE_SELECTION
- "model", e_tree->priv->model,
- "ets", e_tree->priv->sorted,
- "etta", e_tree->priv->etta,
-#else
- "model", e_tree->priv->etta,
-#endif
- "selection_mode", specification->selection_mode,
- "cursor_mode", specification->cursor_mode,
- NULL);
-
- gtk_signal_connect(GTK_OBJECT(e_tree->priv->selection), "selection_changed",
- GTK_SIGNAL_FUNC(et_selection_model_selection_changed), e_tree);
- gtk_signal_connect(GTK_OBJECT(e_tree->priv->selection), "selection_row_changed",
- GTK_SIGNAL_FUNC(et_selection_model_selection_row_changed), e_tree);
-
- if (!specification->no_headers) {
- e_tree_setup_header (e_tree);
- }
- e_tree_setup_table (e_tree);
-
- gtk_layout_get_vadjustment (GTK_LAYOUT (e_tree->priv->table_canvas))->step_increment = 20;
- gtk_adjustment_changed(gtk_layout_get_vadjustment (GTK_LAYOUT (e_tree->priv->table_canvas)));
- gtk_layout_get_hadjustment (GTK_LAYOUT (e_tree->priv->table_canvas))->step_increment = 20;
- gtk_adjustment_changed(gtk_layout_get_hadjustment (GTK_LAYOUT (e_tree->priv->table_canvas)));
-
- if (!specification->no_headers) {
- /*
- * The header
- */
- gtk_table_attach (GTK_TABLE (e_tree), GTK_WIDGET (e_tree->priv->header_canvas),
- 0, 1, 0 + row, 1 + row,
- GTK_FILL | GTK_EXPAND,
- GTK_FILL, 0, 0);
- row ++;
- }
- gtk_table_attach (GTK_TABLE (e_tree), GTK_WIDGET (e_tree->priv->table_canvas),
- 0, 1, 0 + row, 1 + row,
- GTK_FILL | GTK_EXPAND,
- GTK_FILL | GTK_EXPAND,
- 0, 0);
-
- gtk_widget_pop_colormap ();
- gtk_widget_pop_visual ();
-
- gtk_object_unref(GTK_OBJECT(ete));
-
- return e_tree;
-}
-
-/**
- * e_tree_construct:
- * @e_tree: The newly created #ETree object.
- * @etm: The model for this table.
- * @ete: An optional #ETableExtras. (%NULL is valid.)
- * @spec_str: The spec.
- * @state_str: An optional state. (%NULL is valid.)
- *
- * This is the internal implementation of e_tree_new() for use by
- * subclasses or language bindings. See e_tree_new() for details.
- *
- * Return value:
- * The passed in value @e_tree or %NULL if there's an error.
- **/
-ETree *
-e_tree_construct (ETree *e_tree, ETreeModel *etm, ETableExtras *ete,
- const char *spec_str, const char *state_str)
-{
- ETableSpecification *specification;
- ETableState *state;
-
- g_return_val_if_fail(e_tree != NULL, NULL);
- g_return_val_if_fail(E_IS_TREE(e_tree), NULL);
- g_return_val_if_fail(etm != NULL, NULL);
- g_return_val_if_fail(E_IS_TREE_MODEL(etm), NULL);
- g_return_val_if_fail(ete == NULL || E_IS_TABLE_EXTRAS(ete), NULL);
- g_return_val_if_fail(spec_str != NULL, NULL);
-
- specification = e_table_specification_new();
- e_table_specification_load_from_string(specification, spec_str);
- if (state_str) {
- state = e_table_state_new();
- e_table_state_load_from_string(state, state_str);
- if (state->col_count <= 0) {
- gtk_object_unref(GTK_OBJECT(state));
- state = specification->state;
- gtk_object_ref(GTK_OBJECT(state));
- }
- } else {
- state = specification->state;
- gtk_object_ref(GTK_OBJECT(state));
- }
-
- e_tree = et_real_construct (e_tree, etm, ete, specification, state);
-
- e_tree->priv->spec = specification;
- gtk_object_unref(GTK_OBJECT(state));
-
- return e_tree;
-}
-
-/**
- * e_tree_construct_from_spec_file:
- * @e_tree: The newly created #ETree object.
- * @etm: The model for this tree
- * @ete: An optional #ETableExtras (%NULL is valid.)
- * @spec_fn: The filename of the spec
- * @state_fn: An optional state file (%NULL is valid.)
- *
- * This is the internal implementation of e_tree_new_from_spec_file()
- * for use by subclasses or language bindings. See
- * e_tree_new_from_spec_file() for details.
- *
- * Return value:
- * The passed in value @e_tree or %NULL if there's an error.
- **/
-ETree *
-e_tree_construct_from_spec_file (ETree *e_tree, ETreeModel *etm, ETableExtras *ete,
- const char *spec_fn, const char *state_fn)
-{
- ETableSpecification *specification;
- ETableState *state;
-
- g_return_val_if_fail(e_tree != NULL, NULL);
- g_return_val_if_fail(E_IS_TREE(e_tree), NULL);
- g_return_val_if_fail(etm != NULL, NULL);
- g_return_val_if_fail(E_IS_TREE_MODEL(etm), NULL);
- g_return_val_if_fail(ete == NULL || E_IS_TABLE_EXTRAS(ete), NULL);
- g_return_val_if_fail(spec_fn != NULL, NULL);
-
- specification = e_table_specification_new();
- if (!e_table_specification_load_from_file(specification, spec_fn)) {
- gtk_object_unref(GTK_OBJECT(specification));
- return NULL;
- }
-
- if (state_fn) {
- state = e_table_state_new();
- if (!e_table_state_load_from_file(state, state_fn)) {
- gtk_object_unref(GTK_OBJECT(state));
- state = specification->state;
- gtk_object_ref(GTK_OBJECT(state));
- }
- if (state->col_count <= 0) {
- gtk_object_unref(GTK_OBJECT(state));
- state = specification->state;
- gtk_object_ref(GTK_OBJECT(state));
- }
- } else {
- state = specification->state;
- gtk_object_ref(GTK_OBJECT(state));
- }
-
- e_tree = et_real_construct (e_tree, etm, ete, specification, state);
-
- e_tree->priv->spec = specification;
- gtk_object_unref(GTK_OBJECT(state));
-
- return e_tree;
-}
-
-/**
- * e_tree_new:
- * @etm: The model for this tree
- * @ete: An optional #ETableExtras (%NULL is valid.)
- * @spec: The spec
- * @state: An optional state (%NULL is valid.)
- *
- * This function creates an #ETree from the given parameters. The
- * #ETreeModel is a tree model to be represented. The #ETableExtras
- * is an optional set of pixbufs, cells, and sorting functions to be
- * used when interpreting the spec. If you pass in %NULL it uses the
- * default #ETableExtras. (See e_table_extras_new()).
- *
- * @spec is the specification of the set of viewable columns and the
- * default sorting state and such. @state is an optional string
- * specifying the current sorting state and such. If @state is NULL,
- * then the default state from the spec will be used.
- *
- * Return value:
- * The newly created #ETree or %NULL if there's an error.
- **/
-GtkWidget *
-e_tree_new (ETreeModel *etm, ETableExtras *ete, const char *spec, const char *state)
-{
- ETree *e_tree, *ret_val;
-
- g_return_val_if_fail(etm != NULL, NULL);
- g_return_val_if_fail(E_IS_TREE_MODEL(etm), NULL);
- g_return_val_if_fail(ete == NULL || E_IS_TABLE_EXTRAS(ete), NULL);
- g_return_val_if_fail(spec != NULL, NULL);
-
- e_tree = gtk_type_new (e_tree_get_type ());
-
- ret_val = e_tree_construct (e_tree, etm, ete, spec, state);
-
- if (ret_val == NULL) {
- gtk_object_unref (GTK_OBJECT (e_tree));
- }
-
- return (GtkWidget *) ret_val;
-}
-
-/**
- * e_tree_new_from_spec_file:
- * @etm: The model for this tree.
- * @ete: An optional #ETableExtras. (%NULL is valid.)
- * @spec_fn: The filename of the spec.
- * @state_fn: An optional state file. (%NULL is valid.)
- *
- * This is very similar to e_tree_new(), except instead of passing in
- * strings you pass in the file names of the spec and state to load.
- *
- * @spec_fn is the filename of the spec to load. If this file doesn't
- * exist, e_tree_new_from_spec_file will return %NULL.
- *
- * @state_fn is the filename of the initial state to load. If this is
- * %NULL or if the specified file doesn't exist, the default state
- * from the spec file is used.
- *
- * Return value:
- * The newly created #ETree or %NULL if there's an error.
- **/
-GtkWidget *
-e_tree_new_from_spec_file (ETreeModel *etm, ETableExtras *ete, const char *spec_fn, const char *state_fn)
-{
- ETree *e_tree, *ret_val;
-
- g_return_val_if_fail(etm != NULL, NULL);
- g_return_val_if_fail(E_IS_TREE_MODEL(etm), NULL);
- g_return_val_if_fail(ete == NULL || E_IS_TABLE_EXTRAS(ete), NULL);
- g_return_val_if_fail(spec_fn != NULL, NULL);
-
- e_tree = gtk_type_new (e_tree_get_type ());
-
- ret_val = e_tree_construct_from_spec_file (e_tree, etm, ete, spec_fn, state_fn);
-
- if (ret_val == NULL) {
- gtk_object_unref (GTK_OBJECT (e_tree));
- }
-
- return (GtkWidget *) ret_val;
-}
-
-void
-e_tree_set_cursor (ETree *e_tree, ETreePath path)
-{
-#ifndef E_TREE_USE_TREE_SELECTION
- int row;
-#endif
- g_return_if_fail(e_tree != NULL);
- g_return_if_fail(E_IS_TREE(e_tree));
- g_return_if_fail(path != NULL);
-
-#ifdef E_TREE_USE_TREE_SELECTION
- e_tree_selection_model_select_single_path (E_TREE_SELECTION_MODEL(e_tree->priv->selection), path);
- e_tree_selection_model_change_cursor (E_TREE_SELECTION_MODEL(e_tree->priv->selection), path);
-#else
- path = e_tree_sorted_model_to_view_path(e_tree->priv->sorted, path);
-
- row = e_tree_table_adapter_row_of_node(E_TREE_TABLE_ADAPTER(e_tree->priv->etta), path);
-
- if (row == -1)
- return;
-
- gtk_object_set(GTK_OBJECT(e_tree->priv->selection),
- "cursor_row", row,
- NULL);
-#endif
-}
-
-ETreePath
-e_tree_get_cursor (ETree *e_tree)
-{
-#ifdef E_TREE_USE_TREE_SELECTION
- return e_tree_selection_model_get_cursor (E_TREE_SELECTION_MODEL(e_tree->priv->selection));
-#else
- int row;
- ETreePath path;
- g_return_val_if_fail(e_tree != NULL, NULL);
- g_return_val_if_fail(E_IS_TREE(e_tree), NULL);
-
- gtk_object_get(GTK_OBJECT(e_tree->priv->selection),
- "cursor_row", &row,
- NULL);
- if (row == -1)
- return NULL;
- path = e_tree_table_adapter_node_at_row(E_TREE_TABLE_ADAPTER(e_tree->priv->etta), row);
- path = e_tree_sorted_view_to_model_path(e_tree->priv->sorted, path);
- return path;
-#endif
-}
-
-void
-e_tree_selected_row_foreach (ETree *e_tree,
- EForeachFunc callback,
- gpointer closure)
-{
- g_return_if_fail(e_tree != NULL);
- g_return_if_fail(E_IS_TREE(e_tree));
-
- e_selection_model_foreach(e_tree->priv->selection,
- callback,
- closure);
-}
-
-#ifdef E_TREE_USE_TREE_SELECTION
-void
-e_tree_selected_path_foreach (ETree *e_tree,
- ETreeForeachFunc callback,
- gpointer closure)
-{
- g_return_if_fail(e_tree != NULL);
- g_return_if_fail(E_IS_TREE(e_tree));
-
- e_tree_selection_model_foreach(E_TREE_SELECTION_MODEL (e_tree->priv->selection),
- callback,
- closure);
-}
-#endif
-
-EPrintable *
-e_tree_get_printable (ETree *e_tree)
-{
- g_return_val_if_fail(e_tree != NULL, NULL);
- g_return_val_if_fail(E_IS_TREE(e_tree), NULL);
-
- return e_table_item_get_printable(E_TABLE_ITEM(e_tree->priv->item));
-}
-
-static void
-et_get_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- ETree *etree = E_TREE (o);
-
- switch (arg_id){
- case ARG_ETTA:
- if (etree->priv->item) {
- GTK_VALUE_OBJECT (*arg) = GTK_OBJECT (etree->priv->etta);
- }
- break;
- case ARG_UNIFORM_ROW_HEIGHT:
- GTK_VALUE_BOOL (*arg) = etree->priv->uniform_row_height;
- break;
-
- default:
- break;
- }
-}
-
-typedef struct {
- char *arg;
- gboolean setting;
-} bool_closure;
-
-static void
-et_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- ETree *etree = E_TREE (o);
-
- switch (arg_id){
- case ARG_LENGTH_THRESHOLD:
- etree->priv->length_threshold = GTK_VALUE_INT (*arg);
- if (etree->priv->item) {
- gnome_canvas_item_set (GNOME_CANVAS_ITEM(etree->priv->item),
- "length_threshold", GTK_VALUE_INT (*arg),
- NULL);
- }
- break;
-
- case ARG_HORIZONTAL_DRAW_GRID:
- etree->priv->horizontal_draw_grid = GTK_VALUE_BOOL (*arg);
- if (etree->priv->item) {
- gnome_canvas_item_set (GNOME_CANVAS_ITEM(etree->priv->item),
- "horizontal_draw_grid", GTK_VALUE_BOOL (*arg),
- NULL);
- }
- break;
-
- case ARG_VERTICAL_DRAW_GRID:
- etree->priv->vertical_draw_grid = GTK_VALUE_BOOL (*arg);
- if (etree->priv->item) {
- gnome_canvas_item_set (GNOME_CANVAS_ITEM(etree->priv->item),
- "vertical_draw_grid", GTK_VALUE_BOOL (*arg),
- NULL);
- }
- break;
-
- case ARG_DRAW_FOCUS:
- etree->priv->draw_focus = GTK_VALUE_BOOL (*arg);
- if (etree->priv->item) {
- gnome_canvas_item_set (GNOME_CANVAS_ITEM(etree->priv->item),
- "draw_focus", GTK_VALUE_BOOL (*arg),
- NULL);
- }
- break;
-
- case ARG_UNIFORM_ROW_HEIGHT:
- etree->priv->uniform_row_height = GTK_VALUE_BOOL (*arg);
- if (etree->priv->item) {
- gnome_canvas_item_set (GNOME_CANVAS_ITEM(etree->priv->item),
- "uniform_row_height", GTK_VALUE_BOOL (*arg),
- NULL);
- }
- break;
- }
-}
-
-static void
-set_scroll_adjustments (ETree *tree,
- GtkAdjustment *hadjustment,
- GtkAdjustment *vadjustment)
-{
- if (vadjustment != NULL) {
- vadjustment->step_increment = 20;
- gtk_adjustment_changed(vadjustment);
- }
- if (hadjustment != NULL) {
- hadjustment->step_increment = 20;
- gtk_adjustment_changed(hadjustment);
- }
-
- gtk_layout_set_hadjustment (GTK_LAYOUT(tree->priv->table_canvas),
- hadjustment);
- gtk_layout_set_vadjustment (GTK_LAYOUT(tree->priv->table_canvas),
- vadjustment);
-
- if (tree->priv->header_canvas != NULL)
- gtk_layout_set_hadjustment (GTK_LAYOUT(tree->priv->header_canvas),
- hadjustment);
-}
-
-gint
-e_tree_get_next_row (ETree *e_tree,
- gint model_row)
-{
- g_return_val_if_fail(e_tree != NULL, -1);
- g_return_val_if_fail(E_IS_TREE(e_tree), -1);
-
- if (e_tree->priv->sorter) {
- int i;
- i = e_sorter_model_to_sorted(E_SORTER (e_tree->priv->sorter), model_row);
- i++;
- if (i < e_table_model_row_count(E_TABLE_MODEL(e_tree->priv->etta))) {
- return e_sorter_sorted_to_model(E_SORTER (e_tree->priv->sorter), i);
- } else
- return -1;
- } else
- if (model_row < e_table_model_row_count(E_TABLE_MODEL(e_tree->priv->etta)) - 1)
- return model_row + 1;
- else
- return -1;
-}
-
-gint
-e_tree_get_prev_row (ETree *e_tree,
- gint model_row)
-{
- g_return_val_if_fail(e_tree != NULL, -1);
- g_return_val_if_fail(E_IS_TREE(e_tree), -1);
-
- if (e_tree->priv->sorter) {
- int i;
- i = e_sorter_model_to_sorted(E_SORTER (e_tree->priv->sorter), model_row);
- i--;
- if (i >= 0)
- return e_sorter_sorted_to_model(E_SORTER (e_tree->priv->sorter), i);
- else
- return -1;
- } else
- return model_row - 1;
-}
-
-gint
-e_tree_model_to_view_row (ETree *e_tree,
- gint model_row)
-{
- g_return_val_if_fail(e_tree != NULL, -1);
- g_return_val_if_fail(E_IS_TREE(e_tree), -1);
-
- if (e_tree->priv->sorter)
- return e_sorter_model_to_sorted(E_SORTER (e_tree->priv->sorter), model_row);
- else
- return model_row;
-}
-
-gint
-e_tree_view_to_model_row (ETree *e_tree,
- gint view_row)
-{
- g_return_val_if_fail(e_tree != NULL, -1);
- g_return_val_if_fail(E_IS_TREE(e_tree), -1);
-
- if (e_tree->priv->sorter)
- return e_sorter_sorted_to_model (E_SORTER (e_tree->priv->sorter), view_row);
- else
- return view_row;
-}
-
-
-gboolean
-e_tree_node_is_expanded (ETree *et, ETreePath path)
-{
- path = e_tree_sorted_model_to_view_path(et->priv->sorted, path);
-
- g_return_val_if_fail(path, FALSE);
-
- return e_tree_table_adapter_node_is_expanded (et->priv->etta, path);
-}
-
-void
-e_tree_node_set_expanded (ETree *et, ETreePath path, gboolean expanded)
-{
- g_return_if_fail (et != NULL);
- g_return_if_fail (E_IS_TREE(et));
-
- path = e_tree_sorted_model_to_view_path(et->priv->sorted, path);
-
- e_tree_table_adapter_node_set_expanded (et->priv->etta, path, expanded);
-}
-
-void
-e_tree_node_set_expanded_recurse (ETree *et, ETreePath path, gboolean expanded)
-{
- g_return_if_fail (et != NULL);
- g_return_if_fail (E_IS_TREE(et));
-
- path = e_tree_sorted_model_to_view_path(et->priv->sorted, path);
-
- e_tree_table_adapter_node_set_expanded_recurse (et->priv->etta, path, expanded);
-}
-
-void
-e_tree_root_node_set_visible (ETree *et, gboolean visible)
-{
- g_return_if_fail (et != NULL);
- g_return_if_fail (E_IS_TREE(et));
-
- e_tree_table_adapter_root_node_set_visible (et->priv->etta, visible);
-}
-
-ETreePath
-e_tree_node_at_row (ETree *et, int row)
-{
- ETreePath path;
-
- path = e_tree_table_adapter_node_at_row (et->priv->etta, row);
- path = e_tree_sorted_view_to_model_path(et->priv->sorted, path);
-
- return path;
-}
-
-int
-e_tree_row_of_node (ETree *et, ETreePath path)
-{
- path = e_tree_sorted_model_to_view_path(et->priv->sorted, path);
- return e_tree_table_adapter_row_of_node (et->priv->etta, path);
-}
-
-gboolean
-e_tree_root_node_is_visible(ETree *et)
-{
- return e_tree_table_adapter_root_node_is_visible (et->priv->etta);
-}
-
-void
-e_tree_show_node (ETree *et, ETreePath path)
-{
- g_return_if_fail (et != NULL);
- g_return_if_fail (E_IS_TREE(et));
-
- path = e_tree_sorted_model_to_view_path(et->priv->sorted, path);
-
- e_tree_table_adapter_show_node (et->priv->etta, path);
-}
-
-void
-e_tree_save_expanded_state (ETree *et, char *filename)
-{
- g_return_if_fail (et != NULL);
- g_return_if_fail (E_IS_TREE(et));
-
- e_tree_table_adapter_save_expanded_state (et->priv->etta, filename);
-}
-
-void
-e_tree_load_expanded_state (ETree *et, char *filename)
-{
- e_tree_table_adapter_load_expanded_state (et->priv->etta, filename);
-}
-
-gint
-e_tree_row_count (ETree *et)
-{
- return e_table_model_row_count (E_TABLE_MODEL(et->priv->etta));
-}
-
-GtkWidget *
-e_tree_get_tooltip (ETree *et)
-{
- return E_CANVAS(et->priv->table_canvas)->tooltip_window;
-}
-
-typedef struct {
- ETreePathFunc func;
- gpointer data;
- ETree *et;
-} FindNextCallback;
-
-static gboolean
-find_next_callback (ETreeModel *model, ETreePath path, gpointer data)
-{
- FindNextCallback *cb_data = data;
- ETree *et = cb_data->et;
-
- path = e_tree_sorted_view_to_model_path(et->priv->sorted, path);
-
- return cb_data->func (et->priv->model, path, cb_data->data);
-}
-
-gboolean
-e_tree_find_next (ETree *et, ETreeFindNextParams params, ETreePathFunc func, gpointer data)
-{
- ETreePath cursor;
- ETreePath found;
- FindNextCallback cb_data;
-
- cb_data.func = func;
- cb_data.data = data;
- cb_data.et = et;
-
- cursor = e_tree_get_cursor (et);
- cursor = e_tree_sorted_model_to_view_path (et->priv->sorted, cursor);
-
- found = e_tree_model_node_find (E_TREE_MODEL (et->priv->sorted), cursor, NULL, params & E_TREE_FIND_NEXT_FORWARD, find_next_callback, &cb_data);
-
- if (found) {
- e_tree_table_adapter_show_node (et->priv->etta, found);
- cursor = e_tree_sorted_view_to_model_path (et->priv->sorted, found);
- e_tree_set_cursor (et, cursor);
- return TRUE;
- }
-
- if (params & E_TREE_FIND_NEXT_WRAP) {
- found = e_tree_model_node_find (E_TREE_MODEL (et->priv->sorted), NULL, cursor, params & E_TREE_FIND_NEXT_FORWARD, find_next_callback, &cb_data);
-
- if (found && found != cursor) {
- e_tree_table_adapter_show_node (et->priv->etta, found);
- cursor = e_tree_sorted_view_to_model_path (et->priv->sorted, found);
- e_tree_set_cursor (et, cursor);
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-void
-e_tree_right_click_up (ETree *et)
-{
- e_selection_model_right_click_up(et->priv->selection);
-}
-
-/**
- * e_tree_get_model:
- * @et: the ETree
- *
- * Returns the model upon which this ETree is based.
- *
- * Returns: the model
- **/
-ETreeModel *
-e_tree_get_model (ETree *et)
-{
- g_return_val_if_fail (et != NULL, NULL);
- g_return_val_if_fail (E_IS_TREE (et), NULL);
-
- return et->priv->model;
-}
-
-/**
- * e_tree_get_selection_model:
- * @et: the ETree
- *
- * Returns the selection model of this ETree.
- *
- * Returns: the selection model
- **/
-ESelectionModel *
-e_tree_get_selection_model (ETree *et)
-{
- g_return_val_if_fail (et != NULL, NULL);
- g_return_val_if_fail (E_IS_TREE (et), NULL);
-
- return et->priv->selection;
-}
-
-
-struct _ETreeDragSourceSite
-{
- GdkModifierType start_button_mask;
- GtkTargetList *target_list; /* Targets for drag data */
- GdkDragAction actions; /* Possible actions */
- GdkColormap *colormap; /* Colormap for drag icon */
- GdkPixmap *pixmap; /* Icon for drag data */
- GdkBitmap *mask;
-
- /* Stored button press information to detect drag beginning */
- gint state;
- gint x, y;
- gint row, col;
-};
-
-typedef enum
-{
- GTK_DRAG_STATUS_DRAG,
- GTK_DRAG_STATUS_WAIT,
- GTK_DRAG_STATUS_DROP
-} GtkDragStatus;
-
-typedef struct _GtkDragDestInfo GtkDragDestInfo;
-typedef struct _GtkDragSourceInfo GtkDragSourceInfo;
-
-struct _GtkDragDestInfo
-{
- GtkWidget *widget; /* Widget in which drag is in */
- GdkDragContext *context; /* Drag context */
- GtkDragSourceInfo *proxy_source; /* Set if this is a proxy drag */
- GtkSelectionData *proxy_data; /* Set while retrieving proxied data */
- gboolean dropped : 1; /* Set after we receive a drop */
- guint32 proxy_drop_time; /* Timestamp for proxied drop */
- gboolean proxy_drop_wait : 1; /* Set if we are waiting for a
- * status reply before sending
- * a proxied drop on.
- */
- gint drop_x, drop_y; /* Position of drop */
-};
-
-struct _GtkDragSourceInfo
-{
- GtkWidget *widget;
- GtkTargetList *target_list; /* Targets for drag data */
- GdkDragAction possible_actions; /* Actions allowed by source */
- GdkDragContext *context; /* drag context */
- GtkWidget *icon_window; /* Window for drag */
- GtkWidget *ipc_widget; /* GtkInvisible for grab, message passing */
- GdkCursor *cursor; /* Cursor for drag */
- gint hot_x, hot_y; /* Hot spot for drag */
- gint button; /* mouse button starting drag */
-
- GtkDragStatus status; /* drag status */
- GdkEvent *last_event; /* motion event waiting for response */
-
- gint start_x, start_y; /* Initial position */
- gint cur_x, cur_y; /* Current Position */
-
- GList *selections; /* selections we've claimed */
-
- GtkDragDestInfo *proxy_dest; /* Set if this is a proxy drag */
-
- guint drop_timeout; /* Timeout for aborting drop */
- guint destroy_icon : 1; /* If true, destroy icon_window
- */
-};
-
-/* Drag & drop stuff. */
-/* Target */
-
-void
-e_tree_drag_get_data (ETree *tree,
- int row,
- int col,
- GdkDragContext *context,
- GdkAtom target,
- guint32 time)
-{
- ETreePath path;
- g_return_if_fail(tree != NULL);
- g_return_if_fail(E_IS_TREE(tree));
-
- path = e_tree_table_adapter_node_at_row(tree->priv->etta, row);
- path = e_tree_sorted_view_to_model_path(tree->priv->sorted, path);
-
- gtk_drag_get_data(GTK_WIDGET(tree),
- context,
- target,
- time);
-
-}
-
-#if 0
-static void
-e_tree_request_hightlight_redraw (ETree *tree)
-{
- int row = tree->drop_highlight_row;
- int col = tree->drop_highlight_col;
-
- if (row != -1) {
- int x, y, width, height;
- if (col == -1) {
- e_tree_get_cell_geometry (tree, row, 0, &x, &y, &width, &height);
- x = 0;
- width = tree->allocation.width;
- } else {
- e_tree_get_cell_geometry (tree, row, col, &x, &y, &width, &height);
- x += GTK_LAYOUT(tree->priv->table_canvas)->hadjustment->value;
- }
- y += GTK_LAYOUT(tree->priv->table_canvas)->vadjustment->value;
- gnome_canvas_request_redraw (tree->priv->table_canvas, x, y, x + width - 1, y + height - 1);
- }
-}
-#endif
-
-/**
- * e_tree_drag_highlight:
- * @tree:
- * @row:
- * @col:
- *
- * Set col to -1 to highlight the entire row.
- * Set row to -1 to turn off the highlight.
- */
-void
-e_tree_drag_highlight (ETree *tree,
- int row,
- int col)
-{
- g_return_if_fail(tree != NULL);
- g_return_if_fail(E_IS_TREE(tree));
-
- if (row != -1) {
- int x, y, width, height;
- if (col == -1) {
- e_tree_get_cell_geometry (tree, row, 0, &x, &y, &width, &height);
- x = 0;
- width = GTK_WIDGET (tree->priv->table_canvas)->allocation.width;
- } else {
- e_tree_get_cell_geometry (tree, row, col, &x, &y, &width, &height);
- x += GTK_LAYOUT(tree->priv->table_canvas)->hadjustment->value;
- }
- y += GTK_LAYOUT(tree->priv->table_canvas)->vadjustment->value;
-
- if (tree->priv->drop_highlight == NULL) {
- tree->priv->drop_highlight =
- gnome_canvas_item_new (gnome_canvas_root (tree->priv->table_canvas),
- gnome_canvas_rect_get_type (),
- "fill_color", NULL,
- /* "outline_color", "black",
- "width_pixels", 1,*/
- "outline_color_gdk", &(GTK_WIDGET (tree)->style->fg[GTK_STATE_NORMAL]),
- NULL);
- }
- gnome_canvas_item_set (tree->priv->drop_highlight,
- "x1", (double) x,
- "x2", (double) x + width - 1,
- "y1", (double) y,
- "y2", (double) y + height - 1,
- NULL);
- } else {
- gtk_object_destroy (GTK_OBJECT (tree->priv->drop_highlight));
- tree->priv->drop_highlight = NULL;
- }
-}
-
-void
-e_tree_drag_unhighlight (ETree *tree)
-{
- g_return_if_fail(tree != NULL);
- g_return_if_fail(E_IS_TREE(tree));
-
- if (tree->priv->drop_highlight) {
- gtk_object_destroy (GTK_OBJECT (tree->priv->drop_highlight));
- tree->priv->drop_highlight = NULL;
- }
-}
-
-void e_tree_drag_dest_set (ETree *tree,
- GtkDestDefaults flags,
- const GtkTargetEntry *targets,
- gint n_targets,
- GdkDragAction actions)
-{
- g_return_if_fail(tree != NULL);
- g_return_if_fail(E_IS_TREE(tree));
-
- gtk_drag_dest_set(GTK_WIDGET(tree),
- flags,
- targets,
- n_targets,
- actions);
-}
-
-void e_tree_drag_dest_set_proxy (ETree *tree,
- GdkWindow *proxy_window,
- GdkDragProtocol protocol,
- gboolean use_coordinates)
-{
- g_return_if_fail(tree != NULL);
- g_return_if_fail(E_IS_TREE(tree));
-
- gtk_drag_dest_set_proxy(GTK_WIDGET(tree),
- proxy_window,
- protocol,
- use_coordinates);
-}
-
-/*
- * There probably should be functions for setting the targets
- * as a GtkTargetList
- */
-
-void
-e_tree_drag_dest_unset (GtkWidget *widget)
-{
- g_return_if_fail(widget != NULL);
- g_return_if_fail(E_IS_TREE(widget));
-
- gtk_drag_dest_unset(widget);
-}
-
-/* Source side */
-
-static gint
-et_real_start_drag (ETree *tree, int row, ETreePath path, int col, GdkEvent *event)
-{
- GtkDragSourceInfo *info;
- GdkDragContext *context;
- ETreeDragSourceSite *site;
-
- if (tree->priv->do_drag) {
- site = tree->priv->site;
-
- site->state = 0;
- context = e_tree_drag_begin (tree, row, col,
- site->target_list,
- site->actions,
- 1, event);
-
- if (context) {
- info = g_dataset_get_data (context, "gtk-info");
-
- if (info && !info->icon_window) {
- if (site->pixmap)
- gtk_drag_set_icon_pixmap (context,
- site->colormap,
- site->pixmap,
- site->mask, -2, -2);
- else
- gtk_drag_set_icon_default (context);
- }
- }
- return TRUE;
- }
- return FALSE;
-}
-
-void
-e_tree_drag_source_set (ETree *tree,
- GdkModifierType start_button_mask,
- const GtkTargetEntry *targets,
- gint n_targets,
- GdkDragAction actions)
-{
- ETreeDragSourceSite *site;
- GtkWidget *canvas;
-
- g_return_if_fail(tree != NULL);
- g_return_if_fail(E_IS_TREE(tree));
-
- canvas = GTK_WIDGET(tree->priv->table_canvas);
- site = tree->priv->site;
-
- tree->priv->do_drag = TRUE;
-
- gtk_widget_add_events (canvas,
- gtk_widget_get_events (canvas) |
- GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
- GDK_BUTTON_MOTION_MASK | GDK_STRUCTURE_MASK);
-
- if (site) {
- if (site->target_list)
- gtk_target_list_unref (site->target_list);
- } else {
- site = g_new0 (ETreeDragSourceSite, 1);
- tree->priv->site = site;
- }
-
- site->start_button_mask = start_button_mask;
-
- if (targets)
- site->target_list = gtk_target_list_new (targets, n_targets);
- else
- site->target_list = NULL;
-
- site->actions = actions;
-}
-
-void
-e_tree_drag_source_unset (ETree *tree)
-{
- ETreeDragSourceSite *site;
-
- g_return_if_fail (tree != NULL);
- g_return_if_fail (E_IS_TREE(tree));
-
- site = tree->priv->site;
-
- if (site) {
- g_free (site);
- tree->priv->site = NULL;
- }
-}
-
-/* There probably should be functions for setting the targets
- * as a GtkTargetList
- */
-
-GdkDragContext *
-e_tree_drag_begin (ETree *tree,
- int row,
- int col,
- GtkTargetList *targets,
- GdkDragAction actions,
- gint button,
- GdkEvent *event)
-{
- ETreePath path;
- g_return_val_if_fail (tree != NULL, NULL);
- g_return_val_if_fail (E_IS_TREE(tree), NULL);
-
- path = e_tree_table_adapter_node_at_row(tree->priv->etta, row);
- path = e_tree_sorted_view_to_model_path(tree->priv->sorted, path);
-
- tree->priv->drag_row = row;
- tree->priv->drag_path = path;
- tree->priv->drag_col = col;
-
- return gtk_drag_begin(GTK_WIDGET (tree->priv->table_canvas),
- targets,
- actions,
- button,
- event);
-}
-
-/**
- * e_tree_get_cell_at:
- * @tree: An ETree widget
- * @x: X coordinate for the pixel
- * @y: Y coordinate for the pixel
- * @row_return: Pointer to return the row value
- * @col_return: Pointer to return the column value
- *
- * Return the row and column for the cell in which the pixel at (@x, @y) is
- * contained.
- **/
-void
-e_tree_get_cell_at (ETree *tree,
- int x, int y,
- int *row_return, int *col_return)
-{
- g_return_if_fail (tree != NULL);
- g_return_if_fail (E_IS_TREE (tree));
- g_return_if_fail (row_return != NULL);
- g_return_if_fail (col_return != NULL);
-
- /* FIXME it would be nice if it could handle a NULL row_return or
- * col_return gracefully. */
-
- if (row_return)
- *row_return = -1;
- if (col_return)
- *col_return = -1;
-
- x += GTK_LAYOUT(tree->priv->table_canvas)->hadjustment->value;
- y += GTK_LAYOUT(tree->priv->table_canvas)->vadjustment->value;
- e_table_item_compute_location(E_TABLE_ITEM(tree->priv->item), &x, &y, row_return, col_return);
-}
-
-/**
- * e_tree_get_cell_geometry:
- * @tree: The tree.
- * @row: The row to get the geometry of.
- * @col: The col to get the geometry of.
- * @x_return: Returns the x coordinate of the upper right hand corner of the cell with respect to the widget.
- * @y_return: Returns the y coordinate of the upper right hand corner of the cell with respect to the widget.
- * @width_return: Returns the width of the cell.
- * @height_return: Returns the height of the cell.
- *
- * Computes the data about this cell.
- **/
-void
-e_tree_get_cell_geometry (ETree *tree,
- int row, int col,
- int *x_return, int *y_return,
- int *width_return, int *height_return)
-{
- g_return_if_fail (tree != NULL);
- g_return_if_fail (E_IS_TREE (tree));
- g_return_if_fail (row >= 0);
- g_return_if_fail (col >= 0);
-
- /* FIXME it would be nice if it could handle a NULL row_return or
- * col_return gracefully. */
-
- e_table_item_get_cell_geometry(E_TABLE_ITEM(tree->priv->item), &row, &col, x_return, y_return, width_return, height_return);
-
- if (x_return)
- (*x_return) -= GTK_LAYOUT(tree->priv->table_canvas)->hadjustment->value;
- if (y_return)
- (*y_return) -= GTK_LAYOUT(tree->priv->table_canvas)->vadjustment->value;
-}
-
-static void
-et_drag_begin (GtkWidget *widget,
- GdkDragContext *context,
- ETree *et)
-{
- gtk_signal_emit (GTK_OBJECT (et),
- et_signals [TREE_DRAG_BEGIN],
- et->priv->drag_row,
- et->priv->drag_path,
- et->priv->drag_col,
- context);
-}
-
-static void
-et_drag_end (GtkWidget *widget,
- GdkDragContext *context,
- ETree *et)
-{
- gtk_signal_emit (GTK_OBJECT (et),
- et_signals [TREE_DRAG_END],
- et->priv->drag_row,
- et->priv->drag_path,
- et->priv->drag_col,
- context);
-}
-
-static void
-et_drag_data_get(GtkWidget *widget,
- GdkDragContext *context,
- GtkSelectionData *selection_data,
- guint info,
- guint time,
- ETree *et)
-{
- gtk_signal_emit (GTK_OBJECT (et),
- et_signals [TREE_DRAG_DATA_GET],
- et->priv->drag_row,
- et->priv->drag_path,
- et->priv->drag_col,
- context,
- selection_data,
- info,
- time);
-}
-
-static void
-et_drag_data_delete(GtkWidget *widget,
- GdkDragContext *context,
- ETree *et)
-{
- gtk_signal_emit (GTK_OBJECT (et),
- et_signals [TREE_DRAG_DATA_DELETE],
- et->priv->drag_row,
- et->priv->drag_path,
- et->priv->drag_col,
- context);
-}
-
-static gboolean
-do_drag_motion(ETree *et,
- GdkDragContext *context,
- gint x,
- gint y,
- guint time)
-{
- gboolean ret_val = FALSE;
- int row, col;
- ETreePath path;
- GtkWidget *widget;
-
- widget = GTK_WIDGET (et);
-
- x -= widget->allocation.x;
- y -= widget->allocation.y;
- e_tree_get_cell_at (et,
- x,
- y,
- &row,
- &col);
- if (row != et->priv->drop_row && col != et->priv->drop_col) {
- gtk_signal_emit (GTK_OBJECT (et),
- et_signals [TREE_DRAG_LEAVE],
- et->priv->drop_row,
- et->priv->drop_path,
- et->priv->drop_col,
- context,
- time);
- }
-
- path = e_tree_table_adapter_node_at_row(et->priv->etta, row);
- path = e_tree_sorted_view_to_model_path(et->priv->sorted, path);
-
- et->priv->drop_row = row;
- et->priv->drop_path = path;
- et->priv->drop_col = col;
- gtk_signal_emit (GTK_OBJECT (et),
- et_signals [TREE_DRAG_MOTION],
- et->priv->drop_row,
- et->priv->drop_path,
- et->priv->drop_col,
- context,
- x,
- y,
- time,
- &ret_val);
-
- return ret_val;
-}
-
-static gboolean
-scroll_timeout (gpointer data)
-{
- ETree *et = data;
- int dx = 0, dy = 0;
- GtkAdjustment *v, *h;
- double vvalue, hvalue;
-
- if (et->priv->scroll_direction & ET_SCROLL_DOWN)
- dy += 20;
- if (et->priv->scroll_direction & ET_SCROLL_UP)
- dy -= 20;
-
- if (et->priv->scroll_direction & ET_SCROLL_RIGHT)
- dx += 20;
- if (et->priv->scroll_direction & ET_SCROLL_LEFT)
- dx -= 20;
-
- h = GTK_LAYOUT(et->priv->table_canvas)->hadjustment;
- v = GTK_LAYOUT(et->priv->table_canvas)->vadjustment;
-
- hvalue = h->value;
- vvalue = v->value;
-
- gtk_adjustment_set_value(h, CLAMP(h->value + dx, h->lower, h->upper - h->page_size));
- gtk_adjustment_set_value(v, CLAMP(v->value + dy, v->lower, v->upper - v->page_size));
-
- if (h->value != hvalue ||
- v->value != vvalue)
- do_drag_motion(et,
- et->priv->last_drop_context,
- et->priv->last_drop_x,
- et->priv->last_drop_y,
- et->priv->last_drop_time);
-
-
- return TRUE;
-}
-
-static void
-scroll_on (ETree *et, guint scroll_direction)
-{
- if (et->priv->scroll_idle_id == 0 || scroll_direction != et->priv->scroll_direction) {
- if (et->priv->scroll_idle_id != 0)
- g_source_remove (et->priv->scroll_idle_id);
- et->priv->scroll_direction = scroll_direction;
- et->priv->scroll_idle_id = g_timeout_add (100, scroll_timeout, et);
- }
-}
-
-static void
-scroll_off (ETree *et)
-{
- if (et->priv->scroll_idle_id) {
- g_source_remove (et->priv->scroll_idle_id);
- et->priv->scroll_idle_id = 0;
- }
-}
-
-static gboolean
-hover_timeout (gpointer data)
-{
- ETree *et = data;
- GtkWidget *widget = data;
- int x = et->priv->hover_x;
- int y = et->priv->hover_y;
- int row, col;
- ETreePath path;
-
- x -= widget->allocation.x;
- y -= widget->allocation.y;
- e_tree_get_cell_at (et,
- x,
- y,
- &row,
- &col);
-
- path = e_tree_table_adapter_node_at_row(et->priv->etta, row);
- if (path && e_tree_model_node_is_expandable (E_TREE_MODEL (et->priv->sorted), path)) {
- if (!e_tree_table_adapter_node_is_expanded (et->priv->etta, path)) {
- if (e_tree_model_has_save_id (E_TREE_MODEL (et->priv->sorted)) && e_tree_model_has_get_node_by_id (E_TREE_MODEL (et->priv->sorted)))
- et->priv->expanded_list = g_list_prepend (et->priv->expanded_list, e_tree_model_get_save_id (E_TREE_MODEL (et->priv->sorted), path));
- e_tree_table_adapter_node_set_expanded (et->priv->etta, path, TRUE);
- }
- }
-
- return TRUE;
-}
-
-static void
-hover_on (ETree *et, int x, int y)
-{
- et->priv->hover_x = x;
- et->priv->hover_y = y;
- if (et->priv->hover_idle_id != 0)
- g_source_remove (et->priv->hover_idle_id);
- et->priv->hover_idle_id = g_timeout_add (500, hover_timeout, et);
-}
-
-static void
-hover_off (ETree *et)
-{
- if (et->priv->hover_idle_id) {
- g_source_remove (et->priv->hover_idle_id);
- et->priv->hover_idle_id = 0;
- }
-}
-
-static void
-collapse_drag (ETree *et, ETreePath drop)
-{
- GList *list;
-
- /* We only want to leave open parents of the node dropped in. Not the node itself. */
- if (drop) {
- drop = e_tree_model_node_get_parent (E_TREE_MODEL (et->priv->sorted), drop);
- }
-
- for (list = et->priv->expanded_list; list; list = list->next) {
- char *save_id = list->data;
- ETreePath path;
-
- path = e_tree_model_get_node_by_id (E_TREE_MODEL (et->priv->sorted), save_id);
- if (path) {
- ETreePath search;
- gboolean found = FALSE;
-
- for (search = drop; search; search = e_tree_model_node_get_parent (E_TREE_MODEL (et->priv->sorted), search)) {
- if (path == search) {
- found = TRUE;
- break;
- }
- }
-
- if (!found)
- e_tree_table_adapter_node_set_expanded (et->priv->etta, path, FALSE);
- }
- g_free (save_id);
- }
- g_list_free (et->priv->expanded_list);
- et->priv->expanded_list = NULL;
-}
-
-static void
-context_destroyed (gpointer data)
-{
- ETree *et = data;
- if (et->priv) {
- et->priv->last_drop_x = 0;
- et->priv->last_drop_y = 0;
- et->priv->last_drop_time = 0;
- et->priv->last_drop_context = NULL;
- collapse_drag (et, NULL);
- scroll_off (et);
- hover_off (et);
- }
- gtk_object_unref (GTK_OBJECT (et));
-}
-
-static void
-context_connect (ETree *et, GdkDragContext *context)
-{
- if (g_dataset_get_data (context, "e-tree") == NULL) {
- gtk_object_ref (GTK_OBJECT (et));
- g_dataset_set_data_full (context, "e-tree", et, context_destroyed);
- }
-}
-
-static void
-et_drag_leave(GtkWidget *widget,
- GdkDragContext *context,
- guint time,
- ETree *et)
-{
- gtk_signal_emit (GTK_OBJECT (et),
- et_signals [TREE_DRAG_LEAVE],
- et->priv->drop_row,
- et->priv->drop_path,
- et->priv->drop_col,
- context,
- time);
- et->priv->drop_row = -1;
- et->priv->drop_col = -1;
-
- scroll_off (et);
- hover_off (et);
-}
-
-static gboolean
-et_drag_motion(GtkWidget *widget,
- GdkDragContext *context,
- gint x,
- gint y,
- guint time,
- ETree *et)
-{
- int ret_val;
- guint direction = 0;
-
- et->priv->last_drop_x = x;
- et->priv->last_drop_y = y;
- et->priv->last_drop_time = time;
- et->priv->last_drop_context = context;
- context_connect (et, context);
-
- if (et->priv->hover_idle_id != 0) {
- if (abs (et->priv->hover_x - x) > 3 ||
- abs (et->priv->hover_y - y) > 3) {
- hover_on (et, x, y);
- }
- } else {
- hover_on (et, x, y);
- }
-
- ret_val = do_drag_motion (et,
- context,
- x,
- y,
- time);
-
- x -= widget->allocation.x;
- y -= widget->allocation.y;
-
- if (y < 20)
- direction |= ET_SCROLL_UP;
- if (y > widget->allocation.height - 20)
- direction |= ET_SCROLL_DOWN;
- if (x < 20)
- direction |= ET_SCROLL_LEFT;
- if (x > widget->allocation.width - 20)
- direction |= ET_SCROLL_RIGHT;
-
- if (direction != 0)
- scroll_on (et, direction);
- else
- scroll_off (et);
-
- return ret_val;
-}
-
-static gboolean
-et_drag_drop(GtkWidget *widget,
- GdkDragContext *context,
- gint x,
- gint y,
- guint time,
- ETree *et)
-{
- gboolean ret_val = FALSE;
- int row, col;
- ETreePath path;
- ETreePath sorted_path;
- y -= widget->allocation.y;
- x -= widget->allocation.x;
- e_tree_get_cell_at(et,
- x,
- y,
- &row,
- &col);
- sorted_path = e_tree_table_adapter_node_at_row(et->priv->etta, row);
- path = e_tree_sorted_view_to_model_path(et->priv->sorted, sorted_path);
-
- if (row != et->priv->drop_row && col != et->priv->drop_row) {
- gtk_signal_emit (GTK_OBJECT (et),
- et_signals [TREE_DRAG_LEAVE],
- et->priv->drop_row,
- et->priv->drop_path,
- et->priv->drop_col,
- context,
- time);
- gtk_signal_emit (GTK_OBJECT (et),
- et_signals [TREE_DRAG_MOTION],
- row,
- path,
- col,
- context,
- x,
- y,
- time,
- &ret_val);
- }
- et->priv->drop_row = row;
- et->priv->drop_path = path;
- et->priv->drop_col = col;
-
- gtk_signal_emit (GTK_OBJECT (et),
- et_signals [TREE_DRAG_DROP],
- et->priv->drop_row,
- et->priv->drop_path,
- et->priv->drop_col,
- context,
- x,
- y,
- time,
- &ret_val);
-
- et->priv->drop_row = -1;
- et->priv->drop_path = NULL;
- et->priv->drop_col = -1;
-
- collapse_drag (et, sorted_path);
-
- scroll_off (et);
- return ret_val;
-}
-
-static void
-et_drag_data_received(GtkWidget *widget,
- GdkDragContext *context,
- gint x,
- gint y,
- GtkSelectionData *selection_data,
- guint info,
- guint time,
- ETree *et)
-{
- int row, col;
- ETreePath path;
- y -= widget->allocation.y;
- x -= widget->allocation.x;
- e_tree_get_cell_at(et,
- x,
- y,
- &row,
- &col);
- path = e_tree_table_adapter_node_at_row(et->priv->etta, row);
- path = e_tree_sorted_view_to_model_path(et->priv->sorted, path);
- gtk_signal_emit (GTK_OBJECT (et),
- et_signals [TREE_DRAG_DATA_RECEIVED],
- row,
- path,
- col,
- context,
- x,
- y,
- selection_data,
- info,
- time);
-}
-
-static void
-e_tree_class_init (ETreeClass *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 (PARENT_TYPE);
-
- object_class->destroy = et_destroy;
- object_class->set_arg = et_set_arg;
- object_class->get_arg = et_get_arg;
-
- widget_class->grab_focus = et_grab_focus;
- widget_class->unrealize = et_unrealize;
-
- container_class->focus = et_focus;
-
- class->cursor_change = NULL;
- class->cursor_activated = NULL;
- class->selection_change = NULL;
- class->double_click = NULL;
- class->right_click = NULL;
- class->click = NULL;
- class->key_press = NULL;
- class->start_drag = et_real_start_drag;
- class->state_change = NULL;
-
- class->tree_drag_begin = NULL;
- class->tree_drag_end = NULL;
- class->tree_drag_data_get = NULL;
- class->tree_drag_data_delete = NULL;
-
- class->tree_drag_leave = NULL;
- class->tree_drag_motion = NULL;
- class->tree_drag_drop = NULL;
- class->tree_drag_data_received = NULL;
-
- et_signals [CURSOR_CHANGE] =
- gtk_signal_new ("cursor_change",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETreeClass, cursor_change),
- gtk_marshal_NONE__INT_POINTER,
- GTK_TYPE_NONE, 2, GTK_TYPE_INT, GTK_TYPE_POINTER);
-
- et_signals [CURSOR_ACTIVATED] =
- gtk_signal_new ("cursor_activated",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETreeClass, cursor_activated),
- gtk_marshal_NONE__INT_POINTER,
- GTK_TYPE_NONE, 2, GTK_TYPE_INT, GTK_TYPE_POINTER);
-
- et_signals [SELECTION_CHANGE] =
- gtk_signal_new ("selection_change",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETreeClass, selection_change),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- et_signals [DOUBLE_CLICK] =
- gtk_signal_new ("double_click",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETreeClass, double_click),
- e_marshal_NONE__INT_POINTER_INT_POINTER,
- GTK_TYPE_NONE, 4, GTK_TYPE_INT, GTK_TYPE_POINTER, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT);
-
- et_signals [RIGHT_CLICK] =
- gtk_signal_new ("right_click",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETreeClass, right_click),
- e_marshal_INT__INT_POINTER_INT_POINTER,
- GTK_TYPE_INT, 4, GTK_TYPE_INT, GTK_TYPE_POINTER, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT);
-
- et_signals [CLICK] =
- gtk_signal_new ("click",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETreeClass, click),
- e_marshal_INT__INT_POINTER_INT_POINTER,
- GTK_TYPE_INT, 4, GTK_TYPE_INT, GTK_TYPE_POINTER, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT);
-
- et_signals [KEY_PRESS] =
- gtk_signal_new ("key_press",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETreeClass, key_press),
- e_marshal_INT__INT_POINTER_INT_POINTER,
- GTK_TYPE_INT, 4, GTK_TYPE_INT, GTK_TYPE_POINTER, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT);
-
- et_signals [START_DRAG] =
- gtk_signal_new ("start_drag",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETreeClass, start_drag),
- e_marshal_NONE__INT_POINTER_INT_POINTER,
- GTK_TYPE_NONE, 4, GTK_TYPE_INT, GTK_TYPE_POINTER, GTK_TYPE_INT, GTK_TYPE_GDK_EVENT);
-
- et_signals [STATE_CHANGE] =
- gtk_signal_new ("state_change",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETreeClass, state_change),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- et_signals[TREE_DRAG_BEGIN] =
- gtk_signal_new ("tree_drag_begin",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETreeClass, tree_drag_begin),
- e_marshal_NONE__INT_POINTER_INT_POINTER,
- GTK_TYPE_NONE, 4,
- GTK_TYPE_INT,
- GTK_TYPE_POINTER,
- GTK_TYPE_INT,
- GTK_TYPE_GDK_DRAG_CONTEXT);
- et_signals[TREE_DRAG_END] =
- gtk_signal_new ("tree_drag_end",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETreeClass, tree_drag_end),
- e_marshal_NONE__INT_POINTER_INT_POINTER,
- GTK_TYPE_NONE, 4,
- GTK_TYPE_INT,
- GTK_TYPE_POINTER,
- GTK_TYPE_INT,
- GTK_TYPE_GDK_DRAG_CONTEXT);
- et_signals[TREE_DRAG_DATA_GET] =
- gtk_signal_new ("tree_drag_data_get",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETreeClass, tree_drag_data_get),
- e_marshal_NONE__INT_POINTER_INT_POINTER_POINTER_UINT_UINT,
- GTK_TYPE_NONE, 7,
- GTK_TYPE_INT,
- GTK_TYPE_POINTER,
- GTK_TYPE_INT,
- GTK_TYPE_GDK_DRAG_CONTEXT,
- GTK_TYPE_SELECTION_DATA,
- GTK_TYPE_UINT,
- GTK_TYPE_UINT);
- et_signals[TREE_DRAG_DATA_DELETE] =
- gtk_signal_new ("tree_drag_data_delete",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETreeClass, tree_drag_data_delete),
- e_marshal_NONE__INT_POINTER_INT_POINTER,
- GTK_TYPE_NONE, 4,
- GTK_TYPE_INT,
- GTK_TYPE_POINTER,
- GTK_TYPE_INT,
- GTK_TYPE_GDK_DRAG_CONTEXT);
-
- et_signals[TREE_DRAG_LEAVE] =
- gtk_signal_new ("tree_drag_leave",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETreeClass, tree_drag_leave),
- e_marshal_NONE__INT_POINTER_INT_POINTER_UINT,
- GTK_TYPE_NONE, 5,
- GTK_TYPE_INT,
- GTK_TYPE_POINTER,
- GTK_TYPE_INT,
- GTK_TYPE_GDK_DRAG_CONTEXT,
- GTK_TYPE_UINT);
- et_signals[TREE_DRAG_MOTION] =
- gtk_signal_new ("tree_drag_motion",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETreeClass, tree_drag_motion),
- e_marshal_BOOL__INT_POINTER_INT_POINTER_INT_INT_UINT,
- GTK_TYPE_BOOL, 7,
- GTK_TYPE_INT,
- GTK_TYPE_POINTER,
- GTK_TYPE_INT,
- GTK_TYPE_GDK_DRAG_CONTEXT,
- GTK_TYPE_INT,
- GTK_TYPE_INT,
- GTK_TYPE_UINT);
- et_signals[TREE_DRAG_DROP] =
- gtk_signal_new ("tree_drag_drop",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETreeClass, tree_drag_drop),
- e_marshal_BOOL__INT_POINTER_INT_POINTER_INT_INT_UINT,
- GTK_TYPE_BOOL, 7,
- GTK_TYPE_INT,
- GTK_TYPE_POINTER,
- GTK_TYPE_INT,
- GTK_TYPE_GDK_DRAG_CONTEXT,
- GTK_TYPE_INT,
- GTK_TYPE_INT,
- GTK_TYPE_UINT);
- et_signals[TREE_DRAG_DATA_RECEIVED] =
- gtk_signal_new ("tree_drag_data_received",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETreeClass, tree_drag_data_received),
- e_marshal_NONE__INT_POINTER_INT_POINTER_INT_INT_POINTER_UINT_UINT,
- GTK_TYPE_NONE, 9,
- GTK_TYPE_INT,
- GTK_TYPE_POINTER,
- GTK_TYPE_INT,
- GTK_TYPE_GDK_DRAG_CONTEXT,
- GTK_TYPE_INT,
- GTK_TYPE_INT,
- GTK_TYPE_SELECTION_DATA,
- GTK_TYPE_UINT,
- GTK_TYPE_UINT);
-
- E_OBJECT_CLASS_ADD_SIGNALS (object_class, et_signals, LAST_SIGNAL);
-
- class->set_scroll_adjustments = set_scroll_adjustments;
-
- widget_class->set_scroll_adjustments_signal =
- gtk_signal_new ("set_scroll_adjustments",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETreeClass, set_scroll_adjustments),
- gtk_marshal_NONE__POINTER_POINTER,
- GTK_TYPE_NONE, 2, GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT);
-
- gtk_object_add_arg_type ("ETree::length_threshold", GTK_TYPE_INT,
- GTK_ARG_WRITABLE, ARG_LENGTH_THRESHOLD);
- gtk_object_add_arg_type ("ETree::horizontal_draw_grid", GTK_TYPE_BOOL,
- GTK_ARG_WRITABLE, ARG_HORIZONTAL_DRAW_GRID);
- gtk_object_add_arg_type ("ETree::vertical_draw_grid", GTK_TYPE_BOOL,
- GTK_ARG_WRITABLE, ARG_VERTICAL_DRAW_GRID);
- gtk_object_add_arg_type ("ETree::draw_focus", GTK_TYPE_BOOL,
- GTK_ARG_WRITABLE, ARG_DRAW_FOCUS);
- gtk_object_add_arg_type ("ETree::ETreeTableAdapter", GTK_TYPE_OBJECT,
- GTK_ARG_READABLE, ARG_ETTA);
- gtk_object_add_arg_type ("ETree::uniform_row_height", GTK_TYPE_BOOL,
- GTK_ARG_READWRITE, ARG_UNIFORM_ROW_HEIGHT);
-}
-
-E_MAKE_TYPE(e_tree, "ETree", ETree, e_tree_class_init, e_tree_init, PARENT_TYPE);
diff --git a/widgets/table/e-tree.h b/widgets/table/e-tree.h
deleted file mode 100644
index 68b60f8c25..0000000000
--- a/widgets/table/e-tree.h
+++ /dev/null
@@ -1,304 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-tree.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_TREE_H_
-#define _E_TREE_H_
-
-#include <gtk/gtktable.h>
-#include <gnome-xml/tree.h>
-#include <libgnomeui/gnome-canvas.h>
-
-#include <gal/widgets/e-printable.h>
-
-#include <gal/e-table/e-table-extras.h>
-#include <gal/e-table/e-table-specification.h>
-#include <gal/e-table/e-table-state.h>
-#include <gal/e-table/e-tree-model.h>
-#include <libgnome/gnome-defs.h>
-
-#define E_TREE_USE_TREE_SELECTION
-
-#ifdef E_TREE_USE_TREE_SELECTION
-#include <gal/e-table/e-tree-selection-model.h>
-#endif
-
-BEGIN_GNOME_DECLS
-
-#define E_TREE_TYPE (e_tree_get_type ())
-#define E_TREE(o) (GTK_CHECK_CAST ((o), E_TREE_TYPE, ETree))
-#define E_TREE_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TREE_TYPE, ETreeClass))
-#define E_IS_TREE(o) (GTK_CHECK_TYPE ((o), E_TREE_TYPE))
-#define E_IS_TREE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TREE_TYPE))
-
-typedef struct _ETreeDragSourceSite ETreeDragSourceSite;
-typedef struct ETreePriv ETreePriv;
-
-typedef struct {
- GtkTable parent;
-
- ETreePriv *priv;
-} ETree;
-
-typedef struct {
- GtkTableClass parent_class;
-
- void (*cursor_change) (ETree *et, int row, ETreePath path);
- void (*cursor_activated) (ETree *et, int row, ETreePath path);
- void (*selection_change) (ETree *et);
- void (*double_click) (ETree *et, int row, ETreePath path, int col, GdkEvent *event);
- gint (*right_click) (ETree *et, int row, ETreePath path, int col, GdkEvent *event);
- gint (*click) (ETree *et, int row, ETreePath path, int col, GdkEvent *event);
- gint (*key_press) (ETree *et, int row, ETreePath path, int col, GdkEvent *event);
- gint (*start_drag) (ETree *et, int row, ETreePath path, int col, GdkEvent *event);
- gint (*state_change) (ETree *et);
-
- void (*set_scroll_adjustments) (ETree *tree,
- GtkAdjustment *hadjustment,
- GtkAdjustment *vadjustment);
-
- /* Source side drag signals */
- void (* tree_drag_begin) (ETree *tree,
- int row,
- ETreePath path,
- int col,
- GdkDragContext *context);
- void (* tree_drag_end) (ETree *tree,
- int row,
- ETreePath path,
- int col,
- GdkDragContext *context);
- void (* tree_drag_data_get) (ETree *tree,
- int row,
- ETreePath path,
- int col,
- GdkDragContext *context,
- GtkSelectionData *selection_data,
- guint info,
- guint time);
- void (* tree_drag_data_delete) (ETree *tree,
- int row,
- ETreePath path,
- int col,
- GdkDragContext *context);
-
- /* Target side drag signals */
- void (* tree_drag_leave) (ETree *tree,
- int row,
- ETreePath path,
- int col,
- GdkDragContext *context,
- guint time);
- gboolean (* tree_drag_motion) (ETree *tree,
- int row,
- ETreePath path,
- int col,
- GdkDragContext *context,
- gint x,
- gint y,
- guint time);
- gboolean (* tree_drag_drop) (ETree *tree,
- int row,
- ETreePath path,
- int col,
- GdkDragContext *context,
- gint x,
- gint y,
- guint time);
- void (* tree_drag_data_received) (ETree *tree,
- int row,
- ETreePath path,
- int col,
- GdkDragContext *context,
- gint x,
- gint y,
- GtkSelectionData *selection_data,
- guint info,
- guint time);
-} ETreeClass;
-
-GtkType e_tree_get_type (void);
-ETree *e_tree_construct (ETree *e_tree,
- ETreeModel *etm,
- ETableExtras *ete,
- const char *spec,
- const char *state);
-GtkWidget *e_tree_new (ETreeModel *etm,
- ETableExtras *ete,
- const char *spec,
- const char *state);
-
-/* Create an ETree using files. */
-ETree *e_tree_construct_from_spec_file (ETree *e_tree,
- ETreeModel *etm,
- ETableExtras *ete,
- const char *spec_fn,
- const char *state_fn);
-GtkWidget *e_tree_new_from_spec_file (ETreeModel *etm,
- ETableExtras *ete,
- const char *spec_fn,
- const char *state_fn);
-
-/* To save the state */
-gchar *e_tree_get_state (ETree *e_tree);
-void e_tree_save_state (ETree *e_tree,
- const gchar *filename);
-ETableState *e_tree_get_state_object (ETree *e_tree);
-ETableSpecification *e_tree_get_spec (ETree *e_tree);
-
-/* note that it is more efficient to provide the state at creation time */
-void e_tree_set_state (ETree *e_tree,
- const gchar *state);
-void e_tree_set_state_object (ETree *e_tree,
- ETableState *state);
-void e_tree_load_state (ETree *e_tree,
- const gchar *filename);
-void e_tree_set_cursor (ETree *e_tree,
- ETreePath path);
-
-/* NULL means we don't have the cursor. */
-ETreePath e_tree_get_cursor (ETree *e_tree);
-void e_tree_selected_row_foreach (ETree *e_tree,
- EForeachFunc callback,
- gpointer closure);
-#ifdef E_TREE_USE_TREE_SELECTION
-void e_tree_selected_path_foreach (ETree *e_tree,
- ETreeForeachFunc callback,
- gpointer closure);
-#endif
-gint e_tree_selected_count (ETree *e_tree);
-EPrintable *e_tree_get_printable (ETree *e_tree);
-gint e_tree_get_next_row (ETree *e_tree,
- gint model_row);
-gint e_tree_get_prev_row (ETree *e_tree,
- gint model_row);
-gint e_tree_model_to_view_row (ETree *e_tree,
- gint model_row);
-gint e_tree_view_to_model_row (ETree *e_tree,
- gint view_row);
-void e_tree_get_cell_at (ETree *tree,
- int x,
- int y,
- int *row_return,
- int *col_return);
-void e_tree_get_cell_geometry (ETree *tree,
- int row,
- int col,
- int *x_return,
- int *y_return,
- int *width_return,
- int *height_return);
-
-/* Useful accessors */
-ETreeModel * e_tree_get_model (ETree *et);
-ESelectionModel *e_tree_get_selection_model (ETree *et);
-
-/* Drag & drop stuff. */
-/* Target */
-void e_tree_drag_get_data (ETree *tree,
- int row,
- int col,
- GdkDragContext *context,
- GdkAtom target,
- guint32 time);
-void e_tree_drag_highlight (ETree *tree,
- int row,
- int col); /* col == -1 to highlight entire row. */
-void e_tree_drag_unhighlight (ETree *tree);
-void e_tree_drag_dest_set (ETree *tree,
- GtkDestDefaults flags,
- const GtkTargetEntry *targets,
- gint n_targets,
- GdkDragAction actions);
-void e_tree_drag_dest_set_proxy (ETree *tree,
- GdkWindow *proxy_window,
- GdkDragProtocol protocol,
- gboolean use_coordinates);
-
-/* There probably should be functions for setting the targets
- * as a GtkTargetList
- */
-void e_tree_drag_dest_unset (GtkWidget *widget);
-
-/* Source side */
-void e_tree_drag_source_set (ETree *tree,
- GdkModifierType start_button_mask,
- const GtkTargetEntry *targets,
- gint n_targets,
- GdkDragAction actions);
-void e_tree_drag_source_unset (ETree *tree);
-
-/* There probably should be functions for setting the targets
- * as a GtkTargetList
- */
-GdkDragContext *e_tree_drag_begin (ETree *tree,
- int row,
- int col,
- GtkTargetList *targets,
- GdkDragAction actions,
- gint button,
- GdkEvent *event);
-
-/* Adapter functions */
-gboolean e_tree_node_is_expanded (ETree *et,
- ETreePath path);
-void e_tree_node_set_expanded (ETree *et,
- ETreePath path,
- gboolean expanded);
-void e_tree_node_set_expanded_recurse (ETree *et,
- ETreePath path,
- gboolean expanded);
-void e_tree_root_node_set_visible (ETree *et,
- gboolean visible);
-ETreePath e_tree_node_at_row (ETree *et,
- int row);
-int e_tree_row_of_node (ETree *et,
- ETreePath path);
-gboolean e_tree_root_node_is_visible (ETree *et);
-void e_tree_show_node (ETree *et,
- ETreePath path);
-void e_tree_save_expanded_state (ETree *et,
- char *filename);
-void e_tree_load_expanded_state (ETree *et,
- char *filename);
-int e_tree_row_count (ETree *et);
-GtkWidget *e_tree_get_tooltip (ETree *et);
-
-typedef enum {
- E_TREE_FIND_NEXT_BACKWARD = 0,
- E_TREE_FIND_NEXT_FORWARD = 1 << 0,
- E_TREE_FIND_NEXT_WRAP = 1 << 1
-} ETreeFindNextParams;
-
-gboolean e_tree_find_next (ETree *et,
- ETreeFindNextParams params,
- ETreePathFunc func,
- gpointer data);
-
-/* This function is only needed in single_selection_mode. */
-void e_tree_right_click_up (ETree *et);
-
-
-END_GNOME_DECLS
-
-#endif /* _E_TREE_H_ */
-
diff --git a/widgets/table/image1.png b/widgets/table/image1.png
deleted file mode 100644
index 8326ac241f..0000000000
--- a/widgets/table/image1.png
+++ /dev/null
Binary files differ
diff --git a/widgets/table/image2.png b/widgets/table/image2.png
deleted file mode 100644
index e6a4c75dbe..0000000000
--- a/widgets/table/image2.png
+++ /dev/null
Binary files differ
diff --git a/widgets/table/image3.png b/widgets/table/image3.png
deleted file mode 100644
index 50e16e8620..0000000000
--- a/widgets/table/image3.png
+++ /dev/null
Binary files differ
diff --git a/widgets/table/remove-col.xpm b/widgets/table/remove-col.xpm
deleted file mode 100644
index ff1024f0c9..0000000000
--- a/widgets/table/remove-col.xpm
+++ /dev/null
@@ -1,22 +0,0 @@
-/* XPM */
-static char * remove_col_xpm[] = {
-"16 16 3 1",
-" c None",
-". c #000000",
-"+ c #FF0000",
-"... ...",
-".++. .++.",
-".+++. .+++.",
-" .+++. .+++. ",
-" .+++. .+++. ",
-" .+++..+++. ",
-" .++++++. ",
-" .++++. ",
-" .++++. ",
-" .++++++. ",
-" .+++..+++. ",
-" .+++. .+++. ",
-" .+++. .+++. ",
-".+++. .+++.",
-".++. .++.",
-"... ..."};
diff --git a/widgets/table/sample.table b/widgets/table/sample.table
deleted file mode 100644
index e1909a2bf7..0000000000
--- a/widgets/table/sample.table
+++ /dev/null
@@ -1,45 +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
-aaa1 bbb ccc ddd eee
-aaa2 bbb ccc ddd eee
-aaa3 bbb ccc ddd eee
-aaa4 bbb ccc ddd eee
-aaa5 bbb ccc ddd eee
-aaa6 bbb ccc ddd eee
-aaa7 bbb ccc ddd eee
-aaa8 bbb ccc ddd eee
-aaa9 bbb ccc ddd eee
-aaa10 bbb ccc ddd eee
-aaa11 bbb ccc ddd eee
-aaa12 bbb ccc ddd eee
-aaa13 bbb ccc ddd eee
-aaa14 bbb ccc ddd eee
-aaa15 bbb ccc ddd eee
-aaa16 bbb ccc ddd eee
-aaa17 bbb ccc ddd eee
-aaa18 bbb ccc ddd eee
-aaa19 bbb ccc ddd eee
-aaa20 bbb ccc ddd eee
-aaa21 bbb ccc ddd eee
-aaa22 bbb ccc ddd eee
-aaa23 bbb ccc ddd eee
-aaa24 bbb ccc ddd eee
-aaa25 bbb ccc ddd eee
-aaa26 bbb ccc ddd eee
-aaa27 bbb ccc ddd eee
-aaa28 bbb ccc ddd eee
-aaa29 bbb ccc ddd eee
-aaa30 bbb ccc ddd eee
-aaa31 bbb ccc ddd eee
-aaa32 bbb ccc ddd eee
-aaa33 bbb ccc ddd eee
-aaa34 bbb ccc ddd eee
-aaa35 bbb ccc ddd eee
-aaa36 bbb ccc ddd eee
diff --git a/widgets/table/spec.xml b/widgets/table/spec.xml
deleted file mode 100644
index a8e524484c..0000000000
--- a/widgets/table/spec.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-<ETableSpecification no-headers="false" click-to-add="false"
- draw-grid="true" cursor-mode="simple"
- _click-to-add-message="">
- <ETableColumn model_col="0" _title="Email" expansion="1.0" minimum_width="20" resizable="true" cell="cell_left_just" compare="string"/>
- <ETableColumn model_col="1" _title="Full Name" expansion="1.0" minimum_width="20" resizable="true" cell="cell_left_just" compare="string"/>
- <ETableColumn model_col="2" _title="Address" expansion="1.0" minimum_width="20" resizable="true" cell="cell_left_just" compare="string"/>
- <ETableColumn model_col="3" _title="Phone" expansion="1.0" minimum_width="20" resizable="true" cell="cell_left_just" compare="string"/>
- <ETableState>
- <column source="0"/>
- <column source="3"/>
- <column source="1"/>
- <column source="2"/>
- <grouping>
- <group column="2" ascending="true">
- <leaf column="1" ascending="true"/>
- </group>
- </grouping>
- <!-- Column that's been added by hand. Not implemented yet.
- <ETableColumn model_col="custom-string" _title="Custom" expansion="1.0" minimum_widgth="20" resizable="true" cell="string" compare="string"/> -->
- </ETableState>
-</ETableSpecification>
diff --git a/widgets/table/table-test.c b/widgets/table/table-test.c
deleted file mode 100644
index 20faa35e57..0000000000
--- a/widgets/table/table-test.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * table-test.c
- * Copyright 1999, 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Miguel de Icaza (miguel@gnu.org)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <stdio.h>
-#include <string.h>
-#include <fcntl.h>
-#include <gnome.h>
-#include "gal/widgets/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 d0442ca64b..0000000000
--- a/widgets/table/table-test.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * table-test.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Miguel de Icaza (miguel@gnu.org)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-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 1b717009ef..0000000000
--- a/widgets/table/test-check.c
+++ /dev/null
@@ -1,222 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * test-check.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Miguel de Icaza (miguel@gnu.org)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <stdio.h>
-#include <string.h>
-#include <gnome.h>
-#include "e-table-simple.h"
-#include "e-table-header.h"
-#include "e-table-header-item.h"
-#include "e-table-item.h"
-#include "gal/widgets/e-cursors.h"
-#include "gal/widgets/e-canvas-utils.h"
-#include "gal/widgets/e-canvas.h"
-#include "gal/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 *
-initialize_value (ETableModel *etc, int col, void *data)
-{
- if (col == 0)
- return NULL;
- else
- return g_strdup ("");
-}
-
-static gboolean
-value_is_empty (ETableModel *etc, int col, const void *value, void *data)
-{
- if (col == 0)
- return value == NULL;
- else
- return !(value && *(char *)value);
-}
-
-static char *
-value_to_string (ETableModel *etc, int col, const void *value, void *data)
-{
- if (col == 0)
- return g_strdup_printf("%d", (int) value);
- else
- return g_strdup(value);
-}
-
-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,
- initialize_value, value_is_empty,
- value_to_string,
- NULL);
-
- /*
- * Header
- */
- e_table_header = e_table_header_new ();
-
- cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT);
-
- cell_image_check = e_cell_checkbox_new ();
- pixbuf = gdk_pixbuf_new_from_file ("clip.png");
- col_0 = e_table_col_new_with_pixbuf (0, pixbuf, 0.0, 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", 1.0, 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 = e_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,
- 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,
-#if 0
- "spreadsheet", TRUE,
-#endif
- "cursor_mode", E_TABLE_CURSOR_SIMPLE,
- 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 d6bbe4d2be..0000000000
--- a/widgets/table/test-cols.c
+++ /dev/null
@@ -1,266 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * test-cols.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Miguel de Icaza (miguel@gnu.org)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <stdio.h>
-#include <string.h>
-#include <gnome.h>
-#include "gal/widgets/e-canvas-utils.h"
-#include "gal/widgets/e-canvas.h"
-#include "gal/widgets/e-cursors.h"
-#include "gal/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 *
-initialize_value (ETableModel *etc, int col, void *data)
-{
- if (col == 0)
- return NULL;
- else
- return g_strdup ("");
-}
-
-static gboolean
-value_is_empty (ETableModel *etc, int col, const void *value, void *data)
-{
- if (col == 0)
- return value == NULL;
- else
- return !(value && *(char *)value);
-}
-
-static char *
-value_to_string (ETableModel *etc, int col, const void *value, void *data)
-{
- if (col == 0)
- return g_strdup_printf("%d", (int) value);
- else
- return g_strdup(value);
-}
-
-static void
-set_canvas_size (GnomeCanvas *canvas, GtkAllocation *alloc)
-{
- gnome_canvas_set_scroll_region (canvas, 0, 0, alloc->width, alloc->height);
-}
-
-void
-multi_cols_test (void)
-{
- GtkWidget *canvas, *window;
- ETableModel *e_table_model;
- ETableHeader *e_table_header, *e_table_header_multiple;
- ETableCol *col_0, *col_1;
- ECell *cell_left_just, *cell_image_toggle;
- 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,
- initialize_value, value_is_empty,
- value_to_string,
- NULL);
-
- /*
- * Header
- */
- e_table_header = e_table_header_new ();
-
- cell_left_just = e_cell_text_new (e_table_model, NULL, GTK_JUSTIFY_LEFT);
-
- {
- GdkPixbuf **images = g_new (GdkPixbuf *, 3);
- int i;
-
- images [0] = gdk_pixbuf_new_from_file ("image1.png");
- images [1] = gdk_pixbuf_new_from_file ("image2.png");
- images [2] = gdk_pixbuf_new_from_file ("image3.png");
-
- cell_image_toggle = e_cell_toggle_new (0, 3, images);
-
- for (i = 0; i < 3; i++)
- gdk_pixbuf_unref (images [i]);
-
- g_free (images);
- }
-
- col_1 = e_table_col_new (1, "Item Name", 1.0, 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", 0.0, 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 = e_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,
- 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,
- "cursor_mode", E_TABLE_CURSOR_SIMPLE,
-#if 0
- "spreadsheet", TRUE,
-#endif
- 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,
- 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,
-#if 0
- "spreadsheet", TRUE,
-#endif
- "cursor_mode", E_TABLE_CURSOR_SIMPLE,
- 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 55a432e995..0000000000
--- a/widgets/table/test-table.c
+++ /dev/null
@@ -1,478 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * test-table.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Miguel de Icaza (miguel@gnu.org)
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <stdio.h>
-#include <string.h>
-#include <gnome.h>
-#include "gal/widgets/e-cursors.h"
-#include "gal/widgets/e-canvas.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 "e-table-config.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 (void)
-{
- 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 (void)
-{
- 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
-append_row (ETableModel *etm, ETableModel *model, int row, void *data)
-{
- abort ();
-}
-
-static void *
-value_at (ETableModel *etc, int col, int row, void *data)
-{
- g_assert (col < cols);
- g_assert (row < lines);
-
- fprintf (stderr, "value_at[%d,%d]\n", col, row);
-
- 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 gboolean
-has_save_id (ETableModel *etm, void *data)
-{
- return FALSE;
-}
-
-static char *
-get_save_id (ETableModel *etm, int row, void *data)
-{
- abort ();
-}
-
-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 *
-initialize_value (ETableModel *etc, int col, void *data)
-{
- return g_strdup ("");
-}
-
-static gboolean
-value_is_empty (ETableModel *etc, int col, const void *value, void *data)
-{
- return !(value && *(char *)value);
-}
-
-static char *
-value_to_string (ETableModel *etc, int col, const void *value, void *data)
-{
- return g_strdup(value);
-}
-
-#ifdef BIT_ROT
-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;
- int priority = 20;
-
- load_data ();
-
- /*
- * Data model
- */
- e_table_model = e_table_simple_new (
- col_count, row_count, append_row,
-
- value_at, set_value_at, is_cell_editable,
-
- has_save_id, get_save_id,
-
- duplicate_value, free_value,
- initialize_value, value_is_empty,
- value_to_string,
- NULL);
-
- /*
- * Header
- */
- e_table_header = e_table_header_new ();
- cell_left_just = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT);
-
- for (i = 0; i < cols; i++){
- ETableCol *ecol = e_table_col_new (
- i, column_labels [i],
- 1.0, 20, cell_left_just,
- g_str_compare, TRUE,
- priority);
-
- e_table_header_add_column (e_table_header, ecol, i);
- }
-
- /*
- * Setup GUI
- */
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- canvas = e_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,
- 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,
-#if 0
- "spreadsheet", TRUE,
-#endif
- NULL);
-}
-#endif
-
-static void
-save_spec (GtkWidget *button, ETable *e_table)
-{
-#ifdef BIT_ROT
- e_table_save_specification (e_table, "e-table-test.xml");
-#endif
-}
-
-#ifdef BIT_ROT
-static void
-row_selection_test (ETable *table, int row, gboolean selected)
-{
- if (selected)
- g_print ("Row %d selected\n", row);
- else
- g_print ("Row %d unselected\n", row);
-}
-#endif
-
-static void
-toggle_grid (void *nothing, ETable *etable)
-{
- static gboolean shown;
-
- gtk_object_get (GTK_OBJECT (etable), "drawgrid", &shown, NULL);
- gtk_object_set (GTK_OBJECT (etable), "drawgrid", !shown, NULL);
-}
-
-static void
-do_e_table_demo (const char *state)
-{
- GtkWidget *e_table, *window, *frame, *vbox, *button, *bhide;
- ECell *cell_left_just;
- ETableHeader *full_header;
- int i;
- GString *spec;
-
- /*
- * Data model
- */
- static ETableModel *e_table_model = NULL;
-
- if (e_table_model == NULL)
- e_table_model =
- e_table_simple_new (col_count, row_count, append_row,
- value_at, set_value_at, is_cell_editable,
- has_save_id, get_save_id,
- duplicate_value, free_value,
- initialize_value, value_is_empty,
- value_to_string,
- NULL);
-
- full_header = e_table_header_new ();
- cell_left_just = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT);
-
- spec = g_string_new ("\
-<ETableSpecification \
-cursor-mode=\"line\" \
-selection-mode=\"browse\" \
-draw-focus=\"true\">");
- for (i = 0; i < cols; i++) {
- char *colspec =
- g_strdup_printf ("\
- <ETableColumn model_col=\"%d\" \
-_title=\"%s\" \
-minimum_width=\"20\" \
-resizable=\"true\" \
-cell=\"string\" \
-compare=\"string\"/>\n", i, column_labels[i]);
- g_string_append (spec, colspec);
- g_free (colspec);
- }
- g_string_append (spec, "</ETableSpecification>");
- e_table = e_table_new (e_table_model, NULL, spec->str, state);
-
- /* This makes value_at not called just to determine row height. */
- gtk_object_set (GTK_OBJECT (e_table),
- "uniform_row_height", 1,
- NULL);
-
- g_string_free (spec, TRUE);
-
- window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- frame = gtk_frame_new (NULL);
-#ifdef BIT_ROT
- gtk_signal_connect (GTK_OBJECT(e_table), "row_selection",
- GTK_SIGNAL_FUNC(row_selection_test), NULL);
-#endif
-
- vbox = gtk_vbox_new (FALSE, 0);
- gtk_box_pack_start (GTK_BOX (vbox), e_table, TRUE, TRUE, 0);
- gtk_container_add (GTK_CONTAINER (frame), vbox);
- gtk_container_add (GTK_CONTAINER (window), frame);
-
-#if 0
- /*
- * gadgets
- */
- button = gtk_button_new_with_label ("Save spec");
- gtk_signal_connect (GTK_OBJECT (button), "clicked",
- GTK_SIGNAL_FUNC (save_spec), e_table);
- gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
-
- bhide = gtk_button_new_with_label ("Toggle Grid");
- gtk_signal_connect (GTK_OBJECT (bhide), "clicked",
- GTK_SIGNAL_FUNC (toggle_grid), e_table);
- gtk_box_pack_start (GTK_BOX (vbox), bhide, FALSE, FALSE, 0);
-#endif
-
- gtk_widget_set_usize (window, 400, 200);
- gtk_widget_show_all (window);
-
-#ifdef BIT_ROT
- if (getenv ("TEST")){
- e_table_do_gui_config (NULL, E_TABLE(e_table));
- }
-#endif
-}
-
-void
-e_table_test (void)
-{
- load_data ();
-
- if (1){/*getenv ("DO")){*/
- do_e_table_demo ("\
-<ETableState>\n\
- <column source=\"0\"/>\n\
- <column source=\"1\"/>\n\
- <column source=\"2\"/>\n\
- <column source=\"3\"/>\n\
- <column source=\"4\"/>\n\
- <grouping></grouping>\n\
-</ETableState>");
-#if 0
- do_e_table_demo ("<ETableSpecification> <columns-shown> <column> 0 </column> <column> 0 </column> <column> 1 </column> <column> 2 </column> <column> 3 </column> <column> 4 </column> </columns-shown> <grouping> <group column=\"3\" ascending=\"true\"> <group column=\"4\" ascending=\"false\"> <leaf column=\"2\" ascending=\"true\"/> </group> </group> </grouping> </ETableSpecification>");
- do_e_table_demo ("<ETableSpecification> <columns-shown> <column> 0 </column> <column> 1 </column> <column> 2 </column> <column> 3 </column> <column> 4 </column> </columns-shown> <grouping> <group column=\"4\" ascending=\"true\"> <leaf column=\"2\" ascending=\"true\"/> </group> </grouping> </ETableSpecification>");
- do_e_table_demo ("<ETableSpecification> <columns-shown> <column> 0 </column> <column> 1 </column> <column> 2 </column> <column> 3 </column> <column> 4 </column> </columns-shown> <grouping> <group column=\"3\" ascending=\"true\"> <leaf column=\"2\" ascending=\"true\"/> </group> </grouping> </ETableSpecification>");
-#endif
- }
-}
diff --git a/widgets/table/tree-expanded.xpm b/widgets/table/tree-expanded.xpm
deleted file mode 100644
index d9bda3694d..0000000000
--- a/widgets/table/tree-expanded.xpm
+++ /dev/null
@@ -1,23 +0,0 @@
-/* XPM */
-static char * tree_expanded_xpm[] = {
-"16 16 4 1",
-" c None",
-". c #FFFFFF",
-"* c #000000",
-"+ c #666666",
-" ",
-" ",
-" ",
-" ",
-" +++++++++ ",
-" +.......+ ",
-" +.......+ ",
-" +.......+ ",
-" +.*****.+ ",
-" +.......+ ",
-" +.......+ ",
-" +.......+ ",
-" +++++++++ ",
-" ",
-" ",
-" "};
diff --git a/widgets/table/tree-unexpanded.xpm b/widgets/table/tree-unexpanded.xpm
deleted file mode 100644
index e1b48448ba..0000000000
--- a/widgets/table/tree-unexpanded.xpm
+++ /dev/null
@@ -1,23 +0,0 @@
-/* XPM */
-static char * tree_unexpanded_xpm[] = {
-"16 16 4 1",
-" c None",
-". c #FFFFFF",
-"* c #000000",
-"+ c #666666",
-" ",
-" ",
-" ",
-" ",
-" +++++++++ ",
-" +.......+ ",
-" +...*...+ ",
-" +...*...+ ",
-" +.*****.+ ",
-" +...*...+ ",
-" +...*...+ ",
-" +.......+ ",
-" +++++++++ ",
-" ",
-" ",
-" "};
diff --git a/widgets/text/.cvsignore b/widgets/text/.cvsignore
deleted file mode 100644
index 792b9f5af2..0000000000
--- a/widgets/text/.cvsignore
+++ /dev/null
@@ -1,11 +0,0 @@
-.deps
-.libs
-.pure
-Makefile
-Makefile.in
-*.lo
-*.la
-e-text-test
-e-entry-test
-e-text-model-test
-e-completion-test \ No newline at end of file
diff --git a/widgets/text/e-completion-match.c b/widgets/text/e-completion-match.c
deleted file mode 100644
index e61362a561..0000000000
--- a/widgets/text/e-completion-match.c
+++ /dev/null
@@ -1,186 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-completion-match.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Jon Trowbridge <trow@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <string.h>
-#include <gal/unicode/gunicode.h>
-#include <gal/widgets/e-unicode.h>
-#include "e-completion-match.h"
-
-static void
-e_completion_match_destroy (ECompletionMatch *match)
-{
- if (match) {
- g_free (match->match_text);
- g_free (match->menu_text);
- if (match->destroy)
- match->destroy (match);
- g_free (match);
- }
-}
-
-void
-e_completion_match_construct (ECompletionMatch *match)
-{
- g_return_if_fail (match != NULL);
-
- match->match_text = NULL;
- match->menu_text = NULL;
- match->score = 0;
- match->sort_major = 0;
- match->sort_minor = 0;
- match->user_data = NULL;
- match->ref = 1;
- match->hit_count = 0;
- match->destroy = NULL;
-}
-
-void
-e_completion_match_ref (ECompletionMatch *match)
-{
- g_return_if_fail (match != NULL);
- g_return_if_fail (match->ref > 0);
-
- ++match->ref;
-}
-
-void
-e_completion_match_unref (ECompletionMatch *match)
-{
- if (match) {
- g_return_if_fail (match->ref > 0);
-
- --match->ref;
- if (match->ref == 0) {
- e_completion_match_destroy (match);
- }
- }
-}
-
-void
-e_completion_match_set_text (ECompletionMatch *match,
- const gchar *match_text,
- const gchar *menu_text)
-{
- g_return_if_fail (match != NULL);
-
- /* We silently drop any entries w/ invalid utf8.
- This is not optimal behavior. */
-
- if (match_text && ! g_utf8_validate (match_text, -1, NULL)) {
- match_text = NULL;
- }
-
- if (menu_text && ! g_utf8_validate (menu_text, -1, NULL)) {
- menu_text = NULL;
- }
-
- if (match->match_text && match->match_text != match_text) {
- g_free (match->match_text);
- }
- match->match_text = g_strdup (match_text);
-
- if (match->menu_text && match->menu_text != menu_text) {
- g_free (match->menu_text);
- }
- match->menu_text = g_strdup (menu_text);
-}
-
-const gchar *
-e_completion_match_get_match_text (ECompletionMatch *match)
-{
- g_return_val_if_fail (match != NULL, NULL);
- return match->match_text;
-}
-
-const gchar *
-e_completion_match_get_menu_text (ECompletionMatch *match)
-{
- g_return_val_if_fail (match != NULL, NULL);
- return match->menu_text;
-}
-
-gint
-e_completion_match_compare (const ECompletionMatch *a, const ECompletionMatch *b)
-{
- gint rv;
-
- /* Deal with NULL arguments. */
- if (!(a || b)) {
- if (!(a && b))
- return 0;
- return a ? -1 : 1;
- }
-
- if ( (rv = (b->sort_major < a->sort_major) - (a->sort_major < b->sort_major)) )
- return rv;
-
- /* Sort the scores high->low. */
- if ( (rv = (b->score > a->score) - (a->score > b->score)) )
- return rv;
-
- if ( (rv = (b->sort_minor < a->sort_minor) - (a->sort_minor < b->sort_minor)) )
- return rv;
-
- return 0;
-}
-
-gint
-e_completion_match_compare_alpha (const ECompletionMatch *a, const ECompletionMatch *b)
-{
- gint rv, rv2;
-
- /* Deal with NULL arguments. */
- if (!(a || b)) {
- if (!(a && b))
- return 0;
- return a ? -1 : 1;
- }
-
- /* The sort_major trumps everything. */
- if ( (rv = (b->sort_major < a->sort_major) - (a->sort_major < b->sort_major)) )
- return rv;
-
- /* Sort the scores high->low. */
- if ( (rv = (b->score > a->score) - (a->score > b->score)) )
- return rv;
-
- /* When the match text is the same, we use the minor fields */
- rv2 = strcmp (a->match_text, b->match_text);
- if ( !rv2 && (rv = (b->sort_minor < a->sort_minor) - (a->sort_minor < b->sort_minor)) )
- return rv;
-
- return strcmp (a->menu_text, b->menu_text);
-}
-
-ECompletionMatch *
-e_completion_match_new (const gchar *match_text, const gchar *menu_text, double score)
-{
- ECompletionMatch *match = g_new0 (ECompletionMatch, 1);
-
- e_completion_match_construct (match);
- e_completion_match_set_text (match, match_text, menu_text);
- match->score = score;
-
- return match;
-}
diff --git a/widgets/text/e-completion-match.h b/widgets/text/e-completion-match.h
deleted file mode 100644
index ba93e53172..0000000000
--- a/widgets/text/e-completion-match.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-completion-match.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Jon Trowbridge <trow@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef __E_COMPLETION_MATCH_H__
-#define __E_COMPLETION_MATCH_H__
-
-#include <glib.h>
-#include <libgnome/gnome-defs.h>
-#include <gtk/gtkwidget.h>
-
-BEGIN_GNOME_DECLS
-
-typedef struct _ECompletionMatch ECompletionMatch;
-
-struct _ECompletionMatch {
- gchar *match_text; /* in utf8 */
- gchar *menu_text; /* in utf8 */
- double score;
- gint sort_major;
- gint sort_minor;
- gpointer user_data;
-
- gint ref;
- gint hit_count;
- void (*destroy) (ECompletionMatch *);
-};
-
-typedef void (*ECompletionMatchFn) (ECompletionMatch *, gpointer closure);
-
-void e_completion_match_construct (ECompletionMatch *);
-void e_completion_match_ref (ECompletionMatch *);
-void e_completion_match_unref (ECompletionMatch *);
-
-void e_completion_match_set_text (ECompletionMatch *, const gchar *match_text, const gchar *label_text);
-const gchar *e_completion_match_get_match_text (ECompletionMatch *);
-const gchar *e_completion_match_get_menu_text (ECompletionMatch *);
-
-gint e_completion_match_compare (const ECompletionMatch *, const ECompletionMatch *);
-gint e_completion_match_compare_alpha (const ECompletionMatch *, const ECompletionMatch *);
-
-ECompletionMatch *e_completion_match_new (const gchar *match_text, const gchar *menu_text, double score);
-
-
-
-
-END_GNOME_DECLS
-
-#endif /* __E_COMPLETION_MATCH_H__ */
-
diff --git a/widgets/text/e-completion-test.c b/widgets/text/e-completion-test.c
deleted file mode 100644
index bfa53982a3..0000000000
--- a/widgets/text/e-completion-test.c
+++ /dev/null
@@ -1,220 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-completion-test.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Jon Trowbridge <trow@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <gnome.h>
-#include "e-completion.h"
-#include "e-entry.h"
-
-#define TIMEOUT 10
-
-/* Dictionary Lookup test */
-
-static gint word_count = 0;
-static gchar **word_array = NULL;
-
-static void
-read_dict (void)
-{
- FILE *in = fopen ("/usr/share/dict/words", "r");
- gchar buffer[128];
- GList *word_list = NULL, *iter;
- gint i;
-
- while (fgets (buffer, 128, in)) {
- gint len = strlen (buffer);
- if (len > 0 && buffer[len-1] == '\n')
- buffer[len-1] = '\0';
- word_list = g_list_prepend (word_list, g_strdup (buffer));
- ++word_count;
- }
- fclose (in);
-
- word_array = g_new (gchar *, word_count);
- i = word_count-1;
- for (iter = word_list; iter != NULL; iter = g_list_next (iter)) {
- word_array[i] = (gchar *)iter->data;
- --i;
- }
-}
-
-static gint
-find_word (const gchar *str)
-{
- gint a, b;
-
- if (word_array == NULL)
- read_dict ();
-
- a = 0;
- b = word_count-1;
-
- while (b-a > 1) {
- gint m = (a+b)/2;
- gint cmp = g_strcasecmp (str, word_array[m]);
-
- if (cmp < 0)
- b = m;
- else if (cmp > 0)
- a = m;
- else
- return m;
- }
-
- return b;
-}
-
-struct {
- ECompletion *complete;
- const gchar *txt;
- gint start;
- gint current;
- gint len;
- gint limit;
- gint count;
-} dict_info;
-static guint dict_tag = 0;
-
-static gboolean
-dict_check (gpointer ptr)
-{
- gint limit = dict_info.limit;
- gint i;
-
- /* If this is the first iteration, do the binary search in our word list to figure out
- where to start. We do less work on the first iteration, to give more of a sense of
- immediate feedback. */
- if (dict_info.start < 0) {
- dict_info.start = dict_info.current = find_word (dict_info.txt);
- }
-
- i = dict_info.current;
- while (limit > 0
- && i < word_count
- && dict_info.count < 50
- && g_strncasecmp (dict_info.txt, word_array[i], dict_info.len) == 0) {
-
- ECompletionMatch *match = g_new (ECompletionMatch, 1);
- e_completion_match_construct (match);
- e_completion_match_set_text (match, word_array[i], NULL);
- match->score = dict_info.len / (double)strlen (word_array[i]);
- e_completion_found_match (dict_info.complete, match);
-
- ++i;
- --limit;
- ++dict_info.count;
- }
- dict_info.current = i;
- dict_info.limit = MIN (dict_info.limit*2, 400);
-
- if (limit != 0) {
- dict_tag = 0;
- e_completion_end_search (dict_info.complete);
- return FALSE;
- }
-
-
-
- return TRUE;
-}
-
-static void
-request_dict_search (ECompletion *complete, const gchar *txt, gint pos, gint limit, gpointer user_data)
-{
- gint len = strlen (txt);
-
- if (dict_tag != 0) {
- gtk_timeout_remove (dict_tag);
- dict_tag = 0;
- }
-
- if (len > 0) {
- dict_info.complete = complete;
- dict_info.txt = txt;
- dict_info.start = -1;
- dict_info.current = -1;
- dict_info.len = len;
- dict_info.limit = 100;
- dict_info.count = 0;
- dict_tag = gtk_timeout_add (TIMEOUT, dict_check, NULL);
- } else {
- e_completion_end_search (complete);
- }
-}
-
-static void
-end_dict_search (ECompletion *complete, gpointer user_data)
-{
- if (dict_tag != 0) {
- gtk_timeout_remove (dict_tag);
- dict_tag = 0;
- }
-}
-
-static void
-popup_cb (EEntry *popup, GdkEventButton *ev, gint pos, gpointer user_data)
-{
- g_print ("popup at pos %d\n", pos);
-}
-
-int
-main (int argc, gchar **argv)
-{
- ECompletion* complete;
- GtkWidget *entry;
- GtkWidget *win;
-
- gnome_init ("ETextModelTest", "0.0", argc, argv);
-
- read_dict ();
-
- complete = e_completion_new ();
- gtk_signal_connect (GTK_OBJECT (complete),
- "request_completion",
- GTK_SIGNAL_FUNC (request_dict_search),
- NULL);
- gtk_signal_connect (GTK_OBJECT (complete),
- "end_completion",
- GTK_SIGNAL_FUNC (end_dict_search),
- NULL);
- gtk_signal_connect (GTK_OBJECT (complete),
- "cancel_completion",
- GTK_SIGNAL_FUNC (end_dict_search),
- NULL);
-
- win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- entry = e_entry_new ();
- e_entry_enable_completion_full (E_ENTRY (entry), complete, 0, NULL);
- e_entry_set_editable (E_ENTRY (entry), TRUE);
-
- gtk_signal_connect (GTK_OBJECT (entry),
- "popup",
- GTK_SIGNAL_FUNC (popup_cb),
- NULL);
-
- gtk_container_add (GTK_CONTAINER (win), entry);
- gtk_widget_show_all (win);
-
- gtk_main ();
-
- return 0;
-}
diff --git a/widgets/text/e-completion-view.c b/widgets/text/e-completion-view.c
deleted file mode 100644
index c2eafb6273..0000000000
--- a/widgets/text/e-completion-view.c
+++ /dev/null
@@ -1,932 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-completion-view.c - A text completion selection widget
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Miguel de Icaza <miguel@ximian.com>
- * Adapted by Jon Trowbridge <trow@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <math.h>
-#include <gdk/gdkkeysyms.h>
-#include <gal/e-table/e-table-simple.h>
-#include <gal/e-table/e-table-scrolled.h>
-#include "e-completion-view.h"
-
-enum {
- E_COMPLETION_VIEW_NONEMPTY,
- E_COMPLETION_VIEW_ADDED,
- E_COMPLETION_VIEW_FULL,
- E_COMPLETION_VIEW_BROWSE,
- E_COMPLETION_VIEW_UNBROWSE,
- E_COMPLETION_VIEW_ACTIVATE,
- E_COMPLETION_VIEW_LAST_SIGNAL
-};
-
-static guint e_completion_view_signals[E_COMPLETION_VIEW_LAST_SIGNAL] = { 0 };
-
-static void e_completion_view_disconnect (ECompletionView *cv);
-static ETable *e_completion_view_table (ECompletionView *cv);
-static void e_completion_view_clear_choices (ECompletionView *cv);
-static void e_completion_view_set_cursor_row (ECompletionView *cv, gint r);
-static void e_completion_view_select (ECompletionView *cv, gint r);
-
-static gint e_completion_view_key_press_handler (GtkWidget *w, GdkEventKey *key_event, gpointer user_data);
-
-static void e_completion_view_class_init (ECompletionViewClass *klass);
-static void e_completion_view_init (ECompletionView *completion);
-static void e_completion_view_destroy (GtkObject *object);
-
-static GtkObjectClass *parent_class;
-
-
-
-static gint
-e_completion_view_local_key_press_handler (GtkWidget *w, GdkEventKey *ev)
-{
- return e_completion_view_key_press_handler (w, ev, w);
-}
-
-static void
-e_completion_view_paint (GtkWidget *widget, GdkRectangle *area)
-{
- gint i;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (E_IS_COMPLETION_VIEW (widget));
- g_return_if_fail (area != NULL);
-
- if (!GTK_WIDGET_DRAWABLE (widget))
- return;
-
- for (i = 0; i < E_COMPLETION_VIEW (widget)->border_width; ++i) {
-
- gdk_draw_rectangle (widget->window,
- widget->style->black_gc,
- FALSE, i, i,
- widget->allocation.width-1-2*i,
- widget->allocation.height-1-2*i);
-
- }
-
-}
-
-static void
-e_completion_view_draw (GtkWidget *widget, GdkRectangle *area)
-{
- GtkBin *bin;
- GdkRectangle child_area;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (E_IS_COMPLETION_VIEW (widget));
- g_return_if_fail (area != NULL);
-
- if (GTK_WIDGET_DRAWABLE (widget)) {
- bin = GTK_BIN (widget);
-
- e_completion_view_paint (widget, area);
-
- if (bin->child && gtk_widget_intersect (bin->child, area, &child_area))
- gtk_widget_draw (bin->child, &child_area);
- }
-}
-
-static gint
-e_completion_view_expose_event (GtkWidget *widget, GdkEventExpose *event)
-{
- GtkBin *bin;
- GdkEventExpose child_event;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (E_IS_COMPLETION_VIEW (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- if (GTK_WIDGET_DRAWABLE (widget)) {
- bin = GTK_BIN (widget);
-
- e_completion_view_paint (widget, &event->area);
-
- child_event = *event;
- if (bin->child &&
- GTK_WIDGET_NO_WINDOW (bin->child) &&
- gtk_widget_intersect (bin->child, &event->area, &child_event.area))
- gtk_widget_event (bin->child, (GdkEvent*) &child_event);
- }
-
- return FALSE;
-}
-
-static void
-e_completion_view_size_request (GtkWidget *widget, GtkRequisition *requisition)
-{
- GtkBin *bin;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (E_IS_COMPLETION_VIEW (widget));
- g_return_if_fail (requisition != NULL);
-
- bin = GTK_BIN (widget);
-
- requisition->width = 2 * E_COMPLETION_VIEW (widget)->border_width;
- requisition->height = 2 * E_COMPLETION_VIEW (widget)->border_width;
-
- if (bin->child && GTK_WIDGET_VISIBLE (bin->child)) {
- GtkRequisition child_requisition;
-
- gtk_widget_size_request (bin->child, &child_requisition);
-
- requisition->width += child_requisition.width;
- requisition->height += child_requisition.height;
- }
-}
-
-static void
-e_completion_view_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
-{
- GtkBin *bin;
- GtkAllocation child_allocation;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (E_IS_COMPLETION_VIEW (widget));
- g_return_if_fail (allocation != NULL);
-
- bin = GTK_BIN (widget);
- widget->allocation = *allocation;
-
- child_allocation.x = E_COMPLETION_VIEW (widget)->border_width;
- child_allocation.width = MAX(0, (gint)allocation->width - child_allocation.x * 2);
-
- child_allocation.y = E_COMPLETION_VIEW (widget)->border_width;
- child_allocation.height = MAX (0, (gint)allocation->height - child_allocation.y * 2);
-
- if (GTK_WIDGET_REALIZED (widget)) {
- gdk_window_move_resize (widget->window,
- allocation->x,
- allocation->y,
- allocation->width,
- allocation->height);
- }
-
- if (bin->child) {
- gtk_widget_size_allocate (bin->child, &child_allocation);
- }
-}
-
-GtkType
-e_completion_view_get_type (void)
-{
- static GtkType completion_view_type = 0;
-
- if (!completion_view_type) {
- GtkTypeInfo completion_view_info = {
- "ECompletionView",
- sizeof (ECompletionView),
- sizeof (ECompletionViewClass),
- (GtkClassInitFunc) e_completion_view_class_init,
- (GtkObjectInitFunc) e_completion_view_init,
- NULL, NULL, /* reserved */
- (GtkClassInitFunc) NULL
- };
-
- completion_view_type = gtk_type_unique (gtk_event_box_get_type (), &completion_view_info);
- }
-
- return completion_view_type;
-}
-
-static void
-e_completion_view_class_init (ECompletionViewClass *klass)
-{
- GtkObjectClass *object_class = (GtkObjectClass *) klass;
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
-
- parent_class = GTK_OBJECT_CLASS (gtk_type_class (gtk_event_box_get_type ()));
-
- e_completion_view_signals[E_COMPLETION_VIEW_NONEMPTY] =
- gtk_signal_new ("nonempty",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ECompletionViewClass, nonempty),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- e_completion_view_signals[E_COMPLETION_VIEW_ADDED] =
- gtk_signal_new ("added",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ECompletionViewClass, added),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- e_completion_view_signals[E_COMPLETION_VIEW_FULL] =
- gtk_signal_new ("full",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ECompletionViewClass, full),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- e_completion_view_signals[E_COMPLETION_VIEW_BROWSE] =
- gtk_signal_new ("browse",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ECompletionViewClass, browse),
- gtk_marshal_NONE__POINTER,
- GTK_TYPE_NONE, 1,
- GTK_TYPE_POINTER);
-
- e_completion_view_signals[E_COMPLETION_VIEW_UNBROWSE] =
- gtk_signal_new ("unbrowse",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ECompletionViewClass, unbrowse),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- e_completion_view_signals[E_COMPLETION_VIEW_ACTIVATE] =
- gtk_signal_new ("activate",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ECompletionViewClass, activate),
- gtk_marshal_NONE__POINTER,
- GTK_TYPE_NONE, 1,
- GTK_TYPE_POINTER);
-
- E_OBJECT_CLASS_ADD_SIGNALS (object_class, e_completion_view_signals, E_COMPLETION_VIEW_LAST_SIGNAL);
-
- object_class->destroy = e_completion_view_destroy;
-
- widget_class->key_press_event = e_completion_view_local_key_press_handler;
- widget_class->draw = e_completion_view_draw;
- widget_class->expose_event = e_completion_view_expose_event;
- widget_class->size_request = e_completion_view_size_request;
- widget_class->size_allocate = e_completion_view_size_allocate;
-}
-
-static void
-e_completion_view_init (ECompletionView *completion)
-{
- completion->border_width = 2;
- completion->choices = g_ptr_array_new ();
-}
-
-static void
-e_completion_view_destroy (GtkObject *object)
-{
- ECompletionView *cv = E_COMPLETION_VIEW (object);
-
- e_completion_view_disconnect (cv);
- e_completion_view_clear_choices (cv);
-
- g_ptr_array_free (cv->choices, TRUE);
-
- if (cv->key_widget) {
- gtk_signal_disconnect (GTK_OBJECT (cv->key_widget), cv->key_signal_id);
- gtk_object_unref (GTK_OBJECT (cv->key_widget));
- }
-
- if (cv->completion)
- gtk_object_unref (GTK_OBJECT (cv->completion));
-
-
- if (parent_class->destroy)
- (parent_class->destroy) (object);
-}
-
-static void
-e_completion_view_disconnect (ECompletionView *cv)
-{
- g_return_if_fail (cv != NULL);
- g_return_if_fail (E_IS_COMPLETION_VIEW (cv));
-
- if (cv->begin_signal_id)
- gtk_signal_disconnect (GTK_OBJECT (cv->completion), cv->begin_signal_id);
- if (cv->comp_signal_id)
- gtk_signal_disconnect (GTK_OBJECT (cv->completion), cv->comp_signal_id);
- if (cv->restart_signal_id)
- gtk_signal_disconnect (GTK_OBJECT (cv->completion), cv->restart_signal_id);
- if (cv->cancel_signal_id)
- gtk_signal_disconnect (GTK_OBJECT (cv->completion), cv->cancel_signal_id);
- if (cv->end_signal_id)
- gtk_signal_disconnect (GTK_OBJECT (cv->completion), cv->end_signal_id);
- if (cv->clear_signal_id)
- gtk_signal_disconnect (GTK_OBJECT (cv->completion), cv->clear_signal_id);
- if (cv->lost_signal_id)
- gtk_signal_disconnect (GTK_OBJECT (cv->completion), cv->lost_signal_id);
-
- cv->begin_signal_id = 0;
- cv->comp_signal_id = 0;
- cv->restart_signal_id = 0;
- cv->end_signal_id = 0;
- cv->clear_signal_id = 0;
- cv->lost_signal_id = 0;
-}
-
-static ETable *
-e_completion_view_table (ECompletionView *cv)
-{
- return e_table_scrolled_get_table (E_TABLE_SCROLLED (cv->table));
-}
-
-static void
-e_completion_view_clear_choices (ECompletionView *cv)
-{
- ECompletionMatch *match;
- GPtrArray *m;
- int i;
-
- g_return_if_fail (E_IS_COMPLETION_VIEW (cv));
-
- m = cv->choices;
- for (i = 0; i < m->len; i++) {
- match = g_ptr_array_index (m, i);
- e_completion_match_unref (match);
- }
- g_ptr_array_set_size (m, 0);
-}
-
-static void
-e_completion_view_set_cursor_row (ECompletionView *cv, gint r)
-{
- ETable *table;
- GtkAdjustment *adj;
- gint x, y1, y2, r1, r2, c;
- double fracline;
- gint iteration_count=0;
-
- g_return_if_fail (cv != NULL);
- g_return_if_fail (E_IS_COMPLETION_VIEW (cv));
-#ifndef G_DISABLE_CHECKS
- /* choices->len is unsigned, but it is reasonable for r to be
- * < 0 */
- if (r > 0) {
- g_return_if_fail (r < cv->choices->len);
- }
-#endif
-
- adj = e_scroll_frame_get_vadjustment (E_SCROLL_FRAME (cv->table));
-
- table = e_completion_view_table (cv);
-
- if (r < 0) {
- e_selection_model_clear (E_SELECTION_MODEL(table->selection));
-
- /* Move back to the top when we clear the selection */
- gtk_adjustment_set_value (adj, adj->lower);
- return;
- }
-
- e_table_set_cursor_row (table, r);
-
- /* OK, now the tricky bit. We try to insure that this row is
- visible. */
-
- /* If we are selecting the first or last row, then it is easy. We just
- cram the vadjustment all the way up/down. */
- if (r == 0) {
- gtk_adjustment_set_value (adj, adj->lower);
- return;
- } else if (r == cv->choices->len - 1) {
- gtk_adjustment_set_value (adj, adj->upper - adj->page_size);
- return;
- }
-
- fracline = ((adj->upper - adj->lower - adj->page_size) / (gint)cv->choices->len) / 4;
-
- while (iteration_count < 100) {
- x = GTK_LAYOUT(table->table_canvas)->hadjustment->value;
- y1 = GTK_LAYOUT(table->table_canvas)->vadjustment->value;
-
- y2 = y1 + cv->table->allocation.height;
-
- e_table_group_compute_location (e_completion_view_table (cv)->group, &x, &y1, &r1, &c);
- e_table_group_compute_location (e_completion_view_table (cv)->group, &x, &y2, &r2, &c);
-
- if (r <= r1) {
- gtk_adjustment_set_value (adj, adj->value - fracline);
- } else if (r >= r2) {
- gtk_adjustment_set_value (adj, adj->value + fracline);
- } else
- return;
-
- ++iteration_count;
- }
-
- g_assert_not_reached ();
-}
-
-static void
-e_completion_view_select (ECompletionView *cv, gint r)
-{
- ECompletionMatch *match;
-
- match = g_ptr_array_index (cv->choices, r);
-
- cv->selection = r;
- e_completion_view_set_cursor_row (cv, r);
- gtk_signal_emit (GTK_OBJECT (cv), e_completion_view_signals[E_COMPLETION_VIEW_ACTIVATE], match);
-}
-
-static gint
-e_completion_view_key_press_handler (GtkWidget *w, GdkEventKey *key_event, gpointer user_data)
-{
- ECompletionView *cv = E_COMPLETION_VIEW (user_data);
- gint dir = 0;
- gboolean key_handled = TRUE, complete_key = FALSE, uncomplete_key = FALSE, is_space = FALSE;
-
- /* FIXME: This is totally lame.
- The ECompletionView should be able to specify multiple completion/uncompletion keys, or just
- have sensible defaults. */
-
- if ((cv->complete_key && key_event->keyval == cv->complete_key)
- || ((key_event->keyval == GDK_n || key_event->keyval == GDK_N) && (key_event->state & GDK_CONTROL_MASK)))
- complete_key = TRUE;
-
- if ((cv->uncomplete_key && key_event->keyval == cv->uncomplete_key)
- || ((key_event->keyval == GDK_p || key_event->keyval == GDK_P) && (key_event->state & GDK_CONTROL_MASK)))
- uncomplete_key = TRUE;
-
- /* Start up a completion.*/
- if (complete_key && !cv->editable) {
- gtk_signal_emit (GTK_OBJECT (cv), e_completion_view_signals[E_COMPLETION_VIEW_BROWSE], NULL);
- goto stop_emission;
- }
-
- /* Stop our completion. */
- if (uncomplete_key && cv->editable && cv->selection < 0) {
- e_completion_view_set_cursor_row (cv, -1);
- gtk_signal_emit (GTK_OBJECT (cv), e_completion_view_signals[E_COMPLETION_VIEW_UNBROWSE]);
- goto stop_emission;
- }
-
- if (!cv->editable)
- return FALSE;
-
- switch (key_event->keyval) {
-
- case GDK_n:
- case GDK_N:
- /* We (heart) emacs: treat ctrl-n as down */
- if (! (key_event->state & GDK_CONTROL_MASK))
- return FALSE;
-
- case GDK_Down:
- case GDK_KP_Down:
- dir = 1;
- break;
-
- case GDK_p:
- case GDK_P:
- /* Treat ctrl-p as up */
- if (! (key_event->state & GDK_CONTROL_MASK))
- return FALSE;
-
- case GDK_Up:
- case GDK_KP_Up:
- dir = -1;
- break;
-
- case GDK_Tab:
- /* If our cursor is still up in the entry, move down into
- the popup. Otherwise unbrowse. */
- if (cv->choices->len > 0) {
- if (cv->selection < 0) {
- cv->selection = 0;
- dir = 0;
- } else {
- cv->selection = -1;
- dir = 0;
- key_handled = FALSE;
- }
- }
- break;
-
- case GDK_space:
- case GDK_KP_Space:
- is_space = TRUE;
-
- case GDK_Return:
- case GDK_KP_Enter:
- if (cv->selection < 0) {
- /* We don't have a selection yet, move to the first selection if there is
- more than one option. If there is only one option, select it automatically. */
-
- /* Let space pass through. */
- if (is_space)
- return FALSE;
-
- if (cv->choices->len == 1) {
- e_completion_view_select (cv, 0);
- goto stop_emission;
- } else {
- cv->selection = 0;
- dir = 0;
- }
-
- } else {
- /* Our cursor is down in the pop-up, so we make our selection. */
- e_completion_view_select (cv, cv->selection);
- goto stop_emission;
- }
- break;
-
- case GDK_Escape:
- /* Unbrowse hack */
- cv->selection = -1;
- dir = 0;
- break;
-
- default:
- return FALSE;
- }
-
- cv->selection += dir;
-
- if (cv->selection >= (int)cv->choices->len) {
- cv->selection = cv->choices->len - 1;
- /* Don't re-emit the browse signal */
- goto stop_emission;
- }
-
- e_completion_view_set_cursor_row (cv, cv->selection);
-
- if (cv->selection >= 0)
- gtk_signal_emit (GTK_OBJECT (cv), e_completion_view_signals[E_COMPLETION_VIEW_BROWSE],
- g_ptr_array_index (cv->choices, cv->selection));
- else
- gtk_signal_emit (GTK_OBJECT (cv), e_completion_view_signals[E_COMPLETION_VIEW_UNBROWSE]);
-
- stop_emission:
-
- if (key_handled)
- gtk_signal_emit_stop_by_name (GTK_OBJECT (w), "key_press_event");
-
- return key_handled;
-}
-
-static void
-begin_completion_cb (ECompletion *completion, const gchar *txt, gint pos, gint limit, gpointer user_data)
-{
- ECompletionView *cv = E_COMPLETION_VIEW (user_data);
-
- e_completion_view_clear_choices (cv);
- cv->have_all_choices = FALSE;
-
- e_table_model_changed (cv->model);
-}
-
-static void
-restart_completion_cb (ECompletion *completion, gpointer user_data)
-{
- /* For now, handle restarts like the beginning of a new completion. */
- begin_completion_cb (completion, NULL, 0, 0, user_data);
-}
-
-static void
-cancel_completion_cb (ECompletion *completion, gpointer user_data)
-{
- ECompletionView *cv = E_COMPLETION_VIEW (user_data);
-
- /* On a cancel, clear our choices and issue an "unbrowse" signal. */
- e_completion_view_clear_choices (cv);
- cv->have_all_choices = TRUE;
- e_completion_view_set_cursor_row (cv, -1);
- e_table_model_changed (cv->model);
-
- gtk_signal_emit (GTK_OBJECT (cv), e_completion_view_signals[E_COMPLETION_VIEW_UNBROWSE]);
-}
-
-static void
-completion_cb (ECompletion *completion, ECompletionMatch *match, gpointer user_data)
-{
- ECompletionView *cv = E_COMPLETION_VIEW (user_data);
- gint r = cv->choices->len;
- gboolean first = (cv->choices->len == 0);
-
- e_completion_match_ref (match);
- g_ptr_array_add (cv->choices, match);
-
- e_table_model_row_inserted (cv->model, r);
-
- if (first)
- gtk_signal_emit (GTK_OBJECT (cv), e_completion_view_signals[E_COMPLETION_VIEW_NONEMPTY]);
-
- gtk_signal_emit (GTK_OBJECT (cv), e_completion_view_signals[E_COMPLETION_VIEW_ADDED]);
-}
-
-static void
-end_completion_cb (ECompletion *completion, gpointer user_data)
-{
- ECompletionView *cv = E_COMPLETION_VIEW (user_data);
-
- /* Do a final refresh of the table. */
- e_table_model_changed (cv->model);
-
- cv->have_all_choices = TRUE;
- gtk_signal_emit (GTK_OBJECT (cv), e_completion_view_signals[E_COMPLETION_VIEW_FULL]);
-}
-
-static void
-clear_completion_cb (ECompletion *completion, gpointer user_data)
-{
- ECompletionView *cv = E_COMPLETION_VIEW (user_data);
-
- e_completion_view_clear_choices (cv);
- cv->have_all_choices = FALSE;
-
- e_table_model_changed (cv->model);
-}
-
-static void
-lost_completion_cb (ECompletion *completion, ECompletionMatch *match, gpointer user_data)
-{
- ECompletionView *cv = E_COMPLETION_VIEW (user_data);
- int i;
- GPtrArray *c = cv->choices;
-
- for (i = 0; i < c->len; i++)
- if (g_ptr_array_index (c, i) == match)
- break;
-
- g_return_if_fail (i == c->len);
-
- /* FIXME: do remove_index_fast(), then row_changed and
- * row_deleted (if there are more than 1 row still) */
- g_ptr_array_remove_index (c, i);
- e_table_model_row_deleted (cv->model, i);
-
- e_completion_match_unref (match);
-}
-
-/*** Table Callbacks ***/
-
-static char *simple_spec =
-"<ETableSpecification no-headers=\"true\" draw-grid=\"false\" cursor-mode=\"line\" alternating-row-colors=\"false\">"
-" <ETableColumn model_col=\"0\" _title=\"Node\" expansion=\"1.0\" "
-" minimum_width=\"16\" resizable=\"true\" cell=\"string\" "
-" compare=\"string\"/> "
-" <ETableState> "
-" <column source=\"0\"/> "
-" <grouping></grouping> "
-" </ETableState> "
-"</ETableSpecification>";
-
-static gint
-table_col_count (ETableModel *etm, gpointer data)
-{
- return 1;
-}
-
-static gint
-table_row_count (ETableModel *etm, gpointer data)
-{
- ECompletionView *cv = E_COMPLETION_VIEW (data);
- return cv->choices->len;
-}
-
-static gboolean
-table_is_cell_editable (ETableModel *etm, gint c, gint r, gpointer data)
-{
- return FALSE;
-}
-
-static gpointer
-table_value_at (ETableModel *etm, gint c, gint r, gpointer data)
-{
- ECompletionView *cv = E_COMPLETION_VIEW (data);
- ECompletionMatch *match;
-
- match = g_ptr_array_index (cv->choices, r);
-
- return (gpointer) e_completion_match_get_menu_text (match);
-}
-
-static gchar *
-table_value_to_string (ETableModel *em, gint col, gconstpointer val, gpointer data)
-{
- return (gchar *) val;
-}
-
-static void
-table_click_cb (ETable *et, gint r, gint c, GdkEvent *ev, gpointer data)
-{
- ECompletionView *cv = E_COMPLETION_VIEW (data);
-
- e_completion_view_select (cv, r);
-}
-
-void
-e_completion_view_construct (ECompletionView *cv, ECompletion *completion)
-{
- g_return_if_fail (cv != NULL);
- g_return_if_fail (E_IS_COMPLETION_VIEW (cv));
- g_return_if_fail (completion != NULL);
- g_return_if_fail (E_IS_COMPLETION (completion));
-
- /* Make sure we don't call construct twice. */
- g_return_if_fail (cv->completion == NULL);
-
- GTK_WIDGET_SET_FLAGS (GTK_WIDGET (cv), GTK_CAN_FOCUS);
-
- cv->completion = completion;
- gtk_object_ref (GTK_OBJECT (completion));
-
- cv->begin_signal_id = gtk_signal_connect (GTK_OBJECT (completion),
- "begin_completion",
- GTK_SIGNAL_FUNC (begin_completion_cb),
- cv);
- cv->comp_signal_id = gtk_signal_connect (GTK_OBJECT (completion),
- "completion",
- GTK_SIGNAL_FUNC (completion_cb),
- cv);
- cv->restart_signal_id = gtk_signal_connect (GTK_OBJECT (completion),
- "restart_completion",
- GTK_SIGNAL_FUNC (restart_completion_cb),
- cv);
- cv->cancel_signal_id = gtk_signal_connect (GTK_OBJECT (completion),
- "cancel_completion",
- GTK_SIGNAL_FUNC (cancel_completion_cb),
- cv);
- cv->end_signal_id = gtk_signal_connect (GTK_OBJECT (completion),
- "end_completion",
- GTK_SIGNAL_FUNC (end_completion_cb),
- cv);
- cv->clear_signal_id = gtk_signal_connect (GTK_OBJECT (completion),
- "clear_completion",
- GTK_SIGNAL_FUNC (clear_completion_cb),
- cv);
- cv->lost_signal_id = gtk_signal_connect (GTK_OBJECT (completion),
- "lost_completion",
- GTK_SIGNAL_FUNC (lost_completion_cb),
- cv);
-
- cv->model = e_table_simple_new (table_col_count,
- table_row_count,
- NULL,
-
- table_value_at,
- NULL,
- table_is_cell_editable,
-
- NULL, NULL,
-
- NULL, NULL, NULL, NULL,
- table_value_to_string,
- cv);
-
- cv->table = e_table_scrolled_new (cv->model, NULL, simple_spec, NULL);
- gtk_object_unref (GTK_OBJECT (cv->model));
-
- e_scroll_frame_set_shadow_type (E_SCROLL_FRAME (cv->table), GTK_SHADOW_NONE);
- e_scroll_frame_set_scrollbar_spacing (E_SCROLL_FRAME (cv->table), 0);
- e_scroll_frame_set_policy (E_SCROLL_FRAME (cv->table), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
-
- gtk_container_add (GTK_CONTAINER (cv), cv->table);
- gtk_widget_show_all (cv->table);
-
- gtk_signal_connect (GTK_OBJECT (e_completion_view_table (cv)),
- "click",
- GTK_SIGNAL_FUNC (table_click_cb),
- cv);
-
- cv->selection = -1;
-}
-
-GtkWidget *
-e_completion_view_new (ECompletion *completion)
-{
- gpointer p;
-
- g_return_val_if_fail (completion != NULL, NULL);
- g_return_val_if_fail (E_IS_COMPLETION (completion), NULL);
-
- p = gtk_type_new (e_completion_view_get_type ());
-
- e_completion_view_construct (E_COMPLETION_VIEW (p), completion);
-
- return GTK_WIDGET (p);
-}
-
-void
-e_completion_view_connect_keys (ECompletionView *cv, GtkWidget *w)
-{
- g_return_if_fail (cv != NULL);
- g_return_if_fail (E_IS_COMPLETION_VIEW (cv));
- g_return_if_fail (w == NULL || GTK_IS_WIDGET (w));
-
- if (cv->key_widget) {
- gtk_signal_disconnect (GTK_OBJECT (cv->key_widget), cv->key_signal_id);
- gtk_object_unref (GTK_OBJECT (cv->key_widget));
- }
-
- if (w) {
- cv->key_widget = w;
- gtk_object_ref (GTK_OBJECT (w));
-
- cv->key_signal_id = gtk_signal_connect (GTK_OBJECT (w),
- "key_press_event",
- GTK_SIGNAL_FUNC (e_completion_view_key_press_handler),
- cv);
- } else {
- cv->key_widget = NULL;
- cv->key_signal_id = 0;
- }
-}
-
-void
-e_completion_view_set_complete_key (ECompletionView *cv, gint keyval)
-{
- g_return_if_fail (cv != NULL);
- g_return_if_fail (E_IS_COMPLETION_VIEW (cv));
-
- cv->complete_key = keyval;
-}
-
-void
-e_completion_view_set_uncomplete_key (ECompletionView *cv, gint keyval)
-{
- g_return_if_fail (cv != NULL);
- g_return_if_fail (E_IS_COMPLETION_VIEW (cv));
-
- cv->uncomplete_key = keyval;
-}
-
-void
-e_completion_view_set_width (ECompletionView *cv, gint width)
-{
- GtkWidget *w;
- gint y, r, dummy, line_height, final_height;
- double drop_room, lines;
-
- g_return_if_fail (cv != NULL);
- g_return_if_fail (E_IS_COMPLETION_VIEW (cv));
- g_return_if_fail (width > 0);
-
- w = GTK_WIDGET (cv);
-
- if (! GTK_WIDGET_REALIZED (w)) {
- gtk_widget_set_usize (w, width, -1);
- return;
- }
-
- /* A Horrible Hack(tm) to figure out the height of a single table row */
-
- for (line_height=5, r=0; r == 0 && line_height < 1000; line_height += 2) {
- dummy = 0;
- e_table_group_compute_location (e_completion_view_table (cv)->group,
- &dummy, &line_height, &r, &dummy);
- }
-
- if (line_height >= 1000) {
- /* Something went wrong, so we make a (possibly very lame) guess */
- line_height = 30;
- }
-
-
- gdk_window_get_origin (w->window, NULL, &y);
- y += w->allocation.y;
-
- lines = 5; /* default maximum */
- lines = MIN (lines, cv->choices->len);
-
- drop_room = (gdk_screen_height () - y) / (double)line_height;
- drop_room = MAX (drop_room, 1);
-
- lines = MIN (lines, drop_room);
-
- /* We reduce the total height by a bit; in practice, this seems to work out well. */
- final_height = (gint) floor (line_height * (0.5 + (float)lines) * 0.97);
- gtk_widget_set_usize (w, width, final_height);
-}
-
-void
-e_completion_view_set_editable (ECompletionView *cv, gboolean x)
-{
- g_return_if_fail (cv != NULL);
- g_return_if_fail (E_IS_COMPLETION_VIEW (cv));
-
- if (x == cv->editable)
- return;
-
- cv->editable = x;
- cv->selection = -1;
- e_completion_view_set_cursor_row (cv, -1);
-}
-
-
diff --git a/widgets/text/e-completion-view.h b/widgets/text/e-completion-view.h
deleted file mode 100644
index f58050a564..0000000000
--- a/widgets/text/e-completion-view.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-completion-view.h - A text completion selection widget
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Miguel de Icaza <miguel@ximian.com>
- * Adapted by Jon Trowbridge <trow@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef E_COMPLETION_VIEW_H
-#define E_COMPLETION_VIEW_H
-
-#include <libgnome/gnome-defs.h>
-#include <gtk/gtk.h>
-#include <gal/e-table/e-table.h>
-#include "e-completion.h"
-
-BEGIN_GNOME_DECLS
-
-#define E_COMPLETION_VIEW_TYPE (e_completion_view_get_type ())
-#define E_COMPLETION_VIEW(o) (GTK_CHECK_CAST ((o), E_COMPLETION_VIEW_TYPE, ECompletionView))
-#define E_COMPLETION_VIEW_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), E_COMPLETION_VIEW_TYPE, ECompletionViewClass))
-#define E_IS_COMPLETION_VIEW(o) (GTK_CHECK_TYPE ((o), E_COMPLETION_VIEW_TYPE))
-#define E_IS_COMPLETION_VIEW_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_COMPLETION_VIEW_TYPE))
-
-typedef struct _ECompletionView ECompletionView;
-typedef struct _ECompletionViewClass ECompletionViewClass;
-
-struct _ECompletionView {
- GtkEventBox parent;
-
- ETableModel *model;
- GtkWidget *table;
-
- GPtrArray *choices;
-
- ECompletion *completion;
- guint begin_signal_id;
- guint comp_signal_id;
- guint restart_signal_id;
- guint cancel_signal_id;
- guint end_signal_id;
- guint clear_signal_id;
- guint lost_signal_id;
-
- GtkWidget *key_widget;
- guint key_signal_id;
-
- gint complete_key;
- gint uncomplete_key;
-
- gboolean have_all_choices;
-
- gboolean editable;
- gint selection;
-
- gint border_width;
-};
-
-struct _ECompletionViewClass {
- GtkEventBoxClass parent_class;
-
- /* Signals */
- void (*nonempty) (ECompletionView *cv);
- void (*added) (ECompletionView *cv);
- void (*full) (ECompletionView *cv);
- void (*browse) (ECompletionView *cv, ECompletionMatch *match);
- void (*unbrowse) (ECompletionView *cv);
- void (*activate) (ECompletionView *cv, ECompletionMatch *match);
-};
-
-GtkType e_completion_view_get_type (void);
-
-void e_completion_view_construct (ECompletionView *cv, ECompletion *completion);
-GtkWidget *e_completion_view_new (ECompletion *completion);
-
-void e_completion_view_connect_keys (ECompletionView *cv, GtkWidget *w);
-
-void e_completion_view_set_complete_key (ECompletionView *cv, gint keyval);
-void e_completion_view_set_uncomplete_key (ECompletionView *cv, gint keyval);
-
-void e_completion_view_set_width (ECompletionView *cv, gint width);
-void e_completion_view_set_editable (ECompletionView *cv, gboolean);
-
-END_GNOME_DECLS
-
-
-#endif /* E_COMPLETION_H */
diff --git a/widgets/text/e-completion.c b/widgets/text/e-completion.c
deleted file mode 100644
index 975bc9e112..0000000000
--- a/widgets/text/e-completion.c
+++ /dev/null
@@ -1,644 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-completion.c - A base class for text completion.
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Miguel de Icaza <miguel@ximian.com>
- * Adapted by Jon Trowbridge <trow@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <string.h>
-#include <stdio.h>
-#include <gtk/gtk.h>
-#include "e-completion.h"
-#include "gal/util/e-util.h"
-
-enum {
- E_COMPLETION_REQUEST_COMPLETION,
- E_COMPLETION_BEGIN_COMPLETION,
- E_COMPLETION_COMPLETION,
- E_COMPLETION_RESTART_COMPLETION,
- E_COMPLETION_CANCEL_COMPLETION,
- E_COMPLETION_END_COMPLETION,
- E_COMPLETION_CLEAR_COMPLETION,
- E_COMPLETION_LOST_COMPLETION,
- E_COMPLETION_LAST_SIGNAL
-};
-
-static guint e_completion_signals[E_COMPLETION_LAST_SIGNAL] = { 0 };
-
-struct _ECompletionPrivate {
- gboolean searching;
- gboolean done_search;
- gboolean refining;
- gchar *search_text;
- GPtrArray *matches;
- gint match_count;
- gint pos;
- gint limit;
- double min_score, max_score;
- gint refinement_count;
- GList *search_stack;
-};
-
-typedef struct {
- gchar *text;
- gint pos;
-} ECompletionSearch;
-
-static void e_completion_class_init (ECompletionClass *klass);
-static void e_completion_init (ECompletion *complete);
-static void e_completion_destroy (GtkObject *object);
-
-static void e_completion_add_match (ECompletion *complete, ECompletionMatch *);
-static void e_completion_clear_search_stack (ECompletion *complete);
-static void e_completion_clear_matches (ECompletion *complete);
-static gboolean e_completion_sort (ECompletion *complete);
-static void e_completion_restart (ECompletion *complete);
-
-static GtkObjectClass *parent_class;
-
-
-
-GtkType
-e_completion_get_type (void)
-{
- static GtkType complete_type = 0;
-
- if (!complete_type) {
- GtkTypeInfo complete_info = {
- "ECompletion",
- sizeof (ECompletion),
- sizeof (ECompletionClass),
- (GtkClassInitFunc) e_completion_class_init,
- (GtkObjectInitFunc) e_completion_init,
- NULL, NULL, /* reserved */
- (GtkClassInitFunc) NULL
- };
-
- complete_type = gtk_type_unique (gtk_object_get_type (), &complete_info);
- }
-
- return complete_type;
-}
-
-static void
-e_completion_class_init (ECompletionClass *klass)
-{
- GtkObjectClass *object_class = (GtkObjectClass *) klass;
-
- parent_class = GTK_OBJECT_CLASS (gtk_type_class (gtk_object_get_type ()));
-
- e_completion_signals[E_COMPLETION_REQUEST_COMPLETION] =
- gtk_signal_new ("request_completion",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ECompletionClass, request_completion),
- gtk_marshal_NONE__POINTER_INT_INT,
- GTK_TYPE_NONE, 3,
- GTK_TYPE_POINTER, GTK_TYPE_INT, GTK_TYPE_INT);
-
- e_completion_signals[E_COMPLETION_BEGIN_COMPLETION] =
- gtk_signal_new ("begin_completion",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ECompletionClass, begin_completion),
- gtk_marshal_NONE__POINTER_INT_INT,
- GTK_TYPE_NONE, 3,
- GTK_TYPE_POINTER, GTK_TYPE_INT, GTK_TYPE_INT);
-
- e_completion_signals[E_COMPLETION_COMPLETION] =
- gtk_signal_new ("completion",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ECompletionClass, completion),
- gtk_marshal_NONE__POINTER,
- GTK_TYPE_NONE, 1,
- GTK_TYPE_POINTER);
-
- e_completion_signals[E_COMPLETION_RESTART_COMPLETION] =
- gtk_signal_new ("restart_completion",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ECompletionClass, restart_completion),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- e_completion_signals[E_COMPLETION_CANCEL_COMPLETION] =
- gtk_signal_new ("cancel_completion",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ECompletionClass, cancel_completion),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- e_completion_signals[E_COMPLETION_END_COMPLETION] =
- gtk_signal_new ("end_completion",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ECompletionClass, end_completion),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- e_completion_signals[E_COMPLETION_CLEAR_COMPLETION] =
- gtk_signal_new ("clear_completion",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ECompletionClass, clear_completion),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- e_completion_signals[E_COMPLETION_LOST_COMPLETION] =
- gtk_signal_new ("lost_completion",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ECompletionClass, lost_completion),
- gtk_marshal_NONE__POINTER,
- GTK_TYPE_NONE, 1, GTK_TYPE_POINTER);
-
- E_OBJECT_CLASS_ADD_SIGNALS (object_class, e_completion_signals, E_COMPLETION_LAST_SIGNAL);
-
- object_class->destroy = e_completion_destroy;
-}
-
-static void
-e_completion_init (ECompletion *complete)
-{
- complete->priv = g_new0 (struct _ECompletionPrivate, 1);
- complete->priv->matches = g_ptr_array_new ();
-}
-
-static void
-e_completion_destroy (GtkObject *object)
-{
- ECompletion *complete = E_COMPLETION (object);
-
- g_free (complete->priv->search_text);
- complete->priv->search_text = NULL;
-
- e_completion_clear_matches (complete);
- e_completion_clear_search_stack (complete);
-
- g_ptr_array_free (complete->priv->matches, TRUE);
- complete->priv->matches = NULL;
-
- g_free (complete->priv);
- complete->priv = NULL;
-
- if (parent_class->destroy)
- (parent_class->destroy) (object);
-}
-
-static void
-e_completion_add_match (ECompletion *complete, ECompletionMatch *match)
-{
- g_return_if_fail (complete && E_IS_COMPLETION (complete));
- g_return_if_fail (match != NULL);
-
- g_ptr_array_add (complete->priv->matches, match);
-
- if (complete->priv->matches->len == 1) {
-
- complete->priv->min_score = complete->priv->max_score = match->score;
-
- } else {
-
- complete->priv->min_score = MIN (complete->priv->min_score, match->score);
- complete->priv->max_score = MAX (complete->priv->max_score, match->score);
-
- }
-}
-
-static void
-e_completion_clear_matches (ECompletion *complete)
-{
- ECompletionMatch *match;
- GPtrArray *m;
- int i;
-
- g_return_if_fail (E_IS_COMPLETION (complete));
-
- m = complete->priv->matches;
- for (i = 0; i < m->len; i++) {
- match = g_ptr_array_index (m, i);
- e_completion_match_unref (match);
- }
- g_ptr_array_set_size (m, 0);
-
- complete->priv->min_score = 0;
- complete->priv->max_score = 0;
-}
-
-void
-e_completion_clear (ECompletion *complete)
-{
- g_return_if_fail (E_IS_COMPLETION (complete));
-
- /* FIXME: do we really want _clear and _clear_matches() ? */
-
- /* I think yes, because it is convenient to be able to clear our match cache
- without emitting a "clear_completion" signal. -JT */
-
- e_completion_clear_matches (complete);
- e_completion_clear_search_stack (complete);
- complete->priv->refinement_count = 0;
- complete->priv->match_count = 0;
- gtk_signal_emit (GTK_OBJECT (complete), e_completion_signals[E_COMPLETION_CLEAR_COMPLETION]);
-}
-
-static void
-e_completion_push_search (ECompletion *complete, const gchar *text, gint pos)
-{
- ECompletionSearch *search;
-
- g_return_if_fail (E_IS_COMPLETION (complete));
-
- search = g_new (ECompletionSearch, 1);
- search->text = complete->priv->search_text;
- search->pos = complete->priv->pos;
- complete->priv->search_stack = g_list_prepend (complete->priv->search_stack, search);
-
- complete->priv->search_text = g_strdup (text);
- complete->priv->pos = pos;
-}
-
-static void
-e_completion_pop_search (ECompletion *complete)
-{
- ECompletionSearch *search;
- GList *old_link = complete->priv->search_stack;
-
- g_return_if_fail (E_IS_COMPLETION (complete));
- g_return_if_fail (complete->priv->search_stack != NULL);
-
- g_free (complete->priv->search_text);
-
- search = complete->priv->search_stack->data;
- complete->priv->search_text = search->text;
- complete->priv->pos = search->pos;
-
- g_free (search);
- complete->priv->search_stack = g_list_remove_link (complete->priv->search_stack,
- complete->priv->search_stack);
- g_list_free_1 (old_link);
-}
-
-static void
-e_completion_clear_search_stack (ECompletion *complete)
-{
- GList *iter;
-
- g_return_if_fail (E_IS_COMPLETION (complete));
-
- for (iter = complete->priv->search_stack; iter != NULL; iter = g_list_next (iter)) {
- ECompletionSearch *search = iter->data;
- g_free (search->text);
- g_free (search);
- }
- g_list_free (complete->priv->search_stack);
- complete->priv->search_stack = NULL;
-}
-
-static void
-e_completion_refine_search (ECompletion *comp, const gchar *text, gint pos, ECompletionRefineFn refine_fn)
-{
- GPtrArray *m;
- gint i;
-
- comp->priv->refining = TRUE;
-
- e_completion_push_search (comp, text, pos);
-
- gtk_signal_emit (GTK_OBJECT (comp), e_completion_signals[E_COMPLETION_BEGIN_COMPLETION], text, pos, comp->priv->limit);
-
- comp->priv->match_count = 0;
-
- comp->priv->searching = TRUE;
-
- m = comp->priv->matches;
- for (i = 0; i < m->len; ++i) {
- ECompletionMatch *match = g_ptr_array_index (m, i);
- if (comp->priv->refinement_count == match->hit_count
- && refine_fn (comp, match, text, pos)) {
- ++match->hit_count;
- gtk_signal_emit (GTK_OBJECT (comp), e_completion_signals[E_COMPLETION_COMPLETION], match);
- ++comp->priv->match_count;
- }
- }
-
- ++comp->priv->refinement_count;
-
- gtk_signal_emit (GTK_OBJECT (comp), e_completion_signals[E_COMPLETION_END_COMPLETION]);
-
- comp->priv->searching = FALSE;
- comp->priv->refining = FALSE;
-}
-
-static void
-e_completion_unrefine_search (ECompletion *comp)
-{
- GPtrArray *m;
- gint i;
-
- comp->priv->refining = TRUE;
-
- e_completion_pop_search (comp);
-
- gtk_signal_emit (GTK_OBJECT (comp), e_completion_signals[E_COMPLETION_BEGIN_COMPLETION], comp->priv->search_text, comp->priv->pos, comp->priv->limit);
-
- comp->priv->match_count = 0;
- --comp->priv->refinement_count;
-
- comp->priv->searching = TRUE;
-
- m = comp->priv->matches;
- for (i = 0; i < m->len; ++i) {
- ECompletionMatch *match = g_ptr_array_index (m, i);
- if (comp->priv->refinement_count <= match->hit_count) {
- match->hit_count = comp->priv->refinement_count;
- gtk_signal_emit (GTK_OBJECT (comp), e_completion_signals[E_COMPLETION_COMPLETION], match);
- ++comp->priv->match_count;
- }
- }
-
- gtk_signal_emit (GTK_OBJECT (comp), e_completion_signals[E_COMPLETION_END_COMPLETION]);
-
- comp->priv->searching = FALSE;
- comp->priv->refining = FALSE;
-}
-
-void
-e_completion_begin_search (ECompletion *complete, const gchar *text, gint pos, gint limit)
-{
- ECompletionClass *klass;
- ECompletionRefineFn refine_fn;
-
- g_return_if_fail (complete != NULL);
- g_return_if_fail (E_IS_COMPLETION (complete));
- g_return_if_fail (text != NULL);
-
- klass = E_COMPLETION_CLASS (GTK_OBJECT (complete)->klass);
-
- if (!complete->priv->searching && complete->priv->done_search) {
-
- /* If the search we are requesting is the same as what we had before our last refinement,
- treat the request as an unrefine. */
- if (complete->priv->search_stack != NULL) {
- ECompletionSearch *search = complete->priv->search_stack->data;
- if ((klass->ignore_pos_on_auto_unrefine || search->pos == pos)
- && !strcmp (search->text, text)) {
- e_completion_unrefine_search (complete);
- return;
- }
- }
-
- if (klass->auto_refine
- && (refine_fn = klass->auto_refine (complete,
- complete->priv->search_text, complete->priv->pos,
- text, pos))) {
- e_completion_refine_search (complete, text, pos, refine_fn);
- return;
- }
-
- }
-
- /* Stop any prior search. */
- if (complete->priv->searching)
- e_completion_cancel_search (complete);
-
- e_completion_clear_search_stack (complete);
-
- g_free (complete->priv->search_text);
- complete->priv->search_text = g_strdup (text);
-
- complete->priv->pos = pos;
- complete->priv->searching = TRUE;
- complete->priv->done_search = FALSE;
-
- e_completion_clear_matches (complete);
-
- complete->priv->limit = limit > 0 ? limit : G_MAXINT;
- complete->priv->refinement_count = 0;
-
- gtk_signal_emit (GTK_OBJECT (complete), e_completion_signals[E_COMPLETION_BEGIN_COMPLETION], text, pos, limit);
- gtk_signal_emit (GTK_OBJECT (complete), e_completion_signals[E_COMPLETION_REQUEST_COMPLETION], text, pos, limit);
-}
-
-void
-e_completion_cancel_search (ECompletion *complete)
-{
- g_return_if_fail (complete != NULL);
- g_return_if_fail (E_IS_COMPLETION (complete));
-
- /* If there is no search to cancel, just silently return. */
- if (!complete->priv->searching)
- return;
-
- gtk_signal_emit (GTK_OBJECT (complete), e_completion_signals[E_COMPLETION_CANCEL_COMPLETION]);
-
- complete->priv->searching = FALSE;
-}
-
-gboolean
-e_completion_searching (ECompletion *complete)
-{
- g_return_val_if_fail (complete != NULL, FALSE);
- g_return_val_if_fail (E_IS_COMPLETION (complete), FALSE);
-
- return complete->priv->searching;
-}
-
-gboolean
-e_completion_refining (ECompletion *complete)
-{
- g_return_val_if_fail (complete != NULL, FALSE);
- g_return_val_if_fail (E_IS_COMPLETION (complete), FALSE);
-
- return complete->priv->refining;
-}
-
-const gchar *
-e_completion_search_text (ECompletion *complete)
-{
- g_return_val_if_fail (complete != NULL, NULL);
- g_return_val_if_fail (E_IS_COMPLETION (complete), NULL);
-
- return complete->priv->search_text;
-}
-
-gint
-e_completion_search_text_pos (ECompletion *complete)
-{
- g_return_val_if_fail (complete != NULL, -1);
- g_return_val_if_fail (E_IS_COMPLETION (complete), -1);
-
- return complete->priv->pos;
-}
-
-gint
-e_completion_match_count (ECompletion *complete)
-{
- g_return_val_if_fail (complete != NULL, 0);
- g_return_val_if_fail (E_IS_COMPLETION (complete), 0);
-
- return complete->priv->refinement_count > 0 ? complete->priv->match_count : complete->priv->matches->len;
-}
-
-void
-e_completion_foreach_match (ECompletion *complete, ECompletionMatchFn fn, gpointer closure)
-{
- GPtrArray *m;
- int i;
-
- g_return_if_fail (complete != NULL);
- g_return_if_fail (E_IS_COMPLETION (complete));
-
- if (fn == NULL)
- return;
-
- m = complete->priv->matches;
- for (i = 0; i < m->len; i++) {
- ECompletionMatch *match = g_ptr_array_index (m, i);
- if (match->hit_count == complete->priv->refinement_count) {
- fn (match, closure);
- }
- }
-}
-
-ECompletion *
-e_completion_new (void)
-{
- return E_COMPLETION (gtk_type_new (e_completion_get_type ()));
-}
-
-static gboolean
-e_completion_sort (ECompletion *complete)
-{
- GPtrArray *m;
- int i;
- GList *sort_list = NULL, *j;
- gboolean diff;
-
- m = complete->priv->matches;
-
- for (i = 0; i < m->len; i++)
- sort_list = g_list_append (sort_list,
- g_ptr_array_index (m, i));
-
- sort_list = g_list_sort (sort_list, (GCompareFunc) e_completion_match_compare_alpha);
-
- diff = FALSE;
-
- for (i=0, j=sort_list; i < m->len; i++, j = g_list_next (j)) {
- if (g_ptr_array_index (m, i) == j->data)
- continue;
-
- diff = TRUE;
- g_ptr_array_index (m, i) = j->data;
- }
-
- g_list_free (sort_list);
-
- return diff;
-}
-
-/* Emit a restart signal and re-declare our matches, up to the limit. */
-static void
-e_completion_restart (ECompletion *complete)
-{
- GPtrArray *m;
- gint i, count;
-
- gtk_signal_emit (GTK_OBJECT (complete), e_completion_signals[E_COMPLETION_RESTART_COMPLETION]);
-
- m = complete->priv->matches;
- for (i = count = 0;
- i < m->len && count < complete->priv->limit;
- i++, count++) {
- gtk_signal_emit (GTK_OBJECT (complete),
- e_completion_signals[E_COMPLETION_COMPLETION],
- g_ptr_array_index (m, i));
- }
-}
-
-void
-e_completion_found_match (ECompletion *complete, ECompletionMatch *match)
-{
- g_return_if_fail (complete);
- g_return_if_fail (E_IS_COMPLETION (complete));
- g_return_if_fail (match != NULL);
-
- if (! complete->priv->searching) {
- g_warning ("e_completion_found_match(...,\"%s\",...) called outside of a search", match->match_text);
- return;
- }
-
- /* For now, do nothing when we hit the limit --- just don't
- * announce the incoming matches. */
- if (complete->priv->matches->len >= complete->priv->limit) {
- e_completion_match_unref (match);
- return;
- }
-
- e_completion_add_match (complete, match);
-
- gtk_signal_emit (GTK_OBJECT (complete), e_completion_signals[E_COMPLETION_COMPLETION], match);
-}
-
-/* to optimize this, make the match a hash table */
-void
-e_completion_lost_match (ECompletion *complete, ECompletionMatch *match)
-{
- gboolean removed;
-
- g_return_if_fail (E_IS_COMPLETION (complete));
- g_return_if_fail (match != NULL);
-
- /* FIXME: remove fast */
- removed = g_ptr_array_remove (complete->priv->matches,
- match);
-
- /* maybe just return here? */
- g_return_if_fail (removed);
-
- gtk_signal_emit (GTK_OBJECT (complete), e_completion_signals[E_COMPLETION_LOST_COMPLETION], match);
-
- e_completion_match_unref (match);
-}
-
-void
-e_completion_end_search (ECompletion *complete)
-{
- g_return_if_fail (complete != NULL);
- g_return_if_fail (E_IS_COMPLETION (complete));
- g_return_if_fail (complete->priv->searching);
-
- /* our table model should be sorted by a non-visible column of
- * doubles (the score) rather than whatever we are doing
- */
- /* If sorting by score accomplishes anything, issue a restart right before we end. */
- if (e_completion_sort (complete))
- e_completion_restart (complete);
-
- gtk_signal_emit (GTK_OBJECT (complete), e_completion_signals[E_COMPLETION_END_COMPLETION]);
-
- complete->priv->searching = FALSE;
- complete->priv->done_search = TRUE;
-}
-
diff --git a/widgets/text/e-completion.h b/widgets/text/e-completion.h
deleted file mode 100644
index 9e7b5ab4b3..0000000000
--- a/widgets/text/e-completion.h
+++ /dev/null
@@ -1,103 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-completion.h - A base class for text completion.
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Miguel de Icaza <miguel@ximian.com>
- * Adapted by Jon Trowbridge <trow@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef E_COMPLETION_H
-#define E_COMPLETION_H
-
-#include <libgnome/gnome-defs.h>
-#include <gtk/gtkobject.h>
-#include "e-completion-match.h"
-
-BEGIN_GNOME_DECLS
-
-#define E_COMPLETION_TYPE (e_completion_get_type ())
-#define E_COMPLETION(o) (GTK_CHECK_CAST ((o), E_COMPLETION_TYPE, ECompletion))
-#define E_COMPLETION_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), E_COMPLETION_TYPE, ECompletionClass))
-#define E_IS_COMPLETION(o) (GTK_CHECK_TYPE ((o), E_COMPLETION_TYPE))
-#define E_IS_COMPLETION_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_COMPLETION_TYPE))
-
-typedef struct _ECompletion ECompletion;
-typedef struct _ECompletionClass ECompletionClass;
-struct _ECompletionPrivate;
-
-typedef gboolean (*ECompletionRefineFn) (ECompletion *, ECompletionMatch *, const gchar *search_text, gint pos);
-
-struct _ECompletion {
- GtkObject parent;
-
- struct _ECompletionPrivate *priv;
-};
-
-struct _ECompletionClass {
- GtkObjectClass parent_class;
-
- /* virtual functions */
- ECompletionRefineFn (*auto_refine) (ECompletion *comp,
- const gchar *old_text, gint old_pos,
- const gchar *new_text, gint new_pos);
- gboolean ignore_pos_on_auto_unrefine;
-
- /* Signals */
- void (*request_completion) (ECompletion *comp, const gchar *search_text, gint pos, gint limit);
-
- void (*begin_completion) (ECompletion *comp, const gchar *search_text, gint pos, gint limit);
- void (*restart_completion) (ECompletion *comp);
-
- void (*completion) (ECompletion *comp, ECompletionMatch *match);
- void (*lost_completion) (ECompletion *comp, ECompletionMatch *match);
-
- void (*cancel_completion) (ECompletion *comp);
- void (*end_completion) (ECompletion *comp);
- void (*clear_completion) (ECompletion *comp);
-};
-
-GtkType e_completion_get_type (void);
-
-void e_completion_begin_search (ECompletion *comp, const gchar *text, gint pos, gint limit);
-void e_completion_cancel_search (ECompletion *comp);
-
-gboolean e_completion_searching (ECompletion *comp);
-gboolean e_completion_refining (ECompletion *comp);
-const gchar *e_completion_search_text (ECompletion *comp);
-gint e_completion_search_text_pos (ECompletion *comp);
-gint e_completion_match_count (ECompletion *comp);
-void e_completion_foreach_match (ECompletion *comp, ECompletionMatchFn fn, gpointer user_data);
-
-ECompletion *e_completion_new (void);
-
-
-
-/* These functions should only be called by derived classes or search callbacks,
- or very bad things might happen. */
-
-void e_completion_found_match (ECompletion *comp, ECompletionMatch *);
-void e_completion_lost_match (ECompletion *comp, ECompletionMatch *);
-void e_completion_clear (ECompletion *comp);
-void e_completion_end_search (ECompletion *comp);
-
-END_GNOME_DECLS
-
-
-#endif /* E_COMPLETION_H */
-
diff --git a/widgets/text/e-entry-test.c b/widgets/text/e-entry-test.c
deleted file mode 100644
index 94f490113b..0000000000
--- a/widgets/text/e-entry-test.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-entry-test.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include "config.h"
-
-#include <gnome.h>
-#include "e-entry.h"
-
-static void destroy_callback(GtkWidget *app, gpointer data)
-{
- exit(0);
-}
-
-#if 0
-static void about_callback( GtkWidget *widget, gpointer data )
-{
-
- const gchar *authors[] =
- {
- "Christopher James Lahey <clahey@umich.edu>",
- 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 *entry;
-
- /* bindtextdomain (PACKAGE, GNOMELOCALEDIR);
- textdomain (PACKAGE);*/
-
- gnome_init( "EEntry Test", VERSION, argc, argv);
- app = gnome_app_new("EEntry Test", NULL);
-
- entry = e_entry_new();
- gtk_object_set(GTK_OBJECT(entry),
- "editable", TRUE,
- "use_ellipsis", TRUE,
- NULL);
- gnome_app_set_contents( GNOME_APP( app ), entry );
-
- /* 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/widgets/text/e-entry.c b/widgets/text/e-entry.c
deleted file mode 100644
index 6c060244f5..0000000000
--- a/widgets/text/e-entry.c
+++ /dev/null
@@ -1,1355 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-entry.c - An EText-based entry widget
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- * Jon Trowbridge <trow@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <math.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
-#endif
-#include <stdio.h>
-#include <gdk/gdkkeysyms.h>
-#include <gtk/gtksignal.h>
-#include <gnome-xml/parser.h>
-#include <libgnomeui/gnome-canvas.h>
-#include "gal/util/e-util.h"
-#include "gal/widgets/e-canvas.h"
-#include "gal/widgets/e-canvas-utils.h"
-#include "e-completion-view.h"
-#include "e-text.h"
-#include "e-entry.h"
-
-#define MOVE_RIGHT_AND_UP 0
-
-#define EVIL_POINTER_WARPING_HACK
-
-#ifdef EVIL_POINTER_WARPING_HACK
-#include <gdk/gdkx.h>
-#endif
-
-#define MIN_ENTRY_WIDTH 150
-
-#define d(x)
-
-#define PARENT_TYPE gtk_table_get_type ()
-
-static GtkObjectClass *parent_class;
-
-enum {
- E_ENTRY_CHANGED,
- E_ENTRY_ACTIVATE,
- E_ENTRY_POPUP,
- E_ENTRY_COMPLETION_POPUP,
- E_ENTRY_LAST_SIGNAL
-};
-
-static guint e_entry_signals[E_ENTRY_LAST_SIGNAL] = { 0 };
-
-/* Object argument IDs */
-enum {
- ARG_0,
- ARG_MODEL,
- ARG_EVENT_PROCESSOR,
- ARG_TEXT,
- ARG_FONT,
- ARG_FONTSET,
- ARG_FONT_GDK,
- ARG_ANCHOR,
- ARG_JUSTIFICATION,
- ARG_X_OFFSET,
- ARG_Y_OFFSET,
- ARG_FILL_COLOR,
- ARG_FILL_COLOR_GDK,
- ARG_FILL_COLOR_RGBA,
- ARG_FILL_STIPPLE,
- ARG_EDITABLE,
- ARG_USE_ELLIPSIS,
- ARG_ELLIPSIS,
- ARG_LINE_WRAP,
- ARG_BREAK_CHARACTERS,
- ARG_MAX_LINES,
- ARG_ALLOW_NEWLINES,
- ARG_DRAW_BORDERS,
- ARG_DRAW_BACKGROUND,
- ARG_DRAW_BUTTON,
- ARG_EMULATE_LABEL_RESIZE,
- ARG_CURSOR_POS,
-};
-
-typedef struct _EEntryPrivate EEntryPrivate;
-struct _EEntryPrivate {
- GtkJustification justification;
-
- guint changed_proxy_tag;
- guint activate_proxy_tag;
- guint popup_proxy_tag;
- /* Data related to completions */
- ECompletion *completion;
- EEntryCompletionHandler handler;
- GtkWidget *completion_view;
- guint nonempty_signal_id;
- guint added_signal_id;
- guint full_signal_id;
- guint browse_signal_id;
- guint unbrowse_signal_id;
- guint activate_signal_id;
- GtkWidget *completion_view_popup;
- gboolean popup_is_visible;
- gchar *pre_browse_text;
- gint completion_delay;
- guint completion_delay_tag;
- gboolean ptr_grab;
- gboolean changed_since_keypress;
- guint changed_since_keypress_tag;
- gint last_completion_pos;
-
- guint draw_borders : 1;
- guint emulate_label_resize : 1;
- guint have_set_transient : 1;
- gint last_width;
-};
-
-static gboolean e_entry_is_empty (EEntry *entry);
-static void e_entry_show_popup (EEntry *entry, gboolean x);
-static void e_entry_start_completion (EEntry *entry);
-static void e_entry_start_delayed_completion (EEntry *entry, gint delay);
-static void e_entry_cancel_delayed_completion (EEntry *entry);
-
-static void
-canvas_size_allocate (GtkWidget *widget, GtkAllocation *alloc,
- EEntry *entry)
-{
- gnome_canvas_set_scroll_region (entry->canvas,
- 0, 0, alloc->width, alloc->height);
- gtk_object_set (GTK_OBJECT (entry->item),
- "clip_width", (double) (alloc->width),
- "clip_height", (double) (alloc->height),
- NULL);
-
- switch (entry->priv->justification) {
- case GTK_JUSTIFY_RIGHT:
- e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(entry->item),
- alloc->width, 0);
- break;
- case GTK_JUSTIFY_CENTER:
- e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(entry->item),
- alloc->width / 2, 0);
- break;
- default:
- e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(entry->item),
- 0, 0);
- break;
- }
-}
-
-static void
-canvas_size_request (GtkWidget *widget, GtkRequisition *requisition,
- EEntry *entry)
-{
- int xthick, ythick;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GNOME_IS_CANVAS (widget));
- g_return_if_fail (requisition != NULL);
-
- if (entry->priv->draw_borders) {
- xthick = 2 * widget->style->klass->xthickness;
- ythick = 2 * widget->style->klass->ythickness;
- } else {
- xthick = ythick = 0;
- }
-
- if (entry->priv->emulate_label_resize) {
- gdouble width;
- gtk_object_get (GTK_OBJECT (entry->item),
- "text_width", &width,
- NULL);
- requisition->width = 2 + xthick + width;
- } else {
- requisition->width = 2 + MIN_ENTRY_WIDTH + xthick;
- }
- if (entry->priv->last_width != requisition->width)
- gtk_widget_queue_resize (widget);
- entry->priv->last_width = requisition->width;
-
- d(g_print("%s: width = %d\n", __FUNCTION__, requisition->width));
-
- requisition->height = (2 + widget->style->font->ascent +
- widget->style->font->descent +
- ythick);
-}
-
-static gint
-canvas_focus_in_event (GtkWidget *widget, GdkEventFocus *focus, EEntry *entry)
-{
- if (entry->canvas->focused_item != GNOME_CANVAS_ITEM(entry->item))
- gnome_canvas_item_grab_focus(GNOME_CANVAS_ITEM(entry->item));
-
- return FALSE;
-}
-
-static void
-e_entry_text_keypress (EText *text, guint keyval, guint state, EEntry *entry)
-{
- if (entry->priv->changed_since_keypress_tag) {
- gtk_timeout_remove (entry->priv->changed_since_keypress_tag);
- entry->priv->changed_since_keypress_tag = 0;
- }
-
- if (entry->priv->changed_since_keypress
- || (entry->priv->popup_is_visible && e_entry_get_position (entry) != entry->priv->last_completion_pos)) {
- if (e_entry_is_empty (entry)) {
- e_entry_cancel_delayed_completion (entry);
- e_entry_show_popup (entry, FALSE);
- } else if (entry->priv->completion_delay >= 0) {
- int delay;
- delay = entry->priv->popup_is_visible
- ? 1
- : entry->priv->completion_delay;
- e_entry_start_delayed_completion (entry, delay);
- }
- }
- entry->priv->changed_since_keypress = FALSE;
-}
-
-static gint
-changed_since_keypress_timeout_fn (gpointer user_data)
-{
- EEntry *entry = E_ENTRY (user_data);
- entry->priv->changed_since_keypress = FALSE;
- entry->priv->changed_since_keypress_tag = 0;
- return FALSE;
-}
-
-static void
-e_entry_proxy_changed (EText *text, EEntry *entry)
-{
- if (entry->priv->changed_since_keypress_tag)
- gtk_timeout_remove (entry->priv->changed_since_keypress_tag);
- entry->priv->changed_since_keypress = TRUE;
- entry->priv->changed_since_keypress_tag = gtk_timeout_add (20, changed_since_keypress_timeout_fn, entry);
-
- gtk_signal_emit (GTK_OBJECT (entry), e_entry_signals [E_ENTRY_CHANGED]);
-}
-
-static void
-e_entry_proxy_activate (EText *text, EEntry *entry)
-{
- gtk_signal_emit (GTK_OBJECT (entry), e_entry_signals [E_ENTRY_ACTIVATE]);
-}
-
-static void
-e_entry_proxy_popup (EText *text, GdkEventButton *ev, gint pos, EEntry *entry)
-{
- gtk_signal_emit (GTK_OBJECT (entry), e_entry_signals [E_ENTRY_POPUP], ev, pos);
-}
-
-static void
-e_entry_init (GtkObject *object)
-{
- EEntry *entry = E_ENTRY (object);
- GtkTable *gtk_table = GTK_TABLE (object);
-
- entry->priv = g_new0 (EEntryPrivate, 1);
-
- entry->priv->emulate_label_resize = FALSE;
-
- entry->canvas = GNOME_CANVAS (e_canvas_new ());
-
- gtk_signal_connect (GTK_OBJECT (entry->canvas),
- "size_allocate",
- GTK_SIGNAL_FUNC (canvas_size_allocate),
- entry);
-
- gtk_signal_connect (GTK_OBJECT (entry->canvas),
- "size_request",
- GTK_SIGNAL_FUNC (canvas_size_request),
- entry);
-
- gtk_signal_connect(GTK_OBJECT (entry->canvas),
- "focus_in_event",
- GTK_SIGNAL_FUNC(canvas_focus_in_event),
- entry);
-
- entry->priv->draw_borders = TRUE;
- entry->priv->last_width = -1;
-
- entry->item = E_TEXT(gnome_canvas_item_new(
- gnome_canvas_root (entry->canvas),
- e_text_get_type(),
- "clip", TRUE,
- "fill_clip_rectangle", TRUE,
- "anchor", GTK_ANCHOR_NW,
- "draw_borders", TRUE,
- "draw_background", TRUE,
- "draw_button", FALSE,
- "max_lines", 1,
- "editable", TRUE,
- "allow_newlines", FALSE,
- NULL));
-
- gtk_signal_connect (GTK_OBJECT (entry->item),
- "keypress",
- GTK_SIGNAL_FUNC (e_entry_text_keypress),
- entry);
-
- entry->priv->justification = GTK_JUSTIFY_LEFT;
- gtk_table_attach (gtk_table, GTK_WIDGET (entry->canvas),
- 0, 1, 0, 1,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK,
- GTK_EXPAND | GTK_FILL | GTK_SHRINK,
- 0, 0);
- gtk_widget_show (GTK_WIDGET (entry->canvas));
-
- /*
- * Proxy functions: we proxy the changed and activate signals
- * from the item to ourselves
- */
- entry->priv->changed_proxy_tag = gtk_signal_connect (
- GTK_OBJECT (entry->item),
- "changed",
- GTK_SIGNAL_FUNC (e_entry_proxy_changed),
- entry);
- entry->priv->activate_proxy_tag = gtk_signal_connect (
- GTK_OBJECT (entry->item),
- "activate",
- GTK_SIGNAL_FUNC (e_entry_proxy_activate),
- entry);
- entry->priv->popup_proxy_tag = gtk_signal_connect (
- GTK_OBJECT (entry->item),
- "popup",
- GTK_SIGNAL_FUNC (e_entry_proxy_popup),
- entry);
-
- entry->priv->completion_delay = 1;
-}
-
-/**
- * e_entry_construct
- *
- * Constructs the given EEntry.
- *
- **/
-void
-e_entry_construct (EEntry *entry)
-{
- /* Do nothing */
-}
-
-
-/**
- * e_entry_new
- *
- * Creates a new EEntry.
- *
- * Returns: The new EEntry
- **/
-GtkWidget *
-e_entry_new (void)
-{
- EEntry *entry;
- entry = gtk_type_new (e_entry_get_type ());
- e_entry_construct (entry);
-
- return GTK_WIDGET (entry);
-}
-
-const gchar *
-e_entry_get_text (EEntry *entry)
-{
- g_return_val_if_fail (entry != NULL && E_IS_ENTRY (entry), NULL);
-
- return e_text_model_get_text (entry->item->model);
-}
-
-void
-e_entry_set_text (EEntry *entry, const gchar *txt)
-{
- g_return_if_fail (entry != NULL && E_IS_ENTRY (entry));
-
- e_text_model_set_text (entry->item->model, txt);
-}
-
-static void
-e_entry_set_text_quiet (EEntry *entry, const gchar *txt)
-{
- g_return_if_fail (entry != NULL && E_IS_ENTRY (entry));
-
- gtk_signal_handler_block (GTK_OBJECT (entry->item), entry->priv->changed_proxy_tag);
- e_entry_set_text (entry, txt);
- gtk_signal_handler_unblock (GTK_OBJECT (entry->item), entry->priv->changed_proxy_tag);
-}
-
-
-void
-e_entry_set_editable (EEntry *entry, gboolean am_i_editable)
-{
- g_return_if_fail (entry != NULL && E_IS_ENTRY (entry));
-
- gtk_object_set (GTK_OBJECT (entry->item), "editable", am_i_editable, NULL);
-}
-
-gint
-e_entry_get_position (EEntry *entry)
-{
- g_return_val_if_fail (entry != NULL && E_IS_ENTRY (entry), -1);
-
- return entry->item->selection_start;
-}
-
-void
-e_entry_set_position (EEntry *entry, gint pos)
-{
- g_return_if_fail (entry != NULL && E_IS_ENTRY (entry));
- if (pos < 0)
- pos = 0;
- else if (pos > e_text_model_get_text_length (entry->item->model))
- pos = e_text_model_get_text_length (entry->item->model);
-
- entry->item->selection_start = entry->item->selection_end = pos;
-}
-
-void
-e_entry_select_region (EEntry *entry, gint pos1, gint pos2)
-{
- gint len;
-
- g_return_if_fail (entry != NULL && E_IS_ENTRY (entry));
-
- len = e_text_model_get_text_length (entry->item->model);
- pos1 = CLAMP (pos1, 0, len);
- pos2 = CLAMP (pos2, 0, len);
-
- entry->item->selection_start = MIN (pos1, pos2);
- entry->item->selection_end = MAX (pos1, pos2);
-}
-
-/** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **/
-
-/*** Completion-related code ***/
-
-static gboolean
-e_entry_is_empty (EEntry *entry)
-{
- const gchar *txt = e_entry_get_text (entry);
-
- if (txt == NULL)
- return TRUE;
-
- while (*txt) {
- if (!isspace ((gint) *txt))
- return FALSE;
- ++txt;
- }
-
- return TRUE;
-}
-
-static void
-e_entry_show_popup (EEntry *entry, gboolean visible)
-{
- GtkWidget *pop = entry->priv->completion_view_popup;
-
- if (pop == NULL)
- return;
-
- /* The async query can give us a result after the focus was lost by the
- widget. In that case, we don't want to show the pop-up. */
- if (! GTK_WIDGET_HAS_FOCUS (entry->canvas))
- return;
-
- if (visible) {
- GtkAllocation *dim = &(GTK_WIDGET (entry)->allocation);
- gint x, y, xo, yo, fudge;
- const GdkEventMask grab_mask = (GdkEventMask)GDK_BUTTON_PRESS_MASK | GDK_BUTTON_MOTION_MASK | GDK_BUTTON_RELEASE_MASK;
-
- /* Figure out where to put our popup. */
- gdk_window_get_origin (GTK_WIDGET (entry)->window, &xo, &yo);
- x = xo + dim->x;
- y = yo + dim->height + dim->y;
-
-#if MOVE_RIGHT_AND_UP
- /* Put our popup slightly to the right and up, to try to give a visual cue that this popup
- is tied to this entry. Otherwise one-row popups can sort of "blend" with an entry
- directly below. */
- fudge = MAX (dim->height/10, 3); /* just in case we are using a really big font, etc. */
- x += 2*fudge;
- y -= fudge;
-#else
- fudge = 1;
- y -= fudge;
-#endif
- gtk_widget_set_uposition (pop, x, y);
- e_completion_view_set_width (E_COMPLETION_VIEW (entry->priv->completion_view), dim->width);
-
-#ifdef EVIL_POINTER_WARPING_HACK
- /*
- I should have learned by now to listen to Havoc...
- http://developer.gnome.org/doc/GGAD/faqs.html
- */
-
- if (! entry->priv->popup_is_visible) {
- GdkWindow *gwin = GTK_WIDGET (entry)->window;
- gint xx, yy;
- gdk_window_get_pointer (gwin, &xx, &yy, NULL);
- xx += xo;
- yy += yo;
-
- /* If we are inside the "zone of death" where the popup will appear, warp the pointer to safety.
- This is a horrible thing to do. */
- if (y <= yy && yy < yy + dim->height && x <= xx && xx < xx + dim->width) {
- XWarpPointer (GDK_WINDOW_XDISPLAY (gwin), None, GDK_WINDOW_XWINDOW (gwin),
- 0, 0, 0, 0,
- xx - xo, (y-1) - yo);
- }
- }
-#endif
-
- gtk_widget_show (pop);
-
-
- if (getenv ("GAL_E_ENTRY_NO_GRABS_HACK") == NULL && !entry->priv->ptr_grab) {
- entry->priv->ptr_grab = (0 == gdk_pointer_grab (GTK_WIDGET (entry->priv->completion_view)->window, TRUE,
- grab_mask, NULL, NULL, GDK_CURRENT_TIME));
- if (entry->priv->ptr_grab) {
- gtk_grab_add (GTK_WIDGET (entry->priv->completion_view));
- }
- }
-
-
- } else {
-
- gtk_widget_hide (pop);
-
- if (entry->priv->ptr_grab) {
- gdk_pointer_ungrab (GDK_CURRENT_TIME);
- gtk_grab_remove (GTK_WIDGET (entry->priv->completion_view));
- }
-
- entry->priv->ptr_grab = FALSE;
-
- entry->priv->last_completion_pos = -1;
- }
-
- e_completion_view_set_editable (E_COMPLETION_VIEW (entry->priv->completion_view), visible);
-
- if (entry->priv->popup_is_visible != visible) {
- entry->priv->popup_is_visible = visible;
- gtk_signal_emit (GTK_OBJECT (entry), e_entry_signals[E_ENTRY_COMPLETION_POPUP], (gint) visible);
- }
-}
-
-static void
-e_entry_refresh_popup (EEntry *entry)
-{
- if (entry->priv->popup_is_visible)
- e_entry_show_popup (entry, TRUE);
-}
-
-static void
-e_entry_start_completion (EEntry *entry)
-{
- if (entry->priv->completion == NULL)
- return;
-
- e_entry_cancel_delayed_completion (entry);
-
- if (e_entry_is_empty (entry))
- return;
-
- e_completion_begin_search (entry->priv->completion,
- e_entry_get_text (entry),
- entry->priv->last_completion_pos = e_entry_get_position (entry),
- 0); /* No limit. Probably a bad idea. */
-}
-
-static gboolean
-start_delayed_cb (gpointer user_data)
-{
- EEntry *entry = E_ENTRY (user_data);
- entry->priv->completion_delay_tag = 0;
- e_entry_start_completion (entry);
- return FALSE;
-}
-
-static void
-e_entry_start_delayed_completion (EEntry *entry, gint delay)
-{
- if (delay < 0)
- return;
-
- e_entry_cancel_delayed_completion (entry);
- entry->priv->completion_delay_tag = gtk_timeout_add (MAX (delay, 1), start_delayed_cb, entry);
-}
-
-static void
-e_entry_cancel_delayed_completion (EEntry *entry)
-{
- if (entry->priv->completion == NULL)
- return;
-
- if (entry->priv->completion_delay_tag) {
- gtk_timeout_remove (entry->priv->completion_delay_tag);
- entry->priv->completion_delay_tag = 0;
- }
-}
-
-static void
-nonempty_cb (ECompletionView *view, gpointer user_data)
-{
- EEntry *entry = E_ENTRY (user_data);
-
- e_entry_show_popup (entry, TRUE);
-}
-
-static void
-added_cb (ECompletionView *view, gpointer user_data)
-{
- EEntry *entry = E_ENTRY (user_data);
- e_entry_refresh_popup (entry);
-}
-
-static void
-full_cb (ECompletionView *view, gpointer user_data)
-{
- EEntry *entry = E_ENTRY (user_data);
- gboolean show;
-
- show = GTK_WIDGET_HAS_FOCUS (GTK_WIDGET (entry->canvas)) && view->choices->len > 0;
- e_entry_show_popup (entry, show);
-}
-
-static void
-browse_cb (ECompletionView *view, ECompletionMatch *match, gpointer user_data)
-{
- EEntry *entry = E_ENTRY (user_data);
-
- if (match == NULL) {
- /* Requesting a completion. */
- e_entry_start_completion (entry);
- return;
- }
-
- if (entry->priv->pre_browse_text == NULL)
- entry->priv->pre_browse_text = g_strdup (e_entry_get_text (entry));
-
- /* If there is no other handler in place, echo the selected completion in
- the entry. */
- if (entry->priv->handler == NULL)
- e_entry_set_text_quiet (entry, e_completion_match_get_match_text (match));
-}
-
-static void
-unbrowse_cb (ECompletionView *view, gpointer user_data)
-{
- EEntry *entry = E_ENTRY (user_data);
-
- if (entry->priv->pre_browse_text) {
-
- if (entry->priv->handler == NULL)
- e_entry_set_text_quiet (entry, entry->priv->pre_browse_text);
-
- g_free (entry->priv->pre_browse_text);
- entry->priv->pre_browse_text = NULL;
- }
-
- e_entry_show_popup (entry, FALSE);
-}
-
-static void
-activate_cb (ECompletionView *view, ECompletionMatch *match, gpointer user_data)
-{
- EEntry *entry = E_ENTRY (user_data);
-
- e_entry_cancel_delayed_completion (entry);
-
- g_free (entry->priv->pre_browse_text);
- entry->priv->pre_browse_text = NULL;
- e_entry_show_popup (entry, FALSE);
-
- if (entry->priv->handler)
- entry->priv->handler (entry, match);
- else
- e_entry_set_text (entry, match->match_text);
-
- e_entry_cancel_delayed_completion (entry);
-}
-
-void
-e_entry_enable_completion (EEntry *entry, ECompletion *completion)
-{
- g_return_if_fail (entry != NULL && E_IS_ENTRY (entry));
- g_return_if_fail (completion != NULL && E_IS_COMPLETION (completion));
-
- e_entry_enable_completion_full (entry, completion, -1, NULL);
-}
-
-static void
-button_press_cb (GtkWidget *w, GdkEvent *ev, gpointer user_data)
-{
- EEntry *entry = E_ENTRY (user_data);
- GtkWidget *child;
-
- /* Bail out if our click happened inside of our widget. */
- child = gtk_get_event_widget (ev);
- if (child != w) {
- while (child) {
- if (child == w)
- return;
- child = child->parent;
- }
- }
-
- /* Treat this as an unbrowse */
- unbrowse_cb (E_COMPLETION_VIEW (w), entry);
-}
-
-static void
-cancel_completion_cb (ETextModel *model, gpointer user_data)
-{
- EEntry *entry = E_ENTRY (user_data);
-
- /* If we get the signal from the underlying text model, unbrowse.
- This usually means that the text model itself has done some
- sort of completion, or has otherwise transformed its contents
- in some way that would render any previous completion invalid. */
- unbrowse_cb (E_COMPLETION_VIEW (entry->priv->completion_view), entry);
-}
-
-static gint
-key_press_cb (GtkWidget *w, GdkEventKey *ev, gpointer user_data)
-{
- gint rv = 0;
- /* Forward signal */
- gtk_signal_emit_by_name (GTK_OBJECT (user_data), "key_press_event", ev, &rv);
- return rv;
-}
-
-static gint
-key_release_cb (GtkWidget *w, GdkEventKey *ev, gpointer user_data)
-{
- gint rv = 0;
- /* Forward signal */
- gtk_signal_emit_by_name (GTK_OBJECT (user_data), "key_release_event", ev, &rv);
- return rv;
-}
-
-static void
-e_entry_make_completion_window_transient (EEntry *entry)
-{
- GtkWidget *w;
-
- if (entry->priv->have_set_transient || entry->priv->completion_view_popup == NULL)
- return;
-
- w = GTK_WIDGET (entry)->parent;
- while (w && ! GTK_IS_WINDOW (w))
- w = w->parent;
-
- if (w) {
- gtk_window_set_transient_for (GTK_WINDOW (entry->priv->completion_view_popup),
- GTK_WINDOW (w));
- entry->priv->have_set_transient = 1;
- }
-}
-
-void
-e_entry_enable_completion_full (EEntry *entry, ECompletion *completion, gint delay, EEntryCompletionHandler handler)
-{
- g_return_if_fail (entry != NULL && E_IS_ENTRY (entry));
- g_return_if_fail (completion != NULL && E_IS_COMPLETION (completion));
-
- /* For now, completion can't be changed mid-stream. */
- g_return_if_fail (entry->priv->completion == NULL);
-
- entry->priv->completion = completion;
- gtk_object_ref (GTK_OBJECT (completion));
- gtk_object_sink (GTK_OBJECT (completion));
-
- entry->priv->completion_delay = delay;
- entry->priv->handler = handler;
-
- entry->priv->completion_view = e_completion_view_new (completion);
- /* Make the up and down keys enable and disable completions. */
- e_completion_view_set_complete_key (E_COMPLETION_VIEW (entry->priv->completion_view), GDK_Down);
- e_completion_view_set_uncomplete_key (E_COMPLETION_VIEW (entry->priv->completion_view), GDK_Up);
-
- gtk_signal_connect_after (GTK_OBJECT (entry->priv->completion_view),
- "button_press_event",
- GTK_SIGNAL_FUNC (button_press_cb),
- entry);
-
- entry->priv->nonempty_signal_id = gtk_signal_connect (GTK_OBJECT (entry->priv->completion_view),
- "nonempty",
- GTK_SIGNAL_FUNC (nonempty_cb),
- entry);
-
- entry->priv->added_signal_id = gtk_signal_connect (GTK_OBJECT (entry->priv->completion_view),
- "added",
- GTK_SIGNAL_FUNC (added_cb),
- entry);
-
- entry->priv->full_signal_id = gtk_signal_connect (GTK_OBJECT (entry->priv->completion_view),
- "full",
- GTK_SIGNAL_FUNC (full_cb),
- entry);
-
- entry->priv->browse_signal_id = gtk_signal_connect (GTK_OBJECT (entry->priv->completion_view),
- "browse",
- GTK_SIGNAL_FUNC (browse_cb),
- entry);
-
- entry->priv->unbrowse_signal_id = gtk_signal_connect (GTK_OBJECT (entry->priv->completion_view),
- "unbrowse",
- GTK_SIGNAL_FUNC (unbrowse_cb),
- entry);
-
- entry->priv->activate_signal_id = gtk_signal_connect (GTK_OBJECT (entry->priv->completion_view),
- "activate",
- GTK_SIGNAL_FUNC (activate_cb),
- entry);
-
- entry->priv->completion_view_popup = gtk_window_new (GTK_WINDOW_POPUP);
-
- e_entry_make_completion_window_transient (entry);
-
- gtk_signal_connect (GTK_OBJECT (entry->item->model),
- "cancel_completion",
- GTK_SIGNAL_FUNC (cancel_completion_cb),
- entry);
-
- gtk_signal_connect (GTK_OBJECT (entry->priv->completion_view_popup),
- "key_press_event",
- GTK_SIGNAL_FUNC (key_press_cb),
- entry->canvas);
- gtk_signal_connect (GTK_OBJECT (entry->priv->completion_view_popup),
- "key_release_event",
- GTK_SIGNAL_FUNC (key_release_cb),
- entry->canvas);
-
- e_completion_view_connect_keys (E_COMPLETION_VIEW (entry->priv->completion_view),
- GTK_WIDGET (entry->canvas));
-
- gtk_object_ref (GTK_OBJECT (entry->priv->completion_view_popup));
- gtk_object_sink (GTK_OBJECT (entry->priv->completion_view_popup));
- gtk_window_set_policy (GTK_WINDOW (entry->priv->completion_view_popup), TRUE, TRUE, TRUE);
- gtk_container_add (GTK_CONTAINER (entry->priv->completion_view_popup), entry->priv->completion_view);
- gtk_widget_show (entry->priv->completion_view);
-}
-
-gboolean
-e_entry_completion_popup_is_visible (EEntry *entry)
-{
- g_return_val_if_fail (E_IS_ENTRY (entry), FALSE);
-
- return entry->priv->popup_is_visible;
-}
-
-/** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **/
-
-static void
-et_get_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- EEntry *entry = E_ENTRY (o);
- GtkObject *item = GTK_OBJECT (entry->item);
-
- switch (arg_id){
- case ARG_MODEL:
- gtk_object_get(item,
- "model", &GTK_VALUE_OBJECT (*arg),
- NULL);
- break;
-
- case ARG_EVENT_PROCESSOR:
- gtk_object_get(item,
- "event_processor", &GTK_VALUE_OBJECT (*arg),
- NULL);
- break;
-
- case ARG_TEXT:
- gtk_object_get(item,
- "text", &GTK_VALUE_STRING (*arg),
- NULL);
- break;
-
- case ARG_FONT_GDK:
- gtk_object_get(item,
- "font_gdk", &GTK_VALUE_BOXED (*arg),
- NULL);
- break;
-
- case ARG_JUSTIFICATION:
- gtk_object_get(item,
- "justification", &GTK_VALUE_ENUM (*arg),
- NULL);
- break;
-
- case ARG_FILL_COLOR_GDK:
- gtk_object_get(item,
- "fill_color_gdk", &GTK_VALUE_BOXED (*arg),
- NULL);
- break;
-
- case ARG_FILL_COLOR_RGBA:
- gtk_object_get(item,
- "fill_color_rgba", &GTK_VALUE_UINT (*arg),
- NULL);
- break;
-
- case ARG_FILL_STIPPLE:
- gtk_object_get(item,
- "fill_stiple", &GTK_VALUE_BOXED (*arg),
- NULL);
- break;
-
- case ARG_EDITABLE:
- gtk_object_get(item,
- "editable", &GTK_VALUE_BOOL (*arg),
- NULL);
- break;
-
- case ARG_USE_ELLIPSIS:
- gtk_object_get(item,
- "use_ellipsis", &GTK_VALUE_BOOL (*arg),
- NULL);
- break;
-
- case ARG_ELLIPSIS:
- gtk_object_get(item,
- "ellipsis", &GTK_VALUE_STRING (*arg),
- NULL);
- break;
-
- case ARG_LINE_WRAP:
- gtk_object_get(item,
- "line_wrap", &GTK_VALUE_BOOL (*arg),
- NULL);
- break;
-
- case ARG_BREAK_CHARACTERS:
- gtk_object_get(item,
- "break_characters", &GTK_VALUE_STRING (*arg),
- NULL);
- break;
-
- case ARG_MAX_LINES:
- gtk_object_get(item,
- "max_lines", &GTK_VALUE_INT (*arg),
- NULL);
- break;
- case ARG_ALLOW_NEWLINES:
- gtk_object_get(item,
- "allow_newlines", &GTK_VALUE_BOOL (*arg),
- NULL);
- break;
-
- case ARG_DRAW_BORDERS:
- GTK_VALUE_BOOL (*arg) = entry->priv->draw_borders;
- break;
-
- case ARG_DRAW_BACKGROUND:
- gtk_object_get (item,
- "draw_background", &GTK_VALUE_BOOL (*arg),
- NULL);
- break;
-
- case ARG_DRAW_BUTTON:
- gtk_object_get (item,
- "draw_button", &GTK_VALUE_BOOL (*arg),
- NULL);
- break;
-
- case ARG_EMULATE_LABEL_RESIZE:
- GTK_VALUE_BOOL (*arg) = entry->priv->emulate_label_resize;
- break;
-
- case ARG_CURSOR_POS:
- gtk_object_get (item,
- "cursor_pos", &GTK_VALUE_INT (*arg),
- NULL);
-
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-static void
-et_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
-{
- EEntry *entry = E_ENTRY (o);
- GtkObject *item = GTK_OBJECT (entry->item);
- GtkAnchorType anchor;
- double width, height;
- gint xthick;
- gint ythick;
- GtkWidget *widget = GTK_WIDGET(entry->canvas);
-
- d(g_print("%s: arg_id: %d\n", __FUNCTION__, arg_id));
-
- switch (arg_id){
- case ARG_MODEL:
- gtk_object_set(item,
- "model", GTK_VALUE_OBJECT (*arg),
- NULL);
- if (entry->priv->emulate_label_resize)
- gtk_widget_queue_resize (widget);
- break;
-
- case ARG_EVENT_PROCESSOR:
- gtk_object_set(item,
- "event_processor", GTK_VALUE_OBJECT (*arg),
- NULL);
- break;
-
- case ARG_TEXT:
- gtk_object_set(item,
- "text", GTK_VALUE_STRING (*arg),
- NULL);
- d(g_print("%s: text: %s\n", __FUNCTION__, GTK_VALUE_STRING (*arg)));
- if (entry->priv->emulate_label_resize)
- gtk_widget_queue_resize (widget);
- break;
-
- case ARG_FONT:
- gtk_object_set(item,
- "font", GTK_VALUE_STRING (*arg),
- NULL);
- d(g_print("%s: font: %s\n", __FUNCTION__, GTK_VALUE_STRING (*arg)));
- if (entry->priv->emulate_label_resize)
- gtk_widget_queue_resize (widget);
- break;
-
- case ARG_FONTSET:
- gtk_object_set(item,
- "fontset", GTK_VALUE_STRING (*arg),
- NULL);
- if (entry->priv->emulate_label_resize)
- gtk_widget_queue_resize (widget);
- break;
-
- case ARG_FONT_GDK:
- gtk_object_set(item,
- "font_gdk", GTK_VALUE_BOXED (*arg),
- NULL);
- if (entry->priv->emulate_label_resize)
- gtk_widget_queue_resize (widget);
- break;
-
- case ARG_JUSTIFICATION:
- entry->priv->justification = GTK_VALUE_ENUM (*arg);
- gtk_object_get(item,
- "clip_width", &width,
- "clip_height", &height,
- NULL);
-
- if (entry->priv->draw_borders) {
- xthick = 0;
- ythick = 0;
- } else {
- xthick = widget->style->klass->xthickness;
- ythick = widget->style->klass->ythickness;
- }
-
- switch (entry->priv->justification) {
- case GTK_JUSTIFY_CENTER:
- anchor = GTK_ANCHOR_N;
- e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(entry->item), width / 2, ythick);
- break;
- case GTK_JUSTIFY_RIGHT:
- anchor = GTK_ANCHOR_NE;
- e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(entry->item), width - xthick, ythick);
- break;
- default:
- anchor = GTK_ANCHOR_NW;
- e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(entry->item), xthick, ythick);
- break;
- }
- gtk_object_set(item,
- "justification", entry->priv->justification,
- "anchor", anchor,
- NULL);
- break;
-
- case ARG_FILL_COLOR:
- gtk_object_set(item,
- "fill_color", GTK_VALUE_STRING (*arg),
- NULL);
- break;
-
- case ARG_FILL_COLOR_GDK:
- gtk_object_set(item,
- "fill_color_gdk", GTK_VALUE_BOXED (*arg),
- NULL);
- break;
-
- case ARG_FILL_COLOR_RGBA:
- gtk_object_set(item,
- "fill_color_rgba", GTK_VALUE_UINT (*arg),
- NULL);
- break;
-
- case ARG_FILL_STIPPLE:
- gtk_object_set(item,
- "fill_stiple", GTK_VALUE_BOXED (*arg),
- NULL);
- break;
-
- case ARG_EDITABLE:
- gtk_object_set(item,
- "editable", GTK_VALUE_BOOL (*arg),
- NULL);
- break;
-
- case ARG_USE_ELLIPSIS:
- gtk_object_set(item,
- "use_ellipsis", GTK_VALUE_BOOL (*arg),
- NULL);
- if (entry->priv->emulate_label_resize)
- gtk_widget_queue_resize (widget);
- break;
-
- case ARG_ELLIPSIS:
- gtk_object_set(item,
- "ellipsis", GTK_VALUE_STRING (*arg),
- NULL);
- if (entry->priv->emulate_label_resize)
- gtk_widget_queue_resize (widget);
- break;
-
- case ARG_LINE_WRAP:
- gtk_object_set(item,
- "line_wrap", GTK_VALUE_BOOL (*arg),
- NULL);
- if (entry->priv->emulate_label_resize)
- gtk_widget_queue_resize (widget);
- break;
-
- case ARG_BREAK_CHARACTERS:
- gtk_object_set(item,
- "break_characters", GTK_VALUE_STRING (*arg),
- NULL);
- if (entry->priv->emulate_label_resize)
- gtk_widget_queue_resize (widget);
- break;
-
- case ARG_MAX_LINES:
- gtk_object_set(item,
- "max_lines", GTK_VALUE_INT (*arg),
- NULL);
- if (entry->priv->emulate_label_resize)
- gtk_widget_queue_resize (widget);
- break;
-
- case ARG_ALLOW_NEWLINES:
- gtk_object_set(item,
- "allow_newlines", GTK_VALUE_BOOL (*arg),
- NULL);
- break;
-
- case ARG_DRAW_BORDERS:
- if (entry->priv->draw_borders != GTK_VALUE_BOOL (*arg)) {
- entry->priv->draw_borders = GTK_VALUE_BOOL (*arg);
- gtk_object_set (item,
- "draw_borders", entry->priv->draw_borders,
- NULL);
- gtk_widget_queue_resize (GTK_WIDGET (entry));
- }
- break;
-
- case ARG_CURSOR_POS:
- gtk_object_set (item,
- "cursor_pos", GTK_VALUE_INT (*arg), NULL);
- break;
-
- case ARG_DRAW_BACKGROUND:
- gtk_object_set (item, "draw_background",
- GTK_VALUE_BOOL (*arg), NULL);
- break;
-
- case ARG_DRAW_BUTTON:
- gtk_object_set (item, "draw_button",
- GTK_VALUE_BOOL (*arg), NULL);
- break;
-
- case ARG_EMULATE_LABEL_RESIZE:
- if (entry->priv->emulate_label_resize != GTK_VALUE_BOOL (*arg)) {
- entry->priv->emulate_label_resize = GTK_VALUE_BOOL (*arg);
- gtk_widget_queue_resize (widget);
- }
- break;
- }
-}
-
-static void
-e_entry_destroy (GtkObject *object)
-{
- EEntry *entry = E_ENTRY (object);
-
- if (entry->priv->completion_delay_tag)
- gtk_timeout_remove (entry->priv->completion_delay_tag);
-
- if (entry->priv->completion)
- gtk_object_unref (GTK_OBJECT (entry->priv->completion));
- if (entry->priv->completion_view_popup) {
- gtk_widget_destroy (GTK_WIDGET (entry->priv->completion_view_popup));
- gtk_object_unref (GTK_OBJECT (entry->priv->completion_view_popup));
- }
- g_free (entry->priv->pre_browse_text);
-
- if (entry->priv->changed_since_keypress_tag)
- gtk_timeout_remove (entry->priv->changed_since_keypress_tag);
-
- if (entry->priv->ptr_grab)
- gdk_pointer_ungrab (GDK_CURRENT_TIME);
-
- g_free (entry->priv);
- entry->priv = NULL;
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-static void
-e_entry_realize (GtkWidget *widget)
-{
- EEntry *entry;
-
- if (GTK_WIDGET_CLASS (parent_class)->realize)
- (* GTK_WIDGET_CLASS (parent_class)->realize) (widget);
-
- entry = E_ENTRY (widget);
-
- e_entry_make_completion_window_transient (entry);
-
- if (entry->priv->emulate_label_resize) {
- d(g_print("%s: queue_resize\n", __FUNCTION__));
- gtk_widget_queue_resize (GTK_WIDGET (entry->canvas));
- }
-}
-
-static void
-e_entry_class_init (GtkObjectClass *object_class)
-{
- EEntryClass *klass = E_ENTRY_CLASS(object_class);
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(object_class);
-
- parent_class = gtk_type_class (PARENT_TYPE);
-
- object_class->set_arg = et_set_arg;
- object_class->get_arg = et_get_arg;
- object_class->destroy = e_entry_destroy;
-
- widget_class->realize = e_entry_realize;
-
- klass->changed = NULL;
- klass->activate = NULL;
-
- e_entry_signals[E_ENTRY_CHANGED] =
- gtk_signal_new ("changed",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (EEntryClass, changed),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- e_entry_signals[E_ENTRY_ACTIVATE] =
- gtk_signal_new ("activate",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (EEntryClass, activate),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- e_entry_signals[E_ENTRY_POPUP] =
- gtk_signal_new ("popup",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (EEntryClass, popup),
- gtk_marshal_NONE__POINTER_INT,
- GTK_TYPE_NONE, 2, GTK_TYPE_POINTER, GTK_TYPE_INT);
-
- e_entry_signals[E_ENTRY_COMPLETION_POPUP] =
- gtk_signal_new ("completion_popup",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (EEntryClass, completion_popup),
- gtk_marshal_NONE__INT,
- GTK_TYPE_NONE, 1, GTK_TYPE_INT);
-
-
- E_OBJECT_CLASS_ADD_SIGNALS (object_class, e_entry_signals, E_ENTRY_LAST_SIGNAL);
-
- gtk_object_add_arg_type ("EEntry::model",
- GTK_TYPE_OBJECT, GTK_ARG_READWRITE, ARG_MODEL);
- gtk_object_add_arg_type ("EEntry::event_processor",
- GTK_TYPE_OBJECT, GTK_ARG_READWRITE, ARG_EVENT_PROCESSOR);
- gtk_object_add_arg_type ("EEntry::text",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_TEXT);
- gtk_object_add_arg_type ("EEntry::font",
- GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_FONT);
- gtk_object_add_arg_type ("EEntry::fontset",
- GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_FONTSET);
- gtk_object_add_arg_type ("EEntry::font_gdk",
- GTK_TYPE_GDK_FONT, GTK_ARG_READWRITE, ARG_FONT_GDK);
- gtk_object_add_arg_type ("EEntry::justification",
- GTK_TYPE_JUSTIFICATION, GTK_ARG_READWRITE, ARG_JUSTIFICATION);
- gtk_object_add_arg_type ("EEntry::fill_color",
- GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_FILL_COLOR);
- gtk_object_add_arg_type ("EEntry::fill_color_gdk",
- GTK_TYPE_GDK_COLOR, GTK_ARG_READWRITE, ARG_FILL_COLOR_GDK);
- gtk_object_add_arg_type ("EEntry::fill_color_rgba",
- GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_FILL_COLOR_RGBA);
- gtk_object_add_arg_type ("EEntry::fill_stipple",
- GTK_TYPE_GDK_WINDOW, GTK_ARG_READWRITE, ARG_FILL_STIPPLE);
- gtk_object_add_arg_type ("EEntry::editable",
- GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_EDITABLE);
- gtk_object_add_arg_type ("EEntry::use_ellipsis",
- GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_USE_ELLIPSIS);
- gtk_object_add_arg_type ("EEntry::ellipsis",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_ELLIPSIS);
- gtk_object_add_arg_type ("EEntry::line_wrap",
- GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_LINE_WRAP);
- gtk_object_add_arg_type ("EEntry::break_characters",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_BREAK_CHARACTERS);
- gtk_object_add_arg_type ("EEntry::max_lines",
- GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_MAX_LINES);
- gtk_object_add_arg_type ("EEntry::allow_newlines",
- GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_ALLOW_NEWLINES);
- gtk_object_add_arg_type ("EEntry::draw_borders",
- GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_DRAW_BORDERS);
- gtk_object_add_arg_type ("EEntry::draw_background",
- GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_DRAW_BACKGROUND);
- gtk_object_add_arg_type ("EEntry::draw_button",
- GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_DRAW_BUTTON);
- gtk_object_add_arg_type ("EEntry::emulate_label_resize",
- GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_EMULATE_LABEL_RESIZE);
- gtk_object_add_arg_type ("EEntry::cursor_pos",
- GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_CURSOR_POS);
-}
-
-E_MAKE_TYPE(e_entry, "EEntry", EEntry, e_entry_class_init, e_entry_init, PARENT_TYPE);
diff --git a/widgets/text/e-entry.h b/widgets/text/e-entry.h
deleted file mode 100644
index bd57e862a8..0000000000
--- a/widgets/text/e-entry.h
+++ /dev/null
@@ -1,89 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-entry.h - An EText-based entry widget
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- * Jon Trowbridge <trow@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef _E_ENTRY_H_
-#define _E_ENTRY_H_
-
-#include <libgnomeui/gnome-canvas.h>
-#include <gtk/gtktable.h>
-#include <gnome-xml/tree.h>
-#include <gal/e-text/e-text.h>
-#include "e-completion.h"
-#include <libgnome/gnome-defs.h>
-
-
-BEGIN_GNOME_DECLS
-
-#define E_ENTRY_TYPE (e_entry_get_type ())
-#define E_ENTRY(o) (GTK_CHECK_CAST ((o), E_ENTRY_TYPE, EEntry))
-#define E_ENTRY_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_ENTRY_TYPE, EEntryClass))
-#define E_IS_ENTRY(o) (GTK_CHECK_TYPE ((o), E_ENTRY_TYPE))
-#define E_IS_ENTRY_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_ENTRY_TYPE))
-
-typedef struct _EEntry EEntry;
-typedef struct _EEntryClass EEntryClass;
-struct _EEntryPrivate;
-
-typedef void (*EEntryCompletionHandler) (EEntry *entry, ECompletionMatch *match);
-
-struct _EEntry {
- GtkTable parent;
-
- GnomeCanvas *canvas;
- EText *item;
-
- struct _EEntryPrivate *priv;
-};
-
-struct _EEntryClass {
- GtkTableClass parent_class;
-
- void (* changed) (EEntry *entry);
- void (* activate) (EEntry *entry);
- void (* popup) (EEntry *entry, GdkEventButton *ev, gint pos);
- void (* completion_popup) (EEntry *entry, gint visible);
-};
-
-GtkType e_entry_get_type (void);
-
-void e_entry_construct (EEntry *entry);
-GtkWidget *e_entry_new (void);
-
-const gchar *e_entry_get_text (EEntry *entry);
-void e_entry_set_text (EEntry *entry, const gchar *text);
-
-gint e_entry_get_position (EEntry *entry);
-void e_entry_set_position (EEntry *entry, gint);
-void e_entry_select_region (EEntry *entry, gint start, gint end);
-
-void e_entry_set_editable (EEntry *entry, gboolean editable);
-
-void e_entry_enable_completion (EEntry *entry, ECompletion *completion);
-void e_entry_enable_completion_full (EEntry *entry, ECompletion *completion, gint autocomplete_delay,
- EEntryCompletionHandler handler);
-gboolean e_entry_completion_popup_is_visible (EEntry *entry);
-
-END_GNOME_DECLS
-
-#endif /* _E_ENTRY_H_ */
diff --git a/widgets/text/e-table-text-model.c b/widgets/text/e-table-text-model.c
deleted file mode 100644
index 6b195136f2..0000000000
--- a/widgets/text/e-table-text-model.c
+++ /dev/null
@@ -1,246 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-text-model.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-#include <ctype.h>
-#include <gtk/gtksignal.h>
-#include <gal/util/e-util.h>
-#include "e-table-text-model.h"
-
-static void e_table_text_model_class_init (ETableTextModelClass *class);
-static void e_table_text_model_init (ETableTextModel *model);
-static void e_table_text_model_destroy (GtkObject *object);
-
-static const gchar *e_table_text_model_get_text (ETextModel *model);
-static void e_table_text_model_set_text (ETextModel *model, const gchar *text);
-static void e_table_text_model_insert (ETextModel *model, gint postion, const gchar *text);
-static void e_table_text_model_insert_length (ETextModel *model, gint postion, const gchar *text, gint length);
-static void e_table_text_model_delete (ETextModel *model, gint postion, gint length);
-
-static GtkObject *parent_class;
-
-
-
-/**
- * e_table_text_model_get_type:
- * @void:
- *
- * Registers the &ETableTextModel class if necessary, and returns the type ID
- * associated to it.
- *
- * Return value: The type ID of the &ETableTextModel class.
- **/
-GtkType
-e_table_text_model_get_type (void)
-{
- static GtkType model_type = 0;
-
- if (!model_type) {
- GtkTypeInfo model_info = {
- "ETableTextModel",
- sizeof (ETableTextModel),
- sizeof (ETableTextModelClass),
- (GtkClassInitFunc) e_table_text_model_class_init,
- (GtkObjectInitFunc) e_table_text_model_init,
- NULL, /* reserved_1 */
- NULL, /* reserved_2 */
- (GtkClassInitFunc) NULL
- };
-
- model_type = gtk_type_unique (e_text_model_get_type (), &model_info);
- }
-
- return model_type;
-}
-
-/* Class initialization function for the text item */
-static void
-e_table_text_model_class_init (ETableTextModelClass *klass)
-{
- GtkObjectClass *object_class;
- ETextModelClass *model_class;
-
- object_class = (GtkObjectClass *) klass;
- model_class = (ETextModelClass *) klass;
-
- parent_class = gtk_type_class (e_text_model_get_type ());
-
- model_class->get_text = e_table_text_model_get_text;
- model_class->set_text = e_table_text_model_set_text;
- model_class->insert = e_table_text_model_insert;
- model_class->insert_length = e_table_text_model_insert_length;
- model_class->delete = e_table_text_model_delete;
-
- object_class->destroy = e_table_text_model_destroy;
-}
-
-/* Object initialization function for the text item */
-static void
-e_table_text_model_init (ETableTextModel *model)
-{
- model->model = NULL;
- model->row = 0;
- model->model_col = 0;
- model->cell_changed_signal_id = 0;
- model->row_changed_signal_id = 0;
-}
-
-/* Destroy handler for the text item */
-static void
-e_table_text_model_destroy (GtkObject *object)
-{
- ETableTextModel *model;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (E_IS_TABLE_TEXT_MODEL (object));
-
- model = E_TABLE_TEXT_MODEL (object);
-
- if (model->model)
- g_assert (GTK_IS_OBJECT (model->model));
-
- if (model->cell_changed_signal_id)
- gtk_signal_disconnect (GTK_OBJECT(model->model),
- model->cell_changed_signal_id);
-
- if (model->row_changed_signal_id)
- gtk_signal_disconnect (GTK_OBJECT(model->model),
- model->row_changed_signal_id);
-
- if (model->model)
- gtk_object_unref (GTK_OBJECT(model->model));
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-static const gchar *
-e_table_text_model_get_text (ETextModel *text_model)
-{
- ETableTextModel *model = E_TABLE_TEXT_MODEL(text_model);
- if (model->model)
- return (gchar *)e_table_model_value_at (model->model, model->model_col, model->row);
- else
- return "";
-}
-
-static void
-e_table_text_model_set_text (ETextModel *text_model, const gchar *text)
-{
- ETableTextModel *model = E_TABLE_TEXT_MODEL(text_model);
- if (model->model)
- e_table_model_set_value_at (model->model, model->model_col, model->row, (void *) text);
-}
-
-static void
-e_table_text_model_insert (ETextModel *text_model, gint position, const gchar *text)
-{
- ETableTextModel *model = E_TABLE_TEXT_MODEL(text_model);
- if (model->model){
- gchar *temp = (gchar *)e_table_model_value_at (model->model, model->model_col, model->row);
- /* Can't use g_strdup_printf here because on some
- systems printf ("%.*s"); is locale dependent. */
- temp = e_strdup_append_strings (temp, position,
- text, -1,
- temp + position, -1,
- NULL);
- e_table_model_set_value_at (model->model, model->model_col, model->row, temp);
- g_free (temp);
- }
-}
-
-static void
-e_table_text_model_insert_length (ETextModel *text_model, gint position, const gchar *text, gint length)
-{
- ETableTextModel *model = E_TABLE_TEXT_MODEL(text_model);
- if (model->model){
- gchar *temp = (gchar *)e_table_model_value_at (model->model, model->model_col, model->row);
- /* Can't use g_strdup_printf here because on some
- systems printf ("%.*s"); is locale dependent. */
- temp = e_strdup_append_strings (temp, position,
- text, length,
- temp + position, -1,
- NULL);
- e_table_model_set_value_at (model->model, model->model_col, model->row, temp);
- g_free (temp);
- }
-}
-
-static void
-e_table_text_model_delete (ETextModel *text_model, gint position, gint length)
-{
- ETableTextModel *model = E_TABLE_TEXT_MODEL(text_model);
- if (model->model){
- gchar *temp = (gchar *)e_table_model_value_at (model->model, model->model_col, model->row);
- /* Can't use g_strdup_printf here because on some
- systems printf ("%.*s"); is locale dependent. */
- temp = e_strdup_append_strings (temp, position,
- temp + position + length, -1,
- NULL);
- e_table_model_set_value_at (model->model, model->model_col, model->row, temp);
- g_free (temp);
- }
-}
-
-static void
-cell_changed (ETableModel *table_model, int model_col, int row, ETableTextModel *model)
-{
- if (model->model_col == model_col &&
- model->row == row)
- e_text_model_changed (E_TEXT_MODEL(model));
-}
-
-static void
-row_changed (ETableModel *table_model, int row, ETableTextModel *model)
-{
- if (model->row == row)
- e_text_model_changed (E_TEXT_MODEL(model));
-}
-
-ETableTextModel *
-e_table_text_model_new (ETableModel *table_model, int row, int model_col)
-{
- ETableTextModel *model;
-
- g_return_val_if_fail(table_model != NULL, NULL);
- g_return_val_if_fail(E_IS_TABLE_MODEL(table_model), NULL);
-
- model = gtk_type_new (e_table_text_model_get_type ());
- model->model = table_model;
- if (model->model){
- gtk_object_ref (GTK_OBJECT(model->model));
- model->cell_changed_signal_id =
- gtk_signal_connect (GTK_OBJECT(model->model),
- "model_cell_changed",
- GTK_SIGNAL_FUNC(cell_changed),
- model);
- model->row_changed_signal_id =
- gtk_signal_connect (GTK_OBJECT(model->model),
- "model_row_changed",
- GTK_SIGNAL_FUNC(row_changed),
- model);
- }
- model->row = row;
- model->model_col = model_col;
- return model;
-}
-
diff --git a/widgets/text/e-table-text-model.h b/widgets/text/e-table-text-model.h
deleted file mode 100644
index 4f55b45ccf..0000000000
--- a/widgets/text/e-table-text-model.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-text-model.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef E_TABLE_TEXT_MODEL_H
-#define E_TABLE_TEXT_MODEL_H
-
-#include <gal/e-text/e-text-model.h>
-#include <gal/e-table/e-table-model.h>
-#include <libgnome/gnome-defs.h>
-
-
-BEGIN_GNOME_DECLS
-
-#define E_TYPE_TABLE_TEXT_MODEL (e_table_text_model_get_type ())
-#define E_TABLE_TEXT_MODEL(obj) (GTK_CHECK_CAST ((obj), E_TYPE_TABLE_TEXT_MODEL, ETableTextModel))
-#define E_TABLE_TEXT_MODEL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_TABLE_TEXT_MODEL, ETableTextModelClass))
-#define E_IS_TABLE_TEXT_MODEL(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_TABLE_TEXT_MODEL))
-#define E_IS_TABLE_TEXT_MODEL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), E_TYPE_TABLE_TEXT_MODEL))
-
-typedef struct _ETableTextModel ETableTextModel;
-typedef struct _ETableTextModelClass ETableTextModelClass;
-
-struct _ETableTextModel {
- ETextModel parent;
-
- ETableModel *model;
- int row;
- int model_col;
-
- int cell_changed_signal_id;
- int row_changed_signal_id;
-};
-
-struct _ETableTextModelClass {
- ETextModelClass parent_class;
-
-};
-
-
-/* Standard Gtk function */
-GtkType e_table_text_model_get_type (void);
-ETableTextModel *e_table_text_model_new (ETableModel *table_model, int row, int model_col);
-
-END_GNOME_DECLS
-
-#endif
diff --git a/widgets/text/e-text-model-repos.c b/widgets/text/e-text-model-repos.c
deleted file mode 100644
index 17ffe07578..0000000000
--- a/widgets/text/e-text-model-repos.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-text-model-repos.c - Standard ETextModelReposFn definitions
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Jon Trowbridge <trow@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include "e-text-model-repos.h"
-
-#define MODEL_CLAMP(model, pos) (CLAMP((pos), 0, strlen((model)->text)))
-
-gint
-e_repos_shift (gint pos, gpointer data)
-{
- EReposShift *info = (EReposShift *) data;
- g_return_val_if_fail (data, -1);
-
- return e_text_model_validate_position (info->model, pos + info->change);
-}
-
-gint
-e_repos_absolute (gint pos, gpointer data)
-{
- EReposAbsolute *info = (EReposAbsolute *) data;
- g_return_val_if_fail (data, -1);
-
- pos = info->pos;
- if (pos < 0) {
- gint len = e_text_model_get_text_length (info->model);
- pos += len + 1;
- }
-
- return e_text_model_validate_position (info->model, pos);
-}
-
-gint
-e_repos_insert_shift (gint pos, gpointer data)
-{
- EReposInsertShift *info = (EReposInsertShift *) data;
- g_return_val_if_fail (data, -1);
-
- if (pos >= info->pos)
- pos += info->len;
-
- return e_text_model_validate_position (info->model, pos);
-}
-
-gint
-e_repos_delete_shift (gint pos, gpointer data)
-{
- EReposDeleteShift *info = (EReposDeleteShift *) data;
- g_return_val_if_fail (data, -1);
-
- if (pos > info->pos + info->len)
- pos -= info->len;
- else if (pos > info->pos)
- pos = info->pos;
-
- return e_text_model_validate_position (info->model, pos);
-}
-
-gint
-e_repos_clamp (gint pos, gpointer data)
-{
- ETextModel *model;
-
- g_return_val_if_fail (data != NULL && E_IS_TEXT_MODEL (data), -1);
- model = E_TEXT_MODEL (data);
-
- return e_text_model_validate_position (model, pos);
-}
diff --git a/widgets/text/e-text-model-repos.h b/widgets/text/e-text-model-repos.h
deleted file mode 100644
index 5f0c93ee6a..0000000000
--- a/widgets/text/e-text-model-repos.h
+++ /dev/null
@@ -1,69 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-text-model-repos.h - Standard ETextModelReposFn definitions
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Jon Trowbridge <trow@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef E_TEXT_MODEL_REPOS_H
-#define E_TEXT_MODEL_REPOS_H
-
-#include "e-text-model.h"
-
-typedef struct {
- ETextModel *model;
- gint change; /* Relative change to position. */
-} EReposShift;
-
-gint e_repos_shift (gint pos, gpointer data);
-
-
-typedef struct {
- ETextModel *model;
- gint pos; /* Position to move to. Negative values count from the end buffer.
- (i.e. -1 puts cursor at the end, -2 one character from end, etc.) */
-} EReposAbsolute;
-
-gint e_repos_absolute (gint pos, gpointer data);
-
-
-typedef struct {
- ETextModel *model;
- gint pos; /* Location of first inserted character. */
- gint len; /* Number of characters inserted. */
-} EReposInsertShift;
-
-gint e_repos_insert_shift (gint pos, gpointer data);
-
-
-typedef struct {
- ETextModel *model;
- gint pos; /* Location of first deleted character. */
- gint len; /* Number of characters deleted. */
-} EReposDeleteShift;
-
-gint e_repos_delete_shift (gint pos, gpointer data);
-
-
-/* For e_repos_clamp, data is a pointer to an ETextModel. The only repositioning
- that occurs is to avoid buffer overruns. */
-
-gint e_repos_clamp (gint pos, gpointer data);
-
-#endif
diff --git a/widgets/text/e-text-model-test.c b/widgets/text/e-text-model-test.c
deleted file mode 100644
index c364b852c6..0000000000
--- a/widgets/text/e-text-model-test.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-text-model-test.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <gnome.h>
-#include <gal/widgets/e-canvas.h>
-#include "e-text-model.h"
-#include "e-text-model-uri.h"
-#include "e-text.h"
-#include <gal/util/e-util.h>
-
-#if 0
-static void
-describe_model (ETextModel *model)
-{
- gint i, N;
- g_return_if_fail (E_IS_TEXT_MODEL (model));
-
- N = e_text_model_object_count (model);
-
- g_print ("text: %s\n", e_text_model_get_text (model));
- g_print ("objs: %d\n", N);
-
- for (i=0; i<N; ++i) {
- gchar *s = e_text_model_strdup_nth_object (model, i);
- g_print ("obj%d: %s\n", i, s);
- g_free (s);
- }
-}
-#endif
-
-int
-main (int argc, gchar **argv)
-{
- GtkWidget *win[2], *canvas[2];
- GnomeCanvasItem *item[2];
- ETextModel *model;
- gint i;
-
- gnome_init ("ETextModelTest", "0.0", argc, argv);
-
- model = e_text_model_uri_new ();
-
- e_text_model_set_text (model, "My favorite website is http://www.ximian.com. My next favorite www.assbarn.com.");
-
- // describe_model (model);
-
- for (i=0; i<2; ++i) {
- win[i] = gtk_window_new (GTK_WINDOW_TOPLEVEL);
-
- gtk_widget_push_visual (gdk_rgb_get_visual ());
- gtk_widget_push_colormap (gdk_rgb_get_cmap ());
- canvas[i] = e_canvas_new ();
- gtk_widget_pop_visual ();
- gtk_widget_pop_colormap ();
-
- item[i] = gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS (canvas[i])),
- e_text_get_type (),
- "model", model,
- "font", "-adobe-helvetica-medium-r-normal--12-120-75-75-p-67-iso8859-1",
- "anchor", GTK_ANCHOR_NORTH,
- "line_wrap", TRUE,
- "width", 150.0,
- "editable", TRUE,
- NULL);
-
- gtk_container_add (GTK_CONTAINER (win[i]), canvas[i]);
- gtk_widget_show_all (win[i]);
- }
-
- gtk_main ();
-
- return 0;
-}
diff --git a/widgets/text/e-text-model-uri.c b/widgets/text/e-text-model-uri.c
deleted file mode 100644
index 765faa05ca..0000000000
--- a/widgets/text/e-text-model-uri.c
+++ /dev/null
@@ -1,359 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-text-model-uri.c - a text model w/ clickable URIs
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Jon Trowbridge <trow@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-
-#include "e-text-model-uri.h"
-
-#include <ctype.h>
-#include <sys/types.h>
-#include <regex.h>
-#include <gtk/gtkmain.h>
-#include <libgnome/gnome-url.h>
-
-static void e_text_model_uri_class_init (ETextModelURIClass *class);
-static void e_text_model_uri_init (ETextModelURI *model);
-static void e_text_model_uri_destroy (GtkObject *object);
-
-static void objectify_uris (ETextModelURI *model);
-
-static void e_text_model_uri_objectify (ETextModel *model);
-static gint e_text_model_uri_validate_pos (ETextModel *model, gint pos);
-static gint e_text_model_uri_get_obj_count (ETextModel *model);
-static const gchar *e_text_model_uri_get_nth_object (ETextModel *model, gint i, gint *len);
-static void e_text_model_uri_activate_nth_object (ETextModel *model, gint);
-
-typedef struct _ObjInfo ObjInfo;
-struct _ObjInfo {
- gint offset, len;
-};
-
-static GtkObject *parent_class;
-
-GtkType
-e_text_model_uri_get_type (void)
-{
- static GtkType model_uri_type = 0;
-
- if (!model_uri_type) {
- GtkTypeInfo model_uri_info = {
- "ETextModelURI",
- sizeof (ETextModelURI),
- sizeof (ETextModelURIClass),
- (GtkClassInitFunc) e_text_model_uri_class_init,
- (GtkObjectInitFunc) e_text_model_uri_init,
- NULL, /* reserved_1 */
- NULL, /* reserved_2 */
- (GtkClassInitFunc) NULL
- };
-
- model_uri_type = gtk_type_unique (e_text_model_get_type (), &model_uri_info);
- }
-
- return model_uri_type;
-}
-
-static void
-e_text_model_uri_class_init (ETextModelURIClass *klass)
-{
- GtkObjectClass *object_class;
- ETextModelClass *model_class;
-
- object_class = (GtkObjectClass *) klass;
- model_class = E_TEXT_MODEL_CLASS (klass);
-
- parent_class = gtk_type_class (e_text_model_get_type ());
-
- object_class->destroy = e_text_model_uri_destroy;
-
- model_class->object_activated = e_text_model_uri_activate_nth_object;
-
- model_class->objectify = e_text_model_uri_objectify;
- model_class->validate_pos = e_text_model_uri_validate_pos;
- model_class->obj_count = e_text_model_uri_get_obj_count;
- model_class->get_nth_obj = e_text_model_uri_get_nth_object;
-
-}
-
-static void
-e_text_model_uri_init (ETextModelURI *model)
-{
-
-}
-
-static void
-e_text_model_uri_destroy (GtkObject *object)
-{
- ETextModelURI *model_uri = E_TEXT_MODEL_URI (object);
- GList *iter;
-
- if (model_uri->objectify_idle) {
- gtk_idle_remove (model_uri->objectify_idle);
- model_uri->objectify_idle = 0;
- }
-
- for (iter = model_uri->uris; iter != NULL; iter = g_list_next (iter))
- g_free (iter->data);
- g_list_free (model_uri->uris);
- model_uri->uris = NULL;
-
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-
-}
-
-static const gchar *uri_regex[] = {
- "(((news|telnet|nttp|file|http|ftp|https)://)|(www|ftp))[-A-Za-z0-9\\.]+(:[0-9]*)?/[-A-Za-z0-9_\\$\\.\\+\\!\\*\\(\\),;:@&=\\?/~\\#\\%]*[^]'\\.}>\\) ,\\\"]",
- "(((news|telnet|nttp|file|http|ftp|https)://)|(www|ftp))[-A-Za-z0-9\\.]+[-A-Za-z0-9](:[0-9]*)?",
- "mailto:[A-Za-z0-9_]+@[-A-Za-z0-9_]+\\.[-A-Za-z0-9\\.]+[-A-Za-z0-9]",
- NULL
-};
-static gint regex_count = 0;
-static regex_t *regex_compiled = NULL;
-
-static void
-regex_init (void)
-{
- gint i;
-
- if (regex_count != 0)
- return;
-
- while (uri_regex[regex_count]) ++regex_count;
-
- regex_compiled = g_new0 (regex_t, regex_count);
-
- for (i=0; i<regex_count; ++i) {
- if (regcomp (&regex_compiled[i], uri_regex[i], REG_EXTENDED))
- g_error ("Bad regex?: %s", uri_regex[i]);
- }
-}
-
-
-static void
-objectify_uris (ETextModelURI *model_uri)
-{
- static gboolean objectifying = FALSE;
-
- ETextModel *model = E_TEXT_MODEL (model_uri);
- const gchar *txt;
- GList *iter, *old_uris;
- gint offset, len;
- gboolean found_match;
- regmatch_t match;
- gboolean changed;
-
- if (objectifying)
- return;
-
- objectifying = TRUE;
-
- if (regex_count == 0)
- regex_init ();
-
- txt = e_text_model_get_text (model);
- len = e_text_model_get_text_length (model);
-
- old_uris = model_uri->uris;
- model_uri->uris = NULL;
-
- if (txt) {
- offset = 0;
- found_match = TRUE;
-
- while (offset < len && found_match) {
-
- gint i, so=-1, eo=-1;
-
- found_match = FALSE;
-
- for (i=0; i<regex_count; ++i) {
-
- if (regexec (&regex_compiled[i], txt+offset, 1, &match, 0) == 0) {
-
- /* Take earliest match possible. In case of a tie, take the
- largest possible match. */
- if (!found_match
- || match.rm_so < so
- || (match.rm_so == so && match.rm_eo > eo)) {
- so = match.rm_so;
- eo = match.rm_eo;
- }
- found_match = TRUE;
- }
- }
-
- if (found_match) {
-
- ObjInfo *info = g_new0 (ObjInfo, 1);
- info->offset = offset + so;
- info->len = eo - so;
-
- model_uri->uris = g_list_append (model_uri->uris, info);
-
- offset += eo;
- }
- }
- }
-
- changed = (g_list_length (old_uris) != g_list_length (model_uri->uris));
-
- if (!changed) {
- /* Check that there is a 1-1 correspondence between object positions. */
- GList *jter;
-
- for (iter = model_uri->uris; iter != NULL && !changed; iter = g_list_next (iter)) {
- ObjInfo *info = (ObjInfo *) iter->data;
- found_match = FALSE;
- for (jter = old_uris; jter != NULL && !found_match; jter = g_list_next (jter)) {
- ObjInfo *jnfo = (ObjInfo *) jter->data;
-
- if (info->offset == jnfo->offset && info->len == jnfo->len)
- found_match = TRUE;
- }
- changed = !found_match;
- }
- }
-
- if (changed)
- e_text_model_changed (model);
-
- /* Free old uris */
- for (iter = old_uris; iter != NULL; iter = g_list_next (iter))
- g_free (iter->data);
- g_list_free (old_uris);
-
- objectifying = FALSE;
-}
-
-static gboolean
-objectify_idle_cb (gpointer ptr)
-{
- ETextModelURI *model_uri = E_TEXT_MODEL_URI (ptr);
-
- g_assert (model_uri->objectify_idle);
- objectify_uris (model_uri);
- model_uri->objectify_idle = 0;
-
- return FALSE;
-}
-
-static void
-e_text_model_uri_objectify (ETextModel *model)
-{
- ETextModelURI *model_uri = E_TEXT_MODEL_URI (model);
-
- if (model_uri->objectify_idle == 0)
- model_uri->objectify_idle = gtk_idle_add (objectify_idle_cb, model);
-
- if (E_TEXT_MODEL_CLASS(parent_class)->objectify)
- E_TEXT_MODEL_CLASS(parent_class)->objectify (model);
-}
-
-static void
-objectify_idle_flush (ETextModelURI *model_uri)
-{
- if (model_uri->objectify_idle) {
- gtk_idle_remove (model_uri->objectify_idle);
- model_uri->objectify_idle = 0;
- objectify_uris (model_uri);
- }
-}
-
-static gint
-e_text_model_uri_validate_pos (ETextModel *model, gint pos)
-{
- gint obj_num;
-
- /* Cause us to skip over objects */
-
- obj_num = e_text_model_get_object_at_offset (model, pos);
- if (obj_num != -1) {
- gint pos0, pos1, mp;
- e_text_model_get_nth_object_bounds (model, obj_num, &pos0, &pos1);
- mp = (pos0 + pos1)/2;
- if (pos0 < pos && pos < mp)
- pos = pos1;
- else if (mp <= pos && pos < pos1)
- pos = pos0;
- }
-
-
-
- if (E_TEXT_MODEL_CLASS (parent_class)->validate_pos)
- pos = E_TEXT_MODEL_CLASS (parent_class)->validate_pos (model, pos);
-
- return pos;
-}
-
-static gint
-e_text_model_uri_get_obj_count (ETextModel *model)
-{
- ETextModelURI *model_uri = E_TEXT_MODEL_URI (model);
-
- objectify_idle_flush (model_uri);
-
- return g_list_length (model_uri->uris);
-}
-
-static const gchar *
-e_text_model_uri_get_nth_object (ETextModel *model, gint i, gint *len)
-{
- ETextModelURI *model_uri = E_TEXT_MODEL_URI (model);
- ObjInfo *info;
- const gchar *txt;
-
- objectify_idle_flush (model_uri);
-
- txt = e_text_model_get_text (model);
-
- info = (ObjInfo *) g_list_nth_data (model_uri->uris, i);
- g_return_val_if_fail (info != NULL, NULL);
-
-
- if (len)
- *len = info->len;
- return txt + info->offset;
-}
-
-static void
-e_text_model_uri_activate_nth_object (ETextModel *model, gint i)
-{
- gchar *obj_str;
-
- objectify_idle_flush (E_TEXT_MODEL_URI (model));
-
- obj_str = e_text_model_strdup_nth_object (model, i);
- gnome_url_show (obj_str);
- g_free (obj_str);
-}
-
-ETextModel *
-e_text_model_uri_new (void)
-{
- return E_TEXT_MODEL (gtk_type_new (e_text_model_uri_get_type ()));
-}
-
-
-/* $Id$ */
diff --git a/widgets/text/e-text-model-uri.h b/widgets/text/e-text-model-uri.h
deleted file mode 100644
index a4b2f9f80f..0000000000
--- a/widgets/text/e-text-model-uri.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-text-model-uri.h - a text model w/ clickable URIs
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Jon Trowbridge <trow@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef E_TEXT_MODEL_URI_H
-#define E_TEXT_MODEL_URI_H
-
-#include <gal/e-text/e-text-model.h>
-#include <libgnome/gnome-defs.h>
-
-BEGIN_GNOME_DECLS
-
-#define E_TYPE_TEXT_MODEL_URI (e_text_model_get_type ())
-#define E_TEXT_MODEL_URI(obj) (GTK_CHECK_CAST ((obj), E_TYPE_TEXT_MODEL_URI, ETextModelURI))
-#define E_TEXT_MODEL_URI_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_TEXT_MODEL_URI, ETextModelURIClass))
-#define E_IS_TEXT_MODEL_URI(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_TEXT_MODEL_URI))
-#define E_IS_TEXT_MODEL_URI_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), E_TYPE_TEXT_MODEL_URI))
-
-typedef struct _ETextModelURI ETextModelURI;
-typedef struct _ETextModelURIClass ETextModelURIClass;
-
-struct _ETextModelURI {
- ETextModel item;
- GList *uris;
-
- guint objectify_idle;
-};
-
-struct _ETextModelURIClass {
- ETextModelClass parent_class;
-};
-
-GtkType e_text_model_uri_get_type (void);
-ETextModel *e_text_model_uri_new (void);
-
-END_GNOME_DECLS
-
-#endif
diff --git a/widgets/text/e-text-model.c b/widgets/text/e-text-model.c
deleted file mode 100644
index da8644570b..0000000000
--- a/widgets/text/e-text-model.c
+++ /dev/null
@@ -1,645 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-text-model.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#undef PARANOID_DEBUGGING
-
-#include <config.h>
-#include <ctype.h>
-#include <string.h>
-#include <gtk/gtksignal.h>
-#include "e-text-model-repos.h"
-#include "e-text-model.h"
-#include "gal/util/e-util.h"
-
-#define CLASS(obj) (E_TEXT_MODEL_CLASS (GTK_OBJECT (obj)->klass))
-
-#define MAX_LENGTH (2047)
-
-enum {
- E_TEXT_MODEL_CHANGED,
- E_TEXT_MODEL_REPOSITION,
- E_TEXT_MODEL_OBJECT_ACTIVATED,
- E_TEXT_MODEL_CANCEL_COMPLETION,
- E_TEXT_MODEL_LAST_SIGNAL
-};
-
-static guint e_text_model_signals[E_TEXT_MODEL_LAST_SIGNAL] = { 0 };
-
-struct _ETextModelPrivate {
- gchar *text;
- gint len;
-};
-
-static void e_text_model_class_init (ETextModelClass *class);
-static void e_text_model_init (ETextModel *model);
-static void e_text_model_destroy (GtkObject *object);
-
-static gint e_text_model_real_validate_position (ETextModel *, gint pos);
-static const gchar *e_text_model_real_get_text (ETextModel *model);
-static gint e_text_model_real_get_text_length (ETextModel *model);
-static void e_text_model_real_set_text (ETextModel *model, const gchar *text);
-static void e_text_model_real_insert (ETextModel *model, gint postion, const gchar *text);
-static void e_text_model_real_insert_length (ETextModel *model, gint postion, const gchar *text, gint length);
-static void e_text_model_real_delete (ETextModel *model, gint postion, gint length);
-
-static GtkObject *parent_class;
-
-
-
-/**
- * e_text_model_get_type:
- * @void:
- *
- * Registers the &ETextModel class if necessary, and returns the type ID
- * associated to it.
- *
- * Return value: The type ID of the &ETextModel class.
- **/
-GtkType
-e_text_model_get_type (void)
-{
- static GtkType model_type = 0;
-
- if (!model_type) {
- GtkTypeInfo model_info = {
- "ETextModel",
- sizeof (ETextModel),
- sizeof (ETextModelClass),
- (GtkClassInitFunc) e_text_model_class_init,
- (GtkObjectInitFunc) e_text_model_init,
- NULL, /* reserved_1 */
- NULL, /* reserved_2 */
- (GtkClassInitFunc) NULL
- };
-
- model_type = gtk_type_unique (gtk_object_get_type (), &model_info);
- }
-
- return model_type;
-}
-
-/* Class initialization function for the text item */
-static void
-e_text_model_class_init (ETextModelClass *klass)
-{
- GtkObjectClass *object_class;
-
- object_class = (GtkObjectClass *) klass;
-
- parent_class = gtk_type_class (gtk_object_get_type ());
-
- e_text_model_signals[E_TEXT_MODEL_CHANGED] =
- gtk_signal_new ("changed",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETextModelClass, changed),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- e_text_model_signals[E_TEXT_MODEL_REPOSITION] =
- gtk_signal_new ("reposition",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETextModelClass, reposition),
- gtk_marshal_NONE__POINTER_POINTER,
- GTK_TYPE_NONE, 2,
- GTK_TYPE_POINTER, GTK_TYPE_POINTER);
-
- e_text_model_signals[E_TEXT_MODEL_OBJECT_ACTIVATED] =
- gtk_signal_new ("object_activated",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETextModelClass, object_activated),
- gtk_marshal_NONE__INT,
- GTK_TYPE_NONE, 1,
- GTK_TYPE_INT);
-
- e_text_model_signals[E_TEXT_MODEL_CANCEL_COMPLETION] =
- gtk_signal_new ("cancel_completion",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETextModelClass, cancel_completion),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- E_OBJECT_CLASS_ADD_SIGNALS (object_class, e_text_model_signals, E_TEXT_MODEL_LAST_SIGNAL);
-
- /* No default signal handlers. */
- klass->changed = NULL;
- klass->reposition = NULL;
- klass->object_activated = NULL;
-
- klass->validate_pos = e_text_model_real_validate_position;
-
- klass->get_text = e_text_model_real_get_text;
- klass->get_text_len = e_text_model_real_get_text_length;
- klass->set_text = e_text_model_real_set_text;
- klass->insert = e_text_model_real_insert;
- klass->insert_length = e_text_model_real_insert_length;
- klass->delete = e_text_model_real_delete;
-
- /* We explicitly don't define default handlers for these. */
- klass->objectify = NULL;
- klass->obj_count = NULL;
- klass->get_nth_obj = NULL;
-
- object_class->destroy = e_text_model_destroy;
-}
-
-/* Object initialization function for the text item */
-static void
-e_text_model_init (ETextModel *model)
-{
- model->priv = g_new0 (struct _ETextModelPrivate, 1);
- model->priv->text = g_strdup ("");
- model->priv->len = 0;
-}
-
-/* Destroy handler for the text item */
-static void
-e_text_model_destroy (GtkObject *object)
-{
- ETextModel *model;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (E_IS_TEXT_MODEL (object));
-
- model = E_TEXT_MODEL (object);
-
- g_free (model->priv->text);
-
- g_free (model->priv);
- model->priv = NULL;
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- GTK_OBJECT_CLASS (parent_class)->destroy (object);
-}
-
-static gint
-e_text_model_real_validate_position (ETextModel *model, gint pos)
-{
- gint len;
-
- if (pos < 0)
- pos = 0;
- else if (pos > ( len = e_text_model_get_text_length (model) ))
- pos = len;
-
- return pos;
-}
-
-static const gchar *
-e_text_model_real_get_text (ETextModel *model)
-{
- if (model->priv->text)
- return model->priv->text;
- else
- return "";
-}
-
-static gint
-e_text_model_real_get_text_length (ETextModel *model)
-{
- if (model->priv->len < 0)
- model->priv->len = strlen (e_text_model_get_text (model));
-
- return model->priv->len;
-}
-
-static void
-e_text_model_real_set_text (ETextModel *model, const gchar *text)
-{
- EReposAbsolute repos;
- gboolean changed = FALSE;
-
- if (text == NULL) {
-
- changed = (model->priv->text != NULL);
-
- g_free (model->priv->text);
- model->priv->text = NULL;
- model->priv->len = -1;
-
- } else if (model->priv->text == NULL || strcmp (model->priv->text, text)) {
-
- g_free (model->priv->text);
- model->priv->text = g_strndup (text, MAX_LENGTH);
- model->priv->len = -1;
-
- changed = TRUE;
- }
-
- if (changed) {
- e_text_model_changed (model);
- repos.model = model;
- repos.pos = -1;
- e_text_model_reposition (model, e_repos_absolute, &repos);
- }
-}
-
-static void
-e_text_model_real_insert (ETextModel *model, gint position, const gchar *text)
-{
- EReposInsertShift repos;
- gchar *new_text;
- gint length;
-
- if (model->priv->len < 0)
- e_text_model_real_get_text_length (model);
- length = strlen(text);
-
- if (length + model->priv->len > MAX_LENGTH)
- length = MAX_LENGTH - model->priv->len;
- if (length <= 0)
- return;
-
- /* Can't use g_strdup_printf here because on some systems
- printf ("%.*s"); is locale dependent. */
- new_text = e_strdup_append_strings (model->priv->text, position,
- text, length,
- model->priv->text + position, -1,
- NULL);
-
- if (model->priv->text)
- g_free (model->priv->text);
-
- model->priv->text = new_text;
-
- if (model->priv->len >= 0)
- model->priv->len += length;
-
- e_text_model_changed (model);
-
- repos.model = model;
- repos.pos = position;
- repos.len = length;
-
- e_text_model_reposition (model, e_repos_insert_shift, &repos);
-}
-
-static void
-e_text_model_real_insert_length (ETextModel *model, gint position, const gchar *text, gint length)
-{
- EReposInsertShift repos;
- gchar *new_text;
-
- if (model->priv->len < 0)
- e_text_model_real_get_text_length (model);
-
- if (length + model->priv->len > MAX_LENGTH)
- length = MAX_LENGTH - model->priv->len;
- if (length <= 0)
- return;
-
- /* Can't use g_strdup_printf here because on some systems
- printf ("%.*s"); is locale dependent. */
- new_text = e_strdup_append_strings (model->priv->text, position,
- text, length,
- model->priv->text + position, -1,
- NULL);
-
- if (model->priv->text)
- g_free (model->priv->text);
- model->priv->text = new_text;
-
- if (model->priv->len >= 0)
- model->priv->len += length;
-
- e_text_model_changed (model);
-
- repos.model = model;
- repos.pos = position;
- repos.len = length;
-
- e_text_model_reposition (model, e_repos_insert_shift, &repos);
-}
-
-static void
-e_text_model_real_delete (ETextModel *model, gint position, gint length)
-{
- EReposDeleteShift repos;
-
- memmove (model->priv->text + position, model->priv->text + position + length, strlen (model->priv->text + position + length) + 1);
-
- if (model->priv->len >= 0)
- model->priv->len -= length;
-
- e_text_model_changed (model);
-
- repos.model = model;
- repos.pos = position;
- repos.len = length;
-
- e_text_model_reposition (model, e_repos_delete_shift, &repos);
-}
-
-void
-e_text_model_changed (ETextModel *model)
-{
- g_return_if_fail (model != NULL);
- g_return_if_fail (E_IS_TEXT_MODEL (model));
-
- /*
- Objectify before emitting any signal.
- While this method could, in theory, do pretty much anything, it is meant
- for scanning objects and converting substrings into embedded objects.
- */
- if (CLASS (model)->objectify)
- CLASS (model)->objectify (model);
-
- gtk_signal_emit (GTK_OBJECT (model),
- e_text_model_signals[E_TEXT_MODEL_CHANGED]);
-}
-
-void
-e_text_model_cancel_completion (ETextModel *model)
-{
- g_return_if_fail (E_IS_TEXT_MODEL (model));
-
- gtk_signal_emit (GTK_OBJECT (model), e_text_model_signals[E_TEXT_MODEL_CANCEL_COMPLETION]);
-}
-
-void
-e_text_model_reposition (ETextModel *model, ETextModelReposFn fn, gpointer repos_data)
-{
- g_return_if_fail (model != NULL);
- g_return_if_fail (E_IS_TEXT_MODEL (model));
- g_return_if_fail (fn != NULL);
-
- gtk_signal_emit (GTK_OBJECT (model),
- e_text_model_signals[E_TEXT_MODEL_REPOSITION],
- fn, repos_data);
-}
-
-gint
-e_text_model_validate_position (ETextModel *model, gint pos)
-{
- g_return_val_if_fail (model != NULL, 0);
- g_return_val_if_fail (E_IS_TEXT_MODEL (model), 0);
-
- if (CLASS (model)->validate_pos)
- pos = CLASS (model)->validate_pos (model, pos);
-
- return pos;
-}
-
-const gchar *
-e_text_model_get_text (ETextModel *model)
-{
- g_return_val_if_fail (model != NULL, NULL);
- g_return_val_if_fail (E_IS_TEXT_MODEL (model), NULL);
-
- if (CLASS (model)->get_text)
- return CLASS (model)->get_text (model);
-
- return "";
-}
-
-gint
-e_text_model_get_text_length (ETextModel *model)
-{
- g_return_val_if_fail (model != NULL, 0);
- g_return_val_if_fail (E_IS_TEXT_MODEL (model), 0);
-
- if (CLASS (model)->get_text_len (model)) {
-
- gint len = CLASS (model)->get_text_len (model);
-
-#ifdef PARANOID_DEBUGGING
- const gchar *str = e_text_model_get_text (model);
- gint len2 = str ? strlen (str) : 0;
- if (len != len)
- g_error ("\"%s\" length reported as %d, not %d.", str, len, len2);
-#endif
-
- return len;
-
- } else {
- /* Calculate length the old-fashioned way... */
- const gchar *str = e_text_model_get_text (model);
- return str ? strlen (str) : 0;
- }
-}
-
-void
-e_text_model_set_text (ETextModel *model, const gchar *text)
-{
- g_return_if_fail (model != NULL);
- g_return_if_fail (E_IS_TEXT_MODEL (model));
-
- if (CLASS (model)->set_text)
- CLASS (model)->set_text (model, text);
-}
-
-void
-e_text_model_insert (ETextModel *model, gint position, const gchar *text)
-{
- g_return_if_fail (model != NULL);
- g_return_if_fail (E_IS_TEXT_MODEL (model));
-
- if (text == NULL)
- return;
-
- if (CLASS (model)->insert)
- CLASS (model)->insert (model, position, text);
-}
-
-void
-e_text_model_insert_length (ETextModel *model, gint position, const gchar *text, gint length)
-{
- g_return_if_fail (model != NULL);
- g_return_if_fail (E_IS_TEXT_MODEL (model));
- g_return_if_fail (length >= 0);
-
-
- if (text == NULL || length == 0)
- return;
-
- if (CLASS (model)->insert_length)
- CLASS (model)->insert_length (model, position, text, length);
-}
-
-void
-e_text_model_prepend (ETextModel *model, const gchar *text)
-{
- g_return_if_fail (model != NULL);
- g_return_if_fail (E_IS_TEXT_MODEL (model));
-
- if (text == NULL)
- return;
-
- e_text_model_insert (model, 0, text);
-}
-
-void
-e_text_model_append (ETextModel *model, const gchar *text)
-{
- g_return_if_fail (model != NULL);
- g_return_if_fail (E_IS_TEXT_MODEL (model));
-
- if (text == NULL)
- return;
-
- e_text_model_insert (model, e_text_model_get_text_length (model), text);
-}
-
-void
-e_text_model_delete (ETextModel *model, gint position, gint length)
-{
- gint txt_len;
-
- g_return_if_fail (model != NULL);
- g_return_if_fail (E_IS_TEXT_MODEL (model));
- g_return_if_fail (length >= 0);
-
- txt_len = e_text_model_get_text_length (model);
- if (position + length > txt_len)
- length = txt_len - position;
-
- if (length <= 0)
- return;
-
- if (CLASS (model)->delete)
- CLASS (model)->delete (model, position, length);
-}
-
-gint
-e_text_model_object_count (ETextModel *model)
-{
- g_return_val_if_fail (model != NULL, 0);
- g_return_val_if_fail (E_IS_TEXT_MODEL (model), 0);
-
- if (CLASS (model)->obj_count)
- return CLASS (model)->obj_count (model);
-
- return 0;
-}
-
-const gchar *
-e_text_model_get_nth_object (ETextModel *model, gint n, gint *len)
-{
- g_return_val_if_fail (model != NULL, NULL);
- g_return_val_if_fail (E_IS_TEXT_MODEL (model), NULL);
-
- if (n < 0 || n >= e_text_model_object_count (model))
- return NULL;
-
- if (CLASS (model)->get_nth_obj)
- return CLASS (model)->get_nth_obj (model, n, len);
-
- return NULL;
-}
-
-gchar *
-e_text_model_strdup_nth_object (ETextModel *model, gint n)
-{
- const gchar *obj;
- gint len = 0;
-
- g_return_val_if_fail (model != NULL, NULL);
- g_return_val_if_fail (E_IS_TEXT_MODEL (model), NULL);
-
- obj = e_text_model_get_nth_object (model, n, &len);
-
- return obj ? g_strndup (obj, n) : NULL;
-}
-
-void
-e_text_model_get_nth_object_bounds (ETextModel *model, gint n, gint *start, gint *end)
-{
- const gchar *txt = NULL, *obj = NULL;
- gint len = 0;
-
- g_return_if_fail (model != NULL);
- g_return_if_fail (E_IS_TEXT_MODEL (model));
-
- txt = e_text_model_get_text (model);
- obj = e_text_model_get_nth_object (model, n, &len);
-
- g_return_if_fail (obj != NULL);
-
- if (start)
- *start = obj - txt;
- if (end)
- *end = obj - txt + len;
-}
-
-gint
-e_text_model_get_object_at_offset (ETextModel *model, gint offset)
-{
- g_return_val_if_fail (model != NULL, -1);
- g_return_val_if_fail (E_IS_TEXT_MODEL (model), -1);
-
- if (offset < 0 || offset >= e_text_model_get_text_length (model))
- return -1;
-
- /* If an optimized version has been provided, we use it. */
- if (CLASS (model)->obj_at_offset) {
-
- return CLASS (model)->obj_at_offset (model, offset);
-
- } else {
- /* If not, we fake it.*/
-
- gint i, N, pos0, pos1;
-
- N = e_text_model_object_count (model);
-
- for (i = 0; i < N; ++i) {
- e_text_model_get_nth_object_bounds (model, i, &pos0, &pos1);
- if (pos0 <= offset && offset < pos1)
- return i;
- }
-
- }
-
- return -1;
-}
-
-gint
-e_text_model_get_object_at_pointer (ETextModel *model, const gchar *s)
-{
- g_return_val_if_fail (model != NULL, -1);
- g_return_val_if_fail (E_IS_TEXT_MODEL (model), -1);
- g_return_val_if_fail (s != NULL, -1);
-
- return e_text_model_get_object_at_offset (model, s - e_text_model_get_text (model));
-}
-
-void
-e_text_model_activate_nth_object (ETextModel *model, gint n)
-{
- g_return_if_fail (model != NULL);
- g_return_if_fail (E_IS_TEXT_MODEL (model));
- g_return_if_fail (n >= 0);
- g_return_if_fail (n < e_text_model_object_count (model));
-
- gtk_signal_emit (GTK_OBJECT (model), e_text_model_signals[E_TEXT_MODEL_OBJECT_ACTIVATED], n);
-}
-
-ETextModel *
-e_text_model_new (void)
-{
- ETextModel *model = gtk_type_new (e_text_model_get_type ());
- return model;
-}
diff --git a/widgets/text/e-text-model.h b/widgets/text/e-text-model.h
deleted file mode 100644
index a3b1caa415..0000000000
--- a/widgets/text/e-text-model.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-text-model.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef E_TEXT_MODEL_H
-#define E_TEXT_MODEL_H
-
-#include <glib.h>
-#include <gtk/gtkobject.h>
-#include <libgnome/gnome-defs.h>
-
-BEGIN_GNOME_DECLS
-
-#define E_TYPE_TEXT_MODEL (e_text_model_get_type ())
-#define E_TEXT_MODEL(obj) (GTK_CHECK_CAST ((obj), E_TYPE_TEXT_MODEL, ETextModel))
-#define E_TEXT_MODEL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_TEXT_MODEL, ETextModelClass))
-#define E_IS_TEXT_MODEL(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_TEXT_MODEL))
-#define E_IS_TEXT_MODEL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), E_TYPE_TEXT_MODEL))
-
-typedef struct _ETextModel ETextModel;
-typedef struct _ETextModelClass ETextModelClass;
-
-struct _ETextModelPrivate;
-
-typedef gint (*ETextModelReposFn) (gint, gpointer);
-
-struct _ETextModel {
- GtkObject item;
-
- struct _ETextModelPrivate *priv;
-};
-
-struct _ETextModelClass {
- GtkObjectClass parent_class;
-
- /* Signal */
- void (* changed) (ETextModel *model);
- void (* reposition) (ETextModel *model, ETextModelReposFn fn, gpointer repos_fn_data);
- void (* object_activated) (ETextModel *model, gint obj_num);
- void (* cancel_completion) (ETextModel *model);
-
- /* Virtual methods */
-
- gint (* validate_pos) (ETextModel *model, gint pos);
-
- const char *(* get_text) (ETextModel *model);
- gint (* get_text_len) (ETextModel *model);
- void (* set_text) (ETextModel *model, const gchar *text);
- void (* insert) (ETextModel *model, gint position, const gchar *text);
- void (* insert_length) (ETextModel *model, gint position, const gchar *text, gint length);
- void (* delete) (ETextModel *model, gint position, gint length);
-
- void (* objectify) (ETextModel *model);
- gint (* obj_count) (ETextModel *model);
- const gchar *(* get_nth_obj) (ETextModel *model, gint n, gint *len);
- gint (* obj_at_offset) (ETextModel *model, gint offset);
-};
-
-GtkType e_text_model_get_type (void);
-
-ETextModel *e_text_model_new (void);
-
-void e_text_model_changed (ETextModel *model);
-void e_text_model_cancel_completion (ETextModel *model);
-
-void e_text_model_reposition (ETextModel *model, ETextModelReposFn fn, gpointer repos_data);
-gint e_text_model_validate_position (ETextModel *model, gint pos);
-
-
-/* Functions for manipulating the underlying text. */
-
-const gchar *e_text_model_get_text (ETextModel *model);
-gint e_text_model_get_text_length (ETextModel *model);
-void e_text_model_set_text (ETextModel *model, const gchar *text);
-void e_text_model_insert (ETextModel *model, gint position, const gchar *text);
-void e_text_model_insert_length (ETextModel *model, gint position, const gchar *text, gint length);
-void e_text_model_prepend (ETextModel *model, const gchar *text);
-void e_text_model_append (ETextModel *model, const gchar *text);
-void e_text_model_delete (ETextModel *model, gint position, gint length);
-
-
-/* Functions for accessing embedded objects. */
-
-gint e_text_model_object_count (ETextModel *model);
-const gchar *e_text_model_get_nth_object (ETextModel *model, gint n, gint *len);
-gchar *e_text_model_strdup_nth_object (ETextModel *model, gint n);
-void e_text_model_get_nth_object_bounds (ETextModel *model, gint n, gint *start_pos, gint *end_pos);
-gint e_text_model_get_object_at_offset (ETextModel *model, gint offset);
-gint e_text_model_get_object_at_pointer (ETextModel *model, const gchar *c);
-void e_text_model_activate_nth_object (ETextModel *model, gint n);
-
-
-
-
-
-
-
-END_GNOME_DECLS
-
-#endif
diff --git a/widgets/text/e-text-test.c b/widgets/text/e-text-test.c
deleted file mode 100644
index 39572905c8..0000000000
--- a/widgets/text/e-text-test.c
+++ /dev/null
@@ -1,171 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-text-test.c - E-Text item test program
- * Copyright 2000: Iain Holmes <ih@csd.abdn.ac.uk>
- *
- * Authors:
- * Iain Holmes <ih@csd.abdn.ac.uk>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include "e-text.h"
-#include <gnome.h>
-#include "gal/widgets/e-canvas.h"
-#include "gal/widgets/e-unicode.h"
-
-GnomeCanvasItem *rect;
-
-static void allocate_callback(GtkWidget *canvas, GtkAllocation *allocation, GnomeCanvasItem *item)
-{
- double height;
- gnome_canvas_item_set( item,
- "width", (double) allocation->width,
- NULL );
- gtk_object_get(GTK_OBJECT(item),
- "height", &height,
- NULL);
- height = MAX(height, allocation->height);
- gnome_canvas_set_scroll_region(GNOME_CANVAS( canvas ), 0, 0, allocation->width, height );
- gnome_canvas_item_set( rect,
- "x2", (double) allocation->width,
- "y2", (double) height,
- NULL );
-}
-
-static void
-reflow (GtkWidget *canvas, GnomeCanvasItem *item)
-{
- double height;
- gtk_object_get(GTK_OBJECT(item),
- "height", &height,
- NULL);
- height = MAX(height, canvas->allocation.height);
- gnome_canvas_set_scroll_region(GNOME_CANVAS( canvas ), 0, 0, canvas->allocation.width, height );
- gnome_canvas_item_set( rect,
- "x2", (double) canvas->allocation.width,
- "y2", (double) height,
- NULL );
-}
-
-static void
-quit_cb (GtkWidget *widget,
- gpointer data)
-{
- gtk_main_quit ();
-}
-
-static void
-change_text_cb (GtkEntry *entry,
- EText *text)
-{
- gchar *str;
-
- str = e_utf8_gtk_entry_get_text (entry);
- gnome_canvas_item_set (GNOME_CANVAS_ITEM (text),
- "text", str,
- NULL);
-}
-
-static 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 = e_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_entry_set_text(GTK_ENTRY(text), "Hello World! This is a really long string to test out the ellipsis stuff.");
- 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_entry_set_text(GTK_ENTRY(font), "fixed");
- gtk_container_add (GTK_CONTAINER (frame), font);
- gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
-
- 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 );
-
- 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.",
- "font", "fixed",
- "fill_color", "black",
- "anchor", GTK_ANCHOR_NW,
- "clip", TRUE,
- "use_ellipsis", TRUE,
- "editable", TRUE,
- "line_wrap", TRUE,
- "max_lines", 2,
- "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);
-
- gtk_signal_connect( GTK_OBJECT( canvas ), "size_allocate",
- GTK_SIGNAL_FUNC( allocate_callback ),
- item );
- gtk_signal_connect( GTK_OBJECT( canvas ), "reflow",
- GTK_SIGNAL_FUNC( reflow ),
- 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 2dc03d9a25..0000000000
--- a/widgets/text/e-text.c
+++ /dev/null
@@ -1,4214 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-text.c - Text item for evolution.
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- * Jon Trowbridge <trow@ximian.com>
- *
- * 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 <federico@nuclecu.unam.mx>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#include <config.h>
-
-#include "e-text.h"
-
-#include <math.h>
-#include <ctype.h>
-#include <string.h>
-#include <gdk/gdkx.h> /* for BlackPixel */
-#include <gtk/gtkinvisible.h>
-#include <gtk/gtkmain.h>
-#include <gtk/gtkselection.h>
-#include <gtk/gtkwindow.h>
-#include <libgnomeui/gnome-canvas-rect-ellipse.h>
-
-#include "gal/widgets/e-canvas.h"
-#include "gal/widgets/e-canvas-utils.h"
-#include "gal/widgets/e-unicode.h"
-#include "gal/util/e-text-event-processor-emacs-like.h"
-#include "gal/util/e-util.h"
-#include <libart_lgpl/art_affine.h>
-#include <libart_lgpl/art_rgb.h>
-#include <libart_lgpl/art_rgb_bitmap_affine.h>
-
-#define BORDER_INDENT 4
-
-enum {
- E_TEXT_CHANGED,
- E_TEXT_ACTIVATE,
- E_TEXT_KEYPRESS,
- E_TEXT_POPUP,
- E_TEXT_LAST_SIGNAL
-};
-
-static guint e_text_signals[E_TEXT_LAST_SIGNAL] = { 0 };
-
-
-
-/* This defines a line of text */
-struct line {
- const char *text; /* Line's text, it is a pointer into the text->text string */
- int length; /* Line's length IN BYTES */
- int width; /* Line's width in pixels */
- int ellipsis_length; /* Length before adding ellipsis */
-};
-
-/* Object argument IDs */
-enum {
- ARG_0,
- ARG_MODEL,
- ARG_EVENT_PROCESSOR,
- ARG_TEXT,
- ARG_FONT,
- ARG_FONTSET,
- ARG_FONT_GDK,
- ARG_FONT_E,
- ARG_BOLD,
- ARG_STRIKEOUT,
- ARG_ANCHOR,
- ARG_JUSTIFICATION,
- ARG_CLIP_WIDTH,
- ARG_CLIP_HEIGHT,
- ARG_CLIP,
- ARG_FILL_CLIP_RECTANGLE,
- 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_BREAK_CHARACTERS,
- ARG_MAX_LINES,
- ARG_WIDTH,
- ARG_HEIGHT,
- ARG_DRAW_BORDERS,
- ARG_ALLOW_NEWLINES,
- ARG_DRAW_BACKGROUND,
- ARG_DRAW_BUTTON,
- ARG_CURSOR_POS
-};
-
-
-enum {
- E_SELECTION_PRIMARY,
- E_SELECTION_CLIPBOARD
-};
-enum _TargetInfo {
- TARGET_UTF8_STRING,
- TARGET_UTF8,
- TARGET_COMPOUND_TEXT,
- TARGET_STRING,
- TARGET_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_reflow (GnomeCanvasItem *item, int flags);
-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 void e_text_text_model_changed(ETextModel *model, EText *text);
-static void e_text_text_model_reposition (ETextModel *model, ETextModelReposFn fn, gpointer repos_data, gpointer data);
-
-static void _get_tep(EText *text);
-
-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);
-
-#if 0
-static ETextSuckFont *e_suck_font (GdkFont *font);
-static void e_suck_font_free (ETextSuckFont *suckfont);
-#endif
-
-static void e_text_free_lines(EText *text);
-
-static gint text_width_with_objects (ETextModel *model,
- EFont *font, EFontStyle style,
- const gchar *text, gint bytelen);
-
-static void calc_height (EText *text);
-static void calc_line_widths (EText *text);
-static void split_into_lines (EText *text);
-
-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_CHANGED] =
- gtk_signal_new ("changed",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETextClass, changed),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- e_text_signals[E_TEXT_ACTIVATE] =
- gtk_signal_new ("activate",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETextClass, activate),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- e_text_signals[E_TEXT_KEYPRESS] =
- gtk_signal_new ("keypress",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETextClass, keypress),
- gtk_marshal_NONE__INT_INT,
- GTK_TYPE_NONE, 2, GTK_TYPE_UINT, GTK_TYPE_UINT);
-
- e_text_signals[E_TEXT_POPUP] =
- gtk_signal_new ("popup",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETextClass, popup),
- gtk_marshal_NONE__POINTER_INT,
- GTK_TYPE_NONE, 2, GTK_TYPE_POINTER, GTK_TYPE_INT);
-
- E_OBJECT_CLASS_ADD_SIGNALS (object_class, e_text_signals, E_TEXT_LAST_SIGNAL);
-
-
- gtk_object_add_arg_type ("EText::model",
- GTK_TYPE_OBJECT, GTK_ARG_READWRITE, ARG_MODEL);
- gtk_object_add_arg_type ("EText::event_processor",
- GTK_TYPE_OBJECT, GTK_ARG_READWRITE, ARG_EVENT_PROCESSOR);
- gtk_object_add_arg_type ("EText::text",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_TEXT);
- 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_WRITABLE, ARG_FONT_GDK);
- gtk_object_add_arg_type ("EText::font_e",
- GTK_TYPE_POINTER, GTK_ARG_READWRITE, ARG_FONT_E);
- gtk_object_add_arg_type ("EText::bold",
- GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_BOLD);
- gtk_object_add_arg_type ("EText::strikeout",
- GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_STRIKEOUT);
- 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::fill_clip_rectangle",
- GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_FILL_CLIP_RECTANGLE);
- 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::break_characters",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_BREAK_CHARACTERS);
- gtk_object_add_arg_type ("EText::max_lines",
- GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_MAX_LINES);
- gtk_object_add_arg_type ("EText::width",
- GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_WIDTH);
- gtk_object_add_arg_type ("EText::height",
- GTK_TYPE_DOUBLE, GTK_ARG_READABLE, ARG_HEIGHT);
- gtk_object_add_arg_type ("EText::draw_borders",
- GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_DRAW_BORDERS);
- gtk_object_add_arg_type ("EText::allow_newlines",
- GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_ALLOW_NEWLINES);
- gtk_object_add_arg_type ("EText::draw_background",
- GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_DRAW_BACKGROUND);
- gtk_object_add_arg_type ("EText::draw_button",
- GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_DRAW_BUTTON);
- gtk_object_add_arg_type ("EText::cursor_pos",
- GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_CURSOR_POS);
-
- if (!clipboard_atom)
- clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE);
-
-
-
- klass->changed = NULL;
- klass->activate = 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->model = e_text_model_new ();
- text->text = e_text_model_get_text (text->model);
-
- text->revert = NULL;
-
- gtk_object_ref (GTK_OBJECT (text->model));
- gtk_object_sink (GTK_OBJECT (text->model));
-
- text->model_changed_signal_id =
- gtk_signal_connect (GTK_OBJECT (text->model),
- "changed",
- GTK_SIGNAL_FUNC (e_text_text_model_changed),
- text);
- text->model_repos_signal_id =
- gtk_signal_connect (GTK_OBJECT (text->model),
- "reposition",
- GTK_SIGNAL_FUNC (e_text_text_model_reposition),
- text);
-
- text->anchor = GTK_ANCHOR_CENTER;
- text->justification = GTK_JUSTIFY_LEFT;
- text->clip_width = -1.0;
- text->clip_height = -1.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->yofs_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->tep_command_id = 0;
-
- 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->break_characters = NULL;
- text->max_lines = -1;
-
- text->tooltip_timeout = 0;
- text->tooltip_count = 0;
- text->tooltip_owner = FALSE;
-
- text->dbl_timeout = 0;
- text->tpl_timeout = 0;
-
- text->draw_background = FALSE;
- text->draw_button = FALSE;
-
- text->bold = FALSE;
- text->strikeout = FALSE;
-
- text->style = E_FONT_PLAIN;
- text->allow_newlines = TRUE;
-
- text->last_type_request = -1;
- text->last_time_request = 0;
- text->queued_requests = NULL;
-
- e_canvas_item_set_reflow_callback(GNOME_CANVAS_ITEM(text), e_text_reflow);
-}
-
-/* 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->tooltip_owner) {
- e_canvas_hide_tooltip (E_CANVAS(GNOME_CANVAS_ITEM(text)->canvas));
- }
-
- if (text->model_changed_signal_id)
- gtk_signal_disconnect (GTK_OBJECT (text->model),
- text->model_changed_signal_id);
-
- if (text->model_repos_signal_id)
- gtk_signal_disconnect (GTK_OBJECT (text->model),
- text->model_repos_signal_id);
-
- if (text->model)
- gtk_object_unref(GTK_OBJECT(text->model));
-
- if (text->tep_command_id)
- gtk_signal_disconnect(GTK_OBJECT(text->tep),
- text->tep_command_id);
-
- if (text->tep)
- gtk_object_unref (GTK_OBJECT(text->tep));
-
- if (text->invisible)
- gtk_object_unref (GTK_OBJECT(text->invisible));
-
- g_free (text->lines);
- g_free (text->primary_selection);
- g_free (text->clipboard_selection);
- g_free (text->revert);
-
- if (text->font)
- e_font_unref (text->font);
- text->font = NULL;
-
-#if 0
- if (text->suckfont)
- e_suck_font_free (text->suckfont);
-#endif
-
- if (text->stipple)
- gdk_bitmap_unref (text->stipple);
-
- 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->tooltip_timeout ) {
- gtk_timeout_remove (text->tooltip_timeout);
- text->tooltip_timeout = 0;
- }
-
- if ( text->dbl_timeout ) {
- gtk_timeout_remove (text->dbl_timeout);
- text->dbl_timeout = 0;
- }
-
- if ( text->tpl_timeout ) {
- gtk_timeout_remove (text->tpl_timeout);
- text->tpl_timeout = 0;
- }
-
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
-}
-
-static void
-e_text_text_model_changed (ETextModel *model, EText *text)
-{
- gint model_len = e_text_model_get_text_length (model);
- text->text = e_text_model_get_text(model);
- e_text_free_lines(text);
-
- /* Make sure our selection doesn't extend past the bounds of our text. */
- text->selection_start = CLAMP (text->selection_start, 0, model_len);
- text->selection_end = CLAMP (text->selection_end, 0, model_len);
-
- text->needs_split_into_lines = 1;
- text->needs_redraw = 1;
- e_canvas_item_request_reflow (GNOME_CANVAS_ITEM(text));
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (text));
-
- gtk_signal_emit (GTK_OBJECT (text), e_text_signals[E_TEXT_CHANGED]);
-}
-
-static void
-e_text_text_model_reposition (ETextModel *model, ETextModelReposFn fn, gpointer repos_data, gpointer user_data)
-{
- EText *text = E_TEXT (user_data);
- gint model_len = e_text_model_get_text_length (model);
-
- text->selection_start = fn (text->selection_start, repos_data);
- text->selection_end = fn (text->selection_end, repos_data);
-
- /* Our repos function should make sure we don't overrun the buffer, but it never
- hurts to be paranoid. */
- text->selection_start = CLAMP (text->selection_start, 0, model_len);
- text->selection_end = CLAMP (text->selection_end, 0, model_len);
-
- if (text->selection_start > text->selection_end) {
- gint tmp = text->selection_start;
- text->selection_start = text->selection_end;
- text->selection_end = tmp;
- }
-}
-
-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 = 0;
- y = 0;
-
- clip_x = x;
- clip_y = y;
-
- /* Calculate text dimensions */
-
- old_height = text->height;
-
- if (text->text && text->font)
- text->height = (e_font_height (text->font)) * text->num_lines;
- else
- text->height = 0;
-
- if (old_height != text->height)
- e_canvas_item_request_parent_reflow(item);
-
- /* 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;
- if ( text->clip_width >= 0)
- clip_x -= text->clip_width / 2;
- else
- clip_x -= text->width / 2;
- break;
-
- case GTK_ANCHOR_NE:
- case GTK_ANCHOR_E:
- case GTK_ANCHOR_SE:
- x -= text->max_width;
- if (text->clip_width >= 0)
- clip_x -= text->clip_width;
- else
- clip_x -= text->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;
- if ( text->clip_height >= 0 )
- clip_y -= text->clip_height / 2;
- else
- clip_y -= text->height / 2;
- break;
-
- case GTK_ANCHOR_SW:
- case GTK_ANCHOR_S:
- case GTK_ANCHOR_SE:
- y -= text->height;
- if ( text->clip_height >= 0 )
- clip_y -= text->clip_height;
- else
- clip_y -= text->height;
- break;
- }
-
- /* Bounds */
-
- if (text->clip) {
- /* maybe do bbox intersection here? */
- *px1 = clip_x;
- *py1 = clip_y;
- if (text->clip_width >= 0)
- *px2 = clip_x + text->clip_width;
- else
- *px2 = clip_x + text->width;
-
- if ( text->clip_height >= 0 )
- *py2 = clip_y + text->clip_height;
- else
- *py2 = clip_y + text->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, clip_width;
-
- item = GNOME_CANVAS_ITEM (text);
-
- /* Get canvas pixel coordinates for text position */
-
- wx = 0;
- wy = 0;
- gnome_canvas_item_i2w (item, &wx, &wy);
- gnome_canvas_w2c (item->canvas, wx + text->xofs, wy + text->yofs, &text->cx, &text->cy);
-
- if (text->clip_width < 0)
- clip_width = text->max_width;
- else
- clip_width = text->clip_width;
-
- /* Get canvas pixel coordinates for clip rectangle position */
- gnome_canvas_w2c (item->canvas, wx, wy, &text->clip_cx, &text->clip_cy);
- text->clip_cwidth = clip_width * item->canvas->pixels_per_unit;
- if ( text->clip_height >= 0 )
- text->clip_cheight = text->clip_height * item->canvas->pixels_per_unit;
- else
- text->clip_cheight = text->height * item->canvas->pixels_per_unit;
-
- /* 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;
- }
-}
-
-static void
-calc_height (EText *text)
-{
- GnomeCanvasItem *item;
- int old_height;
-
- item = GNOME_CANVAS_ITEM (text);
-
- /* Calculate text dimensions */
-
- old_height = text->height;
-
- if (text->text && text->font)
- text->height = e_font_height (text->font) * text->num_lines;
- else
- text->height = 0;
-
- if (old_height != text->height)
- e_canvas_item_request_parent_reflow(item);
-}
-
-static void
-calc_ellipsis (EText *text)
-{
- if (text->font)
- text->ellipsis_width =
- e_font_utf8_text_width (text->font, text->style,
- 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;
- gdouble clip_width;
- const gchar *p;
-
- lines = text->lines;
- text->max_width = 0;
-
- clip_width = text->clip_width;
- if (clip_width >= 0 && text->draw_borders) {
- clip_width -= 6;
- if (clip_width < 0)
- clip_width = 0;
- }
-
-
- if (!lines)
- return;
-
- for (i = 0; i < text->num_lines; i++) {
- if (lines->length != 0) {
- if (text->font) {
- lines->width = text_width_with_objects (text->model,
- text->font, text->style,
- lines->text, lines->length);
- lines->ellipsis_length = 0;
- } else {
- lines->width = 0;
- }
-
- if (text->clip &&
- text->use_ellipsis &&
- ! text->editing &&
- lines->width > clip_width &&
- clip_width >= 0) {
- if (text->font) {
- lines->ellipsis_length = 0;
- for (p = lines->text;
- p && *p && g_unichar_validate (g_utf8_get_char (p)) && (p - lines->text) < lines->length;
- p = g_utf8_next_char (p)) {
- gint text_width = text_width_with_objects (text->model,
- text->font, text->style,
- lines->text, p - lines->text);
- if (clip_width >= text_width + text->ellipsis_width)
- lines->ellipsis_length = p - lines->text;
- else
- break;
- }
- }
- else
- lines->ellipsis_length = 0;
- lines->width = text_width_with_objects (text->model,
- text->font, text->style,
- 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++;
- }
-}
-
-static void
-e_text_free_lines(EText *text)
-{
- if (text->lines)
- g_free (text->lines);
-
- text->lines = NULL;
- text->num_lines = 0;
-}
-
-static gint
-text_width_with_objects (ETextModel *model,
- EFont *font, EFontStyle style,
- const gchar *text, gint numbytes)
-{
- return text && *text ? e_font_utf8_text_width (font, style, text, numbytes) : 0;
-}
-
-static void
-text_draw_with_objects (ETextModel *model,
- GdkDrawable *drawable,
- EFont *font, EFontStyle style,
- GdkGC *gc,
- gint x, gint y,
- const gchar *text, gint numbytes)
-{
- const gchar *c;
-
- if (text == NULL)
- return;
-
- while (*text && numbytes > 0) {
- gint obj_num = -1;
-
- c = text;
-
- while (*c
- && (obj_num = e_text_model_get_object_at_pointer (model, c)) == -1
- && numbytes > 0) {
- ++c;
- --numbytes;
- }
-
- e_font_draw_utf8_text (drawable, font, style, gc, x, y, text, c-text);
- x += e_font_utf8_text_width (font, style, text, c-text);
-
- if (obj_num != -1 && numbytes > 0) {
- gint len;
- gint start_x = x;
-
- e_text_model_get_nth_object (model, obj_num, &len);
-
- if (len > numbytes)
- len = numbytes;
- e_font_draw_utf8_text (drawable, font, style, gc, x, y, c, len);
- x += e_font_utf8_text_width (font, style, c, len);
-
- /* We underline our objects. */
- gdk_draw_line (drawable, gc, start_x, y+1, x, y+1);
-
- c += len;
- numbytes -= len;
- }
-
- text = c;
- }
-}
-
-typedef void (*LineSplitterFn) (int line_num, const char *start, int length, gpointer user_data);
-
-#define IS_BREAK_CHAR(break_chars, c) (g_unichar_isspace (c) || ((break_chars) && g_utf8_strchr ((break_chars), (c))))
-
-static gint
-line_splitter (ETextModel *model, EFont *font, EFontStyle style,
- const char *break_characters,
- gboolean wrap_lines, double clip_width, gint max_lines,
- LineSplitterFn split_cb, gpointer user_data)
-{
- const char *curr;
- const char *text;
- const char *linestart;
- const char *last_breakpoint;
- gint line_count = 0;
-
- gunichar unival;
-
- if (max_lines < 1)
- max_lines = G_MAXINT;
-
- text = e_text_model_get_text (model);
- linestart = NULL;
- last_breakpoint = text;
-
- for (curr = text; curr && *curr && line_count < max_lines; curr = g_utf8_next_char (curr)) {
-
- unival = g_utf8_get_char (curr);
-
- if (linestart == NULL)
- linestart = curr;
-
- if (unival == '\n') { /* We always break on newline */
-
- if (split_cb)
- split_cb (line_count, linestart, curr - linestart, user_data);
- ++line_count;
- linestart = NULL;
-
- } else if (wrap_lines) {
-
- if (clip_width < text_width_with_objects (model, font, style, linestart, curr - linestart)
- && last_breakpoint > linestart) {
-
- if (split_cb)
- split_cb (line_count, linestart, last_breakpoint - linestart, user_data);
- ++line_count;
- linestart = NULL;
- curr = last_breakpoint;
-
- } else if (IS_BREAK_CHAR (break_characters, unival)
- && e_text_model_get_object_at_pointer (model, curr) == -1) { /* don't break mid-object */
- last_breakpoint = curr;
- }
- }
- }
-
- /* Handle any leftover text. */
- if (linestart) {
-
- if (clip_width < text_width_with_objects (model, font, style, linestart, strlen (linestart))
- && last_breakpoint > linestart) {
-
- if (split_cb)
- split_cb (line_count, linestart, last_breakpoint - linestart, user_data);
-
- ++line_count;
- linestart = g_utf8_next_char (last_breakpoint);
- }
-
- if (split_cb)
- split_cb (line_count, linestart, strlen (linestart), user_data);
- ++line_count;
-
- }
-
- if (line_count == 0) {
- if (split_cb)
- split_cb (0, text, strlen (text), user_data);
- line_count ++;
- }
-
- return line_count;
-}
-
-static void
-line_split_cb (int line_num, const char *start, int length, gpointer user_data)
-{
- EText *text = user_data;
- struct line *line = &((struct line *)text->lines)[line_num];
-
- line->text = start;
- line->length = length;
-}
-
-static void
-split_into_lines (EText *text)
-{
- double clip_width;
-
- if (text->text == NULL)
- return;
-
- /* Free old array of lines */
- e_text_free_lines (text);
-
- clip_width = text->clip_width;
- if (clip_width >= 0 && text->draw_borders) {
- clip_width -= 6;
- if (clip_width < 0)
- clip_width = 0;
- }
-
- /* First, count the number of lines */
- text->num_lines = line_splitter (text->model, text->font, text->style,
- text->break_characters,
- text->line_wrap, text->clip_width, -1,
- NULL, NULL);
-
- /* Allocate our array of lines */
- text->lines = g_new0 (struct line, text->num_lines);
-
- text->num_lines = line_splitter (text->model, text->font, text->style,
- text->break_characters,
- text->line_wrap, text->clip_width, text->num_lines,
- line_split_cb, text);
-}
-
-/* Convenience function to set the text's GC's foreground color */
-static void
-set_text_gc_foreground (EText *text)
-{
- if (!text->gc)
- return;
-
- gdk_gc_set_foreground (text->gc, &text->color);
-}
-
-/* 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;
-
- gboolean needs_update = 0;
- gboolean needs_reflow = 0;
-
- item = GNOME_CANVAS_ITEM (object);
- text = E_TEXT (object);
-
- color_changed = FALSE;
- have_pixel = FALSE;
-
- switch (arg_id) {
- case ARG_MODEL:
-
- if ( text->model_changed_signal_id )
- gtk_signal_disconnect (GTK_OBJECT (text->model),
- text->model_changed_signal_id);
-
- if ( text->model_repos_signal_id )
- gtk_signal_disconnect (GTK_OBJECT (text->model),
- text->model_repos_signal_id);
-
- gtk_object_unref (GTK_OBJECT (text->model));
- text->model = E_TEXT_MODEL (GTK_VALUE_OBJECT (*arg));
- gtk_object_ref (GTK_OBJECT (text->model));
-
- text->model_changed_signal_id =
- gtk_signal_connect (GTK_OBJECT (text->model),
- "changed",
- GTK_SIGNAL_FUNC (e_text_text_model_changed),
- text);
-
- text->model_repos_signal_id =
- gtk_signal_connect (GTK_OBJECT (text->model),
- "reposition",
- GTK_SIGNAL_FUNC (e_text_text_model_reposition),
- text);
-
- e_text_free_lines(text);
-
- text->text = e_text_model_get_text(text->model);
- gtk_signal_emit (GTK_OBJECT (text), e_text_signals[E_TEXT_CHANGED]);
-
- text->needs_split_into_lines = 1;
- needs_reflow = 1;
- break;
-
- case ARG_EVENT_PROCESSOR:
- if ( text->tep && text->tep_command_id )
- gtk_signal_disconnect(GTK_OBJECT(text->tep),
- text->tep_command_id);
- if ( text->tep ) {
- gtk_object_unref(GTK_OBJECT(text->tep));
- }
- text->tep = E_TEXT_EVENT_PROCESSOR(GTK_VALUE_OBJECT (*arg));
- gtk_object_ref(GTK_OBJECT(text->tep));
- text->tep_command_id =
- gtk_signal_connect(GTK_OBJECT(text->tep),
- "command",
- GTK_SIGNAL_FUNC(e_text_command),
- text);
- if (!text->allow_newlines)
- gtk_object_set (GTK_OBJECT (text->tep),
- "allow_newlines", FALSE,
- NULL);
- break;
-
- case ARG_TEXT:
- e_text_model_set_text(text->model, GTK_VALUE_STRING (*arg));
- break;
-
- case ARG_FONT:
- if (text->font)
- e_font_unref (text->font);
-
- text->font = e_font_from_gdk_name (GTK_VALUE_STRING (*arg));
-
- calc_ellipsis (text);
- if ( text->line_wrap )
- text->needs_split_into_lines = 1;
- else {
- text->needs_calc_line_widths = 1;
- text->needs_calc_height = 1;
- }
- needs_reflow = 1;
- break;
-
- case ARG_FONTSET:
- if (text->font)
- e_font_unref (text->font);
-
- text->font = e_font_from_gdk_name (GTK_VALUE_STRING (*arg));
-
- calc_ellipsis (text);
- if ( text->line_wrap )
- text->needs_split_into_lines = 1;
- else {
- text->needs_calc_line_widths = 1;
- text->needs_calc_height = 1;
- }
- needs_reflow = 1;
- break;
-
- case ARG_FONT_GDK:
- /* Ref the font in case it was the font that is stored
- in the e-font */
- gdk_font_ref (GTK_VALUE_POINTER (*arg));
- if (text->font)
- e_font_unref (text->font);
-
- text->font = e_font_from_gdk_font (GTK_VALUE_POINTER (*arg));
-
- calc_ellipsis (text);
- if ( text->line_wrap )
- text->needs_split_into_lines = 1;
- else {
- text->needs_calc_line_widths = 1;
- text->needs_calc_height = 1;
- }
- needs_reflow = 1;
- break;
-
- case ARG_FONT_E:
- if (text->font)
- e_font_unref (text->font);
-
- text->font = GTK_VALUE_POINTER (*arg);
- e_font_ref (text->font);
-
- calc_ellipsis (text);
- if (text->line_wrap)
- text->needs_split_into_lines = 1;
- else {
- text->needs_calc_line_widths = 1;
- text->needs_calc_height = 1;
- }
- needs_reflow = 1;
- break;
-
- case ARG_BOLD:
- text->bold = GTK_VALUE_BOOL (*arg);
- text->style = text->bold ? E_FONT_BOLD : E_FONT_PLAIN;
-
- text->needs_redraw = 1;
- text->needs_recalc_bounds = 1;
- if ( text->line_wrap )
- text->needs_split_into_lines = 1;
- else {
- text->needs_calc_line_widths = 1;
- text->needs_calc_height = 1;
- }
- needs_update = 1;
- needs_reflow = 1;
- break;
-
- case ARG_STRIKEOUT:
- text->strikeout = GTK_VALUE_BOOL (*arg);
- text->needs_redraw = 1;
- needs_update = 1;
- break;
-
- case ARG_ANCHOR:
- text->anchor = GTK_VALUE_ENUM (*arg);
- text->needs_recalc_bounds = 1;
- needs_update = 1;
- break;
-
- case ARG_JUSTIFICATION:
- text->justification = GTK_VALUE_ENUM (*arg);
- text->needs_redraw = 1;
- needs_update = 1;
- break;
-
- case ARG_CLIP_WIDTH:
- text->clip_width = fabs (GTK_VALUE_DOUBLE (*arg));
- calc_ellipsis (text);
- if ( text->line_wrap )
- text->needs_split_into_lines = 1;
- else {
- text->needs_calc_line_widths = 1;
- text->needs_calc_height = 1;
- }
- needs_reflow = 1;
- break;
-
- case ARG_CLIP_HEIGHT:
- text->clip_height = fabs (GTK_VALUE_DOUBLE (*arg));
- text->needs_recalc_bounds = 1;
- needs_reflow = 1;
- break;
-
- case ARG_CLIP:
- text->clip = GTK_VALUE_BOOL (*arg);
- calc_ellipsis (text);
- if ( text->line_wrap )
- text->needs_split_into_lines = 1;
- else {
- text->needs_calc_line_widths = 1;
- text->needs_calc_height = 1;
- }
- needs_reflow = 1;
- break;
-
- case ARG_FILL_CLIP_RECTANGLE:
- text->fill_clip_rectangle = GTK_VALUE_BOOL (*arg);
- needs_update = 1;
- break;
-
- case ARG_X_OFFSET:
- text->xofs = GTK_VALUE_DOUBLE (*arg);
- text->needs_recalc_bounds = 1;
- needs_update = 1;
- break;
-
- case ARG_Y_OFFSET:
- text->yofs = GTK_VALUE_DOUBLE (*arg);
- text->needs_recalc_bounds = 1;
- needs_update = 1;
- 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;
- }
-
- 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.red = ((text->rgba >> 24) & 0xff) * 0x101;
- color.green = ((text->rgba >> 16) & 0xff) * 0x101;
- color.blue = ((text->rgba >> 8) & 0xff) * 0x101;
- color_changed = TRUE;
- break;
-
- case ARG_FILL_STIPPLE:
- set_stipple (text, GTK_VALUE_BOXED (*arg), FALSE);
- text->needs_redraw = 1;
- needs_update = 1;
- break;
-
- case ARG_EDITABLE:
- text->editable = GTK_VALUE_BOOL (*arg);
- text->needs_redraw = 1;
- needs_update = 1;
- break;
-
- case ARG_USE_ELLIPSIS:
- text->use_ellipsis = GTK_VALUE_BOOL (*arg);
- text->needs_calc_line_widths = 1;
- needs_reflow = 1;
- break;
-
- case ARG_ELLIPSIS:
- if (text->ellipsis)
- g_free (text->ellipsis);
-
- text->ellipsis = g_strdup (GTK_VALUE_STRING (*arg));
- calc_ellipsis (text);
- text->needs_calc_line_widths = 1;
- needs_reflow = 1;
- break;
-
- case ARG_LINE_WRAP:
- text->line_wrap = GTK_VALUE_BOOL (*arg);
- text->needs_split_into_lines = 1;
- needs_reflow = 1;
- break;
-
- case ARG_BREAK_CHARACTERS:
- if ( text->break_characters ) {
- g_free(text->break_characters);
- text->break_characters = NULL;
- }
- if ( GTK_VALUE_STRING (*arg) )
- text->break_characters = g_strdup( GTK_VALUE_STRING (*arg) );
- text->needs_split_into_lines = 1;
- needs_reflow = 1;
- break;
-
- case ARG_MAX_LINES:
- text->max_lines = GTK_VALUE_INT (*arg);
- text->needs_split_into_lines = 1;
- needs_reflow = 1;
- break;
-
- case ARG_WIDTH:
- text->clip_width = fabs (GTK_VALUE_DOUBLE (*arg));
- calc_ellipsis (text);
- if ( text->line_wrap )
- text->needs_split_into_lines = 1;
- else {
- text->needs_calc_line_widths = 1;
- text->needs_calc_height = 1;
- }
- needs_reflow = 1;
- break;
-
- case ARG_DRAW_BORDERS:
- if (text->draw_borders != GTK_VALUE_BOOL (*arg)) {
- text->draw_borders = GTK_VALUE_BOOL (*arg);
- text->needs_calc_height = 1;
- text->needs_redraw = 1;
- needs_reflow = 1;
- needs_update = 1;
- }
- break;
-
- case ARG_DRAW_BACKGROUND:
- if (text->draw_background != GTK_VALUE_BOOL (*arg)){
- text->draw_background = GTK_VALUE_BOOL (*arg);
- text->needs_redraw = 1;
- }
- break;
-
- case ARG_DRAW_BUTTON:
- if (text->draw_button != GTK_VALUE_BOOL (*arg)){
- text->draw_button = GTK_VALUE_BOOL (*arg);
- text->needs_redraw = 1;
- }
- break;
-
- case ARG_ALLOW_NEWLINES:
- text->allow_newlines = GTK_VALUE_BOOL (*arg);
- _get_tep(text);
- gtk_object_set (GTK_OBJECT (text->tep),
- "allow_newlines", GTK_VALUE_BOOL (*arg),
- NULL);
- break;
-
- case ARG_CURSOR_POS: {
- ETextEventProcessorCommand command;
-
- command.action = E_TEP_MOVE;
- command.position = E_TEP_VALUE;
- command.value = GTK_VALUE_INT (*arg);
- command.time = GDK_CURRENT_TIME;
- e_text_command (text->tep, &command, text);
- break;
- }
-
- default:
- return;
- }
-
- if (color_changed) {
- if (GNOME_CANVAS_ITEM_REALIZED & GTK_OBJECT_FLAGS(item))
- gdk_color_context_query_color (item->canvas->cc, &color);
-
- text->color = color;
-
- if (!item->canvas->aa)
- set_text_gc_foreground (text);
-
- text->needs_redraw = 1;
- needs_update = 1;
- }
-
- if ( needs_reflow )
- e_canvas_item_request_reflow (item);
- if ( needs_update )
- 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_MODEL:
- GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(text->model);
- break;
-
- case ARG_EVENT_PROCESSOR:
- _get_tep(text);
- GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(text->tep);
- break;
-
- case ARG_TEXT:
- GTK_VALUE_STRING (*arg) = g_strdup (text->text);
- break;
-
- case ARG_FONT_E:
- GTK_VALUE_BOXED (*arg) = text->font;
- break;
-
- case ARG_BOLD:
- GTK_VALUE_BOOL (*arg) = text->bold;
- break;
-
- case ARG_STRIKEOUT:
- GTK_VALUE_BOOL (*arg) = text->strikeout;
- 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_FILL_CLIP_RECTANGLE:
- GTK_VALUE_BOOL (*arg) = text->fill_clip_rectangle;
- 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 = text->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_BREAK_CHARACTERS:
- GTK_VALUE_STRING (*arg) = g_strdup (text->break_characters);
- break;
-
- case ARG_MAX_LINES:
- GTK_VALUE_INT (*arg) = text->max_lines;
- break;
-
- case ARG_WIDTH:
- GTK_VALUE_DOUBLE (*arg) = text->clip_width;
- break;
-
- case ARG_HEIGHT:
- GTK_VALUE_DOUBLE (*arg) = text->clip && text->clip_height != -1 ? text->clip_height : text->height / text->item.canvas->pixels_per_unit;
- break;
-
- case ARG_DRAW_BORDERS:
- GTK_VALUE_BOOL (*arg) = text->draw_borders;
- break;
-
- case ARG_DRAW_BACKGROUND:
- GTK_VALUE_BOOL (*arg) = text->draw_background;
- break;
-
- case ARG_DRAW_BUTTON:
- GTK_VALUE_BOOL (*arg) = text->draw_button;
- break;
-
- case ARG_ALLOW_NEWLINES:
- GTK_VALUE_BOOL (*arg) = text->allow_newlines;
- break;
-
- case ARG_CURSOR_POS:
- GTK_VALUE_INT (*arg) = text->selection_start;
- break;
-
- default:
- arg->type = GTK_TYPE_INVALID;
- break;
- }
-}
-
-/* Update handler for the text item */
-static void
-e_text_reflow (GnomeCanvasItem *item, int flags)
-{
- EText *text;
-
- text = E_TEXT (item);
-
- if (text->needs_split_into_lines) {
- split_into_lines (text);
-
- text->needs_split_into_lines = 0;
- text->needs_calc_line_widths = 1;
- text->needs_calc_height = 1;
- }
-
- if ( text->needs_calc_line_widths ) {
- int x;
- int i;
- struct line *lines;
- gdouble clip_width;
- calc_line_widths (text);
- text->needs_calc_line_widths = 0;
- text->needs_redraw = 1;
-
- lines = text->lines;
- if ( !lines )
- return;
-
- for (lines = text->lines, i = 0; i < text->num_lines ; i++, lines ++) {
- if ((lines->text - text->text) > text->selection_end) {
- break;
- }
- }
- lines --;
- i--;
- x = text_width_with_objects (text->model,
- text->font, text->style,
- lines->text,
- text->selection_end - (lines->text - text->text));
-
- if (x < text->xofs_edit) {
- text->xofs_edit = x;
- }
-
- clip_width = text->clip_width;
- if (clip_width >= 0 && text->draw_borders) {
- clip_width -= 6;
- if (clip_width < 0)
- clip_width = 0;
- }
-
- if (2 + x - clip_width > text->xofs_edit) {
- text->xofs_edit = 2 + x - clip_width;
- }
-
- if (e_font_height (text->font) * i < text->yofs_edit)
- text->yofs_edit = e_font_height (text->font) * i;
-
- if ( text->needs_calc_height ) {
- calc_height (text);
- gnome_canvas_item_request_update(item);
- text->needs_calc_height = 0;
- text->needs_recalc_bounds = 1;
- }
-
- if (e_font_height (text->font) * (i + 1) -
- (text->clip_height != -1 ? text->clip_height : text->height) > text->yofs_edit)
- text->yofs_edit = e_font_height (text->font) * (i + 1) -
- (text->clip_height != -1 ? text->clip_height : text->height);
-
- gnome_canvas_item_request_update (item);
- }
- if ( text->needs_calc_height ) {
- calc_height (text);
- gnome_canvas_item_request_update(item);
- text->needs_calc_height = 0;
- text->needs_recalc_bounds = 1;
- }
-}
-
-/* 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 ( text->needs_recalc_bounds
- || (flags & GNOME_CANVAS_UPDATE_AFFINE)) {
- if (!item->canvas->aa) {
- set_text_gc_foreground (text);
- set_stipple (text, text->stipple, TRUE);
- get_bounds (text, &x1, &y1, &x2, &y2);
- if ( item->x1 != x1 ||
- item->x2 != x2 ||
- item->y1 != y1 ||
- item->y2 != y2 ) {
- gnome_canvas_request_redraw (item->canvas, item->x1, item->y1, item->x2, item->y2);
- item->x1 = x1;
- item->y1 = y1;
- item->x2 = x2;
- item->y2 = y2;
- text->needs_redraw = 1;
- item->canvas->need_repick = TRUE;
- }
- } 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);
- }
- text->needs_recalc_bounds = 0;
- }
- if ( text->needs_redraw ) {
- gnome_canvas_request_redraw (item->canvas, item->x1, item->y1, item->x2, item->y2);
- text->needs_redraw = 0;
- }
-}
-
-/* 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);
- gdk_color_context_query_color (item->canvas->cc, &text->color);
- gdk_gc_set_foreground (text->gc, &text->color);
-
- text->i_cursor = gdk_cursor_new (GDK_XTERM);
- text->default_cursor = gdk_cursor_new (GDK_LEFT_PTR);
- if (text->font == NULL) {
- gdk_font_ref (GTK_WIDGET (item->canvas)->style->font);
- text->font = e_font_from_gdk_font (GTK_WIDGET (item->canvas)->style->font);
- }
-}
-
-/* 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);
- text->i_cursor = NULL;
- gdk_cursor_destroy (text->default_cursor);
- text->default_cursor = NULL;
-
- 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 = 0;
-
- 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:
- if (text->draw_borders)
- x += BORDER_INDENT;
-
- /* For GTK_JUSTIFY_LEFT, we don't have to do anything. We do not support
- * GTK_JUSTIFY_FILL, yet.
- */
- break;
- }
-
- return x;
-}
-
-#if 0
-/* Calculates the y position of the first line of text. */
-static double
-get_line_ypos_item_relative (EText *text)
-{
- double y;
-
- y = 0;
-
- 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;
-}
-#endif
-
-/* 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:
- if (text->draw_borders)
- x += BORDER_INDENT;
- /* 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));
- text->tep_command_id =
- 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, *main_gc;
- GnomeCanvas *canvas;
- GtkWidget *widget;
-
- text = E_TEXT (item);
- canvas = GNOME_CANVAS_ITEM(text)->canvas;
- widget = GTK_WIDGET(canvas);
-
- fg_gc = widget->style->fg_gc[text->has_selection ? GTK_STATE_SELECTED : GTK_STATE_ACTIVE];
- if (text->draw_background || text->draw_button) {
- main_gc = widget->style->text_gc[GTK_STATE_NORMAL];
- } else {
- main_gc = text->gc;
- }
-
- if (text->draw_borders || text->draw_background) {
- gdouble thisx = item->x1 - x;
- gdouble thisy = item->y1 - y;
- gdouble thiswidth, thisheight;
- GtkWidget *widget = GTK_WIDGET(item->canvas);
-
- gtk_object_get(GTK_OBJECT(text),
- "width", &thiswidth,
- "height", &thisheight,
- NULL);
-
- if (text->draw_borders){
-
- if (text->editing) {
- thisx += 1;
- thisy += 1;
- thiswidth -= 2;
- thisheight -= 2;
- }
-
- gtk_paint_shadow (widget->style, drawable,
- GTK_STATE_NORMAL, GTK_SHADOW_IN,
- NULL, widget, "entry",
- thisx, thisy, thiswidth, thisheight);
-
- if (text->editing) {
- thisx -= 1;
- thisy -= 1;
- thiswidth += 2;
- thisheight += 2;
- /*
- * Chris: I am here "filling in" for the additions
- * and substractions done in the previous if (text->editing).
- * but you might have other plans for this. Please enlighten
- * me as to whether it should be:
- * thiswidth + 2 or thiswidth + 1.
- */
- gtk_paint_focus (widget->style, drawable,
- NULL, widget, "entry",
- thisx, thisy, thiswidth - 1, thisheight - 1);
- }
- }
-
- if (text->draw_background) {
- gtk_paint_flat_box (widget->style, drawable,
- GTK_WIDGET_STATE(widget), GTK_SHADOW_NONE,
- NULL, widget, "entry_bg",
- thisx + widget->style->klass->xthickness,
- thisy + widget->style->klass->ythickness,
- thiswidth - widget->style->klass->xthickness * 2,
- thisheight - widget->style->klass->ythickness * 2);
- }
- }
- if (text->draw_button) {
- GtkWidget *widget;
- int xoff = item->x1 - x;
- int yoff = item->y1 - y;
-
- widget = GTK_WIDGET (item->canvas);
-
- xoff -= widget->allocation.x;
- yoff -= widget->allocation.y;
-
- widget = widget->parent;
-
- while (widget && !GTK_IS_BUTTON(widget)) {
- if (!GTK_WIDGET_NO_WINDOW (widget)) {
- widget = NULL;
- break;
- }
- widget = widget->parent;
- }
- if (widget) {
- GtkButton *button = GTK_BUTTON (widget);
- GtkShadowType shadow_type;
- int thisx, thisy, thisheight, thiswidth;
- int default_spacing;
- GdkRectangle area;
- area.x = 0;
- area.y = 0;
- area.width = width;
- area.height = height;
-
-#define DEFAULT_SPACING 7
-#if 0
- default_spacing = gtk_style_get_prop_experimental (widget->style,
- "GtkButton::default_spacing",
- DEFAULT_SPACING);
-#endif
- default_spacing = 7;
-
- thisx = 0;
- thisy = 0;
- thiswidth = widget->allocation.width - GTK_CONTAINER (widget)->border_width * 2;
- thisheight = widget->allocation.height - GTK_CONTAINER (widget)->border_width * 2;
-
- if (GTK_WIDGET_HAS_DEFAULT (widget) &&
- GTK_BUTTON (widget)->relief == GTK_RELIEF_NORMAL)
- {
- gtk_paint_box (widget->style, drawable,
- GTK_STATE_NORMAL, GTK_SHADOW_IN,
- &area, widget, "buttondefault",
- thisx + xoff, thisy + yoff, thiswidth, thisheight);
- }
-
- if (GTK_WIDGET_CAN_DEFAULT (widget)) {
- thisx += widget->style->klass->xthickness;
- thisy += widget->style->klass->ythickness;
- thiswidth -= 2 * thisx + default_spacing;
- thisheight -= 2 * thisy + default_spacing;
- thisx += (1 + default_spacing) / 2;
- thisy += (1 + default_spacing) / 2;
- }
-
- if (GTK_WIDGET_HAS_FOCUS (widget)) {
- thisx += 1;
- thisy += 1;
- thiswidth -= 2;
- thisheight -= 2;
- }
-
- if (GTK_WIDGET_STATE (widget) == GTK_STATE_ACTIVE)
- shadow_type = GTK_SHADOW_IN;
- else
- shadow_type = GTK_SHADOW_OUT;
-
- if ((button->relief != GTK_RELIEF_NONE) ||
- ((GTK_WIDGET_STATE(widget) != GTK_STATE_NORMAL) &&
- (GTK_WIDGET_STATE(widget) != GTK_STATE_INSENSITIVE)))
- gtk_paint_box (widget->style, drawable,
- GTK_WIDGET_STATE (widget),
- shadow_type, &area, widget, "button",
- thisx + xoff, thisy + yoff, thiswidth, thisheight);
-
- if (GTK_WIDGET_HAS_FOCUS (widget)) {
- thisx -= 1;
- thisy -= 1;
- thiswidth += 2;
- thisheight += 2;
-
- gtk_paint_focus (widget->style, widget->window,
- &area, widget, "button",
- thisx + xoff, thisy + yoff, thiswidth - 1, thisheight - 1);
- }
- }
- }
-
-
- if (!text->text || !text->font)
- return;
-
- lines = text->lines;
- if ( !lines ) {
- text->needs_split_into_lines = 1;
- e_canvas_item_request_reflow (item);
- 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 (main_gc, &rect);
- gdk_gc_set_clip_rectangle (fg_gc, &rect);
- clip_rect = &rect;
- }
- ypos = text->cy + e_font_ascent (text->font);
- if (text->draw_borders)
- ypos += BORDER_INDENT;
-
- if (text->editing)
- ypos -= text->yofs_edit;
-
- if (text->stipple)
- gnome_canvas_set_stipple_origin (item->canvas, main_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 + text_width_with_objects (text->model,
- text->font, text->style,
- lines->text,
- sel_start - start_char);
- sel_rect.y = ypos - y - e_font_ascent (text->font);
- sel_rect.width = text_width_with_objects (text->model,
- text->font, text->style,
- lines->text + sel_start - start_char,
- sel_end - sel_start);
- sel_rect.height = e_font_height (text->font);
- 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);
- text_draw_with_objects (text->model,
- drawable,
- text->font, text->style,
- main_gc,
- xpos - x,
- ypos - y,
- lines->text,
- sel_start - start_char);
- text_draw_with_objects (text->model,
- drawable,
- text->font, text->style,
- fg_gc,
- xpos - x + text_width_with_objects (text->model,
- text->font, text->style,
- lines->text,
- sel_start - start_char),
- ypos - y,
- lines->text + sel_start - start_char,
- sel_end - sel_start);
- text_draw_with_objects (text->model,
- drawable,
- text->font, text->style,
- main_gc,
- xpos - x + text_width_with_objects (text->model,
- text->font, text->style,
- lines->text,
- sel_end - start_char),
- ypos - y,
- lines->text + sel_end - start_char,
- end_char - sel_end);
- } else {
- text_draw_with_objects (text->model,
- drawable,
- text->font, text->style,
- main_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,
- main_gc,
- TRUE,
- xpos - x + text_width_with_objects (text->model,
- text->font, text->style,
- lines->text,
- sel_start - start_char),
- ypos - y - e_font_ascent (text->font),
- 1,
- e_font_height (text->font));
- }
- } else {
- if (text->clip && text->use_ellipsis && lines->ellipsis_length < lines->length) {
- text_draw_with_objects (text->model,
- drawable,
- text->font, text->style,
- main_gc,
- xpos - x,
- ypos - y,
- lines->text,
- lines->ellipsis_length);
- e_font_draw_utf8_text (drawable,
- text->font, text->style,
- main_gc,
- xpos - x + lines->width - text->ellipsis_width,
- ypos - y,
- text->ellipsis ? text->ellipsis : "...",
- text->ellipsis ? strlen (text->ellipsis) : 3);
- } else {
- text_draw_with_objects (text->model,
- drawable,
- text->font, text->style,
- main_gc,
- xpos - x,
- ypos - y,
- lines->text,
- lines->length);
- }
- }
-
- if (text->strikeout)
- gdk_draw_rectangle (drawable,
- main_gc,
- TRUE,
- xpos - x,
- ypos - y - e_font_ascent (text->font) / 2,
- lines->width, 1);
- ypos += e_font_height (text->font);
- lines++;
- }
-
- if (text->clip) {
- gdk_gc_set_clip_rectangle (main_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)
-{
-#if 0
- EText *text;
- guint32 fg_color;
- double xpos, ypos;
- struct line *lines;
- int i, j;
- double affine[6];
- 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;
- if ( !lines )
- return;
-
- 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;
-#endif
-}
-
-/* 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 = e_font_height (text->font);
- else
- font_height = 0;
-
- best = 1.0e36;
-
- lines = text->lines;
-
- if ( !lines ) {
- text->needs_split_into_lines = 1;
- e_canvas_item_request_reflow (item);
- return 1;
- }
-
- if (text->fill_clip_rectangle) {
- double clip_width;
- double clip_height;
-
- if (text->clip_width < 0)
- clip_width = text->max_width;
- else
- clip_width = text->clip_width;
-
- /* Get canvas pixel coordinates for clip rectangle position */
- clip_width = clip_width * item->canvas->pixels_per_unit;
- if ( text->clip_height >= 0 )
- clip_height = text->clip_height * item->canvas->pixels_per_unit;
- else
- clip_height = text->height * item->canvas->pixels_per_unit;
-
- if (cx >= text->clip_cx &&
- cx <= text->clip_cx + clip_width &&
- cy >= text->clip_cy &&
- cy <= text->clip_cy + clip_height)
- return 0;
- else
- return 1;
- }
-
- 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 ( text->clip_width >= 0 ) {
- if (x2 > (text->clip_cx + text->clip_width))
- x2 = text->clip_cx + text->clip_width;
- }
-
- if ( text->clip_height >= 0 ) {
- 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 = 0;
- *y1 = 0;
-
- if (text->clip) {
- width = text->clip_width;
- if ( text->clip_height >= 0 )
- height = text->clip_height;
- else height = text->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 gboolean
-_get_xy_from_position (EText *text, gint position, gint *xp, gint *yp)
-{
- if (text->lines && (xp || yp)) {
- struct line *lines = NULL;
- int x, y;
- double xd, yd;
- int j;
- x = get_line_xpos_item_relative (text, lines);
- y = text->yofs;
- y -= text->yofs_edit;
- for (j = 0, lines = text->lines; j < text->num_lines; lines++, j++) {
- if (lines->text > text->text + position)
- break;
- y += e_font_height (text->font);
- }
- lines --;
- y -= e_font_descent (text->font);
-
- x += text_width_with_objects (text->model,
- text->font, text->style,
- lines->text,
- position - (lines->text - text->text));
- x -= text->xofs_edit;
-
- xd = x; yd = y;
- gnome_canvas_item_i2w (GNOME_CANVAS_ITEM(text), &xd, &yd);
- gnome_canvas_w2c (GNOME_CANVAS_ITEM(text)->canvas, xd, yd, &x, &y);
-
- if (xp)
- *xp = x;
- if (yp)
- *yp = y;
-
- return TRUE;
- }
-
- return FALSE;
-}
-
-static gint
-_get_position_from_xy (EText *text, gint x, gint y)
-{
- int i, j;
- int ypos = text->yofs;
- int xpos;
- double xd, yd;
- const char *p;
- gunichar unival;
- gint font_ht, adjust=0;
- struct line *lines;
-
- xd = x; yd = y;
- gnome_canvas_c2w (GNOME_CANVAS_ITEM(text)->canvas, xd, yd, &xd, &yd);
- gnome_canvas_item_w2i (GNOME_CANVAS_ITEM(text), &xd, &yd);
- x = xd; y = yd;
-
- y += text->yofs_edit;
- font_ht = e_font_height (text->font);
-
- if (text->draw_borders)
- ypos += BORDER_INDENT;
-
- switch (text->anchor) {
- case GTK_ANCHOR_WEST:
- case GTK_ANCHOR_CENTER:
- case GTK_ANCHOR_EAST:
- y += (text->num_lines * font_ht)/2;
- break;
- case GTK_ANCHOR_SOUTH:
- case GTK_ANCHOR_SOUTH_EAST:
- case GTK_ANCHOR_SOUTH_WEST:
- y += text->num_lines * font_ht;
- default:
- /* Do nothing */
- break;
- }
-
-
- j = 0;
- while (y > ypos) {
- ypos += font_ht;
- j ++;
- }
- j--;
- if (j >= text->num_lines)
- j = text->num_lines - 1;
- if (j < 0)
- j = 0;
- i = 0;
- lines = text->lines;
-
- if ( !lines )
- return 0;
-
- lines += j;
- x += text->xofs_edit;
- xpos = get_line_xpos_item_relative (text, lines);
-
- for (i = 0, p = lines->text; p && i < lines->length; i++, p = e_unicode_get_utf8 (p, &unival)) {
- int charwidth;
- int step1, step2;
-
-#if 0
- if (unival == '\1') {
- const gchar *obj_str = NULL; /*e_text_model_get_nth_object (text->model, object_num);*/
- charwidth = e_font_utf8_text_width (text->font, text->style, obj_str, strlen (obj_str));
- ++object_num;
-
- step1 = charwidth;
- step2 = 0;
- adjust = -1;
-
- } else {
-#endif
- charwidth = e_font_utf8_char_width (text->font, text->style, (gchar *) p);
-
- step1 = charwidth / 2;
- step2 = (charwidth + 1) / 2;
- adjust = 0;
-#if 0
- }
-#endif
-
- xpos += step1;
- if (xpos > x) {
- break;
- }
- xpos += step2;
- }
-
- if (!p) return 0;
-
- return MAX (p - text->text + adjust, 0);
-}
-
-#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, &current_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 (text->lasty - text->clip_cy > text->clip_cheight &&
- text->yofs_edit < text->height - text->clip_cheight) {
- text->yofs_edit += 4;
- if (text->yofs_edit > text->height - text->clip_cheight + 1)
- text->yofs_edit = text->height - text->clip_cheight + 1;
- redraw = TRUE;
- }
- if (text->lasty - text->clip_cy < 0 &&
- text->yofs_edit > 0) {
- text->yofs_edit -= 4;
- if (text->yofs_edit < 0)
- text->yofs_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) {
- text->needs_redraw = 1;
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(text));
- }
- return TRUE;
-}
-
-static gboolean
-tooltip_event(GtkWidget *tooltip, GdkEvent *event, EText *text)
-{
- gint ret_val = FALSE;
- if (GTK_OBJECT_DESTROYED (text)) {
- return FALSE;
- }
- switch (event->type) {
- case GDK_LEAVE_NOTIFY:
- e_canvas_hide_tooltip (E_CANVAS(GNOME_CANVAS_ITEM(text)->canvas));
- break;
- case GDK_BUTTON_PRESS:
- case GDK_BUTTON_RELEASE:
- if (event->type == GDK_BUTTON_RELEASE) {
- e_canvas_hide_tooltip (E_CANVAS(GNOME_CANVAS_ITEM(text)->canvas));
- }
- /* Forward events to the text item */
- gtk_signal_emit_by_name (GTK_OBJECT (text), "event", event,
- &ret_val);
- if (!ret_val)
- gtk_propagate_event (GTK_WIDGET(GNOME_CANVAS_ITEM(text)->canvas), event);
- ret_val = TRUE;
- default:
- break;
- }
- return ret_val;
-}
-
-static void
-tooltip_destroy(GtkWidget *tooltip, EText *text)
-{
- text->tooltip_owner = FALSE;
- gtk_object_unref (GTK_OBJECT (text));
-}
-
-static gboolean
-_do_tooltip (gpointer data)
-{
- EText *text = E_TEXT (data);
- struct line *lines;
- GtkWidget *canvas;
- int i;
- gdouble max_width;
- gboolean cut_off;
- double i2c[6];
- ArtPoint origin = {0, 0};
- ArtPoint pixel_origin;
- int canvas_x, canvas_y;
- GnomeCanvasItem *tooltip_text;
- double tooltip_width;
- double tooltip_height;
- double tooltip_x;
- double tooltip_y;
-#if 0
- double x1, x2, y1, y2;
-#endif
- GnomeCanvasItem *rect;
- GtkWidget *tooltip_window; /* GtkWindow for displaying the tooltip */
-
- text->tooltip_count = 0;
-
- lines = text->lines;
-
- if (E_CANVAS(GNOME_CANVAS_ITEM(text)->canvas)->tooltip_window || text->editing || (!lines)) {
- text->tooltip_timeout = 0;
- return FALSE;
- }
-
- cut_off = FALSE;
- for ( lines = text->lines, i = 0; i < text->num_lines; lines++, i++ ) {
- if (lines->length > lines->ellipsis_length) {
- cut_off = TRUE;
- break;
- }
- }
- if ( ! cut_off ) {
- text->tooltip_timeout = 0;
- return FALSE;
- }
-
- gnome_canvas_item_i2c_affine(GNOME_CANVAS_ITEM(text), i2c);
- art_affine_point (&pixel_origin, &origin, i2c);
-
- gdk_window_get_origin (GTK_WIDGET(GNOME_CANVAS_ITEM(text)->canvas)->window, &canvas_x, &canvas_y);
- pixel_origin.x += canvas_x;
- pixel_origin.y += canvas_y;
- pixel_origin.x -= (int) gtk_layout_get_hadjustment(GTK_LAYOUT(GNOME_CANVAS_ITEM(text)->canvas))->value;
- pixel_origin.y -= (int) gtk_layout_get_vadjustment(GTK_LAYOUT(GNOME_CANVAS_ITEM(text)->canvas))->value;
-
- tooltip_window = gtk_window_new (GTK_WINDOW_POPUP);
- gtk_container_set_border_width (GTK_CONTAINER (tooltip_window), 1);
-
- canvas = e_canvas_new ();
-
- gtk_container_add (GTK_CONTAINER (tooltip_window), canvas);
-
- /* Get the longest line length */
- max_width = 0.0;
- for (lines = text->lines, i = 0; i < text->num_lines; lines++, i++) {
- gdouble line_width;
-
- line_width = text_width_with_objects (text->model, text->font, text->style, lines->text, lines->length);
- max_width = MAX (max_width, line_width);
- }
-
- rect = gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS (canvas)),
- gnome_canvas_rect_get_type (),
- "x1", (double) 0,
- "y1", (double) 0,
- "x2", (double) max_width + 4,
- "y2", (double) text->height + 4,
- "fill_color", "light gray",
- NULL);
-
- tooltip_text = gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS (canvas)),
- e_text_get_type (),
- "anchor", GTK_ANCHOR_NW,
- "bold", text->bold,
- "strikeout", text->strikeout,
- "font_e", text->font,
- "text", text->text,
- "editable", FALSE,
- "clip_width", text->max_lines != 1 ? text->clip_width : max_width,
- "clip_height", text->max_lines != 1 ? -1 : (double)text->height,
- "clip", TRUE,
- "line_wrap", text->line_wrap,
- "justification", text->justification,
- NULL);
-
-
-
- if (text->draw_borders)
- e_canvas_item_move_absolute(tooltip_text, 1 + BORDER_INDENT, 1 + BORDER_INDENT);
- else
- e_canvas_item_move_absolute(tooltip_text, 1, 1);
-
-
- split_into_lines (E_TEXT(tooltip_text));
- calc_height (E_TEXT(tooltip_text));
- calc_line_widths (E_TEXT(tooltip_text));
- gnome_canvas_item_set (tooltip_text,
- "clip_height", (double) E_TEXT(tooltip_text)->height,
- "clip_width", (double) E_TEXT(tooltip_text)->max_width,
- NULL);
- tooltip_width = E_TEXT(tooltip_text)->max_width;
- tooltip_height = E_TEXT(tooltip_text)->height;
- tooltip_x = 0;
- tooltip_y = 0;
- switch(E_TEXT(tooltip_text)->justification) {
- case GTK_JUSTIFY_CENTER:
- tooltip_x = - tooltip_width / 2;
- break;
- case GTK_JUSTIFY_RIGHT:
- tooltip_x = tooltip_width / 2;
- break;
- case GTK_JUSTIFY_FILL:
- case GTK_JUSTIFY_LEFT:
- tooltip_x = 0;
- 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:
- tooltip_y -= tooltip_height / 2.0;
- break;
-
- case GTK_ANCHOR_SW:
- case GTK_ANCHOR_S:
- case GTK_ANCHOR_SE:
- tooltip_y -= tooltip_height;
- break;
- }
- switch(E_TEXT(tooltip_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:
- tooltip_x -= tooltip_width / 2.0;
- break;
-
- case GTK_ANCHOR_NE:
- case GTK_ANCHOR_E:
- case GTK_ANCHOR_SE:
- tooltip_x -= tooltip_width;
- break;
- }
-
- gnome_canvas_item_set(rect,
- "x2", (double) tooltip_width + 4 + (text->draw_borders ? BORDER_INDENT * 2 : 0),
- "y2", (double) tooltip_height + 4 + (text->draw_borders ? BORDER_INDENT * 2 : 0),
- NULL);
-
- gtk_widget_set_usize (tooltip_window,
- tooltip_width + 4 + (text->draw_borders ? BORDER_INDENT * 2 : 0),
- tooltip_height + 4 + (text->draw_borders ? BORDER_INDENT * 2 : 0));
- gnome_canvas_set_scroll_region (GNOME_CANVAS(canvas), 0.0, 0.0,
- tooltip_width + (text->draw_borders ? BORDER_INDENT * 2 : 0),
- (double)tooltip_height + (text->draw_borders ? BORDER_INDENT * 2 : 0));
- gtk_widget_show (canvas);
- gtk_widget_realize (tooltip_window);
- gtk_signal_connect (GTK_OBJECT(tooltip_window), "event",
- GTK_SIGNAL_FUNC(tooltip_event), text);
- gtk_signal_connect (GTK_OBJECT(tooltip_window), "destroy",
- GTK_SIGNAL_FUNC(tooltip_destroy), text);
- gtk_object_ref (GTK_OBJECT (text));
-
- e_canvas_popup_tooltip (E_CANVAS(GNOME_CANVAS_ITEM(text)->canvas),
- tooltip_window,
- pixel_origin.x - 2 + tooltip_x,
- pixel_origin.y - 2 + tooltip_y);
- text->tooltip_owner = TRUE;
-
- text->tooltip_timeout = 0;
- return FALSE;
-}
-
-static void
-start_editing (EText *text)
-{
- if (text->editing)
- return;
-
- g_free (text->revert);
- text->revert = g_strdup (text->text);
-
- text->editing = TRUE;
- if (text->pointer_in) {
- if (text->default_cursor_shown && (!text->draw_borders)) {
- gdk_window_set_cursor (GTK_WIDGET (GNOME_CANVAS_ITEM (text)->canvas)->window, text->i_cursor);
- text->default_cursor_shown = FALSE;
- }
- }
- text->select_by_word = FALSE;
- text->xofs_edit = 0;
- text->yofs_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);
-}
-
-void
-e_text_stop_editing (EText *text)
-{
- if (!text->editing)
- return;
-
- g_free (text->revert);
- text->revert = NULL;
-
- text->editing = FALSE;
- if ( (!text->default_cursor_shown) && (!text->draw_borders) ) {
- gdk_window_set_cursor (GTK_WIDGET (GNOME_CANVAS_ITEM (text)->canvas)->window, text->default_cursor);
- text->default_cursor_shown = TRUE;
- }
- if (text->timer) {
- g_timer_stop(text->timer);
- g_timer_destroy(text->timer);
- text->timer = NULL;
- }
-}
-
-void
-e_text_cancel_editing (EText *text)
-{
- if (text->revert)
- e_text_model_set_text(text->model, text->revert);
- e_text_stop_editing (text);
-}
-
-static gboolean
-_click (gpointer data)
-{
- *(gint *)data = 0;
- return FALSE;
-}
-
-static gint
-e_text_event (GnomeCanvasItem *item, GdkEvent *event)
-{
- EText *text = E_TEXT(item);
- ETextEventProcessorEvent e_tep_event;
-
- gint return_val = 0;
-
- if (GTK_OBJECT_DESTROYED (item))
- return FALSE;
-
- 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) {
- start_editing (text);
- } else {
- e_text_stop_editing (text);
- if (text->timeout_id) {
- g_source_remove(text->timeout_id);
- text->timeout_id = 0;
- }
- }
- if ( text->line_wrap )
- text->needs_split_into_lines = 1;
- else
- text->needs_calc_line_widths = 1;
- e_canvas_item_request_reflow (GNOME_CANVAS_ITEM(text));
- }
- return_val = 0;
- break;
- case GDK_KEY_PRESS: /* Fall Through */
- case GDK_KEY_RELEASE:
- if (text->editing) {
- GdkEventKey key = event->key;
- gint ret;
-
- e_tep_event.key.time = key.time;
- e_tep_event.key.state = key.state;
- e_tep_event.key.keyval = key.keyval;
-
- /* This is probably ugly hack, but we have to handle UTF-8 input somehow */
-#if 0
- e_tep_event.key.length = key.length;
- e_tep_event.key.string = key.string;
-#else
- e_tep_event.key.string = e_utf8_from_gtk_event_key (GTK_WIDGET (item->canvas), key.keyval, key.string);
- if (e_tep_event.key.string != NULL) {
- e_tep_event.key.length = strlen (e_tep_event.key.string);
- } else {
- e_tep_event.key.length = 0;
- }
-#endif
- _get_tep(text);
- ret = e_text_event_processor_handle_event (text->tep, &e_tep_event);
-
- if (event->type == GDK_KEY_PRESS)
- gtk_signal_emit (GTK_OBJECT (text), e_text_signals[E_TEXT_KEYPRESS],
- e_tep_event.key.keyval, e_tep_event.key.state);
-
-
- if (e_tep_event.key.string)
- g_free (e_tep_event.key.string);
-
-
- return ret;
- }
- else
- return 0;
- break;
- case GDK_BUTTON_PRESS: /* Fall Through */
- case GDK_BUTTON_RELEASE:
- if (text->tooltip_timeout) {
- gtk_timeout_remove (text->tooltip_timeout);
- text->tooltip_timeout = 0;
- }
- e_canvas_hide_tooltip (E_CANVAS(GNOME_CANVAS_ITEM(text)->canvas));
-#if 0
- if ((!text->editing)
- && text->editable
- && event->type == GDK_BUTTON_RELEASE
- && event->button.button == 1) {
- GdkEventButton button = event->button;
-
- e_canvas_item_grab_focus (item, TRUE);
-
- e_tep_event.type = GDK_BUTTON_RELEASE;
- 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;
- }
-#else
- if ((!text->editing)
- && text->editable
- && (event->button.button == 1 ||
- event->button.button == 2)) {
- e_canvas_item_grab_focus (item, TRUE);
- start_editing (text);
- }
-#endif
-
- /* We follow convention and emit popup events on right-clicks. */
- if (event->type == GDK_BUTTON_PRESS && event->button.button == 3) {
- gtk_signal_emit (GTK_OBJECT (text),
- e_text_signals[E_TEXT_POPUP],
- &(event->button),
- _get_position_from_xy (text, event->button.x, event->button.y));
-
- break;
- }
-
- /* Create our own double and triple click events,
- as gnome-canvas doesn't forward them to us */
- if (event->type == GDK_BUTTON_PRESS) {
- if (text->dbl_timeout == 0 &&
- text->tpl_timeout == 0) {
- text->dbl_timeout = gtk_timeout_add (200,
- _click,
- &(text->dbl_timeout));
- } else {
- if (text->tpl_timeout == 0) {
- e_tep_event.type = GDK_2BUTTON_PRESS;
- text->tpl_timeout = gtk_timeout_add (200, _click, &(text->tpl_timeout));
- } else {
- e_tep_event.type = GDK_3BUTTON_PRESS;
- }
- }
- }
-
- 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 0
- GdkEventCrossing *crossing = (GdkEventCrossing *) event;
- double x1, y1, x2, y2;
- split_into_lines (text);
- calc_height (text);
- calc_line_widths (text);
- get_bounds (text, &x1, &y1, &x2, &y2);
- if (crossing->x >= x1 &&
- crossing->y >= y1 &&
- crossing->x <= x2 &&
- crossing->y <= y2) {
-#endif
- if ( text->tooltip_count == 0 && text->clip) {
- if (!text->tooltip_timeout)
- text->tooltip_timeout = gtk_timeout_add (1000, _do_tooltip, text);
- }
- text->tooltip_count ++;
-#if 0
- }
-#endif
- }
-
- text->pointer_in = TRUE;
- if (text->editing || text->draw_borders) {
- 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:
- if (text->tooltip_count > 0)
- text->tooltip_count --;
- if ( text->tooltip_count == 0 && text->clip) {
- if ( text->tooltip_timeout ) {
- gtk_timeout_remove (text->tooltip_timeout);
- text->tooltip_timeout = 0;
- }
- }
-
- text->pointer_in = FALSE;
- if (text->editing || text->draw_borders) {
- 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;
-}
-
-/* fixme: */
-
-static int
-next_word (EText *text, int start)
-{
- char *p;
- int length;
-
- length = strlen (text->text);
-
- if (start >= length) {
- return length;
- } else {
- p = g_utf8_next_char (text->text + start);
-
- while (p && *p && g_unichar_validate (g_utf8_get_char (p))) {
- gunichar unival = g_utf8_get_char (p);
- if (g_unichar_isspace (unival)) {
- return p - text->text;
- } else
- p = g_utf8_next_char (p);
- }
- }
-
- return p - text->text;
-}
-
-static int
-_get_position(EText *text, ETextEventProcessorCommand *command)
-{
- int length, obj_num;
- int x, y;
- gunichar unival;
- char *p = NULL;
- gint new_pos = 0;
-
- switch (command->position) {
-
- case E_TEP_VALUE:
- new_pos = command->value;
- break;
-
- case E_TEP_SELECTION:
- new_pos = text->selection_end;
- break;
-
- case E_TEP_START_OF_BUFFER:
- new_pos = 0;
- break;
-
- case E_TEP_END_OF_BUFFER:
- new_pos = strlen (text->text);
- break;
-
- case E_TEP_START_OF_LINE:
-
- new_pos = 0;
-
- if (text->selection_end >= 1) {
-
- p = g_utf8_find_prev_char (text->text, text->text + text->selection_end);
- if (p != text->text) {
- p = g_utf8_find_prev_char (text->text, p);
-
- while (p && p > text->text && !new_pos) {
- if (*p == '\n')
- new_pos = p - text->text + 1;
- p = g_utf8_find_prev_char (text->text, p);
- }
- }
- }
-
- break;
-
- case E_TEP_END_OF_LINE:
- new_pos = -1;
- length = strlen (text->text);
-
- if (text->selection_end >= length) {
- new_pos = length;
- } else {
-
- p = g_utf8_next_char (text->text + text->selection_end);
-
- while (p && *p && g_unichar_validate (g_utf8_get_char (p))) {
- if (*p == '\n') {
- new_pos = p - text->text;
- p = NULL;
- } else
- p = g_utf8_next_char (p);
- }
- }
-
- if (new_pos == -1)
- new_pos = p - text->text;
-
- break;
-
- case E_TEP_FORWARD_CHARACTER:
- length = strlen (text->text);
-
- if (text->selection_end >= length) {
- new_pos = length;
- } else {
- p = g_utf8_next_char (text->text + text->selection_end);
- new_pos = p - text->text;
- }
-
- break;
-
- case E_TEP_BACKWARD_CHARACTER:
- new_pos = 0;
- if (text->selection_end >= 1) {
- p = g_utf8_find_prev_char (text->text, text->text + text->selection_end);
-
- if (p != NULL)
- new_pos = p - text->text;
- }
-
- break;
-
- case E_TEP_FORWARD_WORD:
- new_pos = next_word (text, text->selection_end);
- break;
-
- case E_TEP_BACKWARD_WORD:
- new_pos = 0;
- if (text->selection_end >= 1) {
- p = g_utf8_find_prev_char (text->text, text->text + text->selection_end);
- if (p != text->text) {
- p = g_utf8_find_prev_char (text->text, p);
-
- while (p && p > text->text && g_unichar_validate (g_utf8_get_char (p))) {
- unival = g_utf8_get_char (p);
- if (g_unichar_isspace (unival)) {
- new_pos = g_utf8_next_char (p) - text->text;
- p = NULL;
- } else
- p = g_utf8_find_prev_char (text->text, p);
- }
- }
- }
-
- break;
-
- case E_TEP_FORWARD_LINE:
- if (_get_xy_from_position(text, text->selection_end, &x, &y)) {
- y += e_font_height (text->font);
- new_pos = _get_position_from_xy(text, x, y);
- }
- break;
-
- case E_TEP_BACKWARD_LINE:
- if (_get_xy_from_position(text, text->selection_end, &x, &y)) {
- y -= e_font_height (text->font);
- new_pos = _get_position_from_xy(text, x, y);
- }
- break;
-
- case E_TEP_SELECT_WORD:
-
- /* This is a silly hack to cause double-clicking on an object
- to activate that object.
- (Normally, double click == select word, which is why this is here.) */
-
- obj_num = e_text_model_get_object_at_offset (text->model, text->selection_start);
- if (obj_num != -1) {
- e_text_model_activate_nth_object (text->model, obj_num);
- new_pos = text->selection_start;
- break;
- }
-
-
- if (text->selection_end < 1) {
- new_pos = 0;
- break;
- }
-
- p = g_utf8_find_prev_char (text->text, text->text + text->selection_end);
- if (p == text->text) {
- new_pos = 0;
- break;
- }
- p = g_utf8_find_prev_char (text->text, p);
-
- while (p && p > text->text && g_unichar_validate (g_utf8_get_char (p))) {
- unival = g_utf8_get_char (p);
- if (g_unichar_isspace (unival)) {
- p = g_utf8_next_char (p);
- break;
- }
- p = g_utf8_find_prev_char (text->text, p);
- }
-
- if (!p)
- text->selection_start = 0;
- else
- text->selection_start = p - text->text;
-
-
- text->selection_start = e_text_model_validate_position (text->model, text->selection_start);
-
- length = strlen (text->text);
- if (text->selection_end >= length) {
- new_pos = length;
- break;
- }
-
- p = g_utf8_next_char (text->text + text->selection_end);
-
- while (p && *p && g_unichar_validate (g_utf8_get_char (p))) {
- unival = g_utf8_get_char (p);
- if (g_unichar_isspace (unival)) {
- new_pos = p - text->text;
- p = NULL;
- } else
- p = g_utf8_next_char (p);
- }
-
- if (p)
- new_pos = p - text->text;
-
- return new_pos;
-
- case E_TEP_SELECT_ALL:
- text->selection_start = 0;
- new_pos = strlen (text->text);
- break;
-
- case E_TEP_FORWARD_PARAGRAPH:
- case E_TEP_BACKWARD_PARAGRAPH:
-
- case E_TEP_FORWARD_PAGE:
- case E_TEP_BACKWARD_PAGE:
- new_pos = text->selection_end;
- break;
-
- default:
- new_pos = text->selection_end;
- break;
- }
-
- new_pos = e_text_model_validate_position (text->model, new_pos);
-
- return new_pos;
-}
-
-static void
-_delete_selection(EText *text)
-{
- if ( text->selection_start < text->selection_end ) {
- e_text_model_delete(text->model, text->selection_start, text->selection_end - text->selection_start);
-#if 0
- text->selection_end = text->selection_start;
-#endif
- } else {
- e_text_model_delete(text->model, text->selection_end, text->selection_start - text->selection_end);
-#if 0
- text->selection_start = text->selection_end;
-#endif
- }
-}
-
-static void
-_insert(EText *text, char *string, int value)
-{
- if (value > 0) {
- if (!text->allow_newlines) {
- char *i;
- for (i = string; *i; i++) {
- if (*i == '\n') {
- char *new_string = g_malloc (strlen (string) + 1);
- char *j = new_string;
- for (i = string; *i; i++) {
- if (*i != '\n')
- *(j++) = *i;
- }
- *j = 0;
- e_text_model_insert_length(text->model, text->selection_start, new_string, j - new_string);
- g_free (new_string);
- return;
- }
- }
- }
- e_text_model_insert_length(text->model, text->selection_start, string, value);
-
-#if 0
- text->selection_start += value;
- text->selection_end = text->selection_start;
-#endif
- }
-}
-
-static void
-capitalize (EText *text, int start, int end, ETextEventProcessorCaps type)
-{
- gboolean first = TRUE;
- const char *p = text->text + start;
- const char *text_end = text->text + end;
- char *new_text = g_new0 (char, g_utf8_strlen (text->text + start, start - end) * 6);
- char *output = new_text;
-
- while (p && *p && p < text_end && g_unichar_validate (g_utf8_get_char (p))) {
- gunichar unival = g_utf8_get_char (p);
- gunichar newval = unival;
-
- switch (type) {
- case E_TEP_CAPS_UPPER:
- newval = g_unichar_toupper (unival);
- break;
- case E_TEP_CAPS_LOWER:
- newval = g_unichar_tolower (unival);
- break;
- case E_TEP_CAPS_TITLE:
- if (g_unichar_isalpha (unival)) {
- if (first)
- newval = g_unichar_totitle (unival);
- else
- newval = g_unichar_tolower (unival);
- first = FALSE;
- } else {
- first = TRUE;
- }
- break;
- }
- g_unichar_to_utf8 (newval, output);
- output = g_utf8_next_char (output);
-
- p = g_utf8_next_char (p);
- }
- *output = 0;
-
- e_text_model_delete (text->model, start, end - start);
- e_text_model_insert (text->model, start, new_text);
- g_free (new_text);
-}
-
-static void
-e_text_command(ETextEventProcessor *tep, ETextEventProcessorCommand *command, gpointer data)
-{
- EText *text = E_TEXT(data);
- int sel_start, sel_end;
- gboolean scroll = TRUE;
-
- 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_start = e_text_model_validate_position (text->model, text->selection_start); /* paranoia */
- 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);
-
- sel_start = e_text_model_validate_position (text->model, sel_start);
-
- if (sel_start != sel_end) {
- e_text_supply_selection (text, command->time, GDK_SELECTION_PRIMARY,
- (guchar *) 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);
- 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);
- 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,
- (guchar *) text->text + sel_start, sel_end - sel_start);
- }
- if (text->timer) {
- g_timer_reset(text->timer);
- }
- scroll = FALSE;
- 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:
- gtk_signal_emit (GTK_OBJECT (text), e_text_signals[E_TEXT_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);
- scroll = FALSE;
- break;
- case E_TEP_UNGRAB:
- gnome_canvas_item_ungrab (GNOME_CANVAS_ITEM(text), command->time);
- scroll = FALSE;
- break;
- case E_TEP_CAPS:
- if (text->selection_start == text->selection_end) {
- capitalize (text, text->selection_start, next_word (text, text->selection_start), command->value);
- } else {
- int selection_start = MIN (text->selection_start, text->selection_end);
- int selection_end = text->selection_start + text->selection_end - selection_start; /* Slightly faster than MAX */
- capitalize (text, selection_start, selection_end, command->value);
- }
- break;
- case E_TEP_NOP:
- scroll = FALSE;
- break;
- }
-
- if (scroll && !text->button_down) {
- int x;
- int i;
- struct line *lines = text->lines;
- gdouble clip_width;
- if ( !lines )
- return;
-
- for (lines = text->lines, i = 0; i < text->num_lines ; i++, lines ++) {
- if ((lines->text - text->text) > text->selection_end) {
- break;
- }
- }
- lines --;
- i --;
- x = text_width_with_objects (text->model,
- text->font, text->style,
- lines->text,
- text->selection_end - (lines->text - text->text));
-
-
- if (x < text->xofs_edit) {
- text->xofs_edit = x;
- }
-
- clip_width = text->clip_width;
- if (clip_width >= 0 && text->draw_borders) {
- clip_width -= 6;
- if (clip_width < 0)
- clip_width = 0;
- }
-
- if (2 + x - clip_width > text->xofs_edit) {
- text->xofs_edit = 2 + x - clip_width;
- }
-
- if (e_font_height (text->font) * i < text->yofs_edit)
- text->yofs_edit = e_font_height (text->font) * i;
-
- if (e_font_height (text->font) * (i + 1) - (text->clip_height != -1 ? text->clip_height : text->height) > text->yofs_edit)
- text->yofs_edit = e_font_height (text->font) * (i + 1) - (text->clip_height != -1 ? text->clip_height : text->height);
- }
-
- text->needs_redraw = 1;
- 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 {
- static const GtkTargetEntry targets[] = {
- { "UTF8_STRING", 0, TARGET_UTF8_STRING },
- { "UTF-8", 0, TARGET_UTF8 },
- { "COMPOUND_TEXT", 0, TARGET_COMPOUND_TEXT },
- { "STRING", 0, TARGET_STRING },
- { "TEXT", 0, TARGET_TEXT }
- };
- static const gint n_targets = sizeof(targets) / sizeof(targets[0]);
-
- invisible = gtk_invisible_new();
- text->invisible = invisible;
-
- gtk_selection_add_targets (invisible,
- GDK_SELECTION_PRIMARY,
- targets, n_targets);
- gtk_selection_add_targets (invisible,
- clipboard_atom,
- targets, n_targets);
-
- 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;
- text->needs_redraw = 1;
- 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)
-{
- char *selection_string;
- int selection_length;
- if (selection_data->selection == GDK_SELECTION_PRIMARY) {
- selection_string = text->primary_selection;
- selection_length = text->primary_length;
- } else /* CLIPBOARD */ {
- selection_string = text->clipboard_selection;
- selection_length = text->clipboard_length;
- }
-
- if (selection_string != NULL) {
- if (info == TARGET_UTF8_STRING) {
- gtk_selection_data_set (selection_data,
- gdk_atom_intern ("UTF8_STRING", FALSE), 8,
- (const guchar *) selection_string,
- selection_length);
- } else if (info == TARGET_UTF8) {
- gtk_selection_data_set (selection_data,
- gdk_atom_intern ("UTF-8", FALSE), 8,
- (const guchar *) selection_string,
- selection_length);
- } else if (info == TARGET_STRING || info == TARGET_TEXT || info == TARGET_COMPOUND_TEXT) {
- gchar *localized_string;
-
- localized_string = e_utf8_to_gtk_string (GTK_WIDGET (GNOME_CANVAS_ITEM(text)->canvas),
- selection_string);
-
- if (info == TARGET_STRING) {
- gtk_selection_data_set (selection_data,
- GDK_SELECTION_TYPE_STRING, 8,
- (const guchar *) localized_string,
- strlen (localized_string));
- } else {
- guchar *text;
- GdkAtom encoding;
- gint format;
- gint new_length;
-
- gdk_string_to_compound_text (localized_string,
- &encoding, &format,
- &text, &new_length);
-
- gtk_selection_data_set (selection_data,
- encoding, format,
- text, new_length);
- gdk_free_compound_text (text);
- }
- g_free (localized_string);
- }
- }
-}
-
-typedef struct {
- guint32 time;
- GdkAtom selection;
-} SelectionAndTime;
-
-static const char *formats[] = {"UTF8_STRING", "UTF-8", "STRING"};
-#define E_STRING_ATOM 2
-static const int format_count = sizeof (formats) / sizeof (formats[0]);
-static GdkAtom atoms[sizeof (formats) / sizeof (formats[0])];
-static int initialized = FALSE;
-
-static inline void
-init_atoms (void)
-{
- int type;
- if (!initialized) {
- for (type = 0; type < format_count; type++)
- atoms[type] = gdk_atom_intern (formats[type], FALSE);
- initialized = TRUE;
- }
-}
-
-static void
-e_text_request_paste (EText *text)
-{
- GdkAtom format_atom;
- GtkWidget *invisible;
- int type = text->last_type_request;
-
- init_atoms ();
-
- format_atom = GDK_NONE;
-
- while (format_atom == GDK_NONE) {
- type ++;
-
- if (type >= format_count) {
- if (text->queued_requests) {
- guint32 *new_time = text->queued_requests->data;
- text->queued_requests = g_list_remove_link (text->queued_requests, text->queued_requests);
- text->last_time_request = *new_time;
- g_free (new_time);
-
- type = -1;
- } else {
- text->last_type_request = -1;
- text->last_time_request = 0;
- return;
- }
- }
-
- format_atom = atoms [type];
- }
-
- /* And request the format target for the required selection */
- invisible = e_text_get_invisible(text);
- gtk_selection_convert(invisible,
- text->last_selection_request,
- format_atom,
- text->last_time_request);
-
- text->last_type_request = type;
- return;
-}
-
-static void
-_selection_received (GtkInvisible *invisible,
- GtkSelectionData *selection_data,
- guint time,
- EText *text)
-{
- init_atoms ();
- if (selection_data->length < 0) {
- e_text_request_paste (text);
- return;
- } else if (selection_data->type == atoms[E_STRING_ATOM]) {
- ETextEventProcessorCommand command;
- char *string;
-
- string = e_utf8_from_gtk_string_sized (GTK_WIDGET (GNOME_CANVAS_ITEM(text)->canvas),
- selection_data->data,
- selection_data->length);
- command.action = E_TEP_INSERT;
- command.position = E_TEP_SELECTION;
- command.string = string;
- command.value = strlen (string);
- command.time = time;
- e_text_command(text->tep, &command, text);
- g_free (string);
- } 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);
- }
- text->last_type_request = -1;
- if (text->queued_requests) {
- SelectionAndTime *new_request = text->queued_requests->data;
- text->queued_requests = g_list_remove_link (text->queued_requests, text->queued_requests);
- text->last_time_request = new_request->time;
- text->last_selection_request = new_request->selection;
- g_free (new_request);
- e_text_request_paste (text);
- }
-}
-
-
-
-static void
-e_text_get_selection(EText *text, GdkAtom selection, guint32 time)
-{
- if (text->last_type_request == -1) {
- text->last_time_request = time;
- text->last_selection_request = selection;
- e_text_request_paste (text);
- } else {
- SelectionAndTime *new_request = g_new (SelectionAndTime, 1);
- new_request->time = time;
- new_request->selection = selection;
- /* FIXME: Queue the selection request type as well. */
- text->queued_requests = g_list_append (text->queued_requests, new_request);
- }
-}
-
-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 ) {
- g_free (text->primary_selection);
- text->primary_selection = g_strndup(data, length);
- text->primary_length = length;
- } else if (selection == clipboard_atom) {
- 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;
-}
-
-#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
-
-
-#if 0
-/* 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);
-}
-#endif
diff --git a/widgets/text/e-text.h b/widgets/text/e-text.h
deleted file mode 100644
index 5c575e88a9..0000000000
--- a/widgets/text/e-text.h
+++ /dev/null
@@ -1,273 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-text.h - Text item for evolution.
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- * Jon Trowbridge <trow@ximian.com>
- *
- * 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 <federico@nuclecu.unam.mx>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * 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.
- */
-
-#ifndef E_TEXT_H
-#define E_TEXT_H
-
-#include <gtk/gtkobject.h>
-#include <gtk/gtkpacker.h>
-
-#include <gal/widgets/e-font.h>
-#include <gal/util/e-text-event-processor.h>
-#include <gal/e-text/e-text-model.h>
-#include <gal/widgets/e-canvas.h>
-#include <libgnome/gnome-defs.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
- * font string W X logical font descriptor
- * fontset string W X logical fontset descriptor
- * font_gdk GdkFont* RW Pointer to a GdkFont
- * bold boolean RW Bold?
- * 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?
- * fill_clip_rect boolean RW Whether the text item represents itself as being the size of the 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
- * width double RW A synonym for clip_width
- * height double R A synonym for text_height
- *
- * 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.
- * break_characters string RW List of characters to optionally break on.
- * max_lines int RW Number of lines possible when doing line wrap.
- * draw_borders boolean RW Whether to draw borders.
- * draw_background boolean RW Whether to draw the background.
- * draw_button boolean RW This makes EText handle being the child of a button properly and highlighting as it should.
- */
-
-#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;
-
-#if 0
-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];
-};
-#endif
-
-struct _EText {
- GnomeCanvasItem item;
-
- ETextModel *model;
- gint model_changed_signal_id;
- gint model_repos_signal_id;
-
- const gchar *text; /* Text to display --- from the ETextModel */
- gpointer lines; /* Text split into lines (private field) */
- int num_lines; /* Number of lines of text */
-
- gchar *revert; /* Text to revert to */
-
-#if 0
- GdkFont *font; /* Font for text */
-#else
- EFont *font;
-#endif
- 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 */
-
- GdkColor color; /* 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 width; /* Rendered text width in pixels */
- int height; /* Rendered text height in pixels */
-
- /* Antialiased specific stuff follows */
-#if 0
- ETextSuckFont *suckfont; /* Sucked font */
-#endif
- 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. */
-
- int xofs_edit; /* Offset because of editing */
- int yofs_edit; /* Offset because of editing */
-
- /* This needs to be reworked a bit once we get line wrapping. */
- int selection_start; /* Start of selection IN BYTES */
- int selection_end; /* End of selection IN BYTES */
- 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 */
- gint tep_command_id;
-
- 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 clip : 1; /* Use clip rectangle? */
- guint fill_clip_rectangle : 1; /* Fill the clipping rectangle. */
-
- guint pointer_in : 1; /* Is the pointer currently over us? */
- guint default_cursor_shown : 1; /* Is the default cursor currently shown? */
- guint draw_borders : 1; /* Draw borders? */
- guint draw_background : 1; /* Draw background? */
- guint draw_button : 1; /* Draw button? */
-
- guint line_wrap : 1; /* Do line wrap */
-
- guint needs_redraw : 1; /* Needs redraw */
- guint needs_recalc_bounds : 1; /* Need recalc_bounds */
- guint needs_calc_height : 1; /* Need calc_height */
- guint needs_calc_line_widths : 1; /* Needs calc_line_widths */
- guint needs_split_into_lines : 1; /* Needs split_into_lines */
-
- guint bold : 1;
- guint strikeout : 1;
-
- guint tooltip_owner : 1;
- guint allow_newlines : 1;
-
- guint use_ellipsis : 1; /* Whether to use the ellipsis. */
-
- guint editable : 1; /* Item is editable */
- guint editing : 1; /* Item is currently being edited */
-
- EFontStyle style;
-
- gchar *break_characters; /* Characters to optionally break after */
-
- 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 */
- gint tooltip_count; /* GDK_ENTER_NOTIFY count. */
-
- gint dbl_timeout; /* Double click timeout */
- gint tpl_timeout; /* Triple click timeout */
-
- gint last_type_request; /* Last selection type requested. */
- guint32 last_time_request; /* The time of the last selection request. */
- guint32 last_selection_request; /* The time of the last selection request. */
- GList *queued_requests; /* Queued selection requests. */
-};
-
-struct _ETextClass {
- GnomeCanvasItemClass parent_class;
-
- void (* changed) (EText *text);
- void (* activate) (EText *text);
- void (* keypress) (EText *text, guint keyval, guint state);
- void (* popup) (EText *text, GdkEventButton *ev, gint pos);
-};
-
-
-/* Standard Gtk function */
-GtkType e_text_get_type (void);
-void e_text_cancel_editing (EText *text);
-void e_text_stop_editing (EText *text);
-
-END_GNOME_DECLS
-
-#endif