aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornobody <nobody@localhost>2003-09-26 23:53:23 +0800
committernobody <nobody@localhost>2003-09-26 23:53:23 +0800
commit911c3b9d4fe2f40bc34029ef798ed78fdf0fcb42 (patch)
treee3efa4958cf2cf6bfe50e2a15c729b9014efa5db
parent99c61843f0d1da7f9b3b73b99bab0e918ce99e5b (diff)
downloadgsoc2013-evolution-new-calendar-branch-merge-end.tar
gsoc2013-evolution-new-calendar-branch-merge-end.tar.gz
gsoc2013-evolution-new-calendar-branch-merge-end.tar.bz2
gsoc2013-evolution-new-calendar-branch-merge-end.tar.lz
gsoc2013-evolution-new-calendar-branch-merge-end.tar.xz
gsoc2013-evolution-new-calendar-branch-merge-end.tar.zst
gsoc2013-evolution-new-calendar-branch-merge-end.zip
This commit was manufactured by cvs2svn to create tagnew-calendar-branch-merge-end
'new-calendar-branch-merge-end'. svn path=/tags/new-calendar-branch-merge-end/; revision=22718
-rw-r--r--a11y/.cvsignore2
-rw-r--r--a11y/ChangeLog36
-rw-r--r--a11y/Makefile.am5
-rw-r--r--a11y/calendar/.cvsignore6
-rw-r--r--a11y/calendar/Makefile.am82
-rw-r--r--a11y/calendar/ea-cal-view-event.c460
-rw-r--r--a11y/calendar/ea-cal-view-event.h64
-rw-r--r--a11y/calendar/ea-cal-view.c271
-rw-r--r--a11y/calendar/ea-cal-view.h64
-rw-r--r--a11y/calendar/ea-calendar-helpers.c148
-rw-r--r--a11y/calendar/ea-calendar-helpers.h43
-rw-r--r--a11y/calendar/ea-calendar.c135
-rw-r--r--a11y/calendar/ea-calendar.h37
-rw-r--r--a11y/calendar/ea-day-view.c245
-rw-r--r--a11y/calendar/ea-day-view.h64
-rw-r--r--a11y/calendar/ea-gnome-calendar.c248
-rw-r--r--a11y/calendar/ea-gnome-calendar.h65
-rw-r--r--a11y/calendar/ea-week-view.c235
-rw-r--r--a11y/calendar/ea-week-view.h65
-rw-r--r--a11y/e-table/.cvsignore4
-rw-r--r--a11y/e-table/gal-a11y-e-cell-registry.c132
-rw-r--r--a11y/e-table/gal-a11y-e-cell-registry.h58
-rw-r--r--a11y/e-table/gal-a11y-e-cell-text.c486
-rw-r--r--a11y/e-table/gal-a11y-e-cell-text.h48
-rw-r--r--a11y/e-table/gal-a11y-e-cell.c239
-rw-r--r--a11y/e-table/gal-a11y-e-cell.h61
-rw-r--r--a11y/e-table/gal-a11y-e-table-factory.c83
-rw-r--r--a11y/e-table/gal-a11y-e-table-factory.h36
-rw-r--r--a11y/e-table/gal-a11y-e-table-item.c456
-rw-r--r--a11y/e-table/gal-a11y-e-table-item.h43
-rw-r--r--a11y/e-table/gal-a11y-e-table.c156
-rw-r--r--a11y/e-table/gal-a11y-e-table.h43
-rw-r--r--a11y/e-text/.cvsignore4
-rw-r--r--a11y/e-text/gal-a11y-e-text-factory.c88
-rw-r--r--a11y/e-text/gal-a11y-e-text-factory.h36
-rw-r--r--a11y/e-text/gal-a11y-e-text.c648
-rw-r--r--a11y/e-text/gal-a11y-e-text.h40
-rw-r--r--a11y/ea-factory.h113
-rw-r--r--a11y/gal-a11y-factory.h94
-rw-r--r--a11y/gal-a11y-util.c31
-rw-r--r--a11y/gal-a11y-util.h21
-rw-r--r--a11y/widgets/.cvsignore2
-rw-r--r--a11y/widgets/Makefile.am23
-rw-r--r--a11y/widgets/ea-calendar-item.c165
-rw-r--r--a11y/widgets/ea-calendar-item.h65
-rw-r--r--a11y/widgets/ea-widgets.c35
-rw-r--r--a11y/widgets/ea-widgets.h34
-rw-r--r--addressbook/ChangeLog72
-rw-r--r--addressbook/backend/pas/pas-backend-file.c27
-rw-r--r--calendar/ChangeLog1643
-rw-r--r--calendar/cal-util/cal-util.c34
-rw-r--r--calendar/conduits/calendar/calendar-conduit.c104
-rw-r--r--calendar/conduits/todo/todo-conduit.c82
-rw-r--r--calendar/gui/Makefile.am20
-rw-r--r--calendar/gui/alarm-notify/alarm-notify.c3
-rw-r--r--calendar/gui/alarm-notify/alarm-queue.c284
-rw-r--r--calendar/gui/calendar-commands.c34
-rw-r--r--calendar/gui/calendar-offline-handler.c10
-rw-r--r--calendar/gui/comp-editor-factory.c40
-rw-r--r--calendar/gui/comp-util.c37
-rw-r--r--calendar/gui/dialogs/alarm-page.c16
-rw-r--r--calendar/gui/dialogs/comp-editor.c38
-rw-r--r--calendar/gui/dialogs/delete-error.c25
-rw-r--r--calendar/gui/dialogs/delete-error.h2
-rw-r--r--calendar/gui/dialogs/event-editor.c5
-rw-r--r--calendar/gui/dialogs/event-page.c23
-rw-r--r--calendar/gui/dialogs/meeting-page.c8
-rw-r--r--calendar/gui/dialogs/recurrence-page.c6
-rw-r--r--calendar/gui/dialogs/schedule-page.c23
-rw-r--r--calendar/gui/dialogs/task-editor.c5
-rw-r--r--calendar/gui/dialogs/task-page.c17
-rw-r--r--calendar/gui/e-alarm-list.c4
-rw-r--r--calendar/gui/e-cal-model-calendar.c30
-rw-r--r--calendar/gui/e-cal-model-tasks.c27
-rw-r--r--calendar/gui/e-cal-model.c207
-rw-r--r--calendar/gui/e-cal-view.c255
-rw-r--r--calendar/gui/e-cal-view.h2
-rw-r--r--calendar/gui/e-calendar-table.c66
-rw-r--r--calendar/gui/e-calendar-view.c255
-rw-r--r--calendar/gui/e-calendar-view.h2
-rw-r--r--calendar/gui/e-date-time-list.c4
-rw-r--r--calendar/gui/e-day-view.c506
-rw-r--r--calendar/gui/e-day-view.h6
-rw-r--r--calendar/gui/e-itip-control.c196
-rw-r--r--calendar/gui/e-meeting-model.c17
-rw-r--r--calendar/gui/e-tasks.c83
-rw-r--r--calendar/gui/e-week-view.c476
-rw-r--r--calendar/gui/e-week-view.h11
-rw-r--r--calendar/gui/gnome-cal.c353
-rw-r--r--calendar/gui/gnome-cal.h9
-rw-r--r--calendar/gui/itip-utils.c46
-rw-r--r--calendar/gui/print.c29
-rw-r--r--calendar/gui/tag-calendar.c3
-rw-r--r--calendar/gui/tasks-control.c4
-rw-r--r--calendar/idl/evolution-calendar.idl273
-rw-r--r--calendar/importers/icalendar-importer.c66
-rw-r--r--data/evolution.desktop.in4
-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/ChangeLog56
-rw-r--r--e-util/Makefile.am19
-rw-r--r--e-util/e-bit-array.c429
-rw-r--r--e-util/e-bit-array.h104
-rw-r--r--e-util/e-dbhash.c227
-rw-r--r--e-util/e-dbhash.h45
-rw-r--r--e-util/e-i18n.h74
-rw-r--r--e-util/e-iconv.c614
-rw-r--r--e-util/e-iconv.h49
-rw-r--r--e-util/e-marshal.list51
-rw-r--r--e-util/e-sorter-array.c259
-rw-r--r--e-util/e-sorter-array.h77
-rw-r--r--e-util/e-sorter.c153
-rw-r--r--e-util/e-sorter.h82
-rw-r--r--e-util/e-text-event-processor-emacs-like.c489
-rw-r--r--e-util/e-text-event-processor-emacs-like.h70
-rw-r--r--e-util/e-text-event-processor-types.h132
-rw-r--r--e-util/e-text-event-processor.c148
-rw-r--r--e-util/e-text-event-processor.h77
-rw-r--r--e-util/e-util.c1230
-rw-r--r--e-util/e-util.h231
-rw-r--r--e-util/e-xml-utils.c502
-rw-r--r--e-util/e-xml-utils.h101
-rw-r--r--help/devel/executive-summary/evolution-services.hierarchy7
-rw-r--r--help/devel/importer/evolution-shell-importer.hierarchy7
-rw-r--r--libical/ChangeLog1197
-rw-r--r--libical/design-data/properties.csv56
-rw-r--r--libical/examples/.cvsignore7
-rw-r--r--libical/examples/Makefile.am11
-rw-r--r--libical/scripts/readvaluesfile.pl3
-rw-r--r--libical/src/.cvsignore5
-rw-r--r--libical/src/Makefile.am16
-rw-r--r--libical/src/libical/icalcomponent.c1501
-rw-r--r--libical/src/libical/icalderivedparameter.c.in44
-rw-r--r--libical/src/libical/icalderivedparameter.h.in5
-rw-r--r--libical/src/libical/icalderivedproperty.c.in83
-rw-r--r--libical/src/libical/icalderivedproperty.h.in7
-rw-r--r--libical/src/libical/icallangbind.h5
-rw-r--r--libical/src/libical/icalmime.c18
-rw-r--r--libical/src/libical/icalperiod.h6
-rw-r--r--libical/src/libical/icalrecur.h72
-rw-r--r--libical/src/libical/icalrestriction.c.in30
-rw-r--r--libical/src/libical/sspm.c22
-rw-r--r--libical/src/libical/vsnprintf.c11
-rw-r--r--libical/src/libicalss/.cvsignore6
-rw-r--r--libical/src/libicalss/Makefile.am123
-rw-r--r--libical/src/libicalss/icalcalendar.c52
-rw-r--r--libical/src/libicalss/icalcalendar.h2
-rw-r--r--libical/src/libicalss/icalcluster.c245
-rw-r--r--libical/src/libicalss/icalcluster.h61
-rw-r--r--libical/src/libicalss/icaldirset.c518
-rw-r--r--libical/src/libicalss/icalsslexer.c1746
-rw-r--r--libical/src/libicalss/icalssyacc.c1397
-rw-r--r--libical/src/libicalvcal/.cvsignore15
-rw-r--r--libical/src/libicalvcal/Makefile.am15
-rw-r--r--libical/src/libicalvcal/icalvcal.c67
-rw-r--r--libical/src/libicalvcal/icalvcal.h2
-rw-r--r--libical/src/libicalvcal/vcc.y9
-rw-r--r--libical/src/libicalvcal/vobject.c12
-rw-r--r--libical/src/python/.cvsignore9
-rw-r--r--libical/src/test/process.c115
-rw-r--r--libical/src/test/recur.c151
-rw-r--r--libical/src/test/testclassify.c170
-rw-r--r--libical/src/test/testmime.c5
-rw-r--r--libical/test-data/calendar.ics20
-rw-r--r--libical/test-data/incoming.ics150
-rw-r--r--libical/test-data/recur.txt330
-rw-r--r--libical/test-data/simple-mime.txt5
-rw-r--r--ui/evolution-addressbook.h25
-rw-r--r--ui/evolution-message-composer.h53
-rw-r--r--widgets/menus/gal-define-views-dialog.c351
-rw-r--r--widgets/menus/gal-define-views-dialog.h78
-rw-r--r--widgets/menus/gal-define-views-model.c322
-rw-r--r--widgets/menus/gal-define-views-model.h72
-rw-r--r--widgets/menus/gal-define-views.glade232
-rw-r--r--widgets/menus/gal-view-collection.c823
-rw-r--r--widgets/menus/gal-view-collection.h151
-rw-r--r--widgets/menus/gal-view-etable.c305
-rw-r--r--widgets/menus/gal-view-etable.h78
-rw-r--r--widgets/menus/gal-view-factory-etable.c120
-rw-r--r--widgets/menus/gal-view-factory-etable.h62
-rw-r--r--widgets/menus/gal-view-factory.c107
-rw-r--r--widgets/menus/gal-view-factory.h79
-rw-r--r--widgets/menus/gal-view-instance-save-as-dialog.c299
-rw-r--r--widgets/menus/gal-view-instance-save-as-dialog.glade243
-rw-r--r--widgets/menus/gal-view-instance-save-as-dialog.h89
-rw-r--r--widgets/menus/gal-view-instance.c600
-rw-r--r--widgets/menus/gal-view-instance.h116
-rw-r--r--widgets/menus/gal-view-new-dialog.c284
-rw-r--r--widgets/menus/gal-view-new-dialog.glade175
-rw-r--r--widgets/menus/gal-view-new-dialog.h86
-rw-r--r--widgets/menus/gal-view.c206
-rw-r--r--widgets/menus/gal-view.h98
-rw-r--r--widgets/misc/e-canvas-background.c496
-rw-r--r--widgets/misc/e-canvas-background.h71
-rw-r--r--widgets/misc/e-canvas-utils.c171
-rw-r--r--widgets/misc/e-canvas-utils.h55
-rw-r--r--widgets/misc/e-canvas-vbox.c381
-rw-r--r--widgets/misc/e-canvas-vbox.h93
-rw-r--r--widgets/misc/e-canvas.c1096
-rw-r--r--widgets/misc/e-canvas.h157
-rw-r--r--widgets/misc/e-colors.c103
-rw-r--r--widgets/misc/e-colors.h44
-rw-r--r--widgets/misc/e-cursors.c156
-rw-r--r--widgets/misc/e-cursors.h68
-rw-r--r--widgets/misc/e-gui-utils.c238
-rw-r--r--widgets/misc/e-gui-utils.h58
-rw-r--r--widgets/misc/e-hsv-utils.c178
-rw-r--r--widgets/misc/e-hsv-utils.h52
-rw-r--r--widgets/misc/e-popup-menu.c240
-rw-r--r--widgets/misc/e-popup-menu.h142
-rw-r--r--widgets/misc/e-printable.c209
-rw-r--r--widgets/misc/e-printable.h90
-rw-r--r--widgets/misc/e-reflow-model.c355
-rw-r--r--widgets/misc/e-reflow-model.h112
-rw-r--r--widgets/misc/e-reflow.c1506
-rw-r--r--widgets/misc/e-reflow.h146
-rw-r--r--widgets/misc/e-selection-model-array.c557
-rw-r--r--widgets/misc/e-selection-model-array.h96
-rw-r--r--widgets/misc/e-selection-model-simple.c115
-rw-r--r--widgets/misc/e-selection-model-simple.h70
-rw-r--r--widgets/misc/e-selection-model.c689
-rw-r--r--widgets/misc/e-selection-model.h170
-rw-r--r--widgets/misc/e-unicode.c2055
-rw-r--r--widgets/misc/e-unicode.h115
-rw-r--r--widgets/misc/gal-categories.glade166
-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.c76
-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.h50
-rw-r--r--widgets/table/e-cell-combo.c679
-rw-r--r--widgets/table/e-cell-combo.h63
-rw-r--r--widgets/table/e-cell-date.c166
-rw-r--r--widgets/table/e-cell-date.h49
-rw-r--r--widgets/table/e-cell-float.c93
-rw-r--r--widgets/table/e-cell-float.h53
-rw-r--r--widgets/table/e-cell-number.c85
-rw-r--r--widgets/table/e-cell-number.h49
-rw-r--r--widgets/table/e-cell-pixbuf.c417
-rw-r--r--widgets/table/e-cell-pixbuf.h53
-rw-r--r--widgets/table/e-cell-popup.c515
-rw-r--r--widgets/table/e-cell-popup.h101
-rw-r--r--widgets/table/e-cell-progress.c456
-rw-r--r--widgets/table/e-cell-progress.h74
-rw-r--r--widgets/table/e-cell-size.c110
-rw-r--r--widgets/table/e-cell-size.h49
-rw-r--r--widgets/table/e-cell-spin-button.c670
-rw-r--r--widgets/table/e-cell-spin-button.h103
-rw-r--r--widgets/table/e-cell-text.c2331
-rw-r--r--widgets/table/e-cell-text.h108
-rw-r--r--widgets/table/e-cell-toggle.c484
-rw-r--r--widgets/table/e-cell-toggle.h62
-rw-r--r--widgets/table/e-cell-tree.c900
-rw-r--r--widgets/table/e-cell-tree.h75
-rw-r--r--widgets/table/e-cell-vbox.c489
-rw-r--r--widgets/table/e-cell-vbox.h65
-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.c562
-rw-r--r--widgets/table/e-table-click-to-add.h77
-rw-r--r--widgets/table/e-table-col-dnd.h39
-rw-r--r--widgets/table/e-table-col.c236
-rw-r--r--widgets/table/e-table-col.h101
-rw-r--r--widgets/table/e-table-column-specification.c150
-rw-r--r--widgets/table/e-table-column-specification.h73
-rw-r--r--widgets/table/e-table-column.c291
-rw-r--r--widgets/table/e-table-config-field.c300
-rw-r--r--widgets/table/e-table-config-field.h69
-rw-r--r--widgets/table/e-table-config-no-group.glade2039
-rw-r--r--widgets/table/e-table-config.c1200
-rw-r--r--widgets/table/e-table-config.glade2107
-rw-r--r--widgets/table/e-table-config.h115
-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.c349
-rw-r--r--widgets/table/e-table-extras.c292
-rw-r--r--widgets/table/e-table-extras.h82
-rw-r--r--widgets/table/e-table-field-chooser-dialog.c224
-rw-r--r--widgets/table/e-table-field-chooser-dialog.h79
-rw-r--r--widgets/table/e-table-field-chooser-item.c711
-rw-r--r--widgets/table/e-table-field-chooser-item.h75
-rw-r--r--widgets/table/e-table-field-chooser.c282
-rw-r--r--widgets/table/e-table-field-chooser.glade123
-rw-r--r--widgets/table/e-table-field-chooser.h79
-rw-r--r--widgets/table/e-table-group-container.c1512
-rw-r--r--widgets/table/e-table-group-container.h98
-rw-r--r--widgets/table/e-table-group-leaf.c686
-rw-r--r--widgets/table/e-table-group-leaf.h90
-rw-r--r--widgets/table/e-table-group.c712
-rw-r--r--widgets/table/e-table-group.h178
-rw-r--r--widgets/table/e-table-header-item.c1837
-rw-r--r--widgets/table/e-table-header-item.h114
-rw-r--r--widgets/table/e-table-header-utils.c481
-rw-r--r--widgets/table/e-table-header-utils.h55
-rw-r--r--widgets/table/e-table-header.c952
-rw-r--r--widgets/table/e-table-header.h120
-rw-r--r--widgets/table/e-table-item.c3674
-rw-r--r--widgets/table/e-table-item.h229
-rw-r--r--widgets/table/e-table-memory-callbacks.c208
-rw-r--r--widgets/table/e-table-memory-callbacks.h91
-rw-r--r--widgets/table/e-table-memory-store.c583
-rw-r--r--widgets/table/e-table-memory-store.h138
-rw-r--r--widgets/table/e-table-memory.c277
-rw-r--r--widgets/table/e-table-memory.h76
-rw-r--r--widgets/table/e-table-model.c579
-rw-r--r--widgets/table/e-table-model.h170
-rw-r--r--widgets/table/e-table-one.c243
-rw-r--r--widgets/table/e-table-one.h57
-rw-r--r--widgets/table/e-table-scrolled.c229
-rw-r--r--widgets/table/e-table-scrolled.h76
-rw-r--r--widgets/table/e-table-search.c223
-rw-r--r--widgets/table/e-table-search.h71
-rw-r--r--widgets/table/e-table-selection-model.c347
-rw-r--r--widgets/table/e-table-selection-model.h76
-rw-r--r--widgets/table/e-table-simple.c289
-rw-r--r--widgets/table/e-table-simple.h122
-rw-r--r--widgets/table/e-table-size-test.c307
-rw-r--r--widgets/table/e-table-sort-info.c481
-rw-r--r--widgets/table/e-table-sort-info.h107
-rw-r--r--widgets/table/e-table-sorted-variable.c228
-rw-r--r--widgets/table/e-table-sorted-variable.h65
-rw-r--r--widgets/table/e-table-sorted.c310
-rw-r--r--widgets/table/e-table-sorted.h65
-rw-r--r--widgets/table/e-table-sorter.c462
-rw-r--r--widgets/table/e-table-sorter.h74
-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.c432
-rw-r--r--widgets/table/e-table-specification.h89
-rw-r--r--widgets/table/e-table-state.c299
-rw-r--r--widgets/table/e-table-state.h74
-rw-r--r--widgets/table/e-table-subset-variable.c250
-rw-r--r--widgets/table/e-table-subset-variable.h82
-rw-r--r--widgets/table/e-table-subset.c482
-rw-r--r--widgets/table/e-table-subset.h89
-rw-r--r--widgets/table/e-table-tooltip.h44
-rw-r--r--widgets/table/e-table-tree.h48
-rw-r--r--widgets/table/e-table-utils.c191
-rw-r--r--widgets/table/e-table-utils.h49
-rw-r--r--widgets/table/e-table-without.c392
-rw-r--r--widgets/table/e-table-without.h91
-rw-r--r--widgets/table/e-table.c3272
-rw-r--r--widgets/table/e-table.diabin4514 -> 0 bytes
-rw-r--r--widgets/table/e-table.h358
-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.c717
-rw-r--r--widgets/table/e-tree-memory.h101
-rw-r--r--widgets/table/e-tree-model.c1098
-rw-r--r--widgets/table/e-tree-model.h227
-rw-r--r--widgets/table/e-tree-scrolled.c228
-rw-r--r--widgets/table/e-tree-scrolled.h75
-rw-r--r--widgets/table/e-tree-selection-model.c802
-rw-r--r--widgets/table/e-tree-selection-model.h77
-rw-r--r--widgets/table/e-tree-simple.c208
-rw-r--r--widgets/table/e-tree-simple.h85
-rw-r--r--widgets/table/e-tree-sorted-variable.c477
-rw-r--r--widgets/table/e-tree-sorted-variable.h85
-rw-r--r--widgets/table/e-tree-sorted.c1390
-rw-r--r--widgets/table/e-tree-sorted.h86
-rw-r--r--widgets/table/e-tree-table-adapter.c1174
-rw-r--r--widgets/table/e-tree-table-adapter.h95
-rw-r--r--widgets/table/e-tree.c3314
-rw-r--r--widgets/table/e-tree.h310
-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.c221
-rw-r--r--widgets/table/test-cols.c265
-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-callbacks.c98
-rw-r--r--widgets/text/e-completion-callbacks.h68
-rw-r--r--widgets/text/e-completion-match.c184
-rw-r--r--widgets/text/e-completion-match.h67
-rw-r--r--widgets/text/e-completion-view.c859
-rw-r--r--widgets/text/e-completion-view.h98
-rw-r--r--widgets/text/e-completion.c339
-rw-r--r--widgets/text/e-completion.h91
-rw-r--r--widgets/text/e-entry-test.c83
-rw-r--r--widgets/text/e-entry.c1399
-rw-r--r--widgets/text/e-entry.h87
-rw-r--r--widgets/text/e-table-text-model.c234
-rw-r--r--widgets/text/e-table-text-model.h64
-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.c91
-rw-r--r--widgets/text/e-text-model-uri.c344
-rw-r--r--widgets/text/e-text-model-uri.h56
-rw-r--r--widgets/text/e-text-model.c601
-rw-r--r--widgets/text/e-text-model.h113
-rw-r--r--widgets/text/e-text-test.c168
-rw-r--r--widgets/text/e-text.c3757
-rw-r--r--widgets/text/e-text.h243
-rw-r--r--wombat/ChangeLog9
-rw-r--r--wombat/GNOME_Evolution_WombatLDAP.server.in.in3
-rw-r--r--wombat/wombat.c10
415 files changed, 4734 insertions, 99411 deletions
diff --git a/a11y/.cvsignore b/a11y/.cvsignore
deleted file mode 100644
index 282522db03..0000000000
--- a/a11y/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-Makefile
-Makefile.in
diff --git a/a11y/ChangeLog b/a11y/ChangeLog
deleted file mode 100644
index 5e433f5314..0000000000
--- a/a11y/ChangeLog
+++ /dev/null
@@ -1,36 +0,0 @@
-2003-08-27 Bolian Yin <bolian.yin@sun.com>
-
- * Makefile.am: add widgets directory; move calendar idl stuff to calendar directory; stop make a single shared lib for whole a11y stuff.
- * ea-factory.h: make factory macros available to GOBJECT
- * calendar/Makefile.am: add calendar idl stuff
- * calendar/ea-cal-view-event.c: add atkcomponent interface.
- * calendar/ea-gnome-calendar.c (ea_gcal_switch_view_cb): add details for "children_changed".
- * new widgets directory for widgets a11y stuff, new files are:
- widgets/Makefile.am, widgets/ea-calendar-item.c, widgets/ea-calendar-item.h, widgets/ea-widgets.c, widgets/ea-widgets.h
-
-2003-08-20 Rodrigo Moya <rodrigo@ximian.com>
-
- * calendar/ea-cal-view-event.c (ea_cal_view_event_get_name):
- adapted to changes in ECalViewEvent.
-
-2003-08-20 Bolian Yin <bolian.yin@sun.com>
- setup the a11y directory for evolution accessibility work
- New files are:
- ChangeLog
- ea-factory.h
- Makefile.am
- calendar/ea-calendar.c
- calendar/ea-calendar.h
- calendar/ea-calendar-helpers.c
- calendar/ea-calendar-helpers.h
- calendar/ea-cal-view.c
- calendar/ea-cal-view.h
- calendar/ea-cal-view-event.c
- calendar/ea-cal-view-event.h
- calendar/ea-day-view.c
- calendar/ea-day-view.h
- calendar/ea-week-view.c
- calendar/ea-week-view.h
- calendar/ea-gnome-calendar.c
- calendar/ea-gnome-calendar.h
- calendar/Makefile.am
diff --git a/a11y/Makefile.am b/a11y/Makefile.am
deleted file mode 100644
index 796eeba234..0000000000
--- a/a11y/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-
-SUBDIRS = calendar widgets
-
-
-EXTRA_DIST = ea-factory.h
diff --git a/a11y/calendar/.cvsignore b/a11y/calendar/.cvsignore
deleted file mode 100644
index 0e1e389af7..0000000000
--- a/a11y/calendar/.cvsignore
+++ /dev/null
@@ -1,6 +0,0 @@
-Makefile
-Makefile.in
-Evolution-*.c
-Evolution.h
-evolution-calendar-*.c
-evolution-calendar.h
diff --git a/a11y/calendar/Makefile.am b/a11y/calendar/Makefile.am
deleted file mode 100644
index 2c3a26f2ba..0000000000
--- a/a11y/calendar/Makefile.am
+++ /dev/null
@@ -1,82 +0,0 @@
-# Calendar IDL files
-
-CALENDAR_IDLS = $(top_srcdir)/calendar/idl/evolution-calendar.idl
-SHELL_IDLS = \
- $(top_srcdir)/shell/Evolution-Activity.idl \
- $(top_srcdir)/shell/Evolution-ConfigControl.idl \
- $(top_srcdir)/shell/Evolution-Offline.idl \
- $(top_srcdir)/shell/Evolution-Session.idl \
- $(top_srcdir)/shell/Evolution-Shell.idl \
- $(top_srcdir)/shell/Evolution-ShellComponent.idl \
- $(top_srcdir)/shell/Evolution-ShellComponentDnd.idl \
- $(top_srcdir)/shell/Evolution-ShellView.idl \
- $(top_srcdir)/shell/Evolution-Shortcuts.idl \
- $(top_srcdir)/shell/Evolution-Storage.idl \
- $(top_srcdir)/shell/Evolution-StorageSetView.idl \
- $(top_srcdir)/shell/Evolution-Wizard.idl \
- $(top_srcdir)/shell/Evolution-common.idl \
- $(top_srcdir)/shell/Evolution.idl
-
-CALENDAR_IDL_GENERATED_H = evolution-calendar.h
-CALENDAR_IDL_GENERATED_C = \
- evolution-calendar-common.c \
- evolution-calendar-skels.c \
- evolution-calendar-stubs.c
-
-SHELL_IDL_GENERATED_H = Evolution.h
-SHELL_IDL_GENERATED_C = \
- Evolution-common.c \
- Evolution-skels.c \
- Evolution-stubs.c
-
-$(CALENDAR_IDL_GENERATED_H): $(CALENDAR_IDLS)
- $(ORBIT_IDL) -I $(srcdir) $(IDL_INCLUDES) \
- $(top_srcdir)/calendar/idl/evolution-calendar.idl
-
-$(SHELL_IDL_GENERATED_H): $(SHELL_IDLS)
- $(ORBIT_IDL) -I $(srcdir) $(IDL_INCLUDES) \
- $(top_srcdir)/shell/Evolution.idl
-
-IDL_GENERATED = $(SHELL_IDL_GENERATED_H) $(CALENDAR_IDL_GENERATED_H)
-BUILT_SOURCES = $(IDL_GENERATED)
-CLEANFILES = $(BUILT_SOURCES) $(CALENDAR_IDL_GENERATED_C) $(SHELL_IDL_GENERATED_C)
-
-noinst_LTLIBRARIES = libevolution-calendar-a11y.la
-
-INCLUDES = \
- -DG_LOG_DOMAIN=\"evolution-a11y\" \
- -I$(top_srcdir)/shell \
- -I$(top_srcdir)/calendar \
- -I$(top_srcdir)/calendar/cal-client \
- -I$(top_srcdir)/libical/src/libical \
- -I$(top_srcdir)/calendar/gui \
- -I$(top_srcdir)/widgets \
- -I$(top_srcdir)/a11y \
- -DEVOLUTION_DATADIR=\""$(datadir)"\" \
- -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \
- -DEVOLUTION_ETSPECDIR=\""$(etspecdir)"\" \
- -DEVOLUTION_IMAGESDIR=\""$(imagesdir)"\" \
- -DEVOLUTION_GALVIEWSDIR=\""$(viewsdir)"\" \
- -DEVOLUTION_UIDIR=\""$(evolutionuidir)"\" \
- -DG_DISABLE_DEPRECATED \
- -DPREFIX=\""$(prefix)"\" \
- $(A11Y_CFLAGS) \
- $(EVOLUTION_CALENDAR_CFLAGS)
-
-libevolution_calendar_a11y_la_SOURCES = \
- $(CALENDAR_IDL_GENERATED_H) \
- $(SHELL_IDL_GENERATED_H) \
- ea-calendar.c \
- ea-calendar.h \
- ea-calendar-helpers.c \
- ea-calendar-helpers.h \
- ea-cal-view.c \
- ea-cal-view.h \
- ea-cal-view-event.c \
- ea-cal-view-event.h \
- ea-day-view.c \
- ea-day-view.h \
- ea-week-view.c \
- ea-week-view.h \
- ea-gnome-calendar.c \
- ea-gnome-calendar.h
diff --git a/a11y/calendar/ea-cal-view-event.c b/a11y/calendar/ea-cal-view-event.c
deleted file mode 100644
index deffa32ce8..0000000000
--- a/a11y/calendar/ea-cal-view-event.c
+++ /dev/null
@@ -1,460 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* vim:expandtab:shiftwidth=8:tabstop=8:
- */
-/* Evolution Accessibility: ea-cal-view-event.c
- *
- * Copyright (C) 2003 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
- * 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.
- *
- * Author: Bolian Yin <bolian.yin@sun.com> Sun Microsystem Inc., 2003
- *
- */
-
-#include "ea-cal-view-event.h"
-#include "ea-calendar-helpers.h"
-#include "ea-day-view.h"
-#include "ea-week-view.h"
-#include <gal/e-text/e-text.h>
-
-static void ea_cal_view_event_class_init (EaCalViewEventClass *klass);
-
-static G_CONST_RETURN gchar* ea_cal_view_event_get_name (AtkObject *accessible);
-static G_CONST_RETURN gchar* ea_cal_view_event_get_description (AtkObject *accessible);
-static AtkObject* ea_cal_view_event_get_parent (AtkObject *accessible);
-static gint ea_cal_view_event_get_index_in_parent (AtkObject *accessible);
-
-/* component interface */
-static void atk_component_interface_init (AtkComponentIface *iface);
-static void ea_cal_view_get_extents (AtkComponent *component,
- gint *x, gint *y, gint *width, gint *height,
- AtkCoordType coord_type);
-
-static gpointer parent_class = NULL;
-
-GType
-ea_cal_view_event_get_type (void)
-{
- static GType type = 0;
- AtkObjectFactory *factory;
- GTypeQuery query;
- GType derived_atk_type;
-
-
- if (!type) {
- static GTypeInfo tinfo = {
- sizeof (EaCalViewEventClass),
- (GBaseInitFunc) NULL, /* base init */
- (GBaseFinalizeFunc) NULL, /* base finalize */
- (GClassInitFunc) ea_cal_view_event_class_init, /* class init */
- (GClassFinalizeFunc) NULL, /* class finalize */
- NULL, /* class data */
- sizeof (EaCalViewEvent), /* instance size */
- 0, /* nb preallocs */
- (GInstanceInitFunc) NULL, /* instance init */
- NULL /* value table */
- };
-
- static const GInterfaceInfo atk_component_info = {
- (GInterfaceInitFunc) atk_component_interface_init,
- (GInterfaceFinalizeFunc) NULL,
- NULL
- };
-
- /*
- * Figure out the size of the class and instance
- * we are run-time deriving from (atk object for E_TEXT, in this case)
- */
-
- factory = atk_registry_get_factory (atk_get_default_registry (),
- E_TYPE_TEXT);
- derived_atk_type = atk_object_factory_get_accessible_type (factory);
- g_type_query (derived_atk_type, &query);
-
- tinfo.class_size = query.class_size;
- tinfo.instance_size = query.instance_size;
-
- /* we inherit the component, text and other interfaces from E_TEXT */
- type = g_type_register_static (derived_atk_type,
- "EaCalViewEvent", &tinfo, 0);
- g_type_add_interface_static (type, ATK_TYPE_COMPONENT,
- &atk_component_info);
- }
-
- return type;
-}
-
-static void
-ea_cal_view_event_class_init (EaCalViewEventClass *klass)
-{
- AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
-
- class->get_name = ea_cal_view_event_get_name;
- class->get_description = ea_cal_view_event_get_description;
- class->get_parent = ea_cal_view_event_get_parent;
- class->get_index_in_parent = ea_cal_view_event_get_index_in_parent;
-
-}
-
-AtkObject*
-ea_cal_view_event_new (GObject *obj)
-{
- AtkObject *atk_obj = NULL;
- GObject *target_obj;
- ECalView *cal_view;
-
- g_return_val_if_fail (E_IS_TEXT (obj), NULL);
- cal_view = ea_calendar_helpers_get_cal_view_from (GNOME_CANVAS_ITEM (obj));
- if (E_IS_WEEK_VIEW (cal_view)) {
- gint event_num, span_num;
- EWeekViewEvent *week_view_event;
- EWeekViewEventSpan *event_span;
- EWeekView *week_view = E_WEEK_VIEW (cal_view);
-
- /* for week view, we need to check if a atkobject exists for
- * the first span of the same event
- */
- if (!e_week_view_find_event_from_item (week_view,
- GNOME_CANVAS_ITEM (obj),
- &event_num,
- &span_num))
- return NULL;
- week_view_event = &g_array_index (week_view->events,
- EWeekViewEvent,
- event_num);
- /* get the first span */
- event_span = &g_array_index (week_view->spans,
- EWeekViewEventSpan,
- week_view_event->spans_index);
- target_obj = G_OBJECT (event_span->text_item);
- atk_obj = g_object_get_data (target_obj, "accessible-object");
-
- }
- else
- target_obj = obj;
-
- if (!atk_obj) {
- static AtkRole event_role = ATK_ROLE_INVALID;
- atk_obj = ATK_OBJECT (g_object_new (EA_TYPE_CAL_VIEW_EVENT,
- NULL));
- atk_object_initialize (atk_obj, target_obj);
- if (event_role == ATK_ROLE_INVALID)
- event_role = atk_role_register ("Calendar Event");
- atk_obj->role = event_role;
-#ifdef ACC_DEBUG
- printf ("EvoAcc: ea_cal_view_event created %p for item=%p\n",
- atk_obj, target_obj);
-#endif
- }
-
- /* the registered factory for E_TEXT is cannot create a EaCalViewEvent,
- * we should save the EaCalViewEvent object in it.
- */
- g_object_set_data (obj, "accessible-object", atk_obj);
-
- return atk_obj;
-}
-
-static G_CONST_RETURN gchar*
-ea_cal_view_event_get_name (AtkObject *accessible)
-{
- g_return_val_if_fail (EA_IS_CAL_VIEW_EVENT (accessible), NULL);
-
- if (accessible->name)
- return accessible->name;
- else {
- AtkGObjectAccessible *atk_gobj;
- GObject *g_obj;
- ECalViewEvent *event;
- gchar *tmp_name;
- gchar *new_name = g_strdup ("");
- const char *summary;
-
- atk_gobj = ATK_GOBJECT_ACCESSIBLE (accessible);
- g_obj = atk_gobject_accessible_get_object (atk_gobj);
- if (!g_obj || !E_IS_TEXT (g_obj))
- return NULL;
- event = ea_calendar_helpers_get_cal_view_event_from (GNOME_CANVAS_ITEM(g_obj));
-
- if (event && event->comp_data) {
- if (cal_util_component_has_alarms (event->comp_data->icalcomp)) {
- tmp_name = new_name;
- new_name = g_strconcat (new_name, "alarm ", NULL);
- g_free (tmp_name);
- }
-
- if (cal_util_component_has_recurrences (event->comp_data->icalcomp)) {
- tmp_name = new_name;
- new_name = g_strconcat (new_name, "recurrence ", NULL);
- g_free (tmp_name);
- }
-
- if (event->different_timezone) {
- tmp_name = new_name;
- new_name = g_strconcat (new_name, "time-zone ", NULL);
- g_free (tmp_name);
- }
-
- if (cal_util_component_has_organizer (event->comp_data->icalcomp)) {
- tmp_name = new_name;
- new_name = g_strconcat (new_name, "meeting ", NULL);
- g_free (tmp_name);
- }
- }
- tmp_name = new_name;
- new_name = g_strconcat (new_name, "event. Summary is ", NULL);
- g_free (tmp_name);
-
- summary = icalcomponent_get_summary (event->comp_data->icalcomp);
- if (summary) {
- tmp_name = new_name;
- new_name = g_strconcat (new_name, summary, NULL);
- g_free (tmp_name);
- }
- else {
- tmp_name = new_name;
- new_name = g_strconcat (new_name, "empty", NULL);
- g_free (tmp_name);
- }
-
- ATK_OBJECT_CLASS (parent_class)->set_name (accessible, new_name);
-#ifdef ACC_DEBUG
- printf("EvoAcc: name for event accobj=%p, is %s\n",
- accessible, new_name);
-#endif
- g_free (new_name);
- return accessible->name;
- }
-}
-
-static G_CONST_RETURN gchar*
-ea_cal_view_event_get_description (AtkObject *accessible)
-{
- if (accessible->description)
- return accessible->description;
-
- return "calendar view event";
-}
-
-static AtkObject *
-ea_cal_view_event_get_parent (AtkObject *accessible)
-{
- AtkGObjectAccessible *atk_gobj;
- GObject *g_obj;
- GnomeCanvasItem *canvas_item;
- ECalView *cal_view;
-
- g_return_val_if_fail (EA_IS_CAL_VIEW_EVENT (accessible), NULL);
- atk_gobj = ATK_GOBJECT_ACCESSIBLE (accessible);
-
- g_obj = atk_gobject_accessible_get_object (atk_gobj);
- if (g_obj == NULL)
- /* Object is defunct */
- return NULL;
- canvas_item = GNOME_CANVAS_ITEM (g_obj);
-
- cal_view = ea_calendar_helpers_get_cal_view_from (canvas_item);
-
- if (!cal_view)
- return NULL;
-
- return gtk_widget_get_accessible (GTK_WIDGET (cal_view));
-}
-
-static gint
-ea_cal_view_event_get_index_in_parent (AtkObject *accessible)
-{
- GObject *g_obj;
- GnomeCanvasItem *canvas_item;
- ECalView *cal_view;
- ECalViewEvent *cal_view_event;
-
- g_return_val_if_fail (EA_IS_CAL_VIEW_EVENT (accessible), -1);
- g_obj = atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE(accessible));
- if (!g_obj)
- /* defunct object*/
- return -1;
-
- canvas_item = GNOME_CANVAS_ITEM (g_obj);
- cal_view = ea_calendar_helpers_get_cal_view_from (canvas_item);
- if (!cal_view)
- return -1;
-
- cal_view_event = ea_calendar_helpers_get_cal_view_event_from (canvas_item);
- if (!cal_view_event)
- return -1;
-
- if (E_IS_DAY_VIEW (cal_view)) {
- gint day, event_num, num_before;
- EDayViewEvent *day_view_event;
- EDayView *day_view = E_DAY_VIEW (cal_view);
-
- /* the long event comes first in the order */
- for (event_num = day_view->long_events->len - 1; event_num >= 0;
- --event_num) {
- day_view_event = &g_array_index (day_view->long_events,
- EDayViewEvent, event_num);
- if (cal_view_event == (ECalViewEvent*)day_view_event)
- return event_num;
-
- }
- num_before = day_view->long_events->len;
-
- for (day = 0; day < day_view->days_shown; ++day) {
- for (event_num = day_view->events[day]->len - 1; event_num >= 0;
- --event_num) {
- day_view_event = &g_array_index (day_view->events[day],
- EDayViewEvent, event_num);
- if (cal_view_event == (ECalViewEvent*)day_view_event)
- return num_before + event_num;
- }
- num_before += day_view->events[day]->len;
- }
- }
- else if (E_IS_WEEK_VIEW (cal_view)) {
- gint index;
- EWeekViewEvent *week_view_event;
- EWeekView *week_view = E_WEEK_VIEW (cal_view);
-
- for (index = week_view->events->len - 1; index >= 0; --index) {
- week_view_event = &g_array_index (week_view->events,
- EWeekViewEvent, index);
- if (cal_view_event == (ECalViewEvent*)week_view_event)
- return index;
- }
- }
- else {
- g_assert_not_reached ();
- return -1;
- }
- return -1;
-}
-
-/* Atk Component Interface */
-
-static void
-atk_component_interface_init (AtkComponentIface *iface)
-{
- g_return_if_fail (iface != NULL);
-
- iface->get_extents = ea_cal_view_get_extents;
-}
-
-static void
-ea_cal_view_get_extents (AtkComponent *component,
- gint *x,
- gint *y,
- gint *width,
- gint *height,
- AtkCoordType coord_type)
-{
- GObject *g_obj;
- GnomeCanvasItem *canvas_item;
- gint x_window, y_window;
- gint scroll_x, scroll_y;
- ECalView *cal_view;
- gint item_x, item_y, item_w, item_h;
- GtkWidget *canvas = NULL;
-
- g_return_if_fail (EA_IS_CAL_VIEW_EVENT (component));
-
- g_obj = atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE(component));
- if (!g_obj)
- /* defunct object*/
- return;
- g_return_if_fail (E_IS_TEXT (g_obj));
-
- canvas_item = GNOME_CANVAS_ITEM (g_obj);
- cal_view = ea_calendar_helpers_get_cal_view_from (canvas_item);
- if (!cal_view)
- return;
-
- if (E_IS_DAY_VIEW (cal_view)) {
- gint day, event_num;
-
- if (!e_day_view_find_event_from_item (E_DAY_VIEW (cal_view),
- canvas_item,
- &day, &event_num))
- return;
- if (day == E_DAY_VIEW_LONG_EVENT) {
- gint start_day, end_day;
- if (!e_day_view_get_long_event_position (E_DAY_VIEW (cal_view),
- event_num,
- &start_day,
- &end_day,
- &item_x,
- &item_y,
- &item_w,
- &item_h))
- return;
- canvas = E_DAY_VIEW (cal_view)->top_canvas;
- }
- else {
- if (!e_day_view_get_event_position (E_DAY_VIEW (cal_view), day,
- event_num,
- &item_x, &item_y,
- &item_w, &item_h))
-
- return;
- canvas = E_DAY_VIEW (cal_view)->main_canvas;
- }
- }
- else if (E_IS_WEEK_VIEW (cal_view)) {
- gint event_num, span_num;
- if (!e_week_view_find_event_from_item (E_WEEK_VIEW (cal_view),
- canvas_item, &event_num,
- &span_num))
- return;
-
- if (!e_week_view_get_span_position (E_WEEK_VIEW (cal_view),
- event_num, span_num,
- &item_x, &item_y, &item_w))
- return;
- item_h = E_WEEK_VIEW_ICON_HEIGHT;
- canvas = E_WEEK_VIEW (cal_view)->main_canvas;
- }
- else
- return;
-
- if (!canvas)
- return;
-
- gdk_window_get_origin (canvas->window,
- &x_window, &y_window);
- gnome_canvas_get_scroll_offsets (GNOME_CANVAS (canvas), &scroll_x, &scroll_y);
-
- *x = item_x + x_window - scroll_x;
- *y = item_y + y_window - scroll_y;
- *width = item_w;
- *height = item_h;
-
- if (coord_type == ATK_XY_WINDOW) {
- GdkWindow *window;
- gint x_toplevel, y_toplevel;
-
- window = gdk_window_get_toplevel (GTK_WIDGET (cal_view)->window);
- gdk_window_get_origin (window, &x_toplevel, &y_toplevel);
-
- *x -= x_toplevel;
- *y -= y_toplevel;
- }
-
-#ifdef ACC_DEBUG
- printf ("Event Bounds (%d, %d, %d, %d)\n", *x, *y, *width, *height);
-#endif
-}
diff --git a/a11y/calendar/ea-cal-view-event.h b/a11y/calendar/ea-cal-view-event.h
deleted file mode 100644
index f139dde9fb..0000000000
--- a/a11y/calendar/ea-cal-view-event.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* vim:expandtab:shiftwidth=8:tabstop=8:
- */
-/* Evolution Accessibility: ea-cal-view-event.h
- *
- * Copyright (C) 2003 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
- * 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.
- *
- * Author: Bolian Yin <bolian.yin@sun.com> Sun Microsystem Inc., 2003
- *
- */
-
-#ifndef __EA_CAL_VIEW_EVENT_H__
-#define __EA_CAL_VIEW_EVENT_H__
-
-#include <atk/atkgobjectaccessible.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#define EA_TYPE_CAL_VIEW_EVENT (ea_cal_view_event_get_type ())
-#define EA_CAL_VIEW_EVENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EA_TYPE_CAL_VIEW_EVENT, EaCalViewEvent))
-#define EA_CAL_VIEW_EVENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EA_TYPE_CAL_VIEW_EVENT, EaCalViewEventClass))
-#define EA_IS_CAL_VIEW_EVENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EA_TYPE_CAL_VIEW_EVENT))
-#define EA_IS_CAL_VIEW_EVENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EA_TYPE_CAL_VIEW_EVENT))
-#define EA_CAL_VIEW_EVENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EA_TYPE_CAL_VIEW_EVENT, EaCalViewEventClass))
-
-typedef struct _EaCalViewEvent EaCalViewEvent;
-typedef struct _EaCalViewEventClass EaCalViewEventClass;
-
-struct _EaCalViewEvent
-{
- AtkGObjectAccessible parent;
-};
-
-GType ea_cal_view_event_get_type (void);
-
-struct _EaCalViewEventClass
-{
- AtkGObjectAccessibleClass parent_class;
-};
-
-AtkObject *ea_cal_view_event_new (GObject *obj);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __EA_CAL_VIEW_EVENT_H__ */
diff --git a/a11y/calendar/ea-cal-view.c b/a11y/calendar/ea-cal-view.c
deleted file mode 100644
index f31d24cc55..0000000000
--- a/a11y/calendar/ea-cal-view.c
+++ /dev/null
@@ -1,271 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* vim:expandtab:shiftwidth=8:tabstop=8:
- */
-/* Evolution Accessibility: ea-cal-view.c
- *
- * Copyright (C) 2003 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
- * 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.
- *
- * Author: Bolian Yin <bolian.yin@sun.com> Sun Microsystem Inc., 2003
- *
- */
-
-#include "ea-cal-view.h"
-#include "ea-calendar-helpers.h"
-#include "e-day-view.h"
-#include "e-week-view.h"
-#include "calendar-commands.h"
-#include <glib/gstrfuncs.h>
-
-static void ea_cal_view_class_init (EaCalViewClass *klass);
-
-static AtkObject* ea_cal_view_get_parent (AtkObject *accessible);
-static gint ea_cal_view_get_index_in_parent (AtkObject *accessible);
-static void ea_cal_view_real_initialize (AtkObject *accessible, gpointer data);
-
-static void ea_cal_view_event_changed_cb (ECalView *cal_view,
- ECalViewEvent *event, gpointer data);
-static void ea_cal_view_event_added_cb (ECalView *cal_view,
- ECalViewEvent *event, gpointer data);
-
-static void ea_cal_view_dates_change_cb (GnomeCalendar *gcal, gpointer data);
-
-static gpointer parent_class = NULL;
-
-GType
-ea_cal_view_get_type (void)
-{
- static GType type = 0;
- AtkObjectFactory *factory;
- GTypeQuery query;
- GType derived_atk_type;
-
- if (!type) {
- static GTypeInfo tinfo = {
- sizeof (EaCalViewClass),
- (GBaseInitFunc) NULL, /* base init */
- (GBaseFinalizeFunc) NULL, /* base finalize */
- (GClassInitFunc) ea_cal_view_class_init, /* class init */
- (GClassFinalizeFunc) NULL, /* class finalize */
- NULL, /* class data */
- sizeof (EaCalView), /* instance size */
- 0, /* nb preallocs */
- (GInstanceInitFunc) NULL, /* instance init */
- NULL /* value table */
- };
-
- /*
- * Figure out the size of the class and instance
- * we are run-time deriving from (GailWidget, in this case)
- */
-
- factory = atk_registry_get_factory (atk_get_default_registry (),
- GTK_TYPE_WIDGET);
- derived_atk_type = atk_object_factory_get_accessible_type (factory);
- g_type_query (derived_atk_type, &query);
-
- tinfo.class_size = query.class_size;
- tinfo.instance_size = query.instance_size;
-
- type = g_type_register_static (derived_atk_type,
- "EaCalView", &tinfo, 0);
- }
-
- return type;
-}
-
-static void
-ea_cal_view_class_init (EaCalViewClass *klass)
-{
- AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
- class->get_parent = ea_cal_view_get_parent;
- class->get_index_in_parent = ea_cal_view_get_index_in_parent;
- class->initialize = ea_cal_view_real_initialize;
-}
-
-AtkObject*
-ea_cal_view_new (GtkWidget *widget)
-{
- GObject *object;
- AtkObject *accessible;
-
- g_return_val_if_fail (E_IS_CAL_VIEW (widget), NULL);
-
- object = g_object_new (EA_TYPE_CAL_VIEW, NULL);
-
- accessible = ATK_OBJECT (object);
- atk_object_initialize (accessible, widget);
-
- return accessible;
-}
-
-static void
-ea_cal_view_real_initialize (AtkObject *accessible, gpointer data)
-{
- ECalView *cal_view;
- GnomeCalendar *gcal;
-
- g_return_if_fail (EA_IS_CAL_VIEW (accessible));
- g_return_if_fail (E_IS_CAL_VIEW (data));
-
- ATK_OBJECT_CLASS (parent_class)->initialize (accessible, data);
- accessible->role = ATK_ROLE_CANVAS;
- cal_view = E_CAL_VIEW (data);
-
- /* add listener for event_changed, event_added
- * we don't need to listen on event_removed. When the e_text
- * of the event is removed, the cal_view_event will go to the state
- * of "defunct" (changed by weak ref callback of atkgobjectaccessible
- */
- g_signal_connect (G_OBJECT(cal_view), "event_changed",
- G_CALLBACK (ea_cal_view_event_changed_cb), NULL);
- g_signal_connect (G_OBJECT(cal_view), "event_added",
- G_CALLBACK (ea_cal_view_event_added_cb), NULL);
-
- /* listen for date changes of calendar */
- gcal = e_cal_view_get_calendar (cal_view);
-
- if (gcal)
- g_signal_connect (gcal, "dates_shown_changed",
- G_CALLBACK (ea_cal_view_dates_change_cb),
- accessible);
-}
-
-static AtkObject*
-ea_cal_view_get_parent (AtkObject *accessible)
-{
- ECalView *cal_view;
- GnomeCalendar *gnomeCalendar;
-
- g_return_val_if_fail (EA_IS_CAL_VIEW (accessible), NULL);
-
- if (!GTK_ACCESSIBLE (accessible)->widget)
- return NULL;
- cal_view = E_CAL_VIEW (GTK_ACCESSIBLE (accessible)->widget);
-
- gnomeCalendar = e_cal_view_get_calendar (cal_view);
-
- return gtk_widget_get_accessible (GTK_WIDGET(gnomeCalendar));
-}
-
-static gint
-ea_cal_view_get_index_in_parent (AtkObject *accessible)
-{
- return 1;
-}
-
-static void
-ea_cal_view_event_changed_cb (ECalView *cal_view, ECalViewEvent *event,
- gpointer data)
-{
- AtkObject *atk_obj;
- EaCalView *ea_cal_view;
- AtkObject *event_atk_obj = NULL;
-
- g_return_if_fail (E_IS_CAL_VIEW (cal_view));
-
- atk_obj = gtk_widget_get_accessible (GTK_WIDGET(cal_view));
- if (!EA_IS_CAL_VIEW (atk_obj))
- return;
- ea_cal_view = EA_CAL_VIEW (atk_obj);
-
- if ((E_IS_DAY_VIEW (cal_view)) && event && event->canvas_item) {
- event_atk_obj =
- ea_calendar_helpers_get_accessible_for (event->canvas_item);
- }
- else if ((E_IS_WEEK_VIEW (cal_view)) && event) {
- EWeekViewEventSpan *span;
- EWeekViewEvent *week_view_event = (EWeekViewEvent *)event;
- EWeekView *week_view = E_WEEK_VIEW (cal_view);
- /* get the first span of the event */
- span = &g_array_index (week_view->spans, EWeekViewEventSpan,
- week_view_event->spans_index);
- if (span && span->text_item)
- event_atk_obj = ea_calendar_helpers_get_accessible_for (span->text_item);
- }
- if (event_atk_obj) {
-#ifdef ACC_DEBUG
- printf ("AccDebug: event=%p changed\n", event);
-#endif
- g_object_notify (G_OBJECT(event_atk_obj), "accessible-name");
- g_signal_emit_by_name (event_atk_obj, "visible_data_changed");
- }
-
-}
-
-static void
-ea_cal_view_event_added_cb (ECalView *cal_view, ECalViewEvent *event,
- gpointer data)
-{
- AtkObject *atk_obj;
- EaCalView *ea_cal_view;
- AtkObject *event_atk_obj = NULL;
- gint index;
-
- g_return_if_fail (E_IS_CAL_VIEW (cal_view));
-
- atk_obj = gtk_widget_get_accessible (GTK_WIDGET(cal_view));
- if (!EA_IS_CAL_VIEW (atk_obj))
- return;
- ea_cal_view = EA_CAL_VIEW (atk_obj);
-
- if ((E_IS_DAY_VIEW (cal_view)) && event && event->canvas_item) {
- event_atk_obj =
- ea_calendar_helpers_get_accessible_for (event->canvas_item);
- }
- else if ((E_IS_WEEK_VIEW (cal_view)) && event) {
- EWeekViewEventSpan *span;
- EWeekViewEvent *week_view_event = (EWeekViewEvent *)event;
- EWeekView *week_view = E_WEEK_VIEW (cal_view);
- /* get the first span of the event */
- span = &g_array_index (week_view->spans, EWeekViewEventSpan,
- week_view_event->spans_index);
- if (span && span->text_item)
- event_atk_obj = ea_calendar_helpers_get_accessible_for (span->text_item);
-
- }
- if (event_atk_obj) {
- index = atk_object_get_index_in_parent (event_atk_obj);
- if (index < 0)
- return;
-#ifdef ACC_DEBUG
- printf ("AccDebug: event=%p added\n", event);
-#endif
- g_signal_emit_by_name (atk_obj, "children_changed::add",
- index, event_atk_obj, NULL);
- }
-}
-
-static void
-ea_cal_view_dates_change_cb (GnomeCalendar *gcal, gpointer data)
-{
- AtkObject *atk_obj;
-
- g_return_if_fail (GNOME_IS_CALENDAR (gcal));
- g_return_if_fail (data);
- g_return_if_fail (EA_IS_CAL_VIEW (data));
-
- atk_obj = ATK_OBJECT(data);
- if (atk_obj->name) {
- g_free (atk_obj->name);
- atk_obj->name = NULL;
- }
- g_object_notify (G_OBJECT (data), "accessible-name");
- g_signal_emit_by_name (data, "visible_data_changed");
-}
diff --git a/a11y/calendar/ea-cal-view.h b/a11y/calendar/ea-cal-view.h
deleted file mode 100644
index 858aa497d4..0000000000
--- a/a11y/calendar/ea-cal-view.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* vim:expandtab:shiftwidth=8:tabstop=8:
- */
-/* Evolution Accessibility: ea-cal-view.h
- *
- * Copyright (C) 2003 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
- * 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.
- *
- * Author: Bolian Yin <bolian.yin@sun.com> Sun Microsystem Inc., 2003
- *
- */
-
-#ifndef __EA_CAL_VIEW_H__
-#define __EA_CAL_VIEW_H__
-
-#include <gtk/gtkaccessible.h>
-#include "e-cal-view.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#define EA_TYPE_CAL_VIEW (ea_cal_view_get_type ())
-#define EA_CAL_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EA_TYPE_CAL_VIEW, EaCalView))
-#define EA_CAL_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EA_TYPE_CAL_VIEW, EaCalViewClass))
-#define EA_IS_CAL_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EA_TYPE_CAL_VIEW))
-#define EA_IS_CAL_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EA_TYPE_CAL_VIEW))
-#define EA_CAL_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EA_TYPE_CAL_VIEW, EaCalViewClass))
-
-typedef struct _EaCalView EaCalView;
-typedef struct _EaCalViewClass EaCalViewClass;
-
-struct _EaCalView
-{
- GtkAccessible parent;
-};
-
-GType ea_cal_view_get_type (void);
-
-struct _EaCalViewClass
-{
- GtkAccessibleClass parent_class;
-};
-
-AtkObject* ea_cal_view_new (GtkWidget *widget);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __EA_CAL_VIEW_H__ */
diff --git a/a11y/calendar/ea-calendar-helpers.c b/a11y/calendar/ea-calendar-helpers.c
deleted file mode 100644
index e8b0d3aa9c..0000000000
--- a/a11y/calendar/ea-calendar-helpers.c
+++ /dev/null
@@ -1,148 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* vim:expandtab:shiftwidth=8:tabstop=8:
- */
-/* Evolution Accessibility: ea-calendar-helpers.c
- *
- * Copyright (C) 2003 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
- * 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.
- *
- * Author: Bolian Yin <bolian.yin@sun.com> Sun Microsystem Inc., 2003
- *
- */
-
-#include "ea-calendar-helpers.h"
-#include "ea-cal-view-event.h"
-#include "e-day-view.h"
-#include "e-week-view.h"
-
-#include <gal/e-text/e-text.h>
-
-/**
- * ea_calendar_helpers_get_accessible_for
- * @canvas_item: the canvas item (e_text) for a event
- * @returns: the atk object for the canvas_item
- *
- **/
-AtkObject *
-ea_calendar_helpers_get_accessible_for (GnomeCanvasItem *canvas_item)
-{
- AtkObject *atk_obj = NULL;
- GObject *g_obj;
-
- g_return_val_if_fail (E_IS_TEXT (canvas_item), NULL);
-
- g_obj = G_OBJECT (canvas_item);
- /* we cannot use atk_gobject_accessible_for_object here,
- * EaDayViewEvent/EaWeekViewEvent cannot be created by the
- * registered facotry of E_TEXT
- */
- atk_obj = g_object_get_data (g_obj, "accessible-object");
- if (!atk_obj)
- atk_obj = ea_cal_view_event_new (g_obj);
- return atk_obj;
-}
-
-/**
- * ea_calendar_helpers_get_view_widget_from:
- * @canvas_item: the canvas item (e_text) for a event
- * @returns: the cal view widget if exists
- *
- * Get the cal view widget contains the canvas_item.
- *
- **/
-ECalView *
-ea_calendar_helpers_get_cal_view_from (GnomeCanvasItem *canvas_item)
-{
- GnomeCanvas *canvas;
- GtkWidget *view_widget = NULL;
-
- g_return_val_if_fail (canvas_item, NULL);
- g_return_val_if_fail (E_IS_TEXT (canvas_item), NULL);
-
- /* canvas_item is the e_text for the event */
- /* canvas_item->canvas is the ECanvas for day view */
- /* parent of canvas_item->canvas is the EDayView or EWeekView widget */
- canvas = canvas_item->canvas;
- view_widget = gtk_widget_get_parent (GTK_WIDGET(canvas));
- if (!view_widget || !E_IS_CAL_VIEW (view_widget))
- return NULL;
- return E_CAL_VIEW (view_widget);
-}
-
-/**
- * ea_calendar_helpers_get_cal_view_event_from
- * @canvas_item: the cavas_item (e_text) for the event
- * @returns: the ECalViewEvent
- *
- * Get the ECalViewEvent for the canvas_item.
- *
- **/
-ECalViewEvent *
-ea_calendar_helpers_get_cal_view_event_from (GnomeCanvasItem *canvas_item)
-{
- ECalView *cal_view;
- gboolean event_found;
- ECalViewEvent *cal_view_event;
-
- g_return_val_if_fail (E_IS_TEXT (canvas_item), NULL);
-
- cal_view = ea_calendar_helpers_get_cal_view_from (canvas_item);
-
- if (!cal_view)
- return NULL;
-
- if (E_IS_DAY_VIEW (cal_view)) {
- gint event_day, event_num;
- EDayViewEvent *day_view_event;
- EDayView *day_view = E_DAY_VIEW (cal_view);
- event_found = e_day_view_find_event_from_item (day_view, canvas_item,
- &event_day, &event_num);
- if (!event_found)
- return NULL;
- if (event_day == E_DAY_VIEW_LONG_EVENT) {
- /* a long event */
- day_view_event = &g_array_index (day_view->long_events,
- EDayViewEvent, event_num);
- }
- else {
- /* a main canvas event */
- day_view_event = &g_array_index (day_view->events[event_day],
- EDayViewEvent, event_num);
- }
- cal_view_event = (ECalViewEvent *) day_view_event;
- }
- else if (E_IS_WEEK_VIEW (cal_view)) {
- gint event_num, span_num;
- EWeekViewEvent *week_view_event;
- EWeekView *week_view = E_WEEK_VIEW (cal_view);
- event_found = e_week_view_find_event_from_item (week_view,
- canvas_item,
- &event_num,
- &span_num);
- if (!event_found)
- return NULL;
-
- week_view_event = &g_array_index (week_view->events, EWeekViewEvent,
- event_num);
-
- cal_view_event = (ECalViewEvent *)week_view_event;
- }
- else {
- g_assert_not_reached ();
- return NULL;
- }
- return cal_view_event;
-}
diff --git a/a11y/calendar/ea-calendar-helpers.h b/a11y/calendar/ea-calendar-helpers.h
deleted file mode 100644
index 3b7417a4c0..0000000000
--- a/a11y/calendar/ea-calendar-helpers.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* vim:expandtab:shiftwidth=8:tabstop=8:
- */
-/* Evolution Accessibility: ea-calendar-helpers.h
- *
- * Copyright (C) 2003 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
- * 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.
- *
- * Author: Bolian Yin <bolian.yin@sun.com> Sun Microsystem Inc., 2003
- *
- */
-
-/* Evolution Accessibility
- */
-
-#ifndef _EA_CALENDAR_HELPERS_H__
-#define _EA_CALENDAR_HELPERS_H__
-
-#include "ea-cal-view.h"
-
-AtkObject *
-ea_calendar_helpers_get_accessible_for (GnomeCanvasItem *canvas_item);
-
-ECalView *
-ea_calendar_helpers_get_cal_view_from (GnomeCanvasItem *canvas_item);
-
-ECalViewEvent *
-ea_calendar_helpers_get_cal_view_event_from (GnomeCanvasItem *canvas_item);
-
-#endif /* _EA_CALENDAR_HELPERS_H__ */
diff --git a/a11y/calendar/ea-calendar.c b/a11y/calendar/ea-calendar.c
deleted file mode 100644
index b5296c2618..0000000000
--- a/a11y/calendar/ea-calendar.c
+++ /dev/null
@@ -1,135 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* vim:expandtab:shiftwidth=8:tabstop=8:
- */
-/* Evolution Accessibility: ea-calendar.c
- *
- * Copyright (C) 2003 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
- * 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.
- *
- * Author: Bolian Yin <bolian.yin@sun.com> Sun Microsystem Inc., 2003
- *
- */
-
-#include <gal/e-text/e-text.h>
-#include "ea-calendar-helpers.h"
-#include "ea-factory.h"
-#include "ea-calendar.h"
-
-#include "calendar/ea-cal-view.h"
-#include "calendar/ea-cal-view-event.h"
-#include "calendar/ea-day-view.h"
-#include "calendar/ea-week-view.h"
-#include "calendar/ea-gnome-calendar.h"
-
-
-EA_FACTORY (EA_TYPE_CAL_VIEW, ea_cal_view, ea_cal_view_new);
-EA_FACTORY (EA_TYPE_DAY_VIEW, ea_day_view, ea_day_view_new);
-EA_FACTORY (EA_TYPE_WEEK_VIEW, ea_week_view, ea_week_view_new);
-EA_FACTORY (EA_TYPE_GNOME_CALENDAR, ea_gnome_calendar, ea_gnome_calendar_new);
-
-static gboolean ea_calendar_focus_watcher (GSignalInvocationHint *ihint,
- guint n_param_values,
- const GValue *param_values,
- gpointer data);
-
-void
-gnome_calendar_a11y_init (void)
-{
- EA_SET_FACTORY (gnome_calendar_get_type(), ea_gnome_calendar);
- /* we only add focus watcher when accessibility is enabled
- */
- if (atk_get_root ())
- g_signal_add_emission_hook (g_signal_lookup ("event", E_TYPE_TEXT),
- 0, ea_calendar_focus_watcher,
- NULL, (GDestroyNotify) NULL);
-}
-
-void
-e_cal_view_a11y_init (void)
-{
- EA_SET_FACTORY (e_cal_view_get_type(), ea_cal_view);
- /* we only add focus watcher when accessibility is enabled
- */
-#if 0
- if (atk_get_root ())
- g_signal_add_emission_hook (g_signal_lookup ("selection_time_changed",
- e_cal_view_get_type ()),
- 0, ea_calendar_focus_watcher,
- NULL, (GDestroyNotify) NULL);
-#endif
-}
-
-void
-e_day_view_a11y_init (void)
-{
- EA_SET_FACTORY (e_day_view_get_type(), ea_day_view);
-}
-
-void
-e_week_view_a11y_init (void)
-{
- EA_SET_FACTORY (e_week_view_get_type(), ea_week_view);
-}
-
-gboolean
-ea_calendar_focus_watcher (GSignalInvocationHint *ihint,
- guint n_param_values,
- const GValue *param_values,
- gpointer data)
-{
- GObject *object;
- GdkEvent *event;
-
- object = g_value_get_object (param_values + 0);
- event = g_value_get_boxed (param_values + 1);
-
- if (E_IS_TEXT (object)) {
- /* "event" signal on canvas item
- */
- GnomeCanvasItem *canvas_item;
- AtkObject *ea_event;
-
- canvas_item = GNOME_CANVAS_ITEM (object);
- if (event->type == GDK_FOCUS_CHANGE) {
- if (event->focus_change.in)
- ea_event =
- ea_calendar_helpers_get_accessible_for (canvas_item);
- else
- /* focus out */
- ea_event = NULL;
- atk_focus_tracker_notify (ea_event);
-
- }
- }
-#if 0
- else if (E_IS_DAY_VIEW (object)) {
- /* "selection_time_changed" signal on day_view
- */
- if (ATK_IS_SELECTION (object)) {
- AtkSelection *atk_selection;
- AtkObject *atk_obj;
- atk_selection = ATK_SELECTION (object);
- atk_obj = atk_selection_ref_selection (atk_selection, 0);
-
-#ifdef ACC_DEBUG
- printf ("EvoAcc: ref a selection %p\n", atk_selection);
-#endif
- atk_focus_tracker_notify (atk_obj);
- }
- }
-#endif
- return TRUE;
-}
diff --git a/a11y/calendar/ea-calendar.h b/a11y/calendar/ea-calendar.h
deleted file mode 100644
index 61cdab1a89..0000000000
--- a/a11y/calendar/ea-calendar.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* vim:expandtab:shiftwidth=8:tabstop=8:
- */
-/* Evolution Accessibility: ea-calendar.h
- *
- * Copyright (C) 2003 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
- * 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.
- *
- * Author: Bolian Yin <bolian.yin@sun.com> Sun Microsystem Inc., 2003
- *
- */
-
-/* Evolution Accessibility
-*/
-
-#ifndef _EA_CALENDAR_H__
-#define _EA_CALENDAR_H__
-
-void gnome_calendar_a11y_init (void);
-void e_cal_view_a11y_init (void);
-void e_day_view_a11y_init (void);
-void e_week_view_a11y_init (void);
-
-#endif /* _EA_CALENDAR_H__ */
diff --git a/a11y/calendar/ea-day-view.c b/a11y/calendar/ea-day-view.c
deleted file mode 100644
index 65cfb31752..0000000000
--- a/a11y/calendar/ea-day-view.c
+++ /dev/null
@@ -1,245 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* vim:expandtab:shiftwidth=8:tabstop=8:
- */
-/* Evolution Accessibility: ea-day-view.c
- *
- * Copyright (C) 2003 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
- * 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.
- *
- * Author: Bolian Yin <bolian.yin@sun.com> Sun Microsystem Inc., 2003
- *
- */
-
-#include "ea-day-view.h"
-#include "ea-cal-view-event.h"
-
-#include "ea-calendar-helpers.h"
-#include "calendar-commands.h"
-#include <glib/gstrfuncs.h>
-
-static void ea_day_view_class_init (EaDayViewClass *klass);
-
-static G_CONST_RETURN gchar* ea_day_view_get_name (AtkObject *accessible);
-static G_CONST_RETURN gchar* ea_day_view_get_description (AtkObject *accessible);
-static gint ea_day_view_get_n_children (AtkObject *obj);
-static AtkObject* ea_day_view_ref_child (AtkObject *obj,
- gint i);
-static gpointer parent_class = NULL;
-
-GType
-ea_day_view_get_type (void)
-{
- static GType type = 0;
- AtkObjectFactory *factory;
- GTypeQuery query;
- GType derived_atk_type;
-
- if (!type) {
- static GTypeInfo tinfo = {
- sizeof (EaDayViewClass),
- (GBaseInitFunc) NULL, /* base init */
- (GBaseFinalizeFunc) NULL, /* base finalize */
- (GClassInitFunc) ea_day_view_class_init, /* class init */
- (GClassFinalizeFunc) NULL, /* class finalize */
- NULL, /* class data */
- sizeof (EaDayView), /* instance size */
- 0, /* nb preallocs */
- (GInstanceInitFunc) NULL, /* instance init */
- NULL /* value table */
- };
-
- /*
- * Figure out the size of the class and instance
- * we are run-time deriving from (EaCalView, in this case)
- *
- * Note: we must still use run-time deriving here, because
- * our parent class EaCalView is run-time deriving.
- */
-
- factory = atk_registry_get_factory (atk_get_default_registry (),
- e_cal_view_get_type());
- derived_atk_type = atk_object_factory_get_accessible_type (factory);
- g_type_query (derived_atk_type, &query);
-
- tinfo.class_size = query.class_size;
- tinfo.instance_size = query.instance_size;
-
- type = g_type_register_static (derived_atk_type,
- "EaDayView", &tinfo, 0);
- }
-
- return type;
-}
-
-static void
-ea_day_view_class_init (EaDayViewClass *klass)
-{
- AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
- class->get_name = ea_day_view_get_name;
- class->get_description = ea_day_view_get_description;
-
- class->get_n_children = ea_day_view_get_n_children;
- class->ref_child = ea_day_view_ref_child;
-}
-
-AtkObject*
-ea_day_view_new (GtkWidget *widget)
-{
- GObject *object;
- AtkObject *accessible;
-
- g_return_val_if_fail (E_IS_DAY_VIEW (widget), NULL);
-
- object = g_object_new (EA_TYPE_DAY_VIEW, NULL);
-
- accessible = ATK_OBJECT (object);
- atk_object_initialize (accessible, widget);
-
-#ifdef ACC_DEBUG
- printf ("EvoAcc: ea_day_view created %p\n", accessible);
-#endif
-
- return accessible;
-}
-
-static G_CONST_RETURN gchar*
-ea_day_view_get_name (AtkObject *accessible)
-{
- EDayView *day_view;
-
- g_return_val_if_fail (EA_IS_DAY_VIEW (accessible), NULL);
-
- if (!GTK_ACCESSIBLE (accessible)->widget)
- return NULL;
- day_view = E_DAY_VIEW (GTK_ACCESSIBLE (accessible)->widget);
-
- if (!accessible->name) {
- GnomeCalendar *gcal;
- const gchar *label_text;
- GnomeCalendarViewType view_type;
-
- gcal = e_cal_view_get_calendar (E_CAL_VIEW (day_view));
- label_text = calendar_get_text_for_folder_bar_label (gcal);
-
- view_type = gnome_calendar_get_view (gcal);
- if (view_type == GNOME_CAL_WORK_WEEK_VIEW)
- accessible->name = g_strconcat ("work week view :",
- label_text,
- NULL);
- else
- accessible->name = g_strconcat ("day view :",
- label_text, NULL);
- }
- return accessible->name;
-}
-
-static G_CONST_RETURN gchar*
-ea_day_view_get_description (AtkObject *accessible)
-{
- EDayView *day_view;
-
- g_return_val_if_fail (EA_IS_DAY_VIEW (accessible), NULL);
-
- if (!GTK_ACCESSIBLE (accessible)->widget)
- return NULL;
- day_view = E_DAY_VIEW (GTK_ACCESSIBLE (accessible)->widget);
-
- if (accessible->description)
- return accessible->description;
- else {
- GnomeCalendar *gcal;
- GnomeCalendarViewType view_type;
-
- gcal = e_cal_view_get_calendar (E_CAL_VIEW (day_view));
- view_type = gnome_calendar_get_view (gcal);
-
- if (view_type == GNOME_CAL_WORK_WEEK_VIEW)
- return "calendar view for a work week";
- else
- return "calendar view for one or more days";
- }
-}
-
-static gint
-ea_day_view_get_n_children (AtkObject *accessible)
-{
- EDayView *day_view;
- gint day;
- gint child_num = 0;
-
- g_return_val_if_fail (EA_IS_DAY_VIEW (accessible), -1);
-
- if (!GTK_ACCESSIBLE (accessible)->widget)
- return -1;
-
- day_view = E_DAY_VIEW (GTK_ACCESSIBLE (accessible)->widget);
-
- child_num += day_view->long_events->len;
-
- for (day = 0; day < day_view->days_shown; day++) {
- child_num += day_view->events[day]->len;
- }
-
- return child_num;
-}
-
-static AtkObject *
-ea_day_view_ref_child (AtkObject *accessible, gint index)
-{
- EDayView *day_view;
- gint child_num;
- gint day;
- AtkObject *atk_object = NULL;
- EDayViewEvent *event = NULL;
-
- g_return_val_if_fail (EA_IS_DAY_VIEW (accessible), NULL);
-
- child_num = atk_object_get_n_accessible_children (accessible);
- if (child_num <= 0 || index < 0 || index >= child_num)
- return NULL;
-
- if (!GTK_ACCESSIBLE (accessible)->widget)
- return NULL;
- day_view = E_DAY_VIEW (GTK_ACCESSIBLE (accessible)->widget);
-
- /* a long event */
- if (index < day_view->long_events->len) {
- event = &g_array_index (day_view->long_events,
- EDayViewEvent, index);
- }
- else {
- index -= day_view->long_events->len;
- day = 0;
- while (index >= day_view->events[day]->len) {
- index -= day_view->events[day]->len;
- ++day;
- }
-
- event = &g_array_index (day_view->events[day],
- EDayViewEvent, index);
- }
- if (event && event->canvas_item) {
- /* Not use atk_gobject_accessible_for_object here,
- * we need to do special thing here
- */
- atk_object = ea_calendar_helpers_get_accessible_for (event->canvas_item);
- g_object_ref (atk_object);
- }
- return atk_object;
-}
diff --git a/a11y/calendar/ea-day-view.h b/a11y/calendar/ea-day-view.h
deleted file mode 100644
index 5ca4614f03..0000000000
--- a/a11y/calendar/ea-day-view.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* vim:expandtab:shiftwidth=8:tabstop=8:
- */
-/* Evolution Accessibility: ea-day-view.h
- *
- * Copyright (C) 2003 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
- * 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.
- *
- * Author: Bolian Yin <bolian.yin@sun.com> Sun Microsystem Inc., 2003
- *
- */
-
-#ifndef __EA_DAY_VIEW_H__
-#define __EA_DAY_VIEW_H__
-
-#include "ea-cal-view.h"
-#include "e-day-view.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#define EA_TYPE_DAY_VIEW (ea_day_view_get_type ())
-#define EA_DAY_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EA_TYPE_DAY_VIEW, EaDayView))
-#define EA_DAY_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EA_TYPE_DAY_VIEW, EaDayViewClass))
-#define EA_IS_DAY_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EA_TYPE_DAY_VIEW))
-#define EA_IS_DAY_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EA_TYPE_DAY_VIEW))
-#define EA_DAY_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EA_TYPE_DAY_VIEW, EaDayViewClass))
-
-typedef struct _EaDayView EaDayView;
-typedef struct _EaDayViewClass EaDayViewClass;
-
-struct _EaDayView
-{
- EaCalView parent;
-};
-
-GType ea_day_view_get_type (void);
-
-struct _EaDayViewClass
-{
- EaCalViewClass parent_class;
-};
-
-AtkObject* ea_day_view_new (GtkWidget *widget);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __EA_DAY_VIEW_H__ */
diff --git a/a11y/calendar/ea-gnome-calendar.c b/a11y/calendar/ea-gnome-calendar.c
deleted file mode 100644
index 407b8ed95f..0000000000
--- a/a11y/calendar/ea-gnome-calendar.c
+++ /dev/null
@@ -1,248 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* vim:expandtab:shiftwidth=8:tabstop=8:
- */
-/* Evolution Accessibility: ea-gnome-calendar.c
- *
- * Copyright (C) 2003 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
- * 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.
- *
- * Author: Bolian Yin <bolian.yin@sun.com> Sun Microsystem Inc., 2003
- *
- */
-
-#include "ea-gnome-calendar.h"
-#include "calendar-commands.h"
-#include <gtk/gtknotebook.h>
-
-static void ea_gnome_calendar_class_init (EaGnomeCalendarClass *klass);
-
-static G_CONST_RETURN gchar* ea_gnome_calendar_get_name (AtkObject *accessible);
-static G_CONST_RETURN gchar* ea_gnome_calendar_get_description (AtkObject *accessible);
-static gint ea_gnome_calendar_get_n_children (AtkObject* obj);
-static AtkObject * ea_gnome_calendar_ref_child (AtkObject *obj, gint i);
-
-static void ea_gcal_switch_view_cb (GtkNotebook *widget, GtkNotebookPage *page,
- guint index, gpointer data);
-static void ea_gcal_dates_change_cb (GnomeCalendar *gcal, gpointer data);
-
-static gpointer parent_class = NULL;
-
-GType
-ea_gnome_calendar_get_type (void)
-{
- static GType type = 0;
- AtkObjectFactory *factory;
- GTypeQuery query;
- GType derived_atk_type;
-
- if (!type) {
- static GTypeInfo tinfo = {
- sizeof (EaGnomeCalendarClass),
- (GBaseInitFunc) NULL, /* base init */
- (GBaseFinalizeFunc) NULL, /* base finalize */
- (GClassInitFunc) ea_gnome_calendar_class_init, /* class init */
- (GClassFinalizeFunc) NULL, /* class finalize */
- NULL, /* class data */
- sizeof (EaGnomeCalendar), /* instance size */
- 0, /* nb preallocs */
- (GInstanceInitFunc) NULL, /* instance init */
- NULL /* value table */
- };
-
- /*
- * Figure out the size of the class and instance
- * we are run-time deriving from (GailWidget, in this case)
- */
-
- factory = atk_registry_get_factory (atk_get_default_registry (),
- GTK_TYPE_WIDGET);
- derived_atk_type = atk_object_factory_get_accessible_type (factory);
- g_type_query (derived_atk_type, &query);
- tinfo.class_size = query.class_size;
- tinfo.instance_size = query.instance_size;
-
- type = g_type_register_static (derived_atk_type,
- "EaGnomeCalendar", &tinfo, 0);
-
- }
-
- return type;
-}
-
-static void
-ea_gnome_calendar_class_init (EaGnomeCalendarClass *klass)
-{
- AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
- class->get_name = ea_gnome_calendar_get_name;
- class->get_description = ea_gnome_calendar_get_description;
-
- class->get_n_children = ea_gnome_calendar_get_n_children;
- class->ref_child = ea_gnome_calendar_ref_child;
-}
-
-AtkObject*
-ea_gnome_calendar_new (GtkWidget *widget)
-{
- GObject *object;
- AtkObject *accessible;
- GnomeCalendar *gcal;
- GtkWidget *notebook;
-
- g_return_val_if_fail (GNOME_IS_CALENDAR (widget), NULL);
-
- object = g_object_new (EA_TYPE_GNOME_CALENDAR, NULL);
-
- accessible = ATK_OBJECT (object);
- atk_object_initialize (accessible, widget);
-
- accessible->role = ATK_ROLE_FILLER;
-
- gcal = GNOME_CALENDAR (widget);
-
- /* listen on view type change
- */
- g_signal_connect (widget, "dates_shown_changed",
- G_CALLBACK (ea_gcal_dates_change_cb),
- accessible);
- notebook = gnome_calendar_get_view_notebook_widget (gcal);
- if (notebook) {
- g_signal_connect (notebook, "switch_page",
- G_CALLBACK (ea_gcal_switch_view_cb),
- accessible);
- }
-
-#ifdef ACC_DEBUG
- printf ("EvoAcc: ea-gnome-calendar created: %p\n", accessible);
-#endif
-
- return accessible;
-}
-
-static G_CONST_RETURN gchar*
-ea_gnome_calendar_get_name (AtkObject *accessible)
-{
- if (accessible->name)
- return accessible->name;
- return "Gnome Calendar";
-}
-
-static G_CONST_RETURN gchar*
-ea_gnome_calendar_get_description (AtkObject *accessible)
-{
- if (accessible->description)
- return accessible->description;
- return "Gnome Calendar";
-}
-
-static gint
-ea_gnome_calendar_get_n_children (AtkObject* obj)
-{
- g_return_val_if_fail (EA_IS_GNOME_CALENDAR (obj), 0);
-
- if (!GTK_ACCESSIBLE (obj)->widget)
- return -1;
- return 4;
-}
-
-static AtkObject *
-ea_gnome_calendar_ref_child (AtkObject *obj, gint i)
-{
- AtkObject * child = NULL;
- GnomeCalendar * calendarWidget;
- GtkWidget *childWidget;
-
- g_return_val_if_fail (EA_IS_GNOME_CALENDAR (obj), NULL);
- /* valid child index range is [0-3] */
- if (i < 0 || i >3 )
- return NULL;
-
- if (!GTK_ACCESSIBLE (obj)->widget)
- return NULL;
- calendarWidget = GNOME_CALENDAR (GTK_ACCESSIBLE (obj)->widget);
-
- switch (i) {
- case 0:
- /* for the search bar */
- childWidget = gnome_calendar_get_search_bar_widget (calendarWidget);
- child = gtk_widget_get_accessible (childWidget);
- atk_object_set_parent (child, obj);
- atk_object_set_name (child, "search bar");
- atk_object_set_description (child, "evolution calendar search bar");
- break;
- case 1:
- /* for the day/week view */
- childWidget = gnome_calendar_get_current_view_widget (calendarWidget);
- child = gtk_widget_get_accessible (childWidget);
- atk_object_set_parent (child, obj);
- break;
- case 2:
- /* for calendar */
- childWidget = gnome_calendar_get_e_calendar_widget (calendarWidget);
- child = gtk_widget_get_accessible (childWidget);
- break;
- case 3:
- /* for todo list */
- childWidget = GTK_WIDGET (gnome_calendar_get_task_pad (calendarWidget));
- child = gtk_widget_get_accessible (childWidget);
- break;
- default:
- break;
- }
- if (child)
- g_object_ref(child);
- return child;
-}
-
-static void
-ea_gcal_switch_view_cb (GtkNotebook *widget, GtkNotebookPage *page,
- guint index, gpointer data)
-{
- GtkWidget *new_widget;
-
- new_widget = gtk_notebook_get_nth_page (widget, index);
-
- /* views are always the second child in gnome calendar
- */
- if (new_widget)
- g_signal_emit_by_name (G_OBJECT(data), "children_changed::add",
- 1, gtk_widget_get_accessible (new_widget), NULL);
-
-#ifdef ACC_DEBUG
- printf ("AccDebug: view switch to widget %p (index=%d) \n",
- new_widget, index);
-#endif
-}
-
-static void
-ea_gcal_dates_change_cb (GnomeCalendar *gcal, gpointer data)
-{
- const gchar *new_name;
-
- g_return_if_fail (GNOME_IS_CALENDAR (gcal));
- g_return_if_fail (data);
- g_return_if_fail (EA_IS_GNOME_CALENDAR (data));
-
- new_name = calendar_get_text_for_folder_bar_label (gcal);
- atk_object_set_name (ATK_OBJECT(data), new_name);
- g_signal_emit_by_name (data, "visible_data_changed");
-
-#ifdef ACC_DEBUG
- printf ("AccDebug: calendar dates changed, label=%s\n", new_name);
-#endif
-}
diff --git a/a11y/calendar/ea-gnome-calendar.h b/a11y/calendar/ea-gnome-calendar.h
deleted file mode 100644
index 2cb39219c4..0000000000
--- a/a11y/calendar/ea-gnome-calendar.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* vim:expandtab:shiftwidth=8:tabstop=8:
- */
-/* Evolution Accessibility: ea-gnome-calendar.h
- *
- * Copyright (C) 2003 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
- * 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.
- *
- * Author: Bolian Yin <bolian.yin@sun.com> Sun Microsystem Inc., 2003
- *
- */
-
-#ifndef __EA_GNOME_CALENDAR_H__
-#define __EA_GNOME_CALENDAR_H__
-
-#include <gtk/gtkaccessible.h>
-#include "gnome-cal.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#define EA_TYPE_GNOME_CALENDAR (ea_gnome_calendar_get_type ())
-#define EA_GNOME_CALENDAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EA_TYPE_GNOME_CALENDAR, EaGnomeCalendar))
-#define EA_GNOME_CALENDAR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EA_TYPE_GNOME_CALENDAR, EaGnomeCalendarClass))
-#define EA_IS_GNOME_CALENDAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EA_TYPE_GNOME_CALENDAR))
-#define EA_IS_GNOME_CALENDAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EA_TYPE_GNOME_CALENDAR))
-#define EA_GNOME_CALENDAR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EA_TYPE_GNOME_CALENDAR, EaGnomeCalendarClass))
-
-typedef struct _EaGnomeCalendar EaGnomeCalendar;
-typedef struct _EaGnomeCalendarClass EaGnomeCalendarClass;
-
-struct _EaGnomeCalendar
-{
- GtkAccessible parent;
-};
-
-GType ea_gnome_calendar_get_type (void);
-
-struct _EaGnomeCalendarClass
-{
- GtkAccessibleClass parent_class;
-};
-
-AtkObject* ea_gnome_calendar_new (GtkWidget *widget);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __EA_GNOME_CALENDAR_H__ */
diff --git a/a11y/calendar/ea-week-view.c b/a11y/calendar/ea-week-view.c
deleted file mode 100644
index 9917d147d2..0000000000
--- a/a11y/calendar/ea-week-view.c
+++ /dev/null
@@ -1,235 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* vim:expandtab:shiftwidth=8:tabstop=8:
- */
-/* Evolution Accessibility: ea-week-view.c
- *
- * Copyright (C) 2003 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
- * 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.
- *
- * Author: Bolian Yin <bolian.yin@sun.com> Sun Microsystem Inc., 2003
- *
- */
-
-#include "ea-week-view.h"
-#include "ea-cal-view.h"
-#include "ea-cal-view-event.h"
-#include "ea-calendar-helpers.h"
-#include "calendar-commands.h"
-
-static void ea_week_view_class_init (EaWeekViewClass *klass);
-
-static G_CONST_RETURN gchar* ea_week_view_get_name (AtkObject *accessible);
-static G_CONST_RETURN gchar* ea_week_view_get_description (AtkObject *accessible);
-static gint ea_week_view_get_n_children (AtkObject *obj);
-static AtkObject* ea_week_view_ref_child (AtkObject *obj,
- gint i);
-
-static gpointer parent_class = NULL;
-
-GType
-ea_week_view_get_type (void)
-{
- static GType type = 0;
- AtkObjectFactory *factory;
- GTypeQuery query;
- GType derived_atk_type;
-
- if (!type) {
- static GTypeInfo tinfo = {
- sizeof (EaWeekViewClass),
- (GBaseInitFunc) NULL, /* base init */
- (GBaseFinalizeFunc) NULL, /* base finalize */
- (GClassInitFunc) ea_week_view_class_init, /* class init */
- (GClassFinalizeFunc) NULL, /* class finalize */
- NULL, /* class data */
- sizeof (EaWeekView), /* instance size */
- 0, /* nb preallocs */
- (GInstanceInitFunc) NULL, /* instance init */
- NULL /* value table */
- };
-
- /*
- * Figure out the size of the class and instance
- * we are run-time deriving from (EaCalView, in this case)
- *
- * Note: we must still use run-time deriving here, because
- * our parent class EaCalView is run-time deriving.
- */
-
- factory = atk_registry_get_factory (atk_get_default_registry (),
- e_cal_view_get_type());
- derived_atk_type = atk_object_factory_get_accessible_type (factory);
- g_type_query (derived_atk_type, &query);
-
- tinfo.class_size = query.class_size;
- tinfo.instance_size = query.instance_size;
-
- type = g_type_register_static (derived_atk_type,
- "EaWeekView", &tinfo, 0);
-
- }
-
- return type;
-}
-
-static void
-ea_week_view_class_init (EaWeekViewClass *klass)
-{
- AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
- class->get_name = ea_week_view_get_name;
- class->get_description = ea_week_view_get_description;
-
- class->get_n_children = ea_week_view_get_n_children;
- class->ref_child = ea_week_view_ref_child;
-}
-
-AtkObject*
-ea_week_view_new (GtkWidget *widget)
-{
- GObject *object;
- AtkObject *accessible;
-
- g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
-
- object = g_object_new (EA_TYPE_WEEK_VIEW, NULL);
-
- accessible = ATK_OBJECT (object);
- atk_object_initialize (accessible, widget);
-
-#ifdef ACC_DEBUG
- printf ("EvoAcc: ea_week_view created %p\n", accessible);
-#endif
-
- return accessible;
-}
-
-static G_CONST_RETURN gchar*
-ea_week_view_get_name (AtkObject *accessible)
-{
- EWeekView *week_view;
-
- g_return_val_if_fail (EA_IS_WEEK_VIEW (accessible), NULL);
-
- if (!GTK_ACCESSIBLE (accessible)->widget)
- return NULL;
- week_view = E_WEEK_VIEW (GTK_ACCESSIBLE (accessible)->widget);
-
- if (!accessible->name) {
- GnomeCalendar *gcal;
- const gchar *label_text;
- GnomeCalendarViewType view_type;
-
- gcal = e_cal_view_get_calendar (E_CAL_VIEW (week_view));
- label_text = calendar_get_text_for_folder_bar_label (gcal);
- view_type = gnome_calendar_get_view (gcal);
-
- view_type = gnome_calendar_get_view (gcal);
-
- if (view_type == GNOME_CAL_MONTH_VIEW)
- accessible->name = g_strconcat ("month view :",
- label_text,
- NULL);
-
-
- else
- accessible->name = g_strconcat ("week view :",
- label_text, NULL);
- }
- return accessible->name;
-}
-
-static G_CONST_RETURN gchar*
-ea_week_view_get_description (AtkObject *accessible)
-{
- EWeekView *week_view;
-
- g_return_val_if_fail (EA_IS_WEEK_VIEW (accessible), NULL);
-
- if (!GTK_ACCESSIBLE (accessible)->widget)
- return NULL;
- week_view = E_WEEK_VIEW (GTK_ACCESSIBLE (accessible)->widget);
-
- if (accessible->description)
- return accessible->description;
- else {
- GnomeCalendar *gcal;
- GnomeCalendarViewType view_type;
-
- gcal = e_cal_view_get_calendar (E_CAL_VIEW (week_view));
- view_type = gnome_calendar_get_view (gcal);
-
- if (view_type == GNOME_CAL_MONTH_VIEW)
- return "calendar view for a month";
- else
- return "calendar view for one or more weeks";
- }
-}
-
-static gint
-ea_week_view_get_n_children (AtkObject *accessible)
-{
- EWeekView *week_view;
-
- g_return_val_if_fail (EA_IS_WEEK_VIEW (accessible), -1);
-
- if (!GTK_ACCESSIBLE (accessible)->widget)
- return -1;
- week_view = E_WEEK_VIEW (GTK_ACCESSIBLE (accessible)->widget);
-
- return week_view->events->len;
-}
-
-static AtkObject *
-ea_week_view_ref_child (AtkObject *accessible, gint index)
-{
- EWeekView *week_view;
- gint child_num;
- AtkObject *atk_object = NULL;
- EWeekViewEvent *event;
- EWeekViewEventSpan *span;
- gint span_num = 0;
-
- g_return_val_if_fail (EA_IS_WEEK_VIEW (accessible), NULL);
-
- child_num = atk_object_get_n_accessible_children (accessible);
- if (child_num <= 0 || index < 0 || index >= child_num)
- return NULL;
-
- if (!GTK_ACCESSIBLE (accessible)->widget)
- return NULL;
- week_view = E_WEEK_VIEW (GTK_ACCESSIBLE (accessible)->widget);
-
- event = &g_array_index (week_view->events,
- EWeekViewEvent, index);
- span = &g_array_index (week_view->spans, EWeekViewEventSpan,
- event->spans_index + span_num);
-
- if (event) {
- /* Not use atk_gobject_accessible_for_object here,
- * we need to do special thing here
- */
- atk_object = ea_calendar_helpers_get_accessible_for (span->text_item);
- g_object_ref (atk_object);
- }
-#ifdef ACC_DEBUG
- printf ("EvoAcc: ea_week_view_ref_child [%d]=%p\n",
- index, atk_object);
-#endif
- return atk_object;
-}
diff --git a/a11y/calendar/ea-week-view.h b/a11y/calendar/ea-week-view.h
deleted file mode 100644
index f0ed117375..0000000000
--- a/a11y/calendar/ea-week-view.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* vim:expandtab:shiftwidth=8:tabstop=8:
- */
-/* Evolution Accessibility: ea-week-view.h
- *
- * Copyright (C) 2003 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
- * 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.
- *
- * Author: Bolian Yin <bolian.yin@sun.com> Sun Microsystem Inc., 2003
- *
- */
-
-#ifndef __EA_WEEK_VIEW_H__
-#define __EA_WEEK_VIEW_H__
-
-#include <gtk/gtkaccessible.h>
-#include "e-week-view.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#define EA_TYPE_WEEK_VIEW (ea_week_view_get_type ())
-#define EA_WEEK_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EA_TYPE_WEEK_VIEW, EaWeekView))
-#define EA_WEEK_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EA_TYPE_WEEK_VIEW, EaWeekViewClass))
-#define EA_IS_WEEK_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EA_TYPE_WEEK_VIEW))
-#define EA_IS_WEEK_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EA_TYPE_WEEK_VIEW))
-#define EA_WEEK_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EA_TYPE_WEEK_VIEW, EaWeekViewClass))
-
-typedef struct _EaWeekView EaWeekView;
-typedef struct _EaWeekViewClass EaWeekViewClass;
-
-struct _EaWeekView
-{
- GtkAccessible parent;
-};
-
-GType ea_week_view_get_type (void);
-
-struct _EaWeekViewClass
-{
- GtkAccessibleClass parent_class;
-};
-
-AtkObject* ea_week_view_new (GtkWidget *widget);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __EA_WEEK_VIEW_H__ */
diff --git a/a11y/e-table/.cvsignore b/a11y/e-table/.cvsignore
deleted file mode 100644
index 5b48d3f593..0000000000
--- a/a11y/e-table/.cvsignore
+++ /dev/null
@@ -1,4 +0,0 @@
-.libs
-Makefile.in
-Makefile
-*.la
diff --git a/a11y/e-table/gal-a11y-e-cell-registry.c b/a11y/e-table/gal-a11y-e-cell-registry.c
deleted file mode 100644
index 7110179554..0000000000
--- a/a11y/e-table/gal-a11y-e-cell-registry.c
+++ /dev/null
@@ -1,132 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors:
- * Christopher James Lahey <clahey@ximian.com>
- *
- * Copyright (C) 2002 Ximian, Inc.
- */
-
-#include <config.h>
-#include "gal-a11y-e-cell-registry.h"
-#include "gal-a11y-e-cell.h"
-
-static GObjectClass *parent_class;
-static GalA11yECellRegistry *default_registry;
-#define PARENT_TYPE (G_TYPE_OBJECT)
-
-struct _GalA11yECellRegistryPrivate {
- GHashTable *table;
-};
-
-/* Static functions */
-
-static void
-gal_a11y_e_cell_registry_finalize (GObject *obj)
-{
- GalA11yECellRegistry *registry = GAL_A11Y_E_CELL_REGISTRY (obj);
-
- g_hash_table_destroy (registry->priv->table);
- g_free (registry->priv);
-}
-
-static void
-gal_a11y_e_cell_registry_class_init (GalA11yECellRegistryClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- parent_class = g_type_class_ref (PARENT_TYPE);
-
- object_class->finalize = gal_a11y_e_cell_registry_finalize;
-}
-
-static void
-gal_a11y_e_cell_registry_init (GalA11yECellRegistry *registry)
-{
- registry->priv = g_new (GalA11yECellRegistryPrivate, 1);
- registry->priv->table = g_hash_table_new (NULL, NULL);
-}
-
-/**
- * gal_a11y_e_cell_registry_get_type:
- * @void:
- *
- * Registers the &GalA11yECellRegistry class if necessary, and returns the type ID
- * associated to it.
- *
- * Return value: The type ID of the &GalA11yECellRegistry class.
- **/
-GType
-gal_a11y_e_cell_registry_get_type (void)
-{
- static GType type = 0;
-
- if (!type) {
- GTypeInfo info = {
- sizeof (GalA11yECellRegistryClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) gal_a11y_e_cell_registry_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (GalA11yECellRegistry),
- 0,
- (GInstanceInitFunc) gal_a11y_e_cell_registry_init,
- NULL /* value_cell */
- };
-
- type = g_type_register_static (PARENT_TYPE, "GalA11yECellRegistry", &info, 0);
- }
-
- return type;
-}
-
-static void
-init_default_registry (void)
-{
- if (default_registry == NULL) {
- default_registry = g_object_new (gal_a11y_e_cell_registry_get_type(), NULL);
- }
-}
-
-
-AtkObject *
-gal_a11y_e_cell_registry_get_object (GalA11yECellRegistry *registry,
- ETableItem *item,
- ECellView *cell_view,
- AtkObject *parent,
- int model_col,
- int view_col,
- int row)
-{
- GalA11yECellRegistryFunc func = NULL;
- GType type;
-
- if (registry == NULL) {
- init_default_registry ();
- registry = default_registry;
- }
-
- type = GTK_OBJECT_TYPE (cell_view->ecell);
- while (func == NULL && type != 0) {
- func = g_hash_table_lookup (registry->priv->table, GINT_TO_POINTER (type));
- type = g_type_parent (type);
- }
-
- if (func)
- return func (item, cell_view, parent, model_col, view_col, row);
- else
- return gal_a11y_e_cell_new (item, cell_view, parent, model_col, view_col, row);
-}
-
-void
-gal_a11y_e_cell_registry_add_cell_type (GalA11yECellRegistry *registry,
- GType type,
- GalA11yECellRegistryFunc func)
-{
- if (registry == NULL) {
- init_default_registry ();
- registry = default_registry;
- }
-
- g_hash_table_insert (registry->priv->table, GINT_TO_POINTER (type), func);
-}
diff --git a/a11y/e-table/gal-a11y-e-cell-registry.h b/a11y/e-table/gal-a11y-e-cell-registry.h
deleted file mode 100644
index eecd41139c..0000000000
--- a/a11y/e-table/gal-a11y-e-cell-registry.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors:
- * Christopher James Lahey <clahey@ximian.com>
- *
- * Copyright (C) 2001 Chris Lahey
- */
-
-#ifndef __GAL_A11Y_E_CELL_REGISTRY_H__
-#define __GAL_A11Y_E_CELL_REGISTRY_H__
-
-#include <glib-object.h>
-#include <atk/atkobject.h>
-#include <gal/e-table/e-table-item.h>
-#include <gal/e-table/e-cell.h>
-
-#define GAL_A11Y_TYPE_E_CELL_REGISTRY (gal_a11y_e_cell_registry_get_type ())
-#define GAL_A11Y_E_CELL_REGISTRY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAL_A11Y_TYPE_E_CELL_REGISTRY, GalA11yECellRegistry))
-#define GAL_A11Y_E_CELL_REGISTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAL_A11Y_TYPE_E_CELL_REGISTRY, GalA11yECellRegistryClass))
-#define GAL_A11Y_IS_E_CELL_REGISTRY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAL_A11Y_TYPE_E_CELL_REGISTRY))
-#define GAL_A11Y_IS_E_CELL_REGISTRY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAL_A11Y_TYPE_E_CELL_REGISTRY))
-
-typedef struct _GalA11yECellRegistry GalA11yECellRegistry;
-typedef struct _GalA11yECellRegistryClass GalA11yECellRegistryClass;
-typedef struct _GalA11yECellRegistryPrivate GalA11yECellRegistryPrivate;
-
-typedef AtkObject *(*GalA11yECellRegistryFunc) (ETableItem *item,
- ECellView *cell_view,
- AtkObject *parent,
- int model_col,
- int view_col,
- int row);
-
-struct _GalA11yECellRegistry {
- GObject object;
-
- GalA11yECellRegistryPrivate *priv;
-};
-
-struct _GalA11yECellRegistryClass {
- GObjectClass parent_class;
-};
-
-
-/* Standard Glib function */
-GType gal_a11y_e_cell_registry_get_type (void);
-AtkObject *gal_a11y_e_cell_registry_get_object (GalA11yECellRegistry *registry,
- ETableItem *item,
- ECellView *cell_view,
- AtkObject *parent,
- int model_col,
- int view_col,
- int row);
-void gal_a11y_e_cell_registry_add_cell_type (GalA11yECellRegistry *registry,
- GType type,
- GalA11yECellRegistryFunc func);
-
-#endif /* ! __GAL_A11Y_E_CELL_REGISTRY_H__ */
diff --git a/a11y/e-table/gal-a11y-e-cell-text.c b/a11y/e-table/gal-a11y-e-cell-text.c
deleted file mode 100644
index c5a94144a8..0000000000
--- a/a11y/e-table/gal-a11y-e-cell-text.c
+++ /dev/null
@@ -1,486 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors:
- * Christopher James Lahey <clahey@ximian.com>
- *
- * Copyright (C) 2002 Ximian, Inc.
- */
-
-#include <config.h>
-#include "gal-a11y-e-cell-text.h"
-#include "gal-a11y-util.h"
-#include <gal/e-table/e-cell-text.h>
-#include <atk/atkobject.h>
-#include <atk/atktext.h>
-#include <atk/atkeditabletext.h>
-
-#define CS_CLASS(a11y) (G_TYPE_INSTANCE_GET_CLASS ((a11y), C_TYPE_STREAM, GalA11yECellTextClass))
-static AtkObjectClass *parent_class;
-#define PARENT_TYPE (gal_a11y_e_cell_get_type ())
-
-/* XXX: these functions are undefined */
-#define e_cell_text_get_selection(a,b,c,d,e) NULL
-#define e_cell_text_set_selection(a,b,c,d,e) FALSE
-
-/* Static functions */
-static gchar *
-ect_get_text (AtkText *text,
- gint start_offset,
- gint end_offset)
-{
- GalA11yECell *gaec = GAL_A11Y_E_CELL (text);
- ECellText *ect = E_CELL_TEXT (gaec->cell_view->ecell);
- char *ret_val;
- char *full_text =
- e_cell_text_get_text (ect, gaec->item->table_model, gaec->model_col, gaec->row);
-
- if (end_offset == -1)
- end_offset = strlen (full_text);
- else
- end_offset = g_utf8_offset_to_pointer (full_text, end_offset) - full_text;
-
- start_offset = g_utf8_offset_to_pointer (full_text, start_offset) - full_text;
-
- ret_val = g_strndup (full_text + start_offset, end_offset - start_offset);
-
- e_cell_text_free_text (ect, full_text);
-
- return ret_val;
-}
-
-static gchar *
-ect_get_text_after_offset (AtkText *text,
- gint offset,
- AtkTextBoundary boundary_type,
- gint *start_offset,
- gint *end_offset)
-{
- /* Unimplemented */
- return NULL;
-}
-
-static gchar *
-ect_get_text_at_offset (AtkText *text,
- gint offset,
- AtkTextBoundary boundary_type,
- gint *start_offset,
- gint *end_offset)
-{
- /* Unimplemented */
- return NULL;
-}
-
-static gunichar
-ect_get_character_at_offset (AtkText *text,
- gint offset)
-{
- GalA11yECell *gaec = GAL_A11Y_E_CELL (text);
- ECellText *ect = E_CELL_TEXT (gaec->cell_view->ecell);
- gunichar ret_val;
- char *full_text;
- char *at_offset;
-
- full_text = e_cell_text_get_text (ect, gaec->item->table_model, gaec->model_col, gaec->row);
- at_offset = g_utf8_offset_to_pointer (full_text, offset);
- ret_val = g_utf8_get_char_validated (at_offset, -1);
- e_cell_text_free_text (ect, full_text);
-
- return ret_val;
-}
-
-
-static gchar*
-ect_get_text_before_offset (AtkText *text,
- gint offset,
- AtkTextBoundary boundary_type,
- gint *start_offset,
- gint *end_offset)
-{
- /* Unimplemented */
- return NULL;
-}
-
-
-static gint
-ect_get_caret_offset (AtkText *text)
-{
- GalA11yECell *gaec = GAL_A11Y_E_CELL (text);
- int start, end;
- if (e_cell_text_get_selection (gaec->cell_view,
- gaec->view_col, gaec->row,
- &start, &end)
- && start == end) {
- char *full_text;
- int ret_val;
- ECellText *ect = E_CELL_TEXT (gaec->cell_view->ecell);
-
- full_text = e_cell_text_get_text (ect, gaec->item->table_model, gaec->model_col, gaec->row);
- ret_val = g_utf8_pointer_to_offset (full_text, full_text + start);
- e_cell_text_free_text (ect, full_text);
-
- return ret_val;
- } else {
- return -1;
- }
-}
-
-
-static AtkAttributeSet*
-ect_get_run_attributes (AtkText *text,
- gint offset,
- gint *start_offset,
- gint *end_offset)
-{
- /* Unimplemented */
- return NULL;
-}
-
-
-static AtkAttributeSet*
-ect_get_default_attributes (AtkText *text)
-{
- /* Unimplemented */
- return NULL;
-}
-
-
-static void
-ect_get_character_extents (AtkText *text,
- gint offset,
- gint *x,
- gint *y,
- gint *width,
- gint *height,
- AtkCoordType coords)
-{
- /* Unimplemented */
-}
-
-
-static gint
-ect_get_character_count (AtkText *text)
-{
- GalA11yECell *gaec = GAL_A11Y_E_CELL (text);
- ECellText *ect = E_CELL_TEXT (gaec->cell_view->ecell);
- int ret_val;
-
- char *full_text = e_cell_text_get_text (ect, gaec->item->table_model, gaec->model_col, gaec->row);
-
- ret_val = g_utf8_strlen (full_text, -1);
- e_cell_text_free_text (ect, full_text);
- return ret_val;
-}
-
-
-static gint
-ect_get_offset_at_point (AtkText *text,
- gint x,
- gint y,
- AtkCoordType coords)
-{
- /* Unimplemented */
- return 0;
-}
-
-
-static gint
-ect_get_n_selections (AtkText *text)
-{
- GalA11yECell *gaec = GAL_A11Y_E_CELL (text);
- int selection_start, selection_end;
- if (e_cell_text_get_selection (gaec->cell_view,
- gaec->view_col, gaec->row,
- &selection_start,
- &selection_end) &&
- selection_start != selection_end)
- return 1;
- return 0;
-}
-
-
-static gchar*
-ect_get_selection (AtkText *text,
- gint selection_num,
- gint *start_offset,
- gint *end_offset)
-{
- GalA11yECell *gaec = GAL_A11Y_E_CELL (text);
- ECellText *ect = E_CELL_TEXT (gaec->cell_view->ecell);
- int selection_start, selection_end;
- if (selection_num == 0 &&
- e_cell_text_get_selection (gaec->cell_view,
- gaec->view_col, gaec->row,
- &selection_start,
- &selection_end) &&
- selection_start != selection_end) {
- char *ret_val;
- char *full_text =
- e_cell_text_get_text (ect, gaec->item->table_model, gaec->model_col, gaec->row);
-
- ret_val = g_strndup (full_text + selection_start, selection_end - selection_start);
-
- if (start_offset)
- *start_offset = g_utf8_pointer_to_offset (full_text, full_text + selection_start);
- if (end_offset)
- *end_offset = g_utf8_pointer_to_offset (full_text, full_text + selection_end);
-
- e_cell_text_free_text (ect, full_text);
-
- return ret_val;
- }
- return NULL;
-}
-
-
-static gboolean
-ect_add_selection (AtkText *text,
- gint start_offset,
- gint end_offset)
-{
- GalA11yECell *gaec = GAL_A11Y_E_CELL (text);
- ECellText *ect = E_CELL_TEXT (gaec->cell_view->ecell);
- int selection_start, selection_end;
- if (e_cell_text_get_selection (gaec->cell_view,
- gaec->view_col, gaec->row,
- &selection_start,
- &selection_end) &&
- selection_start == selection_end &&
- start_offset != end_offset) {
- char *full_text;
-
- full_text = e_cell_text_get_text (ect, gaec->item->table_model, gaec->model_col, gaec->row);
- start_offset = g_utf8_offset_to_pointer (full_text, start_offset) - full_text;
- end_offset = g_utf8_offset_to_pointer (full_text, end_offset) - full_text;
- e_cell_text_free_text (ect, full_text);
-
- return e_cell_text_set_selection (gaec->cell_view,
- gaec->view_col, gaec->row,
- start_offset, end_offset);
- }
- return FALSE;
-}
-
-
-static gboolean
-ect_remove_selection (AtkText *text,
- gint selection_num)
-{
- /* Unimplemented */
- return FALSE;
-}
-
-
-static gboolean
-ect_set_selection (AtkText *text,
- gint selection_num,
- gint start_offset,
- gint end_offset)
-{
- /* Unimplemented */
- return FALSE;
-}
-
-
-static gboolean
-ect_set_caret_offset (AtkText *text,
- gint offset)
-{
- GalA11yECell *gaec = GAL_A11Y_E_CELL (text);
- ECellText *ect = E_CELL_TEXT (gaec->cell_view->ecell);
- char *full_text;
-
- full_text = e_cell_text_get_text (ect, gaec->item->table_model, gaec->model_col, gaec->row);
- offset = g_utf8_offset_to_pointer (full_text, offset) - full_text;
- e_cell_text_free_text (ect, full_text);
-
- return e_cell_text_set_selection (gaec->cell_view,
- gaec->view_col, gaec->row,
- offset, offset);
-}
-
-static gboolean
-ect_set_run_attributes (AtkEditableText *text,
- AtkAttributeSet *attrib_set,
- gint start_offset,
- gint end_offset)
-{
- /* Unimplemented */
- return FALSE;
-}
-
-static void
-ect_set_text_contents (AtkEditableText *text,
- const gchar *string)
-{
- GalA11yECell *gaec = GAL_A11Y_E_CELL (text);
- ECellText *ect = E_CELL_TEXT (gaec->cell_view->ecell);
-
- e_cell_text_set_value (ect, gaec->item->table_model, gaec->model_col, gaec->row, string);
-}
-
-static void
-ect_insert_text (AtkEditableText *text,
- const gchar *string,
- gint length,
- gint *position)
-{
- /* Utf8 unimplemented */
- GalA11yECell *gaec = GAL_A11Y_E_CELL (text);
- ECellText *ect = E_CELL_TEXT (gaec->cell_view->ecell);
-
- char *full_text = e_cell_text_get_text (ect, gaec->item->table_model, gaec->model_col, gaec->row);
- char *result = g_strdup_printf ("%.*s%.*s%s", *position, full_text, length, string, full_text + *position);
-
- e_cell_text_set_value (ect, gaec->item->table_model, gaec->model_col, gaec->row, result);
-
- *position += length;
-
- g_free (result);
- e_cell_text_free_text (ect, full_text);
-}
-
-static void
-ect_copy_text (AtkEditableText *text,
- gint start_pos,
- gint end_pos)
-{
- /* Unimplemented */
-}
-
-static void
-ect_cut_text (AtkEditableText *text,
- gint start_pos,
- gint end_pos)
-{
- /* Unimplemented */
-}
-
-static void
-ect_delete_text (AtkEditableText *text,
- gint start_pos,
- gint end_pos)
-{
- /* Unimplemented */
-}
-
-static void
-ect_paste_text (AtkEditableText *text,
- gint position)
-{
- /* Unimplemented */
-}
-
-
-static void
-ect_atk_text_iface_init (AtkTextIface *iface)
-{
- iface->get_text = ect_get_text;
- iface->get_text_after_offset = ect_get_text_after_offset;
- iface->get_text_at_offset = ect_get_text_at_offset;
- iface->get_character_at_offset = ect_get_character_at_offset;
- iface->get_text_before_offset = ect_get_text_before_offset;
- iface->get_caret_offset = ect_get_caret_offset;
- iface->get_run_attributes = ect_get_run_attributes;
- iface->get_default_attributes = ect_get_default_attributes;
- iface->get_character_extents = ect_get_character_extents;
- iface->get_character_count = ect_get_character_count;
- iface->get_offset_at_point = ect_get_offset_at_point;
- iface->get_n_selections = ect_get_n_selections;
- iface->get_selection = ect_get_selection;
- iface->add_selection = ect_add_selection;
- iface->remove_selection = ect_remove_selection;
- iface->set_selection = ect_set_selection;
- iface->set_caret_offset = ect_set_caret_offset;
-}
-
-static void
-ect_atk_editable_text_iface_init (AtkEditableTextIface *iface)
-{
- iface->set_run_attributes = ect_set_run_attributes;
- iface->set_text_contents = ect_set_text_contents;
- iface->insert_text = ect_insert_text;
- iface->copy_text = ect_copy_text;
- iface->cut_text = ect_cut_text;
- iface->delete_text = ect_delete_text;
- iface->paste_text = ect_paste_text;
-}
-
-static void
-ect_class_init (GalA11yECellTextClass *klass)
-{
- parent_class = g_type_class_ref (PARENT_TYPE);
-}
-
-static void
-ect_init (GalA11yECellText *a11y)
-{
-}
-
-/**
- * gal_a11y_e_cell_text_get_type:
- * @void:
- *
- * Registers the &GalA11yECellText class if necessary, and returns the type ID
- * associated to it.
- *
- * Return value: The type ID of the &GalA11yECellText class.
- **/
-GType
-gal_a11y_e_cell_text_get_type (void)
-{
- static GType type = 0;
-
- if (!type) {
- GTypeInfo info = {
- sizeof (GalA11yECellTextClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) ect_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (GalA11yECellText),
- 0,
- (GInstanceInitFunc) ect_init,
- NULL /* value_cell_text */
- };
-
- static const GInterfaceInfo atk_text_info = {
- (GInterfaceInitFunc) ect_atk_text_iface_init,
- (GInterfaceFinalizeFunc) NULL,
- NULL
- };
-
- static const GInterfaceInfo atk_editable_text_info = {
- (GInterfaceInitFunc) ect_atk_editable_text_iface_init,
- (GInterfaceFinalizeFunc) NULL,
- NULL
- };
-
- type = g_type_register_static (PARENT_TYPE, "GalA11yECellText", &info, 0);
- g_type_add_interface_static (type, ATK_TYPE_TEXT, &atk_text_info);
- g_type_add_interface_static (type, ATK_TYPE_EDITABLE_TEXT, &atk_editable_text_info);
- }
-
- return type;
-}
-AtkObject *
-gal_a11y_e_cell_text_new (ETableItem *item,
- ECellView *cell_view,
- AtkObject *parent,
- int model_col,
- int view_col,
- int row)
-{
- AtkObject *a11y;
-
- a11y = g_object_new (gal_a11y_e_cell_text_get_type (), NULL);
-
- gal_a11y_e_cell_construct (a11y,
- item,
- cell_view,
- parent,
- model_col,
- view_col,
- row);
- return a11y;
-}
diff --git a/a11y/e-table/gal-a11y-e-cell-text.h b/a11y/e-table/gal-a11y-e-cell-text.h
deleted file mode 100644
index 3d9a4447be..0000000000
--- a/a11y/e-table/gal-a11y-e-cell-text.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors:
- * Christopher James Lahey <clahey@ximian.com>
- *
- * Copyright (C) 2001 Chris Lahey
- */
-
-#ifndef __GAL_A11Y_E_CELL_TEXT_H__
-#define __GAL_A11Y_E_CELL_TEXT_H__
-
-#include <glib-object.h>
-#include <gal/e-table/e-table-item.h>
-#include <gal/e-table/e-cell-text.h>
-#include <a11y/e-table/gal-a11y-e-cell.h>
-
-#define GAL_A11Y_TYPE_E_CELL_TEXT (gal_a11y_e_cell_text_get_type ())
-#define GAL_A11Y_E_CELL_TEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAL_A11Y_TYPE_E_CELL_TEXT, GalA11yECellText))
-#define GAL_A11Y_E_CELL_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAL_A11Y_TYPE_E_CELL_TEXT, GalA11yECellTextClass))
-#define GAL_A11Y_IS_E_CELL_TEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAL_A11Y_TYPE_E_CELL_TEXT))
-#define GAL_A11Y_IS_E_CELL_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAL_A11Y_TYPE_E_CELL_TEXT))
-
-typedef struct _GalA11yECellText GalA11yECellText;
-typedef struct _GalA11yECellTextClass GalA11yECellTextClass;
-typedef struct _GalA11yECellTextPrivate GalA11yECellTextPrivate;
-
-/* This struct should actually be larger as this isn't what we derive from.
- * The GalA11yECellTextPrivate comes right after the parent class structure.
- **/
-struct _GalA11yECellText {
- GalA11yECell object;
-};
-
-struct _GalA11yECellTextClass {
- GalA11yECellClass parent_class;
-};
-
-
-/* Standard Glib function */
-GType gal_a11y_e_cell_text_get_type (void);
-AtkObject *gal_a11y_e_cell_text_new (ETableItem *item,
- ECellView *cell_view,
- AtkObject *parent,
- int model_col,
- int view_col,
- int row);
-
-#endif /* ! __GAL_A11Y_E_CELL_TEXT_H__ */
diff --git a/a11y/e-table/gal-a11y-e-cell.c b/a11y/e-table/gal-a11y-e-cell.c
deleted file mode 100644
index ceac5d5817..0000000000
--- a/a11y/e-table/gal-a11y-e-cell.c
+++ /dev/null
@@ -1,239 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors:
- * Christopher James Lahey <clahey@ximian.com>
- *
- * Copyright (C) 2002 Ximian, Inc.
- */
-
-#include <config.h>
-#include "gal-a11y-e-cell.h"
-#include "gal-a11y-util.h"
-#include <atk/atkobject.h>
-#include <atk/atkcomponent.h>
-
-#define CS_CLASS(a11y) (G_TYPE_INSTANCE_GET_CLASS ((a11y), C_TYPE_STREAM, GalA11yECellClass))
-static GObjectClass *parent_class;
-#define PARENT_TYPE (atk_object_get_type ())
-
-
-#if 0
-static void
-unref_item (gpointer user_data, GObject *obj_loc)
-{
- GalA11yECell *a11y = GAL_A11Y_E_CELL (user_data);
- a11y->item = NULL;
- g_object_unref (a11y);
-}
-
-static void
-unref_cell (gpointer user_data, GObject *obj_loc)
-{
- GalA11yECell *a11y = GAL_A11Y_E_CELL (user_data);
- a11y->cell_view = NULL;
- g_object_unref (a11y);
-}
-#endif
-
-static void
-eti_dispose (GObject *object)
-{
- GalA11yECell *a11y = GAL_A11Y_E_CELL (object);
-
-#if 0
- if (a11y->item)
- g_object_unref (G_OBJECT (a11y->item)); /*, unref_item, a11y); */
- if (a11y->cell_view)
- g_object_unref (G_OBJECT (a11y->cell_view)); /*, unref_cell, a11y); */
- if (a11y->parent)
- g_object_unref (a11y->parent);
-#endif
- a11y->item = NULL;
- a11y->cell_view = NULL;
- a11y->parent = NULL;
- a11y->model_col = -1;
- a11y->view_col = -1;
- a11y->row = -1;
-
- if (parent_class->dispose)
- parent_class->dispose (object);
-}
-
-/* Static functions */
-static AtkObject*
-eti_get_parent (AtkObject *accessible)
-{
- GalA11yECell *a11y = GAL_A11Y_E_CELL (accessible);
- return a11y->parent;
-}
-
-static gint
-eti_get_index_in_parent (AtkObject *accessible)
-{
- GalA11yECell *a11y = GAL_A11Y_E_CELL (accessible);
-
- return a11y->row * a11y->item->cols + a11y->view_col;
-}
-
-
-/* Component IFace */
-static void
-eti_get_extents (AtkComponent *component,
- gint *x,
- gint *y,
- gint *width,
- gint *height,
- AtkCoordType coord_type)
-{
- GalA11yECell *a11y = GAL_A11Y_E_CELL (component);
- int row;
- int col;
- int xval;
- int yval;
-
- row = a11y->row;
- col = a11y->view_col;
-
-
- e_table_item_get_cell_geometry (a11y->item,
- &row,
- &col,
- &xval,
- &yval,
- width,
- height);
-
- atk_component_get_position (ATK_COMPONENT (a11y->parent),
- x, y, coord_type);
- if (x && *x != G_MININT)
- *x += xval;
- if (y && *y != G_MININT)
- *y += yval;
-}
-
-/* Table IFace */
-
-static void
-eti_atk_component_iface_init (AtkComponentIface *iface)
-{
- iface->get_extents = eti_get_extents;
-}
-
-static void
-eti_class_init (GalA11yECellClass *klass)
-{
- AtkObjectClass *atk_object_class = ATK_OBJECT_CLASS (klass);
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- parent_class = g_type_class_ref (PARENT_TYPE);
-
- object_class->dispose = eti_dispose;
-
- atk_object_class->get_parent = eti_get_parent;
- atk_object_class->get_index_in_parent = eti_get_index_in_parent;
-}
-
-static void
-eti_init (GalA11yECell *a11y)
-{
- a11y->item = NULL;
- a11y->cell_view = NULL;
- a11y->parent = NULL;
- a11y->model_col = -1;
- a11y->view_col = -1;
- a11y->row = -1;
-}
-
-/**
- * gal_a11y_e_cell_get_type:
- * @void:
- *
- * Registers the &GalA11yECell class if necessary, and returns the type ID
- * associated to it.
- *
- * Return value: The type ID of the &GalA11yECell class.
- **/
-GType
-gal_a11y_e_cell_get_type (void)
-{
- static GType type = 0;
-
- if (!type) {
- GTypeInfo info = {
- sizeof (GalA11yECellClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) eti_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (GalA11yECell),
- 0,
- (GInstanceInitFunc) eti_init,
- NULL /* value_cell */
- };
-
- static const GInterfaceInfo atk_component_info = {
- (GInterfaceInitFunc) eti_atk_component_iface_init,
- (GInterfaceFinalizeFunc) NULL,
- NULL
- };
-
- type = g_type_register_static (PARENT_TYPE, "GalA11yECell", &info, 0);
- g_type_add_interface_static (type, ATK_TYPE_COMPONENT, &atk_component_info);
- }
-
- return type;
-}
-AtkObject *
-gal_a11y_e_cell_new (ETableItem *item,
- ECellView *cell_view,
- AtkObject *parent,
- int model_col,
- int view_col,
- int row)
-{
- AtkObject *a11y;
-
- a11y = g_object_new (gal_a11y_e_cell_get_type (), NULL);
-
- gal_a11y_e_cell_construct (a11y,
- item,
- cell_view,
- parent,
- model_col,
- view_col,
- row);
- return a11y;
-}
-
-void
-gal_a11y_e_cell_construct (AtkObject *object,
- ETableItem *item,
- ECellView *cell_view,
- AtkObject *parent,
- int model_col,
- int view_col,
- int row)
-{
- GalA11yECell *a11y = GAL_A11Y_E_CELL (object);
- a11y->item = item;
- a11y->cell_view = cell_view;
- a11y->parent = parent;
- a11y->model_col = model_col;
- a11y->view_col = view_col;
- a11y->row = row;
-
-#if 0
- if (parent)
- g_object_ref (parent);
-
- if (item)
- g_object_ref (G_OBJECT (item)); /*,
- unref_item,
- a11y);*/
- if (cell_view)
- g_object_ref (G_OBJECT (cell_view)); /*,
- unref_cell,
- a11y);*/
-#endif
-}
diff --git a/a11y/e-table/gal-a11y-e-cell.h b/a11y/e-table/gal-a11y-e-cell.h
deleted file mode 100644
index ff9e5162d8..0000000000
--- a/a11y/e-table/gal-a11y-e-cell.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors:
- * Christopher James Lahey <clahey@ximian.com>
- *
- * Copyright (C) 2001 Chris Lahey
- */
-
-#ifndef __GAL_A11Y_E_CELL_H__
-#define __GAL_A11Y_E_CELL_H__
-
-#include <glib-object.h>
-#include <gal/e-table/e-table-item.h>
-#include <gal/e-table/e-cell.h>
-
-#define GAL_A11Y_TYPE_E_CELL (gal_a11y_e_cell_get_type ())
-#define GAL_A11Y_E_CELL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAL_A11Y_TYPE_E_CELL, GalA11yECell))
-#define GAL_A11Y_E_CELL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAL_A11Y_TYPE_E_CELL, GalA11yECellClass))
-#define GAL_A11Y_IS_E_CELL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAL_A11Y_TYPE_E_CELL))
-#define GAL_A11Y_IS_E_CELL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAL_A11Y_TYPE_E_CELL))
-
-typedef struct _GalA11yECell GalA11yECell;
-typedef struct _GalA11yECellClass GalA11yECellClass;
-typedef struct _GalA11yECellPrivate GalA11yECellPrivate;
-
-/* This struct should actually be larger as this isn't what we derive from.
- * The GalA11yECellPrivate comes right after the parent class structure.
- **/
-struct _GalA11yECell {
- AtkObject object;
-
- ETableItem *item;
- ECellView *cell_view;
- AtkObject *parent;
- int model_col;
- int view_col;
- int row;
-};
-
-struct _GalA11yECellClass {
- AtkObjectClass parent_class;
-};
-
-
-/* Standard Glib function */
-GType gal_a11y_e_cell_get_type (void);
-AtkObject *gal_a11y_e_cell_new (ETableItem *item,
- ECellView *cell_view,
- AtkObject *parent,
- int model_col,
- int view_col,
- int row);
-void gal_a11y_e_cell_construct (AtkObject *object,
- ETableItem *item,
- ECellView *cell_view,
- AtkObject *parent,
- int model_col,
- int view_col,
- int row);
-
-#endif /* ! __GAL_A11Y_E_CELL_H__ */
diff --git a/a11y/e-table/gal-a11y-e-table-factory.c b/a11y/e-table/gal-a11y-e-table-factory.c
deleted file mode 100644
index 14eaca3d19..0000000000
--- a/a11y/e-table/gal-a11y-e-table-factory.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors:
- * Christopher James Lahey <clahey@ximian.com>
- *
- * Copyright (C) 2002 Ximian, Inc.
- */
-
-#include <config.h>
-#include "gal-a11y-e-table-factory.h"
-#include "gal-a11y-e-table.h"
-
-#define CS_CLASS(factory) (G_TYPE_INSTANCE_GET_CLASS ((factory), C_TYPE_STREAM, GalA11yETableFactoryClass))
-static AtkObjectFactoryClass *parent_class;
-#define PARENT_TYPE (ATK_TYPE_OBJECT_FACTORY)
-
-/* Static functions */
-
-static GType
-gal_a11y_e_table_factory_get_accessible_type (void)
-{
- return GAL_A11Y_TYPE_E_TABLE;
-}
-
-static AtkObject*
-gal_a11y_e_table_factory_create_accessible (GObject *obj)
-{
- AtkObject *accessible;
-
- accessible = gal_a11y_e_table_new (obj);
-
- return accessible;
-}
-
-static void
-gal_a11y_e_table_factory_class_init (GalA11yETableFactoryClass *klass)
-{
- AtkObjectFactoryClass *factory_class = ATK_OBJECT_FACTORY_CLASS (klass);
-
- parent_class = g_type_class_ref (PARENT_TYPE);
-
- factory_class->create_accessible = gal_a11y_e_table_factory_create_accessible;
- factory_class->get_accessible_type = gal_a11y_e_table_factory_get_accessible_type;
-}
-
-static void
-gal_a11y_e_table_factory_init (GalA11yETableFactory *factory)
-{
-}
-
-/**
- * gal_a11y_e_table_factory_get_type:
- * @void:
- *
- * Registers the &GalA11yETableFactory class if necessary, and returns the type ID
- * associated to it.
- *
- * Return value: The type ID of the &GalA11yETableFactory class.
- **/
-GType
-gal_a11y_e_table_factory_get_type (void)
-{
- static GType type = 0;
-
- if (!type) {
- GTypeInfo info = {
- sizeof (GalA11yETableFactoryClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) gal_a11y_e_table_factory_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (GalA11yETableFactory),
- 0,
- (GInstanceInitFunc) gal_a11y_e_table_factory_init,
- NULL /* value_table */
- };
-
- type = g_type_register_static (PARENT_TYPE, "GalA11yETableFactory", &info, 0);
- }
-
- return type;
-}
diff --git a/a11y/e-table/gal-a11y-e-table-factory.h b/a11y/e-table/gal-a11y-e-table-factory.h
deleted file mode 100644
index eb8eb55414..0000000000
--- a/a11y/e-table/gal-a11y-e-table-factory.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors:
- * Christopher James Lahey <clahey@ximian.com>
- *
- * Copyright (C) 2001 Chris Lahey
- */
-
-#ifndef __GAL_A11Y_E_TABLE_FACTORY_H__
-#define __GAL_A11Y_E_TABLE_FACTORY_H__
-
-#include <glib-object.h>
-#include <atk/atkobjectfactory.h>
-
-#define GAL_A11Y_TYPE_E_TABLE_FACTORY (gal_a11y_e_table_factory_get_type ())
-#define GAL_A11Y_E_TABLE_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAL_A11Y_TYPE_E_TABLE_FACTORY, GalA11yETableFactory))
-#define GAL_A11Y_E_TABLE_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAL_A11Y_TYPE_E_TABLE_FACTORY, GalA11yETableFactoryClass))
-#define GAL_A11Y_IS_E_TABLE_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAL_A11Y_TYPE_E_TABLE_FACTORY))
-#define GAL_A11Y_IS_E_TABLE_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAL_A11Y_TYPE_E_TABLE_FACTORY))
-
-typedef struct _GalA11yETableFactory GalA11yETableFactory;
-typedef struct _GalA11yETableFactoryClass GalA11yETableFactoryClass;
-
-struct _GalA11yETableFactory {
- AtkObject object;
-};
-
-struct _GalA11yETableFactoryClass {
- AtkObjectClass parent_class;
-};
-
-
-/* Standard Glib function */
-GType gal_a11y_e_table_factory_get_type (void);
-
-#endif /* ! __GAL_A11Y_E_TABLE_FACTORY_H__ */
diff --git a/a11y/e-table/gal-a11y-e-table-item.c b/a11y/e-table/gal-a11y-e-table-item.c
deleted file mode 100644
index 6ee060caba..0000000000
--- a/a11y/e-table/gal-a11y-e-table-item.c
+++ /dev/null
@@ -1,456 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors:
- * Christopher James Lahey <clahey@ximian.com>
- *
- * Copyright (C) 2002 Ximian, Inc.
- */
-
-#include <config.h>
-#include "gal-a11y-e-table-item.h"
-#include "gal-a11y-e-cell-registry.h"
-#include "gal-a11y-util.h"
-#include <atk/atkobject.h>
-#include <atk/atktable.h>
-#include <atk/atkcomponent.h>
-#include <atk/atkobjectfactory.h>
-#include <atk/atkregistry.h>
-#include <atk/atkgobjectaccessible.h>
-
-#define CS_CLASS(a11y) (G_TYPE_INSTANCE_GET_CLASS ((a11y), C_TYPE_STREAM, GalA11yETableItemClass))
-static GObjectClass *parent_class;
-static AtkComponentIface *component_parent_iface;
-static GType parent_type;
-static gint priv_offset;
-static GQuark quark_accessible_object = 0;
-#define GET_PRIVATE(object) ((GalA11yETableItemPrivate *) (((char *) object) + priv_offset))
-#define PARENT_TYPE (parent_type)
-
-struct _GalA11yETableItemPrivate {
- AtkObject *parent;
- gint index_in_parent;
-};
-
-#if 0
-static void
-unref_accessible (gpointer user_data, GObject *obj_loc)
-{
- GalA11yETableItem *a11y = GAL_A11Y_E_TABLE_ITEM (user_data);
- GET_PRIVATE (a11y)->item = NULL;
- g_object_unref (a11y);
-}
-#endif
-
-static void
-eti_dispose (GObject *object)
-{
- GalA11yETableItem *a11y = GAL_A11Y_E_TABLE_ITEM (object);
- GalA11yETableItemPrivate *priv = GET_PRIVATE (a11y);
-
-#if 0
- if (priv->item)
- g_object_weak_unref (G_OBJECT (priv->item), unref_accessible, a11y);
-
- if (priv->parent)
- g_object_unref (priv->parent);
-#endif
- priv->parent = NULL;
-
- if (parent_class->dispose)
- parent_class->dispose (object);
-}
-
-/* Static functions */
-static AtkObject*
-eti_get_parent (AtkObject *accessible)
-{
- GalA11yETableItem *a11y = GAL_A11Y_E_TABLE_ITEM (accessible);
- return GET_PRIVATE (a11y)->parent;
-}
-
-static gint
-eti_get_n_children (AtkObject *accessible)
-{
- return atk_table_get_n_columns (ATK_TABLE (accessible)) *
- atk_table_get_n_rows (ATK_TABLE (accessible));
-}
-
-static AtkObject*
-eti_ref_child (AtkObject *accessible,
- gint i)
-{
- AtkTable *table = ATK_TABLE (accessible);
- ETableItem *item = E_TABLE_ITEM (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (accessible)));
-
- int col = i % item->cols;
- int row = i / item->cols;
-
- return atk_table_ref_at (table, row, col);
-}
-
-static gint
-eti_get_index_in_parent (AtkObject *accessible)
-{
- GalA11yETableItem *a11y = GAL_A11Y_E_TABLE_ITEM (accessible);
- return GET_PRIVATE (a11y)->index_in_parent;
-}
-
-static void
-eti_get_extents (AtkComponent *component,
- gint *x,
- gint *y,
- gint *width,
- gint *height,
- AtkCoordType coord_type)
-{
- ETableItem *item = E_TABLE_ITEM (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (component)));
- double real_width;
- double real_height;
- int fake_width;
- int fake_height;
-
- if (component_parent_iface &&
- component_parent_iface->get_extents)
- component_parent_iface->get_extents (component,
- x,
- y,
- &fake_width,
- &fake_height,
- coord_type);
-
- gtk_object_get (GTK_OBJECT (item),
- "width", &real_width,
- "height", &real_height,
- NULL);
-
- if (width)
- *width = real_width;
- if (height)
- *height = real_height;
-}
-
-static AtkObject*
-eti_ref_accessible_at_point (AtkComponent *component,
- gint x,
- gint y,
- AtkCoordType coord_type)
-{
- int row = -1;
- int col = -1;
- int x_origin, y_origin;
- ETableItem *item = E_TABLE_ITEM (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (component)));
-
- atk_component_get_position (component,
- &x_origin,
- &y_origin,
- coord_type);
- x -= x_origin;
- y -= y_origin;
-
- e_table_item_compute_location (item, &x, &y,
- &row, &col);
-
- if (row != -1 && col != -1) {
- return atk_table_ref_at (ATK_TABLE (component), row, col);
- } else {
- return NULL;
- }
-}
-
-
-/* Table IFace */
-
-static AtkObject*
-eti_ref_at (AtkTable *table,
- gint row,
- gint column)
-{
- AtkObject* accessible = ATK_OBJECT (table);
- ETableItem *item = E_TABLE_ITEM (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (table)));
-
- if (column >= 0 &&
- column < item->cols &&
- row >= 0 &&
- row < item->rows &&
- item->cell_views_realized) {
- ECellView *cell_view = item->cell_views[column];
- ETableCol *ecol = e_table_header_get_column (item->header, column);
- return gal_a11y_e_cell_registry_get_object (NULL,
- item,
- cell_view,
- accessible,
- ecol->col_idx,
- column,
- row);
- }
-
- return NULL;
-}
-
-static gint
-eti_get_index_at (AtkTable *table,
- gint row,
- gint column)
-{
- ETableItem *item = E_TABLE_ITEM (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (table)));
-
- return column + row * item->cols;
-}
-
-static gint
-eti_get_column_at_index (AtkTable *table,
- gint index)
-{
- ETableItem *item = E_TABLE_ITEM (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (table)));
-
- return index % item->cols;
-}
-
-static gint
-eti_get_row_at_index (AtkTable *table,
- gint index)
-{
- ETableItem *item = E_TABLE_ITEM (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (table)));
-
- return index / item->cols;
-}
-
-static gint
-eti_get_n_columns (AtkTable *table)
-{
- ETableItem *item = E_TABLE_ITEM (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (table)));
-
- return item->cols;
-}
-
-static gint
-eti_get_n_rows (AtkTable *table)
-{
- ETableItem *item = E_TABLE_ITEM (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (table)));
-
- return item->rows;
-}
-
-static gint
-eti_get_column_extent_at (AtkTable *table,
- gint row,
- gint column)
-{
- ETableItem *item = E_TABLE_ITEM (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (table)));
- int width;
-
- e_table_item_get_cell_geometry (item,
- &row,
- &column,
- NULL,
- NULL,
- &width,
- NULL);
-
- return width;
-}
-
-static gint
-eti_get_row_extent_at (AtkTable *table,
- gint row,
- gint column)
-{
- ETableItem *item = E_TABLE_ITEM (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (table)));
- int height;
-
- e_table_item_get_cell_geometry (item,
- &row,
- &column,
- NULL,
- NULL,
- NULL,
- &height);
-
- return height;
-}
-
-static AtkObject *
-eti_get_caption (AtkTable *table)
-{
- /* Unimplemented */
- return NULL;
-}
-
-static G_CONST_RETURN gchar *
-eti_get_column_description (AtkTable *table,
- gint column)
-{
- ETableItem *item = E_TABLE_ITEM (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (table)));
- ETableCol *ecol = e_table_header_get_column (item->header, column);
-
- return ecol->text;
-}
-
-static AtkObject *
-eti_get_column_header (AtkTable *table,
- gint column)
-{
- /* Unimplemented */
- return NULL;
-}
-
-static G_CONST_RETURN gchar *
-eti_get_row_description (AtkTable *table,
- gint row)
-{
- /* Unimplemented */
- return NULL;
-}
-
-static AtkObject *
-eti_get_row_header (AtkTable *table,
- gint row)
-{
- /* Unimplemented */
- return NULL;
-}
-
-static AtkObject *
-eti_get_summary (AtkTable *table)
-{
- /* Unimplemented */
- return NULL;
-}
-
-static void
-eti_atk_table_iface_init (AtkTableIface *iface)
-{
- iface->ref_at = eti_ref_at;
- iface->get_index_at = eti_get_index_at;
- iface->get_column_at_index = eti_get_column_at_index;
- iface->get_row_at_index = eti_get_row_at_index;
- iface->get_n_columns = eti_get_n_columns;
- iface->get_n_rows = eti_get_n_rows;
- iface->get_column_extent_at = eti_get_column_extent_at;
- iface->get_row_extent_at = eti_get_row_extent_at;
- iface->get_caption = eti_get_caption;
- iface->get_column_description = eti_get_column_description;
- iface->get_column_header = eti_get_column_header;
- iface->get_row_description = eti_get_row_description;
- iface->get_row_header = eti_get_row_header;
- iface->get_summary = eti_get_summary;
-}
-
-static void
-eti_atk_component_iface_init (AtkComponentIface *iface)
-{
- component_parent_iface = g_type_interface_peek_parent (iface);
-
- iface->ref_accessible_at_point = eti_ref_accessible_at_point;
- iface->get_extents = eti_get_extents;
-}
-
-static void
-eti_class_init (GalA11yETableItemClass *klass)
-{
- AtkObjectClass *atk_object_class = ATK_OBJECT_CLASS (klass);
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- quark_accessible_object = g_quark_from_static_string ("gtk-accessible-object");
-
- parent_class = g_type_class_ref (PARENT_TYPE);
-
- object_class->dispose = eti_dispose;
-
- atk_object_class->get_parent = eti_get_parent;
- atk_object_class->get_n_children = eti_get_n_children;
- atk_object_class->ref_child = eti_ref_child;
- atk_object_class->get_index_in_parent = eti_get_index_in_parent;
-}
-
-static void
-eti_init (GalA11yETableItem *a11y)
-{
- GalA11yETableItemPrivate *priv;
-
- priv = GET_PRIVATE (a11y);
-
- priv->parent = NULL;
- priv->index_in_parent = -1;
-}
-
-/**
- * gal_a11y_e_table_item_get_type:
- * @void:
- *
- * Registers the &GalA11yETableItem class if necessary, and returns the type ID
- * associated to it.
- *
- * Return value: The type ID of the &GalA11yETableItem class.
- **/
-GType
-gal_a11y_e_table_item_get_type (void)
-{
- static GType type = 0;
-
- if (!type) {
- AtkObjectFactory *factory;
-
- GTypeInfo info = {
- sizeof (GalA11yETableItemClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) eti_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (GalA11yETableItem),
- 0,
- (GInstanceInitFunc) eti_init,
- NULL /* value_table_item */
- };
-
- static const GInterfaceInfo atk_component_info = {
- (GInterfaceInitFunc) eti_atk_component_iface_init,
- (GInterfaceFinalizeFunc) NULL,
- NULL
- };
- static const GInterfaceInfo atk_table_info = {
- (GInterfaceInitFunc) eti_atk_table_iface_init,
- (GInterfaceFinalizeFunc) NULL,
- NULL
- };
-
- factory = atk_registry_get_factory (atk_get_default_registry (), GNOME_TYPE_CANVAS_ITEM);
- parent_type = atk_object_factory_get_accessible_type (factory);
-
- type = gal_a11y_type_register_static_with_private (PARENT_TYPE, "GalA11yETableItem", &info, 0,
- sizeof (GalA11yETableItemPrivate), &priv_offset);
-
- g_type_add_interface_static (type, ATK_TYPE_COMPONENT, &atk_component_info);
- g_type_add_interface_static (type, ATK_TYPE_TABLE, &atk_table_info);
- }
-
- return type;
-}
-
-AtkObject *
-gal_a11y_e_table_item_new (AtkObject *parent,
- ETableItem *item,
- int index_in_parent)
-{
- GalA11yETableItem *a11y;
-
- a11y = g_object_new (gal_a11y_e_table_item_get_type (), NULL);
-
- atk_object_initialize (ATK_OBJECT (a11y), item);
-
- GET_PRIVATE (a11y)->parent = parent;
- GET_PRIVATE (a11y)->index_in_parent = index_in_parent;
-
- if (parent)
- g_object_ref (parent);
-
-#if 0
- if (item)
- g_object_weak_ref (G_OBJECT (item),
- unref_accessible,
- a11y);
-#endif
-
- return ATK_OBJECT (a11y);
-}
diff --git a/a11y/e-table/gal-a11y-e-table-item.h b/a11y/e-table/gal-a11y-e-table-item.h
deleted file mode 100644
index 795fa64499..0000000000
--- a/a11y/e-table/gal-a11y-e-table-item.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors:
- * Christopher James Lahey <clahey@ximian.com>
- *
- * Copyright (C) 2001 Chris Lahey
- */
-
-#ifndef __GAL_A11Y_E_TABLE_ITEM_H__
-#define __GAL_A11Y_E_TABLE_ITEM_H__
-
-#include <glib-object.h>
-#include <gal/e-table/e-table-item.h>
-
-#define GAL_A11Y_TYPE_E_TABLE_ITEM (gal_a11y_e_table_item_get_type ())
-#define GAL_A11Y_E_TABLE_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAL_A11Y_TYPE_E_TABLE_ITEM, GalA11yETableItem))
-#define GAL_A11Y_E_TABLE_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAL_A11Y_TYPE_E_TABLE_ITEM, GalA11yETableItemClass))
-#define GAL_A11Y_IS_E_TABLE_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAL_A11Y_TYPE_E_TABLE_ITEM))
-#define GAL_A11Y_IS_E_TABLE_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAL_A11Y_TYPE_E_TABLE_ITEM))
-
-typedef struct _GalA11yETableItem GalA11yETableItem;
-typedef struct _GalA11yETableItemClass GalA11yETableItemClass;
-typedef struct _GalA11yETableItemPrivate GalA11yETableItemPrivate;
-
-/* This struct should actually be larger as this isn't what we derive from.
- * The GalA11yETableItemPrivate comes right after the parent class structure.
- **/
-struct _GalA11yETableItem {
- AtkObject object;
-};
-
-struct _GalA11yETableItemClass {
- AtkObject parent_class;
-};
-
-
-/* Standard Glib function */
-GType gal_a11y_e_table_item_get_type (void);
-AtkObject *gal_a11y_e_table_item_new (AtkObject *parent,
- ETableItem *item,
- int index_in_parent);
-
-#endif /* ! __GAL_A11Y_E_TABLE_ITEM_H__ */
diff --git a/a11y/e-table/gal-a11y-e-table.c b/a11y/e-table/gal-a11y-e-table.c
deleted file mode 100644
index ae166d2c09..0000000000
--- a/a11y/e-table/gal-a11y-e-table.c
+++ /dev/null
@@ -1,156 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors:
- * Christopher James Lahey <clahey@ximian.com>
- *
- * Copyright (C) 2002 Ximian, Inc.
- */
-
-#include <config.h>
-#include "gal-a11y-e-table.h"
-#include "gal-a11y-e-table-item.h"
-#include "gal-a11y-util.h"
-#include <gal/e-table/e-table.h>
-#include <gal/e-table/e-table-group.h>
-#include <gal/e-table/e-table-group-leaf.h>
-
-#define CS_CLASS(a11y) (G_TYPE_INSTANCE_GET_CLASS ((a11y), C_TYPE_STREAM, GalA11yETableClass))
-static AtkObjectClass *parent_class;
-static GType parent_type;
-static gint priv_offset;
-#define GET_PRIVATE(object) ((GalA11yETablePrivate *) (((char *) object) + priv_offset))
-#define PARENT_TYPE (parent_type)
-
-struct _GalA11yETablePrivate {
- AtkObject *child_item;
-};
-
-/* Static functions */
-
-static void
-init_child_item (GalA11yETable *a11y)
-{
- GalA11yETablePrivate *priv = GET_PRIVATE (a11y);
- ETable *table = E_TABLE (GTK_ACCESSIBLE (a11y)->widget);
- if (priv->child_item == NULL) {
- priv->child_item = gal_a11y_e_table_item_new (ATK_OBJECT (a11y), E_TABLE_GROUP_LEAF (table->group)->item, 0);
- }
-}
-
-static AtkObject*
-et_ref_accessible_at_point (AtkComponent *component,
- gint x,
- gint y,
- AtkCoordType coord_type)
-{
- GalA11yETable *a11y = GAL_A11Y_E_TABLE (component);
- init_child_item (a11y);
- return GET_PRIVATE (a11y)->child_item;
-}
-
-static gint
-et_get_n_children (AtkObject *accessible)
-{
- return 1;
-}
-
-static AtkObject*
-et_ref_child (AtkObject *accessible,
- gint i)
-{
- GalA11yETable *a11y = GAL_A11Y_E_TABLE (accessible);
- if (i != 0)
- return NULL;
- init_child_item (a11y);
- g_object_ref (GET_PRIVATE (a11y)->child_item);
- return GET_PRIVATE (a11y)->child_item;
-}
-
-static void
-et_class_init (GalA11yETableClass *klass)
-{
- AtkObjectClass *atk_object_class = ATK_OBJECT_CLASS (klass);
-
- parent_class = g_type_class_ref (PARENT_TYPE);
-
- atk_object_class->get_n_children = et_get_n_children;
- atk_object_class->ref_child = et_ref_child;
-}
-
-static void
-et_atk_component_iface_init (AtkComponentIface *iface)
-{
- iface->ref_accessible_at_point = et_ref_accessible_at_point;
-}
-
-static void
-et_init (GalA11yETable *a11y)
-{
- GalA11yETablePrivate *priv;
-
- priv = GET_PRIVATE (a11y);
-
- priv->child_item = NULL;
-}
-
-/**
- * gal_a11y_e_table_get_type:
- * @void:
- *
- * Registers the &GalA11yETable class if necessary, and returns the type ID
- * associated to it.
- *
- * Return value: The type ID of the &GalA11yETable class.
- **/
-GType
-gal_a11y_e_table_get_type (void)
-{
- static GType type = 0;
-
- if (!type) {
- AtkObjectFactory *factory;
-
- GTypeInfo info = {
- sizeof (GalA11yETableClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) et_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (GalA11yETable),
- 0,
- (GInstanceInitFunc) et_init,
- NULL /* value_table */
- };
-
- static const GInterfaceInfo atk_component_info = {
- (GInterfaceInitFunc) et_atk_component_iface_init,
- (GInterfaceFinalizeFunc) NULL,
- NULL
- };
-
- factory = atk_registry_get_factory (atk_get_default_registry (), GTK_TYPE_WIDGET);
- parent_type = atk_object_factory_get_accessible_type (factory);
-
- type = gal_a11y_type_register_static_with_private (PARENT_TYPE, "GalA11yETable", &info, 0,
- sizeof (GalA11yETablePrivate), &priv_offset);
- g_type_add_interface_static (type, ATK_TYPE_COMPONENT, &atk_component_info);
- }
-
- return type;
-}
-
-AtkObject *
-gal_a11y_e_table_new (GObject *widget)
-{
- GalA11yETable *a11y;
- ETable *table;
-
- table = E_TABLE (widget);
-
- a11y = g_object_new (gal_a11y_e_table_get_type (), NULL);
-
- GTK_ACCESSIBLE (a11y)->widget = GTK_WIDGET (widget);
-
- return ATK_OBJECT (a11y);
-}
diff --git a/a11y/e-table/gal-a11y-e-table.h b/a11y/e-table/gal-a11y-e-table.h
deleted file mode 100644
index 0a0901e3bc..0000000000
--- a/a11y/e-table/gal-a11y-e-table.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors:
- * Christopher James Lahey <clahey@ximian.com>
- *
- * Copyright (C) 2001 Chris Lahey
- */
-
-#ifndef __GAL_A11Y_E_TABLE_H__
-#define __GAL_A11Y_E_TABLE_H__
-
-#include <glib-object.h>
-#include <atk/atkobject.h>
-#include <atk/atkcomponent.h>
-#include <gtk/gtkaccessible.h>
-
-#define GAL_A11Y_TYPE_E_TABLE (gal_a11y_e_table_get_type ())
-#define GAL_A11Y_E_TABLE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAL_A11Y_TYPE_E_TABLE, GalA11yETable))
-#define GAL_A11Y_E_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAL_A11Y_TYPE_E_TABLE, GalA11yETableClass))
-#define GAL_A11Y_IS_E_TABLE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAL_A11Y_TYPE_E_TABLE))
-#define GAL_A11Y_IS_E_TABLE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAL_A11Y_TYPE_E_TABLE))
-
-typedef struct _GalA11yETable GalA11yETable;
-typedef struct _GalA11yETableClass GalA11yETableClass;
-typedef struct _GalA11yETablePrivate GalA11yETablePrivate;
-
-/* This struct should actually be larger as this isn't what we derive from.
- * The GalA11yETablePrivate comes right after the parent class structure.
- **/
-struct _GalA11yETable {
- GtkAccessible object;
-};
-
-struct _GalA11yETableClass {
- GtkAccessibleClass parent_class;
-};
-
-
-/* Standard Glib function */
-GType gal_a11y_e_table_get_type (void);
-AtkObject *gal_a11y_e_table_new (GObject *table);
-
-#endif /* ! __GAL_A11Y_E_TABLE_H__ */
diff --git a/a11y/e-text/.cvsignore b/a11y/e-text/.cvsignore
deleted file mode 100644
index 5b48d3f593..0000000000
--- a/a11y/e-text/.cvsignore
+++ /dev/null
@@ -1,4 +0,0 @@
-.libs
-Makefile.in
-Makefile
-*.la
diff --git a/a11y/e-text/gal-a11y-e-text-factory.c b/a11y/e-text/gal-a11y-e-text-factory.c
deleted file mode 100644
index 574315b335..0000000000
--- a/a11y/e-text/gal-a11y-e-text-factory.c
+++ /dev/null
@@ -1,88 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors:
- * Christopher James Lahey <clahey@ximian.com>
- *
- * Copyright (C) 2002 Ximian, Inc.
- */
-
-#include <config.h>
-#include "gal/e-text/e-text.h"
-#include "gal-a11y-e-text-factory.h"
-#include "gal-a11y-e-text.h"
-
-#define CS_CLASS(factory) (G_TYPE_INSTANCE_GET_CLASS ((factory), C_TYPE_STREAM, GalA11yETextFactoryClass))
-static AtkObjectFactoryClass *parent_class;
-#define PARENT_TYPE (ATK_TYPE_OBJECT_FACTORY)
-
-/* Static functions */
-
-static GType
-gal_a11y_e_text_factory_get_accessible_type (void)
-{
- return GAL_A11Y_TYPE_E_TEXT;
-}
-
-static AtkObject*
-gal_a11y_e_text_factory_create_accessible (GObject *obj)
-{
- AtkObject *atk_object;
-
- g_return_val_if_fail (E_IS_TEXT (obj), NULL);
-
- atk_object = g_object_new (GAL_A11Y_TYPE_E_TEXT, NULL);
- atk_object_initialize (atk_object, obj);
- atk_object->role = ATK_ROLE_UNKNOWN;
-
- return atk_object;
-}
-
-static void
-gal_a11y_e_text_factory_class_init (GalA11yETextFactoryClass *klass)
-{
- AtkObjectFactoryClass *factory_class = ATK_OBJECT_FACTORY_CLASS (klass);
-
- parent_class = g_type_class_ref (PARENT_TYPE);
-
- factory_class->create_accessible = gal_a11y_e_text_factory_create_accessible;
- factory_class->get_accessible_type = gal_a11y_e_text_factory_get_accessible_type;
-}
-
-static void
-gal_a11y_e_text_factory_init (GalA11yETextFactory *factory)
-{
-}
-
-/**
- * gal_a11y_e_text_factory_get_type:
- * @void:
- *
- * Registers the &GalA11yETextFactory class if necessary, and returns the type ID
- * associated to it.
- *
- * Return value: The type ID of the &GalA11yETextFactory class.
- **/
-GType
-gal_a11y_e_text_factory_get_type (void)
-{
- static GType type = 0;
-
- if (!type) {
- GTypeInfo info = {
- sizeof (GalA11yETextFactoryClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) gal_a11y_e_text_factory_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (GalA11yETextFactory),
- 0,
- (GInstanceInitFunc) gal_a11y_e_text_factory_init,
- NULL /* value_text */
- };
-
- type = g_type_register_static (PARENT_TYPE, "GalA11yETextFactory", &info, 0);
- }
-
- return type;
-}
diff --git a/a11y/e-text/gal-a11y-e-text-factory.h b/a11y/e-text/gal-a11y-e-text-factory.h
deleted file mode 100644
index 56a8d29ab9..0000000000
--- a/a11y/e-text/gal-a11y-e-text-factory.h
+++ /dev/null
@@ -1,36 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors:
- * Christopher James Lahey <clahey@ximian.com>
- *
- * Copyright (C) 2001 Chris Lahey
- */
-
-#ifndef __GAL_A11Y_E_TEXT_FACTORY_H__
-#define __GAL_A11Y_E_TEXT_FACTORY_H__
-
-#include <glib-object.h>
-#include <atk/atkobjectfactory.h>
-
-#define GAL_A11Y_TYPE_E_TEXT_FACTORY (gal_a11y_e_text_factory_get_type ())
-#define GAL_A11Y_E_TEXT_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAL_A11Y_TYPE_E_TEXT_FACTORY, GalA11yETextFactory))
-#define GAL_A11Y_E_TEXT_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAL_A11Y_TYPE_E_TEXT_FACTORY, GalA11yETextFactoryClass))
-#define GAL_A11Y_IS_E_TEXT_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAL_A11Y_TYPE_E_TEXT_FACTORY))
-#define GAL_A11Y_IS_E_TEXT_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAL_A11Y_TYPE_E_TEXT_FACTORY))
-
-typedef struct _GalA11yETextFactory GalA11yETextFactory;
-typedef struct _GalA11yETextFactoryClass GalA11yETextFactoryClass;
-
-struct _GalA11yETextFactory {
- AtkObjectFactory object;
-};
-
-struct _GalA11yETextFactoryClass {
- AtkObjectFactoryClass parent_class;
-};
-
-
-/* Standard Glib function */
-GType gal_a11y_e_text_factory_get_type (void);
-
-#endif /* ! __GAL_A11Y_E_TEXT_FACTORY_H__ */
diff --git a/a11y/e-text/gal-a11y-e-text.c b/a11y/e-text/gal-a11y-e-text.c
deleted file mode 100644
index a37726a5a8..0000000000
--- a/a11y/e-text/gal-a11y-e-text.c
+++ /dev/null
@@ -1,648 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors:
- * Christopher James Lahey <clahey@ximian.com>
- *
- * Copyright (C) 2002 Ximian, Inc.
- */
-
-#include <config.h>
-#include "gal-a11y-e-text.h"
-#include "gal-a11y-util.h"
-#include <atk/atkobject.h>
-#include <atk/atktable.h>
-#include <atk/atkcomponent.h>
-#include <atk/atkobjectfactory.h>
-#include <atk/atkregistry.h>
-#include <atk/atkgobjectaccessible.h>
-#include "gal/e-text/e-text.h"
-#include <gtk/gtkmain.h>
-
-#define CS_CLASS(a11y) (G_TYPE_INSTANCE_GET_CLASS ((a11y), C_TYPE_STREAM, GalA11yETextClass))
-static GObjectClass *parent_class;
-static AtkComponentIface *component_parent_iface;
-static GType parent_type;
-static gint priv_offset;
-static GQuark quark_accessible_object = 0;
-#define GET_PRIVATE(object) ((GalA11yETextPrivate *) (((char *) object) + priv_offset))
-#define PARENT_TYPE (parent_type)
-
-struct _GalA11yETextPrivate {
- int dummy;
-};
-
-static void
-et_dispose (GObject *object)
-{
- if (parent_class->dispose)
- parent_class->dispose (object);
-}
-
-/* Static functions */
-
-static void
-et_get_extents (AtkComponent *component,
- gint *x,
- gint *y,
- gint *width,
- gint *height,
- AtkCoordType coord_type)
-{
- EText *item = E_TEXT (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (component)));
- double real_width;
- double real_height;
- int fake_width;
- int fake_height;
-
- if (component_parent_iface &&
- component_parent_iface->get_extents)
- component_parent_iface->get_extents (component,
- x,
- y,
- &fake_width,
- &fake_height,
- coord_type);
-
- gtk_object_get (GTK_OBJECT (item),
- "text_width", &real_width,
- "text_height", &real_height,
- NULL);
-
- if (width)
- *width = real_width;
- if (height)
- *height = real_height;
-}
-
-static const gchar *
-et_get_full_text (AtkText *text)
-{
- EText *etext = E_TEXT (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (text)));
- ETextModel *model;
- const char *full_text;
-
- gtk_object_get (GTK_OBJECT (etext),
- "model", &model,
- NULL);
-
- full_text = e_text_model_get_text (model);
-
- return full_text;
-}
-
-static void
-et_set_full_text (AtkEditableText *text,
- const char *full_text)
-{
- EText *etext = E_TEXT (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (text)));
- ETextModel *model;
-
- gtk_object_get (GTK_OBJECT (etext),
- "model", &model,
- NULL);
-
- e_text_model_set_text (model, full_text);
-}
-
-static gchar *
-et_get_text (AtkText *text,
- gint start_offset,
- gint end_offset)
-{
- gint start, end, real_start, real_end, len;
- const char *full_text = et_get_full_text (text);
- if (full_text == NULL)
- return;
- len = g_utf8_strlen (full_text, -1);
-
- start = MIN (MAX (0, start_offset), len);
- end = MIN (MAX (-1, end_offset), len);
-
- if (end_offset == -1)
- end = strlen (full_text);
- else
- end = g_utf8_offset_to_pointer (full_text, end) - full_text;
-
- start = g_utf8_offset_to_pointer (full_text, start) - full_text;
-
- real_start = MIN (start, end);
- real_end = MAX (start, end);
-
- return g_strndup (full_text + real_start, real_end - real_start);
-}
-
-static gchar *
-et_get_text_after_offset (AtkText *text,
- gint offset,
- AtkTextBoundary boundary_type,
- gint *start_offset,
- gint *end_offset)
-{
- /* Unimplemented */
- return NULL;
-}
-
-static gchar *
-et_get_text_at_offset (AtkText *text,
- gint offset,
- AtkTextBoundary boundary_type,
- gint *start_offset,
- gint *end_offset)
-{
- /* Unimplemented */
- return NULL;
-}
-
-static gunichar
-et_get_character_at_offset (AtkText *text,
- gint offset)
-{
- const char *full_text = et_get_full_text (text);
- char *at_offset;
-
- at_offset = g_utf8_offset_to_pointer (full_text, offset);
- return g_utf8_get_char_validated (at_offset, -1);
-}
-
-
-static gchar*
-et_get_text_before_offset (AtkText *text,
- gint offset,
- AtkTextBoundary boundary_type,
- gint *start_offset,
- gint *end_offset)
-{
- /* Unimplemented */
- return NULL;
-}
-
-
-static gint
-et_get_caret_offset (AtkText *text)
-{
- GObject *obj;
- EText *etext;
- int offset;
-
- g_return_val_if_fail (ATK_IS_GOBJECT_ACCESSIBLE(text), -1);
- obj = atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (text));
- if (obj == NULL)
- return -1;
-
- g_return_val_if_fail (E_IS_TEXT (obj), -1);
- etext = E_TEXT (obj);
-
- gtk_object_get (GTK_OBJECT (etext),
- "cursor_pos", &offset,
- NULL);
- return offset;
-}
-
-
-static AtkAttributeSet*
-et_get_run_attributes (AtkText *text,
- gint offset,
- gint *start_offset,
- gint *end_offset)
-{
- /* Unimplemented */
- return NULL;
-}
-
-
-static AtkAttributeSet*
-et_get_default_attributes (AtkText *text)
-{
- /* Unimplemented */
- return NULL;
-}
-
-
-static void
-et_get_character_extents (AtkText *text,
- gint offset,
- gint *x,
- gint *y,
- gint *width,
- gint *height,
- AtkCoordType coords)
-{
- /* Unimplemented */
-}
-
-
-static gint
-et_get_character_count (AtkText *text)
-{
- const char *full_text = et_get_full_text (text);
-
- return g_utf8_strlen (full_text, -1);
-}
-
-
-static gint
-et_get_offset_at_point (AtkText *text,
- gint x,
- gint y,
- AtkCoordType coords)
-{
- /* Unimplemented */
- return 0;
-}
-
-
-static gint
-et_get_n_selections (AtkText *text)
-{
- EText *etext = E_TEXT (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (text)));
- if (etext->selection_start !=
- etext->selection_end)
- return 1;
- return 0;
-}
-
-
-static gchar*
-et_get_selection (AtkText *text,
- gint selection_num,
- gint *start_offset,
- gint *end_offset)
-{
- gint start, end, real_start, real_end, len;
- EText *etext;
- if (selection_num == 0) {
- const char *full_text = et_get_full_text (text);
- if (full_text == NULL)
- return NULL;
- len = g_utf8_strlen (full_text, -1);
- etext = E_TEXT (atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (text)));
- start = MIN (etext->selection_start, etext->selection_end);
- end = MAX (etext->selection_start, etext->selection_end);
- start = MIN (MAX (0, start), len);
- end = MIN (MAX (0, end), len);
- if (start != end) {
- if (start_offset)
- *start_offset = start;
- if (end_offset)
- *end_offset = end;
- real_start = g_utf8_offset_to_pointer (full_text, start) - full_text;
- real_end = g_utf8_offset_to_pointer (full_text, end) - full_text;
- return g_strndup (full_text + real_start, real_end - real_start);
- }
- }
-
- return NULL;
-}
-
-
-static gboolean
-et_add_selection (AtkText *text,
- gint start_offset,
- gint end_offset)
-{
- GObject *obj;
- EText *etext;
-
- g_return_val_if_fail (ATK_IS_GOBJECT_ACCESSIBLE (text), FALSE);
- obj = atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (text));
- if (obj == NULL)
- return FALSE;
- g_return_val_if_fail (E_IS_TEXT (obj), FALSE);
- etext = E_TEXT (obj);
-
- g_return_val_if_fail (start_offset >= 0, FALSE);
- g_return_val_if_fail (start_offset >= -1, FALSE);
- if (end_offset == -1)
- end_offset = et_get_character_count (text);
-
- if (start_offset != end_offset) {
- gint real_start, real_end;
- real_start = MIN (start_offset, end_offset);
- real_end = MAX (start_offset, end_offset);
- etext->selection_start = real_start;
- etext->selection_end = real_end;
-
- gnome_canvas_item_grab_focus (GNOME_CANVAS_ITEM (etext));
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (etext));
-
- g_signal_emit_by_name (ATK_OBJECT (text), "text_selection_changed");
-
- return TRUE;
- }
-
- return FALSE;
-}
-
-
-static gboolean
-et_remove_selection (AtkText *text,
- gint selection_num)
-{
- GObject *obj;
- EText *etext;
-
- g_return_val_if_fail (ATK_IS_GOBJECT_ACCESSIBLE (text), FALSE);
- obj = atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (text));
- if (obj == NULL)
- return FALSE;
- g_return_val_if_fail (E_IS_TEXT (obj), FALSE);
- etext = E_TEXT (obj);
-
- if( selection_num == 0
- && etext->selection_start != etext->selection_end ) {
- etext->selection_end = etext->selection_start;
- g_signal_emit_by_name (ATK_OBJECT(text), "text_selection_changed");
- return TRUE;
- }
-
- return FALSE;
-}
-
-
-static gboolean
-et_set_selection (AtkText *text,
- gint selection_num,
- gint start_offset,
- gint end_offset)
-{
- GObject *obj;
- EText *etext;
- int offset;
-
- g_return_val_if_fail (ATK_IS_GOBJECT_ACCESSIBLE (text), FALSE);
- obj = atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (text));
- if (obj == NULL)
- return FALSE;
- g_return_val_if_fail (E_IS_TEXT (obj), FALSE);
- etext = E_TEXT (obj);
- if (selection_num == 0)
- return et_add_selection (text, start_offset, end_offset);
- return FALSE;
-}
-
-
-static gboolean
-et_set_caret_offset (AtkText *text,
- gint offset)
-{
- GObject *obj;
- EText *etext;
-
- g_return_val_if_fail (ATK_IS_GOBJECT_ACCESSIBLE (text), FALSE);
- obj = atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (text));
- if (obj == NULL)
- return FALSE;
-
- g_return_val_if_fail (E_IS_TEXT (obj), FALSE);
- etext = E_TEXT (obj);
-
- if (offset < -1)
- return FALSE;
- else if (offset == -1)
- gtk_object_set (GTK_OBJECT (etext),
- "cursor_pos", et_get_character_count (text),
- NULL);
- else
- gtk_object_set (GTK_OBJECT (etext),
- "cursor_pos", offset,
- NULL);
- return TRUE;
-}
-
-static gboolean
-et_set_run_attributes (AtkEditableText *text,
- AtkAttributeSet *attrib_set,
- gint start_offset,
- gint end_offset)
-{
- /* Unimplemented */
- return FALSE;
-}
-
-static void
-et_set_text_contents (AtkEditableText *text,
- const gchar *string)
-{
- et_set_full_text (text, string);
-}
-
-static void
-et_insert_text (AtkEditableText *text,
- const gchar *string,
- gint length,
- gint *position)
-{
- /* Utf8 unimplemented */
- char *result;
-
- const char *full_text = et_get_full_text (ATK_TEXT (text));
- if (full_text == NULL)
- return;
-
- result = g_strdup_printf ("%.*s%.*s%s", *position, full_text, length, string, full_text + *position);
-
- et_set_full_text (text, result);
-
- *position += length;
-
- g_free (result);
-}
-
-static void
-et_copy_text (AtkEditableText *text,
- gint start_pos,
- gint end_pos)
-{
- GObject *obj;
- EText *etext;
-
- g_return_if_fail (ATK_IS_GOBJECT_ACCESSIBLE (text));
- obj = atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (text));
- if (obj == NULL)
- return;
-
- g_return_if_fail (E_IS_TEXT (obj));
- etext = E_TEXT (obj);
-
- if (start_pos != end_pos) {
- etext->selection_start = start_pos;
- etext->selection_end = end_pos;
- e_text_copy_clipboard (etext);
- }
-}
-
-static void
-et_delete_text (AtkEditableText *text,
- gint start_pos,
- gint end_pos)
-{
- GObject *obj;
- EText *etext;
-
- g_return_if_fail (ATK_IS_GOBJECT_ACCESSIBLE(text));
- obj = atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (text));
- if (obj == NULL)
- return;
-
- g_return_if_fail (E_IS_TEXT (obj));
- etext = E_TEXT (obj);
-
- etext->selection_start = start_pos;
- etext->selection_end = end_pos;
-
- e_text_delete_selection (etext);
-}
-
-static void
-et_cut_text (AtkEditableText *text,
- gint start_pos,
- gint end_pos)
-{
- et_copy_text (text, start_pos, end_pos);
- et_delete_text (text, start_pos, end_pos);
-}
-
-static void
-et_paste_text (AtkEditableText *text,
- gint position)
-{
- GObject *obj;
- EText *etext;
-
- g_return_if_fail (ATK_IS_GOBJECT_ACCESSIBLE (text));
- obj = atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE (text));
- if (obj == NULL)
- return;
-
- g_return_if_fail (E_IS_TEXT (obj));
- etext = E_TEXT (obj);
-
- gtk_object_set (GTK_OBJECT (etext),
- "cursor_pos", position,
- NULL);
- e_text_paste_clipboard (etext);
-}
-
-static void
-et_atk_component_iface_init (AtkComponentIface *iface)
-{
- iface->get_extents = et_get_extents;
-}
-
-static void
-et_atk_text_iface_init (AtkTextIface *iface)
-{
- iface->get_text = et_get_text;
- iface->get_text_after_offset = et_get_text_after_offset;
- iface->get_text_at_offset = et_get_text_at_offset;
- iface->get_character_at_offset = et_get_character_at_offset;
- iface->get_text_before_offset = et_get_text_before_offset;
- iface->get_caret_offset = et_get_caret_offset;
- iface->get_run_attributes = et_get_run_attributes;
- iface->get_default_attributes = et_get_default_attributes;
- iface->get_character_extents = et_get_character_extents;
- iface->get_character_count = et_get_character_count;
- iface->get_offset_at_point = et_get_offset_at_point;
- iface->get_n_selections = et_get_n_selections;
- iface->get_selection = et_get_selection;
- iface->add_selection = et_add_selection;
- iface->remove_selection = et_remove_selection;
- iface->set_selection = et_set_selection;
- iface->set_caret_offset = et_set_caret_offset;
-}
-
-static void
-et_atk_editable_text_iface_init (AtkEditableTextIface *iface)
-{
- iface->set_run_attributes = et_set_run_attributes;
- iface->set_text_contents = et_set_text_contents;
- iface->insert_text = et_insert_text;
- iface->copy_text = et_copy_text;
- iface->cut_text = et_cut_text;
- iface->delete_text = et_delete_text;
- iface->paste_text = et_paste_text;
-}
-
-static void
-et_class_init (GalA11yETextClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- quark_accessible_object = g_quark_from_static_string ("gtk-accessible-object");
-
- parent_class = g_type_class_ref (PARENT_TYPE);
-
- component_parent_iface = g_type_interface_peek(parent_class, ATK_TYPE_COMPONENT);
-
- object_class->dispose = et_dispose;
-}
-
-static void
-et_init (GalA11yEText *a11y)
-{
-#if 0
- GalA11yETextPrivate *priv;
-
- priv = GET_PRIVATE (a11y);
-#endif
-}
-
-/**
- * gal_a11y_e_text_get_type:
- * @void:
- *
- * Registers the &GalA11yEText class if necessary, and returns the type ID
- * associated to it.
- *
- * Return value: The type ID of the &GalA11yEText class.
- **/
-GType
-gal_a11y_e_text_get_type (void)
-{
- static GType type = 0;
-
- if (!type) {
- AtkObjectFactory *factory;
-
- GTypeInfo info = {
- sizeof (GalA11yETextClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) et_class_init,
- (GClassFinalizeFunc) NULL,
- NULL, /* class_data */
- sizeof (GalA11yEText),
- 0,
- (GInstanceInitFunc) et_init,
- NULL /* value_text */
- };
-
- static const GInterfaceInfo atk_component_info = {
- (GInterfaceInitFunc) et_atk_component_iface_init,
- (GInterfaceFinalizeFunc) NULL,
- NULL
- };
- static const GInterfaceInfo atk_text_info = {
- (GInterfaceInitFunc) et_atk_text_iface_init,
- (GInterfaceFinalizeFunc) NULL,
- NULL
- };
- static const GInterfaceInfo atk_editable_text_info = {
- (GInterfaceInitFunc) et_atk_editable_text_iface_init,
- (GInterfaceFinalizeFunc) NULL,
- NULL
- };
-
- factory = atk_registry_get_factory (atk_get_default_registry (), GNOME_TYPE_CANVAS_ITEM);
- parent_type = atk_object_factory_get_accessible_type (factory);
-
- type = gal_a11y_type_register_static_with_private (PARENT_TYPE, "GalA11yEText", &info, 0,
- sizeof (GalA11yETextPrivate), &priv_offset);
-
- g_type_add_interface_static (type, ATK_TYPE_COMPONENT, &atk_component_info);
- g_type_add_interface_static (type, ATK_TYPE_TEXT, &atk_text_info);
- g_type_add_interface_static (type, ATK_TYPE_EDITABLE_TEXT, &atk_editable_text_info);
- }
-
- return type;
-}
diff --git a/a11y/e-text/gal-a11y-e-text.h b/a11y/e-text/gal-a11y-e-text.h
deleted file mode 100644
index 66d2d6283b..0000000000
--- a/a11y/e-text/gal-a11y-e-text.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors:
- * Christopher James Lahey <clahey@ximian.com>
- *
- * Copyright (C) 2001 Chris Lahey
- */
-
-#ifndef __GAL_A11Y_E_TEXT_H__
-#define __GAL_A11Y_E_TEXT_H__
-
-#include <glib-object.h>
-#include <gal/e-table/e-table-item.h>
-
-#define GAL_A11Y_TYPE_E_TEXT (gal_a11y_e_text_get_type ())
-#define GAL_A11Y_E_TEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAL_A11Y_TYPE_E_TEXT, GalA11yEText))
-#define GAL_A11Y_E_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAL_A11Y_TYPE_E_TEXT, GalA11yETextClass))
-#define GAL_A11Y_IS_E_TEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAL_A11Y_TYPE_E_TEXT))
-#define GAL_A11Y_IS_E_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GAL_A11Y_TYPE_E_TEXT))
-
-typedef struct _GalA11yEText GalA11yEText;
-typedef struct _GalA11yETextClass GalA11yETextClass;
-typedef struct _GalA11yETextPrivate GalA11yETextPrivate;
-
-/* This struct should actually be larger as this isn't what we derive from.
- * The GalA11yETextPrivate comes right after the parent class structure.
- **/
-struct _GalA11yEText {
- AtkObject object;
-};
-
-struct _GalA11yETextClass {
- AtkObject parent_class;
-};
-
-
-/* Standard Glib function */
-GType gal_a11y_e_text_get_type (void);
-
-#endif /* ! __GAL_A11Y_E_TEXT_H__ */
diff --git a/a11y/ea-factory.h b/a11y/ea-factory.h
deleted file mode 100644
index 06ae612d6f..0000000000
--- a/a11y/ea-factory.h
+++ /dev/null
@@ -1,113 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* vim:expandtab:shiftwidth=8:tabstop=8:
- */
-/* Evolution Accessibility: ea-factory.h
- *
- * Copyright (C) 2003 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
- * 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.
- *
- * Author: Bolian Yin <bolian.yin@sun.com> Sun Microsystem Inc., 2003
- *
- */
-
-/* Evolution Accessibility
-*/
-
-#ifndef _EA_FACTORY_H__
-#define _EA_FACTORY_H__
-
-#include <glib-object.h>
-#include <atk/atkobject.h>
-
-#define EA_FACTORY_PARTA_GOBJECT(type, type_as_function, opt_create_accessible) \
-static AtkObject* \
-type_as_function ## _factory_create_accessible (GObject *obj) \
-{ \
- AtkObject *accessible; \
- g_return_val_if_fail (G_IS_OBJECT (obj), NULL); \
- accessible = opt_create_accessible (G_OBJECT (obj)); \
- return accessible; \
-}
-
-#define EA_FACTORY_PARTA(type, type_as_function, opt_create_accessible) \
-static AtkObject* \
-type_as_function ## _factory_create_accessible (GObject *obj) \
-{ \
- GtkWidget *widget; \
- AtkObject *accessible; \
- \
- g_return_val_if_fail (GTK_IS_WIDGET (obj), NULL); \
- \
- widget = GTK_WIDGET (obj); \
- \
- accessible = opt_create_accessible (widget); \
- return accessible; \
-}
-
-#define EA_FACTORY_PARTB(type, type_as_function, opt_create_accessible) \
- \
-static GType \
-type_as_function ## _factory_get_accessible_type (void) \
-{ \
- return type; \
-} \
- \
- \
-static void \
-type_as_function ## _factory_class_init (AtkObjectFactoryClass *klass) \
-{ \
- klass->create_accessible = type_as_function ## _factory_create_accessible; \
- klass->get_accessible_type = type_as_function ## _factory_get_accessible_type;\
-} \
- \
-static GType \
-type_as_function ## _factory_get_type (void) \
-{ \
- static GType t = 0; \
- \
- if (!t) \
- { \
- char *name; \
- static const GTypeInfo tinfo = \
- { \
- sizeof (AtkObjectFactoryClass), \
- NULL, NULL, (GClassInitFunc) type_as_function ## _factory_class_init, \
- NULL, NULL, sizeof (AtkObjectFactory), 0, NULL, NULL \
- }; \
- \
- name = g_strconcat (g_type_name (type), "Factory", NULL); \
- t = g_type_register_static ( \
- ATK_TYPE_OBJECT_FACTORY, name, &tinfo, 0); \
- g_free (name); \
- } \
- \
- return t; \
-}
-
-#define EA_FACTORY(type, type_as_function, opt_create_accessible) \
- EA_FACTORY_PARTA(type, type_as_function, opt_create_accessible) \
- EA_FACTORY_PARTB(type, type_as_function, opt_create_accessible)
-
-#define EA_FACTORY_GOBJECT(type, type_as_function, opt_create_accessible) \
- EA_FACTORY_PARTA_GOBJECT(type, type_as_function, opt_create_accessible) \
- EA_FACTORY_PARTB(type, type_as_function, opt_create_accessible)
-
-#define EA_SET_FACTORY(obj_type, type_as_function) \
- atk_registry_set_factory_type (atk_get_default_registry (), \
- obj_type, \
- type_as_function ## _factory_get_type ())
-
-#endif /* _EA_FACTORY_H__ */
diff --git a/a11y/gal-a11y-factory.h b/a11y/gal-a11y-factory.h
deleted file mode 100644
index 22da85eca8..0000000000
--- a/a11y/gal-a11y-factory.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* GAL A11Y
- * gal-a11y-factory.h
- *
- * Copyright 2003 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 as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
- *
- * Authors:
- * Gilbert Fang <gilbert.fang@sun.com>, Sun Microsystem Inc. 2003.
- *
- * This file is mainly from the gailfactory.h of GAIL.
- */
-
-#ifndef _GAL_A11Y_FACTORY_H__
-#define _GAL_A11Y_FACTORY_H__
-
-#include <glib-object.h>
-#include <atk/atkobject.h>
-#include <atk/atkobjectfactory.h>
-
-#define GAL_A11Y_FACTORY(type, type_as_function, opt_create_accessible) \
- \
-static GType \
-type_as_function ## _factory_get_accessible_type (void) \
-{ \
- return type; \
-} \
- \
-static AtkObject* \
-type_as_function ## _factory_create_accessible (GObject *obj) \
-{ \
- GtkWidget *widget; \
- AtkObject *accessible; \
- \
- g_return_val_if_fail (GTK_IS_WIDGET (obj), NULL); \
- \
- widget = GTK_WIDGET (obj); \
- \
- accessible = opt_create_accessible (widget); \
- \
- return accessible; \
-} \
- \
-static void \
-type_as_function ## _factory_class_init (AtkObjectFactoryClass *klass) \
-{ \
- klass->create_accessible = type_as_function ## _factory_create_accessible; \
- klass->get_accessible_type = type_as_function ## _factory_get_accessible_type;\
-} \
- \
-static GType \
-type_as_function ## _factory_get_type (void) \
-{ \
- static GType t = 0; \
- \
- if (!t) \
- { \
- char *name; \
- static const GTypeInfo tinfo = \
- { \
- sizeof (AtkObjectFactoryClass), \
- NULL, NULL, (GClassInitFunc) type_as_function ## _factory_class_init, \
- NULL, NULL, sizeof (AtkObjectFactory), 0, NULL, NULL \
- }; \
- \
- name = g_strconcat (g_type_name (type), "Factory", NULL); \
- t = g_type_register_static ( \
- ATK_TYPE_OBJECT_FACTORY, name, &tinfo, 0); \
- g_free (name); \
- } \
- \
- return t; \
-}
-
-#define GAL_A11Y_WIDGET_SET_FACTORY(widget_type, type_as_function) \
- atk_registry_set_factory_type (atk_get_default_registry (), \
- widget_type, \
- type_as_function ## _factory_get_type ())
-
-#endif /* _GAL_A11Y_FACTORY_H__ */
diff --git a/a11y/gal-a11y-util.c b/a11y/gal-a11y-util.c
deleted file mode 100644
index 0cf7c69dbb..0000000000
--- a/a11y/gal-a11y-util.c
+++ /dev/null
@@ -1,31 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors:
- * Christopher James Lahey <clahey@ximian.com>
- *
- * Copyright (C) 2002 Ximian, Inc.
- */
-
-#include <config.h>
-#include "gal-a11y-util.h"
-
-GType
-gal_a11y_type_register_static_with_private (GType parent_type,
- const gchar *type_name,
- GTypeInfo *info,
- GTypeFlags flags,
- gint priv_size,
- gint *priv_offset)
-{
- GTypeQuery query;
-
- g_type_query (parent_type, &query);
-
- info->class_size = query.class_size;
- info->instance_size = query.instance_size + priv_size;
-
- if (priv_offset)
- *priv_offset = query.instance_size;
-
- return g_type_register_static (parent_type, type_name, info, flags);
-}
diff --git a/a11y/gal-a11y-util.h b/a11y/gal-a11y-util.h
deleted file mode 100644
index b7f742b122..0000000000
--- a/a11y/gal-a11y-util.h
+++ /dev/null
@@ -1,21 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Authors:
- * Christopher James Lahey <clahey@ximian.com>
- *
- * Copyright (C) 2001 Chris Lahey
- */
-
-#ifndef __GAL_A11Y_UTIL_H__
-#define __GAL_A11Y_UTIL_H__
-
-#include <glib-object.h>
-
-GType gal_a11y_type_register_static_with_private (GType parent_type,
- const gchar *type_name,
- GTypeInfo *info,
- GTypeFlags flags,
- int priv_size,
- gint *priv_offset);
-
-#endif /* ! __GAL_A11Y_UTIL_H__ */
diff --git a/a11y/widgets/.cvsignore b/a11y/widgets/.cvsignore
deleted file mode 100644
index 282522db03..0000000000
--- a/a11y/widgets/.cvsignore
+++ /dev/null
@@ -1,2 +0,0 @@
-Makefile
-Makefile.in
diff --git a/a11y/widgets/Makefile.am b/a11y/widgets/Makefile.am
deleted file mode 100644
index c6b0ea2221..0000000000
--- a/a11y/widgets/Makefile.am
+++ /dev/null
@@ -1,23 +0,0 @@
-
-noinst_LTLIBRARIES = libevolution-widgets-a11y.la
-
-INCLUDES = \
- -DG_LOG_DOMAIN=\"evolution-a11y\" \
- -I$(top_srcdir)/widgets \
- -I$(top_srcdir)/a11y \
- -DEVOLUTION_DATADIR=\""$(datadir)"\" \
- -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \
- -DEVOLUTION_ETSPECDIR=\""$(etspecdir)"\" \
- -DEVOLUTION_IMAGESDIR=\""$(imagesdir)"\" \
- -DEVOLUTION_GALVIEWSDIR=\""$(viewsdir)"\" \
- -DEVOLUTION_UIDIR=\""$(evolutionuidir)"\" \
- -DG_DISABLE_DEPRECATED \
- -DPREFIX=\""$(prefix)"\" \
- $(A11Y_CFLAGS) \
- $(EVOLUTION_CALENDAR_CFLAGS)
-
-libevolution_widgets_a11y_la_SOURCES = \
- ea-calendar-item.c \
- ea-calendar-item.h \
- ea-widgets.c \
- ea-widgets.h
diff --git a/a11y/widgets/ea-calendar-item.c b/a11y/widgets/ea-calendar-item.c
deleted file mode 100644
index fee92e27d7..0000000000
--- a/a11y/widgets/ea-calendar-item.c
+++ /dev/null
@@ -1,165 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* vim:expandtab:shiftwidth=8:tabstop=8:
- */
-/* Evolution Accessibility: ea-calendar-item.c
- *
- * Copyright (C) 2003 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
- * 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.
- *
- * Author: Bolian Yin <bolian.yin@sun.com> Sun Microsystem Inc., 2003
- *
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <libgnomecanvas/gnome-canvas.h>
-#include <glib/gdate.h>
-#include "ea-calendar-item.h"
-
-static void ea_calendar_item_class_init (EaCalendarItemClass *klass);
-
-static G_CONST_RETURN gchar* ea_calendar_item_get_name (AtkObject *accessible);
-static G_CONST_RETURN gchar* ea_calendar_item_get_description (AtkObject *accessible);
-
-static gpointer parent_class = NULL;
-
-GType
-ea_calendar_item_get_type (void)
-{
- static GType type = 0;
- AtkObjectFactory *factory;
- GTypeQuery query;
- GType derived_atk_type;
-
-
- if (!type) {
- static GTypeInfo tinfo = {
- sizeof (EaCalendarItemClass),
- (GBaseInitFunc) NULL, /* base init */
- (GBaseFinalizeFunc) NULL, /* base finalize */
- (GClassInitFunc) ea_calendar_item_class_init, /* class init */
- (GClassFinalizeFunc) NULL, /* class finalize */
- NULL, /* class data */
- sizeof (EaCalendarItem), /* instance size */
- 0, /* nb preallocs */
- (GInstanceInitFunc) NULL, /* instance init */
- NULL /* value table */
- };
-
- /*
- * Figure out the size of the class and instance
- * we are run-time deriving from (GailCanvasItem, in this case)
- */
-
- factory = atk_registry_get_factory (atk_get_default_registry (),
- GNOME_TYPE_CANVAS_ITEM);
- derived_atk_type = atk_object_factory_get_accessible_type (factory);
- g_type_query (derived_atk_type, &query);
-
- tinfo.class_size = query.class_size;
- tinfo.instance_size = query.instance_size;
-
- type = g_type_register_static (derived_atk_type,
- "EaCalendarItem", &tinfo, 0);
- }
-
- return type;
-}
-
-static void
-ea_calendar_item_class_init (EaCalendarItemClass *klass)
-{
- AtkObjectClass *class = ATK_OBJECT_CLASS (klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
- class->get_name = ea_calendar_item_get_name;
- class->get_description = ea_calendar_item_get_description;
-}
-
-AtkObject*
-ea_calendar_item_new (GObject *obj)
-{
- gpointer object;
- AtkObject *atk_object;
-
- g_return_val_if_fail (E_IS_CALENDAR_ITEM (obj), NULL);
- object = g_object_new (EA_TYPE_CALENDAR_ITEM, NULL);
- atk_object = ATK_OBJECT (object);
- atk_object_initialize (atk_object, obj);
- atk_object->role = ATK_ROLE_CALENDAR;
-#ifdef ACC_DEBUG
- g_print ("ea_calendar_item created %p\n", atk_object);
-#endif
- return atk_object;
-}
-
-static G_CONST_RETURN gchar*
-ea_calendar_item_get_name (AtkObject *accessible)
-{
- GObject *g_obj;
- ECalendarItem *calitem;
- gint start_year, start_month, start_day;
- gint end_year, end_month, end_day;
- GDate select_start, select_end;
- static gchar new_name[256] = "";
-
- g_return_val_if_fail (EA_IS_CALENDAR_ITEM (accessible), NULL);
-
- if (accessible->name)
- return accessible->name;
-
- g_obj = atk_gobject_accessible_get_object (ATK_GOBJECT_ACCESSIBLE(accessible));
- g_return_val_if_fail (E_IS_CALENDAR_ITEM (g_obj), NULL);
-
- calitem = E_CALENDAR_ITEM (g_obj);
- if (e_calendar_item_get_date_range (calitem,
- &start_year, &start_month, &start_day,
- &end_year, &end_month, &end_day)) {
- ++start_month;
- ++end_month;
- sprintf (new_name, "calendar date range: from %d-%d-%d to %d-%d-%d.",
- start_year, start_month, start_day,
- end_year, end_month, end_day);
- }
- if (e_calendar_item_get_selection (calitem, &select_start, &select_end)) {
- gint year1, year2, month1, month2, day1, day2;
-
- year1 = g_date_get_year (&select_start);
- month1 = g_date_get_month (&select_start);
- day1 = g_date_get_day (&select_start);
-
- year2 = g_date_get_year (&select_end);
- month2 = g_date_get_month (&select_end);
- day2 = g_date_get_day (&select_end);
-
- sprintf (new_name + strlen (new_name),
- "current selection: from %d-%d-%d to %d-%d-%d.",
- year1, month1, day1,
- year2, month2, day2);
- }
-
- return new_name;
-}
-
-static G_CONST_RETURN gchar*
-ea_calendar_item_get_description (AtkObject *accessible)
-{
- if (accessible->description)
- return accessible->description;
-
- return "evolution calendar widget";
-}
diff --git a/a11y/widgets/ea-calendar-item.h b/a11y/widgets/ea-calendar-item.h
deleted file mode 100644
index 675cb4c6e7..0000000000
--- a/a11y/widgets/ea-calendar-item.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* vim:expandtab:shiftwidth=8:tabstop=8:
- */
-/* Evolution Accessibility: ea-calendar-item.h
- *
- * Copyright (C) 2003 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
- * 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.
- *
- * Author: Bolian Yin <bolian.yin@sun.com> Sun Microsystem Inc., 2003
- *
- */
-
-#ifndef __EA_CALENDAR_ITEM_H__
-#define __EA_CALENDAR_ITEM_H__
-
-#include <atk/atkgobjectaccessible.h>
-#include <misc/e-calendar-item.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#define EA_TYPE_CALENDAR_ITEM (ea_calendar_item_get_type ())
-#define EA_CALENDAR_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EA_TYPE_CALENDAR_ITEM, EaCalendarItem))
-#define EA_CALENDAR_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EA_TYPE_CALENDAR_ITEM, EaCalendarItemClass))
-#define EA_IS_CALENDAR_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EA_TYPE_CALENDAR_ITEM))
-#define EA_IS_CALENDAR_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EA_TYPE_CALENDAR_ITEM))
-#define EA_CALENDAR_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EA_TYPE_CALENDAR_ITEM, EaCalendarItemClass))
-
-typedef struct _EaCalendarItem EaCalendarItem;
-typedef struct _EaCalendarItemClass EaCalendarItemClass;
-
-struct _EaCalendarItem
-{
- AtkGObjectAccessible parent;
-};
-
-GType ea_calendar_item_get_type (void);
-
-struct _EaCalendarItemClass
-{
- AtkGObjectAccessibleClass parent_class;
-};
-
-AtkObject *ea_calendar_item_new (GObject *obj);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __EA_CALENDAR_ITEM_H__ */
diff --git a/a11y/widgets/ea-widgets.c b/a11y/widgets/ea-widgets.c
deleted file mode 100644
index 3b288dc669..0000000000
--- a/a11y/widgets/ea-widgets.c
+++ /dev/null
@@ -1,35 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* vim:expandtab:shiftwidth=8:tabstop=8:
- */
-/* Evolution Accessibility: ea-widgets.c
- *
- * Copyright (C) 2003 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
- * 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.
- *
- * Author: Bolian Yin <bolian.yin@sun.com> Sun Microsystem Inc., 2003
- *
- */
-
-#include "ea-factory.h"
-#include "widgets/ea-calendar-item.h"
-#include "ea-widgets.h"
-
-EA_FACTORY_GOBJECT (EA_TYPE_CALENDAR_ITEM, ea_calendar_item, ea_calendar_item_new);
-
-void e_calendar_item_a11y_init (void)
-{
- EA_SET_FACTORY (e_calendar_item_get_type (), ea_calendar_item);
-}
diff --git a/a11y/widgets/ea-widgets.h b/a11y/widgets/ea-widgets.h
deleted file mode 100644
index e9ec9b3ad9..0000000000
--- a/a11y/widgets/ea-widgets.h
+++ /dev/null
@@ -1,34 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/* vim:expandtab:shiftwidth=8:tabstop=8:
- */
-/* Evolution Accessibility: ea-widgets.h
- *
- * Copyright (C) 2003 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
- * 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.
- *
- * Author: Bolian Yin <bolian.yin@sun.com> Sun Microsystem Inc., 2003
- *
- */
-
-/* Evolution Accessibility
-*/
-
-#ifndef _EA_WIDGETS_H__
-#define _EA_WIDGETS_H__
-
-void e_calendar_item_a11y_init (void);
-
-#endif /* _EA_WIDGETS_H__ */
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index ed3992ba42..4b0aef5991 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -1,74 +1,6 @@
-2003-09-19 Gilbert Fang <gilbert.fang@sun.com>
+2003-08-13 JP Rosevear <jpr@ximian.com>
- * addressbook/gui/component/addressbook-component.c (xfer_folder):
- remove the "addressbook.db.summary" correctly. #48538
-
-2003-09-11 Dan Winship <danw@ximian.com>
-
- * backend/ebook/Makefile.am (privlib_LTLIBRARIES): Remove
- libebook-static.la
-
- * conduit/Makefile.am (libeaddress_conduit_la_LIBADD): Use
- non-static versions of libraries: the static ones were only needed
- for libtool 1.3.
-
-2003-08-26 JP Rosevear <jpr@ximian.com>
-
- * conduit/address-conduit.c (ecard_from_remote_record): duplicate
- the extra address lines
-
-2003-08-20 Gilbert Fang <gilbert.fang@sun.com>
-
- * gui/widgets/e-addressbook-util.c
- (e_addressbook_send_card_list): use memcpy to assign
- CORBA_char_sequence instead of strcpy. (#46706)
-
-2003-08-12 Rodrigo Moya <rodrigo@ximian.com>
-
- * backend/ebook/e-book.c (e_book_dispose): unref the
- EComponentListener before unloading the CORBA object.
-
-2003-08-12 Hans Petter Jansson <hpj@ximian.com>
-
- * backend/ebook/e-destination.c (e_destination_dispose): Chain.
-
- * gui/component/e-address-widget.c (e_address_widget_destroy): Chain.
- Prevent double frees. Prevent double GSource removal.
-
- * gui/component/e-cardlist-model.c (e_cardlist_model_class_init):
- Store parent class.
- (e_cardlist_model_dispose): Chain. Prevent double frees and unrefs.
-
- * gui/contact-editor/e-contact-editor-address.c
- (e_contact_editor_address_dispose): Chain.
-
- * gui/contact-editor/e-contact-editor-fullname.c
- (e_contact_editor_fullname_dispose): Chain.
-
- * gui/contact-list-editor/e-contact-list-editor.c
- (e_contact_list_editor_dispose): Chain.
-
- * gui/contact-list-editor/e-contact-list-model.c
- (contact_list_model_destroy): Chain. Prevent double frees and unrefs.
-
- * gui/widgets/e-addressbook-reflow-adapter.c (addressbook_dispose):
- Chain.
- (addressbook_finalize): Chain.
-
- * gui/widgets/e-addressbook-table-adapter.c (addressbook_dispose):
- Chain.
-
- * gui/widgets/e-addressbook-treeview-adapter.c (addressbook_destroy):
- Chain. Prevent double free.
-
- * gui/widgets/gal-view-minicard.c (gal_view_minicard_dispose):
- Chain. Prevent double free and detach.
-
- * gui/widgts/gal-view-treeview.c (gal_view_treeview_dispose):
- Chain. Prevent double free and detach.
-
- * printins/e-contact-print-style-editor.c
- (e_contact_print_stule_editor_destroy): Chain. Prevent double unref.
+ * backend/pas/pas-backend-file.c: convert db3 hashes to xml hashes
2003-07-23 Chris Toshok <toshok@ximian.com>
diff --git a/addressbook/backend/pas/pas-backend-file.c b/addressbook/backend/pas/pas-backend-file.c
index b11c62cb86..1d35684a46 100644
--- a/addressbook/backend/pas/pas-backend-file.c
+++ b/addressbook/backend/pas/pas-backend-file.c
@@ -17,7 +17,7 @@
#include <db.h>
#include <sys/stat.h>
-#include <e-util/e-db3-utils.h>
+#include <e-util/e-xml-hash-utils.h>
#if DB_VERSION_MAJOR != 3 || \
DB_VERSION_MINOR != 1 || \
@@ -29,7 +29,6 @@
#include <gal/widgets/e-unicode.h>
#include <ebook/e-card-simple.h>
-#include <e-util/e-dbhash.h>
#include <e-util/e-db3-utils.h>
#include <libgnome/gnome-i18n.h>
@@ -529,7 +528,7 @@ pas_backend_file_changes (PASBackendFile *bf,
int db_error = 0;
DBT id_dbt, vcard_dbt;
char *filename;
- EDbHash *ehash;
+ EXmlHash *ehash;
GList *i, *v;
DB *db = bf->priv->file_db;
DBC *dbc;
@@ -546,7 +545,7 @@ pas_backend_file_changes (PASBackendFile *bf,
*slash = '\0';
filename = g_strdup_printf ("%s/%s.db", dirname, view->change_id);
- ehash = e_dbhash_new (filename);
+ ehash = e_xmlhash_new (filename);
g_free (filename);
g_free (dirname);
@@ -576,15 +575,15 @@ pas_backend_file_changes (PASBackendFile *bf,
g_object_unref (card);
/* check what type of change has occurred, if any */
- switch (e_dbhash_compare (ehash, id, vcard_string)) {
- case E_DBHASH_STATUS_SAME:
+ switch (e_xmlhash_compare (ehash, id, vcard_string)) {
+ case E_XMLHASH_STATUS_SAME:
break;
- case E_DBHASH_STATUS_NOT_FOUND:
+ case E_XMLHASH_STATUS_NOT_FOUND:
ctx->add_cards = g_list_append (ctx->add_cards,
vcard_string);
ctx->add_ids = g_list_append (ctx->add_ids, g_strdup(id));
break;
- case E_DBHASH_STATUS_DIFFERENT:
+ case E_XMLHASH_STATUS_DIFFERENT:
ctx->mod_cards = g_list_append (ctx->mod_cards,
vcard_string);
ctx->mod_ids = g_list_append (ctx->mod_ids, g_strdup(id));
@@ -597,7 +596,7 @@ pas_backend_file_changes (PASBackendFile *bf,
dbc->c_close (dbc);
}
- e_dbhash_foreach_key (ehash, (EDbHashFunc)pas_backend_file_changes_foreach_key, view->change_context);
+ e_xmlhash_foreach_key (ehash, (EXmlHashFunc)pas_backend_file_changes_foreach_key, view->change_context);
/* Send the changes */
if (db_error != DB_NOTFOUND) {
@@ -622,7 +621,7 @@ pas_backend_file_changes (PASBackendFile *bf,
char *id = i->data;
char *vcard = v->data;
- e_dbhash_add (ehash, id, vcard);
+ e_xmlhash_add (ehash, id, vcard);
g_free (i->data);
g_free (v->data);
}
@@ -630,19 +629,19 @@ pas_backend_file_changes (PASBackendFile *bf,
char *id = i->data;
char *vcard = v->data;
- e_dbhash_add (ehash, id, vcard);
+ e_xmlhash_add (ehash, id, vcard);
g_free (i->data);
g_free (v->data);
}
for (i = ctx->del_ids; i != NULL; i = i->next){
char *id = i->data;
- e_dbhash_remove (ehash, id);
+ e_xmlhash_remove (ehash, id);
g_free (i->data);
}
- e_dbhash_write (ehash);
- e_dbhash_destroy (ehash);
+ e_xmlhash_write (ehash);
+ e_xmlhash_destroy (ehash);
}
static char *
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 827b997321..0747082457 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,195 +1,1321 @@
-2003-09-22 Hans Petter Jansson <hpj@ximian.com>
+2003-09-26 JP Rosevear <jpr@ximian.com>
- * cal-util/Makefile.am (libical_util_la_LIBADD):
- libical.la -> libical-evolution.la
+ * pcs/cal-backend.c (cal_backend_class_init): remove cal_added
+ signal
- * importers/Makefile.am (libevolution_calendar_importers_la_LIBADD):
- libicalvcal.la -> libicalvcal-evolution.la
+2003-09-26 JP Rosevear <jpr@ximian.com>
+
+ * pcs/cal.h: add protos
+
+ * pcs/cal.c (cal_get_backend): accessor
+ (cal_get_listener): ditto
+
+ * pcs/cal-factory.c (impl_CalFactory_getCal): update to new
+ routine name
+
+ * pcs/cal-backend.h: add protos
+
+ * pcs/cal-backend.c (cal_backend_init): init client mutex
+ (cal_backend_finalize): destroy client mutex
+ (cal_destroy_cb): just remove the client
+ (listener_died_cb): remove the client, the listener died so it
+ can't really do anything
+ (last_client_gone): signal the last client gone
+ (cal_backend_add_client): add a client with locking and listen for
+ the death of the listener
+ (cal_backend_remove_client): remove client
+
+2003-09-26 Rodrigo Moya <rodrigo@ximian.com>
+
+ * pcs/cal-backend-sync.c (_cal_backend_create_object): only free the
+ returned UID if it's not NULL.
+
+ * pcs/cal.c (cal_notify_object_created): dont send NULL strings to
+ ORBit code.
+
+2003-09-26 Rodrigo Moya <rodrigo@ximian.com>
+
+ * gui/comp-util.c (cal_comp_is_on_server): free the icalcomponent
+ returned from cal_client_get_object, and return TRUE if we find
+ the component on the backend.
+
+ * gui/e-day-view.c (process_component):
+ * gui/e-week-view.c (process_component): added missing case, so that
+ we also display recurrent meetings starting before the time range and
+ ending after the time range.
+
+ * cal-client/cal-listener.c (impl_notifyReadOnly): pass the
+ 'read_only' argument to the signal callback correctly (a gboolean
+ not a 'gboolean *').
+
+ * gui/comp-editor-factory.c (resolve_pending_requests): removed
+ the g_assert on 'oc->pending != NULL', since there are now cases
+ (local calendar) where we get to call this function (cal_opened_cb)
+ with no pending requests yet.
+
+2003-09-25 JP Rosevear <jpr@ximian.com>
+
+ * gui/calendar-commands.c (publish_freebusy_cmd): adapt to new
+ get_free_busy api
+
+ * conduits/calendar/calendar-conduit.c (post_sync): ditto
+ (pre_sync): ditto
+
+ * conduits/todo/todo-conduit.c (pre_sync): ditto
+ (post_sync): ditto
+
+ * gui/e-meeting-model.c (refresh_busy_periods): ditto
+
+ * gui/e-itip-control.c (send_freebusy): ditto
+
+ * gui/e-cal-view.c (on_publish): ditto
+
+ * cal-client/cal-listener.h: add signals
+
+ * cal-client/cal-listener.c (build_change_list): move here from
+ cal-client.c
+ (impl_notifyChanges): implement
+ (build_free_busy_list): util to create the GList of free busy
+ objects
+ (impl_notifyFreeBusy): implement
+ (cal_listener_class_init): set free busy and changes epv methods,
+ add signals
+
+ * cal-client/cal-client.h: update protos
+
+ * cal-client/cal-client.c (cal_get_changes_cb): get changes call
+ back
+ (cal_get_free_busy_cb): get free busy call back
+ (cal_client_init): listen for free busy and changes signals
+ (cal_client_get_changes): convert to new threaded sync api
+ (cal_client_get_free_busy): ditto
+
+ * pcs/cal.h: add protos
+
+ * pcs/cal.c: remove dead type conversion function
+ (impl_Cal_getChanges): implement by just calling, no return stuff
+ (impl_Cal_getFreeBusy): ditto
+ (cal_notify_changes): do getChanges callback
+ (cal_notify_free_busy): do getFreeBusy callback
+
+ * pcs/cal-backend.h: update protos, vmethods
+
+ * pcs/cal-backend.c (cal_backend_get_free_busy): call through
+ (cal_backend_get_changes): ditto
+
+ * pcs/cal-backend-sync.h: add vmethods, protos
+
+ * pcs/cal-backend-sync.c (cal_backend_sync_get_changes): call
+ through
+ (cal_backend_sync_get_free_busy): ditto
+ (_cal_backend_get_changes): backend implementation, notify
+ (_cal_backend_get_free_busy): ditto
+ (cal_backend_sync_class_init): set free busy and changes
+ implementations
+
+ * pcs/cal-backend-file.c (cal_backend_file_get_free_busy): convert
+ to sync backend method
+ (cal_backend_file_compute_changes_foreach_key): remove from the
+ hash here
+ (cal_backend_file_compute_changes): no need to build the sequence
+ here
+ (cal_backend_file_get_changes): convert to sync backend method
+ (cal_backend_file_class_init): set sync backend methods for free
+ busy and changes
+
+ * idl/evolution-calendar.idl: convert getChanges and getFreeBusy
+ to new async api
+
+2003-09-25 JP Rosevear <jpr@ximian.com>
+
+ * pcs/cal-backend.h: remove dead result enums
+
+ * pcs/cal-backend.c: fix comments
+
+ * idl/evolution-calendar.idl: remove dead exceptions
+
+2003-09-25 JP Rosevear <jpr@ximian.com>
+
+ * pcs/cal.c (cal_notify_default_object): send back the empty
+ string if the object is NULL
+ (cal_notify_object): ditto
+
+2003-09-25 JP Rosevear <jpr@ximian.com>
+
+ * gui/comp-editor-factory.c (edit_existing): convert to api
+ changes
+
+ * conduits/todo/todo-conduit.c (local_record_from_uid): ditto
+ (pre_sync): ditto
+
+ * conduits/calendar/calendar-conduit.c (local_record_from_uid):
+ ditto
+ (pre_sync): ditto
+
+ * importers/icalendar-importer.c (update_single_object): ditto
+
+ * gui/dialogs/comp-editor.c (obj_updated_cb): ditto
+
+ * gui/e-itip-control.c (get_real_item): ditto
+ (find_server): ditto
+
+ * gui/comp-util.c (cal_comp_is_on_server): ditto
+ (cal_comp_event_new_with_defaults): ditto
+ (cal_comp_task_new_with_defaults): ditto
+
+ * cal-client/cal-listener.h: add signals
+
+ * cal-client/cal-listener.c (impl_notifyDefaultObjectRequested):
+ implement
+ (impl_notifyObjectRequested): ditto
+ (cal_listener_class_init): set above epv implementations, add signals
+
+ * cal-client/cal-client.h: update protos
+
+ * cal-client/cal-client.c (cal_default_object_requested_cb): get
+ default object callback
+ (cal_object_requested_cb): get object callback
+ (cal_client_init): listen for get and get default object signals
+ (cal_client_get_default_object): convert to new sync api
+ (cal_client_get_object): ditto
+
+ * pcs/cal.h: add protos
+
+ * pcs/cal.c (impl_Cal_getDefaultObject): just call the backend, it
+ does the notification now
+ (impl_Cal_getObject): ditto
+ (cal_notify_default_object): do getDefaultObject response
+ (cal_notify_object): do getObject response
+
+ * pcs/cal-backend.h: remove vmethods, protos
+
+ * pcs/cal-backend.c: remove a couple of dead functions
+ (cal_backend_class_init): get_object_component is no longer a
+ vmethod
+ (cal_backend_get_default_object): call through
+ (cal_backend_get_object): ditto
+
+ * pcs/cal-backend-sync.h: add protos, vmethods
+
+ * pcs/cal-backend-sync.c (cal_backend_sync_get_default_object):
+ call through
+ (cal_backend_sync_get_object): ditto
+ (_cal_backend_discard_alarm): pass correct params to
+ cal_notify_discard_alarm
+ (_cal_backend_get_default_object): call through and notify
+ (_cal_backend_get_object): ditto
+ (cal_backend_sync_class_init): set backend implementations
+
+ * pcs/cal-backend-file.c (cal_backend_file_get_default_object):
+ convert to sync backend method
+ (cal_backend_file_get_object): ditto
+ (cal_backend_file_compute_changes_foreach_key): just look up the
+ component rather than using the backend vmethod
+ (cal_backend_file_remove_object): return valid sync status codes
+ (cal_backend_file_class_init): move get_object, get_default_object
+ to sync class
+
+ * idl/evolution-calendar.idl: convert getObject and
+ getDefaultObject to new async idl
+
+2003-09-25 JP Rosevear <jpr@ximian.com>
+
+ * pcs/cal.c (impl_Cal_discardAlarm): just call the backend
+ function, it does the notification
+ (cal_notify_alarm_discarded): notify of discard alarm call
+
+ * pcs/cal-backend.h: update proto
+
+ * pcs/cal-backend.c (cal_backend_discard_alarm): call through
+
+ * pcs/cal-backend-sync.h: add proto, vmethod
+
+ * pcs/cal-backend-sync.c (cal_backend_sync_discard_alarm): call
+ through
+ (_cal_backend_discard_alarm): call through and notify
+ (cal_backend_sync_class_init): set discard alarm implementation
+
+ * pcs/cal-backend-file.c (cal_backend_file_discard_alarm): match
+ sync backend vmethod
+ (cal_backend_file_class_init): set alarm vmethod implementation
+
+ * idl/evolution-calendar.idl: switch discardAlarm to new api
+
+ * gui/alarm-notify/alarm-queue.c (remove_queued_alarm): match new
+ api
+
+ * cal-client/cal-listener.h: add signal
+
+ * cal-client/cal-listener.c (impl_notifyAlarmDiscarded): implement
+ (cal_listener_class_init): add alarm, send, receive epv functions,
+ alarm signal
+
+ * cal-client/cal-client.h: update proto
+
+ * cal-client/cal-client.c (cal_alarm_discarded_cb): discardAlarm
+ callback
+ (cal_client_init): listen to discard alarm signal
+ (cal_client_discard_alarm): implement with new threaded sync api
+
+2003-09-25 JP Rosevear <jpr@ximian.com>
+
+ * idl/evolution-calendar.idl: remove unused user exceptions
+
+2003-09-24 Rodrigo Moya <rodrigo@ximian.com>
+
+ * pcs/cal-backend-util.[ch] (cal_backend_util_fill_alarm_instances_seq):
+ removed unneeded function.
+
+2003-09-24 JP Rosevear <jpr@ximian.com>
+
+ * conduits/*/*.c: adjust to new timezone api calls
+
+ * gui/*.c: ditto
+
+ * gui/dialogs/*.c: ditto
+
+ * cal-client/cal-listener.h: add new signals
+
+ * cal-client/cal-listener.c (convert_status): convert invalid
+ object as well
+ (impl_notifyTimezoneRequested): implement
+ (impl_notifyDefaultTimezoneSet): ditto
+ (cal_listener_class_init): set epv implementations for timezone
+ functions
+ (cal_listener_class_init): create timezone response signals
+
+ * cal-client/cal-client.h: update protos
+
+ * cal-client/cal-client.c: fix return values all over the place
+ (cal_get_timezone_cb): getTimezone response
+ (cal_query_cb): setDefaultTimezone response
+ (cal_client_init): listen for new response signals
+ (cal_client_get_timezone): implement using new thread sync api
+ (cal_client_ensure_timezone_on_server): use add timezone call
+ (cal_client_set_default_timezone): oimplement using new thread sync
+ api
+
+ * cal-client/cal-client-types.h: add invalid object status code
+
+ * idl/evolution-calendar.idl: getQuery no longer raises any user
+ exceptions, remove dead types and exceptions
+
+2003-09-24 JP Rosevear <jpr@ximian.com>
+
+ * pcs/cal.h: new protos
+
+ * pcs/cal.c (impl_Cal_getTimezone): call backend implementation
+ (impl_Cal_addTimezone): ditto
+ (impl_Cal_setDefaultTimezone): ditto
+ (cal_class_init): set epv implementations of timezone functions
+ (cal_notify_timezone_requested): notify of get timezone response
+ (cal_notify_default_timezone_set): notify of default timezone
+ being set
+
+ * pcs/cal-backend.h: new vmethods, protos
+
+ * pcs/cal-backend.c (cal_backend_class_init): init new timezone
+ vmethods
+ (cal_backend_get_timezone): call through
+ (cal_backend_set_default_timezone): ditto
+ (cal_backend_add_timezone): ditto
+ (cal_backend_internal_get_default_timezone): ditto
+ (cal_backend_internal_get_timezone): ditto
+
+ * pcs/cal-backend-sync.h: add vmethods, protos
+
+ * pcs/cal-backend-sync.c (cal_backend_sync_get_timezone): call
+ through
+ (cal_backend_sync_set_default_timezone): ditto
+ (_cal_backend_set_default_timezone): call through and notify
+ (_cal_backend_get_timezone): ditto
+ (cal_backend_sync_class_init): set backend implementations for new
+ funcs
+
+ * pcs/cal-backend-object-sexp.c (func_occur_in_time_range): get
+ time_t values based on the zone
+
+ * pcs/cal-backend-file.c: reorg so we don't have to prototype
+ everything
+ (cal_backend_file_get_timezone): implement the sync backend way
+ (cal_backend_file_add_timezone): ditto
+ (cal_backend_file_set_default_timezone): ditto
+ (cal_backend_file_internal_get_default_timezone): internal method,
+ for sexp comparison
+ (cal_backend_file_internal_get_timezone): ditto
+
+ * idl/evolution-calendar.idl: convert timezone routines to async
+ api
+
+2003-09-23 Rodrigo Moya <rodrigo@ximian.com>
+
+ * pcs/cal-backend-object-sexp.c (func_occur_in_time_range): dont expand
+ recurrences, since they are supposed to be expanded in the backends.
+ (instance_occur_cb, resolve_tzid): removed unneeded functions.
+
+ * pcs/cal-backend-file.c (cal_backend_file_add_timezone): guard against
+ adding the timezone if it's already there.
+
+2003-09-23 JP Rosevear <jpr@ximian.com>
+
+ * pcs/cal.c (cal_notify_object_created): notify with the object,
+ not the uid
+
+ * gui/e-cal-model.c (add_new_client): don't listen for
+ non-existent signal
+
+2003-09-23 JP Rosevear <jpr@ximian.com>
+
+ * cal-client/cal-client.h: remove dead proto
+
+2003-09-23 JP Rosevear <jpr@ximian.com>
+
+ * cal-client/cal-client.h: remove send result enum
+
+ * gui/itip-utils.c (comp_server_send): use the new send_objects
+ routine
+
+2003-09-23 JP Rosevear <jpr@ximian.com>
+
+ * cal-client/cal-client.h: remove send result enum
+
+2003-09-23 JP Rosevear <jpr@ximian.com>
+
+ * cal-client/cal-client.h: remove enum, protos
+
+ * cal-client/cal-client.c: remove remove status enum typing
+
+2003-09-23 Rodrigo Moya <rodrigo@ximian.com>
+
+ * importers/icalendar-importer.c (update_objects): new function
+ to manage the update of components, taking into account
+ VTIMEZONE components.
+ (process_item_fn, gnome_calendar_import_data_fn): use
+ update_objects instead of cal_client_update_objects.
+
+2003-09-23 JP Rosevear <jpr@ximian.com>
+
+ * pcs/cal.h: update proto
+
+ * pcs/cal.c (impl_Cal_addTimezone): just call add_timezone, it
+ does the notification
+ (cal_notify_object_created): only notify the query if the object
+ matches
+ (cal_notify_object_removed): ditto
+
+ * pcs/cal-backend.h: update proto, vmethod
+
+ * pcs/cal-backend.c (cal_backend_add_timezone): returns void
+
+ * pcs/cal-backend-sync.h: update proto, vmethod
+
+ * pcs/cal-backend-sync.c (cal_backend_sync_remove_object): add the
+ object as an out param
+ (_cal_backend_remove_object): get the object and pass it in the
+ notification
+
+ * pcs/cal-backend-file.c (cal_backend_file_create_object): kill
+ cal_backend_file_update_objects call, its more efficient to create
+ the comp ourselves; stamp the creation time, add the component to
+ the toplevel
+ (cal_backend_file_modify_object): kill the
+ cal_backend_file_update_objects call, add the component to the
+ toplevel
+ (cal_backend_file_remove_object): pass back the object when
+ removing
+
+2003-09-23 JP Rosevear <jpr@ximian.com>
+
+ * cal-client/cal-query.c (cal_query_finalize): disconnect the
+ signal handlers
+
+ * cal-client/cal-client.c (cal_client_get_query): unref the
+ listener when done
+
+2003-09-23 Rodrigo Moya <rodrigo@ximian.com>
+
+ * gui/e-cal-view.c (selection_received): add VTIMEZONE components
+ contained in the clipboard data to the backend.
+
+2003-09-22 JP Rosevear <jpr@ximian.com>
+
+ * gui/dialogs/comp-editor.c (save_comp): modify and create instead
+ of update, simplify mod code
+
+2003-09-22 JP Rosevear <jpr@ximian.com>
+
+ * gui/e-day-view.c (e_day_view_finish_long_event_resize): modify
+ the object instead of update, simplify the instance handling
+ (e_day_view_finish_resize): ditto
+ (e_day_view_on_top_canvas_drag_data_received): ditto
+ (e_day_view_on_main_canvas_drag_data_received): ditto
+
+2003-09-22 Rodrigo Moya <rodrigo@ximian.com>
+
+ * cal-client/cal-client.c (cal_client_get_alarms_in_range): use
+ 'has-alarms' function in the search expression.
+
+ * pcs/cal-backend-object-sexp.c (func_has_alarms): new SExp function.
+
+2003-09-22 JP Rosevear <jpr@ximian.com>
+
+ * gui/e-day-view.c (e_day_view_on_editing_stopped): create the
+ object if its not on the server or modify it if it is
+
+ * gui/e-week-view.c (e_week_view_on_editing_stopped): we return if
+ there is no text and it *not* on the server
+
+2003-09-22 JP Rosevear <jpr@ximian.com>
+
+ * gui/e-week-view.c (e_week_view_on_editing_stopped): create the
+ object if its not on the server or modify it if it is
+
+2003-09-22 JP Rosevear <jpr@ximian.com>
+
+ * gui/gnome-cal.h: remove proto
+
+ * gui/gnome-cal.c: remove gnome_calendar_unrecur_selection
+
+ * gui/e-week-view.h: remove proto
+
+ * gui/e-week-view.c: remove e_week_view_unrecur_appointment
+
+ * gui/e-day-view.h: remove proto
+
+ * gui/e-day-view.c: remove e_day_view_unrecur_appointment
+
+ * gui/e-cal-view.c: remove on_unrecur_appointment (this is handled
+ better via recurrence id's now)
+
+2003-09-22 JP Rosevear <jpr@ximian.com>
+
+ * gui/e-itip-control.c (update_attendee_status): ifdef out, leave
+ temporarily for reference, but otherwise it shouldn't be needed
+ (update_item): switch to using receive objects
+ (ok_clicked_cb): update item when receiving a reply
+
+ * gui/e-calendar-table.c (selection_received): switch to using
+ create object from update_objects
+
+ * gui/e-cal-view.c (selection_received_add_event): util routine to
+ prevent duplication
+ (selection_received): use above
+
+ * gui/e-cal-model.c (ecm_set_value_at): switch to using modify
+ object from update_objects
+ (ecm_append_row): switch to using create object from
+ update_objects
+
+ * gui/e-cal-model-calendar.c (ecmc_set_value_at): switch to using
+ modify object from update_objects
+
+ * gui/e-cal-model-tasks.c (ecmt_set_value_at): ditto
+
+2003-09-19 Rodrigo Moya <rodrigo@ximian.com>
+
+ * idl/evolution-calendar.idl: removed getAlarmsInRange and
+ getAlarmsForObject methods.
+
+ * pcs/cal.c (impl_Cal_getAlarmsInRange, impl_Cal_getAlarmsForObject):
+ removed unneeded CORBA methods.
+ (cal_class_init): dont set removed methods in the epv.
+
+ * pcs/cal-backend.[ch]: removed get_alarms_in_range and
+ get_alarms_for_object virtual methods.
+ (cal_backend_get_alarms_in_range, cal_backend_get_alarms_for_object):
+ removed.
+ (cal_backend_class_init): dont set removed virtual methods.
+
+ * pcs/cal-backend-file.c (cal_backend_file_get_alarms_in_range,
+ cal_backend_file_get_alarms_for_object): removed.
+ (cal_backend_file_class_init): dont set removed virtual methods.
+
+2003-09-19 Rodrigo Moya <rodrigo@ximian.com>
+
+ * cal-client/cal-client.c (cal_client_get_alarms_in_range): changed
+ to use queries.
+ (build_component_alarms_list): create the alarm list from a list
+ of iCalendar strings.
+ (build_alarm_instance_list): removed.
+ (cal_client_get_alarms_for_object): dont call the CORBA methods,
+ just get alarms by itself.
+
+2003-09-18 Rodrigo Moya <rodrigo@ximian.com>
+
+ * cal-client/cal-listener.[ch]: added "add_timezone" signal.
+ (impl_notifyTimezoneAdded): implemented new CalListener method.
+ (cal_listener_class_init): create "add_timezone" signal for the class.
+
+ * cal-client/cal-client.[ch] (cal_client_add_timezone): new function.
+ (cal_client_init): connect to "add_timezone" signal on the
+ CalListener.
+ (cal_add_timezone_cb): callback for the "add_timezone" signal.
+
+2003-09-18 Rodrigo Moya <rodrigo@ximian.com>
+
+ * idl/evolution-calendar.idl: added 'notifyTimezoneAdded' method
+ to the Calendar::Listener interface.
+
+ * pcs/cal-backend-sync.[ch] (cal_backend_sync_add_timezone):
+ (_cal_backend_add_timezone): new functions for the new virtual
+ method implementation.
+
+ * pcs/cal.[ch] (cal_notify_timezone_added): new function.
+
+ * pcs/cal-backend-file.c (cal_backend_add_timezone): converted to
+ return a CalBackendSyncStatus.
+ (cal_backend_file_class_init): the 'add_timezone' method we implement
+ is the one in the CalBackendSync class.
+ (cancel_receive_object): added missing 'return'.
+ (free_cal_component): removed unused function.
+
+2003-09-17 Rodrigo Moya <rodrigo@ximian.com>
+
+ * pcs/cal-backend-file.c (cal_backend_add_timezone): added new
+ virtual method implementation.
+
+ * pcs/cal.c (impl_Cal_addTimezone): check return value from
+ cal_backend_add_timezone, and set an exception if an error is
+ returned.
2003-09-16 Rodrigo Moya <rodrigo@ximian.com>
- * conduits/todo/Makefile.am: removed libwombat reference.
+ * idl/evolution-calendar.idl: added addTimezone method.
+
+ * pcs/cal.c (impl_Cal_addTimezone): implemented new method.
+ (cal_class_init): set new method on the epv.
+
+ * pcs/cal-backend.[ch]: added 'add_timezone' virtual method.
+ (cal_backend_add_timezone): implemented new virtual method.
+
+ * pcs/cal-backend-file.c (cal_backend_file_modify_object): it's
+ cal_component_get_as_string, not cal_component_as_string.
+
+ * cal-client/cal-client.c (cal_client_ensure_timezone_on_server):
+ dont use anymore updateObjects method, use addTimezone instead.
+
+2003-09-15 Rodrigo Moya <rodrigo@ximian.com>
+
+ * pcs/cal-backend-file.c (cal_backend_file_create_object): return
+ the UID of the added object.
+ (cal_backend_file_remove_object): ditto for old_object.
+
+2003-09-15 <jpr@ximian.com>
+
+ * conduits/todo/todo-conduit.c (replace_record): switch to modify
+ object
+ (add_record): switch to using create object
+
+ * conduits/calendar/calendar-conduit.c (process_multi_day): switch
+ to using create object
+ (add_record): switch to using create object
+ (replace_record): switch to modify object
+
+ * cal-client/cal-listener.h: add signals
+
+ * cal-client/cal-listener.c (impl_notifyObjectsReceived):
+ implement listener method
+ (build_object_list): ditto
+ (cal_listener_class_init): create receive_objects and send_objects
+ signals
+
+ * cal-client/cal-client.h: add, update protos
+
+ * cal-client/cal-client.c (cal_objects_received_cb):
+ receive_objects callback
+ (cal_objects_sent_cb): send_objects callback
+ (cal_client_init): listen for above signals
+ (cal_client_create_object): pass back uid
+ (cal_client_receive_objects): implement
+ (cal_client_send_objects): ditto
+
+ * idl/evolution-calendar.idl: add receive/send objects methods and
+ yank updateObjects
+
+ * pcs/cal.h: add protos
+
+ * pcs/cal.c (impl_Cal_receiveObjects): implement
+ (impl_Cal_sendObjects): ditto
+ (cal_class_init): add epv methods
+ (cal_notify_objects_received): notify of objects received call,
+ updating queries
+ (cal_notify_objects_sent): notify of objects sent
+
+ * pcs/cal-backend.h: remove proto
+
+ * pcs/cal-backend.c (cal_backend_class_init): remove obj_updated
+ signal
+ (cal_backend_class_init): init vmethods properly
+ (cal_backend_receive_objects): call through
+ (cal_backend_send_objects): ditto
+
+ * pcs/cal-backend-sync.h: add protos, vmethods
+
+ * pcs/cal-backend-sync.c (cal_backend_sync_receive_objects): call
+ through
+ (cal_backend_sync_send_objects): ditto
+ (_cal_backend_receive_objects): call backend method and notify
+ (_cal_backend_send_objects): ditto
+ (cal_backend_sync_class_init): override send/receive object
+ vmethods
+
+ * pcs/cal-backend-file.c (cal_backend_file_class_init): set
+ remove/send objects sync vmethods
+ (cal_backend_file_create_object): remove call to dead method
+ (cal_backend_file_remove_object): ditto
+ (cal_backend_file_modify_object): ditto
+ (cancel_received_object): cancel an object
+ (check_tzids): check we have all the tzid's for the object
+ (cal_backend_file_receive_objects): receive a bunch of objects via
+ itip
+ (cal_backend_file_send_objects): skeleton implementation
+
+2003-09-15 Rodrigo Moya <rodrigo@ximian.com>
+
+ * idl/evolution-calendar.idl: added InvalidObject CallStatus.
+
+ * pcs/cal-backend-file.c (cal_backend_file_create_object): implemented.
+ (cal_backend_file_modify_object): implemented.
+
+2003-09-12 Rodrigo Moya <rodrigo@ximian.com>
+
+ * pcs/cal.c (cal_notify_cal_address, cal_notify_alarm_email_address,
+ cal_notify_ldap_attribute, cal_notify_static_capability):
+ make sure we always notify listeners, regardless of whether the
+ string is empty or not.
+
+ * cal-client/cal-client.c (check_capability): guard against using
+ NULL strings with strstr.
+
+2003-09-12 JP Rosevear <jpr@ximian.com>
+
+ * cal-client/client-test.c (cal_opened_cb): listen for other query
+ signals
+
+ * cal-client/cal-listener.h: add signals
+
+ * cal-client/cal-listener.c (impl_notifyObjectCreated): implement
+ (impl_notifyObjectModified): implement
+ (cal_listener_class_init): assign epv implementations
+ (cal_listener_class_init): add create/modify object signals
+
+ * cal-client/cal-client.h: add protos
+
+ * cal-client/cal-client.c (cal_object_created_cb): object created
+ callback
+ (cal_object_modified_cb): object modified callback
+ (cal_client_init): listen for create/modify object signals from
+ the listener
+ (cal_client_create_object): call the create object method
+ (cal_client_modify_object): call the modify object method
+
+ * cal-client/client-test.c (cal_opened_cb): listen for all the
+ query signals, tidy
+
+2003-09-12 JP Rosevear <jpr@ximian.com>
+
+ * pcs/cal.c (impl_Cal_createObject): implement
+ (impl_Cal_modifyObject): ditto
+ (cal_class_init): set epv methods for create/modify
+
+ * pcs/cal-backend.h: add protos, vmethod
+
+ * pcs/cal-backend.c (cal_backend_class_init): init new vmethods
+ (cal_backend_create_object): call through
+ (cal_backend_modify_object): ditto
+
+ * pcs/cal-backend-sync.h: add protos, vmethods
+
+ * pcs/cal-backend-sync.c (cal_backend_sync_create_object): call
+ through
+ (cal_backend_sync_modify_object): ditto
+ (_cal_backend_create_object): create object and notify
+ (_cal_backend_modify_object): modify object and notify
+
+ * pcs/cal-backend-file.c (cal_backend_file_create_object):
+ skeleton routine for creating objects
+ (cal_backend_file_modify_object): ditto for modifying
+
+ * idl/evolution-calendar.idl: add createObject and modifyObject
+ calls
+
+2003-09-12 JP Rosevear <jpr@ximian.com>
+
+ * pcs/cal.c (cal_notify_object_removed): its uid, not uids
+
+2003-09-12 JP Rosevear <jpr@ximian.com>
+
+ * pcs/query.h: add protos
+
+ * pcs/query.c (query_object_matches): use the sexp to check for a
+ match
+ (query_notify_objects_added_1): notify of one object added to
+ query
+ (query_notify_objects_modified_1): ditto for modification
+ (query_notify_objects_removed_1): ditto for removal
+
+ * pcs/cal.h: add protos
+
+ * pcs/cal.c (cal_notify_object_created): notify of object creation
+ (cal_notify_object_modified): notify of object modification
+ (cal_notify_object_removed): use the _1 routines
+
+ * pcs/cal-backend-file.c (match_recurrence_sexp): this returns a
+ boolean
+ (cal_backend_file_update_objects): don't signal removals here now
+
+ * idl/evolution-calendar.idl: add object created and modified
+ responses
+
+2003-09-11 JP Rosevear <jpr@ximian.com>
+
+ * pcs/cal.h: update proto
+
+ * pcs/cal.c (cal_notify_object_removed): notify relevant queries
+ of removal
+
+ * pcs/cal-backend.c (cal_backend_get_queries): ref the list before
+ passing it back
+
+ * pcs/cal-backend-sync.c (_cal_backend_remove_object): pass uid to
+ notification
+
+2003-09-11 JP Rosevear <jpr@ximian.com>
+
+ * pcs/cal-backend-file.c (match_recurrence_sexp): don't unref the
+ component
+
+ * cal-client/client-test.c (cal_opened_cb): listen to objects
+ added signal
+ (objects_added_cb): print the object uid
+
+2003-09-11 JP Rosevear <jpr@ximian.com>
+
+ * pcs/cal-backend-object-sexp.c (cal_backend_object_sexp_text):
+ return the base text
+
+2003-09-11 JP Rosevear <jpr@ximian.com>
+
+ * gui/gnome-cal.c (update_query): fix c/p typo
-2003-09-15 Harry Lu <harry.lu@sun.com>
+2003-09-11 JP Rosevear <jpr@ximian.com>
- * gui/apps_evolution_calendar.schemas: change last_notification_time's
- type from string to int.
+ * gui/gnome-cal.c (update_query): start the query
-2003-09-12 Bolian Yin <bolian.yin@sun.com>
+ * gui/e-cal-model.c (update_query_for_client): ditto
- * e-week-view.c (e_week_view_focus): make jump button focusable
- (e_week_view_on_jump_button_event): key_press and focus event for jump button
- (e_week_view_jump_to_button_item): new function, jump to the day view.
- (e_week_view_is_jump_button_visible): new function.
+ * cal-client/client-test.c (cal_opened_cb): ditto
+
+2003-09-11 JP Rosevear <jpr@ximian.com>
+
+ * cal-client/cal-query.h: add proto
+
+ * cal-client/cal-query.c (cal_query_start): start the query
+
+2003-09-11 JP Rosevear <jpr@ximian.com>
+
+ * gui/dialogs/delete-error.c (delete_error_dialog): accept GError
+ and base error messages on that
+
+ * gui/dialogs/delete-error.h: update proto
+
+ * gui/e-tasks.c (e_tasks_delete_completed): pass extra param to
+ cal_client_remove_object
+
+ * conduits/todo/todo-conduit.c (delete_record): ditto
+
+ * conduits/calendar/calendar-conduit.c (process_multi_day): ditto
+ (delete_record): ditto
+
+ * gui/gnome-cal.c (gnome_calendar_purge): ditto
+
+ * gui/dialogs/comp-editor.c (delete_comp): ditto
+
+ * gui/e-cal-view.c (e_cal_view_cut_clipboard): pass the error to
+ delete_error_dialog
+ (delete_event): ditto
+ (e_cal_view_delete_selected_occurrence): ditto
+
+ * gui/e-itip-control.c (remove_item): ditto
+
+ * gui/e-calendar-table.c (delete_selected_components): ditto
+
+ * cal-client/cal-listener.h: add signal
+
+ * cal-client/cal-listener.c (impl_notifyObjectRemoved): implement
+ (cal_listener_class_init): set object removed implementation and
+ create signal
+
+ * cal-client/cal-client.h: update protos
+
+ * cal-client/cal-client.c (cal_object_removed_cb): object removal
+ callback
+ (cal_client_init): listen for object removal signal
+ (cal_client_remove_object_with_mod): make call synchronous
+ (cal_client_remove_object): pass new params
+
+ * pcs/cal.h: add proto
+
+ * pcs/cal.c (impl_Cal_removeObject): just call the backend
+ function
+ (cal_notify_object_removed): notify of removal
+
+ * pcs/cal-backend.h: remove and update protos, remove signal
+
+ * pcs/cal-backend.c (cal_backend_class_init): kill obj_removed
+ signal
+ (cal_backend_remove_object): there is no return value now
+
+ * pcs/cal-backend-sync.h: add vmethod, proto
+
+ * pcs/cal-backend-sync.c (cal_backend_sync_remove_object): call
+ through
+ (_cal_backend_remove_object): remove the object and then do the
+ notification
+
+ * pcs/cal-backend-file.c (cal_backend_file_class_init): remove
+ object is not part of the sync class
+ (cal_backend_file_update_objects): there is no more removed signal
+ (cal_backend_file_remove_object): return sync status codes
+
+ * idl/evolution-calendar.idl: make removeObject oneway and and a
+ notification method in the listener
+
+2003-09-11 Rodrigo Moya <rodrigo@ximian.com>
+
+ * pcs/query.[ch] (query_get_text): new function.
+ (query_get_object_sexp): new function.
+
+ * pcs/cal-backend-file.c (cal_backend_file_start_query): implemented.
+
+2003-09-10 JP Rosevear <jpr@ximian.com>
+
+ * pcs/cal.h: update proto
+
+ * pcs/cal.c (impl_Cal_getObjectList): just call the backend, it
+ will do the notification now
+ (cal_notify_object_list): the list is a list of strings
+
+ * pcs/cal-backend.h: update vmethod, proto
+
+ * pcs/cal-backend.c (cal_backend_get_object_list): call through
+
+ * pcs/cal-backend-sync.h: add proto, vmethod
+
+ * pcs/cal-backend-sync.c (cal_backend_sync_get_object_list): call
+ through
+ (_cal_backend_get_object_list): get the list of objects from the
+ sync backend and do the notification
+ (cal_backend_sync_class_init): set vmethod implementation
+
+ * pcs/cal-backend-file.c (cal_backend_file_class_init): the get
+ object list call is now part of the sync backend
+ (cal_backend_file_get_object_list): return a status and put the
+ object list in the passed in param
+
+2003-09-10 JP Rosevear <jpr@ximian.com>
+
+ * pcs/cal-backend.c (cal_backend_finalize): unref the elist
+ (cal_backend_init): init the query elist
-2003-09-11 Hans Petter Jansson <hpj@ximian.com>
+2003-09-10 JP Rosevear <jpr@ximian.com>
- * cal-util/Makefile.am (libcal_util_la_LIBADD):
- libical-evolution.la -> libical.la
+ * gui/gnome-cal.c (dn_query_objects_added_cb): match new query
+ signals - just tag here
+ (dn_query_objects_modified_cb): always retag
+ (dn_query_objects_removed_cb): ditto
+ (update_query): connect to new signals
+ (gnome_calendar_destroy): we don't keep a list of expunging
+ queries
+ (gnome_calendar_purge): no need to do the
+ expunge async, just get the object list immediately
- * cal-util/cal-component.c (cal_component_get_classification)
- (cal_component_set_classification)
- (get_text_list)
- (get_icaltimetype)
- (get_datetime)
- (get_period_list)
- (get_recur_list)
- (cal_component_get_transparency)
- (cal_component_set_transparency): Adapt to new libical.
+ * gui/e-tasks.c (e_tasks_delete_completed): no need to do the
+ expunge async, just get the object list immediately
- * cal-util/cal-util.c (cal_util_event_dates_match): Ditto.
+ * gui/e-cal-model.c (query_objects_added_cb): callback for objects
+ added to the query
+ (query_objects_modified_cb): ditto for modifications
+ (query_objects_removed_cb): ditto for removed
+ (query_progress_cb): progress of the query
+ (query_done_cb): query is done
+ (update_query_for_client): connect to the new signals
- * pcs/cal-backend-file.c (create_user_free_busy): Ditto.
+ * cal-client/client-test.c (cal_opened_cb): run a query
- * gui/e-cal-model-tasks.c (get_completed)
- (get_due)
- (get_due_status): Ditto.
+ * cal-client/cal-query.c: we are given the listener now - listen
+ for signals from the listener and emit signals matching the api
+ changes
- * gui/e-cal-model.c (get_dtstart)
- (set_classification): Ditto.
+ * cal-client/query-listener.[hc]: rewrite to match new query
+ listener methods and emit signals rather than using function
+ callbacks
- * gui/e-cal-model-calendar.c (get_dtend)
- (get_transparency)
- (set_transparency): Adapt to new libical and fix a comparison bug.
+ * cal-client/cal-marshal.list: add to marshallers
- * importers/Makefile.am (libevolution_calendar_importers_la_LIBADD):
- libical-evolution.la -> libical.la
+ * cal-client/cal-listener.h: add query signal
-2003-09-11 Dan Winship <danw@ximian.com>
+ * cal-client/cal-listener.c (impl_notifyQuery): implement
+ (cal_listener_class_init): set notifyQuery method
+ (cal_listener_class_init): add query signal
- * cal-util/Makefile.am (privlib_LTLIBRARIES): Remove
- libcal-util-static.la
+ * cal-client/cal-client.h: update protos
- * cal-client/Makefile.am (noinst_LTLIBRARIES): Remove
- libcal-client-static.la
+ * cal-client/cal-client.c (cal_query_cb): handle response to
+ getQuery
+ (cal_client_init): listen for query signal
+ (cal_client_get_query): get a query from the calendar
- * conduits/calendar/Makefile.am (libecalendar_conduit_la_LIBADD):
- use non-static libraries. The static ones were only needed for
- libtool 1.3.
+ * pcs/query.h: update protos
- * conduits/todo/Makefile.am (libetodo_conduit_la_LIBADD): Likewise
+ * pcs/query.c: rewrite to implement the query start method and
+ provide notification calls
- * gui/Makefile.am (IDL_GENERATED): Don't compile the calendar idl
- here. It's already in libcal-client.
+ * pcs/cal.h: add proto
-2003-09-11 Frederic Crozat <fcrozat@mandrakesoft.com>
+ * pcs/cal.c (impl_Cal_getQuery): re-implement so the backend
+ doesn't create the query for us
+ (cal_notify_query): respond with the query
- * conduits/todo/Makefile.am:
- Statically link with wombat. Fix ETodo conduit.
- (Mdk bug #5348)
+ * pcs/cal-factory.c: re-order includes
-2003-09-01 Andrew Wu <Yang.Wu@sun.com>
- * gui/e-day-view.c:
- (e_day_view_change_event_end_time_up):
- (e_day_view_change_event_end_time_down):
- Use "ctrl+shift+alt+Up/Down" to change the end time of the editing event.
+ * pcs/cal-common.h: add types
-2003-08-28 Hans Petter Jansson <hpj@ximian.com>
+ * pcs/cal-backend.h: update protos, vmethods
- * gui/alarm-notify/alarm-queue.c (tray_icon_blink_cb)
- (display_notification): Use images that come with Evolution instead
- of unreleased stock, for now.
+ * pcs/cal-backend.c (cal_backend_class_init): init start_query
+ vmethod
+ (cal_backend_finalize): free mutex
+ (cal_backend_start_query): call through
+ (cal_backend_add_query): add a query to the list the backend is
+ running
+ (cal_backend_get_queries): get the query list
-2003-08-28 Hans Petter Jansson <hpj@ximian.com>
+ * pcs/cal-backend-object-sexp.h: add proto
- * gui/alarm-notify/util.[ch]: Added alarm-notify utils.
+ * pcs/cal-backend-file.c (cal_backend_file_start_query): skeleton
+ for new backend implementation
- * gui/alarm-notify/Makefile.am: Added alarm-notify utils.
+ * pcs/Makefile.am: don't build dead files
- * gui/alarm-notify/alarm-notify-dialog.c (timet_to_str_with_zone):
- Move to util.c.
+ * idl/evolution-calendar.idl: make the getQuery call async, make
+ the query listener calls oneway and match the addressbook
- * gui/alarm-notify/alarm-queue.c (notify_dialog_cb)
- (on_dialog_removed_cb)
- (notify_dialog_cb)
- (tray_icon_destroyed_cb)
- (tray_icon_clicked_cb)
- (tray_icon_blink_cb)
- (display_notification): Add Rodrigo Moya's code for tray icon
- notification of appointments, with some fixes and blink code by me.
- Requires HEAD gnome-icon-theme for now.
+2003-09-09 Rodrigo Moya <rodrigo@ximian.com>
-2003-08-27 Hans Petter Jansson <hpj@ximian.com>
+ * pcs/cal-backend-file.c (cal_backend_file_get_object_component):
+ added case for getting the individual recurrences if 'rid' is
+ not NULL,
- Fixes #29032.
+2003-09-09 Rodrigo Moya <rodrigo@ximian.com>
- * gui/dialogs/task-details-page.c (status_changed): When task status
- is set to "In Progress", set percent complete to 50% only if it was
- previously set to 0% or 100%.
+ * pcs/cal-backend-file.c (match_object_sexp): expand recurrences
+ for recurrent objects.
+ (match_recurrence_sexp): add the recurrences that match the query
+ expression to the object list.
-2003-08-27 Bolian Yin <bolian.yin@sun.com>
+2003-09-08 Rodrigo Moya <rodrigo@ximian.com>
- * gui/Makefile.am use libevolution-calendar-a11y instead of libevolution-a11y.
+ * pcs/cal-backend-file.c: don't store all recurrences in the
+ private structure.
+
+2003-09-04 Rodrigo Moya <rodrigo@ximian.com>
+
+ * gui/e-day-view.c (process_component):
+ * gui/e-week-view.c (process_component): dont expand recurrences,
+ since they are now expanded by the backends.
+
+2003-09-02 JP Rosevear <jpr@ximian.com>
+
+ * gui/tasks-control.c (sensitize_commands): adapt to cal-client
+ threaded sync api changes
+
+ * gui/itip-utils.c (itip_organizer_is_user): ditto
+
+ * gui/gnome-cal.c (gnome_calendar_purge): ditto
+
+ * gui/e-meeting-model.c (process_section): ditto
+
+ * gui/e-calendar-table.c (e_calendar_table_show_popup_menu): ditto
+
+ * gui/e-cal-view.c (e_cal_view_create_popup_menu): ditto
+
+ * gui/calendar-commands.c (sensitize_calendar_commands): ditto
+ (sensitize_taskpad_commands): ditto
-2003-08-26 Jack Jia <jack.jia@sun.com>
+ * gui/dialogs/task-editor.c (set_menu_sens): ditto
- ** Fixes #47863.
+ * gui/dialogs/meeting-page.c (meeting_page_construct): ditto
- * gui/alarm-notify/alarm-notify.c (AlarmNotify_removeCalendar): set
- the initial value of lc_ptr and orig_str_ptr to NULL to avoid crash.
+ * gui/dialogs/event-editor.c (set_menu_sens): ditto
-2003-08-22 Frederic Crozat <fcrozat@mandrakesoft.com>
+ * gui/dialogs/alarm-page.c (add_clicked_cb): ditto
- * gui/alarm-notify/notify-main.c: (main):
- Ensure we get UTF-8 strings from gettext.
+ * conduits/calendar/calendar-conduit.c (pre_sync): convert to
+ cal_client api changes
-2003-08-22 Bolian Yin <bolian.yin@sun.com>
+ * conduits/todo/todo-conduit.c (pre_sync): ditto
+
+ * cal-client/client-test.c (list_uids): match new error handling
+
+ * cal-client/cal-marshal.list: marshallers
+
+ * cal-client/cal-listener.[hc]: emit signals for corba listener
+ callbacks - start with is_read_only, get_static_capabilities,
+ get_cal_address, get_ldap_attribute, open, remove and object_list
+
+ * cal-client/cal-client.h: move the status enum away from here,
+ update protos to new thread sync api standard
+
+ * cal-client/cal-client.c: the listener emits signals instead of
+ using callback functions now and we return booleans + GError in
+ outs for results
+ (e_calendar_error_quark): for GError handling
+ (cal_read_only_cb): handle listener op callback
+ (cal_cal_address_cb): ditto
+ (cal_alarm_address_cb): ditto
+ (cal_ldap_attribute_cb): ditto
+ (cal_static_capabilities_cb): ditto
+ (cal_opened_cb): ditto
+ (cal_removed_cb): ditto
+ (cal_object_list_cb): ditto
+
+ * cal-client/cal-client-types.h: add GError stuff
+
+ * cal-client/Makefile.am: build glib marshal stuff
+
+ * pcs/query.c (backend_opened_cb): comment out some break
+ temporarily
+
+ * pcs/cal.h: add protos
+
+ * pcs/cal.c (impl_Cal_open): just call the backend method, it will
+ handle the notification
+ (impl_Cal_remove): ditto
+ (impl_Cal_isReadOnly): ditto
+ (impl_Cal_getCalAddress): ditto
+ (impl_Cal_getAlarmEmailAddress): ditto
+ (impl_Cal_getLdapAttribute): ditto
+ (impl_Cal_getStaticCapabilities): ditto
+ (impl_Cal_getObjectList): simplify
+ (cal_new): set poa to be threaded
+ (cal_notify_read_only): notification utils
+ (cal_notify_cal_address): ditto
+ (cal_notify_alarm_email_address): ditto
+ (cal_notify_ldap_attribute): ditto
+ (cal_notify_static_capabilities): ditto
+ (cal_notify_open): ditto
+ (cal_notify_remove): ditto
+ (cal_notify_object_list): ditto
+
+ * pcs/cal-factory.c (impl_CalFactory_getCal): dup the key and the
+ object
+ (cal_factory_new): set poa to be threaded
+
+ * pcs/cal-backend.h: update vmethods and protos
+
+ * pcs/cal-backend.c (cal_backend_get_cal_address): we no longer
+ return anything - the callee is responsible for notification
+ (cal_backend_get_alarm_email_address): ditto
+ (cal_backend_get_ldap_attribute): ditto
+ (cal_backend_get_static_capabilities): ditto
+ (cal_backend_open): ditto
+ (cal_backend_remove): ditto
+
+ * pcs/cal-backend-file.h: update inheritance
+
+ * pcs/cal-backend-file.c: inherit from CalBackendSync and make
+ is_read_only, get_static_capabilities, get_cal_address, get_ldap_attribute, open and
+ remove match
+
+ * pcs/Makefile.am: build new files
+
+2003-09-02 JP Rosevear <jpr@ximian.com>
+
+ * idl/evolution-calendar.idl: make all listener callbacks one ways
+
+2003-09-02 Rodrigo Moya <rodrigo@ximian.com>
+
+ * pcs/cal-backend-file.c (match_recurrence_sexp, match_object_sexp):
+ new callbacks for g_hash_table_foreach in get_object_list.
+ (cal_backend_file_get_object_list): don't use the priv->comp list
+ to check the components, use the hash table, which contains all
+ the recurrences already expanded.
+ (add_component): only expand recurrences for recurrent components.
+
+2003-08-29 Rodrigo Moya <rodrigo@ximian.com>
+
+ * pcs/cal-backend-file.c (lookup_component): take into account the 'rid'
+ argument.
+ (get_rid_string): new function to convert the recurrence ID to string.
+ (add_recurrence_to_object): callback for cal_recur_generate_instances.
+ (add_component): expand recurrences and g_strdup the hash's key.
+ (free_cal_component): free also the hash's key.
+
+2003-08-26 Rodrigo Moya <rodrigo@ximian.com>
+
+ * idl/evolution-calendar.idl: QueryListener::notifyObjUpdated now gets
+ a sequence of CalObj's.
+
+ * pcs/query.c (add_component): send the whole object to the listener,
+ not just the UID. Improved the way the listeners are notified, by allocating
+ a CORBA sequence to be used for all listeners, not one for each.
+ (match_component): pass the CalComponent to add_component, not only the UID.
+ (start_cached_query_cb): send the whole object to the listener.
+
+ * cal-client/cal-query.[ch]: changed argument names for "obj_updated"
+ signal.
+ (obj_updated_cb): pass the calobj's, not uid's.
+
+ * gui/e-tasks.c (query_obj_updated_cb):
+ * gui/gnome-cal.c (dn_query_obj_updated_cb, purging_obj_updated_cb):
+ * gui/e-cal-model.c (query_obj_updated_cb): we now get the object's
+ string representation instead of the UID.
+
+2003-08-25 Rodrigo Moya <rodrigo@ximian.com>
+
+ * cal-client/cal-client.c (cal_client_get_object): added a 'rid' argument
+ to match the IDL method.
+
+ * conduits/calendar/calendar-conduit.c (local_record_from_uid):
+ * conduits/todo/todo-conduit.c (local_record_from_uid):
+ * gui/comp-editor-factory.c (edit_existing):
+ * gui/comp-util.c (cal_comp_is_on_server):
+ * gui/e-cal-model.c (query_obj_updated_cb):
+ * gui/e-itip-control.c (find_server, get_real_item, update_attendee_status):
+ * gui/gnome-cal.c (dn_query_obj_updated_cb, purging_obj_updated_cb):
+ * gui/dialogs/comp-editor.c (obj_updated_cb): adapted to changes in
+ cal_client_get_object().
+
+2003-08-23 Rodrigo Moya <rodrigo@ximian.com>
- Fixes #47779
+ * pcs/query-backend.c (object_updated_cb):
+ * pcs/cal-backend.c (cal_backend_get_type_by_uid): use 'rid' parameter
+ where appropriate.
- * gnome-cal.c (gnome_calendar_get_visible_time_range): fix the return value bug.
+ * pcs/cal-backend-file.c (check_dup_uid): removed unused variables.
+ (cal_backend_file_compute_changes_foreach_key): pass a NULL 'rid'
+ to cal_backend_get_object().
+ (lookup_component): get a 'rid' argument also.
+ (cal_backend_file_cancel_object, cal_backend_file_remove_object):
+ pass correct number of parameters to lookup_component().
-2003-08-21 Rodrigo Moya <rodrigo@ximian.com>
+2003-08-22 Rodrigo Moya <rodrigo@ximian.com>
- * cal-client/cal-client.[ch] (cal_client_send_object): use a 'char **'
- for the 'error_msg' argument, instead of a fixed size string.
+ * idl/evolution-calendar.idl: use UID/RID pairs to identify objects.
- * gui/itip-utils.c (comp_server_send): pass the correct parameter to
- cal_client_send_object.
+ * pcs/cal.c (impl_Cal_getObject): added 'rid' parameter.
-2002-08-20 Hans Petter Jansson <hpj@ximian.com>
+ * pcs/cal-backend.c (cal_backend_get_object): added 'rid' parameter.
+ (cal_backend_get_object_component): ditto.
+ (get_object): ditto.
- * gui/e-itip-control.c (start_defalt_server): Rename to
- start_default_server_async () and don't run a nested main loop. Let
- the caller deal with the client object and signals.
- (default_server_started_cb): Implement. Async signal handler for
- 'cal_opened' signal, does the embedding.
- (object_requested_cb): Rewritten to work asynchronously, and finish
- the embedding when default_server_started_cb() is called.
+ * pcs/cal-backend-file.c (cal_backend_file_get_object_component):
+ added 'rid' parameter.
+ (lookup_component): added 'rid' parameter and made it search for the
+ recurrence when that parameter is not NULL.
+ (cal_backend_file_get_alarms_for_object, cal_backend_file_update_object):
+ adapted to changes in lookup_component().
2003-08-20 Rodrigo Moya <rodrigo@ximian.com>
- * gui/e-calendar-table.c (setup_popup_icons): new function to set icons
- on the popup menu items.
- (e_calendar_table_show_popup_menu): call setup_popup_icons.
-
- * gui/e-cal-view.c (setup_popup_icons): set more icons for the
- popup menu.
-
-2003-08-20 Bolian Yin <bolian.yin@sun.com>
-
- * gui/Makefile.am : Add a11y dependency.
- * gui/calendar-commands.c (calendar_get_text_for_folder_bar_label)
- * gui/e-cal-view.c: Add two new events: "event_changed" and "event_added"
- * gui/e-day-view.c (e_day_view_class_init): init a11y.
- (e_day_view_find_event_from_item): make it public from private
- (e_day_view_update_event_cb): emit "event_changed" signal
- (e_day_view_reshape_day_event): emit "event_added" signal
- (e_day_view_reshape_long_event): emit "event_added" signal
- * gui/e-week-view.c (e_week_view_class_init): init a11y.
- (e_week_view_find_event_from_item): make it public from private
- (e_week_view_update_event_cb): emit "event_changed" signal
- (e_week_view_reshape_event_span): emit "event_added" signal
- * gui/gnome-cal.c (gnome_calendar_class_init): init a11y.
- (gnome_calendar_get_e_calendar_widget),
- (gnome_calendar_get_search_bar_widget),
- (gnome_calendar_get_view_notebook_widget): new functions
+ * pcs/query-backend.c (foreach_uid_cb): use the icalcomponent
+ to call icalcomponent_get_uid, not the string.
-2003-08-19 Rodrigo Moya <rodrigo@ximian.com>
+2003-08-20 Rodrigo Moya <rodrigo@ximian.com>
- * gui/e-cal-model-tasks.c (ecmt_get_color_for_component): use
- "black" for normal tasks, since the light colors from the palette
- are too light.
+ * pcs/cal-backend-file.c: store objects by UID and RID.
+ (free_object): new function to free the CalBackendFileObject structure.
+ (cal_backend_file_dispose): use free_object callback to remove the
+ objects in the comp_uid_hash.
+ (lookup_component): search correctly the component in the new hash
+ table organizarion.
+ (check_dup_uid): ditto.
+ (add_component): ditto.
+ (remove_component): ditto.
+
+2003-08-19 JP Rosevear <jpr@ximian.com>
+
+ * gui/gnome-cal.c (setup_widgets): set up models here
+ (gnome_calendar_construct): not here
+
+ * conduits/calendar/calendar-conduit.c
+ (e_calendar_context_destroy): we have a list of calcomponents
+ rather than uids now
+ (process_multi_day): build a list of components rather than uids
+ (pre_sync): use get_object_list instead of getting uids
+ (for_each): create local records from calcomponents
+
+ * conduits/todo/todo-conduit.c: as above
+
+ * gui/print.c (instance_cb): mark as true if we found an instance
+ (print_month_small): see if atleast one instance exists in a
+ slight different way
+
+ * cal-client/client-test.c (list_uids): use get_object_list
+
+ * cal-client/cal-listener.h: update protos
+
+ * cal-client/cal-listener.c (cal_listener_class_init): set object
+ list callback implementation
+ (impl_notifyObjectListRequested): implement
+ (cal_listener_construct): take object list callback function
+ (cal_listener_new): ditto
+
+ * cal-client/cal-client.h: update protos, add status
+
+ * cal-client/cal-client.c (e_calendar_new_op): create new op
+ (e_calendar_get_op): retrieve current op
+ (e_calendar_free_op): free the op
+ (e_calendar_remove_op): clear current op
+ (cal_client_init): create new mutex
+ (cal_client_finalize): destroy mutex
+ (build_object_list): build list of icalcomponents
+ (cal_object_list_cb): handle getObjectList response
+ (real_open_calendar): pass extra listener arg
+ (cal_client_get_object_list): implement using thread safe mutex
+ locking
+ (cal_client_get_object_list_as_comp): return calcomponents instead
+ of icalcomponents
+ (cal_client_generate_instances): just get the object list - no
+ need to make it atomic since get_object_list is already atomic
+
+ * pcs/query.c (query_finalize): free new sexp class
+ (parse_sexp): use new sexp class
+ (match_component): ditto
+
+ * pcs/query-backend.c (foreach_uid_cb): use icalcomponent to
+ extract uid
+ (query_backend_new): get all objects using object list call
+
+ * pcs/cal.c (impl_Cal_getObjectList): implement
+ (cal_class_init): adjust for idl method changes
+
+ * pcs/cal-backend.h: update vmethods, add proto
+
+ * pcs/cal-backend.c (cal_backend_class_init): remove get_uids and
+ get_objects_in_range vmethods, add get_object_list vmethod
+ (cal_backend_get_object_list): call through to vmethod implementation
+
+ * pcs/cal-backend-object-sexp.[hc]: nice class to represent a sexp
+ and search cal components
+
+ * pcs/cal-backend-file.c (cal_backend_file_class_init): remove
+ get_uids and get_objects_in_range calls and set get_object_list
+ call
+ (cal_backend_file_get_object_list): implement
+ (create_user_free_busy): use sexp ops to implement
+ (cal_backend_file_compute_changes): just iterate over the
+ component list rather than fetching uids
+
+ * pcs/Makefile.am: build new files
+
+ * idl/evolution-calendar.idl: make opening a oneway call, add
+ getObjectList call, remove getUIDS and getObjectsInRange call -
+ both can be done with getObjectList; make listener callbacks
+ oneway
+
+2003-08-19 Rodrigo Moya <rodrigo@ximian.com>
* gui/gnome-cal.c (gnome_calendar_purge): don't leak the client list.
(gnome_calendar_destroy): disconnect from all callbacks on all
@@ -254,6 +1380,21 @@
2003-08-13 Rodrigo Moya <rodrigo@ximian.com>
+ * gui/e-cal-model.c (ecm_append_row, ecm_get_color_for_component):
+ * gui/e-cal-model-tasks.c (ecmt_get_color_for_component): merged
+ missing bith from calendar-views-with-model branch.
+
+2003-08-13 JP Rosevear <jpr@ximian.com>
+
+ * cal-client/cal-client.c (real_open_calendar): set the priv->cal
+ pointer in a slightly different spot so we have it in the call
+ back
+
+ * gui/e-cal-model.c (e_cal_model_get_client_list): merge this in
+ properly
+
+2003-08-13 Rodrigo Moya <rodrigo@ximian.com>
+
* gui/e-cal-model.c (ecm_get_color_for_component): assign the colors
based on the URI, which is stored in a common place for all models.
Thus different views will use the same color for the same calendar.
@@ -278,55 +1419,117 @@
* gui/e-week-view-event-item.c (e_week_view_event_item_draw): colorize
the background for multiple days events.
+
+2003-08-13 JP Rosevear <jpr@ximian.com>
-2003-08-12 Hans Petter Jansson <hpj@ximian.com>
-
- * gui/calendar-offline-handler.c (impl_dispose): Chain. Prevent
- double unrefs.
- (impl_finalize): Chain.
-
- * gui/e-alarm-list.c (finalize): Chain.
-
- * gui/e-comp-editor-registry.c (destroy): Chain. Prevent double frees.
- (editor_destroy_cb): Don't crash if we get the destroy signal twice.
-
- * gui/e-date-time-list.c (e_date_time_list_finalize): Chain.
-
- * gui/e-meeting-attendee.c (finalize): Chain.
-
- * gui/e-meeting-model.c (finalize): Chain.
-
-2003-08-12 Andrew Wu <Yang.Wu@sun.com>
-
- * gui/e-day-view.c
- (e_day_view_change_duration_to_start_of_work_day):
- In DayView, Shift+Home, Change the duration to the time
- that begins the current work day.
- (e_day_view_change_duration_to_end_of_work_day):
- In DayView, Shift+End, Change the duration to the time
- that ends the current work day
+ * cal-client/client-test.c (create_client): there is no more
+ object updated signal
-2003-08-12 Hans Petter Jansson <hpj@ximian.com>
+ * cal-client/cal-listener.c: clean up comment
- * gui/e-itip-control.c (html_destroyed):
- (init):
- (write_html): Add destroy chaining.
+ * cal-client/cal-client.c (cal_client_class_init): remove
+ obj_updated and obj_removed signals
-2003-08-12 Andrew Wu <Yang.Wu@sun.com>
+ * cal-client/cal-client.h: ditto
+
+2003-08-12 JP Rosevear <jpr@ximian.com>
- * gui/e-week-view.c
- (e_week_view_on_key_up):
- (e_week_view_on_key_down):
- (e_week_view_on_key_left):
- (e_week_view_on_key_right):
- In the WeekView, Navigation through days with arrow keys.
+ * pcs/cal-backend.h: remove get_uri vmethod
-2003-08-12 Harry Lu <harry.lu@sun.com>
+ * pcs/cal-backend.c (cal_backend_class_init): remove get_uri
+ vmethod init
- ** fixes #47464.
+ * pcs/cal-backend-file.c (cal_backend_file_class_init): no longer
+ a get uri vmethod
+ (cal_backend_file_get_uri): remove implementation of above
- * gui/dialogs/meeting-page.c: (get_widgets): The Organizer's value
- need not match one of the values in the list.
+2003-08-12 JP Rosevear <jpr@ximian.com>
+
+ * cal-client/client-test.c (main): use tmp uris
+
+ * cal-client/cal-listener.h: update protos
+
+ * cal-client/cal-listener.c (cal_listener_init): init removed
+ function
+ (cal_listener_finalize): clear removed function
+ (impl_notifyCalOpened): take file status
+ (impl_notifyCalRemoved): implement
+ (cal_listener_construct): take remove function arg
+ (cal_listener_new): ditto
+
+ * cal-client/cal-client.h: update protos, add remove status
+
+ * cal-client/cal-client.c
+ (cal_client_remove_status_enum_get_type): add remove status type
+ (cal_client_class_init): add removed signal
+ (cal_opened_cb): can no longer get unsupported exception here
+ (cal_removed_cb): emit removed status
+ (real_open_calendar): pass removed callback function to listener
+ (get_fall_back_uri): no longer append tasks.ics or calendar.ics
+ (cal_client_remove_calendar): new c wrapper for corba function -
+ calendar must be open currently
+
+ * pcs/query.c (backend_opened_cb): only disconnect the open
+ callback
+ (backend_removed_cb): handle calendar removal
+ (query_construct): listen for remove signal as well
+
+ * pcs/cal.h: cal no longer takes uri during construction
+
+ * pcs/cal.c (backend_to_listener_status): convert backend to corba
+ status code
+ (impl_Cal_open): backend open no longer takes uri, use above to
+ send back status
+ (impl_Cal_remove): implement
+ (cal_construct): we no longer track the uri
+ (cal_finalize): ditto
+ (cal_class_init): set remove epv method
+
+ * pcs/cal-factory.c (impl_CalFactory_getCal): instantiate backend
+ with uri and kind properties
+
+ * pcs/cal-backend.h: list file status enum, add protos
+
+ * pcs/cal-backend.c (cal_backend_set_property): implement object
+ properties
+ (cal_backend_get_property): ditto
+ (cal_backend_class_init): add properties vmethods and uri, kind
+ properties, removed signal
+ (cal_backend_get_uri): don't get the uri from the backend
+ (cal_backend_get_kind): get the kind from the backend
+ (cal_backend_open): adapt to new open call, no uri passed in
+ (cal_backend_remove): call through to remove implementation
+ (cal_backend_opened): use new file status
+ (cal_backend_removed): emit removed signal
+
+ * pcs/cal-backend-file.h: update protos
+
+ * pcs/cal-backend-file.c (cal_backend_file_class_init): override
+ remove vmethod
+ (cal_backend_file_init): default file name to calendar.ics
+ (cal_backend_file_set_file_name): accessor for filename tacked on
+ to uri
+ (cal_backend_file_get_file_name): ditto
+ (open_cal): return "file" type status codes
+ (create_cal): ditto
+ (get_uri_string): construct the full uri string
+ (cal_backend_file_open): use above
+ (cal_backend_file_remove): implement
+
+ * pcs/cal-backend-file-todos.c (cal_backend_file_todos_init): set
+ the file name to tasks.ics
+
+ * pcs/cal-backend-file-events.c (cal_backend_file_events_init):
+ set the file name to calendar.ics
+
+ * cal-util/cal-util.c (cal_util_expand_uri): just return a copy of
+ the uri now
+
+ * idl/evolution-calendar.idl: convert OpenStatus to FileStatus so
+ remove() can use it as well
+
+ * gui/gnome-cal.c (gnome_calendar_open): just open the default
+ folder in all cases
2003-08-12 Rodrigo Moya <rodrigo@ximian.com>
@@ -511,6 +1714,94 @@
(ecm_finalize): don't call e_cal_model_remove_all_clients, since
that function triggers notifications on the model.
(query_obj_updated_cb): free all the date fields.
+
+2003-08-08 JP Rosevear <jpr@ximian.com>
+
+ * pcs/cal.c (impl_Cal_open): implement
+ (cal_new): take uri as arg
+ (cal_construct): ditto
+
+ * pcs/cal.h: update protos
+
+ * idl/evolution-calendar.idl: add open and remove methods to
+ calendar idl and remove countObjects method; remove
+ updated/removed listener methods; add getCal method to factory and
+ remove uriList and open methods
+
+ * pcs/cal-factory.c (calobjtype_to_icalkind): convert to a libical
+ enum
+ (get_backend_type): use kind to determine type as well
+ (impl_CalFactory_getCal): new method to access the calendar
+
+ * pcs/cal-factory.h: you know register both a method and an ical
+ type you support
+
+ * pcs/cal-backend.c (cal_backend_class_init): add removed signal
+ (cal_backend_class_init): don't init deleted vmethod
+ (cal_backend_get_n_objects): remove
+ (cal_backend_notify_update): remove
+ (cal_backend_notify_remove): remove
+
+ * pcs/cal-backend.h: add "remove" vmethod and "removed" signal,
+ remove get_n_objects vmethod
+
+ * pcs/cal-backend-file.c (cal_backend_file_get_n_objects): remove
+ (cal_backend_file_init): we only have a single list of components
+ now
+ (cal_backend_file_dispose): ditto
+ (add_component): ditto
+ (remove_component): ditto
+ (cal_backend_file_open): use e-uri to process uri
+ (cal_backend_file_get_uids): we only have a single list of
+ components now
+ (cal_backend_file_get_objects_in_range): ditto
+ (cal_backend_file_compute_changes): convert to exmlhash instead of
+ db hash
+ (cal_backend_file_get_alarms_in_range): we only have a single list
+ of components now
+ (cal_backend_file_update_objects): just emit removed/updated
+ signals (for the queries)
+
+ * pcs/cal-backend-file-todos.[hc]: subclass of cal-backend-file
+ for todos
+
+ * pcs/cal-backend-file-events.[hc]: subclass of cal-backend-file
+ for events
+
+ * pcs/Makefile.am: don't build deleted sources
+
+ * pcs/job.[hc]: remove, queueing will be done by poa policy
+
+ * conduits/calendar/calendar-conduit.c (pre_sync): just get the
+ number from the list length
+
+ * conduits/todo/todo-conduit.c (pre_sync): ditto
+
+ * cal-client/cal-listener.h: update protos and method signatures
+
+ * cal-client/cal-listener.c (cal_listener_finalize): don't cleanup
+ deleted struct members
+ (impl_notifyCalOpened): we don't get a calendar to pass back now
+ (impl_notifyObjUpdated): idl listener method removed
+ (impl_notifyObjRemoved): ditto
+ (cal_listener_construct): no more updated/removed callbacks
+ (cal_listener_new): ditto
+
+ * cal-client/cal-client.h: update protos
+
+ * cal-client/cal-client.c (cal_opened_cb): we don't get the object
+ in the signal, we already obtained it
+ (obj_updated_cb): remove, the idl no longer supports this (use
+ queries)
+ (obj_removed_cb): ditto
+ (get_factories): determine available factories based on oaf
+ properties in the .server file like the addressbook does
+ (cal_client_construct): remove, its useless now
+ (real_open_calendar): get the factories here and both obtain the
+ cal from the factory and then open it
+ (cal_client_uri_list): comment out most of this as it will be
+ going away
+ (cal_client_get_n_objects): remove useless call
2003-08-07 Rodrigo Moya <rodrigo@ximian.com>
diff --git a/calendar/cal-util/cal-util.c b/calendar/cal-util/cal-util.c
index 1e03c86d75..400207ab0a 100644
--- a/calendar/cal-util/cal-util.c
+++ b/calendar/cal-util/cal-util.c
@@ -584,29 +584,7 @@ cal_util_priority_from_string (const char *string)
char *
cal_util_expand_uri (char *uri, gboolean tasks)
{
- char *file_uri, *file_name;
-
- if (!strncmp (uri, "file://", 7)) {
- file_uri = uri + 7;
- if (strlen (file_uri) > 4
- && !strcmp (file_uri + strlen (file_uri) - 4, ".ics")) {
-
- /* it's a .ics file */
- return g_strdup (uri);
- }
-
- /* we assume it's a dir and glom <type>.ics onto the end. */
- if (tasks)
- file_name = g_concat_dir_and_file (file_uri, "tasks.ics");
- else
- file_name = g_concat_dir_and_file (file_uri, "calendar.ics");
- file_uri = g_strdup_printf("file://%s", file_name);
- g_free(file_name);
- } else {
- file_uri = g_strdup (uri);
- }
-
- return file_uri;
+ return g_strdup (uri);
}
/* callback for icalcomponent_foreach_tzid */
@@ -755,19 +733,13 @@ cal_util_event_dates_match (icalcomponent *icalcomp1, icalcomponent *icalcomp2)
return FALSE;
}
-
-
/* now match the timezones */
if (!(!c1_dtstart.zone && !c2_dtstart.zone) ||
- (c1_dtstart.zone && c2_dtstart.zone &&
- !strcmp (icaltimezone_get_tzid ((icaltimezone *) c1_dtstart.zone),
- icaltimezone_get_tzid ((icaltimezone *) c2_dtstart.zone))))
+ (c1_dtstart.zone && c2_dtstart.zone && !strcmp (c1_dtstart.zone, c2_dtstart.zone)))
return FALSE;
if (!(!c1_dtend.zone && !c2_dtend.zone) ||
- (c1_dtend.zone && c2_dtend.zone &&
- !strcmp (icaltimezone_get_tzid ((icaltimezone *) c1_dtend.zone),
- icaltimezone_get_tzid ((icaltimezone *) c2_dtend.zone))))
+ (c1_dtend.zone && c2_dtend.zone && !strcmp (c1_dtend.zone, c2_dtend.zone)))
return FALSE;
return TRUE;
diff --git a/calendar/conduits/calendar/calendar-conduit.c b/calendar/conduits/calendar/calendar-conduit.c
index 1893e6b34c..39d341cfb5 100644
--- a/calendar/conduits/calendar/calendar-conduit.c
+++ b/calendar/conduits/calendar/calendar-conduit.c
@@ -253,7 +253,7 @@ struct _ECalConduitContext {
icaltimezone *timezone;
CalComponent *default_comp;
- GList *uids;
+ GList *comps;
GList *changed;
GHashTable *changed_hash;
GList *locals;
@@ -276,7 +276,7 @@ e_calendar_context_new (guint32 pilot_id)
ctxt->client = NULL;
ctxt->timezone = NULL;
ctxt->default_comp = NULL;
- ctxt->uids = NULL;
+ ctxt->comps = NULL;
ctxt->changed = NULL;
ctxt->changed_hash = NULL;
ctxt->locals = NULL;
@@ -311,8 +311,11 @@ e_calendar_context_destroy (ECalConduitContext *ctxt)
g_object_unref (ctxt->client);
if (ctxt->default_comp != NULL)
g_object_unref (ctxt->default_comp);
- if (ctxt->uids != NULL)
- cal_obj_uid_list_free (ctxt->uids);
+ if (ctxt->comps != NULL) {
+ for (l = ctxt->comps; l; l = l->next)
+ g_object_unref (l->data);
+ g_list_free (ctxt->comps);
+ }
if (ctxt->changed != NULL)
cal_client_change_list_free (ctxt->changed);
@@ -433,8 +436,8 @@ get_timezone (CalClient *client, const char *tzid)
icaltimezone *timezone = NULL;
timezone = icaltimezone_get_builtin_timezone_from_tzid (tzid);
- if (timezone == NULL)
- cal_client_get_timezone (client, tzid, &timezone);
+ if (timezone == NULL)
+ cal_client_get_timezone (client, tzid, &timezone, NULL);
return timezone;
}
@@ -550,7 +553,7 @@ is_all_day (CalClient *client, CalComponentDateTime *dt_start, CalComponentDateT
}
static gboolean
-process_multi_day (ECalConduitContext *ctxt, CalClientChange *ccc, GList **multi_uid, GList **multi_ccc)
+process_multi_day (ECalConduitContext *ctxt, CalClientChange *ccc, GList **multi_comp, GList **multi_ccc)
{
CalComponentDateTime dt_start, dt_end;
icaltimezone *tz_start, *tz_end;
@@ -562,7 +565,7 @@ process_multi_day (ECalConduitContext *ctxt, CalClientChange *ccc, GList **multi
gboolean ret = TRUE;
*multi_ccc = NULL;
- *multi_uid = NULL;
+ *multi_comp = NULL;
if (ccc->type == CAL_CLIENT_CHANGE_DELETED)
return FALSE;
@@ -617,13 +620,14 @@ process_multi_day (ECalConduitContext *ctxt, CalClientChange *ccc, GList **multi
dt_end.value = &end_value;
cal_component_set_dtend (clone, &dt_end);
- cal_client_update_object (ctxt->client, clone);
+ /* FIXME Error handling */
+ cal_client_create_object (ctxt->client, cal_component_get_icalcomponent (clone), NULL, NULL);
c->comp = clone;
c->type = CAL_CLIENT_CHANGE_ADDED;
*multi_ccc = g_list_prepend (*multi_ccc, c);
- *multi_uid = g_list_prepend (*multi_uid, new_uid);
+ *multi_comp = g_list_prepend (*multi_comp, g_object_ref (c->comp));
event_start = day_end;
day_end = time_day_end_with_zone (event_start, ctxt->timezone);
@@ -632,7 +636,8 @@ process_multi_day (ECalConduitContext *ctxt, CalClientChange *ccc, GList **multi
dt_end.value = old_end_value;
cal_component_get_uid (ccc->comp, &uid);
- cal_client_remove_object (ctxt->client, uid);
+ /* FIXME Error handling */
+ cal_client_remove_object (ctxt->client, uid, NULL);
ccc->type = CAL_CLIENT_CHANGE_DELETED;
cleanup:
@@ -1007,13 +1012,11 @@ local_record_from_uid (ECalLocalRecord *local,
{
CalComponent *comp;
icalcomponent *icalcomp;
- CalClientGetStatus status;
+ GError *error = NULL;
g_assert(local!=NULL);
- status = cal_client_get_object (ctxt->client, uid, &icalcomp);
-
- if (status == CAL_CLIENT_GET_SUCCESS) {
+ if (cal_client_get_object (ctxt->client, uid, NULL, &icalcomp, &error)) {
comp = cal_component_new ();
if (!cal_component_set_icalcomponent (comp, icalcomp)) {
g_object_unref (comp);
@@ -1023,7 +1026,7 @@ local_record_from_uid (ECalLocalRecord *local,
local_record_from_comp (local, comp, ctxt);
g_object_unref (comp);
- } else if (status == CAL_CLIENT_GET_NOT_FOUND) {
+ } else if (error->code == E_CALENDAR_STATUS_OBJECT_NOT_FOUND) {
comp = cal_component_new ();
cal_component_set_new_vtype (comp, CAL_COMPONENT_EVENT);
cal_component_set_uid (comp, uid);
@@ -1031,7 +1034,9 @@ local_record_from_uid (ECalLocalRecord *local,
g_object_unref (comp);
} else {
INFO ("Object did not exist");
- }
+ }
+
+ g_clear_error (&error);
}
static CalComponent *
@@ -1283,21 +1288,6 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit,
}
static void
-update_comp (GnomePilotConduitSyncAbs *conduit, CalComponent *comp,
- ECalConduitContext *ctxt)
-{
- CalClientResult success;
-
- g_return_if_fail (conduit != NULL);
- g_return_if_fail (comp != NULL);
-
- success = cal_client_update_object (ctxt->client, comp);
-
- if (success != CAL_CLIENT_RESULT_SUCCESS)
- WARN (_("Error while communicating with calendar server"));
-}
-
-static void
check_for_slow_setting (GnomePilotConduit *c, ECalConduitContext *ctxt)
{
GnomePilotConduitStandard *conduit = GNOME_PILOT_CONDUIT_STANDARD (c);
@@ -1360,11 +1350,13 @@ pre_sync (GnomePilotConduit *conduit,
LOG (g_message ( " Using timezone: %s", icaltimezone_get_tzid (ctxt->timezone) ));
/* Set the default timezone on the backend. */
- if (ctxt->timezone)
- cal_client_set_default_timezone (ctxt->client, ctxt->timezone);
+ if (ctxt->timezone) {
+ if (!cal_client_set_default_timezone (ctxt->client, ctxt->timezone, NULL))
+ return -1;
+ }
/* Get the default component */
- if (cal_client_get_default_object (ctxt->client, CALOBJ_TYPE_EVENT, &icalcomp) != CAL_CLIENT_GET_SUCCESS)
+ if (!cal_client_get_default_object (ctxt->client, CALOBJ_TYPE_EVENT, &icalcomp, NULL))
return -1;
ctxt->default_comp = cal_component_new ();
@@ -1380,21 +1372,23 @@ pre_sync (GnomePilotConduit *conduit,
g_free (filename);
/* Get the local database */
- ctxt->uids = cal_client_get_uids (ctxt->client, CALOBJ_TYPE_EVENT);
+ if (!cal_client_get_object_list_as_comp (ctxt->client, "(#t)", &ctxt->comps, NULL))
+ return -1;
/* Find the added, modified and deleted items */
change_id = g_strdup_printf ("pilot-sync-evolution-calendar-%d", ctxt->cfg->pilot_id);
- ctxt->changed = cal_client_get_changes (ctxt->client, CALOBJ_TYPE_EVENT, change_id);
+ if (!cal_client_get_changes (ctxt->client, CALOBJ_TYPE_EVENT, change_id, &ctxt->changed, NULL))
+ return -1;
ctxt->changed_hash = g_hash_table_new (g_str_hash, g_str_equal);
g_free (change_id);
/* See if we need to split up any events */
for (l = ctxt->changed; l != NULL; l = l->next) {
CalClientChange *ccc = l->data;
- GList *multi_uid = NULL, *multi_ccc = NULL;
+ GList *multi_comp = NULL, *multi_ccc = NULL;
- if (process_multi_day (ctxt, ccc, &multi_uid, &multi_ccc)) {
- ctxt->uids = g_list_concat (ctxt->uids, multi_uid);
+ if (process_multi_day (ctxt, ccc, &multi_comp, &multi_ccc)) {
+ ctxt->comps = g_list_concat (ctxt->comps, multi_comp);
added = g_list_concat (added, multi_ccc);
removed = g_list_prepend (removed, ccc);
@@ -1442,7 +1436,7 @@ pre_sync (GnomePilotConduit *conduit,
}
/* Set the count information */
- num_records = cal_client_get_n_objects (ctxt->client, CALOBJ_TYPE_EVENT);
+ num_records = g_list_length (ctxt->comps);
gnome_pilot_conduit_sync_abs_set_num_local_records(abs_conduit, num_records);
gnome_pilot_conduit_sync_abs_set_num_new_local_records (abs_conduit, add_records);
gnome_pilot_conduit_sync_abs_set_num_updated_local_records (abs_conduit, mod_records);
@@ -1492,8 +1486,8 @@ post_sync (GnomePilotConduit *conduit,
* a race condition if anyone changes a record elsewhere during sycnc
*/
change_id = g_strdup_printf ("pilot-sync-evolution-calendar-%d", ctxt->cfg->pilot_id);
- changed = cal_client_get_changes (ctxt->client, CALOBJ_TYPE_EVENT, change_id);
- cal_client_change_list_free (changed);
+ if (cal_client_get_changes (ctxt->client, CALOBJ_TYPE_EVENT, change_id, &changed, NULL))
+ cal_client_change_list_free (changed);
g_free (change_id);
LOG (g_message ( "---------------------------------------------------------\n" ));
@@ -1537,7 +1531,7 @@ for_each (GnomePilotConduitSyncAbs *conduit,
ECalLocalRecord **local,
ECalConduitContext *ctxt)
{
- static GList *uids, *iterator;
+ static GList *comps, *iterator;
static int count;
g_return_val_if_fail (local != NULL, -1);
@@ -1545,17 +1539,17 @@ for_each (GnomePilotConduitSyncAbs *conduit,
if (*local == NULL) {
LOG (g_message ( "beginning for_each" ));
- uids = ctxt->uids;
+ comps = ctxt->comps;
count = 0;
- if (uids != NULL) {
- LOG (g_message ( "iterating over %d records", g_list_length (uids) ));
+ if (comps != NULL) {
+ LOG (g_message ( "iterating over %d records", g_list_length (comps)));
*local = g_new0 (ECalLocalRecord, 1);
- local_record_from_uid (*local, uids->data, ctxt);
+ local_record_from_comp (*local, comps->data, ctxt);
g_list_prepend (ctxt->locals, *local);
- iterator = uids;
+ iterator = comps;
} else {
LOG (g_message ( "no events" ));
(*local) = NULL;
@@ -1681,8 +1675,10 @@ add_record (GnomePilotConduitSyncAbs *conduit,
/* Give it a new UID otherwise it will be the uid of the default comp */
uid = cal_component_gen_uid ();
cal_component_set_uid (comp, uid);
+
+ if (!cal_client_create_object (ctxt->client, cal_component_get_icalcomponent (comp), NULL, NULL))
+ return -1;
- update_comp (conduit, comp, ctxt);
e_pilot_map_insert (ctxt->map, remote->ID, uid, FALSE);
g_free (uid);
@@ -1709,7 +1705,10 @@ replace_record (GnomePilotConduitSyncAbs *conduit,
new_comp = comp_from_remote_record (conduit, remote, local->comp, ctxt->client, ctxt->timezone);
g_object_unref (local->comp);
local->comp = new_comp;
- update_comp (conduit, local->comp, ctxt);
+
+ if (!cal_client_modify_object (ctxt->client, cal_component_get_icalcomponent (new_comp),
+ CALOBJ_MOD_ALL, NULL))
+ return -1;
return retval;
}
@@ -1729,7 +1728,8 @@ delete_record (GnomePilotConduitSyncAbs *conduit,
LOG (g_message ( "delete_record: deleting %s\n", uid ));
e_pilot_map_remove_by_uid (ctxt->map, uid);
- cal_client_remove_object (ctxt->client, uid);
+ /* FIXME Error handling */
+ cal_client_remove_object (ctxt->client, uid, NULL);
return 0;
}
diff --git a/calendar/conduits/todo/todo-conduit.c b/calendar/conduits/todo/todo-conduit.c
index 6868368129..d44b8688f1 100644
--- a/calendar/conduits/todo/todo-conduit.c
+++ b/calendar/conduits/todo/todo-conduit.c
@@ -255,7 +255,7 @@ struct _EToDoConduitContext {
icaltimezone *timezone;
CalComponent *default_comp;
- GList *uids;
+ GList *comps;
GList *changed;
GHashTable *changed_hash;
GList *locals;
@@ -275,7 +275,7 @@ e_todo_context_new (guint32 pilot_id)
ctxt->client = NULL;
ctxt->timezone = NULL;
ctxt->default_comp = NULL;
- ctxt->uids = NULL;
+ ctxt->comps = NULL;
ctxt->changed_hash = NULL;
ctxt->changed = NULL;
ctxt->locals = NULL;
@@ -311,8 +311,11 @@ e_todo_context_destroy (EToDoConduitContext *ctxt)
if (ctxt->default_comp != NULL)
g_object_unref (ctxt->default_comp);
- if (ctxt->uids != NULL)
- cal_obj_uid_list_free (ctxt->uids);
+ if (ctxt->comps != NULL) {
+ for (l = ctxt->comps; l; l = l->next)
+ g_object_unref (l->data);
+ g_list_free (ctxt->comps);
+ }
if (ctxt->changed_hash != NULL) {
g_hash_table_foreach_remove (ctxt->changed_hash, e_todo_context_foreach_change, NULL);
@@ -441,7 +444,7 @@ get_timezone (CalClient *client, const char *tzid)
timezone = icaltimezone_get_builtin_timezone_from_tzid (tzid);
if (timezone == NULL)
- cal_client_get_timezone (client, tzid, &timezone);
+ cal_client_get_timezone (client, tzid, &timezone, NULL);
return timezone;
}
@@ -676,13 +679,11 @@ local_record_from_uid (EToDoLocalRecord *local,
{
CalComponent *comp;
icalcomponent *icalcomp;
- CalClientGetStatus status;
+ GError *error = NULL;
g_assert(local!=NULL);
- status = cal_client_get_object (ctxt->client, uid, &icalcomp);
-
- if (status == CAL_CLIENT_GET_SUCCESS) {
+ if (cal_client_get_object (ctxt->client, uid, NULL, &icalcomp, &error)) {
comp = cal_component_new ();
if (!cal_component_set_icalcomponent (comp, icalcomp)) {
g_object_unref (comp);
@@ -692,7 +693,7 @@ local_record_from_uid (EToDoLocalRecord *local,
local_record_from_comp (local, comp, ctxt);
g_object_unref (comp);
- } else if (status == CAL_CLIENT_GET_NOT_FOUND) {
+ } else if (error->code == E_CALENDAR_STATUS_OBJECT_NOT_FOUND) {
comp = cal_component_new ();
cal_component_set_new_vtype (comp, CAL_COMPONENT_TODO);
cal_component_set_uid (comp, uid);
@@ -702,7 +703,7 @@ local_record_from_uid (EToDoLocalRecord *local,
INFO ("Object did not exist");
}
-
+ g_clear_error (&error);
}
@@ -824,21 +825,6 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit,
}
static void
-update_comp (GnomePilotConduitSyncAbs *conduit, CalComponent *comp,
- EToDoConduitContext *ctxt)
-{
- CalClientResult success;
-
- g_return_if_fail (conduit != NULL);
- g_return_if_fail (comp != NULL);
-
- success = cal_client_update_object (ctxt->client, comp);
-
- if (success != CAL_CLIENT_RESULT_SUCCESS)
- WARN (_("Error while communicating with calendar server"));
-}
-
-static void
check_for_slow_setting (GnomePilotConduit *c, EToDoConduitContext *ctxt)
{
GnomePilotConduitStandard *conduit = GNOME_PILOT_CONDUIT_STANDARD (c);
@@ -902,11 +888,13 @@ pre_sync (GnomePilotConduit *conduit,
LOG (g_message ( " Using timezone: %s", icaltimezone_get_tzid (ctxt->timezone) ));
/* Set the default timezone on the backend. */
- if (ctxt->timezone)
- cal_client_set_default_timezone (ctxt->client, ctxt->timezone);
+ if (ctxt->timezone) {
+ if (!cal_client_set_default_timezone (ctxt->client, ctxt->timezone, NULL))
+ return -1;
+ }
/* Get the default component */
- if (cal_client_get_default_object (ctxt->client, CALOBJ_TYPE_TODO, &icalcomp) != CAL_CLIENT_GET_SUCCESS)
+ if (!cal_client_get_default_object (ctxt->client, CALOBJ_TYPE_TODO, &icalcomp, NULL))
return -1;
ctxt->default_comp = cal_component_new ();
@@ -922,11 +910,13 @@ pre_sync (GnomePilotConduit *conduit,
g_free (filename);
/* Get the local database */
- ctxt->uids = cal_client_get_uids (ctxt->client, CALOBJ_TYPE_TODO);
+ if (!cal_client_get_object_list_as_comp (ctxt->client, "(#t)", &ctxt->comps, NULL))
+ return -1;
/* Count and hash the changes */
change_id = g_strdup_printf ("pilot-sync-evolution-todo-%d", ctxt->cfg->pilot_id);
- ctxt->changed = cal_client_get_changes (ctxt->client, CALOBJ_TYPE_TODO, change_id);
+ if (!cal_client_get_changes (ctxt->client, CALOBJ_TYPE_TODO, change_id, &ctxt->changed, NULL))
+ return -1;
ctxt->changed_hash = g_hash_table_new (g_str_hash, g_str_equal);
g_free (change_id);
@@ -956,7 +946,7 @@ pre_sync (GnomePilotConduit *conduit,
}
/* Set the count information */
- num_records = cal_client_get_n_objects (ctxt->client, CALOBJ_TYPE_TODO);
+ num_records = g_list_length (ctxt->comps);
gnome_pilot_conduit_sync_abs_set_num_local_records(abs_conduit, num_records);
gnome_pilot_conduit_sync_abs_set_num_new_local_records (abs_conduit, add_records);
gnome_pilot_conduit_sync_abs_set_num_updated_local_records (abs_conduit, mod_records);
@@ -1006,8 +996,8 @@ post_sync (GnomePilotConduit *conduit,
* a race condition if anyone changes a record elsewhere during sycnc
*/
change_id = g_strdup_printf ("pilot-sync-evolution-todo-%d", ctxt->cfg->pilot_id);
- changed = cal_client_get_changes (ctxt->client, CALOBJ_TYPE_TODO, change_id);
- cal_client_change_list_free (changed);
+ if (cal_client_get_changes (ctxt->client, CALOBJ_TYPE_TODO, change_id, &changed, NULL))
+ cal_client_change_list_free (changed);
g_free (change_id);
LOG (g_message ( "---------------------------------------------------------\n" ));
@@ -1051,7 +1041,7 @@ for_each (GnomePilotConduitSyncAbs *conduit,
EToDoLocalRecord **local,
EToDoConduitContext *ctxt)
{
- static GList *uids, *iterator;
+ static GList *comps, *iterator;
static int count;
g_return_val_if_fail (local != NULL, -1);
@@ -1059,17 +1049,17 @@ for_each (GnomePilotConduitSyncAbs *conduit,
if (*local == NULL) {
LOG (g_message ( "beginning for_each" ));
- uids = ctxt->uids;
+ comps = ctxt->comps;
count = 0;
- if (uids != NULL) {
- LOG (g_message ( "iterating over %d records", g_list_length (uids) ));
+ if (comps != NULL) {
+ LOG (g_message ( "iterating over %d records", g_list_length (comps)));
*local = g_new0 (EToDoLocalRecord, 1);
- local_record_from_uid (*local, uids->data, ctxt);
+ local_record_from_comp (*local, comps->data, ctxt);
g_list_prepend (ctxt->locals, *local);
- iterator = uids;
+ iterator = comps;
} else {
LOG (g_message ( "no events" ));
(*local) = NULL;
@@ -1196,7 +1186,9 @@ add_record (GnomePilotConduitSyncAbs *conduit,
uid = cal_component_gen_uid ();
cal_component_set_uid (comp, uid);
- update_comp (conduit, comp, ctxt);
+ if (!cal_client_create_object (ctxt->client, cal_component_get_icalcomponent (comp), NULL, NULL))
+ return -1;
+
e_pilot_map_insert (ctxt->map, remote->ID, uid, FALSE);
g_object_unref (comp);
@@ -1221,7 +1213,10 @@ replace_record (GnomePilotConduitSyncAbs *conduit,
new_comp = comp_from_remote_record (conduit, remote, local->comp, ctxt->timezone);
g_object_unref (local->comp);
local->comp = new_comp;
- update_comp (conduit, local->comp, ctxt);
+
+ if (!cal_client_modify_object (ctxt->client, cal_component_get_icalcomponent (new_comp),
+ CALOBJ_MOD_ALL, NULL))
+ return -1;
return retval;
}
@@ -1241,7 +1236,8 @@ delete_record (GnomePilotConduitSyncAbs *conduit,
LOG (g_message ( "delete_record: deleting %s\n", uid ));
e_pilot_map_remove_by_uid (ctxt->map, uid);
- cal_client_remove_object (ctxt->client, uid);
+ /* FIXME Error handling */
+ cal_client_remove_object (ctxt->client, uid, NULL);
return 0;
}
diff --git a/calendar/gui/Makefile.am b/calendar/gui/Makefile.am
index 5cee4ae0e3..eef7821858 100644
--- a/calendar/gui/Makefile.am
+++ b/calendar/gui/Makefile.am
@@ -37,7 +37,23 @@ $(SELECT_NAMES_IDL_GENERATED_H): $(IDLS)
$(SELECT_NAMES_IDL_GENERATED_C): $(SELECT_NAMES_IDL_GENERATED_H)
-IDL_GENERATED = $(COMPOSER_IDL_GENERATED) $(SELECT_NAMES_IDL_GENERATED)
+# Calendar IDL files
+
+CALENDAR_IDL_GENERATED_H = \
+ evolution-calendar.h
+CALENDAR_IDL_GENERATED_C = \
+ evolution-calendar-common.c \
+ evolution-calendar-skels.c \
+ evolution-calendar-stubs.c
+CALENDAR_IDL_GENERATED = $(CALENDAR_IDL_GENERATED_C) $(CALENDAR_IDL_GENERATED_H)
+
+$(CALENDAR_IDL_GENERATED_H): $(IDLS)
+ $(ORBIT_IDL) -I $(srcdir) $(IDL_INCLUDES) \
+ $(top_srcdir)/calendar/idl/evolution-calendar.idl
+$(CALENDAR_IDL_GENERATED_C): $(CALENDAR_IDL_GENERATED_H)
+
+
+IDL_GENERATED = $(COMPOSER_IDL_GENERATED) $(SELECT_NAMES_IDL_GENERATED) $(CALENDAR_IDL_GENERATED)
SUBDIRS = alarm-notify dialogs
@@ -57,7 +73,6 @@ INCLUDES = \
-I$(top_srcdir)/addressbook/backend \
-I$(top_builddir)/addressbook/backend \
-I$(top_srcdir)/widgets \
- -I$(top_srcdir)/a11y/calendar \
-DEVOLUTION_DATADIR=\""$(datadir)"\" \
-DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \
-DEVOLUTION_ETSPECDIR=\""$(etspecdir)"\" \
@@ -179,7 +194,6 @@ libevolution_calendar_la_LIBADD = \
$(top_builddir)/calendar/gui/dialogs/libcal-dialogs.la \
$(top_builddir)/widgets/e-timezone-dialog/libetimezonedialog.la \
$(top_builddir)/widgets/misc/libemiscwidgets.la \
- $(top_builddir)/a11y/calendar/libevolution-calendar-a11y.la \
$(EVOLUTION_CALENDAR_LIBS)
libevolution_calendar_la_LDFLAGS = -avoid-version -module
diff --git a/calendar/gui/alarm-notify/alarm-notify.c b/calendar/gui/alarm-notify/alarm-notify.c
index 133448e7cd..800eeb80f6 100644
--- a/calendar/gui/alarm-notify/alarm-notify.c
+++ b/calendar/gui/alarm-notify/alarm-notify.c
@@ -297,9 +297,6 @@ AlarmNotify_removeCalendar (PortableServer_Servant servant,
gpointer lc_ptr, orig_str_ptr;
gboolean found;
- lc_ptr = NULL;
- orig_str_ptr = NULL;
-
an = ALARM_NOTIFY (bonobo_object_from_servant (servant));
priv = an->priv;
diff --git a/calendar/gui/alarm-notify/alarm-queue.c b/calendar/gui/alarm-notify/alarm-queue.c
index cb792e466f..c6c30f9511 100644
--- a/calendar/gui/alarm-notify/alarm-queue.c
+++ b/calendar/gui/alarm-notify/alarm-queue.c
@@ -29,25 +29,20 @@
#include <gtk/gtksignal.h>
#include <gtk/gtkbox.h>
#include <gtk/gtkdialog.h>
-#include <gtk/gtkeventbox.h>
-#include <gtk/gtkimage.h>
#include <gtk/gtklabel.h>
#include <gtk/gtkcheckbutton.h>
#include <gtk/gtkstock.h>
-#include <gtk/gtktooltips.h>
#include <libgnome/gnome-i18n.h>
#include <libgnome/gnome-exec.h>
#include <libgnome/gnome-sound.h>
#include <libgnomeui/gnome-dialog-util.h>
#include <libgnomeui/gnome-uidefs.h>
-#include <e-util/eggtrayicon.h>
#include <cal-util/timeutil.h>
#include "alarm.h"
#include "alarm-notify-dialog.h"
#include "alarm-queue.h"
#include "config-data.h"
#include "save.h"
-#include "util.h"
@@ -227,7 +222,7 @@ remove_queued_alarm (CompQueuedAlarms *cqa, gpointer alarm_id,
if (remove_alarm) {
cqa->expecting_update = TRUE;
cal_client_discard_alarm (cqa->parent_client->client, cqa->alarms->comp,
- qa->instance->auid);
+ qa->instance->auid, NULL);
cqa->expecting_update = FALSE;
}
@@ -654,53 +649,13 @@ edit_component (CalClient *client, CalComponent *comp)
CORBA_exception_free (&ev);
}
-
-/* /\* Callback used from the alarm notify dialog *\/ */
-/* static void */
-/* notify_dialog_cb (AlarmNotifyResult result, int snooze_mins, gpointer data) */
-/* { */
-
-/* switch (result) { */
-/* case ALARM_NOTIFY_SNOOZE: */
-/* create_snooze (c->cqa, c->alarm_id, snooze_mins); */
-
-/* g_object_unref (c->comp); */
-/* g_object_unref (c->client); */
-/* g_free (c); */
-/* return; */
-
-/* case ALARM_NOTIFY_EDIT: */
-/* edit_component (c->client, c->comp); */
-/* break; */
-
-/* case ALARM_NOTIFY_CLOSE: */
-/* /\* Do nothing *\/ */
-/* break; */
-
-/* default: */
-/* g_assert_not_reached (); */
-/* } */
-
-/* if (c->cqa != NULL) */
-/* remove_queued_alarm (c->cqa, c->alarm_id, TRUE, TRUE); */
-/* g_object_unref (c->comp); */
-/* g_object_unref (c->client); */
-/* g_free (c); */
-/* } */
-
-typedef struct {
- char *message;
- gboolean blink_state;
- gint blink_id;
- time_t trigger;
+struct notify_dialog_closure {
CompQueuedAlarms *cqa;
gpointer alarm_id;
- CalComponent *comp;
CalClient *client;
- GtkWidget *tray_icon;
- GtkWidget *image;
- GtkWidget *alarm_dialog;
-} TrayIconData;
+ CalComponent *comp;
+ gpointer dialog;
+};
static void
on_dialog_obj_updated_cb (CalClient *client, const char *uid, gpointer data)
@@ -714,15 +669,15 @@ static void
on_dialog_obj_removed_cb (CalClient *client, const char *uid, gpointer data)
{
const char *our_uid;
- TrayIconData *tray_data = data;
+ struct notify_dialog_closure *c = data;
- cal_component_get_uid (tray_data->comp, &our_uid);
+ cal_component_get_uid (c->comp, &our_uid);
g_return_if_fail (our_uid && *our_uid);
if (!strcmp (uid, our_uid)) {
- alarm_notify_dialog_disable_buttons (tray_data->alarm_dialog);
- tray_data->cqa = NULL;
- tray_data->alarm_id = NULL;
+ alarm_notify_dialog_disable_buttons (c->dialog);
+ c->cqa = NULL;
+ c->alarm_id = NULL;
}
}
@@ -730,19 +685,26 @@ on_dialog_obj_removed_cb (CalClient *client, const char *uid, gpointer data)
static void
notify_dialog_cb (AlarmNotifyResult result, int snooze_mins, gpointer data)
{
- TrayIconData *tray_data = data;
+ struct notify_dialog_closure *c;
- g_signal_handlers_disconnect_matched (tray_data->client, G_SIGNAL_MATCH_FUNC,
+ c = data;
+
+ g_signal_handlers_disconnect_matched (c->client, G_SIGNAL_MATCH_FUNC,
+ 0, 0, NULL, on_dialog_obj_updated_cb, NULL);
+ g_signal_handlers_disconnect_matched (c->client, G_SIGNAL_MATCH_FUNC,
0, 0, NULL, on_dialog_obj_removed_cb, NULL);
switch (result) {
case ALARM_NOTIFY_SNOOZE:
- create_snooze (tray_data->cqa, tray_data->alarm_id, snooze_mins);
- tray_data->cqa = NULL;
+ create_snooze (c->cqa, c->alarm_id, snooze_mins);
+
+ g_object_unref (c->comp);
+ g_object_unref (c->client);
+ g_free (c);
return;
case ALARM_NOTIFY_EDIT:
- edit_component (tray_data->client, tray_data->comp);
+ edit_component (c->client, c->comp);
break;
case ALARM_NOTIFY_CLOSE:
@@ -753,83 +715,11 @@ notify_dialog_cb (AlarmNotifyResult result, int snooze_mins, gpointer data)
g_assert_not_reached ();
}
- tray_data->alarm_dialog = NULL;
- gtk_widget_destroy (tray_data->tray_icon);
-}
-
-static gint
-tray_icon_destroyed_cb (GtkWidget *tray, gpointer user_data)
-{
- TrayIconData *tray_data = user_data;
-
- if (tray_data->cqa != NULL)
- remove_queued_alarm (tray_data->cqa, tray_data->alarm_id, TRUE, TRUE);
-
- if (tray_data->message != NULL) {
- g_free (tray_data->message);
- tray_data->message = NULL;
- }
-
- g_source_remove (tray_data->blink_id);
-
- g_object_unref (tray_data->comp);
- g_object_unref (tray_data->client);
- g_free (tray_data);
-
- return TRUE;
-}
-
-static gint
-tray_icon_clicked_cb (GtkWidget *widget, GdkEventButton *event, gpointer user_data)
-{
- TrayIconData *tray_data = user_data;
-
- if (event->type == GDK_BUTTON_PRESS) {
- if (event->button == 1) {
- QueuedAlarm *qa;
-
- if (tray_data->alarm_dialog != NULL)
- return FALSE;
-
- qa = lookup_queued_alarm (tray_data->cqa, tray_data->alarm_id);
- if (qa) {
- gtk_widget_hide (tray_data->tray_icon);
- tray_data->alarm_dialog = alarm_notify_dialog (
- tray_data->trigger,
- qa->instance->occur_start,
- qa->instance->occur_end,
- cal_component_get_vtype (tray_data->comp),
- tray_data->message,
- notify_dialog_cb, tray_data);
- if (tray_data->alarm_dialog) {
- g_signal_connect (G_OBJECT (tray_data->client), "obj_removed",
- G_CALLBACK (on_dialog_obj_removed_cb), tray_data);
- }
- }
-
- return TRUE;
- } else if (event->button == 2) {
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-static gboolean
-tray_icon_blink_cb (gpointer data)
-{
- TrayIconData *tray_data = data;
-
- /* FIXME: Use stock image equivalents when they become available */
-
- tray_data->blink_state = tray_data->blink_state == TRUE ? FALSE : TRUE;
- gtk_image_set_from_file (GTK_IMAGE (tray_data->image),
- tray_data->blink_state == TRUE ?
- EVOLUTION_IMAGESDIR "/appointment-reminder-excl.png" :
- EVOLUTION_IMAGESDIR "/appointment-reminder.png");
-
- return TRUE;
+ if (c->cqa != NULL)
+ remove_queued_alarm (c->cqa, c->alarm_id, TRUE, TRUE);
+ g_object_unref (c->comp);
+ g_object_unref (c->client);
+ g_free (c);
}
/* Performs notification of a display alarm */
@@ -837,18 +727,13 @@ static void
display_notification (time_t trigger, CompQueuedAlarms *cqa,
gpointer alarm_id, gboolean use_description)
{
- QueuedAlarm *qa;
CalComponent *comp;
- CalClient *client;
CalComponentVType vtype;
- const char *message;
- CalComponentAlarm *alarm;
- GtkWidget *tray_icon, *image, *ebox;
- GtkTooltips *tooltips;
- TrayIconData *tray_data;
CalComponentText text;
- char *str, *start_str, *end_str, *alarm_str;
- icaltimezone *current_zone;
+ QueuedAlarm *qa;
+ const char *message;
+ struct notify_dialog_closure *c;
+ gboolean use_summary;
comp = cqa->alarms->comp;
qa = lookup_queued_alarm (cqa, alarm_id);
@@ -857,73 +742,54 @@ display_notification (time_t trigger, CompQueuedAlarms *cqa,
vtype = cal_component_get_vtype (comp);
- /* get a sensible description for the event */
- alarm = cal_component_get_alarm (comp, qa->instance->auid);
- g_assert (alarm != NULL);
+ /* Pick a sensible notification message. First we try the DESCRIPTION
+ * from the alarm, then the SUMMARY of the component.
+ */
- cal_component_alarm_get_description (alarm, &text);
- cal_component_alarm_free (alarm);
+ use_summary = TRUE;
+ message = NULL;
- if (text.value)
- message = text.value;
- else {
- cal_component_get_summary (comp, &text);
- if (text.value)
- message = text.value;
- else
- message = _("No description available.");
+ if (use_description) {
+ CalComponentAlarm *alarm;
+
+ alarm = cal_component_get_alarm (comp, qa->instance->auid);
+ g_assert (alarm != NULL);
+
+ cal_component_alarm_get_description (alarm, &text);
+ cal_component_alarm_free (alarm);
+
+ if (text.value) {
+ message = text.value;
+ use_summary = FALSE;
+ }
}
- /* create the tray icon */
- tooltips = gtk_tooltips_new ();
-
- /* FIXME: Use stock image equivalent when it becomes available */
- tray_icon = egg_tray_icon_new (qa->instance->auid);
- image = gtk_image_new_from_file (EVOLUTION_IMAGESDIR "/appointment-reminder.png");
- ebox = gtk_event_box_new ();
-
- gtk_widget_show (image);
- gtk_widget_show (ebox);
-
- current_zone = config_data_get_timezone ();
- alarm_str = timet_to_str_with_zone (trigger, current_zone);
- start_str = timet_to_str_with_zone (qa->instance->occur_start, current_zone);
- end_str = timet_to_str_with_zone (qa->instance->occur_end, current_zone);
- str = g_strdup_printf (_("Alarm on %s\n%s\nStarting at %s\nEnding at %s"),
- alarm_str, message, start_str, end_str);
- gtk_tooltips_set_tip (GTK_TOOLTIPS (tooltips), ebox, str, str);
- g_free (start_str);
- g_free (end_str);
- g_free (alarm_str);
- g_free (str);
-
- g_object_set_data (G_OBJECT (tray_icon), "image", image);
- g_object_set_data (G_OBJECT (tray_icon), "available", GINT_TO_POINTER (1));
-
- gtk_container_add (GTK_CONTAINER (ebox), image);
- gtk_container_add (GTK_CONTAINER (tray_icon), ebox);
-
- /* create the private structure */
- tray_data = g_new0 (TrayIconData, 1);
- tray_data->message = g_strdup (message);
- tray_data->trigger = trigger;
- tray_data->cqa = cqa;
- tray_data->alarm_id = alarm_id;
- tray_data->comp = cal_component_clone (comp);
- tray_data->client = cqa->parent_client->client;
- tray_data->image = image;
- tray_data->blink_state = FALSE;
- g_object_ref (tray_data->client);
- tray_data->tray_icon = tray_icon;
-
- g_signal_connect (G_OBJECT (tray_icon), "destroy",
- G_CALLBACK (tray_icon_destroyed_cb), tray_data);
- g_signal_connect (G_OBJECT (ebox), "button_press_event",
- G_CALLBACK (tray_icon_clicked_cb), tray_data);
-
- tray_data->blink_id = g_timeout_add (500, tray_icon_blink_cb, tray_data);
-
- gtk_widget_show (tray_icon);
+ if (use_summary) {
+ cal_component_get_summary (comp, &text);
+ if (text.value)
+ message = text.value;
+ else
+ message = _("No description available.");
+ }
+
+ c = g_new (struct notify_dialog_closure, 1);
+ c->cqa = cqa;
+ c->alarm_id = alarm_id;
+ c->comp = cal_component_clone (comp);
+ c->client = c->cqa->parent_client->client;
+ g_object_ref (c->client);
+
+ if (!(c->dialog = alarm_notify_dialog (trigger,
+ qa->instance->occur_start, qa->instance->occur_end,
+ vtype, message,
+ notify_dialog_cb, c)))
+ g_message ("display_notification(): Could not create the alarm notify dialog");
+ else {
+ g_signal_connect (c->client, "obj_updated",
+ G_CALLBACK (on_dialog_obj_updated_cb), c);
+ g_signal_connect (c->client, "obj_removed",
+ G_CALLBACK (on_dialog_obj_removed_cb), c);
+ }
}
/* Performs notification of an audio alarm */
diff --git a/calendar/gui/calendar-commands.c b/calendar/gui/calendar-commands.c
index 38206a66b9..279e9ad11d 100644
--- a/calendar/gui/calendar-commands.c
+++ b/calendar/gui/calendar-commands.c
@@ -325,12 +325,10 @@ publish_freebusy_cmd (BonoboUIComponent *uic, gpointer data, const gchar *path)
start = time_day_begin_with_zone (start, utc);
end = time_add_week_with_zone (start, 6, utc);
+ /* FIXME Should we aggregate the data? */
client_list = e_cal_model_get_client_list (gnome_calendar_get_calendar_model (gcal));
for (cl = client_list; cl != NULL; cl = cl->next) {
- GList *tmp_comp_list;
-
- tmp_comp_list = cal_client_get_free_busy ((CalClient *) cl->data, NULL, start, end);
- if (tmp_comp_list) {
+ if (cal_client_get_free_busy ((CalClient *) cl->data, NULL, start, end, &comp_list, NULL)) {
GList *l;
for (l = comp_list; l; l = l->next) {
@@ -425,15 +423,16 @@ get_shell_view_interface (BonoboControl *control)
return shell_view;
}
-const gchar *
-calendar_get_text_for_folder_bar_label (GnomeCalendar *gcal)
+/* Displays the currently displayed time range in the folder bar label on the
+ shell view, according to which view we are showing. */
+void
+calendar_set_folder_bar_label (GnomeCalendar *gcal, BonoboControl *control)
{
icaltimezone *zone;
struct icaltimetype start_tt, end_tt;
time_t start_time, end_time;
struct tm start_tm, end_tm;
- static char buffer[512];
- char end_buffer[256];
+ char buffer[512], end_buffer[256];
GnomeCalendarViewType view;
gnome_calendar_get_visible_time_range (gcal, &start_time, &end_time);
@@ -517,17 +516,8 @@ calendar_get_text_for_folder_bar_label (GnomeCalendar *gcal)
break;
default:
g_assert_not_reached ();
- return NULL;
}
- return buffer;
-}
-/* Displays the currently displayed time range in the folder bar label on the
- shell view, according to which view we are showing. */
-void
-calendar_set_folder_bar_label (GnomeCalendar *gcal, BonoboControl *control)
-{
- char *buffer = (char *)calendar_get_text_for_folder_bar_label (gcal);
control_util_set_folder_bar_label (control, buffer);
}
@@ -589,13 +579,15 @@ sensitize_calendar_commands (GnomeCalendar *gcal, BonoboControl *control, gboole
{
BonoboUIComponent *uic;
int n_selected;
- gboolean read_only, has_recurrences;
+ gboolean read_only = FALSE, has_recurrences;
uic = bonobo_control_get_ui_component (control);
g_assert (uic != NULL);
n_selected = enable ? gnome_calendar_get_num_events_selected (gcal) : 0;
- read_only = cal_client_is_read_only (e_cal_model_get_default_client (gnome_calendar_get_calendar_model (gcal)));
+
+ cal_client_is_read_only (e_cal_model_get_default_client (gnome_calendar_get_calendar_model (gcal)),
+ &read_only, NULL);
bonobo_ui_component_set_prop (uic, "/commands/Cut", "sensitive",
n_selected == 0 || read_only ? "0" : "1",
@@ -648,13 +640,13 @@ sensitize_taskpad_commands (GnomeCalendar *gcal, BonoboControl *control, gboolea
{
BonoboUIComponent *uic;
int n_selected;
- gboolean read_only;
+ gboolean read_only = TRUE;
uic = bonobo_control_get_ui_component (control);
g_assert (uic != NULL);
n_selected = enable ? gnome_calendar_get_num_tasks_selected (gcal) : 0;
- read_only = cal_client_is_read_only (gnome_calendar_get_task_pad_cal_client (gcal));
+ cal_client_is_read_only (gnome_calendar_get_task_pad_cal_client (gcal), &read_only, NULL);
bonobo_ui_component_set_prop (uic, "/commands/Cut", "sensitive",
n_selected == 0 || read_only ? "0" : "1",
diff --git a/calendar/gui/calendar-offline-handler.c b/calendar/gui/calendar-offline-handler.c
index 458f951d9a..ab1454bb0a 100644
--- a/calendar/gui/calendar-offline-handler.c
+++ b/calendar/gui/calendar-offline-handler.c
@@ -256,10 +256,7 @@ impl_dispose (GObject *object)
offline_handler = CALENDAR_OFFLINE_HANDLER (object);
priv = offline_handler->priv;
- if (priv->client) {
- g_object_unref (priv->client);
- priv->client = NULL;
- }
+ g_object_unref (priv->client);
if (priv->listener_interface != CORBA_OBJECT_NIL) {
CORBA_Environment ev;
@@ -271,8 +268,6 @@ impl_dispose (GObject *object)
priv->listener_interface = CORBA_OBJECT_NIL;
}
- if (G_OBJECT_CLASS (parent_class)->dispose)
- (* G_OBJECT_CLASS (parent_class)->dispose) (object);
}
static void
@@ -285,9 +280,6 @@ impl_finalize (GObject *object)
priv = offline_handler->priv;
g_free (priv);
-
- if (G_OBJECT_CLASS (parent_class)->finalize)
- (* G_OBJECT_CLASS (parent_class)->finalize) (object);
}
/* GTK+ type initialization. */
diff --git a/calendar/gui/comp-editor-factory.c b/calendar/gui/comp-editor-factory.c
index f76e0d4f03..f5c6c97416 100644
--- a/calendar/gui/comp-editor-factory.c
+++ b/calendar/gui/comp-editor-factory.c
@@ -241,7 +241,6 @@ edit_existing (OpenClient *oc, const char *uid)
{
CalComponent *comp;
icalcomponent *icalcomp;
- CalClientGetStatus status;
CompEditor *editor;
CalComponentVType vtype;
@@ -249,31 +248,20 @@ edit_existing (OpenClient *oc, const char *uid)
/* Get the object */
- status = cal_client_get_object (oc->client, uid, &icalcomp);
-
- switch (status) {
- case CAL_CLIENT_GET_SUCCESS:
- comp = cal_component_new ();
- if (!cal_component_set_icalcomponent (comp, icalcomp)) {
- g_object_unref (comp);
- icalcomponent_free (icalcomp);
- return;
- }
- break;
-
- case CAL_CLIENT_GET_NOT_FOUND:
- /* The object disappeared from the server */
- return;
-
- case CAL_CLIENT_GET_SYNTAX_ERROR:
- g_message ("edit_exiting(): Syntax error while getting component `%s'", uid);
+ if (!cal_client_get_object (oc->client, uid, NULL, &icalcomp, NULL)) {
+ /* FIXME Better error handling */
+ g_warning (G_STRLOC ": Syntax error while getting component `%s'", uid);
+
return;
-
- default:
- g_assert_not_reached ();
+ }
+
+ comp = cal_component_new ();
+ if (!cal_component_set_icalcomponent (comp, icalcomp)) {
+ g_object_unref (comp);
+ icalcomponent_free (icalcomp);
return;
}
-
+
/* Create the appropriate type of editor */
vtype = cal_component_get_vtype (comp);
@@ -405,13 +393,15 @@ resolve_pending_requests (OpenClient *oc)
factory = oc->factory;
priv = factory->priv;
- g_assert (oc->pending != NULL);
+ if (!oc->pending)
+ return;
/* Set the default timezone in the backend. */
location = calendar_config_get_timezone ();
zone = icaltimezone_get_builtin_timezone (location);
if (zone)
- cal_client_set_default_timezone (oc->client, zone);
+ /* FIXME Error handling? */
+ cal_client_set_default_timezone (oc->client, zone, NULL);
for (l = oc->pending; l; l = l->next) {
Request *request;
diff --git a/calendar/gui/comp-util.c b/calendar/gui/comp-util.c
index 28bc66bd54..9c8b8b2e6c 100644
--- a/calendar/gui/comp-util.c
+++ b/calendar/gui/comp-util.c
@@ -95,7 +95,6 @@ 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;
@@ -143,10 +142,8 @@ cal_comp_util_compare_event_timezones (CalComponent *comp,
/* 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)
+ if (!cal_client_get_timezone (client, start_datetime.tzid,
+ &start_zone, NULL))
goto out;
if (start_datetime.value) {
@@ -160,10 +157,8 @@ cal_comp_util_compare_event_timezones (CalComponent *comp,
goto out;
}
- status = cal_client_get_timezone (client,
- end_datetime.tzid,
- &end_zone);
- if (status != CAL_CLIENT_GET_SUCCESS)
+ if (!cal_client_get_timezone (client, end_datetime.tzid,
+ &end_zone, NULL))
goto out;
if (end_datetime.value) {
@@ -210,7 +205,6 @@ gboolean
cal_comp_is_on_server (CalComponent *comp, CalClient *client)
{
const char *uid;
- CalClientGetStatus status;
icalcomponent *icalcomp;
g_return_val_if_fail (comp != NULL, FALSE);
@@ -226,25 +220,12 @@ cal_comp_is_on_server (CalComponent *comp, CalClient *client)
*/
cal_component_get_uid (comp, &uid);
- status = cal_client_get_object (client, uid, &icalcomp);
-
- switch (status) {
- case CAL_CLIENT_GET_SUCCESS:
+ if (cal_client_get_object (client, uid, NULL, &icalcomp, NULL)) {
icalcomponent_free (icalcomp);
return TRUE;
-
- case CAL_CLIENT_GET_SYNTAX_ERROR:
- g_message ("confirm_delete_empty_appointment(): Syntax error when getting "
- "object `%s'",
- uid);
- return TRUE;
-
- case CAL_CLIENT_GET_NOT_FOUND:
- return FALSE;
-
- default:
- g_assert_not_reached ();
}
+
+ /* FIXME Better error handling */
return FALSE;
}
@@ -268,7 +249,7 @@ cal_comp_event_new_with_defaults (CalClient *client)
icalproperty *icalprop;
CalAlarmTrigger trigger;
- if (cal_client_get_default_object (client, CALOBJ_TYPE_EVENT, &icalcomp) != CAL_CLIENT_GET_SUCCESS)
+ if (!cal_client_get_default_object (client, CALOBJ_TYPE_EVENT, &icalcomp, NULL))
return NULL;
comp = cal_component_new ();
@@ -334,7 +315,7 @@ cal_comp_task_new_with_defaults (CalClient *client)
CalComponent *comp;
icalcomponent *icalcomp;
- if (cal_client_get_default_object (client, CALOBJ_TYPE_TODO, &icalcomp) != CAL_CLIENT_GET_SUCCESS)
+ if (!cal_client_get_default_object (client, CALOBJ_TYPE_TODO, &icalcomp, NULL))
return NULL;
comp = cal_component_new ();
diff --git a/calendar/gui/dialogs/alarm-page.c b/calendar/gui/dialogs/alarm-page.c
index 785734ad8c..919ed9a2c8 100644
--- a/calendar/gui/dialogs/alarm-page.c
+++ b/calendar/gui/dialogs/alarm-page.c
@@ -677,10 +677,9 @@ add_clicked_cb (GtkButton *button, gpointer data)
action = e_dialog_option_menu_get (priv->action, action_map);
cal_component_alarm_set_action (alarm, action);
if (action == CAL_ALARM_EMAIL && !cal_component_alarm_has_attendees (alarm)) {
- const char *email;
+ char *email;
- email = cal_client_get_alarm_email_address (COMP_EDITOR_PAGE (apage)->client);
- if (email != NULL) {
+ if (!cal_client_get_alarm_email_address (COMP_EDITOR_PAGE (apage)->client, &email, NULL)) {
CalComponentAttendee *a;
GSList attendee_list;
@@ -689,6 +688,7 @@ add_clicked_cb (GtkButton *button, gpointer data)
attendee_list.data = a;
attendee_list.next = NULL;
cal_component_alarm_set_attendee_list (alarm, &attendee_list);
+ g_free (email);
g_free (a);
}
}
@@ -741,7 +741,7 @@ button_options_clicked_cb (GtkWidget *widget, gpointer data)
AlarmPage *apage;
AlarmPagePrivate *priv;
gboolean repeat;
- const char *email;
+ char *email;
apage = ALARM_PAGE (data);
priv = apage->priv;
@@ -751,9 +751,11 @@ button_options_clicked_cb (GtkWidget *widget, gpointer data)
repeat = !cal_client_get_static_capability (COMP_EDITOR_PAGE (apage)->client,
CAL_STATIC_CAPABILITY_NO_ALARM_REPEAT);
- email = cal_client_get_alarm_email_address (COMP_EDITOR_PAGE (apage)->client);
- if (!alarm_options_dialog_run (priv->alarm, email, repeat))
- g_message ("button_options_clicked_cb(): Could not create the alarm options dialog");
+
+ if (cal_client_get_alarm_email_address (COMP_EDITOR_PAGE (apage)->client, &email, NULL)) {
+ if (!alarm_options_dialog_run (priv->alarm, email, repeat))
+ g_message ("button_options_clicked_cb(): Could not create the alarm options dialog");
+ }
}
/* Hooks the widget signals */
diff --git a/calendar/gui/dialogs/comp-editor.c b/calendar/gui/dialogs/comp-editor.c
index f9c9919338..183be702ab 100644
--- a/calendar/gui/dialogs/comp-editor.c
+++ b/calendar/gui/dialogs/comp-editor.c
@@ -41,6 +41,7 @@
#include <e-util/e-dialog-utils.h>
#include <evolution-shell-component-utils.h>
#include "../print.h"
+#include "../comp-util.h"
#include "save-comp.h"
#include "delete-comp.h"
#include "send-comp.h"
@@ -294,7 +295,7 @@ save_comp (CompEditor *editor)
CompEditorPrivate *priv;
CalComponent *clone;
GList *l;
- CalClientResult result;
+ gboolean result;
priv = editor->priv;
@@ -321,28 +322,19 @@ save_comp (CompEditor *editor)
priv->updating = TRUE;
- if (cal_component_is_instance (priv->comp))
- result = cal_client_update_object_with_mod (priv->client, priv->comp, priv->mod);
- else
- result = cal_client_update_object (priv->client, priv->comp);
- if (result != CAL_CLIENT_RESULT_SUCCESS) {
+ if (!cal_comp_is_on_server (priv->comp, priv->client)) {
+ /* FIXME Better error handling */
+ result = cal_client_create_object (priv->client, cal_component_get_icalcomponent (priv->comp), NULL, NULL);
+ } else {
+ /* FIXME Better error handling */
+ result = cal_client_modify_object (priv->client, cal_component_get_icalcomponent (priv->comp), priv->mod, NULL);
+ }
+
+ if (!result) {
GtkWidget *dlg;
char *msg;
- switch (result) {
- case CAL_CLIENT_RESULT_INVALID_OBJECT :
- msg = g_strdup (_("Could not update invalid object"));
- break;
- case CAL_CLIENT_RESULT_NOT_FOUND :
- msg = g_strdup (_("Object not found, not updated"));
- break;
- case CAL_CLIENT_RESULT_PERMISSION_DENIED :
- msg = g_strdup (_("You don't have permissions to update this object"));
- break;
- default :
- msg = g_strdup (_("Could not update object"));
- break;
- }
+ msg = g_strdup (_("Could not update object"));
dlg = gnome_error_dialog (msg);
gnome_dialog_run_and_close (GNOME_DIALOG (dlg));
@@ -391,7 +383,7 @@ delete_comp (CompEditor *editor)
cal_component_get_uid (priv->comp, &uid);
priv->updating = TRUE;
- cal_client_remove_object (priv->client, uid);
+ cal_client_remove_object (priv->client, uid, NULL);
priv->updating = FALSE;
close_dialog (editor);
}
@@ -1442,7 +1434,6 @@ obj_updated_cb (CalClient *client, const char *uid, gpointer data)
CompEditor *editor = COMP_EDITOR (data);
CompEditorPrivate *priv;
CalComponent *comp = NULL;
- CalClientGetStatus status;
const char *edit_uid;
priv = editor->priv;
@@ -1453,8 +1444,7 @@ obj_updated_cb (CalClient *client, const char *uid, gpointer data)
if (changed_component_dialog ((GtkWindow *) editor, priv->comp, FALSE, priv->changed)) {
icalcomponent *icalcomp;
- status = cal_client_get_object (priv->client, uid, &icalcomp);
- if (status == CAL_CLIENT_GET_SUCCESS) {
+ if (!cal_client_get_object (priv->client, uid, NULL, &icalcomp, NULL)) {
comp = cal_component_new ();
if (cal_component_set_icalcomponent (comp, icalcomp))
comp_editor_edit_comp (editor, comp);
diff --git a/calendar/gui/dialogs/delete-error.c b/calendar/gui/dialogs/delete-error.c
index 947aab1e97..edbcaf9880 100644
--- a/calendar/gui/dialogs/delete-error.c
+++ b/calendar/gui/dialogs/delete-error.c
@@ -38,13 +38,16 @@
*
**/
void
-delete_error_dialog (CalClientResult result, CalComponentVType vtype)
+delete_error_dialog (GError *error, CalComponentVType vtype)
{
GtkWidget *dialog;
const char *str;
- switch (result) {
- case CAL_CLIENT_RESULT_CORBA_ERROR:
+ if (!error)
+ return;
+
+ switch (error->code) {
+ case E_CALENDAR_STATUS_CORBA_EXCEPTION:
switch (vtype) {
case CAL_COMPONENT_EVENT:
str = _("The event could not be deleted due to a corba error");
@@ -60,7 +63,7 @@ delete_error_dialog (CalClientResult result, CalComponentVType vtype)
break;
}
break;
- case CAL_CLIENT_RESULT_PERMISSION_DENIED:
+ case E_CALENDAR_STATUS_PERMISSION_DENIED:
switch (vtype) {
case CAL_COMPONENT_EVENT:
str = _("The event could not be deleted because permission was denied");
@@ -76,24 +79,24 @@ delete_error_dialog (CalClientResult result, CalComponentVType vtype)
break;
}
break;
- case CAL_CLIENT_RESULT_INVALID_OBJECT:
+ case E_CALENDAR_STATUS_OTHER_ERROR:
switch (vtype) {
case CAL_COMPONENT_EVENT:
- str = _("The event could not be deleted because it was invalid");
+ str = _("The event could not be deleted due to an error");
break;
case CAL_COMPONENT_TODO:
- str = _("The task could not be deleted because it was invalid");
+ str = _("The task could not be deleted due to an error");
break;
case CAL_COMPONENT_JOURNAL:
- str = _("The journal entry could not be deleted because it was invalid");
+ str = _("The journal entry could not be deleted due to an error");
break;
default:
- str = _("The item could not be deleted because it was invalid");
+ str = _("The item could not be deleted due to an error");
break;
}
break;
- case CAL_CLIENT_RESULT_SUCCESS:
- case CAL_CLIENT_RESULT_NOT_FOUND:
+ case E_CALENDAR_STATUS_OK:
+ case E_CALENDAR_STATUS_OBJECT_NOT_FOUND:
default:
/* If not found, we don't care - its gone anyhow */
return;
diff --git a/calendar/gui/dialogs/delete-error.h b/calendar/gui/dialogs/delete-error.h
index dcef2fa3be..4ac8cf4515 100644
--- a/calendar/gui/dialogs/delete-error.h
+++ b/calendar/gui/dialogs/delete-error.h
@@ -25,6 +25,6 @@
#include <cal-client/cal-client.h>
#include <cal-util/cal-component.h>
-void delete_error_dialog (CalClientResult result, CalComponentVType vtype);
+void delete_error_dialog (GError *error, CalComponentVType vtype);
#endif
diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c
index a67f2b14f9..18a30db63e 100644
--- a/calendar/gui/dialogs/event-editor.c
+++ b/calendar/gui/dialogs/event-editor.c
@@ -121,13 +121,14 @@ static void
set_menu_sens (EventEditor *ee)
{
EventEditorPrivate *priv;
- gboolean sens, existing, user, read_only;
+ gboolean sens, existing, user, read_only = TRUE;
priv = ee->priv;
existing = comp_editor_get_existing_org (COMP_EDITOR (ee));
user = comp_editor_get_user_org (COMP_EDITOR (ee));
- read_only = cal_client_is_read_only (comp_editor_get_cal_client (COMP_EDITOR (ee)));
+
+ cal_client_is_read_only (comp_editor_get_cal_client (COMP_EDITOR (ee)), &read_only, NULL);
sens = priv->meeting_shown;
comp_editor_set_ui_prop (COMP_EDITOR (ee),
diff --git a/calendar/gui/dialogs/event-page.c b/calendar/gui/dialogs/event-page.c
index b55e67dedd..8813081f4d 100644
--- a/calendar/gui/dialogs/event-page.c
+++ b/calendar/gui/dialogs/event-page.c
@@ -270,7 +270,6 @@ update_time (EventPage *epage, CalComponentDateTime *start_date, CalComponentDat
EventPagePrivate *priv;
struct icaltimetype *start_tt, *end_tt, implied_tt;
icaltimezone *start_zone = NULL, *end_zone = NULL;
- CalClientGetStatus status;
gboolean all_day_event;
priv = epage->priv;
@@ -280,24 +279,22 @@ update_time (EventPage *epage, CalComponentDateTime *start_date, CalComponentDat
first. */
start_zone = icaltimezone_get_builtin_timezone_from_tzid (start_date->tzid);
if (!start_zone) {
- status = cal_client_get_timezone (COMP_EDITOR_PAGE (epage)->client,
- start_date->tzid,
- &start_zone);
/* FIXME: Handle error better. */
- if (status != CAL_CLIENT_GET_SUCCESS)
+ if (!cal_client_get_timezone (COMP_EDITOR_PAGE (epage)->client,
+ start_date->tzid, &start_zone, NULL)) {
g_warning ("Couldn't get timezone from server: %s",
- start_date->tzid ? start_date->tzid : "");
+ start_date->tzid ? start_date->tzid : "");
+ }
}
end_zone = icaltimezone_get_builtin_timezone_from_tzid (end_date->tzid);
if (!end_zone) {
- status = cal_client_get_timezone (COMP_EDITOR_PAGE (epage)->client,
- end_date->tzid,
- &end_zone);
- /* FIXME: Handle error better. */
- if (status != CAL_CLIENT_GET_SUCCESS)
- g_warning ("Couldn't get timezone from server: %s",
- end_date->tzid ? end_date->tzid : "");
+ if (!cal_client_get_timezone (COMP_EDITOR_PAGE (epage)->client,
+ end_date->tzid, &end_zone, NULL)) {
+ /* FIXME: Handle error better. */
+ g_warning ("Couldn't get timezone from server: %s",
+ end_date->tzid ? end_date->tzid : "");
+ }
}
/* If both times are DATE values, we set the 'All Day Event' checkbox.
diff --git a/calendar/gui/dialogs/meeting-page.c b/calendar/gui/dialogs/meeting-page.c
index e603978520..cab0f3df8a 100644
--- a/calendar/gui/dialogs/meeting-page.c
+++ b/calendar/gui/dialogs/meeting-page.c
@@ -497,7 +497,7 @@ get_widgets (MeetingPage *mpage)
/* For making the user the organizer */
priv->organizer_table = GW ("organizer-table");
priv->organizer = GW ("organizer");
- gtk_combo_set_value_in_list (GTK_COMBO (priv->organizer), FALSE, FALSE);
+ gtk_combo_set_value_in_list (GTK_COMBO (priv->organizer), TRUE, FALSE);
/* For showing existing organizers */
priv->existing_organizer_table = GW ("existing-organizer-table");
@@ -790,7 +790,7 @@ meeting_page_construct (MeetingPage *mpage, EMeetingModel *emm,
MeetingPagePrivate *priv;
ETable *real_table;
gchar *filename;
- const char *backend_address;
+ char *backend_address;
EIterator *it;
EAccount *def_account;
GList *address_strings = NULL, *l;
@@ -812,7 +812,8 @@ meeting_page_construct (MeetingPage *mpage, EMeetingModel *emm,
}
/* Address information */
- backend_address = cal_client_get_cal_address (client);
+ if (!cal_client_get_cal_address (client, &backend_address, NULL))
+ return NULL;
priv->accounts = itip_addresses_get ();
def_account = itip_addresses_get_default();
@@ -839,6 +840,7 @@ meeting_page_construct (MeetingPage *mpage, EMeetingModel *emm,
}
}
g_object_unref(it);
+ g_free (backend_address);
if (address_strings)
gtk_combo_set_popdown_strings (GTK_COMBO (priv->organizer), address_strings);
diff --git a/calendar/gui/dialogs/recurrence-page.c b/calendar/gui/dialogs/recurrence-page.c
index 275ba26c44..4599001c27 100644
--- a/calendar/gui/dialogs/recurrence-page.c
+++ b/calendar/gui/dialogs/recurrence-page.c
@@ -852,7 +852,8 @@ preview_recur (RecurrencePage *rpage)
cal_component_get_dtstart (priv->comp, &cdt);
if (cdt.tzid != NULL) {
- if (cal_client_get_timezone (COMP_EDITOR_PAGE (rpage)->client, cdt.tzid, &zone) != CAL_CLIENT_GET_SUCCESS)
+ /* FIXME Will cal_client_get_timezone really not return builtin zones? */
+ if (!cal_client_get_timezone (COMP_EDITOR_PAGE (rpage)->client, cdt.tzid, &zone, NULL))
zone = icaltimezone_get_builtin_timezone_from_tzid (cdt.tzid);
}
cal_component_set_dtstart (comp, &cdt);
@@ -1448,7 +1449,8 @@ fill_ending_date (RecurrencePage *rpage, struct icalrecurrencetype *r)
else if (dt.tzid == NULL)
to_zone = icaltimezone_get_utc_timezone ();
else
- cal_client_get_timezone (client, dt.tzid, &to_zone);
+ /* FIXME Error checking? */
+ cal_client_get_timezone (client, dt.tzid, &to_zone, NULL);
from_zone = icaltimezone_get_utc_timezone ();
icaltimezone_convert_time (&r->until, from_zone, to_zone);
diff --git a/calendar/gui/dialogs/schedule-page.c b/calendar/gui/dialogs/schedule-page.c
index 2163d51f1e..eb1813195c 100644
--- a/calendar/gui/dialogs/schedule-page.c
+++ b/calendar/gui/dialogs/schedule-page.c
@@ -208,7 +208,6 @@ update_time (SchedulePage *spage, CalComponentDateTime *start_date, CalComponent
SchedulePagePrivate *priv;
struct icaltimetype start_tt, end_tt;
icaltimezone *start_zone = NULL, *end_zone = NULL;
- CalClientGetStatus status;
gboolean all_day;
priv = spage->priv;
@@ -218,24 +217,22 @@ update_time (SchedulePage *spage, CalComponentDateTime *start_date, CalComponent
first. */
start_zone = icaltimezone_get_builtin_timezone_from_tzid (start_date->tzid);
if (!start_zone) {
- status = cal_client_get_timezone (COMP_EDITOR_PAGE (spage)->client,
- start_date->tzid,
- &start_zone);
- /* FIXME: Handle error better. */
- if (status != CAL_CLIENT_GET_SUCCESS)
+ if (!cal_client_get_timezone (COMP_EDITOR_PAGE (spage)->client,
+ start_date->tzid, &start_zone, NULL)) {
+ /* FIXME: Handle error better. */
g_warning ("Couldn't get timezone from server: %s",
start_date->tzid ? start_date->tzid : "");
+ }
}
end_zone = icaltimezone_get_builtin_timezone_from_tzid (end_date->tzid);
if (!end_zone) {
- status = cal_client_get_timezone (COMP_EDITOR_PAGE (spage)->client,
- end_date->tzid,
- &end_zone);
- /* FIXME: Handle error better. */
- if (status != CAL_CLIENT_GET_SUCCESS)
- g_warning ("Couldn't get timezone from server: %s",
- end_date->tzid ? end_date->tzid : "");
+ if (!cal_client_get_timezone (COMP_EDITOR_PAGE (spage)->client,
+ end_date->tzid, &end_zone, NULL)) {
+ /* FIXME: Handle error better. */
+ g_warning ("Couldn't get timezone from server: %s",
+ end_date->tzid ? end_date->tzid : "");
+ }
}
start_tt = *start_date->value;
diff --git a/calendar/gui/dialogs/task-editor.c b/calendar/gui/dialogs/task-editor.c
index eaf4c2eaca..2e1b4745d8 100644
--- a/calendar/gui/dialogs/task-editor.c
+++ b/calendar/gui/dialogs/task-editor.c
@@ -111,13 +111,14 @@ static void
set_menu_sens (TaskEditor *te)
{
TaskEditorPrivate *priv;
- gboolean sens, existing, user, read_only;
+ gboolean sens, existing, user, read_only = TRUE;
priv = te->priv;
existing = comp_editor_get_existing_org (COMP_EDITOR (te));
user = comp_editor_get_user_org (COMP_EDITOR (te));
- read_only = cal_client_is_read_only (comp_editor_get_cal_client (COMP_EDITOR (te)));
+
+ cal_client_is_read_only (comp_editor_get_cal_client (COMP_EDITOR (te)), &read_only, NULL);
sens = cal_client_get_static_capability (comp_editor_get_cal_client (COMP_EDITOR (te)),
CAL_STATIC_CAPABILITY_NO_TASK_ASSIGNMENT)
diff --git a/calendar/gui/dialogs/task-page.c b/calendar/gui/dialogs/task-page.c
index 760b3e6f9e..fb7558ce5a 100644
--- a/calendar/gui/dialogs/task-page.c
+++ b/calendar/gui/dialogs/task-page.c
@@ -253,7 +253,6 @@ task_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
CalComponentText text;
CalComponentDateTime d;
CalComponentClassification cl;
- CalClientGetStatus get_tz_status;
GSList *l;
const char *categories;
icaltimezone *zone, *default_zone;
@@ -317,12 +316,10 @@ task_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
if (!zone)
zone = icaltimezone_get_builtin_timezone_from_tzid (d.tzid);
if (!zone) {
- get_tz_status = cal_client_get_timezone (page->client, d.tzid,
- &zone);
- /* FIXME: Handle error better. */
- if (get_tz_status != CAL_CLIENT_GET_SUCCESS)
- g_warning ("Couldn't get timezone from server: %s",
- d.tzid ? d.tzid : "");
+ if (!cal_client_get_timezone (page->client, d.tzid, &zone, NULL))
+ /* FIXME: Handle error better. */
+ g_warning ("Couldn't get timezone from server: %s",
+ d.tzid ? d.tzid : "");
}
e_timezone_entry_set_timezone (E_TIMEZONE_ENTRY (priv->due_timezone),
zone);
@@ -359,10 +356,8 @@ task_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
if (!zone)
zone = icaltimezone_get_builtin_timezone_from_tzid (d.tzid);
if (!zone) {
- get_tz_status = cal_client_get_timezone (page->client, d.tzid,
- &zone);
- /* FIXME: Handle error better. */
- if (get_tz_status != CAL_CLIENT_GET_SUCCESS)
+ if (!cal_client_get_timezone (page->client, d.tzid, &zone, NULL))
+ /* FIXME: Handle error better. */
g_warning ("Couldn't get timezone from server: %s",
d.tzid ? d.tzid : "");
}
diff --git a/calendar/gui/e-alarm-list.c b/calendar/gui/e-alarm-list.c
index 534a8c9449..56cce73e2f 100644
--- a/calendar/gui/e-alarm-list.c
+++ b/calendar/gui/e-alarm-list.c
@@ -224,10 +224,6 @@ row_updated (EAlarmList *alarm_list, gint n)
static void
e_alarm_list_finalize (GObject *object)
{
- EAlarmList *alarm_list = E_ALARM_LIST (object);
-
- if (G_OBJECT_CLASS (parent_class)->finalize)
- (* G_OBJECT_CLASS (parent_class)->finalize) (object);
}
/* Fulfill the GtkTreeModel requirements */
diff --git a/calendar/gui/e-cal-model-calendar.c b/calendar/gui/e-cal-model-calendar.c
index 82de4e6d5a..7a10894ed4 100644
--- a/calendar/gui/e-cal-model-calendar.c
+++ b/calendar/gui/e-cal-model-calendar.c
@@ -128,8 +128,8 @@ get_dtend (ECalModelComponent *comp_data)
/* FIXME: handle errors */
cal_client_get_timezone (comp_data->client,
- icaltime_get_tzid (tt_end),
- &zone);
+ icaltimezone_get_tzid (icaltimezone_get_builtin_timezone (tt_end.zone)),
+ &zone, NULL);
comp_data->dtend->zone = zone;
}
@@ -155,14 +155,12 @@ get_transparency (ECalModelComponent *comp_data)
prop = icalcomponent_get_first_property (comp_data->icalcomp, ICAL_TRANSP_PROPERTY);
if (prop) {
- icalproperty_transp transp;
+ const char *transp;
transp = icalproperty_get_transp (prop);
- if (transp == ICAL_TRANSP_TRANSPARENT ||
- transp == ICAL_TRANSP_TRANSPARENTNOCONFLICT)
+ if (strcasecmp (transp, "TRANSPARENT") == 0)
return _("Free");
- else if (transp == ICAL_TRANSP_OPAQUE ||
- transp == ICAL_TRANSP_OPAQUENOCONFLICT)
+ else if (strcasecmp (transp, "OPAQUE") == 0)
return _("Busy");
}
@@ -253,12 +251,12 @@ set_transparency (ECalModelComponent *comp_data, const void *value)
icalproperty_free (prop);
}
} else {
- icalproperty_transp transp;
+ const char *transp;
- if (!strcasecmp (value, "FREE"))
- transp = ICAL_TRANSP_TRANSPARENT;
- else if (!strcasecmp (value, "OPAQUE"))
- transp = ICAL_TRANSP_OPAQUE;
+ if (strcasecmp (value, "FREE"))
+ transp = "TRANSPARENT";
+ else if (strcasecmp (value, "OPAQUE"))
+ transp = "OPAQUE";
else {
if (prop) {
icalcomponent_remove_property (comp_data->icalcomp, prop);
@@ -308,8 +306,12 @@ ecmc_set_value_at (ETableModel *etm, int col, int row, const void *value)
break;
}
- if (cal_client_update_objects (comp_data->client, comp_data->icalcomp) != CAL_CLIENT_RESULT_SUCCESS)
- g_message ("ecmc_set_value_at(): Could not update the object!");
+ /* FIXME ask about mod type */
+ if (!cal_client_modify_object (comp_data->client, comp_data->icalcomp, CALOBJ_MOD_ALL, NULL)) {
+ g_warning (G_STRLOC ": Could not modify the object!");
+
+ /* FIXME Show error dialog */
+ }
}
static gboolean
diff --git a/calendar/gui/e-cal-model-tasks.c b/calendar/gui/e-cal-model-tasks.c
index 6bca52586c..75d0d1c928 100644
--- a/calendar/gui/e-cal-model-tasks.c
+++ b/calendar/gui/e-cal-model-tasks.c
@@ -222,8 +222,8 @@ get_completed (ECalModelComponent *comp_data)
/* FIXME: handle errors */
cal_client_get_timezone (comp_data->client,
- icaltime_get_tzid (tt_completed),
- &zone);
+ icaltimezone_get_tzid (icaltimezone_get_builtin_timezone (tt_completed.zone)),
+ &zone, NULL);
comp_data->completed->zone = zone;
}
@@ -252,8 +252,8 @@ get_due (ECalModelComponent *comp_data)
/* FIXME: handle errors */
cal_client_get_timezone (comp_data->client,
- icaltime_get_tzid (tt_due),
- &zone);
+ icaltimezone_get_tzid (icaltimezone_get_builtin_timezone (tt_due.zone)),
+ &zone, NULL);
comp_data->due->zone = zone;
}
@@ -374,7 +374,6 @@ get_due_status (ECalModelTasks *model, ECalModelComponent *comp_data)
return E_CAL_MODEL_TASKS_DUE_NEVER;
else {
struct icaltimetype now_tt, due_tt;
- CalClientGetStatus status;
icaltimezone *zone;
/* Second, is it already completed? */
@@ -397,10 +396,9 @@ get_due_status (ECalModelTasks *model, ECalModelComponent *comp_data)
return E_CAL_MODEL_TASKS_DUE_FUTURE;
} else {
/* Get the current time in the same timezone as the DUE date.*/
- status = cal_client_get_timezone (comp_data->client,
- icaltime_get_tzid (due_tt),
- &zone);
- if (status != CAL_CLIENT_GET_SUCCESS)
+ if (!cal_client_get_timezone (comp_data->client,
+ icaltimezone_get_tzid (icaltimezone_get_builtin_timezone (due_tt.zone)),
+ &zone, NULL))
return E_CAL_MODEL_TASKS_DUE_FUTURE;
now_tt = icaltime_current_time_with_zone (zone);
@@ -756,8 +754,12 @@ ecmt_set_value_at (ETableModel *etm, int col, int row, const void *value)
break;
}
- if (cal_client_update_objects (comp_data->client, comp_data->icalcomp) != CAL_CLIENT_RESULT_SUCCESS)
- g_message ("ecmt_set_value_at(): Could not update the object!");
+ /* FIXME ask about mod type */
+ if (!cal_client_modify_object (comp_data->client, comp_data->icalcomp, CALOBJ_MOD_ALL, NULL)) {
+ g_warning (G_STRLOC ": Could not modify the object!");
+
+ /* FIXME Show error dialog */
+ }
}
static gboolean
@@ -960,8 +962,7 @@ ecmt_get_color_for_component (ECalModel *model, ECalModelComponent *comp_data)
break;
}
- return "black";
- /* return E_CAL_MODEL_CLASS (parent_class)->get_color_for_component (model, comp_data); */
+ return E_CAL_MODEL_CLASS (parent_class)->get_color_for_component (model, comp_data);
}
static void
diff --git a/calendar/gui/e-cal-model.c b/calendar/gui/e-cal-model.c
index 8a68cd07e5..9dd75d559a 100644
--- a/calendar/gui/e-cal-model.c
+++ b/calendar/gui/e-cal-model.c
@@ -336,8 +336,8 @@ get_dtstart (ECalModel *model, ECalModelComponent *comp_data)
/* FIXME: handle errors */
cal_client_get_timezone (comp_data->client,
- icaltime_get_tzid (tt_start),
- &zone);
+ icaltimezone_get_tzid (icaltimezone_get_builtin_timezone (tt_start.zone)),
+ &zone, NULL);
comp_data->dtstart->zone = zone;
}
@@ -476,22 +476,11 @@ set_classification (ECalModelComponent *comp_data, const char *value)
icalproperty_free (prop);
}
} else {
- icalproperty_class ical_class;
-
- if (!strcasecmp (value, "PUBLIC"))
- ical_class = ICAL_CLASS_PUBLIC;
- else if (!strcasecmp (value, "PRIVATE"))
- ical_class = ICAL_CLASS_PRIVATE;
- else if (!strcasecmp (value, "CONFIDENTIAL"))
- ical_class = ICAL_CLASS_CONFIDENTIAL;
- else
- ical_class = ICAL_CLASS_NONE;
-
if (!prop) {
- prop = icalproperty_new_class (ical_class);
+ prop = icalproperty_new_class (value);
icalcomponent_add_property (comp_data->icalcomp, prop);
} else
- icalproperty_set_class (prop, ical_class);
+ icalproperty_set_class (prop, value);
}
}
@@ -589,8 +578,12 @@ ecm_set_value_at (ETableModel *etm, int col, int row, const void *value)
set_summary (comp_data, value);
}
- if (cal_client_update_objects (comp_data->client, comp_data->icalcomp) != CAL_CLIENT_RESULT_SUCCESS)
- g_message ("ecm_set_value_at(): Could not update the object!");
+ /* FIXME ask about mod type */
+ if (!cal_client_modify_object (comp_data->client, comp_data->icalcomp, CALOBJ_MOD_ALL, NULL)) {
+ g_warning (G_STRLOC ": Could not modify the object!");
+
+ /* FIXME Show error dialog */
+ }
}
static gboolean
@@ -653,7 +646,10 @@ ecm_append_row (ETableModel *etm, ETableModel *source, int row)
model_class->fill_component_from_model (model, &comp_data, source_model, row);
}
- if (cal_client_update_objects (comp_data.client, comp_data.icalcomp) != CAL_CLIENT_RESULT_SUCCESS) {
+
+ if (!cal_client_create_object (comp_data.client, comp_data.icalcomp, NULL, NULL)) {
+ g_warning (G_STRLOC ": Could not create the object!");
+
/* FIXME: show error dialog */
}
@@ -1062,124 +1058,119 @@ get_position_in_array (GPtrArray *objects, gpointer item)
}
static void
-query_obj_updated_cb (CalQuery *query, const char *uid,
- gboolean query_in_progress,
- int n_scanned, int total,
- gpointer user_data)
+query_objects_added_cb (CalQuery *query, GList *objects, gpointer user_data)
{
- ECalModelPrivate *priv;
- icalcomponent *new_icalcomp;
- CalClientGetStatus status;
- ECalModelComponent *comp_data;
- gint pos;
ECalModel *model = (ECalModel *) user_data;
-
- g_return_if_fail (E_IS_CAL_MODEL (model));
-
+ ECalModelPrivate *priv;
+ GList *l;
+ int start_row;
+
priv = model->priv;
e_table_model_pre_change (E_TABLE_MODEL (model));
- comp_data = search_by_uid_and_client (priv, cal_query_get_client (query), uid);
- status = cal_client_get_object (cal_query_get_client (query), uid, &new_icalcomp);
- switch (status) {
- case CAL_CLIENT_GET_SUCCESS :
- if (comp_data) {
- if (comp_data->icalcomp)
- icalcomponent_free (comp_data->icalcomp);
- if (comp_data->dtstart) {
- g_free (comp_data->dtstart);
- comp_data->dtstart = NULL;
- }
- if (comp_data->dtend) {
- g_free (comp_data->dtend);
- comp_data->dtend = NULL;
- }
- if (comp_data->due) {
- g_free (comp_data->due);
- comp_data->due = NULL;
- }
- if (comp_data->completed) {
- g_free (comp_data->completed);
- comp_data->completed = NULL;
- }
+ start_row = priv->objects->len ? priv->objects->len - 1 : 0;
+
+ for (l = objects; l; l = l->next) {
+ ECalModelComponent *comp_data;
- comp_data->icalcomp = new_icalcomp;
+ comp_data = g_new0 (ECalModelComponent, 1);
+ comp_data->client = cal_query_get_client (query);
+ comp_data->icalcomp = icalcomponent_new_clone (l->data);
- e_table_model_row_changed (E_TABLE_MODEL (model), get_position_in_array (priv->objects, comp_data));
- } else {
- comp_data = g_new0 (ECalModelComponent, 1);
- comp_data->client = cal_query_get_client (query);
- comp_data->icalcomp = new_icalcomp;
+ g_ptr_array_add (priv->objects, comp_data);
+ }
- g_ptr_array_add (priv->objects, comp_data);
- e_table_model_row_inserted (E_TABLE_MODEL (model), priv->objects->len - 1);
- }
- break;
- case CAL_CLIENT_GET_NOT_FOUND :
- case CAL_CLIENT_GET_SYNTAX_ERROR :
- if (comp_data) {
- /* Nothing; the object may have been removed from the server. We just
- notify that the old object was deleted.
- */
- pos = get_position_in_array (priv->objects, comp_data);
+ e_table_model_rows_inserted (E_TABLE_MODEL (model), start_row, priv->objects->len - start_row);
+}
- g_ptr_array_remove (priv->objects, comp_data);
- free_comp_data (comp_data);
+static void
+query_objects_modified_cb (CalQuery *query, GList *objects, gpointer user_data)
+{
+ ECalModelPrivate *priv;
+ ECalModel *model = (ECalModel *) user_data;
+ GList *l;
+
+ priv = model->priv;
- e_table_model_row_deleted (E_TABLE_MODEL (model), pos);
- } else
- e_table_model_no_change (E_TABLE_MODEL (model));
- break;
- default :
- g_assert_not_reached ();
+ for (l = objects; l; l = l->next) {
+ ECalModelComponent *comp_data;
+
+ e_table_model_pre_change (E_TABLE_MODEL (model));
+
+ comp_data = search_by_uid_and_client (priv, cal_query_get_client (query), icalcomponent_get_uid (l->data));
+ g_assert (comp_data);
+
+ if (comp_data->icalcomp)
+ icalcomponent_free (comp_data->icalcomp);
+ if (comp_data->dtstart) {
+ g_free (comp_data->dtstart);
+ comp_data->dtstart = NULL;
+ }
+ if (comp_data->dtend) {
+ g_free (comp_data->dtend);
+ comp_data->dtend = NULL;
+ }
+ if (comp_data->due) {
+ g_free (comp_data->due);
+ comp_data->due = NULL;
+ }
+ if (comp_data->completed) {
+ g_free (comp_data->completed);
+ comp_data->completed = NULL;
+ }
+
+ comp_data->icalcomp = icalcomponent_new_clone (l->data);
+
+ e_table_model_row_changed (E_TABLE_MODEL (model), get_position_in_array (priv->objects, comp_data));
}
}
static void
-query_obj_removed_cb (CalQuery *query, const char *uid, gpointer user_data)
+query_objects_removed_cb (CalQuery *query, GList *uids, gpointer user_data)
{
- ECalModelComponent *comp_data;
ECalModelPrivate *priv;
ECalModel *model = (ECalModel *) user_data;
-
- g_return_if_fail (E_IS_CAL_MODEL (model));
-
+ GList *l;
+
priv = model->priv;
- e_table_model_pre_change (E_TABLE_MODEL (model));
-
- comp_data = search_by_uid_and_client (priv, cal_query_get_client (query), uid);
- if (comp_data) {
- gint pos = get_position_in_array (priv->objects, comp_data);
+ for (l = uids; l; l = l->next) {
+ ECalModelComponent *comp_data;
+ int pos;
+ e_table_model_pre_change (E_TABLE_MODEL (model));
+
+ comp_data = search_by_uid_and_client (priv, cal_query_get_client (query), l->data);
+ g_assert (comp_data);
+
+ pos = get_position_in_array (priv->objects, comp_data);
+
g_ptr_array_remove (priv->objects, comp_data);
free_comp_data (comp_data);
-
+
e_table_model_row_deleted (E_TABLE_MODEL (model), pos);
- } else
- e_table_model_no_change (E_TABLE_MODEL (model));
+ }
}
static void
-query_done_cb (CalQuery *query, CalQueryDoneStatus status, const char *error_str, gpointer user_data)
+query_progress_cb (CalQuery *query, const char *message, int percent, gpointer user_data)
{
ECalModel *model = (ECalModel *) user_data;
g_return_if_fail (E_IS_CAL_MODEL (model));
- if (status != CAL_QUERY_DONE_SUCCESS)
- g_warning ("query done: %s\n", error_str);
+ /* FIXME Update status bar */
}
static void
-query_eval_error_cb (CalQuery *query, const char *error_str, gpointer user_data)
+query_done_cb (CalQuery *query, ECalendarStatus status, gpointer user_data)
{
- ECalModel *model = (ECalModel *) user_data;
+ ECalModel *model = (ECalModel *) user_data;
g_return_if_fail (E_IS_CAL_MODEL (model));
- g_warning ("eval error: %s\n", error_str);
+ /* FIXME Clear status bar */
}
/* Builds a complete query sexp for the calendar model by adding the predicates
@@ -1226,24 +1217,28 @@ update_query_for_client (ECalModel *model, ECalModelClient *client_data)
g_signal_handlers_disconnect_matched (client_data->query, G_SIGNAL_MATCH_DATA,
0, 0, NULL, NULL, model);
g_object_unref (client_data->query);
+ client_data->query = NULL;
}
/* prepare the query */
g_assert (priv->sexp != NULL);
real_sexp = adjust_query_sexp (model, priv->sexp);
- client_data->query = cal_client_get_query (client_data->client, real_sexp);
- g_free (real_sexp);
+ if (!cal_client_get_query (client_data->client, real_sexp, &client_data->query, NULL)) {
+ g_warning (G_STRLOC ": Unable to get query");
+ g_free (real_sexp);
- if (!client_data->query) {
- g_message ("update_query_for_client(): Could not create the query");
return;
- }
+ }
+ g_free (real_sexp);
- g_signal_connect (client_data->query, "obj_updated", G_CALLBACK (query_obj_updated_cb), model);
- g_signal_connect (client_data->query, "obj_removed", G_CALLBACK (query_obj_removed_cb), model);
+ g_signal_connect (client_data->query, "objects_added", G_CALLBACK (query_objects_added_cb), model);
+ g_signal_connect (client_data->query, "objects_modified", G_CALLBACK (query_objects_modified_cb), model);
+ g_signal_connect (client_data->query, "objects_removed", G_CALLBACK (query_objects_removed_cb), model);
+ g_signal_connect (client_data->query, "query_progress", G_CALLBACK (query_progress_cb), model);
g_signal_connect (client_data->query, "query_done", G_CALLBACK (query_done_cb), model);
- g_signal_connect (client_data->query, "eval_error", G_CALLBACK (query_eval_error_cb), model);
+
+ cal_query_start (client_data->query);
}
static void
@@ -1271,6 +1266,8 @@ add_new_client (ECalModel *model, CalClient *client)
priv->clients = g_list_append (priv->clients, client_data);
+ /* FIXME Listen for removals? */
+
g_signal_connect (G_OBJECT (client_data->client), "backend_died",
G_CALLBACK (backend_died_cb), model);
diff --git a/calendar/gui/e-cal-view.c b/calendar/gui/e-cal-view.c
index 381dca2542..7e47d4f59a 100644
--- a/calendar/gui/e-cal-view.c
+++ b/calendar/gui/e-cal-view.c
@@ -45,7 +45,6 @@
#include "dialogs/recur-comp.h"
#include "print.h"
#include "goto.h"
-#include "ea-calendar.h"
/* Used for the status bar messages */
#define EVOLUTION_CALENDAR_PROGRESS_IMAGE "evolution-calendar-mini.png"
@@ -83,8 +82,6 @@ static GdkAtom clipboard_atom = GDK_NONE;
enum {
SELECTION_CHANGED,
TIMEZONE_CHANGED,
- EVENT_CHANGED,
- EVENT_ADDED,
LAST_SIGNAL
};
@@ -115,33 +112,10 @@ e_cal_view_class_init (ECalViewClass *klass)
cal_util_marshal_VOID__POINTER_POINTER,
G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_POINTER);
- e_cal_view_signals[EVENT_CHANGED] =
- g_signal_new ("event_changed",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
- G_STRUCT_OFFSET (ECalViewClass, event_changed),
- NULL, NULL,
- g_cclosure_marshal_VOID__POINTER,
- G_TYPE_NONE, 1,
- G_TYPE_POINTER);
-
- e_cal_view_signals[EVENT_ADDED] =
- g_signal_new ("event_added",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
- G_STRUCT_OFFSET (ECalViewClass, event_added),
- NULL, NULL,
- g_cclosure_marshal_VOID__POINTER,
- G_TYPE_NONE, 1,
- G_TYPE_POINTER);
-
/* Method override */
object_class->destroy = e_cal_view_destroy;
klass->selection_changed = NULL;
- klass->event_changed = NULL;
- klass->event_added = NULL;
-
klass->get_selected_events = NULL;
klass->get_selected_time_range = NULL;
klass->set_selected_time_range = NULL;
@@ -151,9 +125,6 @@ e_cal_view_class_init (ECalViewClass *klass)
/* clipboard atom */
if (!clipboard_atom)
clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE);
-
- /* init the accessibility support for e_day_view */
- e_cal_view_a11y_init ();
}
static void
@@ -208,6 +179,45 @@ selection_clear_event (GtkWidget *invisible,
}
static void
+selection_received_add_event (ECalView *cal_view, CalClient *client, time_t selected_time_start,
+ icaltimezone *default_zone, icalcomponent *icalcomp)
+{
+ CalComponent *comp;
+ struct icaltimetype itime;
+ time_t tt_start, tt_end;
+ struct icaldurationtype ic_dur;
+ char *uid;
+
+ tt_start = icaltime_as_timet (icalcomponent_get_dtstart (icalcomp));
+ tt_end = icaltime_as_timet (icalcomponent_get_dtend (icalcomp));
+ ic_dur = icaldurationtype_from_int (tt_end - tt_start);
+ itime = icaltime_from_timet_with_zone (selected_time_start, FALSE, default_zone);
+
+ icalcomponent_set_dtstart (icalcomp, itime);
+ itime = icaltime_add (itime, ic_dur);
+ icalcomponent_set_dtend (icalcomp, itime);
+
+ /* FIXME The new uid stuff can go away once we actually set it in the backend */
+ uid = cal_component_gen_uid ();
+ comp = cal_component_new ();
+ cal_component_set_icalcomponent (
+ comp, icalcomponent_new_clone (icalcomp));
+ cal_component_set_uid (comp, uid);
+
+ /* FIXME Error handling */
+ cal_client_create_object (client, cal_component_get_icalcomponent (comp), NULL, NULL);
+ if (itip_organizer_is_user (comp, client) &&
+ send_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (cal_view)),
+ client, comp, TRUE)) {
+ itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp,
+ client, NULL);
+ }
+
+ free (uid);
+ g_object_unref (comp);
+}
+
+static void
selection_received (GtkWidget *invisible,
GtkSelectionData *selection_data,
guint time,
@@ -216,12 +226,7 @@ selection_received (GtkWidget *invisible,
char *comp_str, *default_tzid;
icalcomponent *icalcomp;
icalcomponent_kind kind;
- CalComponent *comp;
time_t selected_time_start, selected_time_end;
- struct icaltimetype itime;
- time_t tt_start, tt_end;
- struct icaldurationtype ic_dur;
- char *uid;
icaltimezone *default_zone;
CalClient *client;
@@ -239,20 +244,19 @@ selection_received (GtkWidget *invisible,
default_tzid = calendar_config_get_timezone ();
client = e_cal_model_get_default_client (cal_view->priv->model);
- cal_client_get_timezone (client, default_tzid, &default_zone);
+ /* FIXME Error checking */
+ cal_client_get_timezone (client, default_tzid, &default_zone, NULL);
/* check the type of the component */
+ /* FIXME An error dialog if we return? */
kind = icalcomponent_isa (icalcomp);
- if (kind != ICAL_VCALENDAR_COMPONENT &&
- kind != ICAL_VEVENT_COMPONENT &&
- kind != ICAL_VTODO_COMPONENT &&
- kind != ICAL_VJOURNAL_COMPONENT) {
+ if (kind != ICAL_VCALENDAR_COMPONENT && kind != ICAL_VEVENT_COMPONENT)
return;
- }
e_cal_view_set_status_message (cal_view, _("Updating objects"));
e_cal_view_get_selected_time_range (cal_view, &selected_time_start, &selected_time_end);
+ /* FIXME Timezone handling */
if (kind == ICAL_VCALENDAR_COMPONENT) {
icalcomponent_kind child_kind;
icalcomponent *subcomp;
@@ -260,69 +264,27 @@ selection_received (GtkWidget *invisible,
subcomp = icalcomponent_get_first_component (icalcomp, ICAL_ANY_COMPONENT);
while (subcomp) {
child_kind = icalcomponent_isa (subcomp);
- if (child_kind == ICAL_VEVENT_COMPONENT ||
- child_kind == ICAL_VTODO_COMPONENT ||
- child_kind == ICAL_VJOURNAL_COMPONENT) {
- tt_start = icaltime_as_timet (icalcomponent_get_dtstart (subcomp));
- tt_end = icaltime_as_timet (icalcomponent_get_dtend (subcomp));
- ic_dur = icaldurationtype_from_int (tt_end - tt_start);
- itime = icaltime_from_timet_with_zone (selected_time_start,
- FALSE, default_zone);
-
- icalcomponent_set_dtstart (subcomp, itime);
- itime = icaltime_add (itime, ic_dur);
- icalcomponent_set_dtend (subcomp, itime);
-
- uid = cal_component_gen_uid ();
- comp = cal_component_new ();
- cal_component_set_icalcomponent (
- comp, icalcomponent_new_clone (subcomp));
- cal_component_set_uid (comp, uid);
-
- cal_client_update_object (client, comp);
- if (itip_organizer_is_user (comp, client) &&
- send_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (cal_view)),
- client, comp, TRUE)) {
- itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp,
- client, NULL);
- }
-
- free (uid);
- g_object_unref (comp);
+ if (child_kind == ICAL_VEVENT_COMPONENT)
+ selection_received_add_event (cal_view, client, selected_time_start,
+ default_zone, subcomp);
+ else if (child_kind == ICAL_VTIMEZONE_COMPONENT) {
+ icaltimezone *zone;
+
+ zone = icaltimezone_new ();
+ icaltimezone_set_component (zone, subcomp);
+ cal_client_add_timezone (client, zone, NULL);
+
+ icaltimezone_free (zone, 1);
}
+
subcomp = icalcomponent_get_next_component (
icalcomp, ICAL_ANY_COMPONENT);
}
icalcomponent_free (icalcomp);
- }
- else {
- tt_start = icaltime_as_timet (icalcomponent_get_dtstart (icalcomp));
- tt_end = icaltime_as_timet (icalcomponent_get_dtend (icalcomp));
- ic_dur = icaldurationtype_from_int (tt_end - tt_start);
- itime = icaltime_from_timet_with_zone (selected_time_start, FALSE, default_zone);
-
- icalcomponent_set_dtstart (icalcomp, itime);
- itime = icaltime_add (itime, ic_dur);
- icalcomponent_set_dtend (icalcomp, itime);
-
- uid = cal_component_gen_uid ();
- comp = cal_component_new ();
- cal_component_set_icalcomponent (
- comp, icalcomponent_new_clone (icalcomp));
- cal_component_set_uid (comp, uid);
-
- cal_client_update_object (client, comp);
- if (itip_organizer_is_user (comp, client) &&
- send_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (cal_view)),
- client, comp, TRUE)) {
- itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp,
- client, NULL);
- }
-
- free (uid);
- g_object_unref (comp);
+ } else {
+ selection_received_add_event (cal_view, client, selected_time_start, default_zone, icalcomp);
}
e_cal_view_set_status_message (cal_view, NULL);
@@ -538,13 +500,9 @@ e_cal_view_update_query (ECalView *cal_view)
{
g_return_if_fail (E_IS_CAL_VIEW (cal_view));
- e_cal_view_set_status_message (cal_view, _("Searching"));
-
if (E_CAL_VIEW_CLASS (G_OBJECT_GET_CLASS (cal_view))->update_query) {
E_CAL_VIEW_CLASS (G_OBJECT_GET_CLASS (cal_view))->update_query (cal_view);
}
-
- e_cal_view_set_status_message (cal_view, NULL);
}
void
@@ -564,9 +522,9 @@ e_cal_view_cut_clipboard (ECalView *cal_view)
e_cal_view_copy_clipboard (cal_view);
for (l = selected; l != NULL; l = l->next) {
CalComponent *comp;
-
ECalViewEvent *event = (ECalViewEvent *) l->data;
-
+ GError *error = NULL;
+
if (!event)
continue;
@@ -580,8 +538,8 @@ e_cal_view_cut_clipboard (ECalView *cal_view)
event->comp_data->client, NULL);
cal_component_get_uid (comp, &uid);
- delete_error_dialog (cal_client_remove_object (event->comp_data->client, uid),
- CAL_COMPONENT_EVENT);
+ cal_client_remove_object (event->comp_data->client, uid, &error);
+ delete_error_dialog (error, CAL_COMPONENT_EVENT);
g_object_unref (comp);
}
@@ -657,7 +615,8 @@ delete_event (ECalView *cal_view, ECalViewEvent *event)
if (delete_component_dialog (comp, FALSE, 1, vtype, GTK_WIDGET (cal_view))) {
const char *uid;
-
+ GError *error = NULL;
+
if (itip_organizer_is_user (comp, event->comp_data->client)
&& cancel_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (cal_view)),
event->comp_data->client,
@@ -670,9 +629,10 @@ delete_event (ECalView *cal_view, ECalViewEvent *event)
g_object_unref (comp);
return;
}
-
- delete_error_dialog (
- cal_client_remove_object (event->comp_data->client, uid), CAL_COMPONENT_EVENT);
+
+ cal_client_remove_object (event->comp_data->client, uid, &error);
+ delete_error_dialog (error, CAL_COMPONENT_EVENT);
+ g_clear_error (&error);
}
g_object_unref (comp);
@@ -719,35 +679,20 @@ e_cal_view_delete_selected_occurrence (ECalView *cal_view)
{
ECalViewEvent *event;
GList *selected;
-
+ const char *uid;
+ GError *error = NULL;
+
selected = e_cal_view_get_selected_events (cal_view);
if (!selected)
return;
event = (ECalViewEvent *) selected->data;
- if (cal_util_component_is_instance (event->comp_data->icalcomp)) {
- const char *uid;
-
- uid = icalcomponent_get_uid (event->comp_data->icalcomp);
- delete_error_dialog (
- cal_client_remove_object_with_mod (event->comp_data->client, uid, CALOBJ_MOD_THIS),
- CAL_COMPONENT_EVENT);
- } else {
- CalComponent *comp;
-
- /* we must duplicate the CalComponent, or we won't know it has changed
- when we get the "update_event" signal */
- comp = cal_component_new ();
- cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
- cal_comp_util_add_exdate (comp, event->start, cal_view->priv->zone);
-
- if (cal_client_update_object (event->comp_data->client, comp)
- != CAL_CLIENT_RESULT_SUCCESS)
- g_message ("e_cal_view_delete_selected_occurrence(): Could not update the object!");
+ uid = icalcomponent_get_uid (event->comp_data->icalcomp);
+ cal_client_remove_object_with_mod (event->comp_data->client, uid, CALOBJ_MOD_THIS, &error);
- g_object_unref (comp);
- }
+ delete_error_dialog (error, CAL_COMPONENT_EVENT);
+ g_clear_error (&error);
/* free memory */
g_list_free (selected);
@@ -962,7 +907,7 @@ on_publish (GtkWidget *widget, gpointer user_data)
ECalView *cal_view;
icaltimezone *utc;
time_t start = time (NULL), end;
- GList *comp_list, *client_list, *cl;
+ GList *comp_list = NULL, *client_list, *cl;
cal_view = E_CAL_VIEW (user_data);
@@ -972,8 +917,7 @@ on_publish (GtkWidget *widget, gpointer user_data)
client_list = e_cal_model_get_client_list (cal_view->priv->model);
for (cl = client_list; cl != NULL; cl = cl->next) {
- comp_list = cal_client_get_free_busy ((CalClient *) cl->data, NULL, start, end);
- if (comp_list) {
+ if (cal_client_get_free_busy ((CalClient *) cl->data, NULL, start, end, &comp_list, NULL)) {
GList *l;
for (l = comp_list; l; l = l->next) {
@@ -1041,14 +985,6 @@ on_paste (GtkWidget *widget, gpointer user_data)
e_cal_view_paste_clipboard (cal_view);
}
-static void
-on_unrecur_appointment (GtkWidget *widget, gpointer user_data)
-{
- ECalView *cal_view = E_CAL_VIEW (user_data);
-
- gnome_calendar_unrecur_selection (cal_view->priv->calendar);
-}
-
enum {
/*
* This is used to "flag" events that can not be editted
@@ -1142,7 +1078,6 @@ static EPopupMenu child_items [] = {
E_POPUP_SEPARATOR,
E_POPUP_ITEM (N_("_Delete"), GTK_SIGNAL_FUNC (on_delete_appointment), MASK_EDITABLE | MASK_SINGLE | MASK_EDITING),
- E_POPUP_ITEM (N_("Make this Occurrence _Movable"), GTK_SIGNAL_FUNC (on_unrecur_appointment), MASK_RECURRING | MASK_EDITING | MASK_EDITABLE | MASK_INSTANCE),
E_POPUP_ITEM (N_("Delete this _Occurrence"), GTK_SIGNAL_FUNC (on_delete_occurrence), MASK_RECURRING | MASK_EDITING | MASK_EDITABLE),
E_POPUP_ITEM (N_("Delete _All Occurrences"), GTK_SIGNAL_FUNC (on_delete_appointment), MASK_RECURRING | MASK_EDITING | MASK_EDITABLE),
@@ -1169,36 +1104,8 @@ setup_popup_icons (EPopupMenu *context_menu)
for (i = 0; context_menu[i].name; i++) {
GtkWidget *pixmap_widget = NULL;
- if (!strcmp (context_menu[i].name, _("_Copy")))
- pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_COPY, GTK_ICON_SIZE_MENU);
- else if (!strcmp (context_menu[i].name, _("C_ut")))
- pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_CUT, GTK_ICON_SIZE_MENU);
- else if (!strcmp (context_menu[i].name, _("_Delete")) ||
- !strcmp (context_menu[i].name, _("Delete this _Occurrence")) ||
- !strcmp (context_menu[i].name, _("Delete _All Occurrences")))
- pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_DELETE, GTK_ICON_SIZE_MENU);
- else if (!strcmp (context_menu[i].name, _("Go to _Today")))
- pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_HOME, GTK_ICON_SIZE_MENU);
- else if (!strcmp (context_menu[i].name, _("_Go to Date...")))
- pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_JUMP_TO, GTK_ICON_SIZE_MENU);
- else if (!strcmp (context_menu[i].name, _("New _Appointment...")))
- pixmap_widget = gtk_image_new_from_file (EVOLUTION_IMAGESDIR "/new_appointment.xpm");
- else if (!strcmp (context_menu[i].name, _("New All Day _Event")))
- pixmap_widget = gtk_image_new_from_file (EVOLUTION_IMAGESDIR "/new_all_day_event.png");
- else if (!strcmp (context_menu[i].name, _("New Meeting")))
- pixmap_widget = gtk_image_new_from_file (EVOLUTION_IMAGESDIR "/meeting-request-16.png");
- else if (!strcmp (context_menu[i].name, _("New Task")))
- pixmap_widget = gtk_image_new_from_file (EVOLUTION_IMAGESDIR "/new_task-16.png");
- else if (!strcmp (context_menu[i].name, _("_Open")))
- pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_OPEN, GTK_ICON_SIZE_MENU);
- else if (!strcmp (context_menu[i].name, _("_Paste")))
- pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_PASTE, GTK_ICON_SIZE_MENU);
- else if (!strcmp (context_menu[i].name, _("_Print...")))
+ if (!strcmp (context_menu[i].name, _("_Print...")))
pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_PRINT, GTK_ICON_SIZE_MENU);
- else if (!strcmp (context_menu[i].name, _("_Save As...")))
- pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_SAVE_AS, GTK_ICON_SIZE_MENU);
- else if (!strcmp (context_menu[i].name, _("_Settings...")))
- pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_PREFERENCES, GTK_ICON_SIZE_MENU);
if (pixmap_widget)
gtk_widget_show (pixmap_widget);
@@ -1215,7 +1122,8 @@ e_cal_view_create_popup_menu (ECalView *cal_view)
guint32 disable_mask = 0, hide_mask = 0;
GtkMenu *popup;
CalClient *client = NULL;
-
+ gboolean read_only = TRUE;
+
g_return_val_if_fail (E_IS_CAL_VIEW (cal_view), NULL);
/* get the selection */
@@ -1260,7 +1168,8 @@ e_cal_view_create_popup_menu (ECalView *cal_view)
client = event->comp_data->client;
}
- if (cal_client_is_read_only (client))
+ cal_client_is_read_only (client, &read_only, NULL);
+ if (!read_only)
disable_mask |= MASK_EDITABLE;
if (being_edited)
diff --git a/calendar/gui/e-cal-view.h b/calendar/gui/e-cal-view.h
index ea7c11a00d..6fac862ded 100644
--- a/calendar/gui/e-cal-view.h
+++ b/calendar/gui/e-cal-view.h
@@ -77,8 +77,6 @@ struct _ECalViewClass {
/* Notification signals */
void (* selection_changed) (ECalView *cal_view);
void (* timezone_changed) (ECalView *cal_view, icaltimezone *old_zone, icaltimezone *new_zone);
- void (* event_changed) (ECalView *day_view, ECalViewEvent *event);
- void (* event_added) (ECalView *day_view, ECalViewEvent *event);
/* Virtual methods */
GList * (* get_selected_events) (ECalView *cal_view); /* a GList of ECalViewEvent's */
diff --git a/calendar/gui/e-calendar-table.c b/calendar/gui/e-calendar-table.c
index 5b3f98f373..bbda572984 100644
--- a/calendar/gui/e-calendar-table.c
+++ b/calendar/gui/e-calendar-table.c
@@ -725,10 +725,12 @@ delete_selected_components (ECalendarTable *cal_table)
for (l = objs; l; l = l->next) {
ECalModelComponent *comp_data = (ECalModelComponent *) l->data;
-
- delete_error_dialog (cal_client_remove_object (comp_data->client,
- icalcomponent_get_uid (comp_data->icalcomp)),
- CAL_COMPONENT_TODO);
+ GError *error = NULL;
+
+ cal_client_remove_object (comp_data->client,
+ icalcomponent_get_uid (comp_data->icalcomp), &error);
+ delete_error_dialog (error, CAL_COMPONENT_TODO);
+ g_clear_error (&error);
}
e_calendar_table_set_status_message (cal_table, NULL);
@@ -987,7 +989,7 @@ enum {
static EPopupMenu tasks_popup_menu [] = {
E_POPUP_ITEM (N_("_Open"), GTK_SIGNAL_FUNC (e_calendar_table_on_open_task), MASK_SINGLE),
E_POPUP_ITEM (N_("Open _Web Page"), GTK_SIGNAL_FUNC (open_url_cb), MASK_SINGLE | MASK_LACKS_URL),
- E_POPUP_ITEM (N_("_Save As..."), GTK_SIGNAL_FUNC (e_calendar_table_on_save_as), MASK_SINGLE),
+ E_POPUP_ITEM (N_("_Save as..."), GTK_SIGNAL_FUNC (e_calendar_table_on_save_as), MASK_SINGLE),
E_POPUP_ITEM (N_("_Print..."), GTK_SIGNAL_FUNC (e_calendar_table_on_print_task), MASK_SINGLE),
E_POPUP_SEPARATOR,
@@ -1011,36 +1013,6 @@ static EPopupMenu tasks_popup_menu [] = {
E_POPUP_TERMINATOR
};
-static void
-setup_popup_icons (EPopupMenu *context_menu)
-{
- gint i;
-
- for (i = 0; context_menu[i].name; i++) {
- GtkWidget *pixmap_widget = NULL;
-
- if (!strcmp (context_menu[i].name, _("_Copy")))
- pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_COPY, GTK_ICON_SIZE_MENU);
- else if (!strcmp (context_menu[i].name, _("C_ut")))
- pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_CUT, GTK_ICON_SIZE_MENU);
- else if (!strcmp (context_menu[i].name, _("_Delete")) ||
- !strcmp (context_menu[i].name, _("_Delete Selected Tasks")))
- pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_DELETE, GTK_ICON_SIZE_MENU);
- else if (!strcmp (context_menu[i].name, _("_Open")))
- pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_OPEN, GTK_ICON_SIZE_MENU);
- else if (!strcmp (context_menu[i].name, _("_Paste")))
- pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_PASTE, GTK_ICON_SIZE_MENU);
- else if (!strcmp (context_menu[i].name, _("_Print...")))
- pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_PRINT, GTK_ICON_SIZE_MENU);
- else if (!strcmp (context_menu[i].name, _("_Save As...")))
- pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_SAVE_AS, GTK_ICON_SIZE_MENU);
-
- if (pixmap_widget)
- gtk_widget_show (pixmap_widget);
- context_menu[i].pixmap_widget = pixmap_widget;
- }
-}
-
static gint
e_calendar_table_show_popup_menu (ETable *table,
GdkEvent *gdk_event,
@@ -1052,7 +1024,8 @@ e_calendar_table_show_popup_menu (ETable *table,
GtkMenu *gtk_menu;
icalproperty *prop;
ECalModelComponent *comp_data;
-
+ gboolean read_only = TRUE;
+
n_selected = e_table_selected_count (table);
if (n_selected <= 0)
return TRUE;
@@ -1071,13 +1044,13 @@ e_calendar_table_show_popup_menu (ETable *table,
} else
hide_mask = MASK_SINGLE;
- if (cal_client_is_read_only (comp_data->client))
+ cal_client_is_read_only (comp_data->client, &read_only, NULL);
+ if (!read_only)
disable_mask |= MASK_EDITABLE;
if (cal_client_get_static_capability (comp_data->client, CAL_STATIC_CAPABILITY_NO_TASK_ASSIGNMENT))
disable_mask |= MASK_ASSIGNABLE;
- setup_popup_icons (tasks_popup_menu);
gtk_menu = e_popup_menu_create (tasks_popup_menu, disable_mask,
hide_mask, cal_table);
@@ -1315,6 +1288,7 @@ selection_received (GtkWidget *invisible,
icalcomponent *icalcomp;
char *uid;
CalComponent *comp;
+ CalClient *client;
icalcomponent_kind kind;
g_return_if_fail (E_IS_CALENDAR_TABLE (cal_table));
@@ -1338,6 +1312,8 @@ selection_received (GtkWidget *invisible,
return;
}
+ client = e_cal_model_get_default_client (cal_table->model);
+
e_calendar_table_set_status_message (cal_table, _("Updating objects"));
if (kind == ICAL_VCALENDAR_COMPONENT) {
@@ -1360,11 +1336,12 @@ selection_received (GtkWidget *invisible,
cal_component_set_icalcomponent (
tmp_comp, icalcomponent_new_clone (subcomp));
cal_component_set_uid (tmp_comp, uid);
-
- cal_client_update_object (
- e_cal_model_get_default_client (cal_table->model),
- tmp_comp);
free (uid);
+
+ /* FIXME should we convert start/due/complete times? */
+ /* FIXME Error handling */
+ cal_client_create_object (client, cal_component_get_icalcomponent (tmp_comp), NULL, NULL);
+
g_object_unref (tmp_comp);
}
subcomp = icalcomponent_get_next_component (
@@ -1378,9 +1355,8 @@ selection_received (GtkWidget *invisible,
cal_component_set_uid (comp, (const char *) uid);
free (uid);
- cal_client_update_object (
- e_cal_model_get_default_client (cal_table->model),
- comp);
+ cal_client_create_object (client, cal_component_get_icalcomponent (comp), NULL, NULL);
+
g_object_unref (comp);
}
diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c
index 381dca2542..7e47d4f59a 100644
--- a/calendar/gui/e-calendar-view.c
+++ b/calendar/gui/e-calendar-view.c
@@ -45,7 +45,6 @@
#include "dialogs/recur-comp.h"
#include "print.h"
#include "goto.h"
-#include "ea-calendar.h"
/* Used for the status bar messages */
#define EVOLUTION_CALENDAR_PROGRESS_IMAGE "evolution-calendar-mini.png"
@@ -83,8 +82,6 @@ static GdkAtom clipboard_atom = GDK_NONE;
enum {
SELECTION_CHANGED,
TIMEZONE_CHANGED,
- EVENT_CHANGED,
- EVENT_ADDED,
LAST_SIGNAL
};
@@ -115,33 +112,10 @@ e_cal_view_class_init (ECalViewClass *klass)
cal_util_marshal_VOID__POINTER_POINTER,
G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_POINTER);
- e_cal_view_signals[EVENT_CHANGED] =
- g_signal_new ("event_changed",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
- G_STRUCT_OFFSET (ECalViewClass, event_changed),
- NULL, NULL,
- g_cclosure_marshal_VOID__POINTER,
- G_TYPE_NONE, 1,
- G_TYPE_POINTER);
-
- e_cal_view_signals[EVENT_ADDED] =
- g_signal_new ("event_added",
- G_TYPE_FROM_CLASS (object_class),
- G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
- G_STRUCT_OFFSET (ECalViewClass, event_added),
- NULL, NULL,
- g_cclosure_marshal_VOID__POINTER,
- G_TYPE_NONE, 1,
- G_TYPE_POINTER);
-
/* Method override */
object_class->destroy = e_cal_view_destroy;
klass->selection_changed = NULL;
- klass->event_changed = NULL;
- klass->event_added = NULL;
-
klass->get_selected_events = NULL;
klass->get_selected_time_range = NULL;
klass->set_selected_time_range = NULL;
@@ -151,9 +125,6 @@ e_cal_view_class_init (ECalViewClass *klass)
/* clipboard atom */
if (!clipboard_atom)
clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE);
-
- /* init the accessibility support for e_day_view */
- e_cal_view_a11y_init ();
}
static void
@@ -208,6 +179,45 @@ selection_clear_event (GtkWidget *invisible,
}
static void
+selection_received_add_event (ECalView *cal_view, CalClient *client, time_t selected_time_start,
+ icaltimezone *default_zone, icalcomponent *icalcomp)
+{
+ CalComponent *comp;
+ struct icaltimetype itime;
+ time_t tt_start, tt_end;
+ struct icaldurationtype ic_dur;
+ char *uid;
+
+ tt_start = icaltime_as_timet (icalcomponent_get_dtstart (icalcomp));
+ tt_end = icaltime_as_timet (icalcomponent_get_dtend (icalcomp));
+ ic_dur = icaldurationtype_from_int (tt_end - tt_start);
+ itime = icaltime_from_timet_with_zone (selected_time_start, FALSE, default_zone);
+
+ icalcomponent_set_dtstart (icalcomp, itime);
+ itime = icaltime_add (itime, ic_dur);
+ icalcomponent_set_dtend (icalcomp, itime);
+
+ /* FIXME The new uid stuff can go away once we actually set it in the backend */
+ uid = cal_component_gen_uid ();
+ comp = cal_component_new ();
+ cal_component_set_icalcomponent (
+ comp, icalcomponent_new_clone (icalcomp));
+ cal_component_set_uid (comp, uid);
+
+ /* FIXME Error handling */
+ cal_client_create_object (client, cal_component_get_icalcomponent (comp), NULL, NULL);
+ if (itip_organizer_is_user (comp, client) &&
+ send_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (cal_view)),
+ client, comp, TRUE)) {
+ itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp,
+ client, NULL);
+ }
+
+ free (uid);
+ g_object_unref (comp);
+}
+
+static void
selection_received (GtkWidget *invisible,
GtkSelectionData *selection_data,
guint time,
@@ -216,12 +226,7 @@ selection_received (GtkWidget *invisible,
char *comp_str, *default_tzid;
icalcomponent *icalcomp;
icalcomponent_kind kind;
- CalComponent *comp;
time_t selected_time_start, selected_time_end;
- struct icaltimetype itime;
- time_t tt_start, tt_end;
- struct icaldurationtype ic_dur;
- char *uid;
icaltimezone *default_zone;
CalClient *client;
@@ -239,20 +244,19 @@ selection_received (GtkWidget *invisible,
default_tzid = calendar_config_get_timezone ();
client = e_cal_model_get_default_client (cal_view->priv->model);
- cal_client_get_timezone (client, default_tzid, &default_zone);
+ /* FIXME Error checking */
+ cal_client_get_timezone (client, default_tzid, &default_zone, NULL);
/* check the type of the component */
+ /* FIXME An error dialog if we return? */
kind = icalcomponent_isa (icalcomp);
- if (kind != ICAL_VCALENDAR_COMPONENT &&
- kind != ICAL_VEVENT_COMPONENT &&
- kind != ICAL_VTODO_COMPONENT &&
- kind != ICAL_VJOURNAL_COMPONENT) {
+ if (kind != ICAL_VCALENDAR_COMPONENT && kind != ICAL_VEVENT_COMPONENT)
return;
- }
e_cal_view_set_status_message (cal_view, _("Updating objects"));
e_cal_view_get_selected_time_range (cal_view, &selected_time_start, &selected_time_end);
+ /* FIXME Timezone handling */
if (kind == ICAL_VCALENDAR_COMPONENT) {
icalcomponent_kind child_kind;
icalcomponent *subcomp;
@@ -260,69 +264,27 @@ selection_received (GtkWidget *invisible,
subcomp = icalcomponent_get_first_component (icalcomp, ICAL_ANY_COMPONENT);
while (subcomp) {
child_kind = icalcomponent_isa (subcomp);
- if (child_kind == ICAL_VEVENT_COMPONENT ||
- child_kind == ICAL_VTODO_COMPONENT ||
- child_kind == ICAL_VJOURNAL_COMPONENT) {
- tt_start = icaltime_as_timet (icalcomponent_get_dtstart (subcomp));
- tt_end = icaltime_as_timet (icalcomponent_get_dtend (subcomp));
- ic_dur = icaldurationtype_from_int (tt_end - tt_start);
- itime = icaltime_from_timet_with_zone (selected_time_start,
- FALSE, default_zone);
-
- icalcomponent_set_dtstart (subcomp, itime);
- itime = icaltime_add (itime, ic_dur);
- icalcomponent_set_dtend (subcomp, itime);
-
- uid = cal_component_gen_uid ();
- comp = cal_component_new ();
- cal_component_set_icalcomponent (
- comp, icalcomponent_new_clone (subcomp));
- cal_component_set_uid (comp, uid);
-
- cal_client_update_object (client, comp);
- if (itip_organizer_is_user (comp, client) &&
- send_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (cal_view)),
- client, comp, TRUE)) {
- itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp,
- client, NULL);
- }
-
- free (uid);
- g_object_unref (comp);
+ if (child_kind == ICAL_VEVENT_COMPONENT)
+ selection_received_add_event (cal_view, client, selected_time_start,
+ default_zone, subcomp);
+ else if (child_kind == ICAL_VTIMEZONE_COMPONENT) {
+ icaltimezone *zone;
+
+ zone = icaltimezone_new ();
+ icaltimezone_set_component (zone, subcomp);
+ cal_client_add_timezone (client, zone, NULL);
+
+ icaltimezone_free (zone, 1);
}
+
subcomp = icalcomponent_get_next_component (
icalcomp, ICAL_ANY_COMPONENT);
}
icalcomponent_free (icalcomp);
- }
- else {
- tt_start = icaltime_as_timet (icalcomponent_get_dtstart (icalcomp));
- tt_end = icaltime_as_timet (icalcomponent_get_dtend (icalcomp));
- ic_dur = icaldurationtype_from_int (tt_end - tt_start);
- itime = icaltime_from_timet_with_zone (selected_time_start, FALSE, default_zone);
-
- icalcomponent_set_dtstart (icalcomp, itime);
- itime = icaltime_add (itime, ic_dur);
- icalcomponent_set_dtend (icalcomp, itime);
-
- uid = cal_component_gen_uid ();
- comp = cal_component_new ();
- cal_component_set_icalcomponent (
- comp, icalcomponent_new_clone (icalcomp));
- cal_component_set_uid (comp, uid);
-
- cal_client_update_object (client, comp);
- if (itip_organizer_is_user (comp, client) &&
- send_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (cal_view)),
- client, comp, TRUE)) {
- itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp,
- client, NULL);
- }
-
- free (uid);
- g_object_unref (comp);
+ } else {
+ selection_received_add_event (cal_view, client, selected_time_start, default_zone, icalcomp);
}
e_cal_view_set_status_message (cal_view, NULL);
@@ -538,13 +500,9 @@ e_cal_view_update_query (ECalView *cal_view)
{
g_return_if_fail (E_IS_CAL_VIEW (cal_view));
- e_cal_view_set_status_message (cal_view, _("Searching"));
-
if (E_CAL_VIEW_CLASS (G_OBJECT_GET_CLASS (cal_view))->update_query) {
E_CAL_VIEW_CLASS (G_OBJECT_GET_CLASS (cal_view))->update_query (cal_view);
}
-
- e_cal_view_set_status_message (cal_view, NULL);
}
void
@@ -564,9 +522,9 @@ e_cal_view_cut_clipboard (ECalView *cal_view)
e_cal_view_copy_clipboard (cal_view);
for (l = selected; l != NULL; l = l->next) {
CalComponent *comp;
-
ECalViewEvent *event = (ECalViewEvent *) l->data;
-
+ GError *error = NULL;
+
if (!event)
continue;
@@ -580,8 +538,8 @@ e_cal_view_cut_clipboard (ECalView *cal_view)
event->comp_data->client, NULL);
cal_component_get_uid (comp, &uid);
- delete_error_dialog (cal_client_remove_object (event->comp_data->client, uid),
- CAL_COMPONENT_EVENT);
+ cal_client_remove_object (event->comp_data->client, uid, &error);
+ delete_error_dialog (error, CAL_COMPONENT_EVENT);
g_object_unref (comp);
}
@@ -657,7 +615,8 @@ delete_event (ECalView *cal_view, ECalViewEvent *event)
if (delete_component_dialog (comp, FALSE, 1, vtype, GTK_WIDGET (cal_view))) {
const char *uid;
-
+ GError *error = NULL;
+
if (itip_organizer_is_user (comp, event->comp_data->client)
&& cancel_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (cal_view)),
event->comp_data->client,
@@ -670,9 +629,10 @@ delete_event (ECalView *cal_view, ECalViewEvent *event)
g_object_unref (comp);
return;
}
-
- delete_error_dialog (
- cal_client_remove_object (event->comp_data->client, uid), CAL_COMPONENT_EVENT);
+
+ cal_client_remove_object (event->comp_data->client, uid, &error);
+ delete_error_dialog (error, CAL_COMPONENT_EVENT);
+ g_clear_error (&error);
}
g_object_unref (comp);
@@ -719,35 +679,20 @@ e_cal_view_delete_selected_occurrence (ECalView *cal_view)
{
ECalViewEvent *event;
GList *selected;
-
+ const char *uid;
+ GError *error = NULL;
+
selected = e_cal_view_get_selected_events (cal_view);
if (!selected)
return;
event = (ECalViewEvent *) selected->data;
- if (cal_util_component_is_instance (event->comp_data->icalcomp)) {
- const char *uid;
-
- uid = icalcomponent_get_uid (event->comp_data->icalcomp);
- delete_error_dialog (
- cal_client_remove_object_with_mod (event->comp_data->client, uid, CALOBJ_MOD_THIS),
- CAL_COMPONENT_EVENT);
- } else {
- CalComponent *comp;
-
- /* we must duplicate the CalComponent, or we won't know it has changed
- when we get the "update_event" signal */
- comp = cal_component_new ();
- cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
- cal_comp_util_add_exdate (comp, event->start, cal_view->priv->zone);
-
- if (cal_client_update_object (event->comp_data->client, comp)
- != CAL_CLIENT_RESULT_SUCCESS)
- g_message ("e_cal_view_delete_selected_occurrence(): Could not update the object!");
+ uid = icalcomponent_get_uid (event->comp_data->icalcomp);
+ cal_client_remove_object_with_mod (event->comp_data->client, uid, CALOBJ_MOD_THIS, &error);
- g_object_unref (comp);
- }
+ delete_error_dialog (error, CAL_COMPONENT_EVENT);
+ g_clear_error (&error);
/* free memory */
g_list_free (selected);
@@ -962,7 +907,7 @@ on_publish (GtkWidget *widget, gpointer user_data)
ECalView *cal_view;
icaltimezone *utc;
time_t start = time (NULL), end;
- GList *comp_list, *client_list, *cl;
+ GList *comp_list = NULL, *client_list, *cl;
cal_view = E_CAL_VIEW (user_data);
@@ -972,8 +917,7 @@ on_publish (GtkWidget *widget, gpointer user_data)
client_list = e_cal_model_get_client_list (cal_view->priv->model);
for (cl = client_list; cl != NULL; cl = cl->next) {
- comp_list = cal_client_get_free_busy ((CalClient *) cl->data, NULL, start, end);
- if (comp_list) {
+ if (cal_client_get_free_busy ((CalClient *) cl->data, NULL, start, end, &comp_list, NULL)) {
GList *l;
for (l = comp_list; l; l = l->next) {
@@ -1041,14 +985,6 @@ on_paste (GtkWidget *widget, gpointer user_data)
e_cal_view_paste_clipboard (cal_view);
}
-static void
-on_unrecur_appointment (GtkWidget *widget, gpointer user_data)
-{
- ECalView *cal_view = E_CAL_VIEW (user_data);
-
- gnome_calendar_unrecur_selection (cal_view->priv->calendar);
-}
-
enum {
/*
* This is used to "flag" events that can not be editted
@@ -1142,7 +1078,6 @@ static EPopupMenu child_items [] = {
E_POPUP_SEPARATOR,
E_POPUP_ITEM (N_("_Delete"), GTK_SIGNAL_FUNC (on_delete_appointment), MASK_EDITABLE | MASK_SINGLE | MASK_EDITING),
- E_POPUP_ITEM (N_("Make this Occurrence _Movable"), GTK_SIGNAL_FUNC (on_unrecur_appointment), MASK_RECURRING | MASK_EDITING | MASK_EDITABLE | MASK_INSTANCE),
E_POPUP_ITEM (N_("Delete this _Occurrence"), GTK_SIGNAL_FUNC (on_delete_occurrence), MASK_RECURRING | MASK_EDITING | MASK_EDITABLE),
E_POPUP_ITEM (N_("Delete _All Occurrences"), GTK_SIGNAL_FUNC (on_delete_appointment), MASK_RECURRING | MASK_EDITING | MASK_EDITABLE),
@@ -1169,36 +1104,8 @@ setup_popup_icons (EPopupMenu *context_menu)
for (i = 0; context_menu[i].name; i++) {
GtkWidget *pixmap_widget = NULL;
- if (!strcmp (context_menu[i].name, _("_Copy")))
- pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_COPY, GTK_ICON_SIZE_MENU);
- else if (!strcmp (context_menu[i].name, _("C_ut")))
- pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_CUT, GTK_ICON_SIZE_MENU);
- else if (!strcmp (context_menu[i].name, _("_Delete")) ||
- !strcmp (context_menu[i].name, _("Delete this _Occurrence")) ||
- !strcmp (context_menu[i].name, _("Delete _All Occurrences")))
- pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_DELETE, GTK_ICON_SIZE_MENU);
- else if (!strcmp (context_menu[i].name, _("Go to _Today")))
- pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_HOME, GTK_ICON_SIZE_MENU);
- else if (!strcmp (context_menu[i].name, _("_Go to Date...")))
- pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_JUMP_TO, GTK_ICON_SIZE_MENU);
- else if (!strcmp (context_menu[i].name, _("New _Appointment...")))
- pixmap_widget = gtk_image_new_from_file (EVOLUTION_IMAGESDIR "/new_appointment.xpm");
- else if (!strcmp (context_menu[i].name, _("New All Day _Event")))
- pixmap_widget = gtk_image_new_from_file (EVOLUTION_IMAGESDIR "/new_all_day_event.png");
- else if (!strcmp (context_menu[i].name, _("New Meeting")))
- pixmap_widget = gtk_image_new_from_file (EVOLUTION_IMAGESDIR "/meeting-request-16.png");
- else if (!strcmp (context_menu[i].name, _("New Task")))
- pixmap_widget = gtk_image_new_from_file (EVOLUTION_IMAGESDIR "/new_task-16.png");
- else if (!strcmp (context_menu[i].name, _("_Open")))
- pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_OPEN, GTK_ICON_SIZE_MENU);
- else if (!strcmp (context_menu[i].name, _("_Paste")))
- pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_PASTE, GTK_ICON_SIZE_MENU);
- else if (!strcmp (context_menu[i].name, _("_Print...")))
+ if (!strcmp (context_menu[i].name, _("_Print...")))
pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_PRINT, GTK_ICON_SIZE_MENU);
- else if (!strcmp (context_menu[i].name, _("_Save As...")))
- pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_SAVE_AS, GTK_ICON_SIZE_MENU);
- else if (!strcmp (context_menu[i].name, _("_Settings...")))
- pixmap_widget = gtk_image_new_from_stock (GTK_STOCK_PREFERENCES, GTK_ICON_SIZE_MENU);
if (pixmap_widget)
gtk_widget_show (pixmap_widget);
@@ -1215,7 +1122,8 @@ e_cal_view_create_popup_menu (ECalView *cal_view)
guint32 disable_mask = 0, hide_mask = 0;
GtkMenu *popup;
CalClient *client = NULL;
-
+ gboolean read_only = TRUE;
+
g_return_val_if_fail (E_IS_CAL_VIEW (cal_view), NULL);
/* get the selection */
@@ -1260,7 +1168,8 @@ e_cal_view_create_popup_menu (ECalView *cal_view)
client = event->comp_data->client;
}
- if (cal_client_is_read_only (client))
+ cal_client_is_read_only (client, &read_only, NULL);
+ if (!read_only)
disable_mask |= MASK_EDITABLE;
if (being_edited)
diff --git a/calendar/gui/e-calendar-view.h b/calendar/gui/e-calendar-view.h
index ea7c11a00d..6fac862ded 100644
--- a/calendar/gui/e-calendar-view.h
+++ b/calendar/gui/e-calendar-view.h
@@ -77,8 +77,6 @@ struct _ECalViewClass {
/* Notification signals */
void (* selection_changed) (ECalView *cal_view);
void (* timezone_changed) (ECalView *cal_view, icaltimezone *old_zone, icaltimezone *new_zone);
- void (* event_changed) (ECalView *day_view, ECalViewEvent *event);
- void (* event_added) (ECalView *day_view, ECalViewEvent *event);
/* Virtual methods */
GList * (* get_selected_events) (ECalView *cal_view); /* a GList of ECalViewEvent's */
diff --git a/calendar/gui/e-date-time-list.c b/calendar/gui/e-date-time-list.c
index 5aef6f9c51..83b4632adf 100644
--- a/calendar/gui/e-date-time-list.c
+++ b/calendar/gui/e-date-time-list.c
@@ -222,10 +222,6 @@ row_updated (EDateTimeList *date_time_list, gint n)
static void
e_date_time_list_finalize (GObject *object)
{
- EDateTimeList *date_time_list = E_DATE_TIME_LIST (object);
-
- if (G_OBJECT_CLASS (parent_class)->finalize)
- (* G_OBJECT_CLASS (parent_class)->finalize) (object);
}
/* Fulfill the GtkTreeModel requirements */
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index a2a4f09d56..01a6e890eb 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -29,7 +29,6 @@
#include <config.h>
#include "e-day-view.h"
-#include "ea-calendar.h"
#include <math.h>
#include <time.h>
@@ -164,8 +163,6 @@ static gboolean e_day_view_get_visible_time_range (ECalView *cal_view, time_t *s
static void e_day_view_update_query (ECalView *cal_view);
static void e_day_view_goto_start_of_work_day (EDayView *day_view);
static void e_day_view_goto_end_of_work_day (EDayView *day_view);
-static void e_day_view_change_duration_to_start_of_work_day (EDayView *day_view);
-static void e_day_view_change_duration_to_end_of_work_day (EDayView *day_view);
static void e_day_view_cursor_key_up_shifted (EDayView *day_view,
GdkEventKey *event);
static void e_day_view_cursor_key_down_shifted (EDayView *day_view,
@@ -291,6 +288,10 @@ static ECalViewPosition e_day_view_convert_position_in_main_canvas (EDayView *da
gint *day_return,
gint *row_return,
gint *event_num_return);
+static gboolean e_day_view_find_event_from_item (EDayView *day_view,
+ GnomeCanvasItem *item,
+ gint *day_return,
+ gint *event_num_return);
static gboolean e_day_view_find_event_from_uid (EDayView *day_view,
const gchar *uid,
gint *day_return,
@@ -344,8 +345,6 @@ static void e_day_view_stop_editing_event (EDayView *day_view);
static gboolean e_day_view_on_text_item_event (GnomeCanvasItem *item,
GdkEvent *event,
EDayView *day_view);
-static void e_day_view_change_event_end_time_up (EDayView *day_view);
-static void e_day_view_change_event_end_time_down (EDayView *day_view);
static void e_day_view_on_editing_started (EDayView *day_view,
GnomeCanvasItem *item);
static void e_day_view_on_editing_stopped (EDayView *day_view,
@@ -443,6 +442,7 @@ static void e_day_view_queue_layout (EDayView *day_view);
static void e_day_view_cancel_layout (EDayView *day_view);
static gboolean e_day_view_layout_timeout_cb (gpointer data);
+
static GtkTableClass *parent_class;
E_MAKE_TYPE (e_day_view, "EDayView", EDayView, e_day_view_class_init,
@@ -478,9 +478,6 @@ e_day_view_class_init (EDayViewClass *class)
view_class->set_selected_time_range = e_day_view_set_selected_time_range;
view_class->get_visible_time_range = e_day_view_get_visible_time_range;
view_class->update_query = e_day_view_update_query;
-
- /* init the accessibility support for e_day_view */
- e_day_view_a11y_init ();
}
static void
@@ -571,7 +568,6 @@ e_day_view_init (EDayView *day_view)
day_view->editing_event_day = -1;
day_view->editing_event_num = -1;
- day_view->resize_event_num = -1;
day_view->resize_bars_event_day = -1;
day_view->resize_bars_event_num = -1;
@@ -1483,10 +1479,6 @@ e_day_view_update_event_cb (EDayView *day_view,
e_day_view_update_event_label (day_view, day, event_num);
e_day_view_reshape_day_event (day_view, day, event_num);
}
-
- g_signal_emit_by_name (G_OBJECT(day_view),
- "event_changed", event);
-
return TRUE;
}
@@ -1740,7 +1732,7 @@ e_day_view_update_long_event_label (EDayView *day_view,
/* Finds the day and index of the event with the given canvas item.
If is is a long event, -1 is returned as the day.
Returns TRUE if the event was found. */
-gboolean
+static gboolean
e_day_view_find_event_from_item (EDayView *day_view,
GnomeCanvasItem *item,
gint *day_return,
@@ -3188,6 +3180,7 @@ process_component (EDayView *day_view, ECalModelComponent *comp_data)
const char *uid;
CalComponent *comp;
AddEventData add_event_data;
+ CalComponentDateTime dt_start, dt_end;
/* If our time hasn't been set yet, just return. */
if (day_view->lower == 0 && day_view->upper == 0)
@@ -3228,17 +3221,27 @@ process_component (EDayView *day_view, ECalModelComponent *comp_data)
NULL);
}
- /* Add the occurrences of the event. */
+ /* Add the event if it's on the time range */
comp = cal_component_new ();
cal_component_set_icalcomponent (comp, icalcomponent_new_clone (comp_data->icalcomp));
- add_event_data.day_view = day_view;
- add_event_data.comp_data = comp_data;
- cal_recur_generate_instances (comp, day_view->lower,
- day_view->upper,
- e_day_view_add_event, &add_event_data,
- cal_client_resolve_tzid_cb,
- comp_data->client,
- e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
+ cal_component_get_dtstart (comp, &dt_start);
+ cal_component_get_dtend (comp, &dt_end);
+
+ if (dt_start.value && dt_end.value) {
+ time_t tt_start, tt_end;
+
+ tt_start = icaltime_as_timet (*dt_start.value);
+ tt_end = icaltime_as_timet (*dt_end.value);
+
+ if ((tt_start >= day_view->lower && tt_start <= day_view->upper)
+ || (tt_end >= day_view->lower && tt_end <= day_view->upper)
+ || (tt_start <= day_view->lower && tt_end >= day_view->upper)) {
+ add_event_data.day_view = day_view;
+ add_event_data.comp_data = comp_data;
+ e_day_view_add_event (comp, tt_start, tt_end, &add_event_data);
+ }
+ }
+
g_object_unref (comp);
e_day_view_queue_layout (day_view);
@@ -3282,67 +3285,6 @@ e_day_view_on_event_right_click (EDayView *day_view,
day, event_num);
}
-void
-e_day_view_unrecur_appointment (EDayView *day_view)
-{
- EDayViewEvent *event;
- CalComponent *comp, *new_comp;
- CalComponentDateTime date;
- struct icaltimetype itt;
-
- event = e_day_view_get_popup_menu_event (day_view);
- if (event == NULL)
- return;
-
- date.value = &itt;
- date.tzid = NULL;
-
- /* For the recurring object, we add an exception to get rid of the
- instance. */
-
- comp = cal_component_new ();
- cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
- cal_comp_util_add_exdate (comp, event->start, e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
-
- /* For the unrecurred instance we duplicate the original object,
- create a new uid for it, get rid of the recurrence rules, and set
- the start & end times to the instances times. */
- new_comp = cal_component_new ();
- cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
- cal_component_set_uid (new_comp, cal_component_gen_uid ());
- cal_component_set_rdate_list (new_comp, NULL);
- cal_component_set_rrule_list (new_comp, NULL);
- cal_component_set_exdate_list (new_comp, NULL);
- cal_component_set_exrule_list (new_comp, NULL);
-
- date.value = &itt;
- date.tzid = icaltimezone_get_tzid (e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
-
- *date.value = icaltime_from_timet_with_zone (event->start, FALSE,
- e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
- cal_component_set_dtstart (new_comp, &date);
- *date.value = icaltime_from_timet_with_zone (event->end, FALSE,
- e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
- cal_component_set_dtend (new_comp, &date);
-
-
- /* Now update both CalComponents. Note that we do this last since at
- * present the updates happen synchronously so our event may disappear.
- */
- if (cal_client_update_object (event->comp_data->client, comp)
- != CAL_CLIENT_RESULT_SUCCESS)
- g_message ("e_day_view_on_unrecur_appointment(): Could not update the object!");
-
- g_object_unref (comp);
-
- if (cal_client_update_object (event->comp_data->client, new_comp)
- != CAL_CLIENT_RESULT_SUCCESS)
- g_message ("e_day_view_on_unrecur_appointment(): Could not update the object!");
-
- g_object_unref (new_comp);
-}
-
-
static EDayViewEvent*
e_day_view_get_popup_menu_event (EDayView *day_view)
{
@@ -3841,7 +3783,9 @@ e_day_view_finish_long_event_resize (EDayView *day_view)
struct icaltimetype itt;
time_t dt;
CalClient *client;
-
+ CalObjModType mod = CALOBJ_MOD_ALL;
+ GtkWindow *toplevel;
+
event_num = day_view->resize_event_num;
event = &g_array_index (day_view->long_events, EDayViewEvent,
event_num);
@@ -3870,31 +3814,26 @@ e_day_view_finish_long_event_resize (EDayView *day_view)
e_cal_view_get_timezone (E_CAL_VIEW (day_view)));
cal_component_set_dtend (comp, &date);
}
-
- if (cal_component_is_instance (comp)) {
- CalObjModType mod;
-
- if (recur_component_dialog (comp, &mod, NULL)) {
- if (cal_client_update_object_with_mod (client, comp, mod) == CAL_CLIENT_RESULT_SUCCESS) {
- if (itip_organizer_is_user (comp, client) &&
- send_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (day_view)),
- client, comp, FALSE))
- itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, client, NULL);
- } else {
- g_message ("e_day_view_finish_resize(): Could not update the object!");
- }
- } else {
+
+ if (cal_component_has_recurrences (comp)) {
+ if (!recur_component_dialog (comp, &mod, NULL)) {
gtk_widget_queue_draw (day_view->top_canvas);
- }
- } else if (cal_client_update_object (client, comp) == CAL_CLIENT_RESULT_SUCCESS) {
- if (itip_organizer_is_user (comp, client) &&
- send_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (day_view)),
- client, comp, TRUE))
- itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, client, NULL);
- } else {
- g_message ("e_day_view_finish_long_event_resize(): Could not update the object!");
- }
-
+ goto out;
+ }
+ }
+
+ toplevel = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (day_view)));
+
+ if (cal_client_modify_object (client, cal_component_get_icalcomponent (comp), mod, NULL)) {
+ if (itip_organizer_is_user (comp, client) &&
+ send_component_dialog (toplevel, client, comp, TRUE)) {
+ itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, client, NULL);
+ } else {
+ g_message (G_STRLOC ": Could not update the object!");
+ }
+ }
+
+ out:
gnome_canvas_item_hide (day_view->resize_long_event_rect_item);
day_view->resize_drag_pos = E_CAL_VIEW_POS_NONE;
@@ -3915,6 +3854,8 @@ e_day_view_finish_resize (EDayView *day_view)
struct icaltimetype itt;
time_t dt;
CalClient *client;
+ CalObjModType mod = CALOBJ_MOD_ALL;
+ GtkWindow *toplevel;
day = day_view->resize_event_day;
event_num = day_view->resize_event_num;
@@ -3957,29 +3898,25 @@ e_day_view_finish_resize (EDayView *day_view)
day_view->resize_drag_pos = E_CAL_VIEW_POS_NONE;
- if (cal_component_is_instance (comp)) {
- CalObjModType mod;
-
- if (recur_component_dialog (comp, &mod, NULL)) {
- if (cal_client_update_object_with_mod (client, comp, mod) == CAL_CLIENT_RESULT_SUCCESS) {
- if (itip_organizer_is_user (comp, client) &&
- send_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (day_view)),
- client, comp, FALSE))
- itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, client, NULL);
- } else {
- g_message ("e_day_view_finish_resize(): Could not update the object!");
- }
- } else {
- gtk_widget_queue_draw (day_view->main_canvas);
- }
- } else if (cal_client_update_object (client, comp) == CAL_CLIENT_RESULT_SUCCESS) {
- if (itip_organizer_is_user (comp, client) &&
- send_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (day_view)), client, comp, FALSE))
- itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, client, NULL);
- } else {
- g_message ("e_day_view_finish_resize(): Could not update the object!");
+ if (cal_component_has_recurrences (comp)) {
+ if (!recur_component_dialog (comp, &mod, NULL)) {
+ gtk_widget_queue_draw (day_view->top_canvas);
+ goto out;
+ }
}
+ toplevel = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (day_view)));
+
+ if (cal_client_modify_object (client, cal_component_get_icalcomponent (comp), mod, NULL)) {
+ if (itip_organizer_is_user (comp, client) &&
+ send_component_dialog (toplevel, client, comp, TRUE)) {
+ itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, client, NULL);
+ } else {
+ g_message (G_STRLOC ": Could not update the object!");
+ }
+ }
+
+ out:
g_object_unref (comp);
}
@@ -4343,9 +4280,6 @@ e_day_view_reshape_long_event (EDayView *day_view,
NULL);
g_signal_connect (event->canvas_item, "event",
G_CALLBACK (e_day_view_on_text_item_event), day_view);
- g_signal_emit_by_name (G_OBJECT(day_view),
- "event_added", event);
-
e_day_view_update_long_event_label (day_view, event_num);
}
@@ -4418,12 +4352,6 @@ e_day_view_reshape_day_events (EDayView *day_view,
for (event_num = 0; event_num < day_view->events[day]->len;
event_num++) {
e_day_view_reshape_day_event (day_view, day, event_num);
- if (event_num == day_view->resize_event_num) {
- EDayViewEvent *event;
- event = &g_array_index (day_view->events[day], EDayViewEvent,
- event_num);
- e_canvas_item_grab_focus (event->canvas_item, TRUE);
- }
}
}
@@ -4512,9 +4440,6 @@ e_day_view_reshape_day_event (EDayView *day_view,
NULL);
g_signal_connect (event->canvas_item, "event",
G_CALLBACK (e_day_view_on_text_item_event), day_view);
- g_signal_emit_by_name (G_OBJECT(day_view),
- "event_added", event);
-
e_day_view_update_event_label (day_view, day, event_num);
}
@@ -4682,23 +4607,6 @@ e_day_view_do_key_press (GtkWidget *widget, GdkEventKey *event)
return TRUE;
}
- /* In DayView, Shift+Home/End, Change the duration to the time that begins/ends the current work day */
- if ((keyval == GDK_Home)
- &&((event->state & GDK_SHIFT_MASK) == GDK_SHIFT_MASK)
- &&((event->state & GDK_CONTROL_MASK) != GDK_CONTROL_MASK)
- &&((event->state & GDK_MOD1_MASK) != GDK_MOD1_MASK)) {
- e_day_view_change_duration_to_start_of_work_day (day_view);
- return TRUE;
- }
- if ((keyval == GDK_End)
- &&((event->state & GDK_SHIFT_MASK) == GDK_SHIFT_MASK)
- &&((event->state & GDK_CONTROL_MASK) != GDK_CONTROL_MASK)
- &&((event->state & GDK_MOD1_MASK) != GDK_MOD1_MASK)) {
- e_day_view_change_duration_to_end_of_work_day (day_view);
- return TRUE;
- }
-
-
/* Handle the cursor keys for moving & extending the selection. */
stop_emission = TRUE;
if (event->state & GDK_SHIFT_MASK) {
@@ -4888,80 +4796,6 @@ e_day_view_goto_end_of_work_day (EDayView *day_view)
gtk_widget_queue_draw (day_view->main_canvas);
}
-/* Change the duration to the time that begins the current work day */
-static void
-e_day_view_change_duration_to_start_of_work_day (EDayView *day_view)
-{
- g_return_if_fail(day_view != NULL);
-
- if (day_view->selection_in_top_canvas)
- return;
- else {
- gint work_start_row,work_end_row,selection_start_row,selection_end_row;
-
- work_start_row =
- e_day_view_convert_time_to_row (day_view,
- day_view->work_day_start_hour,
- day_view->work_day_start_minute);
- work_end_row =
- e_day_view_convert_time_to_row (day_view,
- day_view->work_day_end_hour - 1,
- day_view->work_day_end_minute + 30);
- selection_start_row = day_view->selection_start_row;
- selection_end_row = day_view->selection_end_row;
- if (selection_start_row < work_start_row)
- day_view->selection_end_row = work_start_row - 1;
- else day_view->selection_start_row = work_start_row;
- }
-
- e_day_view_ensure_rows_visible (day_view,
- day_view->selection_start_row,
- day_view->selection_end_row);
-
- e_day_view_update_calendar_selection_time (day_view);
-
- gtk_widget_queue_draw (day_view->top_canvas);
- gtk_widget_queue_draw (day_view->main_canvas);
-}
-
-/* Change the duration to the time that ends the current work day */
-static void
-e_day_view_change_duration_to_end_of_work_day (EDayView *day_view)
-{
- g_return_if_fail(day_view != NULL);
-
- if (day_view->selection_in_top_canvas)
- return;
- else {
- gint work_start_row,work_end_row,selection_start_row,selection_end_row;
- work_start_row =
- e_day_view_convert_time_to_row (day_view,
- day_view->work_day_start_hour,
- day_view->work_day_start_minute);
- work_end_row = e_day_view_convert_time_to_row (day_view,
- day_view->work_day_end_hour-1,
- day_view->work_day_end_minute+30);
- selection_start_row = day_view->selection_start_row;
- selection_end_row = day_view->selection_end_row;
- if (selection_start_row <= work_end_row)
- day_view->selection_end_row = work_end_row;
- else {
- day_view->selection_start_row = work_end_row + 1;
- day_view->selection_end_row = selection_start_row;
- }
- }
-
- e_day_view_ensure_rows_visible (day_view,
- day_view->selection_start_row,
- day_view->selection_end_row);
-
- e_day_view_update_calendar_selection_time (day_view);
-
- gtk_widget_queue_draw (day_view->top_canvas);
- gtk_widget_queue_draw (day_view->main_canvas);
-}
-
-
static void
e_day_view_cursor_key_up_shifted (EDayView *day_view, GdkEventKey *event)
{
@@ -5015,10 +4849,9 @@ e_day_view_focus (GtkWidget *widget, GtkDirectionType direction)
}
if (new_day != E_DAY_VIEW_LONG_EVENT && new_day != -1) {
- if (e_day_view_get_event_rows (day_view, new_day,
- new_event_num,
+ if (e_day_view_get_event_rows (day_view, new_day, new_event_num,
&start_row, &end_row))
- /* ensure the event to be seen */
+ /* ajust the scrollbar to ensure the event to be seen */
e_day_view_ensure_rows_visible (day_view,
start_row, end_row);
}
@@ -5607,8 +5440,6 @@ e_day_view_on_text_item_event (GnomeCanvasItem *item,
switch (event->type) {
case GDK_KEY_PRESS:
if (event && event->key.keyval == GDK_Return) {
- day_view->resize_event_num = -1;
-
/* We set the keyboard focus to the EDayView, so the
EText item loses it and stops the edit. */
gtk_widget_grab_focus (GTK_WIDGET (day_view));
@@ -5624,18 +5455,6 @@ e_day_view_on_text_item_event (GnomeCanvasItem *item,
/* focus should go to day view when stop editing */
gtk_widget_grab_focus (GTK_WIDGET (day_view));
return TRUE;
- } else if ((event->key.keyval == GDK_Up)
- && (event->key.state & GDK_SHIFT_MASK)
- && (event->key.state & GDK_CONTROL_MASK)
- && (event->key.state & GDK_MOD1_MASK)) {
- e_day_view_change_event_end_time_up (day_view);
- return TRUE;
- } else if ((event->key.keyval == GDK_Down)
- && (event->key.state & GDK_SHIFT_MASK)
- && (event->key.state & GDK_CONTROL_MASK)
- && (event->key.state & GDK_MOD1_MASK)) {
- e_day_view_change_event_end_time_down (day_view);
- return TRUE;
}
break;
case GDK_2BUTTON_PRESS:
@@ -5665,67 +5484,6 @@ e_day_view_on_text_item_event (GnomeCanvasItem *item,
return FALSE;
}
-static void
-e_day_view_change_event_end_time_up (EDayView *day_view)
-{
- EDayViewEvent *event;
- gint day, event_num, resize_start_row, resize_end_row;
-
- day = day_view->editing_event_day;
- event_num = day_view->editing_event_num;
- if ((day == -1) || (day == E_DAY_VIEW_LONG_EVENT))
- return;
- event = &g_array_index (day_view->events[day], EDayViewEvent,
- event_num);
- day_view->resize_event_day = day;
- day_view->resize_event_num = event_num;
- day_view->resize_bars_event_day = day;
- day_view->resize_bars_event_num = event_num;
- resize_start_row = event->start_minute / day_view->mins_per_row;
- resize_end_row = (event->end_minute - 1) / day_view->mins_per_row;
- if (resize_end_row < resize_start_row)
- resize_end_row = resize_start_row;
- if (resize_end_row == resize_start_row)
- return;
- day_view->resize_drag_pos = E_CAL_VIEW_POS_BOTTOM_EDGE;
- resize_end_row--;
- day_view->resize_start_row = resize_start_row;
- day_view->resize_end_row = resize_end_row;
- e_day_view_finish_resize (day_view);
- e_day_view_ensure_rows_visible (day_view, resize_start_row, resize_end_row);
-}
-
-
-static void
-e_day_view_change_event_end_time_down (EDayView *day_view)
-{
- EDayViewEvent *event;
- gint day, event_num, resize_start_row, resize_end_row;
-
- day = day_view->editing_event_day;
- event_num = day_view->editing_event_num;
- if ((day == -1) || (day == E_DAY_VIEW_LONG_EVENT))
- return;
- event = &g_array_index (day_view->events[day], EDayViewEvent,
- event_num);
- day_view->resize_event_day = day;
- day_view->resize_event_num = event_num;
- day_view->resize_bars_event_day = day;
- day_view->resize_bars_event_num = event_num;
- resize_start_row = event->start_minute / day_view->mins_per_row;
- resize_end_row = (event->end_minute - 1) / day_view->mins_per_row;
- if (resize_end_row < resize_start_row)
- resize_end_row = resize_start_row;
- if (resize_end_row == day_view->rows -1)
- return;
- day_view->resize_drag_pos = E_CAL_VIEW_POS_BOTTOM_EDGE;
- resize_end_row++;
- day_view->resize_start_row = resize_start_row;
- day_view->resize_end_row = resize_end_row;
- e_day_view_finish_resize (day_view);
- e_day_view_ensure_rows_visible (day_view, resize_start_row, resize_end_row);
-}
-
static void
e_day_view_on_editing_started (EDayView *day_view,
@@ -5777,7 +5535,8 @@ e_day_view_on_editing_stopped (EDayView *day_view,
gchar *text = NULL;
CalComponentText summary;
CalComponent *comp;
-
+ gboolean on_server;
+
/* Note: the item we are passed here isn't reliable, so we just stop
the edit of whatever item was being edited. We also receive this
event twice for some reason. */
@@ -5822,8 +5581,9 @@ e_day_view_on_editing_stopped (EDayView *day_view,
comp = cal_component_new ();
cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
- if (string_is_empty (text) &&
- !cal_comp_is_on_server (comp, event->comp_data->client)) {
+ on_server = cal_comp_is_on_server (comp, event->comp_data->client);
+
+ if (string_is_empty (text) && !on_server) {
const char *uid;
cal_component_get_uid (comp, &uid);
@@ -5845,34 +5605,35 @@ e_day_view_on_editing_stopped (EDayView *day_view,
e_day_view_update_event_label (day_view, day,
event_num);
} else if (summary.value || !string_is_empty (text)) {
+ icalcomponent *icalcomp = cal_component_get_icalcomponent (comp);
+
summary.value = text;
summary.altrep = NULL;
cal_component_set_summary (comp, &summary);
- if (cal_component_is_instance (comp)) {
- CalObjModType mod;
+ if (!on_server) {
+ if (!cal_client_create_object (event->comp_data->client, icalcomp, NULL, NULL))
+ g_message (G_STRLOC ": Could not create the object!");
+ } else {
+ CalObjModType mod = CALOBJ_MOD_ALL;
+ GtkWindow *toplevel;
- if (recur_component_dialog (comp, &mod, NULL)) {
- if (cal_client_update_object_with_mod (event->comp_data->client, comp, mod)
- == CAL_CLIENT_RESULT_SUCCESS) {
- if (itip_organizer_is_user (comp, event->comp_data->client)
- && send_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (day_view)),
- event->comp_data->client, comp, FALSE))
- itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp,
- event->comp_data->client, NULL);
- } else {
- g_message ("e_day_view_on_editing_stopped(): Could not update the object!");
+ if (cal_component_has_recurrences (comp)) {
+ if (!recur_component_dialog (comp, &mod, NULL)) {
+ goto out;
}
}
- } else if (cal_client_update_object (event->comp_data->client, comp) == CAL_CLIENT_RESULT_SUCCESS) {
- if (itip_organizer_is_user (comp, event->comp_data->client) &&
- send_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (day_view)),
- event->comp_data->client, comp, FALSE))
- itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp,
- event->comp_data->client, NULL);
- } else {
- g_message ("e_day_view_on_editing_stopped(): Could not update the object!");
+
+ /* FIXME When sending here, what exactly should we send? */
+ toplevel = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (day_view)));
+ if (cal_client_modify_object (event->comp_data->client, icalcomp, mod, NULL)) {
+ if (itip_organizer_is_user (comp, event->comp_data->client)
+ && send_component_dialog (toplevel, event->comp_data->client, comp, FALSE))
+ itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp,
+ event->comp_data->client, NULL);
+ }
}
+
}
out:
@@ -6881,7 +6642,10 @@ e_day_view_on_top_canvas_drag_data_received (GtkWidget *widget,
x, y, &day,
NULL);
if (pos != E_CAL_VIEW_POS_OUTSIDE) {
+ CalObjModType mod = CALOBJ_MOD_ALL;
+ GtkWindow *toplevel;
const char *uid;
+
num_days = 1;
start_offset = 0;
end_offset = 0;
@@ -6972,33 +6736,20 @@ e_day_view_on_top_canvas_drag_data_received (GtkWidget *widget,
if (event->canvas_item)
gnome_canvas_item_show (event->canvas_item);
- if (cal_component_is_instance (comp)) {
- CalObjModType mod;
-
- if (recur_component_dialog (comp, &mod, NULL)) {
- if (cal_client_update_object_with_mod (client, comp, mod) == CAL_CLIENT_RESULT_SUCCESS) {
- if (itip_organizer_is_user (comp, client)
- && send_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (day_view)),
- client, comp, FALSE))
- itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp,
- client, NULL);
- } else {
- g_message ("e_day_view_on_top_canvas_drag_data_received(): Could "
- "not update the object!");
- }
- }
- } else if (cal_client_update_object (client, comp)
- == CAL_CLIENT_RESULT_SUCCESS) {
- if (itip_organizer_is_user (comp, client) &&
- send_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (day_view)),
- client, comp, FALSE))
- itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp,
- client, NULL);
- } else {
- g_message ("e_day_view_on_top_canvas_drag_data_received(): Could "
- "not update the object!");
+ if (cal_component_has_recurrences (comp)) {
+ if (!recur_component_dialog (comp, &mod, NULL))
+ return;
}
+ toplevel = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (day_view)));
+
+ if (cal_client_modify_object (client, cal_component_get_icalcomponent (comp), mod, NULL)) {
+ if (itip_organizer_is_user (comp, client)
+ && send_component_dialog (toplevel, client, comp, FALSE))
+ itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp,
+ client, NULL);
+ }
+
g_object_unref (comp);
return;
@@ -7044,7 +6795,10 @@ e_day_view_on_main_canvas_drag_data_received (GtkWidget *widget,
x, y, &day,
&row, NULL);
if (pos != E_CAL_VIEW_POS_OUTSIDE) {
+ CalObjModType mod = CALOBJ_MOD_ALL;
+ GtkWindow *toplevel;
const char *uid;
+
num_rows = 1;
start_offset = 0;
end_offset = 0;
@@ -7109,30 +6863,20 @@ e_day_view_on_main_canvas_drag_data_received (GtkWidget *widget,
if (event->canvas_item)
gnome_canvas_item_show (event->canvas_item);
- if (cal_component_is_instance (comp)) {
- CalObjModType mod;
-
- if (recur_component_dialog (comp, &mod, NULL)) {
- if (cal_client_update_object_with_mod (client, comp, mod) == CAL_CLIENT_RESULT_SUCCESS) {
- if (itip_organizer_is_user (comp, client)
- && send_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (day_view)),
- client, comp, FALSE))
- itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp,
- client, NULL);
- } else {
- g_message ("e_day_view_on_top_canvas_drag_data_received(): Could "
- "not update the object!");
- }
+ if (cal_component_has_recurrences (comp)) {
+ if (!recur_component_dialog (comp, &mod, NULL)) {
+ g_object_unref (comp);
+ return;
}
- } else if (cal_client_update_object (client, comp) == CAL_CLIENT_RESULT_SUCCESS) {
- if (itip_organizer_is_user (comp, client) &&
- send_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (day_view)),
- client, comp, FALSE))
- itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp,
+ }
+
+ toplevel = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (day_view)));
+
+ if (cal_client_modify_object (client, cal_component_get_icalcomponent (comp), mod, NULL)) {
+ if (itip_organizer_is_user (comp, client)
+ && send_component_dialog (toplevel, client, comp, FALSE))
+ itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp,
client, NULL);
- } else {
- g_message ("e_day_view_on_main_canvas_drag_data_received(): "
- "Could not update the object!");
}
g_object_unref (comp);
diff --git a/calendar/gui/e-day-view.h b/calendar/gui/e-day-view.h
index 1c39fd5844..b85bd01d70 100644
--- a/calendar/gui/e-day-view.h
+++ b/calendar/gui/e-day-view.h
@@ -528,7 +528,6 @@ void e_day_view_set_week_start_day (EDayView *day_view,
gint week_start_day);
void e_day_view_delete_occurrence (EDayView *day_view);
-void e_day_view_unrecur_appointment (EDayView *day_view);
/* Returns the number of selected events (0 or 1 at present). */
gint e_day_view_get_num_events_selected (EDayView *day_view);
@@ -588,11 +587,6 @@ gint e_day_view_get_time_string_width (EDayView *day_view);
gint e_day_view_event_sort_func (const void *arg1,
const void *arg2);
-gboolean e_day_view_find_event_from_item (EDayView *day_view,
- GnomeCanvasItem *item,
- gint *day_return,
- gint *event_num_return);
-
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/calendar/gui/e-itip-control.c b/calendar/gui/e-itip-control.c
index ed15183552..154f23e170 100644
--- a/calendar/gui/e-itip-control.c
+++ b/calendar/gui/e-itip-control.c
@@ -58,12 +58,13 @@
struct _EItipControlPrivate {
GtkWidget *html;
+ gboolean html_destroyed;
GPtrArray *event_clients;
CalClient *event_client;
GPtrArray *task_clients;
CalClient *task_client;
-
+
char *vcalendar;
CalComponent *comp;
icalcomponent *main_comp;
@@ -187,13 +188,43 @@ error:
return NULL;
}
-static gboolean
-start_default_server_async (EItipControl *itip, CalClient *client, gboolean tasks)
+static CalClient *
+start_default_server (EItipControl *itip, gboolean tasks)
{
- if (tasks)
- return cal_client_open_default_tasks (client, FALSE);
- else
- return cal_client_open_default_calendar (client, FALSE);
+ CalClient *client;
+ gboolean success = FALSE;
+
+ client = cal_client_new ();
+
+ g_signal_connect (client, "cal_opened", G_CALLBACK (start_calendar_server_cb), &success);
+
+ if (tasks) {
+ if (!cal_client_open_default_tasks (client, FALSE))
+ goto error;
+ } else {
+ if (!cal_client_open_default_calendar (client, FALSE))
+ goto error;
+ }
+
+ /* run a sub event loop to turn cal-client's async load
+ notification into a synchronous call */
+ if (!itip->priv->destroyed) {
+ gtk_signal_connect (GTK_OBJECT (itip), "destroy",
+ gtk_main_quit, NULL);
+
+ gtk_main ();
+
+ gtk_signal_disconnect_by_func (GTK_OBJECT (itip),
+ gtk_main_quit, NULL);
+ }
+
+ if (success)
+ return client;
+
+ error:
+ g_object_unref (client);
+
+ return NULL;
}
static GPtrArray *
@@ -274,11 +305,9 @@ find_server (GPtrArray *servers, CalComponent *comp)
for (i = 0; i < servers->len; i++) {
CalClient *client;
icalcomponent *icalcomp;
- CalClientGetStatus status;
client = g_ptr_array_index (servers, i);
- status = cal_client_get_object (client, uid, &icalcomp);
- if (status == CAL_CLIENT_GET_SUCCESS) {
+ if (cal_client_get_object (client, uid, NULL, &icalcomp, NULL)) {
icalcomponent_free (icalcomp);
g_object_ref (client);
@@ -297,7 +326,7 @@ html_destroyed (gpointer data)
priv = itip->priv;
- priv->html = NULL;
+ priv->html_destroyed = TRUE;
}
static void
@@ -329,6 +358,7 @@ init (EItipControl *itip)
/* Html Widget */
priv->html = gtk_html_new ();
+ priv->html_destroyed = FALSE;
gtk_html_set_default_content_type (GTK_HTML (priv->html),
"text/html; charset=utf-8");
gtk_html_load_from_string (GTK_HTML (priv->html), " ", 1);
@@ -401,12 +431,10 @@ destroy (GtkObject *obj)
{
EItipControl *itip = E_ITIP_CONTROL (obj);
EItipControlPrivate *priv;
-
+
priv = itip->priv;
-
+
priv->destroyed = TRUE;
-
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (obj);
}
static void
@@ -913,7 +941,7 @@ write_html (EItipControl *itip, const gchar *itip_desc, const gchar *itip_title,
priv = itip->priv;
- if (priv->html == NULL)
+ if (priv->html_destroyed)
return;
/* Html widget */
@@ -1220,7 +1248,7 @@ get_real_item (EItipControl *itip)
CalComponent *comp;
icalcomponent *icalcomp;
CalComponentVType type;
- CalClientGetStatus status = CAL_CLIENT_GET_NOT_FOUND;
+ gboolean found = FALSE;
const char *uid;
priv = itip->priv;
@@ -1231,17 +1259,17 @@ get_real_item (EItipControl *itip)
switch (type) {
case CAL_COMPONENT_EVENT:
if (priv->event_client != NULL)
- status = cal_client_get_object (priv->event_client, uid, &icalcomp);
+ found = cal_client_get_object (priv->event_client, uid, NULL, &icalcomp, NULL);
break;
case CAL_COMPONENT_TODO:
if (priv->task_client != NULL)
- status = cal_client_get_object (priv->task_client, uid, &icalcomp);
+ found = cal_client_get_object (priv->task_client, uid, NULL, &icalcomp, NULL);
break;
default:
- status = CAL_CLIENT_GET_NOT_FOUND;
+ found = FALSE;
}
- if (status != CAL_CLIENT_GET_SUCCESS)
+ if (!found)
return NULL;
comp = cal_component_new ();
@@ -1853,7 +1881,6 @@ update_item (EItipControl *itip)
CalClient *client;
CalComponentVType type;
GtkWidget *dialog;
- CalClientResult result;
priv = itip->priv;
@@ -1881,32 +1908,18 @@ update_item (EItipControl *itip)
icalcomponent_add_component (priv->top_level, clone);
icalcomponent_set_method (priv->top_level, priv->method);
- result = cal_client_update_objects (client, priv->top_level);
- switch (result) {
- case CAL_CLIENT_RESULT_INVALID_OBJECT :
- dialog = gnome_warning_dialog (_("Object is invalid and cannot be updated\n"));
- break;
- case CAL_CLIENT_RESULT_CORBA_ERROR :
- dialog = gnome_warning_dialog (_("There was an error on the CORBA system\n"));
- break;
- case CAL_CLIENT_RESULT_NOT_FOUND :
- dialog = gnome_warning_dialog (_("Object could not be found\n"));
- break;
- case CAL_CLIENT_RESULT_PERMISSION_DENIED :
- dialog = gnome_warning_dialog (_("You do not have the right permissions to update the calendar\n"));
- break;
- case CAL_CLIENT_RESULT_SUCCESS :
- dialog = gnome_ok_dialog (_("Update complete\n"));
- break;
- default :
+ /* FIXME Better error dialog */
+ if (!cal_client_receive_objects (client, priv->top_level, NULL)) {
dialog = gnome_warning_dialog (_("Calendar file could not be updated!\n"));
- break;
+ } else {
+ dialog = gnome_ok_dialog (_("Update complete\n"));
}
gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
icalcomponent_remove_component (priv->top_level, clone);
}
+#if 0
static void
update_attendee_status (EItipControl *itip)
{
@@ -1936,7 +1949,7 @@ update_attendee_status (EItipControl *itip)
/* Obtain our version */
cal_component_get_uid (priv->comp, &uid);
- status = cal_client_get_object (client, uid, &icalcomp);
+ status = cal_client_get_object (client, uid, NULL, &icalcomp);
if (status == CAL_CLIENT_GET_SUCCESS) {
GSList *attendees;
@@ -2010,6 +2023,7 @@ update_attendee_status (EItipControl *itip)
g_object_unref (comp);
gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
}
+#endif
static void
remove_item (EItipControl *itip)
@@ -2019,7 +2033,7 @@ remove_item (EItipControl *itip)
CalComponentVType type;
const char *uid;
GtkWidget *dialog;
- CalClientResult result;
+ GError *error = NULL;
priv = itip->priv;
@@ -2033,13 +2047,15 @@ remove_item (EItipControl *itip)
return;
cal_component_get_uid (priv->comp, &uid);
- result = cal_client_remove_object (client, uid);
- if (result == CAL_CLIENT_RESULT_SUCCESS || result == CAL_CLIENT_RESULT_NOT_FOUND) {
+ cal_client_remove_object (client, uid, &error);
+ if (!error || error->code == E_CALENDAR_STATUS_OBJECT_NOT_FOUND) {
dialog = gnome_ok_dialog (_("Removal Complete"));
gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
} else {
- delete_error_dialog (result, type);
- }
+ delete_error_dialog (error, type);
+ }
+
+ g_clear_error (&error);
}
static void
@@ -2081,7 +2097,7 @@ send_freebusy (EItipControl *itip)
CalComponentDateTime datetime;
time_t start, end;
GtkWidget *dialog;
- GList *comp_list;
+ GList *comp_list = NULL;
icaltimezone *zone;
priv = itip->priv;
@@ -2106,9 +2122,7 @@ send_freebusy (EItipControl *itip)
end = icaltime_as_timet_with_zone (*datetime.value, zone);
cal_component_free_datetime (&datetime);
- comp_list = cal_client_get_free_busy (priv->event_client, NULL, start, end);
-
- if (comp_list) {
+ if (cal_client_get_free_busy (priv->event_client, NULL, start, end, &comp_list, NULL)) {
GList *l;
for (l = comp_list; l; l = l->next) {
@@ -2179,34 +2193,16 @@ url_requested_cb (GtkHTML *html, const gchar *url, GtkHTMLStream *handle, gpoint
g_free (path);
}
-typedef struct
-{
- EItipControl *itip;
- GtkHTMLEmbedded *eb;
- CalClient *client;
-}
-ObjectRequestContext;
-
-static void
-default_server_started_cb (CalClient *client, CalClientOpenStatus status, gpointer data)
+static gboolean
+object_requested_cb (GtkHTML *html, GtkHTMLEmbedded *eb, gpointer data)
{
- ObjectRequestContext *context = data;
+ EItipControl *itip = E_ITIP_CONTROL (data);
EItipControlPrivate *priv;
GtkWidget *button;
CalComponentVType vtype;
+
+ priv = itip->priv;
- priv = context->itip->priv;
-
- if (status != CAL_CLIENT_OPEN_SUCCESS ||
- context->itip->priv->destroyed ||
- context->itip->priv->html == NULL) {
- g_object_unref (context->client);
- g_object_unref (context->itip);
- g_free (context);
- return;
- }
-
- priv->event_client = client;
vtype = cal_component_get_vtype (priv->comp);
switch (vtype) {
@@ -2215,65 +2211,24 @@ default_server_started_cb (CalClient *client, CalClientOpenStatus status, gpoint
global_shell_client, _("Select Calendar Folder"),
calendar_config_default_calendar_folder (),
calendar_types);
+ priv->event_client = start_default_server (itip, FALSE);
break;
case CAL_COMPONENT_TODO:
button = evolution_folder_selector_button_new (
global_shell_client, _("Select Tasks Folder"),
calendar_config_default_tasks_folder (),
tasks_types);
+ priv->task_client = start_default_server (itip, TRUE);
break;
default:
button = NULL;
}
- g_signal_connect (button, "selected", G_CALLBACK (button_selected_cb), context->itip);
+ g_signal_connect (button, "selected", G_CALLBACK (button_selected_cb), itip);
- gtk_container_add (GTK_CONTAINER (context->eb), button);
+ gtk_container_add (GTK_CONTAINER (eb), button);
gtk_widget_show (button);
- g_object_unref (context->itip);
- g_free (context);
- return;
-}
-
-static gboolean
-object_requested_cb (GtkHTML *html, GtkHTMLEmbedded *eb, gpointer data)
-{
- EItipControl *itip = E_ITIP_CONTROL (data);
- ObjectRequestContext *context;
- EItipControlPrivate *priv;
- CalComponentVType vtype;
- gboolean success;
-
- priv = itip->priv;
- vtype = cal_component_get_vtype (priv->comp);
-
- context = g_new0 (ObjectRequestContext, 1);
- context->itip = itip;
- context->eb = eb;
- context->client = cal_client_new ();
-
- g_object_ref (itip);
- g_signal_connect (context->client, "cal_opened",
- G_CALLBACK (default_server_started_cb), context);
-
- switch (vtype) {
- case CAL_COMPONENT_EVENT:
- success = start_default_server_async (itip, context->client, FALSE);
- break;
- case CAL_COMPONENT_TODO:
- success = start_default_server_async (itip, context->client, TRUE);
- break;
- default:
- success = FALSE;
- }
-
- if (!success) {
- g_object_unref (itip);
- g_object_unref (context->client);
- g_free (context);
- }
-
return TRUE;
}
@@ -2330,7 +2285,8 @@ ok_clicked_cb (GtkHTML *html, const gchar *method, const gchar *url, const gchar
send_freebusy (itip);
break;
case 'R':
- update_attendee_status (itip);
+ /* FIXME Make sure this does the right thing in the backend */
+ update_item (itip);
break;
case 'S':
send_item (itip);
diff --git a/calendar/gui/e-meeting-model.c b/calendar/gui/e-meeting-model.c
index a7cd54fd85..1cbb789a9e 100644
--- a/calendar/gui/e-meeting-model.c
+++ b/calendar/gui/e-meeting-model.c
@@ -671,9 +671,6 @@ finalize (GObject *obj)
g_source_remove (priv->refresh_idle_id);
g_free (priv);
-
- if (G_OBJECT_CLASS (parent_class)->finalize)
- (* G_OBJECT_CLASS (parent_class)->finalize) (obj);
}
GtkObject *
@@ -1388,7 +1385,7 @@ refresh_busy_periods (gpointer data)
/* Check the server for free busy data */
if (priv->client) {
- GList *fb_data, *users = NULL;
+ GList *fb_data = NULL, *users = NULL;
struct icaltimetype itt;
time_t startt, endt;
const char *user;
@@ -1411,7 +1408,9 @@ refresh_busy_periods (gpointer data)
user = itip_strip_mailto (e_meeting_attendee_get_address (ia));
users = g_list_append (users, g_strdup (user));
- fb_data = cal_client_get_free_busy (priv->client, users, startt, endt);
+
+ /* FIXME Error checking */
+ cal_client_get_free_busy (priv->client, users, startt, endt, &fb_data, NULL);
g_list_foreach (users, (GFunc)g_free, NULL);
g_list_free (users);
@@ -1650,7 +1649,8 @@ process_section (EMeetingModel *im, GNOME_Evolution_Addressbook_SimpleCardList *
priv = im->priv;
for (i = 0; i < cards->_length; i++) {
EMeetingAttendee *ia;
- const char *name, *attendee = NULL, *attr;
+ const char *name, *attendee = NULL;
+ char *attr;
GNOME_Evolution_Addressbook_SimpleCard card;
CORBA_Environment ev;
@@ -1666,11 +1666,12 @@ process_section (EMeetingModel *im, GNOME_Evolution_Addressbook_SimpleCardList *
}
/* Get the field as attendee from the backend */
- attr = cal_client_get_ldap_attribute (priv->client);
- if (attr) {
+ if (cal_client_get_ldap_attribute (priv->client, &attr, NULL) && attr) {
/* FIXME this should be more general */
if (!strcmp (attr, "icscalendar"))
attendee = GNOME_Evolution_Addressbook_SimpleCard_get (card, GNOME_Evolution_Addressbook_SimpleCard_Icscalendar, &ev);
+
+ g_free (attr);
}
CORBA_exception_init (&ev);
diff --git a/calendar/gui/e-tasks.c b/calendar/gui/e-tasks.c
index b441aee09d..0b9c4ec3b9 100644
--- a/calendar/gui/e-tasks.c
+++ b/calendar/gui/e-tasks.c
@@ -787,7 +787,8 @@ cal_opened_cb (CalClient *client,
location = calendar_config_get_timezone ();
zone = icaltimezone_get_builtin_timezone (location);
if (zone)
- cal_client_set_default_timezone (client, zone);
+ /* FIXME Error checking */
+ cal_client_set_default_timezone (client, zone, NULL);
return;
case CAL_CLIENT_OPEN_ERROR:
@@ -937,60 +938,6 @@ create_sexp (void)
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;
-
- delete_error_dialog (cal_client_remove_object (priv->client, uid), CAL_COMPONENT_TODO);
-}
-
-/* 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);
-
- g_signal_handlers_disconnect_matched (priv->query, G_SIGNAL_MATCH_DATA,
- 0, 0, NULL, NULL, tasks);
- g_object_unref (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);
-
- g_signal_handlers_disconnect_matched (priv->query, G_SIGNAL_MATCH_DATA,
- 0, 0, NULL, NULL, tasks);
- g_object_unref (priv->query);
- priv->query = NULL;
-}
/**
* e_tasks_expunge:
* @tasks: A tasks control widget
@@ -1002,31 +949,32 @@ e_tasks_delete_completed (ETasks *tasks)
{
ETasksPrivate *priv;
char *sexp;
+ GList *objects, *l;
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;
+ /* FIXME Confirm expunge */
sexp = create_sexp ();
set_status_message (tasks, _("Expunging"));
- priv->query = cal_client_get_query (priv->client, sexp);
- g_free (sexp);
-
- if (!priv->query) {
+
+ if (!cal_client_get_object_list (priv->client, sexp, &objects, NULL)) {
set_status_message (tasks, NULL);
- g_message ("update_query(): Could not create the query");
+ g_warning (G_STRLOC ": Could not get the objects");
+
return;
}
+
+ for (l = objects; l; l = l->next) {
+ /* FIXME Better error handling */
+ cal_client_remove_object (priv->client, icalcomponent_get_uid (l->data), NULL);
+ }
- g_signal_connect (priv->query, "obj_updated", G_CALLBACK (query_obj_updated_cb), tasks);
- g_signal_connect (priv->query, "query_done", G_CALLBACK (query_query_done_cb), tasks);
- g_signal_connect (priv->query, "eval_error", G_CALLBACK (query_eval_error_cb), tasks);
+ set_status_message (tasks, NULL);
}
/* Callback used from the view collection when we need to display a new view */
@@ -1181,6 +1129,7 @@ e_tasks_update_all_config_settings (void)
calendar_config_configure_e_calendar_table (E_CALENDAR_TABLE (priv->tasks_view));
if (zone)
- cal_client_set_default_timezone (priv->client, zone);
+ /* FIXME Error checking */
+ cal_client_set_default_timezone (priv->client, zone, NULL);
}
}
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c
index 8028bf13e6..de85919532 100644
--- a/calendar/gui/e-week-view.c
+++ b/calendar/gui/e-week-view.c
@@ -30,7 +30,6 @@
#include <config.h>
#include "e-week-view.h"
-#include "ea-calendar.h"
#include <math.h>
#include <gdk/gdkkeysyms.h>
@@ -82,8 +81,6 @@
#define E_WEEK_VIEW_JUMP_BUTTON_X_PAD 3
#define E_WEEK_VIEW_JUMP_BUTTON_Y_PAD 3
-#define E_WEEK_VIEW_JUMP_BUTTON_NO_FOCUS -1
-
/* The timeout before we do a layout, so we don't do a layout for each event
we get from the server. */
#define E_WEEK_VIEW_LAYOUT_TIMEOUT 100
@@ -162,6 +159,10 @@ static void e_week_view_on_editing_started (EWeekView *week_view,
GnomeCanvasItem *item);
static void e_week_view_on_editing_stopped (EWeekView *week_view,
GnomeCanvasItem *item);
+static gboolean e_week_view_find_event_from_item (EWeekView *week_view,
+ GnomeCanvasItem *item,
+ gint *event_num,
+ gint *span_num);
static gboolean e_week_view_find_event_from_uid (EWeekView *week_view,
const gchar *uid,
gint *event_num_return);
@@ -182,10 +183,6 @@ static gboolean e_week_view_on_jump_button_event (GnomeCanvasItem *item,
static gboolean e_week_view_key_press (GtkWidget *widget, GdkEventKey *event);
static gboolean e_week_view_do_key_press (GtkWidget *widget,
GdkEventKey *event);
-static void e_week_view_on_key_up (EWeekView *week_view, GdkEventKey *event);
-static void e_week_view_on_key_down (EWeekView *week_view, GdkEventKey *event);
-static void e_week_view_on_key_left (EWeekView *week_view, GdkEventKey *event);
-static void e_week_view_on_key_right (EWeekView *week_view, GdkEventKey *event);
static gboolean e_week_view_popup_menu (GtkWidget *widget);
static gboolean e_week_view_update_event_cb (EWeekView *week_view,
@@ -236,9 +233,6 @@ e_week_view_class_init (EWeekViewClass *class)
view_class->set_selected_time_range = e_week_view_set_selected_time_range;
view_class->get_visible_time_range = e_week_view_get_visible_time_range;
view_class->update_query = e_week_view_update_query;
-
- /* init the accessibility support for e_week_view */
- e_week_view_a11y_init ();
}
static void
@@ -384,8 +378,6 @@ e_week_view_init (EWeekView *week_view)
g_signal_connect (week_view->jump_buttons[i], "event",
G_CALLBACK (e_week_view_on_jump_button_event), week_view);
}
- week_view->focused_jump_button = E_WEEK_VIEW_JUMP_BUTTON_NO_FOCUS;
-
gdk_pixbuf_unref (pixbuf);
/*
@@ -1000,25 +992,22 @@ e_week_view_focus (GtkWidget *widget, GtkDirectionType direction)
EWeekView *week_view;
gint new_event_num;
gint new_span_num;
+ gint current_event_num;
+ gint current_span_num;
gint event_loop;
gboolean editable = FALSE;
- static gint last_focus_event_num = -1, last_focus_span_num = -1;
g_return_val_if_fail (widget != NULL, FALSE);
g_return_val_if_fail (E_IS_WEEK_VIEW (widget), FALSE);
week_view = E_WEEK_VIEW (widget);
-
- if (week_view->focused_jump_button == E_WEEK_VIEW_JUMP_BUTTON_NO_FOCUS) {
- last_focus_event_num = week_view->editing_event_num;
- last_focus_span_num = week_view->editing_span_num;
- }
-
+ current_event_num = week_view->editing_event_num;
+ current_span_num = week_view->editing_span_num;
for (event_loop = 0; event_loop < week_view->events->len;
++event_loop) {
if (!e_week_view_get_next_tab_event (week_view, direction,
- last_focus_event_num,
- last_focus_span_num,
+ current_event_num,
+ current_span_num,
&new_event_num,
&new_span_num))
return FALSE;
@@ -1036,32 +1025,8 @@ e_week_view_focus (GtkWidget *widget, GtkDirectionType direction)
NULL);
if (editable)
break;
- else {
- /* check if we should go to the jump button */
-
- EWeekViewEvent *event;
- EWeekViewEventSpan *span;
- gint current_day;
-
- event = &g_array_index (week_view->events,
- EWeekViewEvent,
- new_event_num);
- span = &g_array_index (week_view->spans,
- EWeekViewEventSpan,
- event->spans_index + new_span_num);
- current_day = span->start_day;
-
- if ((week_view->focused_jump_button != current_day) &&
- e_week_view_is_jump_button_visible(week_view, current_day)) {
-
- /* focus go to the jump button */
- e_week_view_stop_editing_event (week_view);
- gnome_canvas_item_grab_focus (week_view->jump_buttons[current_day]);
- return TRUE;
- }
- }
- last_focus_event_num = new_event_num;
- last_focus_span_num = new_span_num;
+ current_event_num = new_event_num;
+ current_span_num = new_span_num;
}
return editable;
}
@@ -1098,6 +1063,7 @@ process_component (EWeekView *week_view, ECalModelComponent *comp_data)
CalComponent *comp = NULL;
AddEventData add_event_data;
const char *uid;
+ CalComponentDateTime dt_start, dt_end;
/* If we don't have a valid date set yet, just return. */
if (!g_date_valid (&week_view->first_day_shown))
@@ -1149,18 +1115,26 @@ process_component (EWeekView *week_view, ECalModelComponent *comp_data)
g_object_unref (tmp_comp);
}
- /* Add the occurrences of the event. */
+ /* Add the event if it's on the time range */
num_days = week_view->multi_week_view ? week_view->weeks_shown * 7 : 7;
- add_event_data.week_view = week_view;
- add_event_data.comp_data = comp_data;
- cal_recur_generate_instances (comp,
- week_view->day_starts[0],
- week_view->day_starts[num_days],
- e_week_view_add_event, &add_event_data,
- cal_client_resolve_tzid_cb,
- comp_data->client,
- e_cal_view_get_timezone (E_CAL_VIEW (week_view)));
+ cal_component_get_dtstart (comp, &dt_start);
+ cal_component_get_dtend (comp, &dt_end);
+
+ if (dt_start.value && dt_end.value) {
+ time_t tt_start, tt_end;
+
+ tt_start = icaltime_as_timet (*dt_start.value);
+ tt_end = icaltime_as_timet (*dt_end.value);
+
+ if ((tt_start >= week_view->day_starts[0] && tt_start <= week_view->day_starts[num_days])
+ || (tt_end >= week_view->day_starts[0] && tt_end <= week_view->day_starts[num_days])
+ || (tt_start <= week_view->day_starts[0] && tt_end >= week_view->day_starts[num_days])) {
+ add_event_data.week_view = week_view;
+ add_event_data.comp_data = comp_data;
+ e_week_view_add_event (comp, tt_start, tt_end, &add_event_data);
+ }
+ }
g_object_unref (comp);
@@ -1817,9 +1791,6 @@ e_week_view_update_event_cb (EWeekView *week_view,
span_num);
}
}
- g_signal_emit_by_name (G_OBJECT(week_view),
- "event_changed", event);
-
return TRUE;
}
@@ -2302,6 +2273,7 @@ e_week_view_add_event (CalComponent *comp,
add_event_data->week_view->day_starts[0], add_event_data->week_view->day_starts[num_days],
start, end);
#endif
+
g_return_val_if_fail (start <= end, TRUE);
g_return_val_if_fail (start < add_event_data->week_view->day_starts[num_days], TRUE);
g_return_val_if_fail (end > add_event_data->week_view->day_starts[0], TRUE);
@@ -2582,9 +2554,6 @@ e_week_view_reshape_event_span (EWeekView *week_view,
g_signal_connect (span->text_item, "event",
G_CALLBACK (e_week_view_on_text_item_event),
week_view);
- g_signal_emit_by_name (G_OBJECT(week_view),
- "event_added", event);
-
}
/* Calculate the position of the text item.
@@ -3049,7 +3018,8 @@ e_week_view_on_editing_stopped (EWeekView *week_view,
CalComponent *comp;
CalComponentText summary;
const char *uid;
-
+ gboolean on_server;
+
/* Note: the item we are passed here isn't reliable, so we just stop
the edit of whatever item was being edited. We also receive this
event twice for some reason. */
@@ -3079,8 +3049,9 @@ e_week_view_on_editing_stopped (EWeekView *week_view,
comp = cal_component_new ();
cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
- if (string_is_empty (text) &&
- !cal_comp_is_on_server (comp, event->comp_data->client)) {
+ on_server = cal_comp_is_on_server (comp, event->comp_data->client);
+
+ if (string_is_empty (text) && !on_server) {
const char *uid;
cal_component_get_uid (comp, &uid);
@@ -3099,33 +3070,34 @@ e_week_view_on_editing_stopped (EWeekView *week_view,
e_week_view_reshape_event_span (week_view, event_num,
span_num);
} else if (summary.value || !string_is_empty (text)) {
+ icalcomponent *icalcomp = cal_component_get_icalcomponent (comp);
+
summary.value = text;
summary.altrep = NULL;
cal_component_set_summary (comp, &summary);
- if (cal_component_is_instance (comp)) {
- CalObjModType mod;
-
- if (recur_component_dialog (comp, &mod, NULL)) {
- if (cal_client_update_object_with_mod (event->comp_data->client, comp, mod)
- == CAL_CLIENT_RESULT_SUCCESS) {
- if (itip_organizer_is_user (comp, event->comp_data->client)
- && send_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (week_view)),
- event->comp_data->client, comp, FALSE))
- itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp,
- event->comp_data->client, NULL);
- } else {
- g_message ("e_week_view_on_editing_stopped(): Could not update the object!");
+
+ if (!on_server) {
+ if (!cal_client_create_object (event->comp_data->client, icalcomp, NULL, NULL))
+ g_message (G_STRLOC ": Could not create the object!");
+ } else {
+ CalObjModType mod = CALOBJ_MOD_ALL;
+ GtkWindow *toplevel;
+
+ if (cal_component_has_recurrences (comp)) {
+ if (!recur_component_dialog (comp, &mod, NULL)) {
+ goto out;
}
}
- } else if (cal_client_update_object (event->comp_data->client, comp) == CAL_CLIENT_RESULT_SUCCESS) {
- if (itip_organizer_is_user (comp, event->comp_data->client) &&
- send_component_dialog ((GtkWindow *) gtk_widget_get_toplevel (GTK_WIDGET (week_view)),
- event->comp_data->client, comp, FALSE))
- itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp,
- event->comp_data->client, NULL);
- } else {
- g_message ("e_week_view_on_editing_stopped(): Could not update the object!");
+
+ /* FIXME When sending here, what exactly should we send? */
+ toplevel = GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (week_view)));
+ if (cal_client_modify_object (event->comp_data->client, icalcomp, mod, NULL)) {
+ if (itip_organizer_is_user (comp, event->comp_data->client)
+ && send_component_dialog (toplevel, event->comp_data->client, comp, FALSE))
+ itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp,
+ event->comp_data->client, NULL);
+ }
}
}
@@ -3138,7 +3110,7 @@ e_week_view_on_editing_stopped (EWeekView *week_view,
}
-gboolean
+static gboolean
e_week_view_find_event_from_item (EWeekView *week_view,
GnomeCanvasItem *item,
gint *event_num_return,
@@ -3256,24 +3228,6 @@ e_week_view_do_key_press (GtkWidget *widget, GdkEventKey *event)
}
#endif
- /*Navigation through days with arrow keys*/
- switch (event->keyval) {
- case GDK_Up:
- e_week_view_on_key_up (week_view, event);
- return TRUE;
- case GDK_Down:
- e_week_view_on_key_down (week_view, event);
- return TRUE;
- case GDK_Left:
- e_week_view_on_key_left (week_view, event);
- return TRUE;
- case GDK_Right:
- e_week_view_on_key_right (week_view, event);
- return TRUE;
- default:
- break;
- }
-
if (week_view->selection_start_day == -1)
return FALSE;
@@ -3338,179 +3292,6 @@ e_week_view_do_key_press (GtkWidget *widget, GdkEventKey *event)
return TRUE;
}
-static void
-e_week_view_on_key_up (EWeekView *week_view, GdkEventKey *event)
-{
- gint selection_start_day, selection_end_day;
-
- selection_start_day = week_view->selection_start_day;
- selection_end_day = week_view->selection_end_day;
-
- if (selection_start_day == -1) {
- selection_start_day = 0;
- selection_end_day = 0;
- }
-
- if (week_view->multi_week_view) {
- if (selection_end_day < 7) {
- g_date_subtract_days (&(week_view->first_day_shown), 7);
- } else
- selection_end_day -= 7;
- }
- else {
- if (selection_start_day == selection_end_day) {
- if (selection_end_day == 0) {
- g_date_subtract_days (&(week_view->first_day_shown), 7);
- selection_end_day = 6;
- } else
- selection_end_day--;
- } else {
- selection_end_day =
- (selection_start_day + selection_end_day)/2;
- }
- }
-
- week_view->selection_start_day = selection_end_day;
- week_view->selection_end_day = selection_end_day;
-
- gtk_widget_queue_draw (week_view->main_canvas);
-}
-
-static void
-e_week_view_on_key_down (EWeekView *week_view, GdkEventKey *event)
-{
- gint selection_start_day, selection_end_day;
-
- selection_start_day = week_view->selection_start_day;
- selection_end_day = week_view->selection_end_day;
-
- if (selection_start_day == -1) {
- selection_start_day = 0;
- selection_end_day = 0;
- }
-
- if (week_view->multi_week_view) {
- if ((selection_end_day+7) / 7 >= week_view->weeks_shown) {
- g_date_add_days (&(week_view->first_day_shown), 7);
- } else
- selection_end_day += 7;
- }
- else {
- if (selection_start_day == selection_end_day) {
- if (selection_end_day == 6) {
- g_date_add_days (&(week_view->first_day_shown), 7);
- selection_end_day = 0;
- } else
- selection_end_day++;
- } else {
- selection_end_day =
- (selection_start_day + selection_end_day)/2;
- }
- }
-
- week_view->selection_start_day = selection_end_day;
- week_view->selection_end_day = selection_end_day;
-
- gtk_widget_queue_draw (week_view->main_canvas);
-}
-
-static void
-e_week_view_on_key_left (EWeekView *week_view, GdkEventKey *event)
-{
- gint selection_start_day, selection_end_day;
-
- selection_start_day = week_view->selection_start_day;
- selection_end_day = week_view->selection_end_day;
-
- if (selection_start_day == -1) {
- selection_start_day = 0;
- selection_end_day = 0;
- }
-
- if (week_view->multi_week_view) {
- if (selection_end_day == 0) {
- g_date_subtract_days (&(week_view->first_day_shown), 7);
- selection_end_day = 6;
- } else
- selection_end_day -= 1;
- }
- else {
- switch (selection_end_day) {
- case 0:
- case 1:
- case 2:
- g_date_subtract_days (&(week_view->first_day_shown), 7);
- selection_end_day += 3;
- break;
- case 3:
- case 4:
- case 5:
- selection_end_day -= 3;
- break;
- case 6:
- selection_end_day -= 4;
- break;
- default:
- break;
- }
- }
-
- week_view->selection_start_day = selection_end_day;
- week_view->selection_end_day = selection_end_day;
-
- gtk_widget_queue_draw (week_view->main_canvas);
-
-}
-
-static void
-e_week_view_on_key_right (EWeekView *week_view, GdkEventKey *event)
-{
-
- gint selection_start_day, selection_end_day;
-
- selection_start_day = week_view->selection_start_day;
- selection_end_day = week_view->selection_end_day;
-
- if (selection_start_day == -1) {
- selection_start_day = 0;
- selection_end_day = 0;
- }
-
- if (week_view->multi_week_view) {
- if (selection_end_day == week_view->weeks_shown*7 -1 ) {
- g_date_add_days (&(week_view->first_day_shown), 7);
- selection_end_day -= 6;
- } else
- selection_end_day++;
- }
- else {
- switch (selection_end_day) {
- case 0:
- case 1:
- case 2:
- selection_end_day += 3;
- break;
- case 3:
- case 4:
- case 5:
- g_date_add_days (&(week_view->first_day_shown), 7);
- selection_end_day -= 3;
- break;
- case 6:
- g_date_add_days (&(week_view->first_day_shown), 7);
- selection_end_day -= 4;
- break;
- default:
- break;
- }
- }
-
- week_view->selection_start_day = selection_end_day;
- week_view->selection_end_day = selection_end_day;
-
- gtk_widget_queue_draw (week_view->main_canvas);
-}
-
static gboolean
e_week_view_key_press (GtkWidget *widget, GdkEventKey *event)
{
@@ -3545,83 +3326,6 @@ e_week_view_popup_menu (GtkWidget *widget)
return TRUE;
}
-void
-e_week_view_unrecur_appointment (EWeekView *week_view)
-{
- EWeekViewEvent *event;
- CalComponent *comp, *new_comp;
- CalComponentDateTime date;
- struct icaltimetype itt;
-
- if (week_view->popup_event_num == -1)
- return;
-
- event = &g_array_index (week_view->events, EWeekViewEvent,
- week_view->popup_event_num);
-
- /* For the recurring object, we add a exception to get rid of the
- instance. */
- comp = cal_component_new ();
- cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp));
- cal_comp_util_add_exdate (comp, event->start, e_cal_view_get_timezone (E_CAL_VIEW (week_view)));
-
- /* For the unrecurred instance we duplicate the original object,
- create a new uid for it, get rid of the recurrence rules, and set
- the start & end times to the instances times. */
- new_comp = cal_component_new ();
- cal_component_set_icalcomponent (new_comp, icalcomponent_new_clone (event->comp_data->icalcomp));
- cal_component_set_uid (new_comp, cal_component_gen_uid ());
- cal_component_set_rdate_list (new_comp, NULL);
- cal_component_set_rrule_list (new_comp, NULL);
- cal_component_set_exdate_list (new_comp, NULL);
- cal_component_set_exrule_list (new_comp, NULL);
-
- date.value = &itt;
- date.tzid = icaltimezone_get_tzid (e_cal_view_get_timezone (E_CAL_VIEW (week_view)));
-
- *date.value = icaltime_from_timet_with_zone (event->start, FALSE,
- e_cal_view_get_timezone (E_CAL_VIEW (week_view)));
- cal_component_set_dtstart (new_comp, &date);
- *date.value = icaltime_from_timet_with_zone (event->end, FALSE,
- e_cal_view_get_timezone (E_CAL_VIEW (week_view)));
- cal_component_set_dtend (new_comp, &date);
-
- /* Now update both CalComponents. Note that we do this last since at
- present the updates happen synchronously so our event may disappear.
- */
- if (cal_client_update_object (event->comp_data->client, comp)
- != CAL_CLIENT_RESULT_SUCCESS)
- g_message ("e_week_view_on_unrecur_appointment(): Could not update the object!");
-
- g_object_unref (comp);
-
- if (cal_client_update_object (event->comp_data->client, new_comp)
- != CAL_CLIENT_RESULT_SUCCESS)
- g_message ("e_week_view_on_unrecur_appointment(): Could not update the object!");
-
- g_object_unref (new_comp);
-}
-
-void
-e_week_view_jump_to_button_item (EWeekView *week_view, GnomeCanvasItem *item)
-{
- gint day;
- GnomeCalendar *calendar;
-
- for (day = 0; day < E_WEEK_VIEW_MAX_WEEKS * 7; ++day) {
- if (item == week_view->jump_buttons[day]) {
- calendar = e_cal_view_get_calendar (E_CAL_VIEW (week_view));
- if (calendar)
- gnome_calendar_dayjump
- (calendar,
- week_view->day_starts[day]);
- else
- g_warning ("Calendar not set");
- return;
- }
- }
-}
-
static gboolean
e_week_view_on_jump_button_event (GnomeCanvasItem *item,
GdkEvent *event,
@@ -3630,49 +3334,21 @@ e_week_view_on_jump_button_event (GnomeCanvasItem *item,
gint day;
if (event->type == GDK_BUTTON_PRESS) {
- e_week_view_jump_to_button_item (week_view, item);
- return TRUE;
- }
- else if (event->type == GDK_KEY_PRESS) {
- /* return, if Tab, Control or Alt is pressed */
- if ((event->key.keyval == GDK_Tab) ||
- (event->key.state & (GDK_CONTROL_MASK | GDK_MOD1_MASK)))
- return FALSE;
- /* with a return key or a simple character (from 0x20 to 0xff),
- * jump to the day
- */
- if ((event->key.keyval == GDK_Return) ||
- ((event->key.keyval >= 0x20) &&
- (event->key.keyval <= 0xFF))) {
- e_week_view_jump_to_button_item (week_view, item);
- return TRUE;
- }
- }
- else if (event->type == GDK_FOCUS_CHANGE) {
- GdkEventFocus *focus_event = (GdkEventFocus *)event;
- GdkPixbuf *pixbuf = NULL;
-
for (day = 0; day < E_WEEK_VIEW_MAX_WEEKS * 7; day++) {
- if (item == week_view->jump_buttons[day])
- break;
+ if (item == week_view->jump_buttons[day]) {
+ GnomeCalendar *calendar;
+
+ calendar = e_cal_view_get_calendar (E_CAL_VIEW (week_view));
+ if (calendar)
+ gnome_calendar_dayjump
+ (calendar,
+ week_view->day_starts[day]);
+ else
+ g_warning ("Calendar not set");
+ return TRUE;
+ }
}
- if (focus_event->in) {
- week_view->focused_jump_button = day;
- pixbuf = gdk_pixbuf_new_from_xpm_data ((const char**) jump_xpm_focused);
- gnome_canvas_item_set (week_view->jump_buttons[day],
- "GnomeCanvasPixbuf::pixbuf",
- pixbuf, NULL);
- }
- else {
- week_view->focused_jump_button = E_WEEK_VIEW_JUMP_BUTTON_NO_FOCUS;
- pixbuf = gdk_pixbuf_new_from_xpm_data ((const char**) jump_xpm);
- gnome_canvas_item_set (week_view->jump_buttons[day],
- "GnomeCanvasPixbuf::pixbuf",
- pixbuf, NULL);
- }
- if (pixbuf)
- gdk_pixbuf_unref (pixbuf);
}
return FALSE;
@@ -3773,12 +3449,4 @@ e_week_view_get_num_events_selected (EWeekView *week_view)
return (week_view->editing_event_num != -1) ? 1 : 0;
}
-gboolean
-e_week_view_is_jump_button_visible (EWeekView *week_view, gint day)
-{
- g_return_val_if_fail (E_IS_WEEK_VIEW (week_view), FALSE);
- if ((day >= 0) && (day < E_WEEK_VIEW_MAX_WEEKS * 7))
- return week_view->jump_buttons[day]->object.flags & GNOME_CANVAS_ITEM_VISIBLE;
- return FALSE;
-}
diff --git a/calendar/gui/e-week-view.h b/calendar/gui/e-week-view.h
index c24470155d..3f93ddc084 100644
--- a/calendar/gui/e-week-view.h
+++ b/calendar/gui/e-week-view.h
@@ -170,7 +170,6 @@ struct _EWeekView
GnomeCanvasItem *main_canvas_item;
GnomeCanvasItem *jump_buttons[E_WEEK_VIEW_MAX_WEEKS * 7];
- gint focused_jump_button;
GtkWidget *vscrollbar;
@@ -396,7 +395,6 @@ void e_week_view_set_24_hour_format (EWeekView *week_view,
void e_week_view_delete_occurrence (EWeekView *week_view);
-void e_week_view_unrecur_appointment (EWeekView *week_view);
/* Returns the number of selected events (0 or 1 at present). */
gint e_week_view_get_num_events_selected (EWeekView *week_view);
@@ -438,15 +436,6 @@ gint e_week_view_get_time_string_width (EWeekView *week_view);
gint e_week_view_event_sort_func (const void *arg1,
const void *arg2);
-gboolean e_week_view_find_event_from_item (EWeekView *week_view,
- GnomeCanvasItem *item,
- gint *event_num_return,
- gint *span_num_return);
-
-gboolean e_week_view_is_jump_button_visible (EWeekView *week_view,
- gint day);
-void e_week_view_jump_to_button_item (EWeekView *week_view, GnomeCanvasItem *item);
-
#ifdef __cplusplus
}
#endif /* __cplusplus */
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 3ae8f4bde8..1f78968b34 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -58,7 +58,6 @@
#include "calendar-view-factory.h"
#include "tag-calendar.h"
#include "misc.h"
-#include "ea-calendar.h"
extern ECompEditorRegistry *comp_editor_registry;
@@ -143,10 +142,6 @@ struct _GnomeCalendarPrivate {
'dates-shown-changed' signal.*/
time_t visible_start;
time_t visible_end;
-
- /* Calendar query for purging old events */
- GList *exp_queries;
- time_t exp_older_than;
};
/* Signal IDs */
@@ -352,104 +347,74 @@ gnome_calendar_class_init (GnomeCalendarClass *class)
"goto_date",1,
G_TYPE_ENUM,
GNOME_CAL_GOTO_SAME_DAY_OF_NEXT_WEEK);
- /* init the accessibility support for gnome_calendar */
- gnome_calendar_a11y_init ();
-
}
/* Callback used when the calendar query reports of an updated object */
static void
-dn_query_obj_updated_cb (CalQuery *query, const char *uid,
- gboolean query_in_progress, int n_scanned, int total,
- gpointer data)
+dn_query_objects_added_cb (CalQuery *query, GList *objects, gpointer data)
{
GnomeCalendar *gcal;
GnomeCalendarPrivate *priv;
- CalComponent *comp = NULL;
- icalcomponent *icalcomp;
- CalClientGetStatus status;
-
+ GList *l;
+
gcal = GNOME_CALENDAR (data);
priv = gcal->priv;
- /* If this is an update that is not part of an ongoing query, we have to
- * retag the whole thing: an event may change dates and the
- * tag_calendar_by_comp() below would not know how to untag the old
- * dates.
- */
- if (!query_in_progress) {
- update_query (gcal);
- return;
- }
+ for (l = objects; l; l = l->next) {
+ CalComponent *comp = NULL;
- status = cal_client_get_object (cal_query_get_client (query), uid, &icalcomp);
-
- switch (status) {
- case CAL_CLIENT_GET_SUCCESS:
comp = cal_component_new ();
- if (!cal_component_set_icalcomponent (comp, icalcomp)) {
+ if (!cal_component_set_icalcomponent (comp, icalcomponent_new_clone (l->data))) {
g_object_unref (comp);
- icalcomponent_free (icalcomp);
- return;
+
+ continue;
}
- break;
-
- case CAL_CLIENT_GET_SYNTAX_ERROR:
- g_message ("dn_query_obj_updated_cb(): Syntax error while getting object `%s'", uid);
- return;
- case CAL_CLIENT_GET_NOT_FOUND:
- /* The object is no longer in the server, so do nothing */
- return;
-
- default:
- g_assert_not_reached ();
- return;
+ tag_calendar_by_comp (priv->date_navigator, comp, cal_query_get_client (query), NULL,
+ FALSE, TRUE);
+ g_object_unref (comp);
}
-
- tag_calendar_by_comp (priv->date_navigator, comp, cal_query_get_client (query), NULL,
- FALSE, TRUE);
- g_object_unref (comp);
}
-/* Callback used when the calendar query reports of a removed object */
static void
-dn_query_obj_removed_cb (CalQuery *query, const char *uid, gpointer data)
+dn_query_objects_modified_cb (CalQuery *query, GList *objects, gpointer data)
{
GnomeCalendar *gcal;
+ GnomeCalendarPrivate *priv;
gcal = GNOME_CALENDAR (data);
+ priv = gcal->priv;
- /* Just retag the whole thing */
+ /* We have to retag the whole thing: an event may change dates
+ * and the tag_calendar_by_comp() below would not know how to
+ * untag the old dates.
+ */
update_query (gcal);
}
-/* Callback used when the calendar query is done */
+/* Callback used when the calendar query reports of a removed object */
static void
-dn_query_query_done_cb (CalQuery *query, CalQueryDoneStatus status, const char *error_str,
- gpointer data)
+dn_query_objects_removed_cb (CalQuery *query, GList *uids, gpointer data)
{
GnomeCalendar *gcal;
gcal = GNOME_CALENDAR (data);
- /* FIXME */
-
- if (status != CAL_QUERY_DONE_SUCCESS)
- fprintf (stderr, "query done: %s\n", error_str);
+ /* Just retag the whole thing */
+ update_query (gcal);
}
-/* Callback used when the calendar query reports an evaluation error */
+/* Callback used when the calendar query is done */
static void
-dn_query_eval_error_cb (CalQuery *query, const char *error_str, gpointer data)
+dn_query_done_cb (CalQuery *query, ECalendarStatus status, gpointer data)
{
GnomeCalendar *gcal;
gcal = GNOME_CALENDAR (data);
- /* FIXME */
-
- fprintf (stderr, "eval error: %s\n", error_str);
+ /* FIXME Better error reporting */
+ if (status != E_CALENDAR_STATUS_OK)
+ g_warning (G_STRLOC ": Query did not successfully complete");
}
/* Returns the current view widget, a EDayView or EWeekView. */
@@ -635,22 +600,24 @@ update_query (GnomeCalendar *gcal)
/* create queries for each loaded client */
client_list = e_cal_model_get_client_list (e_cal_view_get_model (E_CAL_VIEW (priv->day_view)));
for (l = client_list; l != NULL; l = l->next) {
- old_query = cal_client_get_query ((CalClient *) l->data, real_sexp);
- if (!old_query) {
- g_message ("update_query(): Could not create the query");
+ if (!cal_client_get_query ((CalClient *) l->data, real_sexp, &old_query, NULL)) {
+ g_warning (G_STRLOC ": Could not create the query");
+
continue;
}
- g_signal_connect (old_query, "obj_updated",
- G_CALLBACK (dn_query_obj_updated_cb), gcal);
- g_signal_connect (old_query, "obj_removed",
- G_CALLBACK (dn_query_obj_removed_cb), gcal);
+ g_signal_connect (old_query, "objects_added",
+ G_CALLBACK (dn_query_objects_added_cb), gcal);
+ g_signal_connect (old_query, "objects_modified",
+ G_CALLBACK (dn_query_objects_modified_cb), gcal);
+ g_signal_connect (old_query, "objects_removed",
+ G_CALLBACK (dn_query_objects_removed_cb), gcal);
g_signal_connect (old_query, "query_done",
- G_CALLBACK (dn_query_query_done_cb), gcal);
- g_signal_connect (old_query, "eval_error",
- G_CALLBACK (dn_query_eval_error_cb), gcal);
+ G_CALLBACK (dn_query_done_cb), gcal);
priv->dn_queries = g_list_append (priv->dn_queries, old_query);
+
+ cal_query_start (old_query);
}
g_list_free (client_list);
@@ -992,8 +959,6 @@ gnome_calendar_init (GnomeCalendar *gcal)
priv->visible_start = -1;
priv->visible_end = -1;
-
- priv->exp_queries = NULL;
}
/* Frees a set of categories */
@@ -1085,19 +1050,6 @@ gnome_calendar_destroy (GtkObject *object)
priv->view_menus = NULL;
}
- if (priv->exp_queries) {
- GList *l;
-
- for (l = priv->exp_queries; l != NULL; l = l->next) {
- g_signal_handlers_disconnect_matched ((CalQuery *) l->data, G_SIGNAL_MATCH_DATA,
- 0, 0, NULL, NULL, gcal);
- g_object_unref (l->data);
- }
-
- g_list_free (priv->exp_queries);
- priv->exp_queries = NULL;
- }
-
g_free (priv);
gcal->priv = NULL;
}
@@ -1718,7 +1670,8 @@ client_cal_opened_cb (CalClient *client, CalClientOpenStatus status, gpointer da
case CAL_CLIENT_OPEN_SUCCESS:
/* Set the client's default timezone, if we have one. */
if (priv->zone) {
- cal_client_set_default_timezone (client, priv->zone);
+ /* FIXME Error checking */
+ cal_client_set_default_timezone (client, priv->zone, NULL);
}
/* add the alarms for this client */
@@ -2104,9 +2057,7 @@ gnome_calendar_open (GnomeCalendar *gcal, const char *str_uri)
{
GnomeCalendarPrivate *priv;
gboolean success;
- EUri *uri;
char *message;
- char *real_uri;
char *urinopwd;
CalClient *client;
@@ -2120,12 +2071,6 @@ gnome_calendar_open (GnomeCalendar *gcal, const char *str_uri)
cal_client_get_load_state (priv->task_pad_client) == CAL_CLIENT_LOAD_NOT_LOADED,
FALSE);
- uri = e_uri_new (str_uri);
- if (!uri || !g_strncasecmp (uri->protocol, "file", 4))
- real_uri = g_concat_dir_and_file (str_uri, "calendar.ics");
- else
- real_uri = g_strdup (str_uri);
-
urinopwd = get_uri_without_password (str_uri);
message = g_strdup_printf (_("Opening calendar at %s"), urinopwd);
g_free (urinopwd);
@@ -2138,7 +2083,7 @@ gnome_calendar_open (GnomeCalendar *gcal, const char *str_uri)
g_signal_connect (G_OBJECT (client), "categories_changed", G_CALLBACK (client_categories_changed_cb), gcal);
g_signal_connect (G_OBJECT (client), "backend_died", G_CALLBACK (backend_died_cb), gcal);
- if (!cal_client_open_calendar (client, real_uri, FALSE)) {
+ if (!cal_client_open_calendar (client, str_uri, FALSE)) {
g_warning (G_STRLOC ": Could not issue the request to open the calendar folder");
g_object_unref (client);
e_cal_view_set_status_message (E_CAL_VIEW (priv->week_view), NULL);
@@ -2151,9 +2096,6 @@ gnome_calendar_open (GnomeCalendar *gcal, const char *str_uri)
_("Opening default tasks folder"));
success = cal_client_open_default_tasks (priv->task_pad_client, FALSE);
- g_free (real_uri);
- e_uri_free (uri);
-
if (!success) {
g_message ("gnome_calendar_open(): Could not issue the request to open the tasks folder");
e_calendar_table_set_status_message (E_CALENDAR_TABLE (priv->todo), NULL);
@@ -2262,7 +2204,8 @@ gnome_calendar_update_config_settings (GnomeCalendar *gcal,
CalClient *client = l->data;
if (cal_client_get_load_state (client) == CAL_CLIENT_LOAD_LOADED)
- cal_client_set_default_timezone (client, priv->zone);
+ /* FIXME Error checking */
+ cal_client_set_default_timezone (client, priv->zone, NULL);
}
g_list_free (client_list);
@@ -2270,8 +2213,9 @@ gnome_calendar_update_config_settings (GnomeCalendar *gcal,
if (priv->task_pad_client
&& cal_client_get_load_state (priv->task_pad_client) == CAL_CLIENT_LOAD_LOADED) {
+ /* FIXME Error Checking */
cal_client_set_default_timezone (priv->task_pad_client,
- priv->zone);
+ priv->zone, NULL);
}
e_cal_view_set_timezone (E_CAL_VIEW (priv->day_view), priv->zone);
@@ -2544,8 +2488,8 @@ gnome_calendar_get_visible_time_range (GnomeCalendar *gcal,
priv = gcal->priv;
- retval = e_cal_view_get_visible_time_range (E_CAL_VIEW (gnome_calendar_get_current_view_widget (gcal)),
- start_time, end_time);
+ e_cal_view_get_visible_time_range (E_CAL_VIEW (gnome_calendar_get_current_view_widget (gcal)),
+ start_time, end_time);
return retval;
}
@@ -2961,136 +2905,17 @@ gnome_calendar_delete_selected_occurrence (GnomeCalendar *gcal)
}
}
-void
-gnome_calendar_unrecur_selection (GnomeCalendar *gcal)
-{
- GnomeCalendarPrivate *priv;
- FocusLocation location;
- GtkWidget *view;
-
- g_return_if_fail (GNOME_IS_CALENDAR (gcal));
-
- priv = gcal->priv;
-
- location = get_focus_location (gcal);
-
- if (location == FOCUS_CALENDAR) {
-
- view = gnome_calendar_get_current_view_widget (gcal);
-
- if (E_IS_DAY_VIEW (view))
- e_day_view_unrecur_appointment (E_DAY_VIEW (view));
- else
- e_week_view_unrecur_appointment (E_WEEK_VIEW (view));
- }
-}
-
-typedef struct {
- gboolean remove;
- GnomeCalendar *gcal;
-} obj_updated_closure;
-
static gboolean
check_instance_cb (CalComponent *comp,
time_t instance_start,
time_t instance_end,
gpointer data)
{
- obj_updated_closure *closure = data;
+ gboolean *remove = data;
- if (instance_start >= closure->gcal->priv->exp_older_than ||
- instance_end >= closure->gcal->priv->exp_older_than) {
- closure->remove = FALSE;
- return FALSE;
- }
+ *remove = FALSE;
- closure->remove = TRUE;
- return TRUE;
-}
-
-static void
-purging_obj_updated_cb (CalQuery *query, const char *uid,
- gboolean query_in_progress, int n_scanned, int total,
- gpointer data)
-{
- GnomeCalendarPrivate *priv;
- GnomeCalendar *gcal = data;
- CalComponent *comp;
- icalcomponent *icalcomp;
- obj_updated_closure closure;
- gchar *msg;
-
- priv = gcal->priv;
-
- if (cal_client_get_object (cal_query_get_client (query), uid, &icalcomp) != CAL_CLIENT_GET_SUCCESS)
- return;
-
- comp = cal_component_new ();
- if (!cal_component_set_icalcomponent (comp, icalcomp)) {
- g_object_unref (comp);
- icalcomponent_free (icalcomp);
- return;
- }
-
- msg = g_strdup_printf (_("Purging event %s"), uid);
-
- /* further filter the event, to check the last recurrence end date */
- if (cal_component_has_recurrences (comp)) {
- closure.remove = TRUE;
- closure.gcal = gcal;
-
- cal_recur_generate_instances (comp, priv->exp_older_than, -1,
- (CalRecurInstanceFn) check_instance_cb,
- &closure,
- (CalRecurResolveTimezoneFn) cal_client_resolve_tzid_cb,
- cal_query_get_client (query), priv->zone);
-
- if (closure.remove) {
- e_cal_view_set_status_message (E_CAL_VIEW (priv->week_view), msg);
- delete_error_dialog (cal_client_remove_object (cal_query_get_client (query), uid),
- CAL_COMPONENT_EVENT);
- }
- } else {
- e_cal_view_set_status_message (E_CAL_VIEW (priv->week_view), msg);
- delete_error_dialog (cal_client_remove_object (cal_query_get_client (query), uid), CAL_COMPONENT_EVENT);
- }
-
- g_object_unref (comp);
- g_free (msg);
-}
-
-static void
-purging_eval_error_cb (CalQuery *query, const char *error_str, gpointer data)
-{
- GnomeCalendarPrivate *priv;
- GnomeCalendar *gcal = data;
-
- priv = gcal->priv;
-
- e_cal_view_set_status_message (E_CAL_VIEW (priv->week_view), NULL);
-
- g_signal_handlers_disconnect_matched (query, G_SIGNAL_MATCH_DATA,
- 0, 0, NULL, NULL, gcal);
-
- priv->exp_queries = g_list_remove (priv->exp_queries, query);
- g_object_unref (query);
-}
-
-static void
-purging_query_done_cb (CalQuery *query, CalQueryDoneStatus status, const char *error_str, gpointer data)
-{
- GnomeCalendarPrivate *priv;
- GnomeCalendar *gcal = data;
-
- priv = gcal->priv;
-
- e_cal_view_set_status_message (E_CAL_VIEW (priv->week_view), NULL);
-
- g_signal_handlers_disconnect_matched (query, G_SIGNAL_MATCH_DATA,
- 0, 0, NULL, NULL, gcal);
-
- priv->exp_queries = g_list_remove (priv->exp_queries, query);
- g_object_unref (query);
+ return FALSE;
}
void
@@ -3104,11 +2929,6 @@ gnome_calendar_purge (GnomeCalendar *gcal, time_t older_than)
priv = gcal->priv;
- /* if we have a query, we are already purging */
- if (priv->exp_queries)
- return;
-
- priv->exp_older_than = older_than;
start = isodate_from_time_t (0);
end = isodate_from_time_t (older_than);
sexp = g_strdup_printf ("(and (= (get-vtype) \"VEVENT\")"
@@ -3118,27 +2938,47 @@ gnome_calendar_purge (GnomeCalendar *gcal, time_t older_than)
e_cal_view_set_status_message (E_CAL_VIEW (priv->week_view), _("Purging"));
+ /* FIXME Confirm expunge */
+
client_list = e_cal_model_get_client_list (e_cal_view_get_model (E_CAL_VIEW (priv->week_view)));
for (l = client_list; l != NULL; l = l->next) {
- CalQuery *exp_query;
-
- if (cal_client_is_read_only ((CalClient *) l->data))
+ CalClient *client = l->data;
+ GList *objects, *l;
+ gboolean read_only = TRUE;
+
+ cal_client_is_read_only (client, &read_only, NULL);
+ if (!read_only)
continue;
-
- exp_query = cal_client_get_query ((CalClient *) l->data, sexp);
- if (!exp_query) {
- e_cal_view_set_status_message (E_CAL_VIEW (priv->week_view), NULL);
- g_message ("gnome_calendar_purge(): Could not create the query");
+
+ if (!cal_client_get_object_list (client, sexp, &objects, NULL)) {
+ g_warning (G_STRLOC ": Could not get the objects");
+
continue;
}
-
- g_signal_connect (exp_query, "obj_updated", G_CALLBACK (purging_obj_updated_cb), gcal);
- g_signal_connect (exp_query, "query_done", G_CALLBACK (purging_query_done_cb), gcal);
- g_signal_connect (exp_query, "eval_error", G_CALLBACK (purging_eval_error_cb), gcal);
-
- priv->exp_queries = g_list_append (priv->exp_queries, exp_query);
+
+ for (l = objects; l; l = l->next) {
+ CalComponent *comp;
+ gboolean remove = TRUE;
+
+ comp = cal_component_new ();
+ cal_component_set_icalcomponent (comp, icalcomponent_new_clone (l->data));
+
+ cal_recur_generate_instances (comp, older_than, -1,
+ (CalRecurInstanceFn) check_instance_cb,
+ &remove,
+ (CalRecurResolveTimezoneFn) cal_client_resolve_tzid_cb,
+ client, priv->zone);
+
+ /* FIXME Better error handling */
+ if (remove)
+ cal_client_remove_object (client, icalcomponent_get_uid (l->data), NULL);
+
+ g_object_unref (comp);
+ }
}
+ e_cal_view_set_status_message (E_CAL_VIEW (priv->week_view), NULL);
+
g_list_free (client_list);
g_free (sexp);
g_free (start);
@@ -3154,26 +2994,3 @@ gnome_calendar_get_task_pad (GnomeCalendar *gcal)
return E_CALENDAR_TABLE (gcal->priv->todo);
}
-GtkWidget *
-gnome_calendar_get_e_calendar_widget (GnomeCalendar *gcal)
-{
- g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), NULL);
-
- return GTK_WIDGET(gcal->priv->date_navigator);
-}
-
-GtkWidget *
-gnome_calendar_get_search_bar_widget (GnomeCalendar *gcal)
-{
- g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), NULL);
-
- return GTK_WIDGET(gcal->priv->search_bar);
-}
-
-GtkWidget *
-gnome_calendar_get_view_notebook_widget (GnomeCalendar *gcal)
-{
- g_return_val_if_fail (GNOME_IS_CALENDAR (gcal), NULL);
-
- return GTK_WIDGET(gcal->priv->notebook);
-}
diff --git a/calendar/gui/gnome-cal.h b/calendar/gui/gnome-cal.h
index ff5b1a6bd0..459bbbf667 100644
--- a/calendar/gui/gnome-cal.h
+++ b/calendar/gui/gnome-cal.h
@@ -87,7 +87,7 @@ struct _GnomeCalendarClass {
void (* calendar_focus_change) (GnomeCalendar *gcal, gboolean in);
void (* taskpad_focus_change) (GnomeCalendar *gcal, gboolean in);
- void (* goto_date) (GnomeCalendar *gcal,
+ void (* goto_date) (GnomeCalendar *day_view,
GnomeCalendarGotoDateType date);
};
@@ -125,12 +125,6 @@ void gnome_calendar_set_view (GnomeCalendar *gcal, GnomeCalendarViewType view_ty
gboolean range_selected, gboolean grab_focus);
GtkWidget *gnome_calendar_get_current_view_widget (GnomeCalendar *gcal);
-
-ECalendarTable *gnome_calendar_get_task_pad (GnomeCalendar *gcal);
-GtkWidget *gnome_calendar_get_e_calendar_widget (GnomeCalendar *gcal);
-GtkWidget *gnome_calendar_get_search_bar_widget (GnomeCalendar *gcal);
-GtkWidget *gnome_calendar_get_view_notebook_widget (GnomeCalendar *gcal);
-
void gnome_calendar_setup_view_menus (GnomeCalendar *gcal, BonoboUIComponent *uic);
void gnome_calendar_discard_view_menus (GnomeCalendar *gcal);
@@ -192,7 +186,6 @@ void gnome_calendar_paste_clipboard (GnomeCalendar *gcal);
void gnome_calendar_delete_selection (GnomeCalendar *gcal);
void gnome_calendar_delete_selected_occurrence (GnomeCalendar *gcal);
-void gnome_calendar_unrecur_selection (GnomeCalendar *gcal);
void gnome_calendar_purge (GnomeCalendar *gcal,
time_t older_than);
diff --git a/calendar/gui/itip-utils.c b/calendar/gui/itip-utils.c
index 366261ecff..f12c6c7202 100644
--- a/calendar/gui/itip-utils.c
+++ b/calendar/gui/itip-utils.c
@@ -98,12 +98,14 @@ itip_organizer_is_user (CalComponent *comp, CalClient *client)
strip = itip_strip_mailto (organizer.value);
if (cal_client_get_static_capability (client, CAL_STATIC_CAPABILITY_ORGANIZER_NOT_EMAIL_ADDRESS)) {
- const char *email;
+ char *email;
- email = cal_client_get_cal_address (client);
- if (email && !g_strcasecmp (email, strip))
+ if (cal_client_get_cal_address (client, &email, NULL) && !g_strcasecmp (email, strip)) {
+ g_free (email);
+
return TRUE;
-
+ }
+
return FALSE;
}
@@ -185,8 +187,8 @@ foreach_tzid_callback (icalparameter *param, gpointer data)
zone = icalcomponent_get_timezone (tz_data->zones, tzid);
if (zone == NULL)
zone = icaltimezone_get_builtin_timezone_from_tzid (tzid);
- if (zone == NULL && tz_data->client != NULL)
- cal_client_get_timezone (tz_data->client, tzid, &zone);
+ if (zone == NULL && tz_data->client != NULL)
+ cal_client_get_timezone (tz_data->client, tzid, &zone, NULL);
if (zone == NULL)
return;
@@ -528,28 +530,23 @@ static gboolean
comp_server_send (CalComponentItipMethod method, CalComponent *comp, CalClient *client,
icalcomponent *zones, GList **users)
{
- CalClientSendResult result;
- icalcomponent *top_level, *new_top_level = NULL;
- char *error_msg;
+ icalcomponent *top_level;
gboolean retval = TRUE;
+ GError *error = NULL;
top_level = comp_toplevel_with_zones (method, comp, client, zones);
- result = cal_client_send_object (client, top_level, &new_top_level, users, &error_msg);
-
- if (result == CAL_CLIENT_SEND_SUCCESS) {
- icalcomponent *ical_comp;
-
- ical_comp = icalcomponent_get_inner (new_top_level);
- icalcomponent_remove_component (new_top_level, ical_comp);
- cal_component_set_icalcomponent (comp, ical_comp);
- icalcomponent_free (new_top_level);
- } else if (result == CAL_CLIENT_SEND_BUSY) {
- e_notice (NULL, GTK_MESSAGE_ERROR, error_msg);
-
- g_free (error_msg);
- retval = FALSE;
+ if (!cal_client_send_objects (client, top_level, &error)) {
+ /* FIXME Really need a book problem status code */
+ if (error->code != E_CALENDAR_STATUS_OK) {
+ /* FIXME Better error message */
+ e_notice (NULL, GTK_MESSAGE_ERROR, "Unable to book");
+
+ retval = FALSE;
+ }
}
+ g_clear_error (&error);
+
icalcomponent_free (top_level);
return retval;
@@ -755,7 +752,8 @@ comp_compliant (CalComponentItipMethod method, CalComponent *comp, CalClient *cl
if (from_zone == NULL)
from_zone = icaltimezone_get_builtin_timezone_from_tzid (dt.tzid);
if (from_zone == NULL && client != NULL)
- cal_client_get_timezone (client, dt.tzid, &from_zone);
+ /* FIXME Error checking */
+ cal_client_get_timezone (client, dt.tzid, &from_zone, NULL);
}
to_zone = icaltimezone_get_utc_timezone ();
diff --git a/calendar/gui/print.c b/calendar/gui/print.c
index 6aeb9f6566..9f6133c683 100644
--- a/calendar/gui/print.c
+++ b/calendar/gui/print.c
@@ -522,6 +522,16 @@ format_date(time_t time, int flags, char *buffer, int bufflen)
return buffer;
}
+static gboolean
+instance_cb (CalComponent *comp, time_t instance_start, time_t instance_end, gpointer data)
+{
+ gboolean *found = data;
+
+ *found = TRUE;
+
+ return FALSE;
+}
+
/*
print out the month small, embolden any days with events.
@@ -625,16 +635,16 @@ print_month_small (GnomePrintContext *pc, GnomeCalendar *gcal, time_t month,
day = days[y * 7 + x];
if (day != 0) {
- GList *uids;
+ gboolean found = FALSE;
sprintf (buf, "%d", day);
/* this is a slow messy way to do this ... but easy ... */
- uids = cal_client_get_objects_in_range (client,
- CALOBJ_TYPE_EVENT,
- now, time_day_end_with_zone (now, zone));
- font = uids ? font_bold : font_normal;
- cal_obj_uid_list_free (uids);
+ cal_client_generate_instances (client, now, CALOBJ_TYPE_EVENT,
+ time_day_end_with_zone (now, zone),
+ instance_cb, &found);
+
+ font = found ? font_bold : font_normal;
next = time_add_day_with_zone (now, 1, zone);
if ((now >= greystart && now < greyend)
@@ -2161,11 +2171,8 @@ get_zone_from_tzid (CalClient *client, const char *tzid)
the builtin timezone with the TZID first. */
zone = icaltimezone_get_builtin_timezone_from_tzid (tzid);
if (!zone) {
- CalClientGetStatus status;
-
- status = cal_client_get_timezone (client, tzid, &zone);
- /* FIXME: Handle error better. */
- if (status != CAL_CLIENT_GET_SUCCESS)
+ if (!cal_client_get_timezone (client, tzid, &zone, NULL))
+ /* FIXME: Handle error better. */
g_warning ("Couldn't get timezone from server: %s",
tzid ? tzid : "");
}
diff --git a/calendar/gui/tag-calendar.c b/calendar/gui/tag-calendar.c
index 03e0b3dee4..147a69f246 100644
--- a/calendar/gui/tag-calendar.c
+++ b/calendar/gui/tag-calendar.c
@@ -162,7 +162,6 @@ resolve_tzid_cb (const char *tzid, gpointer data)
{
CalClient *client;
icaltimezone *zone = NULL;
- CalClientGetStatus status;
g_return_val_if_fail (data != NULL, NULL);
g_return_val_if_fail (IS_CAL_CLIENT (data), NULL);
@@ -174,7 +173,7 @@ resolve_tzid_cb (const char *tzid, gpointer data)
if (!zone) {
/* FIXME: Handle errors. */
- status = cal_client_get_timezone (client, tzid, &zone);
+ cal_client_get_timezone (client, tzid, &zone, NULL);
}
return zone;
diff --git a/calendar/gui/tasks-control.c b/calendar/gui/tasks-control.c
index 5ed9faa0d6..d97ed2d585 100644
--- a/calendar/gui/tasks-control.c
+++ b/calendar/gui/tasks-control.c
@@ -235,12 +235,12 @@ static void
sensitize_commands (ETasks *tasks, BonoboControl *control, int n_selected)
{
BonoboUIComponent *uic;
- gboolean read_only;
+ gboolean read_only = TRUE;
uic = bonobo_control_get_ui_component (control);
g_assert (uic != NULL);
- read_only = cal_client_is_read_only (e_tasks_get_cal_client (tasks));
+ cal_client_is_read_only (e_tasks_get_cal_client (tasks), &read_only, NULL);
bonobo_ui_component_set_prop (uic, "/commands/TasksCut", "sensitive",
n_selected == 0 || read_only ? "0" : "1",
diff --git a/calendar/idl/evolution-calendar.idl b/calendar/idl/evolution-calendar.idl
index 15b27e806a..44762fc086 100644
--- a/calendar/idl/evolution-calendar.idl
+++ b/calendar/idl/evolution-calendar.idl
@@ -23,9 +23,14 @@ module Calendar {
typedef string CalObj;
typedef sequence<CalObj> CalObjSeq;
+ typedef sequence<string> stringlist;
+
/* A unique identifier for a calendar component */
typedef string CalObjUID;
+ /* A unique identified for an event recurrence */
+ typedef string CalRecurID;
+
/* Simple sequence of strings */
typedef sequence<string> StringSeq;
@@ -66,14 +71,6 @@ module Calendar {
const CalObjChangeType ADDED = 1 << 0;
const CalObjChangeType MODIFIED = 1 << 1;
const CalObjChangeType DELETED = 1 << 2;
-
- /* Types of alarms */
- enum AlarmType {
- MAIL,
- PROGRAM,
- DISPLAY,
- AUDIO
- };
/* Used to store a time_t */
typedef unsigned long Time_t;
@@ -102,30 +99,39 @@ module Calendar {
/* Used to transfer a list of changed components */
typedef sequence<CalObjChange> CalObjChangeSeq;
- /* An alarm trigger instance */
- struct CalAlarmInstance {
- CalAlarmUID auid;
- Time_t trigger;
- Time_t occur_start;
- Time_t occur_end;
- };
-
- /* Used to represent a list of alarm triggers for a single component */
- typedef sequence<CalAlarmInstance> CalAlarmInstanceSeq;
-
- /* Alarms for a component */
- struct CalComponentAlarms {
- CalObj calobj;
- CalAlarmInstanceSeq alarms;
- };
-
- /* Used to represent a list of components plus their triggers */
- typedef sequence<CalComponentAlarms> CalComponentAlarmsSeq;
-
/* Used to represent users and lists of users */
typedef string User;
typedef sequence<User> UserList;
+ enum CallStatus {
+ Success,
+ RepositoryOffline,
+ PermissionDenied,
+ InvalidRange,
+ ObjectNotFound,
+ InvalidObject,
+ CardIdAlreadyExists,
+ AuthenticationFailed,
+ AuthenticationRequired,
+ UnsupportedField,
+ UnsupportedMethod,
+ UnsupportedAuthenticationMethod,
+ TLSNotAvailable,
+ NoSuchCal,
+
+ /* These can be returned for successful searches, but
+ indicate the result set was truncated */
+ SearchSizeLimitExceeded,
+ SearchTimeLimitExceeded,
+
+ InvalidQuery,
+ QueryRefused,
+
+ CouldNotCancel,
+
+ OtherError
+ };
+
interface Query;
interface Listener;
@@ -136,134 +142,68 @@ module Calendar {
interface Cal : Bonobo::Unknown {
exception NotFound {};
exception InvalidRange {};
- exception InvalidObject {};
- exception CouldNotCreate {};
- exception PermissionDenied {};
- exception Busy {string errorMsg;};
/* A calendar is identified by its URI */
readonly attribute string uri;
+ oneway void open (in boolean only_if_exists);
+ oneway void remove ();
+
/* Check write permissions for calendar */
- boolean isReadOnly ();
+ oneway void isReadOnly ();
/* Information on the backend's capabilities */
- string getStaticCapabilities ();
+ oneway void getStaticCapabilities ();
- /* Return the cal address associated with this calendar,
- if any. */
- string getCalAddress ()
- raises (NotFound);
+ /* Return the cal address associated with this calendar, if any. */
+ oneway void getCalAddress ();
- string getAlarmEmailAddress ()
- raises (NotFound);
+ oneway void getAlarmEmailAddress ();
/* Returns the LDAP attribute to get attendees from */
- string getLdapAttribute ()
- raises (NotFound);
+ oneway void getLdapAttribute ();
/* For going online/offline */
void setMode (in CalMode mode);
-
- /* Gets the number of components of the specified types */
- long countObjects (in CalObjType type);
/* Get a default object of a given type */
- CalObj getDefaultObject (in CalObjType type);
+ oneway void getDefaultObject (in CalObjType type);
/* Gets a component based on its URI */
- CalObj getObject (in CalObjUID uid)
- raises (NotFound);
-
- /* Sets the default timezone to be used for resolving DATE
- and floating DATE-TIME values. */
- void setDefaultTimezone (in CalTimezoneObjUID tzid)
- raises (NotFound);
+ oneway void getObject (in CalObjUID uid, in CalRecurID rid);
- /* Gets a VTIMEZONE component based on its TZID */
- CalTimezoneObj getTimezoneObject (in CalTimezoneObjUID tzid)
- raises (NotFound);
+ oneway void getObjectList (in string query);
- /* Gets a list of UIDs based on component type */
- CalObjUIDSeq getUIDs (in CalObjType type);
+ /* Methods for manipulating timezones */
+ oneway void getTimezone (in CalTimezoneObjUID tzid);
+ oneway void addTimezone (in CalTimezoneObj tz);
+ /* The timezone used to resolve DATE and floating DATE-TIME values. */
+ oneway void setDefaultTimezone (in CalTimezoneObjUID tzid);
/* Gets a list of components that changed based on object type */
- CalObjChangeSeq getChanges (in CalObjType type, in string change_id);
-
- /* Gets a list of components that occur or recur in the specified time range */
- CalObjUIDSeq getObjectsInRange (in CalObjType type,
- in Time_t start, in Time_t end)
- raises (InvalidRange);
-
- /* Gets a list of the components that have alarms that trigger
- * in the specified range of time, and the trigger/occurrence
- * structures themselves.
- */
- CalComponentAlarmsSeq getAlarmsInRange (in Time_t start, in Time_t end)
- raises (NotFound, InvalidRange);
+ oneway void getChanges (in CalObjType type, in string change_id);
/* Returns free/busy objects for the given interval */
- CalObjSeq getFreeBusy (in UserList users, in Time_t start, in Time_t end)
- raises (NotFound, InvalidRange);
-
- /* Gets the alarms for the specified component that trigger in
- * the specified time range.
- */
- CalComponentAlarms getAlarmsForObject (in CalObjUID uid,
- in Time_t start, in Time_t end)
- raises (NotFound, InvalidRange);
-
+ oneway void getFreeBusy (in UserList users, in Time_t start, in Time_t end);
/* Discards an alarm from a given component */
- void discardAlarm (in CalObjUID uid, in CalAlarmUID auid)
- raises (NotFound);
-
- /* Adds or updates one or more VEVENT/VTODO/VTIMEZONE
- * components. The calobj should be a string representation of
- * a complete VCALENDAR object (we also support single
- * VEVENT/VTODO strings, but that is deprecated).
- *
- * The VTIMEZONE data will be merged into the calendar,
- * possibly by renaming TZIDs (though not for builtin
- * VTIMEZONEs, which have unique TZIDs), so don't rely on the
- * TZIDs being the same in the new object on the server.
- *
- * The client should probably immediately free its copy of the
- * object after this call, and call getObject to get the
- * updated version.
- */
- void updateObjects (in CalObj calobj, in CalObjModType mod)
- raises (NotFound, InvalidObject, PermissionDenied);
+ oneway void discardAlarm (in CalObjUID uid, in CalAlarmUID auid);
- /* Removes a component */
- void removeObject (in CalObjUID uid, in CalObjModType mod)
- raises (NotFound, PermissionDenied);
+ /* Methods for manipulating iCalendar objects */
+ oneway void createObject (in CalObj calobj);
+ oneway void modifyObject (in CalObj calobj, in CalObjModType mod);
+ oneway void removeObject (in CalObjUID uid, in CalObjModType mod);
- /* Sends a component */
- CalObj sendObject (in CalObj calobj, out UserList users)
- raises (InvalidObject, PermissionDenied, Busy);
+ /* Methods for getting/sending iCalendar VCALENDARS via iTip/iMip */
+ oneway void receiveObjects (in CalObj calobj);
+ oneway void sendObjects (in CalObj calobj);
- /* Initiates a live query of the calendar. Returns a handle
- * to the live query itself; changes to components that are
- * present in the query are notified to the listener.
- */
- Query getQuery (in string sexp, in QueryListener ql)
- raises (CouldNotCreate);
+ /* Query methods */
+ oneway void getQuery (in string sexp, in QueryListener ql);
};
/* Listener for changes in a calendar */
interface Listener : Bonobo::Unknown {
- /* Return status when opening a calendar */
- enum OpenStatus {
- SUCCESS, /* All OK */
- ERROR, /* Generic error */
- NOT_FOUND, /* Requested opening in only_if_exists mode
- * when the URI did not exist.
- */
- METHOD_NOT_SUPPORTED, /* A method handler is not registered */
- PERMISSION_DENIED
- };
-
/* Return status when setting calendar mode */
enum SetModeStatus {
MODE_SET, /* All OK */
@@ -271,62 +211,58 @@ module Calendar {
MODE_NOT_SUPPORTED /* Mode not supported */
};
- /* Called from a CalFactory when a calendar is initially opened.
- * The listener must remember the cal object.
- */
- void notifyCalOpened (in OpenStatus status, in Cal cal);
+ oneway void notifyReadOnly (in CallStatus status, in boolean read_only);
+ oneway void notifyCalAddress (in CallStatus status, in string address);
+ oneway void notifyAlarmEmailAddress (in CallStatus status, in string address);
+ oneway void notifyLDAPAttribute (in CallStatus status, in string ldap_attribute);
+ oneway void notifyStaticCapabilities (in CallStatus status, in string capabilities);
+
+ oneway void notifyCalOpened (in CallStatus status);
+ oneway void notifyCalRemoved (in CallStatus status);
- /* Called from a Calendar when the mode is changed */
- void notifyCalSetMode (in SetModeStatus status, in CalMode mode);
+ oneway void notifyObjectCreated (in CallStatus status, in string uid);
+ oneway void notifyObjectModified (in CallStatus status);
+ oneway void notifyObjectRemoved (in CallStatus status);
+
+ oneway void notifyAlarmDiscarded (in CallStatus status);
+
+ oneway void notifyObjectsReceived (in CallStatus status);
+ oneway void notifyObjectsSent (in CallStatus status);
- /* Called from a Calendar when a component is added or changed */
- void notifyObjUpdated (in CalObjUID uid);
+ oneway void notifyDefaultObjectRequested (in CallStatus status, in CalObj object);
+ oneway void notifyObjectRequested (in CallStatus status, in CalObj object);
+ oneway void notifyObjectListRequested (in CallStatus status, in stringlist objects);
+ oneway void notifyQuery (in CallStatus status, in Query query);
+
+ oneway void notifyTimezoneRequested (in CallStatus status, in CalTimezoneObj tz);
+ oneway void notifyTimezoneAdded (in CallStatus status, in CalTimezoneObjUID tzid);
+ oneway void notifyDefaultTimezoneSet (in CallStatus status);
- /* Called from a Calendar when a component is removed */
- void notifyObjRemoved (in CalObjUID uid);
+ oneway void notifyChanges (in CallStatus status, in CalObjChangeSeq changes);
+ oneway void notifyFreeBusy (in CallStatus status, in CalObjSeq freebusy);
+
+ /* Called from a Calendar when the mode is changed */
+ oneway void notifyCalSetMode (in SetModeStatus status, in CalMode mode);
/* Called from a Calendar when the list of categories changes */
- void notifyCategoriesChanged (in StringSeq categories);
+ oneway void notifyCategoriesChanged (in StringSeq categories);
/* Called from a Calendar when there is an error not notified otherwise */
- void notifyErrorOccurred (in string message);
+ oneway void notifyErrorOccurred (in string message);
};
/* Handle to a live query on a calendar */
interface Query : Bonobo::Unknown {
+ oneway void start ();
};
/* Listener for changes in a query of a calendar */
interface QueryListener : Bonobo::Unknown {
- /* Called when components are added or changed. If
- * query_in_progress is true, then the initial query results are
- * being populated and the other arguments indicate the
- * percentage of completion Otherwise, the percent value is
- * unspecified. */
- void notifyObjUpdated (in CalObjUIDSeq uids,
- in boolean query_in_progress,
- in long n_scanned,
- in long total);
-
- /* Called when a component is removed */
- void notifyObjRemoved (in CalObjUID uid);
-
- /* Reported when a query ends */
- enum QueryDoneStatus {
- SUCCESS,
- PARSE_ERROR
- };
-
- /* Called when the query finishes populating itself some time
- * after it is created. Before this is called,
- * notifyObjUpdated() may have been called several times to
- * indicate which objects are actually in the query, unless the
- * status result is a parse error.
- */
- void notifyQueryDone (in QueryDoneStatus status, in string error_str);
-
- /* Called when an evaluation error occurs while performing a query */
- void notifyEvalError (in string error_str);
+ oneway void notifyObjectsAdded (in stringlist objects);
+ oneway void notifyObjectsModified (in stringlist objects);
+ oneway void notifyObjectsRemoved (in CalObjUIDSeq uids);
+ oneway void notifyQueryProgress (in string message, in short percent);
+ oneway void notifyQueryDone (in CallStatus status);
};
/* A calendar factory, can load and create calendars */
@@ -334,14 +270,9 @@ module Calendar {
exception NilListener {};
exception InvalidURI {};
exception UnsupportedMethod {};
- exception PermissionDenied {};
-
- /* Open a calendar from an URI */
- void open (in string uri, in boolean only_if_exists, in Listener listener)
- raises (NilListener, InvalidURI, UnsupportedMethod, PermissionDenied);
- /* List of open URI's */
- StringSeq uriList (in CalMode mode);
+ Cal getCal (in string uri, in CalObjType type, in Listener listener)
+ raises (NilListener, InvalidURI, UnsupportedMethod);
};
/* Interface to the alarm notification service */
diff --git a/calendar/importers/icalendar-importer.c b/calendar/importers/icalendar-importer.c
index 28068c11df..34e6845e02 100644
--- a/calendar/importers/icalendar-importer.c
+++ b/calendar/importers/icalendar-importer.c
@@ -179,6 +179,60 @@ prepare_tasks (icalcomponent *icalcomp, GList *vtodos)
g_list_free (vtodos);
}
+static CalClientResult
+update_single_object (CalClient *client, icalcomponent *icalcomp)
+{
+ const char *uid;
+ icalcomponent *tmp_icalcomp;
+
+ uid = icalcomponent_get_uid (icalcomp);
+
+ if (cal_client_get_object (client, uid, NULL, &tmp_icalcomp, NULL))
+ return cal_client_modify_object (client, icalcomp, CALOBJ_MOD_ALL, NULL)
+ ? CAL_CLIENT_RESULT_SUCCESS : CAL_CLIENT_RESULT_CORBA_ERROR;
+
+ return cal_client_create_object (client, icalcomp, &uid, NULL)
+ ? CAL_CLIENT_RESULT_SUCCESS : CAL_CLIENT_RESULT_CORBA_ERROR;
+}
+
+static CalClientResult
+update_objects (CalClient *client, icalcomponent *icalcomp)
+{
+ icalcomponent *subcomp;
+ icalcomponent_kind kind;
+ CalClientResult result;
+
+ kind = icalcomponent_isa (icalcomp);
+ if (kind == ICAL_VTODO_COMPONENT || kind == ICAL_VEVENT_COMPONENT)
+ return update_single_object (client, icalcomp);
+ else if (kind != ICAL_VCALENDAR_COMPONENT)
+ return CAL_CLIENT_RESULT_INVALID_OBJECT;
+
+ subcomp = icalcomponent_get_first_component (icalcomp, ICAL_ANY_COMPONENT);
+ while (subcomp) {
+ kind = icalcomponent_isa (subcomp);
+ if (kind == ICAL_VTIMEZONE_COMPONENT) {
+ icaltimezone *zone;
+
+ zone = icaltimezone_new ();
+ icaltimezone_set_component (zone, subcomp);
+
+ result = cal_client_add_timezone (client, zone, NULL);
+ icaltimezone_free (zone, 1);
+ if (result != CAL_CLIENT_RESULT_SUCCESS)
+ return result;
+ } else if (kind == ICAL_VTODO_COMPONENT ||
+ kind == ICAL_VEVENT_COMPONENT) {
+ result = update_single_object (client, subcomp);
+ if (result != CAL_CLIENT_RESULT_SUCCESS)
+ return result;
+ }
+
+ subcomp = icalcomponent_get_next_component (icalcomp, ICAL_ANY_COMPONENT);
+ }
+
+ return CAL_CLIENT_RESULT_SUCCESS;
+}
static void
process_item_fn (EvolutionImporter *importer,
@@ -220,20 +274,20 @@ process_item_fn (EvolutionImporter *importer,
contains just tasks, we strip out the VEVENTs, which do not get
imported at all. */
if (ici->folder_contains_events && ici->folder_contains_tasks) {
- if (cal_client_update_objects (ici->client, ici->icalcomp) != CAL_CLIENT_RESULT_SUCCESS)
+ if (update_objects (ici->client, ici->icalcomp) != CAL_CLIENT_RESULT_SUCCESS)
result = GNOME_Evolution_ImporterListener_BAD_DATA;
} else if (ici->folder_contains_events) {
GList *vtodos = prepare_events (ici->icalcomp);
- if (cal_client_update_objects (ici->client, ici->icalcomp) != CAL_CLIENT_RESULT_SUCCESS)
+ if (update_objects (ici->client, ici->icalcomp) != CAL_CLIENT_RESULT_SUCCESS)
result = GNOME_Evolution_ImporterListener_BAD_DATA;
prepare_tasks (ici->icalcomp, vtodos);
- if (cal_client_update_objects (ici->tasks_client,
+ if (update_objects (ici->tasks_client,
ici->icalcomp) != CAL_CLIENT_RESULT_SUCCESS)
result = GNOME_Evolution_ImporterListener_BAD_DATA;
} else {
prepare_tasks (ici->icalcomp, NULL);
- if (cal_client_update_objects (ici->client, ici->icalcomp) != CAL_CLIENT_RESULT_SUCCESS)
+ if (update_objects (ici->client, ici->icalcomp) != CAL_CLIENT_RESULT_SUCCESS)
result = GNOME_Evolution_ImporterListener_BAD_DATA;
}
@@ -598,7 +652,7 @@ gnome_calendar_import_data_fn (EvolutionIntelligentImporter *ii,
/* Import the calendar events. */
/* FIXME: What do intelligent importers do about errors? */
if (ici->do_calendar)
- cal_client_update_objects (calendar_client, icalcomp);
+ update_objects (calendar_client, icalcomp);
/*
@@ -606,7 +660,7 @@ gnome_calendar_import_data_fn (EvolutionIntelligentImporter *ii,
*/
prepare_tasks (icalcomp, vtodos);
if (ici->do_tasks)
- cal_client_update_objects (tasks_client, icalcomp);
+ update_objects (tasks_client, icalcomp);
out:
if (icalcomp)
diff --git a/data/evolution.desktop.in b/data/evolution.desktop.in
index 2fc62f6993..d8fada2802 100644
--- a/data/evolution.desktop.in
+++ b/data/evolution.desktop.in
@@ -1,8 +1,8 @@
[Desktop Entry]
_Name=Ximian Evolution
_Comment=The Evolution groupware suite
-Exec=evolution-1.4
-Icon=evolution-1.4.png
+Exec=evolution-1.5
+Icon=evolution-1.5.png
Terminal=false
Type=Application
Categories=GNOME;Application;Office;X-Red-Hat-Base;
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 38ee4c5d26..5475dba8d1 100644
--- a/e-util/ChangeLog
+++ b/e-util/ChangeLog
@@ -1,58 +1,6 @@
-2003-09-25 Jeffrey Stedfast <fejj@ximian.com>
+2003-08-13 JP Rosevear <jpr@ximian.com>
- * e-host-utils.c (e_gethostbyaddr_r): Make sure that
- res->ai_canonname is non-NULL and that it doesn't match the
- numeric host address that we were trying to resolve. Fixes the
- second half of bug #46006.
-
-2003-09-19 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-host-utils.c (e_gethostbyaddr_r): Work around a bug in glibc
- 2.3.2's gethostbyaddr_r() implementation.
-
-2003-09-11 Dan Winship <danw@ximian.com>
-
- * Makefile.am (noinst_LTLIBRARIES): Remove libeutil-static.la and
- libeconduit-static.la
-
- * ename/Makefile.am (noinst_LTLIBRARIES): Remove
- libename-static.la
-
-2003-08-28 Hans Petter Jansson <hpj@ximian.com>
-
- * eggtrayicon.[ch]: Added for tray icon support. To be removed when
- libgnomeui sports this functionality.
-
- * Makefile.am: Include eggtrayicon.
-
-2003-08-27 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-mktemp.c (e_mktemp_cleanup): We need to unlink the full paths
- in the tmpdirs, not just the base path.
-
-2003-08-20 Suresh Chandrasekharan <suresh.chandrasekharan@sun.com>
-
- * e-time-utils.c (parse_with_strptime): Fixes #43558 Appointment
- Editor always gives time validation error for apptmnts in non
- UTF-8/non ASCII locales.
-
-2003-08-11 Not Zed <NotZed@Ximian.com>
-
- * e-msgport.c (e_thread_put): check pthread_create return code
- properly.
- (e_mutex_lock): check pthread* return codes properly.
- (e_mutex_unlock): Same here.
- (e_mutex_cond_wait): and here.
-
-2003-08-05 Dan Winship <danw@ximian.com>
-
- * e-html-utils.c (special_chars): add a flag for non-url chars
- (controls, whitespace, ", and |)
- (url_extract): Use that. When urlifying just a hostname, make sure
- it really is a hostname, and not just something like "www.c".
- (e_text_to_html_full): Deal with url_extract returning NULL in the
- "www." case
- (main): add a regression test, #ifdef E_HTML_UTILS_TEST
+ * Makefile.am: remove db3 hash stuff
2003-07-24 Rodrigo Moya <rodrigo@ximian.com>
diff --git a/e-util/Makefile.am b/e-util/Makefile.am
index 61c49ed99c..068a5a4a11 100644
--- a/e-util/Makefile.am
+++ b/e-util/Makefile.am
@@ -16,6 +16,7 @@ INCLUDES = \
$(E_UTIL_CFLAGS)
privlib_LTLIBRARIES = libeutil.la libedb3util.la libeconduit.la
+noinst_LTLIBRARIES = libeutil-static.la libeconduit-static.la
eutilinclude_HEADERS = \
e-account-list.h \
@@ -83,8 +84,6 @@ libeutil_la_SOURCES = \
e-url.c \
e-util-marshal.c \
e-xml-hash-utils.c \
- eggtrayicon.c \
- eggtrayicon.h \
md5-utils.c
MARSHAL_GENERATED = e-util-marshal.c e-util-marshal.h
@@ -92,6 +91,13 @@ MARSHAL_GENERATED = e-util-marshal.c e-util-marshal.h
libeutil_la_LIBADD = $(E_UTIL_LIBS)
+libeutil_static_la_SOURCES = $(libeutil_la_SOURCES)
+libeutil_static_la_LIBADD = $(libeutil_la_LIBADD)
+libeutil_static_la_LDFLAGS = -all-static
+# Make sure libeutil.la and libeutil-static.la are not built in
+# parallel when using a parallel make; libtool can't handle that.
+libeutil_static_la_DEPENDENCIES = libeutil.la
+
econdinclude_HEADERS = \
e-pilot-map.h \
e-pilot-settings.h \
@@ -111,19 +117,20 @@ endif
libeconduit_la_SOURCES = $(pilot_compile)
+libeconduit_static_la_SOURCES = $(libeconduit_la_SOURCES)
+libeconduit_static_la_LDFLAGS = -all-static
+
EXTRA_DIST = \
$(pilot_sources) \
ChangeLog.pre-1-4 \
e-util-marshal.list
edb3include_HEADERS = \
- e-db3-utils.h \
- e-dbhash.h
+ e-db3-utils.h
libedb3util_la_SOURCES = \
$(edb3include_HEADERS) \
- e-db3-utils.c \
- e-dbhash.c
+ e-db3-utils.c
BUILT_SOURCES = $(MARSHAL_GENERATED)
CLEANFILES = $(BUILT_SOURCES)
diff --git a/e-util/e-bit-array.c b/e-util/e-bit-array.c
deleted file mode 100644
index bb98a3f465..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 PARENT_TYPE G_TYPE_OBJECT
-
-#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 GObjectClass *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(guint32, 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(guint32, eba->data, eba->bit_count >> 5);
- }
- if (move_selection_mode && selected && eba->bit_count > 0) {
- e_bit_array_select_single_row (eba, row == eba->bit_count ? row - 1 : row);
- }
- }
-}
-
-/* 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_dispose (GObject *object)
-{
- EBitArray *eba;
-
- eba = E_BIT_ARRAY (object);
-
- if (eba->data)
- g_free(eba->data);
- eba->data = NULL;
-
- if (G_OBJECT_CLASS (parent_class)->dispose)
- (* G_OBJECT_CLASS (parent_class)->dispose) (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 (guint32, (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 (guint32, (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(guint32, (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)
-{
- GObjectClass *object_class;
-
- parent_class = g_type_class_ref (PARENT_TYPE);
-
- object_class = G_OBJECT_CLASS(klass);
-
- object_class->dispose = eba_dispose;
-}
-
-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 = g_object_new (E_BIT_ARRAY_TYPE, NULL);
- eba->bit_count = count;
- eba->data = g_new0(guint32, (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 ebfe644da6..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 <glib-object.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#define E_BIT_ARRAY_TYPE (e_bit_array_get_type ())
-#define E_BIT_ARRAY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_BIT_ARRAY_TYPE, EBitArray))
-#define E_BIT_ARRAY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_BIT_ARRAY_TYPE, EBitArrayClass))
-#define E_IS_BIT_ARRAY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_BIT_ARRAY_TYPE))
-#define E_IS_BIT_ARRAY_CLASS(k) (G_TYPE_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 {
- GObject base;
-
- gint bit_count;
- guint32 *data;
-} EBitArray;
-
-typedef struct {
- GObjectClass parent_class;
-} EBitArrayClass;
-
-
-GType 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-dbhash.c b/e-util/e-dbhash.c
deleted file mode 100644
index 209798fbc5..0000000000
--- a/e-util/e-dbhash.c
+++ /dev/null
@@ -1,227 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Author:
- * JP Rosevear (jpr@ximian.com)
- *
- * Copyright 2000, Ximian, Inc.
- */
-
-#include <config.h>
-
-#include "e-dbhash.h"
-
-#include <string.h>
-#include <fcntl.h>
-#include <db.h>
-#include "md5-utils.h"
-
-#if DB_VERSION_MAJOR != 3 || \
- DB_VERSION_MINOR != 1 || \
- DB_VERSION_PATCH != 17
-#error Including wrong DB3. Need libdb 3.1.17.
-#endif
-
-struct _EDbHashPrivate
-{
- DB *db;
-};
-
-EDbHash *
-e_dbhash_new (const char *filename)
-{
- EDbHash *edbh;
- DB *db;
- int rv;
-
- int major, minor, patch;
-
- db_version (&major, &minor, &patch);
-
- if (major != 3 ||
- minor != 1 ||
- patch != 17) {
- g_warning ("Wrong version of libdb.");
- return NULL;
- }
-
- /* Attempt to open the database */
- rv = db_create (&db, NULL, 0);
- if (rv != 0) {
- return NULL;
- }
-
- rv = db->open (db, filename, NULL, DB_HASH, 0, 0666);
- if (rv != 0) {
- rv = db->open (db, filename, NULL, DB_HASH, DB_CREATE, 0666);
-
- if (rv != 0)
- return NULL;
- }
-
- edbh = g_new (EDbHash, 1);
- edbh->priv = g_new (EDbHashPrivate, 1);
- edbh->priv->db = db;
-
- return edbh;
-}
-
-static void
-string_to_dbt(const char *str, DBT *dbt)
-{
- memset (dbt, 0, sizeof (DBT));
- dbt->data = (void*)str;
- dbt->size = strlen (str) + 1;
-}
-
-static void
-md5_to_dbt(const char str[16], DBT *dbt)
-{
- memset (dbt, 0, sizeof (DBT));
- dbt->data = (void*)str;
- dbt->size = 16;
-}
-
-void
-e_dbhash_add (EDbHash *edbh, const gchar *key, const gchar *data)
-{
- DB *db;
- DBT dkey;
- DBT ddata;
- guchar local_hash[16];
-
- g_return_if_fail (edbh != NULL);
- g_return_if_fail (edbh->priv != NULL);
- g_return_if_fail (edbh->priv->db != NULL);
- g_return_if_fail (key != NULL);
- g_return_if_fail (data != NULL);
-
- db = edbh->priv->db;
-
- /* Key dbt */
- string_to_dbt (key, &dkey);
-
- /* Data dbt */
- md5_get_digest (data, strlen (data), local_hash);
- md5_to_dbt (local_hash, &ddata);
-
- /* Add to database */
- db->put (db, NULL, &dkey, &ddata, 0);
-}
-
-void
-e_dbhash_remove (EDbHash *edbh, const char *key)
-{
- DB *db;
- DBT dkey;
-
- g_return_if_fail (edbh != NULL);
- g_return_if_fail (edbh->priv != NULL);
- g_return_if_fail (key != NULL);
-
- db = edbh->priv->db;
-
- /* Key dbt */
- string_to_dbt (key, &dkey);
-
- /* Remove from database */
- db->del (db, NULL, &dkey, 0);
-}
-
-void
-e_dbhash_foreach_key (EDbHash *edbh, EDbHashFunc func, gpointer user_data)
-{
- DB *db;
- DBT dkey;
- DBT ddata;
- DBC *dbc;
- int db_error = 0;
-
- g_return_if_fail (edbh != NULL);
- g_return_if_fail (edbh->priv != NULL);
- g_return_if_fail (func != NULL);
-
- db = edbh->priv->db;
-
- db_error = db->cursor (db, NULL, &dbc, 0);
-
- if (db_error != 0) {
- return;
- }
-
- memset(&dkey, 0, sizeof(DBT));
- memset(&ddata, 0, sizeof(DBT));
- db_error = dbc->c_get(dbc, &dkey, &ddata, DB_FIRST);
-
- while (db_error == 0) {
- (*func) ((const char *)dkey.data, user_data);
-
- db_error = dbc->c_get(dbc, &dkey, &ddata, DB_NEXT);
- }
- dbc->c_close (dbc);
-}
-
-EDbHashStatus
-e_dbhash_compare (EDbHash *edbh, const char *key, const char *compare_data)
-{
- DB *db;
- DBT dkey;
- DBT ddata;
- guchar compare_hash[16];
-
- g_return_val_if_fail (edbh != NULL, FALSE);
- g_return_val_if_fail (edbh->priv != NULL, FALSE);
- g_return_val_if_fail (key != NULL, FALSE);
- g_return_val_if_fail (compare_hash != NULL, FALSE);
-
- db = edbh->priv->db;
-
- /* Key dbt */
- string_to_dbt (key, &dkey);
-
- /* Lookup in database */
- memset (&ddata, 0, sizeof (DBT));
- db->get (db, NULL, &dkey, &ddata, 0);
-
- /* Compare */
- if (ddata.data) {
- md5_get_digest (compare_data, strlen (compare_data), compare_hash);
-
- if (memcmp (ddata.data, compare_hash, sizeof (guchar) * 16))
- return E_DBHASH_STATUS_DIFFERENT;
- } else {
- return E_DBHASH_STATUS_NOT_FOUND;
- }
-
- return E_DBHASH_STATUS_SAME;
-}
-
-void
-e_dbhash_write (EDbHash *edbh)
-{
- DB *db;
-
- g_return_if_fail (edbh != NULL);
- g_return_if_fail (edbh->priv != NULL);
-
- db = edbh->priv->db;
-
- /* Flush database to disk */
- db->sync (db, 0);
-}
-
-void
-e_dbhash_destroy (EDbHash *edbh)
-{
- DB *db;
-
- g_return_if_fail (edbh != NULL);
- g_return_if_fail (edbh->priv != NULL);
-
- db = edbh->priv->db;
-
- /* Close datbase */
- db->close (db, 0);
-
- g_free (edbh->priv);
- g_free (edbh);
-}
diff --git a/e-util/e-dbhash.h b/e-util/e-dbhash.h
deleted file mode 100644
index 9772a60c41..0000000000
--- a/e-util/e-dbhash.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * Writes hashes that go to/from disk in db form. Hash keys are strings
- *
- * Author:
- * JP Rosevear (jpr@ximian.com)
- *
- * Copyright 2000, Ximian, Inc.
- */
-
-#ifndef __E_DBHASH_H__
-#define __E_DBHASH_H__
-
-#include <glib.h>
-
-typedef enum {
- E_DBHASH_STATUS_SAME,
- E_DBHASH_STATUS_DIFFERENT,
- E_DBHASH_STATUS_NOT_FOUND,
-} EDbHashStatus;
-
-typedef struct _EDbHash EDbHash;
-typedef struct _EDbHashPrivate EDbHashPrivate;
-
-struct _EDbHash
-{
- EDbHashPrivate *priv;
-};
-
-typedef void (*EDbHashFunc) (const char *key, gpointer user_data);
-
-EDbHash *e_dbhash_new (const char *filename);
-
-void e_dbhash_add (EDbHash *edbh, const char *key, const char *data);
-void e_dbhash_remove (EDbHash *edbh, const char *key);
-
-EDbHashStatus e_dbhash_compare (EDbHash *edbh, const char *key, const char *compare_data);
-void e_dbhash_foreach_key (EDbHash *edbh, EDbHashFunc func, gpointer user_data);
-
-void e_dbhash_write (EDbHash *edbh);
-
-void e_dbhash_destroy (EDbHash *edbh);
-
-#endif /* ! __E_DBHASH_H__ */
-
diff --git a/e-util/e-i18n.h b/e-util/e-i18n.h
deleted file mode 100644
index 829b2480aa..0000000000
--- a/e-util/e-i18n.h
+++ /dev/null
@@ -1,74 +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 <libgnome/gnome-i18n.h>
-
-G_BEGIN_DECLS
-
-#ifdef ENABLE_NLS
- /* this function is defined in e-util.c */
- extern char *e_gettext (const char *msgid);
-# undef _
-# ifdef GNOME_EXPLICIT_TRANSLATION_DOMAIN
-/* No parentheses allowed here since that breaks string concatenation. */
-# define E_I18N_DOMAIN GNOME_EXPLICIT_TRANSLATION_DOMAIN
-# else
-/* No parentheses allowed here since that breaks string concatenation. */
-# define E_I18N_DOMAIN PACKAGE
-# endif
-# define _(String) e_gettext (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)
-/* No parentheses allowed here since that breaks string concatenation. */
-# define E_I18N_DOMAIN ""
-#endif
-
-G_END_DECLS
-
-#endif /* __E_I18N_H__ */
diff --git a/e-util/e-iconv.c b/e-util/e-iconv.c
deleted file mode 100644
index 3236521438..0000000000
--- a/e-util/e-iconv.c
+++ /dev/null
@@ -1,614 +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 <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <errno.h>
-
-#include <glib.h>
-#include "e-iconv.h"
-
-#include <locale.h>
-
-#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 char *locale_charset = NULL;
-static char *locale_lang = 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" },
- { "5601", "EUC-KR" },
- { "zh_TW-euc", "EUC-TW" },
- { "zh_CN.euc", "gb2312" },
- { "zh_TW-big5", "BIG5" },
- { "euc-cn", "gb2312" },
- { "big5-0", "BIG5" },
- { "big5.eten-0", "BIG5" },
- { "big5hkscs-0", "BIG5HKSCS" },
- { "gb2312-0", "gb2312" },
- { "gb2312.1980-0", "gb2312" },
- { "gb-2312", "gb2312" },
- { "gb18030-0", "gb18030" },
- { "gbk-0", "GBK" },
-
- { "eucjp-0", "eucJP" },
- { "ujis-0", "ujis" },
- { "jisx0208.1983-0","SJIS" },
- { "jisx0212.1990-0","SJIS" },
- { "pck", "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;
-}
-
-
-/* fucking glib... */
-static const char *
-e_strdown (char *str)
-{
- register char *s = str;
-
- while (*s) {
- if (*s >= 'A' && *s <= 'Z')
- *s += 0x20;
- s++;
- }
-
- return str;
-}
-
-static const char *
-e_strup (char *str)
-{
- register char *s = str;
-
- while (*s) {
- if (*s >= 'a' && *s <= 'z')
- *s -= 0x20;
- s++;
- }
-
- return str;
-}
-
-
-static void
-locale_parse_lang (const char *locale)
-{
- char *codeset, *lang;
-
- if ((codeset = strchr (locale, '.')))
- lang = g_strndup (locale, codeset - locale);
- else
- lang = g_strdup (locale);
-
- /* validate the language */
- if (strlen (lang) >= 2) {
- if (lang[2] == '-' || lang[2] == '_') {
- /* canonicalise the lang */
- e_strdown (lang);
-
- /* validate the country code */
- if (strlen (lang + 3) > 2) {
- /* invalid country code */
- lang[2] = '\0';
- } else {
- lang[2] = '-';
- e_strup (lang + 3);
- }
- } else if (lang[2] != '\0') {
- /* invalid language */
- g_free (lang);
- lang = NULL;
- }
-
- locale_lang = lang;
- } else {
- /* invalid language */
- locale_lang = NULL;
- g_free (lang);
- }
-}
-
-/* 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);
- e_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;
- locale_lang = NULL;
- } else {
-#ifdef HAVE_CODESET
- locale_charset = g_strdup (nl_langinfo (CODESET));
- e_strdown (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);
- e_strdown (locale_charset);
- } else {
- /* charset unknown */
- locale_charset = NULL;
- }
-#endif
-
- /* parse the locale lang */
- locale_parse_lang (locale);
-
- }
-
- if (!keep)
- UNLOCK();
-}
-
-const char *e_iconv_charset_name(const char *charset)
-{
- char *name, *ret, *tmp;
-
- if (charset == NULL)
- return NULL;
-
- name = g_alloca (strlen (charset) + 1);
- strcpy (name, charset);
- e_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;
- int errnosav;
- iconv_t ip;
-
- if (oto == NULL || ofrom == NULL) {
- errno = EINVAL;
- return (iconv_t) -1;
- }
-
- to = e_iconv_charset_name (oto);
- from = e_iconv_charset_name (ofrom);
- tofrom = g_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_len = 0;
- char *buggy_iconv_buf = NULL;
-
- /* resets the converter */
- iconv(ip, &buggy_iconv_buf, &buggy_iconv_len, &buggy_iconv_buf, &buggy_iconv_len);
- 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 {
- errnosav = errno;
- g_warning("Could not open converter for '%s' to '%s' charset", from, to);
- in->busy = FALSE;
- errno = errnosav;
- }
- }
-
- 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;
-}
-
-
-const char *
-e_iconv_locale_language (void)
-{
- e_iconv_init (FALSE);
-
- return locale_lang;
-}
-
-/* map CJKR charsets to their language code */
-/* NOTE: only support charset names that will be returned by
- * e_iconv_charset_name() so that we don't have to keep track of all
- * the aliases too. */
-static struct {
- char *charset;
- char *lang;
-} cjkr_lang_map[] = {
- { "Big5", "zh" },
- { "BIG5HKSCS", "zh" },
- { "gb2312", "zh" },
- { "gb18030", "zh" },
- { "gbk", "zh" },
- { "euc-tw", "zh" },
- { "iso-2022-jp", "ja" },
- { "sjis", "ja" },
- { "ujis", "ja" },
- { "eucJP", "ja" },
- { "euc-jp", "ja" },
- { "euc-kr", "ko" },
- { "koi8-r", "ru" },
- { "koi8-u", "uk" }
-};
-
-#define NUM_CJKR_LANGS (sizeof (cjkr_lang_map) / sizeof (cjkr_lang_map[0]))
-
-const char *
-e_iconv_charset_language (const char *charset)
-{
- int i;
-
- if (!charset)
- return NULL;
-
- charset = e_iconv_charset_name (charset);
- for (i = 0; i < NUM_CJKR_LANGS; i++) {
- if (!strcasecmp (cjkr_lang_map[i].charset, charset))
- return cjkr_lang_map[i].lang;
- }
-
- return NULL;
-}
diff --git a/e-util/e-iconv.h b/e-util/e-iconv.h
deleted file mode 100644
index 14b93853d5..0000000000
--- a/e-util/e-iconv.h
+++ /dev/null
@@ -1,49 +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>
- * 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_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);
-
-/* languages */
-const char *e_iconv_locale_language (void);
-const char *e_iconv_charset_language (const char *charset);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* !_E_ICONV_H_ */
diff --git a/e-util/e-marshal.list b/e-util/e-marshal.list
deleted file mode 100644
index 92496dbd7b..0000000000
--- a/e-util/e-marshal.list
+++ /dev/null
@@ -1,51 +0,0 @@
-BOOLEAN:INT,INT,OBJECT,INT,INT,UINT
-BOOLEAN:INT,POINTER,INT,OBJECT,INT,INT,UINT
-BOOLEAN:NONE
-BOOLEAN:OBJECT
-BOOLEAN:OBJECT,DOUBLE,DOUBLE,BOOLEAN
-BOOLEAN:POINTER,POINTER,INT,INT,INT
-BOOLEAN:POINTER,POINTER,POINTER,INT,INT,INT
-BOOLEAN:STRING,INT
-DOUBLE:OBJECT,DOUBLE,DOUBLE,BOOLEAN
-INT:BOXED
-INT:INT
-INT:INT,INT,BOXED
-INT:INT,POINTER,INT,BOXED
-INT:OBJECT,BOXED
-INT:POINTER
-NONE:BOXED
-NONE:BOXED,INT
-NONE:BOXED,INT,INT
-NONE:DOUBLE
-NONE:INT
-NONE:INT,INT
-NONE:INT,INT,BOXED
-NONE:INT,INT,OBJECT
-NONE:INT,INT,OBJECT,BOXED,UINT,UINT
-NONE:INT,INT,OBJECT,INT,INT,BOXED,UINT,UINT
-NONE:INT,INT,OBJECT,POINTER,UINT,UINT
-NONE:INT,INT,OBJECT,UINT
-NONE:INT,INT,STRING,STRING
-NONE:INT,INT,STRING,STRING,POINTER
-NONE:INT,POINTER
-NONE:INT,POINTER,INT,BOXED
-NONE:INT,POINTER,INT,OBJECT
-NONE:INT,POINTER,INT,OBJECT,BOXED,UINT,UINT
-NONE:INT,POINTER,INT,OBJECT,INT,INT,BOXED,UINT,UINT
-NONE:INT,POINTER,INT,OBJECT,UINT
-NONE:INT,STRING
-NONE:NONE
-NONE:OBJECT
-NONE:OBJECT,OBJECT
-NONE:OBJECT,DOUBLE,DOUBLE,BOOLEAN
-NONE:POINTER
-NONE:POINTER,BOOLEAN
-NONE:POINTER,BOOLEAN,BOOLEAN,BOOLEAN
-NONE:POINTER,INT
-NONE:POINTER,INT,INT
-NONE:POINTER,INT,INT,INT
-NONE:POINTER,INT,OBJECT
-NONE:POINTER,POINTER
-NONE:POINTER,POINTER,INT
-OBJECT:OBJECT,DOUBLE,DOUBLE,BOOLEAN
-POINTER:NONE
diff --git a/e-util/e-sorter-array.c b/e-util/e-sorter-array.c
deleted file mode 100644
index ab1e748d9a..0000000000
--- a/e-util/e-sorter-array.c
+++ /dev/null
@@ -1,259 +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 "gal/util/e-util.h"
-#include "e-sorter-array.h"
-
-#define d(x)
-
-#define PARENT_TYPE E_SORTER_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 = g_object_new (E_SORTER_ARRAY_TYPE, NULL);
-
- return e_sorter_array_construct (esa, compare, closure);
-}
-
-static void
-esa_class_init (ESorterArrayClass *klass)
-{
- ESorterClass *sorter_class = E_SORTER_CLASS(klass);
-
- parent_class = g_type_class_ref (PARENT_TYPE);
-
- 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 227e437443..0000000000
--- a/e-util/e-sorter-array.h
+++ /dev/null
@@ -1,77 +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 <glib.h>
-#include <glib-object.h>
-#include <gal/util/e-sorter.h>
-
-G_BEGIN_DECLS
-
-#define E_SORTER_ARRAY_TYPE (e_sorter_array_get_type ())
-#define E_SORTER_ARRAY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_SORTER_ARRAY_TYPE, ESorterArray))
-#define E_SORTER_ARRAY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_SORTER_ARRAY_TYPE, ESorterArrayClass))
-#define E_IS_SORTER_ARRAY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_SORTER_ARRAY_TYPE))
-#define E_IS_SORTER_ARRAY_CLASS(k) (G_TYPE_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;
-
-GType 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);
-
-G_END_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 adee6d0d98..0000000000
--- a/e-util/e-sorter.c
+++ /dev/null
@@ -1,153 +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 <string.h>
-#include "gal/util/e-util.h"
-#include "e-sorter.h"
-
-#define d(x)
-
-#define PARENT_TYPE G_TYPE_OBJECT
-
-static GObjectClass *parent_class;
-
-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 = g_type_class_ref (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 = g_object_new (E_SORTER_TYPE, NULL);
-
- 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 (E_SORTER_GET_CLASS(es)->model_to_sorted)
- return E_SORTER_GET_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 (E_SORTER_GET_CLASS(es)->sorted_to_model)
- return E_SORTER_GET_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 (E_SORTER_GET_CLASS(es)->get_model_to_sorted_array)
- E_SORTER_GET_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 (E_SORTER_GET_CLASS(es)->get_sorted_to_model_array)
- E_SORTER_GET_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 (E_SORTER_GET_CLASS(es)->needs_sorting)
- return E_SORTER_GET_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 a70c2bd2d7..0000000000
--- a/e-util/e-sorter.h
+++ /dev/null
@@ -1,82 +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 <glib-object.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#define E_SORTER_TYPE (e_sorter_get_type ())
-#define E_SORTER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_SORTER_TYPE, ESorter))
-#define E_SORTER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_SORTER_TYPE, ESorterClass))
-#define E_IS_SORTER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_SORTER_TYPE))
-#define E_IS_SORTER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_SORTER_TYPE))
-#define E_SORTER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), E_SORTER_TYPE, ESorterClass))
-
-typedef struct {
- GObject base;
-} ESorter;
-
-typedef struct {
- GObjectClass 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;
-
-GType 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 9cda8f1677..0000000000
--- a/e-util/e-text-event-processor-emacs-like.c
+++ /dev/null
@@ -1,489 +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 <gal/util/e-util.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);
-
-#define PARENT_TYPE E_TEXT_EVENT_PROCESSOR_TYPE
-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 */
-
-};
-
-E_MAKE_TYPE (e_text_event_processor_emacs_like,
- "ETextEventProcessorEmacsLike",
- ETextEventProcessorEmacsLike,
- e_text_event_processor_emacs_like_class_init,
- e_text_event_processor_emacs_like_init,
- PARENT_TYPE)
-
-static void
-e_text_event_processor_emacs_like_class_init (ETextEventProcessorEmacsLikeClass *klass)
-{
- ETextEventProcessorClass *processor_class;
-
- processor_class = (ETextEventProcessorClass*) klass;
-
- parent_class = g_type_class_ref (PARENT_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;
- g_signal_emit_by_name (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;
- g_signal_emit_by_name (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;
- g_signal_emit_by_name (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;
- g_signal_emit_by_name (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) {
- g_signal_emit_by_name (tep, "command", &command);
- return 1;
- }
- else
- return 0;
-}
-
-ETextEventProcessor *
-e_text_event_processor_emacs_like_new (void)
-{
- ETextEventProcessorEmacsLike *retval = g_object_new (E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_TYPE, NULL);
- 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 1fd74dacfe..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) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_TYPE, ETextEventProcessorEmacsLike))
-#define E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_TYPE, ETextEventProcessorEmacsLikeClass))
-#define E_IS_TEXT_EVENT_PROCESSOR_EMACS_LIKE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_TYPE))
-#define E_IS_TEXT_EVENT_PROCESSOR_EMACS_LIKE_CLASS(klass) (G_TYPE_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;
-};
-
-
-GType 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 5cb3f198d7..0000000000
--- a/e-util/e-text-event-processor-types.h
+++ /dev/null
@@ -1,132 +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__
-
-#include <glib/gmacros.h>
-
-G_BEGIN_DECLS
-
-#include <gdk/gdkevents.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;
-
-G_END_DECLS
-
-#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 6b974d894e..0000000000
--- a/e-util/e-text-event-processor.c
+++ /dev/null
@@ -1,148 +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 <gal/util/e-i18n.h>
-#include "gal/util/e-marshal.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_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec);
-static void e_text_event_processor_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec);
-
-#define PARENT_TYPE G_TYPE_OBJECT
-static GObjectClass *parent_class = NULL;
-
-/* The arguments we take */
-enum {
- PROP_0,
- PROP_ALLOW_NEWLINES
-};
-
-enum {
- E_TEP_EVENT,
- E_TEP_LAST_SIGNAL
-};
-
-static guint e_tep_signals[E_TEP_LAST_SIGNAL] = { 0 };
-
-E_MAKE_TYPE (e_text_event_processor,
- "ETextEventProcessor",
- ETextEventProcessor,
- e_text_event_processor_class_init,
- e_text_event_processor_init,
- PARENT_TYPE)
-
-static void
-e_text_event_processor_class_init (ETextEventProcessorClass *klass)
-{
- GObjectClass *object_class;
-
- object_class = (GObjectClass*) klass;
-
- parent_class = g_type_class_ref (PARENT_TYPE);
-
- object_class->set_property = e_text_event_processor_set_property;
- object_class->get_property = e_text_event_processor_get_property;
-
- e_tep_signals[E_TEP_EVENT] =
- g_signal_new ("command",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETextEventProcessorClass, command),
- NULL, NULL,
- e_marshal_NONE__POINTER,
- G_TYPE_NONE, 1,
- G_TYPE_POINTER);
-
- g_object_class_install_property (object_class, PROP_ALLOW_NEWLINES,
- g_param_spec_boolean ("allow_newlines",
- _( "Allow newlines" ),
- _( "Allow newlines" ),
- FALSE,
- G_PARAM_READWRITE));
-
- klass->event = NULL;
- klass->command = NULL;
-
-}
-
-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_GET_CLASS(tep)->event)
- return E_TEXT_EVENT_PROCESSOR_GET_CLASS(tep)->event(tep, event);
- else
- return 0;
-}
-
-/* Set_arg handler for the text item */
-static void
-e_text_event_processor_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- ETextEventProcessor *tep = E_TEXT_EVENT_PROCESSOR (object);
-
- switch (prop_id) {
- case PROP_ALLOW_NEWLINES:
- tep->allow_newlines = g_value_get_boolean (value);
- break;
- default:
- return;
- }
-}
-
-/* Get_arg handler for the text item */
-static void
-e_text_event_processor_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- ETextEventProcessor *tep = E_TEXT_EVENT_PROCESSOR (object);
-
- switch (prop_id) {
- case PROP_ALLOW_NEWLINES:
- g_value_set_boolean (value, tep->allow_newlines);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
diff --git a/e-util/e-text-event-processor.h b/e-util/e-text-event-processor.h
deleted file mode 100644
index 21f2550fde..0000000000
--- a/e-util/e-text-event-processor.h
+++ /dev/null
@@ -1,77 +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) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TEXT_EVENT_PROCESSOR_TYPE, ETextEventProcessor))
-#define E_TEXT_EVENT_PROCESSOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TEXT_EVENT_PROCESSOR_TYPE, ETextEventProcessorClass))
-#define E_IS_TEXT_EVENT_PROCESSOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TEXT_EVENT_PROCESSOR_TYPE))
-#define E_IS_TEXT_EVENT_PROCESSOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TEXT_EVENT_PROCESSOR_TYPE))
-#define E_TEXT_EVENT_PROCESSOR_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), E_TEXT_EVENT_PROCESSOR_TYPE, ETextEventProcessorClass))
-typedef struct _ETextEventProcessor ETextEventProcessor;
-typedef struct _ETextEventProcessorClass ETextEventProcessorClass;
-
-struct _ETextEventProcessor
-{
- GObject 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);
-};
-
-
-GType 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 2514cfc931..0000000000
--- a/e-util/e-util.c
+++ /dev/null
@@ -1,1230 +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 "e-i18n.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>
-#include <libgnome/gnome-util.h>
-#include <math.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_collate_compare (const void *x, const void *y)
-{
- if (x == NULL || y == NULL) {
- if (x == y)
- return 0;
- else
- return x ? -1 : 1;
- }
-
- return g_utf8_collate (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)
- g_object_unref (p->data);
-
- g_list_free (list);
-}
-
-void
-e_free_object_slist (GSList *list)
-{
- GSList *p;
-
- for (p = list; p != NULL; p = p->next)
- g_object_unref (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 | O_WRONLY, 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;
-
- if (path[0] == '/') {
- p = copy = g_strdup (path);
- } else {
- gchar *current_dir = g_get_current_dir();
- p = copy = g_concat_dir_and_file (current_dir, 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
-
-/* Include build marshalers */
-
-#include "e-marshal.h"
-#include "e-marshal.c"
-
-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;
-}
-
-/* This only makes a filename safe for usage as a filename. It still may have shell meta-characters in it. */
-void
-e_filename_make_safe (gchar *string)
-{
- gchar *p, *ts;
- gunichar c;
-
- g_return_if_fail (string != NULL);
- p = string;
-
- while(p && *p) {
- c = g_utf8_get_char (p);
- ts = p;
- p = g_utf8_next_char (p);
- if (!g_unichar_isprint(c) || ( c < 0xff && strchr (" /'\"`&();|<>$%{}!", c&0xff ))) {
- while (ts<p)
- *ts++ = '_';
- }
- }
-}
-
-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");
- }
-}
-
-static gchar *
-do_format_number_as_float (double 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;
- double fractional;
-
- locality = localeconv();
- grouping = locality->grouping;
- while (number >= 1.0) {
- char *group;
- switch (*grouping) {
- default:
- last_count = *grouping;
- grouping++;
- /* Fall through */
- case 0:
- divider = epow10(last_count);
- number /= divider;
- fractional = modf (number, &number);
- fractional *= divider;
- fractional = floor (fractional);
-
- if (number >= 1.0) {
- group = g_strdup_printf("%0*d", last_count, (int) fractional);
- } else {
- group = g_strdup_printf("%d", (int) fractional);
- }
- break;
- case CHAR_MAX:
- divider = epow10(last_count);
- number /= divider;
- fractional = modf (number, &number);
- fractional *= divider;
- fractional = floor (fractional);
-
- while (number >= 1.0) {
- group = g_strdup_printf("%0*d", last_count, (int) fractional);
-
- char_length += strlen(group);
- list = g_list_prepend(list, group);
- group_count ++;
-
- divider = epow10(last_count);
- number /= divider;
- fractional = modf (number, &number);
- fractional *= divider;
- fractional = floor (fractional);
- }
-
- group = g_strdup_printf("%d", (int) fractional);
- 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)
-{
- gfloat int_part;
- gint fraction;
- struct lconv *locality;
- gchar *str_intpart;
- gchar *decimal_point;
- gchar *str_fraction;
- gchar *value;
-
- locality = localeconv();
-
- int_part = floor (number);
- str_intpart = do_format_number_as_float ((double) 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)
-{
- gint ret_val = e_mkdir_hier (directory, 0777);
- if (ret_val == -1)
- return FALSE;
- else
- return TRUE;
-}
-
-
-/* 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
-}
-
-size_t
-e_utf8_strftime(char *s, size_t max, const char *fmt, const struct tm *tm)
-{
- size_t sz, ret;
- char *locale_fmt, *buf;
-
- locale_fmt = g_locale_from_utf8(fmt, -1, NULL, &sz, NULL);
- if (!locale_fmt)
- return 0;
-
- ret = e_strftime(s, max, locale_fmt, tm);
- if (!ret) {
- g_free (locale_fmt);
- return 0;
- }
-
- buf = g_locale_to_utf8(s, ret, NULL, &sz, NULL);
- if (!buf) {
- g_free (locale_fmt);
- return 0;
- }
-
- if (sz >= max) {
- char *tmp = buf + max - 1;
- tmp = g_utf8_find_prev_char(buf, tmp);
- if (tmp)
- sz = tmp - buf;
- else
- sz = 0;
- }
- memcpy(s, buf, sz);
- s[sz] = '\0';
- g_free(locale_fmt);
- g_free(buf);
- return sz;
-}
-
-/**
- * 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);
-}
-
-size_t
-e_utf8_strftime_fix_am_pm(char *s, size_t max, const char *fmt, const struct tm *tm)
-{
- size_t sz, ret;
- char *locale_fmt, *buf;
-
- locale_fmt = g_locale_from_utf8(fmt, -1, NULL, &sz, NULL);
- if (!locale_fmt)
- return 0;
-
- ret = e_strftime_fix_am_pm(s, max, locale_fmt, tm);
- if (!ret) {
- g_free (locale_fmt);
- return 0;
- }
-
- buf = g_locale_to_utf8(s, ret, NULL, &sz, NULL);
- if (!buf) {
- g_free (locale_fmt);
- return 0;
- }
-
- if (sz >= max) {
- char *tmp = buf + max - 1;
- tmp = g_utf8_find_prev_char(buf, tmp);
- if (tmp)
- sz = tmp - buf;
- else
- sz = 0;
- }
- memcpy(s, buf, sz);
- s[sz] = '\0';
- g_free(locale_fmt);
- g_free(buf);
- return sz;
-}
-
-/**
- * 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;
- }
-}
-
-char *
-e_gettext (const char *msgid)
-{
- static gboolean initialized = FALSE;
-
- if (!initialized) {
- bindtextdomain (E_I18N_DOMAIN, GNOMELOCALEDIR);
- bind_textdomain_codeset (E_I18N_DOMAIN, "UTF-8");
- initialized = TRUE;
- }
-
- return dgettext (E_I18N_DOMAIN, msgid);
-}
-
diff --git a/e-util/e-util.h b/e-util/e-util.h
deleted file mode 100644
index d9d51967d1..0000000000
--- a/e-util/e-util.h
+++ /dev/null
@@ -1,231 +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 <glib-object.h>
-#include <limits.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-#include <gal/util/e-marshal.h>
-
-#define E_MAKE_TYPE(l,str,t,ci,i,parent) \
-GType l##_get_type(void)\
-{\
- static GType type = 0; \
- if (!type){ \
- static GTypeInfo const object_info = { \
- sizeof (t##Class), \
- \
- (GBaseInitFunc) NULL, \
- (GBaseFinalizeFunc) NULL, \
- \
- (GClassInitFunc) ci, \
- (GClassFinalizeFunc) NULL, \
- NULL, /* class_data */ \
- \
- sizeof (t), \
- 0, /* n_preallocs */ \
- (GInstanceInitFunc) i, \
- }; \
- type = g_type_register_static (parent, str, &object_info, 0); \
- } \
- 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){ \
- GTypeInfo info = { \
- sizeof (t##Class), \
- \
- (GBaseInitFunc) NULL, \
- (GBaseFinalizeFunc) NULL, \
- \
- (GClassInitFunc) ci, \
- (GClassFinalizeFunc) NULL, \
- \
- NULL, /* class_data */ \
- \
- sizeof (t), \
- 0, /* n_preallocs */ \
- (GInstanceInitFunc) i, \
- }; \
- type = bonobo_x_type_unique ( \
- parent, poa_init, NULL, \
- offset, &info, str); \
- } \
- 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 0
-# 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_collate_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);
-/* This only makes a filename safe for usage as a filename. It still may have shell meta-characters in it. */
-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);
-
-size_t e_utf8_strftime_fix_am_pm (char *s,
- size_t max,
- const char *fmt,
- const struct tm *tm);
-
-size_t e_utf8_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 (DBL_DIG + 12 + 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,
- ...);
-
-#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 437934be65..0000000000
--- a/e-util/e-xml-utils.c
+++ /dev/null
@@ -1,502 +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.
- */
-
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "e-xml-utils.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <locale.h>
-#include <unistd.h>
-#include <fcntl.h>
-#include <errno.h>
-#include <math.h>
-#include <string.h>
-#include <libxml/parser.h>
-#include <libxml/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,
- const 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) {
- const 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,
- const 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];
- char *format;
-
- g_return_if_fail (parent != NULL);
- g_return_if_fail (prop_name != NULL);
-
- if (fabs (value) < 1e9 && fabs (value) > 1e-5) {
- format = g_strdup_printf ("%%.%df", DBL_DIG);
- } else {
- format = g_strdup_printf ("%%.%dg", DBL_DIG);
- }
- e_ascii_dtostr (buffer, sizeof (buffer), format, value);
- g_free (format);
-
- 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;
-}
-
-
-int
-e_xml_save_file (const char *filename, xmlDocPtr doc)
-{
- char *filesave, *slash, *xmlbuf;
- size_t n, written = 0;
- int ret, fd, size;
- int errnosave;
- ssize_t w;
-
- filesave = alloca (strlen (filename) + 5);
- slash = strrchr (filename, '/');
- if (slash)
- sprintf (filesave, "%.*s.#%s", slash - filename + 1, filename, slash + 1);
- else
- sprintf (filesave, ".#%s", filename);
-
- fd = open (filesave, O_WRONLY | O_CREAT | O_TRUNC, 0600);
- if (fd == -1)
- return -1;
-
- xmlDocDumpFormatMemory (doc, (xmlChar **) &xmlbuf, &size, TRUE);
- if (size <= 0) {
- close (fd);
- unlink (filesave);
- errno = ENOMEM;
- return -1;
- }
-
- n = (size_t) size;
- do {
- do {
- w = write (fd, xmlbuf + written, n - written);
- } while (w == -1 && errno == EINTR);
-
- if (w > 0)
- written += w;
- } while (w != -1 && written < n);
-
- xmlFree (xmlbuf);
-
- if (written < n || fsync (fd) == -1) {
- errnosave = errno;
- close (fd);
- unlink (filesave);
- errno = errnosave;
- return -1;
- }
-
- while ((ret = close (fd)) == -1 && errno == EINTR)
- ;
-
- if (ret == -1)
- return -1;
-
- if (rename (filesave, filename) == -1) {
- errnosave = errno;
- unlink (filesave);
- errno = errnosave;
- return -1;
- }
-
- return 0;
-}
diff --git a/e-util/e-xml-utils.h b/e-util/e-xml-utils.h
deleted file mode 100644
index 6c39ee6f79..0000000000
--- a/e-util/e-xml-utils.h
+++ /dev/null
@@ -1,101 +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 <glib.h>
-#include <libxml/tree.h>
-
-G_BEGIN_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,
- const 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);
-
-int e_xml_save_file (const char *filename, xmlDocPtr doc);
-
-G_END_DECLS
-
-#endif /* __E_XML_UTILS__ */
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/libical/ChangeLog b/libical/ChangeLog
index e771843d69..cb695bd4fa 100644
--- a/libical/ChangeLog
+++ b/libical/ChangeLog
@@ -1,377 +1,669 @@
-2003-09-23 Hans Petter Jansson <hpj@ximian.com>
+2003-08-18 Rodrigo Moya <rodrigo@ximian.com>
- * configure.in: Remove flex check. Set ICAL_ERRORS_ARE_FATAL to 0.
+ * src/libical/icalcomponent.c (icalcomponent_set_uid): added missing
+ implementation.
- * src/libicalss/icalgauge.c (icalgauge_new_from_sql): Don't use
- globals struct. Remove calls to sslex_init(), _extra(),
- ss_scan_string(). Use a global pointer icalss_yy_gauge to hold context.
- Call ssparse() with no arguments.
+2003-08-07 Rodrigo Moya <rodrigo@ximian.com>
- * src/libicalss/icalsslexer.l: Remove options reentrant and
- bison-bridge. Rename variables, change function invocations to comply
- with flex 2.5.4.
- (icalss_input): Add function to read input.
+ * src/libical/icalcomponent.c (icalcomponent_get_uid): added missing
+ implementation.
- * src/libicalss/icalssyacc.y (yyextra): Remove.
- (select_list)
- (from_list)
- (where_clause)
- (where_list): yyextra -> icalss_yy_gauge
+2003-05-14 Rodrigo Moya <rodrigo@ximian.com>
- * src/libicalss/icalsslexer.c:
- * src/libicalss/icalssyacc.c:
- * src/libicalss/icalssyacc.h: Add generated files back to repository.
- They don't belong there, but that's not my problem.
+ Fixes #41579
-2003-09-22 Hans Petter Jansson <hpj@ximian.com>
+ * src/libical/icalcomponent.c (icalcomponent_new_clone): don't add the
+ property if it's NULL.
- * src/libicalcap/Makefile.am (LDADD): Remove $(cxx_libs), it's
- undefined.
+2003-05-07 Rodrigo Moya <rodrigo@ximian.com>
-2003-09-22 Hans Petter Jansson <hpj@ximian.com>
+ Fixes crash in #41631
- * configure.in: Require flex 2.5.31 and add a test for it. Rename
- WITH_CXX conditional to WITH_CXX_BINDINGS.
+ * src/libicalvcal/icalvcal.c (icalvcal_traverse_objects): changed to
+ return an error code and to return immediately if one of the recurrent
+ calls return an error.
+ (icalvcal_convert_with_defaults): if icalvcal_traverse_objects return
+ an error, return NULL.
- * examples/Makefile.am (doesnothing_LDADD): Add -evolution to lib
- names.
+2003-03-17 Hans Petter Jansson <hpj@ximian.com>
- * src/test/Makefile.am: WITH_CXX -> WITH_CXX_BINDINGS. Add -evolution
- to lib names.
+ Part of fix for #34095
- * src/test/regression.c (main): WITH_CXX -> WITH_CXX_BINDINGS.
+ * scripts/mkderivedparameters.pl: Generate code to free old
+ string value when a new one is set.
- * src/libicalcap/Makefile.am: Add -evolution to lib names. Install to
- Evolution's priv dirs.
+ * src/libical/icalperiod.c (icalperiodtype_as_ical_string):
+ Callers expect a temporary string, and thus won't free it, so
+ allocate returned memory from the temporary ring.
- * src/libicalvcal/Makefile.am: Ditto.
+2003-02-10 Ettore Perazzoli <ettore@ximian.com>
- * src/libical/Makefile.am: WITH_CXX -> WITH_CXX_BINDINGS. Add
- -evolution to lib names. Install in privlibdir. Install includes to
- $(privincludedir)/libical.
+ * src/libical/Makefile.am (libical_static_la_DEPENDENCIES): Make
+ libical-static.la depend on libical-evolution.la so they they are
+ not built in parallel by a parallel make, since that would break
+ libtool.
- * src/libicalss/Makefile.am: Ditto.
+2003-02-07 Christian Neumair <chris@gnome-de.org>
- * src/libicalss/icalsslexer.l: Replace option reentrant-bison with
- reentrant and bison-bridge. Use new Flex variable names.
+ * .cvsignore: Added missing files.
+ * configure.in: Added AC_PREREQ as defined in ../configure.in.
- * src/libical/icallexer.l:
- * src/libical/icalyacc.y:
- * src/libicalss/icalsslexer.c:
- * src/libicalss/icalssyacc.c:
- * src/libicalss/icalssyacc.h: Removed from repository.
+2003-02-06 Dan Winship <danw@ximian.com>
-2003-09-12 Hans Petter Jansson <hpj@ximian.com>
+ * configure.in: AC_SUBST privlibdir, privincludedir, privdatadir
+ (sent from ../configure). Add descriptions to AC_DEFINEs. Don't
+ bother checking for python since we don't build it anyway.
- * configure.in: Subst in Evolution install variables.
+ * acconfig.h: Gone
- * src/libical/Makefile.am (CPPFLAGS): Use Evolution's privdatadir.
+ * src/libical/Makefile.am: install library in privlibdir and
+ headers under privincludedir. Look for zone files in privdatadir
-2002-07-09 Andrea Campi <a.campi@inet.it>
+ * src/libicalvcal/Makefile.am: install in privlibdir
- * src/libical/icalcomponent.c
- * src/libical/icalcomponent.h: Added a check for valid component kind
- before instancing a new one.
+ * zoneinfo/Makefile.am (zoneinfodatadir): define in terms of
+ privdatadir
+ (install-data-local): update
-2002-07-08 Andrea Campi <a.campi@inet.it>
+2002-12-19 Joe Shaw <joe@ximian.com>
- * src/python/Gauge.py
- * src/python/LibicalWrap.i
- * src/python/Property.py
- * src/python/Store.py
- * src/python/Time.py
- * src/python/python-binding.txt
- * src/python/test.py: Updated the python bindings to match the C API
- changes.
- Obtained from: Mark Tearle
+ * configure.in: Add AC_CONFIG_AUX_DIR(..) so it looks for ylwrap in
+ the toplevel evolution directory and not our directory. Fixes the
+ build for automake >= 1.5
-2002-07-04 Andrea Campi <a.campi@inet.it>
+2002-11-26 Rodrigo Moya <rodrigo@ximian.com>
- * src/libical/icalderivedproperty.c.in
- * src/libical/icalproperty.c
- * src/libical/icalproperty.h: Added a check for valid property kind
- before instancing a new one.
-
- * src/libical/icalvalue.c: Fixed icalvalue_new_clone to properly clone
- X- properties.
+ * src/libical/icalyacc.y: added missing ';' for new bison to not
+ complain.
-2002-06-28 Andrea Campi <a.campi@inet.it>
+2002-10-25 Dan Winship <danw@ximian.com>
- * design-data/parameters.csv
- * src/libicalss/icalgauge.c
- * src/libicalss/icalgaugeimpl.h
- * src/libicalss/icalsslexer.c
- * src/libicalss/icalsslexer.l
- * src/libicalss/icalssyacc.c
- * src/libicalss/icalssyacc.h
- * src/libicalss/icalssyacc.y: Added IS NULL to icalgauge
- syntax.
- Obtained from: Paul Lindner
-
- * src/libical/icallexer.c
- * src/libical/icallexer.l
- * src/libical/icalyacc.c
- * src/libical/icalyacc.h
- * src/libical/icalyacc.y: Sent lex/yacc code to Attic.
-
- * src/libical/icalparameter.c: Changed icalparameter_as_ical_string
- to also quote the param value if it contains a , (comma), as per RFC2445.
-
- * src/libicalss/icalset.c
- * src/libicalss/icalset.h: Added experimental code to support
- dynamic loading of icalset derived classes.
-
- * src/libicalss/Makefile.am
- * src/libicalss/icalspanlist_cxx.cpp
- * src/libicalss/icalspanlist_cxx.h: Added C++ binding for libicalss.
- Obtained from: Paul Lindner
-
-2002-06-28 Eric Busboom <eric@softwarestudio.org>
-
- * src/libical/Makefile.am
- * src/libical/icalduration.c
- * src/libical/icalparser.c
- * src/libical/icalvalue.c
- * src/libical/icalyacc.c
- * src/libical/icalyacc.h: removed lex and yacc by writing
- code to parse UTC-OFFSET
-
-2002-06-27 Andrea Campi <a.campi@inet.it>
-
- * src/libical/icalcomponent.c
- * src/libical/icalcomponent.h: Added icalcomponent_foreach_recurrence
- as a better way of handling recurrences; deprecated
- icalcomponent_get_span
- Obtained from: Paul Lindner
-
- * src/libical/icalderivedvalue.c.in
- * src/libical/icalvalue.c
- * src/libical/icalvalue.h: Added a check for valid value kind before
- instancing a new one.
- Obtained from: Paul Lindner
-
- * src/libical/icalproperty.c
- * src/libical/icalproperty.h: Deprecated icalproperty_remove_parameter,
- added 3 new functions to do the same in a safer way (wrt X- params).
- Obtained from: Paul Lindner
-
- * src/libical/icaltime.c
- * src/libical/icaltime.h: Added functions to work with time spans.
- Obtained from: Paul Lindner
-
-2002-06-26 Andrea Campi <a.campi@inet.it>
-
- * src/libical/icalduration.c: Fixed icaldurationtype_from_int to
- generate valid RFC2445 durations (it used to mix weeks and other
- time units).
-
-2002-06-13 Andrea Campi <a.campi@inet.it>
-
- * src/libical/icalvalue.c: Fixed escaping of TEXT values and
- formatting of UTCOFFSET values to more closely match RFC2445.
-
- * configure.in
- * src/libical/Makefile.am
- * src/libical/icalparameter_cxx.cpp
- * src/libical/icalparameter_cxx.h
- * src/libical/icalproperty_cxx.cpp
- * src/libical/icalproperty_cxx.h
- * src/libical/icalvalue_cxx.cpp
- * src/libical/icalvalue_cxx.h
- * src/libical/vcomponent.cpp
- * src/libical/vcomponent.h
- * src/libicalss/icalbdbset_cxx.h: Added C++ binding.
- Obtained from: Paul Lindner
-
- * configure.in
- * src/libicalss/Makefile.am
- * src/libicalss/icalbdbset.c
- * src/libicalss/icalbdbset.h
- * src/libicalss/icalbdbset.h
- * src/libicalss/icalbdbsetimpl.h
- * src/test/Makefile.am
- * src/test/storage.c: Added BerkeleyDB 4.0 icalset implementation.
- Obtained from: Paul Lindner
-
-2002-06-11 Andrea Campi <a.campi@inet.it>
-
- * src/test/Makefile.am
- * src/test/regression-classify.c
- * src/test/regression-component.c
- * src/test/regression-recur.c
- * src/test/regression-utils.c
- * src/test/regression.c
- * src/test/regression.h
- * src/test/test_fileset.ics: New regression test suite
- Obtained from: Paul Lindner
-
- * src/libical/icalcomponent.c
- * src/libical/icalproperty.c
- * src/libical/icalproperty.h
- * src/python/test.py
- * src/test/regression.c: Improved X- parameter handling.
- Obtained from: Mark Tearle
-
-2002-06-07 Andrea Campi <a.campi@inet.it>
-
- * configure.in
- * src/libical/Makefile.am
- * src/libical/icallexer.l
- * src/libical/icalparser.c
- * src/libical/icalparser.h
- * src/libical/icalyacc.y
- * src/libicalss/Makefile.am
- * src/libicalss/icalgauge.c
- * src/libicalss/icalsslexer.c
- * src/libicalss/icalsslexer.l
- * src/libicalss/icalssyacc.c
- * src/libicalss/icalssyacc.h
- * src/libicalss/icalssyacc.y: Made parser fully reentrant using
- recent versions of flex/bison. Also committed the generated files
- so that the library can be compiled even without those tools.
- Obtained from: Paul Lindner
-
- * src/python/LibicalWrap.i
- * src/python/Property.py
- * src/python/test.py: Support X- properties in the Python wrapper.
- Obtained from: Mark Tearle
-
-2002-06-04 Andrea Campi <a.campi@inet.it>
-
- * *: Constifed a lot of functions, also made a few of them static
- Obtained from: Paul Lindner <lindner@inuus.com>
-
-2002-06-03 Andrea Campi <a.campi@inet.it>
- * src/libical/icallangbind.c
- * src/python/Component.py
- * src/python/Gauge.py
- * src/python/Libical.py
- * src/python/LibicalWrap.i
- * src/python/Store.py
- * src/python/test.py: Fully implemented FileStore and Gauge
- in the python bindings.
- Obtained from: Mark Tearle <mtearle@tearle.com>
-
-2002-05-28 Andrea Campi <a.campi@inet.it>
-
- * src/libical/icalattach.c
- * src/libical/icalattach.h
- * src/libical/icalattachimpl.h
- * src/libical/icalderivedproperty.c.in
- * src/libical/icalderivedvalue.c.in
- * src/libical/icalderivedvalue.h.in
- * src/libical/icaltypes.c
- * src/libical/icaltypes.h
- * src/libical/icalvalue.c
- * src/libical/icalvalueimpl.h: Changed ATTACH to be an opaque type
-
-2002-05-27 Eric Busboom <eric@softwarestudio.org>
-
- * scripts/mkderivedparameters.pl
- * scripts/mkderivedproperties.pl
- * scripts/mkderivedvalues.pl
- * src/libical/icalderivedparameter.c.in
- * src/libical/icalderivedparameter.h.in
- * src/libical/icalderivedproperty.c.in
- * src/libical/icalderivedproperty.h.in
- * src/libical/icalderivedvalue.c.in
- * src/libical/icalderivedvalue.h.in: changed the auto generated
- files and scripts so that the generated code is inserted into the
- middle of the template (.in) file, instead of the end. This means
- we could get rid of the declaration for the maps.
-
-2002-05-27 Andrea Campi <a.campi@inet.it>
-
- * src/libical/icaltimezone.c: Worked around Outlook/Exchange brokenness.
- Obtained from: evolution CVS repository
-
-2002-05-24 Andrea Campi <a.campi@inet.it>
-
- * src/libical/icalproperty.c: Implemented proper RFC2445 folding.
- Obtained from: evolution CVS repository
-
- * src/libical/icalrecur.c: Worked around Outlook/Exchange brokenness.
- Obtained from: evolution CVS repository
-
-
-2002-05-21 Andrea Campi <a.campi@inet.it>
-
- * src/libical/*: Removed void * in favor of opaque typedef types.
- This helped uncover a few bugs and made debugging easier.
- Obtained from: Paul Lindner
-
-2002-05-10 Andrea Campi <a.campi@inet.it>
-
- * src/libical/icalmemory.c: Made the memory allocator threadsafe.
- This code is currently conditional on USE_THREAD, but it might
- become the default in the future.
- Obtained from: Paul Lindner
-
- * src/libical/icaltime.c: Implemented icaltime_is_date(), with the
- intent of removing all direct accesses to is_date.
-
-2002-05-09 Andrea Campi <a.campi@inet.it>
+ * src/libical/icaltimezone.c
+ (icaltimezone_get_vtimezone_properties): Free the location if it's
+ set. Otherwise one copy of the location of each built-in timezone
+ we use gets leaked.
- * icaltime.c Rewrote and documented icaltime API, with the goal of
- keeping it stable until release 1.0. Some functions and internal
- implementation details are now declared obsolete and removed from
- the documentation; they will be removed at a later time.
-
-2001-12-12 Eric Busboom <eric@softwarestudio.org>
-
- * icalrecur.c implemented recurrence rule for "FREQ=YEARLY",
- with no BY rules.
+2002-10-15 Rodrigo Moya <rodrigo@ximian.com>
-2001-12-11 Eric Busboom <eric@softwarestudio.org>
+ Fixes #25153
+
+ * scripts/mkderivedvalues.pl: changed the _get functions for
+ string values to return a NULL if arguments are wrong
- * icalrecur.c Fixed bug in next_month for MONTHLY rules that have
- only BYDAY rules. The code would miss valid dates that fell on the
- first of the month. created new routine is_day_in_byday()
+ * src/libical/icalderivedvalue.c.in (icalvalue_get_x): return from
+ function if pointer checking fails.
- * icaltime.c Fixed icaltime_from_day_of_year to correctly handle
- negative and over-range day-of-years
+2002-10-01 Ettore Perazzoli <ettore@ximian.com>
- * icaltime.c collected all instances of leap year code into
- icaltime_is_leap_year
+ * src/libicalvcal/vcc.y: Allocate the right number of bytes when
+ appending the string value [it was allocating one fewer than
+ necessary]. [#28321]
- * icaltime.c icaltime_day_of_year. Changed an assert into code
- that advances the year when the day of year is lager than the
- number of days in the given year
+2002-06-18 JP Rosevear <jpr@ximian.com>
- * icalerrno.c,h Added the function version
- icalerror_set_errno. Only the define verson existed.
+ * Update timezones (from Damon)
- * icaltime.c Moved all of the getenv/putenv operations into icaltimegm()
+2002-06-07 JP Rosevear <jpr@ximian.com>
+
+ * src/libical/icalparameter.c (icalparameter_as_ical_string):
+ quote if the item contains a comma
-2001-06-29 Eric Busboom <eric@softwarestudio.org>
+2002-04-01 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): patch from Jeremy Katz <katzj@redhat.com>
+ to remove src/libicalss/Makefile and src/libicalvcal/Makefile, as we
+ don't ship those directories now.
+
+2001-12-10 Damon Chaplin <damon@ximian.com>
+
+ * src/libical/icaltimezone.c (icaltimezone_get_display_name): if all
+ we have is the TZID, see if it is one of our TZIDs and if so get the
+ city name out of it. Fixes bug #16571.
+
+2001-11-13 Damon Chaplin <damon@ximian.com>
+
+ * src/libical/icaltimezone.c (icaltimezone_get_tzid): initialize the
+ builtin timezones, to ensure that the TZID of the UTC zone is set.
+ Hopefully fixes bugs #14941 & #14622.
+
+2001-10-31 Damon Chaplin <damon@ximian.com>
+
+ * src/libical/icalproperty.c (get_next_line_start): use MAX_LINE_LEN
+ rather than magic numbers all over the place.
+
+2001-10-31 Damon Chaplin <damon@ximian.com>
+
+ * src/libical/icalproperty.c (icalproperty_as_ical_string): had to
+ redo the folding code since Outlook 2000 doesn't like parameter values
+ like 'TENTATIVE' cut in half. Now it tries to split after a ';', ':'
+ or space.
+
+2001-10-30 Damon Chaplin <damon@ximian.com>
+
+ * src/libical/icalproperty.c (fold_property_line): forgot to account
+ for the spaces added, so it could have been writing over the end of
+ the allocated memory. Added check for buffer overflow as well.
+ This could well have been the problem causing bug #14067.
+
+2001-10-30 Damon Chaplin <damon@ximian.com>
+
+ * zoneinfo/*.ics: Regenerated all VTIMEZONEs, to be compatable with
+ Outlook Web Access. They now only include 2 RRULEs components or
+ 1 simple DTSTART component.
+
+2001-10-29 Damon Chaplin <damon@ximian.com>
+
+ * src/libical/Makefile.am: renamed the library to libical-evolution.la,
+ install ical.h into $includedir/evolution, with the other Evo headers.
+
+ * src/libical/icalproperty.c (fold_property_line): new function to
+ fold property lines around every 70 characters. Outlook Web Access
+ doesn't seem to like some properties folded after the property name
+ (e.g. UID, VTIMEZONE stuff.) Slight chance of data corruption here.
+
+ * src/libical/icalvalue.c (icalvalue_text_as_ical_string): don't fold
+ the lines here.
+
+ * src/libical/icaltime.c (icaltime_from_string): DATE values should
+ not have is_utc set to 1 - they don't have a timezone.
+
+ * src/libical/icalvalue.c (icalvalue_utcoffset_as_ical_string):
+ always round UTC offsets to the nearest minute, for compatability
+ with Outlook. Should round data when parsing as well.
+
+2001-10-27 Damon Chaplin <damon@ximian.com>
+
+ * src/libical/icaltimezone.c (icaltimezone_get_display_name): added
+ function to get a reasonable name to display for the timezone.
+ (Though it won't be translated.)
+
+2001-10-25 Damon Chaplin <damon@ximian.com>
+
+ * src/libical/icaltimezone.c (icaltimezone_get_tznames_from_vtimezone):
+ Outlooks (2000) places "Standard Time" and "Daylight Time" in the
+ TZNAME strings, which is useless, so return NULL in that case.
+ ETimezoneEntry will then use the TZID instead, in which Outlook does
+ place the actual timezone name. (I just hope Outlook doesn't translate
+ "Standard Time" to other languages, as we won't be able to fix it then)
+
+2001-10-23 Damon Chaplin <damon@ximian.com>
+
+ * src/libical/icalrecur.c (icalrecur_two_byrule): use
+ sizeof(test_array) for the memset call. It was clearing 9 bytes but
+ the array uses shorts.
+
+2001-10-22 Damon Chaplin <damon@ximian.com>
+
+ * zoneinfo/*: updated all files again, placing current RDATEs first,
+ so Outlook uses those. Also fixed a few bugs in vzic which resulted in
+ a few changes.
+
+ * zoneinfo/Makefile.am (DIRS): added America/North_Dakota.
+
+2001-10-22 Damon Chaplin <damon@ximian.com>
+
+ * src/libical/icaltimezone.c (icaltimezone_get_utc_offset):
+ (icaltimezone_get_utc_offset_of_utc_time): if we go off the start of
+ the changes array, return the TZOFFSETFROM of the first change.
+ Also changed the maximum year to 2037.
+
+ * src/libical/icaltime.c (icaltime_day_of_week):
+ (icaltime_start_doy_of_week):
+ (icaltime_week_number): init tm_hour to 12. Sometimes mktime()
+ adjusts the time, if that local time doesn't actually exist, leading
+ to the wrong day being returned. It is unlikely to adjust by 12 hours.
+ (icaltime_as_timet_with_zone):
+ (icaltime_from_timet_with_zone): change it back so it does convert
+ DATE values to/from the timezone. time_t values don't really go well
+ with DATE values, so be very careful when using them. We now assume
+ that the time_t points to the start of the day in the given timezone.
+ (We used to assume it pointed to the start of the day in UTC, but
+ that meant it was actually incorrect wrt the displayed calendar.)
+
+ * src/libical/icalrecur.c (expand_year_days): for FREQ=YEARLY with no
+ modifiers, we add one day, using the month and day from DTSTART.
+ (next_year): make sure we never go past 2037.
+
+ * scripts/mkderivedproperties.pl: Updated to allow DTSTART, DTEND, DUE
+ and RECURRENCE-ID to be set with DATE values. I think it now handles
+ all properties which can take DATE values, except RDATE which uses
+ DATE-TIME-PERIOD.
+
+2001-10-19 JP Rosevear <jpr@ximian.com>
+
+ * src/libical/icalproperty.c (icalproperty_remove_parameter):
+ don't free the parameter
+
+2001-10-05 Ettore Perazzoli <ettore@ximian.com>
+
+ * src/libical/Makefile.am (CLEANFILES): Assign with `=', not `+='.
+
+2001-09-26 Federico Mena Quintero <federico@ximian.com>
+
+ Fix the libical-related part of Ximian bug #7892.
+
+ * src/libical/icalduration.c (icaldurationtype_as_ical_string):
+ The correct string for zero seconds is "PT0S", not "PTS0". Also
+ handle "negative zero" durations.
+
+ * src/libical/icalvalue.c (icalvalue_new_from_string_with_error):
+ Use icalerrno to see if the duration string is invalid. We cannot
+ use icaldurationtype_is_null_duration() because a duration of zero
+ *is* valid, not an error (icalduration_type_from_string() returns
+ a zero duration on parse error, too).
+
+2001-09-19 Larry Ewing <lewing@ximian.com>
+
+ * src/libical/icalperiod.c (icalperiodtype_from_string): free the
+ temp dup'd string.
+
+2001-09-11 Federico Mena Quintero <federico@ximian.com>
+
+ * src/libical/icalvalue.c (icalvalue_new_from_string_with_error):
+ Generate an ICAL_ATTACH_VALUE value from the string.
+
+2001-09-10 Damon Chaplin <damon@ximian.com>
+
+ * src/libical/icalcomponent.c (icalcomponent_compare_vtimezones):
+ strdup the result of the first call to ical_component_as_ical_string()
+ since the second call may free it.
+ Also, don't free the results of ical_component_as_ical_string() since
+ it is a tmp buffer which is freed elsewhere.
+
+2001-09-10 Federico Mena Quintero <federico@ximian.com>
+
+ Replace struct icalattachtype by an opaque icalattach that is
+ properly reference-counted.
+
+ * src/libical/icalvalueimpl.h (struct icalattach_impl): Private
+ declaration for the icalattach type.
+ (struct icalvalue_impl): Make the v_attach field be an icalattach *.
+
+ * src/libical/icaltypes.h: Added declaration for icalattach. This
+ is now an opaque type; the implementation is in icalvalueimpl.h.
+ (struct icalattachtype): Removed.
+
+ * src/libical/icaltypes.c (icalattach_new_from_url): New function.
+ (icalattach_new_from_data): New function.
+ (icalattach_ref): New function.
+ (icalattach_unref): New function.
+ (icalattach_get_is_url): New function.
+ (icalattach_get_url): New function.
+ (icalattach_get_data): New function.
+ (icalattachtype_new): Removed.
+ (icalattachtype_free): Removed.
+ (icalattachtype_add_reference): Removed.
+ (icalattachtype_set_url): Removed.
+ (icalattachtype_get_url): Removed.
+ (icalattachtype_set_base64): Removed.
+ (icalattachtype_get_base64): Removed.
+ (icalattachtype_set_binary): Removed.
+ (icalattachtype_get_binary): Removed.
+
+ * src/libical/icalderivedvalue.c.in (icalvalue_new_attach): New
+ function; we implement it ourselves.
+ (icalvalue_set_attach): New function.
+ (icalvalue_get_attach): New function.
+
+ * src/libical/icalvalue.c (icalmemory_strdup_and_dequote): Made
+ static.
+ (icalvalue_new_clone): Clone BINARY and ATTACH values by refing
+ the old attach value.
+ (icalvalue_free): Free BINARY and ATTACH values.
+ (icalvalue_attach_as_ical_string): Handle the new icalattachtype.
+ (icalvalue_compare): Ditto.
+
+ * src/libical/Makefile.am (CLEANFILES): Added ical.h.
+
+ * design-data/*: Mark ATTACH as a custom value.
+
+2001-09-06 Damon Chaplin <damon@ximian.com>
+
+ * src/libical/icalcomponent.c (icalcomponent_merge_vtimezone): pass
+ the VTIMEZONE component to icalcomponent_compare_vtimezones(), not
+ the icaltimezone*. Strangely we weren't getting a compiler error.
+ Fixes bug #5275, hopefully.
+
+ * src/libical/icaltimezone.c (icaltimezone_dump_changes): updated so
+ it still outputs the same format, even though the '1 Jan 0001'
+ component isn't included any more.
+
+2001-08-31 Damon Chaplin <damon@ximian.com>
+
+ * zoneinfo/*: updated all of the VTIMEZONE files to try to be more
+ compatable with Outlook. i.e. We don't use seconds in UTC offsets,
+ we don't use BYMONTHDAY if we can avoid it (there are still a few uses
+ of this we need to fix), and we don't use years < 1600.
+
+ * src/libical/icalvalue.c (icalvalue_utcoffset_as_ical_string): if
+ seconds is 0 then don't output it. None of the builtin VTIMEZONE data
+ uses the seconds value any more, since it messes up iTIP with Outlook.
+ We may want to make it always round to the nearest minute, to avoid
+ interop problems.
+
+2001-08-22 Ettore Perazzoli <ettore@ximian.com>
+
+ * configure.in: Remove src/python/Makefile and src/test/Makefile.
+
+2001-08-16 Federico Mena Quintero <federico@ximian.com>
+
+ * src/libical/icalvalue.c (icalmemory_strdup_and_dequote): Dequote
+ the same characters that we know how to quote in
+ icalvalue_text_as_ical_string(). Fixes Ximian bug #7433.
+
+2001-08-01 Damon Chaplin <damon@ximian.com>
+
+ * src/libical/icaltimezone.c: removed some debugging messages.
+
+2001-07-30 Damon Chaplin <damon@ximian.com>
+
+ * src/libical/icaltimezone.c (icaltimezone_get_builtin_timezone):
+ changed the debugging message to avoid a crash on non-glibc boxes.
+ (Using %s with a NULL argument will crash them.)
+
+2001-07-30 Damon Chaplin <damon@ximian.com>
+
+ * src/libical/icalcomponent.c (icalcomponent_merge_vtimezone): copy
+ the TZID just in case the property we got it from gets modified.
+ (icalcomponent_rename_tzids_callback): break out of the loop if we
+ have renamed the TZID parameter. Otherwise our tzid variable would be
+ invalid.
+
+ * scripts/mkderivedproperties.pl (fudge_data): changed this so we can
+ set EXDATEs that are DATE values, by checking the is_date field.
+ I'm not entirely sure this is the way it should be done.
+ If it is, I'll also do this for other things like DTSTART/DTEND.
+
+ * src/libical/icalrecur.c (icalrecurrencetype_as_string): handle
+ UNTIL as a DATE value as well as a DATE-TIME.
+
+ * src/libical/icalcomponent.c (icalcomponent_compare_vtimezones):
+ fixed stupid error, getting TZID property from wrong VTIMEZONE.
+ This would only have affected iTIP stuff, with VTIMEZONEs that don't
+ use the '/' prefix (i.e. from Outlook). It probably just meant we
+ kept multiple copies of the same VTIMEZONE.
+
+ * src/libical/icaltimezone.c: removed some debugging messages.
+
+2001-07-26 JP Rosevear <jpr@ximian.com>
+
+ * src/libical/icalcomponent.c (icalcomponent_begin_component):
+ call pvl_next on i rather than itr.iter
+
+2001-07-26 Damon Chaplin <damon@ximian.com>
+
+ * src/libical/icaltimezone.c (icaltimezone_convert_time): if from_zone
+ is NULL (i.e. it is a floating time), just return.
+
+2001-07-25 Damon Chaplin <damon@ximian.com>
+
+ * src/libical/icaltimezone.c: accept an icaltimezone* of NULL for all
+ the public functions, since NULL is used to represent floating times.
+
+2001-07-25 JP Rosevear <jpr@ximian.com>
+
+ * src/libical/icalparameter.c (icalparameter_as_ical_string): if
+ the property contains ':' or ';' put the value in quotes so it
+ parses correctly
+
+2001-07-23 JP Rosevear <jpr@ximian.com>
+
+ * src/libical/icalparser.c: pass extra param to
+ icalparser_get_next_char
+ (icalparser_get_next_char): only use quote mode if the flag is set
+
+2001-07-23 Damon Chaplin <damon@ximian.com>
+
+ * src/libical/icaltime.c (icaltime_day_of_year): changed so it doesn't
+ use mktime(). We are having problems because mktime() only works
+ post 1970.
+
+2001-07-17 JP Rosevear <jpr@ximian.com>
+
+ * src/libical/icaltimezone.c
+ (icaltimezone_get_tznames_from_vtimezone): do not strdup a NULL
+ (valid) timezone
+
+2001-07-16 Damon Chaplin <damon@ximian.com>
+
+ * src/libical/icaltimezone.c
+ (icaltimezone_get_location_from_vtimezone): return NULL if we
+ couldn't find the LOCATION.
+ (icaltimezone_get_utc_offset): ifdef'd out a debugging message.
+ (icaltimezone_get_location):
+ (icaltimezone_get_latitude):
+ (icaltimezone_get_longitude): don't load the builtin timezone for
+ these. We should already have the data from reading zones.tab.
+ (icaltimezone_get_builtin_timezone_from_tzid): return NULL if the
+ TZID given is NULL or "" (i.e. a floating time).
+
+2001-07-10 Peter Williams <peterw@ximian.com>
+
+ * src/libicalss/Makefile.am (libicalss_la_SOURCES): Add the
+ COMBINEDHEADERS here and remove the EXTRA_DIST. This fixes distcheck.
+ We can't just put CONBINEDHEADERS at the bottom of _SOURCES because
+ of the $(srcdir).
+
+2001-07-11 Damon Chaplin <damon@ximian.com>
+
+ * src/libical/icaltimezone.c: only create the timezones array when we
+ need to, and make sure we free things when necessary.
+ Also added timezones_sorted variable, which we set to 0 when adding a
+ timezone. We then sort the array before doing binary searches (oops!)
+
+ * src/libical/icaltimezone.[hc]: added free_struct() arg to
+ icaltimezone_free() to specify whether to free the icaltimezone struct.
+ Also added icaltimezone_array_free() function.
+
+2001-07-10 Damon Chaplin <damon@ximian.com>
+
+ * src/libical/icaltimezone.c (icaltimezone_convert_time): don't convert
+ DATE values.
+
+ * src/libical/icaltime.c (icaltime_from_timet_with_zone):
+ (icaltime_as_timet_with_zone): changed so they do not convert DATE
+ values according to the timezone.
+
+ * src/libical/icaltime.[hc]: added icaltime_current_time_with_zone()
+ and icaltime_today() functions.
+
+2001-07-09 Damon Chaplin <damon@ximian.com>
+
+ * src/libical/icaltime.c (icaltime_adjust): forgot to compile before
+ committing. Idiot.
+
+2001-07-09 Damon Chaplin <damon@ximian.com>
+
+ * src/libical/icaltimezone.c (icaltimezone_convert_time): if the 2
+ zones are the same just return.
+
+ * src/libical/icaltime.c (icaltime_adjust): normalize the month.
+
+2001-07-03 Damon Chaplin <damon@ximian.com>
+
+ * src/libical/icalcomponent.c (icalcomponent_add_component): add the
+ icaltimezone to the timezone array of the toplevel VCALENDAR component.
+
+2001-07-03 Damon Chaplin <damon@ximian.com>
+
+ * src/libical/icalcomponent.c (icalcomponent_merge_component): fixed
+ bad assertion, '!=' -> '=='.
+ (icalcomponent_merge_vtimezone): get the TZID from vtimezone, not comp.
+
+2001-07-03 Damon Chaplin <damon@ximian.com>
+
+ * src/libical/icaltime.c:
+ * src/libical/icalcomponent.c: more timezone stuff.
+
+2001-06-28 Peter Williams <peterw@ximian.com>
+
+ * zoneinfo/Makefile.am (dist-hook): Add $(srcdir) as in install-data-local
+ rule.
+
+2001-06-28 Damon Chaplin <damon@ximian.com>
+
+ * configure.in: commented out AC_DEFINE(ICAL_ERRORS_ARE_FATAL,1).
+ We only want it to abort when there is no possibility of carrying on.
+
+2001-06-26 Damon Chaplin <damon@ximian.com>
+
+ * zoneinfo/*: stripped all blank lines from iCalendar files.
+ Apparently they aren't exactly legal. Oops.
+
+2001-06-15 JP Rosevear <jpr@ximian.com>
+
+ * zoneinfo/Makefile.am: Extra dist the zones.tab information
+
+2001-06-14 Damon Chaplin <damon@ximian.com>
+
+ * src/libical/icaltimezone.c (icaltimezone_get_latitude):
+ (icaltimezone_get_longitude): added functions to get the coords of
+ builtin timezones.
+
+2001-06-13 Damon Chaplin <damon@ximian.com>
+
+ * src/libical/icalrecur.c: merged in some new stuff from libical CVS.
+ (icalrecur_add_byrules): If no sign is given set sign to 1 (i.e.
+ default to positive).
+ (icalrecur_iterator_new): when setting up the year days array, handle
+ the case where a year has no occurrences and we have to skip it.
+ Also initialize the last.day and last.month fields.
+ (expand_by_day): set the last day of the year explicitly rather than
+ adding 1 to year and subtracting 1 from day. It is more efficient,
+ and less prone to bugs. Also rewrote a bit.
+ (expand_year_days): added code to handle BY_MONTH_DAY and BY_DAY +
+ BY_MONTH_DAY, and rewrote code to handle BY_DAY + BY_MONTH.
+ (next_year): handled the case where there are no occurrences in the
+ year.
+
+ * src/libical/icaltime.c (icaltime_adjust): new function to adjust a
+ time by a number of days/hours/minutes/seconds.
+ (icaltime_day_of_week): rewrote using a single call to mktime().
+ (icaltime_day_of_year): rewrote using a single call to mktime().
+ (icaltime_from_day_of_year): rewrote in a simpler way. The old version
+ had a bug in it.
+
+ * src/libical/icaltime.h (struct icaltimetype): added is_daylight
+ flag, so we can try to distinguish between standard and daylight time
+ when the clocks go back. Though this doesn't always resolve the
+ ambiguity.
+
+ * src/libical/icalcomponent.c: added some stuff to handle timezone
+ data connected to the calendar component. Unfinished.
+
+ * src/libical/icalyacc.y: merged in a fix from sourceforge CVS version
+ of libical, so we can handle -ve UTC offsets.
+
+ * src/libical/Makefile.am (CPPFLAGS): added PACKAGE_DATA_DIR define
+ for finding the VTIMEZONE files.
+ (libical_la_SOURCES): added icalarray.[hc] and icaltimezone.[hc].
+ (COMBINEDHEADERS): added icalarray.h and icaltimezone.h to the headers
+ to be combined into ical.h.
+
+2001-06-13 Damon Chaplin <damon@ximian.com>
+
+ * src/libical/icaltimezone.[hc]: new files to contain support for
+ timezones.
+
+ * src/libical/icalarray.[hc]: new files to provide a simple expanding
+ array datatype.
+
+2001-06-13 Damon Chaplin <damon@ximian.com>
+
+ * Makefile.am (SUBDIRS): added zoneinfo.
+
+ * configure.in (AC_OUTPUT): added zoneinfo/Makefile.
+
+ * zoneinfo/Makefile.am: new file to install & distribute the
+ VTIMEZONE data files, and the zones.tab file.
+
+ * zoneinfo/zones.tab: new file containing a list of all timezones
+ and their coordinates (so we can mark them on the world map).
+
+ * zoneinfo/*: Lots of VTIMEZONE data files added, one per timezone.
+
+2001-05-16 JP Rosevear <jpr@ximian.com>
- * icalderivedproperties.h,c Changed the signature if the CLASS
- property from TEXT to CLASS. ( enum icalproperty_class)
+ * src/libical/Makefile.am: Fixes to make it make dist and make
+ distcheck. Kind of kludgy but they seem to work. Time will tell.
-2001-06-22 Eric Busboom <eric@softwarestudio.org>
+2001-05-10 JP Roseveaer <jpr@ximian.com>
- * icaltypes.c Fixed bug in icaltriggertype_new_from_string htat
- caused it to fail.
+ * src/libical/icaltime.c (set_tz, unset_tz): plug leak
+ (icaltime_as_timet): use altered functions
+ (icaltime_utc_offset): ditto
+ (icaltime_from_day_of_year): ditto
-2001-04-12 Eric Busboom <eric@softwarestudio.org>
+2001-05-02 JP Rosevear <jpr@ximian.com>
- * icalvalue.c Added quoting to apostrophies ("'") in text
- values. This is not required by the spec, but it is necessary in
- icallangbind_property_eval_string, since ' is special in both perl
- and python.
+ * src/libical/icalparser.c (icalparser_new): initialize
+ "continuation_line" to 0
-2001-04-10 Eric Busboom <eric@softwarestudio.org>
+2001-04-18 Ettore Perazzoli <ettore@ximian.com>
- * icalvalue.c Added routine icalvalue_reset_kind. This routine is
- now called by all autogenerated icalvalue_set_*
- routines. icalvalue_reset_kind() will change the kind of the value
- based on the data in the value. Currently, it will set a value to
- either DATETIME or DATE based on the is_date flag of icaltimetype.
+ * src/Makefile.am (SUBDIRS): Don't compile the Python stuff nor
+ the tests for now; they are broken.
-2001-04-09 Eric Busboom <eric@softwarestudio.org>
+2001-04-18 Ettore Perazzoli <ettore@ximian.com>
- * icalproperty.h Converted REQUEST-STATUS to use the struct
- icalreqstat structure instead of a string
+ * src/libicalss/Makefile.am (COMBINEDHEADERS): All of these have
+ to come from the srcdir: prepend `$(srcdir)'.
+
+2001-04-18 Ettore Perazzoli <ettore@ximian.com>
+
+ * src/libical/Makefile.am (COMBINEDHEADERS): Shouldn't prepend
+ `$(top_builddir)/src/libical' to `icalderivedvalue.h',
+ `icalderivedparameter.h', `icalderivedproperty.h' here, that
+ confuses the dependencies for make.
+
+ * src/libical/Makefile.am (ical.h): Depend on
+ `$(COMBINEDHEADERS)', not `$(BUILT_SOURCES)'.
2001-04-01 Eric Busboom <eric@softwarestudio.org>
@@ -530,6 +822,10 @@
than on standard value type. These non-standard types now delegate
to stadard types.
+2001-01-24 Dan Winship <danw@helixcode.com>
+
+ * src/libical/icaltime.c: Remove unused "extern long timezone".
+
2001-01-24 Eric Busboom <eric@softwarestudio.org>
* icalfileset.c fixed icalfileset_read-from_file so it will handle
@@ -579,6 +875,72 @@
* icalgauge.c icalgaugeimpl.h, icalgauge.h., Rewrote gauge code to
use pvl-lists directly, instead of trying to reuse icalcomponent.
+2000-12-15 Ettore Perazzoli <ettore@helixcode.com>
+
+ * src/libical/Makefile.am: Build `libical-static.la'.
+
+2000-12-14 Ettore Perazzoli <ettore@helixcode.com>
+
+ * src/libical/Makefile.am (ical.h):
+
+2000-12-13 Federico Mena Quintero <federico@helixcode.com>
+
+ * src/libical/icaltime.c (icaltime_from_timet): Use gmtime()
+ unconditionally, since we want an UTC broken-down representation.
+ (icaltime_as_timet): Add the offset only if the time was supposed
+ to be in UTC; that way mktime() will get a proper localtime as
+ source data.
+
+2000-12-13 Federico Mena Quintero <federico@helixcode.com>
+
+ * src/libical/icaltime.c (icaltime_from_timet): time_t values
+ *are* in UTC by definition, so the is_utc argument is useless.
+ Removed the conversion to UTC and made the icaltimetype.is_utc be
+ TRUE always. This breaks libical's owne internal use of this
+ function, but since we do not use any of the functions that use it
+ that way, we can ignore this. This is basically a temporary
+ measure until libical does the right thing.
+
+2000-12-12 Eric Busboom <eric@softwarestudio.org>
+
+ * icalparser.c Addedd support for x-parameters.
+
+ * icalenum.c Fixed icalenum_parameter_type_to_string and
+ icalenum_property_type_to_string to property identify X- parameers
+ and properties.
+
+ * icalparameter.c Fixed icalparameter_as_ical_string to property
+ write out X-Parameters.
+
+
+2000-12-13 Christopher James Lahey <clahey@helixcode.com>
+
+ * src/libical/icalerror.h: Added a name to the parameter to
+ icalerror_set_errno.
+
+2000-12-12 Eric Busboom <eric@softwarestudio.org>
+
+ * icalparser.c Addedd support for x-parameters.
+
+ * icalenum.c Fixed icalenum_parameter_type_to_string and
+ icalenum_property_type_to_string to property identify X- parameers
+ and properties.
+
+ * icalparameter.c Fixed icalparameter_as_ical_string to property
+ write out X-Parameters.
+
+
+2000-12-11 Eric Busboom <eric@softwarestudio.org>
+
+ * icalcstp.c added empty bodies to prep_* routines so that shared
+ libraries would build.
+
+2000-12-13 Federico Mena Quintero <federico@helixcode.com>
+
+ * src/libical/Makefile.am (COMBINEDHEADERS): Removed the explicit
+ paths. Why it did *not* work on my original try when they were
+ not there, well, now I don't know.
+
2000-12-13 Ettore Perazzoli <ettore@helixcode.com>
* src/libicalvcal/Makefile.am (INCLUDES): Add
@@ -591,6 +953,9 @@
(icalvalue.h): Likewise.
(icalvalue.c): Likewise.
(icalrestriction.c): Likewise.
+ (CLEANFILES): Add `icalparameter.h', `icalparameter.c',
+ `icalproperty.h', `icalproperty.c', `icalrestriction.c',
+ `icalvalue.h', `icalvalue.c'.
(COMBINEDHEADERS): `icalvalue.h', `icalparameter.h' and
`icalproperty.h' are in builddir, not srcdir, so fix the list to
use `$(top_builddir)' instead of `$(top_srcdir)'.
@@ -598,23 +963,45 @@
(BUILT_SOURCES): Move `ical.h' here instead.
(ical.h): Don't depend on `(BUILT_SOURCES)'; this a built source
itself.
-
-2000-12-12 Eric Busboom <eric@softwarestudio.org>
- * icalparser.c Addedd support for x-parameters.
+2000-12-12 Joe Shaw <joe@helixcode.com>
- * icalenum.c Fixed icalenum_parameter_type_to_string and
- icalenum_property_type_to_string to property identify X- parameers
- and properties.
+ * src/libical/icalrecur.c: #if 0ed out some #if 1ed test code that
+ was breaking my build by #including ical.h. No cookie!
- * icalparameter.c Fixed icalparameter_as_ical_string to property
- write out X-Parameters.
+2000-12-12 Dan Winship <danw@helixcode.com>
-
-2000-12-11 Eric Busboom <eric@softwarestudio.org>
+ * configure.in: Add a check for "extern int timezone;" vs struct
+ tm tm_gmtoff, stolen from Evolution's configure.in.
- * icalcstp.c added empty bodies to prep_* routines so that shared
- libraries would build.
+ * src/libical/icaltime.c (icaltime_utc_offset,
+ icaltime_local_utc_offset): Use HAVE_TIMEZONE, add tm_gmtoff
+ support.
+
+ * src/libical/icallexer.l: Remove ical_yy_scan_buffer, ..._string,
+ and ..._bytes prototypes, since it compiles fine without them on
+ Linux, and bombs out due to prototype mismatch on my NetBSD box.
+
+2000-12-11 Federico Mena Quintero <federico@helixcode.com>
+
+ * Makefile.am:
+ * configure.in: Disable compilation of the examples directory
+ until libicalss is fixed.
+
+ * configure.in: Make AC_INIT() check for a file that is not
+ autogenerated!
+
+ * configure.in: Added check for Perl.
+
+2000-12-11 Federico Mena Quintero <federico@helixcode.com>
+
+ * configure.in (AC_OUTPUT): Fixed order of generated files to make
+ "make distcheck" work. Turn on AM_MAINTAINER_MODE.
+
+ * src/libical/Makefile.am (EXTRA_DIST): Add icalversion.h.in.
+ (COMBINEDHEADERS): Added paths to make "make distcheck" work.
+ (libical_la_SOURCES): Added headers for distribution in our weird
+ setup.
2000-12-11 JP Rosevear <jpr@helixcode.com>
@@ -630,20 +1017,10 @@
* src/libical/icalrecur.c: Likewise.
- * src/libical/icalvalue.c: Likewise.
+ * src/libical/icalvalue.c.in: Likewise.
* src/libical/icalyacc.y: Likewise.
-2000-12-11 Federico Mena Quintero <federico@helixcode.com>
-
- * configure.in (AC_OUTPUT): Fixed order of generated files to make
- "make distcheck" work. Turn on AM_MAINTAINER_MODE.
-
- * src/libical/Makefile.am (EXTRA_DIST): Add icalversion.h.in.
- (COMBINEDHEADERS): Added paths to make "make distcheck" work.
- (libical_la_SOURCES): Added headers for distribution in our weird
- setup.
-
2000-12-06 Eric Busboom <eric@softwarestudio.org>
* icaltime.c added icaltime_as_local to convert a UTC time to a
@@ -676,7 +1053,7 @@
2000-11-20 Eric Busboom <eric@softwarestudio.org>
- * icalmessage.c Many routines to create new ical messages.
+ * icalmessage.c Many routines to create new ical messages.
* icalspanlist.c Code to generate a list of the busy time f the
VEVENTS in a set. Also includes routiens to generate free and busy
@@ -689,7 +1066,7 @@
* icalrestriction.c Added more restrictions. Now handles mutual
and exclusive consitions, and checks for the reight values in
STATUS properties
-
+
2000-11-10 Eric Busboom <eric@softwarestudio.org>
@@ -715,13 +1092,18 @@
get the next avaliable busy or free time after a given time.
2000-11-06 Federico Mena Quintero <federico@helixcode.com>
-
+
* src/libical/icalvalue.c (icalvalue_recur_as_ical_string): Handle
- both the position and weekday in the by_day field.
+ both the position and weekday in the by_day field.
+
+2000-10-20 Jesse Pavel <jpavel@helixcode.com>
+
+ * src/libical/icalproperty.c: added support for the
+ icalproperty_remove_parameter() function.
2000-10-20 Eric Busboom <eric@agony.busboom.org>
- * Const correctness. Added 'const' all over everywhere.
+ * Const correctness. Added 'const' all over everywhere.
2000-10-19 Eric Busboom <eric@agony.busboom.org>
@@ -731,9 +1113,9 @@
* icalclassify.h Added multiple include protection
* icalset.h and others, got rid of parameter named "new"
-
+
2000-10-15 Eric Busboom <eric@softwarestudio.org>
-
+
* icalcomponent Added convienience functions for constructing
components: icalcomponent_new_vcalendar(), etc.
@@ -746,7 +1128,7 @@
* libical. Changed flex/bison to use the -P/-p options to set
ical_yy as a prefix. Removed prefix redefinition from icalyacc.y
-
+
2000-10-12 Eric Busboom <eric@softwarestudio.org>
* icalproperty.c Fixed icalproperty_get_{first,next}_parameter to
@@ -755,22 +1137,88 @@
* icalparameter.c Added, but did not complete, a new version of
icalparameters_from_string that does not use the hairy nested
case/switch statements of the previous version
-
-
+
+2000-10-11 Damon Chaplin <damon@helixcode.com>
+
+ * src/libical/icalparameter.c (icalparameter_as_ical_string):
+ (icalparameter_new_from_string):
+ * src/libical/icalparser.c (icalparser_add_line): add support for
+ 'X-' parameters.
+
+2000-10-07 Dan Winship <danw@helixcode.com>
+
+ * src/libical/icalyacc.y (weekday_list): Fix the semicolons in
+ this rule. Noticed by x-virge.
+
+ * src/test/Makefile.in: While I'm here, remove this from CVS, as
+ it's a generated file.
+
2000-10-02 Eric Busboom <eric@softwarestudio.org>
* ical.h ical.h and icalss.h now are concatenations of all of the
public headers for their respective libraries. Thus, only ical.h,
icalss.h and icalvcal.h need to be installed.
+2000-09-12 Ettore Perazzoli <ettore@helixcode.com>
+
+ * configure.in: AC_OUTPUT the Makefile in `src' before the stuff
+ in its subdirs.
+
+2000-09-12 JP Rosevear <jpr@helixcode.com>
+
+ * test-data/stresstest.ics: Merge missing file for distcheck
+
+ * src/libicalss/icalcstp.h: ditto
+
+ * src/libicalss/icalcsdb.h: ditto
+
2000-09-11 Eric Busboom <eric@softwarestudio.org>
- * icalvcal.c Added more comments
-
+ * icalvcal.c Added more comments
+
+2000-09-01 JP Rosevear <jpr@helixcode.com>
+
+ * configure.in: We don't need AC_PROG_RANLIB and
+ AM_PROG_LIBTOOL
+
+ * src/libical/icalyacc.y (clear_recur): Explicitly
+ set the week_start to the Monday default in case the
+ recurrence rule does not.
+
+2000-08-31 JP Rosevear <jpr@helixcode.com>
+
+ * Kill off more old, dead files
+
+2000-08-31 JP Rosevear <jpr@helixcode.com>
+
+ * MacOS: This dir is not in 0.19
+
+2000-08-31 JP Rosevear <jpr@helixcode.com>
+
+ * src/libical/CHANGES: This file is not in 0.19
+
+2000-08-31 JP Rosevear <jpr@helixcode.com>
+
+ * src/libical/.gdb_history: Kill file
+
+ * src/libical/.gdb_history: Kill file
+
+2000-08-31 JP Rosevear <jpr@helixcode.com>
+
+ * src/pvl/Makefile: Kill old file
+
+ * src/test/usecases.c: Kill old file
+
+ * src/test/.cvsignore: Update
+
+ * src/libicalvcal/.cvsignore: Update
+
+ * examples/.cvsignore: Shut up
+
2000-08-31 JP Rosevear <jpr@helixcode.com>
* configure.in: Don't list config.h in AC_OUTPUT
-
+
2000-08-26 Ettore Perazzoli <ettore@helixcode.com>
* examples/Makefile.am (INCLUDES): More `$(srcdir)' loving.
@@ -795,10 +1243,14 @@
use icalerror_check_arg_re so we can return an valid icalcompiter.
(icalcomponent_begin_component): Same.
+2000-08-24 JP Rosevear <jpr@helixcode.com>
+
+ * src/libical/icalvcal.h: Remove this duplicate file to fix build
+
2000-08-24 Federico Mena Quintero <federico@helixcode.com>
* src/test/Makefile.am: Make it work.
-
+
2000-08-04 Eric Busboom <eric@softwarestudio.org>
* stow.c Changed stow to write data to a file ( icalfileset) not a
@@ -810,7 +1262,7 @@
* icalmime.h New file that parses mime data and returns an
icalcomponent that includes all of the parts.
-
+
2000-07-26 Eric Busboom <eric@softwarestudio.org>
* icaldirset.h misc bug fixes to get deleting components to work
@@ -834,7 +1286,7 @@
* icalstore.{c,h} CHanged name to icaldirset
* icalcluster.{c,h} Changed name to icalfileset
-
+
2000-06-12 Eric Busboom <eric@softwarestudio.org>
@@ -846,6 +1298,13 @@
* icalyacc.y Added support for integers in by day lists
+2000-06-08 Ettore Perazzoli <ettore@helixcode.com>
+
+ * src/test/Makefile.am (INCLUDES): Likewise.
+
+ * src/libicalss/Makefile.am (INCLUDES): Use $(srcdir) to allow
+ builddir != srcdir.
+
2000-06-01 Eric Busboom <eric@softwarestudio.org>
* icalrecur.c moved recur code into new files
@@ -856,11 +1315,11 @@
* icaltypes.h Changed signature icaltimetype_from_timet to include
is_utc flag.
-
+
2000-03-17 Eric Busboom <eric@softwarestudio.org>
- * icalstore.c Vastly improved icalstore_test.
+ * icalstore.c Vastly improved icalstore_test.
2000-03-16 Eric Busboom <eric@softwarestudio.org>
@@ -876,5 +1335,5 @@
oriented parsing.
* icalparser.c Fixed icalparser_get_line to remove \r in input.
-
+
diff --git a/libical/design-data/properties.csv b/libical/design-data/properties.csv
index 11f977ed3d..dca6810d8f 100644
--- a/libical/design-data/properties.csv
+++ b/libical/design-data/properties.csv
@@ -5,7 +5,7 @@
"ATTENDEE","CAL-ADDRESS","CAL-ADDRESS"
"CALSCALE","TEXT","TEXT"
"CATEGORIES","TEXT","TEXT"
-"CLASS","CLASS","CLASS"
+"CLASS","TEXT","TEXT"
"COMMENT","TEXT","TEXT"
"COMPLETED","DATE-TIME","DATE-TIME"
"CONTACT","TEXT","TEXT"
@@ -31,13 +31,13 @@
"RECURRENCE-ID","DATE-TIME","DATE-TIME"
"RELATED-TO","TEXT","TEXT"
"REPEAT","INTEGER","INTEGER"
-"REQUEST-STATUS","REQUEST-STATUS","REQUEST-STATUS"
+"REQUEST-STATUS","STRING","STRING"
"RESOURCES","TEXT","TEXT"
"RRULE","RECUR","RECUR"
"SEQUENCE","INTEGER","INTEGER"
"STATUS","STATUS","STATUS"
"SUMMARY","TEXT","TEXT"
-"TRANSP","TRANSP","TRANSP"
+"TRANSP","TEXT","TEXT"
"TRIGGER","TRIGGER","DURATION"
"TZID","TEXT","TEXT"
"TZNAME","TEXT","TEXT"
@@ -47,10 +47,13 @@
"UID","TEXT","TEXT"
"URL","URI","URI"
"VERSION","TEXT","TEXT"
-"X","X","X"
+"X","TEXT","TEXT"
+"SCOPE","TEXT","TEXT"
"MAXRESULTS","INTEGER","INTEGER"
"MAXRESULTSSIZE","INTEGER","INTEGER"
+"QUERY","QUERY","QUERY"
"QUERYNAME","TEXT","TEXT"
+"TARGET","CAL-ADDRESS","CAL-ADDRESS"
"X-LIC-ERROR","TEXT","TEXT"
"X-LIC-CLUSTERCOUNT","STRING","STRING"
"X-LIC-MIMECONTENTTYPE","STRING","STRING"
@@ -59,50 +62,5 @@
"X-LIC-MIMEOPTINFO","STRING","STRING"
"X-LIC-MIMECID","STRING","STRING"
"X-LIC-MIMEFILENAME","STRING","STRING"
-"X-LIC-CLASS","X-LIC-CLASS","X-LIC-CLASS"
"ANY","NO","NO"
"NO","NO","NO"
-"#CAP Properties",,
-,"FIXME","Should be BOOLEAN"
-"ALLOW-CONFLICT","TEXT","TEXT"
-"CALID","TEXT","TEXT"
-"CALMASTER","TEXT","TEXT"
-"CARID","TEXT","TEXT"
-"CMD","CMD","CMD"
-"CSID","URI","URI"
-"DECREED","TEXT","TEXT"
-"DEFAULT-CHARSET","TEXT","TEXT"
-"DEFAULT-LOCALE","TEXT","TEXT"
-"DEFAULT-TZID","TEXT","TEXT"
-"DEFAULT-VCARS","TEXT","TEXT"
-,"FIXME","Should be UPN-FILTER"
-"DENY","TEXT","TEXT"
-,"FIXME","Should be BOOLEAN"
-"EXPAND","INTEGER","INTEGER"
-,"FIXME","Should be UPN-FILTER"
-"GRANT","TEXT","TEXT"
-"MAXDATE","DATE-TIME","DATE-TIME"
-"MINDATE","DATE-TIME","DATE-TIME"
-"NAME","TEXT","TEXT"
-"OWNER","TEXT","TEXT"
-"PERMISSION","TEXT","TEXT"
-"QUERY","QUERY","QUERY"
-"QUERYID","TEXT","TEXT"
-"RELCALID","TEXT","TEXT"
-"RESTRICTION","QUERY","QUERY"
-"SCOPE","TEXT","TEXT"
-"TARGET","CAL-ADDRESS","CAL-ADDRESS"
-"#CAP Properties","These are only allowed in VREPLY",
-"CAP-VERSION","TEXT","TEXT"
-"CAR-LEVEL","CAR-LEVEL","CAR-LEVEL"
-"COMPONENTS","TEXT","TEXT"
-"STORES-EXPANDED","TEXT","TEXT"
-"DATE-MAX","DATE-TIME","DATE-TIME"
-"DATE-MIN","DATE-TIME","DATE-TIME"
-"ITIP-VERSION","TEXT","TEXT"
-"MAX-COMPONENT-SIZE","INTEGER","INTEGER"
-"MULTIPART","TEXT","TEXT"
-"QUERY-LEVEL","QUERY-LEVEL","QUERY-LEVEL"
-"RECUR-ACCEPTED","TEXT","TEXT"
-"RECUR-EXPAND","TEXT","TEXT"
-"RECUR-LIMIT","TEXT","TEXT"
diff --git a/libical/examples/.cvsignore b/libical/examples/.cvsignore
index 14459733c2..29ef3ef4c8 100644
--- a/libical/examples/.cvsignore
+++ b/libical/examples/.cvsignore
@@ -1,6 +1,5 @@
-Makefile
-.deps
.libs
-*.lo
-*.la
+.deps
+Makefile
+Makefile.in
doesnothing
diff --git a/libical/examples/Makefile.am b/libical/examples/Makefile.am
index 7f04902d1c..99e33d3400 100644
--- a/libical/examples/Makefile.am
+++ b/libical/examples/Makefile.am
@@ -1,15 +1,10 @@
noinst_PROGRAMS = doesnothing
-if WITH_BDB4
-doesnothing_LDADD = ../src/libical/libical-evolution.la ../src/libicalss/libicalss-evolution.la ../src/libicalvcal/libicalvcal-evolution.la @BDB_DIR_LIB@/@BDB_LIB@
-else
-doesnothing_LDADD = ../src/libical/libical-evolution.la ../src/libicalss/libicalss-evolution.la ../src/libicalvcal/libicalvcal-evolution.la
-endif
+LDADD = ../src/libical/libical.a ../src/libicalss/libicalss.la ../src/libicalvcal/libicalvcal.la
+INCLUDES = -I . -I../src/libical -I$(srcdir)/../src/libical -I../src/libicalss -I../src/libicalvcal
-LIBS = @PTHREAD_LIBS@
-
-INCLUDES = -I. -I../src/libical -I$(srcdir)/../src/libical -I../src/libicalss -I../src/libicalvcal
+INCLUDES = -I. -I../src/libical -I$(srcdir)/../src/libical -I../src/libicalss -I../src/libicalvcal
doesnothing_SOURCES = \
access_components.c \
diff --git a/libical/scripts/readvaluesfile.pl b/libical/scripts/readvaluesfile.pl
index cb40db84ff..d5e2d36fd8 100644
--- a/libical/scripts/readvaluesfile.pl
+++ b/libical/scripts/readvaluesfile.pl
@@ -13,7 +13,6 @@ sub read_values_file {
s/#.*$//g;
s/\"//g;
- s/\r//g;
next if ! $_;
@@ -70,7 +69,6 @@ sub read_properties_file {
s/#.*$//g;
s/\"//g;
- s/\r//g;
next if ! $_;
@@ -102,7 +100,6 @@ sub read_parameters_file {
s/#.*$//g;
s/\"//g;
- s/\r//g;
next if ! $_;
diff --git a/libical/src/.cvsignore b/libical/src/.cvsignore
index bbc8ba00d1..c038ed7864 100644
--- a/libical/src/.cvsignore
+++ b/libical/src/.cvsignore
@@ -1,5 +1,2 @@
Makefile
-.deps
-.libs
-*.lo
-*.la
+Makefile.in \ No newline at end of file
diff --git a/libical/src/Makefile.am b/libical/src/Makefile.am
index 5e5cd331db..7a3f9fcdff 100644
--- a/libical/src/Makefile.am
+++ b/libical/src/Makefile.am
@@ -4,16 +4,6 @@ else
PYTHON_DIR =
endif
-if WITH_JAVA
-JAVA_DIR = java
-else
-JAVA_DIR =
-endif
-
-if WITH_CAP
-LIBICALCAP_DIR = libicalcap
-else
-LIBICALCAP_DIR =
-endif
-
-SUBDIRS = libical libicalss $(LIBICALCAP_DIR) libicalvcal $(PYTHON_DIR) $(JAVA_DIR) test
+# For evolution we only build libical at present.
+SUBDIRS = libical libicalvcal
+#SUBDIRS = libical libicalss libicalvcal # $(PYTHON_DIR) test
diff --git a/libical/src/libical/icalcomponent.c b/libical/src/libical/icalcomponent.c
index a892128a0e..6c222f01a9 100644
--- a/libical/src/libical/icalcomponent.c
+++ b/libical/src/libical/icalcomponent.c
@@ -4,6 +4,7 @@
$Id$
+
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
This program is free software; you can redistribute it and/or modify
@@ -37,7 +38,6 @@
#include "icalduration.h"
#include "icalperiod.h"
#include "icalparser.h"
-#include "icalrestriction.h"
#include <stdlib.h> /* for malloc */
#include <stdarg.h> /* for va_list, etc */
@@ -45,7 +45,8 @@
#include <assert.h>
#include <stdio.h> /* for fprintf */
#include <string.h> /* for strdup */
-#include <limits.h> /* for INT_MAX */
+
+#define MAX_TMP 1024
struct icalcomponent_impl
{
@@ -58,7 +59,7 @@ struct icalcomponent_impl
pvl_elem component_iterator;
icalcomponent* parent;
- /** An array of icaltimezone structs. We use this so we can do fast
+ /* An array of icaltimezone structs. We use this so we can do fast
lookup of timezones using binary searches. timezones_sorted is
set to 0 whenever we add a timezone, so we remember to sort the
array before doing a binary search. */
@@ -70,8 +71,9 @@ struct icalcomponent_impl
void icalproperty_set_parent(icalproperty* property,
icalcomponent* component);
icalcomponent* icalproperty_get_parent(icalproperty* property);
-void icalcomponent_add_children(icalcomponent *impl,va_list args);
-static icalcomponent* icalcomponent_new_impl (icalcomponent_kind kind);
+void icalcomponent_add_children(struct icalcomponent_impl *impl,va_list args);
+icalcomponent* icalcomponent_new_impl (icalcomponent_kind kind);
+int icalcomponent_property_sorter(void *a, void *b);
static void icalcomponent_merge_vtimezone (icalcomponent *comp,
icalcomponent *vtimezone,
@@ -81,7 +83,7 @@ static void icalcomponent_handle_conflicting_vtimezones (icalcomponent *comp,
icalproperty *tzid_prop,
const char *tzid,
icalarray *tzids_to_rename);
-static unsigned int icalcomponent_get_tzid_prefix_len (const char *tzid);
+static int icalcomponent_get_tzid_prefix_len (const char *tzid);
static void icalcomponent_rename_tzids(icalcomponent* comp,
icalarray* rename_table);
static void icalcomponent_rename_tzids_callback(icalparameter *param,
@@ -92,7 +94,7 @@ static int icalcomponent_compare_timezone_fn (const void *elem1,
const void *elem2);
-void icalcomponent_add_children(icalcomponent *impl, va_list args)
+void icalcomponent_add_children(struct icalcomponent_impl *impl,va_list args)
{
void* vp;
@@ -102,23 +104,25 @@ void icalcomponent_add_children(icalcomponent *impl, va_list args)
icalproperty_isa_property(vp) != 0 ) ;
if (icalcomponent_isa_component(vp) != 0 ){
- icalcomponent_add_component(impl, (icalcomponent*)vp);
+
+ icalcomponent_add_component((icalcomponent*)impl,
+ (icalcomponent*)vp);
} else if (icalproperty_isa_property(vp) != 0 ){
- icalcomponent_add_property(impl, (icalproperty*)vp);
+
+ icalcomponent_add_property((icalcomponent*)impl,
+ (icalproperty*)vp);
}
}
}
-static icalcomponent*
+icalcomponent*
icalcomponent_new_impl (icalcomponent_kind kind)
{
- icalcomponent* comp;
-
- if (!icalcomponent_kind_is_valid(kind))
- return NULL;
+ struct icalcomponent_impl* comp;
- if ( ( comp = (icalcomponent*) malloc(sizeof(icalcomponent))) == 0) {
+ if ( ( comp = (struct icalcomponent_impl*)
+ malloc(sizeof(struct icalcomponent_impl))) == 0) {
icalerror_set_errno(ICAL_NEWFAILED_ERROR);
return 0;
}
@@ -138,22 +142,18 @@ icalcomponent_new_impl (icalcomponent_kind kind)
return comp;
}
-/** @brief Constructor
- */
icalcomponent*
icalcomponent_new (icalcomponent_kind kind)
{
- return icalcomponent_new_impl(kind);
+ return (icalcomponent*)icalcomponent_new_impl(kind);
}
-/** @brief Constructor
- */
icalcomponent*
icalcomponent_vanew (icalcomponent_kind kind, ...)
{
va_list args;
- icalcomponent *impl = icalcomponent_new_impl(kind);
+ struct icalcomponent_impl *impl = icalcomponent_new_impl(kind);
if (impl == 0){
return 0;
@@ -163,26 +163,23 @@ icalcomponent_vanew (icalcomponent_kind kind, ...)
icalcomponent_add_children(impl, args);
va_end(args);
- return impl;
+ return (icalcomponent*) impl;
}
-/** @brief Constructor
- */
icalcomponent* icalcomponent_new_from_string(char* str)
{
return icalparser_parse_string(str);
}
-/** @brief Constructor
- */
-icalcomponent* icalcomponent_new_clone(icalcomponent* old)
+icalcomponent* icalcomponent_new_clone(icalcomponent* component)
{
- icalcomponent *new;
+ struct icalcomponent_impl *old = (struct icalcomponent_impl*)component;
+ struct icalcomponent_impl *new;
icalproperty *p;
icalcomponent *c;
pvl_elem itr;
- icalerror_check_arg_rz( (old!=0), "component");
+ icalerror_check_arg_rz( (component!=0), "component");
new = icalcomponent_new_impl(old->kind);
@@ -196,7 +193,8 @@ icalcomponent* icalcomponent_new_clone(icalcomponent* old)
itr = pvl_next(itr))
{
p = (icalproperty*)pvl_data(itr);
- icalcomponent_add_property(new,icalproperty_new_clone(p));
+ if (p != 0)
+ icalcomponent_add_property(new,icalproperty_new_clone(p));
}
@@ -212,15 +210,15 @@ icalcomponent* icalcomponent_new_clone(icalcomponent* old)
}
-/*** @brief Destructor
- */
+
void
-icalcomponent_free (icalcomponent* c)
+icalcomponent_free (icalcomponent* component)
{
icalproperty* prop;
icalcomponent* comp;
+ struct icalcomponent_impl *c = (struct icalcomponent_impl*)component;
- icalerror_check_arg_rv( (c!=0), "component");
+ icalerror_check_arg_rv( (component!=0), "component");
#ifdef ICAL_FREE_ON_LIST_IS_ERROR
icalerror_assert( (c->parent ==0),"Tried to free a component that is still attached to a parent component");
@@ -230,22 +228,19 @@ icalcomponent_free (icalcomponent* c)
}
#endif
- if(c != 0 ){
+ if(component != 0 ){
- if ( c->properties != 0 )
- {
- while( (prop=pvl_pop(c->properties)) != 0){
- assert(prop != 0);
- icalproperty_set_parent(prop,0);
- icalproperty_free(prop);
- }
- pvl_free(c->properties);
- }
-
+ while( (prop=pvl_pop(c->properties)) != 0){
+ assert(prop != 0);
+ icalproperty_set_parent(prop,0);
+ icalproperty_free(prop);
+ }
+
+ pvl_free(c->properties);
while( (comp=pvl_data(pvl_head(c->components))) != 0){
assert(comp!=0);
- icalcomponent_remove_component(c,comp);
+ icalcomponent_remove_component(component,comp);
icalcomponent_free(comp);
}
@@ -269,40 +264,38 @@ icalcomponent_free (icalcomponent* c)
free(c);
}
+
}
char*
-icalcomponent_as_ical_string (icalcomponent* impl)
+icalcomponent_as_ical_string (icalcomponent* component)
{
char* buf, *out_buf;
- const char* tmp_buf;
+ char* tmp_buf;
size_t buf_size = 1024;
char* buf_ptr = 0;
pvl_elem itr;
+ struct icalcomponent_impl *impl = (struct icalcomponent_impl*)component;
-/* WIN32 automatically adds the \r, Anybody else need it?
#ifdef ICAL_UNIX_NEWLINE
-*/
char newline[] = "\n";
-/*
#else
char newline[] = "\r\n";
#endif
-*/
icalcomponent *c;
icalproperty *p;
- icalcomponent_kind kind = icalcomponent_isa(impl);
+ icalcomponent_kind kind = icalcomponent_isa(component);
const char* kind_string;
buf = icalmemory_new_buffer(buf_size);
buf_ptr = buf;
- icalerror_check_arg_rz( (impl!=0), "component");
+ icalerror_check_arg_rz( (component!=0), "component");
icalerror_check_arg_rz( (kind!=ICAL_NO_COMPONENT), "component kind is ICAL_NO_COMPONENT");
- kind_string = icalcomponent_kind_to_string(kind);
+ kind_string = icalenum_component_kind_to_string(kind);
icalerror_check_arg_rz( (kind_string!=0),"Unknown kind of component");
@@ -339,7 +332,7 @@ icalcomponent_as_ical_string (icalcomponent* impl)
icalmemory_append_string(&buf, &buf_ptr, &buf_size, "END:");
icalmemory_append_string(&buf, &buf_ptr, &buf_size,
- icalcomponent_kind_to_string(kind));
+ icalenum_component_kind_to_string(kind));
icalmemory_append_string(&buf, &buf_ptr, &buf_size, newline);
out_buf = icalmemory_tmp_copy(buf);
@@ -352,8 +345,11 @@ icalcomponent_as_ical_string (icalcomponent* impl)
int
icalcomponent_is_valid (icalcomponent* component)
{
- if ( (strcmp(component->id,"comp") == 0) &&
- component->kind != ICAL_NO_COMPONENT){
+ struct icalcomponent_impl *impl = (struct icalcomponent_impl *)component;
+
+
+ if ( (strcmp(impl->id,"comp") == 0) &&
+ impl->kind != ICAL_NO_COMPONENT){
return 1;
} else {
return 0;
@@ -363,13 +359,14 @@ icalcomponent_is_valid (icalcomponent* component)
icalcomponent_kind
-icalcomponent_isa (const icalcomponent* component)
+icalcomponent_isa (icalcomponent* component)
{
- icalerror_check_arg_rx( (component!=0), "component", ICAL_NO_COMPONENT);
+ struct icalcomponent_impl *impl = (struct icalcomponent_impl *)component;
+ icalerror_check_arg_rz( (component!=0), "component");
if(component != 0)
{
- return component->kind;
+ return impl->kind;
}
return ICAL_NO_COMPONENT;
@@ -379,7 +376,7 @@ icalcomponent_isa (const icalcomponent* component)
int
icalcomponent_isa_component (void* component)
{
- icalcomponent *impl = component;
+ struct icalcomponent_impl *impl = (struct icalcomponent_impl *)component;
icalerror_check_arg_rz( (component!=0), "component");
@@ -391,32 +388,63 @@ icalcomponent_isa_component (void* component)
}
+int icalcomponent_property_sorter(void *a, void *b)
+{
+ icalproperty_kind kinda, kindb;
+ const char *ksa, *ksb;
+
+ kinda = icalproperty_isa((icalproperty*)a);
+ kindb = icalproperty_isa((icalproperty*)b);
+
+ ksa = icalenum_property_kind_to_string(kinda);
+ ksb = icalenum_property_kind_to_string(kindb);
+
+ return strcmp(ksa,ksb);
+}
+
+
void
icalcomponent_add_property (icalcomponent* component, icalproperty* property)
{
+ struct icalcomponent_impl *impl;
+
icalerror_check_arg_rv( (component!=0), "component");
icalerror_check_arg_rv( (property!=0), "property");
+ impl = (struct icalcomponent_impl*)component;
+
icalerror_assert( (!icalproperty_get_parent(property)),"The property has already been added to a component. Remove the property with icalcomponent_remove_property before calling icalcomponent_add_property");
icalproperty_set_parent(property,component);
- pvl_push(component->properties,property);
+#ifdef ICAL_INSERT_ORDERED
+ pvl_insert_ordered(impl->properties,
+ icalcomponent_property_sorter,property);
+#else
+ pvl_push(impl->properties,property);
+#endif
+
}
void
icalcomponent_remove_property (icalcomponent* component, icalproperty* property)
{
+ struct icalcomponent_impl *impl;
pvl_elem itr, next_itr;
+ struct icalproperty_impl *pimpl;
icalerror_check_arg_rv( (component!=0), "component");
icalerror_check_arg_rv( (property!=0), "property");
+ impl = (struct icalcomponent_impl*)component;
+
+ pimpl = (struct icalproperty_impl*)property;
+
icalerror_assert( (icalproperty_get_parent(property)),"The property is not a member of a component");
- for( itr = pvl_head(component->properties);
+ for( itr = pvl_head(impl->properties);
itr != 0;
itr = next_itr)
{
@@ -424,11 +452,11 @@ icalcomponent_remove_property (icalcomponent* component, icalproperty* property)
if( pvl_data(itr) == (void*)property ){
- if (component->property_iterator == itr){
- component->property_iterator = pvl_next(itr);
+ if (impl->property_iterator == itr){
+ impl->property_iterator = pvl_next(itr);
}
- pvl_remove( component->properties, itr);
+ pvl_remove( impl->properties, itr);
icalproperty_set_parent(property,0);
}
}
@@ -440,10 +468,11 @@ icalcomponent_count_properties (icalcomponent* component,
{
int count=0;
pvl_elem itr;
+ struct icalcomponent_impl *impl = (struct icalcomponent_impl*)component;
icalerror_check_arg_rz( (component!=0), "component");
- for( itr = pvl_head(component->properties);
+ for( itr = pvl_head(impl->properties);
itr != 0;
itr = pvl_next(itr))
{
@@ -460,19 +489,23 @@ icalcomponent_count_properties (icalcomponent* component,
icalproperty* icalcomponent_get_current_property (icalcomponent* component)
{
+
+ struct icalcomponent_impl *c = (struct icalcomponent_impl*)component;
icalerror_check_arg_rz( (component!=0),"component");
- if ((component->property_iterator==0)){
+ if ((c->property_iterator==0)){
return 0;
}
- return (icalproperty*) pvl_data(component->property_iterator);
+ return (icalproperty*) pvl_data(c->property_iterator);
+
}
icalproperty*
-icalcomponent_get_first_property (icalcomponent* c, icalproperty_kind kind)
+icalcomponent_get_first_property (icalcomponent* component, icalproperty_kind kind)
{
- icalerror_check_arg_rz( (c!=0),"component");
+ struct icalcomponent_impl *c = (struct icalcomponent_impl*)component;
+ icalerror_check_arg_rz( (component!=0),"component");
for( c->property_iterator = pvl_head(c->properties);
c->property_iterator != 0;
@@ -489,9 +522,10 @@ icalcomponent_get_first_property (icalcomponent* c, icalproperty_kind kind)
}
icalproperty*
-icalcomponent_get_next_property (icalcomponent* c, icalproperty_kind kind)
+icalcomponent_get_next_property (icalcomponent* component, icalproperty_kind kind)
{
- icalerror_check_arg_rz( (c!=0),"component");
+ struct icalcomponent_impl *c = (struct icalcomponent_impl*)component;
+ icalerror_check_arg_rz( (component!=0),"component");
if (c->property_iterator == 0){
return 0;
@@ -520,28 +554,31 @@ icalcomponent_get_properties (icalcomponent* component, icalproperty_kind kind);
void
icalcomponent_add_component (icalcomponent* parent, icalcomponent* child)
{
+ struct icalcomponent_impl *impl, *cimpl;
+
icalerror_check_arg_rv( (parent!=0), "parent");
icalerror_check_arg_rv( (child!=0), "child");
- if (child->parent !=0) {
- icalerror_set_errno(ICAL_USAGE_ERROR);
- }
+ impl = (struct icalcomponent_impl*)parent;
+ cimpl = (struct icalcomponent_impl*)child;
+
+ icalerror_assert( (cimpl->parent ==0),"The child component has already been added to a parent component. Remove the component with icalcomponent_remove_component before calling icalcomponent_add_component");
- child->parent = parent;
+ cimpl->parent = parent;
- pvl_push(parent->components,child);
+ pvl_push(impl->components,child);
/* If the new component is a VTIMEZONE, add it to our array. */
- if (child->kind == ICAL_VTIMEZONE_COMPONENT) {
+ if (cimpl->kind == ICAL_VTIMEZONE_COMPONENT) {
/* FIXME: Currently we are also creating this array when loading in
a builtin VTIMEZONE, when we don't need it. */
- if (!parent->timezones)
- parent->timezones = icaltimezone_array_new ();
+ if (!impl->timezones)
+ impl->timezones = icaltimezone_array_new ();
- icaltimezone_array_append_from_vtimezone (parent->timezones, child);
+ icaltimezone_array_append_from_vtimezone (impl->timezones, child);
/* Flag that we need to sort it before doing any binary searches. */
- parent->timezones_sorted = 0;
+ impl->timezones_sorted = 0;
}
}
@@ -549,28 +586,32 @@ icalcomponent_add_component (icalcomponent* parent, icalcomponent* child)
void
icalcomponent_remove_component (icalcomponent* parent, icalcomponent* child)
{
+ struct icalcomponent_impl *impl,*cimpl;
pvl_elem itr, next_itr;
icalerror_check_arg_rv( (parent!=0), "parent");
icalerror_check_arg_rv( (child!=0), "child");
+ impl = (struct icalcomponent_impl*)parent;
+ cimpl = (struct icalcomponent_impl*)child;
+
/* If the component is a VTIMEZONE, remove it from our array as well. */
- if (child->kind == ICAL_VTIMEZONE_COMPONENT) {
+ if (cimpl->kind == ICAL_VTIMEZONE_COMPONENT) {
icaltimezone *zone;
int i, num_elements;
- num_elements = parent->timezones ? parent->timezones->num_elements : 0;
+ num_elements = impl->timezones ? impl->timezones->num_elements : 0;
for (i = 0; i < num_elements; i++) {
- zone = icalarray_element_at (parent->timezones, i);
+ zone = icalarray_element_at (impl->timezones, i);
if (icaltimezone_get_component (zone) == child) {
icaltimezone_free (zone, 0);
- icalarray_remove_element_at (parent->timezones, i);
+ icalarray_remove_element_at (impl->timezones, i);
break;
}
}
}
- for( itr = pvl_head(parent->components);
+ for( itr = pvl_head(impl->components);
itr != 0;
itr = next_itr)
{
@@ -578,16 +619,16 @@ icalcomponent_remove_component (icalcomponent* parent, icalcomponent* child)
if( pvl_data(itr) == (void*)child ){
- if (parent->component_iterator == itr){
+ if (impl->component_iterator == itr){
/* Don't let the current iterator become invalid */
/* HACK. The semantics for this are troubling. */
- parent->component_iterator =
- pvl_next(parent->component_iterator);
+ impl->component_iterator =
+ pvl_next(impl->component_iterator);
}
- pvl_remove( parent->components, itr);
- child->parent = 0;
+ pvl_remove( impl->components, itr);
+ cimpl->parent = 0;
break;
}
}
@@ -600,10 +641,11 @@ icalcomponent_count_components (icalcomponent* component,
{
int count=0;
pvl_elem itr;
+ struct icalcomponent_impl *impl = (struct icalcomponent_impl*)component;
icalerror_check_arg_rz( (component!=0), "component");
- for( itr = pvl_head(component->components);
+ for( itr = pvl_head(impl->components);
itr != 0;
itr = pvl_next(itr))
{
@@ -619,20 +661,24 @@ icalcomponent_count_components (icalcomponent* component,
icalcomponent*
icalcomponent_get_current_component(icalcomponent* component)
{
+ struct icalcomponent_impl *c = (struct icalcomponent_impl*)component;
+
icalerror_check_arg_rz( (component!=0),"component");
- if (component->component_iterator == 0){
+ if (c->component_iterator == 0){
return 0;
}
- return (icalcomponent*) pvl_data(component->component_iterator);
+ return (icalcomponent*) pvl_data(c->component_iterator);
}
icalcomponent*
-icalcomponent_get_first_component (icalcomponent* c,
+icalcomponent_get_first_component (icalcomponent* component,
icalcomponent_kind kind)
{
- icalerror_check_arg_rz( (c!=0),"component");
+ struct icalcomponent_impl *c = (struct icalcomponent_impl*)component;
+
+ icalerror_check_arg_rz( (component!=0),"component");
for( c->component_iterator = pvl_head(c->components);
c->component_iterator != 0;
@@ -651,9 +697,11 @@ icalcomponent_get_first_component (icalcomponent* c,
icalcomponent*
-icalcomponent_get_next_component (icalcomponent* c, icalcomponent_kind kind)
+icalcomponent_get_next_component (icalcomponent* component, icalcomponent_kind kind)
{
- icalerror_check_arg_rz( (c!=0),"component");
+ struct icalcomponent_impl *c = (struct icalcomponent_impl*)component;
+
+ icalerror_check_arg_rz( (component!=0),"component");
if (c->component_iterator == 0){
return 0;
@@ -686,54 +734,31 @@ icalcomponent* icalcomponent_get_first_real_component(icalcomponent *c)
if(kind == ICAL_VEVENT_COMPONENT ||
kind == ICAL_VTODO_COMPONENT ||
- kind == ICAL_VJOURNAL_COMPONENT ||
- kind == ICAL_VFREEBUSY_COMPONENT ||
- kind == ICAL_VQUERY_COMPONENT ||
- kind == ICAL_VREPLY_COMPONENT ||
- kind == ICAL_VAGENDA_COMPONENT){
+ kind == ICAL_VJOURNAL_COMPONENT ){
return comp;
}
}
return 0;
}
-
-/** @brief Get the timespan covered by this component, in UTC
- * (deprecated)
- *
- * see icalcomponent_foreach_recurrence() for a better way to
- * extract spans from an component.
- *
- * This method can be called on either a VCALENDAR or any real
- * component. If the VCALENDAR contains no real component, but
- * contains a VTIMEZONE, we return that span instead.
- * This might not be a desirable behavior; we keep it for now
- * for backward compatibility, but it might be deprecated at a
- * future time.
- *
- * FIXME this API needs to be clarified. DTEND is defined as the
- * first available time after the end of this event, so the span
- * should actually end 1 second before DTEND.
- */
-
-icaltime_span icalcomponent_get_span(icalcomponent* comp)
+struct icaltime_span icalcomponent_get_span(icalcomponent* comp)
{
icalcomponent *inner;
+ icalproperty *p, *duration;
icalcomponent_kind kind;
- icaltime_span span;
- struct icaltimetype start, end;
+ struct icaltime_span span;
+ struct icaltimetype start;
span.start = 0;
span.end = 0;
span.is_busy= 1;
/* initial Error checking */
- if (comp == NULL) {
- return span;
- }
- /* FIXME this might go away */
+/* icalerror_check_arg_rz( (comp!=0),"comp");*/
+
kind = icalcomponent_isa(comp);
+
if(kind == ICAL_VCALENDAR_COMPONENT){
inner = icalcomponent_get_first_real_component(comp);
@@ -765,330 +790,73 @@ icaltime_span icalcomponent_get_span(icalcomponent* comp)
}
- /* Get to work. starting with DTSTART */
- start = icalcomponent_get_dtstart(comp);
- if (icaltime_is_null_time(start)) {
- return span;
- }
- span.start = icaltime_as_timet_with_zone(start,
- icaltimezone_get_utc_timezone());
- /* The end time could be specified as either a DTEND or a DURATION */
- /* icalcomponent_get_dtend takes care of these cases. */
- end = icalcomponent_get_dtend(comp);
- if (icaltime_is_null_time(end)) {
- if (!icaltime_is_date(start)) {
- /* If dtstart is a DATE-TIME and there is no DTEND nor DURATION
- it takes no time */
- span.start = 0;
- return span;
- } else {
- end = start;
- }
- }
-
- span.end = icaltime_as_timet_with_zone(end,
- icaltimezone_get_utc_timezone());
- if (icaltime_is_date(start)) {
- /* Until the end of the day*/
- span.end += 60*60*24 - 1;
- }
- return span;
+ /* Get to work. starting with DTSTART */
-}
+ p = icalcomponent_get_first_property(inner, ICAL_DTSTART_PROPERTY);
-/**
- * Decide if this recurrance is acceptable
- *
- * @param comp A valid icalcomponent.
- * @param dtstart The base dtstart value for this component.
- * @param recurtime The time to test against.
- *
- * @return true if the recurrence value is excluded, false otherwise.
- *
- * This function decides if a specific recurrence value is
- * excluded by EXRULE or EXDATE properties.
- *
- * It's not the most efficient code. You might get better performance
- * if you assume that recurtime is always increasing for each
- * call. Then you could:
- *
- * - sort the EXDATE values
- * - save the state of each EXRULE iterator for the next call.
- *
- * In this case though you don't need to worry how you call this
- * function. It will always return the correct result.
- */
-
-int icalproperty_recurrence_is_excluded(icalcomponent *comp,
- struct icaltimetype *dtstart,
- struct icaltimetype *recurtime) {
- icalproperty *exdate, *exrule;
-
- if (comp == NULL ||
- dtstart == NULL ||
- recurtime == NULL ||
- icaltime_is_null_time(*recurtime))
- /* BAD DATA */
- return 1;
-
- /** first test against the exdate values **/
- for (exdate = icalcomponent_get_first_property(comp,ICAL_EXDATE_PROPERTY);
- exdate != NULL;
- exdate = icalcomponent_get_next_property(comp,ICAL_EXDATE_PROPERTY)) {
-
- struct icaltimetype exdatetime = icalproperty_get_exdate(exdate);
-
- if (icaltime_compare(*recurtime, exdatetime) == 0) {
- /** MATCHED **/
- return 1;
+ if (p ==0 ) {
+ icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
+ /*icalerror_warn("icalcomponent_get_span: component has no DTSTART time");*/
+ return span;
}
- }
- /** Now test against the EXRULEs **/
- for (exrule = icalcomponent_get_first_property(comp,ICAL_EXRULE_PROPERTY);
- exdate != NULL;
- exdate = icalcomponent_get_next_property(comp,ICAL_EXRULE_PROPERTY)) {
-
- struct icalrecurrencetype recur = icalproperty_get_exrule(exrule);
- icalrecur_iterator *exrule_itr = icalrecur_iterator_new(recur, *dtstart);
- struct icaltimetype exrule_time;
-
- while (1) {
- int result;
- exrule_time = icalrecur_iterator_next(exrule_itr);
-
- if (icaltime_is_null_time(exrule_time))
- break;
-
- result = icaltime_compare(*recurtime, exrule_time);
- if (result == 0) {
- icalrecur_iterator_free(exrule_itr);
- return 1; /** MATCH **/
- }
- if (result == 1)
- break; /** exrule_time > recurtime **/
- }
- icalrecur_iterator_free(exrule_itr);
- }
+ start = icalproperty_get_dtstart(p);
- return 0; /** no matches **/
-}
+ icalerror_clear_errno();
-/**
- * @brief Return the busy status based on the TRANSP property.
- *
- * @param comp A valid icalcomponent.
- *
- * @return 1 if the event is a busy item, 0 if it is not.
- */
-
-static int icalcomponent_is_busy(icalcomponent *comp) {
- icalproperty *transp;
- enum icalproperty_status status;
- int ret = 1;
+ /* FIXME: Needs updating to new icaltimezone functions. */
+#if 0
+ span.start = icalcomponent_convert_time(p);
+#endif
- /** @todo check access control here, converting busy->free if the
- permissions do not allow access... */
+#ifdef TEST_CONVERT_TIME
+ printf("convert time:\n %s %s",
+ icalproperty_as_ical_string(p), ctime(&span.start));
+#endif
- /* Is this a busy time? Check the TRANSP property */
- transp = icalcomponent_get_first_property(comp, ICAL_TRANSP_PROPERTY);
-
- if (transp) {
- icalvalue *transp_val = icalproperty_get_value(transp);
-
- switch (icalvalue_get_transp(transp_val)) {
- case ICAL_TRANSP_OPAQUE:
- case ICAL_TRANSP_OPAQUENOCONFLICT:
- case ICAL_TRANSP_NONE:
- ret = 1;
- break;
- case ICAL_TRANSP_TRANSPARENT:
- case ICAL_TRANSP_TRANSPARENTNOCONFLICT:
- ret = 0;
- break;
- default:
- ret = 0;
- break;
- }
- }
- status = icalcomponent_get_status(comp);
- if (ret && status) {
- switch (status) {
- case ICAL_STATUS_CANCELLED:
- case ICAL_STATUS_TENTATIVE:
- ret = 0;
- break;
- default:
- break;
+ if(icalerrno != ICAL_NO_ERROR){
+ span.start = 0;
+ return span;
}
- }
- return(ret);
-}
-
-
-
-
-/**
- * @brief cycle through all recurrances of an event
- *
- * @param comp A valid VEVENT component
- * @param start Ignore timespans before this
- * @param end Ignore timespans after this
- * @param callback Function called for each timespan within the range
- * @param callback_data Pointer passed back to the callback function
- *
- * This function will call the specified callback function for once
- * for the base value of DTSTART, and foreach recurring date/time
- * value.
- *
- * It will filter out events that are specified as an EXDATE or an EXRULE.
- *
- * @todo We do not filter out duplicate RRULES/RDATES
- * @todo We do not handle RDATEs with explicit periods
- */
-
-void icalcomponent_foreach_recurrence(icalcomponent* comp,
- struct icaltimetype start,
- struct icaltimetype end,
- void (*callback)(icalcomponent *comp,
- struct icaltime_span *span,
- void *data),
- void *callback_data)
-{
- struct icaltimetype dtstart, dtend;
- icaltime_span recurspan, basespan, limit_span;
- time_t limit_start, limit_end;
- int dtduration;
- icalproperty *rrule, *rdate;
- struct icaldurationtype dur;
- pvl_elem property_iterator; /* for saving the iterator */
-
- if (comp == NULL || callback == NULL)
- return;
-
- dtstart = icalcomponent_get_dtstart(comp);
-
- if (icaltime_is_null_time(dtstart))
- return;
-
-
- /* The end time could be specified as either a DTEND or a DURATION */
- /* icalcomponent_get_dtend takes care of these cases. */
- dtend = icalcomponent_get_dtend(comp);
-
- /* Now set up the base span for this item, corresponding to the
- base DTSTART and DTEND */
- basespan = icaltime_span_new(dtstart, dtend, 1);
-
- basespan.is_busy = icalcomponent_is_busy(comp);
-
-
- /** Calculate the ceiling and floor values.. **/
- limit_start = icaltime_as_timet_with_zone(start, icaltimezone_get_utc_timezone());
- if (!icaltime_is_null_time(end))
- limit_end = icaltime_as_timet_with_zone(end, icaltimezone_get_utc_timezone());
- else
- limit_end = INT_MAX; /* max 32 bit time_t */
-
- limit_span.start = limit_start;
- limit_span.end = limit_end;
-
-
- /* Do the callback for the initial DTSTART entry */
-
- if (!icalproperty_recurrence_is_excluded(comp, &dtstart, &dtstart)) {
- /** call callback action **/
- if (icaltime_span_overlaps(&basespan, &limit_span))
- (*callback) (comp, &basespan, callback_data);
- }
-
- recurspan = basespan;
- dtduration = basespan.end - basespan.start;
-
- /* Now cycle through the rrule entries */
- for (rrule = icalcomponent_get_first_property(comp,ICAL_RRULE_PROPERTY);
- rrule != NULL;
- rrule = icalcomponent_get_next_property(comp,ICAL_RRULE_PROPERTY)) {
-
- struct icalrecurrencetype recur = icalproperty_get_rrule(rrule);
- icalrecur_iterator *rrule_itr = icalrecur_iterator_new(recur, dtstart);
- struct icaltimetype rrule_time;
-
- while (1) {
- rrule_time = icalrecur_iterator_next(rrule_itr);
-
- if (icaltime_is_null_time(rrule_time))
- break;
-
- if (!icaltime_compare(rrule_time, dtstart))
- continue;
-
- dur = icaltime_subtract(rrule_time, dtstart);
-
- recurspan.start = basespan.start + icaldurationtype_as_int(dur);
- recurspan.end = recurspan.start + dtduration;
-
- /** save the iterator ICK! **/
- property_iterator = comp->property_iterator;
-
- if (!icalproperty_recurrence_is_excluded(comp, &dtstart, &rrule_time)) {
- /** call callback action **/
- if (icaltime_span_overlaps(&recurspan, &limit_span))
- (*callback) (comp, &recurspan, callback_data);
- }
- comp->property_iterator = property_iterator;
- } /* end of iteration over a specific RRULE */
-
- icalrecur_iterator_free(rrule_itr);
- } /* end of RRULE loop */
-
-
- /** Now process RDATE entries **/
- for (rdate = icalcomponent_get_first_property(comp,ICAL_RDATE_PROPERTY);
- rdate != NULL;
- rdate = icalcomponent_get_next_property(comp,ICAL_RDATE_PROPERTY)) {
-
- struct icaldatetimeperiodtype rdate_period = icalproperty_get_rdate(rdate);
-
- /** RDATES can specify raw datetimes, periods, or dates.
- we only support raw datetimes for now..
- @todo Add support for other types **/
-
- if (icaltime_is_null_time(rdate_period.time))
- continue;
-
- dur = icaltime_subtract(rdate_period.time, dtstart);
+ /* The end time could be specified as either a DTEND or a DURATION */
+ p = icalcomponent_get_first_property(inner, ICAL_DTEND_PROPERTY);
+ duration = icalcomponent_get_first_property(inner, ICAL_DURATION_PROPERTY);
- recurspan.start = basespan.start + icaldurationtype_as_int(dur);
- recurspan.end = recurspan.start + dtduration;
+ if (p==0 && duration == 0 && start.is_date != 1) {
+ icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
+ /*icalerror_warn("icalcomponent_get_span: component has neither DTEND nor DURATION time");*/
+ span.start = 0;
+ return span;
+ }
- /** save the iterator ICK! **/
- property_iterator = comp->property_iterator;
+ if (p!=0){
+ /* FIXME: Needs updating to new icaltimezone functions. */
+#if 0
+ span.end = icalcomponent_convert_time(p);
+#endif
+ } else if (start.is_date == 1) {
+ /* Duration is all day */
+ span.end = span.start + 60*60*24;
+ } else {
+ /* Use the duration */
+ struct icaldurationtype dur;
+ time_t durt;
+
+
+ dur = icalproperty_get_duration(duration);
- if (!icalproperty_recurrence_is_excluded(comp, &dtstart, &rdate_period.time)) {
- /** call callback action **/
- (*callback) (comp, &recurspan, callback_data);
+ durt = icaldurationtype_as_int(dur);
+ span.end = span.start+durt;
}
- comp->property_iterator = property_iterator;
- }
-}
-
+ return span;
-int icalcomponent_check_restrictions(icalcomponent* comp){
- icalerror_check_arg_rz(comp!=0,"comp");
- return icalrestriction_check(comp);
}
-/** @brief returns the number of errors encountered parsing the data
- *
- * This function counts the number times the X-LIC-ERROR occurs
- * in the data structure.
- */
int icalcomponent_count_errors(icalcomponent* component)
{
@@ -1096,8 +864,9 @@ int icalcomponent_count_errors(icalcomponent* component)
icalproperty *p;
icalcomponent *c;
pvl_elem itr;
+ struct icalcomponent_impl *impl = (struct icalcomponent_impl*)component;
- for( itr = pvl_head(component->properties);
+ for( itr = pvl_head(impl->properties);
itr != 0;
itr = pvl_next(itr))
{
@@ -1110,7 +879,7 @@ int icalcomponent_count_errors(icalcomponent* component)
}
- for( itr = pvl_head(component->components);
+ for( itr = pvl_head(impl->components);
itr != 0;
itr = pvl_next(itr))
{
@@ -1129,8 +898,9 @@ void icalcomponent_strip_errors(icalcomponent* component)
icalproperty *p;
icalcomponent *c;
pvl_elem itr, next_itr;
+ struct icalcomponent_impl *impl = (struct icalcomponent_impl*)component;
- for( itr = pvl_head(component->properties);
+ for( itr = pvl_head(impl->properties);
itr != 0;
itr = next_itr)
{
@@ -1143,7 +913,7 @@ void icalcomponent_strip_errors(icalcomponent* component)
}
}
- for( itr = pvl_head(component->components);
+ for( itr = pvl_head(impl->components);
itr != 0;
itr = pvl_next(itr))
{
@@ -1197,14 +967,16 @@ void icalcomponent_convert_errors(icalcomponent* component)
}
default: {
- break;
}
}
if (rst.code != ICAL_UNKNOWN_STATUS){
rst.debug = icalproperty_get_xlicerror(p);
icalcomponent_add_property(component,
- icalproperty_new_requeststatus(rst));
+ icalproperty_new_requeststatus(
+ icalreqstattype_as_string(rst)
+ )
+ );
icalcomponent_remove_property(component,p);
}
@@ -1222,12 +994,16 @@ void icalcomponent_convert_errors(icalcomponent* component)
icalcomponent* icalcomponent_get_parent(icalcomponent* component)
{
- return component->parent;
+ struct icalcomponent_impl *c = (struct icalcomponent_impl*)component;
+
+ return c->parent;
}
void icalcomponent_set_parent(icalcomponent* component, icalcomponent* parent)
{
- component->parent = parent;
+ struct icalcomponent_impl *c = (struct icalcomponent_impl*)component;
+
+ c->parent = parent;
}
icalcompiter icalcompiter_null = {ICAL_NO_COMPONENT,0};
@@ -1246,7 +1022,6 @@ static struct icalcomponent_kind_map component_map[] =
{ ICAL_VTODO_COMPONENT, "VTODO" },
{ ICAL_VJOURNAL_COMPONENT, "VJOURNAL" },
{ ICAL_VCALENDAR_COMPONENT, "VCALENDAR" },
- { ICAL_VAGENDA_COMPONENT, "VAGENDA" },
{ ICAL_VFREEBUSY_COMPONENT, "VFREEBUSY" },
{ ICAL_VTIMEZONE_COMPONENT, "VTIMEZONE" },
{ ICAL_VALARM_COMPONENT, "VALARM" },
@@ -1256,10 +1031,9 @@ static struct icalcomponent_kind_map component_map[] =
{ ICAL_VSCHEDULE_COMPONENT, "SCHEDULE" },
/* CAP components */
+ { ICAL_VQUERY_COMPONENT, "VQUERY" },
{ ICAL_VCAR_COMPONENT, "VCAR" },
{ ICAL_VCOMMAND_COMPONENT, "VCOMMAND" },
- { ICAL_VQUERY_COMPONENT, "VQUERY" },
- { ICAL_VREPLY_COMPONENT, "VREPLY" },
/* libical private components */
{ ICAL_XLICINVALID_COMPONENT, "X-LIC-UNKNOWN" },
@@ -1272,16 +1046,6 @@ static struct icalcomponent_kind_map component_map[] =
};
-int icalcomponent_kind_is_valid(const icalcomponent_kind kind)
-{
- int i = 0;
- do {
- if (component_map[i].kind == kind)
- return 1;
- } while (component_map[i++].kind != ICAL_NO_COMPONENT);
-
- return 0;
-}
const char* icalcomponent_kind_to_string(icalcomponent_kind kind)
{
@@ -1319,15 +1083,15 @@ icalcomponent_kind icalcomponent_string_to_kind(const char* string)
icalcompiter
icalcomponent_begin_component(icalcomponent* component,icalcomponent_kind kind)
{
+ struct icalcomponent_impl *impl = (struct icalcomponent_impl*)component;
icalcompiter itr;
pvl_elem i;
itr.kind = kind;
- itr.iter = NULL;
- icalerror_check_arg_re(component!=0,"component",icalcompiter_null);
+ icalerror_check_arg_re( (component!=0),"component",icalcompiter_null);
- for( i = pvl_head(component->components); i != 0; i = pvl_next(i)) {
+ for( i = pvl_head(impl->components); i != 0; i = pvl_next(i)) {
icalcomponent *c = (icalcomponent*) pvl_data(i);
@@ -1345,14 +1109,15 @@ icalcomponent_begin_component(icalcomponent* component,icalcomponent_kind kind)
icalcompiter
icalcomponent_end_component(icalcomponent* component,icalcomponent_kind kind)
{
+ struct icalcomponent_impl *impl = (struct icalcomponent_impl*)component;
icalcompiter itr;
pvl_elem i;
itr.kind = kind;
- icalerror_check_arg_re(component!=0,"component",icalcompiter_null);
+ icalerror_check_arg_re( (component!=0),"component",icalcompiter_null);
- for( i = pvl_tail(component->components); i != 0; i = pvl_prior(i)) {
+ for( i = pvl_tail(impl->components); i != 0; i = pvl_prior(i)) {
icalcomponent *c = (icalcomponent*) pvl_data(i);
@@ -1433,240 +1198,140 @@ icalcomponent* icalcomponent_get_inner(icalcomponent* comp)
}
}
-/** @brief sets the METHOD property to the given method
- */
-void icalcomponent_set_method(icalcomponent* comp, icalproperty_method method)
+void icalcomponent_set_dtstart(icalcomponent* comp, struct icaltimetype v)
{
- icalproperty *prop
- = icalcomponent_get_first_property(comp, ICAL_METHOD_PROPERTY);
-
-
- if (prop == 0){
- prop = icalproperty_new_method(method);
- icalcomponent_add_property(comp, prop);
- }
-
- icalproperty_set_method(prop,method);
-
-}
-
-/** @brief returns the METHOD property
- */
-icalproperty_method icalcomponent_get_method(icalcomponent* comp)
-{
+ icalcomponent *inner = icalcomponent_get_inner(comp);
icalproperty *prop
- = icalcomponent_get_first_property(comp,ICAL_METHOD_PROPERTY);
+ = icalcomponent_get_first_property(inner, ICAL_DTSTART_PROPERTY);
- if (prop == 0){
- return ICAL_METHOD_NONE;
- }
-
- return icalproperty_get_method(prop);
-}
-
-#define ICALSETUPSET(p_kind) \
- icalcomponent *inner; \
- icalproperty *prop; \
- icalerror_check_arg_rv(comp!=0,"comp");\
- inner = icalcomponent_get_inner(comp); \
- if(inner == 0){\
- icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);\
- return;\
- }\
- prop = icalcomponent_get_first_property(inner, p_kind);
-
-
-/** @brief Set DTSTART property to given icaltime
- *
- * This method respects the icaltime type (DATE vs DATE-TIME) and
- * timezone (or lack thereof).
- */
-void icalcomponent_set_dtstart(icalcomponent* comp, struct icaltimetype v)
-{
- char *tzid;
- ICALSETUPSET(ICAL_DTSTART_PROPERTY);
if (prop == 0){
prop = icalproperty_new_dtstart(v);
icalcomponent_add_property(inner, prop);
- } else {
- icalproperty_remove_parameter_by_kind(prop, ICAL_TZID_PARAMETER);
}
icalproperty_set_dtstart(prop,v);
- if ((tzid = icaltime_get_tzid(v)) != NULL && !icaltime_is_utc(v)) {
- icalproperty_add_parameter(prop, icalparameter_new_tzid(tzid));
- }
}
-/** @brief Get a DATE or DATE-TIME property as an icaltime
- *
- * If the property is a DATE-TIME with a timezone parameter and a
- * corresponding VTIMEZONE is present in the component, the
- * returned component will already be in the correct timezone;
- * otherwise the caller is responsible for converting it.
- *
- * FIXME this is useless until we can flag the failure
- */
-static struct icaltimetype
-icalcomponent_get_datetime(icalcomponent *comp, icalproperty *prop) {
-
- icalcomponent *c;
- icalparameter *param;
- struct icaltimetype ret;
-
- ret = icalvalue_get_datetime(icalproperty_get_value(prop));
-
- if ((param = icalproperty_get_first_parameter(prop, ICAL_TZID_PARAMETER))
- != NULL) {
- const char *tzid = icalparameter_get_tzid(param);
- icaltimezone *tz = NULL;
-
- for (c = comp; c != NULL; c = icalcomponent_get_parent(c)) {
- tz = icalcomponent_get_timezone(c, tzid);
- if (tz != NULL)
- break;
- }
-
- if (tz == NULL)
- tz = icaltimezone_get_builtin_timezone(tzid);
- if (tz != NULL)
- ret = icaltime_set_timezone(&ret, tz);
- }
-
- return ret;
-}
-
-/** @brief Get DTSTART property as an icaltime
- *
- * If DTSTART is a DATE-TIME with a timezone parameter and a
- * corresponding VTIMEZONE is present in the component, the
- * returned component will already be in the correct timezone;
- * otherwise the caller is responsible for converting it.
- *
- * FIXME this is useless until we can flag the failure
- */
struct icaltimetype icalcomponent_get_dtstart(icalcomponent* comp)
{
icalcomponent *inner = icalcomponent_get_inner(comp);
- icalproperty *prop;
+ icalproperty *prop
+ = icalcomponent_get_first_property(inner,ICAL_DTSTART_PROPERTY);
- prop = icalcomponent_get_first_property(inner,ICAL_DTSTART_PROPERTY);
if (prop == 0){
return icaltime_null_time();
}
-
- return icalcomponent_get_datetime(comp, prop);
+
+ return icalproperty_get_dtstart(prop);
}
-/** @brief Get DTEND property as an icaltime
- *
- * If a DTEND property is not present but a DURATION is, we use
- * that to determine the proper end.
- *
- * If DTSTART is a DATE-TIME with a timezone parameter and a
- * corresponding VTIMEZONE is present in the component, the
- * returned component will already be in the correct timezone;
- * otherwise the caller is responsible for converting it.
- *
- * FIXME this is useless until we can flag the failure
- */
+
struct icaltimetype icalcomponent_get_dtend(icalcomponent* comp)
{
icalcomponent *inner = icalcomponent_get_inner(comp);
+
icalproperty *end_prop
= icalcomponent_get_first_property(inner,ICAL_DTEND_PROPERTY);
+
icalproperty *dur_prop
= icalcomponent_get_first_property(inner, ICAL_DURATION_PROPERTY);
- struct icaltimetype ret = icaltime_null_time();
- if ( end_prop != 0) {
- ret = icalcomponent_get_datetime(comp, end_prop);
- } else if ( dur_prop != 0) {
+ if( end_prop == 0 && dur_prop == 0){
+ return icaltime_null_time();
+ } else if ( end_prop != 0) {
+ return icalproperty_get_dtend(end_prop);
+ } else if ( dur_prop != 0) {
+
struct icaltimetype start =
icalcomponent_get_dtstart(inner);
struct icaldurationtype duration =
icalproperty_get_duration(dur_prop);
-
+
struct icaltimetype end = icaltime_add(start,duration);
- ret = end;
- }
+ return end;
+
+ } else {
+ /* Error, both duration and dtend have been specified */
+ icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
+ return icaltime_null_time();
- return ret;
+ }
+
}
-/** @brief Set DTEND property to given icaltime
- *
- * This method respects the icaltime type (DATE vs DATE-TIME) and
- * timezone (or lack thereof).
- *
- * This also checks that a DURATION property isn't already there,
- * and returns an error if it is. It's the caller's responsibility
- * to remove it.
- */
+
void icalcomponent_set_dtend(icalcomponent* comp, struct icaltimetype v)
{
- char *tzid;
- ICALSETUPSET(ICAL_DTEND_PROPERTY);
+ icalcomponent *inner = icalcomponent_get_inner(comp);
- if (icalcomponent_get_first_property(inner,ICAL_DURATION_PROPERTY)
- != NULL) {
- icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
- return;
- }
+ icalproperty *end_prop
+ = icalcomponent_get_first_property(inner,ICAL_DTEND_PROPERTY);
- if (prop == 0) {
- prop = icalproperty_new_dtend(v);
- icalcomponent_add_property(inner, prop);
- } else {
- icalproperty_remove_parameter_by_kind(prop, ICAL_TZID_PARAMETER);
- }
+ icalproperty *dur_prop
+ = icalcomponent_get_first_property(inner,ICAL_DURATION_PROPERTY);
+
+
+ if( end_prop == 0 && dur_prop == 0){
+ end_prop = icalproperty_new_dtend(v);
+ icalcomponent_add_property(inner,end_prop);
+ } else if ( end_prop != 0) {
+ icalproperty_set_dtend(end_prop,v);
+ } else if ( dur_prop != 0) {
+ struct icaltimetype start =
+ icalcomponent_get_dtstart(inner);
+
+ struct icaltimetype end =
+ icalcomponent_get_dtend(inner);
+
+ struct icaldurationtype dur
+ = icaltime_subtract(end,start);
- icalproperty_set_dtend(prop,v);
+ icalproperty_set_duration(dur_prop,dur);
- if ((tzid = icaltime_get_tzid(v)) != NULL && !icaltime_is_utc(v)) {
- icalproperty_add_parameter(prop, icalparameter_new_tzid(tzid));
+ } else {
+ /* Error, both duration and dtend have been specified */
+ icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
}
}
-/** @brief Set DURATION property to given icalduration
- *
- * This method respects the icaltime type (DATE vs DATE-TIME) and
- * timezone (or lack thereof).
- *
- * This also checks that a DTEND property isn't already there,
- * and returns an error if it is. It's the caller's responsibility
- * to remove it.
- */
void icalcomponent_set_duration(icalcomponent* comp,
struct icaldurationtype v)
{
- ICALSETUPSET(ICAL_DURATION_PROPERTY);
+ icalcomponent *inner = icalcomponent_get_inner(comp);
- if (icalcomponent_get_first_property(inner,ICAL_DTEND_PROPERTY) != NULL) {
- icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
- return;
- }
+ icalproperty *end_prop
+ = icalcomponent_get_first_property(inner,ICAL_DTEND_PROPERTY);
- if (prop == 0) {
- prop = icalproperty_new_duration(v);
- icalcomponent_add_property(inner, prop);
+ icalproperty *dur_prop
+ = icalcomponent_get_first_property(inner,ICAL_DURATION_PROPERTY);
+
+
+ if( end_prop == 0 && dur_prop == 0){
+ dur_prop = icalproperty_new_duration(v);
+ icalcomponent_add_property(inner, dur_prop);
+ } else if ( end_prop != 0) {
+ struct icaltimetype start =
+ icalcomponent_get_dtstart(inner);
+
+ struct icaltimetype new_end = icaltime_add(start,v);
+
+ icalproperty_set_dtend(end_prop,new_end);
+
+ } else if ( dur_prop != 0) {
+ icalproperty_set_duration(dur_prop,v);
} else {
- icalproperty_set_duration(prop,v);
+ /* Error, both duration and dtend have been specified */
+ icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
}
}
-/** @brief Get DURATION property as an icalduration
- *
- * If a DURATION property is not present but a DTEND is, we use
- * that to determine the proper end.
- */
struct icaldurationtype icalcomponent_get_duration(icalcomponent* comp)
{
icalcomponent *inner = icalcomponent_get_inner(comp);
@@ -1677,329 +1342,154 @@ struct icaldurationtype icalcomponent_get_duration(icalcomponent* comp)
icalproperty *dur_prop
= icalcomponent_get_first_property(inner,ICAL_DURATION_PROPERTY);
- struct icaldurationtype ret = icaldurationtype_null_duration();
+ struct icaldurationtype null_duration;
+ memset(&null_duration,0,sizeof(struct icaldurationtype));
- if ( dur_prop != 0 && end_prop == 0) {
- ret = icalproperty_get_duration(dur_prop);
- } else if ( end_prop != 0 && dur_prop == 0) {
- /**
- * FIXME
- * We assume DTSTART and DTEND are not in different time zones.
- * Does the standard actually guarantee this?
- */
+ if( end_prop == 0 && dur_prop == 0){
+ return null_duration;
+ } else if ( end_prop != 0) {
struct icaltimetype start =
icalcomponent_get_dtstart(inner);
+ time_t startt = icaltime_as_timet(start);
+
struct icaltimetype end =
icalcomponent_get_dtend(inner);
-
- ret = icaltime_subtract(end, start);
+ time_t endt = icaltime_as_timet(end);
+
+ return icaldurationtype_from_int(endt-startt);
+ } else if ( dur_prop != 0) {
+ return icalproperty_get_duration(dur_prop);
} else {
/* Error, both duration and dtend have been specified */
icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
+ return null_duration;
}
- return ret;
}
-void icalcomponent_set_dtstamp(icalcomponent* comp, struct icaltimetype v)
+void icalcomponent_set_method(icalcomponent* comp, icalproperty_method method)
{
+ icalproperty *prop
+ = icalcomponent_get_first_property(comp, ICAL_METHOD_PROPERTY);
- ICALSETUPSET(ICAL_DTSTAMP_PROPERTY);
if (prop == 0){
- prop = icalproperty_new_dtstamp(v);
- icalcomponent_add_property(inner, prop);
+ prop = icalproperty_new_method(method);
+ icalcomponent_add_property(comp, prop);
}
- icalproperty_set_dtstamp(prop,v);
+ icalproperty_set_method(prop,method);
}
-
-struct icaltimetype icalcomponent_get_dtstamp(icalcomponent* comp)
+icalproperty_method icalcomponent_get_method(icalcomponent* comp)
{
- icalcomponent *inner = icalcomponent_get_inner(comp);
icalproperty *prop
- = icalcomponent_get_first_property(inner,ICAL_DTSTAMP_PROPERTY);
-
- if (prop == 0){
- return icaltime_null_time();
- }
-
- return icalproperty_get_dtstamp(prop);
-}
-
+ = icalcomponent_get_first_property(comp,ICAL_METHOD_PROPERTY);
-void icalcomponent_set_summary(icalcomponent* comp, const char* v)
-{
- ICALSETUPSET(ICAL_SUMMARY_PROPERTY)
-
if (prop == 0){
- prop = icalproperty_new_summary(v);
- icalcomponent_add_property(inner, prop);
+ return ICAL_METHOD_NONE;
}
- icalproperty_set_summary(prop,v);
+ return icalproperty_get_method(prop);
}
-
-const char* icalcomponent_get_summary(icalcomponent* comp)
+void icalcomponent_set_dtstamp(icalcomponent* comp, struct icaltimetype v)
{
- icalcomponent *inner;
- icalproperty *prop;
- icalerror_check_arg_rz(comp!=0,"comp");
- inner = icalcomponent_get_inner(comp);
-
- if(inner == 0){
- icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
- return 0;
- }
-
- prop= icalcomponent_get_first_property(inner,ICAL_SUMMARY_PROPERTY);
-
- if (prop == 0){
- return 0;
- }
-
- return icalproperty_get_summary(prop);
-
-}
+ icalcomponent *inner = icalcomponent_get_inner(comp);
+ icalproperty *prop
+ = icalcomponent_get_first_property(inner, ICAL_DTSTAMP_PROPERTY);
-void icalcomponent_set_comment(icalcomponent* comp, const char* v)
-{
- ICALSETUPSET(ICAL_COMMENT_PROPERTY);
if (prop == 0){
- prop = icalproperty_new_comment(v);
+ prop = icalproperty_new_dtstamp(v);
icalcomponent_add_property(inner, prop);
}
-
- icalproperty_set_summary(prop,v);
+
+ icalproperty_set_dtstamp(prop,v);
}
-const char* icalcomponent_get_comment(icalcomponent* comp){
- icalcomponent *inner;
- icalproperty *prop;
- icalerror_check_arg_rz(comp!=0,"comp");
- inner = icalcomponent_get_inner(comp);
-
- if(inner == 0){
- icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
- return 0;
- }
- prop= icalcomponent_get_first_property(inner,ICAL_COMMENT_PROPERTY);
+struct icaltimetype icalcomponent_get_dtstamp(icalcomponent* comp)
+{
+ icalcomponent *inner = icalcomponent_get_inner(comp);
+ icalproperty *prop
+ = icalcomponent_get_first_property(inner,ICAL_DTSTAMP_PROPERTY);
if (prop == 0){
- return 0;
+ return icaltime_null_time();
}
- return icalproperty_get_comment(prop);
+ return icalproperty_get_dtstamp(prop);
}
-void icalcomponent_set_uid(icalcomponent* comp, const char* v)
+
+void icalcomponent_set_summary(icalcomponent* comp, const char* v)
{
- ICALSETUPSET(ICAL_UID_PROPERTY);
+ icalcomponent *inner = icalcomponent_get_inner(comp);
+ icalproperty *prop
+ = icalcomponent_get_first_property(inner, ICAL_SUMMARY_PROPERTY);
if (prop == 0){
- prop = icalproperty_new_uid(v);
+ prop = icalproperty_new_summary(v);
icalcomponent_add_property(inner, prop);
}
-
+
icalproperty_set_summary(prop,v);
-
}
-const char* icalcomponent_get_uid(icalcomponent* comp){
- icalcomponent *inner;
- icalproperty *prop;
- icalerror_check_arg_rz(comp!=0,"comp");
-
- inner = icalcomponent_get_inner(comp);
- if(inner == 0){
- icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
- return 0;
- }
- prop= icalcomponent_get_first_property(inner,ICAL_UID_PROPERTY);
+const char* icalcomponent_get_summary(icalcomponent* comp)
+{
+ icalcomponent *inner = icalcomponent_get_inner(comp);
+ icalproperty *prop
+ = icalcomponent_get_first_property(inner,ICAL_SUMMARY_PROPERTY);
if (prop == 0){
return 0;
}
- return icalproperty_get_uid(prop);
-}
-
-void icalcomponent_set_recurrenceid(icalcomponent* comp, struct icaltimetype v)
-{
- ICALSETUPSET(ICAL_RECURRENCEID_PROPERTY);
-
- if (prop == 0){
- prop = icalproperty_new_recurrenceid(v);
- icalcomponent_add_property(inner, prop);
- }
-
- icalproperty_set_recurrenceid(prop,v);
-}
-struct icaltimetype icalcomponent_get_recurrenceid(icalcomponent* comp)
-{
- icalcomponent *inner;
- icalproperty *prop;
- if (comp == 0) {
- icalerror_set_errno(ICAL_BADARG_ERROR);
- return icaltime_null_time();
- }
-
- inner = icalcomponent_get_inner(comp);
-
- if(inner == 0){
- icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
- return icaltime_null_time();
- }
-
- prop= icalcomponent_get_first_property(inner, ICAL_RECURRENCEID_PROPERTY);
-
- if (prop == 0){
- return icaltime_null_time();
- }
-
- return icalproperty_get_recurrenceid(prop);
-}
-
-void icalcomponent_set_description(icalcomponent* comp, const char* v)
-{
- ICALSETUPSET(ICAL_DESCRIPTION_PROPERTY);
-
- if (prop == 0){
- prop = icalproperty_new_description(v);
- icalcomponent_add_property(inner, prop);
- }
-
- icalproperty_set_description(prop,v);
-}
-const char* icalcomponent_get_description(icalcomponent* comp)
-{
- icalcomponent *inner;
- icalproperty *prop;
- icalerror_check_arg_rz(comp!=0,"comp");
-
- inner = icalcomponent_get_inner(comp);
-
- if(inner == 0){
- icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
- return 0;
- }
-
- prop= icalcomponent_get_first_property(inner,ICAL_DESCRIPTION_PROPERTY);
-
- if (prop == 0){
- return 0;
- }
-
- return icalproperty_get_description(prop);
-}
-
-void icalcomponent_set_location(icalcomponent* comp, const char* v)
-{
- ICALSETUPSET(ICAL_LOCATION_PROPERTY)
-
- if (prop == 0){
- prop = icalproperty_new_location(v);
- icalcomponent_add_property(inner, prop);
- }
+ return icalproperty_get_summary(prop);
- icalproperty_set_location(prop,v);
}
-const char* icalcomponent_get_location(icalcomponent* comp)
-{
- icalcomponent *inner;
- icalproperty *prop;
- icalerror_check_arg_rz(comp!=0,"comp");
-
- inner = icalcomponent_get_inner(comp);
-
- if(inner == 0){
- icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
- return 0;
- }
- prop= icalcomponent_get_first_property(inner,ICAL_LOCATION_PROPERTY);
+void icalcomponent_set_comment(icalcomponent* comp, const char* v);
+const char* icalcomponent_get_comment(icalcomponent* comp);
- if (prop == 0){
- return 0;
- }
-
- return icalproperty_get_location(prop);
-}
-
-void icalcomponent_set_sequence(icalcomponent* comp, int v)
+void icalcomponent_set_uid(icalcomponent* comp, const char* v)
{
- ICALSETUPSET(ICAL_SEQUENCE_PROPERTY);
-
- if (prop == 0){
- prop = icalproperty_new_sequence(v);
- icalcomponent_add_property(inner, prop);
- }
-
- icalproperty_set_sequence(prop,v);
-
-}
-int icalcomponent_get_sequence(icalcomponent* comp){
- icalcomponent *inner;
- icalproperty *prop;
- icalerror_check_arg_rz(comp!=0,"comp");
+ icalcomponent *inner = icalcomponent_get_inner (comp);
+ icalproperty *prop
+ = icalcomponent_get_first_property (inner, ICAL_UID_PROPERTY);
- inner = icalcomponent_get_inner(comp);
-
- if(inner == 0){
- icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
- return 0;
- }
-
- prop= icalcomponent_get_first_property(inner,ICAL_SEQUENCE_PROPERTY);
-
- if (prop == 0){
- return 0;
- }
+ if (prop == 0) {
+ prop = icalproperty_new_uid (v);
+ icalcomponent_add_property (inner, prop);
+ }
- return icalproperty_get_sequence(prop);
+ icalproperty_set_uid (prop, v);
}
-
-void icalcomponent_set_status(icalcomponent* comp, enum icalproperty_status v)
+const char* icalcomponent_get_uid(icalcomponent* comp)
{
- ICALSETUPSET(ICAL_STATUS_PROPERTY);
-
- if (prop == 0){
- prop = icalproperty_new_status(v);
- icalcomponent_add_property(inner, prop);
- }
+ icalcomponent *inner = icalcomponent_get_inner (comp);
+ icalproperty *prop = icalcomponent_get_first_property (inner, ICAL_UID_PROPERTY);
- icalproperty_set_status(prop,v);
+ if (prop == 0) {
+ return 0;
+ }
+ return icalproperty_get_uid (prop);
}
-enum icalproperty_status icalcomponent_get_status(icalcomponent* comp){
- icalcomponent *inner;
- icalproperty *prop;
- icalerror_check_arg_rz(comp!=0,"comp");
- inner = icalcomponent_get_inner(comp);
+void icalcomponent_set_recurrenceid(icalcomponent* comp,
+ struct icaltimetype v);
+struct icaltimetype icalcomponent_get_recurrenceid(icalcomponent* comp);
- if(inner == 0){
- icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
- return 0;
- }
-
- prop= icalcomponent_get_first_property(inner,ICAL_STATUS_PROPERTY);
- if (prop == 0){
- return 0;
- }
- return icalproperty_get_status(prop);
-}
icalcomponent* icalcomponent_new_vcalendar()
{
@@ -2037,29 +1527,15 @@ icalcomponent* icalcomponent_new_xdaylight()
{
return icalcomponent_new(ICAL_XDAYLIGHT_COMPONENT);
}
-icalcomponent* icalcomponent_new_vagenda()
-{
- return icalcomponent_new(ICAL_VAGENDA_COMPONENT);
-}
-icalcomponent* icalcomponent_new_vquery()
-{
- return icalcomponent_new(ICAL_VQUERY_COMPONENT);
-}
-icalcomponent* icalcomponent_new_vreply()
-{
- return icalcomponent_new(ICAL_VREPLY_COMPONENT);
-}
+
/*
* Timezone stuff.
*/
-
-/**
- * This takes 2 VCALENDAR components and merges the second one into the first,
- * resolving any problems with conflicting TZIDs. comp_to_merge will no
- * longer exist after calling this function.
- */
+/* This takes 2 VCALENDAR components and merges the second one into the first,
+ resolving any problems with conflicting TZIDs. comp_to_merge will no
+ longer exist after calling this function. */
void icalcomponent_merge_component(icalcomponent* comp,
icalcomponent* comp_to_merge)
{
@@ -2126,7 +1602,8 @@ static void icalcomponent_merge_vtimezone (icalcomponent *comp,
icalproperty *tzid_prop;
const char *tzid;
char *tzid_copy;
- icaltimezone *existing_vtimezone;
+ icaltimezone *existing_zone;
+ icalcomponent *existing_vtimezone;
/* Get the TZID of the VTIMEZONE. */
tzid_prop = icalcomponent_get_first_property (vtimezone, ICAL_TZID_PROPERTY);
@@ -2138,11 +1615,11 @@ static void icalcomponent_merge_vtimezone (icalcomponent *comp,
return;
/* See if there is already a VTIMEZONE in comp with the same TZID. */
- existing_vtimezone = icalcomponent_get_timezone (comp, tzid);
+ existing_zone = icalcomponent_get_timezone (comp, tzid);
/* If there is no existing VTIMEZONE with the same TZID, we can just move
the VTIMEZONE to comp and return. */
- if (!existing_vtimezone) {
+ if (!existing_zone) {
icalcomponent_remove_component (icalcomponent_get_parent (vtimezone),
vtimezone);
icalcomponent_add_component (comp, vtimezone);
@@ -2164,7 +1641,8 @@ static void icalcomponent_merge_vtimezone (icalcomponent *comp,
return;
}
- if (!icalcomponent_compare_vtimezones (comp, vtimezone)) {
+ existing_vtimezone = icaltimezone_get_component (existing_zone);
+ if (!icalcomponent_compare_vtimezones (existing_vtimezone, vtimezone)) {
/* FIXME: Handle possible NEWFAILED error. */
/* Now we have two different VTIMEZONEs with the same TZID. */
@@ -2182,8 +1660,8 @@ icalcomponent_handle_conflicting_vtimezones (icalcomponent *comp,
const char *tzid,
icalarray *tzids_to_rename)
{
- int i, suffix, max_suffix = 0, num_elements;
- unsigned int tzid_len;
+ struct icalcomponent_impl *impl = (struct icalcomponent_impl*)comp;
+ int tzid_len, i, suffix, max_suffix = 1, num_elements;
char *tzid_copy, *new_tzid, suffix_buf[32];
/* Find the length of the TZID without any trailing digits. */
@@ -2196,13 +1674,13 @@ icalcomponent_handle_conflicting_vtimezones (icalcomponent *comp,
same prefix (e.g. 'London'). If it matches any of those, we have to
rename the TZIDs to that TZID, else we rename to a new TZID, using
the biggest numeric suffix found + 1. */
- num_elements = comp->timezones ? comp->timezones->num_elements : 0;
+ num_elements = impl->timezones ? impl->timezones->num_elements : 0;
for (i = 0; i < num_elements; i++) {
icaltimezone *zone;
char *existing_tzid, *existing_tzid_copy;
- unsigned int existing_tzid_len;
+ int existing_tzid_len;
- zone = icalarray_element_at (comp->timezones, i);
+ zone = icalarray_element_at (impl->timezones, i);
existing_tzid = icaltimezone_get_tzid (zone);
/* Find the length of the TZID without any trailing digits. */
@@ -2255,7 +1733,7 @@ icalcomponent_handle_conflicting_vtimezones (icalcomponent *comp,
/* Returns the length of the TZID, without any trailing digits. */
-static unsigned int icalcomponent_get_tzid_prefix_len (const char *tzid)
+static int icalcomponent_get_tzid_prefix_len (const char *tzid)
{
int len;
const char *p;
@@ -2271,11 +1749,9 @@ static unsigned int icalcomponent_get_tzid_prefix_len (const char *tzid)
}
-/**
- * Renames all references to the given TZIDs to a new name. rename_table
- * contains pairs of strings - a current TZID, and the new TZID to rename it
- * to.
- */
+/* Renames all references to the given TZIDs to a new name. rename_table
+ contains pairs of strings - a current TZID, and the new TZID to rename it
+ to. */
static void icalcomponent_rename_tzids(icalcomponent* comp,
icalarray* rename_table)
{
@@ -2305,9 +1781,7 @@ static void icalcomponent_rename_tzids_callback(icalparameter *param, void *data
}
-/**
- * Calls the given function for each TZID parameter found in the component.
- */
+/* Calls the given function for each TZID parameter found in the component. */
void icalcomponent_foreach_tzid(icalcomponent* comp,
void (*callback)(icalparameter *param, void *data),
void *callback_data)
@@ -2345,32 +1819,33 @@ void icalcomponent_foreach_tzid(icalcomponent* comp,
-/**
- * Returns the icaltimezone from the component corresponding to the given
- * TZID, or NULL if the component does not have a corresponding VTIMEZONE.
- */
+/* Returns the icaltimezone from the component corresponding to the given
+ TZID, or NULL if the component does not have a corresponding VTIMEZONE. */
icaltimezone* icalcomponent_get_timezone(icalcomponent* comp, const char *tzid)
{
+ struct icalcomponent_impl *impl;
icaltimezone *zone;
int lower, upper, middle, cmp;
char *zone_tzid;
- if (!comp->timezones)
+ impl = (struct icalcomponent_impl*)comp;
+
+ if (!impl->timezones)
return NULL;
/* Sort the array if necessary (by the TZID string). */
- if (!comp->timezones_sorted) {
- icalarray_sort (comp->timezones, icalcomponent_compare_timezone_fn);
- comp->timezones_sorted = 1;
+ if (!impl->timezones_sorted) {
+ icalarray_sort (impl->timezones, icalcomponent_compare_timezone_fn);
+ impl->timezones_sorted = 1;
}
/* Do a simple binary search. */
lower = middle = 0;
- upper = comp->timezones->num_elements;
+ upper = impl->timezones->num_elements;
while (lower < upper) {
middle = (lower + upper) >> 1;
- zone = icalarray_element_at (comp->timezones, middle);
+ zone = icalarray_element_at (impl->timezones, middle);
zone_tzid = icaltimezone_get_tzid (zone);
cmp = strcmp (tzid, zone_tzid);
if (cmp == 0)
@@ -2385,14 +1860,13 @@ icaltimezone* icalcomponent_get_timezone(icalcomponent* comp, const char *tzid)
}
-/**
- * A function to compare 2 icaltimezone elements, used for qsort().
- */
+/* A function to compare 2 icaltimezone elements, used for qsort(). */
static int icalcomponent_compare_timezone_fn (const void *elem1,
const void *elem2)
{
icaltimezone *zone1, *zone2;
const char *zone1_tzid, *zone2_tzid;
+ int retval;
zone1 = (icaltimezone*) elem1;
zone2 = (icaltimezone*) elem2;
@@ -2404,16 +1878,14 @@ static int icalcomponent_compare_timezone_fn (const void *elem1,
}
-/**
- * Compares 2 VTIMEZONE components to see if they match, ignoring their TZIDs.
- * It returns 1 if they match, 0 if they don't, or -1 on error.
- */
+/* Compares 2 VTIMEZONE components to see if they match, ignoring their TZIDs.
+ It returns 1 if they match, 0 if they don't, or -1 on error. */
static int icalcomponent_compare_vtimezones (icalcomponent *vtimezone1,
icalcomponent *vtimezone2)
{
icalproperty *prop1, *prop2;
const char *tzid1, *tzid2;
- char *tzid2_copy, *string1, *string2;
+ char *tzid2_copy, *string1, *string2, *string1_copy;
int cmp;
/* Get the TZID property of the first VTIMEZONE. */
@@ -2421,6 +1893,7 @@ static int icalcomponent_compare_vtimezones (icalcomponent *vtimezone1,
if (!prop1)
return -1;
+ /* This returns the pointer to the actual string in the property. */
tzid1 = icalproperty_get_tzid (prop1);
if (!tzid1)
return -1;
@@ -2430,6 +1903,7 @@ static int icalcomponent_compare_vtimezones (icalcomponent *vtimezone1,
if (!prop2)
return -1;
+ /* This returns the pointer to the actual string in the property. */
tzid2 = icalproperty_get_tzid (prop2);
if (!tzid2)
return -1;
@@ -2447,21 +1921,32 @@ static int icalcomponent_compare_vtimezones (icalcomponent *vtimezone1,
/* Now convert both VTIMEZONEs to strings and compare them. */
string1 = icalcomponent_as_ical_string (vtimezone1);
if (!string1) {
+ /* Try to reset the property. Though this may not work if we are low
+ on memory. */
+ icalproperty_set_tzid (prop2, tzid2_copy);
+ free (tzid2_copy);
+ return -1;
+ }
+
+ /* Copy the string, since it is in a temporary buffer which may get freed
+ during the next call. */
+ string1_copy = strdup (string1);
+ if (!string1_copy) {
+ icalproperty_set_tzid (prop2, tzid2_copy);
free (tzid2_copy);
return -1;
}
string2 = icalcomponent_as_ical_string (vtimezone2);
if (!string2) {
- free (string1);
+ icalproperty_set_tzid (prop2, tzid2_copy);
free (tzid2_copy);
return -1;
}
- cmp = strcmp (string1, string2);
+ cmp = strcmp (string1_copy, string2);
- free (string1);
- free (string2);
+ free (string1_copy);
/* Now reset the second TZID. */
icalproperty_set_tzid (prop2, tzid2_copy);
@@ -2469,143 +1954,3 @@ static int icalcomponent_compare_vtimezones (icalcomponent *vtimezone1,
return (cmp == 0) ? 1 : 0;
}
-
-
-
-
-
-
-/**
- * @brief set the RELCALID property of a component.
- *
- * @param comp Valid calendar component.
- * @param v Relcalid URL value
- */
-
-void icalcomponent_set_relcalid(icalcomponent* comp, const char* v)
-{
- ICALSETUPSET(ICAL_RELCALID_PROPERTY);
-
- if (prop == 0){
- prop = icalproperty_new_relcalid(v);
- icalcomponent_add_property(inner, prop);
- }
-
- icalproperty_set_relcalid(prop,v);
-
-}
-
-
-/**
- * @brief get the RELCALID property of a component.
- *
- * @param comp Valid calendar component.
- */
-
-const char* icalcomponent_get_relcalid(icalcomponent* comp){
- icalcomponent *inner;
- icalproperty *prop;
- icalerror_check_arg_rz(comp!=0,"comp");
-
- inner = icalcomponent_get_inner(comp);
-
- if(inner == 0){
- return 0;
- }
-
- prop= icalcomponent_get_first_property(inner,ICAL_RELCALID_PROPERTY);
-
- if (prop == 0){
- return 0;
- }
-
- return icalproperty_get_relcalid(prop);
-}
-
-
-/** @brief Return the time a TODO task is DUE.
- *
- * @param comp Valid calendar component.
- *
- * Uses the DUE: property if it exists, otherwise we calculate the DUE
- * value by adding the task's duration to the DTSTART time
- */
-
-struct icaltimetype icalcomponent_get_due(icalcomponent* comp)
-{
- icalcomponent *inner = icalcomponent_get_inner(comp);
-
- icalproperty *due_prop
- = icalcomponent_get_first_property(inner,ICAL_DUE_PROPERTY);
-
- icalproperty *dur_prop
- = icalcomponent_get_first_property(inner, ICAL_DURATION_PROPERTY);
-
- if( due_prop == 0 && dur_prop == 0){
- return icaltime_null_time();
- } else if ( due_prop != 0) {
- return icalproperty_get_due(due_prop);
- } else if ( dur_prop != 0) {
-
- struct icaltimetype start =
- icalcomponent_get_dtstart(inner);
- struct icaldurationtype duration =
- icalproperty_get_duration(dur_prop);
-
- struct icaltimetype due = icaltime_add(start,duration);
-
- return due;
-
- } else {
- /* Error, both duration and due have been specified */
- icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
- return icaltime_null_time();
-
- }
-
-}
-
-/** @brief Set the due date of a VTODO task.
- *
- * @param comp Valid VTODO component.
- * @param v Valid due date time.
- *
- * - If no duration or due properties then set the DUE property.
- * - If a DUE property is already set, then reset it to the value v.
- * - If a DURATION property is already set, then calculate the new
- * duration based on the supplied value of v.
- */
-
-void icalcomponent_set_due(icalcomponent* comp, struct icaltimetype v)
-{
- icalcomponent *inner = icalcomponent_get_inner(comp);
-
- icalproperty *due_prop
- = icalcomponent_get_first_property(inner,ICAL_DUE_PROPERTY);
-
- icalproperty *dur_prop
- = icalcomponent_get_first_property(inner,ICAL_DURATION_PROPERTY);
-
-
- if( due_prop == 0 && dur_prop == 0){
- due_prop = icalproperty_new_due(v);
- icalcomponent_add_property(inner,due_prop);
- } else if ( due_prop != 0) {
- icalproperty_set_due(due_prop,v);
- } else if ( dur_prop != 0) {
- struct icaltimetype start =
- icalcomponent_get_dtstart(inner);
-
- struct icaltimetype due =
- icalcomponent_get_due(inner);
-
- struct icaldurationtype dur
- = icaltime_subtract(due,start);
-
- icalproperty_set_duration(dur_prop,dur);
-
- } else {
- /* Error, both duration and due have been specified */
- icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
- }
-}
diff --git a/libical/src/libical/icalderivedparameter.c.in b/libical/src/libical/icalderivedparameter.c.in
index b41587e0de..4af6e95c0e 100644
--- a/libical/src/libical/icalderivedparameter.c.in
+++ b/libical/src/libical/icalderivedparameter.c.in
@@ -3,7 +3,7 @@
FILE: icalderivedparameters.{c,h}
CREATOR: eric 09 May 1999
- $Id: icalderivedparameter.c.in,v 1.2 2003/09/11 22:04:19 hansp Exp $
+ $Id: icalderivedparameter.c.in,v 1.1 2001/04/17 17:23:17 jpr Exp $
$Locker: $
@@ -55,25 +55,8 @@ struct icalparameter_kind_map {
};
-/* This map associates the enumerations for the VALUE parameter with
- the kinds of VALUEs. */
-
-struct icalparameter_value_kind_map {
- icalparameter_value value;
- icalvalue_kind kind;
-};
+extern struct icalparameter_kind_map parameter_map[];
-/* This map associates the parameter enumerations with a specific parameter and the string representation of the enumeration */
-
-struct icalparameter_map {
- icalparameter_kind kind;
- int enumeration;
- const char* str;
-};
-
-
-
-<insert_code_here>
const char* icalparameter_kind_to_string(icalparameter_kind kind)
{
@@ -111,6 +94,16 @@ icalparameter_kind icalparameter_string_to_kind(const char* string)
return ICAL_NO_PARAMETER;
}
+/* This map associates the enumerations for the VALUE parameter with
+ the kinds of VALUEs. */
+
+struct icalparameter_value_kind_map {
+ icalparameter_value value;
+ icalvalue_kind kind;
+};
+
+extern struct icalparameter_value_kind_map value_kind_map[];
+
icalvalue_kind icalparameter_value_to_value_kind(icalparameter_value value)
{
@@ -127,6 +120,18 @@ icalvalue_kind icalparameter_value_to_value_kind(icalparameter_value value)
}
+/* This map associates the parameter enumerations with a specific parameter and the string representation of the enumeration */
+
+struct icalparameter_map {
+ icalparameter_kind kind;
+ int enumeration;
+ const char* str;
+};
+
+
+extern struct icalparameter_map icalparameter_map[];
+
+
const char* icalparameter_enum_to_string(int e)
{
int i;
@@ -203,3 +208,4 @@ icalparameter* icalparameter_new_from_value_string(icalparameter_kind kind,const
+/* Everything below this line is machine generated. Do not edit. */
diff --git a/libical/src/libical/icalderivedparameter.h.in b/libical/src/libical/icalderivedparameter.h.in
index a8f3a36085..e9fdd19fa7 100644
--- a/libical/src/libical/icalderivedparameter.h.in
+++ b/libical/src/libical/icalderivedparameter.h.in
@@ -4,7 +4,7 @@
CREATOR: eric 20 March 1999
- $Id: icalderivedparameter.h.in,v 1.2 2003/09/11 22:04:19 hansp Exp $
+ $Id: icalderivedparameter.h.in,v 1.1 2001/04/17 17:23:17 jpr Exp $
$Locker: $
@@ -30,9 +30,8 @@
#define ICALDERIVEDPARAMETER_H
-typedef struct icalparameter_impl icalparameter;
+typedef void icalparameter;
const char* icalparameter_enum_to_string(int e);
int icalparameter_string_to_enum(const char* str);
-<insert_code_here>
diff --git a/libical/src/libical/icalderivedproperty.c.in b/libical/src/libical/icalderivedproperty.c.in
index 36ddc846ae..ceec0b797d 100644
--- a/libical/src/libical/icalderivedproperty.c.in
+++ b/libical/src/libical/icalderivedproperty.c.in
@@ -4,7 +4,7 @@
FILE: icalderivedproperty.c
CREATOR: eric 15 Feb 2001
- $Id: icalderivedproperty.c.in,v 1.2 2003/09/11 22:04:19 hansp Exp $
+ $Id: icalderivedproperty.c.in,v 1.1 2001/04/17 17:23:17 jpr Exp $
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
@@ -43,9 +43,10 @@
#include <stdio.h> /* for printf */
#include <stdarg.h> /* for va_list, va_start, etc. */
+#define TMP_BUF_SIZE 1024
+
struct icalproperty_impl*
icalproperty_new_impl (icalproperty_kind kind);
-void icalproperty_add_parameters(struct icalproperty_impl *prop,va_list args);
/* This map associates the property kinds with the string
representation of the property name and the kind of VALUE that the
@@ -58,29 +59,7 @@ struct icalproperty_map {
};
-/* This map associates the property enumerations with the king of
- property that they are used in and the string representation of the
- enumeration */
-
-struct icalproperty_enum_map {
- icalproperty_kind prop;
- int prop_enum;
- const char* str;
-};
-
-
-<insert_code_here>
-
-int icalproperty_kind_is_valid(const icalproperty_kind kind)
-{
- int i = 0;
- do {
- if (property_map[i].kind == kind)
- return 1;
- } while (property_map[i++].kind != ICAL_NO_PROPERTY);
-
- return 0;
-}
+extern struct icalproperty_map property_map[];
const char* icalproperty_kind_to_string(icalproperty_kind kind)
{
@@ -121,7 +100,7 @@ icalproperty_kind icalproperty_string_to_kind(const char* string)
}
-icalproperty_kind icalproperty_value_kind_to_kind(icalvalue_kind kind)
+icalvalue_kind icalproperty_value_kind_to_kind(icalvalue_kind kind)
{
int i;
@@ -131,7 +110,7 @@ icalproperty_kind icalproperty_value_kind_to_kind(icalvalue_kind kind)
}
}
- return ICAL_NO_PROPERTY;
+ return ICAL_NO_VALUE;
}
@@ -150,6 +129,19 @@ icalvalue_kind icalproperty_kind_to_value_kind(icalproperty_kind kind)
}
+/* This map associates the property enumerations with the king of
+ property that they are used in and the string representation of the
+ enumeration */
+
+struct icalproperty_enum_map {
+ icalproperty_kind prop;
+ int prop_enum;
+ const char* str;
+};
+
+extern struct icalproperty_enum_map enum_map[];
+
+
const char* icalproperty_enum_to_string(int e)
{
icalerror_check_arg_rz(e >= ICALPROPERTY_FIRST_ENUM,"e");
@@ -158,37 +150,6 @@ const char* icalproperty_enum_to_string(int e)
return enum_map[e-ICALPROPERTY_FIRST_ENUM].str;
}
-int icalproperty_kind_and_string_to_enum(const int kind, const char* str)
-{
- icalproperty_kind pkind;
- int i;
-
- icalerror_check_arg_rz(str!=0,"str")
-
- if ((pkind = icalproperty_value_kind_to_kind(kind)) == ICAL_NO_VALUE)
- return 0;
-
- while(*str == ' '){
- str++;
- }
-
- for (i=ICALPROPERTY_FIRST_ENUM; i != ICALPROPERTY_LAST_ENUM; i++) {
- if (enum_map[i-ICALPROPERTY_FIRST_ENUM].prop == pkind)
- break;
- }
- if (i == ICALPROPERTY_LAST_ENUM)
- return 0;
-
- for (; i != ICALPROPERTY_LAST_ENUM; i++) {
- if ( strcmp(enum_map[i-ICALPROPERTY_FIRST_ENUM].str, str) == 0) {
- return enum_map[i-ICALPROPERTY_FIRST_ENUM].prop_enum;
- }
- }
-
- return 0;
-}
-
-/** @deprecated please use icalproperty_kind_and_string_to_enum instead */
int icalproperty_string_to_enum(const char* str)
{
int i;
@@ -276,10 +237,14 @@ icalproperty_status icalenum_string_to_status(const char* str)
i != ICAL_STATUS_NONE-ICALPROPERTY_FIRST_ENUM;
i++) {
if ( strcmp(enum_map[i].str, str) == 0) {
- return (icalproperty_status)enum_map[i].prop_enum;
+ return (icalproperty_method)enum_map[i].prop_enum;
}
}
return ICAL_STATUS_NONE;
}
+
+
+
+/* Everything below this line is machine generated. Do not edit. */
diff --git a/libical/src/libical/icalderivedproperty.h.in b/libical/src/libical/icalderivedproperty.h.in
index eda95ee031..6ce34afafb 100644
--- a/libical/src/libical/icalderivedproperty.h.in
+++ b/libical/src/libical/icalderivedproperty.h.in
@@ -3,7 +3,7 @@
FILE: icalderivedproperties.{c,h}
CREATOR: eric 09 May 1999
- $Id: icalderivedproperty.h.in,v 1.2 2003/09/11 22:04:19 hansp Exp $
+ $Id: icalderivedproperty.h.in,v 1.1 2001/04/17 17:23:17 jpr Exp $
(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
======================================================================*/
@@ -17,6 +17,7 @@
#include "icalderivedvalue.h"
#include "icalrecur.h"
-typedef struct icalproperty_impl icalproperty;
+typedef void icalproperty;
-<insert_code_here>
+
+/* Everything below this line is machine generated. Do not edit. */
diff --git a/libical/src/libical/icallangbind.h b/libical/src/libical/icallangbind.h
index fed3626c32..2ed50038eb 100644
--- a/libical/src/libical/icallangbind.h
+++ b/libical/src/libical/icallangbind.h
@@ -41,14 +41,9 @@ icalcomponent* icallangbind_get_first_component(icalcomponent *c,
icalcomponent* icallangbind_get_next_component(icalcomponent *c,
const char* comp);
-icalparameter* icallangbind_get_first_parameter(icalproperty *prop);
-
-icalparameter* icallangbind_get_next_parameter(icalproperty *prop);
const char* icallangbind_property_eval_string(icalproperty* prop, char* sep);
int icallangbind_string_to_open_flag(const char* str);
-
-const char* icallangbind_quote_as_ical(const char* str);
#endif /*__ICALLANGBIND_H__*/
diff --git a/libical/src/libical/icalmime.c b/libical/src/libical/icalmime.c
index e5d1c90601..6e11e9e326 100644
--- a/libical/src/libical/icalmime.c
+++ b/libical/src/libical/icalmime.c
@@ -38,10 +38,6 @@
#include "dmalloc.h"
#endif
-#ifdef WIN32
-#define snprintf _snprintf
-#define strcasecmp stricmp
-#endif
/* These *_part routines are called by the MIME parser via the
local_action_map */
@@ -209,12 +205,8 @@ icalcomponent* icalmime_parse(char* (*get_string)(char *s, size_t size,
}
if(parts[i].header.error!=SSPM_NO_ERROR){
- char *str = "Unknown error";
- char temp[256];
-
- if(parts[i].header.error==SSPM_MALFORMED_HEADER_ERROR){
- str = "Malformed header, possibly due to input not in MIME format";
- }
+ char *str;
+ char* temp[256];
if(parts[i].header.error==SSPM_UNEXPECTED_BOUNDARY_ERROR){
str = "Got an unexpected boundary, possibly due to a MIME header for a MULTIPART part that is missing the Content-Type line";
@@ -235,16 +227,16 @@ line between the header and the previous boundary\?";
}
if(parts[i].header.error_text != 0){
- snprintf(temp,sizeof(temp),
+ snprintf((char*)temp,256,
"%s: %s",str,parts[i].header.error_text);
} else {
- strcpy(temp,str);
+ strcpy((char*)temp,str);
}
icalcomponent_add_property
(comp,
icalproperty_vanew_xlicerror(
- temp,
+ (char*)temp,
icalparameter_new_xlicerrortype(
ICAL_XLICERRORTYPE_MIMEPARSEERROR),
0));
diff --git a/libical/src/libical/icalperiod.h b/libical/src/libical/icalperiod.h
index 5f07dd4a88..64d53237ad 100644
--- a/libical/src/libical/icalperiod.h
+++ b/libical/src/libical/icalperiod.h
@@ -42,12 +42,12 @@ struct icalperiodtype
struct icalperiodtype icalperiodtype_from_string (const char* str);
const char* icalperiodtype_as_ical_string(struct icalperiodtype p);
+struct icalperiodtype icalperiodtype_null_period();
+int icalperiodtype_is_null_period(struct icalperiodtype p);
+int icalperiodtype_is_valid_period(struct icalperiodtype p);
-struct icalperiodtype icalperiodtype_null_period(void);
-int icalperiodtype_is_null_period(struct icalperiodtype p);
-int icalperiodtype_is_valid_period(struct icalperiodtype p);
#endif /* !ICALTIME_H */
diff --git a/libical/src/libical/icalrecur.h b/libical/src/libical/icalrecur.h
index 45bdd21b65..5fcdc15a8c 100644
--- a/libical/src/libical/icalrecur.h
+++ b/libical/src/libical/icalrecur.h
@@ -16,17 +16,10 @@
The Mozilla Public License Version 1.0. You may obtain a copy of
the License at http://www.mozilla.org/MPL/
-*/
-
-/**
-@file icalrecur.h
-@brief Routines for dealing with recurring time
How to use:
1) Get a rule and a start time from a component
-
-@code
icalproperty rrule;
struct icalrecurrencetype recur;
struct icaltimetype dtstart;
@@ -34,36 +27,26 @@ How to use:
rrule = icalcomponent_get_first_property(comp,ICAL_RRULE_PROPERTY);
recur = icalproperty_get_rrule(rrule);
start = icalproperty_get_dtstart(dtstart);
-@endcode
Or, just make them up:
-
-@code
recur = icalrecurrencetype_from_string("FREQ=YEARLY;BYDAY=SU,WE");
dtstart = icaltime_from_string("19970101T123000")
-@endcode
2) Create an iterator
-
-@code
icalrecur_iterator* ritr;
ritr = icalrecur_iterator_new(recur,start);
-@endcode
3) Iterator over the occurrences
-
-@code
struct icaltimetype next;
while (next = icalrecur_iterator_next(ritr)
&& !icaltime_is_null_time(next){
Do something with next
}
-@endcode
Note that that the time returned by icalrecur_iterator_next is in
whatever timezone that dtstart is in.
-*/
+======================================================================*/
#ifndef ICALRECUR_H
#define ICALRECUR_H
@@ -71,9 +54,9 @@ whatever timezone that dtstart is in.
#include <time.h>
#include "icaltime.h"
-/*
+/***********************************************************************
* Recurrance enumerations
- */
+**********************************************************************/
typedef enum icalrecurrencetype_frequency
{
@@ -110,9 +93,7 @@ enum {
-/**
- * Recurrence type routines
- */
+/********************** Recurrence type routines **************/
/* See RFC 2445 Section 4.3.10, RECUR Value, for an explaination of
the values and fields in struct icalrecurrencetype */
@@ -127,7 +108,7 @@ enum {
#define ICAL_BY_MONTH_SIZE 13
#define ICAL_BY_SETPOS_SIZE 367
-/** Main struct for holding digested recurrence rules */
+/* Main struct for holding digested recurrence rules */
struct icalrecurrencetype
{
icalrecurrencetype_frequency freq;
@@ -164,50 +145,43 @@ struct icalrecurrencetype
void icalrecurrencetype_clear(struct icalrecurrencetype *r);
-/**
- * Array Encoding
- *
- * The 'day' element of the by_day array is encoded to allow
- * representation of both the day of the week ( Monday, Tueday), but also
- * the Nth day of the week ( First tuesday of the month, last thursday of
- * the year) These routines decode the day values
- */
+/* The 'day' element of the by_day array is encoded to allow
+representation of both the day of the week ( Monday, Tueday), but also
+the Nth day of the week ( First tuesday of the month, last thursday of
+the year) These routines decode the day values */
-/** 1 == Monday, etc. */
+/* 1 == Monday, etc. */
enum icalrecurrencetype_weekday icalrecurrencetype_day_day_of_week(short day);
-/** 0 == any of day of week. 1 == first, 2 = second, -2 == second to last, etc */
-int icalrecurrencetype_day_position(short day);
+/* 0 == any of day of week. 1 == first, 2 = second, -2 == second to last, etc */
+short icalrecurrencetype_day_position(short day);
-icalrecurrencetype_weekday icalrecur_string_to_weekday(const char* str);
-/** Recurrance rule parser */
+/***********************************************************************
+ * Recurrance rule parser
+**********************************************************************/
-/** Convert between strings and recurrencetype structures. */
+/* Convert between strings ans recurrencetype structures. */
struct icalrecurrencetype icalrecurrencetype_from_string(const char* str);
char* icalrecurrencetype_as_string(struct icalrecurrencetype *recur);
-/** Recurrence iteration routines */
+/********** recurrence iteration routines ********************/
-typedef struct icalrecur_iterator_impl icalrecur_iterator;
+typedef void icalrecur_iterator;
-/** Create a new recurrence rule iterator */
+/* Create a new recurrence rule iterator */
icalrecur_iterator* icalrecur_iterator_new(struct icalrecurrencetype rule,
struct icaltimetype dtstart);
-/** Get the next occurrence from an iterator */
+/* Get the next occurrence from an iterator */
struct icaltimetype icalrecur_iterator_next(icalrecur_iterator*);
-void icalrecur_iterator_decrement_count(icalrecur_iterator*);
-
-/** Free the iterator */
+/* Free the iterator */
void icalrecur_iterator_free(icalrecur_iterator*);
-/**
- * Fills array up with at most 'count' time_t values, each
- * representing an occurrence time in seconds past the POSIX epoch
- */
+/* Fills array up with at most 'count' time_t values, each
+ representing an occurrence time in seconds past the POSIX epoch */
int icalrecur_expand_recurrence(char* rule, time_t start,
int count, time_t* array);
diff --git a/libical/src/libical/icalrestriction.c.in b/libical/src/libical/icalrestriction.c.in
index 05cdc9d413..454442531f 100644
--- a/libical/src/libical/icalrestriction.c.in
+++ b/libical/src/libical/icalrestriction.c.in
@@ -19,11 +19,6 @@
#define TMP_BUF_SIZE 1024
-#ifdef WIN32
-#define snprintf _snprintf
-#define strcasecmp stricmp
-#endif
-
/* Define the structs for the restrictions. these data are filled out
in machine generated code below */
@@ -66,7 +61,7 @@ icalrestriction_property_record null_prop_record = {ICAL_METHOD_NONE,ICAL_NO_C
icalrestriction_component_record null_comp_record = {ICAL_METHOD_NONE,ICAL_NO_COMPONENT,ICAL_NO_COMPONENT,ICAL_RESTRICTION_UNKNOWN,0};
-/** The each row gives the result of comparing a restriction against a
+/* The each row gives the result of comparing a restriction against a
count. The columns in each row represent 0,1,2+. '-1' indicates
'invalid, 'don't care' or 'needs more analysis' So, for
ICAL_RESTRICTION_ONE, if there is 1 of a property with that
@@ -224,7 +219,7 @@ char* icalrestriction_must_have_duration(icalrestriction_property_record *rec,
if( !icalcomponent_get_first_property(comp,ICAL_DURATION_PROPERTY)){
- return "Failed iTIP restrictions. This component must have a DURATION property";
+ return "Failed iTIP restrictions for STATUS property. This component must have a DURATION property";
}
@@ -235,7 +230,7 @@ char* icalrestriction_must_have_repeat(icalrestriction_property_record *rec,
icalproperty* prop){
if( !icalcomponent_get_first_property(comp,ICAL_REPEAT_PROPERTY)){
- return "Failed iTIP restrictions. This component must have a REPEAT property";
+ return "Failed iTIP restrictions for STATUS property. This component must have a REPEAT property";
}
@@ -252,9 +247,9 @@ char* icalrestriction_no_dtend(icalrestriction_property_record *rec,
icalcomponent* comp,
icalproperty* prop){
- if( icalcomponent_get_first_property(comp,ICAL_DTEND_PROPERTY)){
+ if( !icalcomponent_get_first_property(comp,ICAL_DTEND_PROPERTY)){
- return "Failed iTIP restrictions. The component must not have both DURATION and DTEND";
+ return "Failed iTIP restrictions for STATUS property. The component must not have both DURATION and DTEND";
}
@@ -267,21 +262,7 @@ char* icalrestriction_no_duration(icalrestriction_property_record *rec,
/* _no_dtend takes care of this one */
return 0;
}
-char* icalrestriction_must_be_email(
- icalrestriction_property_record *rec,
- icalcomponent* comp,
- icalproperty* prop)
-{
- icalproperty_status stat = icalproperty_get_action(prop);
- if( !( stat == ICAL_ACTION_EMAIL)){
-
- return "Failed iTIP restrictions for ACTION property. Value must be EMAIL.";
-
- }
-
- return 0;
-}
int icalrestriction_check_component(icalproperty_method method,
icalcomponent* comp)
@@ -290,6 +271,7 @@ int icalrestriction_check_component(icalproperty_method method,
icalcomponent_kind comp_kind;
icalrestriction_kind restr;
icalrestriction_property_record *prop_record;
+ icalrestriction_component_record *comp_record;
char* funcr = 0;
icalproperty *prop;
diff --git a/libical/src/libical/sspm.c b/libical/src/libical/sspm.c
index c6647d37af..311747c8f5 100644
--- a/libical/src/libical/sspm.c
+++ b/libical/src/libical/sspm.c
@@ -45,11 +45,6 @@
#include "dmalloc.h"
#endif
-#ifdef WIN32
-#define snprintf _snprintf
-#define strcasecmp stricmp
-#endif
-
#define TMP_BUF_SIZE 1024
@@ -90,7 +85,7 @@ char* sspm_strdup(char* str){
}
-static struct major_content_type_map
+struct major_content_type_map
{
enum sspm_major_type type;
char* str;
@@ -109,7 +104,7 @@ static struct major_content_type_map
{SSPM_UNKNOWN_MAJOR_TYPE,"" },
};
-static struct minor_content_type_map
+struct minor_content_type_map
{
enum sspm_minor_type type;
char* str;
@@ -238,7 +233,7 @@ char* sspm_value(char* line)
}
-static char *mime_headers[] = {
+char *mime_headers[] = {
"Content-Type",
"Content-Transfer-Encoding",
"Content-Disposition",
@@ -363,7 +358,7 @@ enum line_type {
};
-static enum line_type get_line_type(char* line){
+enum line_type get_line_type(char* line){
if (line == 0){
return EMPTY;
@@ -387,7 +382,7 @@ static enum line_type get_line_type(char* line){
}
-static struct sspm_action_map get_action(struct mime_impl *impl,
+struct sspm_action_map get_action(struct mime_impl *impl,
enum sspm_major_type major,
enum sspm_minor_type minor)
{
@@ -953,8 +948,7 @@ void sspm_read_header(struct mime_impl *impl,struct sspm_header *header)
assert(strlen(buf) < BUF_SIZE);
- strncpy(header_lines[current_line],buf,BUF_SIZE-1);
- header_lines[current_line][BUF_SIZE-1] = '\0';
+ strcpy(header_lines[current_line],buf);
break;
}
@@ -989,7 +983,7 @@ void sspm_read_header(struct mime_impl *impl,struct sspm_header *header)
assert( strlen(buf_start) + strlen(last_line) < BUF_SIZE);
- strncat(last_line,buf_start,BUF_SIZE-strlen(last_line)-1);
+ strcat(last_line,buf_start);
break;
}
@@ -1169,7 +1163,7 @@ char *decode_base64(char *dest,
char *src,
size_t *size)
{
- int cc = 0;
+ int cc;
char buf[4] = {0,0,0,0};
int p = 0;
int valid_data = 0;
diff --git a/libical/src/libical/vsnprintf.c b/libical/src/libical/vsnprintf.c
index 982920b21c..6339183dd4 100644
--- a/libical/src/libical/vsnprintf.c
+++ b/libical/src/libical/vsnprintf.c
@@ -1,7 +1,4 @@
-#ifndef WIN32
-#include "config.h"
-#endif
-#ifndef HAVE_SNPRINTF
+#ifdef __osf__
/*
* Revision 12: http://theos.com/~deraadt/snprintf.c
*
@@ -28,14 +25,12 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef WIN32
#include <sys/param.h>
-#include <sys/mman.h>
-#include <unistd.h>
-#endif
#include <sys/types.h>
+#include <sys/mman.h>
#include <signal.h>
#include <stdio.h>
+#include <unistd.h>
#include <string.h>
#if __STDC__
#include <stdarg.h>
diff --git a/libical/src/libicalss/.cvsignore b/libical/src/libicalss/.cvsignore
index 25846dfca6..04a3e1b036 100644
--- a/libical/src/libicalss/.cvsignore
+++ b/libical/src/libicalss/.cvsignore
@@ -1,6 +1,10 @@
Makefile
.deps
-.libs
+Makefile.in
*.lo
*.la
+.libs
+y.output
+icalsslexer.c
+icalssyacc.c
icalss.h
diff --git a/libical/src/libicalss/Makefile.am b/libical/src/libicalss/Makefile.am
index 359b1f029a..9e11bc3fc8 100644
--- a/libical/src/libicalss/Makefile.am
+++ b/libical/src/libicalss/Makefile.am
@@ -1,89 +1,26 @@
-#======================================================================
-# FILE: Makefile.am
-# CREATOR: eric
-#
-# $Id: Makefile.am,v 1.20 2003/09/22 07:32:31 hansp Exp $
-#
-#
-# (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of either:
-#
-# The LGPL as published by the Free Software Foundation, version
-# 2.1, available at: http://www.fsf.org/copyleft/lesser.html
-#
-# Or:
-#
-# The Mozilla Public License Version 1.0. You may obtain a copy of
-# the License at http://www.mozilla.org/MPL/
-#
-#
-#
-#======================================================================
+lib_LTLIBRARIES = libicalss.la
-
-AM_YFLAGS =-d -v -p ss
-AM_LFLAGS = -Pss
+YFLAGS =-d -v -p ss
+LFLAGS = -Pss
LEX_OUTPUT_ROOT = lex.ss
all: icalss.h
-# just to get it built
-$(srcdir)/icalgauge.c: icalssyacc.h
-$(srcdir)/icalsslexer.c: icalssyacc.h
-
-
-if WITH_BDB4
-BDB_INCLUDE=-I@BDB_DIR_INCLUDE@ -DWITH_BDB4
-BDB_SOURCEFILES=icalbdbset.c icalbdbset.h icalbdbsetimpl.h
-BDB_HEADERFILES=$(srcdir)/icalbdbset.h
-libicalssinclude_BDBHEADERS=icalbdbset.h icalbdbsetimpl.h
-BDB_LIBFILES=@BDB_DIR_LIB@/@BDB_LIB@
-else
-BDB_INCLUDE=
-BDB_SOURCEFILES=
-BDB_HEADERFILES=
-endif
-
-if WITH_CXX_BINDINGS
-cxx_lib=libicalss-evolution_cxx.la
-cxx_headers=icalspanlist_cxx.h
-else
-cxx_lib=
-cxx_headers=
-endif
-
-privlib_LTLIBRARIES = libicalss-evolution.la $(cxx_lib)
-
INCLUDES = \
-I$(top_srcdir)/src \
-I$(top_builddir)/src \
-I$(top_srcdir)/src/libical \
- -I$(top_builddir)/libical \
- $(BDB_INCLUDE)
+ -I$(top_builddir)/src/libical
-libicalss_evolution_la_LDFLAGS = -version-info 0:0:0
-libicalss_evolution_la_LIBADD = $(BDB_LIBFILES)
+libicalss_la_LDFLAGS = -version-info 0:0:0
-if DEV
-libicalss_evolution_la_DEVSOURCES = icalsslexer.l icalssyacc.y
-else
-libicalss_evolution_la_DEVSOURCES = icalsslexer.c icalssyacc.c
-endif
-
-libicalss_evolution_la_SOURCES = \
- icalcalendar.c \
+libicalss_la_SOURCES = \
icalcalendar.h \
icalclassify.c \
icalclassify.h \
- icalcluster.c \
- icalcluster.h \
- icalclusterimpl.h \
icalgauge.c \
icalgauge.h \
icalgaugeimpl.h \
- icaldirset.c \
icaldirset.h \
icaldirsetimpl.h \
icalfileset.c \
@@ -91,58 +28,42 @@ libicalss_evolution_la_SOURCES = \
icalfilesetimpl.h \
icalset.c \
icalset.h \
+ icalsslexer.l \
icalssyacc.h \
+ icalssyacc.y \
icalspanlist.c \
icalspanlist.h \
icalmessage.c \
icalmessage.h \
- $(BDB_SOURCEFILES) \
- $(libicalss_evolution_la_DEVSOURCES)
+ icalcstpclient.c \
+ icalcstpclient.h \
+ icalcstpserver.c \
+ icalcstpserver.h \
+ icalcstp.c \
+ icalcstp.h
-libicalssincludedir = $(privincludedir)/libical
+libicalssincludedir = $(includedir)
COMBINEDHEADERS = \
$(srcdir)/icalgauge.h \
$(srcdir)/icalset.h \
- $(srcdir)/icalcluster.h \
$(srcdir)/icalfileset.h \
$(srcdir)/icaldirset.h \
- $(BDB_HEADERFILES) \
$(srcdir)/icalcalendar.h \
$(srcdir)/icalclassify.h \
$(srcdir)/icalspanlist.h \
- $(srcdir)/icalmessage.h
+ $(srcdir)/icalmessage.h \
+ $(srcdir)/icalcstp.h \
+ $(srcdir)/icalcstpclient.h \
+ $(srcdir)/icalcstpserver.h
icalss.h: $(COMBINEDHEADERS)
- echo '#ifdef __cplusplus' > icalss.h
- echo 'extern "C" {' >> icalss.h
- echo '#endif' >> icalss.h
- echo '/*' >> icalss.h
- echo ' $$''Id''$$' >> icalss.h
- echo '*/' >> icalss.h
- cat $(COMBINEDHEADERS) \
- | egrep -v "#include.*\"ical" \
- | egrep -v "#include.*\"pvl\.h\"" \
- | egrep -v '\$$(Id|Locker): .+\$$'>> icalss.h
- echo '#ifdef __cplusplus' >> icalss.h
- echo '};' >> icalss.h
- echo '#endif' >> icalss.h
-
-
-if WITH_CXX_BINDINGS
-libicalss_evolution_cxx_la_SOURCES = \
- $(libicalss_evolution_la_SOURCES) \
- icalspanlist_cxx.h \
- icalspanlist_cxx.cpp
-
-# c++ needs ical.h auto-generated.
-icalspanlist_cxx.lo: icalss.h
-
-endif
+ cat $(COMBINEDHEADERS) | egrep -v "#include.*\"ical" \
+ | egrep -v "#include.*\"pvl\.h\"" > icalss.h
-libicalssinclude_HEADERS = icalss.h icalcalendar.h icalclassify.h icalcluster.h icaldirset.h icaldirsetimpl.h icalfileset.h icalfilesetimpl.h icalgauge.h icalgaugeimpl.h icalmessage.h icalset.h icalspanlist.h icalssyacc.h $(libicalssinclude_BDBHEADERS) $(cxx_headers)
+libicalssinclude_HEADERS = icalss.h
CONFIG_CLEAN_FILES = y.output
diff --git a/libical/src/libicalss/icalcalendar.c b/libical/src/libicalss/icalcalendar.c
index 1f24f88db6..e63b5330ad 100644
--- a/libical/src/libicalss/icalcalendar.c
+++ b/libical/src/libicalss/icalcalendar.c
@@ -34,16 +34,7 @@
#include <sys/stat.h> /* For mkdir, stat */
#include <sys/types.h> /* For mkdir */
#include <fcntl.h> /* For mkdir */
-
-#ifndef WIN32
#include <unistd.h> /* For mkdir, stat */
-#endif
-
-#ifndef PATH_MAX
-#define PATH_MAX 512
-#endif
-
-
#include <stdlib.h> /* for malloc */
#include <string.h> /* for strcat */
#include <errno.h>
@@ -56,13 +47,13 @@
struct icalcalendar_impl
{
char* dir;
- icalset* freebusy;
- icalset* properties;
+ icalcomponent* freebusy;
+ icalcomponent* properties;
icalset* booked;
icalset* incoming;
};
-struct icalcalendar_impl* icalcalendar_new_impl(void)
+struct icalcalendar_impl* icalcalendar_new_impl()
{
struct icalcalendar_impl* impl;
@@ -128,26 +119,29 @@ icalcalendar* icalcalendar_new(char* dir)
return impl;
}
-void icalcalendar_free(icalcalendar* impl)
+void icalcalendar_free(icalcalendar* calendar)
{
+
+ struct icalcalendar_impl *impl = (struct icalcalendar_impl*)calendar;
+
if (impl->dir !=0){
free(impl->dir);
}
if (impl->freebusy !=0){
- icalset_free(impl->booked);
+ icalfileset_free(impl->freebusy);
}
if (impl->properties !=0){
- icalset_free(impl->properties);
+ icalfileset_free(impl->properties);
}
if (impl->booked !=0){
- icalset_free(impl->booked);
+ icaldirset_free(impl->booked);
}
if (impl->incoming !=0){
- icalset_free(impl->incoming);
+ icaldirset_free(impl->incoming);
}
impl->dir = 0;
@@ -161,32 +155,37 @@ void icalcalendar_free(icalcalendar* impl)
}
-int icalcalendar_lock(icalcalendar* impl)
+int icalcalendar_lock(icalcalendar* calendar)
{
+ struct icalcalendar_impl *impl = (struct icalcalendar_impl*)calendar;
icalerror_check_arg_rz((impl != 0),"impl");
return 0;
}
-int icalcalendar_unlock(icalcalendar* impl)
+int icalcalendar_unlock(icalcalendar* calendar)
{
+ struct icalcalendar_impl *impl = (struct icalcalendar_impl*)calendar;
icalerror_check_arg_rz((impl != 0),"impl");
return 0;
}
-int icalcalendar_islocked(icalcalendar* impl)
+int icalcalendar_islocked(icalcalendar* calendar)
{
+ struct icalcalendar_impl *impl = (struct icalcalendar_impl*)calendar;
icalerror_check_arg_rz((impl != 0),"impl");
return 0;
}
-int icalcalendar_ownlock(icalcalendar* impl)
+int icalcalendar_ownlock(icalcalendar* calendar)
{
+ struct icalcalendar_impl *impl = (struct icalcalendar_impl*)calendar;
icalerror_check_arg_rz((impl != 0),"impl");
return 0;
}
-icalset* icalcalendar_get_booked(icalcalendar* impl)
+icalset* icalcalendar_get_booked(icalcalendar* calendar)
{
+ struct icalcalendar_impl *impl = (struct icalcalendar_impl*)calendar;
char dir[PATH_MAX];
icalerror_check_arg_rz((impl != 0),"impl");
@@ -206,9 +205,10 @@ icalset* icalcalendar_get_booked(icalcalendar* impl)
}
-icalset* icalcalendar_get_incoming(icalcalendar* impl)
+icalset* icalcalendar_get_incoming(icalcalendar* calendar)
{
char path[PATH_MAX];
+ struct icalcalendar_impl *impl = (struct icalcalendar_impl*)calendar;
icalerror_check_arg_rz((impl != 0),"impl");
path[0] = '\0';
@@ -223,9 +223,10 @@ icalset* icalcalendar_get_incoming(icalcalendar* impl)
return impl->properties;
}
-icalset* icalcalendar_get_properties(icalcalendar* impl)
+icalset* icalcalendar_get_properties(icalcalendar* calendar)
{
char path[PATH_MAX];
+ struct icalcalendar_impl *impl = (struct icalcalendar_impl*)calendar;
icalerror_check_arg_rz((impl != 0),"impl");
path[0] = '\0';
@@ -240,9 +241,10 @@ icalset* icalcalendar_get_properties(icalcalendar* impl)
return impl->properties;
}
-icalset* icalcalendar_get_freebusy(icalcalendar* impl)
+icalset* icalcalendar_get_freebusy(icalcalendar* calendar)
{
char path[PATH_MAX];
+ struct icalcalendar_impl *impl = (struct icalcalendar_impl*)calendar;
icalerror_check_arg_rz((impl != 0),"impl");
path[0] = '\0';
diff --git a/libical/src/libicalss/icalcalendar.h b/libical/src/libicalss/icalcalendar.h
index 2a0c15196a..f07457c60d 100644
--- a/libical/src/libicalss/icalcalendar.h
+++ b/libical/src/libicalss/icalcalendar.h
@@ -38,7 +38,7 @@
* components. It also has interfaces to access the free/busy list
* and a list of calendar properties */
-typedef struct icalcalendar_impl icalcalendar;
+typedef void icalcalendar;
icalcalendar* icalcalendar_new(char* dir);
diff --git a/libical/src/libicalss/icalcluster.c b/libical/src/libicalss/icalcluster.c
deleted file mode 100644
index 6d11078a72..0000000000
--- a/libical/src/libicalss/icalcluster.c
+++ /dev/null
@@ -1,245 +0,0 @@
-/* -*- Mode: C -*-
- ======================================================================
- FILE: icalcluster.c
- CREATOR: acampi 13 March 2002
-
- $Id$
- $Locker$
-
- (C) COPYRIGHT 2002, Eric Busboom, http://www.softwarestudio.org
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: http://www.fsf.org/copyleft/lesser.html
-
- Or:
-
- The Mozilla Public License Version 1.0. You may obtain a copy of
- the License at http://www.mozilla.org/MPL/
-
- The Original Code is eric. The Initial Developer of the Original
- Code is Eric Busboom
-
-
- ======================================================================*/
-
-
-/**
- *
- * icalcluster is an utility class design to manage clusters of
- * icalcomponents on behalf of an implementation of icalset. This is
- * done in order to split out common behavior different classes might
- * need.
- * The definition of what exactly a cluster will contain depends on the
- * icalset subclass. At the basic level, an icluster is just a tuple,
- * with anything as key and an icalcomponent as value.
- */
-
-
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
-#include <stdlib.h>
-#include <string.h>
-
-#if 0
-#include <errno.h>
-#include <sys/stat.h> /* for stat */
-#ifndef WIN32
-#include <unistd.h> /* for stat, getpid */
-#else
-#include <io.h>
-#include <share.h>
-#endif
-#include <fcntl.h> /* for fcntl */
-#endif
-
-#include "icalcluster.h"
-#include "icalclusterimpl.h"
-#include "icalgauge.h"
-
-#ifdef WIN32
-#define snprintf _snprintf
-#define strcasecmp stricmp
-#endif
-
-
-icalcluster * icalcluster_new_impl(void) {
-
- struct icalcluster_impl* impl;
-
- if ((impl = (struct icalcluster_impl*)malloc(
- sizeof(struct icalcluster_impl))) == 0) {
- icalerror_set_errno(ICAL_NEWFAILED_ERROR);
- return 0;
- }
-
- memset(impl, 0, sizeof(struct icalcluster_impl));
- strcpy(impl->id,ICALCLUSTER_ID);
-
- return impl;
-}
-
-/**
- * Create a cluster with a key/value pair.
- *
- * @todo Always do a deep copy.
- */
-
-icalcluster * icalcluster_new(const char* key, icalcomponent *data) {
- struct icalcluster_impl *impl = icalcluster_new_impl();
- assert(impl->data == 0);
-
- impl->key = strdup(key);
- impl->changed = 0;
- impl->data = 0;
-
- if (data != NULL) {
- if (icalcomponent_isa(data) != ICAL_XROOT_COMPONENT) {
- impl->data = icalcomponent_new(ICAL_XROOT_COMPONENT);
- icalcomponent_add_component(impl->data, data);
- } else {
- impl->data = icalcomponent_new_clone(data);
- }
- } else {
- impl->data = icalcomponent_new(ICAL_XROOT_COMPONENT);
- }
-
- return impl;
-}
-
-/**
- * Deep clone an icalcluster to a new one
- */
-
-icalcluster *icalcluster_new_clone(const icalcluster *data) {
- struct icalcluster_impl *old = (struct icalcluster_impl *)data;
- struct icalcluster_impl *impl = icalcluster_new_impl();
-
- impl->key = strdup(old->key);
- impl->data = icalcomponent_new_clone(old->data);
- impl->changed = 0;
-
- return impl;
-}
-
-
-void icalcluster_free(icalcluster *impl) {
- icalerror_check_arg_rv((impl!=0),"cluster");
-
- if (impl->key != 0){
- free(impl->key);
- impl->key = 0;
- }
-
- if (impl->data != 0){
- icalcomponent_free(impl->data);
- impl->data = 0;
- }
-
- free(impl);
-}
-
-
-const char *icalcluster_key(icalcluster *impl) {
- icalerror_check_arg_rz((impl!=0),"cluster");
-
- return impl->key;
-}
-
-
-int icalcluster_is_changed(icalcluster *impl) {
- icalerror_check_arg_rz((impl!=0),"cluster");
-
- return impl->changed;
-}
-
-
-void icalcluster_mark(icalcluster *impl) {
- icalerror_check_arg_rv((impl!=0),"cluster");
-
- impl->changed = 1;
-}
-
-
-void icalcluster_commit(icalcluster *impl) {
- icalerror_check_arg_rv((impl!=0),"cluster");
-
- impl->changed = 0;
-}
-
-
-icalcomponent *icalcluster_get_component(icalcluster *impl) {
-
- icalerror_check_arg_rz((impl!=0),"cluster");
-
- if (icalcomponent_isa(impl->data) != ICAL_XROOT_COMPONENT) {
- icalerror_warn("The top component is not an XROOT");
- fprintf(stderr, "%s\n", icalcomponent_as_ical_string(impl->data));
- abort();
- }
-
- return impl->data;
-}
-
-
-icalerrorenum icalcluster_add_component(icalcluster *impl, icalcomponent* child) {
-
- icalerror_check_arg_re((impl!=0),"cluster", ICAL_BADARG_ERROR);
- icalerror_check_arg_re((child!=0),"child",ICAL_BADARG_ERROR);
-
- icalcomponent_add_component(impl->data, child);
- icalcluster_mark(impl);
-
- return ICAL_NO_ERROR;
-}
-
-
-icalerrorenum icalcluster_remove_component(icalcluster *impl, icalcomponent* child) {
-
- icalerror_check_arg_re((impl!=0),"cluster",ICAL_BADARG_ERROR);
- icalerror_check_arg_re((child!=0),"child",ICAL_BADARG_ERROR);
-
- icalcomponent_remove_component(impl->data,child);
- icalcluster_mark(impl);
-
- return ICAL_NO_ERROR;
-}
-
-
-int icalcluster_count_components(icalcluster *impl, icalcomponent_kind kind) {
-
- icalerror_check_arg_re((impl!=0),"cluster",ICAL_BADARG_ERROR);
-
- return icalcomponent_count_components(impl->data, kind);
-}
-
-
-/** Iterate through components **/
-icalcomponent *icalcluster_get_current_component(icalcluster* impl) {
-
- icalerror_check_arg_rz((impl!=0),"cluster");
-
- return icalcomponent_get_current_component(impl->data);
-}
-
-
-icalcomponent *icalcluster_get_first_component(icalcluster* impl) {
-
- icalerror_check_arg_rz((impl!=0),"cluster");
-
- return icalcomponent_get_first_component(impl->data,
- ICAL_ANY_COMPONENT);
-}
-
-
-icalcomponent *icalcluster_get_next_component(icalcluster* impl) {
-
- icalerror_check_arg_rz((impl!=0),"cluster");
-
- return icalcomponent_get_next_component(impl->data,
- ICAL_ANY_COMPONENT);
-}
diff --git a/libical/src/libicalss/icalcluster.h b/libical/src/libicalss/icalcluster.h
deleted file mode 100644
index f4eb041b04..0000000000
--- a/libical/src/libicalss/icalcluster.h
+++ /dev/null
@@ -1,61 +0,0 @@
-/* -*- Mode: C -*- */
-/*======================================================================
- FILE: icalcluster.h
- CREATOR: eric 23 December 1999
-
-
- $Id$
- $Locker$
-
- (C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: http://www.fsf.org/copyleft/lesser.html
-
- Or:
-
- The Mozilla Public License Version 1.0. You may obtain a copy of
- the License at http://www.mozilla.org/MPL/
-
- The Original Code is eric. The Initial Developer of the Original
- Code is Eric Busboom
-
-
-======================================================================*/
-
-#ifndef ICALCLUSTER_H
-#define ICALCLUSTER_H
-
-#include "ical.h"
-#include "icalset.h"
-
-typedef struct icalcluster_impl icalcluster;
-
-icalcluster* icalcluster_new(const char *key, icalcomponent *data);
-icalcluster* icalcluster_new_clone(const icalcluster *cluster);
-
-void icalcluster_free(icalcluster *cluster);
-
-const char* icalcluster_key(icalcluster *cluster);
-int icalcluster_is_changed(icalcluster *cluster);
-void icalcluster_mark(icalcluster *cluster);
-void icalcluster_commit(icalcluster *cluster);
-
-icalcomponent* icalcluster_get_component(icalcluster* cluster);
-int icalcluster_count_components(icalcluster *cluster, icalcomponent_kind kind);
-icalerrorenum icalcluster_add_component(icalcluster* cluster,
- icalcomponent* child);
-icalerrorenum icalcluster_remove_component(icalcluster* cluster,
- icalcomponent* child);
-
-icalcomponent* icalcluster_get_current_component(icalcluster* cluster);
-icalcomponent* icalcluster_get_first_component(icalcluster* cluster);
-icalcomponent* icalcluster_get_next_component(icalcluster* cluster);
-
-#endif /* !ICALCLUSTER_H */
-
-
-
diff --git a/libical/src/libicalss/icaldirset.c b/libical/src/libicalss/icaldirset.c
index 4a20fe1978..f5da125459 100644
--- a/libical/src/libicalss/icaldirset.c
+++ b/libical/src/libicalss/icaldirset.c
@@ -26,10 +26,9 @@
======================================================================*/
-/**
- @file icaldirset.c
+/*
- @brief icaldirset manages a database of ical components and offers
+ icaldirset manages a database of ical components and offers
interfaces for reading, writting and searching for components.
icaldirset groups components in to clusters based on their DTSTAMP
@@ -37,13 +36,12 @@
together in a single file. All files in a sotre are kept in a single
directory.
- The primary interfaces are icaldirset__get_first_component and
- icaldirset_get_next_component. These routine iterate through all of
- the components in the store, subject to the current gauge. A gauge
- is an icalcomponent that is tested against other componets for a
- match. If a gauge has been set with icaldirset_select,
- icaldirset_first and icaldirset_next will only return componentes
- that match the gauge.
+ The primary interfaces are icaldirset_first and icaldirset_next. These
+ routine iterate through all of the components in the store, subject
+ to the current gauge. A gauge is an icalcomponent that is tested
+ against other componets for a match. If a gauge has been set with
+ icaldirset_select, icaldirset_first and icaldirset_next will only
+ return componentes that match the gauge.
The Store generated UIDs for all objects that are stored if they do
not already have a UID. The UID is the name of the cluster (month &
@@ -59,74 +57,64 @@
#include "ical.h"
#include "icaldirset.h"
+#include "pvl.h"
+#include "icalerror.h"
+#include "icalparser.h"
#include "icaldirset.h"
#include "icalfileset.h"
#include "icalfilesetimpl.h"
-#include "icalcluster.h"
#include "icalgauge.h"
#include <limits.h> /* For PATH_MAX */
-#ifndef WIN32
-#include <dirent.h> /* for opendir() */
-#include <unistd.h> /* for stat, getpid */
-#include <sys/utsname.h> /* for uname */
-#else
-#include <io.h>
-#include <process.h>
-#endif
#include <errno.h>
#include <sys/types.h> /* for opendir() */
+#include <dirent.h> /* for opendir() */
#include <sys/stat.h> /* for stat */
+#include <unistd.h> /* for stat, getpid */
#include <time.h> /* for clock() */
#include <stdlib.h> /* for rand(), srand() */
+#include <sys/utsname.h> /* for uname */
#include <string.h> /* for strdup */
#include "icaldirsetimpl.h"
-#ifdef WIN32
-#define snprintf _snprintf
-#define strcasecmp stricmp
-
-#define _S_ISTYPE(mode, mask) (((mode) & _S_IFMT) == (mask))
+struct icaldirset_impl* icaldirset_new_impl()
+{
+ struct icaldirset_impl* impl;
-#define S_ISDIR(mode) _S_ISTYPE((mode), _S_IFDIR)
-#define S_ISREG(mode) _S_ISTYPE((mode), _S_IFREG)
-#endif
+ if ( ( impl = (struct icaldirset_impl*)
+ malloc(sizeof(struct icaldirset_impl))) == 0) {
+ icalerror_set_errno(ICAL_NEWFAILED_ERROR);
+ return 0;
+ }
-/** Default options used when NULL is passed to icalset_new() **/
-icaldirset_options icaldirset_options_default = {O_RDWR|O_CREAT};
+ strcpy(impl->id,ICALDIRSET_ID);
+ return impl;
+}
-const char* icaldirset_path(icalset* set)
+const char* icaldirset_path(icaldirset* cluster)
{
- icaldirset *dset = (icaldirset*)set;
+ struct icaldirset_impl *impl = icaldirset_new_impl();
- return dset->dir;
-}
+ return impl->dir;
+}
-void icaldirset_mark(icalset* set)
+void icaldirset_mark(icaldirset* store)
{
- icaldirset *dset = (icaldirset*)set;
+ struct icaldirset_impl *impl = (struct icaldirset_impl*)store;
- icalcluster_mark(dset->cluster);
+ icalfileset_mark(impl->cluster);
}
-icalerrorenum icaldirset_commit(icalset* set)
+icalerrorenum icaldirset_commit(icaldirset* store)
{
- icaldirset *dset = (icaldirset*)set;
- icalset *fileset;
- icalfileset_options options = icalfileset_options_default;
+ struct icaldirset_impl *impl = (struct icaldirset_impl*)store;
- options.cluster = dset->cluster;
+ return icalfileset_commit(impl->cluster);
- fileset = icalset_new(ICAL_FILE_SET, icalcluster_key(dset->cluster), &options);
-
- fileset->commit(fileset);
- fileset->free(fileset);
-
- return ICAL_NO_ERROR;
}
void icaldirset_lock(const char* dir)
@@ -139,22 +127,21 @@ void icaldirset_unlock(const char* dir)
}
/* Load the contents of the store directory into the store's internal directory list*/
-icalerrorenum icaldirset_read_directory(icaldirset *dset)
+icalerrorenum icaldirset_read_directory(struct icaldirset_impl* impl)
{
- char *str;
-#ifndef WIN32
struct dirent *de;
DIR* dp;
+ char *str;
- dp = opendir(dset->dir);
+ dp = opendir(impl->dir);
- if (dp == 0) {
+ if ( dp == 0) {
icalerror_set_errno(ICAL_FILE_ERROR);
return ICAL_FILE_ERROR;
}
/* clear contents of directory list */
- while((str = pvl_pop(dset->directory))){
+ while((str = pvl_pop(impl->directory))){
free(str);
}
@@ -169,52 +156,24 @@ icalerrorenum icaldirset_read_directory(icaldirset *dset)
continue;
}
- pvl_push(dset->directory, (void*)strdup(de->d_name));
+ pvl_push(impl->directory, (void*)strdup(de->d_name));
}
closedir(dp);
-#else
- struct _finddata_t c_file;
- long hFile;
-
- /* Find first .c file in current directory */
- if( (hFile = _findfirst( "*", &c_file )) == -1L ) {
- icalerror_set_errno(ICAL_FILE_ERROR);
- return ICAL_FILE_ERROR;
- } else {
- while((str = pvl_pop(dset->directory))){
- free(str);
- }
-
- /* load all of the cluster names in the directory list */
- do {
- /* Remove known directory names '.' and '..'*/
- if (strcmp(c_file.name,".") == 0 ||
- strcmp(c_file.name,"..") == 0 ){
- continue;
- }
-
- pvl_push(dset->directory, (void*)strdup(c_file.name));
- }
- while ( _findnext( hFile, &c_file ) == 0 );
-
- _findclose( hFile );
- }
-
-#endif
return ICAL_NO_ERROR;
}
-
-icalset* icaldirset_init(icalset* set, const char* dir, void* options_in)
+icaldirset* icaldirset_new(const char* dir)
{
- icaldirset *dset = (icaldirset*)set;
- icaldirset_options *options = options_in;
+ struct icaldirset_impl *impl = icaldirset_new_impl();
struct stat sbuf;
+ if (impl == 0){
+ return 0;
+ }
+
icalerror_check_arg_rz( (dir!=0), "dir");
- icalerror_check_arg_rz( (set!=0), "set");
if (stat(dir,&sbuf) != 0){
icalerror_set_errno(ICAL_FILE_ERROR);
@@ -229,83 +188,68 @@ icalset* icaldirset_init(icalset* set, const char* dir, void* options_in)
icaldirset_lock(dir);
- dset->dir = (char*)strdup(dir);
- dset->options = *options;
- dset->directory = pvl_newlist();
- dset->directory_iterator = 0;
- dset->gauge = 0;
- dset->first_component = 0;
- dset->cluster = 0;
-
- return set;
-}
-
-icalset* icaldirset_new(const char* dir)
-{
- return icalset_new(ICAL_DIR_SET, dir, &icaldirset_options_default);
-}
-
-
-icalset* icaldirset_new_reader(const char* dir)
-{
- icaldirset_options reader_options = icaldirset_options_default;
-
- reader_options.flags = O_RDONLY;
-
- return icalset_new(ICAL_DIR_SET, dir, &reader_options);
-}
+ impl = icaldirset_new_impl();
+ if (impl ==0){
+ icalerror_set_errno(ICAL_NEWFAILED_ERROR);
+ return 0;
+ }
-icalset* icaldirset_new_writer(const char* dir)
-{
- icaldirset_options writer_options = icaldirset_options_default;
+ impl->directory = pvl_newlist();
+ impl->directory_iterator = 0;
+ impl->dir = (char*)strdup(dir);
+ impl->gauge = 0;
+ impl->first_component = 0;
+ impl->cluster = 0;
- writer_options.flags = O_RDWR|O_CREAT;
+ icaldirset_read_directory(impl);
- return icalset_new(ICAL_DIR_SET, dir, &writer_options);
+ return (icaldirset*) impl;
}
-
-void icaldirset_free(icalset* s)
+void icaldirset_free(icaldirset* s)
{
- icaldirset *dset = (icaldirset*)s;
+ struct icaldirset_impl *impl = (struct icaldirset_impl*)s;
char* str;
- icaldirset_unlock(dset->dir);
+ icaldirset_unlock(impl->dir);
- if(dset->dir !=0){
- free(dset->dir);
- dset->dir = 0;
+ if(impl->dir !=0){
+ free(impl->dir);
}
- if(dset->gauge !=0){
- icalgauge_free(dset->gauge);
- dset->gauge = 0;
+ if(impl->gauge !=0){
+ icalcomponent_free(impl->gauge);
}
- if(dset->cluster !=0){
- icalcluster_free(dset->cluster);
+ if(impl->cluster !=0){
+ icalfileset_free(impl->cluster);
}
- while(dset->directory !=0 && (str=pvl_pop(dset->directory)) != 0){
+ while(impl->directory !=0 && (str=pvl_pop(impl->directory)) != 0){
free(str);
}
- if(dset->directory != 0){
- pvl_free(dset->directory);
- dset->directory = 0;
+ if(impl->directory != 0){
+ pvl_free(impl->directory);
}
- dset->directory_iterator = 0;
- dset->first_component = 0;
-}
+ impl->directory = 0;
+ impl->directory_iterator = 0;
+ impl->dir = 0;
+ impl->gauge = 0;
+ impl->first_component = 0;
+ free(impl);
+
+}
/* icaldirset_next_uid_number updates a serial number in the Store
directory in a file called SEQUENCE */
-int icaldirset_next_uid_number(icaldirset* dset)
+int icaldirset_next_uid_number(icaldirset* store)
{
+ struct icaldirset_impl *impl = (struct icaldirset_impl*)store;
char sequence = 0;
char temp[128];
char filename[ICAL_PATH_MAX];
@@ -313,9 +257,9 @@ int icaldirset_next_uid_number(icaldirset* dset)
FILE *f;
struct stat sbuf;
- icalerror_check_arg_rz( (dset!=0), "dset");
+ icalerror_check_arg_rz( (store!=0), "store");
- sprintf(filename,"%s/%s",dset->dir,"SEQUENCE");
+ sprintf(filename,"%s/%s",impl->dir,"SEQUENCE");
/* Create the file if it does not exist.*/
if (stat(filename,&sbuf) == -1 || !S_ISREG(sbuf.st_mode)){
@@ -328,6 +272,7 @@ int icaldirset_next_uid_number(icaldirset* dset)
icalerror_warn("Can't create SEQUENCE file in icaldirset_next_uid_number");
return 0;
}
+
}
if ( (f = fopen(filename,"r+")) != 0){
@@ -353,85 +298,85 @@ int icaldirset_next_uid_number(icaldirset* dset)
icalerror_warn("Can't create SEQUENCE file in icaldirset_next_uid_number");
return 0;
}
+
}
-icalerrorenum icaldirset_next_cluster(icaldirset* dset)
+icalerrorenum icaldirset_next_cluster(icaldirset* store)
{
+ struct icaldirset_impl *impl = (struct icaldirset_impl*)store;
char path[ICAL_PATH_MAX];
- if (dset->directory_iterator == 0){
+ if (impl->directory_iterator == 0){
icalerror_set_errno(ICAL_INTERNAL_ERROR);
return ICAL_INTERNAL_ERROR;
}
- dset->directory_iterator = pvl_next(dset->directory_iterator);
+ impl->directory_iterator = pvl_next(impl->directory_iterator);
- if (dset->directory_iterator == 0){
+ if (impl->directory_iterator == 0){
/* There are no more clusters */
- if(dset->cluster != 0){
- icalcluster_free(dset->cluster);
- dset->cluster = 0;
+ if(impl->cluster != 0){
+ icalfileset_free(impl->cluster);
+ impl->cluster = 0;
}
return ICAL_NO_ERROR;
}
- sprintf(path,"%s/%s", dset->dir,(char*)pvl_data(dset->directory_iterator));
+ sprintf(path,"%s/%s",impl->dir,(char*)pvl_data(impl->directory_iterator));
+
+ icalfileset_free(impl->cluster);
- icalcluster_free(dset->cluster);
- dset->cluster = icalfileset_produce_icalcluster(path);
+ impl->cluster = icalfileset_new(path);
return icalerrno;
}
-static void icaldirset_add_uid(icalcomponent* comp)
+void icaldirset_add_uid(icaldirset* store, icaldirset* comp)
{
char uidstring[ICAL_PATH_MAX];
icalproperty *uid;
-#ifndef WIN32
struct utsname unamebuf;
-#endif
+ icalerror_check_arg_rv( (store!=0), "store");
icalerror_check_arg_rv( (comp!=0), "comp");
uid = icalcomponent_get_first_property(comp,ICAL_UID_PROPERTY);
if (uid == 0) {
-#ifndef WIN32
uname(&unamebuf);
sprintf(uidstring,"%d-%s",(int)getpid(),unamebuf.nodename);
-#else
- sprintf(uidstring,"%d-%s",(int)getpid(),"WINDOWS"); /* FIX: There must be an easy get the system name */
-#endif
uid = icalproperty_new_uid(uidstring);
icalcomponent_add_property(comp,uid);
} else {
+
strcpy(uidstring,icalproperty_get_uid(uid));
}
}
-/**
- This assumes that the top level component is a VCALENDAR, and there
+/* This assumes that the top level component is a VCALENDAR, and there
is an inner component of type VEVENT, VTODO or VJOURNAL. The inner
- component must have a DSTAMP property
-*/
+ component must have a DTAMP property */
-icalerrorenum icaldirset_add_component(icalset* set, icalcomponent* comp)
+icalerrorenum icaldirset_add_component(icaldirset* store, icaldirset* comp)
{
+ struct icaldirset_impl *impl;
char clustername[ICAL_PATH_MAX];
- icalproperty *dt = 0;
+ icalproperty *dt;
icalvalue *v;
struct icaltimetype tm;
icalerrorenum error = ICAL_NO_ERROR;
icalcomponent *inner;
- icaldirset *dset = (icaldirset*) set;
- icalerror_check_arg_rz( (dset!=0), "dset");
+ impl = (struct icaldirset_impl*)store;
+ icalerror_check_arg_rz( (store!=0), "store");
icalerror_check_arg_rz( (comp!=0), "comp");
- icaldirset_add_uid(comp);
+ errno = 0;
+
+ icaldirset_add_uid(store,comp);
/* Determine which cluster this object belongs in. This is a HACK */
@@ -441,44 +386,52 @@ icalerrorenum icaldirset_add_component(icalset* set, icalcomponent* comp)
dt = icalcomponent_get_first_property(inner,ICAL_DTSTAMP_PROPERTY);
- if (dt != 0)
+ if (dt != 0){
break;
}
+ }
+
+ if (dt == 0){
- if (dt == 0) {
for(inner = icalcomponent_get_first_component(comp,ICAL_ANY_COMPONENT);
inner != 0;
inner = icalcomponent_get_next_component(comp,ICAL_ANY_COMPONENT)){
dt = icalcomponent_get_first_property(inner,ICAL_DTSTART_PROPERTY);
- if (dt != 0)
+ if (dt != 0){
break;
}
}
+ }
+
if (dt == 0){
+
+
icalerror_warn("The component does not have a DTSTAMP or DTSTART property, so it cannot be added to the store");
icalerror_set_errno(ICAL_BADARG_ERROR);
return ICAL_BADARG_ERROR;
}
v = icalproperty_get_value(dt);
+
tm = icalvalue_get_datetime(v);
- snprintf(clustername,ICAL_PATH_MAX,"%s/%04d%02d",dset->dir, tm.year, tm.month);
+ snprintf(clustername,ICAL_PATH_MAX,"%s/%04d%02d",impl->dir,tm.year,tm.month);
/* Load the cluster and insert the object */
- if(dset->cluster != 0 &&
- strcmp(clustername,icalcluster_key(dset->cluster)) != 0 ){
- icalcluster_free(dset->cluster);
- dset->cluster = 0;
+
+ if(impl->cluster != 0 &&
+ strcmp(clustername,icalfileset_path(impl->cluster)) != 0 ){
+ icalfileset_free(impl->cluster);
+ impl->cluster = 0;
}
- if (dset->cluster == 0){
- dset->cluster = icalfileset_produce_icalcluster(clustername);
+ if (impl->cluster == 0){
+ impl->cluster = icalfileset_new(clustername);
- if (dset->cluster == 0){
+ if (impl->cluster == 0){
error = icalerrno;
}
}
@@ -489,31 +442,33 @@ icalerrorenum icaldirset_add_component(icalset* set, icalcomponent* comp)
}
/* Add the component to the cluster */
- icalcluster_add_component(dset->cluster,comp);
+
+ icalfileset_add_component(impl->cluster,comp);
- /* icalcluster_mark(impl->cluster); */
+ icalfileset_mark(impl->cluster);
return ICAL_NO_ERROR;
}
-/**
- Remove a component in the current cluster. HACK. This routine is a
+/* Remove a component in the current cluster. HACK. This routine is a
"friend" of icalfileset, and breaks its encapsulation. It was
either do it this way, or add several layers of interfaces that had
- no other use.
- */
-
-icalerrorenum icaldirset_remove_component(icalset* set, icalcomponent* comp)
+ no other use. */
+icalerrorenum icaldirset_remove_component(icaldirset* store, icaldirset* comp)
{
- icaldirset *dset = (icaldirset*)set;
- icalcomponent *filecomp = icalcluster_get_component(dset->cluster);
+ struct icaldirset_impl *impl = (struct icaldirset_impl*)store;
+
+ struct icalfileset_impl *filesetimpl =
+ (struct icalfileset_impl*)impl->cluster;
+
+ icalcomponent *filecomp = filesetimpl->cluster;
icalcompiter i;
int found = 0;
- icalerror_check_arg_re((set!=0),"set",ICAL_BADARG_ERROR);
+ icalerror_check_arg_re((store!=0),"store",ICAL_BADARG_ERROR);
icalerror_check_arg_re((comp!=0),"comp",ICAL_BADARG_ERROR);
- icalerror_check_arg_re((dset->cluster!=0),"Cluster pointer",ICAL_USAGE_ERROR);
+ icalerror_check_arg_re((impl->cluster!=0),"Cluster pointer",ICAL_USAGE_ERROR);
for(i = icalcomponent_begin_component(filecomp,ICAL_ANY_COMPONENT);
icalcompiter_deref(&i)!= 0; icalcompiter_next(&i)){
@@ -532,16 +487,17 @@ icalerrorenum icaldirset_remove_component(icalset* set, icalcomponent* comp)
return ICAL_USAGE_ERROR;
}
- icalcluster_remove_component(dset->cluster,comp);
+ icalfileset_remove_component(impl->cluster,comp);
- /* icalcluster_mark(impl->cluster); */
+ icalfileset_mark(impl->cluster);
/* If the removal emptied the fileset, get the next fileset */
- if( icalcluster_count_components(dset->cluster,ICAL_ANY_COMPONENT)==0){
- icalerrorenum error = icaldirset_next_cluster(dset);
+ if( icalfileset_count_components(impl->cluster,ICAL_ANY_COMPONENT)==0){
+
+ icalerrorenum error = icaldirset_next_cluster(store);
- if(dset->cluster != 0 && error == ICAL_NO_ERROR){
- icalcluster_get_first_component(dset->cluster);
+ if(impl->cluster != 0 && error == ICAL_NO_ERROR){
+ icalfileset_get_first_component(impl->cluster);
} else {
/* HACK. Not strictly correct for impl->cluster==0 */
return error;
@@ -555,84 +511,95 @@ icalerrorenum icaldirset_remove_component(icalset* set, icalcomponent* comp)
-int icaldirset_count_components(icalset* store,
+int icaldirset_count_components(icaldirset* store,
icalcomponent_kind kind)
{
/* HACK, not implemented */
+
assert(0);
return 0;
}
-icalcomponent* icaldirset_fetch_match(icalset* set, icalcomponent *c)
+icalcomponent* icaldirset_fetch_match(icaldirset* set, icalcomponent *c)
{
fprintf(stderr," icaldirset_fetch_match is not implemented\n");
assert(0);
- return 0;
}
-icalcomponent* icaldirset_fetch(icalset* set, const char* uid)
+icalcomponent* icaldirset_fetch(icaldirset* store, const char* uid)
{
- icaldirset *dset = (icaldirset*)set;
- icalgauge *gauge;
- icalgauge *old_gauge;
+ icalcomponent *gauge;
+ icalcomponent *old_gauge;
icalcomponent *c;
- char sql[256];
+ struct icaldirset_impl *impl = (struct icaldirset_impl*)store;
- icalerror_check_arg_rz( (set!=0), "set");
+ icalerror_check_arg_rz( (store!=0), "store");
icalerror_check_arg_rz( (uid!=0), "uid");
- snprintf(sql, 256, "SELECT * FROM VEVENT WHERE UID = \"%s\"", uid);
-
- gauge = icalgauge_new_from_sql(sql, 0);
+ gauge =
+ icalcomponent_vanew(
+ ICAL_VCALENDAR_COMPONENT,
+ icalcomponent_vanew(
+ ICAL_VEVENT_COMPONENT,
+ icalproperty_vanew_uid(
+ uid,
+ icalparameter_new_xliccomparetype(
+ ICAL_XLICCOMPARETYPE_EQUAL),
+ 0),
+ 0),
+ 0);
- old_gauge = dset->gauge;
- dset->gauge = gauge;
+ old_gauge = impl->gauge;
+ impl->gauge = gauge;
- c= icaldirset_get_first_component(set);
+ c= icaldirset_get_first_component(store);
- dset->gauge = old_gauge;
+ impl->gauge = old_gauge;
- icalgauge_free(gauge);
+ icalcomponent_free(gauge);
return c;
}
-int icaldirset_has_uid(icalset* set, const char* uid)
+int icaldirset_has_uid(icaldirset* store, const char* uid)
{
icalcomponent *c;
- icalerror_check_arg_rz( (set!=0), "set");
+ icalerror_check_arg_rz( (store!=0), "store");
icalerror_check_arg_rz( (uid!=0), "uid");
/* HACK. This is a temporary implementation. _has_uid should use a
database, and _fetch should use _has_uid, not the other way
around */
- c = icaldirset_fetch(set,uid);
+ c = icaldirset_fetch(store,uid);
return c!=0;
}
-icalerrorenum icaldirset_select(icalset* set, icalgauge* gauge)
-{
- icaldirset *dset = (icaldirset*)set;
+icalerrorenum icaldirset_select(icaldirset* store, icalcomponent* gauge)
+ {
+ struct icaldirset_impl *impl = (struct icaldirset_impl*)store;
- icalerror_check_arg_re( (set!=0), "set",ICAL_BADARG_ERROR);
+ icalerror_check_arg_re( (store!=0), "store",ICAL_BADARG_ERROR);
icalerror_check_arg_re( (gauge!=0), "gauge",ICAL_BADARG_ERROR);
- dset->gauge = gauge;
+ if (!icalcomponent_is_valid(gauge)){
+ return ICAL_BADARG_ERROR;
+ }
+
+ impl->gauge = gauge;
return ICAL_NO_ERROR;
}
-icalerrorenum icaldirset_modify(icalset* set,
- icalcomponent *old,
+icalerrorenum icaldirset_modify(icaldirset* store, icalcomponent *old,
icalcomponent *new)
{
assert(0);
@@ -641,7 +608,7 @@ icalerrorenum icaldirset_modify(icalset* set,
}
-void icaldirset_clear(icalset* set)
+void icaldirset_clear(icaldirset* store)
{
assert(0);
@@ -649,58 +616,53 @@ void icaldirset_clear(icalset* set)
/* HACK, not implemented */
}
-icalcomponent* icaldirset_get_current_component(icalset* set)
+icalcomponent* icaldirset_get_current_component(icaldirset* store)
{
- icaldirset *dset = (icaldirset*)set;
+ struct icaldirset_impl *impl = (struct icaldirset_impl*)store;
- if (dset->cluster == 0){
- icaldirset_get_first_component(set);
- }
- if(dset->cluster == 0){
- return 0;
+ if(impl->cluster == 0){
+ icaldirset_get_first_component(store);
}
- return icalcluster_get_current_component(dset->cluster);
+ return icalfileset_get_current_component(impl->cluster);
+
}
-icalcomponent* icaldirset_get_first_component(icalset* set)
+icalcomponent* icaldirset_get_first_component(icaldirset* store)
{
- icaldirset *dset = (icaldirset*)set;
-
+ struct icaldirset_impl *impl = (struct icaldirset_impl*)store;
icalerrorenum error;
char path[ICAL_PATH_MAX];
- error = icaldirset_read_directory(dset);
+ error = icaldirset_read_directory(impl);
if (error != ICAL_NO_ERROR){
icalerror_set_errno(error);
return 0;
}
- dset->directory_iterator = pvl_head(dset->directory);
+ impl->directory_iterator = pvl_head(impl->directory);
- if (dset->directory_iterator == 0){
+ if (impl->directory_iterator == 0){
icalerror_set_errno(error);
return 0;
}
- snprintf(path,ICAL_PATH_MAX,"%s/%s",
- dset->dir,
- (char*)pvl_data(dset->directory_iterator));
+ snprintf(path,ICAL_PATH_MAX,"%s/%s",impl->dir,(char*)pvl_data(impl->directory_iterator));
/* If the next cluster we need is different than the current cluster,
delete the current one and get a new one */
- if(dset->cluster != 0 && strcmp(path,icalcluster_key(dset->cluster)) != 0 ){
- icalcluster_free(dset->cluster);
- dset->cluster = 0;
+ if(impl->cluster != 0 && strcmp(path,icalfileset_path(impl->cluster)) != 0 ){
+ icalfileset_free(impl->cluster);
+ impl->cluster = 0;
}
- if (dset->cluster == 0){
- dset->cluster = icalfileset_produce_icalcluster(path);
+ if (impl->cluster == 0){
+ impl->cluster = icalfileset_new(path);
- if (dset->cluster == 0){
+ if (impl->cluster == 0){
error = icalerrno;
}
}
@@ -710,22 +672,23 @@ icalcomponent* icaldirset_get_first_component(icalset* set)
return 0;
}
- dset->first_component = 1;
+ impl->first_component = 1;
- return icaldirset_get_next_component(set);
+ return icaldirset_get_next_component(store);
}
-
-icalcomponent* icaldirset_get_next_component(icalset* set)
+icalcomponent* icaldirset_get_next_component(icaldirset* store)
{
- icaldirset *dset = (icaldirset*)set;
+ struct icaldirset_impl *impl;
icalcomponent *c;
icalerrorenum error;
- icalerror_check_arg_rz( (set!=0), "set");
+ icalerror_check_arg_rz( (store!=0), "store");
+
+ impl = (struct icaldirset_impl*)store;
+ if(impl->cluster == 0){
- if(dset->cluster == 0){
icalerror_warn("icaldirset_get_next_component called with a NULL cluster (Caller must call icaldirset_get_first_component first");
icalerror_set_errno(ICAL_USAGE_ERROR);
return 0;
@@ -733,26 +696,30 @@ icalcomponent* icaldirset_get_next_component(icalset* set)
}
/* Set the component iterator for the following for loop */
- if (dset->first_component == 1){
- icalcluster_get_first_component(dset->cluster);
- dset->first_component = 0;
+ if (impl->first_component == 1){
+ icalfileset_get_first_component(impl->cluster);
+ impl->first_component = 0;
} else {
- icalcluster_get_next_component(dset->cluster);
+ icalfileset_get_next_component(impl->cluster);
}
+
while(1){
/* Iterate through all of the objects in the cluster*/
- for( c = icalcluster_get_current_component(dset->cluster);
+ for( c = icalfileset_get_current_component(impl->cluster);
c != 0;
- c = icalcluster_get_next_component(dset->cluster)){
+ c = icalfileset_get_next_component(impl->cluster)){
/* If there is a gauge defined and the component does not
pass the gauge, skip the rest of the loop */
- if (dset->gauge != 0 && icalgauge_compare(dset->gauge,c) == 0){
+#if 0 /* HACK */
+ if (impl->gauge != 0 && icalgauge_test(c,impl->gauge) == 0){
continue;
}
-
+#else
+ assert(0); /* icalgauge_test needs to be fixed */
+#endif
/* Either there is no gauge, or the component passed the
gauge, so return it*/
@@ -762,13 +729,13 @@ icalcomponent* icaldirset_get_next_component(icalset* set)
/* Fell through the loop, so the component we want is not
in this cluster. Load a new cluster and try again.*/
- error = icaldirset_next_cluster(dset);
+ error = icaldirset_next_cluster(store);
- if(dset->cluster == 0 || error != ICAL_NO_ERROR){
+ if(impl->cluster == 0 || error != ICAL_NO_ERROR){
/* No more clusters */
return 0;
} else {
- c = icalcluster_get_first_component(dset->cluster);
+ c = icalfileset_get_first_component(impl->cluster);
return c;
}
@@ -778,28 +745,9 @@ icalcomponent* icaldirset_get_next_component(icalset* set)
return 0; /* Should never get here */
}
-icalsetiter icaldirset_begin_component(icalset* set, icalcomponent_kind kind, icalgauge* gauge)
-{
- icalsetiter itr = icalsetiter_null;
- icaldirset *fset = (icaldirset*) set;
-
- icalerror_check_arg_re((fset!=0), "set", icalsetiter_null);
+
- itr.iter.kind = kind;
- itr.gauge = gauge;
- /* TO BE IMPLEMENTED */
- return icalsetiter_null;
-}
-icalcomponent* icaldirsetiter_to_next(icalset* set, icalsetiter* i)
-{
- /* TO BE IMPLEMENTED */
- return NULL;
-}
-icalcomponent* icaldirsetiter_to_prior(icalset* set, icalsetiter* i)
-{
- /* TO BE IMPLEMENTED */
- return NULL;
-}
+
diff --git a/libical/src/libicalss/icalsslexer.c b/libical/src/libicalss/icalsslexer.c
deleted file mode 100644
index e5afa81f61..0000000000
--- a/libical/src/libicalss/icalsslexer.c
+++ /dev/null
@@ -1,1746 +0,0 @@
-#define yy_create_buffer ss_create_buffer
-#define yy_delete_buffer ss_delete_buffer
-#define yy_scan_buffer ss_scan_buffer
-#define yy_scan_string ss_scan_string
-#define yy_scan_bytes ss_scan_bytes
-#define yy_flex_debug ss_flex_debug
-#define yy_init_buffer ss_init_buffer
-#define yy_flush_buffer ss_flush_buffer
-#define yy_load_buffer_state ss_load_buffer_state
-#define yy_switch_to_buffer ss_switch_to_buffer
-#define yyin ssin
-#define yyleng ssleng
-#define yylex sslex
-#define yyout ssout
-#define yyrestart ssrestart
-#define yytext sstext
-#define yywrap sswrap
-
-/* A lexical scanner generated by flex */
-
-/* Scanner skeleton version:
- * $Header$
- */
-
-#define FLEX_SCANNER
-#define YY_FLEX_MAJOR_VERSION 2
-#define YY_FLEX_MINOR_VERSION 5
-
-#include <stdio.h>
-#include <unistd.h>
-
-
-/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
-#ifdef c_plusplus
-#ifndef __cplusplus
-#define __cplusplus
-#endif
-#endif
-
-
-#ifdef __cplusplus
-
-#include <stdlib.h>
-
-/* Use prototypes in function declarations. */
-#define YY_USE_PROTOS
-
-/* The "const" storage-class-modifier is valid. */
-#define YY_USE_CONST
-
-#else /* ! __cplusplus */
-
-#if __STDC__
-
-#define YY_USE_PROTOS
-#define YY_USE_CONST
-
-#endif /* __STDC__ */
-#endif /* ! __cplusplus */
-
-#ifdef __TURBOC__
- #pragma warn -rch
- #pragma warn -use
-#include <io.h>
-#include <stdlib.h>
-#define YY_USE_CONST
-#define YY_USE_PROTOS
-#endif
-
-#ifdef YY_USE_CONST
-#define yyconst const
-#else
-#define yyconst
-#endif
-
-
-#ifdef YY_USE_PROTOS
-#define YY_PROTO(proto) proto
-#else
-#define YY_PROTO(proto) ()
-#endif
-
-/* Returned upon end-of-file. */
-#define YY_NULL 0
-
-/* Promotes a possibly negative, possibly signed char to an unsigned
- * integer for use as an array index. If the signed char is negative,
- * we want to instead treat it as an 8-bit unsigned char, hence the
- * double cast.
- */
-#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
-
-/* Enter a start condition. This macro really ought to take a parameter,
- * but we do it the disgusting crufty way forced on us by the ()-less
- * definition of BEGIN.
- */
-#define BEGIN yy_start = 1 + 2 *
-
-/* Translate the current start state into a value that can be later handed
- * to BEGIN to return to the state. The YYSTATE alias is for lex
- * compatibility.
- */
-#define YY_START ((yy_start - 1) / 2)
-#define YYSTATE YY_START
-
-/* Action number for EOF rule of a given start state. */
-#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
-
-/* Special action meaning "start processing a new file". */
-#define YY_NEW_FILE yyrestart( yyin )
-
-#define YY_END_OF_BUFFER_CHAR 0
-
-/* Size of default input buffer. */
-#define YY_BUF_SIZE 16384
-
-typedef struct yy_buffer_state *YY_BUFFER_STATE;
-
-extern int yyleng;
-extern FILE *yyin, *yyout;
-
-#define EOB_ACT_CONTINUE_SCAN 0
-#define EOB_ACT_END_OF_FILE 1
-#define EOB_ACT_LAST_MATCH 2
-
-/* The funky do-while in the following #define is used to turn the definition
- * int a single C statement (which needs a semi-colon terminator). This
- * avoids problems with code like:
- *
- * if ( condition_holds )
- * yyless( 5 );
- * else
- * do_something_else();
- *
- * Prior to using the do-while the compiler would get upset at the
- * "else" because it interpreted the "if" statement as being all
- * done when it reached the ';' after the yyless() call.
- */
-
-/* Return all but the first 'n' matched characters back to the input stream. */
-
-#define yyless(n) \
- do \
- { \
- /* Undo effects of setting up yytext. */ \
- *yy_cp = yy_hold_char; \
- YY_RESTORE_YY_MORE_OFFSET \
- yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
- YY_DO_BEFORE_ACTION; /* set up yytext again */ \
- } \
- while ( 0 )
-
-#define unput(c) yyunput( c, yytext_ptr )
-
-/* The following is because we cannot portably get our hands on size_t
- * (without autoconf's help, which isn't available because we want
- * flex-generated scanners to compile on their own).
- */
-typedef unsigned int yy_size_t;
-
-
-struct yy_buffer_state
- {
- FILE *yy_input_file;
-
- char *yy_ch_buf; /* input buffer */
- char *yy_buf_pos; /* current position in input buffer */
-
- /* Size of input buffer in bytes, not including room for EOB
- * characters.
- */
- yy_size_t yy_buf_size;
-
- /* Number of characters read into yy_ch_buf, not including EOB
- * characters.
- */
- int yy_n_chars;
-
- /* Whether we "own" the buffer - i.e., we know we created it,
- * and can realloc() it to grow it, and should free() it to
- * delete it.
- */
- int yy_is_our_buffer;
-
- /* Whether this is an "interactive" input source; if so, and
- * if we're using stdio for input, then we want to use getc()
- * instead of fread(), to make sure we stop fetching input after
- * each newline.
- */
- int yy_is_interactive;
-
- /* Whether we're considered to be at the beginning of a line.
- * If so, '^' rules will be active on the next match, otherwise
- * not.
- */
- int yy_at_bol;
-
- /* Whether to try to fill the input buffer when we reach the
- * end of it.
- */
- int yy_fill_buffer;
-
- int yy_buffer_status;
-#define YY_BUFFER_NEW 0
-#define YY_BUFFER_NORMAL 1
- /* When an EOF's been seen but there's still some text to process
- * then we mark the buffer as YY_EOF_PENDING, to indicate that we
- * shouldn't try reading from the input source any more. We might
- * still have a bunch of tokens to match, though, because of
- * possible backing-up.
- *
- * When we actually see the EOF, we change the status to "new"
- * (via yyrestart()), so that the user can continue scanning by
- * just pointing yyin at a new input file.
- */
-#define YY_BUFFER_EOF_PENDING 2
- };
-
-static YY_BUFFER_STATE yy_current_buffer = 0;
-
-/* We provide macros for accessing buffer states in case in the
- * future we want to put the buffer states in a more general
- * "scanner state".
- */
-#define YY_CURRENT_BUFFER yy_current_buffer
-
-
-/* yy_hold_char holds the character lost when yytext is formed. */
-static char yy_hold_char;
-
-static int yy_n_chars; /* number of characters read into yy_ch_buf */
-
-
-int yyleng;
-
-/* Points to current character in buffer. */
-static char *yy_c_buf_p = (char *) 0;
-static int yy_init = 1; /* whether we need to initialize */
-static int yy_start = 0; /* start state number */
-
-/* Flag which is used to allow yywrap()'s to do buffer switches
- * instead of setting up a fresh yyin. A bit of a hack ...
- */
-static int yy_did_buffer_switch_on_eof;
-
-void yyrestart YY_PROTO(( FILE *input_file ));
-
-void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
-void yy_load_buffer_state YY_PROTO(( void ));
-YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
-void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
-void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
-void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
-#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
-
-YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
-YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
-YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
-
-static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
-static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
-static void yy_flex_free YY_PROTO(( void * ));
-
-#define yy_new_buffer yy_create_buffer
-
-#define yy_set_interactive(is_interactive) \
- { \
- if ( ! yy_current_buffer ) \
- yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
- yy_current_buffer->yy_is_interactive = is_interactive; \
- }
-
-#define yy_set_bol(at_bol) \
- { \
- if ( ! yy_current_buffer ) \
- yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
- yy_current_buffer->yy_at_bol = at_bol; \
- }
-
-#define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
-
-typedef unsigned char YY_CHAR;
-FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
-typedef int yy_state_type;
-extern char yytext[];
-
-
-static yy_state_type yy_get_previous_state YY_PROTO(( void ));
-static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
-static int yy_get_next_buffer YY_PROTO(( void ));
-static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
-
-/* Done after the current pattern has been matched and before the
- * corresponding action - sets up yytext.
- */
-#define YY_DO_BEFORE_ACTION \
- yytext_ptr = yy_bp; \
- yyleng = (int) (yy_cp - yy_bp); \
- yy_hold_char = *yy_cp; \
- *yy_cp = '\0'; \
- if ( yyleng >= YYLMAX ) \
- YY_FATAL_ERROR( "token too large, exceeds YYLMAX" ); \
- yy_flex_strncpy( yytext, yytext_ptr, yyleng + 1 ); \
- yy_c_buf_p = yy_cp;
-
-#define YY_NUM_RULES 23
-#define YY_END_OF_BUFFER 24
-static yyconst short int yy_accept[56] =
- { 0,
- 0, 0, 0, 0, 0, 0, 24, 22, 18, 18,
- 22, 17, 21, 4, 19, 8, 5, 9, 21, 21,
- 21, 21, 21, 21, 21, 18, 7, 0, 21, 10,
- 6, 11, 21, 21, 14, 21, 21, 13, 21, 21,
- 20, 12, 21, 15, 21, 21, 21, 2, 16, 21,
- 21, 21, 3, 1, 0
- } ;
-
-static yyconst int yy_ec[256] =
- { 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
- 1, 1, 2, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 4, 5, 1, 1, 1, 1, 1, 6, 1,
- 1, 7, 1, 8, 7, 7, 1, 7, 7, 7,
- 7, 7, 7, 7, 7, 7, 7, 9, 10, 11,
- 12, 13, 1, 7, 14, 7, 15, 16, 17, 18,
- 7, 19, 20, 7, 7, 21, 22, 23, 24, 7,
- 7, 25, 26, 27, 28, 7, 29, 7, 7, 7,
- 1, 1, 1, 1, 1, 1, 14, 7, 15, 16,
-
- 17, 18, 7, 19, 20, 7, 7, 21, 22, 23,
- 24, 7, 7, 25, 26, 27, 28, 7, 29, 7,
- 7, 7, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1
- } ;
-
-static yyconst int yy_meta[30] =
- { 0,
- 1, 1, 1, 2, 1, 1, 3, 1, 2, 1,
- 1, 1, 1, 3, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 3, 3, 3, 3, 3, 3
- } ;
-
-static yyconst short int yy_base[58] =
- { 0,
- 0, 0, 0, 0, 0, 0, 68, 69, 28, 31,
- 55, 0, 0, 69, 69, 54, 53, 52, 40, 37,
- 35, 12, 35, 42, 39, 35, 69, 51, 0, 69,
- 69, 69, 40, 31, 0, 27, 32, 0, 31, 34,
- 69, 0, 28, 0, 28, 31, 22, 0, 0, 31,
- 28, 17, 0, 0, 69, 39, 40
- } ;
-
-static yyconst short int yy_def[58] =
- { 0,
- 55, 1, 1, 1, 1, 1, 55, 55, 55, 55,
- 55, 56, 57, 55, 55, 55, 55, 55, 57, 57,
- 57, 57, 57, 57, 57, 55, 55, 56, 57, 55,
- 55, 55, 57, 57, 57, 57, 57, 57, 57, 57,
- 55, 57, 57, 57, 57, 57, 57, 57, 57, 57,
- 57, 57, 57, 57, 0, 55, 55
- } ;
-
-static yyconst short int yy_nxt[99] =
- { 0,
- 8, 9, 10, 9, 11, 12, 13, 14, 8, 15,
- 16, 17, 18, 19, 13, 13, 13, 20, 13, 21,
- 13, 13, 22, 23, 13, 24, 13, 13, 25, 26,
- 26, 26, 26, 26, 26, 36, 26, 26, 26, 37,
- 28, 28, 29, 54, 53, 52, 51, 50, 49, 48,
- 47, 46, 45, 44, 43, 42, 41, 40, 39, 38,
- 35, 34, 33, 32, 31, 30, 27, 55, 7, 55,
- 55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
- 55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
- 55, 55, 55, 55, 55, 55, 55, 55
-
- } ;
-
-static yyconst short int yy_chk[99] =
- { 0,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 9,
- 9, 9, 10, 10, 10, 22, 26, 26, 26, 22,
- 56, 56, 57, 52, 51, 50, 47, 46, 45, 43,
- 40, 39, 37, 36, 34, 33, 28, 25, 24, 23,
- 21, 20, 19, 18, 17, 16, 11, 7, 55, 55,
- 55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
- 55, 55, 55, 55, 55, 55, 55, 55, 55, 55,
- 55, 55, 55, 55, 55, 55, 55, 55
-
- } ;
-
-static yy_state_type yy_last_accepting_state;
-static char *yy_last_accepting_cpos;
-
-/* The intent behind this definition is that it'll catch
- * any uses of REJECT which flex missed.
- */
-#define REJECT reject_used_but_not_detected
-#define yymore() yymore_used_but_not_detected
-#define YY_MORE_ADJ 0
-#define YY_RESTORE_YY_MORE_OFFSET
-#ifndef YYLMAX
-#define YYLMAX 8192
-#endif
-
-char yytext[YYLMAX];
-char *yytext_ptr;
-#line 1 "icalsslexer.l"
-#define INITIAL 0
-#line 2 "icalsslexer.l"
-/* -*- Mode: C -*-
- ======================================================================
- FILE: icalsslexer.l
- CREATOR: eric 8 Aug 2000
-
- DESCRIPTION:
-
- $Id$
- $Locker$
-
-(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: http://www.fsf.org/copyleft/lesser.html
-
- Or:
-
- The Mozilla Public License Version 1.0. You may obtain a copy of
- the License at http://www.mozilla.org/MPL/
-
- The Original Code is eric. The Initial Developer of the Original
- Code is Eric Busboom
-
- ======================================================================*/
-
-#include "icalssyacc.h"
-#include "icalgaugeimpl.h"
-#include "assert.h"
-
-#include <string.h> /* For strdup() */
-
-const char* input_buffer;
-const char* input_buffer_p;
-
-#define min(a,b) ((a) < (b) ? (a) : (b))
-
-int icalss_input(char* buf, int max_size)
-{
- int n = min(max_size,strlen(input_buffer_p));
-
- if (n > 0){
- memcpy(buf, input_buffer_p, n);
- input_buffer_p += n;
- return n;
- } else {
- return 0;
- }
-}
-
-#undef YY_INPUT
-#define YY_INPUT(b,r,ms) ( r= icalss_input(b,ms))
-
-#undef SS_FATAL_ERROR
-#define SS_FATAL_ERROR(msg) sserror(msg)
-
-#define sql 1
-#define string_value 2
-
-#line 488 "icalsslexer.c"
-
-/* Macros after this point can all be overridden by user definitions in
- * section 1.
- */
-
-#ifndef YY_SKIP_YYWRAP
-#ifdef __cplusplus
-extern "C" int yywrap YY_PROTO(( void ));
-#else
-extern int yywrap YY_PROTO(( void ));
-#endif
-#endif
-
-#ifndef YY_NO_UNPUT
-static void yyunput YY_PROTO(( int c, char *buf_ptr ));
-#endif
-
-#ifndef yytext_ptr
-static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
-#endif
-
-#ifdef YY_NEED_STRLEN
-static int yy_flex_strlen YY_PROTO(( yyconst char * ));
-#endif
-
-#ifndef YY_NO_INPUT
-#ifdef __cplusplus
-static int yyinput YY_PROTO(( void ));
-#else
-static int input YY_PROTO(( void ));
-#endif
-#endif
-
-#if YY_STACK_USED
-static int yy_start_stack_ptr = 0;
-static int yy_start_stack_depth = 0;
-static int *yy_start_stack = 0;
-#ifndef YY_NO_PUSH_STATE
-static void yy_push_state YY_PROTO(( int new_state ));
-#endif
-#ifndef YY_NO_POP_STATE
-static void yy_pop_state YY_PROTO(( void ));
-#endif
-#ifndef YY_NO_TOP_STATE
-static int yy_top_state YY_PROTO(( void ));
-#endif
-
-#else
-#define YY_NO_PUSH_STATE 1
-#define YY_NO_POP_STATE 1
-#define YY_NO_TOP_STATE 1
-#endif
-
-#ifdef YY_MALLOC_DECL
-YY_MALLOC_DECL
-#else
-#if __STDC__
-#ifndef __cplusplus
-#include <stdlib.h>
-#endif
-#else
-/* Just try to get by without declaring the routines. This will fail
- * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
- * or sizeof(void*) != sizeof(int).
- */
-#endif
-#endif
-
-/* Amount of stuff to slurp up with each read. */
-#ifndef YY_READ_BUF_SIZE
-#define YY_READ_BUF_SIZE 8192
-#endif
-
-/* Copy whatever the last rule matched to the standard output. */
-
-#ifndef ECHO
-/* This used to be an fputs(), but since the string might contain NUL's,
- * we now use fwrite().
- */
-#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
-#endif
-
-/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
- * is returned in "result".
- */
-#ifndef YY_INPUT
-#define YY_INPUT(buf,result,max_size) \
- if ( yy_current_buffer->yy_is_interactive ) \
- { \
- int c = '*', n; \
- for ( n = 0; n < max_size && \
- (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
- buf[n] = (char) c; \
- if ( c == '\n' ) \
- buf[n++] = (char) c; \
- if ( c == EOF && ferror( yyin ) ) \
- YY_FATAL_ERROR( "input in flex scanner failed" ); \
- result = n; \
- } \
- else if ( ((result = fread( buf, 1, max_size, yyin )) == 0) \
- && ferror( yyin ) ) \
- YY_FATAL_ERROR( "input in flex scanner failed" );
-#endif
-
-/* No semi-colon after return; correct usage is to write "yyterminate();" -
- * we don't want an extra ';' after the "return" because that will cause
- * some compilers to complain about unreachable statements.
- */
-#ifndef yyterminate
-#define yyterminate() return YY_NULL
-#endif
-
-/* Number of entries by which start-condition stack grows. */
-#ifndef YY_START_STACK_INCR
-#define YY_START_STACK_INCR 25
-#endif
-
-/* Report a fatal error. */
-#ifndef YY_FATAL_ERROR
-#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
-#endif
-
-/* Default declaration of generated scanner - a define so the user can
- * easily add parameters.
- */
-#ifndef YY_DECL
-#define YY_DECL int yylex YY_PROTO(( void ))
-#endif
-
-/* Code executed at the beginning of each rule, after yytext and yyleng
- * have been set up.
- */
-#ifndef YY_USER_ACTION
-#define YY_USER_ACTION
-#endif
-
-/* Code executed at the end of each rule. */
-#ifndef YY_BREAK
-#define YY_BREAK break;
-#endif
-
-#define YY_RULE_SETUP \
- YY_USER_ACTION
-
-YY_DECL
- {
- register yy_state_type yy_current_state;
- register char *yy_cp = NULL, *yy_bp = NULL;
- register int yy_act;
-
-#line 83 "icalsslexer.l"
-
-
-
-
-
-
-#line 646 "icalsslexer.c"
-
- if ( yy_init )
- {
- yy_init = 0;
-
-#ifdef YY_USER_INIT
- YY_USER_INIT;
-#endif
-
- if ( ! yy_start )
- yy_start = 1; /* first start state */
-
- if ( ! yyin )
- yyin = stdin;
-
- if ( ! yyout )
- yyout = stdout;
-
- if ( ! yy_current_buffer )
- yy_current_buffer =
- yy_create_buffer( yyin, YY_BUF_SIZE );
-
- yy_load_buffer_state();
- }
-
- while ( 1 ) /* loops until end-of-file is reached */
- {
- yy_cp = yy_c_buf_p;
-
- /* Support of yytext. */
- *yy_cp = yy_hold_char;
-
- /* yy_bp points to the position in yy_ch_buf of the start of
- * the current run.
- */
- yy_bp = yy_cp;
-
- yy_current_state = yy_start;
-yy_match:
- do
- {
- register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
- if ( yy_accept[yy_current_state] )
- {
- yy_last_accepting_state = yy_current_state;
- yy_last_accepting_cpos = yy_cp;
- }
- while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
- {
- yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 56 )
- yy_c = yy_meta[(unsigned int) yy_c];
- }
- yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- ++yy_cp;
- }
- while ( yy_base[yy_current_state] != 69 );
-
-yy_find_action:
- yy_act = yy_accept[yy_current_state];
- if ( yy_act == 0 )
- { /* have to back up */
- yy_cp = yy_last_accepting_cpos;
- yy_current_state = yy_last_accepting_state;
- yy_act = yy_accept[yy_current_state];
- }
-
- YY_DO_BEFORE_ACTION;
-
-
-do_action: /* This label is used only to access EOF actions. */
-
-
- switch ( yy_act )
- { /* beginning of action switch */
- case 0: /* must back up */
- /* undo the effects of YY_DO_BEFORE_ACTION */
- *yy_cp = yy_hold_char;
- yy_cp = yy_last_accepting_cpos;
- yy_current_state = yy_last_accepting_state;
- goto yy_find_action;
-
-case 1:
-YY_RULE_SETUP
-#line 89 "icalsslexer.l"
-{ return SELECT; }
- YY_BREAK
-case 2:
-YY_RULE_SETUP
-#line 90 "icalsslexer.l"
-{ return FROM; }
- YY_BREAK
-case 3:
-YY_RULE_SETUP
-#line 91 "icalsslexer.l"
-{ return WHERE; }
- YY_BREAK
-case 4:
-YY_RULE_SETUP
-#line 92 "icalsslexer.l"
-{ return COMMA; }
- YY_BREAK
-case 5:
-YY_RULE_SETUP
-#line 93 "icalsslexer.l"
-{ return EQUALS; }
- YY_BREAK
-case 6:
-YY_RULE_SETUP
-#line 94 "icalsslexer.l"
-{ return EQUALS; }
- YY_BREAK
-case 7:
-YY_RULE_SETUP
-#line 95 "icalsslexer.l"
-{ return NOTEQUALS; }
- YY_BREAK
-case 8:
-YY_RULE_SETUP
-#line 96 "icalsslexer.l"
-{ return LESS; }
- YY_BREAK
-case 9:
-YY_RULE_SETUP
-#line 97 "icalsslexer.l"
-{ return GREATER; }
- YY_BREAK
-case 10:
-YY_RULE_SETUP
-#line 98 "icalsslexer.l"
-{ return LESSEQUALS; }
- YY_BREAK
-case 11:
-YY_RULE_SETUP
-#line 99 "icalsslexer.l"
-{ return GREATEREQUALS; }
- YY_BREAK
-case 12:
-YY_RULE_SETUP
-#line 100 "icalsslexer.l"
-{ return AND; }
- YY_BREAK
-case 13:
-YY_RULE_SETUP
-#line 101 "icalsslexer.l"
-{ return OR; }
- YY_BREAK
-case 14:
-YY_RULE_SETUP
-#line 102 "icalsslexer.l"
-{ return IS; }
- YY_BREAK
-case 15:
-YY_RULE_SETUP
-#line 103 "icalsslexer.l"
-{ return NOT; }
- YY_BREAK
-case 16:
-YY_RULE_SETUP
-#line 104 "icalsslexer.l"
-{ return SQLNULL; }
- YY_BREAK
-case 17:
-YY_RULE_SETUP
-#line 105 "icalsslexer.l"
-{ return QUOTE; }
- YY_BREAK
-case 18:
-YY_RULE_SETUP
-#line 106 "icalsslexer.l"
-;
- YY_BREAK
-case 19:
-YY_RULE_SETUP
-#line 107 "icalsslexer.l"
-{ return EOL; }
- YY_BREAK
-case 20:
-YY_RULE_SETUP
-#line 109 "icalsslexer.l"
-{
- int c = input();
- unput(c);
- if(c!='\''){
- sslval.v_string= icalmemory_tmp_copy(yytext);
- return STRING;
- } else {
- /*ssmore();*/
- }
-}
- YY_BREAK
-case 21:
-YY_RULE_SETUP
-#line 120 "icalsslexer.l"
-{
- sslval.v_string= icalmemory_tmp_copy(yytext);
- return STRING;
-}
- YY_BREAK
-case 22:
-YY_RULE_SETUP
-#line 126 "icalsslexer.l"
-{ return yytext[0]; }
- YY_BREAK
-case 23:
-YY_RULE_SETUP
-#line 128 "icalsslexer.l"
-ECHO;
- YY_BREAK
-#line 856 "icalsslexer.c"
-case YY_STATE_EOF(INITIAL):
-case YY_STATE_EOF(sql):
-case YY_STATE_EOF(string_value):
- yyterminate();
-
- case YY_END_OF_BUFFER:
- {
- /* Amount of text matched not including the EOB char. */
- int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
-
- /* Undo the effects of YY_DO_BEFORE_ACTION. */
- *yy_cp = yy_hold_char;
- YY_RESTORE_YY_MORE_OFFSET
-
- if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
- {
- /* We're scanning a new file or input source. It's
- * possible that this happened because the user
- * just pointed yyin at a new source and called
- * yylex(). If so, then we have to assure
- * consistency between yy_current_buffer and our
- * globals. Here is the right place to do so, because
- * this is the first action (other than possibly a
- * back-up) that will match for the new input source.
- */
- yy_n_chars = yy_current_buffer->yy_n_chars;
- yy_current_buffer->yy_input_file = yyin;
- yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
- }
-
- /* Note that here we test for yy_c_buf_p "<=" to the position
- * of the first EOB in the buffer, since yy_c_buf_p will
- * already have been incremented past the NUL character
- * (since all states make transitions on EOB to the
- * end-of-buffer state). Contrast this with the test
- * in input().
- */
- if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
- { /* This was really a NUL. */
- yy_state_type yy_next_state;
-
- yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
-
- yy_current_state = yy_get_previous_state();
-
- /* Okay, we're now positioned to make the NUL
- * transition. We couldn't have
- * yy_get_previous_state() go ahead and do it
- * for us because it doesn't know how to deal
- * with the possibility of jamming (and we don't
- * want to build jamming into it because then it
- * will run more slowly).
- */
-
- yy_next_state = yy_try_NUL_trans( yy_current_state );
-
- yy_bp = yytext_ptr + YY_MORE_ADJ;
-
- if ( yy_next_state )
- {
- /* Consume the NUL. */
- yy_cp = ++yy_c_buf_p;
- yy_current_state = yy_next_state;
- goto yy_match;
- }
-
- else
- {
- yy_cp = yy_c_buf_p;
- goto yy_find_action;
- }
- }
-
- else switch ( yy_get_next_buffer() )
- {
- case EOB_ACT_END_OF_FILE:
- {
- yy_did_buffer_switch_on_eof = 0;
-
- if ( yywrap() )
- {
- /* Note: because we've taken care in
- * yy_get_next_buffer() to have set up
- * yytext, we can now set up
- * yy_c_buf_p so that if some total
- * hoser (like flex itself) wants to
- * call the scanner after we return the
- * YY_NULL, it'll still work - another
- * YY_NULL will get returned.
- */
- yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
-
- yy_act = YY_STATE_EOF(YY_START);
- goto do_action;
- }
-
- else
- {
- if ( ! yy_did_buffer_switch_on_eof )
- YY_NEW_FILE;
- }
- break;
- }
-
- case EOB_ACT_CONTINUE_SCAN:
- yy_c_buf_p =
- yytext_ptr + yy_amount_of_matched_text;
-
- yy_current_state = yy_get_previous_state();
-
- yy_cp = yy_c_buf_p;
- yy_bp = yytext_ptr + YY_MORE_ADJ;
- goto yy_match;
-
- case EOB_ACT_LAST_MATCH:
- yy_c_buf_p =
- &yy_current_buffer->yy_ch_buf[yy_n_chars];
-
- yy_current_state = yy_get_previous_state();
-
- yy_cp = yy_c_buf_p;
- yy_bp = yytext_ptr + YY_MORE_ADJ;
- goto yy_find_action;
- }
- break;
- }
-
- default:
- YY_FATAL_ERROR(
- "fatal flex scanner internal error--no action found" );
- } /* end of action switch */
- } /* end of scanning one token */
- } /* end of yylex */
-
-
-/* yy_get_next_buffer - try to read in a new buffer
- *
- * Returns a code representing an action:
- * EOB_ACT_LAST_MATCH -
- * EOB_ACT_CONTINUE_SCAN - continue scanning from current position
- * EOB_ACT_END_OF_FILE - end of file
- */
-
-static int yy_get_next_buffer()
- {
- register char *dest = yy_current_buffer->yy_ch_buf;
- register char *source = yytext_ptr;
- register int number_to_move, i;
- int ret_val;
-
- if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
- YY_FATAL_ERROR(
- "fatal flex scanner internal error--end of buffer missed" );
-
- if ( yy_current_buffer->yy_fill_buffer == 0 )
- { /* Don't try to fill the buffer, so this is an EOF. */
- if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
- {
- /* We matched a single character, the EOB, so
- * treat this as a final EOF.
- */
- return EOB_ACT_END_OF_FILE;
- }
-
- else
- {
- /* We matched some text prior to the EOB, first
- * process it.
- */
- return EOB_ACT_LAST_MATCH;
- }
- }
-
- /* Try to read more data. */
-
- /* First move last chars to start of buffer. */
- number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
-
- for ( i = 0; i < number_to_move; ++i )
- *(dest++) = *(source++);
-
- if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
- /* don't do the read, it's not guaranteed to return an EOF,
- * just force an EOF
- */
- yy_current_buffer->yy_n_chars = yy_n_chars = 0;
-
- else
- {
- int num_to_read =
- yy_current_buffer->yy_buf_size - number_to_move - 1;
-
- while ( num_to_read <= 0 )
- { /* Not enough room in the buffer - grow it. */
-#ifdef YY_USES_REJECT
- YY_FATAL_ERROR(
-"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
-#else
-
- /* just a shorter name for the current buffer */
- YY_BUFFER_STATE b = yy_current_buffer;
-
- int yy_c_buf_p_offset =
- (int) (yy_c_buf_p - b->yy_ch_buf);
-
- if ( b->yy_is_our_buffer )
- {
- int new_size = b->yy_buf_size * 2;
-
- if ( new_size <= 0 )
- b->yy_buf_size += b->yy_buf_size / 8;
- else
- b->yy_buf_size *= 2;
-
- b->yy_ch_buf = (char *)
- /* Include room in for 2 EOB chars. */
- yy_flex_realloc( (void *) b->yy_ch_buf,
- b->yy_buf_size + 2 );
- }
- else
- /* Can't grow it, we don't own it. */
- b->yy_ch_buf = 0;
-
- if ( ! b->yy_ch_buf )
- YY_FATAL_ERROR(
- "fatal error - scanner input buffer overflow" );
-
- yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
-
- num_to_read = yy_current_buffer->yy_buf_size -
- number_to_move - 1;
-#endif
- }
-
- if ( num_to_read > YY_READ_BUF_SIZE )
- num_to_read = YY_READ_BUF_SIZE;
-
- /* Read in more data. */
- YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
- yy_n_chars, num_to_read );
-
- yy_current_buffer->yy_n_chars = yy_n_chars;
- }
-
- if ( yy_n_chars == 0 )
- {
- if ( number_to_move == YY_MORE_ADJ )
- {
- ret_val = EOB_ACT_END_OF_FILE;
- yyrestart( yyin );
- }
-
- else
- {
- ret_val = EOB_ACT_LAST_MATCH;
- yy_current_buffer->yy_buffer_status =
- YY_BUFFER_EOF_PENDING;
- }
- }
-
- else
- ret_val = EOB_ACT_CONTINUE_SCAN;
-
- yy_n_chars += number_to_move;
- yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
- yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
-
- yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
-
- return ret_val;
- }
-
-
-/* yy_get_previous_state - get the state just before the EOB char was reached */
-
-static yy_state_type yy_get_previous_state()
- {
- register yy_state_type yy_current_state;
- register char *yy_cp;
-
- yy_current_state = yy_start;
-
- for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
- {
- register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
- if ( yy_accept[yy_current_state] )
- {
- yy_last_accepting_state = yy_current_state;
- yy_last_accepting_cpos = yy_cp;
- }
- while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
- {
- yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 56 )
- yy_c = yy_meta[(unsigned int) yy_c];
- }
- yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- }
-
- return yy_current_state;
- }
-
-
-/* yy_try_NUL_trans - try to make a transition on the NUL character
- *
- * synopsis
- * next_state = yy_try_NUL_trans( current_state );
- */
-
-#ifdef YY_USE_PROTOS
-static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
-#else
-static yy_state_type yy_try_NUL_trans( yy_current_state )
-yy_state_type yy_current_state;
-#endif
- {
- register int yy_is_jam;
- register char *yy_cp = yy_c_buf_p;
-
- register YY_CHAR yy_c = 1;
- if ( yy_accept[yy_current_state] )
- {
- yy_last_accepting_state = yy_current_state;
- yy_last_accepting_cpos = yy_cp;
- }
- while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
- {
- yy_current_state = (int) yy_def[yy_current_state];
- if ( yy_current_state >= 56 )
- yy_c = yy_meta[(unsigned int) yy_c];
- }
- yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
- yy_is_jam = (yy_current_state == 55);
-
- return yy_is_jam ? 0 : yy_current_state;
- }
-
-
-#ifndef YY_NO_UNPUT
-#ifdef YY_USE_PROTOS
-static void yyunput( int c, register char *yy_bp )
-#else
-static void yyunput( c, yy_bp )
-int c;
-register char *yy_bp;
-#endif
- {
- register char *yy_cp = yy_c_buf_p;
-
- /* undo effects of setting up yytext */
- *yy_cp = yy_hold_char;
-
- if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
- { /* need to shift things up to make room */
- /* +2 for EOB chars. */
- register int number_to_move = yy_n_chars + 2;
- register char *dest = &yy_current_buffer->yy_ch_buf[
- yy_current_buffer->yy_buf_size + 2];
- register char *source =
- &yy_current_buffer->yy_ch_buf[number_to_move];
-
- while ( source > yy_current_buffer->yy_ch_buf )
- *--dest = *--source;
-
- yy_cp += (int) (dest - source);
- yy_bp += (int) (dest - source);
- yy_current_buffer->yy_n_chars =
- yy_n_chars = yy_current_buffer->yy_buf_size;
-
- if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
- YY_FATAL_ERROR( "flex scanner push-back overflow" );
- }
-
- *--yy_cp = (char) c;
-
-
- yytext_ptr = yy_bp;
- yy_hold_char = *yy_cp;
- yy_c_buf_p = yy_cp;
- }
-#endif /* ifndef YY_NO_UNPUT */
-
-
-#ifndef YY_NO_INPUT
-#ifdef __cplusplus
-static int yyinput()
-#else
-static int input()
-#endif
- {
- int c;
-
- *yy_c_buf_p = yy_hold_char;
-
- if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
- {
- /* yy_c_buf_p now points to the character we want to return.
- * If this occurs *before* the EOB characters, then it's a
- * valid NUL; if not, then we've hit the end of the buffer.
- */
- if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
- /* This was really a NUL. */
- *yy_c_buf_p = '\0';
-
- else
- { /* need more input */
- int offset = yy_c_buf_p - yytext_ptr;
- ++yy_c_buf_p;
-
- switch ( yy_get_next_buffer() )
- {
- case EOB_ACT_LAST_MATCH:
- /* This happens because yy_g_n_b()
- * sees that we've accumulated a
- * token and flags that we need to
- * try matching the token before
- * proceeding. But for input(),
- * there's no matching to consider.
- * So convert the EOB_ACT_LAST_MATCH
- * to EOB_ACT_END_OF_FILE.
- */
-
- /* Reset buffer status. */
- yyrestart( yyin );
-
- /* fall through */
-
- case EOB_ACT_END_OF_FILE:
- {
- if ( yywrap() )
- return EOF;
-
- if ( ! yy_did_buffer_switch_on_eof )
- YY_NEW_FILE;
-#ifdef __cplusplus
- return yyinput();
-#else
- return input();
-#endif
- }
-
- case EOB_ACT_CONTINUE_SCAN:
- yy_c_buf_p = yytext_ptr + offset;
- break;
- }
- }
- }
-
- c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
- *yy_c_buf_p = '\0'; /* preserve yytext */
- yy_hold_char = *++yy_c_buf_p;
-
-
- return c;
- }
-#endif /* YY_NO_INPUT */
-
-#ifdef YY_USE_PROTOS
-void yyrestart( FILE *input_file )
-#else
-void yyrestart( input_file )
-FILE *input_file;
-#endif
- {
- if ( ! yy_current_buffer )
- yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
-
- yy_init_buffer( yy_current_buffer, input_file );
- yy_load_buffer_state();
- }
-
-
-#ifdef YY_USE_PROTOS
-void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
-#else
-void yy_switch_to_buffer( new_buffer )
-YY_BUFFER_STATE new_buffer;
-#endif
- {
- if ( yy_current_buffer == new_buffer )
- return;
-
- if ( yy_current_buffer )
- {
- /* Flush out information for old buffer. */
- *yy_c_buf_p = yy_hold_char;
- yy_current_buffer->yy_buf_pos = yy_c_buf_p;
- yy_current_buffer->yy_n_chars = yy_n_chars;
- }
-
- yy_current_buffer = new_buffer;
- yy_load_buffer_state();
-
- /* We don't actually know whether we did this switch during
- * EOF (yywrap()) processing, but the only time this flag
- * is looked at is after yywrap() is called, so it's safe
- * to go ahead and always set it.
- */
- yy_did_buffer_switch_on_eof = 1;
- }
-
-
-#ifdef YY_USE_PROTOS
-void yy_load_buffer_state( void )
-#else
-void yy_load_buffer_state()
-#endif
- {
- yy_n_chars = yy_current_buffer->yy_n_chars;
- yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
- yyin = yy_current_buffer->yy_input_file;
- yy_hold_char = *yy_c_buf_p;
- }
-
-
-#ifdef YY_USE_PROTOS
-YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
-#else
-YY_BUFFER_STATE yy_create_buffer( file, size )
-FILE *file;
-int size;
-#endif
- {
- YY_BUFFER_STATE b;
-
- b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
- if ( ! b )
- YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
-
- b->yy_buf_size = size;
-
- /* yy_ch_buf has to be 2 characters longer than the size given because
- * we need to put in 2 end-of-buffer characters.
- */
- b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
- if ( ! b->yy_ch_buf )
- YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
-
- b->yy_is_our_buffer = 1;
-
- yy_init_buffer( b, file );
-
- return b;
- }
-
-
-#ifdef YY_USE_PROTOS
-void yy_delete_buffer( YY_BUFFER_STATE b )
-#else
-void yy_delete_buffer( b )
-YY_BUFFER_STATE b;
-#endif
- {
- if ( ! b )
- return;
-
- if ( b == yy_current_buffer )
- yy_current_buffer = (YY_BUFFER_STATE) 0;
-
- if ( b->yy_is_our_buffer )
- yy_flex_free( (void *) b->yy_ch_buf );
-
- yy_flex_free( (void *) b );
- }
-
-
-
-#ifdef YY_USE_PROTOS
-void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
-#else
-void yy_init_buffer( b, file )
-YY_BUFFER_STATE b;
-FILE *file;
-#endif
-
-
- {
- yy_flush_buffer( b );
-
- b->yy_input_file = file;
- b->yy_fill_buffer = 1;
-
-#if YY_ALWAYS_INTERACTIVE
- b->yy_is_interactive = 1;
-#else
-#if YY_NEVER_INTERACTIVE
- b->yy_is_interactive = 0;
-#else
- b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
-#endif
-#endif
- }
-
-
-#ifdef YY_USE_PROTOS
-void yy_flush_buffer( YY_BUFFER_STATE b )
-#else
-void yy_flush_buffer( b )
-YY_BUFFER_STATE b;
-#endif
-
- {
- if ( ! b )
- return;
-
- b->yy_n_chars = 0;
-
- /* We always need two end-of-buffer characters. The first causes
- * a transition to the end-of-buffer state. The second causes
- * a jam in that state.
- */
- b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
- b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
-
- b->yy_buf_pos = &b->yy_ch_buf[0];
-
- b->yy_at_bol = 1;
- b->yy_buffer_status = YY_BUFFER_NEW;
-
- if ( b == yy_current_buffer )
- yy_load_buffer_state();
- }
-
-
-#ifndef YY_NO_SCAN_BUFFER
-#ifdef YY_USE_PROTOS
-YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
-#else
-YY_BUFFER_STATE yy_scan_buffer( base, size )
-char *base;
-yy_size_t size;
-#endif
- {
- YY_BUFFER_STATE b;
-
- if ( size < 2 ||
- base[size-2] != YY_END_OF_BUFFER_CHAR ||
- base[size-1] != YY_END_OF_BUFFER_CHAR )
- /* They forgot to leave room for the EOB's. */
- return 0;
-
- b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
- if ( ! b )
- YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
-
- b->yy_buf_size = size - 2; /* "- 2" to take care of EOB's */
- b->yy_buf_pos = b->yy_ch_buf = base;
- b->yy_is_our_buffer = 0;
- b->yy_input_file = 0;
- b->yy_n_chars = b->yy_buf_size;
- b->yy_is_interactive = 0;
- b->yy_at_bol = 1;
- b->yy_fill_buffer = 0;
- b->yy_buffer_status = YY_BUFFER_NEW;
-
- yy_switch_to_buffer( b );
-
- return b;
- }
-#endif
-
-
-#ifndef YY_NO_SCAN_STRING
-#ifdef YY_USE_PROTOS
-YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
-#else
-YY_BUFFER_STATE yy_scan_string( yy_str )
-yyconst char *yy_str;
-#endif
- {
- int len;
- for ( len = 0; yy_str[len]; ++len )
- ;
-
- return yy_scan_bytes( yy_str, len );
- }
-#endif
-
-
-#ifndef YY_NO_SCAN_BYTES
-#ifdef YY_USE_PROTOS
-YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
-#else
-YY_BUFFER_STATE yy_scan_bytes( bytes, len )
-yyconst char *bytes;
-int len;
-#endif
- {
- YY_BUFFER_STATE b;
- char *buf;
- yy_size_t n;
- int i;
-
- /* Get memory for full buffer, including space for trailing EOB's. */
- n = len + 2;
- buf = (char *) yy_flex_alloc( n );
- if ( ! buf )
- YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
-
- for ( i = 0; i < len; ++i )
- buf[i] = bytes[i];
-
- buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
-
- b = yy_scan_buffer( buf, n );
- if ( ! b )
- YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
-
- /* It's okay to grow etc. this buffer, and we should throw it
- * away when we're done.
- */
- b->yy_is_our_buffer = 1;
-
- return b;
- }
-#endif
-
-
-#ifndef YY_NO_PUSH_STATE
-#ifdef YY_USE_PROTOS
-static void yy_push_state( int new_state )
-#else
-static void yy_push_state( new_state )
-int new_state;
-#endif
- {
- if ( yy_start_stack_ptr >= yy_start_stack_depth )
- {
- yy_size_t new_size;
-
- yy_start_stack_depth += YY_START_STACK_INCR;
- new_size = yy_start_stack_depth * sizeof( int );
-
- if ( ! yy_start_stack )
- yy_start_stack = (int *) yy_flex_alloc( new_size );
-
- else
- yy_start_stack = (int *) yy_flex_realloc(
- (void *) yy_start_stack, new_size );
-
- if ( ! yy_start_stack )
- YY_FATAL_ERROR(
- "out of memory expanding start-condition stack" );
- }
-
- yy_start_stack[yy_start_stack_ptr++] = YY_START;
-
- BEGIN(new_state);
- }
-#endif
-
-
-#ifndef YY_NO_POP_STATE
-static void yy_pop_state()
- {
- if ( --yy_start_stack_ptr < 0 )
- YY_FATAL_ERROR( "start-condition stack underflow" );
-
- BEGIN(yy_start_stack[yy_start_stack_ptr]);
- }
-#endif
-
-
-#ifndef YY_NO_TOP_STATE
-static int yy_top_state()
- {
- return yy_start_stack[yy_start_stack_ptr - 1];
- }
-#endif
-
-#ifndef YY_EXIT_FAILURE
-#define YY_EXIT_FAILURE 2
-#endif
-
-#ifdef YY_USE_PROTOS
-static void yy_fatal_error( yyconst char msg[] )
-#else
-static void yy_fatal_error( msg )
-char msg[];
-#endif
- {
- (void) fprintf( stderr, "%s\n", msg );
- exit( YY_EXIT_FAILURE );
- }
-
-
-
-/* Redefine yyless() so it works in section 3 code. */
-
-#undef yyless
-#define yyless(n) \
- do \
- { \
- /* Undo effects of setting up yytext. */ \
- yytext[yyleng] = yy_hold_char; \
- yy_c_buf_p = yytext + n; \
- yy_hold_char = *yy_c_buf_p; \
- *yy_c_buf_p = '\0'; \
- yyleng = n; \
- } \
- while ( 0 )
-
-
-/* Internal utility routines. */
-
-#ifndef yytext_ptr
-#ifdef YY_USE_PROTOS
-static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
-#else
-static void yy_flex_strncpy( s1, s2, n )
-char *s1;
-yyconst char *s2;
-int n;
-#endif
- {
- register int i;
- for ( i = 0; i < n; ++i )
- s1[i] = s2[i];
- }
-#endif
-
-#ifdef YY_NEED_STRLEN
-#ifdef YY_USE_PROTOS
-static int yy_flex_strlen( yyconst char *s )
-#else
-static int yy_flex_strlen( s )
-yyconst char *s;
-#endif
- {
- register int n;
- for ( n = 0; s[n]; ++n )
- ;
-
- return n;
- }
-#endif
-
-
-#ifdef YY_USE_PROTOS
-static void *yy_flex_alloc( yy_size_t size )
-#else
-static void *yy_flex_alloc( size )
-yy_size_t size;
-#endif
- {
- return (void *) malloc( size );
- }
-
-#ifdef YY_USE_PROTOS
-static void *yy_flex_realloc( void *ptr, yy_size_t size )
-#else
-static void *yy_flex_realloc( ptr, size )
-void *ptr;
-yy_size_t size;
-#endif
- {
- /* The cast to (char *) in the following accommodates both
- * implementations that use char* generic pointers, and those
- * that use void* generic pointers. It works with the latter
- * because both ANSI C and C++ allow castless assignment from
- * any pointer type to void*, and deal with argument conversions
- * as though doing an assignment.
- */
- return (void *) realloc( (char *) ptr, size );
- }
-
-#ifdef YY_USE_PROTOS
-static void yy_flex_free( void *ptr )
-#else
-static void yy_flex_free( ptr )
-void *ptr;
-#endif
- {
- free( ptr );
- }
-
-#if YY_MAIN
-int main()
- {
- yylex();
- return 0;
- }
-#endif
-#line 128 "icalsslexer.l"
-
-
-int yywrap()
-{
- return 1;
-}
-
diff --git a/libical/src/libicalss/icalssyacc.c b/libical/src/libicalss/icalssyacc.c
deleted file mode 100644
index c2dcc47a24..0000000000
--- a/libical/src/libicalss/icalssyacc.c
+++ /dev/null
@@ -1,1397 +0,0 @@
-/* A Bison parser, made from /home/hpj/work/cvs/cvs.gnome.org/evolution-trunk/libical/src/libicalss/icalssyacc.y
- by GNU bison 1.35. */
-
-#define YYBISON 1 /* Identify Bison output. */
-
-#define yyparse ssparse
-#define yylex sslex
-#define yyerror sserror
-#define yylval sslval
-#define yychar sschar
-#define yydebug ssdebug
-#define yynerrs ssnerrs
-# define STRING 257
-# define SELECT 258
-# define FROM 259
-# define WHERE 260
-# define COMMA 261
-# define QUOTE 262
-# define EQUALS 263
-# define NOTEQUALS 264
-# define LESS 265
-# define GREATER 266
-# define LESSEQUALS 267
-# define GREATEREQUALS 268
-# define AND 269
-# define OR 270
-# define EOL 271
-# define END 272
-# define IS 273
-# define NOT 274
-# define SQLNULL 275
-
-#line 1 "icalssyacc.y"
-
-/* -*- Mode: C -*-
- ======================================================================
- FILE: icalssyacc.y
- CREATOR: eric 08 Aug 2000
-
- DESCRIPTION:
-
- $Id$
- $Locker$
-
-(C) COPYRIGHT 2000, Eric Busboom, http://www.softwarestudio.org
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of either:
-
- The LGPL as published by the Free Software Foundation, version
- 2.1, available at: http://www.fsf.org/copyleft/lesser.html
-
- Or:
-
- The Mozilla Public License Version 1.0. You may obtain a copy of
- the License at http://www.mozilla.org/MPL/
-
- The Original Code is eric. The Initial Developer of the Original
- Code is Eric Busboom
-
- ======================================================================*/
-/*#define YYDEBUG 1*/
-#include <stdlib.h>
-#include <string.h> /* for strdup() */
-#include <limits.h> /* for SHRT_MAX*/
-#include "ical.h"
-#include "icalgauge.h"
-#include "icalgaugeimpl.h"
-
-extern struct icalgauge_impl *icalss_yy_gauge;
-
-#define YYPARSE_PARAM yy_globals
-#define YYLEX_PARAM yy_globals
-#define YY_EXTRA_TYPE icalgauge_impl*
-
-
-static void ssyacc_add_where(struct icalgauge_impl* impl, char* prop,
- icalgaugecompare compare , char* value);
-static void ssyacc_add_select(struct icalgauge_impl* impl, char* str1);
-static void ssyacc_add_from(struct icalgauge_impl* impl, char* str1);
-static void set_logic(struct icalgauge_impl* impl,icalgaugelogic l);
-void sserror(char *s); /* Don't know why I need this.... */
-
-
-#line 53 "icalssyacc.y"
-#ifndef YYSTYPE
-typedef union {
- char* v_string;
-} yystype;
-# define YYSTYPE yystype
-# define YYSTYPE_IS_TRIVIAL 1
-#endif
-#ifndef YYDEBUG
-# define YYDEBUG 0
-#endif
-
-
-
-#define YYFINAL 38
-#define YYFLAG -32768
-#define YYNTBASE 22
-
-/* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
-#define YYTRANSLATE(x) ((unsigned)(x) <= 275 ? yytranslate[x] : 27)
-
-/* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */
-static const char yytranslate[] =
-{
- 0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 1, 3, 4, 5,
- 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 16, 17, 18, 19, 20, 21
-};
-
-#if YYDEBUG
-static const short yyprhs[] =
-{
- 0, 0, 7, 12, 14, 16, 20, 22, 26, 27,
- 31, 35, 40, 44, 48, 52, 56, 60, 62, 66
-};
-static const short yyrhs[] =
-{
- 4, 23, 5, 24, 6, 26, 0, 4, 23, 5,
- 24, 0, 1, 0, 3, 0, 23, 7, 3, 0,
- 3, 0, 24, 7, 3, 0, 0, 3, 9, 3,
- 0, 3, 19, 21, 0, 3, 19, 20, 21, 0,
- 3, 10, 3, 0, 3, 11, 3, 0, 3, 12,
- 3, 0, 3, 13, 3, 0, 3, 14, 3, 0,
- 25, 0, 26, 15, 25, 0, 26, 16, 25, 0
-};
-
-#endif
-
-#if YYDEBUG
-/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
-static const short yyrline[] =
-{
- 0, 64, 65, 66, 72, 74, 78, 80, 83, 85,
- 86, 87, 88, 89, 90, 91, 92, 95, 97, 98
-};
-#endif
-
-
-#if (YYDEBUG) || defined YYERROR_VERBOSE
-
-/* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */
-static const char *const yytname[] =
-{
- "$", "error", "$undefined.", "STRING", "SELECT", "FROM", "WHERE", "COMMA",
- "QUOTE", "EQUALS", "NOTEQUALS", "LESS", "GREATER", "LESSEQUALS",
- "GREATEREQUALS", "AND", "OR", "EOL", "END", "IS", "NOT", "SQLNULL",
- "query_min", "select_list", "from_list", "where_clause", "where_list", 0
-};
-#endif
-
-/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
-static const short yyr1[] =
-{
- 0, 22, 22, 22, 23, 23, 24, 24, 25, 25,
- 25, 25, 25, 25, 25, 25, 25, 26, 26, 26
-};
-
-/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
-static const short yyr2[] =
-{
- 0, 6, 4, 1, 1, 3, 1, 3, 0, 3,
- 3, 4, 3, 3, 3, 3, 3, 1, 3, 3
-};
-
-/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
- doesn't specify something else to do. Zero means the default is an
- error. */
-static const short yydefact[] =
-{
- 0, 3, 0, 4, 0, 0, 0, 6, 2, 5,
- 8, 0, 0, 17, 1, 7, 0, 0, 0, 0,
- 0, 0, 0, 8, 8, 9, 12, 13, 14, 15,
- 16, 0, 10, 18, 19, 11, 0, 0, 0
-};
-
-static const short yydefgoto[] =
-{
- 36, 4, 8, 13, 14
-};
-
-static const short yypact[] =
-{
- 5,-32768, 9,-32768, 6, 17, 18,-32768, 1,-32768,
- 19, 20, -9,-32768, -1,-32768, 21, 22, 23, 24,
- 25, 26, -4, 19, 19,-32768,-32768,-32768,-32768,-32768,
- -32768, 10,-32768,-32768,-32768,-32768, 30, 32,-32768
-};
-
-static const short yypgoto[] =
-{
- -32768,-32768,-32768, -5,-32768
-};
-
-
-#define YYLAST 32
-
-
-static const short yytable[] =
-{
- 16, 17, 18, 19, 20, 21, 1, 10, 11, 2,
- 22, 5, 3, 6, 23, 24, 31, 32, 33, 34,
- 7, 9, 12, 15, 25, 26, 27, 28, 29, 30,
- 37, 35, 38
-};
-
-static const short yycheck[] =
-{
- 9, 10, 11, 12, 13, 14, 1, 6, 7, 4,
- 19, 5, 3, 7, 15, 16, 20, 21, 23, 24,
- 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 0, 21, 0
-};
-/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
-#line 3 "/usr/share/bison/bison.simple"
-
-/* Skeleton output parser for bison,
-
- Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 Free Software
- Foundation, Inc.
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA. */
-
-/* As a special exception, when this file is copied by Bison into a
- Bison output file, you may use that output file without restriction.
- This special exception was added by the Free Software Foundation
- in version 1.24 of Bison. */
-
-/* This is the parser code that is written into each bison parser when
- the %semantic_parser declaration is not specified in the grammar.
- It was written by Richard Stallman by simplifying the hairy parser
- used when %semantic_parser is specified. */
-
-/* All symbols defined below should begin with yy or YY, to avoid
- infringing on user name space. This should be done even for local
- variables, as they might otherwise be expanded by user macros.
- There are some unavoidable exceptions within include files to
- define necessary library symbols; they are noted "INFRINGES ON
- USER NAME SPACE" below. */
-
-#if ! defined (yyoverflow) || defined (YYERROR_VERBOSE)
-
-/* The parser invokes alloca or malloc; define the necessary symbols. */
-
-# if YYSTACK_USE_ALLOCA
-# define YYSTACK_ALLOC alloca
-# else
-# ifndef YYSTACK_USE_ALLOCA
-# if defined (alloca) || defined (_ALLOCA_H)
-# define YYSTACK_ALLOC alloca
-# else
-# ifdef __GNUC__
-# define YYSTACK_ALLOC __builtin_alloca
-# endif
-# endif
-# endif
-# endif
-
-# ifdef YYSTACK_ALLOC
- /* Pacify GCC's `empty if-body' warning. */
-# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
-# else
-# if defined (__STDC__) || defined (__cplusplus)
-# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-# define YYSIZE_T size_t
-# endif
-# define YYSTACK_ALLOC malloc
-# define YYSTACK_FREE free
-# endif
-#endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */
-
-
-#if (! defined (yyoverflow) \
- && (! defined (__cplusplus) \
- || (YYLTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
-
-/* A type that is properly aligned for any stack member. */
-union yyalloc
-{
- short yyss;
- YYSTYPE yyvs;
-# if YYLSP_NEEDED
- YYLTYPE yyls;
-# endif
-};
-
-/* The size of the maximum gap between one aligned stack and the next. */
-# define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
-
-/* The size of an array large to enough to hold all stacks, each with
- N elements. */
-# if YYLSP_NEEDED
-# define YYSTACK_BYTES(N) \
- ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
- + 2 * YYSTACK_GAP_MAX)
-# else
-# define YYSTACK_BYTES(N) \
- ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
- + YYSTACK_GAP_MAX)
-# endif
-
-/* Copy COUNT objects from FROM to TO. The source and destination do
- not overlap. */
-# ifndef YYCOPY
-# if 1 < __GNUC__
-# define YYCOPY(To, From, Count) \
- __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
-# else
-# define YYCOPY(To, From, Count) \
- do \
- { \
- register YYSIZE_T yyi; \
- for (yyi = 0; yyi < (Count); yyi++) \
- (To)[yyi] = (From)[yyi]; \
- } \
- while (0)
-# endif
-# endif
-
-/* Relocate STACK from its old location to the new one. The
- local variables YYSIZE and YYSTACKSIZE give the old and new number of
- elements in the stack, and YYPTR gives the new location of the
- stack. Advance YYPTR to a properly aligned location for the next
- stack. */
-# define YYSTACK_RELOCATE(Stack) \
- do \
- { \
- YYSIZE_T yynewbytes; \
- YYCOPY (&yyptr->Stack, Stack, yysize); \
- Stack = &yyptr->Stack; \
- yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAX; \
- yyptr += yynewbytes / sizeof (*yyptr); \
- } \
- while (0)
-
-#endif
-
-
-#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
-# define YYSIZE_T __SIZE_TYPE__
-#endif
-#if ! defined (YYSIZE_T) && defined (size_t)
-# define YYSIZE_T size_t
-#endif
-#if ! defined (YYSIZE_T)
-# if defined (__STDC__) || defined (__cplusplus)
-# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
-# define YYSIZE_T size_t
-# endif
-#endif
-#if ! defined (YYSIZE_T)
-# define YYSIZE_T unsigned int
-#endif
-
-#define yyerrok (yyerrstatus = 0)
-#define yyclearin (yychar = YYEMPTY)
-#define YYEMPTY -2
-#define YYEOF 0
-#define YYACCEPT goto yyacceptlab
-#define YYABORT goto yyabortlab
-#define YYERROR goto yyerrlab1
-/* Like YYERROR except do call yyerror. This remains here temporarily
- to ease the transition to the new meaning of YYERROR, for GCC.
- Once GCC version 2 has supplanted version 1, this can go. */
-#define YYFAIL goto yyerrlab
-#define YYRECOVERING() (!!yyerrstatus)
-#define YYBACKUP(Token, Value) \
-do \
- if (yychar == YYEMPTY && yylen == 1) \
- { \
- yychar = (Token); \
- yylval = (Value); \
- yychar1 = YYTRANSLATE (yychar); \
- YYPOPSTACK; \
- goto yybackup; \
- } \
- else \
- { \
- yyerror ("syntax error: cannot back up"); \
- YYERROR; \
- } \
-while (0)
-
-#define YYTERROR 1
-#define YYERRCODE 256
-
-
-/* YYLLOC_DEFAULT -- Compute the default location (before the actions
- are run).
-
- When YYLLOC_DEFAULT is run, CURRENT is set the location of the
- first token. By default, to implement support for ranges, extend
- its range to the last symbol. */
-
-#ifndef YYLLOC_DEFAULT
-# define YYLLOC_DEFAULT(Current, Rhs, N) \
- Current.last_line = Rhs[N].last_line; \
- Current.last_column = Rhs[N].last_column;
-#endif
-
-
-/* YYLEX -- calling `yylex' with the right arguments. */
-
-#if YYPURE
-# if YYLSP_NEEDED
-# ifdef YYLEX_PARAM
-# define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
-# else
-# define YYLEX yylex (&yylval, &yylloc)
-# endif
-# else /* !YYLSP_NEEDED */
-# ifdef YYLEX_PARAM
-# define YYLEX yylex (&yylval, YYLEX_PARAM)
-# else
-# define YYLEX yylex (&yylval)
-# endif
-# endif /* !YYLSP_NEEDED */
-#else /* !YYPURE */
-# define YYLEX yylex ()
-#endif /* !YYPURE */
-
-
-/* Enable debugging if requested. */
-#if YYDEBUG
-
-# ifndef YYFPRINTF
-# include <stdio.h> /* INFRINGES ON USER NAME SPACE */
-# define YYFPRINTF fprintf
-# endif
-
-# define YYDPRINTF(Args) \
-do { \
- if (yydebug) \
- YYFPRINTF Args; \
-} while (0)
-/* Nonzero means print parse trace. It is left uninitialized so that
- multiple parsers can coexist. */
-int yydebug;
-#else /* !YYDEBUG */
-# define YYDPRINTF(Args)
-#endif /* !YYDEBUG */
-
-/* YYINITDEPTH -- initial size of the parser's stacks. */
-#ifndef YYINITDEPTH
-# define YYINITDEPTH 200
-#endif
-
-/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
- if the built-in stack extension method is used).
-
- Do not make this value too large; the results are undefined if
- SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
- evaluated with infinite-precision integer arithmetic. */
-
-#if YYMAXDEPTH == 0
-# undef YYMAXDEPTH
-#endif
-
-#ifndef YYMAXDEPTH
-# define YYMAXDEPTH 10000
-#endif
-
-#ifdef YYERROR_VERBOSE
-
-# ifndef yystrlen
-# if defined (__GLIBC__) && defined (_STRING_H)
-# define yystrlen strlen
-# else
-/* Return the length of YYSTR. */
-static YYSIZE_T
-# if defined (__STDC__) || defined (__cplusplus)
-yystrlen (const char *yystr)
-# else
-yystrlen (yystr)
- const char *yystr;
-# endif
-{
- register const char *yys = yystr;
-
- while (*yys++ != '\0')
- continue;
-
- return yys - yystr - 1;
-}
-# endif
-# endif
-
-# ifndef yystpcpy
-# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
-# define yystpcpy stpcpy
-# else
-/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
- YYDEST. */
-static char *
-# if defined (__STDC__) || defined (__cplusplus)
-yystpcpy (char *yydest, const char *yysrc)
-# else
-yystpcpy (yydest, yysrc)
- char *yydest;
- const char *yysrc;
-# endif
-{
- register char *yyd = yydest;
- register const char *yys = yysrc;
-
- while ((*yyd++ = *yys++) != '\0')
- continue;
-
- return yyd - 1;
-}
-# endif
-# endif
-#endif
-
-#line 315 "/usr/share/bison/bison.simple"
-
-
-/* The user can define YYPARSE_PARAM as the name of an argument to be passed
- into yyparse. The argument should have type void *.
- It should actually point to an object.
- Grammar actions can access the variable by casting it
- to the proper pointer type. */
-
-#ifdef YYPARSE_PARAM
-# if defined (__STDC__) || defined (__cplusplus)
-# define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
-# define YYPARSE_PARAM_DECL
-# else
-# define YYPARSE_PARAM_ARG YYPARSE_PARAM
-# define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
-# endif
-#else /* !YYPARSE_PARAM */
-# define YYPARSE_PARAM_ARG
-# define YYPARSE_PARAM_DECL
-#endif /* !YYPARSE_PARAM */
-
-/* Prevent warning if -Wstrict-prototypes. */
-#ifdef __GNUC__
-# ifdef YYPARSE_PARAM
-int yyparse (void *);
-# else
-int yyparse (void);
-# endif
-#endif
-
-/* YY_DECL_VARIABLES -- depending whether we use a pure parser,
- variables are global, or local to YYPARSE. */
-
-#define YY_DECL_NON_LSP_VARIABLES \
-/* The lookahead symbol. */ \
-int yychar; \
- \
-/* The semantic value of the lookahead symbol. */ \
-YYSTYPE yylval; \
- \
-/* Number of parse errors so far. */ \
-int yynerrs;
-
-#if YYLSP_NEEDED
-# define YY_DECL_VARIABLES \
-YY_DECL_NON_LSP_VARIABLES \
- \
-/* Location data for the lookahead symbol. */ \
-YYLTYPE yylloc;
-#else
-# define YY_DECL_VARIABLES \
-YY_DECL_NON_LSP_VARIABLES
-#endif
-
-
-/* If nonreentrant, generate the variables here. */
-
-#if !YYPURE
-YY_DECL_VARIABLES
-#endif /* !YYPURE */
-
-int
-yyparse (YYPARSE_PARAM_ARG)
- YYPARSE_PARAM_DECL
-{
- /* If reentrant, generate the variables here. */
-#if YYPURE
- YY_DECL_VARIABLES
-#endif /* !YYPURE */
-
- register int yystate;
- register int yyn;
- int yyresult;
- /* Number of tokens to shift before error messages enabled. */
- int yyerrstatus;
- /* Lookahead token as an internal (translated) token number. */
- int yychar1 = 0;
-
- /* Three stacks and their tools:
- `yyss': related to states,
- `yyvs': related to semantic values,
- `yyls': related to locations.
-
- Refer to the stacks thru separate pointers, to allow yyoverflow
- to reallocate them elsewhere. */
-
- /* The state stack. */
- short yyssa[YYINITDEPTH];
- short *yyss = yyssa;
- register short *yyssp;
-
- /* The semantic value stack. */
- YYSTYPE yyvsa[YYINITDEPTH];
- YYSTYPE *yyvs = yyvsa;
- register YYSTYPE *yyvsp;
-
-#if YYLSP_NEEDED
- /* The location stack. */
- YYLTYPE yylsa[YYINITDEPTH];
- YYLTYPE *yyls = yylsa;
- YYLTYPE *yylsp;
-#endif
-
-#if YYLSP_NEEDED
-# define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
-#else
-# define YYPOPSTACK (yyvsp--, yyssp--)
-#endif
-
- YYSIZE_T yystacksize = YYINITDEPTH;
-
-
- /* The variables used to return semantic value and location from the
- action routines. */
- YYSTYPE yyval;
-#if YYLSP_NEEDED
- YYLTYPE yyloc;
-#endif
-
- /* When reducing, the number of symbols on the RHS of the reduced
- rule. */
- int yylen;
-
- YYDPRINTF ((stderr, "Starting parse\n"));
-
- yystate = 0;
- yyerrstatus = 0;
- yynerrs = 0;
- yychar = YYEMPTY; /* Cause a token to be read. */
-
- /* Initialize stack pointers.
- Waste one element of value and location stack
- so that they stay on the same level as the state stack.
- The wasted elements are never initialized. */
-
- yyssp = yyss;
- yyvsp = yyvs;
-#if YYLSP_NEEDED
- yylsp = yyls;
-#endif
- goto yysetstate;
-
-/*------------------------------------------------------------.
-| yynewstate -- Push a new state, which is found in yystate. |
-`------------------------------------------------------------*/
- yynewstate:
- /* In all cases, when you get here, the value and location stacks
- have just been pushed. so pushing a state here evens the stacks.
- */
- yyssp++;
-
- yysetstate:
- *yyssp = yystate;
-
- if (yyssp >= yyss + yystacksize - 1)
- {
- /* Get the current used size of the three stacks, in elements. */
- YYSIZE_T yysize = yyssp - yyss + 1;
-
-#ifdef yyoverflow
- {
- /* Give user a chance to reallocate the stack. Use copies of
- these so that the &'s don't force the real ones into
- memory. */
- YYSTYPE *yyvs1 = yyvs;
- short *yyss1 = yyss;
-
- /* Each stack pointer address is followed by the size of the
- data in use in that stack, in bytes. */
-# if YYLSP_NEEDED
- YYLTYPE *yyls1 = yyls;
- /* This used to be a conditional around just the two extra args,
- but that might be undefined if yyoverflow is a macro. */
- yyoverflow ("parser stack overflow",
- &yyss1, yysize * sizeof (*yyssp),
- &yyvs1, yysize * sizeof (*yyvsp),
- &yyls1, yysize * sizeof (*yylsp),
- &yystacksize);
- yyls = yyls1;
-# else
- yyoverflow ("parser stack overflow",
- &yyss1, yysize * sizeof (*yyssp),
- &yyvs1, yysize * sizeof (*yyvsp),
- &yystacksize);
-# endif
- yyss = yyss1;
- yyvs = yyvs1;
- }
-#else /* no yyoverflow */
-# ifndef YYSTACK_RELOCATE
- goto yyoverflowlab;
-# else
- /* Extend the stack our own way. */
- if (yystacksize >= YYMAXDEPTH)
- goto yyoverflowlab;
- yystacksize *= 2;
- if (yystacksize > YYMAXDEPTH)
- yystacksize = YYMAXDEPTH;
-
- {
- short *yyss1 = yyss;
- union yyalloc *yyptr =
- (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
- if (! yyptr)
- goto yyoverflowlab;
- YYSTACK_RELOCATE (yyss);
- YYSTACK_RELOCATE (yyvs);
-# if YYLSP_NEEDED
- YYSTACK_RELOCATE (yyls);
-# endif
-# undef YYSTACK_RELOCATE
- if (yyss1 != yyssa)
- YYSTACK_FREE (yyss1);
- }
-# endif
-#endif /* no yyoverflow */
-
- yyssp = yyss + yysize - 1;
- yyvsp = yyvs + yysize - 1;
-#if YYLSP_NEEDED
- yylsp = yyls + yysize - 1;
-#endif
-
- YYDPRINTF ((stderr, "Stack size increased to %lu\n",
- (unsigned long int) yystacksize));
-
- if (yyssp >= yyss + yystacksize - 1)
- YYABORT;
- }
-
- YYDPRINTF ((stderr, "Entering state %d\n", yystate));
-
- goto yybackup;
-
-
-/*-----------.
-| yybackup. |
-`-----------*/
-yybackup:
-
-/* Do appropriate processing given the current state. */
-/* Read a lookahead token if we need one and don't already have one. */
-/* yyresume: */
-
- /* First try to decide what to do without reference to lookahead token. */
-
- yyn = yypact[yystate];
- if (yyn == YYFLAG)
- goto yydefault;
-
- /* Not known => get a lookahead token if don't already have one. */
-
- /* yychar is either YYEMPTY or YYEOF
- or a valid token in external form. */
-
- if (yychar == YYEMPTY)
- {
- YYDPRINTF ((stderr, "Reading a token: "));
- yychar = YYLEX;
- }
-
- /* Convert token to internal form (in yychar1) for indexing tables with */
-
- if (yychar <= 0) /* This means end of input. */
- {
- yychar1 = 0;
- yychar = YYEOF; /* Don't call YYLEX any more */
-
- YYDPRINTF ((stderr, "Now at end of input.\n"));
- }
- else
- {
- yychar1 = YYTRANSLATE (yychar);
-
-#if YYDEBUG
- /* We have to keep this `#if YYDEBUG', since we use variables
- which are defined only if `YYDEBUG' is set. */
- if (yydebug)
- {
- YYFPRINTF (stderr, "Next token is %d (%s",
- yychar, yytname[yychar1]);
- /* Give the individual parser a way to print the precise
- meaning of a token, for further debugging info. */
-# ifdef YYPRINT
- YYPRINT (stderr, yychar, yylval);
-# endif
- YYFPRINTF (stderr, ")\n");
- }
-#endif
- }
-
- yyn += yychar1;
- if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
- goto yydefault;
-
- yyn = yytable[yyn];
-
- /* yyn is what to do for this token type in this state.
- Negative => reduce, -yyn is rule number.
- Positive => shift, yyn is new state.
- New state is final state => don't bother to shift,
- just return success.
- 0, or most negative number => error. */
-
- if (yyn < 0)
- {
- if (yyn == YYFLAG)
- goto yyerrlab;
- yyn = -yyn;
- goto yyreduce;
- }
- else if (yyn == 0)
- goto yyerrlab;
-
- if (yyn == YYFINAL)
- YYACCEPT;
-
- /* Shift the lookahead token. */
- YYDPRINTF ((stderr, "Shifting token %d (%s), ",
- yychar, yytname[yychar1]));
-
- /* Discard the token being shifted unless it is eof. */
- if (yychar != YYEOF)
- yychar = YYEMPTY;
-
- *++yyvsp = yylval;
-#if YYLSP_NEEDED
- *++yylsp = yylloc;
-#endif
-
- /* Count tokens shifted since error; after three, turn off error
- status. */
- if (yyerrstatus)
- yyerrstatus--;
-
- yystate = yyn;
- goto yynewstate;
-
-
-/*-----------------------------------------------------------.
-| yydefault -- do the default action for the current state. |
-`-----------------------------------------------------------*/
-yydefault:
- yyn = yydefact[yystate];
- if (yyn == 0)
- goto yyerrlab;
- goto yyreduce;
-
-
-/*-----------------------------.
-| yyreduce -- Do a reduction. |
-`-----------------------------*/
-yyreduce:
- /* yyn is the number of a rule to reduce with. */
- yylen = yyr2[yyn];
-
- /* If YYLEN is nonzero, implement the default value of the action:
- `$$ = $1'.
-
- Otherwise, the following line sets YYVAL to the semantic value of
- the lookahead token. This behavior is undocumented and Bison
- users should not rely upon it. Assigning to YYVAL
- unconditionally makes the parser a bit smaller, and it avoids a
- GCC warning that YYVAL may be used uninitialized. */
- yyval = yyvsp[1-yylen];
-
-#if YYLSP_NEEDED
- /* Similarly for the default location. Let the user run additional
- commands if for instance locations are ranges. */
- yyloc = yylsp[1-yylen];
- YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
-#endif
-
-#if YYDEBUG
- /* We have to keep this `#if YYDEBUG', since we use variables which
- are defined only if `YYDEBUG' is set. */
- if (yydebug)
- {
- int yyi;
-
- YYFPRINTF (stderr, "Reducing via rule %d (line %d), ",
- yyn, yyrline[yyn]);
-
- /* Print the symbols being reduced, and their result. */
- for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++)
- YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
- YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]);
- }
-#endif
-
- switch (yyn) {
-
-case 3:
-#line 66 "icalssyacc.y"
-{
- yyclearin;
- YYABORT;
- }
- break;
-case 4:
-#line 73 "icalssyacc.y"
-{ssyacc_add_select(icalss_yy_gauge,yyvsp[0].v_string);}
- break;
-case 5:
-#line 74 "icalssyacc.y"
-{ssyacc_add_select(icalss_yy_gauge,yyvsp[0].v_string);}
- break;
-case 6:
-#line 79 "icalssyacc.y"
-{ssyacc_add_from(icalss_yy_gauge,yyvsp[0].v_string);}
- break;
-case 7:
-#line 80 "icalssyacc.y"
-{ssyacc_add_from(icalss_yy_gauge,yyvsp[0].v_string);}
- break;
-case 9:
-#line 85 "icalssyacc.y"
-{ssyacc_add_where(icalss_yy_gauge,yyvsp[-2].v_string,ICALGAUGECOMPARE_EQUAL,yyvsp[0].v_string); }
- break;
-case 10:
-#line 86 "icalssyacc.y"
-{ssyacc_add_where(icalss_yy_gauge,yyvsp[-2].v_string,ICALGAUGECOMPARE_ISNULL,""); }
- break;
-case 11:
-#line 87 "icalssyacc.y"
-{ssyacc_add_where(icalss_yy_gauge,yyvsp[-3].v_string,ICALGAUGECOMPARE_ISNOTNULL,""); }
- break;
-case 12:
-#line 88 "icalssyacc.y"
-{ssyacc_add_where(icalss_yy_gauge,yyvsp[-2].v_string,ICALGAUGECOMPARE_NOTEQUAL,yyvsp[0].v_string); }
- break;
-case 13:
-#line 89 "icalssyacc.y"
-{ssyacc_add_where(icalss_yy_gauge,yyvsp[-2].v_string,ICALGAUGECOMPARE_LESS,yyvsp[0].v_string); }
- break;
-case 14:
-#line 90 "icalssyacc.y"
-{ssyacc_add_where(icalss_yy_gauge,yyvsp[-2].v_string,ICALGAUGECOMPARE_GREATER,yyvsp[0].v_string); }
- break;
-case 15:
-#line 91 "icalssyacc.y"
-{ssyacc_add_where(icalss_yy_gauge,yyvsp[-2].v_string,ICALGAUGECOMPARE_LESSEQUAL,yyvsp[0].v_string); }
- break;
-case 16:
-#line 92 "icalssyacc.y"
-{ssyacc_add_where(icalss_yy_gauge,yyvsp[-2].v_string,ICALGAUGECOMPARE_GREATEREQUAL,yyvsp[0].v_string); }
- break;
-case 17:
-#line 96 "icalssyacc.y"
-{set_logic(icalss_yy_gauge,ICALGAUGELOGIC_NONE);}
- break;
-case 18:
-#line 97 "icalssyacc.y"
-{set_logic(icalss_yy_gauge,ICALGAUGELOGIC_AND);}
- break;
-case 19:
-#line 98 "icalssyacc.y"
-{set_logic(icalss_yy_gauge,ICALGAUGELOGIC_OR);}
- break;
-}
-
-#line 705 "/usr/share/bison/bison.simple"
-
-
- yyvsp -= yylen;
- yyssp -= yylen;
-#if YYLSP_NEEDED
- yylsp -= yylen;
-#endif
-
-#if YYDEBUG
- if (yydebug)
- {
- short *yyssp1 = yyss - 1;
- YYFPRINTF (stderr, "state stack now");
- while (yyssp1 != yyssp)
- YYFPRINTF (stderr, " %d", *++yyssp1);
- YYFPRINTF (stderr, "\n");
- }
-#endif
-
- *++yyvsp = yyval;
-#if YYLSP_NEEDED
- *++yylsp = yyloc;
-#endif
-
- /* Now `shift' the result of the reduction. Determine what state
- that goes to, based on the state we popped back to and the rule
- number reduced by. */
-
- yyn = yyr1[yyn];
-
- yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
- if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
- yystate = yytable[yystate];
- else
- yystate = yydefgoto[yyn - YYNTBASE];
-
- goto yynewstate;
-
-
-/*------------------------------------.
-| yyerrlab -- here on detecting error |
-`------------------------------------*/
-yyerrlab:
- /* If not already recovering from an error, report this error. */
- if (!yyerrstatus)
- {
- ++yynerrs;
-
-#ifdef YYERROR_VERBOSE
- yyn = yypact[yystate];
-
- if (yyn > YYFLAG && yyn < YYLAST)
- {
- YYSIZE_T yysize = 0;
- char *yymsg;
- int yyx, yycount;
-
- yycount = 0;
- /* Start YYX at -YYN if negative to avoid negative indexes in
- YYCHECK. */
- for (yyx = yyn < 0 ? -yyn : 0;
- yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
- if (yycheck[yyx + yyn] == yyx)
- yysize += yystrlen (yytname[yyx]) + 15, yycount++;
- yysize += yystrlen ("parse error, unexpected ") + 1;
- yysize += yystrlen (yytname[YYTRANSLATE (yychar)]);
- yymsg = (char *) YYSTACK_ALLOC (yysize);
- if (yymsg != 0)
- {
- char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
- yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]);
-
- if (yycount < 5)
- {
- yycount = 0;
- for (yyx = yyn < 0 ? -yyn : 0;
- yyx < (int) (sizeof (yytname) / sizeof (char *));
- yyx++)
- if (yycheck[yyx + yyn] == yyx)
- {
- const char *yyq = ! yycount ? ", expecting " : " or ";
- yyp = yystpcpy (yyp, yyq);
- yyp = yystpcpy (yyp, yytname[yyx]);
- yycount++;
- }
- }
- yyerror (yymsg);
- YYSTACK_FREE (yymsg);
- }
- else
- yyerror ("parse error; also virtual memory exhausted");
- }
- else
-#endif /* defined (YYERROR_VERBOSE) */
- yyerror ("parse error");
- }
- goto yyerrlab1;
-
-
-/*--------------------------------------------------.
-| yyerrlab1 -- error raised explicitly by an action |
-`--------------------------------------------------*/
-yyerrlab1:
- if (yyerrstatus == 3)
- {
- /* If just tried and failed to reuse lookahead token after an
- error, discard it. */
-
- /* return failure if at end of input */
- if (yychar == YYEOF)
- YYABORT;
- YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
- yychar, yytname[yychar1]));
- yychar = YYEMPTY;
- }
-
- /* Else will try to reuse lookahead token after shifting the error
- token. */
-
- yyerrstatus = 3; /* Each real token shifted decrements this */
-
- goto yyerrhandle;
-
-
-/*-------------------------------------------------------------------.
-| yyerrdefault -- current state does not do anything special for the |
-| error token. |
-`-------------------------------------------------------------------*/
-yyerrdefault:
-#if 0
- /* This is wrong; only states that explicitly want error tokens
- should shift them. */
-
- /* If its default is to accept any token, ok. Otherwise pop it. */
- yyn = yydefact[yystate];
- if (yyn)
- goto yydefault;
-#endif
-
-
-/*---------------------------------------------------------------.
-| yyerrpop -- pop the current state because it cannot handle the |
-| error token |
-`---------------------------------------------------------------*/
-yyerrpop:
- if (yyssp == yyss)
- YYABORT;
- yyvsp--;
- yystate = *--yyssp;
-#if YYLSP_NEEDED
- yylsp--;
-#endif
-
-#if YYDEBUG
- if (yydebug)
- {
- short *yyssp1 = yyss - 1;
- YYFPRINTF (stderr, "Error: state stack now");
- while (yyssp1 != yyssp)
- YYFPRINTF (stderr, " %d", *++yyssp1);
- YYFPRINTF (stderr, "\n");
- }
-#endif
-
-/*--------------.
-| yyerrhandle. |
-`--------------*/
-yyerrhandle:
- yyn = yypact[yystate];
- if (yyn == YYFLAG)
- goto yyerrdefault;
-
- yyn += YYTERROR;
- if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
- goto yyerrdefault;
-
- yyn = yytable[yyn];
- if (yyn < 0)
- {
- if (yyn == YYFLAG)
- goto yyerrpop;
- yyn = -yyn;
- goto yyreduce;
- }
- else if (yyn == 0)
- goto yyerrpop;
-
- if (yyn == YYFINAL)
- YYACCEPT;
-
- YYDPRINTF ((stderr, "Shifting error token, "));
-
- *++yyvsp = yylval;
-#if YYLSP_NEEDED
- *++yylsp = yylloc;
-#endif
-
- yystate = yyn;
- goto yynewstate;
-
-
-/*-------------------------------------.
-| yyacceptlab -- YYACCEPT comes here. |
-`-------------------------------------*/
-yyacceptlab:
- yyresult = 0;
- goto yyreturn;
-
-/*-----------------------------------.
-| yyabortlab -- YYABORT comes here. |
-`-----------------------------------*/
-yyabortlab:
- yyresult = 1;
- goto yyreturn;
-
-/*---------------------------------------------.
-| yyoverflowab -- parser overflow comes here. |
-`---------------------------------------------*/
-yyoverflowlab:
- yyerror ("parser stack overflow");
- yyresult = 2;
- /* Fall through. */
-
-yyreturn:
-#ifndef yyoverflow
- if (yyss != yyssa)
- YYSTACK_FREE (yyss);
-#endif
- return yyresult;
-}
-#line 102 "icalssyacc.y"
-
-
-static void ssyacc_add_where(struct icalgauge_impl* impl, char* str1,
- icalgaugecompare compare , char* value_str)
-{
-
- struct icalgauge_where *where;
- char *compstr, *propstr, *c, *s,*l;
-
- if ( (where = malloc(sizeof(struct icalgauge_where))) ==0){
- icalerror_set_errno(ICAL_NEWFAILED_ERROR);
- return;
- }
-
- memset(where,0,sizeof(struct icalgauge_where));
- where->logic = ICALGAUGELOGIC_NONE;
- where->compare = ICALGAUGECOMPARE_NONE;
- where->comp = ICAL_NO_COMPONENT;
- where->prop = ICAL_NO_PROPERTY;
-
- /* remove enclosing quotes */
- s = value_str;
- if(*s == '\''){
- s++;
- }
- l = s+strlen(s)-1;
- if(*l == '\''){
- *l=0;
- }
-
- where->value = strdup(s);
-
- /* Is there a period in str1 ? If so, the string specified both a
- component and a property*/
- if( (c = strrchr(str1,'.')) != 0){
- compstr = str1;
- propstr = c+1;
- *c = '\0';
- } else {
- compstr = 0;
- propstr = str1;
- }
-
-
- /* Handle the case where a component was specified */
- if(compstr != 0){
- where->comp = icalenum_string_to_component_kind(compstr);
- } else {
- where->comp = ICAL_NO_COMPONENT;
- }
-
- where->prop = icalenum_string_to_property_kind(propstr);
-
- where->compare = compare;
-
- if(where->value == 0){
- icalerror_set_errno(ICAL_NEWFAILED_ERROR);
- free(where->value);
- return;
- }
-
- pvl_push(impl->where,where);
-}
-
-static void set_logic(struct icalgauge_impl* impl,icalgaugelogic l)
-{
- pvl_elem e = pvl_tail(impl->where);
- struct icalgauge_where *where = pvl_data(e);
-
- where->logic = l;
-
-}
-
-
-
-static void ssyacc_add_select(struct icalgauge_impl* impl, char* str1)
-{
- char *c, *compstr, *propstr;
- struct icalgauge_where *where;
-
- /* Uses only the prop and comp fields of the where structure */
- if ( (where = malloc(sizeof(struct icalgauge_where))) ==0){
- icalerror_set_errno(ICAL_NEWFAILED_ERROR);
- return;
- }
-
- memset(where,0,sizeof(struct icalgauge_where));
- where->logic = ICALGAUGELOGIC_NONE;
- where->compare = ICALGAUGECOMPARE_NONE;
- where->comp = ICAL_NO_COMPONENT;
- where->prop = ICAL_NO_PROPERTY;
-
- /* Is there a period in str1 ? If so, the string specified both a
- component and a property*/
- if( (c = strrchr(str1,'.')) != 0){
- compstr = str1;
- propstr = c+1;
- *c = '\0';
- } else {
- compstr = 0;
- propstr = str1;
- }
-
-
- /* Handle the case where a component was specified */
- if(compstr != 0){
- where->comp = icalenum_string_to_component_kind(compstr);
- } else {
- where->comp = ICAL_NO_COMPONENT;
- }
-
-
- /* If the property was '*', then accept all properties */
- if(strcmp("*",propstr) == 0) {
- where->prop = ICAL_ANY_PROPERTY;
- } else {
- where->prop = icalenum_string_to_property_kind(propstr);
- }
-
-
- if(where->prop == ICAL_NO_PROPERTY){
- free(where);
- icalerror_set_errno(ICAL_BADARG_ERROR);
- return;
- }
-
- pvl_push(impl->select,where);
-}
-
-static void ssyacc_add_from(struct icalgauge_impl* impl, char* str1)
-{
- icalcomponent_kind ckind;
-
- ckind = icalenum_string_to_component_kind(str1);
-
- if(ckind == ICAL_NO_COMPONENT){
- assert(0);
- }
-
- pvl_push(impl->from,(void*)ckind);
-
-}
-
-
-void sserror(char *s){
- fprintf(stderr,"Parse error \'%s\'\n", s);
- icalerror_set_errno(ICAL_MALFORMEDDATA_ERROR);
-}
diff --git a/libical/src/libicalvcal/.cvsignore b/libical/src/libicalvcal/.cvsignore
index bbc8ba00d1..533caa2f3d 100644
--- a/libical/src/libicalvcal/.cvsignore
+++ b/libical/src/libicalvcal/.cvsignore
@@ -1,5 +1,12 @@
-Makefile
-.deps
-.libs
-*.lo
*.la
+*.lo
+.libs
+.deps
+Makefile
+Makefile.in
+libtool
+ltconfig
+ltmain.sh
+stamp-h
+stamp-h.in
+vcc.c \ No newline at end of file
diff --git a/libical/src/libicalvcal/Makefile.am b/libical/src/libicalvcal/Makefile.am
index 414265181c..f9d8dd39d9 100644
--- a/libical/src/libicalvcal/Makefile.am
+++ b/libical/src/libicalvcal/Makefile.am
@@ -8,27 +8,20 @@ INCLUDES = \
libicalvcal_evolution_la_LDFLAGS = -version-info 0:0:0
-if DEV
-libicalvcal_evolution_la_DEVSOURCES = vcc.y
-else
-libicalvcal_evolution_la_DEVSOURCES = vcc.c
-endif
-
-
libicalvcal_evolution_la_SOURCES = \
icalvcal.h \
icalvcal.c \
port.h \
vcc.h \
+ vcc.y \
vobject.h \
vobject.c \
vcaltmp.h \
- vcaltmp.c \
- $(libicalvcal_evolution_la_DEVSOURCES)
+ vcaltmp.c
-libicalvcal_evolutionincludedir = $(privincludedir)/libical
+#libicalvcalincludedir = $(privincludedir)/libicalvcal
-#libicalvcal_evolutioninclude_HEADERS = \
+#libicalvcalinclude_HEADERS = \
# icalvcal.h \
# port.h \
# vcc.h \
diff --git a/libical/src/libicalvcal/icalvcal.c b/libical/src/libicalvcal/icalvcal.c
index f5d417cb6d..9ab3fa899e 100644
--- a/libical/src/libicalvcal/icalvcal.c
+++ b/libical/src/libicalvcal/icalvcal.c
@@ -42,11 +42,6 @@
#include "icalvcal.h"
#include <string.h>
-#ifdef WIN32
-#define snprintf _snprintf
-#define strcasecmp stricmp
-#endif
-
enum datatype {
COMPONENT,
PROPERTY,
@@ -67,7 +62,6 @@ int weekday_codes[] = {
ICAL_SATURDAY_WEEKDAY
};
-
struct conversion_table_struct {
char* vcalname;
enum datatype type;
@@ -155,10 +149,10 @@ static void convert_floating_time_to_utc (struct icaltimetype *itt)
}
-static void icalvcal_traverse_objects(VObject *object,
- icalcomponent* last_comp,
- icalproperty* last_prop,
- icalvcal_defaults *defaults)
+static int icalvcal_traverse_objects(VObject *object,
+ icalcomponent* last_comp,
+ icalproperty* last_prop,
+ icalvcal_defaults *defaults)
{
VObjectIterator iterator;
char* name = "[No Name]";
@@ -167,8 +161,7 @@ static void icalvcal_traverse_objects(VObject *object,
if ( vObjectName(object)== 0){
printf("ERROR, object has no name");
- assert(0);
- return;
+ return 0;
}
name = (char*)vObjectName(object);
@@ -191,8 +184,7 @@ static void icalvcal_traverse_objects(VObject *object,
icalproperty_set_x_name(prop,name);
icalcomponent_add_property(last_comp,prop);
} else {
- assert(0);
- return;
+ return 0;
}
} else {
@@ -211,8 +203,9 @@ static void icalvcal_traverse_objects(VObject *object,
object, last_comp, defaults));
if (subc) {
- icalcomponent_add_component(last_comp,subc);
- }
+ icalcomponent_add_component(last_comp,subc);
+ }
+
break;
}
@@ -227,7 +220,7 @@ static void icalvcal_traverse_objects(VObject *object,
object, last_comp, defaults));
if (prop)
- icalcomponent_add_property(last_comp,prop);
+ icalcomponent_add_property(last_comp,prop);
last_prop = prop;
@@ -267,7 +260,6 @@ static void icalvcal_traverse_objects(VObject *object,
/* Do Nothing. */
break;
}
-
}
}
@@ -282,12 +274,16 @@ static void icalvcal_traverse_objects(VObject *object,
should use it as the 'last_comp' */
if(subc!=0){
- icalvcal_traverse_objects(eachProp,subc,last_prop,defaults);
+ if (!icalvcal_traverse_objects(eachProp,subc,last_prop,defaults))
+ return 0;
} else {
- icalvcal_traverse_objects(eachProp,last_comp,last_prop,defaults);
+ if (!icalvcal_traverse_objects(eachProp,last_comp,last_prop,defaults))
+ return 0;
}
}
+
+ return 1;
}
icalcomponent* icalvcal_convert_with_defaults (VObject *object,
@@ -313,7 +309,8 @@ icalcomponent* icalvcal_convert_with_defaults (VObject *object,
printf ("===========================================\n");
#endif
- icalvcal_traverse_objects(object,container,0,defaults);
+ if (!icalvcal_traverse_objects(object,container,0,defaults))
+ return 0;
/* HACK. I am using the extra 'container' component because I am
lazy. I know there is a way to get rid of it, but I did not care
@@ -449,7 +446,7 @@ static int get_alarm_properties (icalcomponent *comp, VObject *object,
icalcomponent_add_property (comp, trigger_prop);
}
-
+
} else if (!strcmp (name, VCSnoozeTimeProp)) {
struct icaldurationtype d;
@@ -458,7 +455,7 @@ static int get_alarm_properties (icalcomponent *comp, VObject *object,
which we don't handle at present. Though it is unlikely they
will be used as a snooze time between repeated alarms! */
d = icaldurationtype_from_string (s);
-
+
duration_prop = icalproperty_new_duration (d);
icalcomponent_add_property (comp, duration_prop);
@@ -534,7 +531,7 @@ static int get_alarm_properties (icalcomponent *comp, VObject *object,
if (!summary_prop) {
summary_prop = icalproperty_new_summary (s);
icalcomponent_add_property (comp, summary_prop);
- }
+ }
}
if (free_string)
@@ -695,23 +692,23 @@ void* alarm_comp(int icaltype, VObject *o, icalcomponent *comp,
int is_valid_alarm;
icalcomponent* c = icalcomponent_new(ICAL_VALARM_COMPONENT);
-
+
is_valid_alarm = get_alarm_properties (c, o, icaltype, defaults);
if (is_valid_alarm) {
- return (void*)c;
+ return (void*)c;
} else {
icalcomponent_free (c);
return NULL;
}
}
-
/* These #defines indicate conversion routines that are not defined yet. */
#define parameter 0
#define rsvp_parameter 0
+
void* transp_prop(int icaltype, VObject *object, icalcomponent *comp,
icalvcal_defaults *defaults)
{
@@ -721,12 +718,11 @@ void* transp_prop(int icaltype, VObject *object, icalcomponent *comp,
s = get_string_value (object, &free_string);
-
/* In vCalendar "0" means opaque, "1" means transparent, and >1 is
implementation-specific. So we just check for "1" and output
TRANSPARENT. For anything else, the default OPAQUE will be used. */
if (!strcmp (s, "1")) {
- prop = icalproperty_new_transp (ICAL_TRANSP_TRANSPARENT);
+ prop = icalproperty_new_transp ("TRANSPARENT");
}
if (free_string)
@@ -735,6 +731,7 @@ void* transp_prop(int icaltype, VObject *object, icalcomponent *comp,
return (void*)prop;
}
+
void* sequence_prop(int icaltype, VObject *object, icalcomponent *comp,
icalvcal_defaults *defaults)
{
@@ -1016,8 +1013,8 @@ static char* rrule_parse_weekly_days (char *s,
e = s + 2;
if (*e == ' ' || *e == '\t' || *e == '\0') {
found_day = day;
- break;
- }
+ break;
+ }
}
}
@@ -1070,8 +1067,8 @@ static char* rrule_parse_monthly_days (char *s,
} else if (*e == '-') {
e++;
month_day = -month_day;
+ }
}
- }
/* Check the next char is whitespace or the end of the string. */
if (*e != ' ' && *e != '\t' && *e != '\0')
@@ -1391,10 +1388,9 @@ void* dc_prop(int icaltype, VObject *object, icalcomponent *comp,
icalproperty *prop;
icalvalue *value;
icalvalue_kind value_kind;
- char *s,*t=0;
+ char *s;
int free_string;
-
prop = icalproperty_new(kind);
value_kind = icalenum_property_kind_to_value_kind (icalproperty_isa(prop));
@@ -1422,6 +1418,7 @@ struct conversion_table_struct conversion_table[] =
{VCCalProp, COMPONENT, comp, ICAL_VCALENDAR_COMPONENT},
{VCTodoProp, COMPONENT, comp, ICAL_VTODO_COMPONENT},
{VCEventProp, COMPONENT, comp, ICAL_VEVENT_COMPONENT},
+
{VCAAlarmProp, COMPONENT, alarm_comp, ICAL_XAUDIOALARM_COMPONENT},
{VCDAlarmProp, COMPONENT, alarm_comp, ICAL_XDISPLAYALARM_COMPONENT},
{VCMAlarmProp, COMPONENT, alarm_comp, ICAL_XEMAILALARM_COMPONENT},
@@ -1481,6 +1478,7 @@ struct conversion_table_struct conversion_table[] =
{VCSnoozeTimeProp, IGNORE,0, 0},
{VCRepeatCountProp, IGNORE,0, 0},
{VCValueProp, IGNORE,0, 0},
+{VCAudioContentProp, IGNORE,0, 0},
{VCProcedureNameProp, IGNORE,0, 0},
{VCDisplayStringProp, IGNORE,0, 0},
{VCEmailAddressProp, IGNORE,0, 0},
@@ -1497,7 +1495,6 @@ struct conversion_table_struct conversion_table[] =
{VCAppleLinkProp, UNSUPPORTED,0, 0},
{VCAttachProp, UNSUPPORTED,0, 0},
{VCATTMailProp, UNSUPPORTED,0, 0},
-{VCAudioContentProp, UNSUPPORTED,0, 0},
{VCAVIProp, UNSUPPORTED,0, 0},
{VCBase64Prop, UNSUPPORTED,0, 0},
{VCBBSProp, UNSUPPORTED,0, 0},
diff --git a/libical/src/libicalvcal/icalvcal.h b/libical/src/libicalvcal/icalvcal.h
index 67119ce042..96e94b9f2e 100644
--- a/libical/src/libicalvcal/icalvcal.h
+++ b/libical/src/libicalvcal/icalvcal.h
@@ -44,10 +44,10 @@ struct _icalvcal_defaults {
icalcomponent* icalvcal_convert(VObject *object);
-
icalcomponent* icalvcal_convert_with_defaults (VObject *object,
icalvcal_defaults *defaults);
+
#endif /* !ICALVCAL_H */
diff --git a/libical/src/libicalvcal/vcc.y b/libical/src/libicalvcal/vcc.y
index 245774f37e..5338f563a6 100644
--- a/libical/src/libicalvcal/vcc.y
+++ b/libical/src/libicalvcal/vcc.y
@@ -56,11 +56,6 @@ DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable.
#define DBG_(x)
#endif
-#ifdef WIN32
-#define snprintf _snprintf
-#define strcasecmp stricmp
-#endif
-
/**** External Functions ****/
/* assign local name to parser variables and functions so that
@@ -424,7 +419,7 @@ static void enterValues(const char *value)
using ';' to separate the values. */
if (vObjectUStringZValue(curProp)) {
p1 = fakeCString(vObjectUStringZValue(curProp));
- p2 = malloc((strlen(p1)+strlen(value)+1));
+ p2 = malloc((strlen(p1)+strlen(value)+2));
strcpy(p2, p1);
deleteStr(p1);
@@ -437,7 +432,7 @@ static void enterValues(const char *value)
setVObjectUStringZValue_(curProp,fakeUnicode(p2,0));
deleteStr(p2);
} else {
- setVObjectUStringZValue_(curProp,fakeUnicode(value,0));
+ setVObjectUStringZValue_(curProp,fakeUnicode(value,0));
}
}
}
diff --git a/libical/src/libicalvcal/vobject.c b/libical/src/libicalvcal/vobject.c
index 616581ffa8..b17830eb72 100644
--- a/libical/src/libicalvcal/vobject.c
+++ b/libical/src/libicalvcal/vobject.c
@@ -42,11 +42,6 @@ DFARS 252.227-7013 or 48 CFR 52.227-19, as applicable.
* vobject, and convert a vobject into its textual representation.
*/
-#ifdef WIN32
-#define snprintf _snprintf
-#define strcasecmp stricmp
-#endif
-
#include "vobject.h"
#include <stdlib.h>
#include <string.h>
@@ -1249,10 +1244,9 @@ static void writeGroup(OFile *fp, VObject *o)
char buf2[256];
strcpy(buf1,NAME_OF(o));
while ((o=isAPropertyOf(o,VCGroupingProp)) != 0) {
- strncpy(buf2,STRINGZ_VALUE_OF(o),sizeof(buf2));
- buf2[sizeof(buf2)-1] = '\0';
- strncat(buf2,".",sizeof(buf2)-strlen(buf2)-1);
- strncat(buf2,buf1,sizeof(buf2)-strlen(buf2)-1);
+ strcpy(buf2,STRINGZ_VALUE_OF(o));
+ strcat(buf2,".");
+ strcat(buf2,buf1);
strcpy(buf1,buf2);
}
appendsOFile(fp,buf1);
diff --git a/libical/src/python/.cvsignore b/libical/src/python/.cvsignore
index 801247a12c..3dda72986f 100644
--- a/libical/src/python/.cvsignore
+++ b/libical/src/python/.cvsignore
@@ -1,9 +1,2 @@
+Makefile.in
Makefile
-.deps
-.libs
-*.lo
-*.la
-*.pyc
-LibicalWrap.c
-LibicalWrap_wrap.doc
-config.c
diff --git a/libical/src/test/process.c b/libical/src/test/process.c
index 466cf38101..56f1c65fb1 100644
--- a/libical/src/test/process.c
+++ b/libical/src/test/process.c
@@ -22,12 +22,55 @@
======================================================================*/
#include <stdio.h> /* for printf */
+#include "ical.h"
+#include "icalss.h"
#include <errno.h>
#include <string.h> /* For strerror */
#include <stdlib.h> /* for free */
-#include "ical.h"
-#include "icalss.h"
+struct class_map {
+ ical_class class;
+ char *str;
+} class_map[] = {
+ {ICAL_NO_CLASS,"No class"},
+ {ICAL_PUBLISH_NEW_CLASS,"New Publish"},
+ {ICAL_PUBLISH_UPDATE_CLASS,"New Publish"},
+ {ICAL_REQUEST_NEW_CLASS,"New request"},
+ {ICAL_REQUEST_UPDATE_CLASS,"Update"},
+ {ICAL_REQUEST_RESCHEDULE_CLASS,"Reschedule"},
+ {ICAL_REQUEST_DELEGATE_CLASS,"Delegate"},
+ {ICAL_REQUEST_NEW_ORGANIZER_CLASS,"New Organizer"},
+ {ICAL_REQUEST_FORWARD_CLASS,"Forward"},
+ {ICAL_REQUEST_STATUS_CLASS,"Status request"},
+ {ICAL_REPLY_ACCEPT_CLASS,"Accept reply"},
+ {ICAL_REPLY_DECLINE_CLASS,"Decline reply"},
+ {ICAL_REPLY_CRASHER_ACCEPT_CLASS,"Crasher's accept reply"},
+ {ICAL_REPLY_CRASHER_DECLINE_CLASS,"Crasher's decline reply"},
+ {ICAL_ADD_INSTANCE_CLASS,"Add instance"},
+ {ICAL_CANCEL_EVENT_CLASS,"Cancel event"},
+ {ICAL_CANCEL_INSTANCE_CLASS,"Cancel instance"},
+ {ICAL_CANCEL_ALL_CLASS,"Cancel all instances"},
+ {ICAL_REFRESH_CLASS,"Refresh"},
+ {ICAL_COUNTER_CLASS,"Counter"},
+ {ICAL_DECLINECOUNTER_CLASS,"Decline counter"},
+ {ICAL_MALFORMED_CLASS,"Malformed"},
+ {ICAL_OBSOLETE_CLASS,"Obsolete"},
+ {ICAL_MISSEQUENCED_CLASS,"Missequenced"},
+ {ICAL_UNKNOWN_CLASS,"Unknown"}
+};
+
+char* find_class_string(ical_class class)
+{
+ int i;
+
+ for (i = 0;class_map[i].class != ICAL_UNKNOWN_CLASS;i++){
+ if (class_map[i].class == class){
+ return class_map[i].str;
+ }
+ }
+
+ return "Unknown";
+}
void send_message(icalcomponent *reply,const char* this_user)
{
@@ -41,7 +84,7 @@ int main(int argc, char* argv[])
{
icalcomponent *c, *next_c;
int i=0;
- const char *class_string;
+ char *class_string;
int dont_remove;
icalset* f = icalset_new_file("../../test-data/process-incoming.ics");
@@ -60,7 +103,7 @@ int main(int argc, char* argv[])
/* Foreach incoming message */
for(c=icalset_get_first_component(f);c!=0;c = next_c){
- icalproperty_xlicclass class;
+ ical_class class;
icalcomponent *match;
icalcomponent *inner;
icalcomponent *reply = 0;
@@ -87,7 +130,7 @@ int main(int argc, char* argv[])
class = icalclassify(c,match,this_user);
- class_string = icalproperty_enum_to_string(class);
+ class_string = find_class_string(class);
/* Print out the notes associated with the incoming component
and the matched component in the */
@@ -128,7 +171,7 @@ int main(int argc, char* argv[])
/* Main processing structure */
switch (class){
- case ICAL_XLICCLASS_NONE: {
+ case ICAL_NO_CLASS: {
char temp[1024];
/* Huh? Return an error to sender */
icalrestriction_check(c);
@@ -148,15 +191,15 @@ int main(int argc, char* argv[])
break;
}
- case ICAL_XLICCLASS_PUBLISHNEW: {
+ case ICAL_PUBLISH_NEW_CLASS: {
/* Don't accept published events from anyone but
- self. If self, fall through to ICAL_XLICCLASS_REQUESTNEW */
+ self. If self, fall through to ICAL_REQUEST_NEW_CLASS */
}
- case ICAL_XLICCLASS_REQUESTNEW: {
+ case ICAL_REQUEST_NEW_CLASS: {
/* Book the new component if it does not overlap
anything. If the time is busy and the start time is
@@ -240,114 +283,110 @@ conflicts with this meeting. I am proposing a time that works better for me.");
}
break;
}
- case ICAL_XLICCLASS_PUBLISHFREEBUSY: {
+ case ICAL_PUBLISH_FREEBUSY_CLASS: {
/* Store the busy time information in a file named after
the sender */
break;
}
- case ICAL_XLICCLASS_PUBLISHUPDATE: {
+ case ICAL_PUBLISH_UPDATE_CLASS: {
/* Only accept publish updates from self. If self, fall
- throught to ICAL_XLICCLASS_REQUESTUPDATE */
+ throught to ICAL_REQUEST_UPDATE_CLASS */
}
- case ICAL_XLICCLASS_REQUESTUPDATE: {
+ case ICAL_REQUEST_UPDATE_CLASS: {
/* always accept the changes */
break;
}
- case ICAL_XLICCLASS_REQUESTRESCHEDULE: {
+ case ICAL_REQUEST_RESCHEDULE_CLASS: {
/* Use same rules as REQUEST_NEW */
icalcomponent *overlaps;
overlaps = icalclassify_find_overlaps(cal,c);
break;
}
- case ICAL_XLICCLASS_REQUESTDELEGATE: {
+ case ICAL_REQUEST_DELEGATE_CLASS: {
break;
}
- case ICAL_XLICCLASS_REQUESTNEWORGANIZER: {
+ case ICAL_REQUEST_NEW_ORGANIZER_CLASS: {
break;
}
- case ICAL_XLICCLASS_REQUESTFORWARD: {
+ case ICAL_REQUEST_FORWARD_CLASS: {
break;
}
- case ICAL_XLICCLASS_REQUESTSTATUS: {
+ case ICAL_REQUEST_STATUS_CLASS: {
break;
}
- case ICAL_XLICCLASS_REQUESTFREEBUSY: {
+ case ICAL_REQUEST_FREEBUSY_CLASS: {
break;
}
- case ICAL_XLICCLASS_REPLYACCEPT: {
+ case ICAL_REPLY_ACCEPT_CLASS: {
/* Change the PARTSTAT of the sender */
break;
}
- case ICAL_XLICCLASS_REPLYDECLINE: {
+ case ICAL_REPLY_DECLINE_CLASS: {
/* Change the PARTSTAT of the sender */
break;
}
- case ICAL_XLICCLASS_REPLYCRASHERACCEPT: {
+ case ICAL_REPLY_CRASHER_ACCEPT_CLASS: {
/* Add the crasher to the ATTENDEE list with the
appropriate PARTSTAT */
break;
}
- case ICAL_XLICCLASS_REPLYCRASHERDECLINE: {
+ case ICAL_REPLY_CRASHER_DECLINE_CLASS: {
/* Add the crasher to the ATTENDEE list with the
appropriate PARTSTAT */
break;
}
- case ICAL_XLICCLASS_ADDINSTANCE: {
+ case ICAL_ADD_INSTANCE_CLASS: {
break;
}
- case ICAL_XLICCLASS_CANCELEVENT: {
+ case ICAL_CANCEL_EVENT_CLASS: {
/* Remove the component */
break;
}
- case ICAL_XLICCLASS_CANCELINSTANCE: {
+ case ICAL_CANCEL_INSTANCE_CLASS: {
break;
}
- case ICAL_XLICCLASS_CANCELALL: {
+ case ICAL_CANCEL_ALL_CLASS: {
/* Remove the component */
break;
}
- case ICAL_XLICCLASS_REFRESH: {
+ case ICAL_REFRESH_CLASS: {
/* Resend the latest copy of the request */
break;
}
- case ICAL_XLICCLASS_COUNTER: {
+ case ICAL_COUNTER_CLASS: {
break;
}
- case ICAL_XLICCLASS_DECLINECOUNTER: {
+ case ICAL_DECLINECOUNTER_CLASS: {
break;
}
- case ICAL_XLICCLASS_MALFORMED: {
+ case ICAL_MALFORMED_CLASS: {
/* Send back an error */
break;
}
- case ICAL_XLICCLASS_OBSOLETE: {
+ case ICAL_OBSOLETE_CLASS: {
printf(" ** Got an obsolete component:\n%s",
icalcomponent_as_ical_string(c));
/* Send back an error */
break;
}
- case ICAL_XLICCLASS_MISSEQUENCED: {
+ case ICAL_MISSEQUENCED_CLASS: {
printf(" ** Got a missequenced component:\n%s",
icalcomponent_as_ical_string(c));
/* Send back an error */
break;
}
- case ICAL_XLICCLASS_UNKNOWN: {
+ case ICAL_UNKNOWN_CLASS: {
printf(" ** Don't know what to do with this component:\n%s",
icalcomponent_as_ical_string(c));
/* Send back an error */
break;
}
- case ICAL_XLICCLASS_X:
- case ICAL_XLICCLASS_REPLYDELEGATE:
- default: {
- }
}
#if(0)
diff --git a/libical/src/test/recur.c b/libical/src/test/recur.c
index bb23337adb..f4d9a38647 100644
--- a/libical/src/test/recur.c
+++ b/libical/src/test/recur.c
@@ -25,137 +25,96 @@
======================================================================*/
+#include "ical.h"
#include <assert.h>
#include <string.h> /* for strdup */
#include <stdlib.h> /* for malloc */
#include <stdio.h> /* for printf */
#include <time.h> /* for time() */
#include <signal.h> /* for signal */
-#ifndef WIN32
#include <unistd.h> /* for alarm */
-#endif
-
-#include "ical.h"
-#include "icalss.h"
-
-#ifdef WIN32
-#define snprintf _snprintf
-#define strcasecmp stricmp
-#endif
+#include "icalmemory.h"
+#include "icaldirset.h"
+#include "icalfileset.h"
static void sig_alrm(int i){
fprintf(stderr,"Could not get lock on file\n");
exit(1);
}
-static void recur_callback(icalcomponent *comp,
- struct icaltime_span *span,
- void *data)
-{
- printf("cb: %s", ctime(&span->start));
- printf(" %s\n", ctime(&span->end));
-
-}
-
int main(int argc, char *argv[])
{
- icalset *cin;
- struct icaltimetype next;
+ icalfileset *cin;
+ struct icaltimetype start, next;
icalcomponent *itr;
icalproperty *desc, *dtstart, *rrule;
struct icalrecurrencetype recur;
icalrecur_iterator* ritr;
time_t tt;
char* file;
-
+
icalerror_set_error_state(ICAL_PARSE_ERROR, ICAL_ERROR_NONFATAL);
-
-#ifndef WIN32
+
signal(SIGALRM,sig_alrm);
-#endif
-
+
+
if (argc <= 1){
- file = "../../test-data/recur.txt";
+ file = "../../test-data/recur.txt";
} else if (argc == 2){
- file = argv[1];
+ file = argv[1];
} else {
- fprintf(stderr,"usage: recur [input file]\n");
- exit(1);
+ fprintf(stderr,"usage: recur [input file]\n");
+ exit(1);
}
-
-#ifndef WIN32
+
alarm(300); /* to get file lock */
-#endif
cin = icalfileset_new(file);
-#ifndef WIN32
alarm(0);
-#endif
-
+
if(cin == 0){
- fprintf(stderr,"recur: can't open file %s\n",file);
- exit(1);
- }
-
-
- for (itr = icalfileset_get_first_component(cin);
- itr != 0;
- itr = icalfileset_get_next_component(cin)){
-
- struct icaltimetype start = icaltime_from_timet(1,0);
- struct icaltimetype end = icaltime_today();
-
-
-
- desc = icalcomponent_get_first_property(itr,ICAL_DESCRIPTION_PROPERTY);
- dtstart = icalcomponent_get_first_property(itr,ICAL_DTSTART_PROPERTY);
- rrule = icalcomponent_get_first_property(itr,ICAL_RRULE_PROPERTY);
-
- if (desc == 0 || dtstart == 0 || rrule == 0){
- printf("\n******** Error in input component ********\n");
- printf("The following component is malformed:\n %s\n",
- icalcomponent_as_ical_string(itr));
- continue;
- }
-
- printf("\n\n#### %s\n",icalproperty_get_description(desc));
- printf("#### %s\n",icalvalue_as_ical_string(icalproperty_get_value(rrule)));
- recur = icalproperty_get_rrule(rrule);
- start = icalproperty_get_dtstart(dtstart);
-
- ritr = icalrecur_iterator_new(recur,start);
-
- tt = icaltime_as_timet(start);
-
- printf("#### %s\n",ctime(&tt ));
-
- icalrecur_iterator_free(ritr);
-
- for(ritr = icalrecur_iterator_new(recur,start),
- next = icalrecur_iterator_next(ritr);
- !icaltime_is_null_time(next);
- next = icalrecur_iterator_next(ritr)){
-
- tt = icaltime_as_timet(next);
-
- printf(" %s",ctime(&tt ));
-
- }
- icalrecur_iterator_free(ritr);
-
- icalcomponent_foreach_recurrence(itr, start, end,
- recur_callback, NULL);
-
-
-
+ fprintf(stderr,"recur: can't open file %s\n",file);
+ exit(1);
}
- icalset_free(cin);
- icaltimezone_free_builtin_timezones();
-
- icalmemory_free_ring();
+ for (itr = icalfileset_get_first_component(cin);
+ itr != 0;
+ itr = icalfileset_get_next_component(cin)){
+
+ desc = icalcomponent_get_first_property(itr,ICAL_DESCRIPTION_PROPERTY);
+ dtstart = icalcomponent_get_first_property(itr,ICAL_DTSTART_PROPERTY);
+ rrule = icalcomponent_get_first_property(itr,ICAL_RRULE_PROPERTY);
+
+ if (desc == 0 || dtstart == 0 || rrule == 0){
+ printf("\n******** Error in input component ********\n");
+ printf("The following component is malformed:\n %s\n",
+ icalcomponent_as_ical_string(itr));
+ continue;
+ }
+
+ printf("\n\n#### %s\n",icalproperty_get_description(desc));
+ printf("#### %s\n",icalvalue_as_ical_string(icalproperty_get_value(rrule)));
+ recur = icalproperty_get_rrule(rrule);
+ start = icalproperty_get_dtstart(dtstart);
- free_zone_directory();
+ ritr = icalrecur_iterator_new(recur,start);
+ tt = icaltime_as_timet(start);
+
+ printf("#### %s\n",ctime(&tt ));
+
+ for(ritr = icalrecur_iterator_new(recur,start),
+ next = icalrecur_iterator_next(ritr);
+ !icaltime_is_null_time(next);
+ next = icalrecur_iterator_next(ritr)){
+
+ tt = icaltime_as_timet(next);
+
+ printf(" %s",ctime(&tt ));
+
+ }
+
+ }
+
return 0;
}
diff --git a/libical/src/test/testclassify.c b/libical/src/test/testclassify.c
index 649d80cc58..2c6c785dfa 100644
--- a/libical/src/test/testclassify.c
+++ b/libical/src/test/testclassify.c
@@ -29,29 +29,52 @@
#include "ical.h"
#include <errno.h>
#include <string.h> /* For strerror */
-#include "icalss.h"
-
-/* Get a note about the purpose of the property*/
-const char* get_note(icalcomponent *c)
+#include "icalset.h"
+#include "icalclassify.h"
+
+
+struct class_map {
+ ical_class class;
+ char *str;
+} class_map[] = {
+ {ICAL_NO_CLASS,"No class"},
+ {ICAL_PUBLISH_NEW_CLASS,"New Publish"},
+ {ICAL_PUBLISH_UPDATE_CLASS,"Update Publish"},
+ {ICAL_REQUEST_NEW_CLASS,"New request"},
+ {ICAL_REQUEST_UPDATE_CLASS,"Update"},
+ {ICAL_REQUEST_RESCHEDULE_CLASS,"Reschedule"},
+ {ICAL_REQUEST_DELEGATE_CLASS,"Delegate"},
+ {ICAL_REQUEST_NEW_ORGANIZER_CLASS,"New Organizer"},
+ {ICAL_REQUEST_FORWARD_CLASS,"Forward"},
+ {ICAL_REQUEST_STATUS_CLASS,"Status request"},
+ {ICAL_REPLY_ACCEPT_CLASS,"Accept reply"},
+ {ICAL_REPLY_DECLINE_CLASS,"Decline reply"},
+ {ICAL_REPLY_CRASHER_ACCEPT_CLASS,"Crasher's accept reply"},
+ {ICAL_REPLY_CRASHER_DECLINE_CLASS,"Crasher's decline reply"},
+ {ICAL_ADD_INSTANCE_CLASS,"Add instance"},
+ {ICAL_CANCEL_EVENT_CLASS,"Cancel event"},
+ {ICAL_CANCEL_INSTANCE_CLASS,"Cancel instance"},
+ {ICAL_CANCEL_ALL_CLASS,"Cancel all instances"},
+ {ICAL_REFRESH_CLASS,"Refresh"},
+ {ICAL_COUNTER_CLASS,"Counter"},
+ {ICAL_DECLINECOUNTER_CLASS,"Decline counter"},
+ {ICAL_MALFORMED_CLASS,"Malformed"},
+ {ICAL_OBSOLETE_CLASS,"Obsolete"},
+ {ICAL_MISSEQUENCED_CLASS,"Missequenced"},
+ {ICAL_UNKNOWN_CLASS,"Unknown"}
+};
+
+char* find_class_string(ical_class class)
{
- icalproperty *p;
- const char* note = 0;
-
- if(c != 0){
- for(p = icalcomponent_get_first_property(c,ICAL_X_PROPERTY);
- p!= 0;
- p = icalcomponent_get_next_property(c,ICAL_X_PROPERTY)){
- if(strcmp(icalproperty_get_x_name(p),"X-LIC-NOTE")==0){
- note = icalproperty_get_x(p);
- }
- }
- }
-
- if(note == 0){
- note = "None";
+ int i;
+
+ for (i = 0;class_map[i].class != ICAL_UNKNOWN_CLASS;i++){
+ if (class_map[i].class == class){
+ return class_map[i].str;
+ }
}
-
- return note;
+
+ return "Unknown";
}
@@ -60,66 +83,71 @@ int main(int argc, char* argv[])
icalcomponent *c;
int i=0;
- /* Open up the two storage files, one for the incomming components,
- one for the calendar */
- icalset* incoming = icalset_new_file("../../test-data/incoming.ics");
+ icalset* f = icalset_new_file("../../test-data/incoming.ics");
icalset* cal = icalset_new_file("../../test-data/calendar.ics");
- assert(incoming!= 0);
+ assert(f!= 0);
assert(cal!=0);
+
- /* Iterate through all of the incoming components */
- for(c=icalset_get_first_component(incoming);c!=0;
- c=icalset_get_next_component(incoming)){
+ /* Foreach incoming message */
+ for(c=icalset_get_first_component(f);c!=0;
+ c=icalset_get_next_component(f)){
- icalproperty_xlicclass class;
- icalcomponent *match = 0;
- const char* this_uid;
+ ical_class class;
+ icalcomponent *match;
+ icalcomponent *inner = icalcomponent_get_first_real_component(c);
+ icalcomponent *p;
+ const char *this_uid;
+ const char *i_x_note=0;
+ const char *c_x_note=0;
i++;
- /* Check this component against the restrictions imposed by
- iTIP. An errors will be inserted as X-LIC-ERROR properties
- in the component. The Parser will also insert errors if it
- cannot parse the component */
- icalcomponent_check_restrictions(c);
-
- /* If there are any errors, print out the component */
- if(icalcomponent_count_errors(c) != 0){
- printf("----- Component has errors ------- \n%s-----------------\n",
- icalcomponent_as_ical_string(c));
- }
-
- /* Use one of the icalcomponent convenience routines to get
- the UID. This routine will save you from having to use
- icalcomponent_get_inner(),
- icalcomponent_get_first_property(), checking the return
- value, and then calling icalproperty_get_uid. There are
- several other convenience routines for DTSTART, DTEND,
- DURATION, SUMMARY, METHOD, and COMMENT */
- this_uid = icalcomponent_get_uid(c);
-
- if(this_uid != 0){
- /* Look in the calendar for a component with the same UID
- as the incomming component. We should reall also be
- checking the RECURRENCE-ID. Another way to do this
- operation is to us icalset_find_match(), which does use
- the RECURRENCE-ID. */
- match = icalset_fetch(cal,this_uid);
- }
-
-
- /* Classify the incoming component. The third argument is the
- calid of the user who owns the calendar. In a real program,
- you would probably switch() on the class.*/
+ if(inner == 0){
+ continue;
+ }
+
+ p = icalcomponent_get_first_property(inner,ICAL_UID_PROPERTY);
+ this_uid = icalproperty_get_uid(p);
+
+ assert(this_uid != 0);
+
+ /* Find a booked component that is matched to the incoming
+ message, based on the incoming component's UID, SEQUENCE
+ and RECURRENCE-ID*/
+
+ match = icalset_fetch(cal,this_uid);
+
class = icalclassify(c,match,"A@example.com");
- printf("Test %d\n\
-Incoming: %s\n\
-Matched: %s\n\
-Classification: %s\n\n",
- i,get_note(c),get_note(match),
- icalproperty_enum_to_string(class));
+ for(p = icalcomponent_get_first_property(c,ICAL_X_PROPERTY);
+ p!= 0;
+ p = icalcomponent_get_next_property(c,ICAL_X_PROPERTY)){
+ if(strcmp(icalproperty_get_x_name(p),"X-LIC-NOTE")==0){
+ i_x_note = icalproperty_get_x(p);
+ }
+ }
+
+
+ if(i_x_note == 0){
+ i_x_note = "None";
+ }
+
+ for(p = icalcomponent_get_first_property(match,ICAL_X_PROPERTY);
+ p!= 0;
+ p = icalcomponent_get_next_property(match,ICAL_X_PROPERTY)){
+ if(strcmp(icalproperty_get_x_name(p),"X-LIC-NOTE")==0){
+ c_x_note = icalproperty_get_x(p);
+ }
+ }
+
+ if(c_x_note == 0){
+ c_x_note = "None";
+ }
+
+
+ printf("Test %d\nIncoming: %s\nMatched: %s\nClassification: %s\n\n",i,i_x_note,c_x_note,find_class_string(class));
}
return 0;
diff --git a/libical/src/test/testmime.c b/libical/src/test/testmime.c
index cdb47d88dc..5dfc3b7d31 100644
--- a/libical/src/test/testmime.c
+++ b/libical/src/test/testmime.c
@@ -34,7 +34,8 @@
======================================================================*/
#include "ical.h"
-
+#include "sspm.h"
+#include "icalmime.h"
#include <stdlib.h> /* For rand */
#include <string.h> /* for strrchr, strdup*/
#include <unistd.h> /* for getopt */
@@ -264,7 +265,7 @@ int main(int argc, char* argv[]) {
d.pos = 0;
d.str = buf;
- c = icalmime_parse(icalparser_string_line_generator,&d);
+ c = icalmime_parse(string_line_generator,&d);
printf("%s\n",icalcomponent_as_ical_string(c));
diff --git a/libical/test-data/calendar.ics b/libical/test-data/calendar.ics
index 417ce5079b..63b0a93838 100644
--- a/libical/test-data/calendar.ics
+++ b/libical/test-data/calendar.ics
@@ -1,7 +1,7 @@
BEGIN:VCALENDAR
PRODID:-//ACME/DesktopCalendar//EN
METHOD:CREATE
-X-LIC-NOTE: #C1. Rescheduled by #I2\ and updated by #I3
+X-LIC-NOTE: #C1. Rescheduled by #I1\ and updated by #I2
VERSION:2.0
BEGIN:VEVENT
ORGANIZER:Mailto:B@example.com
@@ -13,7 +13,7 @@ ATTENDEE;RSVP=FALSE;CUTYPE=ROOM:conf_Big@example.com
ATTENDEE;ROLE=NON-PARTICIPANT;RSVP=FALSE:Mailto:E@example.com
DTSTAMP:19970611T190000Z
DTSTART:19970701T190000Z
-DTEND:19970701T193000Z
+DTEND:19970701T1930000Z
SUMMARY:Conference
UID:calsrv.example.com-873970198738777@example.com
SEQUENCE:1
@@ -45,19 +45,3 @@ STATUS:CONFIRMED
END:VEVENT
END:VCALENDAR
-BEGIN:VCALENDAR
-PRODID:-//ACME/DesktopCalendar//EN
-METHOD:CREATED
-X-LIC-NOTE: #C3. Publish
-VERSION:2.0
-BEGIN:VEVENT
-ORGANIZER:Mailto:B@example.com
-DTSTAMP:19970610T190000Z
-DTSTART:19970701T100000Z
-DTEND:19970701T1100000Z
-SUMMARY:Conference
-UID:calsrv.example.com-1002@example.com
-STATUS:CONFIRMED
-SEQUENCE:2
-END:VEVENT
-END:VCALENDAR
diff --git a/libical/test-data/incoming.ics b/libical/test-data/incoming.ics
index dd77861ad4..c598dfa6bf 100644
--- a/libical/test-data/incoming.ics
+++ b/libical/test-data/incoming.ics
@@ -1,32 +1,7 @@
BEGIN:VCALENDAR
PRODID:-//ACME/DesktopCalendar//EN
METHOD:REQUEST
-X-LIC-NOTE:#I1. New Request
-X-LIC-EXPECT:REQUEST-NEW
-VERSION:2.0
-BEGIN:VEVENT
-ORGANIZER:Mailto:B@example.com
-ATTENDEE;ROLE=CHAIR;PARTSTAT=ACCEPTED;CN=BIG A:Mailto:A@example.com
-ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL;CN=B:Mailto:B@example.com
-ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL;CN=C:Mailto:C@example.com
-ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL;CN=Hal:Mailto:D@example.com
-ATTENDEE;RSVP=FALSE;CUTYPE=ROOM:conf_Big@example.com
-ATTENDEE;ROLE=NON-PARTICIPANT;RSVP=FALSE:Mailto:E@example.com
-DTSTAMP:19970610T190000Z
-DTSTART:19970701T100000Z
-DTEND:19970701T10300Z
-SUMMARY:Conference
-UID:calsrv.example.com-873970198738776@example.com
-SEQUENCE:2
-STATUS:CONFIRMED
-END:VEVENT
-END:VCALENDAR
-
-BEGIN:VCALENDAR
-PRODID:-//ACME/DesktopCalendar//EN
-METHOD:REQUEST
-X-LIC-NOTE:#I2. Reschedules C1
-X-LIC-EXPECT:REQUEST-RESCHEDULE
+X-LIC-NOTE: #I1. Reschedules C1
VERSION:2.0
BEGIN:VEVENT
ORGANIZER:Mailto:B@example.com
@@ -38,7 +13,7 @@ ATTENDEE;RSVP=FALSE;CUTYPE=ROOM:conf_Big@example.com
ATTENDEE;ROLE=NON-PARTICIPANT;RSVP=FALSE:Mailto:E@example.com
DTSTAMP:19970611T190000Z
DTSTART:19970701T200000Z
-DTEND:19970701T200000Z
+DTEND:19970701T2000000Z
SUMMARY:Conference
UID:calsrv.example.com-873970198738777@example.com
SEQUENCE:2
@@ -49,8 +24,7 @@ END:VCALENDAR
BEGIN:VCALENDAR
PRODID:-//ACME/DesktopCalendar//EN
METHOD:REQUEST
-X-LIC-NOTE:#I3. Updates C1
-X-LIC-EXPECT:REQUEST-UPDATE
+X-LIC-NOTE: #I2. Updates C1
VERSION:2.0
BEGIN:VEVENT
ORGANIZER:Mailto:B@example.com
@@ -62,7 +36,7 @@ ATTENDEE;RSVP=FALSE;CUTYPE=ROOM:conf_Big@example.com
ATTENDEE;ROLE=NON-PARTICIPANT;RSVP=FALSE:Mailto:E@example.com
DTSTAMP:19970611T193000Z
DTSTART:19970701T190000Z
-DTEND:19970701T193000Z
+DTEND:19970701T1930000Z
SUMMARY: Pool party
UID:calsrv.example.com-873970198738777@example.com
SEQUENCE:2
@@ -73,8 +47,7 @@ END:VCALENDAR
BEGIN:VCALENDAR
PRODID:-//ACME/DesktopCalendar//EN
METHOD:REQUEST
-X-LIC-NOTE:#I4: This is an obsolete request\, otherwise identical to #I1
-X-LIC-EXPECT:OBSOLETE
+X-LIC-NOTE: #I2: This is an obsolete request\, otherwise identical to #I1
VERSION:2.0
BEGIN:VEVENT
ORGANIZER:Mailto:B@example.com
@@ -98,8 +71,7 @@ END:VCALENDAR
BEGIN:VCALENDAR
PRODID:-//ACME/DesktopCalendar//EN
METHOD:REPLY
-X-LIC-NOTE:#I5: User B is accepting A's request\, #C2
-X-LIC-EXPECT:REPLY-ACCEPT
+X-LIC-NOTE: #I3: User B is accepting A's request\, #C2
VERSION:2.0
BEGIN:VEVENT
ATTENDEE;PARTSTAT=ACCEPTED:Mailto:B@example.com
@@ -114,47 +86,7 @@ END:VCALENDAR
BEGIN:VCALENDAR
PRODID:-//ACME/DesktopCalendar//EN
METHOD:REPLY
-X-LIC-NOTE:#I6: User B's reply delegating to C\, #C2
-X-LIC-EXPECT:REPLY-DELEGATE
-VERSION:2.0
-BEGIN:VEVENT
-ATTENDEE;PARTSTAT=DELEGATED;DELEGATED-TO="Mailto:C@example.com"
- :Mailto:B@example.com
-ORGANIZER:MAILTO:A@example.com
-UID:calsrv.example.com-873970198738785@example.com
-SEQUENCE:1
-REQUEST-STATUS:2.0;Success
-DTSTAMP:19970612T190000Z
-END:VEVENT
-END:VCALENDAR
-
-BEGIN:VCALENDAR
-PRODID:-//ACME/DesktopCalendar//EN
-METHOD:REQUEST
-X-LIC-NOTE:#I7: User C's delegation to A\, new event
-X-LIC-EXPECT:REQUEST-DELEGATE
-VERSION:2.0
-BEGIN:VEVENT
-ORGANIZER:Mailto:B@example.com
-ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL;CN=C;DELEGATED-TO="Mailto:A@example.com"
- :Mailto:C@example.com
-ATTENDEE;RSVP=TRUE;CUTYPE=INDIVIDUAL;CN=A;DELEGATED-FROM="Mailto:C@example.com"
- :Mailto:A@example.com
-DTSTAMP:19970611T190000Z
-DTSTART:19970701T190000Z
-DTEND:19970701T193000Z
-SUMMARY:Conference
-UID:calsrv.example.com-873970198738779@example.com
-SEQUENCE:2
-STATUS:CONFIRMED
-END:VEVENT
-END:VCALENDAR
-
-BEGIN:VCALENDAR
-PRODID:-//ACME/DesktopCalendar//EN
-METHOD:REPLY
-X-LIC-NOTE:#I8: User C is rejecting A's request\, #C2
-X-LIC-EXPECT:REPLY-DECLINE
+X-LIC-NOTE: #I4: User C is rejecting A's request\, #C2
VERSION:2.0
BEGIN:VEVENT
ATTENDEE;PARTSTAT=DECLINED:Mailto:C@example.com
@@ -169,8 +101,7 @@ END:VCALENDAR
BEGIN:VCALENDAR
PRODID:-//ACME/DesktopCalendar//EN
METHOD:REPLY
-X-LIC-NOTE:#I9: Crasher X is accepting A's request\, #C2
-X-LIC-EXPECT:REPLY-CRASHER-ACCEPT
+X-LIC-NOTE: #I5: Crasher X is accepting A's request\, #C2
VERSION:2.0
BEGIN:VEVENT
ATTENDEE;PARTSTAT=ACCEPTED:Mailto:X@example.com
@@ -185,8 +116,7 @@ END:VCALENDAR
BEGIN:VCALENDAR
PRODID:-//ACME/DesktopCalendar//EN
METHOD:REPLY
-X-LIC-NOTE:#I10: Crasher Y is declining A's request\, #C2
-X-LIC-EXPECT:REPLY-CRASHER-DECLINE
+X-LIC-NOTE: #I6: Crasher Y is declining A's request\, #C2
VERSION:2.0
BEGIN:VEVENT
ATTENDEE;PARTSTAT=DECLINED:Mailto:Y@example.com
@@ -201,8 +131,7 @@ END:VCALENDAR
BEGIN:VCALENDAR
PRODID:-//ACME/DesktopCalendar//EN
METHOD:CANCEL
-X-LIC-NOTE:#I11: Cancel #c1
-X-LIC-EXPECT:CANCEL-EVENT
+X-LIC-NOTE: #I7: Cancel #c1
VERSION:2.0
BEGIN:VEVENT
ORGANIZER:Mailto:B@example.com
@@ -213,6 +142,7 @@ ATTENDEE;CUTYPE=INDIVIDUAL:Mailto:D@example.com
COMMENT:Mr. B cannot attend. It's raining. Lets cancel.
UID:calsrv.example.com-873970198738777@example.com
SEQUENCE:1
+UID:calsrv.example.com-873970198738777@example.com
STATUS:CANCELLED
DTSTAMP:19970613T190000Z
END:VEVENT
@@ -221,8 +151,7 @@ END:VCALENDAR
BEGIN:VCALENDAR
PRODID:-//ACME/DesktopCalendar//EN
METHOD:COUNTER
-X-LIC-NOTE:#I12. Counter to #C1. Changed DTEND to DURATION.
-X-LIC-EXPECT:COUNTER
+X-LIC-NOTE: #I8. Counter to #C1. Changed DTEND to DURATION.
VERSION:2.0
BEGIN:VEVENT
DTSTAMP:19970611T190000Z
@@ -237,58 +166,3 @@ SEQUENCE:1
END:VEVENT
END:VCALENDAR
-BEGIN:VCALENDAR
-PRODID:-//ACME/DesktopCalendar//EN
-METHOD:PUBLISH
-X-LIC-NOTE:#I13. New Publish
-X-LIC-EXPECT:PUBLISH-UPDATE
-VERSION:2.0
-BEGIN:VEVENT
-ORGANIZER:Mailto:B@example.com
-DTSTAMP:19970610T190000Z
-DTSTART:19970701T100000Z
-DTEND:19970701T103000Z
-SUMMARY:Conference
-UID:calsrv.example.com-1001@example.com
-STATUS:CONFIRMED
-END:VEVENT
-END:VCALENDAR
-
-BEGIN:VCALENDAR
-PRODID:-//ACME/DesktopCalendar//EN
-METHOD:PUBLISH
-X-LIC-NOTE:#I14. Publish Update
-X-LIC-EXPECT:PUBLISH-UPDATE
-VERSION:2.0
-BEGIN:VEVENT
-ORGANIZER:Mailto:B@example.com
-DTSTAMP:19970610T190000Z
-DTSTART:19970701T100000Z
-DTEND:19970701T110000Z
-SUMMARY:Conference
-UID:calsrv.example.com-1002@example.com
-STATUS:CONFIRMED
-SEQUENCE:2
-END:VEVENT
-END:VCALENDAR
-
-BEGIN:VCALENDAR
-PRODID:-//ACME/DesktopCalendar//EN
-VERSION:2.0
-METHOD:PUBLISH
-X-LIC-NOTE:#I15. Publish VFREEBUSY
-X-LIC-EXPECT:PUBLISH-FREEBUSY
-BEGIN:VFREEBUSY
-DTSTAMP:19980101T124100Z
-ORGANIZER:MAILTO:A@Example.com
-DTSTART:19980101T124200Z
-DTEND:19980107T124200Z
-FREEBUSY:19980101T180000Z/19980101T190000Z
-FREEBUSY:19980103T020000Z/19980103T050000Z
-FREEBUSY:19980107T020000Z/19980107T050000Z
-FREEBUSY:19980113T000000Z/19980113T010000Z
-FREEBUSY:19980115T190000Z/19980115T200000Z
-FREEBUSY:19980115T220000Z/19980115T230000Z
-FREEBUSY:19980116T013000Z/19980116T043000Z
-END:VFREEBUSY
-END:VCALENDAR
diff --git a/libical/test-data/recur.txt b/libical/test-data/recur.txt
index e1b00a65a2..f158a2a96b 100644
--- a/libical/test-data/recur.txt
+++ b/libical/test-data/recur.txt
@@ -1,261 +1,121 @@
-BEGIN:VEVENT
-DESCRIPTION
- :Repeat every tuesday and wednesday starting Tue 2nd April 2002
-RRULE
- :FREQ=WEEKLY;INTERVAL=1;COUNT=6;BYDAY=TU,WE
-DTSTART
- :20020402T114500
-DTEND
- :20020402T124500
-X-EXPECT-NUMEVENTS: 6
-END:VEVENT
-
-BEGIN:VEVENT
-DESCRIPTION
- :Repeat every thursday starting Tue 2nd April 2002
-RRULE
- :FREQ=WEEKLY;INTERVAL=1;COUNT=6;BYDAY=TH
-DTSTART
- :20020402T114500
-DTEND
- :20020402T124500
-X-EXPECT-NUMEVENTS: 7
-END:VEVENT
-
-
-BEGIN:VEVENT
-DESCRIPTION
- :Every year on the same day\, forever
-RRULE
- :FREQ=YEARLY;INTERVAL=1
-DTSTART
- :19990201T172000
-DTEND
- :19990201T182000
-X-EXPECT-NUMEVENTS: 39
-END:VEVENT
-
-BEGIN:VEVENT
-DESCRIPTION
- :Monday of week number 20 (where the default start of the week is Monday)\,
- forever:
-DTSTART
- ;TZID=America/Los_Angeles
- :19970512T090000
-RRULE
- :FREQ=YEARLY;INTERVAL=1;COUNT=10;BYDAY=MO;BYWEEKNO=20
-X-EXPECT-NUMEVENTS: 11
-END:VEVENT
-
-
-BEGIN:VEVENT
-DESCRIPTION
- : Once a Year
-DTSTART
- ;TZID=America/Los_Angeles
- :20010205T090000
-RRULE
- :FREQ=YEARLY;INTERVAL=1
-X-EXPECT-NUMEVENTS: 37
-END:VEVENT
-
-BEGIN:VEVENT
-DESCRIPTION
- :Recur every sunday and tuesday
-RRULE
- :FREQ=WEEKLY;COUNT=10;INTERVAL=1;BYDAY=SU,TU
-DTSTART
- :20011216T192500
-DTEND
- :20011216T202500
-X-EXPECT-NUMEVENTS: 10
-END:VEVENT
-
-BEGIN:VEVENT
-DESCRIPTION
- :Every first tuesday of the month
-RRULE
- :FREQ=MONTHLY;INTERVAL=1;COUNT=3;BYDAY=1TU
-DTSTART
- :20011204T153500
-DTEND
- :20011204T163500
-X-EXPECT-NUMEVENTS: 3
-END:VEVENT
-
BEGIN:VEVENT
DESCRIPTION
:Daily for 10 occurrences:
DTSTART
- ;TZID=America/Los_Angeles
+ ;TZID=US-Eastern
:19970902T090000
RRULE
:FREQ=DAILY;COUNT=10;INTERVAL=1
-X-EXPECT-NUMEVENTS: 10
END:VEVENT
BEGIN:VEVENT
DESCRIPTION
:Daily until December 24\, 1997:
DTSTART
- ;TZID=America/Los_Angeles
+ ;TZID=US-Eastern
:19971215T090000
RRULE
:FREQ=DAILY;UNTIL=19971224T000000Z;INTERVAL=1
-X-EXPECT-NUMEVENTS: 9
END:VEVENT
BEGIN:VEVENT
DESCRIPTION
:Every other day - forever:
DTSTART
- ;TZID=America/Los_Angeles
+ ;TZID=US-Eastern
:19970902T090000
RRULE
:FREQ=DAILY;COUNT=10;INTERVAL=2
-X-EXPECT-NUMEVENTS: 10
END:VEVENT
BEGIN:VEVENT
DESCRIPTION
:Every 10 days\, 5 occurrences:
DTSTART
- ;TZID=America/Los_Angeles
+ ;TZID=US-Eastern
:19970902T090000
RRULE
:FREQ=DAILY;COUNT=5;INTERVAL=10
-X-EXPECT-NUMEVENTS: 5
END:VEVENT
BEGIN:VEVENT
DESCRIPTION
:Daily for 10 occurrences:
DTSTART
- ;TZID=America/Los_Angeles
+ ;TZID=US-Eastern
:19970902T090000
RRULE
:FREQ=DAILY;COUNT=10;INTERVAL=1
-X-EXPECT-NUMEVENTS: 10
END:VEVENT
BEGIN:VEVENT
DESCRIPTION
:Every day in January\, for 3 years
DTSTART
- ;TZID=America/Los_Angeles
+ ;TZID=US-Eastern
:19980101T090000
RRULE
:FREQ=YEARLY;UNTIL=20000131T090000Z;INTERVAL=1;BYDAY=SU,MO,TU,WE,TH,FR,SA;BYMONTH=1
-X-EXPECT-NUMEVENTS: 93
END:VEVENT
BEGIN:VEVENT
DESCRIPTION
:Everyday in January\, for 3 years:
DTSTART
- ;TZID=America/Los_Angeles
+ ;TZID=US-Eastern
:19980101T090000
RRULE
- :FREQ=DAILY;UNTIL=20000131T170000Z;INTERVAL=1;BYMONTH=1
-X-EXPECT-NUMEVENTS: 93
-END:VEVENT
-
-BEGIN:VEVENT
-DESCRIPTION
- :Repeat every tuesday and wednesday starting Tue 2nd April 2002
-RRULE
- :FREQ=WEEKLY;INTERVAL=1;COUNT=6;BYDAY=TU,WE
-DTSTART
- :20020402T114500
-DTEND
- :20020402T124500
-X-EXPECT-NUMEVENTS: 6
-END:VEVENT
-
-BEGIN:VEVENT
-DESCRIPTION
- :Every Day start the first day in January\, except saturday and sunday. This should be up to March.
-RRULE
- :FREQ=DAILY;COUNT=50;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR
-DTSTART
- :20020101T090000Z
-X-EXPECT-NUMEVENTS: 50
-END:VEVENT
-
-BEGIN:VEVENT
-DESCRIPTION
- :Every Day in January\, but only in Tuesday\, Wednesday and Thursday
-RRULE
- :FREQ=DAILY;UNTIL=20020120T090000Z;INTERVAL=1;BYDAY=TU,WE,TH
-DTSTART
- :20020101T090000Z
-X-EXPECT-NUMEVENTS: 9
+ :FREQ=DAILY;UNTIL=20000131T090000Z;INTERVAL=1;BYMONTH=1
END:VEVENT
BEGIN:VEVENT
DESCRIPTION
- :Every Day in January\, except saturday and sunday. This is MS Outlook every weekday case.
-RRULE
- :FREQ=DAILY;UNTIL=20020120T090000Z;INTERVAL=1;BYDAY=MO,TU,WE,TH,FR;WKST=SU
-DTSTART
- :20020101T090000Z
-X-EXPECT-NUMEVENTS: 14
-END:VEVENT
-
-
-BEGIN:VEVENT
-DESCRIPTION
:Weekly for 10 occurrences
DTSTART
- ;TZID=America/Los_Angeles
+ ;TZID=US-Eastern
:19970902T090000
RRULE
:FREQ=WEEKLY;COUNT=10;INTERVAL=1
-X-EXPECT-NUMEVENTS: 10
END:VEVENT
BEGIN:VEVENT
DESCRIPTION
:Weekly until December 24\, 1997
DTSTART
- ;TZID=America/Los_Angeles
+ ;TZID=US-Eastern
:19970902T090000
RRULE
:FREQ=WEEKLY;UNTIL=19971224T000000Z;INTERVAL=1
-X-EXPECT-NUMEVENTS: 17
END:VEVENT
BEGIN:VEVENT
DESCRIPTION
- :Every other week - 10 times:
+ :Every other week - forever:
DTSTART
- ;TZID=America/Los_Angeles
+ ;TZID=US-Eastern
:19970902T090000
RRULE
:FREQ=WEEKLY;INTERVAL=2;COUNT=10
-X-EXPECT-NUMEVENTS: 10
END:VEVENT
BEGIN:VEVENT
DESCRIPTION
:Weekly on Tuesday and Thursday for 5 weeks:
DTSTART
- ;TZID=America/Los_Angeles
+ ;TZID=US-Eastern
:19970902T090000
RRULE
:FREQ=WEEKLY;UNTIL=19971007T000000Z;INTERVAL=1;BYDAY=TU,TH
-X-EXPECT-NUMEVENTS: 10
END:VEVENT
BEGIN:VEVENT
DESCRIPTION
:Weekly on Tuesday and Thursday for 5 weeks:
DTSTART
- ;TZID=America/Los_Angeles
+ ;TZID=US-Eastern
:19970902T090000
RRULE
:FREQ=WEEKLY;COUNT=10;INTERVAL=1;BYDAY=TU,TH
-X-EXPECT-NUMEVENTS: 10
END:VEVENT
BEGIN:VEVENT
@@ -263,224 +123,186 @@ DESCRIPTION
:Every other week on Monday\, Wednesday and Friday until December
24\,1997\, but starting on Tuesday\, September 2\, 1997:
DTSTART
- ;TZID=America/Los_Angeles
+ ;TZID=US-Eastern
:19970902T090000
RRULE
:FREQ=WEEKLY;INTERVAL=2;UNTIL=19971224T000000Z;BYDAY=MO,WE,FR;WKST=SU
-X-EXPECT-NUMEVENTS: 25
END:VEVENT
BEGIN:VEVENT
DESCRIPTION
:Every other week on Tuesday and Thursday\, for 8 occurrences:
DTSTART
- ;TZID=America/Los_Angeles
+ ;TZID=US-Eastern
:19970902T090000
RRULE
:FREQ=WEEKLY;COUNT=8;INTERVAL=2;BYDAY=TU,TH
-X-EXPECT-NUMEVENTS: 8
END:VEVENT
-
-
BEGIN:VEVENT
DESCRIPTION
:Monthly on the 1st Friday for ten occurrences:
DTSTART
- ;TZID=America/Los_Angeles
+ ;TZID=US-Eastern
:19970905T090000
RRULE
:FREQ=MONTHLY;COUNT=10;INTERVAL=1;BYDAY=FR
-X-EXPECT-NUMEVENTS: 10
END:VEVENT
-
BEGIN:VEVENT
DESCRIPTION
:Monthly on the 1st Friday until December 24\, 1997:
DTSTART
- ;TZID=America/Los_Angeles
+ ;TZID=US-Eastern
:19970905T090000
RRULE
:FREQ=MONTHLY;UNTIL=19971224T000000Z;INTERVAL=1;BYDAY=1FR
-X-EXPECT-NUMEVENTS: 4
END:VEVENT
-
BEGIN:VEVENT
DESCRIPTION
:Every other month on the 1st and last Sunday of the month for 10 occurrences
:
DTSTART
- ;TZID=America/Los_Angeles
+ ;TZID=US-Eastern
:19970907T090000
RRULE
:FREQ=MONTHLY;INTERVAL=2;COUNT=10;BYDAY=1SU,-1SU
-X-EXPECT-NUMEVENTS: 10
END:VEVENT
-
BEGIN:VEVENT
DESCRIPTION
:Monthly on the second to last Monday of the month for 6 months:
DTSTART
- ;TZID=America/Los_Angeles
+ ;TZID=US-Eastern
:19970922T090000
RRULE
:FREQ=MONTHLY;COUNT=6;INTERVAL=1;BYDAY=-2MO
-X-EXPECT-NUMEVENTS: 6
END:VEVENT
-
BEGIN:VEVENT
DESCRIPTION
:Monthly on the third to the last day of the month\, forever:
DTSTART
- ;TZID=America/Los_Angeles
+ ;TZID=US-Eastern
:19970928T090000
RRULE
:FREQ=MONTHLY;INTERVAL=1;COUNT=10;BYMONTHDAY=-3
-X-EXPECT-NUMEVENTS: 10
END:VEVENT
-
BEGIN:VEVENT
DESCRIPTION
:Monthly on the 2nd and 15th of the month for 10 occurrences:
DTSTART
- ;TZID=America/Los_Angeles
+ ;TZID=US-Eastern
:19970902T090000
RRULE
:FREQ=MONTHLY;COUNT=10;INTERVAL=1;BYMONTHDAY=2,15
-X-EXPECT-NUMEVENTS: 10
END:VEVENT
-
BEGIN:VEVENT
DESCRIPTION
:Monthly on the first and last day of the month for 10 occurrences:\n
DTSTART
- ;TZID=America/Los_Angeles
+ ;TZID=US-Eastern
:19970930T090000
RRULE
:FREQ=MONTHLY;COUNT=10;INTERVAL=1;BYMONTHDAY=1,-1
-X-EXPECT-NUMEVENTS: 10
END:VEVENT
-
BEGIN:VEVENT
DESCRIPTION
:Every 18 months on the 10th thru 15th of the month for 10 occurrences:
DTSTART
- ;TZID=America/Los_Angeles
+ ;TZID=US-Eastern
:19970910T090000
RRULE
:FREQ=MONTHLY;COUNT=10;INTERVAL=18;BYMONTHDAY=10,11,12,13,14,15
-X-EXPECT-NUMEVENTS: 10
END:VEVENT
-
BEGIN:VEVENT
DESCRIPTION
:Every Tuesday\, every other month:
DTSTART
- ;TZID=America/Los_Angeles
+ ;TZID=US-Eastern
:19970902T090000
RRULE
:FREQ=MONTHLY;INTERVAL=2;COUNT=10;BYDAY=TU
-X-EXPECT-NUMEVENTS: 10
END:VEVENT
-
BEGIN:VEVENT
DESCRIPTION
:Yearly in June and July for 10 occurrences:
DTSTART
- ;TZID=America/Los_Angeles
+ ;TZID=US-Eastern
:19970610T090000
RRULE
:FREQ=YEARLY;COUNT=10;INTERVAL=1;BYMONTH=6,7
-X-EXPECT-NUMEVENTS: 10
END:VEVENT
-
BEGIN:VEVENT
DESCRIPTION
:Every other year on January\, February\, and March for 10 occurrences:
DTSTART
- ;TZID=America/Los_Angeles
+ ;TZID=US-Eastern
:19970310T090000
RRULE
:FREQ=YEARLY;COUNT=10;INTERVAL=2;BYMONTH=1,2,3
-X-EXPECT-NUMEVENTS: 10
END:VEVENT
-
BEGIN:VEVENT
DESCRIPTION
:Every 3rd year on the 1st\, 100th and 200th day for 10 occurrences:
DTSTART
- ;TZID=America/Los_Angeles
+ ;TZID=US-Eastern
:19970101T090000
RRULE
:FREQ=YEARLY;COUNT=10;INTERVAL=3;BYYEARDAY=1,100,200
-X-EXPECT-NUMEVENTS: 10
END:VEVENT
-
BEGIN:VEVENT
DESCRIPTION
:Every 20th Monday of the year\, forever:
DTSTART
- ;TZID=America/Los_Angeles
+ ;TZID=US-Eastern
:19970519T090000
RRULE
:FREQ=YEARLY;INTERVAL=1;COUNT=10;BYDAY=20MO
-X-EXPECT-NUMEVENTS: 10
END:VEVENT
-
BEGIN:VEVENT
DESCRIPTION
:Monday of week number 20 (where the default start of the week is Monday)\,
forever:
DTSTART
- ;TZID=America/Los_Angeles
+ ;TZID=US-Eastern
:19970512T090000
RRULE
:FREQ=YEARLY;INTERVAL=1;COUNT=10;BYDAY=MO;BYWEEKNO=20
-X-EXPECT-NUMEVENTS: 11
END:VEVENT
-
-
BEGIN:VEVENT
DESCRIPTION
:Every Thursday in March\, forever:
DTSTART
- ;TZID=America/Los_Angeles
+ ;TZID=US-Eastern
:19970313T090000
RRULE
:FREQ=YEARLY;INTERVAL=1;COUNT=10;BYDAY=TH;BYMONTH=3
-X-EXPECT-NUMEVENTS: 10
END:VEVENT
-
BEGIN:VEVENT
DESCRIPTION
:Every Thursday\, but only during June\, July\, and August\, forever:
DTSTART
- ;TZID=America/Los_Angeles
+ ;TZID=US-Eastern
:19970605T090000
RRULE
:FREQ=YEARLY;INTERVAL=1;COUNT=10;BYDAY=TH;BYMONTH=6,7,8
-X-EXPECT-NUMEVENTS: 10
END:VEVENT
BEGIN:VEVENT
DESCRIPTION
:Every Friday the 13th\, forever:
DTSTART
- ;TZID=America/Los_Angeles
+ ;TZID=US-Eastern
:19970902T090000
RRULE
:FREQ=MONTHLY;INTERVAL=1;COUNT=10;BYDAY=FR;BYMONTHDAY=13
-X-EXPECT-NUMEVENTS: 10
END:VEVENT
BEGIN:VEVENT
DESCRIPTION
:The first Saturday that follows the first Sunday of the month\,
DTSTART
- ;TZID=America/Los_Angeles
+ ;TZID=US-Eastern
:19970913T090000
RRULE
:FREQ=MONTHLY;INTERVAL=1;COUNT=10;BYDAY=SA;BYMONTHDAY=7,8,9,10,11,12,13
-X-EXPECT-NUMEVENTS: 10
END:VEVENT
BEGIN:VEVENT
@@ -488,11 +310,10 @@ DESCRIPTION
:Every four years\, the first Tuesday after a Monday in November\,
forever (U.S. Presidential Election day):
DTSTART
- ;TZID=America/Los_Angeles
+ ;TZID=US-Eastern
:19961105T090000
RRULE
:FREQ=YEARLY;INTERVAL=4;COUNT=10;BYDAY=TU;BYMONTHDAY=2,3,4,5,6,7,8;BYMONTH=11
-X-EXPECT-NUMEVENTS: 10
END:VEVENT
BEGIN:VEVENT
@@ -500,145 +321,84 @@ DESCRIPTION
:The 3rd instance into the month of one of Tuesday\, Wednesday or
Thursday\, for the next 3 months:
DTSTART
- ;TZID=America/Los_Angeles
+ ;TZID=US-Eastern
:19970904T090000
RRULE
:FREQ=MONTHLY;COUNT=3;INTERVAL=1;BYDAY=TU,WE,TH;BYSETPOS=3
-X-EXPECT-NUMEVENTS: 3
END:VEVENT
BEGIN:VEVENT
DESCRIPTION
:The 2nd to last weekday of the month:
DTSTART
- ;TZID=America/Los_Angeles
+ ;TZID=US-Eastern
:19970929T090000
RRULE
:FREQ=MONTHLY;INTERVAL=1;COUNT=10;BYDAY=MO,TU,WE,TH,FR;BYSETPOS=-2
-X-EXPECT-NUMEVENTS: 10
END:VEVENT
-
BEGIN:VEVENT
DESCRIPTION
:Every 3 hours from 9:00 AM to 5:00 PM on a specific day:
DTSTART
- :19970902T090000Z
+ ;TZID=US-Eastern
+ :19970902T090000
RRULE
:FREQ=HOURLY;UNTIL=19970902T170000Z;INTERVAL=3
-X-EXPECT-NUMEVENTS: 3
END:VEVENT
-
BEGIN:VEVENT
DESCRIPTION
:Every 15 minutes for 6 occurrences:
DTSTART
- ;TZID=America/Los_Angeles
+ ;TZID=US-Eastern
:19970902T090000
RRULE
:FREQ=MINUTELY;COUNT=6;INTERVAL=15
-X-EXPECT-NUMEVENTS: 6
END:VEVENT
-
BEGIN:VEVENT
DESCRIPTION
:Every hour and a half for 4 occurrences:
DTSTART
- ;TZID=America/Los_Angeles
+ ;TZID=US-Eastern
:19970902T090000
RRULE
:FREQ=MINUTELY;COUNT=4;INTERVAL=90
-X-EXPECT-NUMEVENTS: 4
END:VEVENT
-
BEGIN:VEVENT
DESCRIPTION
:Every 20 minutes from 9:00 AM to 4:40 PM every day:
DTSTART
- ;TZID=America/Los_Angeles
+ ;TZID=US-Eastern
:19970902T090000
RRULE
:FREQ=DAILY;COUNT=20;INTERVAL=1;BYMINUTE=0,20,40;BYHOUR=9,10,11,12,13,14,15,16
-X-EXPECT-NUMEVENTS: 20
END:VEVENT
-
BEGIN:VEVENT
DESCRIPTION
:Every 20 minutes from 9:00 AM to 4:40 PM every day:
DTSTART
- ;TZID=America/Los_Angeles
+ ;TZID=US-Eastern
:19970902T090000
RRULE
:FREQ=MINUTELY;COUNT=20;INTERVAL=20;BYHOUR=9,10,11,12,13,14,15,16
-X-EXPECT-NUMEVENTS: 20
END:VEVENT
-
BEGIN:VEVENT
DESCRIPTION
:An example where the days generated makes a difference because of
WKST:
DTSTART
- ;TZID=America/Los_Angeles
+ ;TZID=US-Eastern
:19970805T090000
RRULE
:FREQ=WEEKLY;COUNT=4;INTERVAL=2;BYDAY=TU,SU
-X-EXPECT-NUMEVENTS: 4
END:VEVENT
-
BEGIN:VEVENT
DESCRIPTION
:An example where the days generated makes a difference because of
WKST. Changing only WKST from MO to SU yields different results...
DTSTART
- ;TZID=America/Los_Angeles
+ ;TZID=US-Eastern
:19970805T090000
RRULE
:FREQ=WEEKLY;COUNT=4;INTERVAL=2;BYDAY=TU,SU
-X-EXPECT-NUMEVENTS: 4
-END:VEVENT
-
-BEGIN:VEVENT
-DESCRIPTION
- :Repeat every tuesday and wednesday starting 2 April 2002
-RRULE
- :FREQ=WEEKLY;INTERVAL=1;COUNT=6;BYDAY=TU,WE
-DTSTART
- :20020402T114500
-X-EXPECT-NUMEVENTS: 6
-END:VEVENT
-
-BEGIN:VEVENT
-DESCRIPTION
- :Use count=1 to repeat zero times.
-RRULE
- :FREQ=DAILY;COUNT=1
-DTSTART
- :20020402T114500
-X-EXPECT-NUMEVENTS: 1
-END:VEVENT
-
-BEGIN:VEVENT
-DESCRIPTION
- :Use EXDATE to eliminate the base event
-RRULE
- :FREQ=DAILY;COUNT=1
-DTSTART
- :20020402T114500Z
-EXDATE
- :20020402T114500Z
-X-EXPECT-NUMEVENTS: 0
-END:VEVENT
-
-BEGIN:VEVENT
-DESCRIPTION
- :Every Day in January\, except saturday and sunday\, using 2 EXRULEs. (NOT IMPLEMENTED)
-RRULE
- :FREQ=DAILY;INTERVAL=1;UNTIL=20020201T000000Z
-EXRULE
- :FREQ=WEEKLY;INTERVAL=1;UNTIL=20020201T000000Z;BYDAY=SU
-EXRULE
- :FREQ=WEEKLY;INTERVAL=1;UNTIL=20020201T000000Z;BYDAY=SA
-DTSTART
- :20020101T090000Z
-X-EXPECT-NUMEVENTS: 23
END:VEVENT
diff --git a/libical/test-data/simple-mime.txt b/libical/test-data/simple-mime.txt
index db7f8a6c39..aa7113a82f 100644
--- a/libical/test-data/simple-mime.txt
+++ b/libical/test-data/simple-mime.txt
@@ -10,15 +10,14 @@ Content-Disposition: attachment; filename="event.vcs"
BEGIN:VCALENDAR
PRODID:-//ACME/DesktopCalendar//EN
VERSION:2.0
-METHOD:REQUEST
BEGIN:VEVENT
ORGANIZER:foo1@example.com
ATTENDEE;RSVP=TRUE;ROLE=REQ-PARTICIPANT;CUTYPE=GROUP:MAILTO:employee-A@host.com
ATTENDEE;RSVP=TRUE;ROLE=REQ-PARTICIPANT;CUTYPE=GROUP:mailto:Employee-B@HOST.com
-ATTENDEE;RSVP=TRUE;ROLE=REQ-PARTICIPANT;CUTYPE=GROUP:MailTo:Eric@agony.busboom.org
+ATTENDEE;RSVP=TRUE;ROLE=REQ-PARTICIPANT;CUTYPE=GROUP:MailTo:Eric@Agony.Qualcomm.com
DTSTAMP:19970611T190000Z
DTSTART:19970621T170000Z
-DTEND:19970621T173000Z
+DTEND:199706211T173000Z
SUMMARY:Let's discuss the attached document
UID:calsvr.example.com-873970198738777-8aa
SEQUENCE:0
diff --git a/ui/evolution-addressbook.h b/ui/evolution-addressbook.h
deleted file mode 100644
index 3128ccfb83..0000000000
--- a/ui/evolution-addressbook.h
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * This file is autogenerated from evolution-addressbook.xml, do not edit
- *
- * This file contains translatable strings generated by
- * bonobo-ui-extract. Add this file to your project's
- * POTFILES.in. DO NOT compile it as part of your application.
- */
-
-gchar *s = N_("_Print Contacts...");
-gchar *s = N_("As _Table");
-gchar *s = N_("_New Contact");
-gchar *s = N_("_Tools");
-gchar *s = N_("_Search for contacts");
-gchar *s = N_("New");
-gchar *s = N_("Create a new contact");
-gchar *s = N_("Find");
-gchar *s = N_("Find a contact");
-gchar *s = N_("Print");
-gchar *s = N_("Print contacts");
-gchar *s = N_("Delete");
-gchar *s = N_("Delete a contact");
-gchar *s = N_("View All");
-gchar *s = N_("View all contacts");
-gchar *s = N_("Stop");
-gchar *s = N_("Stop Loading");
diff --git a/ui/evolution-message-composer.h b/ui/evolution-message-composer.h
deleted file mode 100644
index bcc259c4d5..0000000000
--- a/ui/evolution-message-composer.h
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * This file is autogenerated from evolution-message-composer.xml, do not edit
- *
- * This file contains translatable strings generated by
- * bonobo-ui-extract. Add this file to your project's
- * POTFILES.in. DO NOT compile it as part of your application.
- */
-
-gchar *s = N_("Open");
-gchar *s = N_("Open a file");
-gchar *s = N_("Save");
-gchar *s = N_("Save the current file");
-gchar *s = N_("Save As");
-gchar *s = N_("Save the current file with a different name");
-gchar *s = N_("Close");
-gchar *s = N_("Close the current file");
-gchar *s = N_("Save in folder...");
-gchar *s = N_("Save the message in a specified folder");
-gchar *s = N_("Insert text file...");
-gchar *s = N_("Insert a file as text into the message");
-gchar *s = N_("Send");
-gchar *s = N_("Send the message now");
-gchar *s = N_("Send _later");
-gchar *s = N_("Send the message later");
-gchar *s = N_("Attach");
-gchar *s = N_("Attach a file");
-gchar *s = N_("HTML");
-gchar *s = N_("Send the mail in HTML format");
-gchar *s = N_("Show attachments");
-gchar *s = N_("Show / hide attachments");
-gchar *s = N_("_File");
-gchar *s = N_("_Open...");
-gchar *s = N_("_Save");
-gchar *s = N_("Save _As...");
-gchar *s = N_("Save in _folder... (FIXME)");
-gchar *s = N_("_Insert text file... (FIXME)");
-gchar *s = N_("Send");
-gchar *s = N_("Send _Later");
-gchar *s = N_("_Close");
-gchar *s = N_("_Edit");
-gchar *s = N_("F_ormat");
-gchar *s = N_("_View");
-gchar *s = N_("Show _attachments");
-gchar *s = N_("_Help");
-gchar *s = N_("_About...");
-gchar *s = N_("_Debug");
-gchar *s = N_("Send this message now");
-gchar *s = N_("Bold");
-gchar *s = N_("Sets something as bold");
-
-
-
-
diff --git a/widgets/menus/gal-define-views-dialog.c b/widgets/menus/gal-define-views-dialog.c
deleted file mode 100644
index 4337901e48..0000000000
--- a/widgets/menus/gal-define-views-dialog.c
+++ /dev/null
@@ -1,351 +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 "gal-define-views-dialog.h"
-
-#include <gtk/gtk.h>
-#include "gal-define-views-model.h"
-#include "gal-view-new-dialog.h"
-#include <gal/e-table/e-table-scrolled.h>
-#include <gal/util/e-i18n.h>
-#include <gal/util/e-util.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_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
-static void gal_define_views_dialog_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
-static void gal_define_views_dialog_dispose (GObject *object);
-
-static GtkDialogClass *parent_class = NULL;
-#define PARENT_TYPE GTK_TYPE_DIALOG
-
-/* The properties we support */
-enum {
- PROP_0,
- PROP_COLLECTION
-};
-
-typedef struct {
- char *title;
- ETableModel *model;
- GalDefineViewsDialog *names;
-} GalDefineViewsDialogChild;
-
-
-E_MAKE_TYPE(gal_define_views_dialog, "GalDefineViewsDialog", GalDefineViewsDialog, gal_define_views_dialog_class_init, gal_define_views_dialog_init, PARENT_TYPE)
-
-static void
-gal_define_views_dialog_class_init (GalDefineViewsDialogClass *klass)
-{
- GObjectClass *object_class;
-
- object_class = (GObjectClass*) klass;
-
- parent_class = g_type_class_ref (PARENT_TYPE);
-
- object_class->set_property = gal_define_views_dialog_set_property;
- object_class->get_property = gal_define_views_dialog_get_property;
- object_class->dispose = gal_define_views_dialog_dispose;
-
- g_object_class_install_property (object_class, PROP_COLLECTION,
- g_param_spec_object ("collection",
- _("Collection"),
- /*_( */"XXX blurb" /*)*/,
- GAL_VIEW_COLLECTION_TYPE,
- G_PARAM_READWRITE));
-}
-
-/* ETable creation */
-#define SPEC "<ETableSpecification cursor-mode=\"line\" draw-grid=\"true\" selection-mode=\"single\" gettext-domain=\"" E_I18N_DOMAIN "\">" \
- "<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);
- g_object_set_data(G_OBJECT (table), "GalDefineViewsDialog::model", model);
- return table;
-}
-
-/* Button callbacks */
-
-static void
-gdvd_button_new_dialog_callback(GtkWidget *widget, int id, GalDefineViewsDialog *dialog)
-{
- gchar *name;
- GalView *view;
- GalViewFactory *factory;
- switch (id) {
- case GTK_RESPONSE_OK:
- g_object_get(widget,
- "name", &name,
- "factory", &factory,
- NULL);
- if (name && factory) {
- g_strchomp(name);
- if (*name != '\0') {
- view = gal_view_factory_new_view(factory, name);
- gal_define_views_model_append(GAL_DEFINE_VIEWS_MODEL(dialog->model), view);
- gal_view_edit(view, GTK_WINDOW (dialog));
- g_object_unref(view);
- }
- }
- g_object_unref(factory);
- g_free(name);
- break;
- }
- gtk_widget_destroy (widget);
-}
-
-static void
-gdvd_button_new_callback(GtkWidget *widget, GalDefineViewsDialog *dialog)
-{
- GtkWidget *view_new_dialog = gal_view_new_dialog_new(dialog->collection);
- gtk_window_set_transient_for (GTK_WINDOW (view_new_dialog), GTK_WINDOW (dialog));
- g_signal_connect(view_new_dialog, "response",
- G_CALLBACK(gdvd_button_new_dialog_callback), dialog);
- gtk_widget_show(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, GTK_WINDOW (dialog));
- }
-
-}
-
-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);
- }
-
-}
-
-#if 0
-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);
- }
-
-}
-#endif
-
-static void
-gdvd_connect_signal(GalDefineViewsDialog *dialog, char *widget_name, char *signal, GCallback handler)
-{
- GtkWidget *widget;
-
- widget = glade_xml_get_widget(dialog->gui, widget_name);
-
- if (widget)
- g_signal_connect(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 (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_container_remove (GTK_CONTAINER (widget->parent), widget);
- gtk_window_set_default_size(GTK_WINDOW(dialog), 360, 270);
- gtk_container_set_border_width(GTK_CONTAINER(dialog), 6);
- gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), widget, TRUE, TRUE, 0);
- gtk_widget_unref(widget);
-
- gtk_dialog_add_buttons (GTK_DIALOG (dialog),
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_OK, GTK_RESPONSE_OK,
- NULL);
-
- gdvd_connect_signal(dialog, "button-new", "clicked", G_CALLBACK(gdvd_button_new_callback));
- gdvd_connect_signal(dialog, "button-modify", "clicked", G_CALLBACK(gdvd_button_modify_callback));
- gdvd_connect_signal(dialog, "button-delete", "clicked", G_CALLBACK(gdvd_button_delete_callback));
-#if 0
- gdvd_connect_signal(dialog, "button-copy", "clicked", G_CALLBACK(gdvd_button_copy_callback));
-#endif
-
- dialog->model = NULL;
- etable = glade_xml_get_widget(dialog->gui, "custom-table");
- if (etable) {
- dialog->model = g_object_get_data(G_OBJECT (etable), "GalDefineViewsDialog::model");
- g_object_set(dialog->model,
- "collection", dialog->collection,
- NULL);
- gtk_widget_show_all (etable);
- }
-
- gtk_window_set_policy(GTK_WINDOW(dialog), FALSE, TRUE, FALSE);
-}
-
-static void
-gal_define_views_dialog_dispose (GObject *object)
-{
- GalDefineViewsDialog *gal_define_views_dialog = GAL_DEFINE_VIEWS_DIALOG(object);
-
- if (gal_define_views_dialog->gui)
- g_object_unref(gal_define_views_dialog->gui);
- gal_define_views_dialog->gui = NULL;
-
- if (G_OBJECT_CLASS (parent_class)->dispose)
- (* G_OBJECT_CLASS (parent_class)->dispose) (object);
-}
-
-static void
-gal_define_views_dialog_set_collection(GalDefineViewsDialog *dialog,
- GalViewCollection *collection)
-{
- dialog->collection = collection;
- if (dialog->model) {
- g_object_set(dialog->model,
- "collection", collection,
- NULL);
- }
- if (dialog->gui) {
- GtkWidget *widget = glade_xml_get_widget(dialog->gui, "label-views");
- if (widget && GTK_IS_LABEL (widget)) {
- if (collection->title) {
- char *text = g_strdup_printf (_("Define Views for %s"),
- collection->title);
- gtk_label_set_text (GTK_LABEL (widget),
- text);
- gtk_window_set_title (GTK_WINDOW (dialog), text);
- g_free (text);
- } else {
- gtk_label_set_text (GTK_LABEL (widget),
- _("Define Views"));
- gtk_window_set_title (GTK_WINDOW (dialog),
- _("Define Views"));
- }
- }
- }
-}
-
-/**
- * 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 = g_object_new (GAL_DEFINE_VIEWS_DIALOG_TYPE, NULL);
- gal_define_views_dialog_set_collection(GAL_DEFINE_VIEWS_DIALOG (widget), collection);
- return widget;
-}
-
-static void
-gal_define_views_dialog_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
-{
- GalDefineViewsDialog *dialog;
-
- dialog = GAL_DEFINE_VIEWS_DIALOG (object);
-
- switch (prop_id){
- case PROP_COLLECTION:
- if (g_value_get_object (value))
- gal_define_views_dialog_set_collection(dialog, GAL_VIEW_COLLECTION(g_value_get_object (value)));
- else
- gal_define_views_dialog_set_collection(dialog, NULL);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- return;
- }
-}
-
-static void
-gal_define_views_dialog_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
-{
- GalDefineViewsDialog *dialog;
-
- dialog = GAL_DEFINE_VIEWS_DIALOG (object);
-
- switch (prop_id) {
- case PROP_COLLECTION:
- g_value_set_object (value, dialog->collection);
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
diff --git a/widgets/menus/gal-define-views-dialog.h b/widgets/menus/gal-define-views-dialog.h
deleted file mode 100644
index 03a047b9fe..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 <gtk/gtkdialog.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) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAL_DEFINE_VIEWS_DIALOG_TYPE, GalDefineViewsDialog))
-#define GAL_DEFINE_VIEWS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAL_DEFINE_VIEWS_DIALOG_TYPE, GalDefineViewsDialogClass))
-#define GAL_IS_DEFINE_VIEWS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAL_DEFINE_VIEWS_DIALOG_TYPE))
-#define GAL_IS_DEFINE_VIEWS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), GAL_DEFINE_VIEWS_DIALOG_TYPE))
-
-typedef struct _GalDefineViewsDialog GalDefineViewsDialog;
-typedef struct _GalDefineViewsDialogClass GalDefineViewsDialogClass;
-
-struct _GalDefineViewsDialog
-{
- GtkDialog parent;
-
- /* item specific fields */
- GladeXML *gui;
- ETableModel *model;
-
- GalViewCollection *collection;
-};
-
-struct _GalDefineViewsDialogClass
-{
- GtkDialogClass parent_class;
-};
-
-GtkWidget *gal_define_views_dialog_new (GalViewCollection *collection);
-GType 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 40e54a53b6..0000000000
--- a/widgets/menus/gal-define-views-model.c
+++ /dev/null
@@ -1,322 +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 <libxml/tree.h>
-#include <libxml/parser.h>
-#include <libxml/xmlmemory.h>
-#include "gal-define-views-model.h"
-#include <gal/util/e-i18n.h>
-#include <gal/util/e-util.h>
-
-#define PARENT_TYPE E_TABLE_MODEL_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_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
-static void gal_define_views_model_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
-
-enum {
- PROP_0,
- PROP_EDITABLE,
- PROP_COLLECTION
-};
-
-static void
-gdvm_dispose(GObject *object)
-{
- GalDefineViewsModel *model = GAL_DEFINE_VIEWS_MODEL(object);
-
- if (model->collection)
- g_object_unref(model->collection);
- model->collection = NULL;
-
- if (G_OBJECT_CLASS (parent_class)->dispose)
- (* G_OBJECT_CLASS (parent_class)->dispose) (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 (GObjectClass *object_class)
-{
- ETableModelClass *model_class = (ETableModelClass *) object_class;
-
- parent_class = g_type_class_ref (PARENT_TYPE);
-
- object_class->dispose = gdvm_dispose;
- object_class->set_property = gal_define_views_model_set_property;
- object_class->get_property = gal_define_views_model_get_property;
-
- g_object_class_install_property (object_class, PROP_EDITABLE,
- g_param_spec_boolean ("editable",
- _("Editable"),
- /*_( */"XXX blurb" /*)*/,
- FALSE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_COLLECTION,
- g_param_spec_object ("collection",
- _("Collection"),
- /*_( */"XXX blurb" /*)*/,
- GAL_VIEW_COLLECTION_TYPE,
- G_PARAM_READWRITE));
-
- 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 (GObject *object)
-{
- GalDefineViewsModel *model = GAL_DEFINE_VIEWS_MODEL(object);
-
- model->collection = NULL;
-}
-
-static void
-gal_define_views_model_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
-{
- GalDefineViewsModel *model;
-
- model = GAL_DEFINE_VIEWS_MODEL (object);
-
- switch (prop_id){
- case PROP_EDITABLE:
- model->editable = g_value_get_boolean (value);
- break;
-
- case PROP_COLLECTION:
- e_table_model_pre_change(E_TABLE_MODEL(object));
- if (g_value_get_object (value))
- model->collection = GAL_VIEW_COLLECTION(g_value_get_object (value));
- else
- model->collection = NULL;
- e_table_model_changed(E_TABLE_MODEL(object));
- break;
- }
-}
-
-static void
-gal_define_views_model_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
-{
- GalDefineViewsModel *model;
-
- model = GAL_DEFINE_VIEWS_MODEL (object);
-
- switch (prop_id) {
- case PROP_EDITABLE:
- g_value_set_boolean (value, model->editable);
- break;
-
- case PROP_COLLECTION:
- g_value_set_object (value, model->collection);
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-E_MAKE_TYPE(gal_define_views_model, "GalDefineViewsModel", GalDefineViewsModel, gal_define_views_model_class_init, gal_define_views_model_init, PARENT_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 = g_object_new (GAL_DEFINE_VIEWS_MODEL_TYPE, NULL);
-
- 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 6ea2b28cbc..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) (G_TYPE_CHECK_INSTANCE_CAST ((o), GAL_DEFINE_VIEWS_MODEL_TYPE, GalDefineViewsModel))
-#define GAL_DEFINE_VIEWS_MODEL_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GAL_DEFINE_VIEWS_MODEL_TYPE, GalDefineViewsModelClass))
-#define GAL_IS_DEFINE_VIEWS_MODEL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GAL_DEFINE_VIEWS_MODEL_TYPE))
-#define GAL_IS_DEFINE_VIEWS_MODEL_CLASS(k) (G_TYPE_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;
-
-
-GType 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 8c0101d47f..0000000000
--- a/widgets/menus/gal-define-views.glade
+++ /dev/null
@@ -1,232 +0,0 @@
-<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
-<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
-
-<glade-interface>
-
-<widget class="GtkDialog" id="dialog1">
- <property name="title" translatable="yes">Define Views for &quot;%s&quot;</property>
- <property name="type">GTK_WINDOW_TOPLEVEL</property>
- <property name="window_position">GTK_WIN_POS_NONE</property>
- <property name="modal">False</property>
- <property name="resizable">True</property>
- <property name="destroy_with_parent">False</property>
- <property name="has_separator">True</property>
-
- <child internal-child="vbox">
- <widget class="GtkVBox" id="dialog-vbox1">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child internal-child="action_area">
- <widget class="GtkHButtonBox" id="dialog-action_area1">
- <property name="visible">True</property>
- <property name="layout_style">GTK_BUTTONBOX_END</property>
-
- <child>
- <widget class="GtkButton" id="button1">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-cancel</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="response_id">-6</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkButton" id="button7">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-ok</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="response_id">-5</property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">GTK_PACK_END</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkTable" id="table-top">
- <property name="visible">True</property>
- <property name="n_rows">4</property>
- <property name="n_columns">1</property>
- <property name="homogeneous">False</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">6</property>
-
- <child>
- <widget class="GtkHBox" id="hbox1">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="Custom" id="custom-table">
- <property name="visible">True</property>
- <property name="creation_function">gal_define_views_dialog_create_etable</property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Fri, 10 Nov 2000 16:37:39 GMT</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vbox1">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkButton" id="button-new">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-new</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkButton" id="button-modify">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">_Edit...</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkButton" id="button-delete">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-delete</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHButtonBox" id="hbuttonbox1">
- <property name="visible">True</property>
- <property name="layout_style">GTK_BUTTONBOX_END</property>
- <property name="spacing">6</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
- <property name="x_options">fill</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkAlignment" id="alignment3">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xscale">0</property>
- <property name="yscale">1</property>
-
- <child>
- <widget class="GtkButton" id="button-reset">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-revert-to-saved</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options">fill</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label-views">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Define Views for %s</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">12</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- </child>
-</widget>
-
-</glade-interface>
diff --git a/widgets/menus/gal-view-collection.c b/widgets/menus/gal-view-collection.c
deleted file mode 100644
index 5e97419270..0000000000
--- a/widgets/menus/gal-view-collection.c
+++ /dev/null
@@ -1,823 +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 <sys/stat.h>
-#include <ctype.h>
-#include <string.h>
-#include <errno.h>
-#include <libxml/parser.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 PARENT_TYPE G_TYPE_OBJECT
-
-static GObjectClass *gal_view_collection_parent_class;
-
-#define d(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));
-
- g_signal_emit (collection,
- gal_view_collection_signals [DISPLAY_VIEW], 0,
- view);
-}
-
-static void
-gal_view_collection_changed (GalViewCollection *collection)
-{
- g_return_if_fail (collection != NULL);
- g_return_if_fail (GAL_IS_VIEW_COLLECTION (collection));
-
- g_signal_emit (collection,
- gal_view_collection_signals [CHANGED], 0);
-}
-
-static void
-gal_view_collection_item_free (GalViewCollectionItem *item)
-{
- g_free(item->id);
- if (item->view) {
- if (item->view_changed_id)
- g_signal_handler_disconnect (item->view,
- item->view_changed_id);
- g_object_unref(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_dispose (GObject *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);
- collection->view_data = NULL;
- collection->view_count = 0;
-
- e_free_object_list (collection->factory_list);
- collection->factory_list = NULL;
-
- 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);
- collection->removed_view_data = NULL;
- collection->removed_view_count = 0;
-
- g_free(collection->system_dir);
- collection->system_dir = NULL;
-
- g_free(collection->local_dir);
- collection->system_dir = NULL;
- collection->local_dir = NULL;
-
- g_free (collection->default_view);
- collection->default_view = NULL;
-
- g_free (collection->title);
- collection->title = NULL;
-
- if (gal_view_collection_parent_class->dispose)
- (*gal_view_collection_parent_class->dispose)(object);
-}
-
-static void
-gal_view_collection_class_init (GObjectClass *object_class)
-{
- GalViewCollectionClass *klass = GAL_VIEW_COLLECTION_CLASS(object_class);
- gal_view_collection_parent_class = g_type_class_ref (PARENT_TYPE);
-
- object_class->dispose = gal_view_collection_dispose;
-
- gal_view_collection_signals [DISPLAY_VIEW] =
- g_signal_new ("display_view",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GalViewCollectionClass, display_view),
- NULL, NULL,
- g_cclosure_marshal_VOID__OBJECT,
- G_TYPE_NONE, 1, GAL_VIEW_TYPE);
-
- gal_view_collection_signals [CHANGED] =
- g_signal_new ("changed",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GalViewCollectionClass, changed),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- 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;
-
- collection->title = NULL;
-}
-
-E_MAKE_TYPE(gal_view_collection, "GalViewCollection", GalViewCollection, gal_view_collection_class_init, gal_view_collection_init, PARENT_TYPE)
-
-/**
- * gal_view_collection_new:
- *
- * A collection of views and view factories.
- */
-GalViewCollection *
-gal_view_collection_new (void)
-{
- return g_object_new (GAL_VIEW_COLLECTION_TYPE, NULL);
-}
-
-void
-gal_view_collection_set_title (GalViewCollection *collection,
- const char *title)
-{
- g_free (collection->title);
- collection->title = g_strdup (title);
-}
-
-/**
- * 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));
-
- g_object_ref (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;
-
- g_signal_handler_block(G_OBJECT(item->view), item->view_changed_id);
- gal_view_collection_changed(item->collection);
- g_signal_handler_unblock(G_OBJECT(item->view), item->view_changed_id);
-}
-
-/* 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 =
- g_signal_connect(item->view, "changed",
- G_CALLBACK(view_changed), item);
- }
- }
- return item;
-}
-
-static void
-load_single_dir (GalViewCollection *collection,
- char *dir,
- gboolean local)
-{
- xmlDoc *doc = NULL;
- xmlNode *root;
- xmlNode *child;
- char *filename = g_concat_dir_and_file(dir, "galview.xml");
- char *default_view;
- struct stat st;
-
- if (stat (filename, &st) != -1 && S_ISREG (st.st_mode))
- doc = xmlParseFile (filename);
-
- if (!doc) {
- g_free (filename);
- return;
- }
- root = xmlDocGetRootElement(doc);
- for (child = root->xmlChildrenNode; child; child = child->next) {
- gchar *id;
- gboolean found = FALSE;
- int i;
-
- if (!strcmp (child->name, "text"))
- continue;
-
- id = e_xml_get_string_prop_by_name(child, "id");
- 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);
-
- if ((e_create_directory(collection->local_dir) == -1) && (errno != EEXIST))
- g_warning ("Unable to create dir %s: %s", collection->local_dir, g_strerror(errno));
-
- 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");
- if (e_xml_save_file (filename, doc) == -1)
- g_warning ("Unable to save view to %s - %s", filename, g_strerror(errno));
- 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;
- g_object_ref(view);
-
- item->view_changed_id =
- g_signal_connect(item->view, "changed",
- G_CALLBACK (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 =
- g_signal_connect(item->view, "changed",
- G_CALLBACK (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", G_GNUC_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;
- g_object_ref(view);
-
- item->view_changed_id =
- g_signal_connect(item->view, "changed",
- G_CALLBACK (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", G_GNUC_FUNCTION, view));
-
- item = collection->view_data[i];
-
- gal_view_set_title (view, item->title);
- g_object_ref (view);
- if (item->view) {
- g_signal_handler_disconnect (item->view,
- item->view_changed_id);
- g_object_unref (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 =
- g_signal_connect(item->view, "changed",
- G_CALLBACK (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 9ba5eab71f..0000000000
--- a/widgets/menus/gal-view-collection.h
+++ /dev/null
@@ -1,151 +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>
-
-G_BEGIN_DECLS
-
-#define GAL_VIEW_COLLECTION_TYPE (gal_view_collection_get_type ())
-#define GAL_VIEW_COLLECTION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GAL_VIEW_COLLECTION_TYPE, GalViewCollection))
-#define GAL_VIEW_COLLECTION_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GAL_VIEW_COLLECTION_TYPE, GalViewCollectionClass))
-#define GAL_IS_VIEW_COLLECTION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GAL_VIEW_COLLECTION_TYPE))
-#define GAL_IS_VIEW_COLLECTION_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GAL_VIEW_COLLECTION_TYPE))
-#define GAL_VIEW_COLLECTION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GAL_VIEW_COLLECTION_TYPE, GalViewCollectionClass))
-
-typedef struct GalViewCollectionItem GalViewCollectionItem;
-
-typedef struct {
- GObject 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;
-
- char *title;
-} GalViewCollection;
-
-typedef struct {
- GObjectClass 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 */
-GType gal_view_collection_get_type (void);
-GalViewCollection *gal_view_collection_new (void);
-
-void gal_view_collection_set_title (GalViewCollection *collection,
- const char *title);
-/* Set up the view collection. Call these two 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);
-
-
-G_END_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 a46368559e..0000000000
--- a/widgets/menus/gal-view-etable.c
+++ /dev/null
@@ -1,305 +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 "gal-view-etable.h"
-#include <gal/e-table/e-table-config.h>
-
-#define PARENT_TYPE GAL_VIEW_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) {
- g_signal_handler_disconnect (view->table,
- view->table_state_changed_id);
- view->table_state_changed_id = 0;
- }
- g_object_unref (view->table);
- view->table = NULL;
-}
-
-static void
-detach_tree (GalViewEtable *view)
-{
- if (view->tree == NULL)
- return;
- if (view->tree_state_changed_id) {
- g_signal_handler_disconnect (view->tree,
- view->tree_state_changed_id);
- view->tree_state_changed_id = 0;
- }
- g_object_unref (view->tree);
- view->tree = NULL;
-}
-
-static void
-config_changed (ETableConfig *config, GalViewEtable *view)
-{
- ETableState *state;
- if (view->state)
- g_object_unref(view->state);
- g_object_get (config,
- "state", &state,
- NULL);
- view->state = e_table_state_duplicate(state);
- g_object_unref (state);
-
- gal_view_changed(GAL_VIEW(view));
-}
-
-static void
-gal_view_etable_edit (GalView *view, GtkWindow *parent)
-{
- GalViewEtable *etable_view = GAL_VIEW_ETABLE(view);
- ETableConfig *config;
-
- config = e_table_config_new(etable_view->title,
- etable_view->spec,
- etable_view->state,
- parent);
-
- g_signal_connect(config, "changed",
- G_CALLBACK(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 = g_object_new (GAL_VIEW_ETABLE_TYPE, NULL);
- new->spec = gve->spec;
- new->title = g_strdup (gve->title);
- new->state = e_table_state_duplicate(gve->state);
-
- g_object_ref(new->spec);
-
- return GAL_VIEW(new);
-}
-
-static void
-gal_view_etable_dispose (GObject *object)
-{
- GalViewEtable *view = GAL_VIEW_ETABLE(object);
-
- gal_view_etable_detach (view);
-
- g_free(view->title);
- view->title = NULL;
-
- if (view->spec)
- g_object_unref(view->spec);
- view->spec = NULL;
-
- if (view->state)
- g_object_unref(view->state);
- view->state = NULL;
-
- if (G_OBJECT_CLASS (gal_view_etable_parent_class)->dispose)
- (* G_OBJECT_CLASS (gal_view_etable_parent_class)->dispose) (object);
-}
-
-static void
-gal_view_etable_class_init (GObjectClass *object_class)
-{
- GalViewClass *gal_view_class = GAL_VIEW_CLASS(object_class);
- gal_view_etable_parent_class = g_type_class_ref (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->dispose = gal_view_etable_dispose ;
-}
-
-static void
-gal_view_etable_init (GalViewEtable *gve)
-{
- gve->spec = NULL;
- gve->state = e_table_state_new();
- gve->title = NULL;
-}
-
-E_MAKE_TYPE(gal_view_etable, "GalViewEtable", GalViewEtable, gal_view_etable_class_init, gal_view_etable_init, PARENT_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 (g_object_new (GAL_VIEW_ETABLE_TYPE, NULL), 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)
- g_object_ref(spec);
- view->spec = spec;
-
- if (view->state)
- g_object_unref(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)
- g_object_unref(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);
- g_object_unref (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);
- g_object_unref (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);
- g_object_ref (view->table);
- view->table_state_changed_id =
- g_signal_connect(view->table, "state_change",
- G_CALLBACK (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);
- g_object_ref (view->tree);
- view->tree_state_changed_id =
- g_signal_connect(view->tree, "state_change",
- G_CALLBACK (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 65879663fa..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 <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>
-
-G_BEGIN_DECLS
-
-#define GAL_VIEW_ETABLE_TYPE (gal_view_etable_get_type ())
-#define GAL_VIEW_ETABLE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GAL_VIEW_ETABLE_TYPE, GalViewEtable))
-#define GAL_VIEW_ETABLE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GAL_VIEW_ETABLE_TYPE, GalViewEtableClass))
-#define GAL_IS_VIEW_ETABLE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GAL_VIEW_ETABLE_TYPE))
-#define GAL_IS_VIEW_ETABLE_CLASS(k) (G_TYPE_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 */
-GType 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);
-
-
-G_END_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 c0d68fe006..0000000000
--- a/widgets/menus/gal-view-factory-etable.c
+++ /dev/null
@@ -1,120 +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/util/e-util.h"
-#include "gal-view-factory-etable.h"
-#include "gal-view-etable.h"
-
-#define PARENT_TYPE GAL_VIEW_FACTORY_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_dispose (GObject *object)
-{
- GalViewFactoryEtable *factory = GAL_VIEW_FACTORY_ETABLE(object);
-
- if (factory->spec)
- g_object_unref(factory->spec);
- factory->spec = NULL;
-
- if (G_OBJECT_CLASS (gal_view_factory_etable_parent_class)->dispose)
- (* G_OBJECT_CLASS (gal_view_factory_etable_parent_class)->dispose) (object);
-}
-
-static void
-gal_view_factory_etable_class_init (GObjectClass *object_class)
-{
- GalViewFactoryClass *view_factory_class = GAL_VIEW_FACTORY_CLASS(object_class);
- gal_view_factory_etable_parent_class = g_type_class_ref (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->dispose = gal_view_factory_etable_dispose;
-}
-
-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 (g_object_new (GAL_VIEW_FACTORY_ETABLE_TYPE, NULL), 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)
- g_object_ref(spec);
- factory->spec = spec;
- return GAL_VIEW_FACTORY(factory);
-}
-
-E_MAKE_TYPE(gal_view_factory_etable, "GalViewFactoryEtable", GalViewFactoryEtable, gal_view_factory_etable_class_init, gal_view_factory_etable_init, PARENT_TYPE)
diff --git a/widgets/menus/gal-view-factory-etable.h b/widgets/menus/gal-view-factory-etable.h
deleted file mode 100644
index 542aa255fc..0000000000
--- a/widgets/menus/gal-view-factory-etable.h
+++ /dev/null
@@ -1,62 +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) (G_TYPE_CHECK_INSTANCE_CAST ((o), GAL_VIEW_FACTORY_ETABLE_TYPE, GalViewFactoryEtable))
-#define GAL_VIEW_FACTORY_ETABLE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GAL_VIEW_FACTORY_ETABLE_TYPE, GalViewFactoryEtableClass))
-#define GAL_IS_VIEW_FACTORY_ETABLE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GAL_VIEW_FACTORY_ETABLE_TYPE))
-#define GAL_IS_VIEW_FACTORY_ETABLE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GAL_VIEW_FACTORY_ETABLE_TYPE))
-#define GAL_VIEW_FACTORY_ETABLE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GAL_VIEW_FACTORY_ETABLE_TYPE, GalViewFactoryEtableClass))
-
-typedef struct {
- GalViewFactory base;
-
- ETableSpecification *spec;
-} GalViewFactoryEtable;
-
-typedef struct {
- GalViewFactoryClass parent_class;
-} GalViewFactoryEtableClass;
-
-/* Standard functions */
-GType 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 5bc2c9f11d..0000000000
--- a/widgets/menus/gal-view-factory.c
+++ /dev/null
@@ -1,107 +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"
-#include "gal/util/e-util.h"
-
-#define PARENT_TYPE G_TYPE_OBJECT
-
-#define d(x)
-
-d(static gint depth = 0;)
-
-static GObjectClass *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 (GAL_VIEW_FACTORY_GET_CLASS (factory)->get_title)
- return GAL_VIEW_FACTORY_GET_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 (GAL_VIEW_FACTORY_GET_CLASS (factory)->new_view)
- return GAL_VIEW_FACTORY_GET_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 (GAL_VIEW_FACTORY_GET_CLASS (factory)->get_type_code)
- return GAL_VIEW_FACTORY_GET_CLASS (factory)->get_type_code (factory);
- else
- return NULL;
-}
-
-static void
-gal_view_factory_class_init (GObjectClass *object_class)
-{
- GalViewFactoryClass *klass = GAL_VIEW_FACTORY_CLASS(object_class);
- gal_view_factory_parent_class = g_type_class_ref (PARENT_TYPE);
-
- klass->get_title = NULL;
- klass->new_view = NULL;
-}
-
-static void
-gal_view_factory_init (GalViewFactory *factory)
-{
-}
-
-E_MAKE_TYPE(gal_view_factory, "GalViewFactory", GalViewFactory, gal_view_factory_class_init, gal_view_factory_init, PARENT_TYPE)
diff --git a/widgets/menus/gal-view-factory.h b/widgets/menus/gal-view-factory.h
deleted file mode 100644
index 5fff83e048..0000000000
--- a/widgets/menus/gal-view-factory.h
+++ /dev/null
@@ -1,79 +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) (G_TYPE_CHECK_INSTANCE_CAST ((o), GAL_VIEW_FACTORY_TYPE, GalViewFactory))
-#define GAL_VIEW_FACTORY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GAL_VIEW_FACTORY_TYPE, GalViewFactoryClass))
-#define GAL_IS_VIEW_FACTORY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GAL_VIEW_FACTORY_TYPE))
-#define GAL_IS_VIEW_FACTORY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GAL_VIEW_FACTORY_TYPE))
-#define GAL_VIEW_FACTORY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GAL_VIEW_FACTORY_TYPE, GalViewFactoryClass))
-
-typedef struct {
- GObject base;
-} GalViewFactory;
-
-typedef struct {
- GObjectClass 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 */
-GType 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-instance-save-as-dialog.c b/widgets/menus/gal-view-instance-save-as-dialog.c
deleted file mode 100644
index 2bd4a67a9e..0000000000
--- a/widgets/menus/gal-view-instance-save-as-dialog.c
+++ /dev/null
@@ -1,299 +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 "gal-view-instance-save-as-dialog.h"
-
-#include "gal-define-views-model.h"
-#include "gal-view-new-dialog.h"
-#include <gal/e-table/e-table-scrolled.h>
-#include <gal/util/e-i18n.h>
-#include <gtk/gtknotebook.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtktogglebutton.h>
-#include <gtk/gtkbox.h>
-#include <gtk/gtkstock.h>
-
-static GtkDialogClass *parent_class = NULL;
-#define PARENT_TYPE GTK_TYPE_DIALOG
-
-/* The arguments we take */
-enum {
- PROP_0,
- PROP_INSTANCE,
-};
-
-typedef struct {
- char *title;
- ETableModel *model;
- GalViewInstanceSaveAsDialog *names;
-} GalViewInstanceSaveAsDialogChild;
-
-
-/* Static functions */
-static void
-gal_view_instance_save_as_dialog_set_instance(GalViewInstanceSaveAsDialog *dialog,
- GalViewInstance *instance)
-{
- dialog->instance = instance;
- if (dialog->model) {
- g_object_set(dialog->model,
- "collection", instance ? instance->collection : NULL,
- NULL);
- }
-}
-
-static void
-gvisad_setup_radio_buttons (GalViewInstanceSaveAsDialog *dialog)
-{
- GtkWidget *radio_replace = glade_xml_get_widget (dialog->gui, "radiobutton-replace");
- GtkWidget *radio_create = glade_xml_get_widget (dialog->gui, "radiobutton-create" );
- GtkWidget *widget;
- GtkNotebook *notebook = GTK_NOTEBOOK (glade_xml_get_widget (dialog->gui, "notebook-help"));
-
- widget = glade_xml_get_widget (dialog->gui, "custom-replace");
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (radio_replace))) {
- gtk_widget_set_sensitive (widget, TRUE);
- gtk_notebook_set_page (notebook, 0);
- dialog->toggle = GAL_VIEW_INSTANCE_SAVE_AS_DIALOG_TOGGLE_REPLACE;
- } else {
- gtk_widget_set_sensitive (widget, FALSE);
- }
-
- widget = glade_xml_get_widget (dialog->gui, "entry-create");
- if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (radio_create))) {
- gtk_widget_set_sensitive (widget, TRUE);
- gtk_notebook_set_page (notebook, 1);
- dialog->toggle = GAL_VIEW_INSTANCE_SAVE_AS_DIALOG_TOGGLE_CREATE;
- } else {
- gtk_widget_set_sensitive (widget, FALSE);
- }
-}
-
-static void
-gvisad_radio_toggled (GtkWidget *widget, GalViewInstanceSaveAsDialog *dialog)
-{
- gvisad_setup_radio_buttons (dialog);
-}
-
-static void
-gvisad_connect_signal(GalViewInstanceSaveAsDialog *dialog, char *widget_name, char *signal, GCallback handler)
-{
- GtkWidget *widget;
-
- widget = glade_xml_get_widget(dialog->gui, widget_name);
-
- if (widget)
- g_signal_connect (G_OBJECT (widget), signal, handler, dialog);
-}
-
-/* Method override implementations */
-static void
-gal_view_instance_save_as_dialog_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
-{
- GalViewInstanceSaveAsDialog *dialog;
-
- dialog = GAL_VIEW_INSTANCE_SAVE_AS_DIALOG (object);
-
- switch (prop_id){
- case PROP_INSTANCE:
- if (g_value_get_object (value))
- gal_view_instance_save_as_dialog_set_instance(dialog, GAL_VIEW_INSTANCE(g_value_get_object (value)));
- else
- gal_view_instance_save_as_dialog_set_instance(dialog, NULL);
- break;
-
- default:
- return;
- }
-}
-
-static void
-gal_view_instance_save_as_dialog_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
-{
- GalViewInstanceSaveAsDialog *dialog;
-
- dialog = GAL_VIEW_INSTANCE_SAVE_AS_DIALOG (object);
-
- switch (prop_id) {
- case PROP_INSTANCE:
- g_value_set_object (value, dialog->instance);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-gal_view_instance_save_as_dialog_dispose (GObject *object)
-{
- GalViewInstanceSaveAsDialog *gal_view_instance_save_as_dialog = GAL_VIEW_INSTANCE_SAVE_AS_DIALOG(object);
-
- if (gal_view_instance_save_as_dialog->gui)
- g_object_unref(gal_view_instance_save_as_dialog->gui);
- gal_view_instance_save_as_dialog->gui = NULL;
-
- if (G_OBJECT_CLASS (parent_class)->dispose)
- (* G_OBJECT_CLASS (parent_class)->dispose) (object);
-}
-
-/* Init functions */
-static void
-gal_view_instance_save_as_dialog_class_init (GalViewInstanceSaveAsDialogClass *klass)
-{
- GObjectClass *object_class;
-
- object_class = (GObjectClass*) klass;
-
- parent_class = g_type_class_ref (PARENT_TYPE);
-
- object_class->set_property = gal_view_instance_save_as_dialog_set_property;
- object_class->get_property = gal_view_instance_save_as_dialog_get_property;
- object_class->dispose = gal_view_instance_save_as_dialog_dispose;
-
- g_object_class_install_property (object_class, PROP_INSTANCE,
- g_param_spec_object ("instance",
- _("Instance"),
- /*_( */"XXX blurb" /*)*/,
- GAL_VIEW_INSTANCE_TYPE,
- G_PARAM_READWRITE));
-}
-
-static void
-gal_view_instance_save_as_dialog_init (GalViewInstanceSaveAsDialog *dialog)
-{
- GladeXML *gui;
- GtkWidget *widget;
- GtkWidget *etable;
-
- dialog->instance = NULL;
-
- gui = glade_xml_new_with_domain (GAL_GLADEDIR "/gal-view-instance-save-as-dialog.glade", NULL, PACKAGE);
- dialog->gui = gui;
-
- widget = glade_xml_get_widget(gui, "table-top");
- if (!widget) {
- return;
- }
- gtk_widget_ref(widget);
- gtk_container_remove (GTK_CONTAINER (widget->parent), widget);
- gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), widget, TRUE, TRUE, 0);
- gtk_widget_unref(widget);
-
- gtk_dialog_add_buttons (GTK_DIALOG (dialog),
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_OK, GTK_RESPONSE_OK,
- NULL);
-
- gvisad_connect_signal(dialog, "radiobutton-replace", "toggled", G_CALLBACK(gvisad_radio_toggled));
- gvisad_connect_signal(dialog, "radiobutton-create", "toggled", G_CALLBACK(gvisad_radio_toggled));
-
- dialog->model = NULL;
- etable = glade_xml_get_widget(dialog->gui, "custom-replace");
- if (etable) {
- dialog->model = g_object_get_data(G_OBJECT (etable), "GalViewInstanceSaveAsDialog::model");
- g_object_set(dialog->model,
- "collection", dialog->instance ? dialog->instance->collection : NULL,
- NULL);
- }
-
- gvisad_setup_radio_buttons (dialog);
- gtk_window_set_policy(GTK_WINDOW(dialog), FALSE, TRUE, FALSE);
-}
-
-
-/* For use from libglade. */
-/* ETable creation */
-#define SPEC "<ETableSpecification no-header=\"true\" cursor-mode=\"line\" draw-grid=\"false\" selection-mode=\"single\" gettext-domain=\"" E_I18N_DOMAIN "\">" \
- "<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>"
-
-GtkWidget *gal_view_instance_save_as_dialog_create_etable(char *name, char *string1, char *string2, int int1, int int2);
-
-GtkWidget *
-gal_view_instance_save_as_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);
- g_object_set_data(G_OBJECT (table), "GalViewInstanceSaveAsDialog::model", model);
- return table;
-}
-
-/* External methods */
-/**
- * gal_view_instance_save_as_dialog_new
- *
- * Returns a new dialog for defining views.
- *
- * Returns: The GalViewInstanceSaveAsDialog.
- */
-GtkWidget*
-gal_view_instance_save_as_dialog_new (GalViewInstance *instance)
-{
- GtkWidget *widget = g_object_new (GAL_VIEW_INSTANCE_SAVE_AS_DIALOG_TYPE, NULL);
- gal_view_instance_save_as_dialog_set_instance(GAL_VIEW_INSTANCE_SAVE_AS_DIALOG (widget), instance);
- return widget;
-}
-
-E_MAKE_TYPE(gal_view_instance_save_as_dialog, "GalViewInstanceSaveAsDialog",
- GalViewInstanceSaveAsDialog,
- gal_view_instance_save_as_dialog_class_init,
- gal_view_instance_save_as_dialog_init, PARENT_TYPE)
-
-void
-gal_view_instance_save_as_dialog_save (GalViewInstanceSaveAsDialog *dialog)
-{
- GalView *view = gal_view_instance_get_current_view (dialog->instance);
- GtkWidget *widget;
- const char *title;
- int n;
- const char *id = NULL;
- switch (dialog->toggle) {
- case GAL_VIEW_INSTANCE_SAVE_AS_DIALOG_TOGGLE_REPLACE:
- widget = glade_xml_get_widget(dialog->gui, "custom-replace");
- if (widget && E_IS_TABLE_SCROLLED (widget)) {
- n = e_table_get_cursor_row (e_table_scrolled_get_table (E_TABLE_SCROLLED (widget)));
- id = gal_view_collection_set_nth_view (dialog->instance->collection, n, view);
- gal_view_collection_save (dialog->instance->collection);
- }
- break;
- case GAL_VIEW_INSTANCE_SAVE_AS_DIALOG_TOGGLE_CREATE:
- widget = glade_xml_get_widget(dialog->gui, "entry-create");
- if (widget && GTK_IS_ENTRY (widget)) {
- title = gtk_entry_get_text (GTK_ENTRY (widget));
- id = gal_view_collection_append_with_title (dialog->instance->collection, title, view);
- gal_view_collection_save (dialog->instance->collection);
- }
- break;
- }
-
- if (id) {
- gal_view_instance_set_current_view_id (dialog->instance, id);
- }
-}
diff --git a/widgets/menus/gal-view-instance-save-as-dialog.glade b/widgets/menus/gal-view-instance-save-as-dialog.glade
deleted file mode 100644
index e60357e17c..0000000000
--- a/widgets/menus/gal-view-instance-save-as-dialog.glade
+++ /dev/null
@@ -1,243 +0,0 @@
-<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
-<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd" >
-
-<glade-interface>
- <widget class="GtkDialog" id="dialog1">
- <property name="visible">no</property>
- <property name="type">GTK_WINDOW_TOPLEVEL</property>
- <property name="modal">no</property>
- <property name="allow_shrink">no</property>
- <property name="allow_grow">yes</property>
- <property name="window-position">GTK_WIN_POS_NONE</property>
-
- <child internal-child="vbox">
- <widget class="GtkVBox" id="dialog-vbox1">
- <property name="homogeneous">no</property>
- <property name="spacing">8</property>
- <property name="visible">yes</property>
-
- <child internal-child="action_area">
- <widget class="GtkHButtonBox" id="dialog-action_area1">
- <property name="layout_style">GTK_BUTTONBOX_END</property>
- <property name="spacing">8</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="GtkButton" id="button1">
- <property name="can_default">yes</property>
- <property name="can_focus">yes</property>
- <property name="visible">yes</property>
- <property name="label">gtk-ok</property>
- <property name="use_stock">yes</property>
- <property name="use_underline">yes</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkButton" id="button3">
- <property name="can_default">yes</property>
- <property name="can_focus">yes</property>
- <property name="visible">yes</property>
- <property name="label">gtk-cancel</property>
- <property name="use_stock">yes</property>
- <property name="use_underline">yes</property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">no</property>
- <property name="fill">yes</property>
- <property name="pack_type">GTK_PACK_END</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkTable" id="table-top">
- <property name="homogeneous">no</property>
- <property name="row_spacing">0</property>
- <property name="column_spacing">0</property>
- <property name="n-rows">5</property>
- <property name="n-columns">1</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="GtkNotebook" id="notebook-help">
- <property name="show_tabs">no</property>
- <property name="show_border">no</property>
- <property name="tab_pos">GTK_POS_TOP</property>
- <property name="scrollable">no</property>
- <property name="tab_hborder">2</property>
- <property name="tab_vborder">2</property>
- <property name="enable-popup">no</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="GtkLabel" id="label6">
- <property name="label" translatable="yes">The current view will replace the given view. Any folders
-set to this view wil be replaced with the current view.</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">no</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="visible">yes</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label4">
- <property name="label" translatable="yes">label4</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">no</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="visible">yes</property>
- </widget>
- <packing>
- <property name="type">tab</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label7">
- <property name="label" translatable="yes">This will create a new View.</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">no</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="visible">yes</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label5">
- <property name="label" translatable="yes">label5</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">no</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="visible">yes</property>
- </widget>
- <packing>
- <property name="type">tab</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">4</property>
- <property name="bottom_attach">5</property>
- <property name="x_padding">0</property>
- <property name="y_padding">0</property>
- <property name="x_options">expand|fill</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="Custom" id="custom-replace">
- <property name="creation_function">gal_view_instance_save_as_dialog_create_etable</property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Fri, 01 Feb 2002 20:18:32 GMT</property>
- <property name="visible">yes</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
- <property name="x_padding">0</property>
- <property name="y_padding">0</property>
- <property name="x_options">fill</property>
- <property name="y_options">expand|fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkEntry" id="entry-create">
- <property name="sensitive">no</property>
- <property name="can_focus">yes</property>
- <property name="editable">yes</property>
- <property name="text" translatable="yes"></property>
- <property name="max-length">0</property>
- <property name="visibility">yes</property>
- <property name="visible">yes</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_padding">0</property>
- <property name="y_padding">0</property>
- <property name="x_options">expand|fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkRadioButton" id="radiobutton-replace">
- <property name="can_focus">yes</property>
- <property name="label" translatable="yes">Replace Existing View</property>
- <property name="active">no</property>
- <property name="draw_indicator">yes</property>
- <property name="visible">yes</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_padding">0</property>
- <property name="y_padding">0</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkRadioButton" id="radiobutton-create">
- <property name="can_focus">yes</property>
- <property name="label" translatable="yes">Create New View Named</property>
- <property name="active">yes</property>
- <property name="draw_indicator">yes</property>
- <property name="visible">yes</property>
- <property name="group">radiobutton-replace</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="x_padding">0</property>
- <property name="y_padding">0</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">yes</property>
- <property name="fill">yes</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">4</property>
- <property name="expand">yes</property>
- <property name="fill">yes</property>
- </packing>
- </child>
- </widget>
-</glade-interface>
diff --git a/widgets/menus/gal-view-instance-save-as-dialog.h b/widgets/menus/gal-view-instance-save-as-dialog.h
deleted file mode 100644
index 53d99d0789..0000000000
--- a/widgets/menus/gal-view-instance-save-as-dialog.h
+++ /dev/null
@@ -1,89 +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_VIEW_INSTANCE_SAVE_AS_DIALOG_H__
-#define __GAL_VIEW_INSTANCE_SAVE_AS_DIALOG_H__
-
-#include <gtk/gtkdialog.h>
-#include <glade/glade.h>
-#include <gal/e-table/e-table-model.h>
-#include <gal/menus/gal-view-collection.h>
-#include <gal/menus/gal-view-instance.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-/* GalViewInstanceSaveAsDialog - A dialog displaying information about a contact.
- *
- * The following arguments are available:
- *
- * name type read/write description
- * --------------------------------------------------------------------------------
- */
-
-#define GAL_VIEW_INSTANCE_SAVE_AS_DIALOG_TYPE (gal_view_instance_save_as_dialog_get_type ())
-#define GAL_VIEW_INSTANCE_SAVE_AS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAL_VIEW_INSTANCE_SAVE_AS_DIALOG_TYPE, GalViewInstanceSaveAsDialog))
-#define GAL_VIEW_INSTANCE_SAVE_AS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAL_VIEW_INSTANCE_SAVE_AS_DIALOG_TYPE, GalViewInstanceSaveAsDialogClass))
-#define GAL_IS_VIEW_INSTANCE_SAVE_AS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAL_VIEW_INSTANCE_SAVE_AS_DIALOG_TYPE))
-#define GAL_IS_VIEW_INSTANCE_SAVE_AS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), GAL_VIEW_INSTANCE_SAVE_AS_DIALOG_TYPE))
-
-typedef struct _GalViewInstanceSaveAsDialog GalViewInstanceSaveAsDialog;
-typedef struct _GalViewInstanceSaveAsDialogClass GalViewInstanceSaveAsDialogClass;
-
-typedef enum {
- GAL_VIEW_INSTANCE_SAVE_AS_DIALOG_TOGGLE_REPLACE,
- GAL_VIEW_INSTANCE_SAVE_AS_DIALOG_TOGGLE_CREATE
-} GalViewInstanceSaveAsDialogToggle;
-
-struct _GalViewInstanceSaveAsDialog
-{
- GtkDialog parent;
-
- /* item specific fields */
- GladeXML *gui;
- ETableModel *model;
-
- GalViewInstance *instance;
- GalViewCollection *collection;
-
- GalViewInstanceSaveAsDialogToggle toggle;
-};
-
-struct _GalViewInstanceSaveAsDialogClass
-{
- GtkDialogClass parent_class;
-};
-
-GtkWidget *gal_view_instance_save_as_dialog_new (GalViewInstance *instance);
-GType gal_view_instance_save_as_dialog_get_type (void);
-
-void gal_view_instance_save_as_dialog_save (GalViewInstanceSaveAsDialog *dialog);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-
-#endif /* __GAL_VIEW_INSTANCE_SAVE_AS_DIALOG_H__ */
diff --git a/widgets/menus/gal-view-instance.c b/widgets/menus/gal-view-instance.c
deleted file mode 100644
index 18965c6b84..0000000000
--- a/widgets/menus/gal-view-instance.c
+++ /dev/null
@@ -1,600 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * gal-view-instance.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 <errno.h>
-#include <libxml/parser.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-instance.h"
-#include "gal-view-instance-save-as-dialog.h"
-#include "gal-define-views-dialog.h"
-#include <sys/stat.h>
-#include <unistd.h>
-#include <gtk/gtkcheckmenuitem.h>
-
-#define PARENT_TYPE G_TYPE_OBJECT
-
-static GObjectClass *gal_view_instance_parent_class;
-
-static const EPopupMenu separator = E_POPUP_SEPARATOR;
-static const EPopupMenu terminator = E_POPUP_TERMINATOR;
-
-
-#define d(x)
-
-enum {
- DISPLAY_VIEW,
- CHANGED,
- LAST_SIGNAL
-};
-
-static guint gal_view_instance_signals [LAST_SIGNAL] = { 0, };
-
-static void
-gal_view_instance_changed (GalViewInstance *instance)
-{
- g_return_if_fail (instance != NULL);
- g_return_if_fail (GAL_IS_VIEW_INSTANCE (instance));
-
- g_signal_emit (instance,
- gal_view_instance_signals [CHANGED], 0);
-}
-
-static void
-gal_view_instance_display_view (GalViewInstance *instance, GalView *view)
-{
- g_return_if_fail (instance != NULL);
- g_return_if_fail (GAL_IS_VIEW_INSTANCE (instance));
-
- g_signal_emit (instance,
- gal_view_instance_signals [DISPLAY_VIEW], 0,
- view);
-}
-
-static void
-save_current_view (GalViewInstance *instance)
-{
- xmlDoc *doc;
- xmlNode *root;
-
- doc = xmlNewDoc("1.0");
- root = xmlNewNode (NULL, "GalViewCurrentView");
- xmlDocSetRootElement(doc, root);
-
- if (instance->current_id)
- e_xml_set_string_prop_by_name (root, "current_view", instance->current_id);
- if (instance->current_type)
- e_xml_set_string_prop_by_name (root, "current_view_type", instance->current_type);
-
- if (e_xml_save_file (instance->current_view_filename, doc) == -1)
- g_warning ("Unable to save view to %s - %s", instance->current_view_filename, g_strerror(errno));
- xmlFreeDoc(doc);
-}
-
-static void
-view_changed (GalView *view, GalViewInstance *instance)
-{
- if (instance->current_id != NULL) {
- g_free (instance->current_id);
- instance->current_id = NULL;
- save_current_view (instance);
- gal_view_instance_changed(instance);
- }
-
- gal_view_save (view, instance->custom_filename);
-}
-
-static void
-disconnect_view (GalViewInstance *instance)
-{
- if (instance->current_view) {
- if (instance->view_changed_id) {
- g_signal_handler_disconnect (instance->current_view,
- instance->view_changed_id);
- }
-
- g_object_unref (instance->current_view);
- }
- g_free (instance->current_type);
- g_free (instance->current_title);
- instance->current_title = NULL;
- instance->current_type = NULL;
- instance->view_changed_id = 0;
- instance->current_view = NULL;
-}
-
-static void
-connect_view (GalViewInstance *instance, GalView *view)
-{
- if (instance->current_view)
- disconnect_view (instance);
- instance->current_view = view;
-
- instance->current_title = g_strdup (gal_view_get_title(view));
- instance->current_type = g_strdup (gal_view_get_type_code(view));
- instance->view_changed_id =
- g_signal_connect(instance->current_view, "changed",
- G_CALLBACK (view_changed), instance);
-
- gal_view_instance_display_view (instance, instance->current_view);
-}
-
-static void
-gal_view_instance_dispose (GObject *object)
-{
- GalViewInstance *instance = GAL_VIEW_INSTANCE(object);
-
- if (instance->collection) {
- if (instance->collection_changed_id) {
- g_signal_handler_disconnect (instance->collection,
- instance->collection_changed_id);
- }
- g_object_unref (instance->collection);
- }
-
- g_free (instance->instance_id);
- g_free (instance->custom_filename);
- g_free (instance->current_view_filename);
-
- g_free (instance->current_id);
- disconnect_view (instance);
-
- g_free (instance->default_view);
-
- if (gal_view_instance_parent_class->dispose)
- (*gal_view_instance_parent_class->dispose)(object);
-}
-
-static void
-gal_view_instance_class_init (GObjectClass *object_class)
-{
- GalViewInstanceClass *klass = GAL_VIEW_INSTANCE_CLASS(object_class);
- gal_view_instance_parent_class = g_type_class_ref (PARENT_TYPE);
-
- object_class->dispose = gal_view_instance_dispose;
-
- gal_view_instance_signals [DISPLAY_VIEW] =
- g_signal_new ("display_view",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GalViewInstanceClass, display_view),
- NULL, NULL,
- g_cclosure_marshal_VOID__OBJECT,
- G_TYPE_NONE, 1, GAL_VIEW_TYPE);
-
- gal_view_instance_signals [CHANGED] =
- g_signal_new ("changed",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GalViewInstanceClass, changed),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- klass->display_view = NULL;
- klass->changed = NULL;
-}
-
-static void
-gal_view_instance_init (GalViewInstance *instance)
-{
- instance->collection = NULL;
-
- instance->instance_id = NULL;
- instance->custom_filename = NULL;
- instance->current_view_filename = NULL;
-
- instance->current_title = NULL;
- instance->current_type = NULL;
- instance->current_id = NULL;
- instance->current_view = NULL;
-
- instance->view_changed_id = 0;
- instance->collection_changed_id = 0;
-
- instance->loaded = FALSE;
- instance->default_view = NULL;
-}
-
-E_MAKE_TYPE(gal_view_instance, "GalViewInstance", GalViewInstance, gal_view_instance_class_init, gal_view_instance_init, PARENT_TYPE)
-
-static void
-collection_changed (GalView *view, GalViewInstance *instance)
-{
- if (instance->current_id) {
- char *view_id = instance->current_id;
- instance->current_id = NULL;
- gal_view_instance_set_current_view_id (instance, view_id);
- g_free (view_id);
- }
-}
-
-static void
-load_current_view (GalViewInstance *instance)
-{
- xmlDoc *doc = NULL;
- xmlNode *root;
- GalView *view = NULL;
- struct stat st;
-
- if (stat (instance->current_view_filename, &st) != -1 && S_ISREG (st.st_mode))
- doc = xmlParseFile(instance->current_view_filename);
-
- if (doc == NULL) {
- instance->current_id = g_strdup (gal_view_instance_get_default_view (instance));
-
- if (instance->current_id) {
- int index = gal_view_collection_get_view_index_by_id (instance->collection,
- instance->current_id);
-
- if (index != -1) {
- view = gal_view_collection_get_view (instance->collection,
- index);
- view = gal_view_clone(view);
- connect_view (instance, view);
- }
- }
- return;
- }
-
- root = xmlDocGetRootElement(doc);
- instance->current_id = e_xml_get_string_prop_by_name_with_default (root, "current_view", NULL);
-
- if (instance->current_id != NULL) {
- int index = gal_view_collection_get_view_index_by_id (instance->collection,
- instance->current_id);
-
- if (index != -1) {
- view = gal_view_collection_get_view (instance->collection,
- index);
- view = gal_view_clone(view);
- }
- }
- if (view == NULL) {
- char *type;
- type = e_xml_get_string_prop_by_name_with_default (root, "current_view_type", NULL);
- view = gal_view_collection_load_view_from_file (instance->collection,
- type,
- instance->custom_filename);
- g_free (type);
- }
-
- connect_view (instance, view);
-
- xmlFreeDoc(doc);
-}
-
-/**
- * gal_view_instance_new:
- * @collection: This %GalViewCollection should be loaded before being passed to this function.
- * @instance_id: Which instance of this type of object is this (for most of evo, this is the folder id.)
- *
- * Create a new %GalViewInstance.
- *
- * Return value: The new %GalViewInstance.
- **/
-GalViewInstance *
-gal_view_instance_new (GalViewCollection *collection, const char *instance_id)
-{
- GalViewInstance *instance = g_object_new (GAL_VIEW_INSTANCE_TYPE, NULL);
- if (gal_view_instance_construct (instance, collection, instance_id))
- return instance;
- else {
- g_object_unref (instance);
- return NULL;
- }
-}
-
-GalViewInstance *
-gal_view_instance_construct (GalViewInstance *instance, GalViewCollection *collection, const char *instance_id)
-{
- char *filename;
- char *safe_id;
-
- g_return_val_if_fail (gal_view_collection_loaded (collection), NULL);
-
- instance->collection = collection;
- if (collection)
- g_object_ref (collection);
- instance->collection_changed_id =
- g_signal_connect (collection, "changed",
- G_CALLBACK (collection_changed), instance);
-
- if (instance_id)
- instance->instance_id = g_strdup (instance_id);
- else
- instance->instance_id = g_strdup ("");
-
- safe_id = g_strdup (instance->instance_id);
- e_filename_make_safe (safe_id);
-
- filename = g_strdup_printf ("custom_view-%s.xml", safe_id);
- instance->custom_filename = g_concat_dir_and_file (instance->collection->local_dir, filename);
- g_free (filename);
-
- filename = g_strdup_printf ("current_view-%s.xml", safe_id);
- instance->current_view_filename = g_concat_dir_and_file (instance->collection->local_dir, filename);
- g_free (filename);
-
- g_free (safe_id);
-
- return instance;
-}
-
-/* Manipulate the current view. */
-char *
-gal_view_instance_get_current_view_id (GalViewInstance *instance)
-{
- if (instance->current_id && gal_view_collection_get_view_index_by_id (instance->collection, instance->current_id) != -1)
- return g_strdup (instance->current_id);
- else
- return NULL;
-}
-
-void
-gal_view_instance_set_current_view_id (GalViewInstance *instance, const char *view_id)
-{
- GalView *view;
- int index;
-
- g_return_if_fail (instance != NULL);
- g_return_if_fail (GAL_IS_VIEW_INSTANCE (instance));
-
- d(g_print("%s: view_id set to %s\n", G_GNUC_FUNCTION, view_id));
-
- if (instance->current_id && !strcmp (instance->current_id, view_id))
- return;
-
- g_free (instance->current_id);
- instance->current_id = g_strdup (view_id);
-
- index = gal_view_collection_get_view_index_by_id (instance->collection, view_id);
- if (index != -1) {
- view = gal_view_collection_get_view (instance->collection, index);
- connect_view (instance, gal_view_clone (view));
- }
-
- save_current_view (instance);
- gal_view_instance_changed(instance);
- gal_view_instance_display_view (instance, instance->current_view);
-}
-
-GalView *
-gal_view_instance_get_current_view (GalViewInstance *instance)
-{
- return instance->current_view;
-}
-
-void
-gal_view_instance_set_custom_view (GalViewInstance *instance, GalView *view)
-{
- g_free (instance->current_id);
- instance->current_id = NULL;
-
- view = gal_view_clone (view);
- connect_view (instance, view);
- gal_view_save (view, instance->custom_filename);
- save_current_view (instance);
- gal_view_instance_changed(instance);
-}
-
-static void
-dialog_response(GtkWidget *dialog, int id, GalViewInstance *instance)
-{
- if (id == GTK_RESPONSE_OK) {
- gal_view_instance_save_as_dialog_save (GAL_VIEW_INSTANCE_SAVE_AS_DIALOG (dialog));
- }
- gtk_widget_destroy (dialog);
-}
-
-void
-gal_view_instance_save_as (GalViewInstance *instance)
-{
- GtkWidget *dialog = gal_view_instance_save_as_dialog_new(instance);
- g_signal_connect(dialog, "response",
- G_CALLBACK(dialog_response), instance);
- gtk_widget_show(dialog);
-}
-
-/* This is idempotent. Once it's been called once, the rest of the calls are ignored. */
-void
-gal_view_instance_load (GalViewInstance *instance)
-{
- if (!instance->loaded) {
- load_current_view (instance);
- instance->loaded = TRUE;
- }
-}
-
-/* These only mean anything before gal_view_instance_load is called the first time. */
-const char *
-gal_view_instance_get_default_view (GalViewInstance *instance)
-{
- if (instance->default_view)
- return instance->default_view;
- else
- return gal_view_collection_get_default_view (instance->collection);
-}
-
-void
-gal_view_instance_set_default_view (GalViewInstance *instance, const char *id)
-{
- g_free (instance->default_view);
- instance->default_view = g_strdup (id);
-}
-
-gboolean
-gal_view_instance_exists (GalViewInstance *instance)
-{
- struct stat st;
-
- if (instance->current_view_filename && stat (instance->current_view_filename, &st) == 0 && st.st_size > 0 && S_ISREG (st.st_mode))
- return TRUE;
- else
- return FALSE;
-
-}
-
-typedef struct {
- GalViewInstance *instance;
- char *id;
-} ListenerClosure;
-
-static void
-view_item_cb (GtkWidget *widget,
- gpointer user_data)
-{
- ListenerClosure *closure = user_data;
-
- if (GTK_CHECK_MENU_ITEM (widget)->active) {
- gal_view_instance_set_current_view_id (closure->instance, closure->id);
- }
-}
-
-static void
-add_popup_radio_item (EPopupMenu *menu_item,
- gchar *title,
- GtkSignalFunc fn,
- gpointer closure,
- gboolean value)
-{
- EPopupMenu menu_item_struct =
- E_POPUP_RADIO_ITEM_CC (title,
- fn,
- closure,
- 0,
- 0);
- menu_item_struct.is_active = value;
-
- e_popup_menu_copy_1 (menu_item, &menu_item_struct);
-}
-
-static void
-add_popup_menu_item (EPopupMenu *menu_item,
- gchar *title,
- GCallback fn,
- gpointer closure)
-{
- EPopupMenu menu_item_struct =
- E_POPUP_ITEM_CC (title,
- fn,
- closure,
- 0);
-
- e_popup_menu_copy_1 (menu_item, &menu_item_struct);
-}
-
-static void
-define_views_dialog_response(GtkWidget *dialog, int id, GalViewInstance *instance)
-{
- if (id == GTK_RESPONSE_OK) {
- gal_view_collection_save(instance->collection);
- }
- gtk_widget_destroy (dialog);
-}
-
-static void
-define_views_cb(GtkWidget *widget,
- GalViewInstance *instance)
-{
- GtkWidget *dialog = gal_define_views_dialog_new(instance->collection);
- g_signal_connect(dialog, "response",
- G_CALLBACK(define_views_dialog_response), instance);
- gtk_widget_show(dialog);
-}
-
-static void
-save_current_view_cb(GtkWidget *widget,
- GalViewInstance *instance)
-{
- gal_view_instance_save_as (instance);
-}
-
-EPopupMenu *
-gal_view_instance_get_popup_menu (GalViewInstance *instance)
-{
- EPopupMenu *ret_val;
- int length;
- int i;
- gboolean found = FALSE;
- char *id;
-
- length = gal_view_collection_get_count(instance->collection);
- id = gal_view_instance_get_current_view_id (instance);
-
- ret_val = g_new (EPopupMenu, length + 6);
-
- for (i = 0; i < length; i++) {
- gboolean value = FALSE;
- GalViewCollectionItem *item = gal_view_collection_get_view_item(instance->collection, i);
- ListenerClosure *closure;
-
- closure = g_new (ListenerClosure, 1);
- closure->instance = instance;
- closure->id = item->id;
- g_object_ref (closure->instance);
-
- if (!found && id && !strcmp (id, item->id)) {
- found = TRUE;
- value = TRUE;
- }
-
- add_popup_radio_item (ret_val + i, item->title, G_CALLBACK (view_item_cb), closure, value);
- }
-
- if (!found) {
- e_popup_menu_copy_1 (ret_val + i++, &separator);
-
- add_popup_radio_item (ret_val + i++, N_("Custom View"), NULL, NULL, TRUE);
- add_popup_menu_item (ret_val + i++, N_("Save Custom View"), G_CALLBACK (save_current_view_cb), instance);
- }
-
- e_popup_menu_copy_1 (ret_val + i++, &separator);
- add_popup_menu_item (ret_val + i++, N_("Define Views..."), G_CALLBACK (define_views_cb), instance);
- e_popup_menu_copy_1 (ret_val + i++, &terminator);
-
- if (id)
- g_free (id);
-
- return ret_val;
-}
-
-void
-gal_view_instance_free_popup_menu (GalViewInstance *instance, EPopupMenu *menu)
-{
- int i;
- /* This depends on the first non-custom closure to be a separator or a terminator. */
- for (i = 0; menu[i].name && *(menu[i].name); i++) {
- g_object_unref (((ListenerClosure *)(menu[i].closure))->instance);
- g_free (menu[i].closure);
- }
-
- e_popup_menu_free (menu);
-}
diff --git a/widgets/menus/gal-view-instance.h b/widgets/menus/gal-view-instance.h
deleted file mode 100644
index 05723a2ea6..0000000000
--- a/widgets/menus/gal-view-instance.h
+++ /dev/null
@@ -1,116 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * gal-view-instance.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_INSTANCE_H_
-#define _GAL_VIEW_INSTANCE_H_
-
-#include <gtk/gtkobject.h>
-#include <gal/menus/gal-view-collection.h>
-#include <gal/widgets/e-popup-menu.h>
-
-G_BEGIN_DECLS
-
-#define GAL_VIEW_INSTANCE_TYPE (gal_view_instance_get_type ())
-#define GAL_VIEW_INSTANCE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GAL_VIEW_INSTANCE_TYPE, GalViewInstance))
-#define GAL_VIEW_INSTANCE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GAL_VIEW_INSTANCE_TYPE, GalViewInstanceClass))
-#define GAL_IS_VIEW_INSTANCE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GAL_VIEW_INSTANCE_TYPE))
-#define GAL_IS_VIEW_INSTANCE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GAL_VIEW_INSTANCE_TYPE))
-
-typedef struct {
- GObject base;
-
- GalViewCollection *collection;
-
- char *instance_id;
- char *current_view_filename;
- char *custom_filename;
-
- char *current_title;
- char *current_type;
- char *current_id;
-
- GalView *current_view;
-
- guint view_changed_id;
- guint collection_changed_id;
-
- guint loaded : 1;
- char *default_view;
-} GalViewInstance;
-
-typedef struct {
- GObjectClass parent_class;
-
- /*
- * Signals
- */
- void (*display_view) (GalViewInstance *instance,
- GalView *view);
- void (*changed) (GalViewInstance *instance);
-} GalViewInstanceClass;
-
-/* Standard functions */
-GType gal_view_instance_get_type (void);
-
-/* */
-/*collection should be loaded when you call this.
- instance_id: Which instance of this type of object is this (for most of evo, this is the folder id.) */
-GalViewInstance *gal_view_instance_new (GalViewCollection *collection,
- const char *instance_id);
-GalViewInstance *gal_view_instance_construct (GalViewInstance *instance,
- GalViewCollection *collection,
- const char *instance_id);
-
-/* Manipulate the current view. */
-char *gal_view_instance_get_current_view_id (GalViewInstance *instance);
-void gal_view_instance_set_current_view_id (GalViewInstance *instance,
- const char *view_id);
-GalView *gal_view_instance_get_current_view (GalViewInstance *instance);
-
-/* Sets the current view to the given custom view. */
-void gal_view_instance_set_custom_view (GalViewInstance *instance,
- GalView *view);
-
-
-/* Returns true if this instance has ever been used before. */
-gboolean gal_view_instance_exists (GalViewInstance *instance);
-
-/* Manipulate the view collection */
-/* void gal_view_instance_set_as_default (GalViewInstance *instance); */
-void gal_view_instance_save_as (GalViewInstance *instance);
-
-/* This is idempotent. Once it's been called once, the rest of the calls are ignored. */
-void gal_view_instance_load (GalViewInstance *instance);
-
-/* These only mean anything before gal_view_instance_load is called the first time. */
-const char *gal_view_instance_get_default_view (GalViewInstance *instance);
-void gal_view_instance_set_default_view (GalViewInstance *instance,
- const char *id);
-
-EPopupMenu *gal_view_instance_get_popup_menu (GalViewInstance *instance);
-void gal_view_instance_free_popup_menu (GalViewInstance *instance,
- EPopupMenu *menu);
-
-G_END_DECLS
-
-#endif /* _GAL_VIEW_INSTANCE_H_ */
diff --git a/widgets/menus/gal-view-new-dialog.c b/widgets/menus/gal-view-new-dialog.c
deleted file mode 100644
index 6532c4b5a2..0000000000
--- a/widgets/menus/gal-view-new-dialog.c
+++ /dev/null
@@ -1,284 +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 <gtk/gtk.h>
-#include <gtk/gtktreeselection.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>
-#include <gal/util/e-i18n.h>
-#include <gal/util/e-util.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_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
-static void gal_view_new_dialog_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
-static void gal_view_new_dialog_dispose (GObject *object);
-
-static GtkDialogClass *parent_class = NULL;
-#define PARENT_TYPE GTK_TYPE_DIALOG
-
-/* The arguments we take */
-enum {
- PROP_0,
- PROP_NAME,
- PROP_FACTORY
-};
-
-E_MAKE_TYPE(gal_view_new_dialog, "GalViewNewDialog",
- GalViewNewDialog,
- gal_view_new_dialog_class_init,
- gal_view_new_dialog_init, PARENT_TYPE)
-
-static void
-gal_view_new_dialog_class_init (GalViewNewDialogClass *klass)
-{
- GObjectClass *object_class;
-
- object_class = (GObjectClass*) klass;
-
- parent_class = g_type_class_ref (PARENT_TYPE);
-
- object_class->set_property = gal_view_new_dialog_set_property;
- object_class->get_property = gal_view_new_dialog_get_property;
- object_class->dispose = gal_view_new_dialog_dispose;
-
- g_object_class_install_property (object_class, PROP_NAME,
- g_param_spec_string ("name",
- _("Name"),
- /*_( */"XXX blurb" /*)*/,
- NULL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_FACTORY,
- g_param_spec_object ("factory",
- _("Factory"),
- /*_( */"XXX blurb" /*)*/,
- GAL_VIEW_FACTORY_TYPE,
- G_PARAM_READWRITE));
-}
-
-static void
-gal_view_new_dialog_init (GalViewNewDialog *dialog)
-{
- GladeXML *gui;
- GtkWidget *widget;
-
- gui = glade_xml_new (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_container_remove (GTK_CONTAINER (widget->parent), widget);
- gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), widget, TRUE, TRUE, 0);
- gtk_widget_unref(widget);
-
- gtk_dialog_add_buttons (GTK_DIALOG (dialog),
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_OK, GTK_RESPONSE_OK,
- NULL);
-
- gtk_window_set_policy(GTK_WINDOW(dialog), FALSE, TRUE, FALSE);
- gtk_window_set_modal (GTK_WINDOW(dialog), TRUE);
-
- dialog->collection = NULL;
- dialog->selected_factory = NULL;
-}
-
-static void
-gal_view_new_dialog_dispose (GObject *object)
-{
- GalViewNewDialog *gal_view_new_dialog = GAL_VIEW_NEW_DIALOG(object);
-
- if (gal_view_new_dialog->gui)
- g_object_unref(gal_view_new_dialog->gui);
- gal_view_new_dialog->gui = NULL;
-
- if (G_OBJECT_CLASS (parent_class)->dispose)
- (* G_OBJECT_CLASS (parent_class)->dispose) (object);
-}
-
-GtkWidget*
-gal_view_new_dialog_new (GalViewCollection *collection)
-{
- GtkWidget *widget =
- gal_view_new_dialog_construct(g_object_new (GAL_VIEW_NEW_DIALOG_TYPE, NULL),
- collection);
- return widget;
-}
-
-static void
-sensitize_ok_response (GalViewNewDialog *dialog)
-{
- gboolean ok = TRUE;
- const char *text;
-
- text = gtk_entry_get_text (GTK_ENTRY (dialog->entry));
- if (!text || !text[0])
- ok = FALSE;
-
- if (!dialog->selected_factory)
- ok = FALSE;
-
- gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, ok);
-}
-
-static gboolean
-selection_func (GtkTreeSelection *selection,
- GtkTreeModel *model,
- GtkTreePath *path,
- gboolean path_currently_selected,
- gpointer data)
-{
- GtkTreeIter iter;
- GalViewNewDialog *dialog = data;
-
- if (path_currently_selected)
- return TRUE;
-
- gtk_tree_model_get_iter (GTK_TREE_MODEL (dialog->list_store),
- &iter,
- (GtkTreePath*)path);
-
- gtk_tree_model_get (GTK_TREE_MODEL (dialog->list_store),
- &iter,
- 1, &dialog->selected_factory,
- -1);
-
- printf ("%s factory selected\n", gal_view_factory_get_title(dialog->selected_factory));
-
- sensitize_ok_response (dialog);
-
- return TRUE;
-}
-
-static void
-entry_changed (GtkWidget *entry, gpointer data)
-{
- GalViewNewDialog *dialog = data;
-
- sensitize_ok_response (dialog);
-}
-
-GtkWidget*
-gal_view_new_dialog_construct (GalViewNewDialog *dialog,
- GalViewCollection *collection)
-{
- GList *iterator;
- GtkTreeSelection *selection;
- GtkTreeViewColumn *column;
- GtkCellRenderer *rend;
-
- dialog->collection = collection;
- dialog->list = glade_xml_get_widget(dialog->gui,"list-type-list");
- dialog->entry = glade_xml_get_widget(dialog->gui, "entry-name");
- dialog->list_store = gtk_list_store_new (2,
- G_TYPE_STRING,
- G_TYPE_POINTER);
-
- rend = gtk_cell_renderer_text_new ();
- column = gtk_tree_view_column_new_with_attributes ("factory title",
- rend,
- "text", 0,
- NULL);
-
- gtk_tree_view_append_column (GTK_TREE_VIEW (dialog->list), column);
-
- iterator = dialog->collection->factory_list;
- for ( ; iterator; iterator = g_list_next(iterator) ) {
- GalViewFactory *factory = iterator->data;
- GtkTreeIter iter;
-
- g_object_ref(factory);
- gtk_list_store_append (dialog->list_store,
- &iter);
- gtk_list_store_set (dialog->list_store,
- &iter,
- 0, gal_view_factory_get_title(factory),
- 1, factory,
- -1);
- }
-
- gtk_tree_view_set_model (GTK_TREE_VIEW (dialog->list), GTK_TREE_MODEL (dialog->list_store));
-
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (dialog->list));
- gtk_tree_selection_set_select_function (selection, selection_func, dialog, NULL);
-
- g_signal_connect (dialog->entry, "changed",
- G_CALLBACK (entry_changed), dialog);
-
- sensitize_ok_response (dialog);
-
- return GTK_WIDGET(dialog);
-}
-
-static void
-gal_view_new_dialog_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
-{
- GalViewNewDialog *dialog;
- GtkWidget *entry;
-
- dialog = GAL_VIEW_NEW_DIALOG (object);
-
- switch (prop_id){
- case PROP_NAME:
-
- if (entry && GTK_IS_ENTRY(entry)) {
- gtk_entry_set_text(GTK_ENTRY(entry), g_value_get_string (value));
- }
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- return;
- }
-}
-
-
-static void
-gal_view_new_dialog_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
-{
- GalViewNewDialog *dialog;
- GtkWidget *entry;
-
- dialog = GAL_VIEW_NEW_DIALOG (object);
-
- switch (prop_id) {
- case PROP_NAME:
- entry = glade_xml_get_widget(dialog->gui, "entry-name");
- if (entry && GTK_IS_ENTRY(entry)) {
- g_value_set_string (value, gtk_entry_get_text (GTK_ENTRY (entry)));
- }
- break;
- case PROP_FACTORY:
- g_value_set_object (value, dialog->selected_factory);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
diff --git a/widgets/menus/gal-view-new-dialog.glade b/widgets/menus/gal-view-new-dialog.glade
deleted file mode 100644
index 70922f5dc5..0000000000
--- a/widgets/menus/gal-view-new-dialog.glade
+++ /dev/null
@@ -1,175 +0,0 @@
-<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
-<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
-
-<glade-interface>
-
-<widget class="GtkDialog" id="dialog1">
- <property name="title" translatable="yes"></property>
- <property name="type">GTK_WINDOW_TOPLEVEL</property>
- <property name="window_position">GTK_WIN_POS_NONE</property>
- <property name="modal">False</property>
- <property name="resizable">True</property>
- <property name="destroy_with_parent">False</property>
- <property name="has_separator">True</property>
-
- <child internal-child="vbox">
- <widget class="GtkVBox" id="dialog-vbox1">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">8</property>
-
- <child internal-child="action_area">
- <widget class="GtkHButtonBox" id="dialog-action_area1">
- <property name="visible">True</property>
- <property name="layout_style">GTK_BUTTONBOX_END</property>
-
- <child>
- <widget class="GtkButton" id="button1">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-ok</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="response_id">0</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkButton" id="button3">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-cancel</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="response_id">0</property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">GTK_PACK_END</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkTable" id="table-top">
- <property name="visible">True</property>
- <property name="n_rows">4</property>
- <property name="n_columns">1</property>
- <property name="homogeneous">False</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label1">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Name of new view:</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="mnemonic_widget">entry-name</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkEntry" id="entry-name">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="editable">True</property>
- <property name="visibility">True</property>
- <property name="max_length">0</property>
- <property name="text" translatable="yes"></property>
- <property name="has_frame">True</property>
- <property name="invisible_char" translatable="yes">*</property>
- <property name="activates_default">False</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label2">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Type of view:</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkScrolledWindow" id="scrolledwindow1">
- <property name="visible">True</property>
- <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
- <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
- <property name="shadow_type">GTK_SHADOW_IN</property>
- <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
-
- <child>
- <widget class="GtkTreeView" id="list-type-list">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="headers_visible">False</property>
- <property name="rules_hint">False</property>
- <property name="reorderable">False</property>
- <property name="enable_search">True</property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
- <property name="x_options">fill</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- </child>
-</widget>
-
-</glade-interface>
diff --git a/widgets/menus/gal-view-new-dialog.h b/widgets/menus/gal-view-new-dialog.h
deleted file mode 100644
index cd523a2476..0000000000
--- a/widgets/menus/gal-view-new-dialog.h
+++ /dev/null
@@ -1,86 +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 <gtk/gtkdialog.h>
-#include <gtk/gtkliststore.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) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GAL_VIEW_NEW_DIALOG_TYPE, GalViewNewDialog))
-#define GAL_VIEW_NEW_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GAL_VIEW_NEW_DIALOG_TYPE, GalViewNewDialogClass))
-#define GAL_IS_VIEW_NEW_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GAL_VIEW_NEW_DIALOG_TYPE))
-#define GAL_IS_VIEW_NEW_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), GAL_VIEW_NEW_DIALOG_TYPE))
-
-typedef struct _GalViewNewDialog GalViewNewDialog;
-typedef struct _GalViewNewDialogClass GalViewNewDialogClass;
-
-struct _GalViewNewDialog
-{
- GtkDialog parent;
-
- /* item specific fields */
- GladeXML *gui;
-
- GalViewCollection *collection;
- GalViewFactory *selected_factory;
-
- GtkListStore *list_store;
-
- GtkWidget *entry;
- GtkWidget *list;
-};
-
-struct _GalViewNewDialogClass
-{
- GtkDialogClass parent_class;
-};
-
-GtkWidget *gal_view_new_dialog_new (GalViewCollection *collection);
-GType 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 fa1402fae4..0000000000
--- a/widgets/menus/gal-view.c
+++ /dev/null
@@ -1,206 +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 "gal-view.h"
-#include "gal/util/e-util.h"
-
-#define PARENT_TYPE G_TYPE_OBJECT
-
-#define d(x)
-
-d(static gint depth = 0;)
-
-
-static GObjectClass *gal_view_parent_class;
-
-enum {
- CHANGED,
- LAST_SIGNAL
-};
-
-static guint gal_view_signals [LAST_SIGNAL] = { 0, };
-
-/**
- * gal_view_edit
- * @view: The view to edit
- * @parent: the parent window.
- */
-void
-gal_view_edit (GalView *view,
- GtkWindow *parent)
-{
- g_return_if_fail (view != NULL);
- g_return_if_fail (GAL_IS_VIEW (view));
- g_return_if_fail (GTK_IS_WINDOW (parent));
-
- if (GAL_VIEW_GET_CLASS (view)->edit)
- GAL_VIEW_GET_CLASS (view)->edit (view, parent);
-}
-
-/**
- * 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 (GAL_VIEW_GET_CLASS (view)->load)
- GAL_VIEW_GET_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 (GAL_VIEW_GET_CLASS (view)->save)
- GAL_VIEW_GET_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 (GAL_VIEW_GET_CLASS (view)->get_title)
- return GAL_VIEW_GET_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 (GAL_VIEW_GET_CLASS (view)->set_title)
- GAL_VIEW_GET_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 (GAL_VIEW_GET_CLASS (view)->get_type_code)
- return GAL_VIEW_GET_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 (GAL_VIEW_GET_CLASS (view)->clone)
- return GAL_VIEW_GET_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));
-
- g_signal_emit(view,
- gal_view_signals [CHANGED], 0);
-}
-
-static void
-gal_view_class_init (GObjectClass *object_class)
-{
- GalViewClass *klass = GAL_VIEW_CLASS(object_class);
- gal_view_parent_class = g_type_class_ref (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] =
- g_signal_new ("changed",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GalViewClass, changed),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-}
-
-static void
-gal_view_init (GalView *view)
-{
-}
-
-E_MAKE_TYPE(gal_view, "GalView", GalView, gal_view_class_init, gal_view_init, PARENT_TYPE)
diff --git a/widgets/menus/gal-view.h b/widgets/menus/gal-view.h
deleted file mode 100644
index 77056243c5..0000000000
--- a/widgets/menus/gal-view.h
+++ /dev/null
@@ -1,98 +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/gtkwindow.h>
-#include <libxml/tree.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#define GAL_VIEW_TYPE (gal_view_get_type ())
-#define GAL_VIEW(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GAL_VIEW_TYPE, GalView))
-#define GAL_VIEW_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GAL_VIEW_TYPE, GalViewClass))
-#define GAL_IS_VIEW(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GAL_VIEW_TYPE))
-#define GAL_IS_VIEW_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GAL_VIEW_TYPE))
-#define GAL_VIEW_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GAL_VIEW_TYPE, GalViewClass))
-
-typedef struct {
- GObject base;
-} GalView;
-
-typedef struct {
- GObjectClass parent_class;
-
- /*
- * Virtual methods
- */
- void (*edit) (GalView *view, GtkWindow *parent_window);
- 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 */
-GType gal_view_get_type (void);
-
-/* Open an editor dialog for this view, modal/transient for the GtkWindow arg. */
-void gal_view_edit (GalView *view,
- GtkWindow *parent);
-
-/* 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/e-canvas-background.c b/widgets/misc/e-canvas-background.c
deleted file mode 100644
index 0e57feff4e..0000000000
--- a/widgets/misc/e-canvas-background.c
+++ /dev/null
@@ -1,496 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-canvas-background.c - background color for canvas.
- * 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 "e-canvas-background.h"
-
-#include <math.h>
-#include <stdio.h>
-#include <gtk/gtksignal.h>
-#include <gdk/gdkkeysyms.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 "gal/util/e-i18n.h"
-#include <string.h>
-
-#define PARENT_OBJECT_TYPE gnome_canvas_item_get_type ()
-
-#define d(x)
-
-struct _ECanvasBackgroundPrivate {
- guint rgba; /* Fill color, RGBA */
- GdkColor color; /* Fill color */
- GdkBitmap *stipple; /* Stipple for fill */
- GdkGC *gc; /* GC for filling */
- double x1;
- double x2;
- double y1;
- double y2;
-
- guint needs_redraw : 1;
-};
-
-static GnomeCanvasItemClass *parent_class;
-
-enum {
- PROP_0,
- PROP_FILL_COLOR,
- PROP_FILL_COLOR_GDK,
- PROP_FILL_COLOR_RGBA,
- PROP_FILL_STIPPLE,
- PROP_X1,
- PROP_X2,
- PROP_Y1,
- PROP_Y2,
-};
-
-static void
-get_color(ECanvasBackground *ecb)
-{
- GnomeCanvasItem *item = GNOME_CANVAS_ITEM (ecb);
- ecb->priv->color.pixel = gnome_canvas_get_color_pixel (item->canvas,
- GNOME_CANVAS_COLOR (ecb->priv->color.red >> 8,
- ecb->priv->color.green>> 8,
- ecb->priv->color.blue>> 8));
-}
-
-static void
-ecb_bounds (GnomeCanvasItem *item, double *x1, double *y1, double *x2, double *y2)
-{
- double i2c [6];
- ArtPoint c1, c2, i1, i2;
- ECanvasBackground *ecb = E_CANVAS_BACKGROUND (item);
-
- /* Wrong BBox's are the source of redraw nightmares */
-
- gnome_canvas_item_i2c_affine (GNOME_CANVAS_ITEM (ecb), i2c);
-
- i1.x = ecb->priv->x1;
- i1.y = ecb->priv->y1;
- i2.x = ecb->priv->x2;
- i2.y = ecb->priv->y2;
- art_affine_point (&c1, &i1, i2c);
- art_affine_point (&c2, &i2, i2c);
-
- if (ecb->priv->x1 < 0)
- c1.x = -(double)UINT_MAX;
-
- if (ecb->priv->y1 < 0)
- c1.y = -(double)UINT_MAX;
-
- if (ecb->priv->x2 < 0)
- c2.x = (double)UINT_MAX;
-
- if (ecb->priv->y2 < 0)
- c2.y = (double)UINT_MAX;
-
- *x1 = c1.x;
- *y1 = c1.y;
- *x2 = c2.x + 1;
- *y2 = c2.y + 1;
-}
-
-/*
- * GnomeCanvasItem::update method
- */
-static void
-ecb_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags)
-{
- ArtPoint o1, o2;
- ECanvasBackground *ecb = E_CANVAS_BACKGROUND (item);
-
- if (GNOME_CANVAS_ITEM_CLASS (parent_class)->update)
- GNOME_CANVAS_ITEM_CLASS (parent_class)->update (item, affine, clip_path, flags);
-
- o1.x = item->x1;
- o1.y = item->y1;
- o2.x = item->x2;
- o2.y = item->y2;
-
- ecb_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);
- ecb->priv->needs_redraw = 1;
- }
-
- if (ecb->priv->needs_redraw) {
- gnome_canvas_request_redraw (item->canvas, item->x1, item->y1,
- item->x2, item->y2);
- ecb->priv->needs_redraw = 0;
- }
-}
-
-/* Sets the stipple pattern for the text */
-static void
-set_stipple (ECanvasBackground *ecb, GdkBitmap *stipple, int use_value)
-{
- if (use_value) {
- if (ecb->priv->stipple)
- gdk_bitmap_unref (ecb->priv->stipple);
-
- ecb->priv->stipple = stipple;
- if (stipple)
- gdk_bitmap_ref (stipple);
- }
-
- if (ecb->priv->gc) {
- if (stipple) {
- gdk_gc_set_stipple (ecb->priv->gc, stipple);
- gdk_gc_set_fill (ecb->priv->gc, GDK_STIPPLED);
- } else
- gdk_gc_set_fill (ecb->priv->gc, GDK_SOLID);
- }
-}
-
-static void
-ecb_dispose (GObject *object)
-{
- ECanvasBackground *ecb = E_CANVAS_BACKGROUND (object);
-
- if (ecb->priv) {
- if (ecb->priv->stipple)
- gdk_bitmap_unref (ecb->priv->stipple);
- ecb->priv->stipple = NULL;
-
- g_free (ecb->priv);
- ecb->priv = NULL;
- }
-
- if (G_OBJECT_CLASS (parent_class)->dispose)
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static void
-ecb_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- GnomeCanvasItem *item;
- ECanvasBackground *ecb;
-
- GdkColor color = { 0, 0, 0, 0, };
- GdkColor *pcolor;
- gboolean color_changed = FALSE;
-
- item = GNOME_CANVAS_ITEM (object);
- ecb = E_CANVAS_BACKGROUND (object);
-
- switch (prop_id){
- case PROP_FILL_COLOR:
- if (g_value_get_string (value))
- gdk_color_parse (g_value_get_string (value), &color);
-
- ecb->priv->rgba = ((color.red & 0xff00) << 16 |
- (color.green & 0xff00) << 8 |
- (color.blue & 0xff00) |
- 0xff);
- color_changed = TRUE;
- break;
-
- case PROP_FILL_COLOR_GDK:
- pcolor = g_value_get_boxed (value);
- if (pcolor) {
- color = *pcolor;
- }
-
- ecb->priv->rgba = ((color.red & 0xff00) << 16 |
- (color.green & 0xff00) << 8 |
- (color.blue & 0xff00) |
- 0xff);
- color_changed = TRUE;
- break;
-
- case PROP_FILL_COLOR_RGBA:
- ecb->priv->rgba = g_value_get_uint (value);
- color.red = ((ecb->priv->rgba >> 24) & 0xff) * 0x101;
- color.green = ((ecb->priv->rgba >> 16) & 0xff) * 0x101;
- color.blue = ((ecb->priv->rgba >> 8) & 0xff) * 0x101;
- color_changed = TRUE;
- break;
-
- case PROP_FILL_STIPPLE:
- set_stipple (ecb, g_value_get_object (value), TRUE);
- break;
-
- case PROP_X1:
- ecb->priv->x1 = g_value_get_double (value);
- break;
- case PROP_X2:
- ecb->priv->x2 = g_value_get_double (value);
- break;
- case PROP_Y1:
- ecb->priv->y1 = g_value_get_double (value);
- break;
- case PROP_Y2:
- ecb->priv->y2 = g_value_get_double (value);
- break;
- }
-
- if (color_changed) {
- ecb->priv->color = color;
-
- if (GNOME_CANVAS_ITEM_REALIZED & GTK_OBJECT_FLAGS(item)) {
- get_color (ecb);
- if (!item->canvas->aa) {
- gdk_gc_set_foreground (ecb->priv->gc, &ecb->priv->color);
- }
- }
- }
-
- ecb->priv->needs_redraw = 1;
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(ecb));
-}
-
-static void
-ecb_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- GnomeCanvasItem *item;
- ECanvasBackground *ecb;
-
- item = GNOME_CANVAS_ITEM (object);
- ecb = E_CANVAS_BACKGROUND (object);
-
- switch (prop_id){
- case PROP_FILL_COLOR_GDK:
- g_value_set_boxed (value, gdk_color_copy (&ecb->priv->color));
- break;
- case PROP_FILL_COLOR_RGBA:
- g_value_set_uint (value, ecb->priv->rgba);
- break;
- case PROP_FILL_STIPPLE:
- g_value_set_object (value, ecb->priv->stipple);
- break;
- case PROP_X1:
- g_value_set_double (value, ecb->priv->x1);
- break;
- case PROP_X2:
- g_value_set_double (value, ecb->priv->x2);
- break;
- case PROP_Y1:
- g_value_set_double (value, ecb->priv->y1);
- break;
- case PROP_Y2:
- g_value_set_double (value, ecb->priv->y2);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-ecb_init (GnomeCanvasItem *item)
-{
- ECanvasBackground *ecb = E_CANVAS_BACKGROUND (item);
-
- ecb->priv = g_new (ECanvasBackgroundPrivate, 1);
-
- ecb->priv->color.pixel = 0;
- ecb->priv->color.red = 0;
- ecb->priv->color.green = 0;
- ecb->priv->color.blue = 0;
- ecb->priv->stipple = NULL;
- ecb->priv->gc = NULL;
- ecb->priv->x1 = -1.0;
- ecb->priv->x2 = -1.0;
- ecb->priv->y1 = -1.0;
- ecb->priv->y2 = -1.0;
-}
-
-static void
-ecb_realize (GnomeCanvasItem *item)
-{
- ECanvasBackground *ecb = E_CANVAS_BACKGROUND (item);
-
- if (GNOME_CANVAS_ITEM_CLASS (parent_class)->realize)
- GNOME_CANVAS_ITEM_CLASS (parent_class)->realize (item);
-
- ecb->priv->gc = gdk_gc_new (item->canvas->layout.bin_window);
- get_color (ecb);
- if (!item->canvas->aa)
- gdk_gc_set_foreground (ecb->priv->gc, &ecb->priv->color);
-
- set_stipple (ecb, NULL, FALSE);
-
- ecb->priv->needs_redraw = 1;
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (ecb));
-}
-
-static void
-ecb_unrealize (GnomeCanvasItem *item)
-{
- ECanvasBackground *ecb = E_CANVAS_BACKGROUND (item);
-
- gdk_gc_unref (ecb->priv->gc);
- ecb->priv->gc = NULL;
-
- if (GNOME_CANVAS_ITEM_CLASS (parent_class)->unrealize)
- GNOME_CANVAS_ITEM_CLASS (parent_class)->unrealize (item);
-}
-
-static void
-ecb_draw (GnomeCanvasItem *item, GdkDrawable *drawable, int x, int y, int width, int height)
-{
- ECanvasBackground *ecb = E_CANVAS_BACKGROUND (item);
- int x1, x2, y1, y2;
- double i2c [6];
- ArtPoint upper_left, lower_right, ecb_base_point;
-
- /*
- * Find out our real position after grouping
- */
- gnome_canvas_item_i2c_affine (item, i2c);
- ecb_base_point.x = ecb->priv->x1;
- ecb_base_point.y = ecb->priv->y1;
- art_affine_point (&upper_left, &ecb_base_point, i2c);
-
- ecb_base_point.x = ecb->priv->x2;
- ecb_base_point.y = ecb->priv->y2;
- art_affine_point (&lower_right, &ecb_base_point, i2c);
-
- x1 = 0;
- y1 = 0;
- x2 = width;
- y2 = height;
- if (ecb->priv->x1 >= 0 && upper_left.x > x1)
- x1 = upper_left.x;
- if (ecb->priv->y1 >= 0 && upper_left.y > y1)
- y1 = upper_left.y;
- if (ecb->priv->x2 >= 0 && lower_right.x < x2)
- x2 = lower_right.x;
- if (ecb->priv->y2 >= 0 && lower_right.y < y2)
- y2 = lower_right.y;
-
- gdk_draw_rectangle (drawable, ecb->priv->gc, TRUE,
- x1, y1, x2 - x1, y2 - y1);
-}
-
-static double
-ecb_point (GnomeCanvasItem *item, double x, double y, int cx, int cy,
- GnomeCanvasItem **actual_item)
-{
- ECanvasBackground *ecb = E_CANVAS_BACKGROUND (item);
-
- if (ecb->priv->x1 >= 0 && ecb->priv->x1 > x)
- return 1.0;
- if (ecb->priv->x2 >= 0 && ecb->priv->x2 < x)
- return 1.0;
- if (ecb->priv->y1 >= 0 && ecb->priv->y1 > y)
- return 1.0;
- if (ecb->priv->y2 >= 0 && ecb->priv->y2 < y)
- return 1.0;
- *actual_item = item;
-
- return 0.0;
-}
-
-static void
-ecb_class_init (GObjectClass *object_class)
-{
- GnomeCanvasItemClass *item_class = (GnomeCanvasItemClass *) object_class;
-
- parent_class = g_type_class_ref (PARENT_OBJECT_TYPE);
-
- object_class->dispose = ecb_dispose;
- object_class->set_property = ecb_set_property;
- object_class->get_property = ecb_get_property;
-
- item_class->update = ecb_update;
- item_class->realize = ecb_realize;
- item_class->unrealize = ecb_unrealize;
- item_class->draw = ecb_draw;
- item_class->point = ecb_point;
-
- g_object_class_install_property (object_class, PROP_FILL_COLOR,
- g_param_spec_string ("fill_color",
- _( "Fill color" ),
- _( "Fill color" ),
- NULL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_FILL_COLOR_GDK,
- g_param_spec_boxed ("fill_color_gdk",
- _( "GDK fill color" ),
- _( "GDK fill color" ),
- GDK_TYPE_COLOR,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_FILL_COLOR_RGBA,
- g_param_spec_uint ("fill_color_rgba",
- _( "GDK fill color" ),
- _( "GDK fill color" ),
- 0, G_MAXUINT, 0,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_FILL_STIPPLE,
- g_param_spec_object ("fill_stipple",
- _( "Fill stipple" ),
- _( "FIll stipple" ),
- GDK_TYPE_WINDOW,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_X1,
- g_param_spec_double ("x1",
- _( "X1" ),
- _( "X1" ),
- 0.0, G_MAXDOUBLE, 0.0,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_X2,
- g_param_spec_double ("x2",
- _( "X2" ),
- _( "X2" ),
- 0.0, G_MAXDOUBLE, 0.0,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_Y1,
- g_param_spec_double ("y1",
- _( "Y1" ),
- _( "Y1" ),
- 0.0, G_MAXDOUBLE, 0.0,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_Y2,
- g_param_spec_double ("y2",
- _( "Y2" ),
- _( "Y2" ),
- 0.0, G_MAXDOUBLE, 0.0,
- G_PARAM_READWRITE));
-}
-
-E_MAKE_TYPE (e_canvas_background,
- "ECanvasBackground",
- ECanvasBackground,
- ecb_class_init,
- ecb_init,
- PARENT_OBJECT_TYPE)
diff --git a/widgets/misc/e-canvas-background.h b/widgets/misc/e-canvas-background.h
deleted file mode 100644
index 4a8e3294fb..0000000000
--- a/widgets/misc/e-canvas-background.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-canvas-background.h - background color for canvas.
- * 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_CANVAS_BACKGROUND_H
-#define E_CANVAS_BACKGROUND_H
-
-#include <libgnomecanvas/gnome-canvas.h>
-
-G_BEGIN_DECLS
-
-/*
- * name type read/write description
- * ------------------------------------------------------------------------------------------
- * fill_color string W X color specification for fill color,
- * or NULL pointer for no color (transparent)
- * fill_color_gdk GdkColor* RW Allocated GdkColor for fill
- * fill_stipple GdkBitmap* RW Stipple pattern for fill
- * x1 double RW Coordinates for edges of background rectangle
- * x2 double RW Default is all of them = -1.
- * y1 double RW Which means that the entire space is shown.
- * y2 double RW If you need the rectangle to have negative coordinates, use an affine.
- */
-
-
-#define E_CANVAS_BACKGROUND_TYPE (e_canvas_background_get_type ())
-#define E_CANVAS_BACKGROUND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_CANVAS_BACKGROUND_TYPE, ECanvasBackground))
-#define E_CANVAS_BACKGROUND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_CANVAS_BACKGROUND_TYPE, ECanvasBackgroundClass))
-#define E_IS_CANVAS_BACKGROUND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_CANVAS_BACKGROUND_TYPE))
-#define E_IS_CANVAS_BACKGROUND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_CANVAS_BACKGROUND_TYPE))
-
-typedef struct _ECanvasBackground ECanvasBackground;
-typedef struct _ECanvasBackgroundClass ECanvasBackgroundClass;
-typedef struct _ECanvasBackgroundPrivate ECanvasBackgroundPrivate;
-
-struct _ECanvasBackground {
- GnomeCanvasItem item;
-
- ECanvasBackgroundPrivate *priv;
-};
-
-struct _ECanvasBackgroundClass {
- GnomeCanvasItemClass parent_class;
-};
-
-
-/* Standard Gtk function */
-GtkType e_canvas_background_get_type (void);
-
-G_END_DECLS
-
-#endif
diff --git a/widgets/misc/e-canvas-utils.c b/widgets/misc/e-canvas-utils.c
deleted file mode 100644
index 629804a2d7..0000000000
--- a/widgets/misc/e-canvas-utils.c
+++ /dev/null
@@ -1,171 +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;
-
- e_canvas_show_area(dac->canvas, dac->x1, dac->y1, dac->x2, dac->y2);
- g_object_unref (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;
- g_object_ref (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 5b1a329140..0000000000
--- a/widgets/misc/e-canvas-utils.h
+++ /dev/null
@@ -1,55 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * 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 <libgnomecanvas/gnome-canvas.h>
-
-G_BEGIN_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);
-
-G_END_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 354da5d872..0000000000
--- a/widgets/misc/e-canvas-vbox.c
+++ /dev/null
@@ -1,381 +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"
-#include "gal/util/e-i18n.h"
-
-static void e_canvas_vbox_init (ECanvasVbox *CanvasVbox);
-static void e_canvas_vbox_class_init (ECanvasVboxClass *klass);
-static void e_canvas_vbox_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
-static void e_canvas_vbox_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
-static void e_canvas_vbox_dispose (GObject *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);
-
-#define PARENT_TYPE GNOME_TYPE_CANVAS_GROUP
-static GnomeCanvasGroupClass *parent_class = NULL;
-
-/* The arguments we take */
-enum {
- PROP_0,
- PROP_WIDTH,
- PROP_MINIMUM_WIDTH,
- PROP_HEIGHT,
- PROP_SPACING
-};
-
-E_MAKE_TYPE (e_canvas_vbox,
- "ECanvasVbox",
- ECanvasVbox,
- e_canvas_vbox_class_init,
- e_canvas_vbox_init,
- PARENT_TYPE)
-
-static void
-e_canvas_vbox_class_init (ECanvasVboxClass *klass)
-{
- GObjectClass *object_class;
- GnomeCanvasItemClass *item_class;
-
- object_class = (GObjectClass*) klass;
- item_class = (GnomeCanvasItemClass *) klass;
-
- parent_class = g_type_class_ref (PARENT_TYPE);
-
- klass->add_item = e_canvas_vbox_real_add_item;
- klass->add_item_start = e_canvas_vbox_real_add_item_start;
-
- object_class->set_property = e_canvas_vbox_set_property;
- object_class->get_property = e_canvas_vbox_get_property;
- object_class->dispose = e_canvas_vbox_dispose;
-
- /* GnomeCanvasItem method overrides */
- item_class->event = e_canvas_vbox_event;
- item_class->realize = e_canvas_vbox_realize;
-
- g_object_class_install_property (object_class, PROP_WIDTH,
- g_param_spec_double ("width",
- _( "Width" ),
- _( "Width" ),
- 0.0, G_MAXDOUBLE, 0.0,
- G_PARAM_READWRITE));
- g_object_class_install_property (object_class, PROP_MINIMUM_WIDTH,
- g_param_spec_double ("minimum_width",
- _( "Minimum width" ),
- _( "Minimum Width" ),
- 0.0, G_MAXDOUBLE, 0.0,
- G_PARAM_READWRITE));
- g_object_class_install_property (object_class, PROP_HEIGHT,
- g_param_spec_double ("height",
- _( "Height" ),
- _( "Height" ),
- 0.0, G_MAXDOUBLE, 0.0,
- G_PARAM_READABLE));
- g_object_class_install_property (object_class, PROP_SPACING,
- g_param_spec_double ("spacing",
- _( "Spacing" ),
- _( "Spacing" ),
- 0.0, G_MAXDOUBLE, 0.0,
- G_PARAM_READWRITE));
-}
-
-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_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
-{
- GnomeCanvasItem *item;
- ECanvasVbox *e_canvas_vbox;
-
- item = GNOME_CANVAS_ITEM (object);
- e_canvas_vbox = E_CANVAS_VBOX (object);
-
- switch (prop_id){
- case PROP_WIDTH:
- case PROP_MINIMUM_WIDTH:
- e_canvas_vbox->minimum_width = g_value_get_double (value);
- e_canvas_vbox_resize_children(item);
- e_canvas_item_request_reflow(item);
- break;
- case PROP_SPACING:
- e_canvas_vbox->spacing = g_value_get_double (value);
- e_canvas_item_request_reflow(item);
- break;
- }
-}
-
-static void
-e_canvas_vbox_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
-{
- ECanvasVbox *e_canvas_vbox;
-
- e_canvas_vbox = E_CANVAS_VBOX (object);
-
- switch (prop_id) {
- case PROP_WIDTH:
- g_value_set_double (value, e_canvas_vbox->width);
- break;
- case PROP_MINIMUM_WIDTH:
- g_value_set_double (value, e_canvas_vbox->minimum_width);
- break;
- case PROP_HEIGHT:
- g_value_set_double (value, e_canvas_vbox->height);
- break;
- case PROP_SPACING:
- g_value_set_double (value, e_canvas_vbox->spacing);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- 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);
- g_signal_handlers_disconnect_matched (item,
- G_SIGNAL_MATCH_DATA,
- 0, 0, NULL, NULL,
- vbox);
-}
-
-static void
-e_canvas_vbox_dispose (GObject *object)
-{
- ECanvasVbox *vbox = E_CANVAS_VBOX(object);
-
- if (vbox->items) {
- g_list_foreach(vbox->items, disconnect_item_cb, vbox);
- g_list_free(vbox->items);
- vbox->items = NULL;
- }
-
- G_OBJECT_CLASS(parent_class)->dispose (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 (gpointer data, GObject *where_object_was)
-{
- ECanvasVbox *vbox = data;
- vbox->items = g_list_remove(vbox->items, where_object_was);
-}
-
-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);
- g_object_weak_ref (G_OBJECT (item),
- 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);
- g_object_weak_ref (G_OBJECT (item),
- 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;
- g_object_get (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;
-
- g_object_get (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_GET_CLASS(e_canvas_vbox))->add_item)
- (E_CANVAS_VBOX_CLASS(GTK_OBJECT_GET_CLASS(e_canvas_vbox))->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_GET_CLASS(e_canvas_vbox))->add_item_start)
- (E_CANVAS_VBOX_CLASS(GTK_OBJECT_GET_CLASS(e_canvas_vbox))->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 7d80e7c056..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 <libgnomecanvas/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) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_CANVAS_VBOX_TYPE, ECanvasVbox))
-#define E_CANVAS_VBOX_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_CANVAS_VBOX_TYPE, ECanvasVboxClass))
-#define E_IS_CANVAS_VBOX(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_CANVAS_VBOX_TYPE))
-#define E_IS_CANVAS_VBOX_CLASS(klass) (G_TYPE_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 8be100fb4a..0000000000
--- a/widgets/misc/e-canvas.c
+++ /dev/null
@@ -1,1096 +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"
-#include <X11/Xlib.h>
-#include <gtk/gtkmain.h>
-#include <gtk/gtkimmulticontext.h>
-
-static void e_canvas_init (ECanvas *card);
-static void e_canvas_dispose (GObject *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);
-
-#define PARENT_TYPE GNOME_TYPE_CANVAS
-static GnomeCanvasClass *parent_class = NULL;
-
-#define d(x)
-
-enum {
- REFLOW,
- LAST_SIGNAL
-};
-
-static guint e_canvas_signals [LAST_SIGNAL] = { 0, };
-
-E_MAKE_TYPE (e_canvas,
- "ECanvas",
- ECanvas,
- e_canvas_class_init,
- e_canvas_init,
- PARENT_TYPE)
-
-static void
-e_canvas_class_init (ECanvasClass *klass)
-{
- GObjectClass *object_class;
- GnomeCanvasClass *canvas_class;
- GtkWidgetClass *widget_class;
-
- object_class = (GObjectClass*) klass;
- canvas_class = (GnomeCanvasClass *) klass;
- widget_class = (GtkWidgetClass *) klass;
-
- parent_class = g_type_class_ref (PARENT_TYPE);
-
- object_class->dispose = e_canvas_dispose;
-
- 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] =
- g_signal_new ("reflow",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ECanvasClass, reflow),
- NULL, NULL,
- e_marshal_NONE__NONE,
- G_TYPE_NONE, 0);
-}
-
-static void
-e_canvas_init (ECanvas *canvas)
-{
- canvas->selection = NULL;
- canvas->cursor = NULL;
- canvas->im_context = gtk_im_multicontext_new ();
- canvas->tooltip_window = NULL;
-}
-
-static void
-e_canvas_dispose (GObject *object)
-{
- ECanvas *canvas = E_CANVAS(object);
-
- if (canvas->idle_id)
- g_source_remove(canvas->idle_id);
- canvas->idle_id = 0;
-
- if (canvas->grab_cancelled_check_id)
- g_source_remove (canvas->grab_cancelled_check_id);
- canvas->grab_cancelled_check_id = 0;
-
- if (canvas->toplevel) {
- if (canvas->visibility_notify_id)
- g_signal_handler_disconnect (canvas->toplevel,
- canvas->visibility_notify_id);
- canvas->visibility_notify_id = 0;
-
- g_object_unref (canvas->toplevel);
- canvas->toplevel = NULL;
- }
-
- if (canvas->im_context) {
- g_object_unref (canvas->im_context);
- canvas->im_context = NULL;
- }
-
- e_canvas_hide_tooltip(canvas);
-
- if ((G_OBJECT_CLASS (parent_class))->dispose)
- (*(G_OBJECT_CLASS (parent_class))->dispose) (object);
-}
-
-GtkWidget *
-e_canvas_new ()
-{
- return GTK_WIDGET (g_object_new (E_CANVAS_TYPE, NULL));
-}
-
-
-/* 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 = gdk_event_copy (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) {
- g_object_ref (item);
-
- g_signal_emit_by_name (item, "event", ev, &finished);
-
- parent = item->parent;
- g_object_unref (item);
-
- item = parent;
- }
-
- gdk_event_free (ev);
-
- 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 (GTK_OBJECT_GET_CLASS (item))->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 + canvas->scroll_x1 - canvas->zoom_xofs;
- y = canvas->pick_event.crossing.y + canvas->scroll_y1 - canvas->zoom_yofs;
- } else {
- x = canvas->pick_event.motion.x + canvas->scroll_x1 - canvas->zoom_xofs;
- y = canvas->pick_event.motion.y + canvas->scroll_y1 - 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);
-
- gtk_im_context_focus_in (ecanvas->im_context);
-
- 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);
-
- gtk_im_context_focus_out (ecanvas->im_context);
-
- 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 = g_signal_lookup ("style_set", G_OBJECT_TYPE (item));
- if (signal_id >= 1) {
- GSignalQuery query;
- g_signal_query (signal_id, &query);
- if (query.return_type == GTK_TYPE_NONE && query.n_params == 1 && query.param_types[0] == GTK_TYPE_STYLE) {
- g_signal_emit (item, signal_id, 0, previous_style);
- }
- }
-
- 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)
-{
- 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);
-
- gtk_im_context_set_client_window (ecanvas->im_context, widget->window);
-}
-
-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;
- }
-
- gtk_im_context_set_client_window (ecanvas->im_context, widget->window);
-
- 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 = (ECanvasItemReflowFunc)
- g_object_get_data (G_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;
-
- g_signal_emit (canvas,
- e_canvas_signals [REFLOW], 0);
-
- 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)
-{
- g_object_set_data(G_OBJECT(item), "ECanvasItem::reflow_callback", (gpointer) func);
-}
-
-
-void
-e_canvas_item_set_selection_callback (GnomeCanvasItem *item, ECanvasItemSelectionFunc func)
-{
- g_object_set_data(G_OBJECT(item), "ECanvasItem::selection_callback", (gpointer) func);
-}
-
-void
-e_canvas_item_set_selection_compare_callback (GnomeCanvasItem *item, ECanvasItemSelectionCompareFunc func)
-{
- g_object_set_data(G_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 = (ECanvasItemSelectionFunc)g_object_get_data(G_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);
- g_object_unref (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;
- g_object_ref (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 = (ECanvasItemSelectionFunc)g_object_get_data(G_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 = (ECanvasItemSelectionFunc)g_object_get_data(G_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 = (ECanvasItemSelectionCompareFunc)g_object_get_data(G_OBJECT(search->item),
- "ECanvasItem::selection_compare_callback");
-
- if (compare_func(search->item, search->id, id, 0) == 0) {
- canvas->cursor = search;
- func = (ECanvasItemSelectionFunc)g_object_get_data(G_OBJECT(item),
- "ECanvasItem::selection_callback");
- if (func)
- func(item, flags, search->id);
- return;
- }
- }
- }
-
- info = g_new(ECanvasSelectionInfo, 1);
- info->item = item;
- g_object_ref (info->item);
- info->id = id;
- g_message ("ECANVAS: new info (2): item %p, id %p", item, id);
-
- func = (ECanvasItemSelectionFunc)g_object_get_data(G_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 = (ECanvasItemSelectionCompareFunc)g_object_get_data(G_OBJECT(info->item),
- "ECanvasItem::selection_compare_callback");
-
- if (compare_func(info->item, info->id, id, 0) == 0) {
- ECanvasItemSelectionFunc func;
- func = (ECanvasItemSelectionFunc) g_object_get_data(G_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);
- g_object_unref (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);
- g_object_ref (canvas->toplevel);
- canvas->visibility_notify_id =
- g_signal_connect (canvas->toplevel, "visibility_notify_event",
- G_CALLBACK (e_canvas_visibility), canvas);
- }
- }
- gtk_widget_set_uposition (widget, x, y);
- gtk_widget_show (widget);
-}
-
-void e_canvas_hide_tooltip (ECanvas *canvas)
-{
- if (canvas->tooltip_window) {
- gtk_widget_destroy (canvas->tooltip_window);
- canvas->tooltip_window = NULL;
- }
-}
-
-
-static gboolean
-grab_cancelled_check (gpointer data)
-{
- ECanvas *canvas = data;
-
- if (GNOME_CANVAS (canvas)->grabbed_item == NULL) {
- canvas->grab_cancelled_cb = NULL;
- canvas->grab_cancelled_check_id = 0;
- canvas->grab_cancelled_time = 0;
- canvas->grab_cancelled_data = NULL;
- return FALSE;
- }
-
- if (gtk_grab_get_current ()) {
- gnome_canvas_item_ungrab(GNOME_CANVAS (canvas)->grabbed_item, canvas->grab_cancelled_time);
- if (canvas->grab_cancelled_cb) {
- canvas->grab_cancelled_cb (canvas,
- GNOME_CANVAS (canvas)->grabbed_item,
- canvas->grab_cancelled_data);
- }
- canvas->grab_cancelled_cb = NULL;
- canvas->grab_cancelled_check_id = 0;
- canvas->grab_cancelled_time = 0;
- canvas->grab_cancelled_data = NULL;
- return FALSE;
- }
- return TRUE;
-}
-
-int
-e_canvas_item_grab (ECanvas *canvas,
- GnomeCanvasItem *item,
- guint event_mask,
- GdkCursor *cursor,
- guint32 etime,
- ECanvasItemGrabCancelled cancelled_cb,
- gpointer cancelled_data)
-{
- if (gtk_grab_get_current ()) {
- return AlreadyGrabbed;
- } else {
- int ret_val = gnome_canvas_item_grab (item, event_mask, cursor, etime);
- if (ret_val == GrabSuccess) {
- canvas->grab_cancelled_cb = cancelled_cb;
- canvas->grab_cancelled_check_id =
- g_timeout_add_full (G_PRIORITY_LOW,
- 100,
- grab_cancelled_check,
- canvas,
- NULL);
- canvas->grab_cancelled_time = etime;
- canvas->grab_cancelled_data = cancelled_data;
- }
-
- return ret_val;
- }
-}
-
-void
-e_canvas_item_ungrab (ECanvas *canvas,
- GnomeCanvasItem *item,
- guint32 etime)
-{
- if (canvas->grab_cancelled_check_id) {
- g_source_remove (canvas->grab_cancelled_check_id);
- canvas->grab_cancelled_cb = NULL;
- canvas->grab_cancelled_check_id = 0;
- canvas->grab_cancelled_time = 0;
- canvas->grab_cancelled_data = NULL;
- gnome_canvas_item_ungrab (item, etime);
- }
-}
diff --git a/widgets/misc/e-canvas.h b/widgets/misc/e-canvas.h
deleted file mode 100644
index 092833430b..0000000000
--- a/widgets/misc/e-canvas.h
+++ /dev/null
@@ -1,157 +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 <gtk/gtkimcontext.h>
-#include <libgnomecanvas/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) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_CANVAS_TYPE, ECanvas))
-#define E_CANVAS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_CANVAS_TYPE, ECanvasClass))
-#define E_IS_CANVAS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_CANVAS_TYPE))
-#define E_IS_CANVAS_CLASS(klass) (G_TYPE_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;
-
-typedef void (*ECanvasItemGrabCancelled) (ECanvas *canvas, GnomeCanvasItem *item, gpointer data);
-
-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 */
- GtkIMContext *im_context;
-
- ECanvasItemGrabCancelled grab_cancelled_cb;
- guint grab_cancelled_check_id;
- guint32 grab_cancelled_time;
- gpointer grab_cancelled_data;
-};
-
-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);
-
-int e_canvas_item_grab (ECanvas *canvas,
- GnomeCanvasItem *item,
- guint event_mask,
- GdkCursor *cursor,
- guint32 etime,
- ECanvasItemGrabCancelled cancelled,
- gpointer cancelled_data);
-void e_canvas_item_ungrab (ECanvas *canvas,
- GnomeCanvasItem *item,
- guint32 etime);
-
-/* 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 3f16437bee..0000000000
--- a/widgets/misc/e-colors.c
+++ /dev/null
@@ -1,103 +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"
-
-GdkColor e_white, e_dark_gray, e_black;
-
-gulong
-e_color_alloc (gushort red, gushort green, gushort blue)
-{
- e_color_init ();
-
- red >>= 8;
- green >>= 8;
- blue >>= 8;
- return gdk_rgb_xpixel_from_rgb (
- ((red & 0xff) << 16) | ((green & 0xff) << 8) |
- (blue & 0xff));
-}
-
-void
-e_color_alloc_gdk (GtkWidget *widget, GdkColor *c)
-{
- GdkColormap *map;
-
- e_color_init ();
-
- if (widget)
- map = gtk_widget_get_colormap (widget);
- else /* FIXME: multi depth broken ? */
- map = gtk_widget_get_default_colormap ();
-
- gdk_rgb_find_color (map, c);
-}
-
-void
-e_color_alloc_name (GtkWidget *widget, const char *name, GdkColor *c)
-{
- GdkColormap *map;
-
- e_color_init ();
-
- gdk_color_parse (name, c);
-
- if (widget)
- map = gtk_widget_get_colormap (widget);
- else /* FIXME: multi depth broken ? */
- map = gtk_widget_get_default_colormap ();
-
- gdk_rgb_find_color (map, c);
-}
-
-void
-e_color_init (void)
-{
- static gboolean e_color_inited = FALSE;
-
- /* It's surprisingly easy to end up calling this twice. Survive. */
- if (e_color_inited)
- return;
-
- e_color_inited = TRUE;
-
- /* Allocate the default colors */
- e_white.red = 65535;
- e_white.green = 65535;
- e_white.blue = 65535;
- e_color_alloc_gdk (NULL, &e_white);
-
- e_black.red = 0;
- e_black.green = 0;
- e_black.blue = 0;
- e_color_alloc_gdk (NULL, &e_black);
-
- e_color_alloc_name (NULL, "gray20", &e_dark_gray);
-}
-
diff --git a/widgets/misc/e-colors.h b/widgets/misc/e-colors.h
deleted file mode 100644
index 596fd2b0a5..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 <gtk/gtkwidget.h>
-
-G_BEGIN_DECLS
-
-void e_color_init (void);
-
-/* Return the pixel value for the given red, green and blue */
-gulong e_color_alloc (gushort red, gushort green, gushort blue);
-void e_color_alloc_name (GtkWidget *widget, const char *name, GdkColor *color);
-void e_color_alloc_gdk (GtkWidget *widget, GdkColor *color);
-
-extern GdkColor e_white, e_dark_gray, e_black;
-
-G_END_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 3b44ab809e..0000000000
--- a/widgets/misc/e-cursors.c
+++ /dev/null
@@ -1,156 +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, GDK_INTERNAL_CURSOR, GDK_XTERM, NULL },
- { NULL, 0, 0, NULL }
-};
-
-
-static void
-create_bitmap_and_mask_from_xpm (GdkBitmap **bitmap, GdkBitmap **mask, gchar **xpm)
-{
- int height, width, colors;
- char pixmap_buffer [(32 * 32)/8];
- char mask_buffer [(32 * 32)/8];
- int x, y, pix, yofs;
- int transparent_color, black_color;
-
- sscanf (xpm [0], "%d %d %d %d", &height, &width, &colors, &pix);
-
- g_assert (height == 32);
- g_assert (width == 32);
- g_assert (colors <= 3);
-
- transparent_color = ' ';
- black_color = '.';
-
- yofs = colors + 1;
- for (y = 0; y < 32; y++){
- for (x = 0; x < 32;){
- char value = 0, maskv = 0;
-
- for (pix = 0; pix < 8; pix++, x++){
- if (xpm [y + yofs][x] != transparent_color){
- maskv |= 1 << pix;
-
- /*
- * Invert the colours here because it seems
- * to workaround a bug the Matrox G100 Xserver?
- * We reverse the foreground & background in the next
- * routine to compensate.
- */
- if (xpm [y + yofs][x] == black_color){
- value |= 1 << pix;
- }
- }
- }
- pixmap_buffer [(y * 4 + x/8)-1] = value;
- mask_buffer [(y * 4 + x/8)-1] = maskv;
- }
- }
- *bitmap = gdk_bitmap_create_from_data (NULL, pixmap_buffer, 32, 32);
- *mask = gdk_bitmap_create_from_data (NULL, mask_buffer, 32, 32);
-}
-
-void
-e_cursors_init (void)
-{
- int i;
-
- e_color_init ();
-
- 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 8e751b659d..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>
-
-G_BEGIN_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_XTERM,
- 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);
-
-G_END_DECLS
-
-#endif /* GNOME_APP_LIB_CURSORS_H */
diff --git a/widgets/misc/e-gui-utils.c b/widgets/misc/e-gui-utils.c
deleted file mode 100644
index 886fb3d7ca..0000000000
--- a/widgets/misc/e-gui-utils.c
+++ /dev/null
@@ -1,238 +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.
- */
-
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "e-gui-utils.h"
-
-#include <gtk/gtkentry.h>
-#include <gtk/gtksignal.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <libgnomecanvas/gnome-canvas-pixbuf.h>
-
-void
-e_auto_kill_popup_menu_on_selection_done (GtkMenu *menu)
-{
- g_return_if_fail (GTK_IS_MENU (menu));
-
- g_signal_connect (menu, "selection_done", G_CALLBACK (gtk_widget_destroy), menu);
-}
-
-void
-e_popup_menu (GtkMenu *menu, GdkEvent *event)
-{
- g_return_if_fail (GTK_IS_MENU (menu));
-
- e_auto_kill_popup_menu_on_selection_done (menu);
-
- if (event) {
- 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) g_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_widget_child_focus (GTK_WIDGET (child), direction)) {
- g_signal_stop_emission_by_name (container, "focus");
- return TRUE;
- }
- }
- }
- else if (GTK_WIDGET_DRAWABLE (child)) {
- if (GTK_IS_CONTAINER (child)) {
- if (gtk_widget_child_focus (GTK_WIDGET (child), direction)) {
- g_signal_stop_emission_by_name (container, "focus");
- return TRUE;
- }
- }
- else if (GTK_WIDGET_CAN_FOCUS (child)) {
- gtk_widget_grab_focus (child);
- g_signal_stop_emission_by_name (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) g_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, GCallback cb, gpointer closure)
-{
- GtkWidget *widget;
-
- widget = glade_xml_get_widget (gui, name);
-
- if (widget) {
- g_signal_connect (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 c52e233714..0000000000
--- a/widgets/misc/e-gui-utils.h
+++ /dev/null
@@ -1,58 +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 <glade/glade-xml.h>
-
-G_BEGIN_DECLS
-
-void e_popup_menu (GtkMenu *menu,
- GdkEvent *event);
-void e_auto_kill_popup_menu_on_selection_done (GtkMenu *menu);
-
-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);
-
-G_END_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 a5007b9b83..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 bbde282697..0000000000
--- a/widgets/misc/e-hsv-utils.h
+++ /dev/null
@@ -1,52 +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 <gdk/gdk.h>
-
-G_BEGIN_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);
-
-G_END_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 8607cd1b01..0000000000
--- a/widgets/misc/e-popup-menu.c
+++ /dev/null
@@ -1,240 +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 <gtk/gtkimage.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 <gtk/gtkimagemenuitem.h>
-
-#include "e-popup-menu.h"
-#include "e-gui-utils.h"
-
-#include <gal/util/e-i18n.h>
-
-/*
- * Creates an item with an optional icon
- */
-static void
-make_item (GtkMenu *menu, GtkMenuItem *item, const char *name, GtkWidget *pixmap)
-{
- GtkWidget *label;
-
- if (*name == '\0')
- return;
-
- /*
- * Ugh. This needs to go into Gtk+
- */
- label = gtk_label_new_with_mnemonic (name);
- gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
- gtk_widget_show (label);
-
- gtk_container_add (GTK_CONTAINER (item), label);
-
- if (pixmap && GTK_IS_IMAGE_MENU_ITEM (item)){
- gtk_widget_show (pixmap);
- gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), pixmap);
- }
-}
-
-GtkMenu *
-e_popup_menu_create (EPopupMenu *menu_list,
- guint32 disable_mask,
- guint32 hide_mask,
- void *default_closure)
-{
- return e_popup_menu_create_with_domain (menu_list,
- disable_mask,
- hide_mask,
- default_closure,
- NULL);
-}
-
-
-GtkMenu *
-e_popup_menu_create_with_domain (EPopupMenu *menu_list,
- guint32 disable_mask,
- guint32 hide_mask,
- void *default_closure,
- const char *domain)
-{
- 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_image_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_get_group (GTK_RADIO_MENU_ITEM (item));
-
- make_item (menu, GTK_MENU_ITEM (item), dgettext(domain, menu_list[i].name), menu_list[i].pixmap_widget);
- } else {
- item = gtk_menu_item_new ();
- }
-
- gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
-
- if (!menu_list[i].submenu) {
- if (menu_list[i].fn)
- g_signal_connect (item, "activate",
- G_CALLBACK (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);
-}
-
-void
-e_popup_menu_copy_1 (EPopupMenu *destination,
- const EPopupMenu *source)
-{
- destination->name = g_strdup (source->name);
- destination->pixname = g_strdup (source->pixname);
- destination->fn = source->fn;
- destination->submenu = e_popup_menu_copy (source->submenu);
- destination->disable_mask = source->disable_mask;
-
- destination->pixmap_widget = source->pixmap_widget;
- if (destination->pixmap_widget)
- g_object_ref (destination->pixmap_widget);
- destination->closure = source->closure;
-
- destination->is_toggle = source->is_toggle;
- destination->is_radio = source->is_radio;
- destination->is_active = source->is_active;
-
- destination->use_custom_closure = source->use_custom_closure;
-}
-
-void
-e_popup_menu_free_1 (EPopupMenu *menu_item)
-{
- g_free (menu_item->name);
- g_free (menu_item->pixname);
- e_popup_menu_free (menu_item->submenu);
-
- if (menu_item->pixmap_widget)
- g_object_unref (menu_item->pixmap_widget);
-}
-
-EPopupMenu *
-e_popup_menu_copy (const EPopupMenu *menu_list)
-{
- int i;
- EPopupMenu *ret_val;
-
- if (menu_list == NULL)
- return NULL;
-
- for (i = 0; menu_list[i].name; i++) {
- /* Intentionally empty */
- }
-
- ret_val = g_new (EPopupMenu, i + 1);
-
- for (i = 0; menu_list[i].name; i++) {
- e_popup_menu_copy_1 (ret_val + i, menu_list + i);
- }
-
- /* Copy the terminator */
- e_popup_menu_copy_1 (ret_val + i, menu_list + i);
-
- return ret_val;
-}
-
-void
-e_popup_menu_free (EPopupMenu *menu_list)
-{
- int i;
-
- if (menu_list == NULL)
- return;
-
- for (i = 0; menu_list[i].name; i++) {
- e_popup_menu_free_1 (menu_list + i);
- }
- g_free (menu_list);
-}
-
diff --git a/widgets/misc/e-popup-menu.h b/widgets/misc/e-popup-menu.h
deleted file mode 100644
index 7289ab5c86..0000000000
--- a/widgets/misc/e-popup-menu.h
+++ /dev/null
@@ -1,142 +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>
-
-G_BEGIN_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_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;
- char *pixname;
- GtkSignalFunc fn;
-
- 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);
-GtkMenu *e_popup_menu_create_with_domain (EPopupMenu *menu_list,
- guint32 disable_mask,
- guint32 hide_mask,
- void *default_closure,
- const char *domain);
-void e_popup_menu_run (EPopupMenu *menu_list,
- GdkEvent *event,
- guint32 disable_mask,
- guint32 hide_mask,
- void *default_closure);
-
-/* Doesn't copy or free the memory. Just the contents. */
-void e_popup_menu_copy_1 (EPopupMenu *destination,
- const EPopupMenu *menu_item);
-void e_popup_menu_free_1 (EPopupMenu *menu_item);
-
-/* Copies or frees the entire structure. */
-EPopupMenu *e_popup_menu_copy (const EPopupMenu *menu_item);
-void e_popup_menu_free (EPopupMenu *menu_item);
-
-G_END_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 534f153823..0000000000
--- a/widgets/misc/e-printable.c
+++ /dev/null
@@ -1,209 +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_TYPE_OBJECT
-
-
-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 = g_type_class_ref (PARENT_TYPE);
-
- e_printable_signals [PRINT_PAGE] =
- g_signal_new ("print_page",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EPrintableClass, print_page),
- NULL, NULL,
- e_marshal_NONE__OBJECT_DOUBLE_DOUBLE_BOOLEAN,
- G_TYPE_NONE, 4, G_TYPE_OBJECT, G_TYPE_DOUBLE,
- G_TYPE_DOUBLE, G_TYPE_BOOLEAN);
-
- e_printable_signals [DATA_LEFT] =
- g_signal_new ("data_left",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EPrintableClass, data_left),
- NULL, NULL,
- e_marshal_BOOLEAN__NONE,
- G_TYPE_BOOLEAN, 0, G_TYPE_NONE);
-
- e_printable_signals [RESET] =
- g_signal_new ("reset",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EPrintableClass, reset),
- NULL, NULL,
- e_marshal_NONE__NONE,
- G_TYPE_NONE, 0, G_TYPE_NONE);
-
- e_printable_signals [HEIGHT] =
- g_signal_new ("height",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EPrintableClass, height),
- NULL, NULL,
- e_marshal_DOUBLE__OBJECT_DOUBLE_DOUBLE_BOOLEAN,
- G_TYPE_DOUBLE, 4, G_TYPE_OBJECT, G_TYPE_DOUBLE,
- G_TYPE_DOUBLE, G_TYPE_BOOLEAN);
-
- e_printable_signals [WILL_FIT] =
- g_signal_new ("will_fit",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EPrintableClass, will_fit),
- NULL, NULL,
- e_marshal_BOOLEAN__OBJECT_DOUBLE_DOUBLE_BOOLEAN,
- G_TYPE_BOOLEAN, 4, G_TYPE_OBJECT, G_TYPE_DOUBLE,
- G_TYPE_DOUBLE, G_TYPE_BOOLEAN);
-
- klass->print_page = NULL;
- klass->data_left = NULL;
- klass->reset = NULL;
- klass->height = NULL;
- klass->will_fit = NULL;
-}
-
-
-E_MAKE_TYPE (e_printable,
- "EPrintable",
- EPrintable,
- e_printable_class_init,
- NULL,
- PARENT_TYPE)
-
-EPrintable *
-e_printable_new(void)
-{
- return E_PRINTABLE(g_object_new(E_PRINTABLE_TYPE, NULL));
-}
-
-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));
-
- g_signal_emit (e_printable,
- e_printable_signals [PRINT_PAGE], 0,
- 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);
-
- g_signal_emit (e_printable,
- e_printable_signals [DATA_LEFT], 0,
- &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));
-
- g_signal_emit (e_printable,
- e_printable_signals [RESET], 0);
-}
-
-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);
-
- g_signal_emit (e_printable,
- e_printable_signals [HEIGHT], 0,
- 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);
-
- g_signal_emit (e_printable,
- e_printable_signals [WILL_FIT], 0,
- 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 0c665f89c2..0000000000
--- a/widgets/misc/e-printable.h
+++ /dev/null
@@ -1,90 +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>
-
-G_BEGIN_DECLS
-
-#define E_PRINTABLE_TYPE (e_printable_get_type ())
-#define E_PRINTABLE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_PRINTABLE_TYPE, EPrintable))
-#define E_PRINTABLE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_PRINTABLE_TYPE, EPrintableClass))
-#define E_IS_PRINTABLE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_PRINTABLE_TYPE))
-#define E_IS_PRINTABLE_CLASS(k) (G_TYPE_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);
-
-G_END_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 33a5498df5..0000000000
--- a/widgets/misc/e-reflow-model.c
+++ /dev/null
@@ -1,355 +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 "gal/util/e-util.h"
-
-#define PARENT_TYPE G_TYPE_OBJECT
-
-#define d(x)
-
-d(static gint depth = 0;)
-
-
-static GObjectClass *e_reflow_model_parent_class;
-
-enum {
- MODEL_CHANGED,
- COMPARISON_CHANGED,
- MODEL_ITEMS_INSERTED,
- MODEL_ITEM_CHANGED,
- MODEL_ITEM_REMOVED,
- 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));
-
- E_REFLOW_MODEL_GET_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 E_REFLOW_MODEL_GET_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 E_REFLOW_MODEL_GET_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 E_REFLOW_MODEL_GET_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 E_REFLOW_MODEL_GET_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));
-
- E_REFLOW_MODEL_GET_CLASS (e_reflow_model)->reincarnate (e_reflow_model, n, item);
-}
-
-static void
-e_reflow_model_class_init (GObjectClass *object_class)
-{
- EReflowModelClass *klass = E_REFLOW_MODEL_CLASS(object_class);
- e_reflow_model_parent_class = g_type_class_ref (PARENT_TYPE);
-
- e_reflow_model_signals [MODEL_CHANGED] =
- g_signal_new ("model_changed",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EReflowModelClass, model_changed),
- NULL, NULL,
- e_marshal_NONE__NONE,
- G_TYPE_NONE, 0);
-
- e_reflow_model_signals [COMPARISON_CHANGED] =
- g_signal_new ("comparison_changed",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EReflowModelClass, comparison_changed),
- NULL, NULL,
- e_marshal_NONE__NONE,
- G_TYPE_NONE, 0);
-
- e_reflow_model_signals [MODEL_ITEMS_INSERTED] =
- g_signal_new ("model_items_inserted",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EReflowModelClass, model_items_inserted),
- NULL, NULL,
- e_marshal_NONE__INT_INT,
- G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
-
- e_reflow_model_signals [MODEL_ITEM_CHANGED] =
- g_signal_new ("model_item_changed",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EReflowModelClass, model_item_changed),
- NULL, NULL,
- e_marshal_NONE__INT,
- G_TYPE_NONE, 1, G_TYPE_INT);
-
- e_reflow_model_signals [MODEL_ITEM_REMOVED] =
- g_signal_new ("model_item_removed",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EReflowModelClass, model_item_removed),
- NULL, NULL,
- e_marshal_NONE__INT,
- G_TYPE_NONE, 1, G_TYPE_INT);
-
- klass->set_width = NULL;
- klass->count = NULL;
- klass->height = NULL;
- klass->incarnate = NULL;
- klass->reincarnate = NULL;
-
- klass->model_changed = NULL;
- klass->comparison_changed = NULL;
- klass->model_items_inserted = NULL;
- klass->model_item_removed = NULL;
- klass->model_item_changed = NULL;
-}
-
-static void
-e_reflow_model_init (GObject *object)
-{
-}
-
-E_MAKE_TYPE(e_reflow_model, "EReflowModel", EReflowModel,
- e_reflow_model_class_init, e_reflow_model_init, PARENT_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++);
- g_signal_emit (e_reflow_model,
- e_reflow_model_signals [MODEL_CHANGED], 0);
- d(depth--);
-}
-
-/**
- * e_reflow_model_comparison_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
- * sorting has changed. The actual contents of the items hasn't, so
- * there's no need to re-query the model for the heights of the
- * individual items.
- */
-void
-e_reflow_model_comparison_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 comparison_changed on model 0x%p.\n", e_reflow_model));
- d(depth++);
- g_signal_emit (e_reflow_model,
- e_reflow_model_signals [COMPARISON_CHANGED], 0);
- 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++);
- g_signal_emit (e_reflow_model,
- e_reflow_model_signals [MODEL_ITEMS_INSERTED], 0,
- position, count);
- d(depth--);
-}
-
-/**
- * e_reflow_model_item_removed:
- * @e_reflow_model: The model changed.
- * @n: The position from which the items were removed.
- *
- * Use this function to notify any views of the reflow model that an
- * item has been removed.
- **/
-void
-e_reflow_model_item_removed (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_removed on model 0x%p, n=%d.\n", e_reflow_model, n));
- d(depth++);
- g_signal_emit (e_reflow_model,
- e_reflow_model_signals [MODEL_ITEM_REMOVED], 0,
- n);
- 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++);
- g_signal_emit (e_reflow_model,
- e_reflow_model_signals [MODEL_ITEM_CHANGED], 0,
- n);
- d(depth--);
-}
diff --git a/widgets/misc/e-reflow-model.h b/widgets/misc/e-reflow-model.h
deleted file mode 100644
index 25731b2af5..0000000000
--- a/widgets/misc/e-reflow-model.h
+++ /dev/null
@@ -1,112 +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 <glib-object.h>
-#include <libgnomecanvas/gnome-canvas.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#define E_REFLOW_MODEL_TYPE (e_reflow_model_get_type ())
-#define E_REFLOW_MODEL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_REFLOW_MODEL_TYPE, EReflowModel))
-#define E_REFLOW_MODEL_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_REFLOW_MODEL_TYPE, EReflowModelClass))
-#define E_IS_REFLOW_MODEL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_REFLOW_MODEL_TYPE))
-#define E_IS_REFLOW_MODEL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_REFLOW_MODEL_TYPE))
-#define E_REFLOW_MODEL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), E_REFLOW_MODEL_TYPE, EReflowModelClass))
-
-typedef struct {
- GObject base;
-} EReflowModel;
-
-typedef struct {
- GObjectClass 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 to the sorting of elements: comparison_changed
- * Changes only in an item: item_changed
- */
- void (*model_changed) (EReflowModel *etm);
- void (*comparison_changed) (EReflowModel *etm);
- void (*model_items_inserted) (EReflowModel *etm, int position, int count);
- void (*model_item_removed) (EReflowModel *etm, int position);
- void (*model_item_changed) (EReflowModel *etm, int n);
-} EReflowModelClass;
-
-GType 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_comparison_changed (EReflowModel *e_reflow_model);
-void e_reflow_model_items_inserted (EReflowModel *e_reflow_model,
- int position,
- int count);
-void e_reflow_model_item_removed (EReflowModel *e_reflow_model,
- int n);
-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 cacf3848ba..0000000000
--- a/widgets/misc/e-reflow.c
+++ /dev/null
@@ -1,1506 +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/util/e-i18n.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)
-
-#define PARENT_TYPE GNOME_TYPE_CANVAS_GROUP
-static GnomeCanvasGroupClass *parent_class = NULL;
-
-/* The arguments we take */
-enum {
- PROP_0,
- PROP_MINIMUM_WIDTH,
- PROP_WIDTH,
- PROP_HEIGHT,
- PROP_EMPTY_MESSAGE,
- PROP_MODEL,
- PROP_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]) {
- g_object_set(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));
- g_object_set (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]) {
- g_object_set (reflow->items[old_cursor],
- "has_cursor", FALSE,
- NULL);
- }
- }
-
- reflow->cursor_row = row;
-
- if (row < count && row >= 0) {
- if (reflow->items[row]) {
- g_object_set (reflow->items[row],
- "has_cursor", TRUE,
- NULL);
- } else {
- reflow->items[row] = e_reflow_model_incarnate (reflow->model, row, GNOME_CANVAS_GROUP (reflow));
- g_object_set (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));
- g_object_set (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 start;
- int i;
- int column_count, column_start;
- double running_height;
-
- if (reflow->reflow_from_column <= 1) {
- start = 0;
- column_count = 1;
- column_start = 0;
- }
- else {
- /* we start one column before the earliest new entry,
- so we can handle the case where the new entry is
- inserted at the start of the column */
- column_start = reflow->reflow_from_column - 1;
- start = reflow->columns[column_start];
- column_count = column_start + 1;
- }
-
- list = NULL;
-
- running_height = E_REFLOW_BORDER_WIDTH;
-
- count = reflow->count - start;
- for (i = start; i < count; i++) {
- int unsorted = e_sorter_sorted_to_model (E_SORTER (reflow->sorter), i);
- 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_renew (int, reflow->columns, column_count);
- column_count --;
-
- for (; column_count > column_start; 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[column_start] = start;
-
- queue_incarnate (reflow);
-
- reflow->need_reflow_columns = FALSE;
- reflow->reflow_from_column = -1;
-}
-
-static void
-item_changed (EReflowModel *model, int i, EReflow *reflow)
-{
- if (i < 0 || i >= reflow->count)
- return;
-
- reflow->heights[i] = e_reflow_model_height (reflow->model, i, GNOME_CANVAS_GROUP (reflow));
- if (reflow->items[i] != NULL)
- e_reflow_model_reincarnate (model, i, reflow->items[i]);
- e_sorter_array_clean (reflow->sorter);
- reflow->reflow_from_column = -1;
- reflow->need_reflow_columns = TRUE;
- e_canvas_item_request_reflow(GNOME_CANVAS_ITEM (reflow));
-}
-
-static void
-item_removed (EReflowModel *model, int i, EReflow *reflow)
-{
- int c;
- int sorted;
-
- if (i < 0 || i >= reflow->count)
- return;
-
- if (reflow->items[i])
- gtk_object_destroy (GTK_OBJECT (reflow->items[i]));
-
- memmove (reflow->heights + i, reflow->heights + i + 1, (reflow->count - i - 1) * sizeof (int));
- memmove (reflow->items + i, reflow->items + i + 1, (reflow->count - i - 1) * sizeof (GnomeCanvasItem *));
-
- reflow->count --;
-
- sorted = e_sorter_model_to_sorted (E_SORTER (reflow->sorter), i);
- for (c = reflow->column_count - 1; c >= 0; c--) {
- int start_of_column = reflow->columns[c];
-
- if (start_of_column <= sorted) {
- if (reflow->reflow_from_column == -1
- || reflow->reflow_from_column > c) {
- reflow->reflow_from_column = c;
- }
- break;
- }
- }
-
- reflow->need_reflow_columns = TRUE;
- set_empty (reflow);
- e_canvas_item_request_reflow(GNOME_CANVAS_ITEM (reflow));
-
- e_sorter_array_set_count (reflow->sorter, reflow->count);
-
- e_selection_model_simple_delete_rows (E_SELECTION_MODEL_SIMPLE (reflow->selection), i, 1);
-}
-
-static void
-items_inserted (EReflowModel *model, int position, int count, EReflow *reflow)
-{
- int i, c;
- int oldcount;
- int lowest_column;
-
- 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] = e_reflow_model_height (reflow->model, i, GNOME_CANVAS_GROUP (reflow));
- }
-
- 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);
-
- for (i = position; i < position + count; i ++) {
- int sorted = e_sorter_model_to_sorted (E_SORTER (reflow->sorter), i);
- int c;
-
- for (c = reflow->column_count - 1; c >= 0; c--) {
- int start_of_column = reflow->columns[c];
-
- if (start_of_column <= sorted) {
- if (reflow->reflow_from_column == -1
- || reflow->reflow_from_column > c) {
- reflow->reflow_from_column = c;
- }
- break;
- }
- }
- }
-
- 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] = e_reflow_model_height (reflow->model, i, GNOME_CANVAS_GROUP (reflow));
- }
-
- 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
-comparison_changed (EReflowModel *model, EReflow *reflow)
-{
- e_sorter_array_clean (reflow->sorter);
- reflow->reflow_from_column = -1;
- reflow->need_reflow_columns = TRUE;
- 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) {
- gnome_canvas_item_set(reflow->empty_text,
- "width", reflow->minimum_width,
- "text", reflow->empty_message,
- NULL);
- e_canvas_item_move_absolute(reflow->empty_text,
- reflow->minimum_width / 2,
- 0);
- } else {
- gtk_object_destroy(GTK_OBJECT(reflow->empty_text));
- reflow->empty_text = NULL;
- }
- } else {
- if (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,
- "fill_color", "black",
- "justification", GTK_JUSTIFY_CENTER,
- "text", reflow->empty_message,
- "draw_background", FALSE,
- NULL);
- 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;
-
- g_signal_handler_disconnect (reflow->model,
- reflow->model_changed_id);
- g_signal_handler_disconnect (reflow->model,
- reflow->comparison_changed_id);
- g_signal_handler_disconnect (reflow->model,
- reflow->model_items_inserted_id);
- g_signal_handler_disconnect (reflow->model,
- reflow->model_item_removed_id);
- g_signal_handler_disconnect (reflow->model,
- reflow->model_item_changed_id);
- g_object_unref (reflow->model);
-
- reflow->model_changed_id = 0;
- reflow->comparison_changed_id = 0;
- reflow->model_items_inserted_id = 0;
- reflow->model_item_removed_id = 0;
- reflow->model_item_changed_id = 0;
- reflow->model = NULL;
-}
-
-static void
-disconnect_selection (EReflow *reflow)
-{
- if (reflow->selection == NULL)
- return;
-
- g_signal_handler_disconnect (reflow->selection,
- reflow->selection_changed_id);
- g_signal_handler_disconnect (reflow->selection,
- reflow->selection_row_changed_id);
- g_signal_handler_disconnect (reflow->selection,
- reflow->cursor_changed_id);
- g_object_unref (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;
- g_object_ref (reflow->model);
- reflow->model_changed_id =
- g_signal_connect (reflow->model, "model_changed",
- G_CALLBACK (model_changed), reflow);
- reflow->comparison_changed_id =
- g_signal_connect (reflow->model, "comparison_changed",
- G_CALLBACK (comparison_changed), reflow);
- reflow->model_items_inserted_id =
- g_signal_connect (reflow->model, "model_items_inserted",
- G_CALLBACK (items_inserted), reflow);
- reflow->model_item_removed_id =
- g_signal_connect (reflow->model, "model_item_removed",
- G_CALLBACK (item_removed), reflow);
- reflow->model_item_changed_id =
- g_signal_connect (reflow->model, "model_item_changed",
- G_CALLBACK (item_changed), reflow);
- model_changed (model, reflow);
-}
-
-static void
-adjustment_changed (GtkAdjustment *adjustment, EReflow *reflow)
-{
- queue_incarnate (reflow);
-}
-
-static void
-disconnect_adjustment (EReflow *reflow)
-{
- if (reflow->adjustment == NULL)
- return;
-
- g_signal_handler_disconnect (reflow->adjustment,
- reflow->adjustment_changed_id);
- g_signal_handler_disconnect (reflow->adjustment,
- reflow->adjustment_value_changed_id);
-
- g_object_unref (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 =
- g_signal_connect (adjustment, "changed",
- G_CALLBACK (adjustment_changed), reflow);
- reflow->adjustment_value_changed_id =
- g_signal_connect (adjustment, "value_changed",
- G_CALLBACK (adjustment_changed), reflow);
- g_object_ref (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 =
- g_signal_connect (GNOME_CANVAS_ITEM (reflow)->canvas,
- "set_scroll_adjustments",
- G_CALLBACK (set_scroll_adjustments), reflow);
-}
-#endif
-
-static void
-disconnect_set_adjustment (EReflow *reflow)
-{
- if (reflow->set_scroll_adjustments_id != 0) {
- g_signal_handler_disconnect (GNOME_CANVAS_ITEM (reflow)->canvas,
- reflow->set_scroll_adjustments_id);
- reflow->set_scroll_adjustments_id = 0;
- }
-}
-
-static void
-column_width_changed (EReflow *reflow)
-{
- g_signal_emit (reflow, signals[COLUMN_WIDTH_CHANGED], 0, reflow->column_width);
-}
-
-
-
-
-/* Virtual functions */
-static void
-e_reflow_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
-{
- GnomeCanvasItem *item;
- EReflow *reflow;
-
- item = GNOME_CANVAS_ITEM (object);
- reflow = E_REFLOW (object);
-
- switch (prop_id){
- case PROP_HEIGHT:
- reflow->height = g_value_get_double (value);
- reflow->need_reflow_columns = TRUE;
- e_canvas_item_request_reflow(item);
- break;
- case PROP_MINIMUM_WIDTH:
- reflow->minimum_width = g_value_get_double (value);
- if (GNOME_CANVAS_ITEM_REALIZED & GTK_OBJECT_FLAGS(object))
- set_empty(reflow);
- e_canvas_item_request_reflow(item);
- break;
- case PROP_EMPTY_MESSAGE:
- g_free(reflow->empty_message);
- reflow->empty_message = g_strdup(g_value_get_string (value));
- if (GNOME_CANVAS_ITEM_REALIZED & GTK_OBJECT_FLAGS(object))
- set_empty(reflow);
- break;
- case PROP_MODEL:
- connect_model (reflow, (EReflowModel *) g_value_get_object (value));
- break;
- case PROP_COLUMN_WIDTH:
- if (reflow->column_width != g_value_get_double (value)) {
- GtkAdjustment *adjustment = gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas));
- double old_width = reflow->column_width;
-
- reflow->column_width = g_value_get_double (value);
- 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_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
-{
- EReflow *reflow;
-
- reflow = E_REFLOW (object);
-
- switch (prop_id) {
- case PROP_MINIMUM_WIDTH:
- g_value_set_double (value, reflow->minimum_width);
- break;
- case PROP_WIDTH:
- g_value_set_double (value, reflow->width);
- break;
- case PROP_HEIGHT:
- g_value_set_double (value, reflow->height);
- break;
- case PROP_EMPTY_MESSAGE:
- g_value_set_string (value, g_strdup(reflow->empty_message));
- break;
- case PROP_MODEL:
- g_value_set_object (value, reflow->model);
- break;
- case PROP_COLUMN_WIDTH:
- g_value_set_double (value, reflow->column_width);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-e_reflow_dispose (GObject *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)
- g_source_remove (reflow->incarnate_idle_id);
- reflow->incarnate_idle_id = 0;
-
- disconnect_model (reflow);
- disconnect_selection (reflow);
-
- g_free(reflow->empty_message);
- reflow->empty_message = NULL;
-
- if (reflow->sorter) {
- g_object_unref (reflow->sorter);
- reflow->sorter = NULL;
- }
-
- G_OBJECT_CLASS(parent_class)->dispose (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", 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) {
- g_object_get(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);
- gnome_canvas_request_redraw(item->canvas, 0, 0, reflow->width, reflow->height);
- 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);
- if (event->button.button == 1) {
- reflow->maybe_did_something =
- e_selection_model_maybe_do_something(reflow->selection, row, 0, event->button.state);
- reflow->maybe_in_drag = TRUE;
- } else {
- 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_BUTTON_RELEASE:
- if (event->button.button == 1) {
- if (reflow->maybe_in_drag) {
- reflow->maybe_in_drag = FALSE;
- if (!reflow->maybe_did_something) {
- row = er_find_item (reflow, item);
- e_selection_model_do_something(reflow->selection, row, 0, event->button.state);
- }
- }
- }
- 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)
-{
- GObjectClass *object_class;
- GnomeCanvasItemClass *item_class;
-
- object_class = (GObjectClass*) klass;
- item_class = (GnomeCanvasItemClass *) klass;
-
- parent_class = g_type_class_ref (PARENT_TYPE);
-
- object_class->set_property = e_reflow_set_property;
- object_class->get_property = e_reflow_get_property;
- object_class->dispose = e_reflow_dispose;
-
- /* 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;
-
- g_object_class_install_property (object_class, PROP_MINIMUM_WIDTH,
- g_param_spec_double ("minimum_width",
- _( "Minimum width" ),
- _( "Minimum Width" ),
- 0.0, G_MAXDOUBLE, 0.0,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_WIDTH,
- g_param_spec_double ("width",
- _( "Width" ),
- _( "Width" ),
- 0.0, G_MAXDOUBLE, 0.0,
- G_PARAM_READABLE));
-
-
- g_object_class_install_property (object_class, PROP_HEIGHT,
- g_param_spec_double ("height",
- _( "Height" ),
- _( "Height" ),
- 0.0, G_MAXDOUBLE, 0.0,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_EMPTY_MESSAGE,
- g_param_spec_string ("empty_message",
- _( "Empty message" ),
- _( "Empty message" ),
- NULL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_MODEL,
- g_param_spec_object ("model",
- _( "Reflow model" ),
- _( "Reflow model" ),
- E_REFLOW_MODEL_TYPE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_COLUMN_WIDTH,
- g_param_spec_double ("column_width",
- _( "Column width" ),
- _( "Column width" ),
- 0.0, G_MAXDOUBLE, 150.0,
- G_PARAM_READWRITE));
-
- signals [SELECTION_EVENT] =
- g_signal_new ("selection_event",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EReflowClass, selection_event),
- NULL, NULL,
- e_marshal_INT__OBJECT_BOXED,
- G_TYPE_INT, 2, G_TYPE_OBJECT,
- GDK_TYPE_EVENT);
-
- signals [COLUMN_WIDTH_CHANGED] =
- g_signal_new ("column_width_changed",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EReflowClass, column_width_changed),
- NULL, NULL,
- e_marshal_NONE__DOUBLE,
- G_TYPE_NONE, 1, G_TYPE_DOUBLE);
-}
-
-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->need_reflow_columns = FALSE;
-
- reflow->maybe_did_something = FALSE;
- reflow->maybe_in_drag = 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);
-
- g_object_set (reflow->selection,
- "sorter", reflow->sorter,
- NULL);
-
- reflow->selection_changed_id =
- g_signal_connect(reflow->selection, "selection_changed",
- G_CALLBACK (selection_changed), reflow);
- reflow->selection_row_changed_id =
- g_signal_connect(reflow->selection, "selection_row_changed",
- G_CALLBACK (selection_row_changed), reflow);
- reflow->cursor_changed_id =
- g_signal_connect(reflow->selection, "cursor_changed",
- G_CALLBACK (cursor_changed), reflow);
-
- e_canvas_item_set_reflow_callback(GNOME_CANVAS_ITEM(reflow), e_reflow_reflow);
-}
-
-E_MAKE_TYPE (e_reflow,
- "EReflow",
- EReflow,
- e_reflow_class_init,
- e_reflow_init,
- PARENT_TYPE)
diff --git a/widgets/misc/e-reflow.h b/widgets/misc/e-reflow.h
deleted file mode 100644
index b92643a935..0000000000
--- a/widgets/misc/e-reflow.h
+++ /dev/null
@@ -1,146 +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 <libgnomecanvas/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) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_REFLOW_TYPE, EReflow))
-#define E_REFLOW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_REFLOW_TYPE, EReflowClass))
-#define E_IS_REFLOW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_REFLOW_TYPE))
-#define E_IS_REFLOW_CLASS(klass) (G_TYPE_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 comparison_changed_id;
- guint model_items_inserted_id;
- guint model_item_removed_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;
-
- int reflow_from_column;
-
- guint column_drag : 1;
-
- guint need_height_update : 1;
- guint need_column_resize : 1;
- guint need_reflow_columns : 1;
-
- guint default_cursor_shown : 1;
-
- guint maybe_did_something : 1;
- guint maybe_in_drag : 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-selection-model-array.c b/widgets/misc/e-selection-model-array.c
deleted file mode 100644
index e6e96702a3..0000000000
--- a/widgets/misc/e-selection-model-array.c
+++ /dev/null
@@ -1,557 +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-i18n.h"
-#include "gal/util/e-util.h"
-
-#define PARENT_TYPE e_selection_model_get_type ()
-
-static ESelectionModelClass *parent_class;
-
-enum {
- PROP_0,
- PROP_CURSOR_ROW,
- PROP_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_dispose (GObject *object)
-{
- ESelectionModelArray *esma;
-
- esma = E_SELECTION_MODEL_ARRAY (object);
-
- if (esma->eba) {
- g_object_unref (esma->eba);
- esma->eba = NULL;
- }
-
- if (G_OBJECT_CLASS (parent_class)->dispose)
- (* G_OBJECT_CLASS (parent_class)->dispose) (object);
-}
-
-static void
-esma_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
-{
- ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY (object);
-
- switch (prop_id){
- case PROP_CURSOR_ROW:
- g_value_set_int (value, esma->cursor_row);
- break;
-
- case PROP_CURSOR_COL:
- g_value_set_int (value, esma->cursor_col);
- break;
- }
-}
-
-static void
-esma_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
-{
- ESelectionModel *esm = E_SELECTION_MODEL (object);
- ESelectionModelArray *esma = E_SELECTION_MODEL_ARRAY (object);
-
- switch (prop_id){
- case PROP_CURSOR_ROW:
- e_selection_model_do_something(esm, g_value_get_int (value), esma->cursor_col, 0);
- break;
-
- case PROP_CURSOR_COL:
- e_selection_model_do_something(esm, esma->cursor_row, g_value_get_int(value), 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) {
- g_object_unref(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);
- }
- }
- 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 (E_SELECTION_MODEL_ARRAY_GET_CLASS(esma)->get_row_count)
- return E_SELECTION_MODEL_ARRAY_GET_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)
-{
- GObjectClass *object_class;
- ESelectionModelClass *esm_class;
-
- parent_class = g_type_class_ref (PARENT_TYPE);
-
- object_class = G_OBJECT_CLASS(klass);
- esm_class = E_SELECTION_MODEL_CLASS(klass);
-
- object_class->dispose = esma_dispose;
- object_class->get_property = esma_get_property;
- object_class->set_property = esma_set_property;
-
- 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 ;
-
- g_object_class_install_property (object_class, PROP_CURSOR_ROW,
- g_param_spec_int ("cursor_row",
- _("Cursor Row"),
- /*_( */"XXX blurb" /*)*/,
- 0, G_MAXINT, 0,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_CURSOR_COL,
- g_param_spec_int ("cursor_col",
- _("Cursor Column"),
- /*_( */"XXX blurb" /*)*/,
- 0, G_MAXINT, 0,
- G_PARAM_READWRITE));
-}
-
-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 a533030f92..0000000000
--- a/widgets/misc/e-selection-model-array.h
+++ /dev/null
@@ -1,96 +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) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_SELECTION_MODEL_ARRAY_TYPE, ESelectionModelArray))
-#define E_SELECTION_MODEL_ARRAY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_SELECTION_MODEL_ARRAY_TYPE, ESelectionModelArrayClass))
-#define E_IS_SELECTION_MODEL_ARRAY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_SELECTION_MODEL_ARRAY_TYPE))
-#define E_IS_SELECTION_MODEL_ARRAY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_SELECTION_MODEL_ARRAY_TYPE))
-#define E_SELECTION_MODEL_ARRAY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), E_SELECTION_MODEL_ARRAY_TYPE, ESelectionModelArrayClass))
-
-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;
-
-GType 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 51a0d86623..0000000000
--- a/widgets/misc/e-selection-model-simple.c
+++ /dev/null
@@ -1,115 +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 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 = g_type_class_ref (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 g_object_new (E_SELECTION_MODEL_SIMPLE_TYPE, NULL);
-}
-
-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)
- g_object_unref(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 6b4f84b4f9..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) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_SELECTION_MODEL_SIMPLE_TYPE, ESelectionModelSimple))
-#define E_SELECTION_MODEL_SIMPLE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_SELECTION_MODEL_SIMPLE_TYPE, ESelectionModelSimpleClass))
-#define E_IS_SELECTION_MODEL_SIMPLE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_SELECTION_MODEL_SIMPLE_TYPE))
-#define E_IS_SELECTION_MODEL_SIMPLE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_SELECTION_MODEL_SIMPLE_TYPE))
-
-typedef struct {
- ESelectionModelArray parent;
-
- int row_count;
-} ESelectionModelSimple;
-
-typedef struct {
- ESelectionModelArrayClass parent_class;
-} ESelectionModelSimpleClass;
-
-GType 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 991fc78490..0000000000
--- a/widgets/misc/e-selection-model.c
+++ /dev/null
@@ -1,689 +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 "e-selection-model.h"
-#include "gal/util/e-i18n.h"
-#include "gal/util/e-util.h"
-
-#define PARENT_TYPE G_TYPE_OBJECT
-
-static GObjectClass *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 {
- PROP_0,
- PROP_SORTER,
- PROP_SELECTION_MODE,
- PROP_CURSOR_MODE
-};
-
-inline static void
-add_sorter(ESelectionModel *esm, ESorter *sorter)
-{
- esm->sorter = sorter;
- if (sorter) {
- g_object_ref (sorter);
- }
-}
-
-inline static void
-drop_sorter(ESelectionModel *esm)
-{
- if (esm->sorter) {
- g_object_unref (esm->sorter);
- }
- esm->sorter = NULL;
-}
-
-static void
-esm_dispose (GObject *object)
-{
- ESelectionModel *esm;
-
- esm = E_SELECTION_MODEL (object);
-
- drop_sorter(esm);
-
- if (e_selection_model_parent_class->dispose)
- (* e_selection_model_parent_class->dispose) (object);
-}
-
-static void
-esm_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
-{
- ESelectionModel *esm = E_SELECTION_MODEL (object);
-
- switch (prop_id){
- case PROP_SORTER:
- g_value_set_object (value, esm->sorter);
- break;
-
- case PROP_SELECTION_MODE:
- g_value_set_int (value, esm->mode);
- break;
-
- case PROP_CURSOR_MODE:
- g_value_set_int (value, esm->cursor_mode);
- break;
- }
-}
-
-static void
-esm_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
-{
- ESelectionModel *esm = E_SELECTION_MODEL (object);
-
- switch (prop_id){
- case PROP_SORTER:
- drop_sorter(esm);
- add_sorter(esm, g_value_get_object (value) ? E_SORTER(g_value_get_object(value)) : NULL);
- break;
-
- case PROP_SELECTION_MODE:
- esm->mode = g_value_get_int (value);
- 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 PROP_CURSOR_MODE:
- esm->cursor_mode = g_value_get_int (value);
- 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)
-{
- GObjectClass *object_class;
-
- e_selection_model_parent_class = g_type_class_ref (PARENT_TYPE);
-
- object_class = G_OBJECT_CLASS(klass);
-
- object_class->dispose = esm_dispose;
- object_class->get_property = esm_get_property;
- object_class->set_property = esm_set_property;
-
- e_selection_model_signals [CURSOR_CHANGED] =
- g_signal_new ("cursor_changed",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ESelectionModelClass, cursor_changed),
- NULL, NULL,
- e_marshal_NONE__INT_INT,
- G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
-
- e_selection_model_signals [CURSOR_ACTIVATED] =
- g_signal_new ("cursor_activated",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ESelectionModelClass, cursor_activated),
- NULL, NULL,
- e_marshal_NONE__INT_INT,
- G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
-
- e_selection_model_signals [SELECTION_CHANGED] =
- g_signal_new ("selection_changed",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ESelectionModelClass, selection_changed),
- NULL, NULL,
- e_marshal_NONE__NONE,
- G_TYPE_NONE, 0);
-
- e_selection_model_signals [SELECTION_ROW_CHANGED] =
- g_signal_new ("selection_row_changed",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ESelectionModelClass, selection_row_changed),
- NULL, NULL,
- e_marshal_NONE__INT,
- G_TYPE_NONE, 1, G_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;
-
- g_object_class_install_property (object_class, PROP_SORTER,
- g_param_spec_object ("sorter",
- _("Sorter"),
- /*_( */"XXX blurb" /*)*/,
- E_SORTER_TYPE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_SELECTION_MODE,
- g_param_spec_int ("selection_mode",
- _("Selection Mode"),
- /*_( */"XXX blurb" /*)*/,
- GTK_SELECTION_NONE, GTK_SELECTION_MULTIPLE,
- GTK_SELECTION_SINGLE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_CURSOR_MODE,
- g_param_spec_int ("cursor_mode",
- _("Cursor Mode"),
- /*_( */"XXX blurb" /*)*/,
- E_CURSOR_LINE, E_CURSOR_SPREADSHEET,
- E_CURSOR_LINE,
- G_PARAM_READWRITE));
-}
-
-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 (E_SELECTION_MODEL_GET_CLASS(selection)->is_row_selected)
- return E_SELECTION_MODEL_GET_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 (E_SELECTION_MODEL_GET_CLASS(selection)->foreach)
- E_SELECTION_MODEL_GET_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 (E_SELECTION_MODEL_GET_CLASS(selection)->clear)
- E_SELECTION_MODEL_GET_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 (E_SELECTION_MODEL_GET_CLASS(selection)->selected_count)
- return E_SELECTION_MODEL_GET_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 (E_SELECTION_MODEL_GET_CLASS(selection)->select_all)
- E_SELECTION_MODEL_GET_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 (E_SELECTION_MODEL_GET_CLASS(selection)->invert_selection)
- E_SELECTION_MODEL_GET_CLASS(selection)->invert_selection (selection);
-}
-
-int
-e_selection_model_row_count (ESelectionModel *selection)
-{
- if (E_SELECTION_MODEL_GET_CLASS(selection)->row_count)
- return E_SELECTION_MODEL_GET_CLASS(selection)->row_count (selection);
- else
- return 0;
-}
-
-void
-e_selection_model_change_one_row(ESelectionModel *selection, int row, gboolean grow)
-{
- if (E_SELECTION_MODEL_GET_CLASS(selection)->change_one_row)
- E_SELECTION_MODEL_GET_CLASS(selection)->change_one_row (selection, row, grow);
-}
-
-void
-e_selection_model_change_cursor (ESelectionModel *selection, int row, int col)
-{
- if (E_SELECTION_MODEL_GET_CLASS(selection)->change_cursor)
- E_SELECTION_MODEL_GET_CLASS(selection)->change_cursor (selection, row, col);
-}
-
-int
-e_selection_model_cursor_row (ESelectionModel *selection)
-{
- if (E_SELECTION_MODEL_GET_CLASS(selection)->cursor_row)
- return E_SELECTION_MODEL_GET_CLASS(selection)->cursor_row (selection);
- else
- return -1;
-}
-
-int
-e_selection_model_cursor_col (ESelectionModel *selection)
-{
- if (E_SELECTION_MODEL_GET_CLASS(selection)->cursor_col)
- return E_SELECTION_MODEL_GET_CLASS(selection)->cursor_col (selection);
- else
- return -1;
-}
-
-void
-e_selection_model_select_single_row (ESelectionModel *selection, int row)
-{
- if (E_SELECTION_MODEL_GET_CLASS(selection)->select_single_row)
- E_SELECTION_MODEL_GET_CLASS(selection)->select_single_row (selection, row);
-}
-
-void
-e_selection_model_toggle_single_row (ESelectionModel *selection, int row)
-{
- if (E_SELECTION_MODEL_GET_CLASS(selection)->toggle_single_row)
- E_SELECTION_MODEL_GET_CLASS(selection)->toggle_single_row (selection, row);
-}
-
-void
-e_selection_model_move_selection_end (ESelectionModel *selection, int row)
-{
- if (E_SELECTION_MODEL_GET_CLASS(selection)->move_selection_end)
- E_SELECTION_MODEL_GET_CLASS(selection)->move_selection_end (selection, row);
-}
-
-void
-e_selection_model_set_selection_end (ESelectionModel *selection, int row)
-{
- if (E_SELECTION_MODEL_GET_CLASS(selection)->set_selection_end)
- E_SELECTION_MODEL_GET_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:
- 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;
- default:
- g_assert_not_reached ();
- break;
- }
- e_selection_model_change_cursor(selection, row, col);
- g_signal_emit(selection,
- e_selection_model_signals[CURSOR_CHANGED], 0,
- row, col);
- g_signal_emit(selection,
- e_selection_model_signals[CURSOR_ACTIVATED], 0,
- 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);
- g_signal_emit(selection,
- e_selection_model_signals[CURSOR_CHANGED], 0,
- 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:
- 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;
- default:
- g_assert_not_reached ();
- break;
- }
- if (row != -1) {
- e_selection_model_change_cursor(selection, row, col);
- g_signal_emit(selection,
- e_selection_model_signals[CURSOR_CHANGED], 0,
- row, col);
- if (cursor_activated)
- g_signal_emit(selection,
- e_selection_model_signals[CURSOR_ACTIVATED], 0,
- 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);
- g_signal_emit(selection,
- e_selection_model_signals[CURSOR_ACTIVATED], 0,
- 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);
- g_signal_emit(selection,
- e_selection_model_signals[CURSOR_ACTIVATED], 0,
- 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)
-{
- g_signal_emit(selection,
- e_selection_model_signals[CURSOR_CHANGED], 0,
- row, col);
-}
-
-void
-e_selection_model_cursor_activated (ESelectionModel *selection,
- int row,
- int col)
-{
- g_signal_emit(selection,
- e_selection_model_signals[CURSOR_ACTIVATED], 0,
- row, col);
-}
-
-void
-e_selection_model_selection_changed (ESelectionModel *selection)
-{
- g_signal_emit(selection,
- e_selection_model_signals[SELECTION_CHANGED], 0);
-}
-
-void
-e_selection_model_selection_row_changed (ESelectionModel *selection,
- int row)
-{
- g_signal_emit(selection,
- e_selection_model_signals[SELECTION_ROW_CHANGED], 0,
- row);
-}
diff --git a/widgets/misc/e-selection-model.h b/widgets/misc/e-selection-model.h
deleted file mode 100644
index a78bdfd9c3..0000000000
--- a/widgets/misc/e-selection-model.h
+++ /dev/null
@@ -1,170 +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/gdkevents.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#define E_SELECTION_MODEL_TYPE (e_selection_model_get_type ())
-#define E_SELECTION_MODEL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_SELECTION_MODEL_TYPE, ESelectionModel))
-#define E_SELECTION_MODEL_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_SELECTION_MODEL_TYPE, ESelectionModelClass))
-#define E_IS_SELECTION_MODEL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_SELECTION_MODEL_TYPE))
-#define E_IS_SELECTION_MODEL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_SELECTION_MODEL_TYPE))
-#define E_SELECTION_MODEL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), E_SELECTION_MODEL_TYPE, ESelectionModelClass))
-
-#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 {
- GObject base;
-
- ESorter *sorter;
-
- GtkSelectionMode mode;
- ECursorMode cursor_mode;
-
- int old_selection;
-} ESelectionModel;
-
-typedef struct {
- GObjectClass 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;
-
-
-GType 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 d7bd33caa7..0000000000
--- a/widgets/misc/e-unicode.c
+++ /dev/null
@@ -1,2055 +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 <libxml/xmlmemory.h>
-#include <stdlib.h>
-#include "gal/util/e-iconv.h"
-
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
-#endif
-
-#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);
-
-#ifndef NO_WARNINGS
-#warning FIXME: this has not been ported fully yet - non ASCII people beware.
-#endif
-
-/*
- * 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;
-
- 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 (char, ibl * 4 + 4);
- obl = ibl * 4;
-
- 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;
-
- /* FIXME: this is wrong... what if the destination charset is 16 or 32 bit? */
- *ob++ = '_';
- obl--;
- }
- }
-
- /* Make sure to terminate with plenty of padding */
- memset (ob, 0, 4);
-
- 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_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)
-{
- return g_strdup (gtk_entry_get_text (entry));
-}
-
-gchar *
-e_utf8_gtk_editable_get_text (GtkEditable *editable)
-{
- return gtk_editable_get_chars (editable, 0, -1);
-}
-
-gchar *
-e_utf8_gtk_editable_get_chars (GtkEditable *editable, gint start, gint end)
-{
- return gtk_editable_get_chars (editable, start, end);
-}
-
-void
-e_utf8_gtk_editable_insert_text (GtkEditable *editable, const gchar *text, gint length, gint *position)
-{
- gtk_editable_insert_text (editable, text, length, position);
-}
-
-void
-e_utf8_gtk_editable_set_text (GtkEditable *editable, const gchar *text)
-{
- int position;
-
- gtk_editable_delete_text(editable, 0, -1);
- 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
- gtk_entry_set_text (entry, text);
-}
-
-/*
- * 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);
-}
-
-/*
- * 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 = g_strdup (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 12c9ef3aa2..0000000000
--- a/widgets/misc/e-unicode.h
+++ /dev/null
@@ -1,115 +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 <libxml/tree.h>
-#include <iconv.h>
-
-G_BEGIN_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_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);
-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);
-
-G_END_DECLS
-
-#endif
-
-
diff --git a/widgets/misc/gal-categories.glade b/widgets/misc/gal-categories.glade
deleted file mode 100644
index 1ecb302f42..0000000000
--- a/widgets/misc/gal-categories.glade
+++ /dev/null
@@ -1,166 +0,0 @@
-<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
-<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
-
-<glade-interface>
-
-<widget class="GtkDialog" id="categories">
- <property name="border_width">6</property>
- <property name="title" translatable="yes">categories</property>
- <property name="type">GTK_WINDOW_TOPLEVEL</property>
- <property name="window_position">GTK_WIN_POS_NONE</property>
- <property name="modal">False</property>
- <property name="resizable">True</property>
- <property name="destroy_with_parent">False</property>
- <property name="has_separator">True</property>
-
- <child internal-child="vbox">
- <widget class="GtkVBox" id="dialog-vbox1">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child internal-child="action_area">
- <widget class="GtkHButtonBox" id="dialog-action_area1">
- <property name="visible">True</property>
- <property name="layout_style">GTK_BUTTONBOX_END</property>
-
- <child>
- <widget class="GtkButton" id="button3">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-ok</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="response_id">0</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkButton" id="button4">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-cancel</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="response_id">0</property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">GTK_PACK_END</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkTable" id="table-categories">
- <property name="border_width">6</property>
- <property name="visible">True</property>
- <property name="n_rows">5</property>
- <property name="n_columns">1</property>
- <property name="homogeneous">False</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">6</property>
-
- <child>
- <widget class="GtkEntry" id="entry-categories">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="editable">True</property>
- <property name="visibility">True</property>
- <property name="max_length">0</property>
- <property name="text" translatable="yes"></property>
- <property name="has_frame">True</property>
- <property name="invisible_char" translatable="yes">*</property>
- <property name="activates_default">False</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label-header">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Item(s) belong to these _categories:</property>
- <property name="use_underline">True</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="mnemonic_widget">entry-categories</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label2">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Available Categories:</property>
- <property name="use_underline">True</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkButton" id="button-ecmld">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Edit Master Category List...</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">4</property>
- <property name="bottom_attach">5</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- </child>
-</widget>
-
-</glade-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 364e0644de..0000000000
--- a/widgets/misc/test-color.c
+++ /dev/null
@@ -1,76 +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 <config.h>
-#include <gal/util/e-i18n.h>
-#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_program_init ("tester", "1.0",
- LIBGNOMEUI_MODULE,
- argc, argv, NULL);
-
- 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 (
- gdk_pixbuf_new_from_xpm_data ((char const **)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 (
- gdk_pixbuf_new_from_xpm_data ((char const **)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 5ef4b23a96..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 <libgnomecanvas/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 = g_object_new (E_CELL_CHECKBOX_TYPE, NULL);
-
- 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 ab56af27ab..0000000000
--- a/widgets/table/e-cell-checkbox.h
+++ /dev/null
@@ -1,50 +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>
-
-G_BEGIN_DECLS
-
-#define E_CELL_CHECKBOX_TYPE (e_cell_checkbox_get_type ())
-#define E_CELL_CHECKBOX(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_CELL_CHECKBOX_TYPE, ECellCheckbox))
-#define E_CELL_CHECKBOX_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_CELL_CHECKBOX_TYPE, ECellCheckboxClass))
-#define E_IS_CELL_CHECKBOX(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_CELL_CHECKBOX_TYPE))
-#define E_IS_CELL_CHECKBOX_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_CELL_CHECKBOX_TYPE))
-
-typedef struct {
- ECellToggle parent;
-} ECellCheckbox;
-
-typedef struct {
- ECellToggleClass parent_class;
-} ECellCheckboxClass;
-
-GType e_cell_checkbox_get_type (void);
-ECell *e_cell_checkbox_new (void);
-
-G_END_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 12a5618b81..0000000000
--- a/widgets/table/e-cell-combo.c
+++ /dev/null
@@ -1,679 +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 <gtk/gtk.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 (GObjectClass *object_class);
-static void e_cell_combo_init (ECellCombo *ecc);
-static void e_cell_combo_dispose (GObject *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 void e_cell_combo_selection_changed(GtkWidget *popup_list, ECellCombo *ecc);
-
-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 (GObjectClass *object_class)
-{
- ECellPopupClass *ecpc = (ECellPopupClass *) object_class;
-
- object_class->dispose = e_cell_combo_dispose;
-
- ecpc->popup = e_cell_combo_do_popup;
-
- parent_class = g_type_class_ref (E_CELL_POPUP_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);
-
- g_signal_connect (ecc->popup_list,
- "selection_changed",
- G_CALLBACK (e_cell_combo_selection_changed),
- ecc);
- g_signal_connect (ecc->popup_window,
- "button_press_event",
- G_CALLBACK (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. */
- g_signal_connect (ecc->popup_window,
- "button_release_event",
- G_CALLBACK (e_cell_combo_button_release),
- ecc);
- g_signal_connect (ecc->popup_window,
- "key_press_event",
- G_CALLBACK (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 = g_object_new (E_CELL_COMBO_TYPE, NULL);
-
- return (ECell*) ecc;
-}
-
-
-/*
- * GObject::dispose method
- */
-static void
-e_cell_combo_dispose (GObject *object)
-{
- ECellCombo *ecc = E_CELL_COMBO (object);
-
- if (ecc->popup_window)
- gtk_widget_destroy (ecc->popup_window);
- ecc->popup_window = NULL;
-
- G_OBJECT_CLASS (parent_class)->dispose (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);
-
- g_object_set_data_full (G_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;
-
- g_signal_handlers_block_by_func(ecc->popup_list, e_cell_combo_selection_changed, ecc);
- e_cell_combo_show_popup (ecc, row, view_col);
- e_cell_combo_select_matching_item (ecc);
- g_signal_handlers_unblock_by_func(ecc->popup_list, e_cell_combo_selection_changed, 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 = g_object_get_data (G_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_GET_CLASS (popup))->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->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->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->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->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_GET_CLASS (popup))->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;
-}
-
-static void
-e_cell_combo_selection_changed(GtkWidget *popup_list, ECellCombo *ecc)
-{
- if (!GTK_LIST(popup_list)->selection || !GTK_WIDGET_REALIZED(ecc->popup_window))
- return;
-
- gtk_grab_remove (ecc->popup_window);
- gdk_pointer_ungrab (gtk_get_current_event_time());
- gtk_widget_hide (ecc->popup_window);
-
- e_cell_popup_set_shown (E_CELL_POPUP (ecc), FALSE);
-
- e_cell_combo_update_cell (ecc);
- e_cell_combo_restart_edit (ecc);
-}
-
-/* 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 = g_object_get_data (G_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 23d5ac26a4..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) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_CELL_COMBO_TYPE, ECellCombo))
-#define E_CELL_COMBO_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_CELL_COMBO_TYPE, ECellComboClass))
-#define E_IS_CELL_COMBO(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_CELL_COMBO_TYPE))
-#define E_IS_CELL_COMBO_CLASS(k) (G_TYPE_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;
-
-
-GType 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 64d9b8132b..0000000000
--- a/widgets/table/e-cell-date.c
+++ /dev/null
@@ -1,166 +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[100];
- char *temp;
- gboolean done = FALSE;
-
- if (date == 0) {
- return g_strdup (_("?"));
- }
-
- localtime_r (&date, &then);
- localtime_r (&nowdate, &now);
-
- if (nowdate - date < 60 * 60 * 8 && nowdate > date) {
- e_utf8_strftime_fix_am_pm (buf, 100, _("%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_utf8_strftime_fix_am_pm (buf, 100, _("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) {
- e_utf8_strftime_fix_am_pm (buf, 100, _("Yesterday %l:%M %p"), &then);
- 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_utf8_strftime_fix_am_pm (buf, 100, _("%a %l:%M %p"), &then);
- done = TRUE;
- break;
- }
- }
- }
- if (!done) {
- if (then.tm_year == now.tm_year) {
- e_utf8_strftime_fix_am_pm (buf, 100, _("%b %d %l:%M %p"), &then);
- } else {
- e_utf8_strftime_fix_am_pm (buf, 100, _("%b %d %Y"), &then);
- }
- }
- temp = buf;
- while ((temp = strstr (temp, " "))) {
- memmove (temp, temp + 1, strlen (temp));
- }
- temp = e_strdup_strip (buf);
- return temp;
-}
-
-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 = g_type_class_ref (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", "underline_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, underline, 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 = g_object_new (E_CELL_DATE_TYPE, NULL);
-
- 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 96d5faa5c3..0000000000
--- a/widgets/table/e-cell-date.h
+++ /dev/null
@@ -1,49 +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>
-
-G_BEGIN_DECLS
-
-#define E_CELL_DATE_TYPE (e_cell_date_get_type ())
-#define E_CELL_DATE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_CELL_DATE_TYPE, ECellDate))
-#define E_CELL_DATE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_CELL_DATE_TYPE, ECellDateClass))
-#define E_IS_CELL_DATE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_CELL_DATE_TYPE))
-#define E_IS_CELL_DATE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_CELL_DATE_TYPE))
-
-typedef struct {
- ECellText base;
-} ECellDate;
-
-typedef struct {
- ECellTextClass parent_class;
-} ECellDateClass;
-
-GType e_cell_date_get_type (void);
-ECell *e_cell_date_new (const char *fontname, GtkJustification justify);
-
-G_END_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 133be063b3..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 = g_type_class_ref (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 = g_object_new (E_CELL_FLOAT_TYPE, NULL);
-
- 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 36874406b2..0000000000
--- a/widgets/table/e-cell-float.h
+++ /dev/null
@@ -1,53 +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>
-
-G_BEGIN_DECLS
-
-#define E_CELL_FLOAT_TYPE (e_cell_float_get_type ())
-#define E_CELL_FLOAT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_CELL_FLOAT_TYPE, ECellFloat))
-#define E_CELL_FLOAT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_CELL_FLOAT_TYPE, ECellFloatClass))
-#define E_IS_CELL_FLOAT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_CELL_FLOAT_TYPE))
-#define E_IS_CELL_FLOAT_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_CELL_FLOAT_TYPE))
-
-typedef struct {
- ECellText base;
-} ECellFloat;
-
-typedef struct {
- ECellTextClass parent_class;
-} ECellFloatClass;
-
-GType e_cell_float_get_type (void);
-ECell *e_cell_float_new (const char *fontname, GtkJustification justify);
-
-G_END_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 8c8887df5a..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 = g_type_class_ref (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 = g_object_new (E_CELL_NUMBER_TYPE, NULL);
-
- 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 3cce1ec412..0000000000
--- a/widgets/table/e-cell-number.h
+++ /dev/null
@@ -1,49 +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>
-
-G_BEGIN_DECLS
-
-#define E_CELL_NUMBER_TYPE (e_cell_number_get_type ())
-#define E_CELL_NUMBER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_CELL_NUMBER_TYPE, ECellNumber))
-#define E_CELL_NUMBER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_CELL_NUMBER_TYPE, ECellNumberClass))
-#define E_IS_CELL_NUMBER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_CELL_NUMBER_TYPE))
-#define E_IS_CELL_NUMBER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_CELL_NUMBER_TYPE))
-
-typedef struct {
- ECellText base;
-} ECellNumber;
-
-typedef struct {
- ECellTextClass parent_class;
-} ECellNumberClass;
-
-GType e_cell_number_get_type (void);
-ECell *e_cell_number_new (const char *fontname, GtkJustification justify);
-
-G_END_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 50c3b2cc7a..0000000000
--- a/widgets/table/e-cell-pixbuf.c
+++ /dev/null
@@ -1,417 +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 <libgnomecanvas/gnome-canvas.h>
-#include "e-cell-pixbuf.h"
-#include <gal/util/e-i18n.h>
-
-#define PARENT_TYPE E_CELL_TYPE
-static ECellClass *parent_class;
-
-typedef struct _ECellPixbufView ECellPixbufView;
-
-struct _ECellPixbufView {
- ECellView cell_view;
- GnomeCanvas *canvas;
-};
-
-/* Object argument IDs */
-enum {
- PROP_0,
-
- PROP_SELECTED_COLUMN,
- PROP_FOCUSED_COLUMN,
- PROP_UNSELECTED_COLUMN
-};
-
-static int
-gnome_print_pixbuf (GnomePrintContext *pc, GdkPixbuf *pixbuf)
-{
- if (gdk_pixbuf_get_has_alpha (pixbuf))
- return gnome_print_rgbaimage (pc,
- gdk_pixbuf_get_pixels (pixbuf),
- gdk_pixbuf_get_width (pixbuf),
- gdk_pixbuf_get_height (pixbuf),
- gdk_pixbuf_get_rowstride (pixbuf));
- else
- return gnome_print_rgbimage (pc,
- gdk_pixbuf_get_pixels (pixbuf),
- gdk_pixbuf_get_width (pixbuf),
- gdk_pixbuf_get_height (pixbuf),
- gdk_pixbuf_get_rowstride (pixbuf));
-}
-
-/*
- * ECellPixbuf functions
- */
-
-ECell *
-e_cell_pixbuf_new (void)
-{
- ECellPixbuf *ecp;
-
- ecp = g_object_new (E_CELL_PIXBUF_TYPE, NULL);
- 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;
-}
-
-/*
- * ECell::print method
- */
-static void
-pixbuf_print (ECellView *ecell_view, GnomePrintContext *context,
- int model_col, int view_col, int row,
- double width, double height)
-{
- GdkPixbuf *pixbuf;
- int scale;
-
- pixbuf = (GdkPixbuf *) e_table_model_value_at (ecell_view->e_table_model, model_col, row);
- if (pixbuf == NULL)
- return;
- scale = gdk_pixbuf_get_height (pixbuf);
-
- gnome_print_gsave(context);
-
- gnome_print_translate (context, 0, (height - scale) / 2);
- gnome_print_scale (context, scale, scale);
- gnome_print_pixbuf (context, pixbuf);
-
- gnome_print_grestore(context);
-}
-
-static gdouble
-pixbuf_print_height (ECellView *ecell_view, GnomePrintContext *context,
- int model_col, int view_col, int row,
- double width)
-{
- 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);
-}
-
-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_dispose (GObject *object)
-{
- if (G_OBJECT_CLASS (parent_class)->dispose)
- (* G_OBJECT_CLASS (parent_class)->dispose) (object);
-}
-
-static void
-pixbuf_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- ECellPixbuf *pixbuf;
-
- pixbuf = E_CELL_PIXBUF (object);
-
- switch (prop_id) {
- case PROP_SELECTED_COLUMN:
- pixbuf->selected_column = g_value_get_int (value);
- break;
-
- case PROP_FOCUSED_COLUMN:
- pixbuf->focused_column = g_value_get_int (value);
- break;
-
- case PROP_UNSELECTED_COLUMN:
- pixbuf->unselected_column = g_value_get_int (value);
- break;
-
- default:
- return;
- }
-}
-
-/* Get_arg handler for the pixbuf item */
-static void
-pixbuf_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- ECellPixbuf *pixbuf;
-
- pixbuf = E_CELL_PIXBUF (object);
-
- switch (prop_id) {
- case PROP_SELECTED_COLUMN:
- g_value_set_int (value, pixbuf->selected_column);
- break;
-
- case PROP_FOCUSED_COLUMN:
- g_value_set_int (value, pixbuf->focused_column);
- break;
-
- case PROP_UNSELECTED_COLUMN:
- g_value_set_int (value, pixbuf->unselected_column);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- 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 (GObjectClass *object_class)
-{
- ECellClass *ecc = (ECellClass *) object_class;
-
- object_class->dispose = pixbuf_dispose;
- object_class->set_property = pixbuf_set_property;
- object_class->get_property = pixbuf_get_property;
-
- 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->print = pixbuf_print;
- ecc->print_height = pixbuf_print_height;
- ecc->max_width = pixbuf_max_width;
-
- parent_class = g_type_class_ref (PARENT_TYPE);
-
- g_object_class_install_property (object_class, PROP_SELECTED_COLUMN,
- g_param_spec_int ("selected_column",
- _("Selected Column"),
- /*_( */"XXX blurb" /*)*/,
- 0, G_MAXINT, 0,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_FOCUSED_COLUMN,
- g_param_spec_int ("focused_column",
- _("Focused Column"),
- /*_( */"XXX blurb" /*)*/,
- 0, G_MAXINT, 0,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_UNSELECTED_COLUMN,
- g_param_spec_int ("unselected_column",
- _("Unselected Column"),
- /*_( */"XXX blurb" /*)*/,
- 0, G_MAXINT, 0,
- G_PARAM_READWRITE));
-}
-
-E_MAKE_TYPE (e_cell_pixbuf,
- "ECellPixbuf",
- ECellPixbuf,
- e_cell_pixbuf_class_init,
- e_cell_pixbuf_init,
- PARENT_TYPE)
diff --git a/widgets/table/e-cell-pixbuf.h b/widgets/table/e-cell-pixbuf.h
deleted file mode 100644
index 2f12521d58..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) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_CELL_PIXBUF_TYPE, ECellPixbuf))
-#define E_CELL_PIXBUF_CLASS(k) (G_TYPE_CHECK_INSTANCE_CAST_CLASS ((k), E_CELL_PIXBUF_TYPE, ECellPixbufClass))
-#define E_IS_CELL_PIXBUF(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_CELL_PIXBUF_TYPE))
-#define E_IS_CELL_PIXBUF_CLASS(k) (G_TYPE_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;
-};
-
-GType 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 3c5eccbee3..0000000000
--- a/widgets/table/e-cell-popup.c
+++ /dev/null
@@ -1,515 +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_dispose (GObject *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;
-
- G_OBJECT_CLASS (object_class)->dispose = e_cell_popup_dispose;
-
- 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 = g_type_class_ref (E_CELL_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 = g_object_new (E_CELL_POPUP_TYPE, NULL);
-
- return (ECell*) ecp;
-}
-
-
-/*
- * GtkObject::destroy method
- */
-static void
-e_cell_popup_dispose (GObject *object)
-{
- ECellPopup *ecp = E_CELL_POPUP (object);
-
- if (ecp->child)
- g_object_unref (ecp->child);
- ecp->child = NULL;
-
- G_OBJECT_CLASS (parent_class)->dispose (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;
-
- /* Display the popup arrow if we are the cursor cell, or the popup
- is shown for this cell. */
- show_popup_arrow = e_table_model_is_cell_editable (ecv->e_table_model, model_col, row) &&
- (flags & E_CELL_CURSOR ||
- (ecp->popup_shown && ecp->popup_view_col == view_col
- && ecp->popup_row == row
- && ecp->popup_model == ((ECellView *) ecp_view)->e_table_model));
-
- if (flags & E_CELL_CURSOR)
- ecp->popup_arrow_shown = show_popup_arrow;
-
- 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 (e_table_model_is_cell_editable (ecv->e_table_model, model_col, row) &&
- flags & E_CELL_CURSOR
- && ecp->popup_arrow_shown) {
- width = e_table_header_col_diff (eti->header, view_col,
- view_col + 1);
-
- /* 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_KEY_PRESS:
- if (e_table_model_is_cell_editable (ecv->e_table_model, model_col, row) &&
- event->key.state & GDK_MOD1_MASK
- && event->key.keyval == GDK_Down) {
- return e_cell_popup_do_popup (ecp_view, event, row, view_col);
- }
- 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;
-
- 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;
-
- 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)
- g_object_unref (ecp->child);
-
- ecp->child = child;
- g_object_ref (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_GET_CLASS (ecp))->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 26a7429127..0000000000
--- a/widgets/table/e-cell-popup.h
+++ /dev/null
@@ -1,101 +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 <libgnomecanvas/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) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_CELL_POPUP_TYPE, ECellPopup))
-#define E_CELL_POPUP_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_CELL_POPUP_TYPE, ECellPopupClass))
-#define E_IS_CELL_POPUP(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_CELL_POPUP_TYPE))
-#define E_IS_CELL_POPUP_CLASS(k) (G_TYPE_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;
-};
-
-
-GType 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);
-
-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 bf7fdd9951..0000000000
--- a/widgets/table/e-cell-progress.c
+++ /dev/null
@@ -1,456 +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.
- */
-
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-
-#include <gtk/gtkenums.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtkwindow.h>
-#include <gtk/gtksignal.h>
-#include <gdk/gdkkeysyms.h>
-#include <libgnomecanvas/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_dispose (GObject *object)
-{
- ECellProgress *eprog = E_CELL_PROGRESS (object);
-
- gdk_pixbuf_unref (eprog->image);
- g_free (eprog->image);
- g_free (eprog->buffer);
-
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static void
-e_cell_progress_class_init (GObjectClass *object_class)
-{
- ECellClass *ecc = (ECellClass *) object_class;
-
- object_class->dispose = eprog_dispose;
-
- 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 = g_type_class_ref (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 = g_object_new (E_CELL_PROGRESS_TYPE, NULL);
-
- 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 01a0d0b504..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 <libgnomecanvas/gnome-canvas.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <gal/e-table/e-cell.h>
-
-G_BEGIN_DECLS
-
-#define E_CELL_PROGRESS_TYPE (e_cell_progress_get_type ())
-#define E_CELL_PROGRESS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_CELL_PROGRESS_TYPE, ECellProgress))
-#define E_CELL_PROGRESS_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_CELL_PROGRESS_TYPE, ECellProgressClass))
-#define E_IS_CELL_PROGRESS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_CELL_PROGRESS_TYPE))
-#define E_IS_CELL_PROGRESS_CLASS(k) (G_TYPE_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;
-
-GType 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);
-
-G_END_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 1ba8f6d2e6..0000000000
--- a/widgets/table/e-cell-size.c
+++ /dev/null
@@ -1,110 +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 = g_type_class_ref (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, underline,
- * bold, color and a size filter.
- *
- * The arguments "strikeout_column", "underline_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, underline, 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 = g_object_new (E_CELL_SIZE_TYPE, NULL);
-
- 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 744cc00a98..0000000000
--- a/widgets/table/e-cell-size.h
+++ /dev/null
@@ -1,49 +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>
-
-G_BEGIN_DECLS
-
-#define E_CELL_SIZE_TYPE (e_cell_size_get_type ())
-#define E_CELL_SIZE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_CELL_SIZE_TYPE, ECellSize))
-#define E_CELL_SIZE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_CELL_SIZE_TYPE, ECellSizeClass))
-#define E_IS_CELL_SIZE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_CELL_SIZE_TYPE))
-#define E_IS_CELL_SIZE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_CELL_SIZE_TYPE))
-
-typedef struct {
- ECellText base;
-} ECellSize;
-
-typedef struct {
- ECellTextClass parent_class;
-} ECellSizeClass;
-
-GType e_cell_size_get_type (void);
-ECell *e_cell_size_new (const char *fontname, GtkJustification justify);
-
-G_END_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 9a0a9ce331..0000000000
--- a/widgets/table/e-cell-spin-button.c
+++ /dev/null
@@ -1,670 +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 (GObjectClass *klass);
-static void e_cell_spin_button_init (GtkObject *object);
-
-static void ecsb_dispose (GObject *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 guint signals[LAST_SIGNAL] = { 0 };
-static ECell *parent_class;
-
-static void
-e_cell_spin_button_class_init (GObjectClass *klass)
-{
- ECellClass *ecc = (ECellClass *) klass;
- ECellSpinButtonClass *ecsbc = (ECellSpinButtonClass *) klass;
-
- klass->dispose = ecsb_dispose;
-
- 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 = g_type_class_ref (E_CELL_TYPE);
-
- signals[STEP] =
- g_signal_new ("step",
- G_OBJECT_CLASS_TYPE (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ECellSpinButtonClass, step),
- NULL, NULL,
- e_marshal_NONE__POINTER_INT_INT_INT,
- G_TYPE_NONE,
- 4, G_TYPE_POINTER, G_TYPE_INT,
- G_TYPE_INT, G_TYPE_INT);
-}
-
-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_GET_CLASS (ecsb));
- 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;
- g_signal_emit (ecsb,
- signals[STEP], 0,
- ecv,
- STEP_UP,
- view_col,
- row);
- } else {
- ecsb->down_pressed = TRUE;
- g_signal_emit (ecsb,
- signals[STEP], 0,
- 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_GET_CLASS (ecell_view->ecell);
-
- 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_GET_CLASS (ecell_view->ecell);
-
- 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_dispose (GObject *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);
-
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-ECell *
-e_cell_spin_button_new (gint min,
- gint max,
- gint step,
- ECell *child_cell)
-{
- ECellSpinButton *ecsb;
-
- ecsb = g_object_new (E_CELL_SPIN_BUTTON_TYPE, NULL);
-
- if (!child_cell) {
- child_cell = e_cell_number_new (NULL,
- GTK_JUSTIFY_LEFT);
-
- g_signal_connect (ecsb, "step",
- G_CALLBACK (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 = g_object_new (E_CELL_SPIN_BUTTON_TYPE, NULL);
-
- if (!child_cell) {
- child_cell = e_cell_float_new (NULL, GTK_JUSTIFY_LEFT);
- g_signal_connect (ecsb, "step",
- G_CALLBACK (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 4326c0429c..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) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_CELL_SPIN_BUTTON_TYPE, ECellSpinButton))
-#define E_CELL_SPIN_BUTTON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_CELL_SPIN_BUTTON_TYPE, ECellSpinButtonClass))
-#define M_IS_CELL_SPIN_BUTTON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_CELL_SPIN_BUTTON_TYPE))
-#define M_IS_CELL_SPIN_BUTTON_CLASS(k) (G_TYPE_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;
-
-GType 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 9151fcc26e..0000000000
--- a/widgets/table/e-cell-text.c
+++ /dev/null
@@ -1,2331 +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 <gdk/gdkkeysyms.h>
-#include <gtk/gtk.h>
-#include <libgnomecanvas/gnome-canvas.h>
-#include <libgnomecanvas/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-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 "gal/util/e-i18n.h"
-#include "e-table-tooltip.h"
-
-#define d(x)
-#define DO_SELECTION 1
-
-#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_GET_CLASS ((c))))
-
-/* 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 {
- PROP_0,
-
- PROP_STRIKEOUT_COLUMN,
- PROP_UNDERLINE_COLUMN,
- PROP_BOLD_COLUMN,
- PROP_COLOR_COLUMN,
- PROP_EDITABLE,
- PROP_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;
- 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;
-
-struct _CellEdit {
-
- ECellTextView *text_view;
-
- int model_col, view_col, row;
- int cell_width;
-
- PangoLayout *layout;
-
- char *text;
-
- 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 void _get_tep (CellEdit *edit);
-
-static gint get_position_from_xy (CellEdit *edit, gint x, gint y);
-static gboolean _blink_scroll_timeout (gpointer data);
-
-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;
-
- if (!edit)
- return;
-
- row = edit->row;
- view_col = edit->view_col;
- model_col = edit->model_col;
-
- old_text = edit->old_text;
- text = edit->text;
- if (edit->invisible)
- gtk_widget_destroy (edit->invisible);
- if (edit->tep)
- g_object_unref (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;
- }
-
- if (edit->layout)
- g_object_unref (edit->layout);
-
- 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;
-
- text_view->gc = gdk_gc_new (GTK_WIDGET (text_view->canvas)->window);
-
- text_view->i_cursor = gdk_cursor_new (GDK_XTERM);
-
- 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->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) {
- gulong pix = color->pixel;
-
- gdk_colors_free (colormap, &pix, 1, 0);
-
- /* This frees the memory for the GdkColor. */
- gdk_color_free (color);
- }
-}
-
-static PangoLayout *
-build_layout (ECellTextView *text_view, int row, const char *text, gint width)
-{
- ECellView *ecell_view = (ECellView *) text_view;
- ECellText *ect = E_CELL_TEXT (ecell_view->ecell);
- PangoLayout *layout;
- gboolean bold, strikeout, underline;
-
- layout = gtk_widget_create_pango_layout (GTK_WIDGET (((GnomeCanvasItem *)ecell_view->e_table_item_view)->canvas), text);
-
- bold = ect->bold_column >= 0 &&
- row >= 0 &&
- e_table_model_value_at(ecell_view->e_table_model, ect->bold_column, row);
- strikeout = ect->strikeout_column >= 0 &&
- row >= 0 &&
- e_table_model_value_at(ecell_view->e_table_model, ect->strikeout_column, row);
- underline = ect->underline_column >= 0 &&
- row >= 0 &&
- e_table_model_value_at(ecell_view->e_table_model, ect->underline_column, row);
-
- if (bold || strikeout || underline) {
- PangoAttrList *attrs;
- int length = strlen (text);
- attrs = pango_attr_list_new ();
- if (bold) {
- PangoAttribute *attr = pango_attr_weight_new (PANGO_WEIGHT_BOLD);
- attr->start_index = 0;
- attr->end_index = length;
-
- pango_attr_list_insert_before (attrs, attr);
- }
- if (strikeout) {
- PangoAttribute *attr = pango_attr_strikethrough_new (TRUE);
- attr->start_index = 0;
- attr->end_index = length;
-
- pango_attr_list_insert_before (attrs, attr);
- }
- if (underline) {
- PangoAttribute *attr = pango_attr_underline_new (TRUE);
- attr->start_index = 0;
- attr->end_index = length;
-
- pango_attr_list_insert_before (attrs, attr);
- }
- pango_layout_set_attributes (layout, attrs);
- pango_attr_list_unref (attrs);
- }
-
- if (text_view->edit || width <= 0)
- return layout;
-
- pango_layout_set_width (layout, width * PANGO_SCALE);
- pango_layout_set_wrap (layout, PANGO_WRAP_CHAR);
-
- if (pango_layout_get_line_count (layout) > 1) {
- PangoLayoutLine *line = pango_layout_get_line (layout, 0);
- gchar *line_text = g_strdup (pango_layout_get_text (layout));
- gchar *last_char = g_utf8_find_prev_char (line_text, line_text + line->length - 1);
- while (last_char && pango_layout_get_line_count (layout) > 1) {
- gchar *new_text;
- last_char = g_utf8_find_prev_char (line_text, last_char);
- if (last_char)
- *last_char = '\0';
- new_text = g_strconcat (line_text, "...", NULL);
- pango_layout_set_text (layout, new_text, -1);
- g_free (new_text);
- }
- g_free (line_text);
- }
-
- switch (ect->justify) {
- case GTK_JUSTIFY_RIGHT:
- pango_layout_set_alignment (layout, PANGO_ALIGN_RIGHT);
- break;
- case GTK_JUSTIFY_CENTER:
- pango_layout_set_alignment (layout, PANGO_ALIGN_CENTER);
- break;
- case GTK_JUSTIFY_LEFT:
- default:
- break;
- }
-
- return layout;
-}
-
-static PangoLayout *
-generate_layout (ECellTextView *text_view, int model_col, int view_col, int row, int width)
-{
- ECellView *ecell_view = (ECellView *) text_view;
- ECellText *ect = E_CELL_TEXT (ecell_view->ecell);
- PangoLayout *layout;
- CellEdit *edit = text_view->edit;
-
- if (edit && edit->layout && edit->model_col == model_col && edit->row == row) {
- g_object_ref (edit->layout);
- return edit->layout;
- }
-
- if (row >= 0) {
- char *temp = e_cell_text_get_text(ect, ecell_view->e_table_model, model_col, row);
- layout = build_layout (text_view, row, temp ? temp : "?", width);
- e_cell_text_free_text(ect, temp);
- } else
- layout = build_layout (text_view, row, "Mumbo Jumbo", width);
-
- return layout;
-}
-
-static void
-draw_pango_rectangle (GdkDrawable *drawable, GdkGC *gc, int x1, int y1, PangoRectangle rect)
-{
- int width = rect.width / PANGO_SCALE;
- int height = rect.height / PANGO_SCALE;
- if (width <= 0)
- width = 1;
- if (height <= 0)
- height = 1;
- gdk_draw_rectangle (drawable, gc, TRUE,
- x1 + rect.x / PANGO_SCALE, y1 + rect.y / PANGO_SCALE, width, height);
-}
-
-static gboolean
-show_pango_rectangle (CellEdit *edit, PangoRectangle rect)
-{
- int x1 = rect.x / PANGO_SCALE;
- int x2 = (rect.x + rect.width) / PANGO_SCALE;
-#if 0
- int y1 = rect.y / PANGO_SCALE;
- int y2 = (rect.y + rect.height) / PANGO_SCALE;
-#endif
-
- int new_xofs_edit = edit->xofs_edit;
- int new_yofs_edit = edit->yofs_edit;
-
- if (x1 < new_xofs_edit)
- new_xofs_edit = x1;
- if (2 + x2 - edit->cell_width > new_xofs_edit)
- new_xofs_edit = 2 + x2 - edit->cell_width;
- if (new_xofs_edit < 0)
- new_xofs_edit = 0;
-
-#if 0
- if (y1 < new_yofs_edit)
- new_yofs_edit = y1;
- if (2 + y2 - edit->cell_height > new_yofs_edit)
- new_yofs_edit = 2 + y2 - edit->cell_height;
- if (new_yofs_edit < 0)
- new_yofs_edit = 0;
-#endif
-
- if (new_xofs_edit != edit->xofs_edit ||
- new_yofs_edit != edit->yofs_edit) {
- edit->xofs_edit = new_xofs_edit;
- edit->yofs_edit = new_yofs_edit;
- return TRUE;
- }
-
- return FALSE;
-}
-
-/*
- * 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)
-{
- PangoLayout *layout;
- ECellTextView *text_view = (ECellTextView *) ecell_view;
- ECellText *ect = E_CELL_TEXT (ecell_view->ecell);
- CellEdit *edit = text_view->edit;
- gboolean selected;
- GdkColor *foreground, *cursor_color;
- GtkWidget *canvas = GTK_WIDGET (text_view->canvas);
- GdkRectangle clip_rect;
- int x_origin, y_origin;
-
- selected = flags & E_CELL_SELECTED;
-
- if (selected) {
- if (flags & E_CELL_FOCUSED)
- foreground = &canvas->style->fg [GTK_STATE_SELECTED];
- else
- foreground = &canvas->style->fg [GTK_STATE_ACTIVE];
- cursor_color = foreground;
- } else {
- foreground = &canvas->style->text [GTK_STATE_NORMAL];
- cursor_color = foreground;
-
- if (ect->color_column != -1) {
- char *color_spec;
- GdkColor *cell_foreground;
-
- 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;
-
- x_origin = x1 + ect->x + text_view->xofs - (edit ? edit->xofs_edit : 0);
- y_origin = y1 + ect->y + text_view->yofs - (edit ? edit->yofs_edit : 0);
-
- clip_rect.x = x1;
- clip_rect.y = y1;
- clip_rect.width = x2 - x1;
- clip_rect.height = y2 - y1;
-
- gdk_gc_set_clip_rectangle (text_view->gc, &clip_rect);
- /* clip_rect = &rect;*/
-
- layout = generate_layout (text_view, model_col, view_col, row, x2 - x1);
-
- gdk_draw_layout (drawable, text_view->gc,
- x_origin, y_origin,
- layout);
-
- if (edit && edit->view_col == view_col && edit->row == row) {
- if (edit->selection_start != edit->selection_end) {
- int start_index, end_index;
- PangoLayoutLine *line;
- gint *ranges;
- gint n_ranges, i;
- PangoRectangle logical_rect;
- GdkRegion *clip_region = gdk_region_new ();
- GdkRegion *rect_region;
- GdkGC *selection_gc;
- GdkGC *text_gc;
-
- start_index = MIN (edit->selection_start, edit->selection_end);
- end_index = edit->selection_start ^ edit->selection_end ^ start_index;
-
- if (edit->has_selection) {
- selection_gc = canvas->style->base_gc [GTK_STATE_SELECTED];
- text_gc = canvas->style->text_gc[GTK_STATE_SELECTED];
- } else {
- selection_gc = canvas->style->base_gc [GTK_STATE_ACTIVE];
- text_gc = canvas->style->text_gc[GTK_STATE_ACTIVE];
- }
-
- gdk_gc_set_clip_rectangle (selection_gc, &clip_rect);
-
- line = pango_layout_get_lines (layout)->data;
-
- pango_layout_line_get_x_ranges (line, start_index, end_index, &ranges, &n_ranges);
-
- pango_layout_get_extents (layout, NULL, &logical_rect);
-
- for (i=0; i < n_ranges; i++) {
- GdkRectangle sel_rect;
-
- sel_rect.x = x_origin + ranges[2*i] / PANGO_SCALE;
- sel_rect.y = y_origin;
- sel_rect.width = (ranges[2*i + 1] - ranges[2*i]) / PANGO_SCALE;
- sel_rect.height = logical_rect.height / PANGO_SCALE;
-
- gdk_draw_rectangle (drawable, selection_gc, TRUE,
- sel_rect.x, sel_rect.y, sel_rect.width, sel_rect.height);
-
- gdk_region_union_with_rect (clip_region, &sel_rect);
- }
-
- rect_region = gdk_region_rectangle (&clip_rect);
- gdk_region_intersect (clip_region, rect_region);
- gdk_region_destroy (rect_region);
-
- gdk_gc_set_clip_region (text_gc, clip_region);
- gdk_draw_layout (drawable, text_gc,
- x_origin, y_origin,
- layout);
- gdk_gc_set_clip_region (text_gc, NULL);
- gdk_gc_set_clip_region (selection_gc, NULL);
-
- gdk_region_destroy (clip_region);
- g_free (ranges);
- } else {
- if (edit->show_cursor) {
- PangoRectangle strong_pos, weak_pos;
- pango_layout_get_cursor_pos (layout, edit->selection_start, &strong_pos, &weak_pos);
- draw_pango_rectangle (drawable, text_view->gc, x_origin, y_origin, strong_pos);
- if (strong_pos.x != weak_pos.x ||
- strong_pos.y != weak_pos.y ||
- strong_pos.width != weak_pos.width ||
- strong_pos.height != weak_pos.height)
- draw_pango_rectangle (drawable, text_view->gc, x_origin, y_origin, weak_pos);
- }
- }
- }
-
- g_object_unref (layout);
-}
-
-/*
- * 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->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;
- d(gboolean press = FALSE);
-
- if (!(flags & E_CELL_EDITING))
- return 0;
-
- if (edit && edit->view_col == view_col && edit->row == row) {
- edit_display = TRUE;
- }
-
- 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;
- 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;
- 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 (edit, event->button.x, event->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 (edit, event->button.x, event->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 (edit, event->motion.x, event->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;
- }
-
- 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;
- gint height;
- PangoLayout *layout;
-
- layout = generate_layout (text_view, model_col, view_col, row, 0);
- pango_layout_get_pixel_size (layout, NULL, &height);
- g_object_unref (layout);
- return height + 2;
-}
-
-/*
- * 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_new0 (CellEdit, 1);
- text_view->edit = edit;
-
- edit->view_col = -1;
- edit->model_col = -1;
- edit->row = -1;
-
- edit->text_view = text_view;
- edit->model_col = model_col;
- edit->view_col = view_col;
- edit->row = row;
- edit->cell_width = e_table_header_get_column (
- ((ETableItem *)ecell_view->e_table_item_view)->header,
- view_col)->width - 8;
-
- edit->layout = generate_layout (text_view, model_col, view_col, row, edit->cell_width);
-
- 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->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);
- } 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->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);
-}
-
-#define FONT_NAME "Sans Regular"
-
-static GnomeFont *
-get_font_for_size (double h)
-{
- GnomeFontFace *face;
- GnomeFont *font;
- double asc, desc, size;
-
- face = gnome_font_face_find (FONT_NAME);
-
- asc = gnome_font_face_get_ascender (face);
- desc = abs (gnome_font_face_get_descender (face));
- size = h * 1000 / (asc + desc);
-
- font = gnome_font_find_closest (FONT_NAME, size);
-
- g_object_unref (face);
- return font;
-}
-
-static void
-ect_print (ECellView *ecell_view, GnomePrintContext *context,
- int model_col, int view_col, int row,
- double width, double height)
-{
- GnomeFont *font = get_font_for_size (16);
- 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);
- g_object_unref (font);
-}
-
-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;
- int row;
- int number_of_rows;
- int max_width = 0;
-
- number_of_rows = e_table_model_row_count (ecell_view->e_table_model);
-
- for (row = 0; row < number_of_rows; row++) {
- PangoLayout *layout = generate_layout (text_view, model_col, view_col, row, 0);
- int width;
-
- pango_layout_get_pixel_size (layout, &width, NULL);
-
- max_width = MAX (max_width, width);
- g_object_unref (layout);
- }
-
- return max_width + 8;
-}
-
-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;
- int width;
- PangoLayout *layout;
-
- if (row >= e_table_model_row_count (ecell_view->e_table_model))
- return 0;
-
- layout = generate_layout (text_view, model_col, view_col, row, 0);
- pango_layout_get_pixel_size (layout, &width, NULL);
- g_object_unref (layout);
-
- return width + 8;
-}
-
-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;
- g_signal_emit_by_name (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));
- g_signal_emit_by_name (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;
- GtkWidget *canvas;
- 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;
- ECellText *ect = E_CELL_TEXT(ecell_view->ecell);
- GtkWidget *window;
- PangoLayout *layout;
- int width, height;
-
- tooltip->timer = 0;
-
- layout = generate_layout (text_view, model_col, view_col, row, col_width);
-
- pango_layout_get_pixel_size (layout, &width, &height);
- if (width < col_width - 8) {
- 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);
-
- 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) width + 4,
- "y2", (double) 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,
- "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),
- "underline", (gboolean) ect->underline_column >= 0 && e_table_model_value_at(ecell_view->e_table_model, ect->underline_column, row),
- "fill_color_gdk", tooltip->foreground,
- "text", pango_layout_get_text (layout),
- "editable", FALSE,
- "clip_width", (double) width,
- "clip_height", (double) height,
- "clip", TRUE,
- "line_wrap", FALSE,
- "justification", E_CELL_TEXT (text_view->cell_view.ecell)->justify,
- "draw_background", FALSE,
- NULL);
-
- tooltip_width = width;
- tooltip_height = 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);
- g_signal_connect (window, "event",
- G_CALLBACK (tooltip_event), tooltip);
-
- e_canvas_popup_tooltip (E_CANVAS(text_view->canvas), window, pixel_origin.x + tooltip->x,
- pixel_origin.y + tooltip->y - 1);
-
- return;
-}
-
-/*
- * GtkObject::destroy method
- */
-static void
-ect_finalize (GObject *object)
-{
- ECellText *ect = E_CELL_TEXT (object);
-
- g_free (ect->font_name);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-/* Set_arg handler for the text item */
-static void
-ect_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- ECellText *text;
-
- text = E_CELL_TEXT (object);
-
- switch (prop_id) {
- case PROP_STRIKEOUT_COLUMN:
- text->strikeout_column = g_value_get_int (value);
- break;
-
- case PROP_UNDERLINE_COLUMN:
- text->underline_column = g_value_get_int (value);
- break;
-
- case PROP_BOLD_COLUMN:
- text->bold_column = g_value_get_int (value);
- break;
-
- case PROP_COLOR_COLUMN:
- text->color_column = g_value_get_int (value);
- break;
-
- case PROP_EDITABLE:
- text->editable = g_value_get_boolean (value);
- break;
-
- case PROP_BG_COLOR_COLUMN:
- text->bg_color_column = g_value_get_int (value);
- break;
-
- default:
- return;
- }
-}
-
-/* Get_arg handler for the text item */
-static void
-ect_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- ECellText *text;
-
- text = E_CELL_TEXT (object);
-
- switch (prop_id) {
- case PROP_STRIKEOUT_COLUMN:
- g_value_set_int (value, text->strikeout_column);
- break;
-
- case PROP_UNDERLINE_COLUMN:
- g_value_set_int (value, text->underline_column);
- break;
-
- case PROP_BOLD_COLUMN:
- g_value_set_int (value, text->bold_column);
- break;
-
- case PROP_COLOR_COLUMN:
- g_value_set_int (value, text->color_column);
- break;
-
- case PROP_EDITABLE:
- g_value_set_boolean (value, text->editable);
- break;
-
- case PROP_BG_COLOR_COLUMN:
- g_value_set_int (value, text->bg_color_column);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static char *ellipsis_default = NULL;
-static gboolean use_ellipsis_default = TRUE;
-
-static void
-e_cell_text_class_init (GObjectClass *object_class)
-{
- ECellClass *ecc = (ECellClass *) object_class;
- ECellTextClass *ectc = (ECellTextClass *) object_class;
- const char *ellipsis_env;
-
- G_OBJECT_CLASS (object_class)->finalize = ect_finalize;
-
- 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_property = ect_get_property;
- object_class->set_property = ect_set_property;
-
- parent_class = g_type_class_ref (PARENT_TYPE);
-
- g_object_class_install_property (object_class, PROP_STRIKEOUT_COLUMN,
- g_param_spec_int ("strikeout_column",
- _("Strikeout Column"),
- /*_( */"XXX blurb" /*)*/,
- 0, G_MAXINT, 0,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_UNDERLINE_COLUMN,
- g_param_spec_int ("underline_column",
- _("Underline Column"),
- /*_( */"XXX blurb" /*)*/,
- 0, G_MAXINT, 0,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_BOLD_COLUMN,
- g_param_spec_int ("bold_column",
- _("Bold Column"),
- /*_( */"XXX blurb" /*)*/,
- 0, G_MAXINT, 0,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_COLOR_COLUMN,
- g_param_spec_int ("color_column",
- _("Color Column"),
- /*_( */"XXX blurb" /*)*/,
- 0, G_MAXINT, 0,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_EDITABLE,
- g_param_spec_boolean ("editable",
- _("Editable"),
- /*_( */"XXX blurb" /*)*/,
- FALSE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_BG_COLOR_COLUMN,
- g_param_spec_int ("bg_color_column",
- _("BG Color Column"),
- /*_( */"XXX blurb" /*)*/,
- 0, G_MAXINT, 0,
- G_PARAM_READWRITE));
-
- if (!clipboard_atom)
- clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE);
-
- ellipsis_env = g_getenv ("GAL_ELLIPSIS");
- if (ellipsis_env) {
- if (*ellipsis_env) {
- ellipsis_default = g_strdup (ellipsis_env);
- } else {
- use_ellipsis_default = FALSE;
- }
- }
-}
-
-static void
-e_cell_text_init (ECellText *ect)
-{
- ect->ellipsis = g_strdup (ellipsis_default);
- ect->use_ellipsis = use_ellipsis_default;
- ect->strikeout_column = -1;
- ect->underline_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: this param is no longer used, but left here for api stability
- * @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: this param is no longer used, but left here for api stability
- * @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, underline, bold, and color.
- *
- * The arguments "strikeout_column", "underline_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 = g_object_new (E_CELL_TEXT_TYPE, NULL);
-
- e_cell_text_construct(ect, fontname, justify);
-
- return (ECell *) ect;
-}
-
-
-/* fixme: Handle Font attributes */
-/* position is in BYTES */
-
-static gint
-get_position_from_xy (CellEdit *edit, gint x, gint y)
-{
- int index;
- int trailing;
- const char *text;
- PangoLayout *layout = generate_layout (edit->text_view, edit->model_col, edit->view_col, edit->row, edit->cell_width);
- ECellTextView *text_view = edit->text_view;
- ECellText *ect = (ECellText *) ((ECellView *)text_view)->ecell;
-
- x -= (ect->x + text_view->xofs - edit->xofs_edit);
- y -= (ect->y + text_view->yofs - edit->yofs_edit);
-
- pango_layout_xy_to_index (layout, x * PANGO_SCALE, y * PANGO_SCALE, &index, &trailing);
-
- text = pango_layout_get_text (layout);
-
- return g_utf8_offset_to_pointer (text + index, trailing) - text;
-}
-
-#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;
-
- gulong current_time;
- gboolean scroll = FALSE;
- gboolean redraw = FALSE;
- int width, height;
-
- 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;
- }
-
- pango_layout_get_pixel_size (edit->layout, &width, &height);
-
- if (scroll && edit->button_down) {
- /* FIXME: Copy this for y. */
- if (edit->lastx - ect->x > edit->cell_width) {
- if (edit->xofs_edit < width - edit->cell_width) {
- edit->xofs_edit += 4;
- if (edit->xofs_edit > width - edit->cell_width + 1)
- edit->xofs_edit = width - edit->cell_width + 1;
- redraw = TRUE;
- }
- }
- if (edit->lastx - ect->x < 0 &&
- edit->xofs_edit > 0) {
- edit->xofs_edit -= 4;
- if (edit->xofs_edit < 0)
- edit->xofs_edit = 0;
- redraw = TRUE;
- }
- if (redraw) {
- ETextEventProcessorEvent e_tep_event;
- e_tep_event.type = GDK_MOTION_NOTIFY;
- e_tep_event.motion.state = edit->last_state;
- e_tep_event.motion.time = 0;
- e_tep_event.motion.position = get_position_from_xy (edit, 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->view_col, edit->row);
- }
- return TRUE;
-}
-
-static int
-next_word (CellEdit *edit, int start)
-{
- char *p;
- int length;
-
- length = strlen (edit->text);
- if (start >= length)
- return length;
-
- p = g_utf8_next_char (edit->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 - edit->text;
- p = g_utf8_next_char (p);
- }
-
- return p - edit->text;
-}
-
-static int
-_get_position (ECellTextView *text_view, ETextEventProcessorCommand *command)
-{
- int length;
- CellEdit *edit = text_view->edit;
- gchar *p;
- int unival;
- int index;
- int trailing;
-
- 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 (edit->text);
-
- case E_TEP_START_OF_LINE:
-
- if (edit->selection_end < 1) return 0;
-
- p = g_utf8_find_prev_char (edit->text, edit->text + edit->selection_end);
-
- if (p == edit->text) return 0;
-
- p = g_utf8_find_prev_char (edit->text, p);
-
- while (p && p > edit->text) {
- if (*p == '\n') return p - edit->text + 1;
- p = g_utf8_find_prev_char (edit->text, p);
- }
-
- return 0;
-
- case E_TEP_END_OF_LINE:
-
- length = strlen (edit->text);
- if (edit->selection_end >= length) return length;
-
- p = g_utf8_next_char (edit->text + edit->selection_end);
-
- while (*p && g_unichar_validate (g_utf8_get_char (p))) {
- if (*p == '\n') return p - edit->text;
- p = g_utf8_next_char (p);
- }
-
- return p - edit->text;
-
- case E_TEP_FORWARD_CHARACTER:
-
- length = strlen (edit->text);
- if (edit->selection_end >= length) return length;
-
- p = g_utf8_next_char (edit->text + edit->selection_end);
-
- return p - edit->text;
-
- case E_TEP_BACKWARD_CHARACTER:
-
- if (edit->selection_end < 1) return 0;
-
- p = g_utf8_find_prev_char (edit->text, edit->text + edit->selection_end);
-
- if (p == NULL) return 0;
-
- return p - edit->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 (edit->text, edit->text + edit->selection_end);
-
- if (p == edit->text) return 0;
-
- p = g_utf8_find_prev_char (edit->text, p);
-
- while (p && p > edit->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) - edit->text);
- }
- p = g_utf8_find_prev_char (edit->text, p);
- }
-
- return 0;
-
- case E_TEP_FORWARD_LINE:
- pango_layout_move_cursor_visually (edit->layout,
- TRUE,
- edit->selection_end,
- 0,
- TRUE,
- &index,
- &trailing);
- index = g_utf8_offset_to_pointer (edit->text + index, trailing) - edit->text;
- if (index < 0)
- return 0;
- length = strlen (edit->text);
- if (index >= length)
- return length;
- return index;
- case E_TEP_BACKWARD_LINE:
- pango_layout_move_cursor_visually (edit->layout,
- TRUE,
- edit->selection_end,
- 0,
- TRUE,
- &index,
- &trailing);
-
- index = g_utf8_offset_to_pointer (edit->text + index, trailing) - edit->text;
- if (index < 0)
- return 0;
- length = strlen (edit->text);
- if (index >= length)
- return length;
- return index;
- 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;
- 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 = edit->text + edit->selection_start;
- ep = edit->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;
- char *temp;
-
- if (value <= 0) return;
-
- temp = g_new (gchar, strlen (edit->text) + value + 1);
-
- strncpy (temp, edit->text, edit->selection_start);
- strncpy (temp + edit->selection_start, string, value);
- strcpy (temp + edit->selection_start + value, edit->text + edit->selection_end);
-
- g_free (edit->text);
-
- edit->text = temp;
-
- edit->selection_start += value;
- edit->selection_end = edit->selection_start;
-}
-
-static void
-capitalize (CellEdit *edit, int start, int end, ETextEventProcessorCaps type)
-{
- ECellTextView *text_view = edit->text_view;
-
- gboolean first = TRUE;
- int character_length = g_utf8_strlen (edit->text + start, start - end);
- const char *p = edit->text + start;
- const char *text_end = edit->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;
- ECellTextView *text_view = edit->text_view;
- ECellText *ect = E_CELL_TEXT (text_view->cell_view.ecell);
-
- gboolean change = FALSE;
- gboolean redraw = FALSE;
-
- int sel_start, sel_end;
-
- /* 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,
- edit->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,
- edit->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 (change) {
- if (edit->layout)
- g_object_unref (edit->layout);
- edit->layout = build_layout (text_view, edit->row, edit->text, edit->cell_width);
- }
-
- if (!edit->button_down) {
- PangoRectangle strong_pos, weak_pos;
- pango_layout_get_cursor_pos (edit->layout, edit->selection_end, &strong_pos, &weak_pos);
- if (strong_pos.x != weak_pos.x ||
- strong_pos.y != weak_pos.y ||
- strong_pos.width != weak_pos.width ||
- strong_pos.height != weak_pos.height) {
- if (show_pango_rectangle (edit, weak_pos))
- redraw = TRUE;
- }
- if (show_pango_rectangle (edit, strong_pos)) {
- redraw = TRUE;
- }
- }
-
- if (redraw){
- ect_queue_redraw (text_view, edit->view_col, edit->row);
- }
-}
-
-#ifdef DO_SELECTION
-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 GtkWidget *e_cell_text_view_get_invisible (CellEdit *edit)
-{
- if (edit->invisible == NULL) {
- GtkWidget *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);
-
- g_signal_connect (invisible, "selection_get",
- G_CALLBACK (_selection_get),
- edit);
- g_signal_connect (invisible, "selection_clear_event",
- G_CALLBACK (_selection_clear_event),
- edit);
- g_signal_connect (invisible, "selection_received",
- G_CALLBACK (_selection_received),
- edit);
- }
- return edit->invisible;
-}
-#endif
-
-static void
-e_cell_text_view_supply_selection (CellEdit *edit, guint time, GdkAtom selection, char *data, gint length)
-{
-#if DO_SELECTION
- 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;
-#endif
-}
-
-static void
-e_cell_text_view_get_selection (CellEdit *edit, GdkAtom selection, guint32 time)
-{
-#if DO_SELECTION
- GtkWidget *invisible;
- invisible = e_cell_text_view_get_invisible (edit);
- gtk_selection_convert (invisible,
- selection,
- GDK_SELECTION_TYPE_STRING,
- time);
-#endif
-}
-
-static void
-_get_tep (CellEdit *edit)
-{
- if (!edit->tep) {
- edit->tep = e_text_event_processor_emacs_like_new ();
- g_signal_connect (edit->tep,
- "command",
- G_CALLBACK(e_cell_text_view_command),
- (gpointer) edit);
- }
-}
-
-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 466fc54f1a..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 <libgnomecanvas/gnome-canvas.h>
-#include <gal/e-table/e-cell.h>
-
-G_BEGIN_DECLS
-
-#define E_CELL_TEXT_TYPE (e_cell_text_get_type ())
-#define E_CELL_TEXT(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_CELL_TEXT_TYPE, ECellText))
-#define E_CELL_TEXT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_CELL_TEXT_TYPE, ECellTextClass))
-#define E_IS_CELL_TEXT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_CELL_TEXT_TYPE))
-#define E_IS_CELL_TEXT_CLASS(k) (G_TYPE_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 underline_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;
-
-GType 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);
-
-G_END_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 fbb68ac951..0000000000
--- a/widgets/table/e-cell-toggle.c
+++ /dev/null
@@ -1,484 +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 <libgnomecanvas/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
-
-static int
-gnome_print_pixbuf (GnomePrintContext *pc, GdkPixbuf *pixbuf)
-{
- if (gdk_pixbuf_get_has_alpha (pixbuf))
- return gnome_print_rgbaimage (pc,
- gdk_pixbuf_get_pixels (pixbuf),
- gdk_pixbuf_get_width (pixbuf),
- gdk_pixbuf_get_height (pixbuf),
- gdk_pixbuf_get_rowstride (pixbuf));
- else
- return gnome_print_rgbimage (pc,
- gdk_pixbuf_get_pixels (pixbuf),
- gdk_pixbuf_get_width (pixbuf),
- gdk_pixbuf_get_height (pixbuf),
- gdk_pixbuf_get_rowstride (pixbuf));
-}
-
-/*
- * 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 (toggle_view->pixmap_cache);
- 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;
- GdkColor color;
- 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 = GTK_WIDGET (toggle_view->canvas)->style->bg [GTK_STATE_SELECTED];
- break;
- case 1:
- color = GTK_WIDGET (toggle_view->canvas)->style->bg [GTK_STATE_ACTIVE];
- break;
- case 2:
- color = GTK_WIDGET (toggle_view->canvas)->style->base [GTK_STATE_NORMAL];
- break;
- }
-
- if (cache_seq >= 3) {
- e_hsv_tweak (&color, 0.0f, 0.0f, -0.07f);
- }
-
- flat = gdk_pixbuf_composite_color_simple (image,
- width, height,
- GDK_INTERP_BILINEAR,
- 255,
- 1,
- RGB_COLOR (color), RGB_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::print method
- */
-static void
-etog_print (ECellView *ecell_view, GnomePrintContext *context,
- int model_col, int view_col, int row,
- double width, double height)
-{
- ECellToggle *toggle = E_CELL_TOGGLE(ecell_view->ecell);
- GdkPixbuf *image;
- const int value = GPOINTER_TO_INT (
- e_table_model_value_at (ecell_view->e_table_model, model_col, row));
-
- if (value >= toggle->n_states){
- g_warning ("Value from the table model is %d, the states we support are [0..%d)\n",
- value, toggle->n_states);
- return;
- }
-
- gnome_print_gsave(context);
-
- image = toggle->images[value];
-
- gnome_print_translate (context, 0, (height - toggle->height) / 2);
- gnome_print_scale (context, toggle->height, toggle->height);
- gnome_print_pixbuf (context, image);
-
- gnome_print_grestore(context);
-}
-
-static gdouble
-etog_print_height (ECellView *ecell_view, GnomePrintContext *context,
- int model_col, int view_col, int row,
- double width)
-{
- 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_finalize (GObject *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;
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static void
-e_cell_toggle_class_init (GtkObjectClass *object_class)
-{
- ECellClass *ecc = (ECellClass *) object_class;
-
- G_OBJECT_CLASS (object_class)->finalize = etog_finalize;
-
- 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->print = etog_print;
- ecc->print_height = etog_print_height;
- ecc->max_width = etog_max_width;
- ecc->style_set = etog_style_set;
-
- parent_class = g_type_class_ref (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 = g_object_new (E_CELL_TOGGLE_TYPE, NULL);
-
- 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 71d9de3883..0000000000
--- a/widgets/table/e-cell-toggle.h
+++ /dev/null
@@ -1,62 +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 <libgnomecanvas/gnome-canvas.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <gal/e-table/e-cell.h>
-
-G_BEGIN_DECLS
-
-#define E_CELL_TOGGLE_TYPE (e_cell_toggle_get_type ())
-#define E_CELL_TOGGLE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_CELL_TOGGLE_TYPE, ECellToggle))
-#define E_CELL_TOGGLE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_CELL_TOGGLE_TYPE, ECellToggleClass))
-#define E_IS_CELL_TOGGLE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_CELL_TOGGLE_TYPE))
-#define E_IS_CELL_TOGGLE_CLASS(k) (G_TYPE_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;
-
-GType 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);
-
-G_END_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 cbe896ceda..0000000000
--- a/widgets/table/e-cell-tree.c
+++ /dev/null
@@ -1,900 +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 <libgnomecanvas/gnome-canvas.h>
-
-#include "e-tree-table-adapter.h"
-#include "e-tree.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;
- gboolean retro_look;
- gboolean prelit;
- gint animate_timeout;
-
-} 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);
-}
-
-static void
-draw_retro_expander (ECellTreeView *ectv, GdkDrawable *drawable, gboolean expanded, GdkRectangle *rect)
-{
- GdkPixbuf *image;
- int image_width, image_height;
- ECellTree *ect = E_CELL_TREE(ectv->cell_view.ecell);
-
- image = expanded ? ect->open_pixbuf : ect->closed_pixbuf;
-
- image_width = gdk_pixbuf_get_width(image);
- image_height = gdk_pixbuf_get_height(image);
-
- gdk_pixbuf_render_to_drawable_alpha (image,
- drawable,
- rect->x, rect->y,
- rect->width - image_width / 2,
- rect->height - image_height / 2,
- image_width, image_height,
- GDK_PIXBUF_ALPHA_BILEVEL,
- 128,
- GDK_RGB_DITHER_NORMAL,
- image_width, 0);
-}
-
-static void
-draw_expander (ECellTreeView *ectv, GdkDrawable *drawable, GtkExpanderStyle expander_style, GtkStateType state, GdkRectangle *rect)
-{
- GtkWidget *tree = GTK_WIDGET (ectv->canvas)->parent;
- gint exp_size;
- gtk_widget_style_get (tree, "expander_size", &exp_size, NULL);
-
- gtk_paint_expander (tree->style, drawable, state, rect, tree, "treeview", rect->x + rect->width - exp_size / 2, rect->y + rect->height / 2, expander_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)
-{
- 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 = NULL;
- 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;
- ETree *tree = E_TREE (canvas->parent);
-
- gtk_widget_style_get (GTK_WIDGET (tree),
- "retro_look", &tree_view->retro_look,
- NULL);
- tree_view->prelit = FALSE;
-
- 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 (tree_view->retro_look && 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_table_adapter_node_get_next (tree_table_adapter, 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_table_adapter_node_get_next(tree_table_adapter, 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)) {
- gboolean expanded = e_tree_table_adapter_node_is_expanded (tree_table_adapter, node);
- GdkRectangle r;
- if (tree_view->retro_look) {
- r.x = 0;
- r.y = 0;
- r.width = x1 + subcell_offset - INDENT_AMOUNT / 2,
- r.height = y1 + (y2 - y1) / 2,
- draw_retro_expander (tree_view, drawable, expanded, &r);
- } else {
- r = rect;
- r.width -= node_image_width + 2;
- draw_expander (tree_view, drawable, expanded ? GTK_EXPANDER_EXPANDED : GTK_EXPANDER_COLLAPSED, GTK_STATE_NORMAL, &r);
- }
- }
-
- 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);
-
- if (clip_rect) {
- gdk_gc_set_clip_rectangle (tree_view->gc, NULL);
- gdk_gc_set_clip_rectangle (fg_gc, NULL);
- }
-}
-
-static void
-adjust_event_position (GdkEvent *event, gint offset)
-{
- 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:
- break;
- }
-}
-
-static gboolean
-event_in_expander (GdkEvent *event, gint offset, gint height)
-{
- switch (event->type) {
- case GDK_BUTTON_PRESS:
- return (event->button.x > (offset - INDENT_AMOUNT) && event->button.x < offset);
- case GDK_MOTION_NOTIFY:
- return (event->motion.x > (offset - INDENT_AMOUNT) && event->motion.x < offset &&
- event->motion.y > 2 && event->motion.y < (height - 2));
- default:
- break;
- }
-
- return FALSE;
-}
-
-/*
- * 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;
-}
-
-typedef struct {
- ECellTreeView *ectv;
- ETreeTableAdapter *etta;
- ETreePath node;
- gboolean expanded;
- gboolean finish;
- GdkRectangle area;
-} animate_closure_t;
-
-static gboolean
-animate_expander (gpointer data)
-{
- animate_closure_t *closure = (animate_closure_t *) data;
-
- if (closure->finish) {
- e_tree_table_adapter_node_set_expanded (closure->etta, closure->node, !closure->expanded);
- closure->ectv->animate_timeout = 0;
- g_free (data);
- return FALSE;
- }
-
- draw_expander (closure->ectv, GTK_LAYOUT (closure->ectv->canvas)->bin_window,
- closure->expanded ? GTK_EXPANDER_SEMI_COLLAPSED : GTK_EXPANDER_SEMI_EXPANDED,
- GTK_STATE_NORMAL, &closure->area);
- closure->finish = TRUE;
-
- 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)
-{
- ECellTreeView *tree_view = (ECellTreeView *) ecell_view;
- ETreeModel *tree_model = e_cell_tree_get_tree_model (ecell_view->e_table_model, row);
- ETreeTableAdapter *etta = 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);
- gint result;
-
- switch (event->type) {
- case GDK_BUTTON_PRESS:
-
- if (event_in_expander (event, offset, 0)) {
- if (e_tree_model_node_is_expandable (tree_model, node)) {
- gboolean expanded = e_tree_table_adapter_node_is_expanded(etta, node);
- if (tree_view->retro_look)
- e_tree_table_adapter_node_set_expanded (etta, node, !expanded);
- else {
- gint tmp_row = row;
- GdkRectangle area;
- animate_closure_t *closure = g_new0 (animate_closure_t, 1);
- e_table_item_get_cell_geometry (tree_view->cell_view.e_table_item_view,
- &tmp_row, &view_col, &area.x, &area.y, NULL, &area.height);
- area.width = offset - 2;
- draw_expander (tree_view, GTK_LAYOUT (tree_view->canvas)->bin_window,
- expanded ? GTK_EXPANDER_SEMI_EXPANDED : GTK_EXPANDER_SEMI_COLLAPSED,
- GTK_STATE_NORMAL, &area);
- closure->ectv = tree_view;
- closure->etta = etta;
- closure->node = node;
- closure->expanded = expanded;
- closure->area = area;
- tree_view->animate_timeout = g_timeout_add (50, animate_expander, closure);
- }
- return TRUE;
- }
- }
- else if (event->button.x < (offset - INDENT_AMOUNT))
- return FALSE;
- break;
-
- case GDK_MOTION_NOTIFY:
-
- if (!tree_view->retro_look && e_tree_model_node_is_expandable (tree_model, node)) {
- gint height = ect_height (ecell_view, model_col, view_col, row);
- GdkRectangle area;
- gboolean in_expander = event_in_expander (event, offset, height);
-
- if (tree_view->prelit ^ in_expander) {
- gint tmp_row = row;
- e_table_item_get_cell_geometry (tree_view->cell_view.e_table_item_view,
- &tmp_row, &view_col, &area.x, &area.y, NULL, &area.height);
- area.width = offset - 2;
- draw_expander (tree_view, GTK_LAYOUT (tree_view->canvas)->bin_window,
- e_tree_table_adapter_node_is_expanded (etta, node) ? GTK_EXPANDER_EXPANDED : GTK_EXPANDER_COLLAPSED,
- in_expander ? GTK_STATE_PRELIGHT : GTK_STATE_NORMAL, &area);
- tree_view->prelit = in_expander;
- return TRUE;
- }
-
- }
- break;
-
- case GDK_LEAVE_NOTIFY:
-
- if (tree_view->prelit) {
- gint tmp_row = row;
- GdkRectangle area;
- e_table_item_get_cell_geometry (tree_view->cell_view.e_table_item_view,
- &tmp_row, &view_col, &area.x, &area.y, NULL, &area.height);
- area.width = offset - 2;
- draw_expander (tree_view, GTK_LAYOUT (tree_view->canvas)->bin_window,
- e_tree_table_adapter_node_is_expanded (etta, node) ? GTK_EXPANDER_EXPANDED : GTK_EXPANDER_COLLAPSED,
- GTK_STATE_NORMAL, &area);
- tree_view->prelit = FALSE;
- }
- return TRUE;
-
- default:
- break;
- }
-
- adjust_event_position (event, -offset);
- result = e_cell_event(tree_view->subcell_view, event, model_col, view_col, row, flags, actions);
- adjust_event_position (event, offset);
-
- return result;
-}
-
-/*
- * 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_table_adapter_node_get_next (tree_table_adapter, 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_table_adapter_node_get_next(tree_table_adapter, 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 */
-}
-
-/*
- * GObject::dispose method
- */
-static void
-ect_dispose (GObject *object)
-{
- ECellTree *ect = E_CELL_TREE (object);
-
- /* destroy our subcell */
- if (ect->subcell)
- g_object_unref (ect->subcell);
- ect->subcell = NULL;
-
- if (ect->open_pixbuf)
- gdk_pixbuf_unref (ect->open_pixbuf);
- ect->open_pixbuf = NULL;
-
- if (ect->closed_pixbuf)
- gdk_pixbuf_unref (ect->closed_pixbuf);
- ect->closed_pixbuf = NULL;
-
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static void
-e_cell_tree_class_init (GObjectClass *object_class)
-{
- ECellClass *ecc = (ECellClass *) object_class;
-
- object_class->dispose = ect_dispose;
-
- 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 = g_type_class_ref (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) {
- g_object_ref (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 = g_object_new (E_CELL_TREE_TYPE, NULL);
-
- 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 13462ee428..0000000000
--- a/widgets/table/e-cell-tree.h
+++ /dev/null
@@ -1,75 +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 <libgnomecanvas/gnome-canvas.h>
-#include <gal/e-table/e-cell.h>
-
-G_BEGIN_DECLS
-
-#define E_CELL_TREE_TYPE (e_cell_tree_get_type ())
-#define E_CELL_TREE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_CELL_TREE_TYPE, ECellTree))
-#define E_CELL_TREE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_CELL_TREE_TYPE, ECellTreeClass))
-#define E_IS_CELL_TREE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_CELL_TREE_TYPE))
-#define E_IS_CELL_TREE_CLASS(k) (G_TYPE_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;
-
-GType 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);
-
-
-G_END_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 ab86e307c9..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
-
-/*
- * GObject::dispose method
- */
-static void
-ecv_dispose (GObject *object)
-{
- ECellVbox *ecv = E_CELL_VBOX (object);
- int i;
-
- /* destroy our subcell */
- for (i = 0; i < ecv->subcell_count; i++)
- if (ecv->subcells[i])
- g_object_unref (ecv->subcells[i]);
- g_free (ecv->subcells);
- ecv->subcells = NULL;
- ecv->subcell_count = 0;
-
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static void
-e_cell_vbox_class_init (GObjectClass *object_class)
-{
- ECellClass *ecc = (ECellClass *) object_class;
-
- object_class->dispose = ecv_dispose;
-
- 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 = g_type_class_ref (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 = g_object_new (E_CELL_VBOX_TYPE, NULL);
-
- 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)
- g_object_ref (subcell);
-}
diff --git a/widgets/table/e-cell-vbox.h b/widgets/table/e-cell-vbox.h
deleted file mode 100644
index 93ddc6d25c..0000000000
--- a/widgets/table/e-cell-vbox.h
+++ /dev/null
@@ -1,65 +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 <libgnomecanvas/gnome-canvas.h>
-#include <gal/e-table/e-cell.h>
-
-G_BEGIN_DECLS
-
-#define E_CELL_VBOX_TYPE (e_cell_vbox_get_type ())
-#define E_CELL_VBOX(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_CELL_VBOX_TYPE, ECellVbox))
-#define E_CELL_VBOX_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_CELL_VBOX_TYPE, ECellVboxClass))
-#define E_IS_CELL_VBOX(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_CELL_VBOX_TYPE))
-#define E_IS_CELL_VBOX_CLASS(k) (G_TYPE_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;
-
-GType e_cell_vbox_get_type (void);
-ECell *e_cell_vbox_new (void);
-void e_cell_vbox_append (ECellVbox *vbox,
- ECell *subcell,
- int model_col);
-
-
-G_END_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 8deeaa654c..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_TYPE_OBJECT
-
-#define ECVIEW_EC_CLASS(v) (E_CELL_GET_CLASS (v->ecell))
-
-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_GET_CLASS (ecell)->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 b6c4e01e71..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 <libgnomeprint/gnome-font.h>
-#include <gal/e-table/e-table-model.h>
-#include <gal/e-table/e-table-tooltip.h>
-
-G_BEGIN_DECLS
-
-#define E_CELL_TYPE (e_cell_get_type ())
-#define E_CELL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_CELL_TYPE, ECell))
-#define E_CELL_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_CELL_TYPE, ECellClass))
-#define E_CELL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), E_CELL_TYPE, ECellClass))
-#define E_IS_CELL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_CELL_TYPE))
-#define E_IS_CELL_CLASS(k) (G_TYPE_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;
-
-GType 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);
-
-G_END_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 9c4d802c1e..0000000000
--- a/widgets/table/e-table-click-to-add.c
+++ /dev/null
@@ -1,562 +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 <libgnomecanvas/gnome-canvas.h>
-#include <libgnomecanvas/gnome-canvas-util.h>
-#include <libgnomecanvas/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"
-#include "gal/util/e-i18n.h"
-#include "gal/util/e-marshal.h"
-
-enum {
- CURSOR_CHANGE,
- LAST_SIGNAL
-};
-
-static guint 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 {
- PROP_0,
- PROP_HEADER,
- PROP_MODEL,
- PROP_MESSAGE,
- PROP_WIDTH,
- PROP_HEIGHT
-};
-
-static void
-etcta_cursor_change (GtkObject *object, gint row, gint col, ETableClickToAdd *etcta)
-{
- g_signal_emit (etcta,
- etcta_signals [CURSOR_CHANGE], 0,
- row, col);
-}
-
-static void
-etcta_add_table_header (ETableClickToAdd *etcta, ETableHeader *header)
-{
- etcta->eth = header;
- if (etcta->eth)
- g_object_ref (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)
-{
- if (!etcta->eth)
- return;
-
- g_object_unref (etcta->eth);
- etcta->eth = NULL;
-}
-
-static void
-etcta_add_one (ETableClickToAdd *etcta, ETableModel *one)
-{
- etcta->one = one;
- if (etcta->one)
- g_object_ref (etcta->one);
- if (etcta->row)
- gnome_canvas_item_set(GNOME_CANVAS_ITEM(etcta->row),
- "ETableModel", one,
- NULL);
- g_object_set(etcta->selection,
- "model", one,
- NULL);
-}
-
-static void
-etcta_drop_one (ETableClickToAdd *etcta)
-{
- if (!etcta->one)
- return;
- g_object_unref (etcta->one);
- etcta->one = NULL;
- g_object_set(etcta->selection,
- "model", NULL,
- NULL);
-}
-
-static void
-etcta_add_model (ETableClickToAdd *etcta, ETableModel *model)
-{
- etcta->model = model;
- if (etcta->model)
- g_object_ref (etcta->model);
-}
-
-static void
-etcta_drop_model (ETableClickToAdd *etcta)
-{
- etcta_drop_one (etcta);
- if (!etcta->model)
- return;
- g_object_unref (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_dispose (GObject *object)
-{
- ETableClickToAdd *etcta = E_TABLE_CLICK_TO_ADD (object);
-
- etcta_drop_table_header (etcta);
- etcta_drop_model (etcta);
- etcta_drop_message (etcta);
- if (etcta->selection)
- g_object_unref (etcta->selection);
- etcta->selection = NULL;
-
- if (G_OBJECT_CLASS (etcta_parent_class)->dispose)
- (*G_OBJECT_CLASS (etcta_parent_class)->dispose) (object);
-}
-
-static void
-etcta_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
-{
- GnomeCanvasItem *item;
- ETableClickToAdd *etcta;
-
- item = GNOME_CANVAS_ITEM (object);
- etcta = E_TABLE_CLICK_TO_ADD (object);
-
- switch (prop_id){
- case PROP_HEADER:
- etcta_drop_table_header (etcta);
- etcta_add_table_header (etcta, E_TABLE_HEADER(g_value_get_object (value)));
- break;
- case PROP_MODEL:
- etcta_drop_model (etcta);
- etcta_add_model (etcta, E_TABLE_MODEL(g_value_get_object (value)));
- break;
- case PROP_MESSAGE:
- etcta_drop_message (etcta);
- etcta_add_message (etcta, (char*)g_value_get_string (value));
- break;
- case PROP_WIDTH:
- etcta->width = g_value_get_double (value);
- 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;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- return;
-
- }
- gnome_canvas_item_request_update(item);
-}
-
-static void
-etcta_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
-{
- ETableClickToAdd *etcta;
-
- etcta = E_TABLE_CLICK_TO_ADD (object);
-
- switch (prop_id){
- case PROP_HEADER:
- g_value_set_object (value, etcta->eth);
- break;
- case PROP_MODEL:
- g_value_set_object (value, etcta->model);
- break;
- case PROP_MESSAGE:
- g_value_set_string (value, g_strdup(etcta->message));
- break;
- case PROP_WIDTH:
- g_value_set_double (value, etcta->width);
- break;
- case PROP_HEIGHT:
- g_value_set_double (value, etcta->height);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- 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);
-
- e_canvas_item_request_reflow (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_item_leave_edit (E_TABLE_ITEM (etcta->row));
- e_table_one_commit(E_TABLE_ONE(etcta->one));
- etcta_drop_one (etcta);
- gtk_object_destroy(etcta->row);
- etcta->row = NULL;
-
- one = e_table_one_new(etcta->model);
- etcta_add_one (etcta, one);
- g_object_unref (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", TRUE,
- "vertical_draw_grid", TRUE,
- "selection_model", etcta->selection,
- "cursor_mode", E_CURSOR_SPREADSHEET,
- NULL);
-
- g_signal_connect(etcta->row, "key_press",
- G_CALLBACK(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(etcta->text);
- etcta->text = NULL;
- }
- if (etcta->rect) {
- gtk_object_destroy(etcta->rect);
- etcta->rect = NULL;
- }
- if (!etcta->row) {
- ETableModel *one;
-
- one = e_table_one_new(etcta->model);
- etcta_add_one (etcta, one);
- g_object_unref (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", TRUE,
- "vertical_draw_grid", TRUE,
- "selection_model", etcta->selection,
- "cursor_mode", E_CURSOR_SPREADSHEET,
- NULL);
-
- g_signal_connect(etcta->row, "key_press",
- G_CALLBACK (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;
- }
- 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) {
- g_object_get(etcta->text,
- "height", &etcta->height,
- NULL);
- etcta->height += 6;
- }
- if (etcta->row) {
- g_object_get(etcta->row,
- "height", &etcta->height,
- NULL);
- }
-
- if (etcta->rect) {
- g_object_set(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);
- GObjectClass *object_class = G_OBJECT_CLASS(klass);
-
- etcta_parent_class = g_type_class_ref (PARENT_OBJECT_TYPE);
-
- klass->cursor_change = NULL;
-
- object_class->dispose = etcta_dispose;
- object_class->set_property = etcta_set_property;
- object_class->get_property = etcta_get_property;
-
- item_class->realize = etcta_realize;
- item_class->unrealize = etcta_unrealize;
- item_class->event = etcta_event;
-
- g_object_class_install_property (object_class, PROP_HEADER,
- g_param_spec_object ("header",
- _("Header"),
- /*_( */"XXX blurb" /*)*/,
- E_TABLE_HEADER_TYPE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_MODEL,
- g_param_spec_object ("model",
- _("Model"),
- /*_( */"XXX blurb" /*)*/,
- E_TABLE_MODEL_TYPE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_MESSAGE,
- g_param_spec_string ("message",
- _("Message"),
- /*_( */"XXX blurb" /*)*/,
- NULL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_WIDTH,
- g_param_spec_double ("width",
- _("Width"),
- /*_( */"XXX blurb" /*)*/,
- 0.0, G_MAXDOUBLE, 0.0,
- G_PARAM_READWRITE | G_PARAM_LAX_VALIDATION));
-
- g_object_class_install_property (object_class, PROP_HEIGHT,
- g_param_spec_double ("height",
- _("Height"),
- /*_( */"XXX blurb" /*)*/,
- 0.0, G_MAXDOUBLE, 0.0,
- G_PARAM_READABLE | G_PARAM_LAX_VALIDATION));
-
- etcta_signals [CURSOR_CHANGE] =
- g_signal_new ("cursor_change",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableClickToAddClass, cursor_change),
- NULL, NULL,
- e_marshal_VOID__INT_INT,
- G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
-}
-
-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();
- g_signal_connect(etcta->selection, "cursor_changed",
- G_CALLBACK (etcta_cursor_change), etcta);
-
- e_canvas_item_set_reflow_callback(item, etcta_reflow);
-}
-
-E_MAKE_TYPE(e_table_click_to_add, "ETableClickToAdd", ETableClickToAdd, etcta_class_init, etcta_init, PARENT_OBJECT_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(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 f5417e23f9..0000000000
--- a/widgets/table/e-table-click-to-add.h
+++ /dev/null
@@ -1,77 +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 <libxml/tree.h>
-#include <libgnomecanvas/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>
-
-G_BEGIN_DECLS
-
-#define E_TABLE_CLICK_TO_ADD_TYPE (e_table_click_to_add_get_type ())
-#define E_TABLE_CLICK_TO_ADD(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_CLICK_TO_ADD_TYPE, ETableClickToAdd))
-#define E_TABLE_CLICK_TO_ADD_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_CLICK_TO_ADD_TYPE, ETableClickToAddClass))
-#define E_IS_TABLE_CLICK_TO_ADD(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_CLICK_TO_ADD_TYPE))
-#define E_IS_TABLE_CLICK_TO_ADD_CLASS(k) (G_TYPE_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;
-
-GType e_table_click_to_add_get_type (void);
-
-void e_table_click_to_add_commit (ETableClickToAdd *etcta);
-
-G_END_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 d31c94ed26..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 <glib.h>
-
-G_BEGIN_DECLS
-
-#define TARGET_ETABLE_COL_TYPE "application/x-etable-column-header"
-
-enum {
- TARGET_ETABLE_COL_HEADER
-};
-
-G_END_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 9acc0ba4fd..0000000000
--- a/widgets/table/e-table-col.c
+++ /dev/null
@@ -1,236 +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 "e-table-col.h"
-#include "gal/util/e-util.h"
-#include "gal/util/e-i18n.h"
-
-static GObjectClass *parent_class;
-
-enum {
- PROP_0,
- PROP_COMPARE_COL,
-};
-
-static void
-etc_dispose (GObject *object)
-{
- ETableCol *etc = E_TABLE_COL (object);
-
- if (etc->ecell)
- g_object_unref (etc->ecell);
- etc->ecell = NULL;
-
- if (etc->pixbuf)
- gdk_pixbuf_unref (etc->pixbuf);
- etc->pixbuf = NULL;
-
- if (etc->text)
- g_free (etc->text);
- etc->text = NULL;
-
- parent_class->dispose (object);
-}
-
-static void
-etc_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
-{
- ETableCol *etc = E_TABLE_COL (object);
-
- switch (prop_id) {
- case PROP_COMPARE_COL:
- etc->compare_col = g_value_get_int (value);
- break;
- default:
- break;
- }
-}
-
-static void
-etc_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
-{
- ETableCol *etc = E_TABLE_COL (object);
-
- switch (prop_id) {
- case PROP_COMPARE_COL:
- g_value_set_int (value, etc->compare_col);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-e_table_col_class_init (GObjectClass *object_class)
-{
- parent_class = g_type_class_peek_parent (object_class);
-
- object_class->dispose = etc_dispose;
- object_class->set_property = etc_set_property;
- object_class->get_property = etc_get_property;
-
- g_object_class_install_property (object_class, PROP_COMPARE_COL,
- g_param_spec_int ("compare_col",
- _( "Width" ),
- "Width",
- 0, G_MAXINT, 0,
- G_PARAM_READWRITE));
-}
-
-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, G_TYPE_OBJECT)
-
-/**
- * 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 = g_object_new (E_TABLE_COL_TYPE, NULL);
-
- etc->is_pixbuf = FALSE;
-
- etc->col_idx = col_idx;
- etc->compare_col = 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;
-
- g_object_ref (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 = g_object_new (E_TABLE_COL_TYPE, NULL);
-
- etc->is_pixbuf = TRUE;
-
- etc->col_idx = col_idx;
- etc->compare_col = 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;
-
- g_object_ref (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 8f2369c76a..0000000000
--- a/widgets/table/e-table-col.h
+++ /dev/null
@@ -1,101 +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>
-
-G_BEGIN_DECLS
-
-#define E_TABLE_COL_TYPE (e_table_col_get_type ())
-#define E_TABLE_COL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_COL_TYPE, ETableCol))
-#define E_TABLE_COL_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_COL_TYPE, ETableColClass))
-#define E_IS_TABLE_COL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_COL_TYPE))
-#define E_IS_TABLE_COL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TABLE_COL_TYPE))
-#define E_TABLE_COL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), E_TABLE_COL_TYPE, ETableColClass))
-
-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 {
- GObject 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 compare_col;
- int priority;
-
- GtkJustification justification;
-
- ECell *ecell;
-} ETableCol;
-
-typedef struct {
- GObjectClass parent_class;
-} ETableColClass;
-
-GType 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);
-
-G_END_DECLS
-
-#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 2e992414d5..0000000000
--- a/widgets/table/e-table-column-specification.c
+++ /dev/null
@@ -1,150 +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 <libxml/parser.h>
-#include <libxml/xmlmemory.h>
-#include "gal/util/e-xml-utils.h"
-#include "gal/util/e-util.h"
-#include "e-table-column-specification.h"
-
-static GObjectClass *etcs_parent_class;
-
-static void
-free_strings (ETableColumnSpecification *etcs)
-{
- g_free(etcs->title);
- etcs->title = NULL;
- g_free(etcs->pixbuf);
- etcs->pixbuf = NULL;
- g_free(etcs->cell);
- etcs->cell = NULL;
- g_free(etcs->compare);
- etcs->compare = NULL;
- g_free(etcs->search);
- etcs->search = NULL;
-}
-
-static void
-etcs_finalize (GObject *object)
-{
- ETableColumnSpecification *etcs = E_TABLE_COLUMN_SPECIFICATION (object);
-
- free_strings(etcs);
-
- etcs_parent_class->finalize (object);
-}
-
-static void
-etcs_class_init (GObjectClass *klass)
-{
- etcs_parent_class = g_type_class_peek_parent (klass);
-
- klass->finalize = etcs_finalize;
-}
-
-static void
-etcs_init (ETableColumnSpecification *specification)
-{
- specification->model_col = 0;
- specification->compare_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, G_TYPE_OBJECT)
-
-ETableColumnSpecification *
-e_table_column_specification_new (void)
-{
- ETableColumnSpecification *etcs = g_object_new (E_TABLE_COLUMN_SPECIFICATION_TYPE, NULL);
-
- 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->compare_col = e_xml_get_integer_prop_by_name_with_default (node, "compare_col", etcs->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);
- if (specification->compare_col != specification->model_col)
- e_xml_set_integer_prop_by_name(node, "compare_col", specification->compare_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 6bf5623398..0000000000
--- a/widgets/table/e-table-column-specification.h
+++ /dev/null
@@ -1,73 +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 <glib-object.h>
-#include <libxml/tree.h>
-
-G_BEGIN_DECLS
-
-#define E_TABLE_COLUMN_SPECIFICATION_TYPE (e_table_column_specification_get_type ())
-#define E_TABLE_COLUMN_SPECIFICATION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_COLUMN_SPECIFICATION_TYPE, ETableColumnSpecification))
-#define E_TABLE_COLUMN_SPECIFICATION_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_COLUMN_SPECIFICATION_TYPE, ETableColumnSpecificationClass))
-#define E_IS_TABLE_COLUMN_SPECIFICATION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_COLUMN_SPECIFICATION_TYPE))
-#define E_IS_TABLE_COLUMN_SPECIFICATION_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TABLE_COLUMN_SPECIFICATION_TYPE))
-#define E_TABLE_COLUMN_SPECIFICATION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), E_TABLE_COLUMN_SPECIFICATION_TYPE, ETableColumnSpecificationClass))
-
-typedef struct {
- GObject base;
- int model_col;
- int compare_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 {
- GObjectClass parent_class;
-} ETableColumnSpecificationClass;
-
-GType 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);
-
-G_END_DECLS
-
-#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 514a25e74e..0000000000
--- a/widgets/table/e-table-column.c
+++ /dev/null
@@ -1,291 +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, };
-
-#define PARENT_CLASS GTK_TYPE_OBJECT
-static GtkObjectClass *e_table_column_parent_class;
-
-static void
-e_table_column_finalize (GObject *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);
-
- G_OBJECT_CLASS (e_table_column_parent_class)->finalize (object);
-}
-
-static void
-e_table_column_class_init (GtkObjectClass *object_class)
-{
- G_OBJECT_CLASS (object_class)->finalize = e_table_column_finalize;
-
- e_table_column_parent_class = g_type_class_ref (PARENT_CLASS);
-
- etc_signals [STRUCTURE_CHANGE] =
- g_signal_new ("structure_change",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableColumn, structure_change),
- NULL, NULL,
- e_marshal_NONE__NONE,
- G_TYPE_NONE, 0);
- etc_signals [DIMENSION_CHANGE] =
- g_signal_new ("dimension_change",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableColumn, dimension_change),
- e_marshal_NONE__INT,
- G_TYPE_NONE, 1, G_TYPE_INT);
-}
-
-E_MAKE_TYPE (e_table_column,
- "ETableColumn",
- ETableColumn,
- e_table_column_class_init,
- NULL,
- PARENT_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++;
-
- g_signal_emit (etc, etc_signals [STRUCTURE_CHANGE], 0);
-}
-
-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);
- g_signal_emit (etc, etc_signals [STRUCTURE_CHANGE], 0);
-}
-
-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);
- g_signal_emit (etc, etc_signals [STRUCTURE_CHANGE], 0);
-}
-
-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;
- g_signal_emit (etc, etc_signals [SIZE_CHANGE], 0, idx);
-}
diff --git a/widgets/table/e-table-config-field.c b/widgets/table/e-table-config-field.c
deleted file mode 100644
index 7c23e10046..0000000000
--- a/widgets/table/e-table-config-field.c
+++ /dev/null
@@ -1,300 +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 <gtk/gtk.h>
-#include <gtk/gtkbox.h>
-#include "gal/util/e-util.h"
-#include "gal/util/e-i18n.h"
-#include "e-table-config-field.h"
-
-#define PARENT_TYPE (gtk_vbox_get_type())
-
-static GtkVBoxClass *etcf_parent_class;
-
-static void
-etcf_dispose (GObject *object)
-{
- ETableConfigField *etcf = E_TABLE_CONFIG_FIELD (object);
-
- if (etct->spec)
- g_object_unref (etcf->spec);
- etct->spec = NULL;
-
- if (etct->sort_info)
- g_object_unref (etcf->sort_info);
- etct->sort_info = NULL;
-
- G_OBJECT_CLASS (etcf_parent_class)->dispose (object);
-}
-
-static void
-etcf_class_init (GObjectClass *klass)
-{
- etcf_parent_class = g_type_class_ref (PARENT_TYPE);
-
- klass->dispose = etcf_dispose;
-}
-
-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 = g_object_new (E_TABLE_CONFIG_FIELD_TYPE, NULL);
-
- 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");
- }
-
- g_signal_connect(GTK_COMBO(etcf->combo)->entry, "changed",
- G_CALLBACK (changed), etcf);
- g_signal_connect(etcf->radio_ascending, "toggled",
- G_CALLBACK (toggled), etcf);
- g_signal_connect(etcf->radio_descending, "toggled",
- G_CALLBACK (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;
- g_object_ref (spec);
-
- etcf->sort_info = sort_info;
- g_object_ref (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(g_object_new (E_TABLE_CONFIG_FIELD_TYPE, NULL));
- 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 bb8f540c4a..0000000000
--- a/widgets/table/e-table-config-field.h
+++ /dev/null
@@ -1,69 +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>
-
-G_BEGIN_DECLS
-
-#define E_TABLE_CONFIG_FIELD_TYPE (e_table_config_field_get_type ())
-#define E_TABLE_CONFIG_FIELD(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_CONFIG_FIELD_TYPE, ETableConfigField))
-#define E_TABLE_CONFIG_FIELD_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_CONFIG_FIELD_TYPE, ETableConfigFieldClass))
-#define E_IS_TABLE_CONFIG_FIELD(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_CONFIG_FIELD_TYPE))
-#define E_IS_TABLE_CONFIG_FIELD_CLASS(k) (G_TYPE_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;
-
-GType 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);
-
-G_END_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 a2ad8736b2..0000000000
--- a/widgets/table/e-table-config-no-group.glade
+++ /dev/null
@@ -1,2039 +0,0 @@
-<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
-<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
-
-<glade-interface>
-
-<widget class="GtkDialog" id="dialog-show-fields">
- <property name="title" translatable="yes">Show Fields</property>
- <property name="type">GTK_WINDOW_TOPLEVEL</property>
- <property name="window_position">GTK_WIN_POS_NONE</property>
- <property name="modal">False</property>
- <property name="resizable">True</property>
- <property name="destroy_with_parent">False</property>
- <property name="has_separator">True</property>
-
- <child internal-child="vbox">
- <widget class="GtkVBox" id="dialog-vbox3">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">8</property>
-
- <child internal-child="action_area">
- <widget class="GtkHButtonBox" id="dialog-action_area3">
- <property name="visible">True</property>
- <property name="layout_style">GTK_BUTTONBOX_END</property>
-
- <child>
- <widget class="GtkButton" id="button22">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-cancel</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="response_id">-6</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkButton" id="button20">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-ok</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="response_id">-5</property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">GTK_PACK_END</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vbox2">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkTable" id="table2">
- <property name="visible">True</property>
- <property name="n_rows">1</property>
- <property name="n_columns">5</property>
- <property name="homogeneous">True</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label-available">
- <property name="visible">True</property>
- <property name="label" translatable="yes">A_vailable Fields:</property>
- <property name="use_underline">True</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">2</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label-displayed">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Sh_ow these fields in order:</property>
- <property name="use_underline">True</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="left_attach">3</property>
- <property name="right_attach">5</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkTable" id="table3">
- <property name="visible">True</property>
- <property name="n_rows">1</property>
- <property name="n_columns">5</property>
- <property name="homogeneous">True</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">6</property>
-
- <child>
- <widget class="GtkVBox" id="vbox4">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="Custom" id="custom-available">
- <property name="visible">True</property>
- <property name="creation_function">e_table_proxy_etable_available_new</property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Thu, 21 Feb 2002 05:42:43 GMT</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">2</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vbox5">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="Custom" id="custom-shown">
- <property name="visible">True</property>
- <property name="creation_function">e_table_proxy_etable_shown_new</property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Thu, 21 Feb 2002 15:52:40 GMT</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox4">
- <property name="visible">True</property>
- <property name="homogeneous">True</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkButton" id="button-up">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Move _Up</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkButton" id="button-down">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Move _Down</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="left_attach">3</property>
- <property name="right_attach">5</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vbox6">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkButton" id="button-add">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">_Add -&gt;</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkButton" id="button-remove">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">&lt;- _Remove</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <placeholder/>
- </child>
- </widget>
- <packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- </child>
-</widget>
-
-<widget class="GtkDialog" id="dialog-group-by">
- <property name="title" translatable="yes">Group</property>
- <property name="type">GTK_WINDOW_TOPLEVEL</property>
- <property name="window_position">GTK_WIN_POS_NONE</property>
- <property name="modal">False</property>
- <property name="resizable">True</property>
- <property name="destroy_with_parent">False</property>
- <property name="has_separator">True</property>
-
- <child internal-child="vbox">
- <widget class="GtkVBox" id="dialog-vbox4">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">8</property>
-
- <child internal-child="action_area">
- <widget class="GtkHButtonBox" id="dialog-action_area4">
- <property name="visible">True</property>
- <property name="layout_style">GTK_BUTTONBOX_END</property>
-
- <child>
- <widget class="GtkButton" id="button39">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Clear All</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="response_id">0</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkButton" id="button42">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-cancel</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="response_id">-6</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkButton" id="button41">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-ok</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="response_id">-5</property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">GTK_PACK_END</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vbox24">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="GtkHBox" id="hbox13">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkFrame" id="frame-group-1">
- <property name="visible">True</property>
- <property name="label_xalign">0</property>
- <property name="label_yalign">0.5</property>
- <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
-
- <child>
- <widget class="GtkHBox" id="hbox5">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkVBox" id="vbox7">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="Custom" id="group-combo-1">
- <property name="visible">True</property>
- <property name="creation_function">e_table_proxy_gtk_combo_text_new</property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Fri, 19 Jan 2001 04:52:09 GMT</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkCheckButton" id="checkbutton-group-1">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Show field in View</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vbox8">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="GtkRadioButton" id="radiobutton-ascending-group-1">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Ascending</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkRadioButton" id="radiobutton-descending-group-1">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Descending</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- <property name="group">radiobutton-ascending-group-1</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label1">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Group Items By</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="type">label_item</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label8">
- <property name="visible">True</property>
- <property name="label" translatable="yes"></property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label9">
- <property name="visible">True</property>
- <property name="label" translatable="yes"></property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label10">
- <property name="visible">True</property>
- <property name="label" translatable="yes"></property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox14">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label11">
- <property name="visible">True</property>
- <property name="label" translatable="yes"></property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkFrame" id="frame-group-2">
- <property name="visible">True</property>
- <property name="label_xalign">0</property>
- <property name="label_yalign">0.5</property>
- <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
-
- <child>
- <widget class="GtkHBox" id="hbox6">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkVBox" id="vbox9">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="Custom" id="group-combo-2">
- <property name="visible">True</property>
- <property name="creation_function">e_table_proxy_gtk_combo_text_new</property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Fri, 19 Jan 2001 04:52:14 GMT</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkCheckButton" id="checkbutton-group-2">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Show field in View</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vbox10">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="GtkRadioButton" id="radiobutton-ascending-group-2">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Ascending</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkRadioButton" id="radiobutton-descending-group-2">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Descending</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- <property name="group">radiobutton-ascending-group-2</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label12">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Then By</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="type">label_item</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label19">
- <property name="visible">True</property>
- <property name="label" translatable="yes"></property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label18">
- <property name="visible">True</property>
- <property name="label" translatable="yes"></property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox15">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label13">
- <property name="visible">True</property>
- <property name="label" translatable="yes"></property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label12">
- <property name="visible">True</property>
- <property name="label" translatable="yes"></property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkFrame" id="frame-group-3">
- <property name="visible">True</property>
- <property name="label_xalign">0</property>
- <property name="label_yalign">0.5</property>
- <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
-
- <child>
- <widget class="GtkHBox" id="hbox7">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkVBox" id="vbox11">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="Custom" id="group-combo-3">
- <property name="visible">True</property>
- <property name="creation_function">e_table_proxy_gtk_combo_text_new</property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Fri, 19 Jan 2001 04:52:18 GMT</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkCheckButton" id="checkbutton-group-3">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Show field in View</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vbox12">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="GtkRadioButton" id="radiobutton-ascending-group-3">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Ascending</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkRadioButton" id="radiobutton-descending-group-3">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Descending</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- <property name="group">radiobutton-ascending-group-3</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label20">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Then By</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="type">label_item</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label17">
- <property name="visible">True</property>
- <property name="label" translatable="yes"></property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox16">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label14">
- <property name="visible">True</property>
- <property name="label" translatable="yes"></property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label16">
- <property name="visible">True</property>
- <property name="label" translatable="yes"></property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label15">
- <property name="visible">True</property>
- <property name="label" translatable="yes"></property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkFrame" id="frame-group-4">
- <property name="visible">True</property>
- <property name="label_xalign">0</property>
- <property name="label_yalign">0.5</property>
- <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
-
- <child>
- <widget class="GtkHBox" id="hbox8">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkVBox" id="vbox13">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="Custom" id="group-combo-4">
- <property name="visible">True</property>
- <property name="creation_function">e_table_proxy_gtk_combo_text_new</property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Fri, 19 Jan 2001 04:52:21 GMT</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkCheckButton" id="checkbutton-group-4">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Show field in View</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vbox14">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="GtkRadioButton" id="radiobutton-ascending-group-4">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Ascending</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkRadioButton" id="radiobutton-descending-group-4">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Descending</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- <property name="group">radiobutton-ascending-group-4</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label21">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Then By</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="type">label_item</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- </child>
-</widget>
-
-<widget class="GtkDialog" id="dialog-sort">
- <property name="title" translatable="yes">Sort</property>
- <property name="type">GTK_WINDOW_TOPLEVEL</property>
- <property name="window_position">GTK_WIN_POS_NONE</property>
- <property name="modal">False</property>
- <property name="resizable">True</property>
- <property name="destroy_with_parent">False</property>
- <property name="has_separator">True</property>
-
- <child internal-child="vbox">
- <widget class="GtkVBox" id="vbox15">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">8</property>
-
- <child internal-child="action_area">
- <widget class="GtkHButtonBox" id="hbuttonbox1">
- <property name="visible">True</property>
- <property name="layout_style">GTK_BUTTONBOX_END</property>
-
- <child>
- <widget class="GtkButton" id="button43">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Clear All</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="response_id">0</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkButton" id="button45">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-cancel</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="response_id">-6</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkButton" id="button44">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="has_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-ok</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="response_id">-5</property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">GTK_PACK_END</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkTable" id="table5">
- <property name="visible">True</property>
- <property name="n_rows">4</property>
- <property name="n_columns">1</property>
- <property name="homogeneous">False</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">6</property>
-
- <child>
- <widget class="GtkFrame" id="frame-sort-4">
- <property name="visible">True</property>
- <property name="label_xalign">0</property>
- <property name="label_yalign">0.5</property>
- <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
-
- <child>
- <widget class="GtkHBox" id="hbox9">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkAlignment" id="alignment1">
- <property name="visible">True</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xscale">1</property>
- <property name="yscale">0</property>
-
- <child>
- <widget class="Custom" id="sort-combo-4">
- <property name="visible">True</property>
- <property name="creation_function">e_table_proxy_gtk_combo_text_new</property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Tue, 16 Jan 2001 08:33:52 GMT</property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vbox17">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="GtkRadioButton" id="radiobutton-ascending-sort-4">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Ascending</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkRadioButton" id="radiobutton-descending-sort-4">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Descending</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- <property name="group">radiobutton-ascending-sort-4</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label22">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Then By</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="type">label_item</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkFrame" id="frame-sort-3">
- <property name="visible">True</property>
- <property name="label_xalign">0</property>
- <property name="label_yalign">0.5</property>
- <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
-
- <child>
- <widget class="GtkHBox" id="hbox10">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkAlignment" id="alignment2">
- <property name="visible">True</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xscale">1</property>
- <property name="yscale">0</property>
-
- <child>
- <widget class="Custom" id="sort-combo-3">
- <property name="visible">True</property>
- <property name="creation_function">e_table_proxy_gtk_combo_text_new</property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Tue, 16 Jan 2001 05:22:22 GMT</property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vbox19">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="GtkRadioButton" id="radiobutton-ascending-sort-3">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Ascending</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkRadioButton" id="radiobutton-descending-sort-3">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Descending</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- <property name="group">radiobutton-ascending-sort-3</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label23">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Then By</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="type">label_item</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkFrame" id="frame-sort-2">
- <property name="visible">True</property>
- <property name="label_xalign">0</property>
- <property name="label_yalign">0.5</property>
- <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
-
- <child>
- <widget class="GtkHBox" id="hbox11">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkAlignment" id="alignment3">
- <property name="visible">True</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xscale">1</property>
- <property name="yscale">0</property>
-
- <child>
- <widget class="Custom" id="sort-combo-2">
- <property name="visible">True</property>
- <property name="creation_function">e_table_proxy_gtk_combo_text_new</property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Tue, 16 Jan 2001 05:22:15 GMT</property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vbox21">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="GtkRadioButton" id="radiobutton-ascending-sort-2">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Ascending</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkRadioButton" id="radiobutton-descending-sort-2">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Descending</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- <property name="group">radiobutton-ascending-sort-2</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label24">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Then By</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="type">label_item</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkFrame" id="frame-sort-1">
- <property name="visible">True</property>
- <property name="label_xalign">0</property>
- <property name="label_yalign">0.5</property>
- <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
-
- <child>
- <widget class="GtkHBox" id="hbox12">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkAlignment" id="alignment4">
- <property name="visible">True</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xscale">1</property>
- <property name="yscale">0</property>
-
- <child>
- <widget class="Custom" id="sort-combo-1">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="has_focus">True</property>
- <property name="creation_function">e_table_proxy_gtk_combo_text_new</property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Tue, 16 Jan 2001 05:22:00 GMT</property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vbox23">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="GtkRadioButton" id="radiobutton-ascending-sort-1">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Ascending</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkRadioButton" id="radiobutton-descending-sort-1">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Descending</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- <property name="group">radiobutton-ascending-sort-1</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label25">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Sort Items By</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="type">label_item</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- </child>
-</widget>
-
-<widget class="GtkDialog" id="e-table-config">
- <property name="visible">True</property>
- <property name="title" translatable="yes">dialog1</property>
- <property name="type">GTK_WINDOW_TOPLEVEL</property>
- <property name="window_position">GTK_WIN_POS_NONE</property>
- <property name="modal">True</property>
- <property name="resizable">True</property>
- <property name="destroy_with_parent">False</property>
- <property name="has_separator">True</property>
-
- <child internal-child="vbox">
- <widget class="GtkVBox" id="dialog-vbox5">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child internal-child="action_area">
- <widget class="GtkHButtonBox" id="dialog-action_area5">
- <property name="visible">True</property>
- <property name="layout_style">GTK_BUTTONBOX_END</property>
-
- <child>
- <widget class="GtkButton" id="cancelbutton1">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-cancel</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="response_id">-6</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkButton" id="applybutton1">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-apply</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="response_id">-10</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkButton" id="okbutton1">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-ok</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="response_id">-5</property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">GTK_PACK_END</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkFrame" id="top-frame">
- <property name="border_width">2</property>
- <property name="visible">True</property>
- <property name="label_xalign">0</property>
- <property name="label_yalign">0.5</property>
- <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
-
- <child>
- <widget class="GtkTable" id="table1">
- <property name="border_width">2</property>
- <property name="visible">True</property>
- <property name="n_rows">2</property>
- <property name="n_columns">3</property>
- <property name="homogeneous">False</property>
- <property name="row_spacing">2</property>
- <property name="column_spacing">4</property>
-
- <child>
- <widget class="GtkButton" id="button-sort">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">_Sort...</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <signal name="clicked" handler="on_sort_clicked"/>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label-sort">
- <property name="visible">True</property>
- <property name="label" translatable="yes"></property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">True</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label4">
- <property name="visible">True</property>
- <property name="label" translatable="yes"></property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">fill</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label21">
- <property name="visible">True</property>
- <property name="label" translatable="yes"></property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="x_options">fill</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label-fields">
- <property name="visible">True</property>
- <property name="label" translatable="yes"></property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">True</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkButton" id="button-fields">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">_Fields Shown...</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <signal name="clicked" handler="on_sort_clicked"/>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label26">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Description</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="type">label_item</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- </child>
-</widget>
-
-</glade-interface>
diff --git a/widgets/table/e-table-config.c b/widgets/table/e-table-config.c
deleted file mode 100644
index 825e28a5a4..0000000000
--- a/widgets/table/e-table-config.c
+++ /dev/null
@@ -1,1200 +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/gtkdialog.h>
-#include <gtk/gtkentry.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtktogglebutton.h>
-#include <libgnomeui/gnome-propertybox.h>
-#include <glade/glade.h>
-#include "gal/util/e-util.h"
-#include "gal/util/e-i18n.h"
-#include "gal/widgets/e-unicode.h"
-
-#include <e-table-scrolled.h>
-#include <e-table-without.h>
-#include <e-table-memory-store.h>
-
-
-static GObjectClass *config_parent_class;
-
-enum {
- CHANGED,
- LAST_SIGNAL
-};
-
-enum {
- PROP_0,
- PROP_STATE,
-};
-
-static guint e_table_config_signals [LAST_SIGNAL] = { 0, };
-
-static void
-config_finalize (GObject *object)
-{
- ETableConfig *config = E_TABLE_CONFIG (object);
-
- if (config->state)
- g_object_unref (config->state);
- config->state = NULL;
-
- if (config->source_state)
- g_object_unref (config->source_state);
- config->source_state = NULL;
-
- if (config->source_spec)
- g_object_unref (config->source_spec);
- config->source_spec = NULL;
-
- g_free (config->header);
- config->header = NULL;
-
- g_slist_free (config->column_names);
- config->column_names = NULL;
-
- g_free (config->domain);
- config->domain = NULL;
-
- config_parent_class->finalize (object);
-}
-
-static void
-e_table_config_changed (ETableConfig *config, ETableState *state)
-{
- g_return_if_fail (E_IS_TABLE_CONFIG (config));
-
- g_signal_emit(G_OBJECT(config), e_table_config_signals [CHANGED], 0, state);
-}
-
-static void
-config_dialog_changed (ETableConfig *config)
-{
- /* enable the apply/ok buttons */
- gtk_dialog_set_response_sensitive (GTK_DIALOG (config->dialog_toplevel),
- GTK_RESPONSE_APPLY, TRUE);
- gtk_dialog_set_response_sensitive (GTK_DIALOG (config->dialog_toplevel),
- GTK_RESPONSE_OK, TRUE);
-}
-
-static void
-config_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- ETableConfig *config = E_TABLE_CONFIG (object);
-
- switch (prop_id) {
- case PROP_STATE:
- g_value_set_object (value, config->state);
- break;
- default:
- break;
- }
-}
-
-static void
-config_class_init (GObjectClass *object_class)
-{
- ETableConfigClass *klass = E_TABLE_CONFIG_CLASS(object_class);
-
- config_parent_class = g_type_class_peek_parent (klass);
-
- klass->changed = NULL;
-
- object_class->finalize = config_finalize;
- object_class->get_property = config_get_property;
-
- e_table_config_signals [CHANGED] =
- g_signal_new ("changed",
- E_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableConfigClass, changed),
- (GSignalAccumulator) NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- g_object_class_install_property (object_class, PROP_STATE,
- g_param_spec_object ("state",
- _("State"),
- /*_( */"XXX blurb" /*)*/,
- E_TABLE_STATE_TYPE,
- G_PARAM_READABLE));
-
- glade_init ();
-}
-
-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
- */
- g_signal_handler_block (
- widgets [i].radio_ascending,
- widgets [i].toggled_id);
- g_signal_handler_block (
- 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 = dgettext (config->domain, 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);
-
- g_signal_handler_unblock (
- widgets [i].radio_ascending,
- widgets [i].toggled_id);
- g_signal_handler_unblock (
- 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, dgettext (config->domain, (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, dgettext (config->domain, (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++) {
- gint j, idx;
- for (j = 0, idx = 0; j < config->temp_state->columns[i]; j++)
- if (!config->source_spec->columns[j]->disabled)
- idx++;
-
- e_table_subset_variable_add (config->shown_model, idx);
- e_table_without_hide (config->available_model, GINT_TO_POINTER(idx));
- }
- }
-}
-
-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, dgettext (config->domain, (*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)
-{
- GtkDialog *dialog;
- int response, 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 = GTK_DIALOG (config->dialog_sort);
- else
- dialog = GTK_DIALOG (config->dialog_group_by);
-
- gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (config->dialog_toplevel));
-
- do {
- response = gtk_dialog_run (dialog);
- switch (response){
- case 0: /* clear fields */
- 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;
-
- case GTK_RESPONSE_OK:
- g_object_unref (config->state);
- config->state = config->temp_state;
- config->temp_state = 0;
- running = 0;
- config_dialog_changed (config);
- break;
-
- case GTK_RESPONSE_CANCEL:
- g_object_unref (config->temp_state);
- config->temp_state = 0;
- running = 0;
- break;
- }
-
- } while (running);
- gtk_widget_hide (GTK_WIDGET (dialog));
-
- if (is_sort)
- config_sort_info_update (config);
- else
- config_group_info_update (config);
-}
-
-static void
-do_fields_config_dialog (ETableConfig *config)
-{
- int response, running = 1;
-
- config->temp_state = e_table_state_duplicate (config->state);
-
- setup_fields (config);
-
- gtk_window_set_transient_for (GTK_WINDOW (config->dialog_show_fields),
- GTK_WINDOW (config->dialog_toplevel));
-
- do {
- response = gtk_dialog_run (GTK_DIALOG(config->dialog_show_fields));
- switch (response){
- case GTK_RESPONSE_OK:
- g_object_unref (config->state);
- config->state = config->temp_state;
- config->temp_state = 0;
- running = 0;
- config_dialog_changed (config);
- break;
-
- /* CANCEL */
- case GTK_RESPONSE_CANCEL:
- g_object_unref (config->temp_state);
- config->temp_state = 0;
- running = 0;
- break;
- }
-
- } while (running);
- gtk_widget_hide (GTK_WIDGET (config->dialog_show_fields));
-
- config_fields_info_update (config);
-}
-
-
-ETableMemoryStoreColumnInfo store_columns[] = {
- E_TABLE_MEMORY_STORE_STRING,
- E_TABLE_MEMORY_STORE_INTEGER,
- 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++) {
-
- char *text;
-
- if (config->source_spec->columns[i]->disabled)
- continue;
-
- text = g_strdup (dgettext (config->domain, config->source_spec->columns[i]->title));
- e_table_memory_store_insert_adopt (E_TABLE_MEMORY_STORE (global_store), -1, NULL, text, i);
- }
-}
-
-char *spec = "<ETableSpecification gettext-domain=\"" E_I18N_DOMAIN "\" 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 (gpointer data, GObject *where_object_was)
-{
- ETableConfig *config = data;
- g_object_unref (config);
-}
-
-static void
-dialog_response (GtkWidget *dialog, int response_id, ETableConfig *config)
-{
- if (response_id == GTK_RESPONSE_APPLY
- || response_id == GTK_RESPONSE_OK) {
- e_table_config_changed (config, config->state);
- }
-
- if (response_id == GTK_RESPONSE_CANCEL
- || response_id == GTK_RESPONSE_OK) {
- gtk_widget_destroy (dialog);
- }
-}
-
-/*
- * 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, GCallback cback)
-{
- GtkWidget *button = glade_xml_get_widget (gui, widget_name);
-
- if (button) {
- g_signal_connect (G_OBJECT (button), "clicked",
- cback, config);
- }
-}
-
-static gint
-get_source_model_col_index (ETableConfig *config, gint idx)
-{
- gint visible_index, result;
- ETableModel *src_model = E_TABLE_SUBSET (config->available_model)->source;
-
- visible_index = e_table_subset_view_to_model_row (E_TABLE_SUBSET (config->available_model), idx);
-
- return GPOINTER_TO_INT (e_table_model_value_at (src_model, 1, visible_index));
-}
-
-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;
-
- const 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_widget_show (GTK_WIDGET (config->sort [i].combo));
- 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,
- dgettext (config->domain, label), label);
- }
- }
-
- /*
- * After we have runtime modified things, signal connect
- */
- for (i = 0; i < 4; i++){
- config->sort [i].changed_id = g_signal_connect (
- config->sort [i].combo->entry,
- "changed", G_CALLBACK (sort_entry_changed),
- &config->sort [i]);
-
- config->sort [i].toggled_id = g_signal_connect (
- config->sort [i].radio_ascending,
- "toggled", G_CALLBACK (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;
- const 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_widget_show (GTK_WIDGET (config->group [i].combo));
-
- 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,
- dgettext (config->domain, label), label);
- }
- }
-
- /*
- * After we have runtime modified things, signal connect
- */
- for (i = 0; i < 4; i++){
- config->group [i].changed_id = g_signal_connect (
- config->group [i].combo->entry,
- "changed", G_CALLBACK (group_entry_changed),
- &config->group [i]);
-
- config->group [i].toggled_id = g_signal_connect (
- config->group [i].radio_ascending,
- "toggled", G_CALLBACK (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] = get_source_model_col_index (config, 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)
-{
- GtkWidget *scrolled;
-
- scrolled = glade_xml_get_widget (gui, "custom-available");
- config->available = e_table_scrolled_get_table (E_TABLE_SCROLLED (scrolled));
- g_object_get (config->available,
- "model", &config->available_model,
- NULL);
- gtk_widget_show_all (scrolled);
-
- scrolled = glade_xml_get_widget (gui, "custom-shown");
- config->shown = e_table_scrolled_get_table (E_TABLE_SCROLLED (scrolled));
- g_object_get (config->shown,
- "model", &config->shown_model,
- NULL);
- gtk_widget_show_all (scrolled);
-
- connect_button (config, gui, "button-add", G_CALLBACK (config_button_add));
- connect_button (config, gui, "button-remove", G_CALLBACK (config_button_remove));
- connect_button (config, gui, "button-up", G_CALLBACK (config_button_up));
- connect_button (config, gui, "button-down", G_CALLBACK (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 (ETABLE_GLADEDIR "/e-table-config.glade", NULL, E_I18N_DOMAIN);
- } else {
- gui = glade_xml_new (ETABLE_GLADEDIR "/e-table-config-no-group.glade", NULL, E_I18N_DOMAIN);
- }
-
- g_object_unref (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);
-
- 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", G_CALLBACK (config_button_sort));
- connect_button (config, gui, "button-group", G_CALLBACK (config_button_group));
- connect_button (config, gui, "button-fields", G_CALLBACK (config_button_fields));
-
- configure_sort_dialog (config, gui);
- configure_group_dialog (config, gui);
- configure_fields_dialog (config, gui);
-
- g_object_weak_ref (G_OBJECT (config->dialog_toplevel),
- dialog_destroyed, config);
-
- g_signal_connect (config->dialog_toplevel, "response",
- G_CALLBACK (dialog_response), config);
-
- g_object_unref (gui);
-}
-
-static void
-config_init (ETableConfig *config)
-{
- config->domain = NULL;
-}
-
-ETableConfig *
-e_table_config_construct (ETableConfig *config,
- const char *header,
- ETableSpecification *spec,
- ETableState *state,
- GtkWindow *parent_window)
-{
- 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);
-
- g_object_ref (config->source_spec);
- g_object_ref (config->source_state);
-
- config->state = e_table_state_duplicate (state);
-
- config->domain = g_strdup (spec->domain);
-
- 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);
-
- if (parent_window)
- gtk_window_set_transient_for (GTK_WINDOW (config->dialog_toplevel),
- parent_window);
-
- 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,
- GtkWindow *parent_window)
-{
- ETableConfig *config = g_object_new (E_TABLE_CONFIG_TYPE, NULL);
-
- if (e_table_config_construct (config, header, spec, state, parent_window) == NULL){
- g_object_unref (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, G_TYPE_OBJECT)
diff --git a/widgets/table/e-table-config.glade b/widgets/table/e-table-config.glade
deleted file mode 100644
index c54c64bb27..0000000000
--- a/widgets/table/e-table-config.glade
+++ /dev/null
@@ -1,2107 +0,0 @@
-<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
-<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
-
-<glade-interface>
-
-<widget class="GtkDialog" id="dialog-show-fields">
- <property name="title" translatable="yes">Show Fields</property>
- <property name="type">GTK_WINDOW_TOPLEVEL</property>
- <property name="window_position">GTK_WIN_POS_NONE</property>
- <property name="modal">True</property>
- <property name="resizable">True</property>
- <property name="destroy_with_parent">False</property>
- <property name="has_separator">True</property>
-
- <child internal-child="vbox">
- <widget class="GtkVBox" id="dialog-vbox3">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">8</property>
-
- <child internal-child="action_area">
- <widget class="GtkHButtonBox" id="dialog-action_area3">
- <property name="visible">True</property>
- <property name="layout_style">GTK_BUTTONBOX_END</property>
-
- <child>
- <widget class="GtkButton" id="button22">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-cancel</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="response_id">-6</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkButton" id="button20">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-ok</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="response_id">-5</property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">GTK_PACK_END</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vbox2">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkTable" id="table2">
- <property name="visible">True</property>
- <property name="n_rows">1</property>
- <property name="n_columns">5</property>
- <property name="homogeneous">True</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label-available">
- <property name="visible">True</property>
- <property name="label" translatable="yes">A_vailable Fields:</property>
- <property name="use_underline">True</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">2</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label-displayed">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Sh_ow these fields in order:</property>
- <property name="use_underline">True</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="left_attach">3</property>
- <property name="right_attach">5</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkTable" id="table3">
- <property name="visible">True</property>
- <property name="n_rows">1</property>
- <property name="n_columns">5</property>
- <property name="homogeneous">True</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">6</property>
-
- <child>
- <widget class="GtkVBox" id="vbox4">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="Custom" id="custom-available">
- <property name="visible">True</property>
- <property name="creation_function">e_table_proxy_etable_available_new</property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Thu, 21 Feb 2002 16:09:53 GMT</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">2</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vbox5">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="Custom" id="custom-shown">
- <property name="visible">True</property>
- <property name="creation_function">e_table_proxy_etable_shown_new</property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Thu, 21 Feb 2002 16:09:58 GMT</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox4">
- <property name="visible">True</property>
- <property name="homogeneous">True</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkButton" id="button-up">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Move _Up</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkButton" id="button-down">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Move _Down</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="left_attach">3</property>
- <property name="right_attach">5</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vbox6">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkButton" id="button-add">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">_Add -&gt;</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkButton" id="button-remove">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">&lt;- _Remove</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <placeholder/>
- </child>
- </widget>
- <packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- </child>
-</widget>
-
-<widget class="GtkDialog" id="dialog-group-by">
- <property name="title" translatable="yes">Group</property>
- <property name="type">GTK_WINDOW_TOPLEVEL</property>
- <property name="window_position">GTK_WIN_POS_NONE</property>
- <property name="modal">True</property>
- <property name="resizable">True</property>
- <property name="destroy_with_parent">False</property>
- <property name="has_separator">True</property>
-
- <child internal-child="vbox">
- <widget class="GtkVBox" id="dialog-vbox4">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">8</property>
-
- <child internal-child="action_area">
- <widget class="GtkHButtonBox" id="dialog-action_area4">
- <property name="visible">True</property>
- <property name="layout_style">GTK_BUTTONBOX_END</property>
-
- <child>
- <widget class="GtkButton" id="button39">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Clear All</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="response_id">0</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkButton" id="button42">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-cancel</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="response_id">-6</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkButton" id="button41">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-ok</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="response_id">-5</property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">GTK_PACK_END</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vbox24">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="GtkHBox" id="hbox13">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkFrame" id="frame-group-1">
- <property name="visible">True</property>
- <property name="label_xalign">0</property>
- <property name="label_yalign">0.5</property>
- <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
-
- <child>
- <widget class="GtkHBox" id="hbox5">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkVBox" id="vbox7">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="Custom" id="group-combo-1">
- <property name="visible">True</property>
- <property name="creation_function">e_table_proxy_gtk_combo_text_new</property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Fri, 19 Jan 2001 04:52:09 GMT</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkCheckButton" id="checkbutton-group-1">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Show field in View</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vbox8">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="GtkRadioButton" id="radiobutton-ascending-group-1">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Ascending</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkRadioButton" id="radiobutton-descending-group-1">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Descending</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- <property name="group">radiobutton-ascending-group-1</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label1">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Group Items By</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="type">label_item</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label8">
- <property name="visible">True</property>
- <property name="label" translatable="yes"></property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label9">
- <property name="visible">True</property>
- <property name="label" translatable="yes"></property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label10">
- <property name="visible">True</property>
- <property name="label" translatable="yes"></property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox14">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label11">
- <property name="visible">True</property>
- <property name="label" translatable="yes"></property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkFrame" id="frame-group-2">
- <property name="visible">True</property>
- <property name="label_xalign">0</property>
- <property name="label_yalign">0.5</property>
- <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
-
- <child>
- <widget class="GtkHBox" id="hbox6">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkVBox" id="vbox9">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="Custom" id="group-combo-2">
- <property name="visible">True</property>
- <property name="creation_function">e_table_proxy_gtk_combo_text_new</property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Fri, 19 Jan 2001 04:52:14 GMT</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkCheckButton" id="checkbutton-group-2">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Show field in View</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vbox10">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="GtkRadioButton" id="radiobutton-ascending-group-2">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Ascending</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkRadioButton" id="radiobutton-descending-group-2">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Descending</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- <property name="group">radiobutton-ascending-group-2</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label12">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Then By</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="type">label_item</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label19">
- <property name="visible">True</property>
- <property name="label" translatable="yes"></property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label18">
- <property name="visible">True</property>
- <property name="label" translatable="yes"></property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox15">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label13">
- <property name="visible">True</property>
- <property name="label" translatable="yes"></property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label12">
- <property name="visible">True</property>
- <property name="label" translatable="yes"></property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkFrame" id="frame-group-3">
- <property name="visible">True</property>
- <property name="label_xalign">0</property>
- <property name="label_yalign">0.5</property>
- <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
-
- <child>
- <widget class="GtkHBox" id="hbox7">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkVBox" id="vbox11">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="Custom" id="group-combo-3">
- <property name="visible">True</property>
- <property name="creation_function">e_table_proxy_gtk_combo_text_new</property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Fri, 19 Jan 2001 04:52:18 GMT</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkCheckButton" id="checkbutton-group-3">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Show field in View</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vbox12">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="GtkRadioButton" id="radiobutton-ascending-group-3">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Ascending</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkRadioButton" id="radiobutton-descending-group-3">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Descending</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- <property name="group">radiobutton-ascending-group-3</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label20">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Then By</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="type">label_item</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label17">
- <property name="visible">True</property>
- <property name="label" translatable="yes"></property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox16">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkLabel" id="label14">
- <property name="visible">True</property>
- <property name="label" translatable="yes"></property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label16">
- <property name="visible">True</property>
- <property name="label" translatable="yes"></property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label15">
- <property name="visible">True</property>
- <property name="label" translatable="yes"></property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkFrame" id="frame-group-4">
- <property name="visible">True</property>
- <property name="label_xalign">0</property>
- <property name="label_yalign">0.5</property>
- <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
-
- <child>
- <widget class="GtkHBox" id="hbox8">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkVBox" id="vbox13">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="Custom" id="group-combo-4">
- <property name="visible">True</property>
- <property name="creation_function">e_table_proxy_gtk_combo_text_new</property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Fri, 19 Jan 2001 04:52:21 GMT</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkCheckButton" id="checkbutton-group-4">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Show field in View</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vbox14">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="GtkRadioButton" id="radiobutton-ascending-group-4">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Ascending</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkRadioButton" id="radiobutton-descending-group-4">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Descending</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- <property name="group">radiobutton-ascending-group-4</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label21">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Then By</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="type">label_item</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- </child>
-</widget>
-
-<widget class="GtkDialog" id="dialog-sort">
- <property name="title" translatable="yes">Sort</property>
- <property name="type">GTK_WINDOW_TOPLEVEL</property>
- <property name="window_position">GTK_WIN_POS_NONE</property>
- <property name="modal">True</property>
- <property name="resizable">True</property>
- <property name="destroy_with_parent">False</property>
- <property name="has_separator">True</property>
-
- <child internal-child="vbox">
- <widget class="GtkVBox" id="vbox15">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">8</property>
-
- <child internal-child="action_area">
- <widget class="GtkHButtonBox" id="hbuttonbox1">
- <property name="visible">True</property>
- <property name="layout_style">GTK_BUTTONBOX_END</property>
-
- <child>
- <widget class="GtkButton" id="button43">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Clear All</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="response_id">0</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkButton" id="button45">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-cancel</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="response_id">-6</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkButton" id="button44">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="has_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-ok</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="response_id">-5</property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">GTK_PACK_END</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkTable" id="table5">
- <property name="visible">True</property>
- <property name="n_rows">4</property>
- <property name="n_columns">1</property>
- <property name="homogeneous">False</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">6</property>
-
- <child>
- <widget class="GtkFrame" id="frame-sort-4">
- <property name="visible">True</property>
- <property name="label_xalign">0</property>
- <property name="label_yalign">0.5</property>
- <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
-
- <child>
- <widget class="GtkHBox" id="hbox9">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkAlignment" id="alignment1">
- <property name="visible">True</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xscale">1</property>
- <property name="yscale">0</property>
-
- <child>
- <widget class="Custom" id="sort-combo-4">
- <property name="visible">True</property>
- <property name="creation_function">e_table_proxy_gtk_combo_text_new</property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Tue, 16 Jan 2001 08:33:52 GMT</property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vbox17">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="GtkRadioButton" id="radiobutton-ascending-sort-4">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Ascending</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkRadioButton" id="radiobutton-descending-sort-4">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Descending</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- <property name="group">radiobutton-ascending-sort-4</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label22">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Then By</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="type">label_item</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkFrame" id="frame-sort-3">
- <property name="visible">True</property>
- <property name="label_xalign">0</property>
- <property name="label_yalign">0.5</property>
- <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
-
- <child>
- <widget class="GtkHBox" id="hbox10">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkAlignment" id="alignment2">
- <property name="visible">True</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xscale">1</property>
- <property name="yscale">0</property>
-
- <child>
- <widget class="Custom" id="sort-combo-3">
- <property name="visible">True</property>
- <property name="creation_function">e_table_proxy_gtk_combo_text_new</property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Tue, 16 Jan 2001 05:22:22 GMT</property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vbox19">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="GtkRadioButton" id="radiobutton-ascending-sort-3">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Ascending</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkRadioButton" id="radiobutton-descending-sort-3">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Descending</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- <property name="group">radiobutton-ascending-sort-3</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label23">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Then By</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="type">label_item</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkFrame" id="frame-sort-2">
- <property name="visible">True</property>
- <property name="label_xalign">0</property>
- <property name="label_yalign">0.5</property>
- <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
-
- <child>
- <widget class="GtkHBox" id="hbox11">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkAlignment" id="alignment3">
- <property name="visible">True</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xscale">1</property>
- <property name="yscale">0</property>
-
- <child>
- <widget class="Custom" id="sort-combo-2">
- <property name="visible">True</property>
- <property name="creation_function">e_table_proxy_gtk_combo_text_new</property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Tue, 16 Jan 2001 05:22:15 GMT</property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vbox21">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="GtkRadioButton" id="radiobutton-ascending-sort-2">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Ascending</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkRadioButton" id="radiobutton-descending-sort-2">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Descending</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- <property name="group">radiobutton-ascending-sort-2</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label24">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Then By</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="type">label_item</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkFrame" id="frame-sort-1">
- <property name="visible">True</property>
- <property name="label_xalign">0</property>
- <property name="label_yalign">0.5</property>
- <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
-
- <child>
- <widget class="GtkHBox" id="hbox12">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">6</property>
-
- <child>
- <widget class="GtkAlignment" id="alignment4">
- <property name="visible">True</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xscale">1</property>
- <property name="yscale">0</property>
-
- <child>
- <widget class="Custom" id="sort-combo-1">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="has_focus">True</property>
- <property name="creation_function">e_table_proxy_gtk_combo_text_new</property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Tue, 16 Jan 2001 05:22:00 GMT</property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vbox23">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child>
- <widget class="GtkRadioButton" id="radiobutton-ascending-sort-1">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Ascending</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkRadioButton" id="radiobutton-descending-sort-1">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Descending</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="active">False</property>
- <property name="inconsistent">False</property>
- <property name="draw_indicator">True</property>
- <property name="group">radiobutton-ascending-sort-1</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label25">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Sort Items By</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="type">label_item</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- </child>
-</widget>
-
-<widget class="GtkDialog" id="e-table-config">
- <property name="visible">True</property>
- <property name="title" translatable="yes">dialog1</property>
- <property name="type">GTK_WINDOW_TOPLEVEL</property>
- <property name="window_position">GTK_WIN_POS_NONE</property>
- <property name="modal">True</property>
- <property name="resizable">True</property>
- <property name="destroy_with_parent">False</property>
- <property name="has_separator">True</property>
-
- <child internal-child="vbox">
- <widget class="GtkVBox" id="dialog-vbox6">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
-
- <child internal-child="action_area">
- <widget class="GtkHButtonBox" id="dialog-action_area6">
- <property name="visible">True</property>
- <property name="layout_style">GTK_BUTTONBOX_END</property>
-
- <child>
- <widget class="GtkButton" id="cancelbutton2">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-cancel</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="response_id">-6</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkButton" id="applybutton2">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-apply</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="response_id">-10</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkButton" id="okbutton2">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label">gtk-ok</property>
- <property name="use_stock">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="response_id">-5</property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="pack_type">GTK_PACK_END</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkFrame" id="top-frame">
- <property name="border_width">2</property>
- <property name="visible">True</property>
- <property name="label_xalign">0</property>
- <property name="label_yalign">0.5</property>
- <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
-
- <child>
- <widget class="GtkTable" id="table1">
- <property name="border_width">2</property>
- <property name="visible">True</property>
- <property name="n_rows">3</property>
- <property name="n_columns">3</property>
- <property name="homogeneous">False</property>
- <property name="row_spacing">2</property>
- <property name="column_spacing">4</property>
-
- <child>
- <widget class="GtkButton" id="button-sort">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">_Sort...</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <signal name="clicked" handler="on_sort_clicked"/>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkButton" id="button-group">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">_Group By...</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <signal name="clicked" handler="on_group_by_clicked"/>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label-sort">
- <property name="visible">True</property>
- <property name="label" translatable="yes"></property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">True</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkButton" id="button-fields">
- <property name="visible">True</property>
- <property name="can_default">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">_Fields Shown...</property>
- <property name="use_underline">True</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <signal name="clicked" handler="on_group_by_clicked"/>
- </widget>
- <packing>
- <property name="left_attach">0</property>
- <property name="right_attach">1</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label-fields">
- <property name="visible">True</property>
- <property name="label" translatable="yes"></property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">True</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label3">
- <property name="visible">True</property>
- <property name="label" translatable="yes"></property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">fill</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label4">
- <property name="visible">True</property>
- <property name="label" translatable="yes"></property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options">fill</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label22">
- <property name="visible">True</property>
- <property name="label" translatable="yes"></property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="x_options">fill</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label-group">
- <property name="visible">True</property>
- <property name="label" translatable="yes"></property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">True</property>
- <property name="selectable">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label26">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Description</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">False</property>
- <property name="selectable">False</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- </widget>
- <packing>
- <property name="type">label_item</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- </child>
-</widget>
-
-</glade-interface>
diff --git a/widgets/table/e-table-config.h b/widgets/table/e-table-config.h
deleted file mode 100644
index 1373fb94de..0000000000
--- a/widgets/table/e-table-config.h
+++ /dev/null
@@ -1,115 +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 <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>
-#include <gtk/gtkwindow.h>
-
-G_BEGIN_DECLS
-
-#define E_TABLE_CONFIG_TYPE (e_table_config_get_type ())
-#define E_TABLE_CONFIG(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_CONFIG_TYPE, ETableConfig))
-#define E_TABLE_CONFIG_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_CONFIG_TYPE, ETableConfigClass))
-#define E_IS_TABLE_CONFIG(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_CONFIG_TYPE))
-#define E_IS_TABLE_CONFIG_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TABLE_CONFIG_TYPE))
-#define E_TABLE_CONFIG_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), E_TABLE_CONFIG_TYPE, ETableConfigClass))
-
-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 {
- GObject 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;
- char *domain;
-
- /*
- * List of valid column names
- */
- GSList *column_names;
-} ETableConfig;
-
-typedef struct {
- GObjectClass parent_class;
-
- /* Signals */
- void (*changed) (ETableConfig *config);
-} ETableConfigClass;
-
-GType e_table_config_get_type (void);
-ETableConfig *e_table_config_new (const char *header,
- ETableSpecification *spec,
- ETableState *state,
- GtkWindow *parent_window);
-ETableConfig *e_table_config_construct (ETableConfig *etco,
- const char *header,
- ETableSpecification *spec,
- ETableState *state,
- GtkWindow *parent_window);
-void e_table_config_raise (ETableConfig *config);
-
-G_END_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 2321e4e7dd..0000000000
--- a/widgets/table/e-table-example-2.c
+++ /dev/null
@@ -1,349 +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_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 81947a6e94..0000000000
--- a/widgets/table/e-table-extras.c
+++ /dev/null
@@ -1,292 +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>
-
-static GObjectClass *ete_parent_class;
-
-static void
-cell_hash_free(gchar *key,
- ECell *cell,
- gpointer user_data)
-{
- g_free(key);
- if (cell)
- g_object_unref(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_finalize (GObject *object)
-{
- ETableExtras *ete = E_TABLE_EXTRAS (object);
-
- if (ete->cells) {
- g_hash_table_foreach (ete->cells, (GHFunc) cell_hash_free, NULL);
- g_hash_table_destroy (ete->cells);
- }
-
- if (ete->compares) {
- g_hash_table_foreach (ete->compares, (GHFunc) g_free, NULL);
- g_hash_table_destroy (ete->compares);
- }
-
- if (ete->searches) {
- g_hash_table_foreach (ete->searches, (GHFunc) g_free, NULL);
- g_hash_table_destroy (ete->searches);
- }
-
- if (ete->pixbufs) {
- g_hash_table_foreach (ete->pixbufs, (GHFunc) pixbuf_hash_free, NULL);
- g_hash_table_destroy (ete->pixbufs);
- }
-
- ete->cells = NULL;
- ete->compares = NULL;
- ete->searches = NULL;
- ete->pixbufs = NULL;
-
- ete_parent_class->finalize (object);
-}
-
-static void
-ete_class_init (GObjectClass *klass)
-{
- ete_parent_class = g_type_class_peek_parent (klass);
-
- klass->finalize = ete_finalize;
-}
-
-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));
-}
-
-/* UTF-8 strncasecmp - not optimized */
-
-static gint
-g_utf8_strncasecmp (const gchar *s1,
- const gchar *s2,
- guint n)
-{
- gunichar c1, c2;
-
- g_return_val_if_fail (s1 != NULL && g_utf8_validate (s1, -1, NULL), 0);
- g_return_val_if_fail (s2 != NULL && g_utf8_validate (s2, -1, NULL), 0);
-
- while (n && *s1 && *s2)
- {
-
- n -= 1;
-
- c1 = g_unichar_tolower (g_utf8_get_char (s1));
- c2 = g_unichar_tolower (g_utf8_get_char (s2));
-
- /* Collation is locale-dependent, so this totally fails to do the right thing. */
- if (c1 != c2)
- return c1 < c2 ? -1 : 1;
-
- s1 = g_utf8_next_char (s1);
- s2 = g_utf8_next_char (s2);
- }
-
- if (n == 0 || (*s1 == '\0' && *s2 == '\0'))
- return 0;
-
- return *s1 ? 1 : -1;
-}
-
-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, "collate", g_collate_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, G_TYPE_OBJECT)
-
-ETableExtras *
-e_table_extras_new (void)
-{
- ETableExtras *ete = g_object_new (E_TABLE_EXTRAS_TYPE, NULL);
-
- 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)
- g_object_unref (old_cell);
- }
-
- if (cell) {
- g_object_ref (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), (gpointer) compare);
-}
-
-GCompareFunc
-e_table_extras_get_compare (ETableExtras *extras,
- char *id)
-{
- return (GCompareFunc) 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 bd478e0bd8..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 <glib-object.h>
-#include <gal/e-table/e-cell.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
-
-G_BEGIN_DECLS
-
-#define E_TABLE_EXTRAS_TYPE (e_table_extras_get_type ())
-#define E_TABLE_EXTRAS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_EXTRAS_TYPE, ETableExtras))
-#define E_TABLE_EXTRAS_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_EXTRAS_TYPE, ETableExtrasClass))
-#define E_IS_TABLE_EXTRAS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_EXTRAS_TYPE))
-#define E_IS_TABLE_EXTRAS_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TABLE_EXTRAS_TYPE))
-#define E_TABLE_EXTRAS_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), E_TABLE_EXTRAS_TYPE, ETableExtrasClass))
-
-typedef struct {
- GObject base;
-
- GHashTable *cells;
- GHashTable *compares;
- GHashTable *pixbufs;
- GHashTable *searches;
-} ETableExtras;
-
-typedef struct {
- GObjectClass parent_class;
-} ETableExtrasClass;
-
-GType 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);
-
-G_END_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 d7e725fd12..0000000000
--- a/widgets/table/e-table-field-chooser-dialog.c
+++ /dev/null
@@ -1,224 +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 "gal/util/e-i18n.h"
-#include "gal/util/e-util.h"
-#include <gtk/gtkstock.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_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
-static void e_table_field_chooser_dialog_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
-static void e_table_field_chooser_dialog_dispose (GObject *object);
-static void e_table_field_chooser_dialog_response (GtkDialog *dialog, gint id);
-
-#define PARENT_TYPE GTK_TYPE_DIALOG
-static GtkDialogClass *parent_class = NULL;
-
-/* The arguments we take */
-enum {
- PROP_0,
- PROP_DND_CODE,
- PROP_FULL_HEADER,
- PROP_HEADER
-};
-
-E_MAKE_TYPE (e_table_field_chooser_dialog,
- "ETableFieldChooserDialog",
- ETableFieldChooserDialog,
- e_table_field_chooser_dialog_class_init,
- e_table_field_chooser_dialog_init,
- PARENT_TYPE);
-
-static void
-e_table_field_chooser_dialog_class_init (ETableFieldChooserDialogClass *klass)
-{
- GObjectClass *object_class;
- GtkDialogClass *dialog_class;
-
- object_class = (GObjectClass*) klass;
- dialog_class = GTK_DIALOG_CLASS (klass);
-
- parent_class = g_type_class_ref (PARENT_TYPE);
-
- object_class->dispose = e_table_field_chooser_dialog_dispose;
- object_class->set_property = e_table_field_chooser_dialog_set_property;
- object_class->get_property = e_table_field_chooser_dialog_get_property;
-
- dialog_class->response = e_table_field_chooser_dialog_response;
-
- g_object_class_install_property (object_class, PROP_DND_CODE,
- g_param_spec_string ("dnd_code",
- _("DnD code"),
- /*_( */"XXX blurb" /*)*/,
- NULL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_FULL_HEADER,
- g_param_spec_object ("full_header",
- _("Full Header"),
- /*_( */"XXX blurb" /*)*/,
- E_TABLE_HEADER_TYPE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_HEADER,
- g_param_spec_object ("header",
- _("Header"),
- /*_( */"XXX blurb" /*)*/,
- E_TABLE_HEADER_TYPE,
- G_PARAM_READWRITE));
-}
-
-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;
-
- gtk_dialog_add_button(GTK_DIALOG(e_table_field_chooser_dialog),
- GTK_STOCK_CLOSE, GTK_RESPONSE_OK);
-
- 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);
-
- g_object_set(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(GTK_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 = g_object_new (E_TABLE_FIELD_CHOOSER_DIALOG_TYPE, NULL);
- return widget;
-}
-
-static void
-e_table_field_chooser_dialog_dispose (GObject *object)
-{
- ETableFieldChooserDialog *etfcd = E_TABLE_FIELD_CHOOSER_DIALOG (object);
-
- if (etfcd->dnd_code)
- g_free (etfcd->dnd_code);
- etfcd->dnd_code = NULL;
-
- if (etfcd->full_header)
- g_object_unref (etfcd->full_header);
- etfcd->full_header = NULL;
-
- if (etfcd->header)
- g_object_unref (etfcd->header);
- etfcd->header = NULL;
-
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static void
-e_table_field_chooser_dialog_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
-{
- ETableFieldChooserDialog *etfcd = E_TABLE_FIELD_CHOOSER_DIALOG(object);
- switch (prop_id){
- case PROP_DND_CODE:
- g_free(etfcd->dnd_code);
- etfcd->dnd_code = g_strdup(g_value_get_string (value));
- if (etfcd->etfc)
- g_object_set(etfcd->etfc,
- "dnd_code", etfcd->dnd_code,
- NULL);
- break;
- case PROP_FULL_HEADER:
- if (etfcd->full_header)
- g_object_unref (etfcd->full_header);
- if (g_value_get_object (value))
- etfcd->full_header = E_TABLE_HEADER(g_value_get_object (value));
- else
- etfcd->full_header = NULL;
- if (etfcd->full_header)
- g_object_ref (etfcd->full_header);
- if (etfcd->etfc)
- g_object_set(etfcd->etfc,
- "full_header", etfcd->full_header,
- NULL);
- break;
- case PROP_HEADER:
- if (etfcd->header)
- g_object_unref (etfcd->header);
- if (g_value_get_object (value))
- etfcd->header = E_TABLE_HEADER(g_value_get_object (value));
- else
- etfcd->header = NULL;
- if (etfcd->header)
- g_object_ref (etfcd->header);
- if (etfcd->etfc)
- g_object_set(etfcd->etfc,
- "header", etfcd->header,
- NULL);
- break;
- default:
- break;
- }
-}
-
-static void
-e_table_field_chooser_dialog_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
-{
- ETableFieldChooserDialog *etfcd = E_TABLE_FIELD_CHOOSER_DIALOG(object);
- switch (prop_id) {
- case PROP_DND_CODE:
- g_value_set_string (value, g_strdup (etfcd->dnd_code));
- break;
- case PROP_FULL_HEADER:
- g_value_set_object (value, etfcd->full_header);
- break;
- case PROP_HEADER:
- g_value_set_object (value, etfcd->header);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-e_table_field_chooser_dialog_response (GtkDialog *dialog, int id)
-{
- if (id == GTK_RESPONSE_OK)
- gtk_widget_destroy (GTK_WIDGET (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 83fd5d3738..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 <gtk/gtkdialog.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) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TABLE_FIELD_CHOOSER_DIALOG_TYPE, ETableFieldChooserDialog))
-#define E_TABLE_FIELD_CHOOSER_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TABLE_FIELD_CHOOSER_DIALOG_TYPE, ETableFieldChooserDialogClass))
-#define E_IS_TABLE_FIELD_CHOOSER_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TABLE_FIELD_CHOOSER_DIALOG_TYPE))
-#define E_IS_TABLE_FIELD_CHOOSER_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TABLE_FIELD_CHOOSER_DIALOG_TYPE))
-
-
-typedef struct _ETableFieldChooserDialog ETableFieldChooserDialog;
-typedef struct _ETableFieldChooserDialogClass ETableFieldChooserDialogClass;
-
-struct _ETableFieldChooserDialog
-{
- GtkDialog parent;
-
- /* item specific fields */
- ETableFieldChooser *etfc;
- gchar *dnd_code;
- ETableHeader *full_header;
- ETableHeader *header;
-};
-
-struct _ETableFieldChooserDialogClass
-{
- GtkDialogClass parent_class;
-};
-
-
-GtkWidget *e_table_field_chooser_dialog_new(void);
-GType 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 cfc73fc102..0000000000
--- a/widgets/table/e-table-field-chooser-item.c
+++ /dev/null
@@ -1,711 +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 <libgnomecanvas/gnome-canvas.h>
-#include <libgnomecanvas/gnome-canvas-util.h>
-#include <libgnomecanvas/gnome-canvas-polygon.h>
-#include <libgnomecanvas/gnome-canvas-rect-ellipse.h>
-#include <gdk-pixbuf/gdk-pixbuf.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 "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"
-
-#define d(x)
-
-#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 {
- PROP_0,
- PROP_FULL_HEADER,
- PROP_HEADER,
- PROP_DND_CODE,
- PROP_WIDTH,
- PROP_HEIGHT
-};
-
-static void
-etfci_dispose (GObject *object)
-{
- ETableFieldChooserItem *etfci = E_TABLE_FIELD_CHOOSER_ITEM (object);
-
- etfci_drop_table_header (etfci);
- etfci_drop_full_header (etfci);
-
- if (etfci->combined_header)
- g_object_unref (etfci->combined_header);
- etfci->combined_header = NULL;
-
- if (etfci->font)
- gdk_font_unref(etfci->font);
- etfci->font = NULL;
-
- if (G_OBJECT_CLASS (etfci_parent_class)->dispose)
- (*G_OBJECT_CLASS (etfci_parent_class)->dispose) (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, GTK_WIDGET (GNOME_CANVAS_ITEM (etfci)->canvas));
- 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)
- g_object_unref (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, GTK_WIDGET (GNOME_CANVAS_ITEM (etfci)->canvas));
- }
-
- 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;
-#ifndef NO_WARNINGS
-#warning Group Child bounds !?
-#endif
-#if 0
- gnome_canvas_group_child_bounds (GNOME_CANVAS_GROUP (item->parent), item);
-#endif
- }
- 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_style_get_font (GTK_WIDGET(GNOME_CANVAS_ITEM(etfci)->canvas)->style);
- gdk_font_ref(etfci->font);
-}
-
-static void
-etfci_drop_full_header (ETableFieldChooserItem *etfci)
-{
- GObject *header;
-
- if (!etfci->full_header)
- return;
-
- header = G_OBJECT (etfci->full_header);
- if (etfci->full_header_structure_change_id)
- g_signal_handler_disconnect (header, etfci->full_header_structure_change_id);
- if (etfci->full_header_dimension_change_id)
- g_signal_handler_disconnect (header, etfci->full_header_dimension_change_id);
- etfci->full_header_structure_change_id = 0;
- etfci->full_header_dimension_change_id = 0;
-
- if (header)
- g_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;
- g_object_ref (etfci->full_header);
-
- etfci->full_header_structure_change_id = g_signal_connect (
- header, "structure_change",
- G_CALLBACK(full_header_structure_changed), etfci);
- etfci->full_header_dimension_change_id = g_signal_connect (
- header, "dimension_change",
- G_CALLBACK(full_header_dimension_changed), etfci);
- e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(etfci));
-}
-
-static void
-etfci_drop_table_header (ETableFieldChooserItem *etfci)
-{
- GObject *header;
-
- if (!etfci->header)
- return;
-
- header = G_OBJECT (etfci->header);
- if (etfci->table_header_structure_change_id)
- g_signal_handler_disconnect (header, etfci->table_header_structure_change_id);
- if (etfci->table_header_dimension_change_id)
- g_signal_handler_disconnect (header, etfci->table_header_dimension_change_id);
- etfci->table_header_structure_change_id = 0;
- etfci->table_header_dimension_change_id = 0;
-
- if (header)
- g_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;
- g_object_ref (etfci->header);
-
- etfci->table_header_structure_change_id = g_signal_connect (
- header, "structure_change",
- G_CALLBACK(table_header_structure_changed), etfci);
- etfci->table_header_dimension_change_id = g_signal_connect (
- header, "dimension_change",
- G_CALLBACK(table_header_dimension_changed), etfci);
- e_canvas_item_request_reflow(GNOME_CANVAS_ITEM(etfci));
-}
-
-static void
-etfci_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
-{
- GnomeCanvasItem *item;
- ETableFieldChooserItem *etfci;
-
- item = GNOME_CANVAS_ITEM (object);
- etfci = E_TABLE_FIELD_CHOOSER_ITEM (object);
-
- switch (prop_id){
- case PROP_FULL_HEADER:
- etfci_drop_full_header (etfci);
- if (g_value_get_object (value))
- etfci_add_full_header (etfci, E_TABLE_HEADER(g_value_get_object (value)));
- break;
-
- case PROP_HEADER:
- etfci_drop_table_header (etfci);
- if (g_value_get_object (value))
- etfci_add_table_header (etfci, E_TABLE_HEADER(g_value_get_object (value)));
- break;
-
- case PROP_DND_CODE:
- g_free(etfci->dnd_code);
- etfci->dnd_code = g_strdup(g_value_get_string (value));
- break;
-
- case PROP_WIDTH:
- etfci->width = g_value_get_double (value);
- gnome_canvas_item_request_update(item);
- break;
- }
-}
-
-static void
-etfci_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
-{
- GnomeCanvasItem *item;
- ETableFieldChooserItem *etfci;
-
- item = GNOME_CANVAS_ITEM (object);
- etfci = E_TABLE_FIELD_CHOOSER_ITEM (object);
-
- switch (prop_id){
-
- case PROP_DND_CODE:
- g_value_set_string (value, g_strdup (etfci->dnd_code));
- break;
- case PROP_WIDTH:
- g_value_set_double (value, etfci->width);
- break;
- case PROP_HEIGHT:
- g_value_set_double (value, etfci->height);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- 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 = g_signal_connect (
- item->canvas, "drag_end",
- G_CALLBACK (etfci_drag_end), etfci);
- etfci->drag_data_get_id = g_signal_connect (
- item->canvas, "drag_data_get",
- G_CALLBACK (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;
-
- g_signal_handler_disconnect (item->canvas, etfci->drag_end_id);
- etfci->drag_end_id = 0;
- g_signal_handler_disconnect (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, GTK_WIDGET (canvas));
-
- if (y1 > (y + height))
- break;
-
- if (y2 < y)
- continue;
-
- e_table_header_draw_button (drawable, ecol,
- style, 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, int x, int 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);
- d(g_print ("etfci - %s\n", etfci_drag_types[0].target));
- 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);
- pixmap = gdk_pixmap_new (widget->window, etfci->width, button_height, -1);
-
- e_table_header_draw_button (pixmap, ecol,
- widget->style, 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 (GObjectClass *object_class)
-{
- GnomeCanvasItemClass *item_class = (GnomeCanvasItemClass *) object_class;
-
- etfci_parent_class = g_type_class_ref (PARENT_OBJECT_TYPE);
-
- object_class->dispose = etfci_dispose;
- object_class->set_property = etfci_set_property;
- object_class->get_property = etfci_get_property;
-
- 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;
-
- g_object_class_install_property (object_class, PROP_DND_CODE,
- g_param_spec_string ("dnd_code",
- _("DnD code"),
- /*_( */"XXX blurb" /*)*/,
- NULL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_FULL_HEADER,
- g_param_spec_object ("full_header",
- _("Full Header"),
- /*_( */"XXX blurb" /*)*/,
- E_TABLE_HEADER_TYPE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_HEADER,
- g_param_spec_object ("header",
- _("Header"),
- /*_( */"XXX blurb" /*)*/,
- E_TABLE_HEADER_TYPE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_WIDTH,
- g_param_spec_double ("width",
- _("Width"),
- /*_( */"XXX blurb" /*)*/,
- 0, G_MAXDOUBLE, 0,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_HEIGHT,
- g_param_spec_double ("height",
- _("Height"),
- /*_( */"XXX blurb" /*)*/,
- 0, G_MAXDOUBLE, 0,
- G_PARAM_READABLE));
-}
-
-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);
-}
-
-E_MAKE_TYPE (e_table_field_chooser_item,
- "ETableFieldChooserItem",
- ETableFieldChooserItem,
- etfci_class_init,
- etfci_init,
- PARENT_OBJECT_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 2ed37d37f1..0000000000
--- a/widgets/table/e-table-field-chooser-item.h
+++ /dev/null
@@ -1,75 +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 <libgnomecanvas/gnome-canvas.h>
-#include <libxml/tree.h>
-#include <gal/e-table/e-table-header.h>
-
-G_BEGIN_DECLS
-
-#define E_TABLE_FIELD_CHOOSER_ITEM_TYPE (e_table_field_chooser_item_get_type ())
-#define E_TABLE_FIELD_CHOOSER_ITEM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_FIELD_CHOOSER_ITEM_TYPE, ETableFieldChooserItem))
-#define E_TABLE_FIELD_CHOOSER_ITEM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_FIELD_CHOOSER_ITEM_TYPE, ETableFieldChooserItemClass))
-#define E_IS_TABLE_FIELD_CHOOSER_ITEM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_FIELD_CHOOSER_ITEM_TYPE))
-#define E_IS_TABLE_FIELD_CHOOSER_ITEM_CLASS(k) (G_TYPE_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;
-
-GType e_table_field_chooser_item_get_type (void);
-
-G_END_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 e5d8510055..0000000000
--- a/widgets/table/e-table-field-chooser.c
+++ /dev/null
@@ -1,282 +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 <gtk/gtksignal.h>
-#include <gtk/gtk.h>
-#include <gtk/gtkbox.h>
-#include <libgnomecanvas/gnome-canvas-rect-ellipse.h>
-#include "e-table-field-chooser.h"
-#include "e-table-field-chooser-item.h"
-#include <gal/util/e-i18n.h>
-#include <gal/util/e-util.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_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
-static void e_table_field_chooser_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
-static void e_table_field_chooser_dispose (GObject *object);
-
-#define PARENT_TYPE GTK_TYPE_VBOX
-static GtkVBoxClass *parent_class = NULL;
-
-/* The arguments we take */
-enum {
- PROP_0,
- PROP_FULL_HEADER,
- PROP_HEADER,
- PROP_DND_CODE
-};
-
-E_MAKE_TYPE (e_table_field_chooser,
- "ETableFieldChooser",
- ETableFieldChooser,
- e_table_field_chooser_class_init,
- e_table_field_chooser_init,
- PARENT_TYPE);
-
-static void
-e_table_field_chooser_class_init (ETableFieldChooserClass *klass)
-{
- GObjectClass *object_class;
- GtkVBoxClass *vbox_class;
-
- object_class = (GObjectClass*) klass;
- vbox_class = (GtkVBoxClass *) klass;
-
- glade_init();
-
- parent_class = g_type_class_ref (GTK_TYPE_VBOX);
-
- object_class->set_property = e_table_field_chooser_set_property;
- object_class->get_property = e_table_field_chooser_get_property;
- object_class->dispose = e_table_field_chooser_dispose;
-
- g_object_class_install_property (object_class, PROP_DND_CODE,
- g_param_spec_string ("dnd_code",
- _("DnD code"),
- /*_( */"XXX blurb" /*)*/,
- NULL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_FULL_HEADER,
- g_param_spec_object ("full_header",
- _("Full Header"),
- /*_( */"XXX blurb" /*)*/,
- E_TABLE_HEADER_TYPE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_HEADER,
- g_param_spec_object ("header",
- _("Header"),
- /*_( */"XXX blurb" /*)*/,
- E_TABLE_HEADER_TYPE,
- G_PARAM_READWRITE));
-}
-
-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 );
- g_object_get(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;
- g_object_get(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 (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_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 );
-
- g_signal_connect( etfc->canvas, "reflow",
- G_CALLBACK ( resize ),
- etfc);
-
- gnome_canvas_set_scroll_region ( GNOME_CANVAS( etfc->canvas ),
- 0, 0,
- 100, 100 );
-
- /* Connect the signals */
- g_signal_connect (etfc->canvas, "size_allocate",
- G_CALLBACK (allocate_callback),
- etfc);
-
- gtk_widget_pop_colormap ();
- gtk_widget_show_all(widget);
-}
-
-static void
-e_table_field_chooser_dispose (GObject *object)
-{
- ETableFieldChooser *etfc = E_TABLE_FIELD_CHOOSER(object);
-
- g_free (etfc->dnd_code);
- etfc->dnd_code = NULL;
-
- if (etfc->full_header)
- g_object_unref (etfc->full_header);
- etfc->full_header = NULL;
-
- if (etfc->header)
- g_object_unref (etfc->header);
- etfc->header = NULL;
-
- if (etfc->gui)
- g_object_unref (etfc->gui);
- etfc->gui = NULL;
-
- if (G_OBJECT_CLASS (parent_class)->dispose)
- (* G_OBJECT_CLASS (parent_class)->dispose) (object);
-}
-
-GtkWidget*
-e_table_field_chooser_new (void)
-{
- GtkWidget *widget = GTK_WIDGET (g_object_new (E_TABLE_FIELD_CHOOSER_TYPE, NULL));
- return widget;
-}
-
-static void
-e_table_field_chooser_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
-{
- ETableFieldChooser *etfc = E_TABLE_FIELD_CHOOSER(object);
-
- switch (prop_id){
- case PROP_DND_CODE:
- g_free(etfc->dnd_code);
- etfc->dnd_code = g_strdup(g_value_get_string(value));
- if (etfc->item)
- g_object_set(etfc->item,
- "dnd_code", etfc->dnd_code,
- NULL);
- break;
- case PROP_FULL_HEADER:
- if (etfc->full_header)
- g_object_unref (etfc->full_header);
- if (g_value_get_object (value))
- etfc->full_header = E_TABLE_HEADER(g_value_get_object (value));
- else
- etfc->full_header = NULL;
- if (etfc->full_header)
- g_object_ref (etfc->full_header);
- if (etfc->item)
- g_object_set(etfc->item,
- "full_header", etfc->full_header,
- NULL);
- break;
- case PROP_HEADER:
- if (etfc->header)
- g_object_unref (etfc->header);
- if (g_value_get_object (value))
- etfc->header = E_TABLE_HEADER(g_value_get_object (value));
- else
- etfc->header = NULL;
- if (etfc->header)
- g_object_ref (etfc->header);
- if (etfc->item)
- g_object_set(etfc->item,
- "header", etfc->header,
- NULL);
- break;
- default:
- break;
- }
-}
-
-static void
-e_table_field_chooser_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
-{
- ETableFieldChooser *etfc = E_TABLE_FIELD_CHOOSER(object);
-
- switch (prop_id) {
- case PROP_DND_CODE:
- g_value_set_string (value, g_strdup (etfc->dnd_code));
- break;
- case PROP_FULL_HEADER:
- g_value_set_object (value, etfc->full_header);
- break;
- case PROP_HEADER:
- g_value_set_object (value, etfc->header);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
diff --git a/widgets/table/e-table-field-chooser.glade b/widgets/table/e-table-field-chooser.glade
deleted file mode 100644
index f46a8dbd52..0000000000
--- a/widgets/table/e-table-field-chooser.glade
+++ /dev/null
@@ -1,123 +0,0 @@
-<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
-<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd" >
-
-<glade-interface>
- <widget class="GtkDialog" id="dialog-field-chooser">
- <property name="visible">no</property>
- <property name="title" translatable="yes">Field Chooser</property>
- <property name="type">GTK_WINDOW_TOPLEVEL</property>
- <property name="modal">no</property>
- <property name="allow_shrink">no</property>
- <property name="allow_grow">yes</property>
- <property name="window-position">GTK_WIN_POS_NONE</property>
-
- <child internal-child="vbox">
- <widget class="GtkVBox" id="dialog-vbox1">
- <property name="homogeneous">no</property>
- <property name="spacing">8</property>
- <property name="visible">yes</property>
-
- <child internal-child="action_area">
- <widget class="GtkHButtonBox" id="dialog-action_area1">
- <property name="layout_style">GTK_BUTTONBOX_END</property>
- <property name="spacing">8</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="GtkButton" id="button3">
- <property name="can_default">yes</property>
- <property name="can_focus">yes</property>
- <property name="visible">yes</property>
- <property name="label">gtk-close</property>
- <property name="use_stock">yes</property>
- <property name="use_underline">yes</property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">no</property>
- <property name="fill">yes</property>
- <property name="pack_type">GTK_PACK_END</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vbox-top">
- <property name="homogeneous">no</property>
- <property name="spacing">4</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="GtkLabel" id="label1">
- <property name="label" translatable="yes">To add a column to your table, drag it into
-the location in which you want it to appear.</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">no</property>
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="visible">yes</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">no</property>
- <property name="fill">no</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkScrolledWindow" id="scrolledwindow1">
- <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
- <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
- <property name="width-request">200</property>
- <property name="height-request">200</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="Custom" id="canvas-buttons">
- <property name="creation_function">e_canvas_new</property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Thu, 08 Jun 2000 07:27:33 GMT</property>
- <property name="visible">yes</property>
- </widget>
- </child>
-
- <child internal-child="hscrollbar">
- <widget class="GtkHScrollbar" id="convertwidget1">
- <property name="update_policy">GTK_UPDATE_CONTINUOUS</property>
- <property name="visible">yes</property>
- </widget>
- </child>
-
- <child internal-child="vscrollbar">
- <widget class="GtkVScrollbar" id="convertwidget2">
- <property name="update_policy">GTK_UPDATE_CONTINUOUS</property>
- <property name="visible">yes</property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">yes</property>
- <property name="fill">yes</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">yes</property>
- <property name="fill">yes</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">4</property>
- <property name="expand">yes</property>
- <property name="fill">yes</property>
- </packing>
- </child>
- </widget>
-</glade-interface>
diff --git a/widgets/table/e-table-field-chooser.h b/widgets/table/e-table-field-chooser.h
deleted file mode 100644
index 65efeeedbe..0000000000
--- a/widgets/table/e-table-field-chooser.h
+++ /dev/null
@@ -1,79 +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 <gtk/gtkvbox.h>
-#include <gal/e-table/e-table-header.h>
-
-G_BEGIN_DECLS
-
-/* 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) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TABLE_FIELD_CHOOSER_TYPE, ETableFieldChooser))
-#define E_TABLE_FIELD_CHOOSER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TABLE_FIELD_CHOOSER_TYPE, ETableFieldChooserClass))
-#define E_IS_TABLE_FIELD_CHOOSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TABLE_FIELD_CHOOSER_TYPE))
-#define E_IS_TABLE_FIELD_CHOOSER_CLASS(klass) (G_TYPE_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);
-GType e_table_field_chooser_get_type (void);
-
-G_END_DECLS
-
-#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 61b8b9f1a5..0000000000
--- a/widgets/table/e-table-group-container.c
+++ /dev/null
@@ -1,1512 +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 <libgnomecanvas/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/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 {
- PROP_0,
- PROP_HEIGHT,
- PROP_WIDTH,
- PROP_MINIMUM_WIDTH,
- PROP_FROZEN,
- PROP_TABLE_ALTERNATING_ROW_COLORS,
- PROP_TABLE_HORIZONTAL_DRAW_GRID,
- PROP_TABLE_VERTICAL_DRAW_GRID,
- PROP_TABLE_DRAW_FOCUS,
- PROP_CURSOR_MODE,
- PROP_SELECTION_MODEL,
- PROP_LENGTH_THRESHOLD,
- PROP_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);
- etgc->children = NULL;
-}
-
-static void
-etgc_dispose (GObject *object)
-{
- ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER (object);
-
- if (etgc->children)
- e_table_group_container_list_free (etgc);
-
- if (etgc->font)
- gdk_font_unref (etgc->font);
- etgc->font = NULL;
-
- if (etgc->ecol)
- g_object_unref (etgc->ecol);
- etgc->ecol = NULL;
-
- if (etgc->sort_info)
- g_object_unref (etgc->sort_info);
- etgc->sort_info = NULL;
-
- if (etgc->selection_model)
- g_object_unref (etgc->selection_model);
- etgc->selection_model = NULL;
-
- if (etgc->rect)
- gtk_object_destroy (GTK_OBJECT(etgc->rect));
- etgc->rect = NULL;
-
- G_OBJECT_CLASS (etgc_parent_class)->dispose (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;
- g_object_ref (etgc->ecol);
- etgc->sort_info = sort_info;
- g_object_ref (etgc->sort_info);
- etgc->n = n;
- etgc->ascending = column.ascending;
-
- etgc->font = gtk_style_get_font (GTK_WIDGET (GNOME_CANVAS_ITEM (etgc)->canvas)->style);
-
- 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 = g_object_new (E_TABLE_GROUP_CONTAINER_TYPE, NULL);
-
- 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)
- ? _("%s : %s (%d item)")
- : _("%s : %s (%d items)"),
- etgc->ecol->text, child_node->string,
- (gint) child_node->count);
- } else {
- text = g_strdup_printf ((child_node->count == 1)
- ? _("%s (%d item)")
- : _("%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 (),
- "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);
-
- g_signal_connect (child, "cursor_change",
- G_CALLBACK (child_cursor_change), etgc);
- g_signal_connect (child, "cursor_activated",
- G_CALLBACK (child_cursor_activated), etgc);
- g_signal_connect (child, "double_click",
- G_CALLBACK (child_double_click), etgc);
- g_signal_connect (child, "right_click",
- G_CALLBACK (child_right_click), etgc);
- g_signal_connect (child, "click",
- G_CALLBACK (child_click), etgc);
- g_signal_connect (child, "key_press",
- G_CALLBACK (child_key_press), etgc);
- g_signal_connect (child, "start_drag",
- G_CALLBACK (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_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
-{
- ETableGroup *etg = E_TABLE_GROUP (object);
- ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER (object);
- GList *list;
-
- switch (prop_id) {
- case PROP_FROZEN:
- if (g_value_get_boolean (value))
- etg->frozen = TRUE;
- else {
- etg->frozen = FALSE;
- etgc_thaw (etg);
- }
- break;
- case PROP_MINIMUM_WIDTH:
- case PROP_WIDTH:
- etgc->minimum_width = g_value_get_double (value);
-
- for (list = etgc->children; list; list = g_list_next (list)) {
- ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *)list->data;
- g_object_set (child_node->child,
- "minimum_width", etgc->minimum_width - GROUP_INDENT,
- NULL);
- }
- break;
- case PROP_LENGTH_THRESHOLD:
- etgc->length_threshold = g_value_get_int (value);
- for (list = etgc->children; list; list = g_list_next (list)) {
- ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *)list->data;
- g_object_set (child_node->child,
- "length_threshold", etgc->length_threshold,
- NULL);
- }
- break;
- case PROP_UNIFORM_ROW_HEIGHT:
- etgc->uniform_row_height = g_value_get_boolean (value);
- for (list = etgc->children; list; list = g_list_next (list)) {
- ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *)list->data;
- g_object_set (child_node->child,
- "uniform_row_height", etgc->uniform_row_height,
- NULL);
- }
- break;
-
- case PROP_SELECTION_MODEL:
- if (etgc->selection_model)
- g_object_unref (etgc->selection_model);
- etgc->selection_model = E_SELECTION_MODEL(g_value_get_object (value));
- if (etgc->selection_model)
- g_object_ref (etgc->selection_model);
- for (list = etgc->children; list; list = g_list_next (list)) {
- ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *)list->data;
- g_object_set (child_node->child,
- "selection_model", etgc->selection_model,
- NULL);
- }
- break;
-
- case PROP_TABLE_ALTERNATING_ROW_COLORS:
- etgc->alternating_row_colors = g_value_get_boolean (value);
- for (list = etgc->children; list; list = g_list_next (list)) {
- ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *)list->data;
- g_object_set (child_node->child,
- "alternating_row_colors", etgc->alternating_row_colors,
- NULL);
- }
- break;
-
- case PROP_TABLE_HORIZONTAL_DRAW_GRID:
- etgc->horizontal_draw_grid = g_value_get_boolean (value);
- for (list = etgc->children; list; list = g_list_next (list)) {
- ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *)list->data;
- g_object_set (child_node->child,
- "horizontal_draw_grid", etgc->horizontal_draw_grid,
- NULL);
- }
- break;
-
- case PROP_TABLE_VERTICAL_DRAW_GRID:
- etgc->vertical_draw_grid = g_value_get_boolean (value);
- for (list = etgc->children; list; list = g_list_next (list)) {
- ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *)list->data;
- g_object_set (child_node->child,
- "vertical_draw_grid", etgc->vertical_draw_grid,
- NULL);
- }
- break;
-
- case PROP_TABLE_DRAW_FOCUS:
- etgc->draw_focus = g_value_get_boolean (value);
- for (list = etgc->children; list; list = g_list_next (list)) {
- ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *)list->data;
- g_object_set (child_node->child,
- "drawfocus", etgc->draw_focus,
- NULL);
- }
- break;
-
- case PROP_CURSOR_MODE:
- etgc->cursor_mode = g_value_get_int (value);
- for (list = etgc->children; list; list = g_list_next (list)) {
- ETableGroupContainerChildNode *child_node = (ETableGroupContainerChildNode *)list->data;
- g_object_set (child_node->child,
- "cursor_mode", etgc->cursor_mode,
- NULL);
- }
- break;
- default:
- break;
- }
-}
-
-static void
-etgc_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
-{
- ETableGroup *etg = E_TABLE_GROUP (object);
- ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER (object);
-
- switch (prop_id) {
- case PROP_FROZEN:
- g_value_set_boolean (value, etg->frozen);
- break;
- case PROP_HEIGHT:
- g_value_set_double (value, etgc->height);
- break;
- case PROP_WIDTH:
- g_value_set_double (value, etgc->width);
- break;
- case PROP_MINIMUM_WIDTH:
- g_value_set_double (value, etgc->minimum_width);
- break;
- case PROP_UNIFORM_ROW_HEIGHT:
- g_value_set_boolean (value, etgc->uniform_row_height);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-etgc_class_init (GObjectClass *object_class)
-{
- GnomeCanvasItemClass *item_class = (GnomeCanvasItemClass *) object_class;
- ETableGroupClass *e_group_class = E_TABLE_GROUP_CLASS(object_class);
-
- object_class->dispose = etgc_dispose;
- object_class->set_property = etgc_set_property;
- object_class->get_property = etgc_get_property;
-
- item_class->event = etgc_event;
- item_class->realize = etgc_realize;
- item_class->unrealize = etgc_unrealize;
-
- etgc_parent_class = g_type_class_ref (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;
-
- g_object_class_install_property (object_class, PROP_TABLE_ALTERNATING_ROW_COLORS,
- g_param_spec_boolean ("alternating_row_colors",
- _( "Alternating Row Colors" ),
- _( "Alternating Row Colors" ),
- FALSE,
- G_PARAM_WRITABLE));
-
- g_object_class_install_property (object_class, PROP_TABLE_HORIZONTAL_DRAW_GRID,
- g_param_spec_boolean ("horizontal_draw_grid",
- _( "Horizontal Draw Grid" ),
- _( "Horizontal Draw Grid" ),
- FALSE,
- G_PARAM_WRITABLE));
-
- g_object_class_install_property (object_class, PROP_TABLE_VERTICAL_DRAW_GRID,
- g_param_spec_boolean ("vertical_draw_grid",
- _( "Vertical Draw Grid" ),
- _( "Vertical Draw Grid" ),
- FALSE,
- G_PARAM_WRITABLE));
-
- g_object_class_install_property (object_class, PROP_TABLE_DRAW_FOCUS,
- g_param_spec_boolean ("drawfocus",
- _( "Draw focus" ),
- _( "Draw focus" ),
- FALSE,
- G_PARAM_WRITABLE));
-
- g_object_class_install_property (object_class, PROP_CURSOR_MODE,
- g_param_spec_int ("cursor_mode",
- _( "Cursor mode" ),
- _( "Cursor mode" ),
- E_CURSOR_LINE, E_CURSOR_SPREADSHEET, E_CURSOR_LINE,
- G_PARAM_WRITABLE));
-
- g_object_class_install_property (object_class, PROP_SELECTION_MODEL,
- g_param_spec_object ("selection_model",
- _( "Selection model" ),
- _( "Selection model" ),
- E_SELECTION_MODEL_TYPE,
- G_PARAM_WRITABLE));
-
- g_object_class_install_property (object_class, PROP_LENGTH_THRESHOLD,
- g_param_spec_int ("length_threshold",
- _( "Length Threshold" ),
- _( "Length Threshold" ),
- -1, G_MAXINT, 0,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_UNIFORM_ROW_HEIGHT,
- g_param_spec_boolean ("uniform_row_height",
- _( "Uniform row height" ),
- _( "Uniform row height" ),
- FALSE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_FROZEN,
- g_param_spec_boolean ("frozen",
- _( "Frozen" ),
- _( "Frozen" ),
- FALSE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_HEIGHT,
- g_param_spec_double ("height",
- _( "Height" ),
- _( "Height" ),
- 0.0, G_MAXDOUBLE, 0.0,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_WIDTH,
- g_param_spec_double ("width",
- _( "Width" ),
- _( "Width" ),
- 0.0, G_MAXDOUBLE, 0.0,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_MINIMUM_WIDTH,
- g_param_spec_double ("minimum_width",
- _( "Minimum width" ),
- _( "Minimum Width" ),
- 0.0, G_MAXDOUBLE, 0.0,
- G_PARAM_READWRITE));
-}
-
-static void
-etgc_reflow (GnomeCanvasItem *item, gint flags)
-{
- ETableGroupContainer *etgc = E_TABLE_GROUP_CONTAINER(item);
- gboolean frozen;
-
- g_object_get (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;
-
- g_object_get (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;
- g_object_get (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 */
- g_object_ref (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);
- }
-
- g_object_unref (etg);
- } else if (E_IS_TABLE_GROUP_LEAF (etg)){
- (*fn) (E_TABLE_GROUP_LEAF (etg)->item, closure);
- } else {
- g_error ("Unknown ETableGroup found: %s",
- g_type_name (G_TYPE_FROM_INSTANCE (etg)));
- }
-}
-
-
-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_find ("Helvetica", TEXT_HEIGHT);
-
- child_printable = groupcontext->child_printable;
- child = groupcontext->child;
-
- if (child_printable) {
- if (child)
- child_node = child->data;
- else
- child_node = NULL;
- g_object_ref (child_printable);
- } else {
- if (!child) {
- return;
- } else {
- child_node = child->data;
- child_printable = e_table_group_get_printable(child_node->child);
- if (child_printable)
- g_object_ref (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)
- g_object_unref (child_printable);
- child_printable = e_table_group_get_printable(child_node->child);
- if (child_printable)
- g_object_ref (child_printable);
- e_printable_reset(child_printable);
- }
-
- gp_draw_rect(context, 0, height, width, 1);
-
- if (groupcontext->child_printable)
- g_object_unref (groupcontext->child_printable);
- groupcontext->child_printable = child_printable;
- groupcontext->child = child;
-
-}
-
-static gboolean
-e_table_group_container_data_left (EPrintable *ep,
- ETGCPrintContext *groupcontext)
-{
- g_signal_stop_emission_by_name(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)
- g_object_unref (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)
- g_object_ref (child_printable);
- else {
- if (!child) {
- g_signal_stop_emission_by_name(ep, "height");
- return 0;
- } else {
- child_node = child->data;
- child_printable = e_table_group_get_printable(child_node->child);
- if (child_printable)
- g_object_ref (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)
- g_object_unref (child_printable);
- child_printable = e_table_group_get_printable(child_node->child);
- if (child_printable)
- g_object_ref (child_printable);
- e_printable_reset(child_printable);
- }
- if (child_printable)
- g_object_unref (child_printable);
- g_signal_stop_emission_by_name(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)
- g_object_ref (child_printable);
- else {
- if (!child) {
- g_signal_stop_emission_by_name(ep, "will_fit");
- return will_fit;
- } else {
- child_node = child->data;
- child_printable = e_table_group_get_printable(child_node->child);
- if (child_printable)
- g_object_ref (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)
- g_object_unref (child_printable);
- child_printable = e_table_group_get_printable(child_node->child);
- if (child_printable)
- g_object_ref (child_printable);
- e_printable_reset(child_printable);
- }
- }
-
- if (child_printable)
- g_object_unref (child_printable);
-
- g_signal_stop_emission_by_name(ep, "will_fit");
- return will_fit;
-}
-
-static void
-e_table_group_container_printable_destroy (gpointer data,
- GObject *where_object_was)
-
-{
- ETGCPrintContext *groupcontext = data;
-
- g_object_unref (groupcontext->etgc);
- if (groupcontext->child_printable)
- g_object_ref (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;
- g_object_ref (etgc);
- groupcontext->child = etgc->children;
- groupcontext->child_printable = NULL;
-
- g_signal_connect (printable,
- "print_page",
- G_CALLBACK(e_table_group_container_print_page),
- groupcontext);
- g_signal_connect (printable,
- "data_left",
- G_CALLBACK(e_table_group_container_data_left),
- groupcontext);
- g_signal_connect (printable,
- "reset",
- G_CALLBACK(e_table_group_container_reset),
- groupcontext);
- g_signal_connect (printable,
- "height",
- G_CALLBACK(e_table_group_container_height),
- groupcontext);
- g_signal_connect (printable,
- "will_fit",
- G_CALLBACK(e_table_group_container_will_fit),
- groupcontext);
- g_object_weak_ref (G_OBJECT (printable),
- 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 b094167c09..0000000000
--- a/widgets/table/e-table-group-container.h
+++ /dev/null
@@ -1,98 +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 <libgnomecanvas/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>
-
-G_BEGIN_DECLS
-
-#define E_TABLE_GROUP_CONTAINER_TYPE (e_table_group_container_get_type ())
-#define E_TABLE_GROUP_CONTAINER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_GROUP_CONTAINER_TYPE, ETableGroupContainer))
-#define E_TABLE_GROUP_CONTAINER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_GROUP_CONTAINER_TYPE, ETableGroupContainerClass))
-#define E_IS_TABLE_GROUP_CONTAINER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_GROUP_CONTAINER_TYPE))
-#define E_IS_TABLE_GROUP_CONTAINER_CLASS(k) (G_TYPE_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);
-
-GType e_table_group_container_get_type (void);
-
-G_END_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 083345ed74..0000000000
--- a/widgets/table/e-table-group-leaf.c
+++ /dev/null
@@ -1,686 +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 <libgnomecanvas/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/util/e-i18n.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 {
- PROP_0,
- PROP_HEIGHT,
- PROP_WIDTH,
- PROP_MINIMUM_WIDTH,
- PROP_FROZEN,
- PROP_TABLE_ALTERNATING_ROW_COLORS,
- PROP_TABLE_HORIZONTAL_DRAW_GRID,
- PROP_TABLE_VERTICAL_DRAW_GRID,
- PROP_TABLE_DRAW_FOCUS,
- PROP_CURSOR_MODE,
- PROP_LENGTH_THRESHOLD,
- PROP_SELECTION_MODEL,
- PROP_UNIFORM_ROW_HEIGHT
-};
-
-static void
-etgl_dispose (GObject *object)
-{
- ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF(object);
-
- if (etgl->ets) {
- g_object_unref (etgl->ets);
- etgl->ets = NULL;
- }
-
- if (etgl->item) {
- if (etgl->etgl_cursor_change_id != 0)
- g_signal_handler_disconnect (etgl->item,
- etgl->etgl_cursor_change_id);
- if (etgl->etgl_cursor_activated_id != 0)
- g_signal_handler_disconnect (etgl->item,
- etgl->etgl_cursor_activated_id);
- if (etgl->etgl_double_click_id != 0)
- g_signal_handler_disconnect (etgl->item,
- etgl->etgl_double_click_id);
- if (etgl->etgl_right_click_id != 0)
- g_signal_handler_disconnect (etgl->item,
- etgl->etgl_right_click_id);
- if (etgl->etgl_click_id != 0)
- g_signal_handler_disconnect (etgl->item,
- etgl->etgl_click_id);
- if (etgl->etgl_key_press_id != 0)
- g_signal_handler_disconnect (etgl->item,
- etgl->etgl_key_press_id);
- if (etgl->etgl_start_drag_id != 0)
- g_signal_handler_disconnect (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) {
- g_object_unref (etgl->selection_model);
- etgl->selection_model = NULL;
- }
-
- if (G_OBJECT_CLASS (etgl_parent_class)->dispose)
- G_OBJECT_CLASS (etgl_parent_class)->dispose (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 = g_object_new (E_TABLE_GROUP_LEAF_TYPE, NULL);
-
- 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);
-
- g_object_get(leaf->item,
- "height", &leaf->height,
- NULL);
- g_object_get(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 = g_signal_connect (etgl->item,
- "cursor_change",
- G_CALLBACK(etgl_cursor_change),
- etgl);
- etgl->etgl_cursor_activated_id = g_signal_connect (etgl->item,
- "cursor_activated",
- G_CALLBACK(etgl_cursor_activated),
- etgl);
- etgl->etgl_double_click_id = g_signal_connect (etgl->item,
- "double_click",
- G_CALLBACK(etgl_double_click),
- etgl);
-
- etgl->etgl_right_click_id = g_signal_connect (etgl->item,
- "right_click",
- G_CALLBACK(etgl_right_click),
- etgl);
- etgl->etgl_click_id = g_signal_connect (etgl->item,
- "click",
- G_CALLBACK(etgl_click),
- etgl);
- etgl->etgl_key_press_id = g_signal_connect (etgl->item,
- "key_press",
- G_CALLBACK(etgl_key_press),
- etgl);
- etgl->etgl_start_drag_id = g_signal_connect (etgl->item,
- "start_drag",
- G_CALLBACK(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_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
-{
- ETableGroup *etg = E_TABLE_GROUP (object);
- ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (object);
-
- switch (prop_id) {
- case PROP_FROZEN:
- etg->frozen = g_value_get_boolean (value);
- break;
- case PROP_MINIMUM_WIDTH:
- case PROP_WIDTH:
- etgl->minimum_width = g_value_get_double (value);
- if (etgl->item) {
- gnome_canvas_item_set (GNOME_CANVAS_ITEM(etgl->item),
- "minimum_width", etgl->minimum_width,
- NULL);
- }
- break;
- case PROP_LENGTH_THRESHOLD:
- etgl->length_threshold = g_value_get_int (value);
- if (etgl->item) {
- gnome_canvas_item_set (GNOME_CANVAS_ITEM(etgl->item),
- "length_threshold", etgl->length_threshold,
- NULL);
- }
- break;
- case PROP_SELECTION_MODEL:
- if (etgl->selection_model)
- g_object_unref(etgl->selection_model);
- etgl->selection_model = E_SELECTION_MODEL(g_value_get_object (value));
- if (etgl->selection_model) {
- g_object_ref(etgl->selection_model);
- }
- if (etgl->item) {
- gnome_canvas_item_set (GNOME_CANVAS_ITEM(etgl->item),
- "selection_model", etgl->selection_model,
- NULL);
- }
- break;
-
- case PROP_UNIFORM_ROW_HEIGHT:
- etgl->uniform_row_height = g_value_get_boolean (value);
- if (etgl->item) {
- gnome_canvas_item_set (GNOME_CANVAS_ITEM(etgl->item),
- "uniform_row_height", etgl->uniform_row_height,
- NULL);
- }
- break;
-
- case PROP_TABLE_ALTERNATING_ROW_COLORS:
- etgl->alternating_row_colors = g_value_get_boolean (value);
- if (etgl->item) {
- gnome_canvas_item_set (GNOME_CANVAS_ITEM(etgl->item),
- "alternating_row_colors", etgl->alternating_row_colors,
- NULL);
- }
- break;
-
- case PROP_TABLE_HORIZONTAL_DRAW_GRID:
- etgl->horizontal_draw_grid = g_value_get_boolean (value);
- if (etgl->item) {
- gnome_canvas_item_set (GNOME_CANVAS_ITEM(etgl->item),
- "horizontal_draw_grid", etgl->horizontal_draw_grid,
- NULL);
- }
- break;
-
- case PROP_TABLE_VERTICAL_DRAW_GRID:
- etgl->vertical_draw_grid = g_value_get_boolean (value);
- if (etgl->item) {
- gnome_canvas_item_set (GNOME_CANVAS_ITEM(etgl->item),
- "vertical_draw_grid", etgl->vertical_draw_grid,
- NULL);
- }
- break;
-
- case PROP_TABLE_DRAW_FOCUS:
- etgl->draw_focus = g_value_get_boolean (value);
- if (etgl->item) {
- gnome_canvas_item_set (GNOME_CANVAS_ITEM(etgl->item),
- "drawfocus", etgl->draw_focus,
- NULL);
- }
- break;
-
- case PROP_CURSOR_MODE:
- etgl->cursor_mode = g_value_get_int (value);
- if (etgl->item) {
- gnome_canvas_item_set (GNOME_CANVAS_ITEM(etgl->item),
- "cursor_mode", etgl->cursor_mode,
- NULL);
- }
- break;
- default:
- break;
- }
-}
-
-static void
-etgl_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
-{
- ETableGroup *etg = E_TABLE_GROUP (object);
- ETableGroupLeaf *etgl = E_TABLE_GROUP_LEAF (object);
-
- switch (prop_id) {
- case PROP_FROZEN:
- g_value_set_boolean (value, etg->frozen);
- break;
- case PROP_HEIGHT:
- g_value_set_double (value, etgl->height);
- break;
- case PROP_WIDTH:
- g_value_set_double (value, etgl->width);
- break;
- case PROP_MINIMUM_WIDTH:
- g_value_set_double (value, etgl->minimum_width);
- break;
- case PROP_UNIFORM_ROW_HEIGHT:
- g_value_set_boolean (value, etgl->uniform_row_height);
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-etgl_class_init (GObjectClass *object_class)
-{
- GnomeCanvasItemClass *item_class = (GnomeCanvasItemClass *) object_class;
- ETableGroupClass *e_group_class = E_TABLE_GROUP_CLASS(object_class);
-
- object_class->dispose = etgl_dispose;
- object_class->set_property = etgl_set_property;
- object_class->get_property = etgl_get_property;
-
- item_class->realize = etgl_realize;
-
- etgl_parent_class = g_type_class_ref (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;
-
- g_object_class_install_property (object_class, PROP_TABLE_ALTERNATING_ROW_COLORS,
- g_param_spec_boolean ("alternating_row_colors",
- _( "Alternating Row Colors" ),
- _( "Alternating Row Colors" ),
- FALSE,
- G_PARAM_WRITABLE));
-
- g_object_class_install_property (object_class, PROP_TABLE_HORIZONTAL_DRAW_GRID,
- g_param_spec_boolean ("horizontal_draw_grid",
- _( "Horizontal Draw Grid" ),
- _( "Horizontal Draw Grid" ),
- FALSE,
- G_PARAM_WRITABLE));
-
- g_object_class_install_property (object_class, PROP_TABLE_VERTICAL_DRAW_GRID,
- g_param_spec_boolean ("vertical_draw_grid",
- _( "Vertical Draw Grid" ),
- _( "Vertical Draw Grid" ),
- FALSE,
- G_PARAM_WRITABLE));
-
- g_object_class_install_property (object_class, PROP_TABLE_DRAW_FOCUS,
- g_param_spec_boolean ("drawfocus",
- _( "Draw focus" ),
- _( "Draw focus" ),
- FALSE,
- G_PARAM_WRITABLE));
-
- g_object_class_install_property (object_class, PROP_CURSOR_MODE,
- g_param_spec_int ("cursor_mode",
- _( "Cursor mode" ),
- _( "Cursor mode" ),
- E_CURSOR_LINE, E_CURSOR_SPREADSHEET, E_CURSOR_LINE,
- G_PARAM_WRITABLE));
-
- g_object_class_install_property (object_class, PROP_LENGTH_THRESHOLD,
- g_param_spec_int ("length_threshold",
- _( "Length Threshold" ),
- _( "Length Threshold" ),
- -1, G_MAXINT, 0,
- G_PARAM_WRITABLE));
-
- g_object_class_install_property (object_class, PROP_SELECTION_MODEL,
- g_param_spec_object ("selection_model",
- _( "Selection model" ),
- _( "Selection model" ),
- E_SELECTION_MODEL_TYPE,
- G_PARAM_WRITABLE));
-
- g_object_class_install_property (object_class, PROP_HEIGHT,
- g_param_spec_double ("height",
- _( "Height" ),
- _( "Height" ),
- 0.0, G_MAXDOUBLE, 0.0,
- G_PARAM_READABLE));
-
- g_object_class_install_property (object_class, PROP_WIDTH,
- g_param_spec_double ("width",
- _( "Width" ),
- _( "Width" ),
- 0.0, G_MAXDOUBLE, 0.0,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_MINIMUM_WIDTH,
- g_param_spec_double ("minimum_width",
- _( "Minimum width" ),
- _( "Minimum Width" ),
- 0.0, G_MAXDOUBLE, 0.0,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_FROZEN,
- g_param_spec_boolean ("frozen",
- _( "Frozen" ),
- _( "Frozen" ),
- FALSE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_UNIFORM_ROW_HEIGHT,
- g_param_spec_boolean ("uniform_row_height",
- _( "Uniform row height" ),
- _( "Uniform row height" ),
- FALSE,
- G_PARAM_READWRITE));
-}
-
-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 74fdfd8c03..0000000000
--- a/widgets/table/e-table-group-leaf.h
+++ /dev/null
@@ -1,90 +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 <libgnomecanvas/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>
-
-G_BEGIN_DECLS
-
-#define E_TABLE_GROUP_LEAF_TYPE (e_table_group_leaf_get_type ())
-#define E_TABLE_GROUP_LEAF(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_GROUP_LEAF_TYPE, ETableGroupLeaf))
-#define E_TABLE_GROUP_LEAF_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_GROUP_LEAF_TYPE, ETableGroupLeafClass))
-#define E_IS_TABLE_GROUP_LEAF(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_GROUP_LEAF_TYPE))
-#define E_IS_TABLE_GROUP_LEAF_CLASS(k) (G_TYPE_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);
-GType e_table_group_leaf_get_type (void);
-
-
-G_END_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 5bc8841cb4..0000000000
--- a/widgets/table/e-table-group.c
+++ /dev/null
@@ -1,712 +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 <libgnomecanvas/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_GET_CLASS(e)))
-
-static GnomeCanvasGroupClass *etg_parent_class;
-
-enum {
- CURSOR_CHANGE,
- CURSOR_ACTIVATED,
- DOUBLE_CLICK,
- RIGHT_CLICK,
- CLICK,
- KEY_PRESS,
- START_DRAG,
- LAST_SIGNAL
-};
-
-static guint etg_signals [LAST_SIGNAL] = { 0, };
-
-static gboolean etg_get_focus (ETableGroup *etg);
-
-static void
-etg_dispose (GObject *object)
-{
- ETableGroup *etg = E_TABLE_GROUP(object);
-
- if (etg->header) {
- g_object_unref (etg->header);
- etg->header = NULL;
- }
-
- if (etg->full_header) {
- g_object_unref (etg->full_header);
- etg->full_header = NULL;
- }
-
- if (etg->model) {
- g_object_unref (etg->model);
- etg->model = NULL;
- }
-
- if (G_OBJECT_CLASS (etg_parent_class)->dispose)
- G_OBJECT_CLASS (etg_parent_class)->dispose (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;
- g_object_ref (etg->full_header);
- etg->header = header;
- g_object_ref (etg->header);
- etg->model = model;
- g_object_ref (etg->model);
- g_object_set (G_OBJECT (etg),
- "parent", parent,
- 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));
-
- g_signal_emit (e_table_group,
- etg_signals [CURSOR_CHANGE], 0,
- 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));
-
- g_signal_emit (e_table_group,
- etg_signals [CURSOR_ACTIVATED], 0,
- 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));
-
- g_signal_emit (e_table_group,
- etg_signals [DOUBLE_CLICK], 0,
- 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);
-
- g_signal_emit (e_table_group,
- etg_signals [RIGHT_CLICK], 0,
- 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);
-
- g_signal_emit (e_table_group,
- etg_signals [CLICK], 0,
- 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);
-
- g_signal_emit (e_table_group,
- etg_signals [KEY_PRESS], 0,
- 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);
-
- g_signal_emit (e_table_group,
- etg_signals [START_DRAG], 0,
- 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 (GObjectClass *object_class)
-{
- GnomeCanvasItemClass *item_class = (GnomeCanvasItemClass *) object_class;
- ETableGroupClass *klass = (ETableGroupClass *) object_class;
-
- object_class->dispose = etg_dispose;
-
- 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 = g_type_class_ref (PARENT_TYPE);
-
- etg_signals [CURSOR_CHANGE] =
- g_signal_new ("cursor_change",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableGroupClass, cursor_change),
- NULL, NULL,
- e_marshal_NONE__INT,
- G_TYPE_NONE, 1, G_TYPE_INT);
-
- etg_signals [CURSOR_ACTIVATED] =
- g_signal_new ("cursor_activated",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableGroupClass, cursor_activated),
- NULL, NULL,
- e_marshal_NONE__INT,
- G_TYPE_NONE, 1, G_TYPE_INT);
-
- etg_signals [DOUBLE_CLICK] =
- g_signal_new ("double_click",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableGroupClass, double_click),
- NULL, NULL,
- e_marshal_NONE__INT_INT_BOXED,
- G_TYPE_NONE, 3, G_TYPE_INT,
- G_TYPE_INT, GDK_TYPE_EVENT);
-
- etg_signals [RIGHT_CLICK] =
- g_signal_new ("right_click",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableGroupClass, right_click),
- NULL, NULL,
- e_marshal_INT__INT_INT_BOXED,
- G_TYPE_INT, 3, G_TYPE_INT, G_TYPE_INT, GDK_TYPE_EVENT);
-
- etg_signals [CLICK] =
- g_signal_new ("click",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableGroupClass, click),
- NULL, NULL,
- e_marshal_INT__INT_INT_BOXED,
- G_TYPE_INT, 3, G_TYPE_INT,
- G_TYPE_INT, GDK_TYPE_EVENT);
-
- etg_signals [KEY_PRESS] =
- g_signal_new ("key_press",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableGroupClass, key_press),
- NULL, NULL,
- e_marshal_INT__INT_INT_BOXED,
- G_TYPE_INT, 3, G_TYPE_INT,
- G_TYPE_INT, GDK_TYPE_EVENT);
-
- etg_signals [START_DRAG] =
- g_signal_new ("start_drag",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableGroupClass, start_drag),
- NULL, NULL,
- e_marshal_INT__INT_INT_BOXED,
- G_TYPE_INT, 3, G_TYPE_INT,
- G_TYPE_INT, GDK_TYPE_EVENT);
-}
-
-E_MAKE_TYPE (e_table_group, "ETableGroup", ETableGroup, etg_class_init, NULL, PARENT_TYPE)
diff --git a/widgets/table/e-table-group.h b/widgets/table/e-table-group.h
deleted file mode 100644
index 2ecd34efe1..0000000000
--- a/widgets/table/e-table-group.h
+++ /dev/null
@@ -1,178 +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 <libgnomecanvas/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>
-
-G_BEGIN_DECLS
-
-#define E_TABLE_GROUP_TYPE (e_table_group_get_type ())
-#define E_TABLE_GROUP(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_GROUP_TYPE, ETableGroup))
-#define E_TABLE_GROUP_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_GROUP_TYPE, ETableGroupClass))
-#define E_IS_TABLE_GROUP(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_GROUP_TYPE))
-#define E_IS_TABLE_GROUP_CLASS(k) (G_TYPE_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);
-GType 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);
-
-G_END_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 3735011dc8..0000000000
--- a/widgets/table/e-table-header-item.c
+++ /dev/null
@@ -1,1837 +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 <gtk/gtkimage.h>
-#include <libgnomecanvas/gnome-canvas.h>
-#include <libgnomecanvas/gnome-canvas-util.h>
-#include <libgnomecanvas/gnome-canvas-polygon.h>
-#include <libgnomecanvas/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/util/e-marshal.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 {
- PROP_0,
- PROP_TABLE_HEADER,
- PROP_FULL_HEADER,
- PROP_DND_CODE,
- PROP_TABLE_FONTSET,
- PROP_SORT_INFO,
- PROP_TABLE,
- PROP_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_dispose (GObject *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)
- g_signal_handler_disconnect (ethi->sort_info, ethi->sort_info_changed_id);
- if (ethi->group_info_changed_id)
- g_signal_handler_disconnect (ethi->sort_info, ethi->group_info_changed_id);
- g_object_unref (ethi->sort_info);
- ethi->sort_info = NULL;
- }
-
- if (ethi->full_header)
- g_object_unref (ethi->full_header);
- ethi->full_header = NULL;
-
- if (ethi->config)
- g_object_unref (ethi->config);
- ethi->config = NULL;
-
- if (G_OBJECT_CLASS (ethi_parent_class)->dispose)
- (*G_OBJECT_CLASS (ethi_parent_class)->dispose) (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,
- GTK_WIDGET (GNOME_CANVAS_ITEM (ethi)->canvas));
-
- 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;
-#ifndef NO_WARNINGS
-#warning FOO BAA
-#endif
-#if 0
- gnome_canvas_group_child_bounds (GNOME_CANVAS_GROUP (item->parent), item);
-#endif
- }
- 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, const char *fontname)
-{
- GdkFont *font = NULL;
-
- if (fontname != NULL)
- font = gdk_fontset_load (fontname);
-
- if (font == NULL) {
- font = gtk_style_get_font (GTK_WIDGET (GNOME_CANVAS_ITEM (ethi)->canvas)->style);
- gdk_font_ref (font);
- }
-
- ethi_font_set (ethi, font);
- gdk_font_unref (font);
-}
-
-static void
-ethi_drop_table_header (ETableHeaderItem *ethi)
-{
- GObject *header;
-
- if (!ethi->eth)
- return;
-
- header = G_OBJECT (ethi->eth);
- g_signal_handler_disconnect (header, ethi->structure_change_id);
- g_signal_handler_disconnect (header, ethi->dimension_change_id);
-
- g_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;
- g_object_ref (ethi->eth);
-
- ethi->height = e_table_header_item_get_height (ethi);
-
- ethi->structure_change_id = g_signal_connect (
- header, "structure_change",
- G_CALLBACK (structure_changed), ethi);
- ethi->dimension_change_id = g_signal_connect (
- header, "dimension_change",
- G_CALLBACK (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_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- GnomeCanvasItem *item;
- ETableHeaderItem *ethi;
-
- item = GNOME_CANVAS_ITEM (object);
- ethi = E_TABLE_HEADER_ITEM (object);
-
- switch (prop_id){
- case PROP_TABLE_HEADER:
- ethi_drop_table_header (ethi);
- ethi_add_table_header (ethi, E_TABLE_HEADER(g_value_get_object (value)));
- break;
-
- case PROP_FULL_HEADER:
- if (ethi->full_header)
- g_object_unref(ethi->full_header);
- ethi->full_header = E_TABLE_HEADER(g_value_get_object (value));
- if (ethi->full_header)
- g_object_ref(ethi->full_header);
- break;
-
- case PROP_DND_CODE:
- g_free(ethi->dnd_code);
- ethi->dnd_code = g_strdup (g_value_get_string (value));
- break;
-
- case PROP_TABLE_FONTSET:
- ethi_font_load (ethi, g_value_get_string (value));
- break;
-
- case PROP_SORT_INFO:
- if (ethi->sort_info){
- if (ethi->sort_info_changed_id)
- g_signal_handler_disconnect (
- ethi->sort_info,
- ethi->sort_info_changed_id);
-
- if (ethi->group_info_changed_id)
- g_signal_handler_disconnect (
- ethi->sort_info,
- ethi->group_info_changed_id);
- g_object_unref (ethi->sort_info);
- }
- ethi->sort_info = g_value_get_object (value);
- g_object_ref (ethi->sort_info);
- ethi->sort_info_changed_id =
- g_signal_connect (
- ethi->sort_info, "sort_info_changed",
- G_CALLBACK (ethi_sort_info_changed), ethi);
- ethi->group_info_changed_id =
- g_signal_connect (
- ethi->sort_info, "group_info_changed",
- G_CALLBACK(ethi_sort_info_changed), ethi);
- break;
- case PROP_TABLE:
- if (g_value_get_object (value))
- ethi->table = E_TABLE(g_value_get_object (value));
- else
- ethi->table = NULL;
- break;
- case PROP_TREE:
- if (g_value_get_object (value))
- ethi->tree = E_TREE(g_value_get_object (value));
- else
- ethi->tree = NULL;
- break;
- }
- gnome_canvas_item_request_update(item);
-}
-
-static void
-ethi_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- ETableHeaderItem *ethi;
-
- ethi = E_TABLE_HEADER_ITEM (object);
-
- switch (prop_id){
- case PROP_FULL_HEADER:
- g_value_set_object (value, ethi->full_header);
- break;
- case PROP_DND_CODE:
- g_value_set_string (value, g_strdup (ethi->dnd_code));
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- 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_colormap (gdk_rgb_get_cmap ());
- win = gtk_window_new (GTK_WINDOW_POPUP);
-
- pix = gtk_image_new_from_pixmap (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_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)
-{
- d(g_print("In do_drag_motion\n"));
- d(g_print("x = %d, y = %d, ethi->width = %d, ethi->height = %d\n", x, y, ethi->width, ethi->height));
-
- if ((x >= 0) && (x <= (ethi->width)) &&
- (y >= 0) && (y <= (ethi->height))){
- int col;
- d(g_print("In header\n"));
-
- 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;
-
- ethi->last_drop_x = 0;
- ethi->last_drop_y = 0;
- ethi->last_drop_time = 0;
- ethi->last_drop_context = NULL;
- scroll_off (ethi);
-
- g_object_unref (ethi);
-}
-
-static void
-context_connect (ETableHeaderItem *ethi, GdkDragContext *context)
-{
- if (g_dataset_get_data (context, "e-table-header-item") == NULL) {
- g_object_ref (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 (GDK_POINTER_TO_ATOM (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);
-
- d(g_print ("y = %d, widget->allocation.y = %d, GTK_LAYOUT (widget)->vadjustment->value = %f\n", y, widget->allocation.y, GTK_LAYOUT (widget)->vadjustment->value));
-
- 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);
- d(g_print ("ethi - %s\n", target));
- 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_style_get_font (GTK_WIDGET (item->canvas)->style));
-
- /*
- * 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 = g_signal_connect (item->canvas, "drag_motion",
- G_CALLBACK (ethi_drag_motion), ethi);
- ethi->drag_leave_id = g_signal_connect (item->canvas, "drag_leave",
- G_CALLBACK (ethi_drag_leave), ethi);
- ethi->drag_drop_id = g_signal_connect (item->canvas, "drag_drop",
- G_CALLBACK (ethi_drag_drop), ethi);
- ethi->drag_data_received_id = g_signal_connect (item->canvas, "drag_data_received",
- G_CALLBACK (ethi_drag_data_received), ethi);
-
- /* Drag signals */
- ethi->drag_end_id = g_signal_connect (item->canvas, "drag_end",
- G_CALLBACK (ethi_drag_end), ethi);
- ethi->drag_data_get_id = g_signal_connect (item->canvas, "drag_data_get",
- G_CALLBACK (ethi_drag_data_get), ethi);
-
-}
-
-static void
-ethi_unrealize (GnomeCanvasItem *item)
-{
- ETableHeaderItem *ethi = E_TABLE_HEADER_ITEM (item);
-
- gdk_font_unref (ethi->font);
-
- g_signal_handler_disconnect (item->canvas, ethi->drag_motion_id);
- g_signal_handler_disconnect (item->canvas, ethi->drag_leave_id);
- g_signal_handler_disconnect (item->canvas, ethi->drag_drop_id);
- g_signal_handler_disconnect (item->canvas, ethi->drag_data_received_id);
-
- g_signal_handler_disconnect (item->canvas, ethi->drag_end_id);
- g_signal_handler_disconnect (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_DOWN :
- E_TABLE_COL_ARROW_UP));
- }
- 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_DOWN :
- E_TABLE_COL_ARROW_UP));
- }
- }
-
- 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,
- 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_DOWN :
- E_TABLE_COL_ARROW_UP));
- }
- 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_DOWN :
- E_TABLE_COL_ARROW_UP));
- }
- }
-
- 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,
- 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();
- g_object_set(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;
-
- g_signal_emit_by_name (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 (gpointer data, GObject *where_object_was)
-{
- ETableHeaderItem *ethi = data;
- 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, NULL);
- g_object_weak_ref (G_OBJECT (ethi->config),
- config_destroyed, ethi);
- g_signal_connect (
- ethi->config, "changed",
- G_CALLBACK (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"), G_CALLBACK(ethi_popup_sort_ascending), 2),
- E_POPUP_ITEM (N_("Sort Descending"), G_CALLBACK(ethi_popup_sort_descending), 2),
- E_POPUP_ITEM (N_("Unsort"), G_CALLBACK(ethi_popup_unsort), 0),
- E_POPUP_SEPARATOR,
- E_POPUP_ITEM (N_("Group By This Field"), G_CALLBACK(ethi_popup_group_field), 16),
- E_POPUP_ITEM (N_("Group By Box"), G_CALLBACK(ethi_popup_group_box), 128),
- E_POPUP_SEPARATOR,
- E_POPUP_ITEM (N_("Remove This Column"), G_CALLBACK(ethi_popup_remove_column), 8),
- E_POPUP_ITEM (N_("Add a Column..."), G_CALLBACK(ethi_popup_field_chooser), 0),
- E_POPUP_SEPARATOR,
- E_POPUP_ITEM (N_("Alignment"), G_CALLBACK(ethi_popup_alignment), 128),
- E_POPUP_ITEM (N_("Best Fit"), G_CALLBACK(ethi_popup_best_fit), 2),
- E_POPUP_ITEM (N_("Format Columns..."), G_CALLBACK(ethi_popup_format_columns), 128),
- E_POPUP_SEPARATOR,
- E_POPUP_ITEM (N_("Customize Current View..."), G_CALLBACK(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_with_domain (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, E_I18N_DOMAIN);
- g_object_ref (popup);
- gtk_object_sink (GTK_OBJECT (popup));
- g_signal_connect (popup, "selection-done",
- G_CALLBACK (free_popup_info), info);
- e_popup_menu (popup, (GdkEvent *) event);
-}
-
-static void
-ethi_button_pressed (ETableHeaderItem *ethi, GdkEventButton *event)
-{
- g_signal_emit (ethi,
- ethi_signals [BUTTON_PRESSED], 0, 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;
- g_signal_emit_by_name (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 (GObjectClass *object_class)
-{
- GnomeCanvasItemClass *item_class = (GnomeCanvasItemClass *) object_class;
-
- ethi_parent_class = g_type_class_ref (PARENT_OBJECT_TYPE);
-
- object_class->dispose = ethi_dispose;
- object_class->set_property = ethi_set_property;
- object_class->get_property = ethi_get_property;
-
- 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;
-
- g_object_class_install_property (object_class, PROP_DND_CODE,
- g_param_spec_string ("dnd_code",
- _("DnD code"),
- /*_( */"XXX blurb" /*)*/,
- NULL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_TABLE_FONTSET,
- g_param_spec_string ("fontset",
- _("Fontset"),
- /*_( */"XXX blurb" /*)*/,
- NULL,
- G_PARAM_WRITABLE));
-
- g_object_class_install_property (object_class, PROP_FULL_HEADER,
- g_param_spec_object ("full_header",
- _("Full Header"),
- /*_( */"XXX blurb" /*)*/,
- E_TABLE_HEADER_TYPE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_TABLE_HEADER,
- g_param_spec_object ("ETableHeader",
- _("Header"),
- /*_( */"XXX blurb" /*)*/,
- E_TABLE_HEADER_TYPE,
- G_PARAM_WRITABLE));
-
- g_object_class_install_property (object_class, PROP_SORT_INFO,
- g_param_spec_object ("sort_info",
- _("Sort Info"),
- /*_( */"XXX blurb" /*)*/,
- E_TABLE_SORT_INFO_TYPE,
- G_PARAM_WRITABLE));
-
- g_object_class_install_property (object_class, PROP_TABLE,
- g_param_spec_object ("table",
- _("Table"),
- /*_( */"XXX blurb" /*)*/,
- E_TABLE_TYPE,
- G_PARAM_WRITABLE));
-
- g_object_class_install_property (object_class, PROP_TREE,
- g_param_spec_object ("tree",
- _("Tree"),
- /*_( */"XXX blurb" /*)*/,
- E_TREE_TYPE,
- G_PARAM_WRITABLE));
-
- /*
- * 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] =
- g_signal_new ("button_pressed",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableHeaderItemClass, button_pressed),
- NULL, NULL,
- e_marshal_NONE__BOXED,
- G_TYPE_NONE, 1, GDK_TYPE_EVENT);
-}
-
-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;
-}
-
-E_MAKE_TYPE (e_table_header_item,
- "ETableHeaderItem",
- ETableHeaderItem,
- ethi_class_init,
- ethi_init,
- PARENT_OBJECT_TYPE)
diff --git a/widgets/table/e-table-header-item.h b/widgets/table/e-table-header-item.h
deleted file mode 100644
index 3eebddeefc..0000000000
--- a/widgets/table/e-table-header-item.h
+++ /dev/null
@@ -1,114 +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 <libgnomecanvas/gnome-canvas.h>
-#include <libxml/tree.h>
-#include <gal/e-table/e-table-header.h>
-#include <gal/e-table/e-table-sort-info.h>
-
-G_BEGIN_DECLS
-
-#define E_TABLE_HEADER_ITEM_TYPE (e_table_header_item_get_type ())
-#define E_TABLE_HEADER_ITEM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_HEADER_ITEM_TYPE, ETableHeaderItem))
-#define E_TABLE_HEADER_ITEM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_HEADER_ITEM_TYPE, ETableHeaderItemClass))
-#define E_IS_TABLE_HEADER_ITEM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_HEADER_ITEM_TYPE))
-#define E_IS_TABLE_HEADER_ITEM_CLASS(k) (G_TYPE_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;
-
-GType e_table_header_item_get_type (void);
-
-G_END_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 b9a0b9b8e5..0000000000
--- a/widgets/table/e-table-header-utils.c
+++ /dev/null
@@ -1,481 +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 "e-table-header-utils.h"
-
-#include <string.h> /* strlen() */
-#include <glib.h>
-#include <gtk/gtkbutton.h>
-#include <gtk/gtkwindow.h>
-#include "e-table-defines.h"
-#include <gal/widgets/e-unicode.h>
-
-
-
-static PangoLayout*
-build_header_layout (GtkWidget *widget, const char *str)
-{
- PangoLayout *layout;
-
- layout = gtk_widget_create_pango_layout (widget, str);
-
-#ifdef FROB_FONT_DESC
- {
- PangoFontDescription *desc;
- desc = pango_font_description_copy (gtk_widget_get_style (widget)->font_desc);
- pango_font_description_set_size (desc,
- pango_font_description_get_size (desc) * 1.2);
-
- pango_font_description_set_weight (desc, PANGO_WEIGHT_BOLD);
- pango_layout_set_font_description (layout, desc);
-
- pango_font_description_free (desc);
- }
-#endif
-
- return layout;
-}
-
-/**
- * e_table_header_compute_height:
- * @ecol: Table column description.
- * @widget: The widget from which to build the PangoLayout.
- *
- * 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, GtkWidget *widget)
-{
- int ythick;
- int height;
- PangoLayout *layout;
-
- g_return_val_if_fail (ecol != NULL, -1);
- g_return_val_if_fail (E_IS_TABLE_COL (ecol), -1);
- g_return_val_if_fail (GTK_IS_WIDGET (widget), -1);
-
- ythick = gtk_widget_get_style (widget)->ythickness;
-
- layout = build_header_layout (widget, ecol->text);
-
- pango_layout_get_pixel_size (layout, NULL, &height);
-
- 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);
-
- g_object_unref (layout);
-
- return height;
-}
-
-double
-e_table_header_width_extras (GtkStyle *style)
-{
- g_return_val_if_fail (style != NULL, -1);
-
- return 2 * (style->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;
-}
-
-/* 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.
- * @layout: the PangoLayout to draw.
- * @str: the string we're drawing, passed in so we can change the layout if it needs eliding.
- * @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.
- **/
-static void
-e_table_draw_elided_string (GdkDrawable *drawable, GdkGC *gc, GtkWidget *widget,
- int x, int y, PangoLayout *layout, char *str,
- int max_width, gboolean center)
-{
- int width;
- int height;
- int index;
- GSList *lines;
- PangoLayoutLine *line;
-
- g_return_if_fail (drawable != NULL);
- g_return_if_fail (gc != NULL);
- g_return_if_fail (layout != NULL);
- g_return_if_fail (max_width >= 0);
-
- pango_layout_get_pixel_size (layout, &width, &height);
-
- gdk_gc_set_clip_rectangle (gc, NULL);
-
- if (width <= max_width) {
- int xpos;
-
- if (center)
- xpos = x + (max_width - width) / 2;
- else
- xpos = x;
-
- gdk_draw_layout (drawable, gc,
- xpos, y,
- layout);
- } else {
- int arrow_width;
- int i;
-
- if (max_width < ARROW_WIDTH + 1)
- arrow_width = max_width - 1;
- else
- arrow_width = ARROW_WIDTH;
-
-
- lines = pango_layout_get_lines (layout);
- line = lines->data;
-
- if (!pango_layout_line_x_to_index (line,
- (max_width - arrow_width) * PANGO_SCALE,
- &index,
- NULL)) {
- g_warning ("pango_layout_line_x_to_index returned false");
- return;
- }
-
- pango_layout_set_text (layout, str, index);
-
- gdk_draw_layout (drawable, gc, x, y, layout);
-
- for (i = 0; i < arrow_width; i++) {
- int h;
-
- h = 2 * i + 1;
-
- gdk_draw_line (drawable, gc,
- x + max_width - i,
- y + height / 2 - i,
- x + max_width - i,
- y + height / 2 + i + 1);
- }
- }
-}
-
-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.
- * @state: State of the table widget.
- * @widget: The table widget.
- * @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, 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;
- char *text;
- PangoLayout *layout;
-
- 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 (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[state];
-
- gdk_gc_set_clip_rectangle (gc, NULL);
-
- xthick = style->xthickness;
- ythick = style->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 */
-
- layout = build_header_layout (widget, ecol->text);
-
- /* 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 width;
- int ypos;
-
- pango_layout_get_pixel_size (layout, &width, NULL);
-
- if (width < inner_width - (pwidth + 1)) {
- xpos = inner_x + (inner_width - width - (pwidth + 1)) / 2;
- }
-
- ypos = inner_y;
-
- e_table_draw_elided_string (drawable, gc, widget,
- xpos + pwidth + 1, ypos,
- layout, 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);
-
- gdk_gc_set_clip_rectangle (gc, NULL);
-
- 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 {
- e_table_draw_elided_string (drawable, gc, widget,
- inner_x, inner_y,
- layout, ecol->text, inner_width, TRUE);
- }
-
- g_object_unref (layout);
-}
diff --git a/widgets/table/e-table-header-utils.h b/widgets/table/e-table-header-utils.h
deleted file mode 100644
index 38defa9261..0000000000
--- a/widgets/table/e-table-header-utils.h
+++ /dev/null
@@ -1,55 +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,
- GtkWidget *widget);
-double e_table_header_width_extras (GtkStyle *style);
-void e_table_header_draw_button (GdkDrawable *drawable,
- ETableCol *ecol,
- GtkStyle *style,
- GtkStateType state,
- GtkWidget *widget,
- int x,
- int y,
- int width,
- int height,
- int button_width,
- int button_height,
- ETableColArrow arrow);
-
-#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 d810d61bd1..0000000000
--- a/widgets/table/e-table-header.c
+++ /dev/null
@@ -1,952 +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 <glib-object.h>
-#include <gtk/gtkimage.h>
-#include <gal/util/e-util.h>
-#include "e-table-header.h"
-#include "e-table-defines.h"
-#include "gal/util/e-util.h"
-
-/* The arguments we take */
-enum {
- PROP_0,
- PROP_SORT_INFO,
- PROP_WIDTH,
- PROP_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 GObjectClass *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)
- g_object_unref (eth->columns [idx]);
-
- memmove (&eth->columns [idx], &eth->columns [idx+1],
- sizeof (ETableCol *) * (eth->col_count - idx - 1));
- eth->col_count--;
-}
-
-static void
-eth_finalize (GObject *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)
- g_signal_handler_disconnect(G_OBJECT(eth->sort_info),
- eth->sort_info_group_change_id);
- g_object_unref(eth->sort_info);
- eth->sort_info = NULL;
- }
-
- if (eth->idle)
- g_source_remove(eth->idle);
- eth->idle = 0;
-
- if (eth->change_queue) {
- g_slist_foreach(eth->change_queue, (GFunc) g_free, NULL);
- g_slist_free(eth->change_queue);
- eth->change_queue = NULL;
- }
-
- /*
- * Destroy columns
- */
- for (i = cols - 1; i >= 0; i--){
- eth_do_remove (eth, i, TRUE);
- }
- g_free (eth->columns);
-
- eth->col_count = 0;
- eth->columns = NULL;
-
- if (e_table_header_parent_class->finalize)
- e_table_header_parent_class->finalize (object);
-}
-
-static void
-eth_group_info_changed(ETableSortInfo *info, ETableHeader *eth)
-{
- enqueue(eth, -1, eth->nominal_width);
-}
-
-static void
-eth_set_property (GObject *object, guint prop_id, const GValue *val, GParamSpec *pspec)
-{
- ETableHeader *eth = E_TABLE_HEADER (object);
-
- switch (prop_id) {
- case PROP_WIDTH:
- eth->nominal_width = g_value_get_double (val);
- enqueue(eth, -1, eth->nominal_width);
- break;
- case PROP_WIDTH_EXTRAS:
- eth->width_extras = g_value_get_double (val);
- enqueue(eth, -1, eth->nominal_width);
- break;
- case PROP_SORT_INFO:
- if (eth->sort_info) {
- if (eth->sort_info_group_change_id)
- g_signal_handler_disconnect(G_OBJECT(eth->sort_info), eth->sort_info_group_change_id);
- g_object_unref (eth->sort_info);
- }
- eth->sort_info = E_TABLE_SORT_INFO(g_value_get_object (val));
- if (eth->sort_info) {
- g_object_ref(eth->sort_info);
- eth->sort_info_group_change_id
- = g_signal_connect(G_OBJECT(eth->sort_info), "group_info_changed",
- G_CALLBACK(eth_group_info_changed), eth);
- }
- enqueue(eth, -1, eth->nominal_width);
- break;
- default:
- break;
- }
-}
-
-static void
-eth_get_property (GObject *object, guint prop_id, GValue *val, GParamSpec *pspec)
-{
- ETableHeader *eth = E_TABLE_HEADER (object);
-
- switch (prop_id) {
- case PROP_SORT_INFO:
- g_value_set_object (val, G_OBJECT(eth->sort_info));
- break;
- case PROP_WIDTH:
- g_value_set_double (val, eth->nominal_width);
- break;
- case PROP_WIDTH_EXTRAS:
- g_value_set_double (val, eth->width_extras);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-e_table_header_class_init (GObjectClass *object_class)
-{
- ETableHeaderClass *klass = E_TABLE_HEADER_CLASS (object_class);
-
- object_class->finalize = eth_finalize;
- object_class->set_property = eth_set_property;
- object_class->get_property = eth_get_property;
-
- e_table_header_parent_class = g_type_class_peek_parent (object_class);
-
- g_object_class_install_property (
- object_class, PROP_WIDTH,
- g_param_spec_double ("width", "Width", "Width",
- 0.0, G_MAXDOUBLE, 0.0,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (
- object_class, PROP_WIDTH_EXTRAS,
- g_param_spec_double ("width_extras", "Width of Extras", "Width of Extras",
- 0.0, G_MAXDOUBLE, 0.0,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (
- object_class, PROP_SORT_INFO,
- g_param_spec_object ("sort_info", "Sort Info", "Sort Info",
- E_TABLE_SORT_INFO_TYPE,
- G_PARAM_READWRITE));
-
- eth_signals [STRUCTURE_CHANGE] =
- g_signal_new ("structure_change",
- E_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableHeaderClass, structure_change),
- (GSignalAccumulator) NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
- eth_signals [DIMENSION_CHANGE] =
- g_signal_new ("dimension_change",
- E_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableHeaderClass, dimension_change),
- (GSignalAccumulator) NULL, NULL,
- g_cclosure_marshal_VOID__INT,
- G_TYPE_NONE, 1, G_TYPE_INT);
- eth_signals [EXPANSION_CHANGE] =
- g_signal_new ("expansion_change",
- E_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableHeaderClass, expansion_change),
- (GSignalAccumulator) NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
- eth_signals [REQUEST_WIDTH] =
- g_signal_new ("request_width",
- E_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableHeaderClass, request_width),
- (GSignalAccumulator) NULL, NULL,
- e_marshal_INT__INT,
- G_TYPE_INT, 1, G_TYPE_INT);
-
- 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)
-{
-
- return (ETableHeader *) g_object_new (E_TABLE_HEADER_TYPE, NULL);
-}
-
-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
- */
- g_object_ref (tc);
-
- eth_do_insert (eth, pos, tc);
-
- enqueue(eth, -1, eth->nominal_width);
- g_signal_emit (G_OBJECT (eth), eth_signals [STRUCTURE_CHANGE], 0);
-}
-
-/**
- * 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 g_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++) {
- g_object_ref(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);
-
- g_signal_emit (G_OBJECT (eth), eth_signals [DIMENSION_CHANGE], 0, eth->width);
- g_signal_emit (G_OBJECT (eth), eth_signals [STRUCTURE_CHANGE], 0);
-}
-
-/**
- * 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);
- g_signal_emit (G_OBJECT (eth), eth_signals [STRUCTURE_CHANGE], 0);
-}
-
-/*
- * 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;
- }
-
- g_signal_emit (G_OBJECT (eth), eth_signals [EXPANSION_CHANGE], 0);
- 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;
- }
- g_signal_emit (G_OBJECT (eth), eth_signals [EXPANSION_CHANGE], 0);
- 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;
- }
- g_signal_emit (G_OBJECT (eth), eth_signals [EXPANSION_CHANGE], 0);
- 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;
- }
- }
- g_signal_emit (G_OBJECT (eth), eth_signals [EXPANSION_CHANGE], 0);
- 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;
- }
- }
- g_signal_emit (G_OBJECT (eth), eth_signals [EXPANSION_CHANGE], 0);
-}
-
-/**
- * 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)
- g_signal_emit (G_OBJECT (eth), eth_signals [DIMENSION_CHANGE], 0, 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;
-
- g_signal_emit_by_name (G_OBJECT (eth),
- "request_width",
- i, &width);
- eth->columns[i]->min_width = width + 10;
- eth->columns[i]->expansion = 1;
- }
- enqueue(eth, -1, eth->nominal_width);
- g_signal_emit (G_OBJECT (eth), eth_signals [EXPANSION_CHANGE], 0);
-}
-
-E_MAKE_TYPE(e_table_header, "ETableHeader", ETableHeader, e_table_header_class_init, e_table_header_init, G_TYPE_OBJECT)
-
-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;
-}
-
-ETableCol *
-e_table_header_prioritized_column_selected (ETableHeader *eth, ETableColCheckFunc check_func, gpointer user_data)
-{
- ETableCol *best_col = NULL;
- int best_priority = G_MININT;
- int i;
- int count;
-
- count = e_table_header_count (eth);
- if (count == 0)
- return NULL;
- for (i = 1; i < count; i++) {
- ETableCol *col = e_table_header_get_column (eth, i);
- if (col) {
- if ((best_col == NULL || col->priority > best_priority) && check_func (col, user_data)) {
- best_priority = col->priority;
- best_col = col;
- }
- }
- }
- return best_col;
-}
diff --git a/widgets/table/e-table-header.h b/widgets/table/e-table-header.h
deleted file mode 100644
index 3a9ae6a0bf..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 <glib-object.h>
-#include <gdk/gdk.h>
-#include <gal/e-table/e-table-sort-info.h>
-#include <gal/e-table/e-table-col.h>
-
-G_BEGIN_DECLS
-
-typedef struct _ETableHeader ETableHeader;
-
-#define E_TABLE_HEADER_TYPE (e_table_header_get_type ())
-#define E_TABLE_HEADER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_HEADER_TYPE, ETableHeader))
-#define E_TABLE_HEADER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_HEADER_TYPE, ETableHeaderClass))
-#define E_IS_TABLE_HEADER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_HEADER_TYPE))
-#define E_IS_TABLE_HEADER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TABLE_HEADER_TYPE))
-#define E_TABLE_HEADER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), E_TABLE_HEADER_TYPE, ETableHeaderClass))
-
-typedef gboolean (*ETableColCheckFunc) (ETableCol *col, gpointer user_data);
-
-/*
- * A Columnar header.
- */
-struct _ETableHeader {
- GObject 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 {
- GObjectClass 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;
-
-GType 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);
-ETableCol *e_table_header_prioritized_column_selected (ETableHeader *eth,
- ETableColCheckFunc check_func,
- gpointer user_data);
-
-G_END_DECLS
-
-#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 ea2dc4297f..0000000000
--- a/widgets/table/e-table-item.c
+++ /dev/null
@@ -1,3674 +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 <X11/Xlib.h>
-
-#include <math.h>
-#include <stdio.h>
-#include <gtk/gtksignal.h>
-#include <gtk/gtkmain.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 "gal/util/e-i18n.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 guint eti_signals [LAST_SIGNAL] = { 0, };
-
-enum {
- PROP_0,
- PROP_TABLE_HEADER,
- PROP_TABLE_MODEL,
- PROP_SELECTION_MODEL,
- PROP_TABLE_ALTERNATING_ROW_COLORS,
- PROP_TABLE_HORIZONTAL_DRAW_GRID,
- PROP_TABLE_VERTICAL_DRAW_GRID,
- PROP_TABLE_DRAW_FOCUS,
- PROP_CURSOR_MODE,
- PROP_LENGTH_THRESHOLD,
- PROP_CURSOR_ROW,
- PROP_UNIFORM_ROW_HEIGHT,
-
- PROP_MINIMUM_WIDTH,
- PROP_WIDTH,
- PROP_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;
-}
-
-static void
-grab_cancelled (ECanvas *canvas, GnomeCanvasItem *item, gpointer data)
-{
- ETableItem *eti = data;
-
- eti->grab_cancelled = TRUE;
-}
-
-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;
- eti->grab_cancelled = FALSE;
- if (e_canvas_item_grab(E_CANVAS (item->canvas),
- 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,
- grab_cancelled,
- eti) != GrabSuccess) {
- 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->grab_cancelled) {
- eti->grab_cancelled = FALSE;
- } else {
- if (eti->gtk_grabbed) {
- d(g_print ("%s: gtk_grab_remove\n", __FUNCTION__));
- gtk_grab_remove (GTK_WIDGET (item->canvas));
- eti->gtk_grabbed = FALSE;
- }
- gnome_canvas_item_ungrab(item, time);
- eti->grabbed_col = -1;
- eti->grabbed_row = -1;
- }
- }
-}
-
-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.07f);
- 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->fg [GTK_STATE_SELECTED];
- else
- foreground = &canvas->style->fg [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;
-
- g_signal_handler_disconnect (G_OBJECT (eti->table_model),
- eti->table_model_pre_change_id);
- g_signal_handler_disconnect (G_OBJECT (eti->table_model),
- eti->table_model_no_change_id);
- g_signal_handler_disconnect (G_OBJECT (eti->table_model),
- eti->table_model_change_id);
- g_signal_handler_disconnect (G_OBJECT (eti->table_model),
- eti->table_model_row_change_id);
- g_signal_handler_disconnect (G_OBJECT (eti->table_model),
- eti->table_model_cell_change_id);
- g_signal_handler_disconnect (G_OBJECT (eti->table_model),
- eti->table_model_rows_inserted_id);
- g_signal_handler_disconnect (G_OBJECT (eti->table_model),
- eti->table_model_rows_deleted_id);
- g_object_unref (eti->table_model);
- if (eti->source_model)
- g_object_unref (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;
-
- g_signal_handler_disconnect (eti->selection,
- eti->selection_change_id);
- g_signal_handler_disconnect (eti->selection,
- eti->selection_row_change_id);
- g_signal_handler_disconnect (eti->selection,
- eti->cursor_change_id);
- g_signal_handler_disconnect (eti->selection,
- eti->cursor_activated_id);
- g_object_unref (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;
-
- g_signal_handler_disconnect (G_OBJECT (eti->header),
- eti->header_structure_change_id);
- g_signal_handler_disconnect (G_OBJECT (eti->header),
- eti->header_dim_change_id);
- g_signal_handler_disconnect (G_OBJECT (eti->header),
- eti->header_request_width_id);
-
- if (eti->cell_views){
- eti_unrealize_cell_views (eti);
- eti_detach_cell_views (eti);
- }
- g_object_unref (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;
- }
-
-#if 0
- g_object_get(eti->selection,
- "cursor_row", &cursor_row,
- NULL);
-#else
- cursor_row = e_selection_model_cursor_row (eti->selection);
-#endif
-
- 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;
- }
-
- if (!((GTK_OBJECT_FLAGS(eti) & GNOME_CANVAS_ITEM_REALIZED) && eti->cell_views_realized))
- return;
-
- if (eti->frozen_count > 0) {
- return;
- }
-
- g_object_get(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 (eti->selection) {
- eti_show_cursor (eti, 0);
- eti_check_cursor_bounds (eti);
- }
-
- eti->cursor_idle_id = 0;
- g_object_unref (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) {
- g_object_ref (eti);
- if (!eti->cursor_idle_id)
- eti->cursor_idle_id = 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;
- }
-
- eti->rows = e_table_model_row_count (eti->table_model);
-
- if (eti->height_cache && (eti->rows > row)) {
- 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));
-
- g_object_get(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)
-{
- if (row != -1)
- 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;
- g_object_ref (eti->table_model);
-
- eti->table_model_pre_change_id = g_signal_connect (
- G_OBJECT (table_model), "model_pre_change",
- G_CALLBACK (eti_table_model_pre_change), eti);
-
- eti->table_model_no_change_id = g_signal_connect (
- G_OBJECT (table_model), "model_no_change",
- G_CALLBACK (eti_table_model_no_change), eti);
-
- eti->table_model_change_id = g_signal_connect (
- G_OBJECT (table_model), "model_changed",
- G_CALLBACK (eti_table_model_changed), eti);
-
- eti->table_model_row_change_id = g_signal_connect (
- G_OBJECT (table_model), "model_row_changed",
- G_CALLBACK (eti_table_model_row_changed), eti);
-
- eti->table_model_cell_change_id = g_signal_connect (
- G_OBJECT (table_model), "model_cell_changed",
- G_CALLBACK (eti_table_model_cell_changed), eti);
-
- eti->table_model_rows_inserted_id = g_signal_connect (
- G_OBJECT (table_model), "model_rows_inserted",
- G_CALLBACK (eti_table_model_rows_inserted), eti);
-
- eti->table_model_rows_deleted_id = g_signal_connect (
- G_OBJECT (table_model), "model_rows_deleted",
- G_CALLBACK (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)
- g_object_ref(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;
- g_object_ref (eti->selection);
-
- eti->selection_change_id = g_signal_connect (
- selection, "selection_changed",
- G_CALLBACK (eti_selection_change), eti);
-
- eti->selection_row_change_id = g_signal_connect (
- selection, "selection_row_changed",
- G_CALLBACK (eti_selection_row_change), eti);
-
- eti->cursor_change_id = g_signal_connect (
- selection, "cursor_changed",
- G_CALLBACK (eti_cursor_change), eti);
-
- eti->cursor_activated_id = g_signal_connect (
- selection, "cursor_activated",
- G_CALLBACK (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;
- g_object_ref (header);
-
- eti_header_structure_changed (header, eti);
-
- eti->header_dim_change_id = g_signal_connect (
- G_OBJECT (header), "dimension_change",
- G_CALLBACK (eti_header_dim_changed), eti);
-
- eti->header_structure_change_id = g_signal_connect (
- G_OBJECT (header), "structure_change",
- G_CALLBACK (eti_header_structure_changed), eti);
-
- eti->header_request_width_id = g_signal_connect
- (G_OBJECT (header), "request_width",
- G_CALLBACK (eti_request_column_width), eti);
-}
-
-/*
- * GObject::dispose method
- */
-static void
-eti_dispose (GObject *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;
- }
- eti->height_cache_idle_count = 0;
-
- if (eti->cursor_idle_id) {
- g_source_remove(eti->cursor_idle_id);
- eti->cursor_idle_id = 0;
- }
-
- if (eti->height_cache)
- g_free (eti->height_cache);
- eti->height_cache = NULL;
-
- e_canvas_hide_tooltip (E_CANVAS(GNOME_CANVAS_ITEM(eti)->canvas));
- if (eti->tooltip) {
- 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;
- }
- g_free (eti->tooltip);
- eti->tooltip = NULL;
- }
-
- if (G_OBJECT_CLASS (eti_parent_class)->dispose)
- (*G_OBJECT_CLASS (eti_parent_class)->dispose) (object);
-}
-
-static void
-eti_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
-{
- GnomeCanvasItem *item;
- ETableItem *eti;
- int cursor_col;
-
- item = GNOME_CANVAS_ITEM (object);
- eti = E_TABLE_ITEM (object);
-
- switch (prop_id){
- case PROP_TABLE_HEADER:
- eti_remove_header_model (eti);
- eti_add_header_model (eti, E_TABLE_HEADER(g_value_get_object (value)));
- break;
-
- case PROP_TABLE_MODEL:
- eti_remove_table_model (eti);
- eti_add_table_model (eti, E_TABLE_MODEL(g_value_get_object (value)));
- break;
-
- case PROP_SELECTION_MODEL:
- eti_remove_selection_model (eti);
- if (g_value_get_object (value))
- eti_add_selection_model (eti, E_SELECTION_MODEL(g_value_get_object(value)));
- break;
-
- case PROP_LENGTH_THRESHOLD:
- eti->length_threshold = g_value_get_int (value);
- break;
-
- case PROP_TABLE_ALTERNATING_ROW_COLORS:
- eti->alternating_row_colors = g_value_get_boolean (value);
- break;
-
- case PROP_TABLE_HORIZONTAL_DRAW_GRID:
- eti->horizontal_draw_grid = g_value_get_boolean (value);
- break;
-
- case PROP_TABLE_VERTICAL_DRAW_GRID:
- eti->vertical_draw_grid = g_value_get_boolean (value);
- break;
-
- case PROP_TABLE_DRAW_FOCUS:
- eti->draw_focus = g_value_get_boolean (value);
- break;
-
- case PROP_CURSOR_MODE:
- eti->cursor_mode = g_value_get_int (value);
- break;
-
- case PROP_MINIMUM_WIDTH:
- case PROP_WIDTH:
- if ((eti->minimum_width == eti->width && g_value_get_double(value) > eti->width) ||
- g_value_get_double(value) < eti->width) {
- eti->needs_compute_width = 1;
- e_canvas_item_request_reflow (GNOME_CANVAS_ITEM(eti));
- }
- eti->minimum_width = g_value_get_double (value);
- break;
- case PROP_CURSOR_ROW:
- g_object_get(eti->selection,
- "cursor_col", &cursor_col,
- NULL);
-
- e_table_item_focus (eti, cursor_col != -1 ? cursor_col : 0, view_to_model_row(eti, g_value_get_int (value)), 0);
- break;
- case PROP_UNIFORM_ROW_HEIGHT:
- if (eti->uniform_row_height != g_value_get_boolean (value)) {
- eti->uniform_row_height = g_value_get_boolean (value);
- 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_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
-{
- GnomeCanvasItem *item;
- ETableItem *eti;
- int row;
-
- item = GNOME_CANVAS_ITEM (object);
- eti = E_TABLE_ITEM (object);
-
- switch (prop_id){
- case PROP_WIDTH:
- g_value_set_double (value, eti->width);
- break;
- case PROP_HEIGHT:
- g_value_set_double (value, eti->height);
- break;
- case PROP_MINIMUM_WIDTH:
- g_value_set_double (value, eti->minimum_width);
- break;
- case PROP_CURSOR_ROW:
- g_object_get(eti->selection,
- "cursor_row", &row,
- NULL);
- g_value_set_int (value, model_to_view_row(eti, row));
- break;
- case PROP_UNIFORM_ROW_HEIGHT:
- g_value_set_boolean (value, eti->uniform_row_height);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-eti_init (GnomeCanvasItem *item)
-{
- ETableItem *eti = E_TABLE_ITEM (item);
-
- eti->motion_row = -1;
- eti->motion_col = -1;
- 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 =
- g_signal_connect (gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas)), "changed",
- G_CALLBACK (adjustment_changed), eti);
- eti->hadjustment_value_change_id =
- g_signal_connect (gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas)), "value_changed",
- G_CALLBACK (adjustment_changed), eti);
- eti->vadjustment_change_id =
- g_signal_connect (gtk_layout_get_vadjustment(GTK_LAYOUT(item->canvas)), "changed",
- G_CALLBACK (adjustment_changed), eti);
- eti->vadjustment_value_change_id =
- g_signal_connect (gtk_layout_get_vadjustment(GTK_LAYOUT(item->canvas)), "value_changed",
- G_CALLBACK (adjustment_changed), eti);
-
- if (eti->cell_views == NULL)
- eti_attach_cell_views (eti);
-
- eti_realize_cell_views (eti);
-
- free_height_cache(eti);
-
- if (item->canvas->focused_item == NULL && eti->selection) {
- int row;
-
- row = e_selection_model_cursor_row (E_SELECTION_MODEL (eti->selection));
- row = model_to_view_row(eti, row);
- if (row != -1) {
- e_canvas_item_grab_focus (item, FALSE);
- eti_show_cursor (eti, 0);
- eti_check_cursor_bounds (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_count > 0) {
- 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) {
- 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;
-
- g_signal_handler_disconnect(gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas)),
- eti->hadjustment_change_id);
- g_signal_handler_disconnect(gtk_layout_get_hadjustment(GTK_LAYOUT(item->canvas)),
- eti->hadjustment_value_change_id);
- g_signal_handler_disconnect(gtk_layout_get_vadjustment(GTK_LAYOUT(item->canvas)),
- eti->vadjustment_change_id);
- g_signal_handler_disconnect(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;
- }
-
- 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));
-
- g_object_get(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;
- g_object_get(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;
- g_object_get(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);
-
- g_object_get(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
-
- if (!eti->header)
- return FALSE;
-
- 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;
-
- g_object_get(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;
-
- g_signal_emit (eti, eti_signals [CLICK], 0,
- row, view_to_model_col(eti, col), &button, &return_val);
-
- if (return_val) {
- eti->click_count = 0;
- return TRUE;
- }
-
- g_object_get(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);
- g_object_get(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);
-
- g_signal_emit (eti, eti_signals [RIGHT_CLICK], 0,
- 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_count > 0) {
- d(g_print ("%s: eti_ungrab\n", __FUNCTION__));
- eti_ungrab (eti, e->button.time);
- }
-
- 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;
-
- g_object_get(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
-
- g_object_get(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 (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_editing (eti))
- e_table_item_leave_edit_ (eti);
-
- }
-
- if (eti->grabbed_count > 0) {
- d(g_print ("%s: eti_ungrab\n", __FUNCTION__));
- eti_ungrab (eti, e->button.time);
- }
-
- if (model_row != -1 && model_col != -1) {
- g_signal_emit (eti, eti_signals [DOUBLE_CLICK], 0,
- model_row, model_col, e);
- }
- }
- break;
- }
- case GDK_MOTION_NOTIFY: {
- int col, row, flags;
- 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;
- g_signal_emit (eti, eti_signals [START_DRAG], 0,
- 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;
-
- if (eti->motion_row != -1 && eti->motion_col != -1 &&
- (row != eti->motion_row || col != eti->motion_col)) {
- GdkEvent *cross = gdk_event_new (GDK_LEAVE_NOTIFY);
- cross->crossing.time = e->motion.time;
- return_val = eti_e_cell_event (eti, eti->cell_views [eti->motion_col],
- cross, cross->crossing.time,
- view_to_model_col(eti, eti->motion_col),
- eti->motion_col, eti->motion_row, 0);
- }
-
- eti->motion_row = row;
- eti->motion_col = col;
-
- g_object_get(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)
- 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
-
- flags = 0;
- if (cursor_row == view_to_model_row(eti, row) && cursor_col == view_to_model_col(eti, col)){
- flags = E_CELL_EDITING | E_CELL_CURSOR;
- }
-
- 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, flags);
- 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));
-
- g_object_get(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_row == -1 && 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;
- }
-
- g_signal_emit (eti, eti_signals [KEY_PRESS], 0,
- 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;
- }
-
- g_signal_emit (eti, eti_signals [KEY_PRESS], 0,
- 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;
- }
- g_object_get(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
- }
- g_signal_emit (eti, eti_signals [KEY_PRESS], 0,
- 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)){
- g_signal_emit (eti, eti_signals [KEY_PRESS], 0,
- 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));
-
- g_object_get(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)
- gtk_timeout_remove (eti->tooltip->timer);
- eti->tooltip->timer = 0;
- if (eti->motion_row != -1 && eti->motion_col != -1)
- return_val = eti_e_cell_event (eti, eti->cell_views [eti->motion_col],
- e, e->crossing.time,
- view_to_model_col(eti, eti->motion_col),
- eti->motion_col, eti->motion_row, 0);
- eti->motion_row = -1;
- eti->motion_col = -1;
-
- 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 (!(GTK_OBJECT_FLAGS(eti) & GNOME_CANVAS_ITEM_REALIZED))
- return;
-
- 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);
- }
- }
-
- 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));
-
- free_height_cache (eti);
-
- eti_idle_maybe_show_cursor(eti);
-}
-
-static void
-eti_class_init (GObjectClass *object_class)
-{
- GnomeCanvasItemClass *item_class = (GnomeCanvasItemClass *) object_class;
- ETableItemClass *eti_class = (ETableItemClass *) object_class;
-
- eti_parent_class = g_type_class_ref (PARENT_OBJECT_TYPE);
-
- object_class->dispose = eti_dispose;
- object_class->set_property = eti_set_property;
- object_class->get_property = eti_get_property;
-
- 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;
-
- g_object_class_install_property (object_class, PROP_TABLE_HEADER,
- g_param_spec_object ("ETableHeader",
- _( "Table header" ),
- _( "Table header" ),
- E_TABLE_HEADER_TYPE,
- G_PARAM_WRITABLE));
-
- g_object_class_install_property (object_class, PROP_TABLE_MODEL,
- g_param_spec_object ("ETableModel",
- _( "Table model" ),
- _( "Table model" ),
- E_TABLE_MODEL_TYPE,
- G_PARAM_WRITABLE));
-
- g_object_class_install_property (object_class, PROP_SELECTION_MODEL,
- g_param_spec_object ("selection_model",
- _( "Selection model" ),
- _( "Selection model" ),
- E_SELECTION_MODEL_TYPE,
- G_PARAM_WRITABLE));
-
- g_object_class_install_property (object_class, PROP_TABLE_ALTERNATING_ROW_COLORS,
- g_param_spec_boolean ("alternating_row_colors",
- _( "Alternating Row Colors" ),
- _( "Alternating Row Colors" ),
- FALSE,
- G_PARAM_WRITABLE));
-
- g_object_class_install_property (object_class, PROP_TABLE_HORIZONTAL_DRAW_GRID,
- g_param_spec_boolean ("horizontal_draw_grid",
- _( "Horizontal Draw Grid" ),
- _( "Horizontal Draw Grid" ),
- FALSE,
- G_PARAM_WRITABLE));
-
- g_object_class_install_property (object_class, PROP_TABLE_VERTICAL_DRAW_GRID,
- g_param_spec_boolean ("vertical_draw_grid",
- _( "Vertical Draw Grid" ),
- _( "Vertical Draw Grid" ),
- FALSE,
- G_PARAM_WRITABLE));
-
- g_object_class_install_property (object_class, PROP_TABLE_DRAW_FOCUS,
- g_param_spec_boolean ("drawfocus",
- _( "Draw focus" ),
- _( "Draw focus" ),
- FALSE,
- G_PARAM_WRITABLE));
-
- g_object_class_install_property (object_class, PROP_CURSOR_MODE,
- g_param_spec_int ("cursor_mode",
- _( "Cursor mode" ),
- _( "Cursor mode" ),
- E_CURSOR_LINE, E_CURSOR_SPREADSHEET, E_CURSOR_LINE,
- G_PARAM_WRITABLE));
-
- g_object_class_install_property (object_class, PROP_LENGTH_THRESHOLD,
- g_param_spec_int ("length_threshold",
- _( "Length Threshold" ),
- _( "Length Threshold" ),
- -1, G_MAXINT, 0,
- G_PARAM_WRITABLE));
-
- g_object_class_install_property (object_class, PROP_MINIMUM_WIDTH,
- g_param_spec_double ("minimum_width",
- _( "Minimum width" ),
- _( "Minimum Width" ),
- 0.0, G_MAXDOUBLE, 0.0,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_WIDTH,
- g_param_spec_double ("width",
- _( "Width" ),
- _( "Width" ),
- 0.0, G_MAXDOUBLE, 0.0,
- G_PARAM_READWRITE));
- g_object_class_install_property (object_class, PROP_HEIGHT,
- g_param_spec_double ("height",
- _( "Height" ),
- _( "Height" ),
- 0.0, G_MAXDOUBLE, 0.0,
- G_PARAM_READABLE));
-
- g_object_class_install_property (object_class, PROP_CURSOR_ROW,
- g_param_spec_int ("cursor_row",
- _( "Cursor row" ),
- _( "Cursor row" ),
- 0, G_MAXINT, 0,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_UNIFORM_ROW_HEIGHT,
- g_param_spec_boolean ("uniform_row_height",
- _( "Uniform row height" ),
- _( "Uniform row height" ),
- FALSE,
- G_PARAM_READWRITE));
-
- eti_signals [CURSOR_CHANGE] =
- g_signal_new ("cursor_change",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableItemClass, cursor_change),
- NULL, NULL,
- e_marshal_NONE__INT,
- G_TYPE_NONE, 1, G_TYPE_INT);
-
- eti_signals [CURSOR_ACTIVATED] =
- g_signal_new ("cursor_activated",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableItemClass, cursor_activated),
- NULL, NULL,
- e_marshal_NONE__INT,
- G_TYPE_NONE, 1, G_TYPE_INT);
-
- eti_signals [DOUBLE_CLICK] =
- g_signal_new ("double_click",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableItemClass, double_click),
- NULL, NULL,
- e_marshal_NONE__INT_INT_BOXED,
- G_TYPE_NONE, 3, G_TYPE_INT,
- G_TYPE_INT, GDK_TYPE_EVENT);
-
- eti_signals [START_DRAG] =
- g_signal_new ("start_drag",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableItemClass, start_drag),
- NULL, NULL,
- e_marshal_INT__INT_INT_BOXED,
- G_TYPE_INT, 3, G_TYPE_INT,
- G_TYPE_INT, GDK_TYPE_EVENT);
-
- eti_signals [RIGHT_CLICK] =
- g_signal_new ("right_click",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableItemClass, right_click),
- NULL, NULL,
- e_marshal_INT__INT_INT_BOXED,
- G_TYPE_INT, 3, G_TYPE_INT,
- G_TYPE_INT, GDK_TYPE_EVENT);
-
- eti_signals [CLICK] =
- g_signal_new ("click",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableItemClass, click),
- NULL, NULL,
- e_marshal_INT__INT_INT_BOXED,
- G_TYPE_INT, 3, G_TYPE_INT,
- G_TYPE_INT, GDK_TYPE_EVENT);
-
- eti_signals [KEY_PRESS] =
- g_signal_new ("key_press",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableItemClass, key_press),
- NULL, NULL,
- e_marshal_INT__INT_INT_BOXED,
- G_TYPE_INT, 3, G_TYPE_INT,
- G_TYPE_INT, GDK_TYPE_EVENT);
-
- eti_signals [STYLE_SET] =
- g_signal_new ("style_set",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableItemClass, style_set),
- NULL, NULL,
- e_marshal_NONE__OBJECT,
- G_TYPE_NONE, 1, GTK_TYPE_STYLE);
-}
-
-E_MAKE_TYPE (e_table_item,
- "ETableItem",
- ETableItem,
- eti_class_init,
- eti_init,
- PARENT_OBJECT_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);
-
- g_object_get(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 (eti->old_cursor_row != -1 && view_row != eti->old_cursor_row)
- e_table_item_redraw_row (eti, eti->old_cursor_row);
-
- if (view_row == -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);
- g_signal_emit (eti, eti_signals [CURSOR_CHANGE], 0,
- view_row);
-
- e_table_item_redraw_row (eti, view_row);
-
- 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);
-
- if (view_row != -1)
- g_signal_emit (eti, eti_signals [CURSOR_ACTIVATED], 0,
- 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->height;
- }
-
- 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 = 1.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;
-
- g_signal_stop_emission_by_name(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;
-
- g_signal_stop_emission_by_name(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);
-
- g_signal_stop_emission_by_name(ep, "will_fit");
- return ret_val;
-}
-
-static void
-e_table_item_printable_destroy (gpointer data,
- GObject *where_object_was)
-{
- ETableItemPrintContext *itemcontext = data;
-
- g_object_unref(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;
- g_object_ref(item);
- itemcontext->rows_printed = 0;
-
- g_signal_connect (printable,
- "print_page",
- G_CALLBACK(e_table_item_print_page),
- itemcontext);
- g_signal_connect (printable,
- "data_left",
- G_CALLBACK(e_table_item_data_left),
- itemcontext);
- g_signal_connect (printable,
- "reset",
- G_CALLBACK(e_table_item_reset),
- itemcontext);
- g_signal_connect (printable,
- "height",
- G_CALLBACK(e_table_item_height),
- itemcontext);
- g_signal_connect (printable,
- "will_fit",
- G_CALLBACK(e_table_item_will_fit),
- itemcontext);
- g_object_weak_ref (G_OBJECT (printable),
- 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 4776bc8ca7..0000000000
--- a/widgets/table/e-table-item.h
+++ /dev/null
@@ -1,229 +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 <libgnomecanvas/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>
-
-G_BEGIN_DECLS
-
-#define E_TABLE_ITEM_TYPE (e_table_item_get_type ())
-#define E_TABLE_ITEM(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_ITEM_TYPE, ETableItem))
-#define E_TABLE_ITEM_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_ITEM_TYPE, ETableItemClass))
-#define E_IS_TABLE_ITEM(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_ITEM_TYPE))
-#define E_IS_TABLE_ITEM_CLASS(k) (G_TYPE_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;
-
- guint cursor_idle_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;
- guint grab_cancelled : 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;
-
- int motion_col, motion_row;
-
- /*
- * 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;
-GType 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);
-
-G_END_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 6cd1b9c8a1..0000000000
--- a/widgets/table/e-table-memory-callbacks.c
+++ /dev/null
@@ -1,208 +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"
-#include "gal/util/e-util.h"
-
-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
-e_table_memory_callbacks_class_init (GObjectClass *object_class)
-{
- ETableModelClass *model_class = (ETableModelClass *) object_class;
-
- 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;
-
-}
-
-E_MAKE_TYPE(e_table_memory_callbacks, "ETableMemoryCalbacks", ETableMemoryCalbacks, e_table_memory_callbacks_class_init, NULL, E_TABLE_MEMORY_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 = g_object_new (E_TABLE_MEMORY_CALLBACKS_TYPE, NULL);
-
- 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 599ffa01f3..0000000000
--- a/widgets/table/e-table-memory-callbacks.h
+++ /dev/null
@@ -1,91 +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>
-
-G_BEGIN_DECLS
-
-#define E_TABLE_MEMORY_CALLBACKS_TYPE (e_table_memory_callbacks_get_type ())
-#define E_TABLE_MEMORY_CALLBACKS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_MEMORY_CALLBACKS_TYPE, ETableMemoryCalbacks))
-#define E_TABLE_MEMORY_CALLBACKS_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_MEMORY_CALLBACKS_TYPE, ETableMemoryCalbacksClass))
-#define E_IS_TABLE_MEMORY_CALLBACKS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_MEMORY_CALLBACKS_TYPE))
-#define E_IS_TABLE_MEMORY_CALLBACKS_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TABLE_MEMORY_CALLBACKS_TYPE))
-#define E_TABLE_MEMORY_CALLBACKS_GET_CLASS(k) (G_TYPE_INSTANCE_GET_CLASS((k), E_TABLE_MEMORY_CALLBACKS_TYPE, ETableMemoryCalbacksClass))
-
-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;
-
-GType 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);
-
-G_END_DECLS
-
-#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 69765b32ab..0000000000
--- a/widgets/table/e-table-memory-store.c
+++ /dev/null
@@ -1,583 +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"
-#include "gal/util/e-util.h"
-
-#define STORE_LOCATOR(etms, col, row) (*((etms)->priv->store + (row) * (etms)->priv->col_count + (col)))
-
-static ETableMemoryClass *parent_class;
-
-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)
- g_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 void
-free_value (ETableMemoryStore *etms, int col, void *value)
-{
- 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)
- g_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 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);
-
- e_table_model_pre_change (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);
-
- free_value (etms, col, value);
-}
-
-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_array (etms, row_count, new_data, NULL);
-}
-
-static void
-etms_finalize (GObject *obj)
-{
- ETableMemoryStore *etms = (ETableMemoryStore *) obj;
-
- if (etms->priv) {
- e_table_memory_store_clear (etms);
-
- g_free (etms->priv->columns);
- g_free (etms->priv->store);
- g_free (etms->priv);
- }
-
- if (G_OBJECT_CLASS (parent_class)->finalize)
- G_OBJECT_CLASS (parent_class)->finalize (obj);
-}
-
-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 (GObjectClass *object_class)
-{
- ETableModelClass *model_class = (ETableModelClass *) object_class;
-
- parent_class = g_type_class_peek_parent (object_class);
-
- object_class->finalize = etms_finalize;
-
- 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;
-}
-
-E_MAKE_TYPE(e_table_memory_store, "ETableMemoryStore", ETableMemoryStore, e_table_memory_store_class_init, e_table_memory_store_init, E_TABLE_MEMORY_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 = g_object_new (E_TABLE_MEMORY_STORE_TYPE, NULL);
-
- if (e_table_memory_store_construct (et, columns)) {
- return (ETableModel *) et;
- } else {
- g_object_unref (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)
-{
- e_table_model_pre_change (E_TABLE_MODEL (etms));
-
- 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_array (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 (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_array (etms, row, store, data);
-
- g_free (store);
-}
-
-void
-e_table_memory_store_insert_adopt_array (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_insert_adopt (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_adopt_array (etms, row, store, data);
-
- g_free (store);
-}
-
-/**
- * e_table_memory_store_change_array:
- * @etms: the ETabelMemoryStore.
- * @row: the row we're changing.
- * @store: an array of new values to fill the row
- * @data: the new closure to associate with this row.
- *
- * frees existing values associated with a row and replaces them with
- * duplicates of the values in store.
- *
- */
-void
-e_table_memory_store_change_array (ETableMemoryStore *etms, int row, void **store, gpointer data)
-{
- int i;
-
- g_return_if_fail (row >= 0 && row < e_table_model_row_count (E_TABLE_MODEL (etms)));
-
- e_table_model_pre_change (E_TABLE_MODEL (etms));
-
- for (i = 0; i < etms->priv->col_count; i++) {
- free_value (etms, i, STORE_LOCATOR(etms, i, row));
- STORE_LOCATOR(etms, i, row) = duplicate_value(etms, i, store[i]);
- }
-
- e_table_memory_set_data (E_TABLE_MEMORY (etms), row, data);
- e_table_model_row_changed (E_TABLE_MODEL (etms), row);
-}
-
-/**
- * e_table_memory_store_change:
- * @etms: the ETabelMemoryStore.
- * @row: the row we're changing.
- * @data: the new closure to associate with this row.
- *
- * a varargs version of e_table_memory_store_change_array. you must
- * pass in etms->col_count args.
- */
-void
-e_table_memory_store_change (ETableMemoryStore *etms, int row, gpointer data, ...)
-{
- void **store;
- va_list args;
- int i;
-
- g_return_if_fail (row >= 0 && row < e_table_model_row_count (E_TABLE_MODEL (etms)));
-
- store = g_new0 (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_change_array (etms, row, store, data);
-
- g_free (store);
-}
-
-/**
- * e_table_memory_store_change_adopt_array:
- * @etms: the ETableMemoryStore
- * @row: the row we're changing.
- * @store: an array of new values to fill the row
- * @data: the new closure to associate with this row.
- *
- * frees existing values for the row and stores the values from store
- * into it. This function differs from
- * e_table_memory_storage_change_adopt_array in that it does not
- * duplicate the data.
- */
-void
-e_table_memory_store_change_adopt_array (ETableMemoryStore *etms, int row, void **store, gpointer data)
-{
- int i;
-
- g_return_if_fail (row >= 0 && row < e_table_model_row_count (E_TABLE_MODEL (etms)));
-
- for (i = 0; i < etms->priv->col_count; i++) {
- free_value (etms, i, STORE_LOCATOR(etms, i, row));
- STORE_LOCATOR(etms, i, row) = store[i];
- }
-
- e_table_memory_set_data (E_TABLE_MEMORY (etms), row, data);
- e_table_model_row_changed (E_TABLE_MODEL (etms), row);
-}
-
-/**
- * e_table_memory_store_change_adopt
- * @etms: the ETabelMemoryStore.
- * @row: the row we're changing.
- * @data: the new closure to associate with this row.
- *
- * a varargs version of e_table_memory_store_change_adopt_array. you
- * must pass in etms->col_count args.
- */
-void
-e_table_memory_store_change_adopt (ETableMemoryStore *etms, int row, gpointer data, ...)
-{
- void **store;
- va_list args;
- int i;
-
- g_return_if_fail (row >= 0 && row < e_table_model_row_count (E_TABLE_MODEL (etms)));
-
- store = g_new0 (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_change_adopt_array (etms, row, store, data);
-
- g_free (store);
-}
-
-void
-e_table_memory_store_remove (ETableMemoryStore *etms, int row)
-{
- ETableModel *model;
- int column_count, row_count;
- int i;
-
- model = E_TABLE_MODEL (etms);
- column_count = e_table_model_column_count (model);
-
- for (i = 0; i < column_count; i ++)
- e_table_model_free_value (model, i, e_table_model_value_at (model, i, row));
-
- 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)
-{
- ETableModel *model;
- int row_count, column_count;
- int i, j;
-
- model = E_TABLE_MODEL (etms);
- row_count = e_table_model_row_count (model);
- column_count = e_table_model_column_count (model);
-
- for (i = 0; i < row_count; i ++) {
- for (j = 0; j < column_count; j ++) {
- e_table_model_free_value (model, j, e_table_model_value_at (model, j, i));
- }
- }
-
- 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 54306da236..0000000000
--- a/widgets/table/e-table-memory-store.h
+++ /dev/null
@@ -1,138 +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>
-
-G_BEGIN_DECLS
-
-#define E_TABLE_MEMORY_STORE_TYPE (e_table_memory_store_get_type ())
-#define E_TABLE_MEMORY_STORE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_MEMORY_STORE_TYPE, ETableMemoryStore))
-#define E_TABLE_MEMORY_STORE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_MEMORY_STORE_TYPE, ETableMemoryStoreClass))
-#define E_IS_TABLE_MEMORY_STORE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_MEMORY_STORE_TYPE))
-#define E_IS_TABLE_MEMORY_STORE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TABLE_MEMORY_STORE_TYPE))
-#define E_TABLE_MEMORY_STORE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((obj), E_TABLE_MEMORY_STORE_TYPE, ETableMemoryStoreClass))
-
-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;
-
-GType 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_array (ETableMemoryStore *etms,
- int row,
- void **store,
- gpointer data);
-void e_table_memory_store_insert (ETableMemoryStore *etms,
- int row,
- gpointer data,
- ...);
-void e_table_memory_store_insert_adopt (ETableMemoryStore *etms,
- int row,
- gpointer data,
- ...);
-void e_table_memory_store_insert_adopt_array (ETableMemoryStore *etms,
- int row,
- void **store,
- gpointer data);
-void e_table_memory_store_change_array (ETableMemoryStore *etms,
- int row,
- void **store,
- gpointer data);
-void e_table_memory_store_change (ETableMemoryStore *etms,
- int row,
- gpointer data,
- ...);
-void e_table_memory_store_change_adopt (ETableMemoryStore *etms,
- int row,
- gpointer data,
- ...);
-void e_table_memory_store_change_adopt_array (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);
-
-G_END_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 7d9958bbd6..0000000000
--- a/widgets/table/e-table-memory.c
+++ /dev/null
@@ -1,277 +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 <libxml/parser.h>
-#include <libxml/xmlmemory.h>
-
-#include "gal/util/e-util.h"
-#include "gal/util/e-xml-utils.h"
-#include <string.h>
-
-static ETableModel *parent_class;
-
-struct ETableMemoryPriv {
- gpointer *data;
- int num_rows;
- gint frozen;
-};
-
-
-/* virtual methods */
-
-static void
-etmm_finalize (GObject *object)
-{
- ETableMemory *etmm = E_TABLE_MEMORY (object);
- ETableMemoryPriv *priv = etmm->priv;
-
- /* XXX lots of stuff to free here */
- if (priv) {
- g_free (priv->data);
- g_free (priv);
- }
- etmm->priv = NULL;
-
- G_OBJECT_CLASS (parent_class)->finalize (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 (GObjectClass *klass)
-{
- ETableModelClass *table_class = (ETableModelClass *) klass;
-
- parent_class = g_type_class_peek_parent (klass);
-
- klass->finalize = etmm_finalize;
-
- table_class->row_count = etmm_row_count;
-}
-
-static void
-e_table_memory_init (GObject *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, E_TABLE_MODEL_TYPE)
-
-
-
-/**
- * e_table_memory_new
- *
- * XXX docs here.
- *
- * return values: a newly constructed ETableMemory.
- */
-ETableMemory *
-e_table_memory_new (void)
-{
- return g_object_new (E_TABLE_MEMORY_TYPE, NULL);
-}
-
-/**
- * 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 c1b3cd45f8..0000000000
--- a/widgets/table/e-table-memory.h
+++ /dev/null
@@ -1,76 +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>
-
-G_BEGIN_DECLS
-
-#define E_TABLE_MEMORY_TYPE (e_table_memory_get_type ())
-#define E_TABLE_MEMORY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_MEMORY_TYPE, ETableMemory))
-#define E_TABLE_MEMORY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_MEMORY_TYPE, ETableMemoryClass))
-#define E_IS_TABLE_MEMORY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_MEMORY_TYPE))
-#define E_IS_TABLE_MEMORY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TABLE_MEMORY_TYPE))
-#define E_TABLE_MEMORY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), E_TABLE_MEMORY_TYPE, ETableMemoryClass))
-
-typedef struct ETableMemory ETableMemory;
-typedef struct ETableMemoryPriv ETableMemoryPriv;
-typedef struct ETableMemoryClass ETableMemoryClass;
-
-struct ETableMemory {
- ETableModel base;
- ETableMemoryPriv *priv;
-};
-
-struct ETableMemoryClass {
- ETableModelClass parent_class;
-};
-
-
-GType 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);
-
-G_END_DECLS
-
-#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 dddcace5be..0000000000
--- a/widgets/table/e-table-model.c
+++ /dev/null
@@ -1,579 +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 <glib-object.h>
-#include "e-table-model.h"
-#include "gal/util/e-util.h"
-#include "gal/util/e-marshal.h"
-
-#define ETM_CLASS(e) (E_TABLE_MODEL_GET_CLASS (e))
-
-#define d(x)
-
-d(static gint depth = 0;)
-
-
-static GObjectClass *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.
- *
- * The data returned must be valid until the model sends a signal that
- * affect that piece of data. model_changed affects all data.
- * row_changed affects the data in that row. cell_changed affects the
- * data in that cell. rows_deleted affects all data in those rows.
- * rows_inserted and no_change don't affect any data in this way.
- **/
-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_finalize (GObject *object)
-{
- if (e_table_model_parent_class->finalize)
- (*e_table_model_parent_class->finalize)(object);
-}
-
-static void
-e_table_model_class_init (GObjectClass *object_class)
-{
- ETableModelClass *klass = E_TABLE_MODEL_CLASS(object_class);
- e_table_model_parent_class = g_type_class_peek_parent (object_class);
-
- object_class->finalize = e_table_model_finalize;
-
- e_table_model_signals [MODEL_NO_CHANGE] =
- g_signal_new ("model_no_change",
- E_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableModelClass, model_no_change),
- (GSignalAccumulator) NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
-
- e_table_model_signals [MODEL_CHANGED] =
- g_signal_new ("model_changed",
- E_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableModelClass, model_changed),
- (GSignalAccumulator) NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- e_table_model_signals [MODEL_PRE_CHANGE] =
- g_signal_new ("model_pre_change",
- E_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableModelClass, model_pre_change),
- (GSignalAccumulator) NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- e_table_model_signals [MODEL_ROW_CHANGED] =
- g_signal_new ("model_row_changed",
- E_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableModelClass, model_row_changed),
- (GSignalAccumulator) NULL, NULL,
- g_cclosure_marshal_VOID__INT,
- G_TYPE_NONE, 1, G_TYPE_INT);
-
- e_table_model_signals [MODEL_CELL_CHANGED] =
- g_signal_new ("model_cell_changed",
- E_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableModelClass, model_cell_changed),
- (GSignalAccumulator) NULL, NULL,
- e_marshal_VOID__INT_INT,
- G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
-
- e_table_model_signals [MODEL_ROWS_INSERTED] =
- g_signal_new ("model_rows_inserted",
- E_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableModelClass, model_rows_inserted),
- (GSignalAccumulator) NULL, NULL,
- e_marshal_VOID__INT_INT,
- G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
-
- e_table_model_signals [MODEL_ROWS_DELETED] =
- g_signal_new ("model_rows_deleted",
- E_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableModelClass, model_rows_deleted),
- (GSignalAccumulator) NULL, NULL,
- e_marshal_VOID__INT_INT,
- G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_INT);
-
- 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;
-}
-
-E_MAKE_TYPE(e_table_model, "ETableModel", ETableModel, e_table_model_class_init, NULL, G_TYPE_OBJECT)
-
-#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++);
- g_signal_emit (G_OBJECT (e_table_model),
- e_table_model_signals [MODEL_PRE_CHANGE], 0);
- 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++);
- g_signal_emit (G_OBJECT (e_table_model),
- e_table_model_signals [MODEL_NO_CHANGE], 0);
- 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++);
- g_signal_emit (G_OBJECT (e_table_model),
- e_table_model_signals [MODEL_CHANGED], 0);
- 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++);
- g_signal_emit (G_OBJECT (e_table_model),
- e_table_model_signals [MODEL_ROW_CHANGED], 0, 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++);
- g_signal_emit (G_OBJECT (e_table_model),
- e_table_model_signals [MODEL_CELL_CHANGED], 0, 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++);
- g_signal_emit (G_OBJECT (e_table_model),
- e_table_model_signals [MODEL_ROWS_INSERTED], 0, 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++);
- g_signal_emit (G_OBJECT (e_table_model),
- e_table_model_signals [MODEL_ROWS_DELETED], 0, 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 6244fa2e7a..0000000000
--- a/widgets/table/e-table-model.h
+++ /dev/null
@@ -1,170 +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 <glib-object.h>
-
-G_BEGIN_DECLS
-
-#define E_TABLE_MODEL_TYPE (e_table_model_get_type ())
-#define E_TABLE_MODEL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_MODEL_TYPE, ETableModel))
-#define E_TABLE_MODEL_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_MODEL_TYPE, ETableModelClass))
-#define E_IS_TABLE_MODEL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_MODEL_TYPE))
-#define E_IS_TABLE_MODEL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TABLE_MODEL_TYPE))
-#define E_TABLE_MODEL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), E_TABLE_MODEL_TYPE, ETableModelClass))
-
-typedef struct {
- GObject base;
-} ETableModel;
-
-typedef struct {
- GObjectClass 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;
-
-GType 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);
-
-G_END_DECLS
-
-#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 123b45712d..0000000000
--- a/widgets/table/e-table-one.c
+++ /dev/null
@@ -1,243 +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"
-#include "gal/util/e-util.h"
-
-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_finalize (GObject *object)
-{
- ETableOne *one = E_TABLE_ONE (object);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static void
-one_dispose (GObject *object)
-{
- ETableOne *one = E_TABLE_ONE (object);
-
-
- if (one->data) {
- int i;
- int col_count;
-
- if (one->source) {
- col_count = e_table_model_column_count(one->source);
-
- for (i = 0; i < col_count; i++)
- e_table_model_free_value(one->source, i, one->data[i]);
- }
-
- g_free (one->data);
- }
- one->data = NULL;
-
- if (one->source)
- g_object_unref(one->source);
- one->source = NULL;
-
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static void
-e_table_one_class_init (GObjectClass *object_class)
-{
- ETableModelClass *model_class = (ETableModelClass *) object_class;
-
- parent_class = g_type_class_peek_parent (object_class);
-
- 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->dispose = one_dispose;
- object_class->finalize = one_finalize;
-}
-
-static void
-e_table_one_init (GObject *object)
-{
- ETableOne *one = E_TABLE_ONE(object);
-
- one->source = NULL;
- one->data = NULL;
-}
-
-E_MAKE_TYPE(e_table_one, "ETableOne", ETableOne, e_table_one_class_init, e_table_one_init, E_TABLE_MODEL_TYPE)
-
-
-ETableModel *
-e_table_one_new (ETableModel *source)
-{
- ETableOne *eto;
- int col_count;
- int i;
-
- eto = g_object_new (E_TABLE_ONE_TYPE, NULL);
- 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)
- g_object_ref(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 1c8147d779..0000000000
--- a/widgets/table/e-table-one.h
+++ /dev/null
@@ -1,57 +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>
-
-G_BEGIN_DECLS
-
-#define E_TABLE_ONE_TYPE (e_table_one_get_type ())
-#define E_TABLE_ONE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_ONE_TYPE, ETableOne))
-#define E_TABLE_ONE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_ONE_TYPE, ETableOneClass))
-#define E_IS_TABLE_ONE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_ONE_TYPE))
-#define E_IS_TABLE_ONE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TABLE_ONE_TYPE))
-#define E_TABLE_ONE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((obj), E_TABLE_ONE_TYPE, ETableOneClass))
-
-typedef struct {
- ETableModel parent;
-
- ETableModel *source;
- void **data;
-} ETableOne;
-
-typedef struct {
- ETableModelClass parent_class;
-} ETableOneClass;
-
-GType e_table_one_get_type (void);
-
-ETableModel *e_table_one_new (ETableModel *source);
-void e_table_one_commit (ETableOne *one);
-
-G_END_DECLS
-
-#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 1786148c78..0000000000
--- a/widgets/table/e-table-scrolled.c
+++ /dev/null
@@ -1,229 +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 <libgnomecanvas/gnome-canvas.h>
-#include <gtk/gtksignal.h>
-#include <libxml/parser.h>
-#include <libxml/xmlmemory.h>
-
-#include "e-table.h"
-#include "e-table-scrolled.h"
-#include "gal/util/e-i18n.h"
-
-#define COLUMN_HEADER_HEIGHT 16
-
-#define PARENT_TYPE gtk_scrolled_window_get_type ()
-
-static GtkObjectClass *parent_class;
-
-enum {
- PROP_0,
- PROP_TABLE
-};
-
-static void
-e_table_scrolled_init (GtkObject *object)
-{
- ETableScrolled *ets;
- GtkScrolledWindow *scrolled_window;
-
- ets = E_TABLE_SCROLLED (object);
- scrolled_window = GTK_SCROLLED_WINDOW (object);
-
- GTK_WIDGET_SET_FLAGS (ets, GTK_CAN_FOCUS);
-
- ets->table = g_object_new (E_TABLE_TYPE, NULL);
-
- gtk_scrolled_window_set_policy (scrolled_window, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_scrolled_window_set_shadow_type (scrolled_window, 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_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
-{
- ETableScrolled *ets = E_TABLE_SCROLLED (object);
-
- switch (prop_id){
- case PROP_TABLE:
- g_value_set_object (value, ets->table);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- 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 (GtkWidget *container, GtkDirectionType direction)
-{
- ETableScrolled *ets;
-
- ets = E_TABLE_SCROLLED (container);
-
- return gtk_widget_child_focus (GTK_WIDGET (ets->table), direction);
-}
-
-static void
-e_table_scrolled_class_init (ETableScrolledClass *class)
-{
- GObjectClass *object_class;
- GtkWidgetClass *widget_class;
- GtkContainerClass *container_class;
-
- object_class = (GObjectClass *) class;
- widget_class = (GtkWidgetClass *) class;
- container_class = (GtkContainerClass *) class;
-
- parent_class = g_type_class_ref (PARENT_TYPE);
-
- object_class->get_property = ets_get_property;
-
- widget_class->grab_focus = ets_grab_focus;
-
- widget_class->focus = ets_focus;
-
- g_object_class_install_property (object_class, PROP_TABLE,
- g_param_spec_object ("table",
- _( "Table" ),
- _( "Table" ),
- E_TABLE_TYPE,
- G_PARAM_READABLE));
-}
-
-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 40de97e99e..0000000000
--- a/widgets/table/e-table-scrolled.h
+++ /dev/null
@@ -1,76 +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 <gtk/gtkscrolledwindow.h>
-#include <gal/e-table/e-table-model.h>
-#include <gal/e-table/e-table.h>
-
-G_BEGIN_DECLS
-
-#define E_TABLE_SCROLLED_TYPE (e_table_scrolled_get_type ())
-#define E_TABLE_SCROLLED(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_SCROLLED_TYPE, ETableScrolled))
-#define E_TABLE_SCROLLED_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_SCROLLED_TYPE, ETableScrolledClass))
-#define E_IS_TABLE_SCROLLED(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_SCROLLED_TYPE))
-#define E_IS_TABLE_SCROLLED_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TABLE_SCROLLED_TYPE))
-
-typedef struct {
- GtkScrolledWindow parent;
-
- ETable *table;
-} ETableScrolled;
-
-typedef struct {
- GtkScrolledWindowClass parent_class;
-} ETableScrolledClass;
-
-GType 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);
-
-G_END_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 c0460e4524..0000000000
--- a/widgets/table/e-table-search.c
+++ /dev/null
@@ -1,223 +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 "e-table-search.h"
-#include "gal/util/e-util.h"
-
-#include <string.h>
-
-#define d(x)
-
-d(static gint depth = 0);
-
-struct _ETableSearchPrivate {
- guint timeout_id;
-
- char *search_string;
- gunichar last_character;
-};
-
-static GObjectClass *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);
-
- g_signal_emit (G_OBJECT (e_table_search),
- e_table_search_signals [SEARCH_SEARCH],
- 0, 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));
-
- g_signal_emit (G_OBJECT (e_table_search),
- e_table_search_signals [SEARCH_ACCEPT], 0);
-}
-
-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_finalize (GObject *object)
-{
- ETableSearch *ets = (ETableSearch *) object;
-
- drop_timeout (ets);
- g_free (ets->priv->search_string);
- g_free (ets->priv);
-
- if (e_table_search_parent_class->finalize)
- (*e_table_search_parent_class->finalize)(object);
-}
-
-static void
-e_table_search_class_init (GObjectClass *object_class)
-{
- ETableSearchClass *klass = E_TABLE_SEARCH_CLASS(object_class);
- e_table_search_parent_class = g_type_class_peek_parent (klass);
-
- object_class->finalize = e_table_search_finalize;
-
- e_table_search_signals [SEARCH_SEARCH] =
- g_signal_new ("search",
- E_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableSearchClass, search),
- (GSignalAccumulator) NULL, NULL,
- e_marshal_BOOLEAN__STRING_INT,
- G_TYPE_BOOLEAN, 2, G_TYPE_STRING, G_TYPE_INT);
-
- e_table_search_signals [SEARCH_ACCEPT] =
- g_signal_new ("accept",
- E_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableSearchClass, accept),
- (GSignalAccumulator) NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- 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;
-}
-
-
-E_MAKE_TYPE(e_table_search, "ETableSearch", ETableSearch, e_table_search_class_init, e_table_search_init, G_TYPE_OBJECT)
-
-ETableSearch *
-e_table_search_new (void)
-{
- ETableSearch *ets = g_object_new (E_TABLE_SEARCH_TYPE, NULL);
-
- 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 b3cdd9ff41..0000000000
--- a/widgets/table/e-table-search.h
+++ /dev/null
@@ -1,71 +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>
-
-G_BEGIN_DECLS
-
-#define E_TABLE_SEARCH_TYPE (e_table_search_get_type ())
-#define E_TABLE_SEARCH(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_SEARCH_TYPE, ETableSearch))
-#define E_TABLE_SEARCH_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_SEARCH_TYPE, ETableSearchClass))
-#define E_IS_TABLE_SEARCH(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_SEARCH_TYPE))
-#define E_IS_TABLE_SEARCH_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TABLE_SEARCH_TYPE))
-#define E_TABLE_SEARCH_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), E_TABLE_SEARCH_TYPE, ETableSearchClass))
-
-typedef struct _ETableSearchPrivate ETableSearchPrivate;
-
-typedef enum {
- E_TABLE_SEARCH_FLAGS_CHECK_CURSOR_FIRST = 1 << 0
-} ETableSearchFlags;
-
-typedef struct {
- GObject base;
-
- ETableSearchPrivate *priv;
-} ETableSearch;
-
-typedef struct {
- GObjectClass parent_class;
-
- /*
- * Signals
- */
- gboolean (*search) (ETableSearch *ets, char *string /* utf8 */, ETableSearchFlags flags);
- void (*accept) (ETableSearch *ets);
-} ETableSearchClass;
-
-GType 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);
-
-G_END_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 14edf3d6de..0000000000
--- a/widgets/table/e-table-selection-model.c
+++ /dev/null
@@ -1,347 +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 "gal/util/e-i18n.h"
-#include "gal/util/e-util.h"
-
-#define PARENT_TYPE e_selection_model_array_get_type ()
-
-static ESelectionModelArray *parent_class;
-
-static gint etsm_get_row_count (ESelectionModelArray *esm);
-
-enum {
- PROP_0,
- PROP_MODEL,
- PROP_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;
- }
- if (etsm->cursor_id)
- 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);
-
- g_object_get(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) {
- g_object_ref(model);
- etsm->model_pre_change_id = g_signal_connect(G_OBJECT(model), "model_pre_change",
- G_CALLBACK(model_pre_change), etsm);
- etsm->model_changed_id = g_signal_connect(G_OBJECT(model), "model_changed",
- G_CALLBACK(model_changed), etsm);
- etsm->model_row_changed_id = g_signal_connect(G_OBJECT(model), "model_row_changed",
- G_CALLBACK(model_row_changed), etsm);
- etsm->model_cell_changed_id = g_signal_connect(G_OBJECT(model), "model_cell_changed",
- G_CALLBACK(model_cell_changed), etsm);
- etsm->model_rows_inserted_id = g_signal_connect(G_OBJECT(model), "model_rows_inserted",
- G_CALLBACK(model_rows_inserted), etsm);
- etsm->model_rows_deleted_id = g_signal_connect(G_OBJECT(model), "model_rows_deleted",
- G_CALLBACK(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) {
- g_signal_handler_disconnect(G_OBJECT(etsm->model),
- etsm->model_pre_change_id);
- g_signal_handler_disconnect(G_OBJECT(etsm->model),
- etsm->model_changed_id);
- g_signal_handler_disconnect(G_OBJECT(etsm->model),
- etsm->model_row_changed_id);
- g_signal_handler_disconnect(G_OBJECT(etsm->model),
- etsm->model_cell_changed_id);
- g_signal_handler_disconnect(G_OBJECT(etsm->model),
- etsm->model_rows_inserted_id);
- g_signal_handler_disconnect(G_OBJECT(etsm->model),
- etsm->model_rows_deleted_id);
-
- g_object_unref(etsm->model);
- }
- etsm->model = NULL;
-}
-
-static void
-etsm_dispose (GObject *object)
-{
- ETableSelectionModel *etsm;
-
- etsm = E_TABLE_SELECTION_MODEL (object);
-
- if (etsm->model_changed_idle_id)
- g_source_remove (etsm->model_changed_idle_id);
- etsm->model_changed_idle_id = 0;
-
- drop_model(etsm);
- free_hash(etsm);
-
- if (G_OBJECT_CLASS(parent_class)->dispose)
- G_OBJECT_CLASS(parent_class)->dispose (object);
-}
-
-static void
-etsm_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
-{
- ETableSelectionModel *etsm = E_TABLE_SELECTION_MODEL (object);
-
- switch (prop_id){
- case PROP_MODEL:
- g_value_set_object (value, etsm->model);
- break;
- case PROP_HEADER:
- g_value_set_object (value, etsm->eth);
- break;
- }
-}
-
-static void
-etsm_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
-{
- ETableSelectionModel *etsm = E_TABLE_SELECTION_MODEL (object);
-
- switch (prop_id){
- case PROP_MODEL:
- drop_model(etsm);
- add_model(etsm, g_value_get_object (value) ? E_TABLE_MODEL(g_value_get_object (value)) : NULL);
- break;
- case PROP_HEADER:
- etsm->eth = E_TABLE_HEADER (g_value_get_object (value));
- 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)
-{
- GObjectClass *object_class;
- ESelectionModelArrayClass *esma_class;
-
- parent_class = g_type_class_ref (PARENT_TYPE);
-
- object_class = G_OBJECT_CLASS(klass);
- esma_class = E_SELECTION_MODEL_ARRAY_CLASS(klass);
-
- object_class->dispose = etsm_dispose;
- object_class->get_property = etsm_get_property;
- object_class->set_property = etsm_set_property;
-
- esma_class->get_row_count = etsm_get_row_count;
-
- g_object_class_install_property (object_class, PROP_MODEL,
- g_param_spec_object ("model",
- _("Model"),
- /*_( */"XXX blurb" /*)*/,
- E_TABLE_MODEL_TYPE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_HEADER,
- g_param_spec_object ("header",
- _("Header"),
- /*_( */"XXX blurb" /*)*/,
- E_TABLE_HEADER_TYPE,
- G_PARAM_READWRITE));
-}
-
-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 g_object_new (E_TABLE_SELECTION_MODEL_TYPE, NULL);
-}
-
-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 f3889d6f1b..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) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_SELECTION_MODEL_TYPE, ETableSelectionModel))
-#define E_TABLE_SELECTION_MODEL_CLASS(k) (G_TYPE-CHECK_CLASS_CAST((k), E_TABLE_SELECTION_MODEL_TYPE, ETableSelectionModelClass))
-#define E_IS_TABLE_SELECTION_MODEL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_SELECTION_MODEL_TYPE))
-#define E_IS_TABLE_SELECTION_MODEL_CLASS(k) (G_TYPE_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;
-
-GType 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 b7cf8f66be..0000000000
--- a/widgets/table/e-table-simple.c
+++ /dev/null
@@ -1,289 +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"
-#include "gal/util/e-util.h"
-
-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 (GObjectClass *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;
-}
-
-E_MAKE_TYPE(e_table_simple, "ETableSimple", ETableSimple, e_table_simple_class_init, NULL, E_TABLE_MODEL_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 = g_object_new (E_TABLE_SIMPLE_TYPE, NULL);
-
- 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 39800c3118..0000000000
--- a/widgets/table/e-table-simple.h
+++ /dev/null
@@ -1,122 +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>
-
-G_BEGIN_DECLS
-
-#define E_TABLE_SIMPLE_TYPE (e_table_simple_get_type ())
-#define E_TABLE_SIMPLE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_SIMPLE_TYPE, ETableSimple))
-#define E_TABLE_SIMPLE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_SIMPLE_TYPE, ETableSimpleClass))
-#define E_IS_TABLE_SIMPLE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_SIMPLE_TYPE))
-#define E_IS_TABLE_SIMPLE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TABLE_SIMPLE_TYPE))
-#define E_TABLE_SIMPLE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), E_TABLE_SIMPLE_TYPE, ETableSimpleClass))
-
-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;
-
-GType 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);
-
-G_END_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 05a4245899..0000000000
--- a/widgets/table/e-table-size-test.c
+++ /dev/null
@@ -1,307 +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_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 ba8f9050ab..0000000000
--- a/widgets/table/e-table-sort-info.c
+++ /dev/null
@@ -1,481 +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 "gal/util/e-util.h"
-#include "gal/util/e-xml-utils.h"
-#include <string.h>
-
-#define ETM_CLASS(e) (E_TABLE_SORT_INFO_GET_CLASS (e))
-
-static GObjectClass *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_finalize (GObject *object)
-{
- ETableSortInfo *etsi = E_TABLE_SORT_INFO (object);
-
- if (etsi->groupings)
- g_free(etsi->groupings);
- etsi->groupings = NULL;
-
- if (etsi->sortings)
- g_free(etsi->sortings);
- etsi->sortings = NULL;
-
- G_OBJECT_CLASS (e_table_sort_info_parent_class)->finalize (object);
-}
-
-static void
-e_table_sort_info_init (ETableSortInfo *info)
-{
- 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)
-{
- GObjectClass * object_class = G_OBJECT_CLASS (klass);
-
- e_table_sort_info_parent_class = g_type_class_peek_parent (klass);
-
- object_class->finalize = etsi_finalize;
-
- e_table_sort_info_signals [SORT_INFO_CHANGED] =
- g_signal_new ("sort_info_changed",
- E_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableSortInfoClass, sort_info_changed),
- (GSignalAccumulator) NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- e_table_sort_info_signals [GROUP_INFO_CHANGED] =
- g_signal_new ("group_info_changed",
- E_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableSortInfoClass, group_info_changed),
- (GSignalAccumulator) NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- klass->sort_info_changed = NULL;
- klass->group_info_changed = NULL;
-}
-
-E_MAKE_TYPE(e_table_sort_info, "ETableSortInfo", ETableSortInfo,
- e_table_sort_info_class_init, e_table_sort_info_init, G_TYPE_OBJECT)
-
-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 {
- g_signal_emit (G_OBJECT (info), e_table_sort_info_signals [SORT_INFO_CHANGED], 0);
- }
-}
-
-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 {
- g_signal_emit (G_OBJECT (info), e_table_sort_info_signals [GROUP_INFO_CHANGED], 0);
- }
-}
-
-/**
- * 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 g_object_new (E_TABLE_SORT_INFO_TYPE, NULL);
-}
-
-/**
- * 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 {
- gint gcnt = 0;
- gint scnt = 0;
- for (grouping = node->children; grouping; grouping = grouping->next) {
- ETableSortColumn column;
-
- if (grouping->type != XML_ELEMENT_NODE)
- continue;
-
- if (!strcmp (grouping->name, "group")) {
- 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, gcnt++, column);
- } else if (!strcmp (grouping->name, "leaf")) {
- 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, scnt++, column);
- }
- }
- }
- g_signal_emit (G_OBJECT (info), e_table_sort_info_signals [SORT_INFO_CHANGED], 0);
-}
-
-/**
- * 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 4710fbd453..0000000000
--- a/widgets/table/e-table-sort-info.h
+++ /dev/null
@@ -1,107 +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 <glib-object.h>
-#include <libxml/tree.h>
-
-G_BEGIN_DECLS
-
-#define E_TABLE_SORT_INFO_TYPE (e_table_sort_info_get_type ())
-#define E_TABLE_SORT_INFO(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_SORT_INFO_TYPE, ETableSortInfo))
-#define E_TABLE_SORT_INFO_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_SORT_INFO_TYPE, ETableSortInfoClass))
-#define E_IS_TABLE_SORT_INFO(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_SORT_INFO_TYPE))
-#define E_IS_TABLE_SORT_INFO_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TABLE_SORT_INFO_TYPE))
-#define E_TABLE_SORT_INFO_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), E_TABLE_SORT_INFO_TYPE, ETableSortInfoClass))
-
-typedef struct _ETableSortColumn ETableSortColumn;
-
-struct _ETableSortColumn {
- guint column : 31;
- guint ascending : 1;
-};
-
-typedef struct {
- GObject 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 {
- GObjectClass parent_class;
-
- /*
- * Signals
- */
- void (*sort_info_changed) (ETableSortInfo *info);
- void (*group_info_changed) (ETableSortInfo *info);
-} ETableSortInfoClass;
-
-GType 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);
-
-G_END_DECLS
-
-#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 1e271f997f..0000000000
--- a/widgets/table/e-table-sorted-variable.c
+++ /dev/null
@@ -1,228 +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 <string.h>
-#include "gal/util/e-util.h"
-#include "e-table-sorted-variable.h"
-#include "e-table-sorting-utils.h"
-
-#define d(x)
-
-#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_dispose (GObject *object)
-{
- ETableSortedVariable *etsv = E_TABLE_SORTED_VARIABLE (object);
-
- if (etsv->sort_info_changed_id)
- g_signal_handler_disconnect (G_OBJECT (etsv->sort_info),
- etsv->sort_info_changed_id);
- etsv->sort_info_changed_id = 0;
-
- if (etsv->sort_idle_id) {
- g_source_remove(etsv->sort_idle_id);
- etsv->sort_idle_id = 0;
- }
- if (etsv->insert_idle_id) {
- g_source_remove(etsv->insert_idle_id);
- etsv->insert_idle_id = 0;
- }
-
- if (etsv->sort_info)
- g_object_unref(etsv->sort_info);
- etsv->sort_info = NULL;
-
- if (etsv->full_header)
- g_object_unref(etsv->full_header);
- etsv->full_header = NULL;
-
- G_OBJECT_CLASS (etsv_parent_class)->dispose (object);
-}
-
-static void
-etsv_class_init (GObjectClass *object_class)
-{
- ETableSubsetVariableClass *etssv_class = E_TABLE_SUBSET_VARIABLE_CLASS(object_class);
-
- etsv_parent_class = g_type_class_peek_parent (object_class);
-
- object_class->dispose = etsv_dispose;
-
- 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, E_TABLE_SUBSET_VARIABLE_TYPE)
-
-static gboolean
-etsv_sort_idle(ETableSortedVariable *etsv)
-{
- g_object_ref(etsv);
- etsv_sort(etsv);
- etsv->sort_idle_id = 0;
- etsv->insert_count = 0;
- g_object_unref(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 = g_object_new (E_TABLE_SORTED_VARIABLE_TYPE, NULL);
- ETableSubsetVariable *etssv = E_TABLE_SUBSET_VARIABLE (etsv);
-
- if (e_table_subset_variable_construct (etssv, source) == NULL){
- g_object_unref (etsv);
- return NULL;
- }
-
- etsv->sort_info = sort_info;
- g_object_ref(etsv->sort_info);
- etsv->full_header = full_header;
- g_object_ref(etsv->full_header);
-
- etsv->sort_info_changed_id = g_signal_connect (G_OBJECT (sort_info), "sort_info_changed",
- G_CALLBACK (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 546d04b240..0000000000
--- a/widgets/table/e-table-sorted-variable.h
+++ /dev/null
@@ -1,65 +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 <glib-object.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>
-
-G_BEGIN_DECLS
-
-#define E_TABLE_SORTED_VARIABLE_TYPE (e_table_sorted_variable_get_type ())
-#define E_TABLE_SORTED_VARIABLE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_SORTED_VARIABLE_TYPE, ETableSortedVariable))
-#define E_TABLE_SORTED_VARIABLE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_SORTED_VARIABLE_TYPE, ETableSortedVariableClass))
-#define E_IS_TABLE_SORTED_VARIABLE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_SORTED_VARIABLE_TYPE))
-#define E_IS_TABLE_SORTED_VARIABLE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TABLE_SORTED_VARIABLE_TYPE))
-#define E_TABLE_SORTED_VARIABLE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), E_TABLE_SORTED_VARIABLE_TYPE, ETableSortedVariableClass))
-
-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;
-
-GType e_table_sorted_variable_get_type (void);
-ETableModel *e_table_sorted_variable_new (ETableModel *etm, ETableHeader *header, ETableSortInfo *sort_info);
-
-G_END_DECLS
-
-#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 a5b5acb8cf..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 <string.h>
-#include "gal/util/e-util.h"
-#include "e-table-sorted.h"
-#include "e-table-sorting-utils.h"
-
-#define d(x)
-
-#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_dispose (GObject *object)
-{
- ETableSorted *ets = E_TABLE_SORTED (object);
-
- if (ets->sort_idle_id)
- g_source_remove(ets->sort_idle_id);
- ets->sort_idle_id = 0;
-
- if (ets->insert_idle_id)
- g_source_remove(ets->insert_idle_id);
- ets->insert_idle_id = 0;
-
- if (ets->sort_info) {
- g_signal_handler_disconnect (G_OBJECT (ets->sort_info),
- ets->sort_info_changed_id);
- g_object_unref(ets->sort_info);
- ets->sort_info = NULL;
- }
-
- if (ets->full_header)
- g_object_unref(ets->full_header);
- ets->full_header = NULL;
-
- G_OBJECT_CLASS (ets_parent_class)->dispose (object);
-}
-
-static void
-ets_class_init (GObjectClass *object_class)
-{
- ETableSubsetClass *etss_class = E_TABLE_SUBSET_CLASS(object_class);
-
- ets_parent_class = g_type_class_peek_parent (object_class);
-
- 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->dispose = ets_dispose;
-}
-
-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, E_TABLE_SUBSET_TYPE)
-
-static gboolean
-ets_sort_idle(ETableSorted *ets)
-{
- g_object_ref(ets);
- ets_sort(ets);
- ets->sort_idle_id = 0;
- ets->insert_count = 0;
- g_object_unref(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 = g_object_new (E_TABLE_SORTED_TYPE, NULL);
- 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){
- g_object_unref (ets);
- return NULL;
- }
-
- ets->sort_info = sort_info;
- g_object_ref(ets->sort_info);
- ets->full_header = full_header;
- g_object_ref(ets->full_header);
-
- ets_proxy_model_changed(etss, source);
-
- ets->sort_info_changed_id = g_signal_connect (G_OBJECT (sort_info), "sort_info_changed",
- G_CALLBACK (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 e1265b0a08..0000000000
--- a/widgets/table/e-table-sorted.h
+++ /dev/null
@@ -1,65 +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 <glib-object.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>
-
-G_BEGIN_DECLS
-
-#define E_TABLE_SORTED_TYPE (e_table_sorted_get_type ())
-#define E_TABLE_SORTED(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_SORTED_TYPE, ETableSorted))
-#define E_TABLE_SORTED_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_SORTED_TYPE, ETableSortedClass))
-#define E_IS_TABLE_SORTED(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_SORTED_TYPE))
-#define E_IS_TABLE_SORTED_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TABLE_SORTED_TYPE))
-#define E_TABLE_SORTED_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((obj), E_TABLE_SORTED_TYPE, ETableSortedClass))
-
-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;
-
-GType e_table_sorted_get_type (void);
-ETableModel *e_table_sorted_new (ETableModel *etm, ETableHeader *header, ETableSortInfo *sort_info);
-
-G_END_DECLS
-
-#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 a92af49f4d..0000000000
--- a/widgets/table/e-table-sorter.c
+++ /dev/null
@@ -1,462 +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 "gal/util/e-i18n.h"
-#include "gal/util/e-util.h"
-#include "e-table-sorter.h"
-
-#define d(x)
-
-/* The arguments we take */
-enum {
- PROP_0,
- PROP_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_dispose (GObject *object)
-{
- ETableSorter *ets = E_TABLE_SORTER (object);
-
- if (ets->sort_info) {
- if (ets->table_model_changed_id)
- g_signal_handler_disconnect (ets->source,
- ets->table_model_changed_id);
- if (ets->table_model_row_changed_id)
- g_signal_handler_disconnect (ets->source,
- ets->table_model_row_changed_id);
- if (ets->table_model_cell_changed_id)
- g_signal_handler_disconnect (ets->source,
- ets->table_model_cell_changed_id);
- if (ets->table_model_rows_inserted_id)
- g_signal_handler_disconnect (ets->source,
- ets->table_model_rows_inserted_id);
- if (ets->table_model_rows_deleted_id)
- g_signal_handler_disconnect (ets->source,
- ets->table_model_rows_deleted_id);
- if (ets->sort_info_changed_id)
- g_signal_handler_disconnect (ets->sort_info,
- ets->sort_info_changed_id);
- if (ets->group_info_changed_id)
- g_signal_handler_disconnect (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;
-
- g_object_unref(ets->sort_info);
- ets->sort_info = NULL;
- }
-
- if (ets->full_header)
- g_object_unref(ets->full_header);
- ets->full_header = NULL;
-
- if (ets->source)
- g_object_unref(ets->source);
- ets->source = NULL;
-
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static void
-ets_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
-{
- ETableSorter *ets = E_TABLE_SORTER (object);
-
- switch (prop_id) {
- case PROP_SORT_INFO:
- if (ets->sort_info) {
- if (ets->sort_info_changed_id)
- g_signal_handler_disconnect(ets->sort_info, ets->sort_info_changed_id);
- if (ets->group_info_changed_id)
- g_signal_handler_disconnect(ets->sort_info, ets->group_info_changed_id);
- g_object_unref(ets->sort_info);
- }
-
- ets->sort_info = E_TABLE_SORT_INFO(g_value_get_object (value));
- g_object_ref(ets->sort_info);
- ets->sort_info_changed_id = g_signal_connect (ets->sort_info, "sort_info_changed",
- G_CALLBACK (ets_sort_info_changed), ets);
- ets->group_info_changed_id = g_signal_connect (ets->sort_info, "group_info_changed",
- G_CALLBACK (ets_sort_info_changed), ets);
-
- ets_clean (ets);
- break;
- default:
- break;
- }
-}
-
-static void
-ets_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
-{
- ETableSorter *ets = E_TABLE_SORTER (object);
- switch (prop_id) {
- case PROP_SORT_INFO:
- g_value_set_object (value, ets->sort_info);
- break;
- }
-}
-
-static void
-ets_class_init (ETableSorterClass *klass)
-{
- GObjectClass *object_class = G_OBJECT_CLASS(klass);
- ESorterClass *sorter_class = E_SORTER_CLASS(klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
- object_class->dispose = ets_dispose;
- object_class->set_property = ets_set_property;
- object_class->get_property = ets_get_property;
-
- 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 ;
-
- g_object_class_install_property (object_class, PROP_SORT_INFO,
- g_param_spec_object ("sort_info",
- _("Sort Info"),
- /*_( */"XXX blurb" /*)*/,
- E_TABLE_SORT_INFO_TYPE,
- G_PARAM_READWRITE));
-}
-
-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 = g_object_new (E_TABLE_SORTER_TYPE, NULL);
-
- ets->sort_info = sort_info;
- g_object_ref(ets->sort_info);
- ets->full_header = full_header;
- g_object_ref(ets->full_header);
- ets->source = source;
- g_object_ref(ets->source);
-
- ets->table_model_changed_id = g_signal_connect (source, "model_changed",
- G_CALLBACK (ets_model_changed), ets);
- ets->table_model_row_changed_id = g_signal_connect (source, "model_row_changed",
- G_CALLBACK (ets_model_row_changed), ets);
- ets->table_model_cell_changed_id = g_signal_connect (source, "model_cell_changed",
- G_CALLBACK (ets_model_cell_changed), ets);
- ets->table_model_rows_inserted_id = g_signal_connect (source, "model_rows_inserted",
- G_CALLBACK (ets_model_rows_inserted), ets);
- ets->table_model_rows_deleted_id = g_signal_connect (source, "model_rows_deleted",
- G_CALLBACK (ets_model_rows_deleted), ets);
- ets->sort_info_changed_id = g_signal_connect (sort_info, "sort_info_changed",
- G_CALLBACK (ets_sort_info_changed), ets);
- ets->group_info_changed_id = g_signal_connect (sort_info, "group_info_changed",
- G_CALLBACK (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 67be48715a..0000000000
--- a/widgets/table/e-table-sorter.h
+++ /dev/null
@@ -1,74 +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 <glib-object.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>
-
-G_BEGIN_DECLS
-
-#define E_TABLE_SORTER_TYPE (e_table_sorter_get_type ())
-#define E_TABLE_SORTER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_SORTER_TYPE, ETableSorter))
-#define E_TABLE_SORTER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_SORTER_TYPE, ETableSorterClass))
-#define E_IS_TABLE_SORTER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_SORTER_TYPE))
-#define E_IS_TABLE_SORTER_CLASS(k) (G_TYPE_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;
-
-GType e_table_sorter_get_type (void);
-ETableSorter *e_table_sorter_new (ETableModel *etm,
- ETableHeader *full_header,
- ETableSortInfo *sort_info);
-G_END_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 80a9564a36..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->compare_col, row1),
- e_table_model_value_at (source, col->compare_col, 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->compare_col, 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->compare_col)
- 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->compare_col),
- e_tree_model_value_at (source, path2, col->compare_col));
- 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->compare_col);
- }
- 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 3fcc28689d..0000000000
--- a/widgets/table/e-table-specification.c
+++ /dev/null
@@ -1,432 +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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "e-table-specification.h"
-
-#include <stdlib.h>
-#include <string.h>
-
-#include <libxml/parser.h>
-#include <libxml/xmlmemory.h>
-#include "gal/util/e-util.h"
-#include "gal/util/e-xml-utils.h"
-
-static GObjectClass *etsp_parent_class;
-
-static void
-etsp_finalize (GObject *object)
-{
- ETableSpecification *etsp = E_TABLE_SPECIFICATION (object);
- int i;
-
- if (etsp->columns) {
- for (i = 0; etsp->columns[i]; i++) {
- g_object_unref (etsp->columns[i]);
- }
- g_free (etsp->columns);
- etsp->columns = NULL;
- }
-
- if (etsp->state)
- g_object_unref (etsp->state);
- etsp->state = NULL;
-
- g_free (etsp->click_to_add_message);
- etsp->click_to_add_message = NULL;
-
- g_free (etsp->domain);
- etsp->domain = NULL;
-
- etsp_parent_class->finalize (object);
-}
-
-static void
-etsp_class_init (GObjectClass *klass)
-{
- etsp_parent_class = g_type_class_peek_parent (klass);
-
- klass->finalize = etsp_finalize;
-}
-
-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;
- etsp->domain = NULL;
-}
-
-E_MAKE_TYPE (e_table_specification, "ETableSpecification", ETableSpecification, etsp_class_init, etsp_init, G_TYPE_OBJECT)
-
-/**
- * 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 = g_object_new (E_TABLE_SPECIFICATION_TYPE, NULL);
-
- 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;
-
- if (!g_file_test (filename, G_FILE_TEST_EXISTS))
- return FALSE;
-
- 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");
-
- g_free (specification->domain);
- specification->domain =
- e_xml_get_string_prop_by_name (
- node, "gettext-domain");
- if (specification->domain && !*specification->domain) {
- g_free (specification->domain);
- specification->domain = NULL;
- }
-
- if (specification->state)
- g_object_unref (specification->state);
- specification->state = NULL;
- if (specification->columns) {
- for (i = 0; specification->columns[i]; i++) {
- g_object_unref (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);
- }
- }
-
- if (specification->state == NULL) {
- /* Make the default state. */
- specification->state = e_table_state_vanilla (g_list_length (list));
- }
-
- 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: 0 on success or -1 on error.
- */
-int
-e_table_specification_save_to_file (ETableSpecification *specification,
- const char *filename)
-{
- xmlDoc *doc;
- int ret;
-
- 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);
-
- if ((doc = xmlNewDoc ("1.0")) == NULL)
- return -1;
-
- xmlDocSetRootElement (doc, e_table_specification_save_to_node (specification, doc));
-
- ret = e_xml_save_file (filename, doc);
-
- xmlFreeDoc (doc);
-
- return ret;
-}
-
-/**
- * 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);
- xmlSetProp (node, "gettext-domain", specification->domain);
-
- 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 961752b9b8..0000000000
--- a/widgets/table/e-table-specification.h
+++ /dev/null
@@ -1,89 +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 <glib-object.h>
-#include <libxml/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>
-
-G_BEGIN_DECLS
-
-#define E_TABLE_SPECIFICATION_TYPE (e_table_specification_get_type ())
-#define E_TABLE_SPECIFICATION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_SPECIFICATION_TYPE, ETableSpecification))
-#define E_TABLE_SPECIFICATION_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_SPECIFICATION_TYPE, ETableSpecificationClass))
-#define E_IS_TABLE_SPECIFICATION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_SPECIFICATION_TYPE))
-#define E_IS_TABLE_SPECIFICATION_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TABLE_SPECIFICATION_TYPE))
-#define E_TABLE_SPECIFICATION_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), E_TABLE_SPECIFICATION_TYPE, ETableSpecificationClass))
-
-typedef struct {
- GObject 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;
- char *domain;
-} ETableSpecification;
-
-typedef struct {
- GObjectClass parent_class;
-} ETableSpecificationClass;
-
-GType 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);
-
-G_END_DECLS
-
-#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 c66e5933e0..0000000000
--- a/widgets/table/e-table-state.c
+++ /dev/null
@@ -1,299 +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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <string.h>
-
-#include <libxml/parser.h>
-#include <libxml/xmlmemory.h>
-#include "gal/util/e-util.h"
-#include "gal/util/e-xml-utils.h"
-#include "e-table-state.h"
-
-
-#define STATE_VERSION 0.1
-
-static GObjectClass *etst_parent_class;
-
-static void
-etst_dispose (GObject *object)
-{
- ETableState *etst = E_TABLE_STATE (object);
-
- if (etst->sort_info) {
- g_object_unref (etst->sort_info);
- etst->sort_info = NULL;
- }
-
- G_OBJECT_CLASS (etst_parent_class)->dispose (object);
-}
-
-static void
-etst_finalize (GObject *object)
-{
- ETableState *etst = E_TABLE_STATE (object);
-
- if (etst->columns) {
- g_free (etst->columns);
- etst->columns = NULL;
- }
-
- if (etst->expansions) {
- g_free (etst->expansions);
- etst->expansions = NULL;
- }
-
- G_OBJECT_CLASS (etst_parent_class)->finalize (object);
-}
-
-static void
-etst_class_init (GObjectClass *klass)
-{
- etst_parent_class = g_type_class_peek_parent (klass);
-
- klass->dispose = etst_dispose;
- klass->finalize = etst_finalize;
-}
-
-static void
-etst_init (ETableState *state)
-{
- 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, G_TYPE_OBJECT)
-
-ETableState *
-e_table_state_new (void)
-{
- return (ETableState *) g_object_new (E_TABLE_STATE_TYPE, NULL);
-}
-
-ETableState *
-e_table_state_vanilla (int col_count)
-{
- GString *str;
- int i;
- ETableState *res;
-
- str = g_string_new ("<ETableState>\n");
- for (i = 0; i < col_count; i++)
- g_string_append_printf (str, " <column source=\"%d\"/>\n", i);
- g_string_append (str, " <grouping></grouping>\n");
- g_string_append (str, "</ETableState>\n");
-
- res = e_table_state_new ();
- e_table_state_load_from_string (res, str->str);
-
- g_string_free (str, TRUE);
- return res;
-}
-
-gboolean
-e_table_state_load_from_file (ETableState *state,
- const char *filename)
-{
- xmlDoc *doc;
-
- if (!g_file_test (filename, G_FILE_TEST_EXISTS))
- return FALSE;
-
- 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)
- g_object_unref (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;
-
- if ((doc = xmlNewDoc ("1.0")) == NULL)
- return;
-
- xmlDocSetRootElement (doc, e_table_state_save_to_node (state, NULL));
-
- e_xml_save_file (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 47e0c7b9b8..0000000000
--- a/widgets/table/e-table-state.h
+++ /dev/null
@@ -1,74 +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 <glib-object.h>
-#include <libxml/tree.h>
-#include <gal/e-table/e-table-sort-info.h>
-
-G_BEGIN_DECLS
-
-#define E_TABLE_STATE_TYPE (e_table_state_get_type ())
-#define E_TABLE_STATE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_STATE_TYPE, ETableState))
-#define E_TABLE_STATE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_STATE_TYPE, ETableStateClass))
-#define E_IS_TABLE_STATE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_STATE_TYPE))
-#define E_IS_TABLE_STATE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TABLE_STATE_TYPE))
-#define E_TABLE_STATE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), E_TABLE_STATE_TYPE, ETableStateClass))
-
-typedef struct {
- GObject base;
-
- ETableSortInfo *sort_info;
- int col_count;
- int *columns;
- double *expansions;
-} ETableState;
-
-typedef struct {
- GObjectClass parent_class;
-} ETableStateClass;
-
-GType e_table_state_get_type (void);
-ETableState *e_table_state_new (void);
-
-ETableState *e_table_state_vanilla (int col_count);
-
-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);
-
-G_END_DECLS
-
-#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 efe6529806..0000000000
--- a/widgets/table/e-table-subset-variable.c
+++ /dev/null
@@ -1,250 +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 "gal/util/e-util.h"
-#include "e-table-subset-variable.h"
-
-#define ETSSV_CLASS(e) (E_TABLE_SUBSET_VARIABLE_GET_CLASS (e))
-
-#define INCREMENT_AMOUNT 10
-
-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 (GObjectClass *object_class)
-{
- ETableSubsetVariableClass *klass = E_TABLE_SUBSET_VARIABLE_CLASS(object_class);
-
- 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, E_TABLE_SUBSET_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 = g_object_new (E_TABLE_SUBSET_VARIABLE_TYPE, NULL);
-
- if (e_table_subset_variable_construct (etssv, source) == NULL){
- g_object_unref (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 2dc0914f9b..0000000000
--- a/widgets/table/e-table-subset-variable.h
+++ /dev/null
@@ -1,82 +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 <glib-object.h>
-#include <gal/e-table/e-table-subset.h>
-
-G_BEGIN_DECLS
-
-#define E_TABLE_SUBSET_VARIABLE_TYPE (e_table_subset_variable_get_type ())
-#define E_TABLE_SUBSET_VARIABLE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_SUBSET_VARIABLE_TYPE, ETableSubsetVariable))
-#define E_TABLE_SUBSET_VARIABLE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_SUBSET_VARIABLE_TYPE, ETableSubsetVariableClass))
-#define E_IS_TABLE_SUBSET_VARIABLE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_SUBSET_VARIABLE_TYPE))
-#define E_IS_TABLE_SUBSET_VARIABLE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TABLE_SUBSET_VARIABLE_TYPE))
-#define E_TABLE_SUBSET_VARIABLE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), E_TABLE_SUBSET_VARIABLE_TYPE, ETableSubsetVariableClass))
-
-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;
-
-GType 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);
-G_END_DECLS
-
-#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 a237ba2d94..0000000000
--- a/widgets/table/e-table-subset.c
+++ /dev/null
@@ -1,482 +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 "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 d(x)
-
-static ETableModelClass *etss_parent_class;
-
-#define ETSS_CLASS(object) (E_TABLE_SUBSET_GET_CLASS(object))
-
-#define VALID_ROW(etss, row) (row >= -1 && row < etss->n_map)
-#define MAP_ROW(etss, row) (row == -1 ? -1 : etss->map_table[row])
-
-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_dispose (GObject *object)
-{
- ETableSubset *etss = E_TABLE_SUBSET (object);
-
- if (etss->source) {
- g_signal_handler_disconnect (G_OBJECT (etss->source),
- etss->table_model_pre_change_id);
- g_signal_handler_disconnect (G_OBJECT (etss->source),
- etss->table_model_no_change_id);
- g_signal_handler_disconnect (G_OBJECT (etss->source),
- etss->table_model_changed_id);
- g_signal_handler_disconnect (G_OBJECT (etss->source),
- etss->table_model_row_changed_id);
- g_signal_handler_disconnect (G_OBJECT (etss->source),
- etss->table_model_cell_changed_id);
- g_signal_handler_disconnect (G_OBJECT (etss->source),
- etss->table_model_rows_inserted_id);
- g_signal_handler_disconnect (G_OBJECT (etss->source),
- etss->table_model_rows_deleted_id);
-
- g_object_unref (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_OBJECT_CLASS (etss_parent_class)->dispose (object);
-}
-
-static void
-etss_finalize (GObject *object)
-{
- ETableSubset *etss = E_TABLE_SUBSET (object);
-
- g_free (etss->map_table);
- etss->map_table = NULL;
-
- G_OBJECT_CLASS (etss_parent_class)->finalize (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;
-
- g_return_val_if_fail (VALID_ROW (etss, row), NULL);
-
- etss->last_access = row;
- d(g_print("g) Setting last_access to %d\n", row));
- return e_table_model_value_at (etss->source, col, MAP_ROW(etss, row));
-}
-
-static void
-etss_set_value_at (ETableModel *etm, int col, int row, const void *val)
-{
- ETableSubset *etss = (ETableSubset *)etm;
-
- g_return_if_fail (VALID_ROW (etss, row));
-
- etss->last_access = row;
- d(g_print("h) Setting last_access to %d\n", row));
- e_table_model_set_value_at (etss->source, col, MAP_ROW(etss, row), val);
-}
-
-static gboolean
-etss_is_cell_editable (ETableModel *etm, int col, int row)
-{
- ETableSubset *etss = (ETableSubset *)etm;
-
- g_return_val_if_fail (VALID_ROW (etss, row), FALSE);
-
- return e_table_model_is_cell_editable (etss->source, col, MAP_ROW(etss, 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;
-
- g_return_val_if_fail (VALID_ROW (etss, row), NULL);
-
- if (e_table_model_has_save_id (etss->source))
- return e_table_model_get_save_id (etss->source, MAP_ROW(etss, row));
- else
- return g_strdup_printf ("%d", MAP_ROW(etss, 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 (GObjectClass *object_class)
-{
- ETableSubsetClass *klass = (ETableSubsetClass *) object_class;
- ETableModelClass *table_class = (ETableModelClass *) object_class;
-
- etss_parent_class = g_type_class_peek_parent (klass);
-
- object_class->dispose = etss_dispose;
- object_class->finalize = etss_finalize;
-
- 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, E_TABLE_MODEL_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;
- g_object_ref (source);
-
- /* Init */
- for (i = 0; i < nvals; i++)
- etss->map_table [i] = i;
-
- etss->table_model_pre_change_id = g_signal_connect (G_OBJECT (source), "model_pre_change",
- G_CALLBACK (etss_proxy_model_pre_change), etss);
- etss->table_model_no_change_id = g_signal_connect (G_OBJECT (source), "model_no_change",
- G_CALLBACK (etss_proxy_model_no_change), etss);
- etss->table_model_changed_id = g_signal_connect (G_OBJECT (source), "model_changed",
- G_CALLBACK (etss_proxy_model_changed), etss);
- etss->table_model_row_changed_id = g_signal_connect (G_OBJECT (source), "model_row_changed",
- G_CALLBACK (etss_proxy_model_row_changed), etss);
- etss->table_model_cell_changed_id = g_signal_connect (G_OBJECT (source), "model_cell_changed",
- G_CALLBACK (etss_proxy_model_cell_changed), etss);
- etss->table_model_rows_inserted_id = g_signal_connect (G_OBJECT (source), "model_rows_inserted",
- G_CALLBACK (etss_proxy_model_rows_inserted), etss);
- etss->table_model_rows_deleted_id = g_signal_connect (G_OBJECT (source), "model_rows_deleted",
- G_CALLBACK (etss_proxy_model_rows_deleted), etss);
-
- return E_TABLE_MODEL (etss);
-}
-
-ETableModel *
-e_table_subset_new (ETableModel *source, const int nvals)
-{
- ETableSubset *etss = g_object_new (E_TABLE_SUBSET_TYPE, NULL);
-
- if (e_table_subset_construct (etss, source, nvals) == NULL){
- g_object_unref (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 505aa6c305..0000000000
--- a/widgets/table/e-table-subset.h
+++ /dev/null
@@ -1,89 +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 <glib-object.h>
-#include <gal/e-table/e-table-model.h>
-
-G_BEGIN_DECLS
-
-#define E_TABLE_SUBSET_TYPE (e_table_subset_get_type ())
-#define E_TABLE_SUBSET(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_SUBSET_TYPE, ETableSubset))
-#define E_TABLE_SUBSET_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_SUBSET_TYPE, ETableSubsetClass))
-#define E_IS_TABLE_SUBSET(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_SUBSET_TYPE))
-#define E_IS_TABLE_SUBSET_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TABLE_SUBSET_TYPE))
-#define E_TABLE_SUBSET_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), E_TABLE_SUBSET_TYPE, ETableSubsetClass))
-
-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;
-
-GType 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);
-
-G_END_DECLS
-
-#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 81c00f9e34..0000000000
--- a/widgets/table/e-table-tooltip.h
+++ /dev/null
@@ -1,44 +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 <libgnomecanvas/gnome-canvas.h>
-
-G_BEGIN_DECLS
-
-typedef struct {
- gint timer;
- int col, row;
- int row_height;
- int x, y;
- int cx, cy;
- GdkColor *foreground;
- GdkColor *background;
- GnomeCanvasItem *eti;
-} ETableTooltip;
-
-G_END_DECLS
-
-#endif
diff --git a/widgets/table/e-table-tree.h b/widgets/table/e-table-tree.h
deleted file mode 100644
index 5648fc2f06..0000000000
--- a/widgets/table/e-table-tree.h
+++ /dev/null
@@ -1,48 +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>
-
-G_BEGIN_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);
-
-G_END_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 eec4fc79d5..0000000000
--- a/widgets/table/e-table-utils.c
+++ /dev/null
@@ -1,191 +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 "gal/widgets/e-unicode.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;
- GValue *val = g_new0 (GValue, 1);
-
- 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 ();
- g_value_init (val, G_TYPE_DOUBLE);
- g_value_set_double (val, e_table_header_width_extras (widget->style));
- g_object_set_property (G_OBJECT(nh), "width_extras", val);
- g_free (val);
-
- 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,
- const char *domain)
-{
- 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) {
- char *title = dgettext (domain, col_spec->title);
-
- title = g_strdup (title);
-
- 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, 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, title,
- col_spec->expansion, col_spec->minimum_width,
- cell, compare, col_spec->resizable, col_spec->disabled, col_spec->priority);
- }
- col->search = search;
-
- g_free (title);
- }
- if (col && col_spec->compare_col != col_spec->model_col)
- g_object_set (col,
- "compare_col", col_spec->compare_col,
- NULL);
- 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, spec->domain);
-
- if (col) {
- e_table_header_add_column (nh, col, -1);
- g_object_unref (col);
- }
- }
-
- return nh;
-}
-
-static gboolean
-check_col (ETableCol *col, gpointer user_data)
-{
- return col->search ? TRUE : FALSE;
-}
-
-ETableCol *
-e_table_util_calculate_current_search_col (ETableHeader *header, ETableHeader *full_header, ETableSortInfo *sort_info, gboolean always_search)
-{
- int i;
- int count;
- ETableCol *col = NULL;
- count = e_table_sort_info_grouping_get_count (sort_info);
- for (i = 0; i < count; i++) {
- ETableSortColumn column = e_table_sort_info_grouping_get_nth(sort_info, i);
-
- col = e_table_header_get_column (full_header, column.column);
-
- if (col && col->search)
- break;
-
- col = NULL;
- }
-
- if (col == NULL) {
- count = e_table_sort_info_sorting_get_count (sort_info);
- for (i = 0; i < count; i++) {
- ETableSortColumn column = e_table_sort_info_sorting_get_nth(sort_info, i);
-
- col = e_table_header_get_column (full_header, column.column);
-
- if (col && col->search)
- break;
-
- col = NULL;
- }
- }
-
- if (col == NULL && always_search) {
- col = e_table_header_prioritized_column_selected (header, check_col, NULL);
- }
-
- return col;
-}
diff --git a/widgets/table/e-table-utils.h b/widgets/table/e-table-utils.h
deleted file mode 100644
index 3c7fd937b6..0000000000
--- a/widgets/table/e-table-utils.h
+++ /dev/null
@@ -1,49 +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>
-
-G_BEGIN_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);
-
-ETableCol *e_table_util_calculate_current_search_col (ETableHeader *header,
- ETableHeader *full_header,
- ETableSortInfo *sort_info,
- gboolean always_search);
-
-G_END_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 e49076be0f..0000000000
--- a/widgets/table/e-table-without.c
+++ /dev/null
@@ -1,392 +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 "gal/util/e-util.h"
-#include "e-table-without.h"
-
-#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_dispose (GObject *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 (G_OBJECT_CLASS (parent_class)->dispose)
- (* G_OBJECT_CLASS (parent_class)->dispose) (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);
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- parent_class = g_type_class_ref (PARENT_TYPE);
-
- object_class->dispose = etw_dispose;
-
- 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 = g_object_new (E_TABLE_WITHOUT_TYPE, NULL);
-
- 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) {
- g_object_unref (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 6bcbdcdc65..0000000000
--- a/widgets/table/e-table-without.h
+++ /dev/null
@@ -1,91 +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) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_WITHOUT_TYPE, ETableWithout))
-#define E_TABLE_WITHOUT_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_WITHOUT_TYPE, ETableWithoutClass))
-#define E_IS_TABLE_WITHOUT(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_WITHOUT_TYPE))
-#define E_IS_TABLE_WITHOUT_CLASS(k) (G_TYPE_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;
-
-GType 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 6d0c4ee112..0000000000
--- a/widgets/table/e-table.c
+++ /dev/null
@@ -1,3272 +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.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <string.h>
-#include <stdio.h>
-#include <gdk/gdk.h>
-#include <gdk/gdkkeysyms.h>
-#include <gtk/gtksignal.h>
-#include <libgnomecanvas/gnome-canvas.h>
-#include <libgnomecanvas/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-background.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"
-
-#include <atk/atk.h>
-#include "gal/a11y/e-table/gal-a11y-e-table-factory.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 {
- PROP_0,
- PROP_LENGTH_THRESHOLD,
- PROP_MODEL,
- PROP_UNIFORM_ROW_HEIGHT,
- PROP_ALWAYS_SEARCH,
- PROP_USE_CLICK_TO_ADD
-};
-
-enum {
- ET_SCROLL_UP = 1 << 0,
- ET_SCROLL_DOWN = 1 << 1,
- ET_SCROLL_LEFT = 1 << 2,
- ET_SCROLL_RIGHT = 1 << 3
-};
-
-static guint 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 (GtkWidget *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)
- g_signal_handler_disconnect (G_OBJECT (et->model),
- et->table_model_change_id);
- if (et->table_row_change_id != 0)
- g_signal_handler_disconnect (G_OBJECT (et->model),
- et->table_row_change_id);
- if (et->table_cell_change_id != 0)
- g_signal_handler_disconnect (G_OBJECT (et->model),
- et->table_cell_change_id);
- if (et->table_rows_inserted_id != 0)
- g_signal_handler_disconnect (G_OBJECT (et->model),
- et->table_rows_inserted_id);
- if (et->table_rows_deleted_id != 0)
- g_signal_handler_disconnect (G_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)
-{
- g_signal_emit (G_OBJECT (et), et_signals [STATE_CHANGE], 0);
-}
-
-#define CHECK_HORIZONTAL(et) if ((et)->horizontal_scrolling || (et)->horizontal_resize) e_table_header_update_horizontal (et->header);
-
-static void
-clear_current_search_col (ETable *et)
-{
- et->search_col_set = FALSE;
-}
-
-static ETableCol *
-current_search_col (ETable *et)
-{
- if (!et->search_col_set) {
- et->current_search_col =
- e_table_util_calculate_current_search_col (et->header,
- et->full_header,
- et->sort_info,
- et->always_search);
- et->search_col_set = TRUE;
- }
-
- return et->current_search_col;
-}
-
-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);
- clear_current_search_col (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)
- g_signal_handler_disconnect (G_OBJECT (e_table->header),
- e_table->structure_change_id);
- if (e_table->expansion_change_id)
- g_signal_handler_disconnect (G_OBJECT (e_table->header),
- e_table->expansion_change_id);
- if (e_table->dimension_change_id)
- g_signal_handler_disconnect (G_OBJECT (e_table->header),
- e_table->dimension_change_id);
-
- g_object_unref(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 =
- g_signal_connect (G_OBJECT (e_table->header), "structure_change",
- G_CALLBACK (structure_changed), e_table);
- e_table->expansion_change_id =
- g_signal_connect (G_OBJECT (e_table->header), "expansion_change",
- G_CALLBACK (expansion_changed), e_table);
- e_table->dimension_change_id =
- g_signal_connect (G_OBJECT (e_table->header), "dimension_change",
- G_CALLBACK (dimension_changed), e_table);
-}
-
-static void
-et_dispose (GObject *object)
-{
- ETable *et = E_TABLE (object);
-
- et_disconnect_model (et);
-
- if (et->search) {
- if (et->search_search_id)
- g_signal_handler_disconnect (G_OBJECT (et->search),
- et->search_search_id);
- if (et->search_accept_id)
- g_signal_handler_disconnect (G_OBJECT (et->search),
- et->search_accept_id);
- g_object_unref (et->search);
- et->search = NULL;
- }
-
- if (et->group_info_change_id) {
- g_signal_handler_disconnect (G_OBJECT (et->sort_info),
- et->group_info_change_id);
- et->group_info_change_id = 0;
- }
-
- if (et->sort_info_change_id) {
- g_signal_handler_disconnect (G_OBJECT (et->sort_info),
- et->sort_info_change_id);
- et->sort_info_change_id = 0;
- }
-
- if (et->reflow_idle_id) {
- g_source_remove(et->reflow_idle_id);
- et->reflow_idle_id = 0;
- }
-
- scroll_off (et);
-
- disconnect_header (et);
-
- if (et->model) {
- g_object_unref (et->model);
- et->model = NULL;
- }
-
- if (et->full_header) {
- g_object_unref (et->full_header);
- et->full_header = NULL;
- }
-
- if (et->sort_info) {
- g_object_unref (et->sort_info);
- et->sort_info = NULL;
- }
-
- if (et->sorter) {
- g_object_unref (et->sorter);
- et->sorter = NULL;
- }
-
- if (et->selection) {
- g_object_unref (et->selection);
- et->selection = NULL;
- }
-
- if (et->spec) {
- g_object_unref (et->spec);
- et->spec = NULL;
- }
-
- if (et->header_canvas != NULL) {
- gtk_widget_destroy (GTK_WIDGET (et->header_canvas));
- et->header_canvas = NULL;
- }
-
- if (et->site != NULL) {
- e_table_drag_source_unset (et);
- et->site = NULL;
- }
-
- if (et->table_canvas != NULL) {
- gtk_widget_destroy (GTK_WIDGET (et->table_canvas));
- et->table_canvas = NULL;
- }
-
- if (et->rebuild_idle_id != 0) {
- g_source_remove (et->rebuild_idle_id);
- et->rebuild_idle_id = 0;
- }
-
- g_free(et->click_to_add_message);
- et->click_to_add_message = NULL;
-
- g_free(et->domain);
- et->domain = NULL;
-
- (*G_OBJECT_CLASS (parent_class)->dispose)(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;
- ETableCol *col = current_search_col (et);
-
- if (col == NULL)
- return FALSE;
-
- rows = e_table_model_row_count (et->model);
-
- g_object_get(et->selection,
- "cursor_row", &cursor,
- NULL);
-
- if ((flags & E_TABLE_SEARCH_FLAGS_CHECK_CURSOR_FIRST) && cursor < rows && cursor >= 0 && check_row (et, cursor, col->col_idx, col->search, 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->col_idx, col->search, string)) {
- e_selection_model_select_as_key_press(E_SELECTION_MODEL (et->selection), model_row, col->col_idx, 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->col_idx, col->search, string)) {
- e_selection_model_select_as_key_press(E_SELECTION_MODEL (et->selection), model_row, col->col_idx, 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->col_idx, col->search, string));
-}
-
-static void
-et_search_accept (ETableSearch *search, ETable *et)
-{
- int cursor;
- ETableCol *col = current_search_col (et);
-
- if (col == NULL)
- return;
-
- g_object_get(et->selection,
- "cursor_row", &cursor,
- NULL);
- e_selection_model_select_as_key_press(E_SELECTION_MODEL (et->selection), cursor, col->col_idx, 0);
-}
-
-static void
-init_search (ETable *e_table)
-{
- if (e_table->search != NULL)
- return;
-
- e_table->search = e_table_search_new();
-
- e_table->search_search_id =
- g_signal_connect (G_OBJECT (e_table->search), "search",
- G_CALLBACK (et_search_search), e_table);
- e_table->search_accept_id =
- g_signal_connect (G_OBJECT (e_table->search), "accept",
- G_CALLBACK (et_search_accept), e_table);
-}
-
-static void
-et_finalize (GObject *object)
-{
- ETable *et = E_TABLE (object);
-
- g_free (et->click_to_add_message);
- et->click_to_add_message = NULL;
-
- g_free(et->domain);
- et->domain = NULL;
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-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->domain = NULL;
-
- 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->always_search = g_getenv ("GAL_ALWAYS_SEARCH") ? TRUE : FALSE;
-
- e_table->search = NULL;
- e_table->search_search_id = 0;
- e_table->search_accept_id = 0;
-
- e_table->current_search_col = NULL;
-
- 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 (GtkWidget *container, GtkDirectionType direction)
-{
- ETable *e_table;
-
- e_table = E_TABLE (container);
-
- if (GTK_CONTAINER (container)->focus_child) {
- gtk_container_set_focus_child (GTK_CONTAINER (container), NULL);
- return FALSE;
- }
-
- return gtk_widget_child_focus (GTK_WIDGET (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;
- clear_current_search_col (et);
- 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)
-{
- clear_current_search_col (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);
-
- g_signal_connect (
- G_OBJECT (e_table->header_canvas), "size_allocate",
- G_CALLBACK (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);
-
- g_object_get (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);
- }
- 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;
- GValue *val = g_new0 (GValue, 1);
- g_value_init (val, G_TYPE_DOUBLE);
-
- width = alloc->width;
- g_value_set_double (val, width);
- g_object_get (e_table->canvas_vbox,
- "height", &height,
- NULL);
- item_height = height;
- height = MAX ((int)height, alloc->height);
-
- g_object_set (e_table->canvas_vbox,
- "width", width,
- NULL);
- g_object_set_property (G_OBJECT (e_table->header), "width", val);
- g_free (val);
- 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;
- g_signal_emit (G_OBJECT (et), et_signals [CURSOR_CHANGE], 0, 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)
-{
- g_signal_emit (G_OBJECT (et), et_signals [CURSOR_ACTIVATED], 0, row);
-}
-
-static void
-group_double_click (ETableGroup *etg, int row, int col, GdkEvent *event, ETable *et)
-{
- g_signal_emit (G_OBJECT (et), et_signals [DOUBLE_CLICK], 0, row, col, event);
-}
-
-static gint
-group_right_click (ETableGroup *etg, int row, int col, GdkEvent *event, ETable *et)
-{
- int return_val = 0;
- g_signal_emit (G_OBJECT (et), et_signals [RIGHT_CLICK], 0, 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;
- g_signal_emit (G_OBJECT (et), et_signals [CLICK], 0, 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:
- init_search (et);
- if (e_table_search_backspace (et->search))
- return TRUE;
- /* Fall through */
- default:
- init_search (et);
- 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);
- g_signal_emit (G_OBJECT (et), et_signals [KEY_PRESS], 0,
- 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;
- g_signal_emit (G_OBJECT (et), et_signals [START_DRAG], 0,
- 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);
-
- g_signal_connect (G_OBJECT (et->group), "cursor_change",
- G_CALLBACK (group_cursor_change), et);
- g_signal_connect (G_OBJECT (et->group), "cursor_activated",
- G_CALLBACK (group_cursor_activated), et);
- g_signal_connect (G_OBJECT (et->group), "double_click",
- G_CALLBACK (group_double_click), et);
- g_signal_connect (G_OBJECT (et->group), "right_click",
- G_CALLBACK (group_right_click), et);
- g_signal_connect (G_OBJECT (et->group), "click",
- G_CALLBACK (group_click), et);
- g_signal_connect (G_OBJECT (et->group), "key_press",
- G_CALLBACK (group_key_press), et);
- g_signal_connect (G_OBJECT (et->group), "start_drag",
- G_CALLBACK (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 = g_signal_connect (G_OBJECT (et->model), "model_changed",
- G_CALLBACK (et_table_model_changed), et);
-
- et->table_row_change_id = g_signal_connect (G_OBJECT (et->model), "model_row_changed",
- G_CALLBACK (et_table_row_changed), et);
-
- et->table_cell_change_id = g_signal_connect (G_OBJECT (et->model), "model_cell_changed",
- G_CALLBACK (et_table_cell_changed), et);
-
- et->table_rows_inserted_id = g_signal_connect (G_OBJECT (et->model), "model_rows_inserted",
- G_CALLBACK (et_table_rows_inserted), et);
-
- et->table_rows_deleted_id = g_signal_connect (G_OBJECT (et->model), "model_rows_deleted",
- G_CALLBACK (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);
- g_object_set (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;
- g_signal_emit (GTK_OBJECT (e_table), et_signals [WHITE_SPACE_EVENT], 0,
- 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 ());
- g_signal_connect (
- G_OBJECT (e_table->table_canvas), "size_allocate",
- G_CALLBACK (table_canvas_size_allocate), e_table);
- g_signal_connect (
- G_OBJECT (e_table->table_canvas), "focus_in_event",
- G_CALLBACK (table_canvas_focus_event_cb), e_table);
- g_signal_connect (
- G_OBJECT (e_table->table_canvas), "focus_out_event",
- G_CALLBACK (table_canvas_focus_event_cb), e_table);
-
- g_signal_connect (
- G_OBJECT (e_table), "drag_begin",
- G_CALLBACK (et_drag_begin), e_table);
- g_signal_connect (
- G_OBJECT (e_table), "drag_end",
- G_CALLBACK (et_drag_end), e_table);
- g_signal_connect (
- G_OBJECT (e_table), "drag_data_get",
- G_CALLBACK (et_drag_data_get), e_table);
- g_signal_connect (
- G_OBJECT (e_table), "drag_data_delete",
- G_CALLBACK (et_drag_data_delete), e_table);
- g_signal_connect (
- G_OBJECT (e_table), "drag_motion",
- G_CALLBACK (et_drag_motion), e_table);
- g_signal_connect (
- G_OBJECT (e_table), "drag_leave",
- G_CALLBACK (et_drag_leave), e_table);
- g_signal_connect (
- G_OBJECT (e_table), "drag_drop",
- G_CALLBACK (et_drag_drop), e_table);
- g_signal_connect (
- G_OBJECT (e_table), "drag_data_received",
- G_CALLBACK (et_drag_data_received), e_table);
-
- g_signal_connect (G_OBJECT(e_table->table_canvas), "reflow",
- G_CALLBACK (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),
- e_canvas_background_get_type(),
- "fill_color_gdk", &GTK_WIDGET(e_table->table_canvas)->style->base[GTK_STATE_NORMAL],
- NULL);
-
- g_signal_connect (G_OBJECT (e_table->white_item), "event",
- G_CALLBACK (white_item_event), e_table);
-
- g_signal_connect (G_OBJECT(e_table->table_canvas), "realize",
- G_CALLBACK(et_canvas_realize), e_table);
-
- g_signal_connect (G_OBJECT(gnome_canvas_root (e_table->table_canvas)), "event",
- G_CALLBACK(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);
-
- g_signal_connect (
- G_OBJECT (e_table->click_to_add), "cursor_change",
- G_CALLBACK (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)
-{
- GValue *val = g_new0 (GValue, 1);
- g_value_init (val, G_TYPE_DOUBLE);
-
- connect_header (e_table, state);
-
- g_value_set_double (val, (double) (GTK_WIDGET(e_table->table_canvas)->allocation.width));
- g_object_set_property (G_OBJECT (e_table->header), "width", val);
- g_free (val);
-
- if (e_table->sort_info) {
- if (e_table->group_info_change_id)
- g_signal_handler_disconnect (G_OBJECT (e_table->sort_info),
- e_table->group_info_change_id);
- if (e_table->sort_info_change_id)
- g_signal_handler_disconnect (G_OBJECT (e_table->sort_info),
- e_table->sort_info_change_id);
- g_object_unref(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 =
- g_signal_connect (G_OBJECT (e_table->sort_info), "group_info_changed",
- G_CALLBACK (group_info_changed), e_table);
- e_table->sort_info_change_id =
- g_signal_connect (G_OBJECT (e_table->sort_info), "sort_info_changed",
- G_CALLBACK (sort_info_changed), e_table);
- }
- else
- e_table->sort_info = NULL;
-
- if (e_table->sorter)
- g_object_set(e_table->sorter,
- "sort_info", e_table->sort_info,
- NULL);
- if (e_table->header_item)
- g_object_set(e_table->header_item,
- "ETableHeader", e_table->header,
- "sort_info", e_table->sort_info,
- NULL);
- if (e_table->click_to_add)
- g_object_set(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);
-
- g_object_unref(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);
-
- g_object_unref(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();
- if (state->sort_info)
- g_object_unref (state->sort_info);
- state->sort_info = e_table->sort_info;
- g_object_ref(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);
- g_object_unref(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);
- g_object_unref(state);
-}
-
-static void
-et_selection_model_selection_changed (ETableGroup *etg, ETable *et)
-{
- g_signal_emit (G_OBJECT (et), et_signals [SELECTION_CHANGE], 0);
-}
-
-static void
-et_selection_model_selection_row_changed (ETableGroup *etg, int row, ETable *et)
-{
- g_signal_emit (G_OBJECT (et), et_signals [SELECTION_CHANGE], 0);
-}
-
-static ETable *
-et_real_construct (ETable *e_table, ETableModel *etm, ETableExtras *ete,
- ETableSpecification *specification, ETableState *state)
-{
- int row = 0;
- int col_count, i;
- GValue *val = g_new0 (GValue, 1);
- g_value_init (val, G_TYPE_OBJECT);
-
- if (ete)
- g_object_ref(ete);
- else {
- ete = e_table_extras_new();
- }
-
- e_table->domain = g_strdup (specification->domain);
-
- 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 = g_strdup (dgettext (e_table->domain, 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);
- g_object_ref (e_table->full_header);
-
- 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;
- e_table->search_col_set = TRUE;
- break;
- }
- }
-
- e_table->model = etm;
- g_object_ref (etm);
-
- 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;
- g_object_ref (state->sort_info);
- e_table_sort_info_set_can_group (e_table->sort_info, e_table->allow_grouping);
-
- e_table->group_info_change_id =
- g_signal_connect (G_OBJECT (e_table->sort_info), "group_info_changed",
- G_CALLBACK (group_info_changed), e_table);
-
- e_table->sort_info_change_id =
- g_signal_connect (G_OBJECT (e_table->sort_info), "sort_info_changed",
- G_CALLBACK (sort_info_changed), e_table);
-
-
- g_value_set_object (val, e_table->sort_info);
- g_object_set_property (G_OBJECT(e_table->header), "sort_info", val);
- g_free (val);
-
- e_table->sorter = e_table_sorter_new(etm, e_table->full_header, e_table->sort_info);
-
- g_object_set (e_table->selection,
- "model", etm,
- "selection_mode", specification->selection_mode,
- "cursor_mode", specification->cursor_mode,
- "sorter", e_table->sorter,
- "header", e_table->header,
- NULL);
-
- g_signal_connect(e_table->selection, "selection_changed",
- G_CALLBACK (et_selection_model_selection_changed), e_table);
- g_signal_connect(e_table->selection, "selection_row_changed",
- G_CALLBACK (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 ();
-
- g_object_unref(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);
-
- g_object_ref (etm);
-
- specification = e_table_specification_new();
- g_object_ref (specification);
- if (!e_table_specification_load_from_string(specification, spec_str)) {
- g_object_unref(specification);
- return NULL;
- }
-
- if (state_str) {
- state = e_table_state_new();
- g_object_ref (state);
- e_table_state_load_from_string(state, state_str);
- if (state->col_count <= 0) {
- g_object_unref(state);
- state = specification->state;
- g_object_ref(state);
- }
- } else {
- state = specification->state;
- g_object_ref(state);
- }
-
- e_table = et_real_construct (e_table, etm, ete, specification, state);
-
- e_table->spec = specification;
- g_object_unref(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)) {
- g_object_unref(specification);
- return NULL;
- }
-
- if (state_fn) {
- state = e_table_state_new();
- if (!e_table_state_load_from_file(state, state_fn)) {
- g_object_unref(state);
- state = specification->state;
- g_object_ref(state);
- }
- if (state->col_count <= 0) {
- g_object_unref(state);
- state = specification->state;
- g_object_ref(state);
- }
- } else {
- state = specification->state;
- g_object_ref(state);
- }
-
- e_table = et_real_construct (e_table, etm, ete, specification, state);
-
- e_table->spec = specification;
- g_object_unref(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 = g_object_new (E_TABLE_TYPE, NULL);
-
- 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 = g_object_new (E_TABLE_TYPE, NULL);
-
- 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, const char *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);
-
- e_xml_save_file (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);
-
- g_object_set(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);
-
- g_object_get(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_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- ETable *etable = E_TABLE (object);
-
- switch (prop_id){
- case PROP_MODEL:
- g_value_set_object (value, etable->model);
- break;
- case PROP_UNIFORM_ROW_HEIGHT:
- g_value_set_boolean (value, etable->uniform_row_height);
- break;
- case PROP_ALWAYS_SEARCH:
- g_value_set_boolean (value, etable->always_search);
- break;
- case PROP_USE_CLICK_TO_ADD:
- g_value_set_boolean (value, etable->use_click_to_add);
- break;
- default:
- break;
- }
-}
-
-typedef struct {
- char *arg;
- gboolean setting;
-} bool_closure;
-
-static void
-et_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- ETable *etable = E_TABLE (object);
-
- switch (prop_id){
- case PROP_LENGTH_THRESHOLD:
- etable->length_threshold = g_value_get_int (value);
- if (etable->group) {
- gnome_canvas_item_set (GNOME_CANVAS_ITEM(etable->group),
- "length_threshold", etable->length_threshold,
- NULL);
- }
- break;
- case PROP_UNIFORM_ROW_HEIGHT:
- etable->uniform_row_height = g_value_get_boolean (value);
- if (etable->group) {
- gnome_canvas_item_set (GNOME_CANVAS_ITEM(etable->group),
- "uniform_row_height", etable->uniform_row_height,
- NULL);
- }
- break;
- case PROP_ALWAYS_SEARCH:
- if (etable->always_search == g_value_get_boolean (value))
- return;
-
- etable->always_search = g_value_get_boolean (value);
- clear_current_search_col (etable);
- break;
- case PROP_USE_CLICK_TO_ADD:
- if (etable->use_click_to_add == g_value_get_boolean (value))
- return;
-
- etable->use_click_to_add = g_value_get_boolean (value);
- clear_current_search_col (etable);
-
- if (etable->use_click_to_add) {
- etable->click_to_add = gnome_canvas_item_new
- (GNOME_CANVAS_GROUP(etable->canvas_vbox),
- e_table_click_to_add_get_type (),
- "header", etable->header,
- "model", etable->model,
- "message", etable->click_to_add_message,
- NULL);
-
- if (etable->use_click_to_add_end)
- e_canvas_vbox_add_item (E_CANVAS_VBOX(etable->canvas_vbox),
- etable->click_to_add);
- else
- e_canvas_vbox_add_item_start (E_CANVAS_VBOX(etable->canvas_vbox),
- etable->click_to_add);
-
- g_signal_connect (G_OBJECT (etable->click_to_add), "cursor_change",
- G_CALLBACK (click_to_add_cursor_change), etable);
- } else {
- gtk_object_destroy (GTK_OBJECT (etable->click_to_add));
- etable->click_to_add = 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);
- }
-
- if (table->table_canvas != NULL) {
- 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));
-
- 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 {
- if (table->drop_highlight) {
- 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) {
- if (site->target_list)
- gtk_target_list_unref (site->target_list);
- 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)
-{
- g_signal_emit (G_OBJECT (et), et_signals [TABLE_DRAG_BEGIN], 0,
- et->drag_row, et->drag_col, context);
-}
-
-static void
-et_drag_end (GtkWidget *widget,
- GdkDragContext *context,
- ETable *et)
-{
- g_signal_emit (G_OBJECT (et), et_signals [TABLE_DRAG_END], 0,
- 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)
-{
- g_signal_emit (G_OBJECT (et), et_signals [TABLE_DRAG_DATA_GET], 0,
- et->drag_row, et->drag_col, context, selection_data,
- info, time);
-}
-
-static void
-et_drag_data_delete(GtkWidget *widget,
- GdkDragContext *context,
- ETable *et)
-{
- g_signal_emit (G_OBJECT (et), et_signals [TABLE_DRAG_DATA_DELETE], 0,
- 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 = -1, col = -1;
- GtkWidget *widget;
-
- widget = GTK_WIDGET (et);
-
- e_table_get_cell_at (et, x, y, &row, &col);
-
- if (row != et->drop_row && col != et->drop_row) {
- g_signal_emit (G_OBJECT (et), et_signals [TABLE_DRAG_LEAVE], 0,
- et->drop_row, et->drop_col, context, time);
- }
- et->drop_row = row;
- et->drop_col = col;
- g_signal_emit (G_OBJECT (et), et_signals [TABLE_DRAG_MOTION], 0,
- 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)) */
-#ifndef NO_WARNINGS
-#warning FIXME
-#endif
- {
- et->last_drop_x = 0;
- et->last_drop_y = 0;
- et->last_drop_time = 0;
- et->last_drop_context = NULL;
- scroll_off (et);
- }
- g_object_unref (et);
-}
-
-static void
-context_connect (ETable *et, GdkDragContext *context)
-{
- if (g_dataset_get_data (context, "e-table") == NULL) {
- g_object_ref (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)
-{
- g_signal_emit (G_OBJECT (et), et_signals [TABLE_DRAG_LEAVE], 0,
- 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);
-
-
- 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;
-
- e_table_get_cell_at (et, x, y, &row, &col);
-
- if (row != et->drop_row && col != et->drop_row) {
- g_signal_emit (G_OBJECT (et), et_signals [TABLE_DRAG_LEAVE], 0,
- et->drop_row, et->drop_col, context, time);
- g_signal_emit (G_OBJECT (et), et_signals [TABLE_DRAG_MOTION], 0,
- row, col, context, x, y, time, &ret_val);
- }
- et->drop_row = row;
- et->drop_col = col;
- g_signal_emit (G_OBJECT (et), et_signals [TABLE_DRAG_DROP], 0,
- 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;
-
- e_table_get_cell_at (et, x, y, &row, &col);
-
- g_signal_emit (G_OBJECT (et), et_signals [TABLE_DRAG_DATA_RECEIVED], 0,
- row, col, context, x, y, selection_data, info, time);
-}
-
-static void
-e_table_class_init (ETableClass *class)
-{
- GObjectClass *object_class;
- GtkWidgetClass *widget_class;
- GtkContainerClass *container_class;
-
- object_class = (GObjectClass *) class;
- widget_class = (GtkWidgetClass *) class;
- container_class = (GtkContainerClass *) class;
-
- parent_class = g_type_class_peek_parent (class);
-
- object_class->dispose = et_dispose;
- object_class->finalize = et_finalize;
- object_class->set_property = et_set_property;
- object_class->get_property = et_get_property;
-
- widget_class->grab_focus = et_grab_focus;
- widget_class->unrealize = et_unrealize;
- widget_class->size_request = et_size_request;
-
- widget_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] =
- g_signal_new ("cursor_change",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableClass, cursor_change),
- NULL, NULL,
- e_marshal_NONE__INT,
- G_TYPE_NONE, 1, G_TYPE_INT);
-
- et_signals [CURSOR_ACTIVATED] =
- g_signal_new ("cursor_activated",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableClass, cursor_activated),
- NULL, NULL,
- e_marshal_NONE__INT,
- G_TYPE_NONE, 1, G_TYPE_INT);
-
- et_signals [SELECTION_CHANGE] =
- g_signal_new ("selection_change",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableClass, selection_change),
- NULL, NULL,
- e_marshal_NONE__NONE,
- G_TYPE_NONE, 0);
-
- et_signals [DOUBLE_CLICK] =
- g_signal_new ("double_click",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableClass, double_click),
- NULL, NULL,
- e_marshal_NONE__INT_INT_BOXED,
- G_TYPE_NONE, 3, G_TYPE_INT,
- G_TYPE_INT, GDK_TYPE_EVENT);
-
- et_signals [RIGHT_CLICK] =
- g_signal_new ("right_click",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableClass, right_click),
- NULL, NULL,
- e_marshal_INT__INT_INT_BOXED,
- G_TYPE_INT, 3, G_TYPE_INT,
- G_TYPE_INT, GDK_TYPE_EVENT);
-
- et_signals [CLICK] =
- g_signal_new ("click",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableClass, click),
- NULL, NULL,
- e_marshal_INT__INT_INT_BOXED,
- G_TYPE_INT, 3, G_TYPE_INT,
- G_TYPE_INT, GDK_TYPE_EVENT);
-
- et_signals [KEY_PRESS] =
- g_signal_new ("key_press",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableClass, key_press),
- NULL, NULL,
- e_marshal_INT__INT_INT_BOXED,
- G_TYPE_INT, 3, G_TYPE_INT,
- G_TYPE_INT, GDK_TYPE_EVENT);
-
- et_signals [START_DRAG] =
- g_signal_new ("start_drag",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableClass, start_drag),
- NULL, NULL,
- e_marshal_INT__INT_INT_BOXED,
- G_TYPE_INT, 3, G_TYPE_INT,
- G_TYPE_INT, GDK_TYPE_EVENT);
-
- et_signals [STATE_CHANGE] =
- g_signal_new ("state_change",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableClass, state_change),
- NULL, NULL,
- e_marshal_NONE__NONE,
- G_TYPE_NONE, 0);
-
- et_signals [WHITE_SPACE_EVENT] =
- g_signal_new ("white_space_event",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableClass, white_space_event),
- NULL, NULL,
- e_marshal_INT__BOXED,
- G_TYPE_INT, 1, GDK_TYPE_EVENT);
-
- et_signals[TABLE_DRAG_BEGIN] =
- g_signal_new ("table_drag_begin",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableClass, table_drag_begin),
- NULL, NULL,
- e_marshal_NONE__INT_INT_OBJECT,
- G_TYPE_NONE, 3,
- G_TYPE_INT,
- G_TYPE_INT,
- GDK_TYPE_DRAG_CONTEXT);
- et_signals[TABLE_DRAG_END] =
- g_signal_new ("table_drag_end",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableClass, table_drag_end),
- NULL, NULL,
- e_marshal_NONE__INT_INT_OBJECT,
- G_TYPE_NONE, 3,
- G_TYPE_INT,
- G_TYPE_INT,
- GDK_TYPE_DRAG_CONTEXT);
- et_signals[TABLE_DRAG_DATA_GET] =
- g_signal_new ("table_drag_data_get",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableClass, table_drag_data_get),
- NULL, NULL,
- e_marshal_NONE__INT_INT_OBJECT_BOXED_UINT_UINT,
- G_TYPE_NONE, 6,
- G_TYPE_INT,
- G_TYPE_INT,
- GDK_TYPE_DRAG_CONTEXT,
- GTK_TYPE_SELECTION_DATA | G_SIGNAL_TYPE_STATIC_SCOPE,
- G_TYPE_UINT,
- G_TYPE_UINT);
- et_signals[TABLE_DRAG_DATA_DELETE] =
- g_signal_new ("table_drag_data_delete",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableClass, table_drag_data_delete),
- NULL, NULL,
- e_marshal_NONE__INT_INT_OBJECT,
- G_TYPE_NONE, 3,
- G_TYPE_INT,
- G_TYPE_INT,
- GDK_TYPE_DRAG_CONTEXT);
-
- et_signals[TABLE_DRAG_LEAVE] =
- g_signal_new ("table_drag_leave",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableClass, table_drag_leave),
- NULL, NULL,
- e_marshal_NONE__INT_INT_OBJECT_UINT,
- G_TYPE_NONE, 4,
- G_TYPE_INT,
- G_TYPE_INT,
- GDK_TYPE_DRAG_CONTEXT,
- G_TYPE_UINT);
- et_signals[TABLE_DRAG_MOTION] =
- g_signal_new ("table_drag_motion",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableClass, table_drag_motion),
- NULL, NULL,
- e_marshal_BOOLEAN__INT_INT_OBJECT_INT_INT_UINT,
- G_TYPE_BOOLEAN, 6,
- G_TYPE_INT,
- G_TYPE_INT,
- GDK_TYPE_DRAG_CONTEXT,
- G_TYPE_INT,
- G_TYPE_INT,
- G_TYPE_UINT);
- et_signals[TABLE_DRAG_DROP] =
- g_signal_new ("table_drag_drop",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableClass, table_drag_drop),
- NULL, NULL,
- e_marshal_BOOLEAN__INT_INT_OBJECT_INT_INT_UINT,
- G_TYPE_BOOLEAN, 6,
- G_TYPE_INT,
- G_TYPE_INT,
- GDK_TYPE_DRAG_CONTEXT,
- G_TYPE_INT,
- G_TYPE_INT,
- G_TYPE_UINT);
- et_signals[TABLE_DRAG_DATA_RECEIVED] =
- g_signal_new ("table_drag_data_received",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableClass, table_drag_data_received),
- NULL, NULL,
- e_marshal_NONE__INT_INT_OBJECT_INT_INT_BOXED_UINT_UINT,
- G_TYPE_NONE, 8,
- G_TYPE_INT,
- G_TYPE_INT,
- GDK_TYPE_DRAG_CONTEXT,
- G_TYPE_INT,
- G_TYPE_INT,
- GTK_TYPE_SELECTION_DATA | G_SIGNAL_TYPE_STATIC_SCOPE,
- G_TYPE_UINT,
- G_TYPE_UINT);
-
- class->set_scroll_adjustments = set_scroll_adjustments;
-
- widget_class->set_scroll_adjustments_signal =
- g_signal_new ("set_scroll_adjustments",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETableClass, set_scroll_adjustments),
- NULL, NULL,
- e_marshal_NONE__OBJECT_OBJECT,
- G_TYPE_NONE, 2, GTK_TYPE_ADJUSTMENT, GTK_TYPE_ADJUSTMENT);
-
- g_object_class_install_property (object_class, PROP_LENGTH_THRESHOLD,
- g_param_spec_int ("length_threshold",
- _("Length Threshold"),
- /*_( */"XXX blurb" /*)*/,
- 0, G_MAXINT, 0,
- G_PARAM_WRITABLE));
-
- g_object_class_install_property (object_class, PROP_UNIFORM_ROW_HEIGHT,
- g_param_spec_boolean ("uniform_row_height",
- _("Uniform row height"),
- /*_( */"XXX blurb" /*)*/,
- FALSE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_ALWAYS_SEARCH,
- g_param_spec_boolean ("always_search",
- _("Always Search"),
- /*_( */"XXX blurb" /*)*/,
- FALSE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_USE_CLICK_TO_ADD,
- g_param_spec_boolean ("use_click_to_add",
- _("Use click to add"),
- /*_( */"XXX blurb" /*)*/,
- FALSE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_MODEL,
- g_param_spec_object ("model",
- _("Model"),
- /*_( */"XXX blurb" /*)*/,
- E_TABLE_MODEL_TYPE,
- G_PARAM_READABLE));
-
- atk_registry_set_factory_type (atk_get_default_registry (),
- E_TABLE_TYPE,
- gal_a11y_e_table_factory_get_type ());
-
-}
-
-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 f025318905..0000000000
--- a/widgets/table/e-table.h
+++ /dev/null
@@ -1,358 +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 <libgnomecanvas/gnome-canvas.h>
-#include <gtk/gtkdnd.h>
-#include <gtk/gtktable.h>
-#include <libxml/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>
-
-G_BEGIN_DECLS
-
-#define E_TABLE_TYPE (e_table_get_type ())
-#define E_TABLE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_TYPE, ETable))
-#define E_TABLE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_TYPE, ETableClass))
-#define E_IS_TABLE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_TYPE))
-#define E_IS_TABLE_CLASS(k) (G_TYPE_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;
-
- ETableCol *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;
-
- guint always_search : 1;
- guint search_col_set : 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 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;
-
- char *domain;
-} 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;
-GType 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);
-
-void e_table_commit_click_to_add (ETable *table);
-
-G_END_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 b6fe3fc375..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 = g_object_new (E_TREE_MEMORY_CALLBACKS_TYPE, NULL);
-
- 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 0f75fa98be..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) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TREE_MEMORY_CALLBACKS_TYPE, ETreeMemoryCallbacks))
-#define E_TREE_MEMORY_CALLBACKS_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TREE_MEMORY_CALLBACKS_TYPE, ETreeMemoryCallbacksClass))
-#define E_IS_TREE_MEMORY_CALLBACKS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TREE_MEMORY_CALLBACKS_TYPE))
-#define E_IS_TREE_MEMORY_CALLBACKS_CLASS(k) (G_TYPE_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;
-
-GType 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 3f178455df..0000000000
--- a/widgets/table/e-tree-memory.c
+++ /dev/null
@@ -1,717 +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 <libxml/parser.h>
-#include <libxml/xmlmemory.h>
-
-#include "gal/util/e-util.h"
-#include "gal/util/e-xml-utils.h"
-#include "e-tree-memory.h"
-
-#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) {
- g_signal_emit (G_OBJECT (memory), signals[FILL_IN_CHILDREN], 0, 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_dispose (GObject *object)
-{
- ETreeMemory *etmm = E_TREE_MEMORY (object);
- ETreeMemoryPriv *priv = etmm->priv;
-
- if (priv) {
- /* XXX lots of stuff to free here */
-
- if (priv->root)
- e_tree_memory_node_remove (etmm, priv->root);
-
- g_free (priv);
- }
- etmm->priv = NULL;
-
- G_OBJECT_CLASS (parent_class)->dispose (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;
- GObjectClass *object_class = (GObjectClass *) klass;
-
- parent_class = g_type_class_peek_parent (klass);
-
- node_chunk = g_mem_chunk_create (ETreeMemoryPath, TREEPATH_CHUNK_AREA_SIZE, G_ALLOC_AND_FREE);
-
- signals [FILL_IN_CHILDREN] =
- g_signal_new ("fill_in_children",
- E_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETreeMemoryClass, fill_in_children),
- (GSignalAccumulator) NULL, NULL,
- g_cclosure_marshal_VOID__POINTER,
- G_TYPE_NONE, 1, G_TYPE_POINTER);
-
- object_class->dispose = etmm_dispose;
-
- 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 (GObject *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, E_TREE_MODEL_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)
-{
- return (ETreeMemory *) g_object_new (E_TREE_MEMORY_TYPE, NULL);
-}
-
-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 ce0003b60a..0000000000
--- a/widgets/table/e-tree-memory.h
+++ /dev/null
@@ -1,101 +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>
-
-G_BEGIN_DECLS
-
-#define E_TREE_MEMORY_TYPE (e_tree_memory_get_type ())
-#define E_TREE_MEMORY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TREE_MEMORY_TYPE, ETreeMemory))
-#define E_TREE_MEMORY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TREE_MEMORY_TYPE, ETreeMemoryClass))
-#define E_IS_TREE_MEMORY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TREE_MEMORY_TYPE))
-#define E_IS_TREE_MEMORY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TREE_MEMORY_TYPE))
-#define E_TREE_MEMORY_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), E_TREE_MEMORY_TYPE, ETreeMemoryClass))
-
-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);
-};
-
-
-GType 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);
-
-G_END_DECLS
-
-#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 6ca0e17af9..0000000000
--- a/widgets/table/e-tree-model.c
+++ /dev/null
@@ -1,1098 +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 <libxml/parser.h>
-#include <libxml/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) (E_TREE_MODEL_GET_CLASS(e))
-
-#define d(x)
-
-static GObjectClass *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 (GObjectClass *klass)
-{
- ETreeModelClass *tree_class = (ETreeModelClass *) klass;
-
- parent_class = g_type_class_peek_parent (klass);
-
- e_tree_model_signals [PRE_CHANGE] =
- g_signal_new ("pre_change",
- E_OBJECT_CLASS_TYPE (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETreeModelClass, pre_change),
- (GSignalAccumulator) NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- e_tree_model_signals [NO_CHANGE] =
- g_signal_new ("no_change",
- E_OBJECT_CLASS_TYPE (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETreeModelClass, no_change),
- (GSignalAccumulator) NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
- e_tree_model_signals [NODE_CHANGED] =
- g_signal_new ("node_changed",
- E_OBJECT_CLASS_TYPE (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETreeModelClass, node_changed),
- (GSignalAccumulator) NULL, NULL,
- g_cclosure_marshal_VOID__POINTER,
- G_TYPE_NONE, 1, G_TYPE_POINTER);
-
- e_tree_model_signals [NODE_DATA_CHANGED] =
- g_signal_new ("node_data_changed",
- E_OBJECT_CLASS_TYPE (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETreeModelClass, node_data_changed),
- (GSignalAccumulator) NULL, NULL,
- g_cclosure_marshal_VOID__POINTER,
- G_TYPE_NONE, 1, G_TYPE_POINTER);
-
- e_tree_model_signals [NODE_COL_CHANGED] =
- g_signal_new ("node_col_changed",
- E_OBJECT_CLASS_TYPE (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETreeModelClass, node_col_changed),
- (GSignalAccumulator) NULL, NULL,
- e_marshal_VOID__POINTER_INT,
- G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_INT);
-
- e_tree_model_signals [NODE_INSERTED] =
- g_signal_new ("node_inserted",
- E_OBJECT_CLASS_TYPE (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETreeModelClass, node_inserted),
- (GSignalAccumulator) NULL, NULL,
- e_marshal_VOID__POINTER_POINTER,
- G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_POINTER);
-
- e_tree_model_signals [NODE_REMOVED] =
- g_signal_new ("node_removed",
- E_OBJECT_CLASS_TYPE (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETreeModelClass, node_removed),
- (GSignalAccumulator) NULL, NULL,
- e_marshal_VOID__POINTER_POINTER_INT,
- G_TYPE_NONE, 3, G_TYPE_POINTER, G_TYPE_POINTER, G_TYPE_INT);
-
- e_tree_model_signals [NODE_DELETED] =
- g_signal_new ("node_deleted",
- E_OBJECT_CLASS_TYPE (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETreeModelClass, node_deleted),
- (GSignalAccumulator) NULL, NULL,
- g_cclosure_marshal_VOID__POINTER,
- G_TYPE_NONE, 1, G_TYPE_POINTER);
-
- e_tree_model_signals [NODE_REQUEST_COLLAPSE] =
- g_signal_new ("node_request_collapse",
- E_OBJECT_CLASS_TYPE (klass),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETreeModelClass, node_request_collapse),
- (GSignalAccumulator) NULL, NULL,
- g_cclosure_marshal_VOID__POINTER,
- G_TYPE_NONE, 1, G_TYPE_POINTER);
-
- 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;
-}
-
-E_MAKE_TYPE(e_tree_model, "ETreeModel", ETreeModel, e_tree_model_class_init, NULL, G_TYPE_OBJECT)
-
-
-/* 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));
-
- d(g_print("Emitting pre_change on model 0x%p, a %s.\n", tree_model, gtk_type_name (GTK_OBJECT(tree_model)->klass->type)));
-
- g_signal_emit (G_OBJECT (tree_model), e_tree_model_signals [PRE_CHANGE], 0);
-}
-
-/**
- * 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));
-
- d(g_print("Emitting no_change on model 0x%p, a %s.\n", tree_model, gtk_type_name (GTK_OBJECT(tree_model)->klass->type)));
-
- g_signal_emit (G_OBJECT (tree_model), e_tree_model_signals [NO_CHANGE], 0);
-}
-
-/**
- * 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));
-
- d(g_print("Emitting node_changed on model 0x%p, a %s.\n", tree_model, gtk_type_name (GTK_OBJECT(tree_model)->klass->type)));
-
- g_signal_emit (G_OBJECT (tree_model), e_tree_model_signals [NODE_CHANGED], 0, 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));
-
- d(g_print("Emitting node_data_changed on model 0x%p, a %s.\n", tree_model, gtk_type_name (GTK_OBJECT(tree_model)->klass->type)));
-
- g_signal_emit (G_OBJECT (tree_model), e_tree_model_signals [NODE_DATA_CHANGED], 0, 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));
-
- d(g_print("Emitting node_col_changed on model 0x%p, a %s.\n", tree_model, gtk_type_name (GTK_OBJECT(tree_model)->klass->type)));
-
- g_signal_emit (G_OBJECT (tree_model), e_tree_model_signals [NODE_COL_CHANGED], 0, 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));
-
- d(g_print("Emitting node_inserted on model 0x%p, a %s.\n", tree_model, gtk_type_name (GTK_OBJECT(tree_model)->klass->type)));
-
- g_signal_emit (G_OBJECT (tree_model), e_tree_model_signals [NODE_INSERTED], 0,
- 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));
-
- d(g_print("Emitting node_removed on model 0x%p, a %s.\n", tree_model, gtk_type_name (GTK_OBJECT(tree_model)->klass->type)));
-
- g_signal_emit (G_OBJECT (tree_model), e_tree_model_signals [NODE_REMOVED], 0,
- 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));
-
- d(g_print("Emitting node_deleted on model 0x%p, a %s.\n", tree_model, gtk_type_name (GTK_OBJECT(tree_model)->klass->type)));
-
- g_signal_emit (G_OBJECT (tree_model), e_tree_model_signals [NODE_DELETED], 0, 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));
-
- d(g_print("Emitting node_request_collapse on model 0x%p, a %s.\n", tree_model, gtk_type_name (GTK_OBJECT(tree_model)->klass->type)));
-
- g_signal_emit (G_OBJECT (tree_model), e_tree_model_signals [NODE_REQUEST_COLLAPSE], 0, collapsed_node);
-}
-
-
-
-/**
- * e_tree_model_new
- *
- * XXX docs here.
- *
- * return values: a newly constructed ETreeModel.
- */
-ETreeModel *
-e_tree_model_new ()
-{
- return (ETreeModel *) g_object_new (E_TREE_MODEL_TYPE, NULL);
-}
-
-/**
- * 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);
- g_return_val_if_fail(node != 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_value_at:
- * @etree: The ETreeModel.
- * @node: The ETreePath to the node we're getting the data from.
- * @col: the column to retrieve data from
- *
- * Return value: This function returns the value that is stored by the
- * @etree in column @col and node @node. 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.
- *
- * The data returned must be valid until the model sends a signal that
- * affect that piece of data. node_changed and node_deleted affect
- * all data in tha t node and all nodes under that node.
- * node_data_changed affects the data in that node. node_col_changed
- * affects the data in that node for that column. node_inserted,
- * node_removed, and no_change don't affect any data in this way.
- **/
-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))
- 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))
- 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 c9574388e1..0000000000
--- a/widgets/table/e-tree-model.h
+++ /dev/null
@@ -1,227 +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 <glib-object.h>
-
-
-G_BEGIN_DECLS
-
-
-#define E_TREE_MODEL_TYPE (e_tree_model_get_type ())
-#define E_TREE_MODEL(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TREE_MODEL_TYPE, ETreeModel))
-#define E_TREE_MODEL_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TREE_MODEL_TYPE, ETreeModelClass))
-#define E_IS_TREE_MODEL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TREE_MODEL_TYPE))
-#define E_IS_TREE_MODEL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TREE_MODEL_TYPE))
-#define E_TREE_MODEL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), E_TREE_MODEL_TYPE, ETreeModelClass))
-
-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 {
- GObject base;
-};
-
-struct ETreeModelClass {
- GObjectClass 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);
-};
-
-
-GType 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);
-
-
-G_END_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 a72a246b69..0000000000
--- a/widgets/table/e-tree-scrolled.c
+++ /dev/null
@@ -1,228 +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 <libgnomecanvas/gnome-canvas.h>
-#include <gtk/gtksignal.h>
-#include <libxml/parser.h>
-#include <libxml/xmlmemory.h>
-#include <gal/util/e-util.h>
-#include <gal/util/e-i18n.h>
-
-#include "e-tree-scrolled.h"
-
-#define COLUMN_HEADER_HEIGHT 16
-
-#define PARENT_TYPE gtk_scrolled_window_get_type ()
-
-static GtkObjectClass *parent_class;
-
-enum {
- PROP_0,
- PROP_TREE
-};
-
-static void
-e_tree_scrolled_init (GtkObject *object)
-{
- ETreeScrolled *ets;
- GtkScrolledWindow *scrolled_window;
-
- ets = E_TREE_SCROLLED (object);
- scrolled_window = GTK_SCROLLED_WINDOW (object);
-
- GTK_WIDGET_SET_FLAGS (ets, GTK_CAN_FOCUS);
-
- ets->tree = g_object_new (E_TREE_TYPE, NULL);
-
- gtk_scrolled_window_set_policy (scrolled_window, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- gtk_scrolled_window_set_shadow_type (scrolled_window, 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_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
-{
- ETreeScrolled *ets = E_TREE_SCROLLED (object);
-
- switch (prop_id){
- case PROP_TREE:
- g_value_set_object (value, ets->tree);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- 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 (GtkWidget *container, GtkDirectionType direction)
-{
- ETreeScrolled *ets;
-
- ets = E_TREE_SCROLLED (container);
-
- return gtk_widget_child_focus (GTK_WIDGET (ets->tree), direction);
-}
-
-static void
-e_tree_scrolled_class_init (ETreeScrolledClass *class)
-{
- GObjectClass *object_class;
- GtkWidgetClass *widget_class;
- GtkContainerClass *container_class;
-
- object_class = (GObjectClass *) class;
- widget_class = (GtkWidgetClass *) class;
- container_class = (GtkContainerClass *) class;
-
- parent_class = g_type_class_ref (PARENT_TYPE);
-
- object_class->get_property = ets_get_property;
-
- widget_class->grab_focus = ets_grab_focus;
-
- widget_class->focus = ets_focus;
-
- g_object_class_install_property (object_class, PROP_TREE,
- g_param_spec_object ("tree",
- _( "Tree" ),
- _( "Tree" ),
- E_TREE_TYPE,
- G_PARAM_READABLE));
-}
-
-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 f861b71138..0000000000
--- a/widgets/table/e-tree-scrolled.h
+++ /dev/null
@@ -1,75 +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 <gtk/gtkscrolledwindow.h>
-#include <gal/e-table/e-tree-model.h>
-#include <gal/e-table/e-tree.h>
-
-G_BEGIN_DECLS
-
-#define E_TREE_SCROLLED_TYPE (e_tree_scrolled_get_type ())
-#define E_TREE_SCROLLED(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TREE_SCROLLED_TYPE, ETreeScrolled))
-#define E_TREE_SCROLLED_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TREE_SCROLLED_TYPE, ETreeScrolledClass))
-#define E_IS_TREE_SCROLLED(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TREE_SCROLLED_TYPE))
-#define E_IS_TREE_SCROLLED_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TREE_SCROLLED_TYPE))
-
-typedef struct {
- GtkScrolledWindow parent;
-
- ETree *tree;
-} ETreeScrolled;
-
-typedef struct {
- GtkScrolledWindowClass parent_class;
-} ETreeScrolledClass;
-
-GType 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);
-
-G_END_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 8aa8cb3239..0000000000
--- a/widgets/table/e-tree-selection-model.c
+++ /dev/null
@@ -1,802 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-tree-selection-model.c
- * Copyright 2000, 2001, 2003 Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- * Mike Kestner <mkestner@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-tree-selection-model.h"
-#include <gal/util/e-i18n.h>
-#include <gal/util/e-util.h>
-#include <gdk/gdkkeysyms.h>
-#include <gal/e-table/e-tree-table-adapter.h>
-
-#define PARENT_TYPE e_selection_model_get_type ()
-
-static ESelectionModelClass *parent_class;
-
-enum {
- PROP_0,
- PROP_CURSOR_ROW,
- PROP_CURSOR_COL,
- PROP_MODEL,
- PROP_ETTA,
-};
-
-struct ETreeSelectionModelPriv {
- ETreeTableAdapter *etta;
- ETreeModel *model;
-
- GHashTable *paths;
- ETreePath cursor_path;
- ETreePath start_path;
- gint cursor_col;
- gchar *cursor_save_id;
-
- gint tree_model_pre_change_id;
- gint tree_model_no_change_id;
- gint tree_model_node_changed_id;
- gint tree_model_node_data_changed_id;
- gint tree_model_node_col_changed_id;
- gint tree_model_node_inserted_id;
- gint tree_model_node_removed_id;
- gint tree_model_node_deleted_id;
-};
-
-static gint
-get_cursor_row (ETreeSelectionModel *etsm)
-{
- if (etsm->priv->cursor_path)
- return e_tree_table_adapter_row_of_node(etsm->priv->etta, etsm->priv->cursor_path);
-
- return -1;
-}
-
-static void
-clear_selection (ETreeSelectionModel *etsm)
-{
- g_hash_table_destroy (etsm->priv->paths);
- etsm->priv->paths = g_hash_table_new (NULL, NULL);
-}
-
-static void
-change_one_path (ETreeSelectionModel *etsm, ETreePath path, gboolean grow)
-{
- if (!path)
- return;
-
- if (grow)
- g_hash_table_insert (etsm->priv->paths, path, path);
- else if (g_hash_table_lookup (etsm->priv->paths, path))
- g_hash_table_remove (etsm->priv->paths, path);
-}
-
-static void
-select_single_path (ETreeSelectionModel *etsm, ETreePath path)
-{
- clear_selection (etsm);
- change_one_path(etsm, path, TRUE);
- etsm->priv->cursor_path = path;
- etsm->priv->start_path = NULL;
-}
-
-static void
-select_range (ETreeSelectionModel *etsm, gint start, gint end)
-{
- gint i;
-
- if (start > end) {
- i = start;
- start = end;
- end = i;
- }
-
- for (i = start; i <= end; i++) {
- ETreePath path = e_tree_table_adapter_node_at_row (etsm->priv->etta, i);
- if (path)
- g_hash_table_insert (etsm->priv->paths, path, path);
- }
-}
-
-static void
-free_id (ETreeSelectionModel *etsm)
-{
- g_free (etsm->priv->cursor_save_id);
- etsm->priv->cursor_save_id = NULL;
-}
-
-static void
-restore_cursor (ETreeSelectionModel *etsm, ETreeModel *etm)
-{
- clear_selection (etsm);
- etsm->priv->cursor_path = NULL;
-
- if (etsm->priv->cursor_save_id) {
- etsm->priv->cursor_path = e_tree_model_get_node_by_id (etm, etsm->priv->cursor_save_id);
- if (etsm->priv->cursor_path != NULL && etsm->priv->cursor_col == -1)
- etsm->priv->cursor_col = 0;
-
- select_single_path(etsm, etsm->priv->cursor_path);
- }
-
- e_selection_model_selection_changed(E_SELECTION_MODEL(etsm));
-
- if (etsm->priv->cursor_path) {
- gint cursor_row = get_cursor_row (etsm);
- 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);
-
- }
-
- free_id (etsm);
-}
-
-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);
- }
-}
-
-static void
-etsm_no_change (ETreeModel *etm, ETreeSelectionModel *etsm)
-{
- free_id (etsm);
-}
-
-static void
-etsm_node_changed (ETreeModel *etm, ETreePath node, ETreeSelectionModel *etsm)
-{
- restore_cursor (etsm, etm);
-}
-
-static void
-etsm_node_data_changed (ETreeModel *etm, ETreePath node, ETreeSelectionModel *etsm)
-{
- free_id (etsm);
-}
-
-static void
-etsm_node_col_changed (ETreeModel *etm, ETreePath node, int col, ETreeSelectionModel *etsm)
-{
- free_id (etsm);
-}
-
-static void
-etsm_node_inserted (ETreeModel *etm, ETreePath parent, ETreePath child, ETreeSelectionModel *etsm)
-{
- restore_cursor (etsm, etm);
-}
-
-static void
-etsm_node_removed (ETreeModel *etm, ETreePath parent, ETreePath child, int old_position, ETreeSelectionModel *etsm)
-{
- restore_cursor (etsm, etm);
-}
-
-static void
-etsm_node_deleted (ETreeModel *etm, ETreePath child, ETreeSelectionModel *etsm)
-{
- restore_cursor (etsm, etm);
-}
-
-
-static void
-add_model(ETreeSelectionModel *etsm, ETreeModel *model)
-{
- ETreeSelectionModelPriv *priv = etsm->priv;
-
- priv->model = model;
-
- if (!priv->model)
- return;
-
- g_object_ref(priv->model);
- priv->tree_model_pre_change_id = g_signal_connect_after (G_OBJECT (priv->model), "pre_change",
- G_CALLBACK (etsm_pre_change), etsm);
- priv->tree_model_no_change_id = g_signal_connect_after (G_OBJECT (priv->model), "no_change",
- G_CALLBACK (etsm_no_change), etsm);
- priv->tree_model_node_changed_id = g_signal_connect_after (G_OBJECT (priv->model), "node_changed",
- G_CALLBACK (etsm_node_changed), etsm);
- priv->tree_model_node_data_changed_id = g_signal_connect_after (G_OBJECT (priv->model), "node_data_changed",
- G_CALLBACK (etsm_node_data_changed), etsm);
- priv->tree_model_node_col_changed_id = g_signal_connect_after (G_OBJECT (priv->model), "node_col_changed",
- G_CALLBACK (etsm_node_col_changed), etsm);
- priv->tree_model_node_inserted_id = g_signal_connect_after (G_OBJECT (priv->model), "node_inserted",
- G_CALLBACK (etsm_node_inserted), etsm);
- priv->tree_model_node_removed_id = g_signal_connect_after (G_OBJECT (priv->model), "node_removed",
- G_CALLBACK (etsm_node_removed), etsm);
- priv->tree_model_node_deleted_id = g_signal_connect_after (G_OBJECT (priv->model), "node_deleted",
- G_CALLBACK (etsm_node_deleted), etsm);
-}
-
-static void
-drop_model(ETreeSelectionModel *etsm)
-{
- ETreeSelectionModelPriv *priv = etsm->priv;
-
- if (!priv->model)
- return;
-
- g_signal_handler_disconnect (G_OBJECT (priv->model),
- priv->tree_model_pre_change_id);
- g_signal_handler_disconnect (G_OBJECT (priv->model),
- priv->tree_model_no_change_id);
- g_signal_handler_disconnect (G_OBJECT (priv->model),
- priv->tree_model_node_changed_id);
- g_signal_handler_disconnect (G_OBJECT (priv->model),
- priv->tree_model_node_data_changed_id);
- g_signal_handler_disconnect (G_OBJECT (priv->model),
- priv->tree_model_node_col_changed_id);
- g_signal_handler_disconnect (G_OBJECT (priv->model),
- priv->tree_model_node_inserted_id);
- g_signal_handler_disconnect (G_OBJECT (priv->model),
- priv->tree_model_node_removed_id);
- g_signal_handler_disconnect (G_OBJECT (priv->model),
- priv->tree_model_node_deleted_id);
-
- g_object_unref (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
-etsm_dispose (GObject *object)
-{
- ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL (object);
-
- drop_model(etsm);
-
- if (G_OBJECT_CLASS (parent_class)->dispose)
- (* G_OBJECT_CLASS (parent_class)->dispose) (object);
-}
-
-static void
-etsm_finalize (GObject *object)
-{
- ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL (object);
-
- if (etsm->priv) {
- clear_selection (etsm);
- g_hash_table_destroy (etsm->priv->paths);
- g_free (etsm->priv);
- etsm->priv = NULL;
- }
-
- if (G_OBJECT_CLASS (parent_class)->finalize)
- (* G_OBJECT_CLASS (parent_class)->finalize) (object);
-}
-
-static void
-etsm_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
-{
- ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL (object);
-
- switch (prop_id){
- case PROP_CURSOR_ROW:
- g_value_set_int (value, get_cursor_row(etsm));
- break;
-
- case PROP_CURSOR_COL:
- g_value_set_int (value, etsm->priv->cursor_col);
- break;
-
- case PROP_MODEL:
- g_value_set_object (value, etsm->priv->model);
- break;
-
- case PROP_ETTA:
- g_value_set_object (value, etsm->priv->etta);
- break;
- }
-}
-
-static void
-etsm_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
-{
- ESelectionModel *esm = E_SELECTION_MODEL (object);
- ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL (object);
-
- switch (prop_id){
- case PROP_CURSOR_ROW:
- e_selection_model_do_something(esm, g_value_get_int (value), etsm->priv->cursor_col, 0);
- break;
-
- case PROP_CURSOR_COL:
- e_selection_model_do_something(esm, get_cursor_row(etsm), g_value_get_int(value), 0);
- break;
-
- case PROP_MODEL:
- drop_model(etsm);
- add_model(etsm, E_TREE_MODEL (g_value_get_object(value)));
- break;
-
- case PROP_ETTA:
- etsm->priv->etta = E_TREE_TABLE_ADAPTER (g_value_get_object (value));
- break;
- }
-}
-
-static gboolean
-etsm_is_path_selected (ETreeSelectionModel *etsm, ETreePath path)
-{
- if (path && g_hash_table_lookup (etsm->priv->paths, path))
- return TRUE;
-
- return FALSE;
-}
-
-/**
- * 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 (gpointer key, gpointer value, gpointer user_data)
-{
- ETreePath path = key;
- ModelAndCallback *mac = user_data;
- int row = e_tree_table_adapter_row_of_node(mac->etsm->priv->etta, 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;
-
- g_hash_table_foreach(etsm->priv->paths, 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);
-
- clear_selection (etsm);
-
- etsm->priv->cursor_path = NULL;
- e_selection_model_selection_changed(E_SELECTION_MODEL(etsm));
- e_selection_model_cursor_changed(E_SELECTION_MODEL(etsm), -1, -1);
-}
-
-/**
- * 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);
-
- return g_hash_table_size (etsm->priv->paths);
-}
-
-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));
-}
-
-/**
- * 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(etsm->priv->model);
- if (root == NULL)
- return;
-
- clear_selection (etsm);
- select_range (etsm, 0, etsm_row_count (selection) - 1);
-
- if (etsm->priv->cursor_path == NULL)
- etsm->priv->cursor_path = e_tree_table_adapter_node_at_row(etsm->priv->etta, 0);
-
- e_selection_model_selection_changed(E_SELECTION_MODEL(etsm));
- e_selection_model_cursor_changed(E_SELECTION_MODEL(etsm), get_cursor_row(etsm), etsm->priv->cursor_col);
-}
-
-/**
- * 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);
- gint count = etsm_row_count (selection);
- gint i;
-
- for (i = 0; i < count; i++) {
- ETreePath path = e_tree_table_adapter_node_at_row (etsm->priv->etta, i);
- if (!path)
- continue;
- if (g_hash_table_lookup (etsm->priv->paths, path))
- g_hash_table_remove (etsm->priv->paths, path);
- else
- g_hash_table_insert (etsm->priv->paths, path, path);
- }
-
- etsm->priv->cursor_col = -1;
- etsm->priv->cursor_path = NULL;
- etsm->priv->start_path = NULL;
- e_selection_model_selection_changed(E_SELECTION_MODEL(etsm));
- e_selection_model_cursor_changed(E_SELECTION_MODEL(etsm), -1, -1);
-}
-
-static void
-etsm_change_one_row(ESelectionModel *selection, int row, gboolean grow)
-{
- ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL(selection);
- 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;
-
- change_one_path (etsm, path, grow);
-}
-
-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 = e_tree_table_adapter_node_at_row(etsm->priv->etta, row);
- }
- etsm->priv->cursor_col = col;
-}
-
-static gint
-etsm_cursor_row (ESelectionModel *selection)
-{
- return get_cursor_row(E_TREE_SELECTION_MODEL(selection));
-}
-
-static gint
-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, gint row)
-{
- ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL(selection);
- ETreePath path = e_tree_table_adapter_node_at_row (etsm->priv->etta, row);
-
- g_return_if_fail (path != NULL);
-
- select_single_path (etsm, path);
-
- e_selection_model_selection_changed(E_SELECTION_MODEL(etsm));
-}
-
-static void
-etsm_toggle_single_row (ESelectionModel *selection, gint row)
-{
- ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL(selection);
- ETreePath path = e_tree_table_adapter_node_at_row(etsm->priv->etta, row);
-
- g_return_if_fail (path);
-
- if (g_hash_table_lookup (etsm->priv->paths, path))
- g_hash_table_remove (etsm->priv->paths, path);
- else
- g_hash_table_insert (etsm->priv->paths, path, path);
-
- etsm->priv->start_path = NULL;
- e_selection_model_selection_changed(E_SELECTION_MODEL(etsm));
-}
-
-static void
-etsm_real_move_selection_end (ETreeSelectionModel *etsm, gint row)
-{
- ETreePath end_path = e_tree_table_adapter_node_at_row (etsm->priv->etta, row);
- gint start;
-
- g_return_if_fail (end_path);
-
- start = e_tree_table_adapter_row_of_node(etsm->priv->etta, etsm->priv->start_path);
- clear_selection (etsm);
- select_range (etsm, start, row);
-}
-
-static void
-etsm_move_selection_end (ESelectionModel *selection, gint row)
-{
- ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL(selection);
-
- g_return_if_fail (etsm->priv->cursor_path);
-
- etsm_real_move_selection_end (etsm, row);
- e_selection_model_selection_changed(E_SELECTION_MODEL(selection));
-}
-
-static void
-etsm_set_selection_end (ESelectionModel *selection, gint row)
-{
- ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL(selection);
-
- g_return_if_fail (etsm->priv->cursor_path);
-
- if (!etsm->priv->start_path)
- etsm->priv->start_path = etsm->priv->cursor_path;
- etsm_real_move_selection_end(etsm, row);
- e_selection_model_selection_changed(E_SELECTION_MODEL(etsm));
-}
-
-struct foreach_path_t {
- ETreeForeachFunc callback;
- gpointer closure;
-};
-
-static void
-foreach_path (gpointer key, gpointer value, gpointer data)
-{
- ETreePath path = key;
- struct foreach_path_t *c = data;
- c->callback (path, c->closure);
-}
-
-void
-e_tree_selection_model_foreach (ETreeSelectionModel *etsm, ETreeForeachFunc callback, gpointer closure)
-{
- if (etsm->priv->paths) {
- struct foreach_path_t c;
- c.callback = callback;
- c.closure = closure;
- g_hash_table_foreach(etsm->priv->paths, foreach_path, &c);
- return;
- }
-}
-
-void
-e_tree_selection_model_select_single_path (ETreeSelectionModel *etsm, ETreePath path)
-{
- 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)
-{
- change_one_path(etsm, path, TRUE);
-
- 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 = get_cursor_row(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->model = NULL;
-
- priv->paths = g_hash_table_new (NULL, NULL);
-
- priv->cursor_path = NULL;
- priv->start_path = NULL;
- priv->cursor_col = -1;
- priv->cursor_save_id = 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
-e_tree_selection_model_class_init (ETreeSelectionModelClass *klass)
-{
- GObjectClass *object_class;
- ESelectionModelClass *esm_class;
-
- parent_class = g_type_class_ref (PARENT_TYPE);
-
- object_class = G_OBJECT_CLASS(klass);
- esm_class = E_SELECTION_MODEL_CLASS(klass);
-
- object_class->dispose = etsm_dispose;
- object_class->finalize = etsm_finalize;
- object_class->get_property = etsm_get_property;
- object_class->set_property = etsm_set_property;
-
- 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 ;
-
- g_object_class_install_property (object_class, PROP_CURSOR_ROW,
- g_param_spec_int ("cursor_row",
- _("Cursor Row"),
- /*_( */"XXX blurb" /*)*/,
- 0, G_MAXINT, 0,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_CURSOR_COL,
- g_param_spec_int ("cursor_col",
- _("Cursor Column"),
- /*_( */"XXX blurb" /*)*/,
- 0, G_MAXINT, 0,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_MODEL,
- g_param_spec_object ("model",
- _("Model"),
- "XXX blurb",
- E_TREE_MODEL_TYPE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_ETTA,
- g_param_spec_object ("etta",
- "ETTA",
- "XXX blurb",
- E_TREE_TABLE_ADAPTER_TYPE,
- G_PARAM_READWRITE));
-
-}
-
-ESelectionModel *
-e_tree_selection_model_new (void)
-{
- return g_object_new (E_TREE_SELECTION_MODEL_TYPE, NULL);
-}
-
-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 0d3305b93d..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) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TREE_SELECTION_MODEL_TYPE, ETreeSelectionModel))
-#define E_TREE_SELECTION_MODEL_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TREE_SELECTION_MODEL_TYPE, ETreeSelectionModelClass))
-#define E_IS_TREE_SELECTION_MODEL(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TREE_SELECTION_MODEL_TYPE))
-#define E_IS_TREE_SELECTION_MODEL_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TREE_SELECTION_MODEL_TYPE))
-
-typedef struct {
- ESelectionModel base;
-
- ETreeSelectionModelPriv *priv;
-} ETreeSelectionModel;
-
-typedef struct {
- ESelectionModelClass parent_class;
-} ETreeSelectionModelClass;
-
-
-GType 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 e8dff1e05a..0000000000
--- a/widgets/table/e-tree-simple.c
+++ /dev/null
@@ -1,208 +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 "gal/util/e-util.h"
-#include "e-tree-simple.h"
-
-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 (GObjectClass *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, E_TREE_MODEL_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 = g_object_new (E_TREE_SIMPLE_TYPE, NULL);
-
- 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 f9980c9544..0000000000
--- a/widgets/table/e-tree-simple.h
+++ /dev/null
@@ -1,85 +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>
-
-G_BEGIN_DECLS
-
-#define E_TREE_SIMPLE_TYPE (e_tree_simple_get_type ())
-#define E_TREE_SIMPLE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TREE_SIMPLE_TYPE, ETreeSimple))
-#define E_TREE_SIMPLE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TREE_SIMPLE_TYPE, ETreeSimpleClass))
-#define E_IS_TREE_SIMPLE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TREE_SIMPLE_TYPE))
-#define E_IS_TREE_SIMPLE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TREE_SIMPLE_TYPE))
-#define E_TREE_SIMPLE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), E_TREE_SIMPLE_TYPE, ETreeSimpleClass))
-
-
-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;
-
-GType 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);
-
-G_END_DECLS
-
-#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 bb73b8b776..0000000000
--- a/widgets/table/e-tree-sorted-variable.c
+++ /dev/null
@@ -1,477 +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 "gal/util/e-util.h"
-#include "e-tree-sorted-variable.h"
-
-#define d(x)
-
-#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_dispose (GObject *object)
-{
- ETreeSortedVariable *etsv = E_TREE_SORTED_VARIABLE (object);
-
- if (etsv->table_model_changed_id)
- g_signal_handler_disconnect (G_OBJECT (etss->source),
- etsv->table_model_changed_id);
- etsv->table_model_changed_id = 0;
-
-#if 0
- g_signal_handler_disconnect (etss->source,
- etsv->table_model_row_changed_id);
- g_signal_handler_disconnect (etss->source,
- etsv->table_model_cell_changed_id);
-
- etsv->table_model_row_changed_id = 0;
- etsv->table_model_cell_changed_id = 0;
-#endif
- if (etsv->sort_info_changed_id)
- g_signal_handler_disconnect (etsv->sort_info,
- etsv->sort_info_changed_id);
- etsv->sort_info_changed_id = 0;
-
- if (etsv->sort_idle_id)
- g_source_remove(etsv->sort_idle_id);
- etsv->sort_idle_id = 0;
-
- if (etsv->insert_idle_id)
- g_source_remove(etsv->insert_idle_id);
- etsv->insert_idle_id = 0;
-
- if (etsv->sort_info)
- g_object_unref(etsv->sort_info);
- etsv->sort_info = NULL;
-
- if (etsv->full_header)
- g_object_unref(etsv->full_header);
- etsv->full_header = NULL;
-
- G_OBJECT_CLASS (etsv_parent_class)->dispose (object);
-}
-
-static void
-etsv_class_init (GObjectClass *object_class)
-{
- ETreeSortedVariableClass *etsv_class = E_TREE_MODEL_CLASS(object_class);
-
- etsv_parent_class = g_type_class_peek_parent (object_class);
-
- object_class->dispose = etsv_dispose;
-
- 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, E_TREE_MODEL_TYPE)
-
-static gboolean
-etsv_sort_idle(ETreeSortedVariable *etsv)
-{
- g_object_ref(etsv);
- etsv_sort(etsv);
- etsv->sort_idle_id = 0;
- etsv->insert_count = 0;
- g_object_unref(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 = g_object_new (E_TREE_SORTED_VARIABLE_TYPE, NULL);
- ETreeSortedVariable *etsv = E_TABLE_SUBSET_VARIABLE (etsv);
-
- if (e_table_subset_variable_construct (etsv, source) == NULL){
- g_object_unref (etsv);
- return NULL;
- }
-
- etsv->sort_info = sort_info;
- g_object_ref(etsv->sort_info);
- etsv->full_header = full_header;
- g_object_ref(etsv->full_header);
-
- etsv->table_model_changed_id = g_signal_connect (source, "model_changed",
- G_CALLBACK (etsv_proxy_model_changed), etsv);
-#if 0
- etsv->table_model_row_changed_id = g_signal_connect (source, "model_row_changed",
- G_CALLBACK (etsv_proxy_model_row_changed), etsv);
- etsv->table_model_cell_changed_id = g_signal_connect (source, "model_cell_changed",
- G_CALLBACK (etsv_proxy_model_cell_changed), etsv);
-#endif
- etsv->sort_info_changed_id = g_signal_connect (sort_info, "sort_info_changed",
- G_CALLBACK (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 35c4c22ffd..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 <glib-object.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>
-
-G_BEGIN_DECLS
-
-#define E_TREE_SORTED_VARIABLE_TYPE (e_tree_sorted_variable_get_type ())
-#define E_TREE_SORTED_VARIABLE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TREE_SORTED_VARIABLE_TYPE, ETreeSortedVariable))
-#define E_TREE_SORTED_VARIABLE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TREE_SORTED_VARIABLE_TYPE, ETreeSortedVariableClass))
-#define E_IS_TREE_SORTED_VARIABLE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TREE_SORTED_VARIABLE_TYPE))
-#define E_IS_TREE_SORTED_VARIABLE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TREE_SORTED_VARIABLE_TYPE))
-#define E_TREE_SORTED_VARIABLE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((obj), E_TREE_SORTED_VARIABLE_TYPE, ETreeSortedVariableClass))
-
-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;
-
-GType 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);
-G_END_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 20ecdad63f..0000000000
--- a/widgets/table/e-tree-sorted.c
+++ /dev/null
@@ -1,1390 +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 <libxml/parser.h>
-#include <libxml/xmlmemory.h>
-
-#include "gal/util/e-util.h"
-#include "gal/util/e-xml-utils.h"
-#include "e-table-sorting-utils.h"
-
-/* 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_dispose (GObject *object)
-{
- ETreeSorted *ets = E_TREE_SORTED (object);
- ETreeSortedPriv *priv = ets->priv;
-
- /* FIXME lots of stuff to free here */
- if (!priv) {
- G_OBJECT_CLASS (parent_class)->dispose (object);
- return;
- }
-
- if (priv->source) {
- g_signal_handler_disconnect (G_OBJECT (priv->source),
- priv->tree_model_pre_change_id);
- g_signal_handler_disconnect (G_OBJECT (priv->source),
- priv->tree_model_no_change_id);
- g_signal_handler_disconnect (G_OBJECT (priv->source),
- priv->tree_model_node_changed_id);
- g_signal_handler_disconnect (G_OBJECT (priv->source),
- priv->tree_model_node_data_changed_id);
- g_signal_handler_disconnect (G_OBJECT (priv->source),
- priv->tree_model_node_col_changed_id);
- g_signal_handler_disconnect (G_OBJECT (priv->source),
- priv->tree_model_node_inserted_id);
- g_signal_handler_disconnect (G_OBJECT (priv->source),
- priv->tree_model_node_removed_id);
- g_signal_handler_disconnect (G_OBJECT (priv->source),
- priv->tree_model_node_deleted_id);
- g_signal_handler_disconnect (G_OBJECT (priv->source),
- priv->tree_model_node_request_collapse_id);
-
- g_object_unref (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) {
- g_signal_handler_disconnect (G_OBJECT (priv->sort_info),
- priv->sort_info_changed_id);
- priv->sort_info_changed_id = 0;
-
- g_object_unref (priv->sort_info);
- priv->sort_info = NULL;
- }
-
- 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)
- g_object_unref(priv->full_header);
-
-}
-
-static void
-ets_finalize (GObject *object)
-{
- ETreeSorted *ets = (ETreeSorted *) object;
-
- if (ets->priv->root)
- free_path(ets->priv->root);
-
- g_free (ets->priv);
- ets->priv = NULL;
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-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);
- return;
- } 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);
- } else {
- e_tree_model_no_change(E_TREE_MODEL(ets));
- }
- } else {
- e_tree_model_no_change(E_TREE_MODEL(ets));
- }
- }
-}
-
-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));
- } 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));
- } 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);
- } else {
- e_tree_model_no_change(E_TREE_MODEL(ets));
- }
- } else {
- e_tree_model_no_change(E_TREE_MODEL(ets));
- }
-}
-
-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);
- if (path) {
- 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);
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- parent_class = g_type_class_peek_parent (klass);
-
- node_chunk = g_mem_chunk_create (ETreeSortedPath, TREEPATH_CHUNK_AREA_SIZE, G_ALLOC_AND_FREE);
-
- klass->node_resorted = NULL;
-
- object_class->dispose = ets_dispose;
- object_class->finalize = ets_finalize;
-
- 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;
-
- signals [NODE_RESORTED] =
- g_signal_new ("node_resorted",
- E_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETreeSortedClass, node_resorted),
- (GSignalAccumulator) NULL, NULL,
- g_cclosure_marshal_VOID__POINTER,
- G_TYPE_NONE, 1, G_TYPE_POINTER);
-}
-
-static void
-e_tree_sorted_init (GObject *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, E_TREE_MODEL_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)
- g_object_ref(source);
-
- ets->priv->full_header = full_header;
- if (full_header)
- g_object_ref(full_header);
-
- e_tree_sorted_set_sort_info (ets, sort_info);
-
- ets->priv->tree_model_pre_change_id = g_signal_connect (G_OBJECT (source), "pre_change",
- G_CALLBACK (ets_proxy_pre_change), ets);
- ets->priv->tree_model_no_change_id = g_signal_connect (G_OBJECT (source), "no_change",
- G_CALLBACK (ets_proxy_no_change), ets);
- ets->priv->tree_model_node_changed_id = g_signal_connect (G_OBJECT (source), "node_changed",
- G_CALLBACK (ets_proxy_node_changed), ets);
- ets->priv->tree_model_node_data_changed_id = g_signal_connect (G_OBJECT (source), "node_data_changed",
- G_CALLBACK (ets_proxy_node_data_changed), ets);
- ets->priv->tree_model_node_col_changed_id = g_signal_connect (G_OBJECT (source), "node_col_changed",
- G_CALLBACK (ets_proxy_node_col_changed), ets);
- ets->priv->tree_model_node_inserted_id = g_signal_connect (G_OBJECT (source), "node_inserted",
- G_CALLBACK (ets_proxy_node_inserted), ets);
- ets->priv->tree_model_node_removed_id = g_signal_connect (G_OBJECT (source), "node_removed",
- G_CALLBACK (ets_proxy_node_removed), ets);
- ets->priv->tree_model_node_deleted_id = g_signal_connect (G_OBJECT (source), "node_deleted",
- G_CALLBACK (ets_proxy_node_deleted), ets);
- ets->priv->tree_model_node_request_collapse_id = g_signal_connect (G_OBJECT (source), "node_request_collapse",
- G_CALLBACK (ets_proxy_node_request_collapse), 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 = g_object_new (E_TREE_SORTED_TYPE, NULL);
-
- 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));
-
- g_signal_emit (G_OBJECT (sorted), signals [NODE_RESORTED], 0, node);
-}
-
-void
-e_tree_sorted_set_sort_info (ETreeSorted *ets, ETableSortInfo *sort_info)
-{
-
- g_return_if_fail (ets != NULL);
-
-
- if (ets->priv->sort_info) {
- if (ets->priv->sort_info_changed_id != 0)
- g_signal_handler_disconnect (G_OBJECT (ets->priv->sort_info),
- ets->priv->sort_info_changed_id);
- ets->priv->sort_info_changed_id = 0;
- g_object_unref (ets->priv->sort_info);
- }
-
- ets->priv->sort_info = sort_info;
- if (sort_info) {
- g_object_ref(sort_info);
- ets->priv->sort_info_changed_id = g_signal_connect (G_OBJECT (ets->priv->sort_info), "sort_info_changed",
- G_CALLBACK (ets_sort_info_changed), ets);
- }
-
- if (ets->priv->root)
- schedule_resort (ets, ets->priv->root, TRUE, TRUE);
-}
-
-ETableSortInfo*
-e_tree_sorted_get_sort_info (ETreeSorted *ets)
-{
- return ets->priv->sort_info;
-}
-
diff --git a/widgets/table/e-tree-sorted.h b/widgets/table/e-tree-sorted.h
deleted file mode 100644
index 41f123dc0b..0000000000
--- a/widgets/table/e-tree-sorted.h
+++ /dev/null
@@ -1,86 +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>
-
-G_BEGIN_DECLS
-
-#define E_TREE_SORTED_TYPE (e_tree_sorted_get_type ())
-#define E_TREE_SORTED(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TREE_SORTED_TYPE, ETreeSorted))
-#define E_TREE_SORTED_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TREE_SORTED_TYPE, ETreeSortedClass))
-#define E_IS_TREE_SORTED(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TREE_SORTED_TYPE))
-#define E_IS_TREE_SORTED_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TREE_SORTED_TYPE))
-#define E_TREE_SORTED_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), E_TREE_SORTED_TYPE, ETreeSortedClass))
-
-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);
-};
-
-
-GType 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);
-
-ETableSortInfo* e_tree_sorted_get_sort_info (ETreeSorted *tree_model);
-void e_tree_sorted_set_sort_info (ETreeSorted *tree_model,
- ETableSortInfo *sort_info);
-
-G_END_DECLS
-
-#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 e1bda25eba..0000000000
--- a/widgets/table/e-tree-table-adapter.c
+++ /dev/null
@@ -1,1174 +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.
- */
-
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <string.h>
-
-#include <libxml/tree.h>
-#include <libxml/parser.h>
-#include "gal/util/e-util.h"
-#include "gal/util/e-xml-utils.h"
-#include "e-tree-table-adapter.h"
-#include "e-table-sorting-utils.h"
-
-#define PARENT_TYPE E_TABLE_MODEL_TYPE
-#define d(x)
-
-#define INCREMENT_AMOUNT 100
-
-static ETableModelClass *parent_class;
-
-typedef struct {
- ETreePath path;
- guint32 num_visible_children;
- guint32 index;
-
- guint expanded : 1;
- guint expandable : 1;
- guint expandable_set : 1;
-} node_t;
-
-struct ETreeTableAdapterPriv {
- ETreeModel *source;
- ETableSortInfo *sort_info;
- ETableHeader *header;
-
- int n_map;
- int n_vals_allocated;
- node_t **map_table;
- GHashTable *nodes;
- GNode *root;
-
- guint root_visible : 1;
- guint remap_needed : 1;
-
- int last_access;
-
- int pre_change_id;
- int no_change_id;
- int node_changed_id;
- int node_data_changed_id;
- int node_col_changed_id;
- int node_inserted_id;
- int node_removed_id;
- int node_request_collapse_id;
- int sort_info_changed_id;
-};
-
-static GNode *
-lookup_gnode(ETreeTableAdapter *etta, ETreePath path)
-{
- GNode *gnode;
-
- if (!path)
- return NULL;
-
- gnode = g_hash_table_lookup(etta->priv->nodes, path);
-
- return gnode;
-}
-
-static void
-resize_map(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 (node_t *, etta->priv->map_table, etta->priv->n_vals_allocated);
- }
-
- etta->priv->n_map = size;
-}
-
-static void
-move_map_elements(ETreeTableAdapter *etta, int to, int from, int count)
-{
- if (count <= 0 || from >= etta->priv->n_map)
- return;
- memmove(etta->priv->map_table + to, etta->priv->map_table + from, count * sizeof (node_t *));
- etta->priv->remap_needed = TRUE;
-}
-
-static gint
-fill_map(ETreeTableAdapter *etta, gint index, GNode *gnode)
-{
- GNode *p;
-
- if ((gnode != etta->priv->root) || etta->priv->root_visible)
- etta->priv->map_table[index++] = gnode->data;
-
- for (p = gnode->children; p; p = p->next)
- index = fill_map(etta, index, p);
-
- etta->priv->remap_needed = TRUE;
- return index;
-}
-
-static void
-remap_indices(ETreeTableAdapter *etta)
-{
- int i;
- for (i = 0; i < etta->priv->n_map; i++)
- etta->priv->map_table[i]->index = i;
- etta->priv->remap_needed = FALSE;
-}
-
-static node_t *
-get_node(ETreeTableAdapter *etta, ETreePath path)
-{
- GNode *gnode = lookup_gnode(etta, path);
-
- if (!gnode)
- return NULL;
-
- return (node_t *)gnode->data;
-}
-
-static void
-resort_node(ETreeTableAdapter *etta, GNode *gnode, gboolean recurse)
-{
- node_t *node = (node_t *)gnode->data;
- ETreePath *paths, path;
- GNode *prev, *curr;
- int i, count;
- gboolean sort_needed;
-
- if (node->num_visible_children == 0)
- return;
-
- sort_needed = etta->priv->sort_info && e_table_sort_info_sorting_get_count (etta->priv->sort_info) > 0;
-
- for (i = 0, path = e_tree_model_node_get_first_child(etta->priv->source, node->path); path;
- path = e_tree_model_node_get_next(etta->priv->source, path), i++);
-
- count = i;
- if (count <= 1)
- return;
-
- paths = g_new0(ETreePath, count);
-
- for (i = 0, path = e_tree_model_node_get_first_child(etta->priv->source, node->path); path;
- path = e_tree_model_node_get_next(etta->priv->source, path), i++)
- paths[i] = path;
-
- if (count > 1 && sort_needed)
- e_table_sorting_utils_tree_sort(etta->priv->source, etta->priv->sort_info, etta->priv->header, paths, count);
-
- prev = NULL;
- for (i = 0; i < count; i++) {
- curr = lookup_gnode(etta, paths[i]);
- if (!curr)
- continue;
-
- if (prev)
- prev->next = curr;
- else
- gnode->children = curr;
-
- curr->prev = prev;
- curr->next = NULL;
- prev = curr;
- if (recurse)
- resort_node(etta, curr, recurse);
- }
-
- g_free(paths);
-}
-
-static gint
-get_row(ETreeTableAdapter *etta, ETreePath path)
-{
- node_t *node = get_node(etta, path);
- if (!node)
- return -1;
-
- if (etta->priv->remap_needed)
- remap_indices(etta);
-
- return node->index;
-}
-
-static ETreePath
-get_path (ETreeTableAdapter *etta, int row)
-{
- if (row == -1 && etta->priv->n_map > 0)
- row = etta->priv->n_map - 1;
- else if (row < 0 || row >= etta->priv->n_map)
- return NULL;
-
- return etta->priv->map_table [row]->path;
-}
-
-static void
-kill_gnode(GNode *node, ETreeTableAdapter *etta)
-{
- g_hash_table_remove(etta->priv->nodes, ((node_t *)node->data)->path);
-
- while (node->children) {
- GNode *next = node->children->next;
- kill_gnode(node->children, etta);
- node->children = next;
- }
-
- g_free(node->data);
- if (node == etta->priv->root)
- etta->priv->root = NULL;
- g_node_destroy(node);
-}
-
-static void
-update_child_counts(GNode *gnode, gint delta)
-{
- while (gnode) {
- node_t *node = (node_t *) gnode->data;
- node->num_visible_children += delta;
- gnode = gnode->parent;
- }
-}
-
-static int
-delete_children(ETreeTableAdapter *etta, GNode *gnode)
-{
- node_t *node = (node_t *)gnode->data;
- int to_remove = node ? node->num_visible_children : 0;
-
- if (to_remove == 0)
- return 0;
-
- while (gnode->children) {
- GNode *next = gnode->children->next;
- kill_gnode(gnode->children, etta);
- gnode->children = next;
- }
-
- return to_remove;
-}
-
-static void
-delete_node(ETreeTableAdapter *etta, ETreePath parent, ETreePath path)
-{
- int to_remove = 1;
- int parent_row = get_row(etta, parent);
- int row = get_row(etta, path);
- GNode *gnode = lookup_gnode(etta, path);
- GNode *parent_gnode = lookup_gnode(etta, parent);
-
- e_table_model_pre_change(E_TABLE_MODEL(etta));
-
- if (row == -1) {
- e_table_model_no_change(E_TABLE_MODEL(etta));
- return;
- }
-
- to_remove += delete_children(etta, gnode);
- kill_gnode(gnode, etta);
-
- move_map_elements(etta, row, row + to_remove, etta->priv->n_map - row - to_remove);
- resize_map(etta, etta->priv->n_map - to_remove);
-
- if (parent_gnode != NULL) {
- node_t *parent_node = parent_gnode->data;
- gboolean expandable = e_tree_model_node_is_expandable(etta->priv->source, parent);
-
- update_child_counts(parent_gnode, - to_remove);
- if (parent_node->expandable != expandable) {
- e_table_model_pre_change(E_TABLE_MODEL(etta));
- parent_node->expandable = expandable;
- e_table_model_row_changed(E_TABLE_MODEL(etta), parent_row);
- }
-
- resort_node (etta, parent_gnode, FALSE);
- }
-
- e_table_model_rows_deleted(E_TABLE_MODEL(etta), row, to_remove);
-}
-
-static GNode *
-create_gnode(ETreeTableAdapter *etta, ETreePath path)
-{
- GNode *gnode;
- node_t *node;
-
- node = g_new0(node_t, 1);
- node->path = path;
- node->index = -1;
- 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;
- gnode = g_node_new(node);
- g_hash_table_insert(etta->priv->nodes, path, gnode);
- return gnode;
-}
-
-static gint
-insert_children(ETreeTableAdapter *etta, GNode *gnode)
-{
- ETreePath path, tmp;
- int count = 0;
- int pos = 0;
-
- path = ((node_t *)gnode->data)->path;
- for (tmp = e_tree_model_node_get_first_child(etta->priv->source, path);
- tmp;
- tmp = e_tree_model_node_get_next(etta->priv->source, tmp), pos++) {
- GNode *child = create_gnode(etta, tmp);
- node_t *node = (node_t *) child->data;
- if (node->expanded)
- node->num_visible_children = insert_children(etta, child);
- g_node_prepend(gnode, child);
- count += node->num_visible_children + 1;
- }
- g_node_reverse_children(gnode);
- return count;
-}
-
-static void
-generate_tree(ETreeTableAdapter *etta, ETreePath path)
-{
- GNode *gnode;
- node_t *node;
- int size;
-
- e_table_model_pre_change(E_TABLE_MODEL(etta));
-
- g_assert(e_tree_model_node_is_root(etta->priv->source, path));
-
- if (etta->priv->root)
- kill_gnode(etta->priv->root, etta);
- resize_map(etta, 0);
-
- gnode = create_gnode(etta, path);
- node = (node_t *) gnode->data;
- node->expanded = TRUE;
- node->num_visible_children = insert_children(etta, gnode);
- if (etta->priv->sort_info && e_table_sort_info_sorting_get_count(etta->priv->sort_info) > 0)
- resort_node(etta, gnode, TRUE);
-
- etta->priv->root = gnode;
- size = etta->priv->root_visible ? node->num_visible_children + 1 : node->num_visible_children;
- resize_map(etta, size);
- fill_map(etta, 0, gnode);
- e_table_model_changed(E_TABLE_MODEL(etta));
-}
-
-static void
-insert_node(ETreeTableAdapter *etta, ETreePath parent, ETreePath path)
-{
- GNode *gnode, *parent_gnode;
- node_t *node, *parent_node;
- gboolean expandable;
- int size, row;
-
- e_table_model_pre_change(E_TABLE_MODEL(etta));
-
- if (get_node(etta, path)) {
- e_table_model_no_change(E_TABLE_MODEL(etta));
- return;
- }
-
- parent_gnode = lookup_gnode(etta, parent);
- if (!parent_gnode) {
- ETreePath grandparent = e_tree_model_node_get_parent(etta->priv->source, parent);
- if (e_tree_model_node_is_root(etta->priv->source, parent))
- generate_tree(etta, parent);
- else
- insert_node(etta, grandparent, parent);
- e_table_model_changed(E_TABLE_MODEL(etta));
- return;
- }
-
- parent_node = (node_t *) parent_gnode->data;
-
- if (parent_gnode != etta->priv->root) {
- expandable = e_tree_model_node_is_expandable(etta->priv->source, parent);
- if (parent_node->expandable != expandable) {
- e_table_model_pre_change(E_TABLE_MODEL(etta));
- parent_node->expandable = expandable;
- parent_node->expandable_set = 1;
- e_table_model_row_changed(E_TABLE_MODEL(etta), parent_node->index);
- }
- }
-
- if (!e_tree_table_adapter_node_is_expanded (etta, parent)) {
- e_table_model_no_change(E_TABLE_MODEL(etta));
- return;
- }
-
- gnode = create_gnode(etta, path);
- node = (node_t *) gnode->data;
-
- if (node->expanded)
- node->num_visible_children = insert_children(etta, gnode);
-
- g_node_append(parent_gnode, gnode);
- update_child_counts(parent_gnode, node->num_visible_children + 1);
- resort_node(etta, parent_gnode, FALSE);
- resort_node(etta, gnode, TRUE);
-
- size = node->num_visible_children + 1;
- resize_map(etta, etta->priv->n_map + size);
- if (parent_gnode == etta->priv->root)
- row = 0;
- else {
- gint new_size = parent_node->num_visible_children + 1;
- gint old_size = new_size - size;
- row = parent_node->index;
- move_map_elements(etta, row + new_size, row + old_size, etta->priv->n_map - row - new_size);
- }
- fill_map(etta, row, parent_gnode);
- e_table_model_rows_inserted(E_TABLE_MODEL(etta), get_row(etta, path), size);
-}
-
-typedef struct {
- GSList *paths;
- gboolean expanded;
-} check_expanded_closure;
-
-static gboolean
-check_expanded(GNode *gnode, gpointer data)
-{
- check_expanded_closure *closure = (check_expanded_closure *) data;
- node_t *node = (node_t *) gnode->data;
-
- if (node->expanded != closure->expanded)
- closure->paths = g_slist_prepend(closure->paths, node->path);
-
- return FALSE;
-}
-
-static void
-update_node(ETreeTableAdapter *etta, ETreePath path)
-{
- check_expanded_closure closure;
- ETreePath parent = e_tree_model_node_get_parent(etta->priv->source, path);
- GNode *gnode = lookup_gnode(etta, path);
- GSList *l;
-
- closure.expanded = e_tree_model_get_expanded_default (etta->priv->source);
- closure.paths = NULL;
-
- if (gnode)
- g_node_traverse(gnode, G_POST_ORDER, G_TRAVERSE_ALL, -1, check_expanded, &closure);
-
- if (e_tree_model_node_is_root(etta->priv->source, path))
- generate_tree(etta, path);
- else {
- delete_node(etta, parent, path);
- insert_node(etta, parent, path);
- }
-
- for (l = closure.paths; l; l = l->next)
- if (lookup_gnode(etta, l->data))
- e_tree_table_adapter_node_set_expanded (etta, l->data, !closure.expanded);
-
- g_slist_free(closure.paths);
-}
-
-static void
-etta_finalize (GObject *object)
-{
- ETreeTableAdapter *etta = E_TREE_TABLE_ADAPTER (object);
-
- if (etta->priv->root) {
- kill_gnode(etta->priv->root, etta);
- etta->priv->root = NULL;
- }
-
- g_hash_table_destroy (etta->priv->nodes);
-
- g_free (etta->priv->map_table);
-
- g_free (etta->priv);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static void
-etta_dispose (GObject *object)
-{
- ETreeTableAdapter *etta = E_TREE_TABLE_ADAPTER (object);
-
- if (etta->priv->sort_info) {
- g_signal_handler_disconnect(G_OBJECT (etta->priv->sort_info),
- etta->priv->sort_info_changed_id);
- g_object_unref(etta->priv->sort_info);
- etta->priv->sort_info = NULL;
- }
-
- if (etta->priv->header) {
- g_object_unref(etta->priv->header);
- etta->priv->header = NULL;
- }
-
- if (etta->priv->source) {
- g_signal_handler_disconnect (G_OBJECT (etta->priv->source),
- etta->priv->pre_change_id);
- g_signal_handler_disconnect (G_OBJECT (etta->priv->source),
- etta->priv->no_change_id);
- g_signal_handler_disconnect (G_OBJECT (etta->priv->source),
- etta->priv->node_changed_id);
- g_signal_handler_disconnect (G_OBJECT (etta->priv->source),
- etta->priv->node_data_changed_id);
- g_signal_handler_disconnect (G_OBJECT (etta->priv->source),
- etta->priv->node_col_changed_id);
- g_signal_handler_disconnect (G_OBJECT (etta->priv->source),
- etta->priv->node_inserted_id);
- g_signal_handler_disconnect (G_OBJECT (etta->priv->source),
- etta->priv->node_removed_id);
- g_signal_handler_disconnect (G_OBJECT (etta->priv->source),
- etta->priv->node_request_collapse_id);
-
- g_object_unref (etta->priv->source);
- etta->priv->source = NULL;
- }
-
- G_OBJECT_CLASS (parent_class)->dispose (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;
-
- return e_tree_model_get_save_id (etta->priv->source, get_path(etta, row));
-}
-
-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;
-
- return etta->priv->n_map;
-}
-
-static void *
-etta_value_at (ETableModel *etm, int col, int row)
-{
- ETreeTableAdapter *etta = (ETreeTableAdapter *)etm;
-
- switch (col) {
- case -1:
- if (row == -1)
- return NULL;
- return get_path (etta, row);
- case -2:
- return etta->priv->source;
- case -3:
- return etta;
- default:
- return e_tree_model_value_at (etta->priv->source, get_path (etta, row), col);
- }
-}
-
-static void
-etta_set_value_at (ETableModel *etm, int col, int row, const void *val)
-{
- ETreeTableAdapter *etta = (ETreeTableAdapter *)etm;
-
- e_tree_model_set_value_at (etta->priv->source, get_path (etta, row), col, val);
-}
-
-static gboolean
-etta_is_cell_editable (ETableModel *etm, int col, int row)
-{
- ETreeTableAdapter *etta = (ETreeTableAdapter *)etm;
-
- return e_tree_model_node_is_editable (etta->priv->source, get_path (etta, row), col);
-}
-
-static void
-etta_append_row (ETableModel *etm, ETableModel *source, int row)
-{
-}
-
-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;
- GObjectClass *object_class = (GObjectClass *) klass;
-
- parent_class = g_type_class_peek_parent (klass);
-
- object_class->dispose = etta_dispose;
- object_class->finalize = etta_finalize;
-
- 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->sort_info = NULL;
-
- etta->priv->n_map = 0;
- etta->priv->n_vals_allocated = 0;
- etta->priv->map_table = NULL;
- etta->priv->nodes = NULL;
- etta->priv->root = NULL;
-
- etta->priv->root_visible = TRUE;
- etta->priv->remap_needed = TRUE;
-
- etta->priv->pre_change_id = 0;
- etta->priv->no_change_id = 0;
- etta->priv->node_changed_id = 0;
- etta->priv->node_data_changed_id = 0;
- etta->priv->node_col_changed_id = 0;
- etta->priv->node_inserted_id = 0;
- etta->priv->node_removed_id = 0;
- etta->priv->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)
-{
- update_node(etta, path);
-
- e_table_model_changed(E_TABLE_MODEL(etta));
-}
-
-static void
-etta_proxy_node_data_changed (ETreeModel *etm, ETreePath path, ETreeTableAdapter *etta)
-{
- int row = get_row(etta, path);
-
- if (row == -1) {
- e_table_model_no_change(E_TABLE_MODEL(etta));
- return;
- }
-
- e_table_model_row_changed(E_TABLE_MODEL(etta), row);
-}
-
-static void
-etta_proxy_node_col_changed (ETreeModel *etm, ETreePath path, int col, ETreeTableAdapter *etta)
-{
- int row = get_row(etta, path);
-
- if (row == -1) {
- e_table_model_no_change(E_TABLE_MODEL(etta));
- return;
- }
-
- e_table_model_cell_changed(E_TABLE_MODEL(etta), col, row);
-}
-
-static void
-etta_proxy_node_inserted (ETreeModel *etm, ETreePath parent, ETreePath child, ETreeTableAdapter *etta)
-{
- if (e_tree_model_node_is_root(etm, child))
- generate_tree(etta, child);
- else
- insert_node(etta, parent, child);
-
- e_table_model_changed(E_TABLE_MODEL(etta));
-}
-
-static void
-etta_proxy_node_removed (ETreeModel *etm, ETreePath parent, ETreePath child, int old_position, ETreeTableAdapter *etta)
-{
- delete_node(etta, parent, child);
- e_table_model_changed(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);
-}
-
-static void
-etta_sort_info_changed (ETableSortInfo *sort_info, ETreeTableAdapter *etta)
-{
- if (!etta->priv->root)
- return;
-
- e_table_model_pre_change(E_TABLE_MODEL(etta));
- resort_node(etta, etta->priv->root, TRUE);
- fill_map(etta, 0, etta->priv->root);
- e_table_model_changed(E_TABLE_MODEL(etta));
-}
-
-ETableModel *
-e_tree_table_adapter_construct (ETreeTableAdapter *etta, ETreeModel *source, ETableSortInfo *sort_info, ETableHeader *header)
-{
- ETreePath root;
-
- etta->priv->source = source;
- g_object_ref (source);
-
- etta->priv->sort_info = sort_info;
- if (sort_info) {
- g_object_ref(sort_info);
- etta->priv->sort_info_changed_id = g_signal_connect (G_OBJECT (sort_info), "sort_info_changed",
- G_CALLBACK (etta_sort_info_changed), etta);
- }
-
- etta->priv->header = header;
- if (header)
- g_object_ref(header);
-
- etta->priv->nodes = g_hash_table_new(NULL, NULL);
-
- root = e_tree_model_get_root (source);
-
- if (root)
- generate_tree(etta, root);
-
- etta->priv->pre_change_id = g_signal_connect(G_OBJECT(source), "pre_change",
- G_CALLBACK (etta_proxy_pre_change), etta);
- etta->priv->no_change_id = g_signal_connect (G_OBJECT (source), "no_change",
- G_CALLBACK (etta_proxy_no_change), etta);
- etta->priv->node_changed_id = g_signal_connect (G_OBJECT (source), "node_changed",
- G_CALLBACK (etta_proxy_node_changed), etta);
- etta->priv->node_data_changed_id = g_signal_connect (G_OBJECT (source), "node_data_changed",
- G_CALLBACK (etta_proxy_node_data_changed), etta);
- etta->priv->node_col_changed_id = g_signal_connect (G_OBJECT (source), "node_col_changed",
- G_CALLBACK (etta_proxy_node_col_changed), etta);
- etta->priv->node_inserted_id = g_signal_connect (G_OBJECT (source), "node_inserted",
- G_CALLBACK (etta_proxy_node_inserted), etta);
- etta->priv->node_removed_id = g_signal_connect (G_OBJECT (source), "node_removed",
- G_CALLBACK (etta_proxy_node_removed), etta);
- etta->priv->node_request_collapse_id = g_signal_connect (G_OBJECT (source), "node_request_collapse",
- G_CALLBACK (etta_proxy_node_request_collapse), etta);
-
- return E_TABLE_MODEL (etta);
-}
-
-ETableModel *
-e_tree_table_adapter_new (ETreeModel *source, ETableSortInfo *sort_info, ETableHeader *header)
-{
- ETreeTableAdapter *etta = g_object_new (E_TREE_TABLE_ADAPTER_TYPE, NULL);
-
- e_tree_table_adapter_construct (etta, source, sort_info, header);
-
- return (ETableModel *) etta;
-}
-
-typedef struct {
- xmlNode *root;
- gboolean expanded_default;
- ETreeModel *model;
-} TreeAndRoot;
-
-static void
-save_expanded_state_func (gpointer keyp, gpointer value, gpointer data)
-{
- ETreePath path = keyp;
- node_t *node = ((GNode *)value)->data;
- TreeAndRoot *tar = data;
- xmlNode *xmlnode;
-
- if (node->expanded != tar->expanded_default) {
- gchar *save_id = e_tree_model_get_save_id(tar->model, path);
- xmlnode = xmlNewChild (tar->root, NULL, "node", NULL);
- e_xml_set_string_prop_by_name(xmlnode, "id", save_id);
- g_free(save_id);
- }
-}
-
-void
-e_tree_table_adapter_save_expanded_state (ETreeTableAdapter *etta, const char *filename)
-{
- TreeAndRoot tar;
- xmlDocPtr doc;
- xmlNode *root;
-
- g_return_if_fail(etta != NULL);
-
- doc = xmlNewDoc ("1.0");
- root = xmlNewDocNode (doc, NULL, (xmlChar *) "expanded_state", NULL);
- xmlDocSetRootElement (doc, root);
-
- tar.model = etta->priv->source;
- tar.root = root;
- tar.expanded_default = e_tree_model_get_expanded_default(etta->priv->source);
-
- e_xml_set_integer_prop_by_name (root, "vers", 2);
- e_xml_set_bool_prop_by_name (root, "default", tar.expanded_default);
-
- g_hash_table_foreach (etta->priv->nodes, save_expanded_state_func, &tar);
-
- e_xml_save_file (filename, doc);
- xmlFreeDoc (doc);
-}
-
-static xmlDoc *
-open_file (ETreeTableAdapter *etta, const char *filename)
-{
- xmlDoc *doc;
- xmlNode *root;
- int vers;
- gboolean model_default, saved_default;
-
- if (!g_file_test (filename, G_FILE_TEST_EXISTS))
- return NULL;
-
- doc = xmlParseFile (filename);
- if (!doc)
- return NULL;
-
- root = xmlDocGetRootElement (doc);
- if (root == NULL || strcmp (root->name, "expanded_state")) {
- xmlFreeDoc (doc);
- return NULL;
- }
-
- vers = e_xml_get_integer_prop_by_name_with_default (root, "vers", 0);
- if (vers > 2) {
- xmlFreeDoc (doc);
- return NULL;
- }
- model_default = e_tree_model_get_expanded_default (etta->priv->source);
- saved_default = e_xml_get_bool_prop_by_name_with_default (root, "default", !model_default);
- if (saved_default != model_default) {
- xmlFreeDoc (doc);
- return NULL;
- }
-
- return doc;
-}
-
-void
-e_tree_table_adapter_load_expanded_state (ETreeTableAdapter *etta, const char *filename)
-{
- xmlDoc *doc;
- xmlNode *root, *child;
- gboolean model_default;
-
- g_return_if_fail(etta != NULL);
-
- doc = open_file(etta, filename);
- if (!doc)
- return;
-
- root = xmlDocGetRootElement (doc);
-
- e_table_model_pre_change(E_TABLE_MODEL(etta));
-
- model_default = e_tree_model_get_expanded_default(etta->priv->source);
-
- for (child = root->xmlChildrenNode; child; child = child->next) {
- char *id;
- ETreePath path;
-
- 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);
- continue;
- }
-
- path = e_tree_model_get_node_by_id(etta->priv->source, id);
- if (path)
- e_tree_table_adapter_node_set_expanded(etta, path, !model_default);
-
- g_free (id);
- }
-
- xmlFreeDoc (doc);
-
- e_table_model_changed (E_TABLE_MODEL (etta));
-}
-
-void
-e_tree_table_adapter_root_node_set_visible (ETreeTableAdapter *etta, gboolean visible)
-{
- int size;
-
- 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);
- }
- size = (visible ? 1 : 0) + (etta->priv->root ? ((node_t *)etta->priv->root->data)->num_visible_children : 0);
- resize_map(etta, size);
- if (etta->priv->root)
- fill_map(etta, 0, etta->priv->root);
- e_table_model_changed(E_TABLE_MODEL(etta));
-}
-
-void
-e_tree_table_adapter_node_set_expanded (ETreeTableAdapter *etta, ETreePath path, gboolean expanded)
-{
- GNode *gnode = lookup_gnode(etta, path);
- node_t *node;
- int row;
-
- if (!expanded && (!gnode || (e_tree_model_node_is_root (etta->priv->source, path) && !etta->priv->root_visible)))
- return;
-
- if (!gnode && expanded) {
- ETreePath parent = e_tree_model_node_get_parent(etta->priv->source, path);
- g_return_if_fail(parent != NULL);
- e_tree_table_adapter_node_set_expanded(etta, parent, expanded);
- gnode = lookup_gnode(etta, path);
- }
- g_return_if_fail(gnode != NULL);
-
- node = (node_t *) gnode->data;
-
- if (expanded == node->expanded)
- return;
-
- node->expanded = expanded;
-
- row = get_row(etta, path);
- if (row == -1)
- return;
-
- e_table_model_pre_change (E_TABLE_MODEL(etta));
- e_table_model_pre_change (E_TABLE_MODEL(etta));
- e_table_model_row_changed(E_TABLE_MODEL(etta), row);
-
-
- if (expanded) {
- int num_children = insert_children(etta, gnode);
- update_child_counts(gnode, num_children);
- if (etta->priv->sort_info && e_table_sort_info_sorting_get_count(etta->priv->sort_info) > 0)
- resort_node(etta, gnode, TRUE);
- resize_map(etta, etta->priv->n_map + num_children);
- move_map_elements(etta, row + 1 + num_children, row + 1, etta->priv->n_map - row - 1 - num_children);
- fill_map(etta, row, gnode);
- if (num_children != 0) {
- e_table_model_rows_inserted(E_TABLE_MODEL(etta), row + 1, num_children);
- } else
- e_table_model_no_change(E_TABLE_MODEL(etta));
- } else {
- int num_children = delete_children(etta, gnode);
- if (num_children == 0) {
- e_table_model_no_change(E_TABLE_MODEL(etta));
- return;
- }
- move_map_elements(etta, row + 1, row + 1 + num_children, etta->priv->n_map - row - 1 - num_children);
- update_child_counts(gnode, - num_children);
- resize_map(etta, etta->priv->n_map - num_children);
- e_table_model_rows_deleted(E_TABLE_MODEL(etta), row + 1, num_children);
- }
-}
-
-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)
-{
- return get_path(etta, row);
-}
-
-int
-e_tree_table_adapter_row_of_node (ETreeTableAdapter *etta, ETreePath path)
-{
- return get_row(etta, path);
-}
-
-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);
-
- while (parent) {
- e_tree_table_adapter_node_set_expanded(etta, parent, TRUE);
- parent = e_tree_model_node_get_parent(etta->priv->source, parent);
- }
-}
-
-gboolean
-e_tree_table_adapter_node_is_expanded (ETreeTableAdapter *etta, ETreePath path)
-{
- node_t *node = get_node(etta, path);
- if (!e_tree_model_node_is_expandable (etta->priv->source, path) || !node)
- return FALSE;
-
- return node->expanded;
-}
-
-void
-e_tree_table_adapter_set_sort_info (ETreeTableAdapter *etta, ETableSortInfo *sort_info)
-{
- if (etta->priv->sort_info) {
- g_signal_handler_disconnect(G_OBJECT(etta->priv->sort_info),
- etta->priv->sort_info_changed_id);
- g_object_unref(etta->priv->sort_info);
- }
-
- etta->priv->sort_info = sort_info;
- if (sort_info) {
- g_object_ref(sort_info);
- etta->priv->sort_info_changed_id = g_signal_connect(G_OBJECT(sort_info), "sort_info_changed",
- G_CALLBACK(etta_sort_info_changed), etta);
- }
-
- if (!etta->priv->root)
- return;
-
- e_table_model_pre_change(E_TABLE_MODEL(etta));
- resort_node(etta, etta->priv->root, TRUE);
- fill_map(etta, 0, etta->priv->root);
- e_table_model_changed(E_TABLE_MODEL(etta));
-}
-
-ETreePath
-e_tree_table_adapter_node_get_next (ETreeTableAdapter *etta, ETreePath path)
-{
- GNode *node = lookup_gnode (etta, path);
-
- if (node && node->next)
- return ((node_t *)node->next->data)->path;
-
- return NULL;
-}
diff --git a/widgets/table/e-tree-table-adapter.h b/widgets/table/e-tree-table-adapter.h
deleted file mode 100644
index 8ce1c78097..0000000000
--- a/widgets/table/e-tree-table-adapter.h
+++ /dev/null
@@ -1,95 +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 <glib-object.h>
-#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>
-
-G_BEGIN_DECLS
-
-#define E_TREE_TABLE_ADAPTER_TYPE (e_tree_table_adapter_get_type ())
-#define E_TREE_TABLE_ADAPTER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TREE_TABLE_ADAPTER_TYPE, ETreeTableAdapter))
-#define E_TREE_TABLE_ADAPTER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TREE_TABLE_ADAPTER_TYPE, ETreeTableAdapterClass))
-#define E_IS_TREE_TABLE_ADAPTER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TREE_TABLE_ADAPTER_TYPE))
-#define E_IS_TREE_TABLE_ADAPTER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TREE_TABLE_ADAPTER_TYPE))
-#define E_TREE_TABLE_ADAPTER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((obj), E_TREE_TABLE_ADAPTER_TYPE, ETreeTableAdapterClass))
-
-typedef struct ETreeTableAdapterPriv ETreeTableAdapterPriv;
-
-typedef struct {
- ETableModel base;
-
- ETreeTableAdapterPriv *priv;
-} ETreeTableAdapter;
-
-typedef struct {
- ETableModelClass parent_class;
-} ETreeTableAdapterClass;
-
-GType e_tree_table_adapter_get_type (void);
-ETableModel *e_tree_table_adapter_new (ETreeModel *source,
- ETableSortInfo *sort_info,
- ETableHeader *header);
-ETableModel *e_tree_table_adapter_construct (ETreeTableAdapter *ets,
- ETreeModel *source,
- ETableSortInfo *sort_info,
- ETableHeader *header);
-
-ETreePath e_tree_table_adapter_node_get_next (ETreeTableAdapter *etta,
- ETreePath path);
-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);
-
-void e_tree_table_adapter_set_sort_info (ETreeTableAdapter *etta,
- ETableSortInfo *sort_info);
-
-G_END_DECLS
-
-#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 84b5fb2a95..0000000000
--- a/widgets/table/e-tree.c
+++ /dev/null
@@ -1,3314 +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 <libgnomecanvas/gnome-canvas-rect-ellipse.h>
-
-#include <gal/util/e-i18n.h>
-#include <gal/util/e-util.h>
-#include <gal/util/e-marshal.h>
-#include <gal/widgets/e-canvas.h>
-#include <gal/widgets/e-canvas-background.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-table-adapter.h>
-
-#include "e-tree.h"
-#include "gal/util/e-marshal.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,
- WHITE_SPACE_EVENT,
-
- 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 {
- PROP_0,
- PROP_LENGTH_THRESHOLD,
- PROP_HORIZONTAL_DRAW_GRID,
- PROP_VERTICAL_DRAW_GRID,
- PROP_DRAW_FOCUS,
- PROP_ETTA,
- PROP_UNIFORM_ROW_HEIGHT,
- PROP_ALWAYS_SEARCH
-};
-
-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;
- 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;
-
- ETableCol *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;
-
- 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;
-
- guint search_col_set : 1;
- guint always_search : 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 guint 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 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 context_destroyed (gpointer data, GObject *ctx);
-
-static void
-et_disconnect_from_etta (ETree *et)
-{
- if (et->priv->table_model_change_id != 0)
- g_signal_handler_disconnect (G_OBJECT (et->priv->etta),
- et->priv->table_model_change_id);
- if (et->priv->table_row_change_id != 0)
- g_signal_handler_disconnect (G_OBJECT (et->priv->etta),
- et->priv->table_row_change_id);
- if (et->priv->table_cell_change_id != 0)
- g_signal_handler_disconnect (G_OBJECT (et->priv->etta),
- et->priv->table_cell_change_id);
-
- et->priv->table_model_change_id = 0;
- et->priv->table_row_change_id = 0;
- et->priv->table_cell_change_id = 0;
-}
-
-static void
-clear_current_search_col (ETree *et)
-{
- et->priv->search_col_set = FALSE;
-}
-
-static ETableCol *
-current_search_col (ETree *et)
-{
- if (!et->priv->search_col_set) {
- et->priv->current_search_col =
- e_table_util_calculate_current_search_col (et->priv->header,
- et->priv->full_header,
- et->priv->sort_info,
- et->priv->always_search);
- et->priv->search_col_set = TRUE;
- }
-
- return et->priv->current_search_col;
-}
-
-static void
-e_tree_state_change (ETree *et)
-{
- g_signal_emit (G_OBJECT (et), et_signals [STATE_CHANGE], 0);
-}
-
-static void
-change_trigger (GtkObject *object, ETree *et)
-{
- e_tree_state_change (et);
-}
-
-static void
-search_col_change_trigger (GtkObject *object, ETree *et)
-{
- clear_current_search_col (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)
- g_signal_handler_disconnect (G_OBJECT (e_tree->priv->header),
- e_tree->priv->structure_change_id);
- if (e_tree->priv->expansion_change_id)
- g_signal_handler_disconnect (G_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)
- g_signal_handler_disconnect (G_OBJECT (e_tree->priv->sort_info),
- e_tree->priv->sort_info_change_id);
- if (e_tree->priv->group_info_change_id)
- g_signal_handler_disconnect (G_OBJECT (e_tree->priv->sort_info),
- e_tree->priv->group_info_change_id);
-
- g_object_unref(e_tree->priv->sort_info);
- }
- g_object_unref(e_tree->priv->header);
- e_tree->priv->header = NULL;
- e_tree->priv->sort_info = NULL;
-}
-
-static void
-connect_header (ETree *e_tree, ETableState *state)
-{
- GValue *val = g_new0 (GValue, 1);
-
- 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 =
- g_signal_connect (G_OBJECT (e_tree->priv->header), "structure_change",
- G_CALLBACK (search_col_change_trigger), e_tree);
- e_tree->priv->expansion_change_id =
- g_signal_connect (G_OBJECT (e_tree->priv->header), "expansion_change",
- G_CALLBACK (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 =
- g_signal_connect (G_OBJECT (e_tree->priv->sort_info), "sort_info_changed",
- G_CALLBACK (search_col_change_trigger), e_tree);
- e_tree->priv->group_info_change_id =
- g_signal_connect (G_OBJECT (e_tree->priv->sort_info), "group_info_changed",
- G_CALLBACK (search_col_change_trigger), e_tree);
- } else
- e_tree->priv->sort_info = NULL;
-
- g_value_init (val, G_TYPE_OBJECT);
- g_value_set_object (val, e_tree->priv->sort_info);
- g_object_set_property (G_OBJECT(e_tree->priv->header), "sort_info", val);
- g_free (val);
-}
-
-static void
-et_dispose (GObject *object)
-{
- ETree *et = E_TREE (object);
-
- if (et->priv) {
-
- if (et->priv->search) {
- if (et->priv->search_search_id)
- g_signal_handler_disconnect (et->priv->search,
- et->priv->search_search_id);
- if (et->priv->search_accept_id)
- g_signal_handler_disconnect (et->priv->search,
- et->priv->search_accept_id);
- g_object_unref (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);
-
- g_object_unref (et->priv->etta);
- g_object_unref (et->priv->model);
- g_object_unref (et->priv->full_header);
- disconnect_header (et);
- g_object_unref (et->priv->selection);
- if (et->priv->spec)
- g_object_unref (et->priv->spec);
- et->priv->spec = NULL;
-
- if (et->priv->sorter)
- g_object_unref (et->priv->sorter);
- et->priv->sorter = NULL;
-
- if (et->priv->header_canvas)
- gtk_widget_destroy (GTK_WIDGET (et->priv->header_canvas));
- et->priv->header_canvas = NULL;
-
- if (et->priv->site)
- e_tree_drag_source_unset (et);
-
- if (et->priv->last_drop_context)
- g_object_weak_unref (G_OBJECT(et->priv->last_drop_context), context_destroyed, et);
- et->priv->last_drop_context = NULL;
-
- gtk_widget_destroy (GTK_WIDGET (et->priv->table_canvas));
-
- g_free(et->priv);
- et->priv = NULL;
- }
-
- if (G_OBJECT_CLASS (parent_class)->dispose)
- G_OBJECT_CLASS (parent_class)->dispose (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;
- ETableCol *col = current_search_col (cb_data->et);
-
- value = e_tree_model_value_at (model, path, cb_data->et->priv->current_search_col->col_idx);
-
- return col->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;
- ETableCol *col = current_search_col (et);
-
- if (col == NULL)
- return FALSE;
-
- cb_data.et = et;
- cb_data.string = string;
-
- cursor = e_tree_get_cursor (et);
-
- if (cursor && (flags & E_TABLE_SEARCH_FLAGS_CHECK_CURSOR_FIRST)) {
- const void *value;
-
- value = e_tree_model_value_at (et->priv->model, cursor, col->col_idx);
-
- if (col->search (value, string)) {
- return TRUE;
- }
- }
-
- found = e_tree_model_node_find (et->priv->model, cursor, NULL, E_TREE_FIND_NEXT_FORWARD, search_search_callback, &cb_data);
- if (found == NULL)
- found = e_tree_model_node_find (et->priv->model, 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 = found;
-
- e_selection_model_select_as_key_press(E_SELECTION_MODEL (et->priv->selection), model_row, col->col_idx, GDK_CONTROL_MASK);
- return TRUE;
- } else if (cursor && !(flags & E_TABLE_SEARCH_FLAGS_CHECK_CURSOR_FIRST)) {
- const void *value;
-
- value = e_tree_model_value_at (et->priv->model, cursor, col->col_idx);
-
- return col->search (value, string);
- } else
- return FALSE;
-}
-
-static void
-et_search_accept (ETableSearch *search, ETree *et)
-{
- ETableCol *col = current_search_col (et);
- int cursor;
-
- if (col == NULL)
- return;
-
- g_object_get(et->priv->selection,
- "cursor_row", &cursor,
- NULL);
- e_selection_model_select_as_key_press(E_SELECTION_MODEL (et->priv->selection), cursor, col->col_idx, 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->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->table_model_change_id = 0;
- e_tree->priv->table_row_change_id = 0;
- e_tree->priv->table_cell_change_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->scroll_direction = 0;
-
- 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 =
- g_signal_connect (G_OBJECT (e_tree->priv->search), "search",
- G_CALLBACK (et_search_search), e_tree);
- e_tree->priv->search_accept_id =
- g_signal_connect (G_OBJECT (e_tree->priv->search), "accept",
- G_CALLBACK (et_search_accept), e_tree);
-
- e_tree->priv->current_search_col = NULL;
- e_tree->priv->search_col_set = FALSE;
- e_tree->priv->always_search = g_getenv ("GAL_ALWAYS_SEARCH") ? TRUE : FALSE;
-}
-
-/* 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 (GtkWidget *container, GtkDirectionType direction)
-{
- ETree *e_tree;
-
- e_tree = E_TREE (container);
-
- if (GTK_CONTAINER (container)->focus_child) {
- gtk_container_set_focus_child (GTK_CONTAINER (container), NULL);
- return FALSE;
- }
-
- return gtk_widget_child_focus (GTK_WIDGET (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);
-
- g_signal_connect (
- e_tree->priv->header_canvas, "size_allocate",
- G_CALLBACK (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);
-
- g_object_get (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);
- }
- 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;
- GtkAdjustment *adj = GTK_LAYOUT(e_tree->priv->table_canvas)->vadjustment;
- ETreePath path = e_tree_get_cursor (e_tree);
- gint x, y, w, h;
- GValue *val = g_new0 (GValue, 1);
- g_value_init (val, G_TYPE_DOUBLE);
-
- width = alloc->width;
- g_value_set_double (val, width);
- g_object_get (e_tree->priv->item,
- "height", &height,
- NULL);
- item_height = height;
- height = MAX ((int)height, alloc->height);
-
- g_object_set (e_tree->priv->item,
- "width", width,
- NULL);
- g_object_set_property (G_OBJECT (e_tree->priv->header), "width", val);
- g_free (val);
-
- if (e_tree->priv->reflow_idle_id)
- g_source_remove(e_tree->priv->reflow_idle_id);
- tree_canvas_reflow_idle(e_tree);
-
- x = y = w = h = 0;
- if (path) {
- int row = e_tree_row_of_node(e_tree, path);
- int col = 0;
-
- if (row >= 0)
- e_table_item_get_cell_geometry (E_TABLE_ITEM (e_tree->priv->item),
- &row, &col, &x, &y, &w, &h);
- }
-
- if (y < adj->value || y + h > adj->value + adj->page_size)
- gtk_adjustment_set_value(adj, CLAMP(y - adj->page_size / 2, adj->lower, adj->upper - adj->page_size));
-}
-
-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);
- g_signal_emit (et,
- et_signals [CURSOR_CHANGE], 0,
- 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);
- g_signal_emit (et,
- et_signals [CURSOR_ACTIVATED], 0,
- 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);
- g_signal_emit (et,
- et_signals [DOUBLE_CLICK], 0,
- 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);
- g_signal_emit (et,
- et_signals [RIGHT_CLICK], 0,
- 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);
- g_signal_emit (et,
- et_signals [CLICK], 0,
- 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:
- /* Only allow if the Shift modifier is used -- eg. Ctrl-Equal shouldn't be handled. */
- if (key->state & ~(GDK_SHIFT_MASK | GDK_LOCK_MASK))
- break;
- 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:
- /* Only allow if the Shift modifier is used -- eg. Ctrl-Minus shouldn't be handled. */
- if (key->state & ~(GDK_SHIFT_MASK | GDK_LOCK_MASK))
- break;
- 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);
- g_signal_emit (et,
- et_signals [KEY_PRESS], 0,
- 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);
-
- g_signal_emit (et,
- et_signals [START_DRAG], 0,
- row, path, col, event, &return_val);
-
- return return_val;
-}
-
-static void
-et_selection_model_selection_changed (ETableSelectionModel *etsm, ETree *et)
-{
- g_signal_emit (et,
- et_signals [SELECTION_CHANGE], 0);
-}
-
-static void
-et_selection_model_selection_row_changed (ETableSelectionModel *etsm, int row, ETree *et)
-{
- g_signal_emit (et,
- et_signals [SELECTION_CHANGE], 0);
-}
-
-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);
-
- g_signal_connect (et->priv->item, "cursor_change",
- G_CALLBACK (item_cursor_change), et);
- g_signal_connect (et->priv->item, "cursor_activated",
- G_CALLBACK (item_cursor_activated), et);
- g_signal_connect (et->priv->item, "double_click",
- G_CALLBACK (item_double_click), et);
- g_signal_connect (et->priv->item, "right_click",
- G_CALLBACK (item_right_click), et);
- g_signal_connect (et->priv->item, "click",
- G_CALLBACK (item_click), et);
- g_signal_connect (et->priv->item, "key_press",
- G_CALLBACK (item_key_press), et);
- g_signal_connect (et->priv->item, "start_drag",
- G_CALLBACK (item_start_drag), et);
-}
-
-static void
-et_canvas_style_set (GtkWidget *widget, GtkStyle *prev_style)
-{
- gnome_canvas_item_set(
- E_TREE(widget)->priv->white_item,
- "fill_color_gdk", &widget->style->base[GTK_STATE_NORMAL],
- NULL);
-}
-
-static gint
-white_item_event (GnomeCanvasItem *white_item, GdkEvent *event, ETree *e_tree)
-{
- int return_val = 0;
- g_signal_emit (e_tree,
- et_signals [WHITE_SPACE_EVENT], 0,
- event, &return_val);
- return return_val;
-}
-
-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 ());
- g_signal_connect (
- e_tree->priv->table_canvas, "size_allocate",
- G_CALLBACK (tree_canvas_size_allocate), e_tree);
- g_signal_connect (
- e_tree->priv->table_canvas, "focus_in_event",
- G_CALLBACK (table_canvas_focus_event_cb), e_tree);
- g_signal_connect (
- e_tree->priv->table_canvas, "focus_out_event",
- G_CALLBACK (table_canvas_focus_event_cb), e_tree);
-
- g_signal_connect (
- e_tree->priv->table_canvas, "drag_begin",
- G_CALLBACK (et_drag_begin), e_tree);
- g_signal_connect (
- e_tree->priv->table_canvas, "drag_end",
- G_CALLBACK (et_drag_end), e_tree);
- g_signal_connect (
- e_tree->priv->table_canvas, "drag_data_get",
- G_CALLBACK (et_drag_data_get), e_tree);
- g_signal_connect (
- e_tree->priv->table_canvas, "drag_data_delete",
- G_CALLBACK (et_drag_data_delete), e_tree);
- g_signal_connect (
- e_tree, "drag_motion",
- G_CALLBACK (et_drag_motion), e_tree);
- g_signal_connect (
- e_tree, "drag_leave",
- G_CALLBACK (et_drag_leave), e_tree);
- g_signal_connect (
- e_tree, "drag_drop",
- G_CALLBACK (et_drag_drop), e_tree);
- g_signal_connect (
- e_tree, "drag_data_received",
- G_CALLBACK (et_drag_data_received), e_tree);
-
- g_signal_connect (e_tree->priv->table_canvas, "reflow",
- G_CALLBACK (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),
- e_canvas_background_get_type(),
- "fill_color_gdk", &GTK_WIDGET(e_tree->priv->table_canvas)->style->base[GTK_STATE_NORMAL],
- NULL);
-
- g_signal_connect (e_tree->priv->white_item, "event",
- G_CALLBACK (white_item_event), e_tree);
- g_signal_connect (
- gnome_canvas_root (e_tree->priv->table_canvas), "event",
- G_CALLBACK(et_canvas_root_event), e_tree);
-
- et_build_item(e_tree);
-}
-
-/**
- * e_tree_set_search_column:
- * @e_tree: #ETree object that will be modified
- * @col: Column index to use for searches
- *
- * This routine sets the current search column to be used for keypress
- * searches of the #ETree. If -1 is passed in for column, the current
- * search column is cleared.
- */
-void
-e_tree_set_search_column (ETree *e_tree, gint col)
-{
- if (col == -1) {
- clear_current_search_col (e_tree);
- return;
- }
-
- e_tree->priv->search_col_set = TRUE;
- e_tree->priv->current_search_col = e_table_header_get_column (e_tree->priv->full_header, col);
-}
-
-void
-e_tree_set_state_object(ETree *e_tree, ETableState *state)
-{
- GValue *val = g_new0 (GValue, 1);
- g_value_init (val, G_TYPE_DOUBLE);
-
- connect_header (e_tree, state);
-
- g_value_set_double (val, (double) (GTK_WIDGET(e_tree->priv->table_canvas)->allocation.width));
- g_object_set_property (G_OBJECT (e_tree->priv->header), "width", val);
- g_free (val);
-
- if (e_tree->priv->header_item)
- g_object_set(e_tree->priv->header_item,
- "ETableHeader", e_tree->priv->header,
- "sort_info", e_tree->priv->sort_info,
- NULL);
-
- if (e_tree->priv->item)
- g_object_set(e_tree->priv->item,
- "ETableHeader", e_tree->priv->header,
- NULL);
-
- if (e_tree->priv->etta)
- e_tree_table_adapter_set_sort_info (e_tree->priv->etta, e_tree->priv->sort_info);
-
- e_tree_state_change (e_tree);
-}
-
-/**
- * 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);
-
- g_object_unref(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);
-
- g_object_unref(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)
- g_object_ref(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);
- g_object_unref(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);
- g_object_unref(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_connect_to_etta (ETree *et)
-{
- et->priv->table_model_change_id = g_signal_connect (et->priv->etta, "model_changed",
- G_CALLBACK (et_table_model_changed), et);
-
- et->priv->table_row_change_id = g_signal_connect (et->priv->etta, "model_row_changed",
- G_CALLBACK (et_table_row_changed), et);
-
- et->priv->table_cell_change_id = g_signal_connect (et->priv->etta, "model_cell_changed",
- G_CALLBACK (et_table_cell_changed), et);
-
-}
-
-static ETree *
-et_real_construct (ETree *e_tree, ETreeModel *etm, ETableExtras *ete,
- ETableSpecification *specification, ETableState *state)
-{
- int row = 0;
-
- if (ete)
- g_object_ref(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);
-
- connect_header (e_tree, state);
-
- e_tree->priv->horizontal_scrolling = specification->horizontal_scrolling;
-
- e_tree->priv->model = etm;
- g_object_ref (etm);
-
- e_tree->priv->etta = E_TREE_TABLE_ADAPTER(e_tree_table_adapter_new(e_tree->priv->model, e_tree->priv->sort_info, e_tree->priv->full_header));
-
- et_connect_to_etta (e_tree);
-
- gtk_widget_push_colormap (gdk_rgb_get_cmap ());
-
- e_tree->priv->sorter = e_sorter_new();
-
- g_object_set (e_tree->priv->selection,
- "sorter", e_tree->priv->sorter,
-#ifdef E_TREE_USE_TREE_SELECTION
- "model", e_tree->priv->model,
- "etta", e_tree->priv->etta,
-#else
- "model", e_tree->priv->etta,
-#endif
- "selection_mode", specification->selection_mode,
- "cursor_mode", specification->cursor_mode,
- NULL);
-
- g_signal_connect(e_tree->priv->selection, "selection_changed",
- G_CALLBACK (et_selection_model_selection_changed), e_tree);
- g_signal_connect(e_tree->priv->selection, "selection_row_changed",
- G_CALLBACK (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 ();
-
- g_object_unref(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) {
- g_object_unref(state);
- state = specification->state;
- g_object_ref(state);
- }
- } else {
- state = specification->state;
- g_object_ref(state);
- }
-
- e_tree = et_real_construct (e_tree, etm, ete, specification, state);
-
- e_tree->priv->spec = specification;
- g_object_unref(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)) {
- g_object_unref(specification);
- return NULL;
- }
-
- if (state_fn) {
- state = e_table_state_new();
- if (!e_table_state_load_from_file(state, state_fn)) {
- g_object_unref(state);
- state = specification->state;
- g_object_ref(state);
- }
- if (state->col_count <= 0) {
- g_object_unref(state);
- state = specification->state;
- g_object_ref(state);
- }
- } else {
- state = specification->state;
- g_object_ref(state);
- }
-
- e_tree = et_real_construct (e_tree, etm, ete, specification, state);
-
- e_tree->priv->spec = specification;
- g_object_unref(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 = g_object_new (E_TREE_TYPE, NULL);
-
- ret_val = e_tree_construct (e_tree, etm, ete, spec, state);
-
- if (ret_val == NULL) {
- g_object_unref (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 = g_object_new (E_TREE_TYPE, NULL);
-
- ret_val = e_tree_construct_from_spec_file (e_tree, etm, ete, spec_fn, state_fn);
-
- if (ret_val == NULL) {
- g_object_unref (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
- row = e_tree_table_adapter_row_of_node(E_TREE_TABLE_ADAPTER(e_tree->priv->etta), path);
-
- if (row == -1)
- return;
-
- g_object_set(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);
-
- g_object_get(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);
- 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);
-}
-
-/* Standard functions */
-static void
-et_foreach_recurse (ETreeModel *model,
- ETreePath path,
- ETreeForeachFunc callback,
- gpointer closure)
-{
- ETreePath child;
-
- callback(path, closure);
-
- child = e_tree_model_node_get_first_child(E_TREE_MODEL(model), path);
- for ( ; child; child = e_tree_model_node_get_next(E_TREE_MODEL(model), child))
- if (child)
- et_foreach_recurse (model, child, callback, closure);
-}
-
-void
-e_tree_path_foreach (ETree *e_tree,
- ETreeForeachFunc callback,
- gpointer closure)
-{
- ETreePath root;
-
- g_return_if_fail(e_tree != NULL);
- g_return_if_fail(E_IS_TREE(e_tree));
-
- root = e_tree_model_get_root (e_tree->priv->model);
-
- if (root)
- et_foreach_recurse (e_tree->priv->model,
- root,
- 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_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- ETree *etree = E_TREE (object);
-
- switch (prop_id){
- case PROP_ETTA:
- g_value_set_object (value, etree->priv->etta);
- break;
- case PROP_UNIFORM_ROW_HEIGHT:
- g_value_set_boolean (value, etree->priv->uniform_row_height);
- break;
- case PROP_ALWAYS_SEARCH:
- g_value_set_boolean (value, etree->priv->always_search);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-typedef struct {
- char *arg;
- gboolean setting;
-} bool_closure;
-
-static void
-et_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- ETree *etree = E_TREE (object);
-
- switch (prop_id){
- case PROP_LENGTH_THRESHOLD:
- etree->priv->length_threshold = g_value_get_int (value);
- if (etree->priv->item) {
- gnome_canvas_item_set (GNOME_CANVAS_ITEM(etree->priv->item),
- "length_threshold", etree->priv->length_threshold,
- NULL);
- }
- break;
-
- case PROP_HORIZONTAL_DRAW_GRID:
- etree->priv->horizontal_draw_grid = g_value_get_boolean (value);
- if (etree->priv->item) {
- gnome_canvas_item_set (GNOME_CANVAS_ITEM(etree->priv->item),
- "horizontal_draw_grid", etree->priv->horizontal_draw_grid,
- NULL);
- }
- break;
-
- case PROP_VERTICAL_DRAW_GRID:
- etree->priv->vertical_draw_grid = g_value_get_boolean (value);
- if (etree->priv->item) {
- gnome_canvas_item_set (GNOME_CANVAS_ITEM(etree->priv->item),
- "vertical_draw_grid", etree->priv->vertical_draw_grid,
- NULL);
- }
- break;
-
- case PROP_DRAW_FOCUS:
- etree->priv->draw_focus = g_value_get_boolean (value);
- if (etree->priv->item) {
- gnome_canvas_item_set (GNOME_CANVAS_ITEM(etree->priv->item),
- "drawfocus", etree->priv->draw_focus,
- NULL);
- }
- break;
-
- case PROP_UNIFORM_ROW_HEIGHT:
- etree->priv->uniform_row_height = g_value_get_boolean (value);
- if (etree->priv->item) {
- gnome_canvas_item_set (GNOME_CANVAS_ITEM(etree->priv->item),
- "uniform_row_height", etree->priv->uniform_row_height,
- NULL);
- }
- break;
-
- case PROP_ALWAYS_SEARCH:
- if (etree->priv->always_search == g_value_get_boolean (value))
- return;
- etree->priv->always_search = g_value_get_boolean (value);
- clear_current_search_col (etree);
- 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);
- }
-
- if (tree->priv) {
- 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)
-{
- 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));
-
- 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));
-
- 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);
-
- return path;
-}
-
-int
-e_tree_row_of_node (ETree *et, ETreePath 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));
-
- 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;
-}
-
-static ETreePath
-find_next_in_range (ETree *et, gint start, gint end, ETreePathFunc func, gpointer data)
-{
- ETreePath path;
- gint row;
-
- for (row = start; row <= end; row++) {
- path = e_tree_table_adapter_node_at_row (et->priv->etta, row);
- if (path && func (et->priv->model, path, data))
- return path;
- }
-
- return NULL;
-}
-
-static ETreePath
-find_prev_in_range (ETree *et, gint start, gint end, ETreePathFunc func, gpointer data)
-{
- ETreePath path;
- gint row;
-
- for (row = start; row >= end; row--) {
- path = e_tree_table_adapter_node_at_row (et->priv->etta, row);
- if (path && func (et->priv->model, path, data))
- return path;
- }
-
- return NULL;
-}
-
-gboolean
-e_tree_find_next (ETree *et, ETreeFindNextParams params, ETreePathFunc func, gpointer data)
-{
- ETreePath cursor, found;
- gint row, row_count;
-
- cursor = e_tree_get_cursor (et);
- row = e_tree_table_adapter_row_of_node (et->priv->etta, cursor);
- row_count = e_table_model_row_count (E_TABLE_MODEL (et->priv->etta));
- if (row == -1)
- row = 0;
-
- if (params & E_TREE_FIND_NEXT_FORWARD)
- found = find_next_in_range (et, row + 1, row_count - 1, func, data);
- else
- found = find_prev_in_range (et, row - 1, 0, func, data);
-
- if (found) {
- e_tree_table_adapter_show_node (et->priv->etta, found);
- e_tree_set_cursor (et, found);
- return TRUE;
- }
-
- if (params & E_TREE_FIND_NEXT_WRAP) {
- if (params & E_TREE_FIND_NEXT_FORWARD)
- found = find_next_in_range (et, 0, row, func, data);
- else
- found = find_prev_in_range (et, row_count - 1, row, func, data);
-
- if (found && found != cursor) {
- e_tree_table_adapter_show_node (et->priv->etta, found);
- e_tree_set_cursor (et, found);
- 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;
-}
-
-/**
- * e_tree_get_table_adapter:
- * @et: the ETree
- *
- * Returns the table adapter this ETree uses.
- *
- * Returns: the model
- **/
-ETreeTableAdapter *
-e_tree_get_table_adapter (ETree *et)
-{
- g_return_val_if_fail (et != NULL, NULL);
- g_return_val_if_fail (E_IS_TREE (et), NULL);
-
- return et->priv->etta;
-}
-
-
-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);
-
- gtk_drag_get_data(GTK_WIDGET(tree),
- context,
- target,
- time);
-
-}
-
-/**
- * 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) {
- if (site->target_list)
- gtk_target_list_unref (site->target_list);
- 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);
-
- 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)
-{
- g_signal_emit (et,
- et_signals [TREE_DRAG_BEGIN], 0,
- et->priv->drag_row,
- et->priv->drag_path,
- et->priv->drag_col,
- context);
-}
-
-static void
-et_drag_end (GtkWidget *widget,
- GdkDragContext *context,
- ETree *et)
-{
- g_signal_emit (et,
- et_signals [TREE_DRAG_END], 0,
- 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)
-{
- g_signal_emit (et,
- et_signals [TREE_DRAG_DATA_GET], 0,
- 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)
-{
- g_signal_emit (et,
- et_signals [TREE_DRAG_DATA_DELETE], 0,
- 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);
-
- e_tree_get_cell_at (et,
- x,
- y,
- &row,
- &col);
- if (row != et->priv->drop_row && col != et->priv->drop_col) {
- g_signal_emit (et,
- et_signals [TREE_DRAG_LEAVE], 0,
- 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);
-
- et->priv->drop_row = row;
- et->priv->drop_path = path;
- et->priv->drop_col = col;
- g_signal_emit (et,
- et_signals [TREE_DRAG_MOTION], 0,
- 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;
- int x = et->priv->hover_x;
- int y = et->priv->hover_y;
- int row, col;
- ETreePath path;
-
- 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 (et->priv->model, path)) {
- if (!e_tree_table_adapter_node_is_expanded (et->priv->etta, path)) {
- if (e_tree_model_has_save_id (et->priv->model) && e_tree_model_has_get_node_by_id (et->priv->model))
- et->priv->expanded_list = g_list_prepend (et->priv->expanded_list, e_tree_model_get_save_id (et->priv->model, 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 (et->priv->model, 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 (et->priv->model, save_id);
- if (path) {
- ETreePath search;
- gboolean found = FALSE;
-
- for (search = drop; search; search = e_tree_model_node_get_parent (et->priv->model, 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, GObject *ctx)
-{
- 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);
- }
- g_object_unref (et);
-}
-
-static void
-context_connect (ETree *et, GdkDragContext *context)
-{
- if (context == et->priv->last_drop_context)
- return;
-
- if (et->priv->last_drop_context)
- g_object_weak_unref (G_OBJECT(et->priv->last_drop_context), context_destroyed, et);
- else
- g_object_ref (et);
-
- g_object_weak_ref (G_OBJECT(context), context_destroyed, et);
-}
-
-static void
-et_drag_leave(GtkWidget *widget,
- GdkDragContext *context,
- guint time,
- ETree *et)
-{
- g_signal_emit (et,
- et_signals [TREE_DRAG_LEAVE], 0,
- 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;
- context_connect (et, context);
- et->priv->last_drop_context = 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);
-
- 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;
- e_tree_get_cell_at(et,
- x,
- y,
- &row,
- &col);
- path = e_tree_table_adapter_node_at_row(et->priv->etta, row);
-
- if (row != et->priv->drop_row && col != et->priv->drop_row) {
- g_signal_emit (et,
- et_signals [TREE_DRAG_LEAVE], 0,
- et->priv->drop_row,
- et->priv->drop_path,
- et->priv->drop_col,
- context,
- time);
- g_signal_emit (et,
- et_signals [TREE_DRAG_MOTION], 0,
- row,
- path,
- col,
- context,
- x,
- y,
- time,
- &ret_val);
- }
- et->priv->drop_row = row;
- et->priv->drop_path = path;
- et->priv->drop_col = col;
-
- g_signal_emit (et,
- et_signals [TREE_DRAG_DROP], 0,
- 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, 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;
- e_tree_get_cell_at(et,
- x,
- y,
- &row,
- &col);
- path = e_tree_table_adapter_node_at_row(et->priv->etta, row);
- g_signal_emit (et,
- et_signals [TREE_DRAG_DATA_RECEIVED], 0,
- row,
- path,
- col,
- context,
- x,
- y,
- selection_data,
- info,
- time);
-}
-
-static void
-e_tree_class_init (ETreeClass *class)
-{
- GObjectClass *object_class;
- GtkWidgetClass *widget_class;
- GtkContainerClass *container_class;
-
- object_class = (GObjectClass *) class;
- widget_class = (GtkWidgetClass *) class;
- container_class = (GtkContainerClass *) class;
-
- parent_class = g_type_class_ref (PARENT_TYPE);
-
- object_class->dispose = et_dispose;
- object_class->set_property = et_set_property;
- object_class->get_property = et_get_property;
-
- widget_class->grab_focus = et_grab_focus;
- widget_class->unrealize = et_unrealize;
- widget_class->style_set = et_canvas_style_set;
- widget_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->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] =
- g_signal_new ("cursor_change",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETreeClass, cursor_change),
- NULL, NULL,
- e_marshal_NONE__INT_POINTER,
- G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_POINTER);
-
- et_signals [CURSOR_ACTIVATED] =
- g_signal_new ("cursor_activated",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETreeClass, cursor_activated),
- NULL, NULL,
- e_marshal_NONE__INT_POINTER,
- G_TYPE_NONE, 2, G_TYPE_INT, G_TYPE_POINTER);
-
- et_signals [SELECTION_CHANGE] =
- g_signal_new ("selection_change",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETreeClass, selection_change),
- NULL, NULL,
- e_marshal_NONE__NONE,
- G_TYPE_NONE, 0);
-
- et_signals [DOUBLE_CLICK] =
- g_signal_new ("double_click",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETreeClass, double_click),
- NULL, NULL,
- e_marshal_NONE__INT_POINTER_INT_BOXED,
- G_TYPE_NONE, 4, G_TYPE_INT,
- G_TYPE_POINTER, G_TYPE_INT, GDK_TYPE_EVENT);
-
- et_signals [RIGHT_CLICK] =
- g_signal_new ("right_click",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETreeClass, right_click),
- NULL, NULL,
- e_marshal_INT__INT_POINTER_INT_BOXED,
- G_TYPE_INT, 4, G_TYPE_INT, G_TYPE_POINTER,
- G_TYPE_INT, GDK_TYPE_EVENT);
-
- et_signals [CLICK] =
- g_signal_new ("click",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETreeClass, click),
- NULL, NULL,
- e_marshal_INT__INT_POINTER_INT_BOXED,
- G_TYPE_INT, 4, G_TYPE_INT, G_TYPE_POINTER,
- G_TYPE_INT, GDK_TYPE_EVENT);
-
- et_signals [KEY_PRESS] =
- g_signal_new ("key_press",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETreeClass, key_press),
- NULL, NULL,
- e_marshal_INT__INT_POINTER_INT_BOXED,
- G_TYPE_INT, 4, G_TYPE_INT, G_TYPE_POINTER,
- G_TYPE_INT, GDK_TYPE_EVENT);
-
- et_signals [START_DRAG] =
- g_signal_new ("start_drag",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETreeClass, start_drag),
- NULL, NULL,
- e_marshal_NONE__INT_POINTER_INT_BOXED,
- G_TYPE_NONE, 4, G_TYPE_INT, G_TYPE_POINTER,
- G_TYPE_INT, GDK_TYPE_EVENT);
-
- et_signals [STATE_CHANGE] =
- g_signal_new ("state_change",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETreeClass, state_change),
- NULL, NULL,
- e_marshal_NONE__NONE,
- G_TYPE_NONE, 0);
-
- et_signals [WHITE_SPACE_EVENT] =
- g_signal_new ("white_space_event",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETreeClass, white_space_event),
- NULL, NULL,
- e_marshal_INT__POINTER,
- G_TYPE_INT, 1, GDK_TYPE_EVENT);
-
- et_signals[TREE_DRAG_BEGIN] =
- g_signal_new ("tree_drag_begin",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETreeClass, tree_drag_begin),
- NULL, NULL,
- e_marshal_NONE__INT_POINTER_INT_BOXED,
- G_TYPE_NONE, 4,
- G_TYPE_INT,
- G_TYPE_POINTER,
- G_TYPE_INT,
- GDK_TYPE_DRAG_CONTEXT);
- et_signals[TREE_DRAG_END] =
- g_signal_new ("tree_drag_end",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETreeClass, tree_drag_end),
- NULL, NULL,
- e_marshal_NONE__INT_POINTER_INT_BOXED,
- G_TYPE_NONE, 4,
- G_TYPE_INT,
- G_TYPE_POINTER,
- G_TYPE_INT,
- GDK_TYPE_DRAG_CONTEXT);
- et_signals[TREE_DRAG_DATA_GET] =
- g_signal_new ("tree_drag_data_get",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETreeClass, tree_drag_data_get),
- NULL, NULL,
- e_marshal_NONE__INT_POINTER_INT_OBJECT_BOXED_UINT_UINT,
- G_TYPE_NONE, 7,
- G_TYPE_INT,
- G_TYPE_POINTER,
- G_TYPE_INT,
- GDK_TYPE_DRAG_CONTEXT,
- GTK_TYPE_SELECTION_DATA | G_SIGNAL_TYPE_STATIC_SCOPE,
- G_TYPE_UINT,
- G_TYPE_UINT);
- et_signals[TREE_DRAG_DATA_DELETE] =
- g_signal_new ("tree_drag_data_delete",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETreeClass, tree_drag_data_delete),
- NULL, NULL,
- e_marshal_NONE__INT_POINTER_INT_OBJECT,
- G_TYPE_NONE, 4,
- G_TYPE_INT,
- G_TYPE_POINTER,
- G_TYPE_INT,
- GDK_TYPE_DRAG_CONTEXT);
-
- et_signals[TREE_DRAG_LEAVE] =
- g_signal_new ("tree_drag_leave",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETreeClass, tree_drag_leave),
- NULL, NULL,
- e_marshal_NONE__INT_POINTER_INT_OBJECT_UINT,
- G_TYPE_NONE, 5,
- G_TYPE_INT,
- G_TYPE_POINTER,
- G_TYPE_INT,
- GDK_TYPE_DRAG_CONTEXT,
- G_TYPE_UINT);
- et_signals[TREE_DRAG_MOTION] =
- g_signal_new ("tree_drag_motion",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETreeClass, tree_drag_motion),
- NULL, NULL,
- e_marshal_BOOLEAN__INT_POINTER_INT_OBJECT_INT_INT_UINT,
- G_TYPE_BOOLEAN, 7,
- G_TYPE_INT,
- G_TYPE_POINTER,
- G_TYPE_INT,
- GDK_TYPE_DRAG_CONTEXT,
- G_TYPE_INT,
- G_TYPE_INT,
- G_TYPE_UINT);
- et_signals[TREE_DRAG_DROP] =
- g_signal_new ("tree_drag_drop",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETreeClass, tree_drag_drop),
- NULL, NULL,
- e_marshal_BOOLEAN__INT_POINTER_INT_OBJECT_INT_INT_UINT,
- G_TYPE_BOOLEAN, 7,
- G_TYPE_INT,
- G_TYPE_POINTER,
- G_TYPE_INT,
- GDK_TYPE_DRAG_CONTEXT,
- G_TYPE_INT,
- G_TYPE_INT,
- G_TYPE_UINT);
- et_signals[TREE_DRAG_DATA_RECEIVED] =
- g_signal_new ("tree_drag_data_received",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETreeClass, tree_drag_data_received),
- NULL, NULL,
- e_marshal_NONE__INT_POINTER_INT_OBJECT_INT_INT_BOXED_UINT_UINT,
- G_TYPE_NONE, 9,
- G_TYPE_INT,
- G_TYPE_POINTER,
- G_TYPE_INT,
- GDK_TYPE_DRAG_CONTEXT,
- G_TYPE_INT,
- G_TYPE_INT,
- GTK_TYPE_SELECTION_DATA,
- G_TYPE_UINT,
- G_TYPE_UINT);
-
- class->set_scroll_adjustments = set_scroll_adjustments;
-
- widget_class->set_scroll_adjustments_signal =
- g_signal_new ("set_scroll_adjustments",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETreeClass, set_scroll_adjustments),
- NULL, NULL,
- e_marshal_NONE__POINTER_POINTER,
- G_TYPE_NONE, 2, GTK_TYPE_ADJUSTMENT,
- GTK_TYPE_ADJUSTMENT);
-
- g_object_class_install_property (object_class, PROP_LENGTH_THRESHOLD,
- g_param_spec_int ("length_threshold",
- _( "Length Threshold" ),
- _( "Length Threshold" ),
- 0, G_MAXINT, 0,
- G_PARAM_WRITABLE));
- g_object_class_install_property (object_class, PROP_HORIZONTAL_DRAW_GRID,
- g_param_spec_boolean ("horizontal_draw_grid",
- _( "Horizontal Draw Grid" ),
- _( "Horizontal Draw Grid" ),
- FALSE,
- G_PARAM_WRITABLE));
- g_object_class_install_property (object_class, PROP_VERTICAL_DRAW_GRID,
- g_param_spec_boolean ("vertical_draw_grid",
- _( "Vertical Draw Grid" ),
- _( "Vertical Draw Grid" ),
- FALSE,
- G_PARAM_WRITABLE));
- g_object_class_install_property (object_class, PROP_DRAW_FOCUS,
- g_param_spec_boolean ("drawfocus",
- _( "Draw focus" ),
- _( "Draw focus" ),
- FALSE,
- G_PARAM_WRITABLE));
-
- g_object_class_install_property (object_class, PROP_ETTA,
- g_param_spec_object ("ETreeTableAdapter",
- _( "ETree table adapter" ),
- _( "ETree table adapter" ),
- E_TREE_TABLE_ADAPTER_TYPE,
- G_PARAM_READABLE));
-
- g_object_class_install_property (object_class, PROP_UNIFORM_ROW_HEIGHT,
- g_param_spec_boolean ("uniform_row_height",
- _( "Uniform row height" ),
- _( "Uniform row height" ),
- FALSE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_ALWAYS_SEARCH,
- g_param_spec_boolean ("always_search",
- _( "Always search" ),
- _( "Always search" ),
- FALSE,
- G_PARAM_READWRITE));
-
- gtk_widget_class_install_style_property (widget_class,
- g_param_spec_boolean ("retro_look",
- _("Retro Look"),
- _("Draw lines and +/- expanders."),
- FALSE,
- G_PARAM_READABLE));
-
- gtk_widget_class_install_style_property (widget_class,
- g_param_spec_int ("expander_size",
- _("Expander Size"),
- _("Size of the expander arrow"),
- 0,
- G_MAXINT,
- 10,
- G_PARAM_READABLE));
-
-}
-
-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 21a755fb3a..0000000000
--- a/widgets/table/e-tree.h
+++ /dev/null
@@ -1,310 +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/gtkdnd.h>
-#include <gtk/gtktable.h>
-#include <libxml/tree.h>
-#include <libgnomecanvas/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 <gal/e-table/e-tree-table-adapter.h>
-
-#define E_TREE_USE_TREE_SELECTION
-
-#ifdef E_TREE_USE_TREE_SELECTION
-#include <gal/e-table/e-tree-selection-model.h>
-#endif
-
-G_BEGIN_DECLS
-
-#define E_TREE_TYPE (e_tree_get_type ())
-#define E_TREE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TREE_TYPE, ETree))
-#define E_TREE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TREE_TYPE, ETreeClass))
-#define E_IS_TREE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TREE_TYPE))
-#define E_IS_TREE_CLASS(k) (G_TYPE_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);
- gint (*white_space_event) (ETree *et, GdkEvent *event);
-
- 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;
-
-GType 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_search_column (ETree *e_tree,
- gint col);
-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);
-void e_tree_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);
-ETreeTableAdapter *e_tree_get_table_adapter (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);
-
-
-G_END_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 fe211e9d21..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 7fe4c126e6..0000000000
--- a/widgets/table/test-check.c
+++ /dev/null
@@ -1,221 +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_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 ();
-
- g_signal_connect (canvas, "size_allocate",
- G_CALLBACK (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 e4873633e5..0000000000
--- a/widgets/table/test-cols.c
+++ /dev/null
@@ -1,265 +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_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 ();
-
- g_signal_connect (canvas, "size_allocate",
- G_CALLBACK (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 b44b62bf42..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 ();
-
- g_signal_connect (canvas, "size_allocate",
- G_CALLBACK (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;
-
- g_object_get (etable, "drawgrid", &shown, NULL);
- g_object_set (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. */
- g_object_set (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
- g_signal_connect (e_table, "row_selection",
- G_CALLBACK(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");
- g_signal_connect (button, "clicked",
- G_CALLBACK (save_spec), e_table);
- gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
-
- bhide = gtk_button_new_with_label ("Toggle Grid");
- g_signal_connect (bhide, "clicked",
- G_CALLBACk (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-callbacks.c b/widgets/text/e-completion-callbacks.c
deleted file mode 100644
index bccc400fab..0000000000
--- a/widgets/text/e-completion-callbacks.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-completion-callbacks.c - A callback based ECompletion.
- * Copyright 2003
- *
- * Authors:
- * 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 <string.h>
-#include <stdio.h>
-#include <gtk/gtk.h>
-#include "gal/util/e-util.h"
-#include "e-completion-callbacks.h"
-
-static void e_completion_callbacks_class_init (ECompletionCallbacksClass *klass);
-static void e_completion_callbacks_init (ECompletionCallbacks *complete);
-
-static void callbacks_request_completion (ECompletion *comp, const gchar *search_text, gint pos, gint limit);
-static void callbacks_end_completion (ECompletion *comp);
-
-#define PARENT_TYPE E_COMPLETION_TYPE
-static ECompletionClass *parent_class;
-
-
-
-E_MAKE_TYPE (e_completion_callbacks,
- "ECompletionCallbacks",
- ECompletionCallbacks,
- e_completion_callbacks_class_init,
- e_completion_callbacks_init,
- PARENT_TYPE)
-
-static void
-e_completion_callbacks_class_init (ECompletionCallbacksClass *klass)
-{
- ECompletionClass *comp_class = (ECompletionClass *) klass;
-
- parent_class = g_type_class_ref (PARENT_TYPE);
-
- comp_class->request_completion = callbacks_request_completion;
- comp_class->end_completion = callbacks_end_completion;
-}
-
-static void
-e_completion_callbacks_init (ECompletionCallbacks *complete)
-{
-}
-
-static void
-callbacks_request_completion (ECompletion *comp, const gchar *search_text, gint pos, gint limit)
-{
- ECompletionCallbacks *cc = E_COMPLETION_CALLBACKS (comp);
-
- cc->request_completion (cc, search_text, pos, limit, cc->data);
-}
-
-static void
-callbacks_end_completion (ECompletion *comp)
-{
- ECompletionCallbacks *cc = E_COMPLETION_CALLBACKS (comp);
-
- cc->end_completion (cc, cc->data);
-}
-
-ECompletionCallbacks*
-e_completion_callbacks_new (ECompletionCallbacksRequestCompletionFn request_completion,
- ECompletionCallbacksEndCompletionFn end_completion,
- gpointer data)
-{
- ECompletionCallbacks *cc;
-
- g_return_val_if_fail (request_completion != NULL, NULL);
- g_return_val_if_fail (end_completion != NULL, NULL);
-
- cc = gtk_type_new (E_COMPLETION_CALLBACKS_TYPE);
-
- cc->request_completion = request_completion;
- cc->end_completion = end_completion;
- cc->data = data;
-
- return cc;
-}
diff --git a/widgets/text/e-completion-callbacks.h b/widgets/text/e-completion-callbacks.h
deleted file mode 100644
index 2661c16022..0000000000
--- a/widgets/text/e-completion-callbacks.h
+++ /dev/null
@@ -1,68 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-completion-callback.h - A callback based completion object.
- * Copyright 2003, Ximian, Inc.
- *
- * Authors:
- * 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_COMPLETION_CALLBACKS_H
-#define E_COMPLETION_CALLBACKS_H
-
-#include <gtk/gtkobject.h>
-#include "e-completion.h"
-
-G_BEGIN_DECLS
-
-#define E_COMPLETION_CALLBACKS_TYPE (e_completion_callbacks_get_type ())
-#define E_COMPLETION_CALLBACKS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_COMPLETION_CALLBACKS_TYPE, ECompletionCallbacks))
-#define E_COMPLETION_CALLBACKS_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), E_COMPLETION_CALLBACKS_TYPE, ECompletionCallbacksClass))
-#define E_IS_COMPLETION_CALLBACKS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_COMPLETION_CALLBACKS_TYPE))
-#define E_IS_COMPLETION_CALLBACKS_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_COMPLETION_CALLBACKS_TYPE))
-
-typedef struct _ECompletionCallbacks ECompletionCallbacks;
-typedef struct _ECompletionCallbacksClass ECompletionCallbacksClass;
-struct _ECompletionCallbacksPrivate;
-
-typedef void (*ECompletionCallbacksRequestCompletionFn) (ECompletionCallbacks *comp, const gchar *search_text, gint pos, gint limit, gpointer data);
-typedef void (*ECompletionCallbacksEndCompletionFn) (ECompletionCallbacks *comp, gpointer data);
-
-struct _ECompletionCallbacks {
- ECompletion parent;
-
- ECompletionCallbacksRequestCompletionFn request_completion;
- ECompletionCallbacksEndCompletionFn end_completion;
-
- gpointer data;
-};
-
-struct _ECompletionCallbacksClass {
- ECompletionClass parent_class;
-};
-
-GtkType e_completion_callbacks_get_type (void);
-
-ECompletionCallbacks* e_completion_callbacks_new (ECompletionCallbacksRequestCompletionFn request_completion,
- ECompletionCallbacksEndCompletionFn end_completion,
- gpointer data);
-
-G_END_DECLS
-
-
-#endif /* E_COMPLETION_CALLBACKS_H */
-
diff --git a/widgets/text/e-completion-match.c b/widgets/text/e-completion-match.c
deleted file mode 100644
index d13ba15973..0000000000
--- a/widgets/text/e-completion-match.c
+++ /dev/null
@@ -1,184 +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/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->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 162373add4..0000000000
--- a/widgets/text/e-completion-match.h
+++ /dev/null
@@ -1,67 +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 <gtk/gtkwidget.h>
-
-G_BEGIN_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;
- 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);
-
-
-
-
-G_END_DECLS
-
-#endif /* __E_COMPLETION_MATCH_H__ */
-
diff --git a/widgets/text/e-completion-view.c b/widgets/text/e-completion-view.c
deleted file mode 100644
index f9728de60c..0000000000
--- a/widgets/text/e-completion-view.c
+++ /dev/null
@@ -1,859 +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 "e-completion-view.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 <gal/util/e-i18n.h>
-#include "gal/util/e-marshal.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_dispose (GObject *object);
-
-#define PARENT_TYPE GTK_TYPE_EVENT_BOX
-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);
-
- }
-
-}
-
-#if 0
-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);
- }
-}
-#endif
-
-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_send_expose (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;
- }
-
- requisition->height = MAX (100, 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);
- }
-}
-
-E_MAKE_TYPE (e_completion_view,
- "ECompletionView",
- ECompletionView,
- e_completion_view_class_init,
- e_completion_view_init,
- PARENT_TYPE)
-
-static void
-e_completion_view_class_init (ECompletionViewClass *klass)
-{
- GObjectClass *object_class = (GObjectClass *) klass;
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
-
- parent_class = g_type_class_ref (PARENT_TYPE);
-
- e_completion_view_signals[E_COMPLETION_VIEW_NONEMPTY] =
- g_signal_new ("nonempty",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ECompletionViewClass, nonempty),
- NULL, NULL,
- e_marshal_NONE__NONE,
- G_TYPE_NONE, 0);
-
- e_completion_view_signals[E_COMPLETION_VIEW_ADDED] =
- g_signal_new ("added",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ECompletionViewClass, added),
- NULL, NULL,
- e_marshal_NONE__NONE,
- G_TYPE_NONE, 0);
-
- e_completion_view_signals[E_COMPLETION_VIEW_FULL] =
- g_signal_new ("full",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ECompletionViewClass, full),
- NULL, NULL,
- e_marshal_NONE__NONE,
- G_TYPE_NONE, 0);
-
- e_completion_view_signals[E_COMPLETION_VIEW_BROWSE] =
- g_signal_new ("browse",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ECompletionViewClass, browse),
- NULL, NULL,
- e_marshal_NONE__POINTER,
- G_TYPE_NONE, 1,
- G_TYPE_POINTER);
-
- e_completion_view_signals[E_COMPLETION_VIEW_UNBROWSE] =
- g_signal_new ("unbrowse",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ECompletionViewClass, unbrowse),
- NULL, NULL,
- e_marshal_NONE__NONE,
- G_TYPE_NONE, 0);
-
- e_completion_view_signals[E_COMPLETION_VIEW_ACTIVATE] =
- g_signal_new ("activate",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ECompletionViewClass, activate),
- NULL, NULL,
- e_marshal_NONE__POINTER,
- G_TYPE_NONE, 1,
- G_TYPE_POINTER);
-
- object_class->dispose = e_completion_view_dispose;
-
- widget_class->key_press_event = e_completion_view_local_key_press_handler;
- 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_dispose (GObject *object)
-{
- ECompletionView *cv = E_COMPLETION_VIEW (object);
-
- e_completion_view_disconnect (cv);
-
- if (cv->choices) {
- e_completion_view_clear_choices (cv);
-
- g_ptr_array_free (cv->choices, TRUE);
- cv->choices = NULL;
- }
-
- if (cv->key_widget) {
- g_signal_handler_disconnect (cv->key_widget, cv->key_signal_id);
- g_object_unref (cv->key_widget);
- cv->key_widget = NULL;
- }
-
- if (cv->completion)
- g_object_unref (cv->completion);
- cv->completion = NULL;
-
- if (G_OBJECT_CLASS (parent_class)->dispose)
- (G_OBJECT_CLASS (parent_class)->dispose) (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)
- g_signal_handler_disconnect (cv->completion, cv->begin_signal_id);
- if (cv->comp_signal_id)
- g_signal_handler_disconnect (cv->completion, cv->comp_signal_id);
- if (cv->end_signal_id)
- g_signal_handler_disconnect (cv->completion, cv->end_signal_id);
-
- cv->begin_signal_id = 0;
- cv->comp_signal_id = 0;
- cv->end_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 = gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (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);
- g_signal_emit (cv, e_completion_view_signals[E_COMPLETION_VIEW_ACTIVATE], 0, 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) {
- g_signal_emit (cv, e_completion_view_signals[E_COMPLETION_VIEW_BROWSE], 0, NULL);
- goto stop_emission;
- }
-
- /* Stop our completion. */
- if (uncomplete_key && cv->editable && cv->selection < 0) {
- e_completion_view_set_cursor_row (cv, -1);
- g_signal_emit (cv, e_completion_view_signals[E_COMPLETION_VIEW_UNBROWSE], 0);
- 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)
- g_signal_emit (cv, e_completion_view_signals[E_COMPLETION_VIEW_BROWSE], 0,
- g_ptr_array_index (cv->choices, cv->selection));
- else
- g_signal_emit (cv, e_completion_view_signals[E_COMPLETION_VIEW_UNBROWSE], 0);
-
- stop_emission:
-
- if (key_handled)
- g_signal_stop_emission_by_name (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_table_model_pre_change (cv->model);
- e_completion_view_clear_choices (cv);
- cv->have_all_choices = FALSE;
-
- e_table_model_changed (cv->model);
-}
-
-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_table_model_pre_change (cv->model);
-
- e_completion_match_ref (match);
- g_ptr_array_add (cv->choices, match);
-
- e_table_model_row_inserted (cv->model, r);
-
- if (first)
- g_signal_emit (cv, e_completion_view_signals[E_COMPLETION_VIEW_NONEMPTY], 0);
-
- g_signal_emit (cv, e_completion_view_signals[E_COMPLETION_VIEW_ADDED], 0);
-}
-
-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_pre_change (cv->model);
- e_table_model_changed (cv->model);
-
- cv->have_all_choices = TRUE;
- g_signal_emit (cv, e_completion_view_signals[E_COMPLETION_VIEW_FULL], 0);
-}
-
-/*** Table Callbacks ***/
-
-/* XXX toshok - we need to add sorting to this etable, through the use
- of undisplayed fields of all the sort keys we want to use */
-static char *simple_spec =
-"<ETableSpecification no-headers=\"true\" draw-grid=\"false\" cursor-mode=\"line\" alternating-row-colors=\"false\" gettext-domain=\"" E_I18N_DOMAIN "\">"
-" <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;
- g_object_ref (completion);
-
- cv->begin_signal_id = g_signal_connect (completion,
- "completion_started",
- G_CALLBACK (begin_completion_cb),
- cv);
- cv->comp_signal_id = g_signal_connect (completion,
- "completion_found",
- G_CALLBACK (completion_cb),
- cv);
- cv->end_signal_id = g_signal_connect (completion,
- "completion_finished",
- G_CALLBACK (end_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);
- g_object_unref (cv->model);
-
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (cv->table), GTK_SHADOW_NONE);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (cv->table), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
-
- gtk_container_add (GTK_CONTAINER (cv), cv->table);
- gtk_widget_show_all (cv->table);
-
- g_signal_connect (e_completion_view_table (cv),
- "click",
- G_CALLBACK (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 = g_object_new (E_COMPLETION_VIEW_TYPE, NULL);
-
- 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) {
- g_signal_handler_disconnect (cv->key_widget, cv->key_signal_id);
- g_object_unref (cv->key_widget);
- }
-
- if (w) {
- cv->key_widget = w;
- g_object_ref (w);
-
- cv->key_signal_id = g_signal_connect (w,
- "key_press_event",
- G_CALLBACK (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 25b2eff645..0000000000
--- a/widgets/text/e-completion-view.h
+++ /dev/null
@@ -1,98 +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 <gtk/gtk.h>
-#include <gal/e-table/e-table.h>
-#include "e-completion.h"
-
-G_BEGIN_DECLS
-
-#define E_COMPLETION_VIEW_TYPE (e_completion_view_get_type ())
-#define E_COMPLETION_VIEW(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_COMPLETION_VIEW_TYPE, ECompletionView))
-#define E_COMPLETION_VIEW_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), E_COMPLETION_VIEW_TYPE, ECompletionViewClass))
-#define E_IS_COMPLETION_VIEW(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_COMPLETION_VIEW_TYPE))
-#define E_IS_COMPLETION_VIEW_CLASS(k) (G_TYPE_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 end_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);
-
-G_END_DECLS
-
-
-#endif /* E_COMPLETION_H */
diff --git a/widgets/text/e-completion.c b/widgets/text/e-completion.c
deleted file mode 100644
index b243d4db35..0000000000
--- a/widgets/text/e-completion.c
+++ /dev/null
@@ -1,339 +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"
-#include "gal/util/e-marshal.h"
-
-enum {
- COMPLETION_STARTED,
- COMPLETION_FOUND,
- COMPLETION_CANCELED,
- COMPLETION_FINISHED,
- LAST_SIGNAL
-};
-
-static guint e_completion_signals[LAST_SIGNAL] = { 0 };
-
-struct _ECompletionPrivate {
- gboolean searching;
- gboolean done_search;
- gchar *search_text;
- GPtrArray *matches;
- gint pos;
- gint limit;
- double min_score, max_score;
-};
-
-static void e_completion_class_init (ECompletionClass *klass);
-static void e_completion_init (ECompletion *complete);
-static void e_completion_dispose (GObject *object);
-
-static void e_completion_add_match (ECompletion *complete, ECompletionMatch *);
-static void e_completion_clear_matches (ECompletion *complete);
-static gboolean e_completion_sort (ECompletion *complete);
-
-#define PARENT_TYPE GTK_TYPE_OBJECT
-static GtkObjectClass *parent_class;
-
-
-
-E_MAKE_TYPE (e_completion,
- "ECompletion",
- ECompletion,
- e_completion_class_init,
- e_completion_init,
- PARENT_TYPE)
-
-static void
-e_completion_class_init (ECompletionClass *klass)
-{
- GObjectClass *object_class = (GObjectClass *) klass;
-
- parent_class = g_type_class_ref (PARENT_TYPE);
-
- e_completion_signals[COMPLETION_STARTED] =
- g_signal_new ("completion_started",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ECompletionClass, completion_started),
- NULL, NULL,
- e_marshal_NONE__POINTER_INT_INT,
- G_TYPE_NONE, 3,
- G_TYPE_POINTER, G_TYPE_INT, G_TYPE_INT);
-
- e_completion_signals[COMPLETION_FOUND] =
- g_signal_new ("completion_found",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ECompletionClass, completion_found),
- NULL, NULL,
- e_marshal_NONE__POINTER,
- G_TYPE_NONE, 1,
- G_TYPE_POINTER);
-
- e_completion_signals[COMPLETION_FINISHED] =
- g_signal_new ("completion_finished",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ECompletionClass, completion_finished),
- NULL, NULL,
- e_marshal_NONE__NONE,
- G_TYPE_NONE, 0);
-
- object_class->dispose = e_completion_dispose;
-}
-
-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_dispose (GObject *object)
-{
- ECompletion *complete = E_COMPLETION (object);
-
- if (complete->priv) {
- g_free (complete->priv->search_text);
- complete->priv->search_text = NULL;
-
- e_completion_clear_matches (complete);
-
- g_ptr_array_free (complete->priv->matches, TRUE);
- complete->priv->matches = NULL;
-
- g_free (complete->priv);
- complete->priv = NULL;
- }
-
- if (G_OBJECT_CLASS (parent_class)->dispose)
- (G_OBJECT_CLASS (parent_class)->dispose) (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_begin_search (ECompletion *complete, const gchar *text, gint pos, gint limit)
-{
- ECompletionClass *klass;
-
- 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_GET_CLASS (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;
-
- g_signal_emit (complete, e_completion_signals[COMPLETION_STARTED], 0, text, pos, limit);
- if (klass->request_completion)
- klass->request_completion (complete, text, pos, limit);
-}
-
-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;
-}
-
-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->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);
- fn (match, closure);
- }
-}
-
-ECompletion *
-e_completion_new (void)
-{
- return E_COMPLETION (g_object_new (E_COMPLETION_TYPE, NULL));
-}
-
-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;
-}
-
-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);
-
- g_signal_emit (complete, e_completion_signals[COMPLETION_FOUND], 0, match);
-}
-
-void
-e_completion_end_search (ECompletion *comp)
-{
- g_return_if_fail (comp != NULL);
- g_return_if_fail (E_IS_COMPLETION (comp));
- g_return_if_fail (comp->priv->searching);
-
- if (E_COMPLETION_CLASS (GTK_OBJECT_GET_CLASS (comp))->end_completion) {
- E_COMPLETION_CLASS (GTK_OBJECT_GET_CLASS (comp))->end_completion (comp);
- }
- g_signal_emit (comp, e_completion_signals[COMPLETION_FINISHED], 0);
-
- comp->priv->searching = FALSE;
- comp->priv->done_search = TRUE;
-}
-
diff --git a/widgets/text/e-completion.h b/widgets/text/e-completion.h
deleted file mode 100644
index 74976e579c..0000000000
--- a/widgets/text/e-completion.h
+++ /dev/null
@@ -1,91 +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 <gtk/gtkobject.h>
-#include "e-completion-match.h"
-
-G_BEGIN_DECLS
-
-#define E_COMPLETION_TYPE (e_completion_get_type ())
-#define E_COMPLETION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_COMPLETION_TYPE, ECompletion))
-#define E_COMPLETION_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), E_COMPLETION_TYPE, ECompletionClass))
-#define E_IS_COMPLETION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_COMPLETION_TYPE))
-#define E_IS_COMPLETION_CLASS(k) (G_TYPE_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 */
- void (*request_completion) (ECompletion *comp, const gchar *search_text, gint pos, gint limit);
- void (*end_completion) (ECompletion *comp);
-
- /* Signals */
- void (*completion_started) (ECompletion *comp, const gchar *search_text, gint pos, gint limit);
-
- void (*completion_found) (ECompletion *comp, ECompletionMatch *match);
-
- void (*completion_finished) (ECompletion *comp);
-};
-
-GtkType e_completion_get_type (void);
-
-void e_completion_begin_search (ECompletion *comp, const gchar *text, gint pos, gint limit);
-
-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_end_search (ECompletion *comp);
-
-G_END_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 d30ba20a9f..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"
-#include <gal/util/e-i18n.h>
-
-static void destroy_callback(gpointer data, GObject *where_object_was)
-{
- 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();
- g_object_set(entry,
- "editable", TRUE,
- "use_ellipsis", TRUE,
- NULL);
- gnome_app_set_contents( GNOME_APP( app ), entry );
-
- /* Connect the signals */
- g_object_weak_ref (G_OBJECT (app),
- destroy_callback, 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 085a3a1a52..0000000000
--- a/widgets/text/e-entry.c
+++ /dev/null
@@ -1,1399 +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>
-#include <stdio.h>
-#include <gdk/gdkkeysyms.h>
-#include <gtk/gtksignal.h>
-#include <gtk/gtktypebuiltins.h>
-#include <libxml/parser.h>
-#include <libgnomecanvas/gnome-canvas.h>
-#include "gal/util/e-util.h"
-#include "gal/util/e-i18n.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 MIN_ENTRY_WIDTH 150
-#define INNER_BORDER 2
-
-#define d(x)
-
-#define PARENT_TYPE gtk_table_get_type ()
-
-static GtkObjectClass *parent_class;
-
-enum {
- E_ENTRY_CHANGED,
- E_ENTRY_ACTIVATE,
- E_ENTRY_POPULATE_POPUP,
- E_ENTRY_COMPLETION_POPUP,
- E_ENTRY_LAST_SIGNAL
-};
-
-static guint e_entry_signals[E_ENTRY_LAST_SIGNAL] = { 0 };
-
-/* Object argument IDs */
-enum {
- PROP_0,
- PROP_MODEL,
- PROP_EVENT_PROCESSOR,
- PROP_TEXT,
- PROP_FONT,
- PROP_FONTSET,
- PROP_FONT_GDK,
- PROP_ANCHOR,
- PROP_JUSTIFICATION,
- PROP_X_OFFSET,
- PROP_Y_OFFSET,
- PROP_FILL_COLOR,
- PROP_FILL_COLOR_GDK,
- PROP_FILL_COLOR_RGBA,
- PROP_FILL_STIPPLE,
- PROP_EDITABLE,
- PROP_USE_ELLIPSIS,
- PROP_ELLIPSIS,
- PROP_LINE_WRAP,
- PROP_BREAK_CHARACTERS,
- PROP_MAX_LINES,
- PROP_ALLOW_NEWLINES,
- PROP_DRAW_BORDERS,
- PROP_DRAW_BACKGROUND,
- PROP_DRAW_BUTTON,
- PROP_EMULATE_LABEL_RESIZE,
- PROP_CURSOR_POS
-};
-
-typedef struct _EEntryPrivate EEntryPrivate;
-struct _EEntryPrivate {
- GtkJustification justification;
-
- guint changed_proxy_tag;
- guint activate_proxy_tag;
- guint populate_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);
- g_object_set (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
-get_borders (EEntry *entry,
- gint *xborder,
- gint *yborder)
-{
- GtkWidget *widget = GTK_WIDGET (entry);
- gint focus_width;
- gboolean interior_focus;
-
- gtk_widget_style_get (widget,
- "interior-focus", &interior_focus,
- "focus-line-width", &focus_width,
- NULL);
-
- *xborder = widget->style->xthickness;
- *yborder = widget->style->ythickness;
-
- if (!interior_focus)
- {
- *xborder += focus_width;
- *yborder += focus_width;
- }
-}
-
-static void
-canvas_size_request (GtkWidget *widget, GtkRequisition *requisition,
- EEntry *entry)
-{
- int xthick, ythick;
- PangoContext *context;
- PangoFontMetrics *metrics;
-
- 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) {
- get_borders (entry, &xthick, &ythick);
- } else {
- xthick = ythick = 0;
- }
-
- if (entry->priv->emulate_label_resize) {
- gdouble width;
- g_object_get (entry->item,
- "text_width", &width,
- NULL);
- requisition->width = 2 + 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));
-
- context = gtk_widget_get_pango_context (widget);
- metrics = pango_context_get_metrics (context, gtk_widget_get_style (widget)->font_desc,
- pango_context_get_language (context));
-
- requisition->height = (2 +
- PANGO_PIXELS (pango_font_metrics_get_ascent (metrics) +
- pango_font_metrics_get_descent (metrics)) +
- 2 * ythick);
-
- pango_font_metrics_unref (metrics);
-}
-
-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
-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);
-
- g_signal_emit (entry, e_entry_signals [E_ENTRY_CHANGED], 0);
-}
-
-static void
-proxy_activate (EText *text, EEntry *entry)
-{
- g_signal_emit (entry, e_entry_signals [E_ENTRY_ACTIVATE], 0);
-}
-
-static void
-proxy_populate_popup (EText *text, GdkEventButton *ev, gint pos, GtkWidget *menu, EEntry *entry)
-{
- g_signal_emit (entry, e_entry_signals [E_ENTRY_POPULATE_POPUP], 0, ev, pos, menu);
-}
-
-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 ());
-
- g_signal_connect (entry->canvas,
- "size_allocate",
- G_CALLBACK (canvas_size_allocate),
- entry);
-
- g_signal_connect (entry->canvas,
- "size_request",
- G_CALLBACK (canvas_size_request),
- entry);
-
- g_signal_connect (entry->canvas,
- "focus_in_event",
- G_CALLBACK(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,
- "im_context", E_CANVAS (entry->canvas)->im_context,
- "handle_popup", TRUE,
- NULL));
-
- g_signal_connect (entry->item,
- "keypress",
- G_CALLBACK (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 = g_signal_connect (entry->item,
- "changed",
- G_CALLBACK (proxy_changed),
- entry);
- entry->priv->activate_proxy_tag = g_signal_connect (entry->item,
- "activate",
- G_CALLBACK (proxy_activate),
- entry);
- entry->priv->populate_popup_proxy_tag = g_signal_connect (entry->item,
- "populate_popup",
- G_CALLBACK (proxy_populate_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 = g_object_new (E_ENTRY_TYPE, NULL);
- 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));
-
- g_signal_handler_block (entry->item, entry->priv->changed_proxy_tag);
- e_entry_set_text (entry, txt);
- g_signal_handler_unblock (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));
-
- g_object_set (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;
-
- fudge = 1;
- y -= fudge;
-
- gtk_widget_set_uposition (pop, x, y);
- e_completion_view_set_width (E_COMPLETION_VIEW (entry->priv->completion_view), dim->width);
-
- gtk_widget_set_sensitive(pop, TRUE);
- 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);
- /* hack to force the popup to lose focus, which it gets if you click on it */
- gtk_widget_set_sensitive(pop, FALSE);
-
- 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;
- g_signal_emit (entry, e_entry_signals[E_ENTRY_COMPLETION_POPUP], 0, (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;
-
- 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 */
- g_signal_emit_by_name (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 */
- g_signal_emit_by_name (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;
- g_object_ref (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);
-
- g_signal_connect_after (entry->priv->completion_view,
- "button_press_event",
- G_CALLBACK (button_press_cb),
- entry);
-
- entry->priv->nonempty_signal_id = g_signal_connect (entry->priv->completion_view,
- "nonempty",
- G_CALLBACK (nonempty_cb),
- entry);
-
- entry->priv->added_signal_id = g_signal_connect (entry->priv->completion_view,
- "added",
- G_CALLBACK (added_cb),
- entry);
-
- entry->priv->full_signal_id = g_signal_connect (entry->priv->completion_view,
- "full",
- G_CALLBACK (full_cb),
- entry);
-
- entry->priv->browse_signal_id = g_signal_connect (entry->priv->completion_view,
- "browse",
- G_CALLBACK (browse_cb),
- entry);
-
- entry->priv->unbrowse_signal_id = g_signal_connect (entry->priv->completion_view,
- "unbrowse",
- G_CALLBACK (unbrowse_cb),
- entry);
-
- entry->priv->activate_signal_id = g_signal_connect (entry->priv->completion_view,
- "activate",
- G_CALLBACK (activate_cb),
- entry);
-
- entry->priv->completion_view_popup = gtk_window_new (GTK_WINDOW_POPUP);
-
- e_entry_make_completion_window_transient (entry);
-
- g_signal_connect (entry->item->model,
- "cancel_completion",
- G_CALLBACK (cancel_completion_cb),
- entry);
-
- g_signal_connect (entry->priv->completion_view_popup,
- "key_press_event",
- G_CALLBACK (key_press_cb),
- entry->canvas);
- g_signal_connect (entry->priv->completion_view_popup,
- "key_release_event",
- G_CALLBACK (key_release_cb),
- entry->canvas);
-
- e_completion_view_connect_keys (E_COMPLETION_VIEW (entry->priv->completion_view),
- GTK_WIDGET (entry->canvas));
-
- g_object_ref (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_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- EEntry *entry = E_ENTRY (object);
- GtkObject *item = GTK_OBJECT (entry->item);
-
- switch (prop_id){
- case PROP_MODEL:
- g_object_get_property (G_OBJECT (item), "model", value);
- break;
- case PROP_EVENT_PROCESSOR:
- g_object_get_property (G_OBJECT (item), "event_processor", value);
- break;
- case PROP_TEXT:
- g_object_get_property (G_OBJECT (item), "text", value);
- break;
-
- case PROP_FONT_GDK:
- g_object_get_property (G_OBJECT (item), "font_gdk", value);
- break;
-
- case PROP_JUSTIFICATION:
- g_object_get_property (G_OBJECT (item), "justification", value);
- break;
-
- case PROP_FILL_COLOR_GDK:
- g_object_get_property (G_OBJECT (item), "fill_color_gdk", value);
- break;
-
- case PROP_FILL_COLOR_RGBA:
- g_object_get_property (G_OBJECT (item), "fill_color_rgba", value);
- break;
-
- case PROP_FILL_STIPPLE:
- g_object_get_property (G_OBJECT (item), "fill_stiple", value);
- break;
-
- case PROP_EDITABLE:
- g_object_get_property (G_OBJECT (item), "editable", value);
- break;
-
- case PROP_USE_ELLIPSIS:
- g_object_get_property (G_OBJECT (item), "use_ellipsis", value);
- break;
-
- case PROP_ELLIPSIS:
- g_object_get_property (G_OBJECT (item), "ellipsis", value);
- break;
-
- case PROP_LINE_WRAP:
- g_object_get_property (G_OBJECT (item), "line_wrap", value);
- break;
-
- case PROP_BREAK_CHARACTERS:
- g_object_get_property (G_OBJECT (item), "break_characters", value);
- break;
-
- case PROP_MAX_LINES:
- g_object_get_property (G_OBJECT (item), "max_lines", value);
- break;
- case PROP_ALLOW_NEWLINES:
- g_object_get_property (G_OBJECT (item), "allow_newlines", value);
- break;
-
- case PROP_DRAW_BORDERS:
- g_value_set_boolean (value, entry->priv->draw_borders);
- break;
-
- case PROP_DRAW_BACKGROUND:
- g_object_get_property (G_OBJECT (item), "draw_background", value);
- break;
-
- case PROP_DRAW_BUTTON:
- g_object_get_property (G_OBJECT (item), "draw_button", value);
- break;
-
- case PROP_EMULATE_LABEL_RESIZE:
- g_value_set_boolean (value, entry->priv->emulate_label_resize);
- break;
-
- case PROP_CURSOR_POS:
- g_object_get_property (G_OBJECT (item), "cursor_pos", value);
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
- }
-}
-
-static void
-et_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- EEntry *entry = E_ENTRY (object);
- 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: prop_id: %d\n", __FUNCTION__, prop_id));
-
- switch (prop_id){
- case PROP_MODEL:
- g_object_set_property (G_OBJECT (item), "model", value);
- if (entry->priv->emulate_label_resize)
- gtk_widget_queue_resize (widget);
- break;
-
- case PROP_EVENT_PROCESSOR:
- g_object_set_property (G_OBJECT (item), "event_processor", value);
- break;
-
- case PROP_TEXT:
- g_object_set_property (G_OBJECT (item), "text", value);
- d(g_print("%s: text: %s\n", __FUNCTION__, g_value_get_string (value)));
- if (entry->priv->emulate_label_resize)
- gtk_widget_queue_resize (widget);
- break;
-
- case PROP_FONT:
- g_object_set_property (G_OBJECT (item), "font", value);
- d(g_print("%s: font: %s\n", __FUNCTION__, g_value_get_string (value)));
- if (entry->priv->emulate_label_resize)
- gtk_widget_queue_resize (widget);
- break;
-
- case PROP_FONTSET:
- g_object_set_property (G_OBJECT (item), "fontset", value);
- if (entry->priv->emulate_label_resize)
- gtk_widget_queue_resize (widget);
- break;
-
- case PROP_FONT_GDK:
- g_object_set_property (G_OBJECT (item), "font_gdk", value);
- if (entry->priv->emulate_label_resize)
- gtk_widget_queue_resize (widget);
- break;
-
- case PROP_JUSTIFICATION:
- entry->priv->justification = g_value_get_enum (value);
- g_object_get(item,
- "clip_width", &width,
- "clip_height", &height,
- NULL);
-
- if (entry->priv->draw_borders) {
- xthick = 0;
- ythick = 0;
- } else {
- xthick = widget->style->xthickness;
- ythick = widget->style->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;
- }
- g_object_set(item,
- "justification", entry->priv->justification,
- "anchor", anchor,
- NULL);
- break;
-
- case PROP_FILL_COLOR:
- g_object_set_property (G_OBJECT (item), "fill_color", value);
- break;
-
- case PROP_FILL_COLOR_GDK:
- g_object_set_property (G_OBJECT (item), "fill_color_gdk", value);
- break;
-
- case PROP_FILL_COLOR_RGBA:
- g_object_set_property (G_OBJECT (item), "fill_color_rgba", value);
- break;
-
- case PROP_FILL_STIPPLE:
- g_object_set_property (G_OBJECT (item), "fill_stiple", value);
- break;
-
- case PROP_EDITABLE:
- g_object_set_property (G_OBJECT (item), "editable", value);
- break;
-
- case PROP_USE_ELLIPSIS:
- g_object_set_property (G_OBJECT (item), "use_ellipsis", value);
- if (entry->priv->emulate_label_resize)
- gtk_widget_queue_resize (widget);
- break;
-
- case PROP_ELLIPSIS:
- g_object_set_property (G_OBJECT (item), "ellipsis", value);
- if (entry->priv->emulate_label_resize)
- gtk_widget_queue_resize (widget);
- break;
-
- case PROP_LINE_WRAP:
- g_object_set_property (G_OBJECT (item), "line_wrap", value);
- if (entry->priv->emulate_label_resize)
- gtk_widget_queue_resize (widget);
- break;
-
- case PROP_BREAK_CHARACTERS:
- g_object_set_property (G_OBJECT (item), "break_characters", value);
- if (entry->priv->emulate_label_resize)
- gtk_widget_queue_resize (widget);
- break;
-
- case PROP_MAX_LINES:
- g_object_set_property (G_OBJECT (item), "max_lines", value);
- if (entry->priv->emulate_label_resize)
- gtk_widget_queue_resize (widget);
- break;
-
- case PROP_ALLOW_NEWLINES:
- g_object_set_property (G_OBJECT (item), "allow_newlines", value);
- break;
-
- case PROP_DRAW_BORDERS:
- if (entry->priv->draw_borders != g_value_get_boolean (value)) {
- entry->priv->draw_borders = g_value_get_boolean (value);
- g_object_set (item,
- "draw_borders", entry->priv->draw_borders,
- NULL);
- gtk_widget_queue_resize (GTK_WIDGET (entry));
- }
- break;
-
- case PROP_CURSOR_POS:
- g_object_set_property (G_OBJECT (item), "cursor_pos", value);
- break;
-
- case PROP_DRAW_BACKGROUND:
- g_object_set_property (G_OBJECT (item), "draw_background", value);
- break;
-
- case PROP_DRAW_BUTTON:
- g_object_set_property (G_OBJECT (item), "draw_button", value);
- break;
-
- case PROP_EMULATE_LABEL_RESIZE:
- if (entry->priv->emulate_label_resize != g_value_get_boolean (value)) {
- entry->priv->emulate_label_resize = g_value_get_boolean (value);
- gtk_widget_queue_resize (widget);
- }
- break;
- }
-}
-
-static void
-e_entry_dispose (GObject *object)
-{
- EEntry *entry = E_ENTRY (object);
-
- if (entry->priv) {
- if (entry->priv->completion_delay_tag)
- gtk_timeout_remove (entry->priv->completion_delay_tag);
-
- if (entry->priv->completion)
- g_object_unref (entry->priv->completion);
-
- if (entry->priv->ptr_grab) {
- gdk_pointer_ungrab (GDK_CURRENT_TIME);
- gtk_grab_remove (GTK_WIDGET (entry->priv->completion_view));
- }
-
- if (entry->priv->completion_view_popup) {
- gtk_widget_destroy (GTK_WIDGET (entry->priv->completion_view_popup));
- g_object_unref (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);
-
- g_free (entry->priv);
- entry->priv = NULL;
- }
-
- if (G_OBJECT_CLASS (parent_class)->dispose)
- (* G_OBJECT_CLASS (parent_class)->dispose) (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 (GObjectClass *object_class)
-{
- EEntryClass *klass = E_ENTRY_CLASS(object_class);
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(object_class);
-
- parent_class = g_type_class_ref (PARENT_TYPE);
-
- object_class->set_property = et_set_property;
- object_class->get_property = et_get_property;
- object_class->dispose = e_entry_dispose;
-
- widget_class->realize = e_entry_realize;
-
- klass->changed = NULL;
- klass->activate = NULL;
-
- e_entry_signals[E_ENTRY_CHANGED] =
- g_signal_new ("changed",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EEntryClass, changed),
- NULL, NULL,
- e_marshal_NONE__NONE,
- G_TYPE_NONE, 0);
-
- e_entry_signals[E_ENTRY_ACTIVATE] =
- g_signal_new ("activate",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EEntryClass, activate),
- NULL, NULL,
- e_marshal_NONE__NONE,
- G_TYPE_NONE, 0);
-
- e_entry_signals[E_ENTRY_POPULATE_POPUP] =
- g_signal_new ("populate_popup",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EEntryClass, populate_popup),
- NULL, NULL,
- e_marshal_NONE__POINTER_INT_OBJECT,
- G_TYPE_NONE, 3, G_TYPE_POINTER, G_TYPE_INT, GTK_TYPE_MENU);
-
- e_entry_signals[E_ENTRY_COMPLETION_POPUP] =
- g_signal_new ("completion_popup",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EEntryClass, completion_popup),
- NULL, NULL,
- gtk_marshal_NONE__INT,
- G_TYPE_NONE, 1, G_TYPE_INT);
-
- g_object_class_install_property (object_class, PROP_MODEL,
- g_param_spec_object ("model",
- _( "Model" ),
- _( "Model" ),
- E_TYPE_TEXT_MODEL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_EVENT_PROCESSOR,
- g_param_spec_object ("event_processor",
- _( "Event Processor" ),
- _( "Event Processor" ),
- E_TEXT_EVENT_PROCESSOR_TYPE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_TEXT,
- g_param_spec_string ("text",
- _( "Text" ),
- _( "Text" ),
- NULL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_FONT,
- g_param_spec_string ("font",
- _( "Font" ),
- _( "Font" ),
- NULL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_FONTSET,
- g_param_spec_string ("fontset",
- _( "Fontset" ),
- _( "Fontset" ),
- NULL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_FONT_GDK,
- g_param_spec_boxed ("font_gdk",
- _( "GDKFont" ),
- _( "GDKFont" ),
- GDK_TYPE_FONT,
- G_PARAM_WRITABLE));
-
- g_object_class_install_property (object_class, PROP_JUSTIFICATION,
- g_param_spec_enum ("justification",
- _( "Justification" ),
- _( "Justification" ),
- GTK_TYPE_JUSTIFICATION, GTK_JUSTIFY_LEFT,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_FILL_COLOR,
- g_param_spec_string ("fill_color",
- _( "Fill color" ),
- _( "Fill color" ),
- NULL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_FILL_COLOR_GDK,
- g_param_spec_boxed ("fill_color_gdk",
- _( "GDK fill color" ),
- _( "GDK fill color" ),
- GDK_TYPE_COLOR,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_FILL_COLOR_RGBA,
- g_param_spec_uint ("fill_color_rgba",
- _( "GDK fill color" ),
- _( "GDK fill color" ),
- 0, G_MAXUINT, 0,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_FILL_STIPPLE,
- g_param_spec_object ("fill_stipple",
- _( "Fill stipple" ),
- _( "FIll stipple" ),
- GDK_TYPE_WINDOW,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_EDITABLE,
- g_param_spec_boolean ("editable",
- _( "Editable" ),
- _( "Editable" ),
- FALSE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_USE_ELLIPSIS,
- g_param_spec_boolean ("use_ellipsis",
- _( "Use ellipsis" ),
- _( "Use ellipsis" ),
- FALSE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_ELLIPSIS,
- g_param_spec_string ("ellipsis",
- _( "Ellipsis" ),
- _( "Ellipsis" ),
- NULL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_LINE_WRAP,
- g_param_spec_boolean ("line_wrap",
- _( "Line wrap" ),
- _( "Line wrap" ),
- FALSE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_BREAK_CHARACTERS,
- g_param_spec_string ("break_characters",
- _( "Break characters" ),
- _( "Break characters" ),
- NULL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_MAX_LINES,
- g_param_spec_int ("max_lines",
- _( "Max lines" ),
- _( "Max lines" ),
- 0, G_MAXINT, 0,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_ALLOW_NEWLINES,
- g_param_spec_boolean ("allow_newlines",
- _( "Allow newlines" ),
- _( "Allow newlines" ),
- FALSE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_DRAW_BORDERS,
- g_param_spec_boolean ("draw_borders",
- _( "Draw borders" ),
- _( "Draw borders" ),
- FALSE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_DRAW_BACKGROUND,
- g_param_spec_boolean ("draw_background",
- _( "Draw background" ),
- _( "Draw background" ),
- FALSE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_DRAW_BUTTON,
- g_param_spec_boolean ("draw_button",
- _( "Draw button" ),
- _( "Draw button" ),
- FALSE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_CURSOR_POS,
- g_param_spec_int ("cursor_pos",
- _( "Cursor position" ),
- _( "Cursor position" ),
- 0, G_MAXINT, 0,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_EMULATE_LABEL_RESIZE,
- g_param_spec_boolean ("emulate_label_resize",
- _( "Emulate label resize" ),
- _( "Emulate label resize" ),
- FALSE,
- G_PARAM_READWRITE));
-}
-
-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 6e71364ee1..0000000000
--- a/widgets/text/e-entry.h
+++ /dev/null
@@ -1,87 +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 <libgnomecanvas/gnome-canvas.h>
-#include <gtk/gtktable.h>
-#include <libxml/tree.h>
-#include <gal/e-text/e-text.h>
-#include "e-completion.h"
-
-G_BEGIN_DECLS
-
-#define E_ENTRY_TYPE (e_entry_get_type ())
-#define E_ENTRY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_ENTRY_TYPE, EEntry))
-#define E_ENTRY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_ENTRY_TYPE, EEntryClass))
-#define E_IS_ENTRY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_ENTRY_TYPE))
-#define E_IS_ENTRY_CLASS(k) (G_TYPE_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 (* populate_popup) (EEntry *entry, GdkEventButton *ev, gint pos, GtkMenu *menu);
- 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);
-
-G_END_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 909a982528..0000000000
--- a/widgets/text/e-table-text-model.c
+++ /dev/null
@@ -1,234 +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_dispose (GObject *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);
-
-#define PARENT_TYPE E_TYPE_TEXT_MODEL
-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.
- **/
-E_MAKE_TYPE (e_table_text_model,
- "ETableTextModel",
- ETableTextModel,
- e_table_text_model_class_init,
- e_table_text_model_init,
- PARENT_TYPE)
-
-/* Class initialization function for the text item */
-static void
-e_table_text_model_class_init (ETableTextModelClass *klass)
-{
- GObjectClass *object_class;
- ETextModelClass *model_class;
-
- object_class = (GObjectClass *) klass;
- model_class = (ETextModelClass *) klass;
-
- parent_class = g_type_class_ref (PARENT_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->dispose = e_table_text_model_dispose;
-}
-
-/* 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;
-}
-
-/* Dispose handler for the text item */
-static void
-e_table_text_model_dispose (GObject *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)
- g_signal_handler_disconnect (model->model,
- model->cell_changed_signal_id);
- model->cell_changed_signal_id = 0;
-
- if (model->row_changed_signal_id)
- g_signal_handler_disconnect (model->model,
- model->row_changed_signal_id);
- model->row_changed_signal_id = 0;
-
- if (model->model)
- g_object_unref (model->model);
- model->model = NULL;
-
- if (G_OBJECT_CLASS (parent_class)->dispose)
- (* G_OBJECT_CLASS (parent_class)->dispose) (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 = g_object_new (E_TYPE_TABLE_TEXT_MODEL, NULL);
- model->model = table_model;
- if (model->model){
- g_object_ref (model->model);
- model->cell_changed_signal_id =
- g_signal_connect (model->model,
- "model_cell_changed",
- G_CALLBACK(cell_changed),
- model);
- model->row_changed_signal_id =
- g_signal_connect (model->model,
- "model_row_changed",
- G_CALLBACK(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 46e82de1c4..0000000000
--- a/widgets/text/e-table-text-model.h
+++ /dev/null
@@ -1,64 +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>
-
-G_BEGIN_DECLS
-
-#define E_TYPE_TABLE_TEXT_MODEL (e_table_text_model_get_type ())
-#define E_TABLE_TEXT_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_TABLE_TEXT_MODEL, ETableTextModel))
-#define E_TABLE_TEXT_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_TABLE_TEXT_MODEL, ETableTextModelClass))
-#define E_IS_TABLE_TEXT_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_TABLE_TEXT_MODEL))
-#define E_IS_TABLE_TEXT_MODEL_CLASS(klass) (G_TYPE_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);
-
-G_END_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 4913b7774e..0000000000
--- a/widgets/text/e-text-model-test.c
+++ /dev/null
@@ -1,91 +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_colormap (gdk_rgb_get_cmap ());
- canvas[i] = e_canvas_new ();
- 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 858771b481..0000000000
--- a/widgets/text/e-text-model-uri.c
+++ /dev/null
@@ -1,344 +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>
-#include <gal/util/e-util.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_dispose (GObject *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;
-};
-
-#define PARENT_TYPE E_TYPE_TEXT_MODEL
-static GtkObject *parent_class;
-
-E_MAKE_TYPE (e_text_model_uri,
- "ETextModelURI",
- ETextModelURI,
- e_text_model_uri_class_init,
- e_text_model_uri_init,
- PARENT_TYPE)
-
-static void
-e_text_model_uri_class_init (ETextModelURIClass *klass)
-{
- GObjectClass *object_class;
- ETextModelClass *model_class;
-
- object_class = (GObjectClass *) klass;
- model_class = E_TEXT_MODEL_CLASS (klass);
-
- parent_class = g_type_class_ref (PARENT_TYPE);
-
- object_class->dispose = e_text_model_uri_dispose;
-
- 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_dispose (GObject *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 (G_OBJECT_CLASS (parent_class)->dispose)
- (* G_OBJECT_CLASS (parent_class)->dispose) (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, NULL);
- g_free (obj_str);
-}
-
-ETextModel *
-e_text_model_uri_new (void)
-{
- return E_TEXT_MODEL (g_object_new (E_TYPE_TEXT_MODEL_URI, NULL));
-}
-
-
-/* $Id$ */
diff --git a/widgets/text/e-text-model-uri.h b/widgets/text/e-text-model-uri.h
deleted file mode 100644
index 64cd7b2a57..0000000000
--- a/widgets/text/e-text-model-uri.h
+++ /dev/null
@@ -1,56 +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>
-
-G_BEGIN_DECLS
-
-#define E_TYPE_TEXT_MODEL_URI (e_text_model_uri_get_type ())
-#define E_TEXT_MODEL_URI(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_TEXT_MODEL_URI, ETextModelURI))
-#define E_TEXT_MODEL_URI_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_TEXT_MODEL_URI, ETextModelURIClass))
-#define E_IS_TEXT_MODEL_URI(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_TEXT_MODEL_URI))
-#define E_IS_TEXT_MODEL_URI_CLASS(klass) (G_TYPE_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);
-
-G_END_DECLS
-
-#endif
diff --git a/widgets/text/e-text-model.c b/widgets/text/e-text-model.c
deleted file mode 100644
index d995d81396..0000000000
--- a/widgets/text/e-text-model.c
+++ /dev/null
@@ -1,601 +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 <gal/util/e-util.h>
-#include "e-text-model-repos.h"
-#include "e-text-model.h"
-#include "gal/util/e-util.h"
-
-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 {
- GString *text;
-};
-
-static void e_text_model_class_init (ETextModelClass *class);
-static void e_text_model_init (ETextModel *model);
-static void e_text_model_dispose (GObject *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);
-
-#define PARENT_TYPE G_TYPE_OBJECT
-static GObject *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.
- **/
-E_MAKE_TYPE (e_text_model,
- "ETextModel",
- ETextModel,
- e_text_model_class_init,
- e_text_model_init,
- PARENT_TYPE)
-
-/* Class initialization function for the text item */
-static void
-e_text_model_class_init (ETextModelClass *klass)
-{
- GObjectClass *object_class;
-
- object_class = (GObjectClass *) klass;
-
- parent_class = g_type_class_ref (PARENT_TYPE);
-
- e_text_model_signals[E_TEXT_MODEL_CHANGED] =
- g_signal_new ("changed",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETextModelClass, changed),
- NULL, NULL,
- e_marshal_NONE__NONE,
- G_TYPE_NONE, 0);
-
- e_text_model_signals[E_TEXT_MODEL_REPOSITION] =
- g_signal_new ("reposition",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETextModelClass, reposition),
- NULL, NULL,
- e_marshal_NONE__POINTER_POINTER,
- G_TYPE_NONE, 2,
- G_TYPE_POINTER, G_TYPE_POINTER);
-
- e_text_model_signals[E_TEXT_MODEL_OBJECT_ACTIVATED] =
- g_signal_new ("object_activated",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETextModelClass, object_activated),
- NULL, NULL,
- e_marshal_NONE__INT,
- G_TYPE_NONE, 1,
- G_TYPE_INT);
-
- e_text_model_signals[E_TEXT_MODEL_CANCEL_COMPLETION] =
- g_signal_new ("cancel_completion",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETextModelClass, cancel_completion),
- NULL, NULL,
- e_marshal_NONE__NONE,
- G_TYPE_NONE, 0);
-
- /* 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->dispose = e_text_model_dispose;
-}
-
-/* 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_string_new ("");
-}
-
-/* Dispose handler for the text item */
-static void
-e_text_model_dispose (GObject *object)
-{
- ETextModel *model;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (E_IS_TEXT_MODEL (object));
-
- model = E_TEXT_MODEL (object);
-
- if (model->priv) {
- g_string_free (model->priv->text, TRUE);
-
- g_free (model->priv);
- model->priv = NULL;
- }
-
- if (G_OBJECT_CLASS (parent_class)->dispose)
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static gint
-e_text_model_real_validate_position (ETextModel *model, gint pos)
-{
- gint len = e_text_model_get_text_length (model);
-
- if (pos < 0)
- pos = 0;
- else if (pos > len)
- pos = len;
-
- return pos;
-}
-
-static const gchar *
-e_text_model_real_get_text (ETextModel *model)
-{
- if (model->priv->text)
- return model->priv->text->str;
- else
- return "";
-}
-
-static gint
-e_text_model_real_get_text_length (ETextModel *model)
-{
- return g_utf8_strlen (model->priv->text->str, -1);
-}
-
-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->str != '\0');
-
- g_string_set_size (model->priv->text, 0);
-
- } else if (*model->priv->text->str == '\0' || strcmp (model->priv->text->str, text)) {
-
- g_string_assign (model->priv->text, text);
-
- 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)
-{
- e_text_model_insert_length (model, position, text, strlen (text));
-}
-
-static void
-e_text_model_real_insert_length (ETextModel *model, gint position, const gchar *text, gint length)
-{
- EReposInsertShift repos;
- gchar *new_text;
- int model_len = e_text_model_real_get_text_length (model);
- char *offs;
- const char *p;
- int byte_length, l;
-
- if (position > model_len)
- return;
-
- offs = g_utf8_offset_to_pointer (model->priv->text->str, position);
-
- for (p = text, l = 0;
- l < length;
- p = g_utf8_next_char (p), l ++) ;
-
- byte_length = p - text;
-
- g_string_insert_len (model->priv->text,
- offs - model->priv->text->str,
- text, byte_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;
- int byte_position, byte_length;
- char *offs, *p;
- int l;
-
- offs = g_utf8_offset_to_pointer (model->priv->text->str, position);
- byte_position = offs - model->priv->text->str;
-
- for (p = offs, l = 0;
- l < length;
- p = g_utf8_next_char (p), l ++) ;
-
- byte_length = p - offs;
-
- g_string_erase (model->priv->text,
- byte_position, byte_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 (E_TEXT_MODEL_GET_CLASS (model)->objectify)
- E_TEXT_MODEL_GET_CLASS (model)->objectify (model);
-
- g_signal_emit (model,
- e_text_model_signals[E_TEXT_MODEL_CHANGED], 0);
-}
-
-void
-e_text_model_cancel_completion (ETextModel *model)
-{
- g_return_if_fail (E_IS_TEXT_MODEL (model));
-
- g_signal_emit (model, e_text_model_signals[E_TEXT_MODEL_CANCEL_COMPLETION], 0);
-}
-
-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);
-
- g_signal_emit (model,
- e_text_model_signals[E_TEXT_MODEL_REPOSITION], 0,
- 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 (E_TEXT_MODEL_GET_CLASS (model)->validate_pos)
- pos = E_TEXT_MODEL_GET_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 (E_TEXT_MODEL_GET_CLASS (model)->get_text)
- return E_TEXT_MODEL_GET_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 (E_TEXT_MODEL_GET_CLASS (model)->get_text_len (model)) {
-
- gint len = E_TEXT_MODEL_GET_CLASS (model)->get_text_len (model);
-
-#ifdef PARANOID_DEBUGGING
- const gchar *str = e_text_model_get_text (model);
- gint len2 = str ? g_utf8_strlen (str, -1) : 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 ? g_utf8_strlen (str, -1) : 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 (E_TEXT_MODEL_GET_CLASS (model)->set_text)
- E_TEXT_MODEL_GET_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 (E_TEXT_MODEL_GET_CLASS (model)->insert)
- E_TEXT_MODEL_GET_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 (E_TEXT_MODEL_GET_CLASS (model)->insert_length)
- E_TEXT_MODEL_GET_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 (E_TEXT_MODEL_GET_CLASS (model)->delete)
- E_TEXT_MODEL_GET_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 (E_TEXT_MODEL_GET_CLASS (model)->obj_count)
- return E_TEXT_MODEL_GET_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 (E_TEXT_MODEL_GET_CLASS (model)->get_nth_obj)
- return E_TEXT_MODEL_GET_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);
-
- if (obj) {
- gint byte_len;
- byte_len = g_utf8_offset_to_pointer (obj, len) - obj;
- return g_strndup (obj, byte_len);
- }
- else {
- return 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 = g_utf8_pointer_to_offset (txt, obj);
- if (end)
- *end = *start + 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 (E_TEXT_MODEL_GET_CLASS (model)->obj_at_offset) {
-
- return E_TEXT_MODEL_GET_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));
-
- g_signal_emit (model, e_text_model_signals[E_TEXT_MODEL_OBJECT_ACTIVATED], 0, n);
-}
-
-ETextModel *
-e_text_model_new (void)
-{
- ETextModel *model = g_object_new (E_TYPE_TEXT_MODEL, NULL);
- return model;
-}
diff --git a/widgets/text/e-text-model.h b/widgets/text/e-text-model.h
deleted file mode 100644
index 2e472ead44..0000000000
--- a/widgets/text/e-text-model.h
+++ /dev/null
@@ -1,113 +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>
-
-G_BEGIN_DECLS
-
-#define E_TYPE_TEXT_MODEL (e_text_model_get_type ())
-#define E_TEXT_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_TEXT_MODEL, ETextModel))
-#define E_TEXT_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_TEXT_MODEL, ETextModelClass))
-#define E_IS_TEXT_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_TEXT_MODEL))
-#define E_IS_TEXT_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_TEXT_MODEL))
-#define E_TEXT_MODEL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), E_TYPE_TEXT_MODEL_TYPE, ETextModelClass))
-
-typedef struct _ETextModel ETextModel;
-typedef struct _ETextModelClass ETextModelClass;
-
-struct _ETextModelPrivate;
-
-typedef gint (*ETextModelReposFn) (gint, gpointer);
-
-struct _ETextModel {
- GObject item;
-
- struct _ETextModelPrivate *priv;
-};
-
-struct _ETextModelClass {
- GObjectClass 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);
-};
-
-GType 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);
-
-G_END_DECLS
-
-#endif
diff --git a/widgets/text/e-text-test.c b/widgets/text/e-text-test.c
deleted file mode 100644
index d10a745d85..0000000000
--- a/widgets/text/e-text-test.c
+++ /dev/null
@@ -1,168 +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 );
- g_object_get(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;
- g_object_get(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 (gpointer data, GObject *where_object_was)
-{
- 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");
- g_object_weak_ref (G_OBJECT (window),
- quit_cb, NULL);
-
- gtk_widget_push_colormap (gdk_rgb_get_cmap ());
- canvas = e_canvas_new ();
- 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);
-
- g_signal_connect (text, "activate",
- G_CALLBACK (change_text_cb), item);
- g_signal_connect (font, "activate",
- G_CALLBACK (change_font_cb), item);
-
- g_signal_connect (canvas , "size_allocate",
- G_CALLBACK (allocate_callback),
- item );
- g_signal_connect (canvas , "reflow",
- G_CALLBACK (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 bda5f46eac..0000000000
--- a/widgets/text/e-text.c
+++ /dev/null
@@ -1,3757 +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 <glib-object.h>
-#include <gdk/gdkx.h> /* for BlackPixel */
-#include <gdk/gdkkeysyms.h>
-#include <gtk/gtkclipboard.h>
-#include <gtk/gtkmain.h>
-#include <gtk/gtkselection.h>
-#include <gtk/gtkstock.h>
-#include <gtk/gtkwindow.h>
-#include <gtk/gtktypebuiltins.h>
-#include <gtk/gtkmenu.h>
-#include <gtk/gtkimagemenuitem.h>
-#include <gtk/gtkimmulticontext.h>
-#include <gtk/gtkmenuitem.h>
-#include <gtk/gtkseparatormenuitem.h>
-#include <libgnomecanvas/gnome-canvas-rect-ellipse.h>
-#include <libgnome/gnome-i18n.h>
-#include "gal/util/e-util.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>
-
-#include <atk/atk.h>
-#include "gal/a11y/e-text/gal-a11y-e-text-factory.h"
-
-#define PARENT_TYPE (gnome_canvas_item_get_type())
-
-#define BORDER_INDENT 3
-#define d(x)
-
-enum {
- E_TEXT_CHANGED,
- E_TEXT_ACTIVATE,
- E_TEXT_KEYPRESS,
- E_TEXT_POPULATE_POPUP,
- E_TEXT_STYLE_SET,
- E_TEXT_LAST_SIGNAL
-};
-
-static GQuark e_text_signals[E_TEXT_LAST_SIGNAL] = { 0 };
-
-/* Object argument IDs */
-enum {
- PROP_0,
- PROP_MODEL,
- PROP_EVENT_PROCESSOR,
- PROP_TEXT,
- PROP_BOLD,
- PROP_STRIKEOUT,
- PROP_ANCHOR,
- PROP_JUSTIFICATION,
- PROP_CLIP_WIDTH,
- PROP_CLIP_HEIGHT,
- PROP_CLIP,
- PROP_FILL_CLIP_RECTANGLE,
- PROP_X_OFFSET,
- PROP_Y_OFFSET,
- PROP_FILL_COLOR,
- PROP_FILL_COLOR_GDK,
- PROP_FILL_COLOR_RGBA,
- PROP_FILL_STIPPLE,
- PROP_TEXT_WIDTH,
- PROP_TEXT_HEIGHT,
- PROP_EDITABLE,
- PROP_USE_ELLIPSIS,
- PROP_ELLIPSIS,
- PROP_LINE_WRAP,
- PROP_BREAK_CHARACTERS,
- PROP_MAX_LINES,
- PROP_WIDTH,
- PROP_HEIGHT,
- PROP_DRAW_BORDERS,
- PROP_ALLOW_NEWLINES,
- PROP_DRAW_BACKGROUND,
- PROP_DRAW_BUTTON,
- PROP_CURSOR_POS,
- PROP_IM_CONTEXT,
- PROP_HANDLE_POPUP
-};
-
-static void e_text_command(ETextEventProcessor *tep, ETextEventProcessorCommand *command, gpointer data);
-
-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 void calc_height (EText *text);
-
-static gboolean show_pango_rectangle (EText *text, PangoRectangle rect);
-
-static void e_text_do_popup (EText *text, GdkEventButton *button, int position);
-
-static void e_text_update_primary_selection (EText *text);
-static void e_text_paste (EText *text, GdkAtom selection);
-static void e_text_insert(EText *text, const char *string);
-
-/* GtkEditable Methods */
-static void e_text_editable_do_insert_text (GtkEditable *editable,
- const gchar *text,
- gint length,
- gint *position);
-static void e_text_editable_do_delete_text (GtkEditable *editable,
- gint start_pos,
- gint end_pos);
-static gchar* e_text_editable_get_chars (GtkEditable *editable,
- gint start_pos,
- gint end_pos);
-static void e_text_editable_set_selection_bounds (GtkEditable *editable,
- gint start_pos,
- gint end_pos);
-static gboolean e_text_editable_get_selection_bounds (GtkEditable *editable,
- gint *start_pos,
- gint *end_pos);
-static void e_text_editable_set_position (GtkEditable *editable,
- gint position);
-static gint e_text_editable_get_position (GtkEditable *editable);
-
-/* IM Context Callbacks */
-static void e_text_commit_cb (GtkIMContext *context,
- const gchar *str,
- EText *text);
-static gboolean e_text_retrieve_surrounding_cb (GtkIMContext *context,
- EText *text);
-static gboolean e_text_delete_surrounding_cb (GtkIMContext *context,
- gint offset,
- gint n_chars,
- EText *text);
-
-static GnomeCanvasItemClass *parent_class;
-static GdkAtom clipboard_atom = GDK_NONE;
-
-
-
-/* Dispose handler for the text item */
-
-
-static void
-e_text_style_set (EText *text, GtkStyle *previous_style)
-{
- if ( text->line_wrap ) {
- text->needs_split_into_lines = 1;
- } else {
- text->needs_calc_height = 1;
- }
- e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (text));
-}
-
-static void
-e_text_dispose (GObject *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));
- text->tooltip_owner = 0;
-
- if (text->model_changed_signal_id)
- g_signal_handler_disconnect (text->model,
- text->model_changed_signal_id);
- text->model_changed_signal_id = 0;
-
- if (text->model_repos_signal_id)
- g_signal_handler_disconnect (text->model,
- text->model_repos_signal_id);
- text->model_repos_signal_id = 0;
-
- if (text->model)
- g_object_unref(text->model);
- text->model = NULL;
-
- if (text->tep_command_id)
- g_signal_handler_disconnect(text->tep,
- text->tep_command_id);
- text->tep_command_id = 0;
-
- if (text->tep)
- g_object_unref (text->tep);
- text->tep = NULL;
-
- g_free (text->revert);
- text->revert = NULL;
-
- if (text->stipple)
- gdk_bitmap_unref (text->stipple);
- text->stipple = NULL;
-
- 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 (text->layout) {
- g_object_unref (text->layout);
- text->layout = NULL;
- }
-
- if (text->im_context) {
- g_signal_handlers_disconnect_matched (text->im_context,
- G_SIGNAL_MATCH_DATA,
- 0, 0, NULL,
- NULL, text);
- g_object_unref (text->im_context);
- text->im_context = NULL;
- }
-
- if (G_OBJECT_CLASS (parent_class)->dispose)
- (* G_OBJECT_CLASS (parent_class)->dispose) (object);
-}
-
-static void
-reset_layout_attrs (EText *text)
-{
- PangoAttrList *attrs = NULL;
- int object_count;
-
- if (text->layout == NULL)
- return;
-
- object_count = e_text_model_object_count (text->model);
-
- if (text->bold || text->strikeout || object_count > 0) {
- int length = 0;
- int i;
-
- attrs = pango_attr_list_new ();
-
- for (i = 0; i < object_count; i++) {
- int start_pos, end_pos;
- PangoAttribute *attr = pango_attr_underline_new (PANGO_UNDERLINE_SINGLE);
-
- e_text_model_get_nth_object_bounds (text->model, i, &start_pos, &end_pos);
-
- attr->start_index = g_utf8_offset_to_pointer (text->text, start_pos) - text->text;
- attr->end_index = g_utf8_offset_to_pointer (text->text, end_pos) - text->text;
-
- pango_attr_list_insert (attrs, attr);
- }
-
- if (text->bold || text->strikeout)
- length = strlen (text->text);
-
- if (text->bold) {
- PangoAttribute *attr = pango_attr_weight_new (PANGO_WEIGHT_BOLD);
- attr->start_index = 0;
- attr->end_index = length;
-
- pango_attr_list_insert_before (attrs, attr);
- }
- if (text->strikeout) {
- PangoAttribute *attr = pango_attr_strikethrough_new (TRUE);
- attr->start_index = 0;
- attr->end_index = length;
-
- pango_attr_list_insert_before (attrs, attr);
- }
- }
- pango_layout_set_attributes (text->layout, attrs);
- if (attrs)
- pango_attr_list_unref (attrs);
- calc_height (text);
-}
-
-static void
-create_layout (EText *text)
-{
- GnomeCanvasItem *item = GNOME_CANVAS_ITEM (text);
-
- if (text->layout)
- return;
-
- text->layout = gtk_widget_create_pango_layout (GTK_WIDGET (item->canvas), text->text);
- if (text->line_wrap)
- pango_layout_set_width (text->layout, text->clip_width < 0 ? -1 : text->clip_width * PANGO_SCALE);
- reset_layout_attrs (text);
-}
-
-static void
-reset_layout (EText *text)
-{
- if (text->layout == NULL) {
- create_layout (text);
- }
- else {
- pango_layout_set_text (text->layout, text->text, -1);
- reset_layout_attrs (text);
- }
-
- if (!text->button_down) {
- PangoRectangle strong_pos, weak_pos;
- char *offs = g_utf8_offset_to_pointer (text->text, text->selection_start);
-
- pango_layout_get_cursor_pos (text->layout, offs - text->text, &strong_pos, &weak_pos);
-
- if (strong_pos.x != weak_pos.x ||
- strong_pos.y != weak_pos.y ||
- strong_pos.width != weak_pos.width ||
- strong_pos.height != weak_pos.height)
- show_pango_rectangle (text, weak_pos);
-
- show_pango_rectangle (text, strong_pos);
- }
-}
-
-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);
-
- /* 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_reset_layout = 1;
- 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));
-
- g_signal_emit (text, e_text_signals[E_TEXT_CHANGED], 0);
-}
-
-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 (EText *text, double *px1, double *py1, double *px2, double *py2)
-{
- GnomeCanvasItem *item;
- double wx, wy, clip_width, clip_height;
-
- 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);
- gnome_canvas_w2c (item->canvas, wx, wy, &text->clip_cx, &text->clip_cy);
-
- if (text->clip_width < 0)
- clip_width = text->width;
- else
- clip_width = text->clip_width;
-
- if ( text->clip_height < 0 )
- clip_height = text->height;
- else
- clip_height = text->clip_height;
-
- /* Get canvas pixel coordinates for clip rectangle position */
- text->clip_cwidth = clip_width * item->canvas->pixels_per_unit;
- text->clip_cheight = clip_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->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->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;
- }
-
- text->text_cx = text->cx;
- text->text_cy = text->cy;
-
- if (text->draw_borders) {
- text->text_cx += BORDER_INDENT;
- text->text_cy += BORDER_INDENT;
- }
-
- /* 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->width;
- *py2 = text->cy + text->height;
- }
-}
-
-static void
-calc_height (EText *text)
-{
- GnomeCanvasItem *item;
- int old_height;
- int old_width;
- int width = 0;
- int height = 0;
-
- item = GNOME_CANVAS_ITEM (text);
-
- /* Calculate text dimensions */
-
- old_height = text->height;
- old_width = text->width;
-
- if (text->layout)
- pango_layout_get_pixel_size (text->layout, &width, &height);
-
- text->height = height;
- text->width = width;
-
- if (old_height != text->height || old_width != text->width)
- e_canvas_item_request_parent_reflow(item);
-}
-
-static void
-calc_ellipsis (EText *text)
-{
-#warning "AIEEEE FIX ME. a pango layout per calc_ellipsis sucks"
- int width;
- PangoLayout *layout = gtk_widget_create_pango_layout (GTK_WIDGET (GNOME_CANVAS_ITEM (text)->canvas),
- text->ellipsis ? text->ellipsis : "...");
- pango_layout_get_size (layout, &width, NULL);
-
- text->ellipsis_width = width;
-
- g_object_unref (layout);
-}
-
-static void
-split_into_lines (EText *text)
-{
- text->num_lines = pango_layout_get_line_count (text->layout);
-}
-
-/* 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_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
-{
- 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 (prop_id) {
- case PROP_MODEL:
-
- if ( text->model_changed_signal_id )
- g_signal_handler_disconnect (text->model,
- text->model_changed_signal_id);
-
- if ( text->model_repos_signal_id )
- g_signal_handler_disconnect (text->model,
- text->model_repos_signal_id);
-
- g_object_unref (text->model);
- text->model = E_TEXT_MODEL (g_value_get_object (value));
- g_object_ref (text->model);
-
- text->model_changed_signal_id =
- g_signal_connect (text->model,
- "changed",
- G_CALLBACK (e_text_text_model_changed),
- text);
-
- text->model_repos_signal_id =
- g_signal_connect (text->model,
- "reposition",
- G_CALLBACK (e_text_text_model_reposition),
- text);
-
- text->text = e_text_model_get_text(text->model);
- g_signal_emit (text, e_text_signals[E_TEXT_CHANGED], 0);
-
- text->needs_split_into_lines = 1;
- needs_reflow = 1;
- break;
-
- case PROP_EVENT_PROCESSOR:
- if ( text->tep && text->tep_command_id )
- g_signal_handler_disconnect(text->tep,
- text->tep_command_id);
- if ( text->tep ) {
- g_object_unref(text->tep);
- }
- text->tep = E_TEXT_EVENT_PROCESSOR(g_value_get_object (value));
- g_object_ref(text->tep);
- text->tep_command_id =
- g_signal_connect(text->tep,
- "command",
- G_CALLBACK(e_text_command),
- text);
- if (!text->allow_newlines)
- g_object_set (text->tep,
- "allow_newlines", FALSE,
- NULL);
- break;
-
- case PROP_TEXT:
- e_text_model_set_text(text->model, g_value_get_string (value));
- break;
-
- case PROP_BOLD:
- text->bold = g_value_get_boolean (value);
-
- text->needs_redraw = 1;
- text->needs_recalc_bounds = 1;
- if ( text->line_wrap )
- text->needs_split_into_lines = 1;
- else {
- text->needs_calc_height = 1;
- }
- needs_update = 1;
- needs_reflow = 1;
- break;
-
- case PROP_STRIKEOUT:
- text->strikeout = g_value_get_boolean (value);
- text->needs_redraw = 1;
- needs_update = 1;
- break;
-
- case PROP_ANCHOR:
- text->anchor = g_value_get_enum (value);
- text->needs_recalc_bounds = 1;
- needs_update = 1;
- break;
-
- case PROP_JUSTIFICATION:
- text->justification = g_value_get_enum (value);
- text->needs_redraw = 1;
- needs_update = 1;
- break;
-
- case PROP_CLIP_WIDTH:
- text->clip_width = fabs (g_value_get_double (value));
- calc_ellipsis (text);
- if ( text->line_wrap )
- text->needs_split_into_lines = 1;
- else {
- text->needs_calc_height = 1;
- }
- needs_reflow = 1;
- break;
-
- case PROP_CLIP_HEIGHT:
- text->clip_height = fabs (g_value_get_double (value));
- text->needs_recalc_bounds = 1;
- /* toshok: kind of a hack - set needs_reset_layout
- here so when something about the style/them
- changes, we redraw the text at the proper size/with
- the proper font. */
- text->needs_reset_layout = 1;
- needs_reflow = 1;
- break;
-
- case PROP_CLIP:
- text->clip = g_value_get_boolean (value);
- calc_ellipsis (text);
- if ( text->line_wrap )
- text->needs_split_into_lines = 1;
- else {
- text->needs_calc_height = 1;
- }
- needs_reflow = 1;
- break;
-
- case PROP_FILL_CLIP_RECTANGLE:
- text->fill_clip_rectangle = g_value_get_boolean (value);
- needs_update = 1;
- break;
-
- case PROP_X_OFFSET:
- text->xofs = g_value_get_double (value);
- text->needs_recalc_bounds = 1;
- needs_update = 1;
- break;
-
- case PROP_Y_OFFSET:
- text->yofs = g_value_get_double (value);
- text->needs_recalc_bounds = 1;
- needs_update = 1;
- break;
-
- case PROP_FILL_COLOR:
- if (g_value_get_string (value))
- gdk_color_parse (g_value_get_string (value), &color);
-
- text->rgba = ((color.red & 0xff00) << 16 |
- (color.green & 0xff00) << 8 |
- (color.blue & 0xff00) |
- 0xff);
- color_changed = TRUE;
- break;
-
- case PROP_FILL_COLOR_GDK:
- pcolor = g_value_get_boxed (value);
- if (pcolor) {
- color = *pcolor;
- }
-
- text->rgba = ((color.red & 0xff00) << 16 |
- (color.green & 0xff00) << 8 |
- (color.blue & 0xff00) |
- 0xff);
- color_changed = TRUE;
- break;
-
- case PROP_FILL_COLOR_RGBA:
- text->rgba = g_value_get_uint (value);
- 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 PROP_FILL_STIPPLE:
- set_stipple (text, g_value_get_object (value), FALSE);
- text->needs_redraw = 1;
- needs_update = 1;
- break;
-
- case PROP_EDITABLE:
- text->editable = g_value_get_boolean (value);
- text->needs_redraw = 1;
- needs_update = 1;
- break;
-
- case PROP_USE_ELLIPSIS:
- text->use_ellipsis = g_value_get_boolean (value);
- needs_reflow = 1;
- break;
-
- case PROP_ELLIPSIS:
- if (text->ellipsis)
- g_free (text->ellipsis);
-
- text->ellipsis = g_strdup (g_value_get_string (value));
- calc_ellipsis (text);
- needs_reflow = 1;
- break;
-
- case PROP_LINE_WRAP:
- text->line_wrap = g_value_get_boolean (value);
- if (text->line_wrap) {
- if (text->layout) {
- pango_layout_set_width (text->layout, text->width < 0 ? -1 : text->width * PANGO_SCALE);
- }
- }
- text->needs_split_into_lines = 1;
- needs_reflow = 1;
- break;
-
- case PROP_BREAK_CHARACTERS:
- if ( text->break_characters ) {
- g_free(text->break_characters);
- text->break_characters = NULL;
- }
- if ( g_value_get_string (value) )
- text->break_characters = g_strdup( g_value_get_string (value) );
- text->needs_split_into_lines = 1;
- needs_reflow = 1;
- break;
-
- case PROP_MAX_LINES:
- text->max_lines = g_value_get_int (value);
- text->needs_split_into_lines = 1;
- needs_reflow = 1;
- break;
-
- case PROP_WIDTH:
- text->clip_width = fabs (g_value_get_double (value));
- calc_ellipsis (text);
- if ( text->line_wrap ) {
- if (text->layout) {
- pango_layout_set_width (text->layout, text->width < 0 ? -1 : text->width * PANGO_SCALE);
- }
- text->needs_split_into_lines = 1;
- }
- else {
- text->needs_calc_height = 1;
- }
- needs_reflow = 1;
- break;
-
- case PROP_DRAW_BORDERS:
- if (text->draw_borders != g_value_get_boolean (value)) {
- text->draw_borders = g_value_get_boolean (value);
- text->needs_calc_height = 1;
- text->needs_redraw = 1;
- needs_reflow = 1;
- needs_update = 1;
- }
- break;
-
- case PROP_DRAW_BACKGROUND:
- if (text->draw_background != g_value_get_boolean (value)) {
- text->draw_background = g_value_get_boolean (value);
- text->needs_redraw = 1;
- }
- break;
-
- case PROP_DRAW_BUTTON:
- if (text->draw_button != g_value_get_boolean (value)) {
- text->draw_button = g_value_get_boolean (value);
- text->needs_redraw = 1;
- }
- break;
-
- case PROP_ALLOW_NEWLINES:
- text->allow_newlines = g_value_get_boolean (value);
- _get_tep(text);
- g_object_set (text->tep,
- "allow_newlines", g_value_get_boolean (value),
- NULL);
- break;
-
- case PROP_CURSOR_POS: {
- ETextEventProcessorCommand command;
-
- command.action = E_TEP_MOVE;
- command.position = E_TEP_VALUE;
- command.value = g_value_get_int (value);
- command.time = GDK_CURRENT_TIME;
- e_text_command (text->tep, &command, text);
- break;
- }
-
- case PROP_IM_CONTEXT:
- if (text->im_context)
- g_object_unref (text->im_context);
-
- text->im_context = g_value_get_object (value);
- if (text->im_context)
- g_object_ref (text->im_context);
-
- text->need_im_reset = FALSE;
- break;
-
- case PROP_HANDLE_POPUP:
- text->handle_popup = g_value_get_boolean (value);
- break;
-
- default:
- return;
- }
-
- if (color_changed) {
- GdkColormap *colormap = gtk_widget_get_colormap (GTK_WIDGET (item->canvas));
-
- text->color = color;
- gdk_rgb_find_color (colormap, &text->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_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
-{
- EText *text;
-
- text = E_TEXT (object);
-
- switch (prop_id) {
- case PROP_MODEL:
- g_value_set_object (value, text->model);
- break;
-
- case PROP_EVENT_PROCESSOR:
- _get_tep(text);
- g_value_set_object (value, text->tep);
- break;
-
- case PROP_TEXT:
- g_value_set_string (value, g_strdup (text->text));
- break;
-
- case PROP_BOLD:
- g_value_set_boolean (value, text->bold);
- break;
-
- case PROP_STRIKEOUT:
- g_value_set_boolean (value, text->strikeout);
- break;
-
- case PROP_ANCHOR:
- g_value_set_enum (value, text->anchor);
- break;
-
- case PROP_JUSTIFICATION:
- g_value_set_enum (value, text->justification);
- break;
-
- case PROP_CLIP_WIDTH:
- g_value_set_double (value, text->clip_width);
- break;
-
- case PROP_CLIP_HEIGHT:
- g_value_set_double (value, text->clip_height);
- break;
-
- case PROP_CLIP:
- g_value_set_boolean (value, text->clip);
- break;
-
- case PROP_FILL_CLIP_RECTANGLE:
- g_value_set_boolean (value, text->fill_clip_rectangle);
- break;
-
- case PROP_X_OFFSET:
- g_value_set_double (value, text->xofs);
- break;
-
- case PROP_Y_OFFSET:
- g_value_set_double (value, text->yofs);
- break;
-
- case PROP_FILL_COLOR_GDK:
- g_value_set_boxed (value, &text->color);
- break;
-
- case PROP_FILL_COLOR_RGBA:
- g_value_set_uint (value, text->rgba);
- break;
-
- case PROP_FILL_STIPPLE:
- g_value_set_object (value, text->stipple);
- break;
-
- case PROP_TEXT_WIDTH:
- g_value_set_double (value, text->width / text->item.canvas->pixels_per_unit);
- break;
-
- case PROP_TEXT_HEIGHT:
- g_value_set_double (value, text->height / text->item.canvas->pixels_per_unit);
- break;
-
- case PROP_EDITABLE:
- g_value_set_boolean (value, text->editable);
- break;
-
- case PROP_USE_ELLIPSIS:
- g_value_set_boolean (value, text->use_ellipsis);
- break;
-
- case PROP_ELLIPSIS:
- g_value_set_string (value, g_strdup (text->ellipsis));
- break;
-
- case PROP_LINE_WRAP:
- g_value_set_boolean (value, text->line_wrap);
- break;
-
- case PROP_BREAK_CHARACTERS:
- g_value_set_string (value, g_strdup (text->break_characters));
- break;
-
- case PROP_MAX_LINES:
- g_value_set_int (value, text->max_lines);
- break;
-
- case PROP_WIDTH:
- g_value_set_double (value, text->clip_width);
- break;
-
- case PROP_HEIGHT:
- g_value_set_double (value, text->clip && text->clip_height != -1 ? text->clip_height : text->height / text->item.canvas->pixels_per_unit);
- break;
-
- case PROP_DRAW_BORDERS:
- g_value_set_boolean (value, text->draw_borders);
- break;
-
- case PROP_DRAW_BACKGROUND:
- g_value_set_boolean (value, text->draw_background);
- break;
-
- case PROP_DRAW_BUTTON:
- g_value_set_boolean (value, text->draw_button);
- break;
-
- case PROP_ALLOW_NEWLINES:
- g_value_set_boolean (value, text->allow_newlines);
- break;
-
- case PROP_CURSOR_POS:
- g_value_set_int (value, text->selection_start);
- break;
-
- case PROP_IM_CONTEXT:
- g_value_set_object (value, text->im_context);
- break;
-
- case PROP_HANDLE_POPUP:
- g_value_set_boolean (value, text->handle_popup);
- break;
-
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- 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_reset_layout) {
- reset_layout (text);
- text->needs_reset_layout = 0;
- text->needs_calc_height = 1;
- }
-
- if (text->needs_split_into_lines) {
- split_into_lines (text);
-
- text->needs_split_into_lines = 0;
- text->needs_calc_height = 1;
- }
-
- 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;
-
- 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;
- }
- if (!text->fill_clip_rectangle)
- item->canvas->need_repick = TRUE;
- }
- 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);
-
- create_layout (text);
-
- text->gc = gdk_gc_new (item->canvas->layout.bin_window);
-#ifndef NO_WARNINGS
-#warning Color brokenness ...
-#endif
-#if 0
- gdk_color_context_query_color (item->canvas->cc, &text->color);
- gdk_gc_set_foreground (text->gc, &text->color);
-#endif
-
- text->i_cursor = gdk_cursor_new (GDK_XTERM);
- text->default_cursor = gdk_cursor_new (GDK_LEFT_PTR);
-}
-
-/* Unrealize handler for the text item */
-static void
-e_text_unrealize (GnomeCanvasItem *item)
-{
- EText *text;
-
- text = E_TEXT (item);
-
- gdk_gc_unref (text->gc);
- text->gc = NULL;
-
- gdk_cursor_destroy (text->i_cursor);
- text->i_cursor = NULL;
- gdk_cursor_destroy (text->default_cursor);
- text->default_cursor = NULL;
-
- if (parent_class->unrealize)
- (* parent_class->unrealize) (item);
-}
-
-static void
-_get_tep(EText *text)
-{
- if (!text->tep) {
- text->tep = e_text_event_processor_emacs_like_new();
- text->tep_command_id =
- g_signal_connect(text->tep,
- "command",
- G_CALLBACK(e_text_command),
- text);
- }
-}
-
-static void
-draw_pango_rectangle (GdkDrawable *drawable, GdkGC *gc, int x1, int y1, PangoRectangle rect)
-{
- int width = rect.width / PANGO_SCALE;
- int height = rect.height / PANGO_SCALE;
- if (width <= 0)
- width = 1;
- if (height <= 0)
- height = 1;
- gdk_draw_rectangle (drawable, gc, TRUE,
- x1 + rect.x / PANGO_SCALE, y1 + rect.y / PANGO_SCALE, width, height);
-}
-
-static gboolean
-show_pango_rectangle (EText *text, PangoRectangle rect)
-{
- int x1 = rect.x / PANGO_SCALE;
- int x2 = (rect.x + rect.width) / PANGO_SCALE;
-
- int y1 = rect.y / PANGO_SCALE;
- int y2 = (rect.y + rect.height) / PANGO_SCALE;
-
- int new_xofs_edit = text->xofs_edit;
- int new_yofs_edit = text->yofs_edit;
-
- int clip_width, clip_height;
-
- clip_width = text->clip_width;
- if (clip_width >= 0 && text->draw_borders) {
- clip_width -= 6;
- if (clip_width < 0)
- clip_width = 0;
- }
-
- clip_height = text->clip_height;
-
- if (clip_height >= 0 && text->draw_borders) {
- clip_height -= 6;
- if (clip_height < 0)
- clip_height = 0;
- }
-
- if (x1 < new_xofs_edit)
- new_xofs_edit = x1;
-
- if (y1 < new_yofs_edit)
- new_yofs_edit = y1;
-
- if (clip_width >= 0) {
- if (2 + x2 - clip_width > new_xofs_edit)
- new_xofs_edit = 2 + x2 - clip_width;
- } else {
- new_xofs_edit = 0;
- }
-
- if (clip_height >= 0) {
- if (y2 - clip_height > new_yofs_edit)
- new_yofs_edit = y2 - clip_height;
- } else {
- new_yofs_edit = 0;
- }
-
- if (new_xofs_edit < 0)
- new_xofs_edit = 0;
- if (new_yofs_edit < 0)
- new_yofs_edit = 0;
-
- if (new_xofs_edit != text->xofs_edit ||
- new_yofs_edit != text->yofs_edit) {
- text->xofs_edit = new_xofs_edit;
- text->yofs_edit = new_yofs_edit;
- return TRUE;
- }
-
- return FALSE;
-}
-
-/* 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;
- int xpos, ypos;
- GdkGC *main_gc;
- GnomeCanvas *canvas;
- GtkWidget *widget;
-
- text = E_TEXT (item);
- canvas = GNOME_CANVAS_ITEM(text)->canvas;
- widget = GTK_WIDGET(canvas);
-
- if (text->draw_background || text->draw_button) {
- main_gc = widget->style->fg_gc[GTK_WIDGET_STATE (widget)];
- } 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);
-
- g_object_get(text,
- "width", &thiswidth,
- "height", &thisheight,
- NULL);
-
- if (text->draw_borders){
-
- gtk_paint_shadow (widget->style, drawable,
- GTK_STATE_NORMAL, GTK_SHADOW_IN,
- NULL, widget, "entry",
- thisx, thisy, thiswidth, thisheight);
-
- }
-
- 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->xthickness,
- thisy + widget->style->ythickness,
- thiswidth - widget->style->xthickness * 2,
- thisheight - widget->style->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->xthickness;
- thisy += widget->style->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, GTK_WIDGET_STATE (widget),
- &area, widget, "button",
- thisx + xoff, thisy + yoff, thiswidth - 1, thisheight - 1);
- }
- }
- }
-
- if (!text->text)
- return;
-
- if (text->stipple)
- gnome_canvas_set_stipple_origin (item->canvas, main_gc);
-
- xpos = text->text_cx;
- ypos = text->text_cy;
-
- xpos -= x;
- ypos -= y;
-
- clip_rect = NULL;
- if (text->clip) {
- rect.x = xpos;
- rect.y = ypos;
- rect.width = text->clip_cwidth;
- rect.height = text->clip_cheight;
-
- gdk_gc_set_clip_rectangle (main_gc, &rect);
- clip_rect = &rect;
- }
-
- if (text->editing) {
- xpos -= text->xofs_edit;
- ypos -= text->yofs_edit;
- }
-
- gdk_draw_layout (drawable, main_gc,
- xpos, ypos,
- text->layout);
-
- if (text->editing) {
- if (text->selection_start != text->selection_end) {
- PangoLayoutIter *iter;
- GdkRegion *clip_region = gdk_region_new ();
- GdkGC *selection_gc;
- GdkGC *text_gc;
- int start_index, end_index;
-
- start_index = MIN (text->selection_start, text->selection_end);
- end_index = MAX (text->selection_start, text->selection_end);
-
- /* convert these into byte indices */
- start_index = g_utf8_offset_to_pointer(text->text, start_index) - text->text;
- end_index = g_utf8_offset_to_pointer(text->text, end_index) - text->text;
-
- if (text->has_selection) {
- selection_gc = widget->style->base_gc [GTK_STATE_SELECTED];
- text_gc = widget->style->text_gc[GTK_STATE_SELECTED];
- } else {
- selection_gc = widget->style->base_gc [GTK_STATE_ACTIVE];
- text_gc = widget->style->text_gc[GTK_STATE_ACTIVE];
- }
-
- gdk_gc_set_clip_rectangle (selection_gc, clip_rect);
-
- iter = pango_layout_get_iter (text->layout);
-
- do {
- PangoLayoutLine *line = pango_layout_iter_get_line (iter);
- gint n_ranges, i;
- gint *ranges;
- int y0, y1;
- int s, e;
-
- if (start_index < line->start_index + line->length
- && end_index > line->start_index) {
-
- if (start_index <= line->start_index)
- s = line->start_index;
- else
- s = start_index;
-
- if (end_index > line->start_index + line->length)
- e = line->start_index + line->length;
- else
- e = end_index;
-
- pango_layout_line_get_x_ranges (line, s, e, &ranges, &n_ranges);
-
- pango_layout_iter_get_line_yrange (iter, &y0, &y1);
-
- for (i=0; i < n_ranges; i++) {
- GdkRectangle sel_rect;
-
- sel_rect.x = xpos + PANGO_PIXELS (ranges[2*i]);
- sel_rect.y = ypos + PANGO_PIXELS (y0);
- sel_rect.width = (ranges[2*i + 1] - ranges[2*i]) / PANGO_SCALE;
- sel_rect.height = (y1 - y0 + PANGO_SCALE / 2) / PANGO_SCALE;
-
- gdk_draw_rectangle (drawable, selection_gc, TRUE,
- sel_rect.x, sel_rect.y, sel_rect.width, sel_rect.height);
-
- gdk_region_union_with_rect (clip_region, &sel_rect);
- }
- g_free (ranges);
- }
- } while (pango_layout_iter_next_line (iter));
-
- pango_layout_iter_free (iter);
-
- if (clip_rect) {
- GdkRegion *rect_region = gdk_region_rectangle (clip_rect);
- gdk_region_intersect (clip_region, rect_region);
- gdk_region_destroy (rect_region);
- }
-
- gdk_gc_set_clip_region (text_gc, clip_region);
- gdk_draw_layout (drawable, text_gc,
- xpos, ypos,
- text->layout);
-
- gdk_gc_set_clip_region (text_gc, NULL);
- gdk_gc_set_clip_region (selection_gc, NULL);
-
- gdk_region_destroy (clip_region);
- } else {
- if (text->show_cursor) {
- PangoRectangle strong_pos, weak_pos;
- char *offs = g_utf8_offset_to_pointer (text->text, text->selection_start);
-
- pango_layout_get_cursor_pos (text->layout, offs - text->text, &strong_pos, &weak_pos);
- draw_pango_rectangle (drawable, main_gc, xpos, ypos, strong_pos);
- if (strong_pos.x != weak_pos.x ||
- strong_pos.y != weak_pos.y ||
- strong_pos.width != weak_pos.width ||
- strong_pos.height != weak_pos.height)
- draw_pango_rectangle (drawable, main_gc, xpos, ypos, weak_pos);
- }
- }
- }
-
-
- if (text->clip) {
- gdk_gc_set_clip_rectangle (main_gc, NULL);
- }
-}
-
-/* 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;
- double clip_width;
- double clip_height;
-
- 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->clip_width < 0)
- clip_width = text->width;
- else
- clip_width = text->clip_width;
-
- if ( text->clip_height < 0 )
- clip_height = text->height;
- else
- clip_height = text->clip_height;
-
- /* Get canvas pixel coordinates for clip rectangle position */
- clip_width = clip_width * item->canvas->pixels_per_unit;
- clip_height = clip_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 1;
-
- if (text->fill_clip_rectangle)
- return 0;
-
- cx -= text->cx;
-
- if (pango_layout_xy_to_index (text->layout, cx, cy, NULL, NULL))
- return 0;
-
- return 1;
-}
-
-/* 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;
-
- width = text->width;
- height = text->height;
-
- if (text->clip) {
- if (text->clip_width >= 0)
- width = text->clip_width;
- if ( text->clip_height >= 0 )
- height = text->clip_height;
- }
-
- width = width / item->canvas->pixels_per_unit;
- height = 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 gint
-get_position_from_xy (EText *text, gint x, gint y)
-{
- int index;
- int trailing;
-
- if (text->draw_borders) {
- x -= BORDER_INDENT;
- y -= BORDER_INDENT;
- }
-
- x -= text->xofs;
- y -= text->yofs;
-
- if (text->editing) {
- x += text->xofs_edit;
- y += text->yofs_edit;
- }
-
- x -= text->cx;
- y -= text->cy;
-
- pango_layout_xy_to_index (text->layout, x * PANGO_SCALE, y * PANGO_SCALE, &index, &trailing);
-
- return g_utf8_pointer_to_offset (text->text, text->text + index + trailing);
-}
-
-#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 && text->clip) {
- int old_xofs_edit = text->xofs_edit;
- int old_yofs_edit = text->yofs_edit;
-
- if (text->clip_cwidth >= 0 &&
- text->lastx - text->clip_cx > text->clip_cwidth &&
- text->xofs_edit < text->width - text->clip_cwidth) {
- text->xofs_edit += 4;
- if (text->xofs_edit > text->width - text->clip_cwidth + 1)
- text->xofs_edit = text->width - text->clip_cwidth + 1;
- }
- if (text->lastx - text->clip_cx < 0 &&
- text->xofs_edit > 0) {
- text->xofs_edit -= 4;
- if (text->xofs_edit < 0)
- text->xofs_edit = 0;
- }
-
- if (text->clip_cheight >= 0 &&
- 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;
- }
- if (text->lasty - text->clip_cy < 0 &&
- text->yofs_edit > 0) {
- text->yofs_edit -= 4;
- if (text->yofs_edit < 0)
- text->yofs_edit = 0;
- }
-
- if (old_xofs_edit != text->xofs_edit ||
- old_yofs_edit != text->yofs_edit) {
- 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;
- redraw = TRUE;
- }
- }
-
- 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 (!text->model)
- 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 */
- g_signal_emit_by_name (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(gpointer data, GObject *where_object_was)
-{
- EText *text = data;
- text->tooltip_owner = FALSE;
- g_object_unref (text);
-}
-
-static gboolean
-_do_tooltip (gpointer data)
-{
-#warning "need to sort out tooltip stuff."
- EText *text = E_TEXT (data);
- struct line *lines;
- GtkWidget *canvas;
- int i;
- int 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;
-
- if (E_CANVAS(GNOME_CANVAS_ITEM(text)->canvas)->tooltip_window || text->editing || !text->num_lines) {
- text->tooltip_timeout = 0;
- return FALSE;
- }
-
- cut_off = FALSE;
- for ( i = 0; i < text->num_lines; i++ ) {
- PangoLayoutLine *line = pango_layout_get_line (text->layout, i);
- PangoRectangle rect;
-
- pango_layout_line_get_pixel_extents (line, &rect, NULL);
-
- if (rect.width > text->clip_width) {
- 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 */
- pango_layout_get_size (text->layout, &max_width, NULL);
-
- 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,
- "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);
-
- create_layout (E_TEXT (tooltip_text));
-
- split_into_lines (E_TEXT(tooltip_text));
- calc_height (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)->width,
- NULL);
-
- tooltip_width = E_TEXT(tooltip_text)->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_show (canvas);
- gtk_widget_realize (tooltip_window);
-
- 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));
- g_signal_connect (tooltip_window, "event",
- G_CALLBACK(tooltip_event), text);
- g_object_weak_ref (G_OBJECT (tooltip_window),
- tooltip_destroy, text);
- g_object_ref (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 (!text->model)
- 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) {
- if (text->im_context) {
- if (!text->im_context_signals_registered) {
- g_signal_connect (text->im_context, "commit",
- G_CALLBACK (e_text_commit_cb), text);
- g_signal_connect (text->im_context, "retrieve_surrounding",
- G_CALLBACK (e_text_retrieve_surrounding_cb), text);
- g_signal_connect (text->im_context, "delete_surrounding",
- G_CALLBACK (e_text_delete_surrounding_cb), text);
- text->im_context_signals_registered = TRUE;
- }
- }
- start_editing (text);
- text->show_cursor = FALSE; /* so we'll redraw and the cursor will be shown */
- } else {
- if (text->im_context) {
- g_signal_handlers_disconnect_matched (text->im_context,
- G_SIGNAL_MATCH_DATA,
- 0, 0, NULL,
- NULL, text);
- text->im_context_signals_registered = FALSE;
- }
- e_text_stop_editing (text);
- if (text->timeout_id) {
- g_source_remove(text->timeout_id);
- text->timeout_id = 0;
- }
- if (text->show_cursor || text->draw_borders) {
- text->show_cursor = FALSE;
- text->needs_redraw = 1;
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(text));
- }
- }
- if ( text->line_wrap )
- text->needs_split_into_lines = 1;
- e_canvas_item_request_reflow (GNOME_CANVAS_ITEM(text));
- }
- return_val = 0;
- break;
- case GDK_KEY_PRESS:
-
- /* Handle S-F10 key binding here. */
-
- if (event->key.keyval == GDK_F10
- && (event->key.state & GDK_SHIFT_MASK)
- && text->handle_popup ){
-
- /* Simulate a GdkEventButton here, so that we can call e_text_do_popup directly */
-
- GdkEventButton *button = gdk_event_new (GDK_BUTTON_PRESS);
- button->time = event->key.time;
- button->button = 0;
- e_text_do_popup (text, button, 0);
- return TRUE;
- }
-
- /* Fall Through */
-
- case GDK_KEY_RELEASE:
-
- if (text->editing) {
- GdkEventKey key;
- gint ret;
-
- if (text->im_context && gtk_im_context_filter_keypress (text->im_context, (GdkEventKey*)event)) {
- text->need_im_reset = TRUE;
- return 1;
- }
-
- key = event->key;
- 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)
- g_signal_emit (text, e_text_signals[E_TEXT_KEYPRESS], 0,
- 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;
- }
- 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) {
- if (text->handle_popup) {
- e_text_do_popup (text, &(event->button),
- get_position_from_xy (text, event->button.x, event->button.y));
- return TRUE;
- }
- else {
- 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 ( text->tooltip_count == 0 && text->clip) {
- if (!text->tooltip_timeout)
- text->tooltip_timeout = gtk_timeout_add (1000, _do_tooltip, text);
- }
- text->tooltip_count ++;
- }
-
- 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;
-}
-
-void
-e_text_copy_clipboard (EText *text)
-{
- gint selection_start_pos;
- gint selection_end_pos;
- char *str;
-
- selection_start_pos = MIN (text->selection_start, text->selection_end);
- selection_end_pos = MAX (text->selection_start, text->selection_end);
-
- /* convert sel_start/sel_end to byte indices */
- selection_start_pos = g_utf8_offset_to_pointer (text->text, selection_start_pos) - text->text;
- selection_end_pos = g_utf8_offset_to_pointer (text->text, selection_end_pos) - text->text;
-
- str = g_strndup (text->text + selection_start_pos,
- selection_end_pos - selection_start_pos);
-
- gtk_clipboard_set_text (
-#ifdef GTK_2_2
- gtk_widget_get_clipboard (GTK_WIDGET (GNOME_CANVAS_ITEM (text)->canvas),
- GDK_SELECTION_CLIPBOARD),
-#else
- gtk_clipboard_get (GDK_SELECTION_CLIPBOARD),
-#endif
- str, -1);
- g_free (str);
-}
-
-void
-e_text_delete_selection(EText *text)
-{
- int sel_start, sel_end;
-
- 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_model_delete(text->model, sel_start, sel_end - sel_start);
-}
-
-void
-e_text_cut_clipboard (EText *text)
-{
- e_text_copy_clipboard (text);
- e_text_delete_selection (text);
-}
-
-void
-e_text_paste_clipboard (EText *text)
-{
- ETextEventProcessorCommand command;
-
- command.action = E_TEP_PASTE;
- command.position = E_TEP_SELECTION;
- command.string = "";
- command.value = 0;
- e_text_command(text->tep, &command, text);
-}
-
-void
-e_text_select_all (EText *text)
-{
- ETextEventProcessorCommand command;
-
- command.action = E_TEP_SELECT;
- command.position = E_TEP_SELECT_ALL;
- command.string = "";
- command.value = 0;
- e_text_command(text->tep, &command, text);
-}
-
-
-static void
-primary_get_cb (GtkClipboard *clipboard,
- GtkSelectionData *selection_data,
- guint info,
- gpointer data)
-{
- EText *text = E_TEXT (data);
- int sel_start, sel_end;
-
- sel_start = MIN(text->selection_start, text->selection_end);
- sel_end = MAX(text->selection_start, text->selection_end);
-
- /* convert sel_start/sel_end to byte indices */
- sel_start = g_utf8_offset_to_pointer (text->text, sel_start) - text->text;
- sel_end = g_utf8_offset_to_pointer (text->text, sel_end) - text->text;
-
- if (sel_start != sel_end) {
- gchar *str = g_strndup (text->text + sel_start,
- sel_end - sel_start);
- gtk_selection_data_set_text (selection_data, str, -1);
- g_free (str);
- }
-}
-
-static void
-primary_clear_cb (GtkClipboard *clipboard,
- gpointer data)
-{
- EText *text = E_TEXT (data);
-
-#if notyet
- /* XXX */
- gtk_editable_select_region (GTK_EDITABLE (entry), entry->current_pos, entry->current_pos);
-#endif
-}
-
-static void
-e_text_update_primary_selection (EText *text)
-{
- static const GtkTargetEntry targets[] = {
- { "UTF8_STRING", 0, 0 },
- { "UTF-8", 0, 0 },
- { "STRING", 0, 0 },
- { "TEXT", 0, 0 },
- { "COMPOUND_TEXT", 0, 0 }
- };
- GtkClipboard *clipboard;
-
-#ifdef GTK_2_2
- clipboard = gtk_widget_get_clipboard (GTK_WIDGET (GNOME_CANVAS_ITEM (text)->canvas), GDK_SELECTION_PRIMARY);
-#else
- clipboard = gtk_clipboard_get (GDK_SELECTION_PRIMARY);
-#endif
-
- if (text->selection_start != text->selection_end) {
- if (!gtk_clipboard_set_with_owner (clipboard, targets, G_N_ELEMENTS (targets),
- primary_get_cb, primary_clear_cb, G_OBJECT (text)))
- primary_clear_cb (clipboard, text);
- }
- else {
- if (gtk_clipboard_get_owner (clipboard) == G_OBJECT (text))
- gtk_clipboard_clear (clipboard);
- }
-}
-
-static void
-paste_received (GtkClipboard *clipboard,
- const gchar *text,
- gpointer data)
-{
- EText *etext = E_TEXT (data);
-
- if (text && g_utf8_validate (text, strlen (text), NULL)) {
- if (etext->selection_end != etext->selection_start)
- e_text_delete_selection (etext);
-
- e_text_insert (etext, text);
- }
-
- g_object_unref (etext);
-}
-
-static void
-e_text_paste (EText *text, GdkAtom selection)
-{
- g_object_ref (text);
- gtk_clipboard_request_text (
-#ifdef GTK_2_2
-
- gtk_widget_get_clipboard (GTK_WIDGET (GNOME_CANVAS_ITEM (text)->canvas),
- selection),
-#else
- gtk_clipboard_get (selection),
-#endif
- paste_received, text);
-}
-
-typedef struct {
- EText *text;
- GdkEventButton *button;
- int position;
-} PopupClosure;
-
-static void
-popup_menu_detach (GtkWidget *attach_widget,
- GtkMenu *menu)
-{
-}
-
-static void
-popup_menu_placement_cb (GtkMenu *menu, gint *x, gint *y, gboolean *push_in, gpointer user_data)
-{
- EText *text = E_TEXT(user_data);
- GnomeCanvasItem *item = &text->item;
- GnomeCanvas *parent = item->canvas;
-
- if (parent){
- gdk_window_get_origin (((GtkWidget*) parent)->window, x, y);
- *x += item->x1 + text->width / 2;
- *y += item->y1 + text->height / 2;
- }
-
- return;
-}
-
-static void
-popup_targets_received (GtkClipboard *clipboard,
- GtkSelectionData *data,
- gpointer user_data)
-{
- PopupClosure *closure = user_data;
- EText *text = closure->text;
- GdkEventButton *button = closure->button;
- int position = closure->position;
- GtkWidget *popup_menu = gtk_menu_new ();
- GtkWidget *menuitem, *submenu;
-
- g_free (closure);
-
- gtk_menu_attach_to_widget (GTK_MENU (popup_menu),
- GTK_WIDGET(GNOME_CANVAS_ITEM (text)->canvas),
- popup_menu_detach);
-
- /* cut menu item */
- menuitem = gtk_image_menu_item_new_from_stock (GTK_STOCK_CUT, NULL);
- gtk_widget_show (menuitem);
- gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), menuitem);
- g_signal_connect_swapped (menuitem, "activate",
- G_CALLBACK (e_text_cut_clipboard), text);
- gtk_widget_set_sensitive (menuitem, text->editable && (text->selection_start != text->selection_end));
-
- /* copy menu item */
- menuitem = gtk_image_menu_item_new_from_stock (GTK_STOCK_COPY, NULL);
- gtk_widget_show (menuitem);
- gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), menuitem);
- g_signal_connect_swapped (menuitem, "activate",
- G_CALLBACK (e_text_copy_clipboard), text);
- gtk_widget_set_sensitive (menuitem, text->selection_start != text->selection_end);
-
- /* paste menu item */
- menuitem = gtk_image_menu_item_new_from_stock (GTK_STOCK_PASTE, NULL);
- gtk_widget_show (menuitem);
- gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), menuitem);
- g_signal_connect_swapped (menuitem, "activate",
- G_CALLBACK (e_text_paste_clipboard), text);
- gtk_widget_set_sensitive (menuitem, text->editable && gtk_selection_data_targets_include_text (data));
-
- menuitem = gtk_menu_item_new_with_label (_("Select All"));
- gtk_widget_show (menuitem);
- gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), menuitem);
- g_signal_connect_swapped (menuitem, "activate",
- G_CALLBACK (e_text_select_all), text);
- gtk_widget_set_sensitive (menuitem, strlen (text->text) > 0);
-
- menuitem = gtk_separator_menu_item_new ();
- gtk_widget_show (menuitem);
- gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), menuitem);
-
- if (text->im_context && GTK_IS_IM_MULTICONTEXT (text->im_context)) {
- menuitem = gtk_menu_item_new_with_label (_("Input Methods"));
- gtk_widget_show (menuitem);
- submenu = gtk_menu_new ();
- gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), submenu);
-
- gtk_menu_shell_append (GTK_MENU_SHELL (popup_menu), menuitem);
-
- gtk_im_multicontext_append_menuitems (GTK_IM_MULTICONTEXT (text->im_context),
- GTK_MENU_SHELL (submenu));
- }
-
- g_signal_emit (text,
- e_text_signals[E_TEXT_POPULATE_POPUP],
- 0,
- button, position,
- popup_menu);
-
- /* If invoked by S-F10 key binding, button will be 0. */
- if (button->button == 0){
- gtk_menu_popup (GTK_MENU (popup_menu), NULL, NULL,
- popup_menu_placement_cb, (gpointer)text,
- button->button, GDK_CURRENT_TIME);
- gdk_event_free (button);
- } else {
- gtk_menu_popup (GTK_MENU (popup_menu), NULL, NULL,
- NULL, NULL,
- button->button, GDK_CURRENT_TIME);
- }
-
- g_object_unref (text);
-}
-
-static void
-e_text_do_popup (EText *text, GdkEventButton *button, int position)
-{
- PopupClosure *closure = g_new (PopupClosure, 1);
-
- closure->text = text;
- g_object_ref (closure->text);
- closure->button = button;
- closure->position = position;
-
- gtk_clipboard_request_contents (
-#ifdef GTK_2_2
-
- gtk_widget_get_clipboard (GTK_WIDGET (GNOME_CANVAS_ITEM (text)->canvas),
- GDK_SELECTION_CLIPBOARD),
-#else
- gtk_clipboard_get (GDK_SELECTION_CLIPBOARD),
-#endif
- gdk_atom_intern ("TARGETS", FALSE),
- popup_targets_received,
- closure);
-}
-
-static void
-e_text_reset_im_context (EText *text)
-{
- if (text->need_im_reset) {
- text->need_im_reset = 0;
- gtk_im_context_reset (text->im_context);
- }
-}
-
-/* fixme: */
-
-static int
-next_word (EText *text, int start)
-{
- char *p = g_utf8_offset_to_pointer (text->text, start);
- int length;
-
- length = g_utf8_strlen (text->text, -1);
-
- if (start >= length) {
- return length;
- } else {
- p = g_utf8_next_char (p);
- start++;
-
- while (p && *p) {
- gunichar unival = g_utf8_get_char (p);
- if (g_unichar_isspace (unival)) {
- return start + 1;
- }
- else {
- p = g_utf8_next_char (p);
- start++;
- }
- }
- }
-
- return g_utf8_pointer_to_offset (text->text, p);
-}
-
-static int
-find_offset_into_line (EText *text, int offset_into_text, char **start_of_line)
-{
- char *p;
-
- p = g_utf8_offset_to_pointer (text->text, offset_into_text);
-
- if (p == text->text) {
- if (start_of_line)
- *start_of_line = (char*)text->text;
- return 0;
- }
- else {
- p = g_utf8_find_prev_char (text->text, p);
-
- while (p && p > text->text) {
- if (*p == '\n') {
- if (start_of_line)
- *start_of_line = p+1;
- return offset_into_text - g_utf8_pointer_to_offset (text->text, p + 1);
- }
- p = g_utf8_find_prev_char (text->text, p);
- }
-
- if (start_of_line)
- *start_of_line = (char*)text->text;
- return offset_into_text;
- }
-}
-
-static int
-_get_position(EText *text, ETextEventProcessorCommand *command)
-{
- int length, obj_num;
- gunichar unival;
- char *p = NULL;
- gint new_pos = 0;
- int index, trailing;
-
- 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:
-
- if (text->selection_end >= 1) {
-
- p = g_utf8_offset_to_pointer (text->text, text->selection_end);
- if (p != text->text) {
- p = g_utf8_find_prev_char (text->text, p);
- while (p && p > text->text) {
- if (*p == '\n') {
- new_pos = g_utf8_pointer_to_offset (text->text, p) + 1;
- break;
- }
- p = g_utf8_find_prev_char (text->text, p);
- }
- }
- }
-
- break;
-
- case E_TEP_END_OF_LINE:
- new_pos = -1;
- length = g_utf8_strlen (text->text, -1);
-
- if (text->selection_end >= length) {
- new_pos = length;
- } else {
-
- p = g_utf8_offset_to_pointer (text->text, text->selection_end);
-
- while (p && *p) {
- if (*p == '\n') {
- new_pos = g_utf8_pointer_to_offset (text->text, p);
- p = NULL;
- } else
- p = g_utf8_next_char (p);
- }
- }
-
- if (new_pos == -1)
- new_pos = g_utf8_pointer_to_offset (text->text, p);
-
- break;
-
- case E_TEP_FORWARD_CHARACTER:
- length = g_utf8_strlen (text->text, -1);
-
- if (text->selection_end >= length)
- new_pos = length;
- else
- new_pos = text->selection_end + 1;
-
- break;
-
- case E_TEP_BACKWARD_CHARACTER:
- new_pos = 0;
- if (text->selection_end >= 1) {
- new_pos = text->selection_end - 1;
- }
-
- 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) {
- int pos = text->selection_end;
-
- p = g_utf8_find_prev_char (text->text, g_utf8_offset_to_pointer (text->text, text->selection_end));
- pos --;
-
- if (p != text->text) {
- p = g_utf8_find_prev_char (text->text, p);
- pos --;
-
- while (p && p > text->text) {
- unival = g_utf8_get_char (p);
- if (g_unichar_isspace (unival)) {
- new_pos = pos + 1;
- p = NULL;
- }
- else {
- p = g_utf8_find_prev_char (text->text, p);
- pos --;
- }
- }
- }
- }
-
- break;
-
- case E_TEP_FORWARD_LINE: {
- int l;
- PangoLayoutLine *line, *next_line;
- int offset_into_line;
- int next_line_length;
- char *p;
-
- offset_into_line = find_offset_into_line (text, text->selection_end, NULL);
- if (offset_into_line == -1)
- return text->selection_end;
-
- /* now we search forward til we hit a \n, and then
- offset_into_line more characters */
- p = g_utf8_offset_to_pointer (text->text, text->selection_end);
- while (p && *p) {
- if (*p == '\n')
- break;
- p = g_utf8_next_char (p);
- }
- if (p && *p == '\n') {
- /* now we loop forward offset_into_line
- characters, or until we hit \n or \0 */
-
- p = g_utf8_next_char (p);
- while (offset_into_line > 0 && p && *p != '\n' && *p != '\0') {
- p = g_utf8_next_char (p);
- offset_into_line --;
- }
- }
-
- /* at this point, p points to the new location,
- convert it to an offset and we're done */
- new_pos = g_utf8_pointer_to_offset (text->text, p);
- break;
- }
- case E_TEP_BACKWARD_LINE: {
- char *p, *prev = NULL;
- int offset_into_line = find_offset_into_line (text, text->selection_end, &p);
-
- if (offset_into_line == -1)
- return text->selection_end;
-
- /* p points to the first character on our line. if we
- have a \n before it, skip it and scan til we hit
- the next one */
- if (p != text->text) {
- p = g_utf8_find_prev_char (text->text, p);
- if (*p == '\n') {
- p = g_utf8_find_prev_char (text->text, p);
- while (p > text->text) {
- if (*p == '\n') {
- p ++;
- break;
- }
- p = g_utf8_find_prev_char (text->text, p);
- }
- }
- }
-
- /* at this point 'p' points to the start of the
- previous line, move forward 'offset_into_line'
- times. */
-
- while (offset_into_line > 0 && p && *p != '\n' && *p != '\0') {
- p = g_utf8_next_char (p);
- offset_into_line --;
- }
-
- /* at this point, p points to the new location,
- convert it to an offset and we're done */
- new_pos = g_utf8_pointer_to_offset (text->text, p);
- 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_offset_to_pointer (text->text, text->selection_end);
-
- p = g_utf8_find_prev_char (text->text, p);
-
- while (p && p > text->text) {
- 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 = g_utf8_pointer_to_offset (text->text, p);
-
-
- text->selection_start = e_text_model_validate_position (text->model, text->selection_start);
-
- length = g_utf8_strlen (text->text, -1);
- if (text->selection_end >= length) {
- new_pos = length;
- break;
- }
-
- p = g_utf8_offset_to_pointer (text->text, text->selection_end);
- while (p && *p) {
- unival = g_utf8_get_char (p);
- if (g_unichar_isspace (unival)) {
- new_pos = g_utf8_pointer_to_offset (text->text, p);
- break;
- } else
- p = g_utf8_next_char (p);
- }
-
- if (!new_pos)
- new_pos = g_utf8_strlen (text->text, -1);
-
- return new_pos;
-
- case E_TEP_SELECT_ALL:
- text->selection_start = 0;
- new_pos = g_utf8_strlen (text->text, -1);
- 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
-e_text_insert(EText *text, const char *string)
-{
- int len = strlen (string);
-
- if (len > 0) {
- int utf8len = 0;
-
- if (!text->allow_newlines) {
- const char *i;
- char *new_string = g_malloc (len + 1);
- char *j = new_string;
-
- for (i = string; *i; i = g_utf8_next_char(i)) {
- if (*i != '\n') {
- gunichar c;
- int charlen;
-
- c = g_utf8_get_char (i);
- charlen = g_unichar_to_utf8 (c, j);
- j += charlen;
- utf8len++;
- }
- }
- *j = 0;
- e_text_model_insert_length(text->model, text->selection_start, new_string, utf8len);
- g_free (new_string);
- }
- else {
- utf8len = g_utf8_strlen (string, -1);
- e_text_model_insert_length(text->model, text->selection_start, string, utf8len);
- }
- }
-}
-
-static void
-capitalize (EText *text, int start, int end, ETextEventProcessorCaps type)
-{
- gboolean first = TRUE;
- const char *p = g_utf8_offset_to_pointer (text->text, start);
- const char *text_end = g_utf8_offset_to_pointer (text->text, end);
- int utf8len = text_end - p;
- char *new_text = g_new0 (char, utf8len * 6);
- char *output = new_text;
-
- while (p && *p && p < text_end) {
- 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, utf8len);
- e_text_model_insert_length (text->model, start, new_text, utf8len);
- 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;
- gboolean use_start = 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);
- }
-
- use_start = TRUE;
- 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);
-
- e_text_update_primary_selection (text);
-
- use_start = FALSE;
-
- break;
- case E_TEP_DELETE:
- if (text->selection_end == text->selection_start) {
- text->selection_end = _get_position(text, command);
- }
- e_text_delete_selection(text);
- if (text->timer) {
- g_timer_reset(text->timer);
- }
-
- use_start = FALSE;
-
- break;
-
- case E_TEP_INSERT:
- if (g_utf8_validate (command->string, command->value, NULL)) {
- if (text->selection_end != text->selection_start) {
- e_text_delete_selection(text);
- }
- e_text_insert(text, command->string);
- if (text->timer) {
- g_timer_reset(text->timer);
- }
- }
- break;
- case E_TEP_COPY:
- e_text_copy_clipboard (text);
-
- if (text->timer) {
- g_timer_reset(text->timer);
- }
- scroll = FALSE;
- break;
- case E_TEP_PASTE:
- e_text_paste (text, GDK_NONE);
- if (text->timer) {
- g_timer_reset(text->timer);
- }
- break;
- case E_TEP_GET_SELECTION:
- e_text_paste (text, GDK_SELECTION_PRIMARY);
- break;
- case E_TEP_ACTIVATE:
- g_signal_emit (text, e_text_signals[E_TEXT_ACTIVATE], 0);
- 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:
- e_canvas_item_grab (E_CANVAS (GNOME_CANVAS_ITEM(text)->canvas),
- GNOME_CANVAS_ITEM(text),
- GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK,
- text->i_cursor,
- command->time,
- NULL,
- NULL);
- scroll = FALSE;
- break;
- case E_TEP_UNGRAB:
- e_canvas_item_ungrab (E_CANVAS (GNOME_CANVAS_ITEM(text)->canvas),
- 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 = MAX (text->selection_start, text->selection_end);
- capitalize (text, selection_start, selection_end, command->value);
- }
- break;
- case E_TEP_NOP:
- scroll = FALSE;
- break;
- }
-
- if (scroll && !text->button_down) {
- /* XXX do we really need the @trailing logic here? if
- we don't we can scrap the loop and just use
- pango_layout_index_to_pos */
- int i;
- PangoLayoutLine *cur_line = NULL;
- int selection_index;
- PangoLayoutIter *iter = pango_layout_get_iter (text->layout);
-
- selection_index = use_start ? text->selection_start : text->selection_end;
- /* convert to a byte index */
- selection_index = g_utf8_offset_to_pointer (text->text, selection_index) - text->text;
-
- do {
- PangoLayoutLine *line = pango_layout_iter_get_line (iter);
-
- if (selection_index >= line->start_index && selection_index <= line->start_index + line->length) {
- /* found the line with the start of the selection */
- cur_line = line;
- break;
- }
-
- } while (pango_layout_iter_next_line (iter));
-
- if (cur_line) {
- int xpos, ypos;
- double clip_width, clip_height;
- gboolean trailing = FALSE;
- PangoRectangle pango_pos;
-
- if (selection_index > 0 && selection_index == cur_line->start_index + cur_line->length) {
- selection_index--;
- trailing = TRUE;
- }
-
- pango_layout_index_to_pos (text->layout, selection_index, &pango_pos);
-
- pango_pos.x = PANGO_PIXELS (pango_pos.x);
- pango_pos.y = PANGO_PIXELS (pango_pos.y);
- pango_pos.width = (pango_pos.width + PANGO_SCALE / 2) / PANGO_SCALE;
- pango_pos.height = (pango_pos.height + PANGO_SCALE / 2) / PANGO_SCALE;
-
- /* scroll for X */
- xpos = pango_pos.x; /* + (trailing ? 0 : pango_pos.width);*/
-
- if (xpos + 2 < text->xofs_edit) {
- text->xofs_edit = xpos;
- }
-
- clip_width = text->clip_width;
- if (clip_width >= 0 && text->draw_borders) {
- clip_width -= 6;
- if (clip_width < 0)
- clip_width = 0;
- }
-
- if (xpos + pango_pos.width - clip_width > text->xofs_edit) {
- text->xofs_edit = xpos + pango_pos.width - clip_width;
- }
-
- /* scroll for Y */
- if (pango_pos.y + 2 < text->yofs_edit) {
- ypos = pango_pos.y;
- text->yofs_edit = ypos;
- }
- else {
- ypos = pango_pos.y + pango_pos.height;
- }
-
- if ( text->clip_height < 0 )
- clip_height = text->height;
- else
- clip_height = text->clip_height;
-
- if (clip_height >= 0 && text->draw_borders) {
- clip_height -= 6;
- if (clip_height < 0)
- clip_height = 0;
- }
-
- if (ypos - clip_height > text->yofs_edit) {
- text->yofs_edit = ypos - clip_height;
- }
-
- }
-
- pango_layout_iter_free (iter);
- }
-
- text->needs_redraw = 1;
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(text));
-}
-
-
-/* Class initialization function for the text item */
-static void
-e_text_class_init (ETextClass *klass)
-{
- GObjectClass *gobject_class;
- GnomeCanvasItemClass *item_class;
-
- gobject_class = (GObjectClass *) klass;
- item_class = (GnomeCanvasItemClass *) klass;
-
- parent_class = g_type_class_ref (PARENT_TYPE);
-
- gobject_class->dispose = e_text_dispose;
- gobject_class->set_property = e_text_set_property;
- gobject_class->get_property = e_text_get_property;
-
- 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->event = e_text_event;
-
- klass->changed = NULL;
- klass->activate = NULL;
-
- e_text_signals[E_TEXT_CHANGED] =
- g_signal_new ("changed",
- G_OBJECT_CLASS_TYPE (gobject_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETextClass, changed),
- NULL, NULL,
- e_marshal_NONE__NONE,
- G_TYPE_NONE, 0);
-
- e_text_signals[E_TEXT_ACTIVATE] =
- g_signal_new ("activate",
- G_OBJECT_CLASS_TYPE (gobject_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETextClass, activate),
- NULL, NULL,
- e_marshal_NONE__NONE,
- G_TYPE_NONE, 0);
-
- e_text_signals[E_TEXT_KEYPRESS] =
- g_signal_new ("keypress",
- G_OBJECT_CLASS_TYPE (gobject_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETextClass, keypress),
- NULL, NULL,
- e_marshal_NONE__INT_INT,
- G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_UINT);
-
- e_text_signals[E_TEXT_POPULATE_POPUP] =
- g_signal_new ("populate_popup",
- G_OBJECT_CLASS_TYPE (gobject_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETextClass, populate_popup),
- NULL, NULL,
- e_marshal_NONE__POINTER_INT_OBJECT,
- G_TYPE_NONE, 3, G_TYPE_POINTER, G_TYPE_INT, GTK_TYPE_MENU);
-
- g_object_class_install_property (gobject_class, PROP_MODEL,
- g_param_spec_object ("model",
- _( "Model" ),
- _( "Model" ),
- E_TYPE_TEXT_MODEL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (gobject_class, PROP_EVENT_PROCESSOR,
- g_param_spec_object ("event_processor",
- _( "Event Processor" ),
- _( "Event Processor" ),
- E_TEXT_EVENT_PROCESSOR_TYPE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (gobject_class, PROP_TEXT,
- g_param_spec_string ("text",
- _( "Text" ),
- _( "Text" ),
- NULL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (gobject_class, PROP_BOLD,
- g_param_spec_boolean ("bold",
- _( "Bold" ),
- _( "Bold" ),
- FALSE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (gobject_class, PROP_STRIKEOUT,
- g_param_spec_boolean ("strikeout",
- _( "Strikeout" ),
- _( "Strikeout" ),
- FALSE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (gobject_class, PROP_ANCHOR,
- g_param_spec_enum ("anchor",
- _( "Anchor" ),
- _( "Anchor" ),
- GTK_TYPE_ANCHOR_TYPE, GTK_ANCHOR_CENTER,
- G_PARAM_READWRITE));
-
-
- g_object_class_install_property (gobject_class, PROP_JUSTIFICATION,
- g_param_spec_enum ("justification",
- _( "Justification" ),
- _( "Justification" ),
- GTK_TYPE_JUSTIFICATION, GTK_JUSTIFY_LEFT,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (gobject_class, PROP_CLIP_WIDTH,
- g_param_spec_double ("clip_width",
- _( "Clip Width" ),
- _( "Clip Width" ),
- 0.0, G_MAXDOUBLE, 0.0,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (gobject_class, PROP_CLIP_HEIGHT,
- g_param_spec_double ("clip_height",
- _( "Clip Height" ),
- _( "Clip Height" ),
- 0.0, G_MAXDOUBLE, 0.0,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (gobject_class, PROP_CLIP,
- g_param_spec_boolean ("clip",
- _( "Clip" ),
- _( "Clip" ),
- FALSE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (gobject_class, PROP_FILL_CLIP_RECTANGLE,
- g_param_spec_boolean ("fill_clip_rectangle",
- _( "Fill clip rectangle" ),
- _( "Fill clip rectangle" ),
- FALSE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (gobject_class, PROP_X_OFFSET,
- g_param_spec_double ("x_offset",
- _( "X Offset" ),
- _( "X Offset" ),
- 0.0, G_MAXDOUBLE, 0.0,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (gobject_class, PROP_Y_OFFSET,
- g_param_spec_double ("y_offset",
- _( "Y Offset" ),
- _( "Y Offset" ),
- 0.0, G_MAXDOUBLE, 0.0,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (gobject_class, PROP_FILL_COLOR,
- g_param_spec_string ("fill_color",
- _( "Fill color" ),
- _( "Fill color" ),
- NULL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (gobject_class, PROP_FILL_COLOR_GDK,
- g_param_spec_boxed ("fill_color_gdk",
- _( "GDK fill color" ),
- _( "GDK fill color" ),
- GDK_TYPE_COLOR,
- G_PARAM_READWRITE));
-
-
- g_object_class_install_property (gobject_class, PROP_FILL_COLOR_RGBA,
- g_param_spec_uint ("fill_color_rgba",
- _( "GDK fill color" ),
- _( "GDK fill color" ),
- 0, G_MAXUINT, 0,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (gobject_class, PROP_FILL_STIPPLE,
- g_param_spec_object ("fill_stipple",
- _( "Fill stipple" ),
- _( "Fill stipple" ),
- GDK_TYPE_DRAWABLE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (gobject_class, PROP_TEXT_WIDTH,
- g_param_spec_double ("text_width",
- _( "Text width" ),
- _( "Text width" ),
- 0.0, G_MAXDOUBLE, 0.0,
- G_PARAM_READABLE));
-
- g_object_class_install_property (gobject_class, PROP_TEXT_HEIGHT,
- g_param_spec_double ("text_height",
- _( "Text height" ),
- _( "Text height" ),
- 0.0, G_MAXDOUBLE, 0.0,
- G_PARAM_READABLE));
-
-
- g_object_class_install_property (gobject_class, PROP_EDITABLE,
- g_param_spec_boolean ("editable",
- _( "Editable" ),
- _( "Editable" ),
- FALSE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (gobject_class, PROP_USE_ELLIPSIS,
- g_param_spec_boolean ("use_ellipsis",
- _( "Use ellipsis" ),
- _( "Use ellipsis" ),
- FALSE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (gobject_class, PROP_ELLIPSIS,
- g_param_spec_string ("ellipsis",
- _( "Ellipsis" ),
- _( "Ellipsis" ),
- NULL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (gobject_class, PROP_LINE_WRAP,
- g_param_spec_boolean ("line_wrap",
- _( "Line wrap" ),
- _( "Line wrap" ),
- FALSE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (gobject_class, PROP_BREAK_CHARACTERS,
- g_param_spec_string ("break_characters",
- _( "Break characters" ),
- _( "Break characters" ),
- NULL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (gobject_class, PROP_MAX_LINES,
- g_param_spec_int ("max_lines",
- _( "Max lines" ),
- _( "Max lines" ),
- 0, G_MAXINT, 0,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (gobject_class, PROP_WIDTH,
- g_param_spec_double ("width",
- _( "Width" ),
- _( "Width" ),
- 0.0, G_MAXDOUBLE, 0.0,
- G_PARAM_READWRITE));
-
-
- g_object_class_install_property (gobject_class, PROP_HEIGHT,
- g_param_spec_double ("height",
- _( "Height" ),
- _( "Height" ),
- 0.0, G_MAXDOUBLE, 0.0,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (gobject_class, PROP_DRAW_BORDERS,
- g_param_spec_boolean ("draw_borders",
- _( "Draw borders" ),
- _( "Draw borders" ),
- FALSE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (gobject_class, PROP_ALLOW_NEWLINES,
- g_param_spec_boolean ("allow_newlines",
- _( "Allow newlines" ),
- _( "Allow newlines" ),
- FALSE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (gobject_class, PROP_DRAW_BACKGROUND,
- g_param_spec_boolean ("draw_background",
- _( "Draw background" ),
- _( "Draw background" ),
- FALSE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (gobject_class, PROP_DRAW_BUTTON,
- g_param_spec_boolean ("draw_button",
- _( "Draw button" ),
- _( "Draw button" ),
- FALSE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (gobject_class, PROP_CURSOR_POS,
- g_param_spec_int ("cursor_pos",
- _( "Cursor position" ),
- _( "Cursor position" ),
- 0, G_MAXINT, 0,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (gobject_class, PROP_IM_CONTEXT,
- g_param_spec_object ("im_context",
- _( "IM Context" ),
- _( "IM Context" ),
- GTK_TYPE_IM_CONTEXT,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (gobject_class, PROP_HANDLE_POPUP,
- g_param_spec_boolean ("handle_popup",
- _( "Handle Popup" ),
- _( "Handle Popup" ),
- FALSE,
- G_PARAM_READWRITE));
-
- if (!clipboard_atom)
- clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE);
-
- atk_registry_set_factory_type (atk_get_default_registry (),
- E_TYPE_TEXT,
- gal_a11y_e_text_factory_get_type ());
-
-}
-
-/* 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->layout = NULL;
-
- text->revert = NULL;
-
- text->model_changed_signal_id =
- g_signal_connect (text->model,
- "changed",
- G_CALLBACK (e_text_text_model_changed),
- text);
- text->model_repos_signal_id =
- g_signal_connect (text->model,
- "reposition",
- G_CALLBACK (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->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->allow_newlines = TRUE;
-
- text->last_type_request = -1;
- d(g_print ("Setting last_type_request to %d at line %d\n", text->last_type_request, __LINE__));
- text->last_time_request = 0;
- text->queued_requests = NULL;
-
- text->im_context = NULL;
- text->need_im_reset = FALSE;
- text->im_context_signals_registered = FALSE;
-
- text->handle_popup = FALSE;
-
-
- e_canvas_item_set_reflow_callback(GNOME_CANVAS_ITEM(text), e_text_reflow);
-}
-
-/**
- * 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.
- **/
-E_MAKE_TYPE (e_text,
- "EText",
- EText,
- e_text_class_init,
- e_text_init,
- PARENT_TYPE)
-
-
-/* IM Context Callbacks */
-static void
-e_text_commit_cb (GtkIMContext *context,
- const gchar *str,
- EText *text)
-{
- if (g_utf8_validate (str, strlen (str), NULL)) {
- if (text->selection_end != text->selection_start)
- e_text_delete_selection (text);
- e_text_insert (text, str);
- g_signal_emit (text, e_text_signals[E_TEXT_KEYPRESS], 0,
- 0 /* XXX ugh */, 0 /* XXX ugh */);
- }
-}
-
-static gboolean
-e_text_retrieve_surrounding_cb (GtkIMContext *context,
- EText *text)
-{
- printf ("e_text_retrieve_surrounding_cb\n");
- gtk_im_context_set_surrounding (context,
- text->text,
- strlen (text->text),
- g_utf8_offset_to_pointer (text->text, text->selection_start) - text->text);
-
- return TRUE;
-}
-
-static gboolean
-e_text_delete_surrounding_cb (GtkIMContext *context,
- gint offset,
- gint n_chars,
- EText *text)
-{
- printf ("e_text_delete_surrounding_cb\n");
-#if 0
- gtk_editable_delete_text (GTK_EDITABLE (entry),
- entry->current_pos + offset,
- entry->current_pos + offset + n_chars);
-#endif
-
- return TRUE;
-}
diff --git a/widgets/text/e-text.h b/widgets/text/e-text.h
deleted file mode 100644
index 0832c5d699..0000000000
--- a/widgets/text/e-text.h
+++ /dev/null
@@ -1,243 +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/gtkmenu.h>
-
-#include <gal/util/e-text-event-processor.h>
-#include <gal/e-text/e-text-model.h>
-#include <gal/widgets/e-canvas.h>
-
-G_BEGIN_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
- * 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) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_TEXT, EText))
-#define E_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_TEXT, ETextClass))
-#define E_IS_TEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_TEXT))
-#define E_IS_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_TEXT))
-
-
-typedef struct _EText EText;
-typedef struct _ETextClass ETextClass;
-
-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 */
- PangoLayout *layout;
- int num_lines; /* Number of lines of text */
-
- gchar *revert; /* Text to revert to */
-
- 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 text_cx, text_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 */
-
- 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;
-
- gboolean has_selection; /* TRUE if we have the selection */
-
- 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_split_into_lines : 1; /* Needs split_into_lines */
- guint needs_reset_layout : 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 */
-
- 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. */
- GdkAtom last_selection_request; /* The time of the last selection request. */
- GList *queued_requests; /* Queued selection requests. */
-
- GtkIMContext *im_context;
- gboolean need_im_reset;
- gboolean im_context_signals_registered;
-
- gboolean handle_popup;
-};
-
-struct _ETextClass {
- GnomeCanvasItemClass parent_class;
-
- void (* changed) (EText *text);
- void (* activate) (EText *text);
- void (* keypress) (EText *text, guint keyval, guint state);
- void (* populate_popup) (EText *text, GdkEventButton *ev, gint pos, GtkMenu *menu);
- void (* style_set) (EText *text, GtkStyle *previous_style);
-};
-
-
-/* Standard Gtk function */
-GtkType e_text_get_type (void);
-void e_text_cancel_editing (EText *text);
-void e_text_stop_editing (EText *text);
-
-void e_text_delete_selection (EText *text);
-void e_text_cut_clipboard (EText *text);
-void e_text_copy_clipboard (EText *text);
-void e_text_paste_clipboard (EText *text);
-void e_text_select_all (EText *text);
-
-G_END_DECLS
-
-#endif
diff --git a/wombat/ChangeLog b/wombat/ChangeLog
index f3b0124776..98da89841a 100644
--- a/wombat/ChangeLog
+++ b/wombat/ChangeLog
@@ -1,3 +1,12 @@
+2003-08-13 JP Rosevear <jpr@ximian.com>
+
+ * wombat.c (termination_handler): comment out some bits
+ (setup_pcs): register kind and method
+
+ * GNOME_Evolution_Wombat.server.in.in: add calendar protocol
+
+ * GNOME_Evolution_WombatLDAP.server.in.in: ditto
+
2003-06-26 Rodrigo Moya <rodrigo@ximian.com>
* Evolution-Wombat.idl: removed WombatClient interface.
diff --git a/wombat/GNOME_Evolution_WombatLDAP.server.in.in b/wombat/GNOME_Evolution_WombatLDAP.server.in.in
index 714763b8ac..6e6e02bc80 100644
--- a/wombat/GNOME_Evolution_WombatLDAP.server.in.in
+++ b/wombat/GNOME_Evolution_WombatLDAP.server.in.in
@@ -30,6 +30,9 @@
<oaf_attribute name="name" type="string"
_value="Evolution Calendar local file backend"/>
+ <oaf_attribute name="calendar:supported_protocols" type="stringv">
+ <item value="file"/>
+ </oaf_attribute>
</oaf_server>
<oaf_server iid="OAFIID:GNOME_Evolution_Wombat_InterfaceCheck"
diff --git a/wombat/wombat.c b/wombat/wombat.c
index 563579f370..27e20d36fb 100644
--- a/wombat/wombat.c
+++ b/wombat/wombat.c
@@ -31,7 +31,8 @@
#include "pas/pas-backend-file.h"
#include "calendar/pcs/cal-factory.h"
-#include "calendar/pcs/cal-backend-file.h"
+#include "calendar/pcs/cal-backend-file-events.h"
+#include "calendar/pcs/cal-backend-file-todos.h"
#include "wombat-interface-check.h"
@@ -65,7 +66,7 @@ static gboolean
termination_handler (gpointer data)
{
if (
- cal_factory_get_n_backends (cal_factory) == 0 &&
+// cal_factory_get_n_backends (cal_factory) == 0 &&
pas_book_factory_get_n_backends (pas_book_factory) == 0) {
fprintf (stderr, "termination_handler(): Terminating the Wombat. Have a nice day.\n");
bonobo_main_quit ();
@@ -144,9 +145,10 @@ setup_pcs (void)
return FALSE;
}
- cal_factory_register_method (cal_factory, "file", CAL_BACKEND_FILE_TYPE);
+ cal_factory_register_method (cal_factory, "file", ICAL_VEVENT_COMPONENT, CAL_BACKEND_FILE_EVENTS_TYPE);
+ cal_factory_register_method (cal_factory, "file", ICAL_VTODO_COMPONENT, CAL_BACKEND_FILE_TODOS_TYPE);
- if (!cal_factory_oaf_register (cal_factory, CAL_FACTORY_OAF_ID)) {
+ if (!cal_factory_register_storage (cal_factory, CAL_FACTORY_OAF_ID)) {
bonobo_object_unref (BONOBO_OBJECT (cal_factory));
cal_factory = NULL;
return FALSE;