aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog154
-rw-r--r--NEWS97
-rw-r--r--README4
-rw-r--r--acconfig.h5
-rw-r--r--addressbook/ChangeLog1135
-rw-r--r--addressbook/backend/ebook/e-card.c934
-rw-r--r--addressbook/backend/ebook/evolution-ldif-importer.c39
-rw-r--r--addressbook/backend/ebook/evolution-vcard-importer.c19
-rw-r--r--addressbook/backend/pas/pas-backend-file.c131
-rw-r--r--addressbook/backend/pas/pas-backend-ldap.c209
-rw-r--r--addressbook/gui/component/select-names/e-select-names.c376
-rw-r--r--addressbook/gui/component/select-names/e-select-names.h21
-rw-r--r--addressbook/gui/component/select-names/select-names.glade889
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor-address.c173
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor-fullname.c156
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.c898
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.h22
-rw-r--r--addressbook/gui/contact-editor/fulladdr.glade867
-rw-r--r--addressbook/gui/contact-editor/fullname.glade1047
-rw-r--r--addressbook/gui/widgets/e-addressbook-reflow-adapter.c264
-rw-r--r--art/ChangeLog5
-rw-r--r--art/about-box.pngbin41928 -> 38129 bytes
-rw-r--r--art/splash.pngbin112938 -> 46245 bytes
-rw-r--r--calendar/ChangeLog469
-rw-r--r--calendar/cal-client/cal-client.c328
-rw-r--r--calendar/cal-util/cal-component.c62
-rw-r--r--calendar/gui/dialogs/comp-editor-util.c29
-rw-r--r--calendar/gui/dialogs/event-editor.c32
-rw-r--r--calendar/gui/dialogs/meeting-page.c63
-rw-r--r--calendar/gui/e-calendar-table.c187
-rw-r--r--calendar/gui/e-day-view.c322
-rw-r--r--calendar/gui/e-itip-control.c441
-rw-r--r--calendar/gui/e-meeting-model.c97
-rw-r--r--calendar/gui/e-week-view.c191
-rw-r--r--calendar/gui/itip-utils.c79
-rw-r--r--calendar/pcs/cal-backend-file.c219
-rw-r--r--camel/ChangeLog275
-rw-r--r--camel/camel-mime-filter-tohtml.c581
-rw-r--r--camel/camel-mime-filter-tohtml.h8
-rw-r--r--camel/camel-tcp-stream-ssl.c57
-rw-r--r--camel/providers/imap/camel-imap-store-summary.c4
-rw-r--r--composer/ChangeLog191
-rw-r--r--composer/e-msg-composer.c627
-rw-r--r--composer/evolution-composer.c59
-rw-r--r--configure.in293
-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/ChangeLog138
-rw-r--r--e-util/e-bit-array.c429
-rw-r--r--e-util/e-bit-array.h104
-rw-r--r--e-util/e-i18n.h75
-rw-r--r--e-util/e-iconv.c496
-rw-r--r--e-util/e-iconv.h44
-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.c1153
-rw-r--r--e-util/e-util.h221
-rw-r--r--e-util/e-xml-utils.c443
-rw-r--r--e-util/e-xml-utils.h99
-rw-r--r--filter/ChangeLog175
-rw-r--r--filter/rule-editor.c505
-rw-r--r--help/C/Makefile.am43
-rw-r--r--help/C/apx-authors.sgml74
-rw-r--r--help/C/apx-fdl.sgml667
-rw-r--r--help/C/apx-gpl.sgml417
-rw-r--r--help/C/config-prefs.sgml908
-rw-r--r--help/C/evolution-C.omf22
-rw-r--r--help/C/evolution.sgml111
-rw-r--r--help/C/preface.sgml411
-rw-r--r--help/ChangeLog24
-rw-r--r--help/devel/executive-summary/evolution-services.hierarchy7
-rw-r--r--help/devel/importer/evolution-shell-importer.hierarchy7
-rw-r--r--help/no/evolution-no.omf4
-rw-r--r--libibex/TODO61
-rw-r--r--libical/ChangeLog9
-rwxr-xr-xlibical/scripts/mkderivedparameters.pl4
-rw-r--r--libical/src/libical/icalperiod.c5
-rw-r--r--libical/src/libical/icalyacc.y2
-rw-r--r--mail/ChangeLog616
-rw-r--r--mail/component-factory.c171
-rw-r--r--mail/mail-accounts.c141
-rw-r--r--mail/mail-callbacks.c850
-rw-r--r--mail/mail-composer-prefs.c336
-rw-r--r--mail/mail-display.c606
-rw-r--r--mail/mail-preferences.c289
-rw-r--r--shell/ChangeLog1358
-rw-r--r--shell/Makefile.am79
-rw-r--r--shell/e-component-info.c10
-rw-r--r--shell/e-corba-storage-registry.c119
-rw-r--r--shell/e-shell-config-default-folders.c97
-rw-r--r--shell/e-shell-folder-title-bar.c95
-rw-r--r--shell/e-shell-settings-dialog.c74
-rw-r--r--shell/e-shell-user-creatable-items-handler.c82
-rw-r--r--shell/e-storage-set-view.c282
-rw-r--r--shell/e-storage.c74
-rw-r--r--shell/main.c317
-rw-r--r--tools/Makefile.am38
-rw-r--r--tools/evolution-launch-composer.c356
-rw-r--r--ui/ChangeLog20
-rw-r--r--ui/evolution-mail-message.xml2
-rw-r--r--widgets/menus/gal-define-views-dialog.c337
-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.glade287
-rw-r--r--widgets/menus/gal-view-collection.c814
-rw-r--r--widgets/menus/gal-view-collection.h151
-rw-r--r--widgets/menus/gal-view-etable.c302
-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.c588
-rw-r--r--widgets/menus/gal-view-instance.h116
-rw-r--r--widgets/menus/gal-view-new-dialog.c283
-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.c203
-rw-r--r--widgets/menus/gal-view.h97
-rw-r--r--widgets/misc/ChangeLog227
-rw-r--r--widgets/misc/e-calendar-item.c91
-rw-r--r--widgets/misc/e-canvas-background.c495
-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.c1168
-rw-r--r--widgets/misc/e-canvas.h158
-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.c265
-rw-r--r--widgets/misc/e-gui-utils.h61
-rw-r--r--widgets/misc/e-hsv-utils.c178
-rw-r--r--widgets/misc/e-hsv-utils.h52
-rw-r--r--widgets/misc/e-multi-config-dialog.c103
-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.c285
-rw-r--r--widgets/misc/e-reflow-model.h106
-rw-r--r--widgets/misc/e-reflow.c1414
-rw-r--r--widgets/misc/e-reflow.h142
-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.c2272
-rw-r--r--widgets/misc/e-unicode.h133
-rw-r--r--widgets/misc/gal-categories.glade168
-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.c658
-rw-r--r--widgets/table/e-cell-combo.h63
-rw-r--r--widgets/table/e-cell-date.c182
-rw-r--r--widgets/table/e-cell-date.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.c526
-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.c108
-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.c2300
-rw-r--r--widgets/table/e-cell-text.h107
-rw-r--r--widgets/table/e-cell-toggle.c501
-rw-r--r--widgets/table/e-cell-toggle.h62
-rw-r--r--widgets/table/e-cell-tree.c772
-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.c559
-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.glade1774
-rw-r--r--widgets/table/e-table-config.c1136
-rw-r--r--widgets/table/e-table-config.glade2082
-rw-r--r--widgets/table/e-table-config.h112
-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.c710
-rw-r--r--widgets/table/e-table-group.h178
-rw-r--r--widgets/table/e-table-header-item.c1838
-rw-r--r--widgets/table/e-table-header-item.h114
-rw-r--r--widgets/table/e-table-header-utils.c527
-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.c3638
-rw-r--r--widgets/table/e-table-item.h225
-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.c239
-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.c478
-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.c429
-rw-r--r--widgets/table/e-table-specification.h89
-rw-r--r--widgets/table/e-table-state.c295
-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.c471
-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.c189
-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.c3278
-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.h76
-rw-r--r--widgets/table/e-tree-selection-model.c1425
-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.c1183
-rw-r--r--widgets/table/e-tree-table-adapter.h84
-rw-r--r--widgets/table/e-tree.c3352
-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-match.c185
-rw-r--r--widgets/text/e-completion-match.h68
-rw-r--r--widgets/text/e-completion-test.c220
-rw-r--r--widgets/text/e-completion-view.c933
-rw-r--r--widgets/text/e-completion-view.h102
-rw-r--r--widgets/text/e-completion.c640
-rw-r--r--widgets/text/e-completion.h102
-rw-r--r--widgets/text/e-entry-test.c83
-rw-r--r--widgets/text/e-entry.c1400
-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.c633
-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.c3876
-rw-r--r--widgets/text/e-text.h275
-rw-r--r--wombat/ChangeLog58
-rw-r--r--wombat/Evolution-Wombat.idl9
-rw-r--r--wombat/Makefile.am54
-rw-r--r--wombat/wombat-interface-check.c69
-rw-r--r--wombat/wombat-interface-check.h67
-rw-r--r--wombat/wombat-moniker.c184
358 files changed, 10873 insertions, 96636 deletions
diff --git a/ChangeLog b/ChangeLog
index 71dd3035b9..6ee689187c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,155 +1,29 @@
-2002-12-04 Ettore Perazzoli <ettore@ximian.com>
+2002-12-05 Ettore Perazzoli <ettore@ximian.com>
- * configure.in: Define COMPONENT_DIR.
+ * tools/evolution-launch-composer.c: New.
-2002-11-22 Jeffrey Stedfast <fejj@ximian.com>
+2002-11-26 Ettore Perazzoli <ettore@ximian.com>
- * configure.in: Add NSPR CFLAGS and LDFLAGS to the E_UTIL build
- flags.
+ * configure.in: Define KILL_PROCESS_CMD.
-2002-11-20 Ettore Perazzoli <ettore@ximian.com>
+2002-11-22 Not Zed <NotZed@Ximian.com>
- * configure.in: AC_OUTPUT(my-evoluton/Makefile).
+ * configure.in (E_UTIL_CFLAGS/LDFLAGS): Added NSPR stuff, so we
+ can nsprpoll on msgports.
-2002-11-20 Ettore Perazzoli <ettore@ximian.com>
+2002-11-07 Ettore Perazzoli <ettore@ximian.com>
- * Makefile.am (changelogs): Add my-evolution.
+ * configure.in (VERSION_COMMENT): 1.2.0.99.
-2002-11-20 Not Zed <NotZed@Ximian.com>
+== Version 1.2 ==
- * libibex/*: cvs removed it all. Not much use having it around
- anymore.
+2002-11-06 Ettore Perazzoli <ettore@ximian.com>
-2002-11-19 Ettore Perazzoli <ettore@ximian.com>
+ * configure.in: Version 1.2.0.
- * configure.in: Check for gconftool-2, and added
- AM_GCONF_SOURCE_2.
+2002-11-05 Ettore Perazzoli <ettore@ximian.com>
-2002-11-18 Not Zed <NotZed@Ximian.com>
-
- * configure.in: Added back IMPORTERS_CFLAGS and
- mail/importers/Makefile
-
-2002-11-16 Chris Toshok <toshok@ximian.com>
-
- * configure.in: we require >= 0.0.9.99 of gal.
-
-2002-11-15 Ettore Perazzoli <ettore@ximian.com>
-
- * configure.in: Set up the my-evolution flags properly, do not
- AC_SUBST GNOME_Evolution_Mail.server.in.
-
-2002-11-13 Not Zed <NotZed@Ximian.com>
-
- * Makefile.am (SUBDIRS): re-added filter, mail, composer
-
- * configure.in: Added EVOLUTION_MAIL settings, and mail/makefile.
-
-2002-11-11 Joe Shaw <joe@ximian.com>
-
- * Makefile.am (SUBDIRS): remove tools for now, it's not in
- configure.in.
-
-2002-11-11 Chris Toshok <toshok@ximian.com>
-
- * Makefile.am (SUBDIRS): add addressbook.
-
-2002-11-08 Chris Toshok <toshok@ximian.com>
-
- * configure.in: add some more addressbook paths.
-
-2002-11-08 Not Zed <NotZed@Ximian.com>
-
- * configure.in: Added composer/Makefile & gtkhtml-3.0 deps.
-
-2002-11-07 Chris Toshok <toshok@ximian.com>
-
- * configure.in (AC_OUTPUT): GNOME_Evolution_Summary.oaf.in = >
- GNOME_Evolution_Summary.server.in
-
-2002-11-07 JP Rosevear <jpr@ximian.com>
-
- * configure.in: update e-util and calendar compile flags
-
-2002-11-07 Rodrigo Moya <rodrigo@ximian.com>
-
- * configure.in: added libgnome-2.0 to camel requirements.
-
-2002-11-06 Chris Toshok <toshok@ximian.com>
-
- * configure.in: add some more addressbook dirs to AC_OUTPUT.
-
-2002-11-05 Jeffrey Stedfast <fejj@ximian.com>
-
- * configure.in: Re-enable the filter cflags/libs stuff.
-
-2002-11-05 Chris Toshok <toshok@ximian.com>
-
- * Makefile.am (SUBDIRS): add wombat.
-
-2002-11-05 Chris Toshok <toshok@ximian.com>
-
- * configure.in: add wombat and addressbook compile flags, and add
- wombat and some addressbook dirs to AC_OUTPUT.
-
-2002-11-05 Dan Winship <danw@ximian.com>
-
- * configure.in: change the commented-out soup check to refer to
- the new soup 2.0 in the libsoup module
-
-2002-11-05 Rodrigo Moya <rodrigo@ximian.com>
-
- * configure.in: use correct libgtkhtml-3.0 for calendar and added
- generation of calendar GUI's directories.
-
-2002-11-05 Rodrigo Moya <rodrigo@ximian.com>
-
- * configure.in: enabled libwombat.
-
-2002-11-04 Rodrigo Moya <rodrigo@ximian.com>
-
- * configure.in:
- * Makefile.am: added libversit directory to build.
-
-2002-11-04 Ettore Perazzoli <ettore@ximian.com>
-
- * Makefile.am (SUBDIRS): Add shell.
-
-2002-11-04 Rodrigo Moya <rodrigo@ximian.com>
-
- * configure.in: added calendar/idl/Makefile to AC_OUTPUT
-
-2002-11-04 Ettore Perazzoli <ettore@ximian.com>
-
- * configure.in: Add an AM_GLIB_GNU_GETTEXT.
-
-2002-11-03 Rodrigo Moya <rodrigo@ximian.com>
-
- * configure.in:
- * Makefile.am: re-added calendar component (only non-UI stuff).
-
- * data/Makefile.am: use intltools instead of xml-i18n-tools.
-
-2002-11-03 Ettore Perazzoli <ettore@ximian.com>
-
- * configure.in: AC_PROG_INTLTOOL instead of
- AM_PROG_XML_I18N_TOOLS.
-
-2002-11-01 Ettore Perazzoli <ettore@ximian.com>
-
- * configure.in: Update to use Autoconf 2.53. Remove checks for
- scrollkeeper. Remove intl/Makefile and macros/Makefile from
- AC_OUTPUT list. Set up GETTEXT_PACKAGE. Removed
- AM_ACLOCAL_INCLUDE(macros). Added AM_PATH_ORBIT2.
- (EVO_SET_COMPILE_FLAGS): Use PKG_CHECK_MODULES.
- (IDL_INCLUDES): New, -I params to pass to $(ORBIT_IDL) when
- compiling IDL files into stubs.
-
- * autogen.sh: Changed to use gnome-autogen.sh.
-
-2002-10-30 Ettore Perazzoli <ettore@ximian.com>
-
- * configure.in: 1.1.90.99.
+ * configure.in: Version 1.1.90.99.
== Version 1.1.90 (Release Candidate 1) ==
diff --git a/NEWS b/NEWS
index 8986efbfd9..149e234678 100644
--- a/NEWS
+++ b/NEWS
@@ -1,10 +1,105 @@
-Evolution 1.1.3, 2002-??-??
+Evolution 1.2.1, ????-??-??
---------------------------
Bugzilla Bugs Fixed (see http://bugzilla.ximian.com/show_bug.cgi):
* Addressbook
+ #16870 -- Fix CR/LF check for empty lines in LDIF importer. (Sean Gao)
+ #25540 -- Fix sensitivity issues in the contact editor. (Toshok)
+ #28945 -- Contact lists saved as invalid vCards. (Toshok)
+ #31763 -- Find button missing from Select Contacts from Addressbook
+ dialog. (Toshok)
+ #32352 -- The LDAP backend should be much more robust in the face of more
+ restrictive ACL's. (Toshok)
+ #33097 -- Fix crash when changing autocomplete folder list. Also
+ fixes #30323, #33930, and #33332. (Toshok)
+ #34254 -- fix case sensitive nature of vCard importer. (Sean Gao)
+
+ * Calendar
+
+ #30993 -- Meeting request for recurring meeting should describe
+ the recurrence. (Dan)
+
+ * Mail
+
+ #32932 -- Reopening a Draft loses References/In-Reply-To headers.
+ (Jeff)
+ #33309 -- Errror while 'Scanning folders in "IMAP server
+ exchange.xxx.xxx"' (Michael)
+ #33933 -- Sorting by subject does not result in expected order (Jeff)
+ #34975 -- Unable to see Inbox on SunOne IMAP server. (Jeff)
+ #34882 -- Forwarded messages use the wrong account. (Jeff)
+ #34315 -- Files silently lost when doing Drag and Drop. (Jeff)
+ #34327 -- Dragging doesn't work for non-inline attachments. (Harry Lu)
+ #34975 -- Unable to view Inbox on SunOne IMAP server (Jeff)
+
+Other fixes:
+
+ * Addressbook
+
+ - Fix scope problem where scopes would be saved as "base" and
+ "one" instead of "one" and "sub" repectively. (Toshok)
+ - Fixed a possible (and very probable) crash involving the
+ minicard view. (Toshok)
+ - Fixed a crash in the file backend. (Toshok)
+
+ * Calendar
+
+ - Fixed a bunch of memory leaks related to email meeting
+ scheduling. (Hans)
+
+ - Make the libical grammar files work with newer versions of
+ Bison.
+
+ * Mail
+
+ - Make the stop button work better when using SSL connections.
+ (Michael)
+
+ * Shell
+
+ - Kill old wombat processes to avoid problems for users who
+ upgrade. (Ettore)
+
+ - Fixed some localization problems. (Dan)
+
+ - Fixed the leaks in the settings dialog. (Ettore)
+
+ * Other
+
+ - Fixed compliance of the .omf files with the OMF 1.0 DTD.
+ (Frederic Crozat)
+
+New features:
+
+ - evolution-launch-composer command-line tool to open up the
+ composer with attachments. (Chris Lahey, Federico)
+
+
+ * Mailer
+
+ - Fixed SSL streams to have cancellable reads and writes.
+ - Auto-subscribe the user to his/her IMAP INBOX
+
+Evolution 1.2.0, 2002-11-06
+---------------------------
+
+Changes since 1.1.90:
+
+ - Made the default width of the mail filter editing dialog larger.
+ (Dan)
+
+ - Removed the development warning at startup. (Ettore)
+
+
+Evolution 1.1.90, 2002-10-28
+----------------------------
+
+Bugzilla Bugs Fixed (see http://bugzilla.ximian.com/show_bug.cgi):
+
+ * Addressbook
+
#25477 -- Crash. (Toshok)
#29067 -- Editing an address entry causes it to disappear. (Toshok)
#29144 -- Selection problem in directory servers page of
diff --git a/README b/README
index ef179e1a2a..4760b20572 100644
--- a/README
+++ b/README
@@ -14,7 +14,7 @@ duplicated effort (and to make sure that you aren't basing your work
on interfaces that are expected to change).
There are mailing list archives available at
-http://lists.ximian.com/archives/public/evolution/ and
+http://lists.ximian.com/archives/public/evolution/ and
http://lists.ximian.com/archives/public/evolution-hackers/
There is also an #evolution IRC channel on irc.gnome.org.
@@ -27,6 +27,7 @@ evolution" at the command line), and in the --help strings (run
The rest of this file is dedicated to building Evolution.
+
PROBLEMS BUILDING EVOLUTION
---------------------------
@@ -110,7 +111,6 @@ and -devel packages for each library.
- gnome-xml - 1.8.17 or later in the 1.0 series, but not from the 2.0
series (If you get this from GNOME CVS, use the tag "LIB_XML_1_BRANCH".)
-
- gnome-print - 0.35 or later
diff --git a/acconfig.h b/acconfig.h
index 7ce1a5993f..21508a7308 100644
--- a/acconfig.h
+++ b/acconfig.h
@@ -26,7 +26,6 @@
#undef HAVE_BROKEN_SPOOL
#undef ENABLE_PEDANTIC_PGPMIME
#undef HAVE_KDE_APPLNK
-#undef GETTEXT_PACKAGE
/* db3 version */
#undef EVOLUTION_DB_VERSION_MAJOR
@@ -50,3 +49,7 @@
/* Define to `int' if your system doesn't have `socklen_t'. */
#undef socklen_t
+
+/* Define to the path to a program to kill processes given the name
+ (eg. "killall" or "killp"). */
+#undef KILL_PROCESS_CMD
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog
index 3ec5dd65c9..c5383b12f6 100644
--- a/addressbook/ChangeLog
+++ b/addressbook/ChangeLog
@@ -11,70 +11,35 @@
naming errors returned from query_ldap_root_dse, as some servers
(older openldap servers among others i'm sure) don't have a root
dse at all.
-
-2002-12-02 Not Zed <NotZed@Ximian.com>
-
- * gui/widgets/e-addressbook-view.c (e_contact_print_button):
- gnomedialog -> gtkdialog stuff. print dialog is a gtkdialog now.
- * gui/contact-editor/e-contact-editor.c: include gtkstock.h
+2002-12-02 Chris Toshok <toshok@ximian.com>
+ * backend/ebook/e-card.c (e_card_get_vobject): back out fix for
+ #28945 because it breaks some internal assumptions about the
+ structure of contact lists.
-2002-11-27 Not Zed <NotZed@Ximian.com>
+2002-11-30 Chris Toshok <toshok@ximian.com>
- * gui/contact-editor/e-contact-editor-address.c: #include gtkstock.h
+ [ the rest of the fix for #31763 ]
+ * gui/component/select-names/e-select-names.h (struct
+ _ESelectNames): add status_image.
-2002-11-29 Chris Toshok <toshok@ximian.com>
+ * gui/component/select-names/select-names.glade: add an icon to
+ the status bar.
- * gui/widgets/e-minicard-view-widget.c (column_width_changed): the
- detail is supposed to go after the signal id, not at the end of
- the parameter list.
+ * gui/component/select-names/e-select-names.c
+ (e_select_names_init): init (and initially hide) status_image.
+ (status_message): show the image if there's a status message, hide
+ it if there's not.
2002-11-28 Chris Toshok <toshok@ximian.com>
- [ roll forward from 1.2 branch, partial fix for #31763 ]
+
+ [ partial fix for #31763 ]
* gui/component/select-names/select-names.glade: add the Find
button back in.
-
-2002-11-28 Chris Toshok <toshok@ximian.com>
-
- * gui/widgets/e-addressbook-view.c (create_minicard_view): remove
- the button_press_event handler (that did nothing). this makes it
- so button presses actually get to the canvas (and therefore we can
- now drag the lines in the reflow widget).
-
-2002-11-26 Chris Toshok <toshok@ximian.com>
-
- * gui/contact-editor/e-contact-quick-add.c: add include for
- gtkstock.h.
-
- * gui/contact-list-editor/e-contact-list-model.c
- (e_contact_list_model_add_destination): add pre_change call.
- (e_contact_list_model_remove_row): same.
- (e_contact_list_model_remove_all): same.
-
- * gui/contact-list-editor/e-contact-list-editor.c
- (e_contact_list_editor_new): ref/sink the contact list editor so
- we don't get the floating unref warning from gtk.
-
- * gui/contact-editor/e-contact-editor.c (e_contact_editor_new):
- ref/sink the contact editor so we don't get the floating unref
- warning from gtk.
- (e_contact_editor_init): use g_build_filename instead of
- g_concat_dir_and_file.
-
- * gui/widgets/e-minicard-label.c
- (e_minicard_label_resize_children): use MAX (value, 0) to make
- sure we aren't passing negative values for clip-widths.
-
- * gui/widgets/e-minicard.c (e_minicard_realize): use MAX (value,
- 0) to make sure we aren't passing negative values for widths.
-
- * gui/contact-editor/e-contact-editor.c (e_contact_editor_init):
- use g_build_filename.
-
+
2002-11-26 Chris Toshok <toshok@ximian.com>
- [ roll forward from 1.2 branch ]
* backend/pas/pas-backend-file.c
(pas_backend_file_process_get_vcard): never pass NULL as the vcard
to the corba call, it causes a crash. This particular bug bit us
@@ -83,67 +48,15 @@
2002-11-26 Chris Toshok <toshok@ximian.com>
- [ roll forward from 1.2 branch, Fixes addressbook bug #28945 ]
+ [ Fixes addressbook bug #28945 ]
* backend/ebook/e-card.c (e_card_get_vobject): if the email
property is xml, get the real address from the e-destination.
Fixes saving contact lists.
-2002-11-26 Chris Toshok <toshok@ximian.com>
-
- * gui/widgets/e-minicard.c (e_minicard_reflow): remove redundant
- setting of y2.
-
- * gui/contact-list-editor/e-contact-list-editor.c
- (e_contact_list_editor_init): show the table.
-
- * gui/component/select-names/e-select-names-completion.c: remove
- an unnecessary #include.
-
- * gui/component/addressbook-storage.c (addressbook_storage_setup):
- use g_build_filename.
-
- * gui/component/addressbook-component.c (remove_folder): use
- g_build_filename.
- (add_creatable_item): same.
- (ensure_completion_uris_exist): same, and use the right gconf
- paths for completion uris.
-
-2002-11-26 Chris Toshok <toshok@ximian.com>
-
- * gui/component/select-names/e-select-names-manager.c
- (read_completion_books_from_db): use new schema for
- completion/uris.
- (uris_listener): same.
-
- * gui/component/select-names/e-select-names.h: Convert to
- GtkDialog from GnomeDialog.
-
- * gui/component/select-names/e-select-names.c: Convert to
- GtkDialog from GnomeDialog.
- (folder_selected): use new schema for last_used_uri.
- (e_select_names_init): same.
- (e_select_names_set_default): use pango markup to set
- bold/not-bold.
- (e_select_names_add_section): don't bother creating an EEntry, we
- can use pango and a normal label. This also keeps us from
- wrapping "contacts ->" at the '-'.
-
- * gui/component/apps_evolution_addressbook.schemas: new file.
-
- * gui/component/Makefile.am: add the schema stuff.
-
-2002-11-24 Chris Toshok <toshok@ximian.com>
-
- * gui/component/addressbook-config.c (query_for_supported_bases):
- show the etable.
- (addressbook_add_server_druid): show_all before returning the
- dialog, so the druid shows up.
-
2002-11-23 Chris Toshok <toshok@ximian.com>
- [ roll forward from the 1.2 branch. fixes #25540, part of #29630,
- as well as other selection issues in the contact editor and ACL
- issues in the ldap backend ]
+ [ fixes #25540, part of #29630, as well as other selection issues
+ in the contact editor and ACL issues in the ldap backend ]
* backend/pas/pas-backend-ldap.c (check_schema_support): reset the
schema check state to FALSE if the read returned nothing (and the
user had not authenticated). we'll requery if/when they auth.
@@ -188,1006 +101,38 @@
(e_contact_editor_address_set_arg): same, and make the labels
sensitive/insensitive depending on the editable state of the
dialog.
-
+
2002-11-22 Chris Toshok <toshok@ximian.com>
- [ roll forward Sean.Gao@sun.com's fix for #16870 from the 1.2
- branch ]
+ * gui/widgets/e-addressbook-reflow-adapter.c (unlink_model): we
+ need to disconnect the model_changed signal too. This at the very
+ least is bad and at the worst could cause crashes.
+
+2002-11-22 Chris Toshok <toshok@ximian.com>
+
+ [ fixes #16870, constibuted by Sean.Gao@sun.com ]
* backend/ebook/evolution-ldif-importer.c (getNextLDIFEntry):
- check for both LR and CRLF as empty line markers.
+ check for both LF and CRLF as empty line markers.
2002-11-22 Chris Toshok <toshok@ximian.com>
- [ rolling forward fix for #34254 from 1.2 branch ]
+ [ fixes #34254, contributed by Sean.Gao@sun.com ]
* backend/ebook/evolution-vcard-importer.c (check_file_is_vcard):
- use g-ascii_strncasecmp instead of strncmp.
- (support_format_fn): use g_ascii_strcasecmp instead of strcmp.
+ use g_strncasecmp instead of strncmp here.
+ (support_format_fn): use g_strcasecmp instead of strcmp here.
-2002-11-20 Chris Toshok <toshok@ximian.com>
+2002-11-21 Chris Toshok <toshok@ximian.com>
- * gui/component/addressbook-storage.h: roll forward the scope fix.
+ * gui/component/addressbook-storage.h: reorder the enum to match
+ the order used in the option menu in the .glade file. Fixes lots
+ of reports of scopes being saved as "base" instead of "one".
2002-11-20 Chris Toshok <toshok@ximian.com>
- * gui/contact-editor/e-contact-editor.c: roll forward the fix for
- the contact editor.
-
-2002-11-21 Not Zed <NotZed@Ximian.com>
-
- * gui/component/select-names/e-select-names-bonobo.c
- (entry_changed): Pass type to bonobo_ctonrol_set_property, and
- also NULL terminate the valist.
-
- * gui/component/select-names/e-select-names-text-model.c
- (changed_cb): Fix signature for signal.
-
-2002-11-19 Ettore Perazzoli <ettore@ximian.com>
-
- * gui/component/select-names/GNOME_Evolution_Addressbook_SelectNames.server.in.in,
- * gui/component/select-names/Makefile.am: Same changes as below
- for the SelectNames component.
-
-2002-11-18 Chris Toshok <toshok@ximian.com>
-
- * gui/component/select-names/e-select-names.c
- (e_select_names_init): show the custom table.
-
-2002-11-18 Chris Toshok <toshok@ximian.com>
-
- * gui/widgets/gal-view-minicard.c (gal_view_minicard_attach):
- remove the cast to (int) - column_width is a double.
-
- * gui/widgets/e-minicard.c (e_minicard_class_init): the height
- property is only readable, not readwrite.
-
- * gui/widgets/e-minicard-view-widget.c
- (e_minicard_view_widget_class_init): make column_width a double
- property.
- (e_minicard_view_widget_set_property): don't cast to (int).
- column_width is double in the e-minicard-view.
- (e_minicard_view_widget_realize): same.
- (e_minicard_view_widget_get_property): use g_value_set_double for
- column_width.
-
-2002-11-17 Chris Toshok <toshok@ximian.com>
-
- * gui/component/select-names/Makefile.am (servers_DATA): oops,
- missed some "oaf"'s.
-
-2002-11-16 Chris Toshok <toshok@ximian.com>
-
- * gui/contact-editor/e-contact-editor.c
- (e_contact_editor_build_phone_ui): sink the popup.
- (e_contact_editor_build_email_ui): same.
- (e_contact_editor_build_address_ui): same.
-
- * gui/component/addressbook-config.c (ldap_dialog_new): show
- everything from dialog->page down, so custom widgets show up.
-
-2002-11-15 Ettore Perazzoli <ettore@ximian.com>
-
- * gui/component/Makefile.am: Added rule to generate
- GNOME_Evolution_Addressbook.server.in from
- GNOME_Evolution_Addressbook.server.in.in, substituting
- @LIBEXECDIR@.
-
- * GNOME_Evolution_Addressbook.server.in.in: Renamed from
- GNOME_Evolution_Addressbook.server.in. Added @LIBEXECDIR@ before
- the location of the executable.
-
- * gui/component/select-names/select-names.glade: Ported to Glade
- 2.
-
- * gui/component/select-names/recipient.glade: Ported to Glade 2.
-
-2002-11-15 Rodney Dawes <dobey@ximian.com>
-
- * gui/component/addressbook-component.c: Use bonobo_main_quit.
-
-2002-11-14 Chris Toshok <toshok@ximian.com>
-
- * gui/widgets/gal-view-factory-minicard.c: clean this up a tad.
-
- * gui/widgets/e-addressbook-view.c (init_collection): re-enable
- this.
- (setup_menus): same.
-
- * gui/widgets/gal-view-minicard.[ch]: more GObject work.
-
-2002-11-12 Chris Toshok <toshok@ximian.com>
-
- * gui/contact-editor/e-contact-editor.c (_popup_position): push_in
- = FALSE, no clue why... :)
- (_arrow_pressed): call g_signal_stop_emission here, seems to fix
- things.
-
- * gui/component/select-names/e-select-names.c
- (e_select_names_init): fix warnings.
-
- * gui/component/select-names/e-select-names-manager.c
- (e_select_names_manager_activate_dialog): fix warning.
-
- * gui/component/addressbook.c (forget_passwords_cb): remove the
- PENDING_PORT ifdef.
- (load_uri_auth_cb): same.
- (addressbook_authenticate): same.
-
- * gui/component/addressbook-factory.c (main): same.
-
- * gui/component/addressbook-storage.c (load_source_data): be
- silent about text nodes if they contain nothing but whitespace.
-
-2002-11-11 Chris Toshok <toshok@ximian.com>
-
- * backend/pas/pas-card-cursor.c (pas_card_cursor_dispose): guard
- against multiple invocations.
-
- * backend/pas/pas-backend-ldap.c (view_destroy): change signature
- to that of a weak ref notify function.
- (cursor_destroy): same.
- (pas_backend_ldap_book_destroy_cb): same.
- (get_cursor_handler): ::destroy -> weak_ref.
- (pas_backend_ldap_process_get_book_view): same.
- (pas_backend_ldap_add_client): same.
-
- * backend/pas/pas-backend-file.c (cursor_destroy): change
- signature to that of a weak ref notify function.
- (view_destroy): same.
- (pas_backend_file_book_destroy_cb): same.
- (pas_backend_file_process_get_cursor): ::destroy -> weak_ref.
- (pas_backend_file_process_get_book_view): same.
- (pas_backend_file_process_get_completion_view): same.
- (pas_backend_file_process_get_changes): same.
- (pas_backend_file_add_client): same.
-
- * backend/ebook/test-client.c (get_cursor_cb): unref the book and
- exit here.
- (get_card_cb): pass a query string to get_cursor.
-
- * backend/ebook/e-book-view.c (e_book_view_class_init): correct
- marshaller for "card_added".
-
-2002-11-11 Chris Toshok <toshok@ximian.com>
-
- * gui/widgets/test-reflow.c (destroy_callback): change signature
- to that of a weak ref notify function.
- (main): ::destroy -> weak_ref.
-
- * gui/widgets/test-minicard.c (destroy_callback): change signature
- to that of a weak ref notify function.
- (main): ::destroy -> weak_ref.
-
- * gui/widgets/test-minicard-view.c (destroy_callback): change
- signature to that of a weak ref notify function.
- (main): ::destroy -> weak_ref.
-
- * gui/widgets/test-minicard-label.c (destroy_callback): change
- signature to that of a weak ref notify function.
- (main): ::destroy -> weak_ref.
-
- * gui/widgets/e-minicard-widget.c (e_minicard_widget_init): ifdef
- out the call to gnome_canvas_set_scroll_region. It doesn't seem
- necessary judging from the rest of the code, and it also crashes
- the addressbook if it's in.
-
- * gui/widgets/e-minicard-widget-test.c (destroy_callback): change
- signature to that of a weak ref notify function.
- (main): ::destroy -> weak_ref.
-
- * gui/widgets/e-minicard-control.c (free_struct): change signature
- to that of a weak ref notify function.
- (e_minicard_control_factory): ::destroy -> weak_ref.
-
- * gui/widgets/e-addressbook-view.c (e_addressbook_view_init):
- ::destroy -> weak_ref.
- (e_addressbook_view_print): same.
- (free_closure): change signature to that of a weak ref notify
- function.
- (e_contact_print_destroy): same.
- (invisible_destroyed): same.
-
- * gui/widgets/e-addressbook-util.c
- (e_addressbook_prompt_save_dialog): convert from GnomeDialog to
- GtkDialog.
- (e_addressbook_show_multiple_cards): same.
-
- * gui/contact-list-editor/e-contact-list-editor.c
- (prompt_to_save_changes): change response ids to use
- GTK_RESPONSE_.
-
- * gui/component/select-names/e-select-names-manager.c
- (clear_widget): new function.
- (e_select_names_manager_activate_dialog): ::destroy -> weak_ref.
-
- * gui/component/select-names/e-select-names.c (clear_widget):
- change signature to that of a weak ref notify function.
- (e_select_names_init): ::destroy -> weak_ref.
-
- * gui/component/e-address-popup.c (mini_wizard_destroy_cb): change
- signature to that of a weak ref notify function.
- (mini_wizard_new): ::destroy -> weak_ref.
-
- * gui/component/addressbook-config.c
- (addressbook_source_dialog_destroy): change signature to that of a
- weak ref notify function.
- (ldap_config_control_destroy_callback): same.
- (addressbook_add_server_druid): ::destroy -> weak_ref.
- (addressbook_edit_server_dialog): same.
- (ldap_config_control_new): same.
-
- * gui/component/addressbook.c (destroy_callback): change signature
- to that of a a weak ref notify function.
- (addressbook_factory_new_control): ::destroy -> weak_ref.
-
- * gui/merging/e-card-merging.c (response): rename clicked to this,
- and destroy the dialog here.
- (match_query_callback): ::clicked -> ::response
-
- * gui/merging/e-card-merging-book-commit-duplicate-detected.glade:
- convert.
-
- * gui/merging/e-card-duplicate-detected.glade: same.
-
-2002-11-11 Chris Toshok <toshok@ximian.com>
-
- * gui/contact-editor/e-contact-editor.c (_arrow_pressed): change
- around a little, still ifdefed though.
-
- * gui/contact-editor/e-contact-save-as.c (file_exists): same.
- (save_it): deal with the GtkDialog response ids.
-
- * gui/contact-editor/e-contact-editor.c
- (e_contact_editor_confirm_delete): just build the dialog here
- (using gtk_message_dialog*).
-
- * gui/contact-editor/Makefile.am (glade_DATA): remove
- file-exists.glade and e-contact-editor-confirm-delete.glade.
-
-2002-11-11 Chris Toshok <toshok@ximian.com>
-
- * backend/pas/pas-card-cursor.c (pas_card_cursor_dispose): guard
- against multiple invocations.
-
- * backend/pas/pas-backend-ldap.c (view_destroy): change signature
- to that of weak ref's notify function - also, don't use the type
- check macros on the freed GObject.
- (cursor_destroy): same.
- (pas_backend_ldap_book_destroy_cb): same.
- (pas_backend_ldap_add_client): use weak_ref insteead of ::destroy.
- (get_cursor_handler): same.
- (pas_backend_ldap_process_get_book_view): same.
-
- * backend/pas/pas-backend-file.c (cursor_destroy): change
- signature to that of weak ref's notify function - also, don't use
- the type check macros on the freed GObject.
- (pas_backend_file_book_destroy_cb): same.
- (view_destroy): same.
- (pas_backend_file_process_get_cursor): use weak_ref instead of
- ::destroy.
- (pas_backend_file_process_get_book_view): same.
- (pas_backend_file_process_get_completion_view): same.
- (pas_backend_file_process_get_changes): same.
- (pas_backend_file_add_client): same.
-
-2002-11-10 Chris Toshok <toshok@ximian.com>
-
- * backend/pas/pas-backend-card-sexp.c
- (pas_backend_card_sexp_dispose): guard against multiple
- invocations.
-
- * backend/pas/pas-card-cursor.c (pas_card_cursor_dispose): same.
-
- * backend/pas/pas-book.c (pas_book_dispose): same.
-
- * backend/pas/pas-book-view.c (pas_book_view_dispose): same.
-
- * backend/pas/pas-book-factory.c (pas_book_factory_dispose): same.
-
- * backend/pas/pas-backend-summary.c (pas_backend_summary_dispose): same.
-
- * backend/pas/pas-backend-ldap.c (pas_backend_ldap_dispose): same.
-
- * backend/pas/pas-backend-file.c (pas_backend_file_dispose): same.
-
- * backend/ebook/e-book-listener.c (e_book_listener_dispose): guard
- against multiple invocations.
-
- * backend/ebook/e-card.c (e_card_dispose): same.
-
- * backend/ebook/e-card-simple.c (e_card_simple_dispose): same.
-
- * backend/ebook/e-card-cursor.c (e_card_cursor_dispose): same.
-
- * backend/ebook/e-book.c (e_book_dispose): same.
-
- * backend/ebook/e-book-view-listener.c (e_book_view_listener_dispose): same.
-
-2002-11-08 Chris Toshok <toshok@ximian.com>
-
- * gui/widgets/e-addressbook-model.c (free_data): guard against
- multiple invocations.
- (remove_book_view): same.
- (addressbook_dispose): same.
-
- * gui/widgets/e-addressbook-view.c (e_addressbook_view_dispose):
- same.
-
- * gui/widgets/e-minicard-view-widget.c
- (e_minicard_view_widget_dispose): same.
-
- * gui/widgets/e-minicard-view.c (e_minicard_view_dispose): same.
-
- * gui/widgets/e-minicard-widget.c (e_minicard_widget_dispose):
- same.
-
-2002-11-08 Chris Toshok <toshok@ximian.com>
-
- * gui/widgets/e-addressbook-reflow-adapter.c
- (addressbook_get_property): oops, missed these casts.
-
- * gui/component/addressbook.c (get_master_list): remove the
- PENDING_PORT_WORK ifdef, just ported ECategoriesMasterList.
- (make_suboptions): same.
-
- * gui/contact-editor/e-contact-editor.c (categories_clicked):
- same.
-
-2002-11-08 Chris Toshok <toshok@ximian.com>
-
- * gui/widgets/test-reflow.c: port work.
-
- * gui/widgets/test-minicard-view.c: port work.
-
- * gui/widgets/e-minicard.[ch]: port work.
-
- * gui/widgets/e-minicard-widget.c: port work.
-
- * gui/widgets/e-minicard-view.c: port work.
-
- * gui/widgets/e-minicard-view-widget.c
- (e_minicard_view_widget_size_allocate): gtk_->g_ change i missed.
- (e_minicard_view_widget_reflow): same.
-
- * gui/widgets/e-minicard-label.c: port work.
-
- * gui/widgets/e-minicard-control.c (get_prop): gtk_->g_ change i
- missed.
-
- * gui/widgets/e-addressbook-view.c (setup_menus): ifdef this
- PENDING_PORT_WORK for now.
- (has_email_address_1): gtk_->g_ change i missed.
- (print): remove the PENDING_PORT_WORK from here, as the print_*
- symbols now resolve.
- (delete): gtk_->g_ changes.
- (new_card): same.
- (new_list): same.
- (sources): same.
- (create_minicard_view): same.
- (table_double_click): same.
- (create_table_view): same.
- (e_contact_print_destroy): same.
- (e_contact_print_button): same.
- (e_addressbook_view_print): same, and remove the PENDING_PORT_WORK
- ifdef.
- (e_addressbook_view_print_preview): same.
- (do_remove): gtk_->g_ changes.
- (e_addressbook_view_save_state): same.
- (view_transfer_cards): same.
-
- * gui/widgets/e-addressbook-view.h (struct _EAddressbookView):
- GtkObject -> GObject.
-
- * gui/widgets/e-addressbook-util.c (e_addressbook_error_dialog):
- GnomeDialog -> GtkDialog.
-
- * gui/widgets/e-addressbook-table-adapter.c
- (addressbook_set_value_at): a gtk_->g_ change i missed.
- (e_addressbook_table_adapter_class_init): gtk_type_class ->
- g_type_class_peek_parent.
-
- * gui/widgets/e-addressbook-reflow-adapter.c
- (addressbook_get_property): use g_object_get_property for
- aggregated properties.
- (e_addressbook_reflow_adapter_class_init): gtk_type_class ->
- g_type_class_peek_parent.
-
- * gui/merging/e-card-merging.c (match_query_callback): some misc
- gtk_->g_ changes i missed.
-
-2002-11-08 Chris Toshok <toshok@ximian.com>
-
- * gui/component/select-names/e-select-names-model.h: parent class
- is GObjectClass.
-
- * gui/component/select-names/e-simple-card-bonobo.c
- (impl_dispose): guard against multiple invocations, and chain
- dispose.
-
- * gui/component/select-names/e-select-names.c
- (e_select_names_dispose): guard against multiple invocations.
-
- * gui/component/select-names/e-select-names-text-model.c
- (e_select_names_text_model_dispose): guard against multiple
- invocations.
- (e_select_names_text_model_set_source): fix casts.
-
- * gui/component/select-names/e-select-names-table-model.c
- (e_select_names_table_model_add_source): remove the GTK_OBJECT
- cast, fixes a warning.
- (clear_info): guard against multiple invocations from ::dispose.
-
- * gui/component/select-names/e-select-names-manager.c
- (e_select_names_manager_dispose): same.
-
- * gui/component/select-names/e-select-names-completion.c
- (e_select_names_completion_dispose): same.
-
- * gui/component/select-names/e-select-names-bonobo.c
- (impl_dispose): guard against multiple invocations.
-
-2002-11-08 Chris Toshok <toshok@ximian.com>
-
- * gui/contact-list-editor/contact-list-editor.glade: convert to glade-2
-
- * gui/contact-list-editor/e-contact-list-editor.c: port work.
-
- * gui/contact-list-editor/e-contact-list-model.[ch]: port work.
-
-2002-11-08 Chris Toshok <toshok@ximian.com>
-
- * gui/contact-editor/e-contact-editor-address.[ch]: port work.
-
- * gui/contact-editor/e-contact-editor-fullname.[ch]: port work.
-
- * gui/contact-editor/e-contact-editor.[ch]: port work.
-
- * gui/contact-editor/e-contact-quick-add.c: port work.
-
- * gui/contact-editor/e-contact-save-as.c: port work.
-
-2002-11-08 Chris Toshok <toshok@ximian.com>
-
- * backend/ebook/e-book-util.c
- (set_default_book_uri_from_config_db): prepend /apps/Evolution to
- config db paths.
-
- * gui/component/select-names/e-select-names-manager.c (read_completion_books_from_db): same.
- (uris_listener): same.
-
-2002-11-08 Chris Toshok <toshok@ximian.com>
-
- * gui/contact-editor/e-contact-editor.c: more porting work.
-
- * e-contact-editor-fullname.[ch]: more porting work.
-
- * e-contact-editor.c: more porting work.
-
- * e-contact-quick-add.c: more porting work.
-
- * e-contact-save-as.c: more porting work.
-
- * test-editor.c: more porting work.
-
- * e-contact-editor-confirm-delete.glade, file-exists.glade,
- fulladdr.glade, fullname.glade: run these through
- libglade-convert.
-
-2002-11-07 Chris Toshok <toshok@ximian.com>
-
- * gui/component/Makefile.am (evolution_addressbook_LDADD): add
- lots of libs back in since they're building now.
-
- * gui/component/addressbook-config.c: more porting work.
-
- * gui/component/addressbook.c: more porting work.
-
- * gui/component/e-address-popup.[ch]: more porting work.
-
- * gui/component/e-address-widget.[ch]: more porting work.
-
- * gui/component/e-cardlist-model.[ch]: more porting work.
-
-2002-11-07 Chris Toshok <toshok@ximian.com>
-
- * gui/component/select-names/e-select-names-bonobo.[ch]: more
- porting work.
-
- * gui/component/select-names/e-select-names-completion.[ch]: more
- porting work.
-
- * gui/component/select-names/e-select-names-manager.[ch]: more
- porting work.
-
- * gui/component/select-names/e-select-names-model.[ch]: more
- porting work.
-
- * gui/component/select-names/e-select-names-popup.c: more
- porting work.
-
- * gui/component/select-names/e-select-names-table-model.[ch]: more
- porting work.
-
- * gui/component/select-names/e-select-names-text-model.[ch]: more
- porting work.
-
- * gui/component/select-names/e-select-names.[ch]: more
- porting work.
-
-2002-11-07 Chris Toshok <toshok@ximian.com>
-
- * backend/ebook/Makefile.am: tests are linking now, and link in
- libcamel.la.
-
- * backend/ebook/e-destination.c (e_destination_get_name): un-ifdef
- since camel is compiling.
- (e_destination_get_email): same.
- (e_destination_get_address): same.
- (e_destination_get_textrep): same.
-
- * backend/ebook/e-card-compare.c (name_fragment_match): use e_utf8_casefold_*.
- (name_fragment_match_with_synonyms): same.
- (e_card_compare_name_to_string_full): same.
- (e_card_compare_name): same.
-
-2002-11-07 Chris Toshok <toshok@ximian.com>
-
- * backend/ebook/e-book-util.h: add prototypes for e_utf8_casefold_collate{_len}
-
- * backend/ebook/e-book-util.c (e_utf8_casefold_collate_len): move
- utf8_casefold_collate_len here.
- (e_utf8_casefold_collate): move utf8_casefold_collate here.
-
-2002-11-06 Chris Toshok <toshok@ximian.com>
-
- * printing/e-contact-print-envelope.c: port this to
- gnome2/gnomeprint2.
-
- * printing/e-contact-print-style-editor.c: same.
-
- * printing/e-contact-print.c: same.
-
- * printing/test-contact-print-style-editor.c: same.
-
- * printing/test-print.c: same.
-
- * printing/e-contact-print.glade: libglade-convert to libglade-2.
-
- * printing/Makefile.am (contact_print_test_LDADD)
- (contact_print_style_editor_test_LDADD): remove libcamel.la from
- these for the time being to get things linking.
-
-2002-11-06 Chris Toshok <toshok@ximian.com>
-
- * gui/widgets/gal-view-minicard.[ch]: gobjectify this.
-
- * gui/widgets/e-minicard.[ch]: gobjectify this.
- (e_minicard_class_init): change the
- min/max values of the width/height paramspecs so that they can
- actually be set to something other than 0.0.
-
- * gui/widgets/e-minicard-widget.[ch]: gobjectify this.
-
- * gui/widgets/e-minicard-view.[ch]: gobjectify this.
- (set_empty_message): don't need e_utf8_from_locale_string anymore.
-
- * gui/widgets/e-minicard-view-widget.[ch]: gobjectify this.
-
- * gui/widgets/e-minicard-label.[ch]: gobjectify this.
-
- * gui/widgets/e-addressbook-view.[ch]: gobjectify this.
-
- * gui/widgets/e-addressbook-table-adapter.[ch]: gobjectify this.
-
- * gui/widgets/e-addressbook-reflow-adapter.[ch]: gobjectify this.
-
- * gui/widgets/e-addressbook-model.[ch]: gobjectify this.
-
- * gui/widgets/e-minicard-control.c (e_minicard_control_factory):
- fix bonobo_persist_stream_new api change.
-
- * gui/contact-list-editor/e-contact-list-model.c
- (e_contact_list_model_add_destination): get rid of the
- gtk_object_sink here.
-
- * gui/component/ldap-config.glade: glade-2 version of this file.
-
- * gui/component/e-address-popup.c (e_address_popup_refresh_names):
- don't need e_utf8_to_gtk_string anymore.
-
- * gui/component/addressbook.c (make_suboptions): don't need
- e_utf8_to_locale_string anymore.
-
- * gui/component/addressbook-config.c
- (addressbook_dialog_get_source): get rid of the e_utf8 gtk_entry
- functions.
- (addressbook_source_dialog_set_source): same.
- (general_tab_check): same.
- (port_changed_func): same.
- (connecting_tab_check): same.
- (query_for_supported_bases): same.
- (display_name_check): same.
- (display_name_page_prepare): same.
- (edit_source_clicked): same.
- (addressbook_config_create_new_source): same.
-
-2002-11-06 Chris Toshok <toshok@ximian.com>
-
- * backend/pas/pas-backend-card-sexp.c
- (pas_backend_card_sexp_class_init): use g_type_class_peek_parent.
-
- * backend/pas/pas-card-cursor.c (pas_card_cursor_class_init): same.
-
- * backend/pas/pas-book-view.c (pas_book_view_class_init): same.
-
- * backend/pas/pas-book-factory.c (pas_book_factory_class_init): same.
-
- * backend/pas/pas-backend-summary.c (pas_backend_summary_class_init): same.
-
- * backend/pas/pas-backend-ldap.c (pas_backend_ldap_class_init): same.
-
- * backend/pas/pas-backend-file.c (pas_backend_file_class_init): same.
-
- * backend/ebook/e-book-marshal.list: ENUM -> INT.
-
- * backend/ebook/e-book-view.c (e_book_view_dispose): guard against
- this being called multiple times.
- (e_book_view_class_init): ENUM -> INT in the sequence_complete
- signal.
-
- * backend/ebook/e-book.c (e_book_do_response_open): un-ifdef the
- component_died signal stuff.
-
-2002-11-06 Chris Toshok <toshok@ximian.com>
-
- * backend/ebook/e-book-util.c (e_book_expand_uri): call
- g_build_filename, not g_build_path.
-
-2002-11-06 Chris Toshok <toshok@ximian.com>
-
- * backend/ebook/e-destination.[ch]: fix the gnome-xml headers.
-
-2002-11-06 Chris Toshok <toshok@ximian.com>
-
- * gui/widgets/gal-view-minicard.c: fix the gnome-xml headers.
-
- * gui/widgets/e-addressbook-view.c
- (e_addressbook_view_class_init): convert from gtk signals and args
- to GSignal and GObject properties.
- (e_addressbook_view_dispose): rename _destroy to this.
- (e_addressbook_view_set_property): rework _set_arg to this.
- (e_addressbook_view_get_property): rework _get_arg to this.
- (display_view): if we're here we need to choose a view, regardless
- of whether or not the GAL_IS_VIEW_* macros tell us which type it
- is.
-
- * gui/widgets/e-addressbook-table-adapter.c: fix the gnome-xml
- headers.
-
- * gui/widgets/e-addressbook-model.c
- (e_addressbook_model_class_init): use INT, not ENUM in the signal here.
-
- * gui/component/addressbook-config.c: another big gtk_* -> g_*
- renaming.
-
- * gui/component/addressbook.c: same.
-
- * gui/component/e-address-popup.c: same.
-
- * gui/component/e-address-widget.c: same.
-
- * gui/component/e-cardlist-model.c: fix the gnome-xml headers, and
- more gtk_* -> g_* renaming.
-
- * gui/component/addressbook-component.c (owner_set_cb): use
- evolution_shell_client_corba_objref as per ettore's change to
- EvolutionShellClient..
- (create_view): fix the call to bonobo_control_set_property.
- (create_component): gtk_signal_connect -> g_signal_connect.
-
- * gui/component/addressbook-storage.c: fix the gnome-xml
- headers.
- (addressbook_storage_setup): use
- evolution_shell_client_corba_objref as per ettore's change to
- EvolutionShellClient..
- (addressbook_get_other_contact_storage): gtk_signal_connect ->
- g_signal_connect.
- (load_source_data): root->childs -> root->childrens.
-
-2002-11-06 Chris Toshok <toshok@ximian.com>
-
- * gui/search/e-addressbook-search-dialog.c: fix some #include's.
-
-2002-11-06 Chris Toshok <toshok@ximian.com>
-
- * Makefile.am (SUBDIRS): only build the backend and gui dirs for
- now. printing and conduits are no-man's land at present.
-
- * addressbook/gui/merging/e-card-merging.[ch]: Port to
- GObject/gnome2.
-
-2002-11-05 Chris Toshok <toshok@ximian.com>
-
- * gui/component/.cvsignore: ignore the new .server file.
-
- * gui/component/Makefile.am: typical port stuff. switch the .oaf
- to .server, and leave out a lot of libs so we can actually get
- things linking.
-
- * gui/component/GNOME_Evolution_Addressbook.server.in: rename
- .oaf.in here.
-
- * gui/component/addressbook-component.c: Port to GObject/gnome2.
-
- * gui/component/addressbook-config.c: Port to GObject/gnome2.
-
- * gui/component/addressbook-factory.c: Port to GObject/gnome2.
-
- * gui/component/addressbook-storage.c: Port to GObject/gnome2.
-
- * gui/component/addressbook.[ch]: Port to GObject/gnome2.
-
- * gui/component/e-address-popup.[ch]: Port to GObject/gnome2.
-
- * gui/component/e-address-widget.[ch]: Port to GObject/gnome2.
-
- * gui/component/e-cardlist-model.h: Port to GObject/gnome2.
-
-2002-11-05 Chris Toshok <toshok@ximian.com>
-
- * gui/contact-list-editor/.cvsignore: ignore the marshal generated
- stuff.
-
- * gui/contact-list-editor/Makefile.am: typical port stuff. add
- marshaller generation foo, dist it...
-
- * gui/contact-list-editor/e-contact-list-editor.[ch]: Port to
- GObject/gnome2.
-
- * gui/contact-list-editor/e-contact-list-model.[ch]: Port to
- GObject/gnome2.
-
-2002-11-05 Chris Toshok <toshok@ximian.com>
-
- * gui/contact-editor/.cvsignore: ignore the marshal generated
- stuff.
-
- * gui/contact-editor/Makefile.am: typical port stuff. add
- marshaller generation foo, dist it...
-
- * gui/contact-editor/e-contact-editor-address.[ch]: Port to GObject/gnome2.
-
- * gui/contact-editor/e-contact-editor-fullname.c: Port to GObject/gnome2.
-
- * gui/contact-editor/e-contact-editor.c: Port to GObject/gnome2.
-
- * gui/contact-editor/e-contact-quick-add.c: Port to GObject/gnome2.
-
- * gui/contact-editor/e-contact-save-as.[ch]: Port to GObject/gnome2.
-
- * gui/contact-editor/test-editor.c: Port to GObject/gnome2.
-
-2002-11-05 Chris Toshok <toshok@ximian.com>
-
- * gui/widgets/e-addressbook-model.[ch]: Port to GObject/gnome2.
-
- * gui/widgets/e-addressbook-reflow-adapter.c: Port to
- GObject/gnome2.
-
- * gui/widgets/e-addressbook-table-adapter.c: Port to
- GObject/gnome2.
-
- * gui/widgets/e-addressbook-util.c: Port to GObject/gnome2.
-
- * gui/widgets/e-addressbook-view.[ch]: Port to GObject/gnome2.
-
- * gui/widgets/e-minicard-control.c: Port to GObject/gnome2.
-
- * gui/widgets/e-minicard-label.[ch]: Port to GObject/gnome2.
-
- * gui/widgets/e-minicard-view-widget.[ch]: Port to GObject/gnome2.
-
- * gui/widgets/e-minicard-view.[ch]: Port to GObject/gnome2.
-
- * gui/widgets/e-minicard-widget-test.c: Port to GObject/gnome2.
-
- * gui/widgets/e-minicard-widget.c: Port to GObject/gnome2.
-
- * gui/widgets/e-minicard.[ch]: Port to GObject/gnome2.
-
- * gui/widgets/gal-view-factory-minicard.c: Port to GObject/gnome2.
-
- * gui/widgets/gal-view-minicard.c: Port to GObject/gnome2.
-
- * gui/widgets/test-minicard-label.c: Port to GObject/gnome2.
-
- * gui/widgets/test-minicard-view.c: Port to GObject/gnome2.
-
- * gui/widgets/test-minicard.c: Port to GObject/gnome2.
-
- * gui/widgets/test-reflow.c: Port to GObject/gnome2.
-
- * gui/widgets/Makefile.am: typical port stuff. add marshaller
- generation foo, dist it...
-
- * gui/widgets/.cvsignore: ignore the marshaller stuff.
-
-2002-11-05 Chris Toshok <toshok@ximian.com>
-
- * gui/component/select-names/e-simple-card-bonobo.[ch]: Port to
- GObject/gnome2.
-
- * gui/component/select-names/e-select-names.[ch]: Port to
- GObject/gnome2.
-
- * gui/component/select-names/e-select-names-text-model.c: Port to
- GObject/gnome2.
-
- * gui/component/select-names/e-select-names-table-model.c: Port to
- GObject/gnome2.
-
- * gui/component/select-names/e-select-names-popup.[ch]: Port to
- GObject/gnome2.
-
- * gui/component/select-names/e-select-names-model.c: Port to
- GObject/gnome2.
-
- * gui/component/select-names/e-select-names-manager.[ch]: Port to
- GObject/gnome2.
-
- * gui/component/select-names/e-select-names-factory.c: Port to
- GObject/gnome2.
-
- * gui/component/select-names/e-select-names-completion.[ch]: Port
- to GObject/gnome2.
-
- * gui/component/select-names/e-select-names-bonobo.[ch]: Port to
- GObject/gnome2.
-
- * gui/component/select-names/Makefile.am: typical port stuff. add
- marshaller generation foo, dist it, and switch the .oaf to .server
-
- * gui/component/select-names/.cvsignore: ignore the marshaller
- stuff.
-
-2002-11-05 Chris Toshok <toshok@ximian.com>
-
- * backend/ebook/.cvsignore: ignore the generated marshaller files.
-
- * backend/ebook/e-destination.c (e_destination_dispose): rename
- e_destination_destroy.
- (e_destination_equal): ifdef this out for now, PENDING_PORT_WORK.
- (e_destination_get_name): same.
- (e_destination_get_email): same.
- (e_destination_get_address): same.
- (e_destination_get_textrep): same.
-
- * backend/ebook/Makefile.am: don't build the executables
- (importers and loaders) for now. Also, s/oaf/server, and use
- INTLTOOL_SERVER_RULE.
-
- * backend/ebook/e-book-util.c (e_book_get_config_database):
- un-#ifdef this.
- (e_book_default_book_open): un-#ifdef ths code in here that relies
- on the e_config_listener.
-
-2002-11-05 Dan Winship <danw@ximian.com>
-
- * backend/pas/pas-backend-ldap.c (send_pending_adds): copy a
- memleak fix from pas-backend-ad.
-
-2002-11-05 Chris Toshok <toshok@ximian.com>
-
- * backend/ebook/e-card.c: g_date_* => g_date_get_*, fixes
- G_DISABLE_DEPRECATED build.
-
- * backend/ebook/e-book-listener.[ch]: remove the servant crap i'd
- c&p'ed and put in here.
-
- * backend/ebook/e-book-view-listener.[ch]: remove the servant crap
- i'd c&p'ed and put in here.
-
- * backend/pas/pas-book-factory.[ch]: subclass from BonoboObject,
- and remove the servant crap from here too. whee.
-
- * backend/pas/pas-card-cursor.[ch]: remove the servant crap i'd
- c&p'ed and put in here.
-
- * backend/pas/pas-book.[ch]: remove the servant crap i'd c&p'ed
- and put in here.
-
- * backend/pas/pas-book-view.[ch]: remove the servant crap i'd
- c&p'ed and put in here.
-
-2002-11-05 Chris Toshok <toshok@ximian.com>
-
- * backend/pas/pas-backend-card-sexp.[ch]: port to gnome 2.
-
- * backend/pas/pas-backend-file.[ch]: same.
-
- * backend/pas/pas-backend-file.[ch]: same.
-
- * backend/pas/pas-backend-ldap.[ch]: same.
-
- * backend/pas/pas-backend-summary.[ch]: same.
-
- * backend/pas/pas-backend.[ch]: same.
-
- * backend/pas/pas-book-factory.[ch]: same.
-
- * backend/pas/pas-book-view.[ch]: same.
-
- * backend/pas/pas-book.[ch]: same.
-
- * backend/pas/pas-card-cursor.[ch]: same.
-
- * backend/pas/pas-marshal.list: list of marshallers.
-
- * backend/pas/Makefile.am (libpas_a_SOURCES): add pas-marshal.c
- also add the marshal building foo.
-
- * backend/pas/.cvsignore: ignore pas-marshal.[ch]
-
-2002-11-05 Chris Toshok <toshok@ximian.com>
-
- * backend/ebook/test-client-list.c (main): don't call
- bonobo_activation_init directly.
-
- * backend/ebook/test-client.c (get_card_cb): don't unref the card
- here since we never reffed it.
- (main): no need to call bonobo_activation_init, as
- gnome_program_init did it for us.
-
- * backend/ebook/e-card-simple.c (e_card_simple_get_property):
- s/g_value_{set,get}_pointer/g_value_{set,get}_object
-
- * backend/ebook/e-book-util.c (set_default_book_uri_local): make
- sure to terminate args with NULL for g_build_filename.
-
- * backend/ebook/e-book-listener.c: nuke e_book_listener_get_type
- and use the BONOBO_TYPE_FUNC_FULL macro.
-
- * backend/ebook/e-book-listener.h: add the epv to
- EBookListenerClass so BONOBO_TYPE_FUNC_FULL works.
-
- * backend/ebook/e-book-view-listener.c: nuke
- e_book_view_listener_get_type and use the BONOBO_TYPE_FUNC_FULL
- macro.
-
- * backend/ebook/e-book-view-listener.h: add the epv to
- EBookViewListenerClass so BONOBO_TYPE_FUNC_FULL works.
-
-2002-11-02 Chris Toshok <toshok@ximian.com>
-
- * backend/ebook/e-book-types.h: just include glib.h instead of the
- gtk stuff.
-
- * backend/ebook/e-book-listener.[ch]: convert to
- GObject/bonobo-activation/etc/etc.
- * e-book-util.[ch]: same.
- * e-book-view-listener.[ch]: same.
- * e-book-view.[ch]: same.
- * e-book.[ch]: same.
- * e-card-compare.[ch]: same.
- * e-card-cursor.[ch]: same.
- * e-card-simple.[ch]: same.
- * e-card.[ch]: same.
- * e-destination.[ch]: same.
- * evolution-ldif-importer.c: same.
- * evolution-vcard-importer.c: same.
- * load-gnomecard-addressbook.c: same.
- * load-pine-addressbok.c: same.
- * test-card.c: same.
- * test-client-list.c: same.
- * test-client.c: same.
-
- * backend/ebook/Makefile.am: add e-book-marshal.c to SOURCES, add
- e-book-marshal.[ch] to CLEANFILES, and add e-book-marshal.list to
- EXTRA_DIST. Also, remove the camel libs from the test LDADD's,
- and leave e-destination.[ch] out of the build.
-
- * backend/ebook/.cvsignore: ignore e-book-marshal.[ch]
-
- * backend/ebook/e-book-marshal.list: marshallers for e-book.
+ [ Should fixes bugs #30323, #33097, #33930, #33332 ]
+ * gui/contact-editor/e-contact-editor.c: unref the *@(&E(@
+ select_names_contacts object. fixes the very, very, very
+ longstanding crash when modifying the list of completion folders.
2002-10-28 Larry Ewing <lewing@ximian.com>
diff --git a/addressbook/backend/ebook/e-card.c b/addressbook/backend/ebook/e-card.c
index 67787a20f9..18f381713c 100644
--- a/addressbook/backend/ebook/e-card.c
+++ b/addressbook/backend/ebook/e-card.c
@@ -12,6 +12,7 @@
#include "e-card.h"
+#include <gal/util/e-i18n.h>
#include <gal/widgets/e-unicode.h>
#include <ctype.h>
@@ -21,7 +22,8 @@
#include <time.h>
#include <math.h>
-#include <bonobo/bonobo-i18n.h>
+#include <gtk/gtkobject.h>
+#include <bonobo/bonobo-object-client.h>
#include <gal/util/e-util.h>
#include <libversit/vcc.h>
@@ -40,54 +42,52 @@
#define XEV_LIST_SHOW_ADDRESSES "X-EVOLUTION-LIST-SHOW_ADDRESSES"
#define XEV_RELATED_CONTACTS "X-EVOLUTION-RELATED_CONTACTS"
-/* Object property IDs */
+/* Object argument IDs */
enum {
- PROP_0,
- PROP_FILE_AS,
- PROP_FULL_NAME,
- PROP_NAME,
- PROP_ADDRESS,
- PROP_ADDRESS_LABEL,
- PROP_PHONE,
- PROP_EMAIL,
- PROP_BIRTH_DATE,
- PROP_URL,
- PROP_ORG,
- PROP_ORG_UNIT,
- PROP_OFFICE,
- PROP_TITLE,
- PROP_ROLE,
- PROP_MANAGER,
- PROP_ASSISTANT,
- PROP_NICKNAME,
- PROP_SPOUSE,
- PROP_ANNIVERSARY,
- PROP_MAILER,
- PROP_CALURI,
- PROP_FBURL,
- PROP_NOTE,
- PROP_RELATED_CONTACTS,
- PROP_CATEGORIES,
- PROP_CATEGORY_LIST,
- PROP_WANTS_HTML,
- PROP_WANTS_HTML_SET,
- PROP_EVOLUTION_LIST,
- PROP_EVOLUTION_LIST_SHOW_ADDRESSES,
- PROP_ARBITRARY,
- PROP_ID,
- PROP_LAST_USE,
- PROP_USE_SCORE,
+ ARG_0,
+ ARG_FILE_AS,
+ ARG_FULL_NAME,
+ ARG_NAME,
+ ARG_ADDRESS,
+ ARG_ADDRESS_LABEL,
+ ARG_PHONE,
+ ARG_EMAIL,
+ ARG_BIRTH_DATE,
+ ARG_URL,
+ ARG_ORG,
+ ARG_ORG_UNIT,
+ ARG_OFFICE,
+ ARG_TITLE,
+ ARG_ROLE,
+ ARG_MANAGER,
+ ARG_ASSISTANT,
+ ARG_NICKNAME,
+ ARG_SPOUSE,
+ ARG_ANNIVERSARY,
+ ARG_MAILER,
+ ARG_CALURI,
+ ARG_FBURL,
+ ARG_NOTE,
+ ARG_RELATED_CONTACTS,
+ ARG_CATEGORIES,
+ ARG_CATEGORY_LIST,
+ ARG_WANTS_HTML,
+ ARG_WANTS_HTML_SET,
+ ARG_EVOLUTION_LIST,
+ ARG_EVOLUTION_LIST_SHOW_ADDRESSES,
+ ARG_ARBITRARY,
+ ARG_ID,
+ ARG_LAST_USE,
+ ARG_USE_SCORE,
};
-static GObjectClass *parent_class;
-
static void parse(ECard *card, VObject *vobj, char *default_charset);
static void e_card_init (ECard *card);
static void e_card_class_init (ECardClass *klass);
-static void e_card_dispose (GObject *object);
-static void e_card_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
-static void e_card_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
+static void e_card_destroy (GtkObject *object);
+static void e_card_set_arg (GtkObject *object, GtkArg *arg, guint arg_id);
+static void e_card_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
static void assign_string(VObject *vobj, char *default_charset, char **string);
@@ -180,25 +180,24 @@ struct {
*
* Return value: The type ID of the &ECard class.
**/
-GType
+GtkType
e_card_get_type (void)
{
- static GType card_type = 0;
+ static GtkType card_type = 0;
if (!card_type) {
- static const GTypeInfo card_info = {
- sizeof (ECardClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) e_card_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
+ GtkTypeInfo card_info = {
+ "ECard",
sizeof (ECard),
- 0, /* n_preallocs */
- (GInstanceInitFunc) e_card_init,
+ sizeof (ECardClass),
+ (GtkClassInitFunc) e_card_class_init,
+ (GtkObjectInitFunc) e_card_init,
+ NULL, /* reserved_1 */
+ NULL, /* reserved_2 */
+ (GtkClassInitFunc) NULL
};
- card_type = g_type_register_static (G_TYPE_OBJECT, "ECard", &card_info, 0);
+ card_type = gtk_type_unique (gtk_object_get_type (), &card_info);
}
return card_type;
@@ -207,7 +206,7 @@ e_card_get_type (void)
ECard *
e_card_new_with_default_charset (char *vcard, char *default_charset)
{
- ECard *card = g_object_new (E_TYPE_CARD, NULL);
+ ECard *card = E_CARD(gtk_type_new(e_card_get_type()));
VObject *vobj = Parse_MIME(vcard, strlen(vcard));
while(vobj) {
VObject *next;
@@ -246,7 +245,7 @@ e_card_duplicate(ECard *card)
if (card->book) {
new_card->book = card->book;
- g_object_ref (new_card->book);
+ gtk_object_ref (GTK_OBJECT (new_card->book));
}
return new_card;
@@ -280,7 +279,7 @@ e_card_get_use_score(ECard *card)
e_card_get_today (&today);
g_date_set_dmy (&last_use, card->last_use->day, card->last_use->month, card->last_use->year);
- days_since_last_use = g_date_get_julian (&today) - g_date_get_julian (&last_use);
+ days_since_last_use = g_date_julian (&today) - g_date_julian (&last_use);
/* Apply a seven-day "grace period" to the use score decay. */
days_since_last_use -= 7;
@@ -304,9 +303,9 @@ e_card_touch(ECard *card)
if (card->last_use == NULL)
card->last_use = g_new (ECardDate, 1);
- card->last_use->day = g_date_get_day (&today);
- card->last_use->month = g_date_get_month (&today);
- card->last_use->year = g_date_get_year (&today);
+ card->last_use->day = g_date_day (&today);
+ card->last_use->month = g_date_month (&today);
+ card->last_use->year = g_date_year (&today);
card->raw_use_score = use_score + 1.0;
}
@@ -358,10 +357,10 @@ e_card_set_book (ECard *card, EBook *book)
g_return_if_fail (card && E_IS_CARD (card));
if (card->book)
- g_object_unref (card->book);
+ gtk_object_unref (GTK_OBJECT (card->book));
card->book = book;
if (card->book)
- g_object_ref (card->book);
+ gtk_object_ref (GTK_OBJECT (card->book));
}
gchar *
@@ -541,7 +540,7 @@ e_card_get_vobject (const ECard *card, gboolean assumeUTF8)
if (!(is_ascii || assumeUTF8))
addPropValue (addressprop, "CHARSET", "UTF-8");
}
- g_object_unref(iterator);
+ gtk_object_unref(GTK_OBJECT(iterator));
}
if ( card->address_label ) {
@@ -556,7 +555,7 @@ e_card_get_vobject (const ECard *card, gboolean assumeUTF8)
set_address_flags (labelprop, address_label->flags);
}
- g_object_unref(iterator);
+ gtk_object_unref(GTK_OBJECT(iterator));
}
if ( card->phone ) {
@@ -568,25 +567,17 @@ e_card_get_vobject (const ECard *card, gboolean assumeUTF8)
set_phone_flags (phoneprop, phone->flags);
}
- g_object_unref(iterator);
+ gtk_object_unref(GTK_OBJECT(iterator));
}
if ( card->email ) {
EIterator *iterator = e_list_get_iterator(card->email);
for ( ; e_iterator_is_valid(iterator) ;e_iterator_next(iterator) ) {
VObject *emailprop;
- char *e = (char *) e_iterator_get(iterator);
- if (!strncmp (e, "<?xml", 5)) {
- EDestination *dest = e_destination_import (e);
- emailprop = ADD_PROP_VALUE(vobj, VCEmailAddressProp, e_destination_get_address (dest));
- g_object_unref (dest);
- }
- else {
- emailprop = ADD_PROP_VALUE(vobj, VCEmailAddressProp, e);
- }
+ emailprop = ADD_PROP_VALUE(vobj, VCEmailAddressProp, (char *) e_iterator_get(iterator));
addProp (emailprop, VCInternetProp);
}
- g_object_unref(iterator);
+ gtk_object_unref(GTK_OBJECT(iterator));
}
if ( card->bday ) {
@@ -837,9 +828,9 @@ parse_email(ECard *card, VObject *vobj, char *default_charset)
EList *list;
assign_string(vobj, default_charset, &next_email);
- g_object_get(card,
- "email", &list,
- NULL);
+ gtk_object_get(GTK_OBJECT(card),
+ "email", &list,
+ NULL);
e_list_append(list, next_email);
g_free (next_email);
}
@@ -867,9 +858,9 @@ parse_phone(ECard *card, VObject *vobj, char *default_charset)
assign_string(vobj, default_charset, &(next_phone->number));
next_phone->flags = get_phone_flags(vobj);
- g_object_get(card,
- "phone", &list,
- NULL);
+ gtk_object_get(GTK_OBJECT(card),
+ "phone", &list,
+ NULL);
e_list_append(list, next_phone);
e_card_phone_unref (next_phone);
}
@@ -889,9 +880,9 @@ parse_address(ECard *card, VObject *vobj, char *default_charset)
next_addr->code = e_v_object_get_child_value (vobj, VCPostalCodeProp, default_charset);
next_addr->country = e_v_object_get_child_value (vobj, VCCountryNameProp, default_charset);
- g_object_get(card,
- "address", &list,
- NULL);
+ gtk_object_get(GTK_OBJECT(card),
+ "address", &list,
+ NULL);
e_list_append(list, next_addr);
e_card_delivery_address_unref (next_addr);
}
@@ -905,9 +896,9 @@ parse_address_label(ECard *card, VObject *vobj, char *default_charset)
next_addr->flags = get_address_flags (vobj);
assign_string(vobj, default_charset, &next_addr->data);
- g_object_get(card,
- "address_label", &list,
- NULL);
+ gtk_object_get(GTK_OBJECT(card),
+ "address_label", &list,
+ NULL);
e_list_append(list, next_addr);
e_card_address_label_unref (next_addr);
}
@@ -1059,7 +1050,7 @@ add_list_unique(ECard *card, EList *list, char *string)
e_list_append(list, temp);
}
g_free(temp);
- g_object_unref(iterator);
+ gtk_object_unref(GTK_OBJECT(iterator));
}
static void
@@ -1069,9 +1060,9 @@ do_parse_categories(ECard *card, char *str)
char *copy = g_new(char, length + 1);
int i, j;
EList *list;
- g_object_get(card,
- "category_list", &list,
- NULL);
+ gtk_object_get(GTK_OBJECT(card),
+ "category_list", &list,
+ NULL);
for (i = 0, j = 0; str[i]; i++, j++) {
switch (str[i]) {
case '\\':
@@ -1194,9 +1185,9 @@ parse_arbitrary(ECard *card, VObject *vobj, char *default_charset)
assign_string(vobj, default_charset, &(arbitrary->value));
- g_object_get(card,
- "arbitrary", &list,
- NULL);
+ gtk_object_get(GTK_OBJECT(card),
+ "arbitrary", &list,
+ NULL);
e_list_append(list, arbitrary);
e_card_arbitrary_unref(arbitrary);
}
@@ -1238,7 +1229,7 @@ parse_use_score(ECard *card, VObject *vobj, char *default_charset)
static void
parse_attribute(ECard *card, VObject *vobj, char *default_charset)
{
- ParsePropertyFunc function = g_hash_table_lookup(E_CARD_GET_CLASS(card)->attribute_jump_table, vObjectName(vobj));
+ ParsePropertyFunc function = g_hash_table_lookup(E_CARD_CLASS(GTK_OBJECT(card)->klass)->attribute_jump_table, vObjectName(vobj));
if ( function )
function(card, vobj, default_charset);
}
@@ -1276,11 +1267,9 @@ static void
e_card_class_init (ECardClass *klass)
{
int i;
- GObjectClass *object_class;
-
- object_class = G_OBJECT_CLASS(klass);
+ GtkObjectClass *object_class;
- parent_class = g_type_class_ref (G_TYPE_OBJECT);
+ object_class = GTK_OBJECT_CLASS(klass);
klass->attribute_jump_table = g_hash_table_new(g_str_hash, g_str_equal);
@@ -1288,250 +1277,79 @@ e_card_class_init (ECardClass *klass)
g_hash_table_insert(klass->attribute_jump_table, attribute_jump_array[i].key, attribute_jump_array[i].function);
}
- object_class->dispose = e_card_dispose;
- object_class->get_property = e_card_get_property;
- object_class->set_property = e_card_set_property;
-
- g_object_class_install_property (object_class, PROP_FILE_AS,
- g_param_spec_string ("file_as",
- _("File As"),
- /*_( */"XXX blurb" /*)*/,
- NULL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_FULL_NAME,
- g_param_spec_string ("full_name",
- _("Full Name"),
- /*_( */"XXX blurb" /*)*/,
- NULL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_NAME,
- g_param_spec_pointer ("name",
- _("Name"),
- /*_( */"XXX blurb" /*)*/,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_ADDRESS,
- g_param_spec_object ("address",
- _("Address"),
- /*_( */"XXX blurb" /*)*/,
- E_TYPE_LIST,
- G_PARAM_READABLE));
-
- g_object_class_install_property (object_class, PROP_ADDRESS_LABEL,
- g_param_spec_object ("address_label",
- _("Address Label"),
- /*_( */"XXX blurb" /*)*/,
- E_TYPE_LIST,
- G_PARAM_READABLE));
-
- g_object_class_install_property (object_class, PROP_PHONE,
- g_param_spec_object ("phone",
- _("Phone"),
- /*_( */"XXX blurb" /*)*/,
- E_TYPE_LIST,
- G_PARAM_READABLE));
-
- g_object_class_install_property (object_class, PROP_EMAIL,
- g_param_spec_object ("email",
- _("Email"),
- /*_( */"XXX blurb" /*)*/,
- E_TYPE_LIST,
- G_PARAM_READABLE));
-
- g_object_class_install_property (object_class, PROP_BIRTH_DATE,
- g_param_spec_pointer ("birth_date",
- _("Birth date"),
- /*_( */"XXX blurb" /*)*/,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_URL,
- g_param_spec_string ("url",
- _("URL"),
- /*_( */"XXX blurb" /*)*/,
- NULL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_ORG,
- g_param_spec_string ("org",
- _("Organization"),
- /*_( */"XXX blurb" /*)*/,
- NULL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_ORG_UNIT,
- g_param_spec_string ("org_unit",
- _("Organizational Unit"),
- /*_( */"XXX blurb" /*)*/,
- NULL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_OFFICE,
- g_param_spec_string ("office",
- _("Office"),
- /*_( */"XXX blurb" /*)*/,
- NULL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_TITLE,
- g_param_spec_string ("title",
- _("Title"),
- /*_( */"XXX blurb" /*)*/,
- NULL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_ROLE,
- g_param_spec_string ("role",
- _("Role"),
- /*_( */"XXX blurb" /*)*/,
- NULL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_MANAGER,
- g_param_spec_string ("manager",
- _("Manager"),
- /*_( */"XXX blurb" /*)*/,
- NULL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_ASSISTANT,
- g_param_spec_string ("assistant",
- _("Assistant"),
- /*_( */"XXX blurb" /*)*/,
- NULL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_NICKNAME,
- g_param_spec_string ("nickname",
- _("Nickname"),
- /*_( */"XXX blurb" /*)*/,
- NULL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_SPOUSE,
- g_param_spec_string ("spouse",
- _("Spouse"),
- /*_( */"XXX blurb" /*)*/,
- NULL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_ANNIVERSARY,
- g_param_spec_pointer ("anniversary",
- _("Anniversary"),
- /*_( */"XXX blurb" /*)*/,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_MAILER,
- g_param_spec_string ("mailer",
- _("Mailer"),
- /*_( */"XXX blurb" /*)*/,
- NULL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_CALURI,
- g_param_spec_string ("caluri",
- _("Calendar URI"),
- /*_( */"XXX blurb" /*)*/,
- NULL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_FBURL,
- g_param_spec_string ("fburl",
- _("Free/Busy URL"),
- /*_( */"XXX blurb" /*)*/,
- NULL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_NOTE,
- g_param_spec_string ("note",
- _("Note"),
- /*_( */"XXX blurb" /*)*/,
- NULL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_RELATED_CONTACTS,
- g_param_spec_string ("related_contacts",
- _("Related Contacts"),
- /*_( */"XXX blurb" /*)*/,
- NULL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_CATEGORIES,
- g_param_spec_string ("categories",
- _("Categories"),
- /*_( */"XXX blurb" /*)*/,
- NULL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_CATEGORY_LIST,
- g_param_spec_object ("category list",
- _("Category List"),
- /*_( */"XXX blurb" /*)*/,
- E_TYPE_LIST,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_WANTS_HTML,
- g_param_spec_boolean ("wants_html",
- _("Wants HTML"),
- /*_( */"XXX blurb" /*)*/,
- FALSE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_WANTS_HTML_SET,
- g_param_spec_boolean ("wants_html_set",
- _("Wants HTML set"),
- /*_( */"XXX blurb" /*)*/,
- FALSE,
- G_PARAM_READABLE));
-
- g_object_class_install_property (object_class, PROP_EVOLUTION_LIST,
- g_param_spec_boolean ("list",
- _("List"),
- /*_( */"XXX blurb" /*)*/,
- FALSE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_EVOLUTION_LIST_SHOW_ADDRESSES,
- g_param_spec_boolean ("list_show_addresses",
- _("List Show Addresses"),
- /*_( */"XXX blurb" /*)*/,
- FALSE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_ARBITRARY,
- g_param_spec_object ("arbitrary",
- _("Arbitrary"),
- /*_( */"XXX blurb" /*)*/,
- E_TYPE_LIST,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_ID,
- g_param_spec_string ("id",
- _("ID"),
- /*_( */"XXX blurb" /*)*/,
- NULL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_LAST_USE,
- g_param_spec_pointer ("last_use",
- _("Last Use"),
- /*_( */"XXX blurb" /*)*/,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_USE_SCORE,
- /* XXX at some point we
- should remove
- LAX_VALIDATION and figure
- out some hard min & max
- scores. */
- g_param_spec_float ("use_score",
- _("Use Score"),
- /*_( */"XXX blurb" /*)*/,
- 0.0,
- 0.0,
- 0.0,
- G_PARAM_READWRITE | G_PARAM_LAX_VALIDATION));
+ gtk_object_add_arg_type ("ECard::file_as",
+ GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_FILE_AS);
+ gtk_object_add_arg_type ("ECard::full_name",
+ GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_FULL_NAME);
+ gtk_object_add_arg_type ("ECard::name",
+ GTK_TYPE_POINTER, GTK_ARG_READWRITE, ARG_NAME);
+ gtk_object_add_arg_type ("ECard::address",
+ GTK_TYPE_OBJECT, GTK_ARG_READABLE, ARG_ADDRESS);
+ gtk_object_add_arg_type ("ECard::address_label",
+ GTK_TYPE_OBJECT, GTK_ARG_READABLE, ARG_ADDRESS_LABEL);
+ gtk_object_add_arg_type ("ECard::phone",
+ GTK_TYPE_OBJECT, GTK_ARG_READABLE, ARG_PHONE);
+ gtk_object_add_arg_type ("ECard::email",
+ GTK_TYPE_OBJECT, GTK_ARG_READABLE, ARG_EMAIL);
+ gtk_object_add_arg_type ("ECard::birth_date",
+ GTK_TYPE_POINTER, GTK_ARG_READWRITE, ARG_BIRTH_DATE);
+ gtk_object_add_arg_type ("ECard::url",
+ GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_URL);
+ gtk_object_add_arg_type ("ECard::org",
+ GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_ORG);
+ gtk_object_add_arg_type ("ECard::org_unit",
+ GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_ORG_UNIT);
+ gtk_object_add_arg_type ("ECard::office",
+ GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_OFFICE);
+ gtk_object_add_arg_type ("ECard::title",
+ GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_TITLE);
+ gtk_object_add_arg_type ("ECard::role",
+ GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_ROLE);
+ gtk_object_add_arg_type ("ECard::manager",
+ GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_MANAGER);
+ gtk_object_add_arg_type ("ECard::assistant",
+ GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_ASSISTANT);
+ gtk_object_add_arg_type ("ECard::nickname",
+ GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_NICKNAME);
+ gtk_object_add_arg_type ("ECard::spouse",
+ GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_SPOUSE);
+ gtk_object_add_arg_type ("ECard::anniversary",
+ GTK_TYPE_POINTER, GTK_ARG_READWRITE, ARG_ANNIVERSARY);
+ gtk_object_add_arg_type ("ECard::mailer",
+ GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_MAILER);
+ gtk_object_add_arg_type ("ECard::caluri",
+ GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_CALURI);
+ gtk_object_add_arg_type ("ECard::fburl",
+ GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_FBURL);
+ gtk_object_add_arg_type ("ECard::note",
+ GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_NOTE);
+ gtk_object_add_arg_type ("ECard::related_contacts",
+ GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_RELATED_CONTACTS);
+ gtk_object_add_arg_type ("ECard::categories",
+ GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_CATEGORIES);
+ gtk_object_add_arg_type ("ECard::category_list",
+ GTK_TYPE_OBJECT, GTK_ARG_READWRITE, ARG_CATEGORY_LIST);
+ gtk_object_add_arg_type ("ECard::wants_html",
+ GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_WANTS_HTML);
+ gtk_object_add_arg_type ("ECard::wants_html_set",
+ GTK_TYPE_BOOL, GTK_ARG_READABLE, ARG_WANTS_HTML);
+ gtk_object_add_arg_type ("ECard::list",
+ GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_EVOLUTION_LIST);
+ gtk_object_add_arg_type ("ECard::list_show_addresses",
+ GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_EVOLUTION_LIST_SHOW_ADDRESSES);
+ gtk_object_add_arg_type ("ECard::arbitrary",
+ GTK_TYPE_OBJECT, GTK_ARG_READWRITE, ARG_ARBITRARY);
+ gtk_object_add_arg_type ("ECard::id",
+ GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_ID);
+ gtk_object_add_arg_type ("ECard::last_use",
+ GTK_TYPE_POINTER, GTK_ARG_READWRITE, ARG_LAST_USE);
+ gtk_object_add_arg_type ("ECard::use_score",
+ GTK_TYPE_FLOAT, GTK_ARG_READWRITE, ARG_USE_SCORE);
+
+
+ object_class->destroy = e_card_destroy;
+ object_class->get_arg = e_card_get_arg;
+ object_class->set_arg = e_card_set_arg;
}
ECardPhone *
@@ -1966,7 +1784,7 @@ e_card_email_match_string (const ECard *card, const gchar *str)
if (e_card_email_match_single_string (e_iterator_get (iter), str))
return TRUE;
}
- g_object_unref (iter);
+ gtk_object_unref (GTK_OBJECT (iter));
return FALSE;
}
@@ -1992,7 +1810,7 @@ e_card_email_find_number (const ECard *card, const gchar *email)
count = -1;
finished:
- g_object_unref (iter);
+ gtk_object_unref (GTK_OBJECT (iter));
return count;
}
@@ -2002,81 +1820,74 @@ e_card_email_find_number (const ECard *card, const gchar *email)
*/
static void
-e_card_dispose (GObject *object)
+e_card_destroy (GtkObject *object)
{
ECard *card = E_CARD(object);
+ g_free(card->id);
+ if (card->book)
+ gtk_object_unref (GTK_OBJECT (card->book));
+ g_free(card->file_as);
+ g_free(card->fname);
+ e_card_name_unref(card->name);
+ g_free(card->bday);
+
+ g_free(card->url);
+ g_free(card->org);
+ g_free(card->org_unit);
+ g_free(card->office);
+ g_free(card->title);
+ g_free(card->role);
+ g_free(card->manager);
+ g_free(card->assistant);
+ g_free(card->nickname);
+ g_free(card->spouse);
+ g_free(card->anniversary);
+ g_free(card->caluri);
+ g_free(card->fburl);
+ g_free(card->note);
+ g_free(card->related_contacts);
-#define FREE_IF(x) do { if ((x)) { g_free (x); x = NULL; } } while (0)
-#define UNREF_IF(x) do { if ((x)) { g_object_unref (x); x = NULL; } } while (0)
-
- FREE_IF (card->id);
- UNREF_IF (card->book);
- FREE_IF(card->file_as);
- FREE_IF(card->fname);
- if (card->name) {
- e_card_name_unref(card->name);
- card->name = NULL;
- }
- FREE_IF(card->bday);
-
- FREE_IF(card->url);
- FREE_IF(card->org);
- FREE_IF(card->org_unit);
- FREE_IF(card->office);
- FREE_IF(card->title);
- FREE_IF(card->role);
- FREE_IF(card->manager);
- FREE_IF(card->assistant);
- FREE_IF(card->nickname);
- FREE_IF(card->spouse);
- FREE_IF(card->anniversary);
- FREE_IF(card->caluri);
- FREE_IF(card->fburl);
- FREE_IF(card->note);
- FREE_IF(card->related_contacts);
-
- UNREF_IF (card->categories);
- UNREF_IF (card->email);
- UNREF_IF (card->phone);
- UNREF_IF (card->address);
- UNREF_IF (card->address_label);
-
- if (G_OBJECT_CLASS (parent_class)->dispose)
- G_OBJECT_CLASS (parent_class)->dispose (object);
+ if (card->categories)
+ gtk_object_unref(GTK_OBJECT(card->categories));
+ if (card->email)
+ gtk_object_unref(GTK_OBJECT(card->email));
+ if (card->phone)
+ gtk_object_unref(GTK_OBJECT(card->phone));
+ if (card->address)
+ gtk_object_unref(GTK_OBJECT(card->address));
+ if (card->address_label)
+ gtk_object_unref(GTK_OBJECT(card->address_label));
}
/* Set_arg handler for the card */
static void
-e_card_set_property (GObject *object,
- guint prop_id,
- const GValue *value,
- GParamSpec *pspec)
+e_card_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
{
ECard *card;
card = E_CARD (object);
- switch (prop_id) {
- case PROP_FILE_AS:
+ switch (arg_id) {
+ case ARG_FILE_AS:
g_free(card->file_as);
- card->file_as = g_strdup(g_value_get_string (value));
+ card->file_as = g_strdup(GTK_VALUE_STRING(*arg));
if (card->file_as == NULL)
card->file_as = g_strdup("");
break;
- case PROP_FULL_NAME:
+ case ARG_FULL_NAME:
g_free(card->fname);
- card->fname = g_strdup(g_value_get_string (value));
+ card->fname = g_strdup(GTK_VALUE_STRING(*arg));
if (card->fname == NULL)
card->fname = g_strdup("");
e_card_name_unref (card->name);
card->name = e_card_name_from_string (card->fname);
break;
- case PROP_NAME:
+ case ARG_NAME:
e_card_name_unref (card->name);
- card->name = e_card_name_ref(g_value_get_pointer (value));
+ card->name = e_card_name_ref(GTK_VALUE_POINTER(*arg));
if (card->name == NULL)
card->name = e_card_name_new();
if (card->fname == NULL) {
@@ -2096,189 +1907,185 @@ e_card_set_property (GObject *object,
card->file_as = string;
}
break;
- case PROP_CATEGORIES:
+ case ARG_CATEGORIES:
if (card->categories)
- g_object_unref(card->categories);
+ gtk_object_unref(GTK_OBJECT(card->categories));
card->categories = NULL;
- if (g_value_get_string (value))
- do_parse_categories(card, (char*)g_value_get_string (value));
+ if (GTK_VALUE_STRING(*arg))
+ do_parse_categories(card, GTK_VALUE_STRING(*arg));
break;
- case PROP_CATEGORY_LIST:
+ case ARG_CATEGORY_LIST:
if (card->categories)
- g_object_unref(card->categories);
- card->categories = E_LIST(g_value_get_pointer(value));
+ gtk_object_unref(GTK_OBJECT(card->categories));
+ card->categories = E_LIST(GTK_VALUE_OBJECT(*arg));
if (card->categories)
- g_object_ref(card->categories);
+ gtk_object_ref(GTK_OBJECT(card->categories));
break;
- case PROP_BIRTH_DATE:
+ case ARG_BIRTH_DATE:
g_free(card->bday);
- if (g_value_get_pointer (value)) {
+ if (GTK_VALUE_POINTER (*arg)) {
card->bday = g_new (ECardDate, 1);
- memcpy (card->bday, g_value_get_pointer (value), sizeof (ECardDate));
+ memcpy (card->bday, GTK_VALUE_POINTER (*arg), sizeof (ECardDate));
} else {
card->bday = NULL;
}
break;
- case PROP_URL:
+ case ARG_URL:
g_free(card->url);
- card->url = g_strdup(g_value_get_string(value));
+ card->url = g_strdup(GTK_VALUE_STRING(*arg));
break;
- case PROP_ORG:
+ case ARG_ORG:
g_free(card->org);
- card->org = g_strdup(g_value_get_string(value));
+ card->org = g_strdup(GTK_VALUE_STRING(*arg));
break;
- case PROP_ORG_UNIT:
+ case ARG_ORG_UNIT:
g_free(card->org_unit);
- card->org_unit = g_strdup(g_value_get_string(value));
+ card->org_unit = g_strdup(GTK_VALUE_STRING(*arg));
break;
- case PROP_OFFICE:
+ case ARG_OFFICE:
g_free(card->office);
- card->office = g_strdup(g_value_get_string(value));
+ card->office = g_strdup(GTK_VALUE_STRING(*arg));
break;
- case PROP_TITLE:
+ case ARG_TITLE:
g_free(card->title);
- card->title = g_strdup(g_value_get_string(value));
+ card->title = g_strdup(GTK_VALUE_STRING(*arg));
break;
- case PROP_ROLE:
+ case ARG_ROLE:
g_free(card->role);
- card->role = g_strdup(g_value_get_string(value));
+ card->role = g_strdup(GTK_VALUE_STRING(*arg));
break;
- case PROP_MANAGER:
+ case ARG_MANAGER:
g_free(card->manager);
- card->manager = g_strdup(g_value_get_string(value));
+ card->manager = g_strdup(GTK_VALUE_STRING(*arg));
break;
- case PROP_ASSISTANT:
+ case ARG_ASSISTANT:
g_free(card->assistant);
- card->assistant = g_strdup(g_value_get_string(value));
+ card->assistant = g_strdup(GTK_VALUE_STRING(*arg));
break;
- case PROP_NICKNAME:
+ case ARG_NICKNAME:
g_free(card->nickname);
- card->nickname = g_strdup(g_value_get_string(value));
+ card->nickname = g_strdup(GTK_VALUE_STRING(*arg));
break;
- case PROP_SPOUSE:
+ case ARG_SPOUSE:
g_free(card->spouse);
- card->spouse = g_strdup(g_value_get_string(value));
+ card->spouse = g_strdup(GTK_VALUE_STRING(*arg));
break;
- case PROP_ANNIVERSARY:
+ case ARG_ANNIVERSARY:
g_free(card->anniversary);
- if (g_value_get_pointer (value)) {
+ if (GTK_VALUE_POINTER (*arg)) {
card->anniversary = g_new (ECardDate, 1);
- memcpy (card->anniversary, g_value_get_pointer (value), sizeof (ECardDate));
+ memcpy (card->anniversary, GTK_VALUE_POINTER (*arg), sizeof (ECardDate));
} else {
card->anniversary = NULL;
}
break;
- case PROP_MAILER:
+ case ARG_MAILER:
g_free(card->mailer);
- card->mailer = g_strdup(g_value_get_string(value));
+ card->mailer = g_strdup(GTK_VALUE_STRING(*arg));
break;
- case PROP_CALURI:
+ case ARG_CALURI:
g_free(card->caluri);
- card->caluri = g_strdup(g_value_get_string(value));
+ card->caluri = g_strdup(GTK_VALUE_STRING(*arg));
break;
- case PROP_FBURL:
+ case ARG_FBURL:
g_free(card->fburl);
- card->fburl = g_strdup(g_value_get_string(value));
+ card->fburl = g_strdup(GTK_VALUE_STRING(*arg));
break;
- case PROP_NOTE:
+ case ARG_NOTE:
g_free (card->note);
- card->note = g_strdup(g_value_get_string(value));
+ card->note = g_strdup(GTK_VALUE_STRING(*arg));
break;
- case PROP_RELATED_CONTACTS:
+ case ARG_RELATED_CONTACTS:
g_free (card->related_contacts);
- card->related_contacts = g_strdup(g_value_get_string(value));
+ card->related_contacts = g_strdup(GTK_VALUE_STRING(*arg));
break;
- case PROP_WANTS_HTML:
- card->wants_html = g_value_get_boolean (value);
+ case ARG_WANTS_HTML:
+ card->wants_html = GTK_VALUE_BOOL(*arg);
card->wants_html_set = TRUE;
break;
- case PROP_ARBITRARY:
+ case ARG_ARBITRARY:
if (card->arbitrary)
- g_object_unref(card->arbitrary);
- card->arbitrary = E_LIST(g_value_get_pointer(value));
+ gtk_object_unref(GTK_OBJECT(card->arbitrary));
+ card->arbitrary = E_LIST(GTK_VALUE_OBJECT(*arg));
if (card->arbitrary)
- g_object_ref(card->arbitrary);
+ gtk_object_ref(GTK_OBJECT(card->arbitrary));
break;
- case PROP_ID:
+ case ARG_ID:
g_free(card->id);
- card->id = g_strdup(g_value_get_string(value));
+ card->id = g_strdup(GTK_VALUE_STRING(*arg));
if (card->id == NULL)
card->id = g_strdup ("");
break;
- case PROP_LAST_USE:
+ case ARG_LAST_USE:
g_free(card->last_use);
- if (g_value_get_pointer (value)) {
+ if (GTK_VALUE_POINTER (*arg)) {
card->last_use = g_new (ECardDate, 1);
- memcpy (card->last_use, g_value_get_pointer (value), sizeof (ECardDate));
+ memcpy (card->last_use, GTK_VALUE_POINTER (*arg), sizeof (ECardDate));
} else {
card->last_use = NULL;
}
break;
- case PROP_USE_SCORE:
- card->raw_use_score = g_value_get_float (value);
+ case ARG_USE_SCORE:
+ card->raw_use_score = GTK_VALUE_FLOAT(*arg);
break;
- case PROP_EVOLUTION_LIST:
- card->list = g_value_get_boolean (value);
+ case ARG_EVOLUTION_LIST:
+ card->list = GTK_VALUE_BOOL(*arg);
break;
- case PROP_EVOLUTION_LIST_SHOW_ADDRESSES:
- card->list_show_addresses = g_value_get_boolean (value);
+ case ARG_EVOLUTION_LIST_SHOW_ADDRESSES:
+ card->list_show_addresses = GTK_VALUE_BOOL(*arg);
break;
default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
+ return;
}
}
/* Get_arg handler for the card */
static void
-e_card_get_property (GObject *object,
- guint prop_id,
- GValue *value,
- GParamSpec *pspec)
+e_card_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
{
ECard *card;
card = E_CARD (object);
- switch (prop_id) {
- case PROP_FILE_AS:
- g_value_set_string (value, card->file_as);
+ switch (arg_id) {
+ case ARG_FILE_AS:
+ GTK_VALUE_STRING (*arg) = card->file_as;
break;
- case PROP_FULL_NAME:
- g_value_set_string (value, card->fname);
+ case ARG_FULL_NAME:
+ GTK_VALUE_STRING (*arg) = card->fname;
break;
- case PROP_NAME:
- g_value_set_pointer (value, card->name);
+ case ARG_NAME:
+ GTK_VALUE_POINTER(*arg) = card->name;
break;
- case PROP_ADDRESS:
+ case ARG_ADDRESS:
if (!card->address)
card->address = e_list_new((EListCopyFunc) e_card_delivery_address_ref,
(EListFreeFunc) e_card_delivery_address_unref,
NULL);
- g_value_set_object (value, card->address);
+ GTK_VALUE_OBJECT(*arg) = GTK_OBJECT(card->address);
break;
- case PROP_ADDRESS_LABEL:
+ case ARG_ADDRESS_LABEL:
if (!card->address_label)
card->address_label = e_list_new((EListCopyFunc) e_card_address_label_ref,
(EListFreeFunc) e_card_address_label_unref,
NULL);
- g_value_set_object (value, card->address_label);
+ GTK_VALUE_OBJECT(*arg) = GTK_OBJECT(card->address_label);
break;
- case PROP_PHONE:
+ case ARG_PHONE:
if (!card->phone)
card->phone = e_list_new((EListCopyFunc) e_card_phone_ref,
(EListFreeFunc) e_card_phone_unref,
NULL);
- g_value_set_object (value, card->phone);
+ GTK_VALUE_OBJECT(*arg) = GTK_OBJECT(card->phone);
break;
- case PROP_EMAIL:
+ case ARG_EMAIL:
if (!card->email)
card->email = e_list_new((EListCopyFunc) g_strdup,
(EListFreeFunc) g_free,
NULL);
- g_value_set_object (value, card->email);
+ GTK_VALUE_OBJECT(*arg) = GTK_OBJECT(card->email);
break;
- case PROP_CATEGORIES:
+ case ARG_CATEGORIES:
{
int i;
char ** strs;
@@ -2294,99 +2101,100 @@ e_card_get_property (GObject *object,
strs[i] = (char *)e_iterator_get(iterator);
}
strs[i] = 0;
- g_value_set_string(value, g_strjoinv(", ", strs)); /* XXX leak here? */
+ GTK_VALUE_STRING(*arg) = g_strjoinv(", ", strs);
g_free(strs);
}
break;
- case PROP_CATEGORY_LIST:
+ case ARG_CATEGORY_LIST:
if (!card->categories)
card->categories = e_list_new((EListCopyFunc) g_strdup,
(EListFreeFunc) g_free,
NULL);
- g_value_set_object (value, card->categories);
+ GTK_VALUE_OBJECT(*arg) = GTK_OBJECT(card->categories);
break;
- case PROP_BIRTH_DATE:
- g_value_set_pointer (value, card->bday);
+ case ARG_BIRTH_DATE:
+ GTK_VALUE_POINTER(*arg) = card->bday;
break;
- case PROP_URL:
- g_value_set_string (value, card->url);
+ case ARG_URL:
+ GTK_VALUE_STRING(*arg) = card->url;
break;
- case PROP_ORG:
- g_value_set_string (value, card->org);
+ case ARG_ORG:
+ GTK_VALUE_STRING(*arg) = card->org;
break;
- case PROP_ORG_UNIT:
- g_value_set_string (value, card->org_unit);
+ case ARG_ORG_UNIT:
+ GTK_VALUE_STRING(*arg) = card->org_unit;
break;
- case PROP_OFFICE:
- g_value_set_string (value, card->office);
+ case ARG_OFFICE:
+ GTK_VALUE_STRING(*arg) = card->office;
break;
- case PROP_TITLE:
- g_value_set_string (value, card->title);
+ case ARG_TITLE:
+ GTK_VALUE_STRING(*arg) = card->title;
break;
- case PROP_ROLE:
- g_value_set_string (value, card->role);
+ case ARG_ROLE:
+ GTK_VALUE_STRING(*arg) = card->role;
break;
- case PROP_MANAGER:
- g_value_set_string (value, card->manager);
+ case ARG_MANAGER:
+ GTK_VALUE_STRING(*arg) = card->manager;
break;
- case PROP_ASSISTANT:
- g_value_set_string (value, card->assistant);
+ case ARG_ASSISTANT:
+ GTK_VALUE_STRING(*arg) = card->assistant;
break;
- case PROP_NICKNAME:
- g_value_set_string (value, card->nickname);
+ case ARG_NICKNAME:
+ GTK_VALUE_STRING(*arg) = card->nickname;
break;
- case PROP_SPOUSE:
- g_value_set_string (value, card->spouse);
+ case ARG_SPOUSE:
+ GTK_VALUE_STRING(*arg) = card->spouse;
break;
- case PROP_ANNIVERSARY:
- g_value_set_pointer (value, card->anniversary);
+ case ARG_ANNIVERSARY:
+ GTK_VALUE_POINTER(*arg) = card->anniversary;
break;
- case PROP_MAILER:
- g_value_set_string (value, card->mailer);
+ case ARG_MAILER:
+ GTK_VALUE_STRING(*arg) = card->mailer;
break;
- case PROP_CALURI:
- g_value_set_string (value, card->caluri);
+ case ARG_CALURI:
+ GTK_VALUE_STRING(*arg) = card->caluri;
break;
- case PROP_FBURL:
- g_value_set_string (value, card->fburl);
+ case ARG_FBURL:
+ GTK_VALUE_STRING(*arg) = card->fburl;
break;
- case PROP_NOTE:
- g_value_set_string (value, card->note);
+ case ARG_NOTE:
+ GTK_VALUE_STRING(*arg) = card->note;
break;
- case PROP_RELATED_CONTACTS:
- g_value_set_string (value, card->related_contacts);
+ case ARG_RELATED_CONTACTS:
+ GTK_VALUE_STRING(*arg) = card->related_contacts;
break;
- case PROP_WANTS_HTML:
- g_value_set_boolean (value, card->wants_html);
+ case ARG_WANTS_HTML:
+ GTK_VALUE_BOOL(*arg) = card->wants_html;
break;
- case PROP_WANTS_HTML_SET:
- g_value_set_boolean (value, card->wants_html_set);
+ case ARG_WANTS_HTML_SET:
+ GTK_VALUE_BOOL(*arg) = card->wants_html_set;
break;
- case PROP_ARBITRARY:
+ case ARG_ARBITRARY:
if (!card->arbitrary)
card->arbitrary = e_list_new((EListCopyFunc) e_card_arbitrary_ref,
(EListFreeFunc) e_card_arbitrary_unref,
NULL);
- g_value_set_object (value, card->arbitrary);
+ GTK_VALUE_OBJECT(*arg) = GTK_OBJECT(card->arbitrary);
break;
- case PROP_ID:
- g_value_set_string (value, card->id);
+ case ARG_ID:
+ GTK_VALUE_STRING(*arg) = card->id;
break;
- case PROP_LAST_USE:
- g_value_set_pointer (value, card->last_use);
+ case ARG_LAST_USE:
+ GTK_VALUE_POINTER(*arg) = card->last_use;
break;
- case PROP_USE_SCORE:
- g_value_set_float (value, e_card_get_use_score (card));
+
+ case ARG_USE_SCORE:
+ GTK_VALUE_FLOAT(*arg) = e_card_get_use_score (card);
break;
- case PROP_EVOLUTION_LIST:
- g_value_set_boolean (value, card->list);
+ case ARG_EVOLUTION_LIST:
+ GTK_VALUE_BOOL(*arg) = card->list;
break;
- case PROP_EVOLUTION_LIST_SHOW_ADDRESSES:
- g_value_set_boolean (value, card->list_show_addresses);
+ case ARG_EVOLUTION_LIST_SHOW_ADDRESSES:
+ GTK_VALUE_BOOL(*arg) = card->list_show_addresses;
break;
default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ arg->type = GTK_TYPE_INVALID;
break;
}
}
@@ -2441,7 +2249,7 @@ e_card_load_cards_from_file_with_default_charset(const char *filename, char *def
GList *list = NULL;
while(vobj) {
VObject *next;
- ECard *card = g_object_new (E_TYPE_CARD, NULL);
+ ECard *card = E_CARD(gtk_type_new(e_card_get_type()));
parse(card, vobj, default_charset);
next = nextVObjectInList(vobj);
cleanVObject(vobj);
@@ -2465,7 +2273,7 @@ e_card_load_cards_from_string_with_default_charset(const char *str, char *defaul
GList *list = NULL;
while(vobj) {
VObject *next;
- ECard *card = g_object_new (E_TYPE_CARD, NULL);
+ ECard *card = E_CARD(gtk_type_new(e_card_get_type()));
parse(card, vobj, default_charset);
next = nextVObjectInList(vobj);
cleanVObject(vobj);
@@ -2486,32 +2294,32 @@ void
e_card_free_empty_lists (ECard *card)
{
if (card->address && e_list_length (card->address) == 0) {
- g_object_unref (card->address);
+ gtk_object_unref (GTK_OBJECT (card->address));
card->address = NULL;
}
if (card->address_label && e_list_length (card->address_label) == 0) {
- g_object_unref (card->address_label);
+ gtk_object_unref (GTK_OBJECT (card->address_label));
card->address_label = NULL;
}
if (card->phone && e_list_length (card->phone) == 0) {
- g_object_unref (card->phone);
+ gtk_object_unref (GTK_OBJECT (card->phone));
card->phone = NULL;
}
if (card->email && e_list_length (card->email) == 0) {
- g_object_unref (card->email);
+ gtk_object_unref (GTK_OBJECT (card->email));
card->email = NULL;
}
if (card->categories && e_list_length (card->categories) == 0) {
- g_object_unref (card->categories);
+ gtk_object_unref (GTK_OBJECT (card->categories));
card->categories = NULL;
}
if (card->arbitrary && e_list_length (card->arbitrary) == 0) {
- g_object_unref (card->arbitrary);
+ gtk_object_unref (GTK_OBJECT (card->arbitrary));
card->arbitrary = NULL;
}
}
@@ -2721,16 +2529,21 @@ set_address_flags (VObject *vobj, ECardAddressFlags flags)
void
e_card_list_send (GList *cards, ECardDisposition disposition)
{
-#if PENDING_PORT_WORK
+ BonoboObjectClient *bonobo_server;
GNOME_Evolution_Composer composer_server;
CORBA_Environment ev;
if (cards == NULL)
return;
+
+ /* First, I obtain an object reference that represents the Composer. */
+ bonobo_server = bonobo_object_activate (COMPOSER_OAFID, 0);
+
+ g_return_if_fail (bonobo_server != NULL);
+
+ composer_server = bonobo_object_corba_objref (BONOBO_OBJECT (bonobo_server));
CORBA_exception_init (&ev);
-
- composer_server = bonobo_activation_activate_from_id (COMPOSER_OAFID, 0, NULL, &ev);
if (disposition == E_CARD_DISPOSITION_AS_TO) {
GNOME_Evolution_Composer_RecipientList *to_list, *cc_list, *bcc_list;
@@ -2809,7 +2622,7 @@ e_card_list_send (GList *cards, ECardDisposition disposition)
name = g_strdup (e_destination_get_name (dest));
addr = g_strdup (e_destination_get_email (dest));
free_name_addr = TRUE;
- g_object_unref (dest);
+ gtk_object_unref (GTK_OBJECT (dest));
}
} else { /* is just a plain old card */
@@ -2833,7 +2646,7 @@ e_card_list_send (GList *cards, ECardDisposition disposition)
break;
}
- g_object_unref (iterator);
+ gtk_object_unref (GTK_OBJECT (iterator));
}
cards = g_list_next (cards);
@@ -2871,9 +2684,9 @@ e_card_list_send (GList *cards, ECardDisposition disposition)
} else {
char *file_as;
- g_object_get(cards->data,
- "file_as", &file_as,
- NULL);
+ gtk_object_get(GTK_OBJECT(cards->data),
+ "file_as", &file_as,
+ NULL);
tempstr = g_strdup_printf (_("VCard for %s"), file_as);
description = CORBA_string_dup (tempstr);
@@ -2921,28 +2734,28 @@ e_card_list_send (GList *cards, ECardDisposition disposition)
const gchar *tempstr2;
tempstr2 = NULL;
- g_object_get(card,
- "file_as", &tempstr2,
- NULL);
+ gtk_object_get(GTK_OBJECT(card),
+ "file_as", &tempstr2,
+ NULL);
if (!tempstr2 || !*tempstr2)
- g_object_get(card,
- "full_name", &tempstr2,
- NULL);
+ gtk_object_get(GTK_OBJECT(card),
+ "full_name", &tempstr2,
+ NULL);
if (!tempstr2 || !*tempstr2)
- g_object_get(card,
- "org", &tempstr2,
- NULL);
+ gtk_object_get(GTK_OBJECT(card),
+ "org", &tempstr2,
+ NULL);
if (!tempstr2 || !*tempstr2) {
EList *list;
EIterator *iterator;
- g_object_get(card,
- "email", &list,
- NULL);
+ gtk_object_get(GTK_OBJECT(card),
+ "email", &list,
+ NULL);
iterator = e_list_get_iterator (list);
if (e_iterator_is_valid (iterator)) {
tempstr2 = e_iterator_get (iterator);
}
- g_object_unref (iterator);
+ gtk_object_unref (GTK_OBJECT (iterator));
}
if (!tempstr2 || !*tempstr2)
@@ -2970,7 +2783,6 @@ e_card_list_send (GList *cards, ECardDisposition disposition)
}
CORBA_exception_free (&ev);
-#endif
}
void
diff --git a/addressbook/backend/ebook/evolution-ldif-importer.c b/addressbook/backend/ebook/evolution-ldif-importer.c
index e0a85e685c..5602f3fb18 100644
--- a/addressbook/backend/ebook/evolution-ldif-importer.c
+++ b/addressbook/backend/ebook/evolution-ldif-importer.c
@@ -13,6 +13,9 @@
*/
#include <config.h>
+#include <bonobo.h>
+#include <gnome.h>
+#include <liboaf/liboaf.h>
#include <stdio.h>
#include <ctype.h>
@@ -266,9 +269,9 @@ parseLine( ECardSimple *simple, ECardDeliveryAddress *address, char **buf )
}
else if (!g_strcasecmp (ptr, "member")) {
EList *email;
- g_object_get (simple->card,
- "email", &email,
- NULL);
+ gtk_object_get (GTK_OBJECT (simple->card),
+ "email", &email,
+ NULL);
e_list_append (email, ldif_value->str);
}
}
@@ -323,7 +326,7 @@ getNextLDIFEntry( FILE *f )
while (buf) {
if (!parseLine (simple, address, &buf)) {
/* parsing error */
- g_object_unref (simple);
+ gtk_object_unref (GTK_OBJECT (simple));
e_card_delivery_address_unref (address);
return NULL;
}
@@ -371,17 +374,17 @@ resolve_list_card (LDIFImporter *gci, ECard *card)
if (!e_card_evolution_list (card))
return;
- g_object_get (card,
- "email", &email,
- "full_name", &full_name,
- NULL);
+ gtk_object_get (GTK_OBJECT (card),
+ "email", &email,
+ "full_name", &full_name,
+ NULL);
/* set file_as to full_name so we don't later try and figure
out a first/last name for the list. */
if (full_name)
- g_object_set (card,
- "file_as", full_name,
- NULL);
+ gtk_object_set (GTK_OBJECT (card),
+ "file_as", full_name,
+ NULL);
email_iter = e_list_get_iterator (email);
while (e_iterator_is_valid (email_iter)) {
@@ -394,7 +397,7 @@ resolve_list_card (LDIFImporter *gci, ECard *card)
gchar *dest_xml;
e_destination_set_card (dest, dn_card, 0); /* Hard-wired for default e-mail, since netscape only exports 1 email address */
dest_xml = e_destination_export (dest);
- g_object_unref (dest);
+ gtk_object_unref (GTK_OBJECT (dest));
if (dest_xml) {
e_iterator_set (email_iter, dest_xml);
g_free (dest_xml);
@@ -546,10 +549,10 @@ support_format_fn (EvolutionImporter *importer,
}
static void
-importer_destroy_cb (GObject *object,
+importer_destroy_cb (GtkObject *object,
LDIFImporter *gci)
{
- g_main_quit ();
+ gtk_main_quit ();
}
static gboolean
@@ -581,8 +584,8 @@ factory_fn (BonoboGenericFactory *_factory,
importer = evolution_importer_new (support_format_fn, load_file_fn,
process_item_fn, NULL, gci);
- g_signal_connect (importer, "destroy",
- G_CALLBACK (importer_destroy_cb), gci);
+ gtk_signal_connect (GTK_OBJECT (importer), "destroy",
+ GTK_SIGNAL_FUNC (importer_destroy_cb), gci);
return BONOBO_OBJECT (importer);
}
@@ -612,8 +615,8 @@ main (int argc,
gnome_init_with_popt_table ("Evolution-LDIF-Importer",
"0.0", argc, argv, oaf_popt_options, 0,
NULL);
- orb = bonobo_activation_init (argc, argv);
- if (bonobo_init_full (&argc, argv, orb, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL) == FALSE) {
+ orb = oaf_init (argc, argv);
+ if (bonobo_init (orb, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL) == FALSE) {
g_error ("Could not initialize Bonobo.");
}
diff --git a/addressbook/backend/ebook/evolution-vcard-importer.c b/addressbook/backend/ebook/evolution-vcard-importer.c
index e18173ab87..f07192d72c 100644
--- a/addressbook/backend/ebook/evolution-vcard-importer.c
+++ b/addressbook/backend/ebook/evolution-vcard-importer.c
@@ -2,6 +2,7 @@
#include <config.h>
#include <stdio.h>
+#include <liboaf/liboaf.h>
#include <bonobo/bonobo-context.h>
#include <bonobo/bonobo-generic-factory.h>
#include <bonobo/bonobo-main.h>
@@ -30,7 +31,7 @@ static void
add_card_cb (EBook *book, EBookStatus status, const gchar *id, gpointer closure)
{
ECard *card = E_CARD(closure);
- g_object_unref(card);
+ gtk_object_unref(GTK_OBJECT(card));
}
static void
@@ -149,7 +150,7 @@ check_file_is_vcard (const char *filename)
return FALSE;
}
- if (g_ascii_strncasecmp (line, "BEGIN:VCARD", 11) == 0) {
+ if (g_strncasecmp (line, "BEGIN:VCARD", 11) == 0) {
result = TRUE;
} else {
result = FALSE;
@@ -172,7 +173,7 @@ support_format_fn (EvolutionImporter *importer,
return check_file_is_vcard (filename);
}
for (i = 0; supported_extensions[i] != NULL; i++) {
- if (g_ascii_strcasecmp (supported_extensions[i], ext) == 0)
+ if (g_strcasecmp (supported_extensions[i], ext) == 0)
return check_file_is_vcard (filename);
}
@@ -180,10 +181,10 @@ support_format_fn (EvolutionImporter *importer,
}
static void
-importer_destroy_cb (GObject *object,
+importer_destroy_cb (GtkObject *object,
VCardImporter *gci)
{
- g_main_quit ();
+ gtk_main_quit ();
}
static gboolean
@@ -220,8 +221,8 @@ factory_fn (BonoboGenericFactory *_factory,
importer = evolution_importer_new (support_format_fn, load_file_fn,
process_item_fn, NULL, gci);
- g_signal_connect (importer, "destroy",
- G_CALLBACK (importer_destroy_cb), gci);
+ gtk_signal_connect (GTK_OBJECT (importer), "destroy",
+ GTK_SIGNAL_FUNC (importer_destroy_cb), gci);
return BONOBO_OBJECT (importer);
}
@@ -251,8 +252,8 @@ main (int argc,
gnome_init_with_popt_table ("Evolution-VCard-Importer",
PACKAGE, argc, argv, oaf_popt_options, 0,
NULL);
- orb = bonobo_activation_init (argc, argv);
- if (bonobo_init_full (&argc, argv, orb, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL) == FALSE) {
+ orb = oaf_init (argc, argv);
+ if (bonobo_init (orb, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL) == FALSE) {
g_error ("Could not initialize Bonobo.");
}
diff --git a/addressbook/backend/pas/pas-backend-file.c b/addressbook/backend/pas/pas-backend-file.c
index 58e1a8405a..ddef2a568b 100644
--- a/addressbook/backend/pas/pas-backend-file.c
+++ b/addressbook/backend/pas/pas-backend-file.c
@@ -10,13 +10,15 @@
#include "pas-backend-file.h"
#include <stdio.h>
-#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <time.h>
#include <db.h>
#include <sys/stat.h>
+#include <libgnome/gnome-defs.h>
+#include <libgnome/gnome-i18n.h>
+
#include <e-util/e-db3-utils.h>
#if DB_VERSION_MAJOR != 3 || \
@@ -25,14 +27,15 @@
#error Including wrong DB3. Need libdb 3.1.17.
#endif
+#include <gtk/gtksignal.h>
+#include <libgnome/gnome-defs.h>
+#include <libgnome/gnome-util.h>
#include <gal/util/e-util.h>
#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>
-
#include "pas-book.h"
#include "pas-card-cursor.h"
#include "pas-backend-card-sexp.h"
@@ -211,7 +214,7 @@ pas_backend_file_book_view_copy(const PASBackendFileBookView *book_view, void *c
new_book_view->search = g_strdup(book_view->search);
new_book_view->card_sexp = book_view->card_sexp;
if (new_book_view->card_sexp)
- g_object_ref(new_book_view->card_sexp);
+ gtk_object_ref(GTK_OBJECT(new_book_view->card_sexp));
new_book_view->change_id = g_strdup(book_view->change_id);
if (book_view->change_context) {
@@ -233,7 +236,7 @@ pas_backend_file_book_view_free(PASBackendFileBookView *book_view, void *closure
{
g_free(book_view->search);
if (book_view->card_sexp)
- g_object_unref (book_view->card_sexp);
+ gtk_object_unref (GTK_OBJECT(book_view->card_sexp));
g_free(book_view->change_id);
if (book_view->change_context) {
@@ -271,7 +274,7 @@ get_nth(PASCardCursor *cursor, long n, gpointer data)
}
static void
-cursor_destroy(gpointer data, GObject *where_object_was)
+cursor_destroy(GtkObject *object, gpointer data)
{
CORBA_Environment ev;
GNOME_Evolution_Addressbook_Book corba_book;
@@ -297,7 +300,7 @@ cursor_destroy(gpointer data, GObject *where_object_was)
}
static void
-view_destroy(gpointer data, GObject *where_object_was)
+view_destroy(GtkObject *object, gpointer data)
{
PASBook *book = (PASBook *)data;
PASBackendFile *bf;
@@ -307,7 +310,7 @@ view_destroy(gpointer data, GObject *where_object_was)
bf = PAS_BACKEND_FILE(pas_book_get_backend(book));
for (iterator = e_list_get_iterator(bf->priv->book_views); e_iterator_is_valid(iterator); e_iterator_next(iterator)) {
const PASBackendFileBookView *view = e_iterator_get(iterator);
- if (view->book_view == (PASBookView*)where_object_was) {
+ if (view->book_view == PAS_BOOK_VIEW(object)) {
e_iterator_delete(iterator);
success = TRUE;
break;
@@ -315,7 +318,7 @@ view_destroy(gpointer data, GObject *where_object_was)
}
if (!success)
g_warning ("Failed to remove from book_views list");
- g_object_unref(iterator);
+ gtk_object_unref(GTK_OBJECT(iterator));
bonobo_object_unref(BONOBO_OBJECT(book));
}
@@ -363,7 +366,7 @@ pas_backend_file_search (PASBackendFile *bf,
pas_book_view_notify_status_message (view->book_view, _("Loading..."));
if (view->card_sexp) {
- g_object_unref (view->card_sexp);
+ gtk_object_unref (GTK_OBJECT(view->card_sexp));
view->card_sexp = NULL;
}
@@ -521,9 +524,9 @@ pas_backend_file_changes (PASBackendFile *bf,
* card changing
*/
card = e_card_new (vcard_dbt.data);
- g_object_set (card, "last_use", NULL, "use_score", 0.0, NULL);
+ gtk_object_set (GTK_OBJECT (card), "last_use", NULL, "use_score", 0.0, NULL);
vcard_string = e_card_get_vcard_assume_utf8 (card);
- g_object_unref (card);
+ gtk_object_unref (GTK_OBJECT (card));
/* check what type of change has occurred, if any */
switch (e_dbhash_compare (ehash, id, vcard_string)) {
@@ -633,7 +636,7 @@ do_create(PASBackend *backend,
ret_val = NULL;
}
- g_object_unref(card);
+ gtk_object_unref(GTK_OBJECT(card));
card = NULL;
if (vcard_ptr && ret_val)
@@ -665,7 +668,7 @@ pas_backend_file_process_create_card (PASBackend *backend,
bonobo_object_unref (BONOBO_OBJECT (view->book_view));
}
}
- g_object_unref(iterator);
+ gtk_object_unref(GTK_OBJECT(iterator));
pas_book_respond_create (
book,
@@ -735,7 +738,7 @@ pas_backend_file_process_remove_card (PASBackend *backend,
bonobo_object_unref (BONOBO_OBJECT (view->book_view));
}
}
- g_object_unref(iterator);
+ gtk_object_unref(GTK_OBJECT(iterator));
pas_book_respond_remove (
book,
@@ -819,7 +822,7 @@ pas_backend_file_process_modify_card (PASBackend *backend,
CORBA_exception_free (&ev);
}
- g_object_unref(iterator);
+ gtk_object_unref(GTK_OBJECT(iterator));
pas_book_respond_modify (
book,
@@ -836,7 +839,7 @@ pas_backend_file_process_modify_card (PASBackend *backend,
g_free(old_vcard_string);
- g_object_unref(card);
+ gtk_object_unref(GTK_OBJECT(card));
}
static void
@@ -970,8 +973,8 @@ pas_backend_file_process_get_cursor (PASBackend *backend,
get_nth,
cursor_data);
- g_object_weak_ref (G_OBJECT (cursor),
- cursor_destroy, cursor_data);
+ gtk_signal_connect(GTK_OBJECT(cursor), "destroy",
+ GTK_SIGNAL_FUNC(cursor_destroy), cursor_data);
pas_book_respond_get_cursor (
book,
@@ -997,7 +1000,8 @@ pas_backend_file_process_get_book_view (PASBackend *backend,
book_view = pas_book_view_new (req->listener);
- g_object_weak_ref (G_OBJECT (book_view), view_destroy, book);
+ gtk_signal_connect(GTK_OBJECT(book_view), "destroy",
+ GTK_SIGNAL_FUNC(view_destroy), book);
view.book_view = book_view;
view.search = g_strdup (req->search);
@@ -1016,7 +1020,7 @@ pas_backend_file_process_get_book_view (PASBackend *backend,
iterator = e_list_get_iterator(bf->priv->book_views);
e_iterator_last(iterator);
pas_backend_file_search (bf, book, e_iterator_get(iterator), FALSE);
- g_object_unref(iterator);
+ gtk_object_unref(GTK_OBJECT(iterator));
}
static void
@@ -1035,7 +1039,8 @@ pas_backend_file_process_get_completion_view (PASBackend *backend,
book_view = pas_book_view_new (req->listener);
- g_object_weak_ref (G_OBJECT (book_view), view_destroy, book);
+ gtk_signal_connect(GTK_OBJECT(book_view), "destroy",
+ GTK_SIGNAL_FUNC(view_destroy), book);
view.book_view = book_view;
view.search = g_strdup (req->search);
@@ -1054,7 +1059,7 @@ pas_backend_file_process_get_completion_view (PASBackend *backend,
iterator = e_list_get_iterator(bf->priv->book_views);
e_iterator_last(iterator);
pas_backend_file_search (bf, book, e_iterator_get(iterator), TRUE);
- g_object_unref(iterator);
+ gtk_object_unref(GTK_OBJECT(iterator));
}
static void
@@ -1074,7 +1079,8 @@ pas_backend_file_process_get_changes (PASBackend *backend,
book_view = pas_book_view_new (req->listener);
- g_object_weak_ref (G_OBJECT (book_view), view_destroy, book);
+ gtk_signal_connect(GTK_OBJECT(book_view), "destroy",
+ GTK_SIGNAL_FUNC(view_destroy), book);
pas_book_respond_get_changes (book,
(book_view != NULL
@@ -1099,7 +1105,7 @@ pas_backend_file_process_get_changes (PASBackend *backend,
iterator = e_list_get_iterator(bf->priv->book_views);
e_iterator_last(iterator);
pas_backend_file_changes (bf, book, e_iterator_get(iterator));
- g_object_unref(iterator);
+ gtk_object_unref(GTK_OBJECT(iterator));
}
static void
@@ -1148,8 +1154,8 @@ pas_backend_file_process_get_supported_fields (PASBackend *backend,
for (i = 0; i < E_CARD_SIMPLE_FIELD_LAST; i ++)
e_list_append (fields, e_card_simple_get_ecard_field (simple, i));
- g_object_unref (card);
- g_object_unref (simple);
+ gtk_object_unref (GTK_OBJECT (card));
+ gtk_object_unref (GTK_OBJECT (simple));
pas_book_respond_get_supported_fields (book,
GNOME_Evolution_Addressbook_BookListener_Success,
@@ -1218,11 +1224,13 @@ pas_backend_file_process_client_requests (PASBook *book)
}
static void
-pas_backend_file_book_destroy_cb (gpointer data, GObject *where_book_was)
+pas_backend_file_book_destroy_cb (PASBook *book, gpointer data)
{
- PASBackendFile *backend = PAS_BACKEND_FILE (data);
+ PASBackendFile *backend;
- pas_backend_remove_client (PAS_BACKEND (backend), (PASBook*)where_book_was);
+ backend = PAS_BACKEND_FILE (data);
+
+ pas_backend_remove_client (PAS_BACKEND (backend), book);
}
/*
@@ -1299,7 +1307,7 @@ pas_backend_file_upgrade_db (PASBackendFile *bf, char *old_version)
card_failed++;
}
- g_object_unref (card);
+ gtk_object_unref (GTK_OBJECT(card));
}
db_error = dbc->c_get(dbc, &id_dbt, &vcard_dbt, DB_NEXT);
@@ -1424,9 +1432,9 @@ pas_backend_file_load_uri (PASBackend *backend,
char *dir;
dir = g_dirname(filename);
- create_initial_file = g_build_filename (dir, "create-initial", NULL);
+ create_initial_file = g_concat_dir_and_file(dir, "create-initial");
- if (g_file_test(create_initial_file, G_FILE_TEST_EXISTS)) {
+ if (g_file_exists(create_initial_file)) {
char *id;
id = do_create(backend, INITIAL_VCARD, NULL);
g_free (id);
@@ -1517,10 +1525,11 @@ pas_backend_file_add_client (PASBackend *backend,
return FALSE;
}
- g_object_weak_ref (G_OBJECT (book), pas_backend_file_book_destroy_cb, backend);
+ gtk_signal_connect (GTK_OBJECT (book), "destroy",
+ pas_backend_file_book_destroy_cb, backend);
- g_signal_connect (book, "requests_queued",
- G_CALLBACK (pas_backend_file_process_client_requests), NULL);
+ gtk_signal_connect (GTK_OBJECT (book), "requests_queued",
+ pas_backend_file_process_client_requests, NULL);
bf->priv->clients = g_list_prepend (
bf->priv->clients, book);
@@ -1604,10 +1613,10 @@ pas_backend_file_new (void)
{
PASBackendFile *backend;
- backend = g_object_new (PAS_TYPE_BACKEND_FILE, NULL);
+ backend = gtk_type_new (pas_backend_file_get_type ());
if (! pas_backend_file_construct (backend)) {
- g_object_unref (backend);
+ gtk_object_unref (GTK_OBJECT (backend));
return NULL;
}
@@ -1616,32 +1625,29 @@ pas_backend_file_new (void)
}
static void
-pas_backend_file_dispose (GObject *object)
+pas_backend_file_destroy (GtkObject *object)
{
PASBackendFile *bf;
bf = PAS_BACKEND_FILE (object);
- if (bf->priv) {
- g_object_unref(bf->priv->book_views);
- g_object_unref(bf->priv->summary);
- g_free (bf->priv->uri);
- g_free (bf->priv->filename);
+ gtk_object_unref(GTK_OBJECT(bf->priv->book_views));
+ gtk_object_unref(GTK_OBJECT(bf->priv->summary));
+ g_free (bf->priv->uri);
+ g_free (bf->priv->filename);
- g_free (bf->priv);
- bf->priv = NULL;
- }
+ g_free (bf->priv);
- G_OBJECT_CLASS (pas_backend_file_parent_class)->dispose (object);
+ GTK_OBJECT_CLASS (pas_backend_file_parent_class)->destroy (object);
}
static void
pas_backend_file_class_init (PASBackendFileClass *klass)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GtkObjectClass *object_class = (GtkObjectClass *) klass;
PASBackendClass *parent_class;
- pas_backend_file_parent_class = g_type_class_peek_parent (klass);
+ pas_backend_file_parent_class = gtk_type_class (pas_backend_get_type ());
parent_class = PAS_BACKEND_CLASS (klass);
@@ -1652,7 +1658,7 @@ pas_backend_file_class_init (PASBackendFileClass *klass)
parent_class->remove_client = pas_backend_file_remove_client;
parent_class->get_static_capabilities = pas_backend_file_get_static_capabilities;
- object_class->dispose = pas_backend_file_dispose;
+ object_class->destroy = pas_backend_file_destroy;
}
static void
@@ -1673,25 +1679,24 @@ pas_backend_file_init (PASBackendFile *backend)
/**
* pas_backend_file_get_type:
*/
-GType
+GtkType
pas_backend_file_get_type (void)
{
- static GType type = 0;
+ static GtkType type = 0;
if (! type) {
- GTypeInfo info = {
- sizeof (PASBackendFileClass),
- NULL, /* base_class_init */
- NULL, /* base_class_finalize */
- (GClassInitFunc) pas_backend_file_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
+ GtkTypeInfo info = {
+ "PASBackendFile",
sizeof (PASBackendFile),
- 0, /* n_preallocs */
- (GInstanceInitFunc) pas_backend_file_init
+ sizeof (PASBackendFileClass),
+ (GtkClassInitFunc) pas_backend_file_class_init,
+ (GtkObjectInitFunc) pas_backend_file_init,
+ NULL, /* reserved 1 */
+ NULL, /* reserved 2 */
+ (GtkClassInitFunc) NULL
};
- type = g_type_register_static (PAS_TYPE_BACKEND, "PASBackendFile", &info, 0);
+ type = gtk_type_unique (pas_backend_get_type (), &info);
}
return type;
diff --git a/addressbook/backend/pas/pas-backend-ldap.c b/addressbook/backend/pas/pas-backend-ldap.c
index 5161ae0b63..b8775f0714 100644
--- a/addressbook/backend/pas/pas-backend-ldap.c
+++ b/addressbook/backend/pas/pas-backend-ldap.c
@@ -10,7 +10,10 @@
#include "config.h"
#include <fcntl.h>
-#include <string.h>
+#include <gtk/gtksignal.h>
+
+#include <libgnome/gnome-defs.h>
+#include <libgnome/gnome-i18n.h>
#ifdef DEBUG
#define LDAP_DEBUG
@@ -35,7 +38,6 @@
#include <e-util/e-sexp.h>
#include <ebook/e-card-simple.h>
-#include <libgnome/gnome-i18n.h>
#include "pas-backend-ldap.h"
#include "pas-backend-card-sexp.h"
@@ -291,7 +293,7 @@ remove_view (int msgid, LDAPOp *op, PASBookView *view)
}
static void
-view_destroy(gpointer data, GObject *where_object_was)
+view_destroy(GtkObject *object, gpointer data)
{
PASBook *book = (PASBook *)data;
PASBackendLDAP *bl;
@@ -304,7 +306,7 @@ view_destroy(gpointer data, GObject *where_object_was)
while (e_iterator_is_valid (iter)) {
PASBackendLDAPBookView *view = (PASBackendLDAPBookView*)e_iterator_get (iter);
- if (view->book_view == (PASBookView*)where_object_was) {
+ if (view->book_view == PAS_BOOK_VIEW(object)) {
GNOME_Evolution_Addressbook_Book corba_book;
CORBA_Environment ev;
@@ -319,7 +321,7 @@ view_destroy(gpointer data, GObject *where_object_was)
/* free up the view structure */
g_free (view->search);
- g_object_unref (view->card_sexp);
+ gtk_object_unref (GTK_OBJECT (view->card_sexp));
g_free (view);
/* and remove it from our list */
@@ -344,7 +346,7 @@ view_destroy(gpointer data, GObject *where_object_was)
e_iterator_next (iter);
}
- g_object_unref (iter);
+ gtk_object_unref (GTK_OBJECT (iter));
}
@@ -369,7 +371,7 @@ find_book_view (PASBackendLDAP *bl)
rv = v->book_view;
}
- g_object_unref (iter);
+ gtk_object_unref (GTK_OBJECT (iter));
return rv;
}
@@ -1136,7 +1138,7 @@ create_card_handler (LDAPOp *op, LDAPMessage *res)
e_iterator_next (iter);
}
- g_object_unref (iter);
+ gtk_object_unref (GTK_OBJECT (iter));
}
else {
ldap_perror (ldap, "create_card");
@@ -1160,7 +1162,7 @@ create_card_dtor (LDAPOp *op)
LDAPCreateOp *create_op = (LDAPCreateOp*)op;
g_free (create_op->dn);
- g_object_unref (create_op->new_card);
+ gtk_object_unref (GTK_OBJECT (create_op->new_card));
g_free (create_op);
}
@@ -1204,7 +1206,7 @@ pas_backend_ldap_process_create_card (PASBackend *backend,
create_op->dn);
g_free (create_op->dn);
- g_object_unref (create_op->new_card);
+ gtk_object_unref (GTK_OBJECT(create_op->new_card));
g_free (create_op);
return;
}
@@ -1325,7 +1327,7 @@ remove_card_handler (LDAPOp *op, LDAPMessage *res)
e_iterator_next (iter);
}
- g_object_unref (iter);
+ gtk_object_unref (GTK_OBJECT (iter));
}
else {
ldap_perror (bl->priv->ldap, "remove_card");
@@ -1453,7 +1455,7 @@ modify_card_modify_handler (LDAPOp *op, LDAPMessage *res)
e_iterator_next (iter);
}
- g_object_unref (iter);
+ gtk_object_unref (GTK_OBJECT (iter));
}
else {
ldap_perror (ldap, "ldap_modify_s");
@@ -1569,10 +1571,10 @@ modify_card_dtor (LDAPOp *op)
g_list_free (modify_op->existing_objectclasses);
g_free (modify_op->current_vcard);
if (modify_op->current_card)
- g_object_unref (modify_op->current_card);
+ gtk_object_unref (GTK_OBJECT (modify_op->current_card));
g_free (modify_op->vcard);
if (modify_op->card)
- g_object_unref (modify_op->card);
+ gtk_object_unref (GTK_OBJECT (modify_op->card));
g_free (modify_op);
}
@@ -1594,7 +1596,7 @@ pas_backend_ldap_process_modify_card (PASBackend *backend,
modify_op->vcard = g_strdup (req->modify.vcard);
new_ecard = e_card_new (modify_op->vcard);
modify_op->card = e_card_simple_new (new_ecard);
- g_object_unref (new_ecard);
+ gtk_object_unref (GTK_OBJECT (new_ecard));
modify_op->id = e_card_simple_get_id(modify_op->card);
ldap = bl->priv->ldap;
@@ -1661,7 +1663,7 @@ get_vcard_handler (LDAPOp *op, LDAPMessage *res)
GNOME_Evolution_Addressbook_BookListener_Success,
vcard);
g_free (vcard);
- g_object_unref (simple);
+ gtk_object_unref (GTK_OBJECT (simple));
ldap_op_finished (op);
}
else if (msg_type == LDAP_RES_SEARCH_RESULT) {
@@ -1750,7 +1752,7 @@ get_nth(PASCardCursor *cursor, long n, gpointer data)
}
static void
-cursor_destroy(gpointer data, GObject *where_object_was)
+cursor_destroy(GtkObject *object, gpointer data)
{
PASBackendLDAPCursorPrivate *cursor_data = (PASBackendLDAPCursorPrivate *) data;
@@ -1801,7 +1803,7 @@ get_cursor_handler (LDAPOp *op, LDAPMessage *res)
cursor_op->cursor_data->num_elements ++;
cursor_op->cursor_data->elements = g_list_prepend (cursor_op->cursor_data->elements,
vcard);
- g_object_unref (simple);
+ gtk_object_unref (GTK_OBJECT (simple));
}
}
}
@@ -1816,7 +1818,8 @@ get_cursor_handler (LDAPOp *op, LDAPMessage *res)
get_nth,
cursor_op->cursor_data);
- g_object_weak_ref (G_OBJECT (cursor), cursor_destroy, cursor_op->cursor_data);
+ gtk_signal_connect(GTK_OBJECT(cursor), "destroy",
+ GTK_SIGNAL_FUNC(cursor_destroy), cursor_op->cursor_data);
cursor_op->responded = TRUE;
}
@@ -1842,7 +1845,7 @@ get_cursor_dtor (LDAPOp *op)
LDAPGetCursorOp *cursor_op = (LDAPGetCursorOp*)op;
if (!cursor_op->responded) {
- cursor_destroy (cursor_op->cursor_data, NULL);
+ cursor_destroy (NULL, cursor_op->cursor_data);
}
g_free (op);
@@ -2118,9 +2121,9 @@ anniversary_populate (ECardSimple *card, char **values)
{
if (values[0]) {
ECardDate dt = e_card_date_from_string (values[0]);
- g_object_set (card->card,
- "anniversary", &dt,
- NULL);
+ gtk_object_set (GTK_OBJECT (card->card),
+ "anniversary", &dt,
+ NULL);
}
}
@@ -2130,9 +2133,9 @@ anniversary_ber (ECardSimple *card)
ECardDate *dt;
struct berval** result = NULL;
- g_object_get (card->card,
- "anniversary", &dt,
- NULL);
+ gtk_object_get (GTK_OBJECT (card->card),
+ "anniversary", &dt,
+ NULL);
if (dt) {
char *anniversary;
@@ -2157,15 +2160,15 @@ anniversary_compare (ECardSimple *ecard1, ECardSimple *ecard2)
char *date1 = NULL, *date2 = NULL;
gboolean equal;
- g_object_get (ecard1->card,
- "anniversary", &dt,
- NULL);
+ gtk_object_get (GTK_OBJECT (ecard1->card),
+ "anniversary", &dt,
+ NULL);
if (dt)
date1 = e_card_date_to_string (dt);
- g_object_get (ecard2->card,
- "anniversary", &dt,
- NULL);
+ gtk_object_get (GTK_OBJECT (ecard2->card),
+ "anniversary", &dt,
+ NULL);
if (dt)
date2 = e_card_date_to_string (dt);
@@ -2185,9 +2188,9 @@ birthday_populate (ECardSimple *card, char **values)
{
if (values[0]) {
ECardDate dt = e_card_date_from_string (values[0]);
- g_object_set (card->card,
- "birth_date", &dt,
- NULL);
+ gtk_object_set (GTK_OBJECT (card->card),
+ "birth_date", &dt,
+ NULL);
}
}
@@ -2197,9 +2200,9 @@ birthday_ber (ECardSimple *card)
ECardDate *dt;
struct berval** result = NULL;
- g_object_get (card->card,
- "birth_date", &dt,
- NULL);
+ gtk_object_get (GTK_OBJECT (card->card),
+ "birth_date", &dt,
+ NULL);
if (dt) {
char *birthday;
@@ -2224,15 +2227,15 @@ birthday_compare (ECardSimple *ecard1, ECardSimple *ecard2)
char *date1 = NULL, *date2 = NULL;
gboolean equal;
- g_object_get (ecard1->card,
- "birth_date", &dt,
- NULL);
+ gtk_object_get (GTK_OBJECT (ecard1->card),
+ "birth_date", &dt,
+ NULL);
if (dt)
date1 = e_card_date_to_string (dt);
- g_object_get (ecard2->card,
- "birth_date", &dt,
- NULL);
+ gtk_object_get (GTK_OBJECT (ecard2->card),
+ "birth_date", &dt,
+ NULL);
if (dt)
date2 = e_card_date_to_string (dt);
@@ -2254,9 +2257,9 @@ category_populate (ECardSimple *card, char **values)
ECard *ecard;
EList *categories;
- g_object_get (card,
- "card", &ecard,
- NULL);
+ gtk_object_get (GTK_OBJECT (card),
+ "card", &ecard,
+ NULL);
categories = e_list_new((EListCopyFunc) g_strdup,
(EListFreeFunc) g_free,
@@ -2265,11 +2268,11 @@ category_populate (ECardSimple *card, char **values)
for (i = 0; values[i]; i++)
e_list_append (categories, values[i]);
- g_object_set (ecard,
- "category_list", categories,
- NULL);
+ gtk_object_set (GTK_OBJECT (ecard),
+ "category_list", categories,
+ NULL);
- g_object_unref (categories);
+ gtk_object_unref (GTK_OBJECT (categories));
e_card_simple_sync_card (card);
}
@@ -2283,13 +2286,13 @@ category_ber (ECardSimple *card)
ECard *ecard;
int i;
- g_object_get (card,
- "card", &ecard,
- NULL);
+ gtk_object_get (GTK_OBJECT (card),
+ "card", &ecard,
+ NULL);
- g_object_get (ecard,
- "category_list", &categories,
- NULL);
+ gtk_object_get (GTK_OBJECT (ecard),
+ "category_list", &categories,
+ NULL);
if (e_list_length (categories) != 0) {
result = g_new0 (struct berval*, e_list_length (categories) + 1);
@@ -2303,7 +2306,7 @@ category_ber (ECardSimple *card)
result[i]->bv_len = strlen (category);
}
- g_object_unref (iterator);
+ gtk_object_unref (GTK_OBJECT (iterator));
}
return result;
@@ -2769,7 +2772,7 @@ build_card_from_entry (LDAP *ldap, LDAPMessage *e, GList **existing_objectclasse
}
else if (info->prop_type & PROP_TYPE_COMPLEX) {
/* if it's a list call the ecard-populate function,
- which calls g_object_set to set the property */
+ which calls gtk_object_set to set the property */
info->populate_ecard_func(card,
values);
}
@@ -2787,7 +2790,7 @@ build_card_from_entry (LDAP *ldap, LDAPMessage *e, GList **existing_objectclasse
e_card_simple_sync_card (card);
- g_object_unref (ecard);
+ gtk_object_unref (GTK_OBJECT (ecard));
return card;
}
@@ -2853,7 +2856,7 @@ poll_ldap (PASBackendLDAP *bl)
}
e_iterator_next (iter);
}
- g_object_unref (iter);
+ gtk_object_unref (GTK_OBJECT (iter));
return TRUE;
}
@@ -2864,7 +2867,6 @@ send_pending_adds (LDAPSearchOp *search_op)
search_op->num_sent_this_time += search_op->num_pending_adds;
pas_book_view_notify_add (search_op->op.view, search_op->pending_adds);
g_list_foreach (search_op->pending_adds, (GFunc)g_free, NULL);
- g_list_free (search_op->pending_adds);
search_op->pending_adds = NULL;
search_op->num_pending_adds = 0;
}
@@ -2930,7 +2932,7 @@ ldap_search_handler (LDAPOp *op, LDAPMessage *res)
e_card_simple_get_vcard_assume_utf8 (card));
search_op->num_pending_adds ++;
- g_object_unref (card);
+ gtk_object_unref (GTK_OBJECT(card));
e = ldap_next_entry(ldap, e);
}
@@ -3069,7 +3071,8 @@ pas_backend_ldap_process_get_book_view (PASBackend *backend,
book_view = pas_book_view_new (req->get_book_view.listener);
bonobo_object_ref(BONOBO_OBJECT(book));
- g_object_weak_ref (G_OBJECT (book_view), view_destroy, book);
+ gtk_signal_connect(GTK_OBJECT(book_view), "destroy",
+ GTK_SIGNAL_FUNC(view_destroy), book);
view = g_new0(PASBackendLDAPBookView, 1);
view->book_view = book_view;
@@ -3256,11 +3259,13 @@ pas_backend_ldap_process_client_requests (PASBook *book)
}
static void
-pas_backend_ldap_book_destroy_cb (gpointer data, GObject *where_book_was)
+pas_backend_ldap_book_destroy_cb (PASBook *book, gpointer data)
{
- PASBackendLDAP *backend = PAS_BACKEND_LDAP (data);
+ PASBackendLDAP *backend;
+
+ backend = PAS_BACKEND_LDAP (data);
- pas_backend_remove_client (PAS_BACKEND (backend), (PASBook*)where_book_was);
+ pas_backend_remove_client (PAS_BACKEND (backend), book);
}
static GNOME_Evolution_Addressbook_BookListener_CallStatus
@@ -3375,10 +3380,11 @@ pas_backend_ldap_add_client (PASBackend *backend,
return FALSE;
}
- g_object_weak_ref (G_OBJECT (book), pas_backend_ldap_book_destroy_cb, backend);
+ gtk_signal_connect (GTK_OBJECT (book), "destroy",
+ pas_backend_ldap_book_destroy_cb, backend);
- g_signal_connect (book, "requests_queued",
- G_CALLBACK (pas_backend_ldap_process_client_requests), NULL);
+ gtk_signal_connect (GTK_OBJECT (book), "requests_queued",
+ pas_backend_ldap_process_client_requests, NULL);
bl->priv->clients = g_list_prepend (
bl->priv->clients, book);
@@ -3447,10 +3453,10 @@ pas_backend_ldap_new (void)
{
PASBackendLDAP *backend;
- backend = g_object_new (PAS_TYPE_BACKEND_LDAP, NULL);
+ backend = gtk_type_new (pas_backend_ldap_get_type ());
if (! pas_backend_ldap_construct (backend)) {
- g_object_unref (backend);
+ gtk_object_unref (GTK_OBJECT (backend));
return NULL;
}
@@ -3469,46 +3475,40 @@ call_dtor (int msgid, LDAPOp *op, gpointer data)
}
static void
-pas_backend_ldap_dispose (GObject *object)
+pas_backend_ldap_destroy (GtkObject *object)
{
PASBackendLDAP *bl;
bl = PAS_BACKEND_LDAP (object);
- if (bl->priv) {
- g_hash_table_foreach_remove (bl->priv->id_to_op, (GHRFunc)call_dtor, NULL);
- g_hash_table_destroy (bl->priv->id_to_op);
+ g_hash_table_foreach_remove (bl->priv->id_to_op, (GHRFunc)call_dtor, NULL);
+ g_hash_table_destroy (bl->priv->id_to_op);
- if (bl->priv->poll_timeout != -1) {
- printf ("removing timeout\n");
- g_source_remove (bl->priv->poll_timeout);
- }
+ if (bl->priv->poll_timeout != -1) {
+ printf ("removing timeout\n");
+ g_source_remove (bl->priv->poll_timeout);
+ }
- g_object_unref (bl->priv->book_views);
+ gtk_object_unref (GTK_OBJECT (bl->priv->book_views));
- if (bl->priv->supported_fields)
- g_object_unref (bl->priv->supported_fields);
+ if (bl->priv->supported_fields)
+ gtk_object_unref (GTK_OBJECT (bl->priv->supported_fields));
- g_free (bl->priv->uri);
+ g_free (bl->priv->uri);
- g_free (bl->priv);
- bl->priv = NULL;
- }
-
- if (G_OBJECT_CLASS (pas_backend_ldap_parent_class)->dispose)
- G_OBJECT_CLASS (pas_backend_ldap_parent_class)->dispose (object);
+ GTK_OBJECT_CLASS (pas_backend_ldap_parent_class)->destroy (object);
}
static void
pas_backend_ldap_class_init (PASBackendLDAPClass *klass)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GtkObjectClass *object_class = (GtkObjectClass *) klass;
PASBackendClass *parent_class;
/* get client side information (extensions present in the library) */
get_ldap_library_info ();
- pas_backend_ldap_parent_class = g_type_class_peek_parent (klass);
+ pas_backend_ldap_parent_class = gtk_type_class (pas_backend_get_type ());
parent_class = PAS_BACKEND_CLASS (klass);
@@ -3519,7 +3519,7 @@ pas_backend_ldap_class_init (PASBackendLDAPClass *klass)
parent_class->remove_client = pas_backend_ldap_remove_client;
parent_class->get_static_capabilities = pas_backend_ldap_get_static_capabilities;
- object_class->dispose = pas_backend_ldap_dispose;
+ object_class->destroy = pas_backend_ldap_destroy;
}
static void
@@ -3541,25 +3541,24 @@ pas_backend_ldap_init (PASBackendLDAP *backend)
/**
* pas_backend_ldap_get_type:
*/
-GType
+GtkType
pas_backend_ldap_get_type (void)
{
- static GType type = 0;
+ static GtkType type = 0;
if (! type) {
- GTypeInfo info = {
- sizeof (PASBackendLDAPClass),
- NULL, /* base_class_init */
- NULL, /* base_class_finalize */
- (GClassInitFunc) pas_backend_ldap_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
+ GtkTypeInfo info = {
+ "PASBackendLDAP",
sizeof (PASBackendLDAP),
- 0, /* n_preallocs */
- (GInstanceInitFunc) pas_backend_ldap_init
+ sizeof (PASBackendLDAPClass),
+ (GtkClassInitFunc) pas_backend_ldap_class_init,
+ (GtkObjectInitFunc) pas_backend_ldap_init,
+ NULL, /* reserved 1 */
+ NULL, /* reserved 2 */
+ (GtkClassInitFunc) NULL
};
- type = g_type_register_static (PAS_TYPE_BACKEND, "PASBackendLDAP", &info, 0);
+ type = gtk_type_unique (pas_backend_get_type (), &info);
}
return type;
diff --git a/addressbook/gui/component/select-names/e-select-names.c b/addressbook/gui/component/select-names/e-select-names.c
index 54186ee16b..7ebd100d67 100644
--- a/addressbook/gui/component/select-names/e-select-names.c
+++ b/addressbook/gui/component/select-names/e-select-names.c
@@ -20,8 +20,11 @@
#include <config.h>
#include <glib.h>
-#include <gtk/gtk.h>
+#include <libgnome/gnome-defs.h>
#include <libgnome/gnome-i18n.h>
+#include <libgnomeui/gnome-stock.h>
+#include <libgnomeui/gnome-dialog.h>
+#include <libgnomeui/gnome-dialog-util.h>
#include <gal/e-table/e-table-simple.h>
#include <gal/e-table/e-table-without.h>
@@ -49,13 +52,15 @@
static void e_select_names_init (ESelectNames *card);
static void e_select_names_class_init (ESelectNamesClass *klass);
-static void e_select_names_dispose (GObject *object);
+static void e_select_names_set_arg (GtkObject *o, GtkArg *arg, guint arg_id);
+static void e_select_names_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
+static void e_select_names_destroy (GtkObject *object);
static void update_query (GtkWidget *widget, ESelectNames *e_select_names);
extern EvolutionShellClient *global_shell_client;
-static GtkDialogClass *parent_class = NULL;
-#define PARENT_TYPE gtk_dialog_get_type()
+static GnomeDialogClass *parent_class = NULL;
+#define PARENT_TYPE gnome_dialog_get_type()
/* The arguments we take */
enum {
@@ -71,25 +76,25 @@ typedef struct {
GtkWidget *button;
} ESelectNamesChild;
-GType
+GtkType
e_select_names_get_type (void)
{
- static GType type = 0;
+ static GtkType type = 0;
if (!type) {
- static const GTypeInfo info = {
- sizeof (ESelectNamesClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) e_select_names_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
+ static const GtkTypeInfo info =
+ {
+ "ESelectNames",
sizeof (ESelectNames),
- 0, /* n_preallocs */
- (GInstanceInitFunc) e_select_names_init,
+ sizeof (ESelectNamesClass),
+ (GtkClassInitFunc) e_select_names_class_init,
+ (GtkObjectInitFunc) e_select_names_init,
+ /* reserved_1 */ NULL,
+ /* reserved_2 */ NULL,
+ (GtkClassInitFunc) NULL,
};
- type = g_type_register_static (PARENT_TYPE, "ESelectNames", &info, 0);
+ type = gtk_type_unique (PARENT_TYPE, &info);
}
return type;
@@ -98,13 +103,15 @@ e_select_names_get_type (void)
static void
e_select_names_class_init (ESelectNamesClass *klass)
{
- GObjectClass *object_class;
+ GtkObjectClass *object_class;
- object_class = G_OBJECT_CLASS (klass);
+ object_class = (GtkObjectClass*) klass;
- parent_class = g_type_class_peek_parent (klass);
+ parent_class = gtk_type_class (PARENT_TYPE);
- object_class->dispose = e_select_names_dispose;
+ object_class->set_arg = e_select_names_set_arg;
+ object_class->get_arg = e_select_names_get_arg;
+ object_class->destroy = e_select_names_destroy;
}
GtkWidget *e_addressbook_create_ebook_table(char *name, char *string1, char *string2, int num1, int num2);
@@ -113,13 +120,13 @@ GtkWidget *e_addressbook_create_folder_selector(char *name, char *string1, char
static void
set_book(EBook *book, EBookStatus status, ESelectNames *esn)
{
- g_object_set(esn->model,
- "book", book,
- NULL);
+ gtk_object_set(GTK_OBJECT(esn->model),
+ "book", book,
+ NULL);
update_query (NULL, esn);
- g_object_unref(book);
- g_object_unref(esn->model);
- g_object_unref(esn);
+ gtk_object_unref(GTK_OBJECT(book));
+ gtk_object_unref(GTK_OBJECT(esn->model));
+ gtk_object_unref(GTK_OBJECT(esn));
}
static void
@@ -142,8 +149,8 @@ addressbook_model_set_uri(ESelectNames *e_select_names, EAddressbookModel *model
book = e_book_new();
- g_object_ref(e_select_names);
- g_object_ref(model);
+ gtk_object_ref(GTK_OBJECT(e_select_names));
+ gtk_object_ref(GTK_OBJECT(model));
addressbook_load_uri(book, book_uri, (EBookCallback) set_book, e_select_names);
g_free (book_uri);
@@ -212,7 +219,7 @@ real_add_address_cb (int model_row, gpointer closure)
e_select_names_model_append (child->source, dest);
e_select_names_model_clean (child->source, FALSE);
- g_object_unref(card);
+ gtk_object_unref(GTK_OBJECT(card));
}
}
@@ -261,7 +268,7 @@ esn_get_key_fn (ETableModel *source, int row, void *closure)
EAddressbookModel *model = E_ADDRESSBOOK_MODEL (closure);
ECard *card = e_addressbook_model_get_card (model, row);
void *key = card_key (card);
- g_object_unref (card);
+ gtk_object_unref (GTK_OBJECT (card));
return key;
}
@@ -296,9 +303,9 @@ e_addressbook_create_ebook_table(char *name, char *string1, char *string2, int n
model = e_addressbook_model_new ();
adapter = E_TABLE_MODEL (e_addressbook_table_adapter_new (model));
- g_object_set(model,
- "editable", FALSE,
- NULL);
+ gtk_object_set(GTK_OBJECT(model),
+ "editable", FALSE,
+ NULL);
without = e_table_without_new (adapter,
g_str_hash,
@@ -314,9 +321,9 @@ e_addressbook_create_ebook_table(char *name, char *string1, char *string2, int n
EVOLUTION_ETSPECDIR "/e-select-names.etspec",
NULL);
- g_object_set_data(G_OBJECT(table), "adapter", adapter);
- g_object_set_data(G_OBJECT(table), "without", without);
- g_object_set_data(G_OBJECT(table), "model", model);
+ gtk_object_set_data(GTK_OBJECT(table), "adapter", adapter);
+ gtk_object_set_data(GTK_OBJECT(table), "without", without);
+ gtk_object_set_data(GTK_OBJECT(table), "model", model);
return table;
}
@@ -324,24 +331,26 @@ e_addressbook_create_ebook_table(char *name, char *string1, char *string2, int n
GtkWidget *
e_addressbook_create_folder_selector(char *name, char *string1, char *string2, int num1, int num2)
{
- return g_object_new (EVOLUTION_TYPE_FOLDER_SELECTOR_BUTTON, NULL);
+ return (GtkWidget *)gtk_type_new (EVOLUTION_TYPE_FOLDER_SELECTOR_BUTTON);
}
static void
folder_selected (EvolutionFolderSelectorButton *button, GNOME_Evolution_Folder *folder,
ESelectNames *e_select_names)
{
+ Bonobo_ConfigDatabase db;
+
addressbook_model_set_uri(e_select_names, e_select_names->model, folder->physicalUri);
- e_config_listener_set_string (e_book_get_config_database(),
- "/apps/evolution/addressbook/select_names/last_used_uri", folder->physicalUri);
+ db = addressbook_config_database (NULL);
+ bonobo_config_set_string (db, "/Addressbook/select_names_uri", folder->physicalUri, NULL);
}
static void
update_query (GtkWidget *widget, ESelectNames *e_select_names)
{
char *category = "";
- const char *search = "";
+ char *search = "";
char *query;
char *q_array[4];
int i;
@@ -369,9 +378,9 @@ update_query (GtkWidget *widget, ESelectNames *e_select_names)
} else {
query = g_strdup (q_array[0]);
}
- g_object_set (e_select_names->model,
- "query", query,
- NULL);
+ gtk_object_set (GTK_OBJECT (e_select_names->model),
+ "query", query,
+ NULL);
for (i = 1; q_array[i]; i++) {
g_free (q_array[i]);
}
@@ -381,14 +390,20 @@ update_query (GtkWidget *widget, ESelectNames *e_select_names)
static void
status_message (EAddressbookModel *model, const gchar *message, ESelectNames *e_select_names)
{
- if (message == NULL)
+ if (message == NULL) {
+ if (e_select_names->status_image)
+ gtk_widget_hide (e_select_names->status_image);
gtk_label_set_text (GTK_LABEL (e_select_names->status_message), "");
- else
+ }
+ else {
+ if (e_select_names->status_image)
+ gtk_widget_show (e_select_names->status_image);
gtk_label_set_text (GTK_LABEL (e_select_names->status_message), message);
+ }
}
static void
-categories_changed (GtkWidget *widget, ESelectNames *e_select_names)
+categories_changed (GtkWidget *widget, gint value, ESelectNames *e_select_names)
{
update_query (widget, e_select_names);
}
@@ -397,7 +412,7 @@ static void
select_entry_changed (GtkWidget *widget, ESelectNames *e_select_names)
{
if (e_select_names->select_entry) {
- const char *select_string = gtk_entry_get_text (GTK_ENTRY (e_select_names->select_entry));
+ char *select_string = gtk_entry_get_text (GTK_ENTRY (e_select_names->select_entry));
char *select_strcoll_string = g_utf8_collate_key (select_string, -1);
int count;
ETable *table;
@@ -445,15 +460,15 @@ e_select_names_create_categories (gchar *name,
ecml = e_categories_master_list_wombat_new ();
option_menu = e_categories_master_list_option_menu_new (ecml);
- g_object_unref (ecml);
+ gtk_object_unref (GTK_OBJECT (ecml));
return option_menu;
}
static void
-clear_widget (gpointer data, GObject *where_object_was)
+clear_widget (GtkWidget *w, gpointer user_data)
{
- GtkWidget **widget_ref = data;
+ GtkWidget **widget_ref = user_data;
*widget_ref = NULL;
}
@@ -465,11 +480,11 @@ e_select_names_init (ESelectNames *e_select_names)
const char *selector_types[] = { "contacts/*", NULL };
char *filename;
char *contacts_uri;
- EConfigListener *db;
+ Bonobo_ConfigDatabase db;
- db = e_book_get_config_database();
+ db = addressbook_config_database (NULL);
- gui = glade_xml_new (EVOLUTION_GLADEDIR "/select-names.glade", NULL, NULL);
+ gui = glade_xml_new (EVOLUTION_GLADEDIR "/select-names.glade", NULL);
e_select_names->gui = gui;
e_select_names->children = g_hash_table_new(g_str_hash, g_str_equal);
@@ -482,70 +497,71 @@ e_select_names_init (ESelectNames *e_select_names)
}
gtk_widget_ref(widget);
gtk_widget_unparent(widget);
- gtk_box_pack_start(GTK_BOX(GTK_DIALOG(e_select_names)->vbox), widget, TRUE, TRUE, 0);
+ gtk_box_pack_start(GTK_BOX(GNOME_DIALOG(e_select_names)->vbox), widget, TRUE, TRUE, 0);
gtk_widget_unref(widget);
- gtk_dialog_add_buttons (GTK_DIALOG (e_select_names),
- GTK_STOCK_OK, GTK_RESPONSE_OK,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- NULL);
-
- gtk_dialog_set_default_response (GTK_DIALOG (e_select_names),
- GTK_RESPONSE_OK);
+ gnome_dialog_append_buttons(GNOME_DIALOG(e_select_names),
+ GNOME_STOCK_BUTTON_OK,
+ GNOME_STOCK_BUTTON_CANCEL,
+ NULL);
+ gnome_dialog_set_default(GNOME_DIALOG(e_select_names), 0);
gtk_window_set_title(GTK_WINDOW(e_select_names), _("Select Contacts from Addressbook"));
gtk_window_set_policy(GTK_WINDOW(e_select_names), FALSE, TRUE, FALSE);
e_select_names->table = E_TABLE_SCROLLED(glade_xml_get_widget(gui, "table-source"));
- e_select_names->model = g_object_get_data(G_OBJECT(e_select_names->table), "model");
- e_select_names->adapter = g_object_get_data(G_OBJECT(e_select_names->table), "adapter");
- e_select_names->without = g_object_get_data(G_OBJECT(e_select_names->table), "without");
- gtk_widget_show (GTK_WIDGET (e_select_names->table));
+ e_select_names->model = gtk_object_get_data(GTK_OBJECT(e_select_names->table), "model");
+ e_select_names->adapter = gtk_object_get_data(GTK_OBJECT(e_select_names->table), "adapter");
+ e_select_names->without = gtk_object_get_data(GTK_OBJECT(e_select_names->table), "without");
e_select_names->status_message = glade_xml_get_widget (gui, "status-message");
if (e_select_names->status_message && !GTK_IS_LABEL (e_select_names->status_message))
e_select_names->status_message = NULL;
if (e_select_names->status_message) {
- g_signal_connect (e_select_names->model, "status_message",
- G_CALLBACK (status_message), e_select_names);
- g_object_weak_ref (G_OBJECT (e_select_names->status_message), clear_widget, &e_select_names->status_message);
+ gtk_signal_connect (GTK_OBJECT (e_select_names->model), "status_message",
+ GTK_SIGNAL_FUNC (status_message), e_select_names);
+ gtk_signal_connect(GTK_OBJECT(e_select_names->status_message), "destroy",
+ GTK_SIGNAL_FUNC(clear_widget), &e_select_names->status_message);
}
+ e_select_names->status_image = glade_xml_get_widget (gui, "status-image");
+ gtk_widget_hide (e_select_names->status_image);
e_select_names->categories = glade_xml_get_widget (gui, "custom-categories");
if (e_select_names->categories && !E_IS_CATEGORIES_MASTER_LIST_OPTION_MENU (e_select_names->categories))
e_select_names->categories = NULL;
if (e_select_names->categories) {
- g_signal_connect(e_select_names->categories, "changed",
- G_CALLBACK(categories_changed), e_select_names);
- g_object_weak_ref (G_OBJECT (e_select_names->categories), clear_widget, &e_select_names->categories);
+ gtk_signal_connect(GTK_OBJECT(e_select_names->categories), "changed",
+ GTK_SIGNAL_FUNC(categories_changed), e_select_names);
+ gtk_signal_connect(GTK_OBJECT(e_select_names->categories), "destroy",
+ GTK_SIGNAL_FUNC(clear_widget), &e_select_names->categories);
}
- gtk_widget_show (e_select_names->categories);
e_select_names->select_entry = glade_xml_get_widget (gui, "entry-select");
if (e_select_names->select_entry && !GTK_IS_ENTRY (e_select_names->select_entry))
e_select_names->select_entry = NULL;
if (e_select_names->select_entry) {
- g_signal_connect(e_select_names->select_entry, "changed",
- G_CALLBACK(select_entry_changed), e_select_names);
- g_signal_connect(e_select_names->select_entry, "activate",
- G_CALLBACK(update_query), e_select_names);
- g_object_weak_ref (G_OBJECT (e_select_names->select_entry), clear_widget, &e_select_names->select_entry);
+ gtk_signal_connect(GTK_OBJECT(e_select_names->select_entry), "changed",
+ GTK_SIGNAL_FUNC(select_entry_changed), e_select_names);
+ gtk_signal_connect(GTK_OBJECT(e_select_names->select_entry), "activate",
+ GTK_SIGNAL_FUNC(update_query), e_select_names);
+ gtk_signal_connect(GTK_OBJECT(e_select_names->select_entry), "destroy",
+ GTK_SIGNAL_FUNC(clear_widget), &e_select_names->select_entry);
}
button = glade_xml_get_widget (gui, "button-find");
if (button && GTK_IS_BUTTON (button))
- g_signal_connect(button, "clicked",
- G_CALLBACK(update_query), e_select_names);
+ gtk_signal_connect(GTK_OBJECT(button), "clicked",
+ GTK_SIGNAL_FUNC(update_query), e_select_names);
- contacts_uri = e_config_listener_get_string_with_default (db, "/apps/evolution/addressbook/select_names/last_used_uri", NULL, NULL);
+ contacts_uri = bonobo_config_get_string_with_default (db, "/Addressbook/select_names_uri",
+ NULL, NULL);
if (!contacts_uri) {
- contacts_uri = e_config_listener_get_string_with_default (db, "/apps/evolution/shell/default_folders/contacts_uri",
- NULL, NULL);
+ contacts_uri = bonobo_config_get_string_with_default (db, "/DefaultFolders/contacts_uri",
+ NULL,
+ NULL);
}
- if (!contacts_uri || !contacts_uri[0]) {
- if (contacts_uri)
- g_free (contacts_uri);
- filename = g_build_filename (g_get_home_dir(), "evolution/local/Contacts", NULL);
+ if (!contacts_uri) {
+ filename = gnome_util_prepend_user_home("evolution/local/Contacts");
contacts_uri = g_strdup_printf("file://%s", filename);
g_free (filename);
}
@@ -557,14 +573,13 @@ e_select_names_init (ESelectNames *e_select_names)
contacts_uri,
selector_types);
if (button && EVOLUTION_IS_FOLDER_SELECTOR_BUTTON (button))
- g_signal_connect(button, "selected",
- G_CALLBACK(folder_selected), e_select_names);
- gtk_widget_show (button);
-
- g_signal_connect (e_table_scrolled_get_table (e_select_names->table), "double_click",
- G_CALLBACK (add_address), e_select_names);
- g_signal_connect (e_table_scrolled_get_table (e_select_names->table), "selection_change",
- G_CALLBACK (selection_change), e_select_names);
+ gtk_signal_connect(GTK_OBJECT(button), "selected",
+ GTK_SIGNAL_FUNC(folder_selected), e_select_names);
+
+ gtk_signal_connect (GTK_OBJECT (e_table_scrolled_get_table (e_select_names->table)), "double_click",
+ GTK_SIGNAL_FUNC (add_address), e_select_names);
+ gtk_signal_connect (GTK_OBJECT (e_table_scrolled_get_table (e_select_names->table)), "selection_change",
+ GTK_SIGNAL_FUNC (selection_change), e_select_names);
selection_change (e_table_scrolled_get_table (e_select_names->table), e_select_names);
addressbook_model_set_uri(e_select_names, e_select_names->model, contacts_uri);
@@ -574,63 +589,66 @@ e_select_names_init (ESelectNames *e_select_names)
static void e_select_names_child_free(char *key, ESelectNamesChild *child, ESelectNames *e_select_names)
{
- g_signal_handlers_disconnect_matched (child->source,
- (GSignalMatchType) (G_SIGNAL_MATCH_FUNC | G_SIGNAL_MATCH_DATA),
- 0, 0, NULL,
- G_CALLBACK (sync_table_and_models), e_select_names);
+ gtk_signal_disconnect_by_func (GTK_OBJECT (child->source), GTK_SIGNAL_FUNC (sync_table_and_models), e_select_names);
g_free(child->title);
- g_object_unref(child->text_model);
- g_object_unref(child->source);
+ gtk_object_unref(GTK_OBJECT(child->text_model));
+ gtk_object_unref(GTK_OBJECT(child->source));
g_free(key);
g_free(child);
}
static void
-e_select_names_dispose (GObject *object)
+e_select_names_destroy (GtkObject *object)
{
ESelectNames *e_select_names = E_SELECT_NAMES(object);
- if (e_select_names->gui) {
- g_object_unref(e_select_names->gui);
- e_select_names->gui = NULL;
- }
-
- if (e_select_names->children) {
- g_hash_table_foreach(e_select_names->children, (GHFunc) e_select_names_child_free, e_select_names);
- g_hash_table_destroy(e_select_names->children);
- e_select_names->children = NULL;
- }
+ gtk_object_unref(GTK_OBJECT(e_select_names->gui));
+ g_hash_table_foreach(e_select_names->children, (GHFunc) e_select_names_child_free, e_select_names);
+ g_hash_table_destroy(e_select_names->children);
+ gtk_object_unref(GTK_OBJECT(e_select_names->without));
+ gtk_object_unref(GTK_OBJECT(e_select_names->adapter));
+ gtk_object_unref(GTK_OBJECT(e_select_names->model));
- if (e_select_names->without) {
- g_object_unref(e_select_names->without);
- e_select_names->without = NULL;
- }
- if (e_select_names->adapter) {
- g_object_unref(e_select_names->adapter);
- e_select_names->adapter = NULL;
- }
- if (e_select_names->model) {
- g_object_unref(e_select_names->model);
- e_select_names->model = NULL;
- }
-
- if (e_select_names->def) {
- g_free(e_select_names->def);
- e_select_names->def = NULL;
- }
+ g_free(e_select_names->def);
- if (G_OBJECT_CLASS(parent_class)->dispose)
- G_OBJECT_CLASS(parent_class)->dispose(object);
+ (*(GTK_OBJECT_CLASS(parent_class))->destroy)(object);
}
GtkWidget*
e_select_names_new (void)
{
- GtkWidget *widget = g_object_new (E_TYPE_SELECT_NAMES, NULL);
+ GtkWidget *widget = GTK_WIDGET (gtk_type_new (e_select_names_get_type ()));
return widget;
}
static void
+e_select_names_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
+{
+ ESelectNames *editor;
+
+ editor = E_SELECT_NAMES (o);
+
+ switch (arg_id){
+ default:
+ return;
+ }
+}
+
+static void
+e_select_names_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
+{
+ ESelectNames *e_select_names;
+
+ e_select_names = E_SELECT_NAMES (object);
+
+ switch (arg_id) {
+ default:
+ arg->type = GTK_TYPE_INVALID;
+ break;
+ }
+}
+
+static void
button_clicked(GtkWidget *button, ESelectNamesChild *child)
{
real_add_address(child->names, child);
@@ -686,7 +704,7 @@ static void
section_right_click_cb (EText *text, GdkEventButton *ev, gint pos, ESelectNamesChild *child)
{
EPopupMenu right_click_menu[] = {
- E_POPUP_ITEM (N_("Remove"), G_CALLBACK (remove_cb), 0),
+ E_POPUP_ITEM (N_("Remove"), GTK_SIGNAL_FUNC (remove_cb), 0),
E_POPUP_TERMINATOR
};
gint index;
@@ -707,12 +725,11 @@ e_select_names_add_section(ESelectNames *e_select_names, char *name, char *id, E
{
ESelectNamesChild *child;
GtkWidget *button;
- GtkWidget *label;
GtkWidget *alignment;
+ GtkWidget *label;
GtkTable *table;
char *label_text;
ETable *etable;
- PangoLayout *layout;
GtkWidget *sw;
GtkWidget *recipient_table;
@@ -732,29 +749,39 @@ e_select_names_add_section(ESelectNames *e_select_names, char *name, char *id, E
e_select_names_text_model_set_separator (child->text_model, "\n");
child->source = source;
- g_object_ref(child->source);
+ gtk_object_ref(GTK_OBJECT(child->source));
e_select_names->child_count++;
alignment = gtk_alignment_new(0, 0, 1, 0);
- label_text = g_strconcat (child->title, " ->", NULL);
-
- label = gtk_label_new ("");
+ button = gtk_button_new ();
- gtk_label_set_markup (GTK_LABEL(label), label_text);
+ label = e_entry_new ();
+ gtk_object_set(GTK_OBJECT(label),
+ "draw_background", FALSE,
+ "draw_borders", FALSE,
+ "draw_button", TRUE,
+ "editable", FALSE,
+ "text", "",
+ "use_ellipsis", FALSE,
+ "justification", GTK_JUSTIFY_CENTER,
+ NULL);
+ label_text = g_strconcat (child->title, " ->", NULL);
+ gtk_object_set (GTK_OBJECT (label),
+ "text", label_text,
+ "emulate_label_resize", TRUE,
+ NULL);
g_free (label_text);
-
- button = gtk_button_new ();
gtk_container_add (GTK_CONTAINER (button), label);
child->label = label;
child->button = button;
gtk_container_add(GTK_CONTAINER(alignment), button);
gtk_widget_show_all(alignment);
- g_signal_connect(button, "clicked",
- G_CALLBACK(button_clicked), child);
+ gtk_signal_connect(GTK_OBJECT(button), "clicked",
+ GTK_SIGNAL_FUNC(button_clicked), child);
gtk_table_attach(table, alignment,
0, 1,
e_select_names->child_count,
@@ -765,32 +792,33 @@ e_select_names_add_section(ESelectNames *e_select_names, char *name, char *id, E
etable = e_table_scrolled_get_table (e_select_names->table);
gtk_widget_set_sensitive (button, e_table_selected_count (etable) > 0);
+
sw = gtk_scrolled_window_new (NULL, NULL);
recipient_table = e_entry_new ();
- g_object_set (recipient_table,
- "model", child->text_model,
- "allow_newlines", TRUE,
- NULL);
+ gtk_object_set (GTK_OBJECT (recipient_table),
+ "model", child->text_model,
+ "allow_newlines", TRUE,
+ NULL);
- g_signal_connect (recipient_table,
- "popup",
- G_CALLBACK (section_right_click_cb),
- child);
+ gtk_signal_connect (GTK_OBJECT (recipient_table),
+ "popup",
+ GTK_SIGNAL_FUNC (section_right_click_cb),
+ child);
gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (sw), recipient_table);
#if 0
- g_signal_connect(e_table_scrolled_get_table(E_TABLE_SCROLLED(etable)), "right_click",
- G_CALLBACK(section_right_click_cb), child);
- g_signal_connect(e_table_scrolled_get_table(E_TABLE_SCROLLED(etable)), "double_click",
- G_CALLBACK(remove_address), child);
+ gtk_signal_connect(GTK_OBJECT(e_table_scrolled_get_table(E_TABLE_SCROLLED(etable))), "right_click",
+ GTK_SIGNAL_FUNC(section_right_click_cb), child);
+ gtk_signal_connect(GTK_OBJECT(e_table_scrolled_get_table(E_TABLE_SCROLLED(etable))), "double_click",
+ GTK_SIGNAL_FUNC(remove_address), child);
#endif
- g_signal_connect (child->source,
- "changed",
- G_CALLBACK (sync_table_and_models),
- e_select_names);
+ gtk_signal_connect (GTK_OBJECT (child->source),
+ "changed",
+ GTK_SIGNAL_FUNC (sync_table_and_models),
+ e_select_names);
gtk_widget_show_all (sw);
@@ -809,14 +837,14 @@ e_select_names_add_section(ESelectNames *e_select_names, char *name, char *id, E
static void *
card_copy(const void *value, void *closure)
{
- g_object_ref((gpointer)value);
+ gtk_object_ref(GTK_OBJECT(value));
return (void *)value;
}
static void
card_free(void *value, void *closure)
{
- g_object_unref((gpointer)value);
+ gtk_object_unref(GTK_OBJECT(value));
}
EList *
@@ -836,7 +864,7 @@ e_select_names_get_section(ESelectNames *e_select_names, char *id)
for (i = 0; i < rows; i++) {
ECard *card = e_select_names_model_get_card (child->source, i);
e_list_append(list, card);
- g_object_unref(card);
+ gtk_object_unref(GTK_OBJECT(card));
}
return list;
}
@@ -848,7 +876,7 @@ e_select_names_get_source(ESelectNames *e_select_names,
ESelectNamesChild *child = g_hash_table_lookup(e_select_names->children, id);
if (child) {
if (child->source)
- g_object_ref(child->source);
+ gtk_object_ref(GTK_OBJECT(child->source));
return child->source;
} else
return NULL;
@@ -862,12 +890,10 @@ e_select_names_set_default (ESelectNames *e_select_names,
if (e_select_names->def) {
child = g_hash_table_lookup(e_select_names->children, e_select_names->def);
- if (child) {
- GtkWidget *label = child->label;
-
- /* set the previous default to non-bold */
- gtk_label_set_markup (GTK_LABEL (label), child->title);
- }
+ if (child)
+ gtk_object_set (GTK_OBJECT (E_ENTRY (child->label)->item),
+ "bold", FALSE,
+ NULL);
}
g_free(e_select_names->def);
@@ -875,13 +901,9 @@ e_select_names_set_default (ESelectNames *e_select_names,
if (e_select_names->def) {
child = g_hash_table_lookup(e_select_names->children, e_select_names->def);
- if (child) {
- GtkWidget *label = child->label;
- char *markup = g_strconcat ("<b>", child->title, "</b>", NULL);
-
- /* set the new default to bold */
- gtk_label_set_markup (GTK_LABEL (label), markup);
- g_free (markup);
- }
+ if (child)
+ gtk_object_set (GTK_OBJECT (E_ENTRY (child->label)->item),
+ "bold", TRUE,
+ NULL);
}
}
diff --git a/addressbook/gui/component/select-names/e-select-names.h b/addressbook/gui/component/select-names/e-select-names.h
index bbed1d77ee..b70655b932 100644
--- a/addressbook/gui/component/select-names/e-select-names.h
+++ b/addressbook/gui/component/select-names/e-select-names.h
@@ -22,7 +22,9 @@
#include <glib.h>
#include <gtk/gtkwidget.h>
-#include <gtk/gtkdialog.h>
+#include <libgnome/gnome-defs.h>
+#include <libgnome/gnome-util.h>
+#include <libgnomeui/gnome-dialog.h>
#include <glade/glade.h>
#include <gal/e-table/e-table.h>
#include <gal/e-table/e-table-scrolled.h>
@@ -45,11 +47,11 @@ extern "C" {
* --------------------------------------------------------------------------------
*/
-#define E_TYPE_SELECT_NAMES (e_select_names_get_type ())
-#define E_SELECT_NAMES(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_SELECT_NAMES, ESelectNames))
-#define E_SELECT_NAMES_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_SELECT_NAMES, ESelectNamesClass))
-#define E_IS_SELECT_NAMES(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_SELECT_NAMES))
-#define E_IS_SELECT_NAMES_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_SELECT_NAMES))
+#define E_SELECT_NAMES_TYPE (e_select_names_get_type ())
+#define E_SELECT_NAMES(obj) (GTK_CHECK_CAST ((obj), E_SELECT_NAMES_TYPE, ESelectNames))
+#define E_SELECT_NAMES_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_SELECT_NAMES_TYPE, ESelectNamesClass))
+#define E_IS_SELECT_NAMES(obj) (GTK_CHECK_TYPE ((obj), E_SELECT_NAMES_TYPE))
+#define E_IS_SELECT_NAMES_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_SELECT_NAMES_TYPE))
typedef struct _ESelectNames ESelectNames;
typedef struct _ESelectNamesClass ESelectNamesClass;
@@ -57,7 +59,7 @@ typedef struct _ESelectNamesFolder ESelectNamesFolder;
struct _ESelectNames
{
- GtkDialog parent;
+ GnomeDialog parent;
/* item specific fields */
GladeXML *gui;
@@ -71,18 +73,19 @@ struct _ESelectNames
GtkWidget *categories;
GtkWidget *select_entry;
GtkWidget *status_message;
+ GtkWidget *status_image;
char *def;
ESelectNamesFolder *current_folder;
};
struct _ESelectNamesClass
{
- GtkDialogClass parent_class;
+ GnomeDialogClass parent_class;
};
GtkWidget *e_select_names_new (void);
-GType e_select_names_get_type (void);
+GtkType e_select_names_get_type (void);
void e_select_names_add_section (ESelectNames *e_select_names,
char *name,
diff --git a/addressbook/gui/component/select-names/select-names.glade b/addressbook/gui/component/select-names/select-names.glade
index 9a6b38f461..6485876fbf 100644
--- a/addressbook/gui/component/select-names/select-names.glade
+++ b/addressbook/gui/component/select-names/select-names.glade
@@ -1,451 +1,518 @@
-<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
-<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
+<?xml version="1.0"?>
+<GTK-Interface>
-<glade-interface>
+<project>
+ <name>Select-names</name>
+ <program_name>select-names</program_name>
+ <directory></directory>
+ <source_directory>src</source_directory>
+ <pixmaps_directory>../../../../art/</pixmaps_directory>
+ <language>C</language>
+ <gnome_support>True</gnome_support>
+ <gettext_support>True</gettext_support>
+ <output_main_file>False</output_main_file>
+ <output_support_files>False</output_support_files>
+ <output_build_files>False</output_build_files>
+</project>
-<widget class="GtkDialog" id="dialog-top">
- <property name="title" translatable="yes">Select Names</property>
- <property name="type">GTK_WINDOW_TOPLEVEL</property>
- <property name="window_position">GTK_WIN_POS_NONE</property>
- <property name="modal">False</property>
- <property name="default_width">417</property>
- <property name="default_height">332</property>
- <property name="resizable">True</property>
- <property name="destroy_with_parent">False</property>
- <property name="has_separator">True</property>
+<widget>
+ <class>GnomeDialog</class>
+ <name>dialog-top</name>
+ <visible>False</visible>
+ <title>Select Names</title>
+ <type>GTK_WINDOW_TOPLEVEL</type>
+ <position>GTK_WIN_POS_NONE</position>
+ <modal>False</modal>
+ <default_width>417</default_width>
+ <default_height>332</default_height>
+ <allow_shrink>False</allow_shrink>
+ <allow_grow>True</allow_grow>
+ <auto_shrink>False</auto_shrink>
+ <auto_close>False</auto_close>
+ <hide_on_close>False</hide_on_close>
- <child internal-child="vbox">
- <widget class="GtkVBox" id="dialog-vbox1">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">3</property>
+ <widget>
+ <class>GtkVBox</class>
+ <child_name>GnomeDialog:vbox</child_name>
+ <name>dialog-vbox1</name>
+ <border_width>3</border_width>
+ <homogeneous>False</homogeneous>
+ <spacing>3</spacing>
+ <child>
+ <padding>4</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
- <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>
+ <widget>
+ <class>GtkHButtonBox</class>
+ <child_name>GnomeDialog:action_area</child_name>
+ <name>dialog-action_area1</name>
+ <layout_style>GTK_BUTTONBOX_END</layout_style>
+ <spacing>8</spacing>
+ <child_min_width>85</child_min_width>
+ <child_min_height>27</child_min_height>
+ <child_ipad_x>7</child_ipad_x>
+ <child_ipad_y>0</child_ipad_y>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>True</fill>
+ <pack>GTK_PACK_END</pack>
+ </child>
- <child>
- <widget class="GtkButton" id="button4">
- <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">0</property>
- </widget>
- </child>
+ <widget>
+ <class>GtkButton</class>
+ <name>button4</name>
+ <can_default>True</can_default>
+ <has_default>True</has_default>
+ <can_focus>True</can_focus>
+ <stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
+ </widget>
- <child>
- <widget class="GtkButton" id="button5">
- <property name="visible">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>
+ <widget>
+ <class>GtkButton</class>
+ <name>button5</name>
+ <can_focus>True</can_focus>
+ <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
+ </widget>
+ </widget>
+ <widget>
+ <class>GtkTable</class>
+ <name>table-top</name>
+ <rows>3</rows>
+ <columns>1</columns>
+ <homogeneous>False</homogeneous>
+ <row_spacing>3</row_spacing>
+ <column_spacing>3</column_spacing>
<child>
- <widget class="GtkTable" id="table-top">
- <property name="visible">True</property>
- <property name="n_rows">3</property>
- <property name="n_columns">1</property>
- <property name="homogeneous">False</property>
- <property name="row_spacing">3</property>
- <property name="column_spacing">3</property>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
- <child>
- <widget class="GtkHSeparator" id="hseparator1">
- <property name="visible">True</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_options"></property>
- <property name="y_options"></property>
- </packing>
- </child>
+ <widget>
+ <class>GtkHSeparator</class>
+ <name>hseparator1</name>
+ <child>
+ <left_attach>0</left_attach>
+ <right_attach>1</right_attach>
+ <top_attach>1</top_attach>
+ <bottom_attach>2</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>False</xfill>
+ <yfill>False</yfill>
+ </child>
+ </widget>
- <child>
- <widget class="GtkFrame" id="frame1">
- <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>
+ <widget>
+ <class>GtkFrame</class>
+ <name>frame1</name>
+ <label>Show Contacts</label>
+ <label_xalign>0</label_xalign>
+ <shadow_type>GTK_SHADOW_ETCHED_IN</shadow_type>
+ <child>
+ <left_attach>0</left_attach>
+ <right_attach>1</right_attach>
+ <top_attach>0</top_attach>
+ <bottom_attach>1</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>True</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>False</yfill>
+ </child>
- <child>
- <widget class="GtkTable" id="table5">
- <property name="border_width">3</property>
- <property name="visible">True</property>
- <property name="n_rows">2</property>
- <property name="n_columns">2</property>
- <property name="homogeneous">False</property>
- <property name="row_spacing">3</property>
- <property name="column_spacing">3</property>
+ <widget>
+ <class>GtkTable</class>
+ <name>table5</name>
+ <border_width>3</border_width>
+ <rows>2</rows>
+ <columns>2</columns>
+ <homogeneous>False</homogeneous>
+ <row_spacing>3</row_spacing>
+ <column_spacing>3</column_spacing>
- <child>
- <widget class="GtkLabel" id="label30">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Folder:</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">0</property>
- <property name="bottom_attach">1</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
+ <widget>
+ <class>GtkLabel</class>
+ <name>label30</name>
+ <label>_Folder:</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <child>
+ <left_attach>0</left_attach>
+ <right_attach>1</right_attach>
+ <top_attach>0</top_attach>
+ <bottom_attach>1</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>False</yfill>
+ </child>
+ </widget>
- <child>
- <widget class="GtkLabel" id="label31">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Category:</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">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
+ <widget>
+ <class>GtkLabel</class>
+ <name>label31</name>
+ <label>_Category:</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <child>
+ <left_attach>0</left_attach>
+ <right_attach>1</right_attach>
+ <top_attach>1</top_attach>
+ <bottom_attach>2</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>False</yfill>
+ </child>
+ </widget>
- <child>
- <widget class="GtkAlignment" id="alignment5">
- <property name="visible">True</property>
- <property name="xalign">7.45058e-09</property>
- <property name="yalign">0.5</property>
- <property name="xscale">0</property>
- <property name="yscale">1</property>
+ <widget>
+ <class>GtkAlignment</class>
+ <name>alignment5</name>
+ <xalign>7.45058e-09</xalign>
+ <yalign>0.5</yalign>
+ <xscale>0</xscale>
+ <yscale>1</yscale>
+ <child>
+ <left_attach>1</left_attach>
+ <right_attach>2</right_attach>
+ <top_attach>1</top_attach>
+ <bottom_attach>2</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>True</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
- <child>
- <widget class="Custom" id="custom-categories">
- <property name="visible">True</property>
- <property name="creation_function">e_select_names_create_categories</property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Tue, 19 Feb 2002 23:06:24 GMT</property>
- </widget>
- </child>
- </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>
+ <widget>
+ <class>Custom</class>
+ <name>custom-categories</name>
+ <creation_function>e_select_names_create_categories</creation_function>
+ <int1>0</int1>
+ <int2>0</int2>
+ <last_modification_time>Tue, 19 Feb 2002 23:06:24 GMT</last_modification_time>
+ </widget>
+ </widget>
- <child>
- <widget class="Custom" id="folder-selector">
- <property name="visible">True</property>
- <property name="creation_function">e_addressbook_create_folder_selector</property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Mon, 15 Jul 2002 02:21:32 GMT</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="x_options">fill</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
- </widget>
- </child>
+ <widget>
+ <class>Custom</class>
+ <name>folder-selector</name>
+ <creation_function>e_addressbook_create_folder_selector</creation_function>
+ <int1>0</int1>
+ <int2>0</int2>
+ <last_modification_time>Mon, 15 Jul 2002 02:21:32 GMT</last_modification_time>
+ <child>
+ <left_attach>1</left_attach>
+ <right_attach>2</right_attach>
+ <top_attach>0</top_attach>
+ <bottom_attach>1</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+ </widget>
+ </widget>
+ </widget>
+ <widget>
+ <class>GtkVBox</class>
+ <name>vbox5</name>
+ <homogeneous>False</homogeneous>
+ <spacing>0</spacing>
+ <child>
+ <left_attach>0</left_attach>
+ <right_attach>1</right_attach>
+ <top_attach>1</top_attach>
+ <bottom_attach>2</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>True</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+
+ <widget>
+ <class>GtkTable</class>
+ <name>table4</name>
+ <rows>2</rows>
+ <columns>2</columns>
+ <homogeneous>False</homogeneous>
+ <row_spacing>3</row_spacing>
+ <column_spacing>3</column_spacing>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label32</name>
+ <label>Type a name into the entry, or
+select one from the list below:</label>
+ <justify>GTK_JUSTIFY_LEFT</justify>
+ <wrap>False</wrap>
+ <xalign>0</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <child>
+ <left_attach>0</left_attach>
+ <right_attach>1</right_attach>
+ <top_attach>0</top_attach>
+ <bottom_attach>1</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>False</yfill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkTable</class>
+ <name>table-recipients</name>
+ <rows>5</rows>
+ <columns>2</columns>
+ <homogeneous>False</homogeneous>
+ <row_spacing>3</row_spacing>
+ <column_spacing>3</column_spacing>
+ <child>
+ <left_attach>1</left_attach>
+ <right_attach>2</right_attach>
+ <top_attach>1</top_attach>
+ <bottom_attach>2</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>True</xexpand>
+ <yexpand>True</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label20</name>
+ <label>Selected Contacts:</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>True</wrap>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
<child>
- <widget class="GtkLabel" id="label1">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Show Contacts</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>
+ <left_attach>1</left_attach>
+ <right_attach>2</right_attach>
+ <top_attach>0</top_attach>
+ <bottom_attach>1</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>False</yfill>
</child>
</widget>
- <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"></property>
- </packing>
- </child>
+ </widget>
- <child>
- <widget class="GtkVBox" id="vbox5">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">0</property>
+ <widget>
+ <class>GtkAlignment</class>
+ <name>alignment4</name>
+ <xalign>7.45058e-09</xalign>
+ <yalign>0.5</yalign>
+ <xscale>1</xscale>
+ <yscale>1</yscale>
+ <child>
+ <left_attach>0</left_attach>
+ <right_attach>1</right_attach>
+ <top_attach>1</top_attach>
+ <bottom_attach>2</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>True</xexpand>
+ <yexpand>True</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
- <child>
- <widget class="GtkTable" id="table4">
- <property name="visible">True</property>
- <property name="n_rows">2</property>
- <property name="n_columns">2</property>
- <property name="homogeneous">False</property>
- <property name="row_spacing">3</property>
- <property name="column_spacing">3</property>
+ <widget>
+ <class>GtkVBox</class>
+ <name>vbox6</name>
+ <border_width>3</border_width>
+ <homogeneous>False</homogeneous>
+ <spacing>3</spacing>
- <child>
- <widget class="GtkLabel" id="label32">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Type a name into the entry, or
-select one from the list below:</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>
+ <class>GtkHBox</class>
+ <name>hbox1</name>
+ <homogeneous>False</homogeneous>
+ <spacing>3</spacing>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ <widget>
+ <class>GtkEntry</class>
+ <name>entry-select</name>
+ <can_focus>True</can_focus>
+ <editable>True</editable>
+ <text_visible>True</text_visible>
+ <text_max_length>0</text_max_length>
+ <text></text>
<child>
- <widget class="GtkTable" id="table-recipients">
- <property name="visible">True</property>
- <property name="n_rows">1</property>
- <property name="n_columns">2</property>
- <property name="homogeneous">False</property>
- <property name="row_spacing">3</property>
- <property name="column_spacing">3</property>
-
- <child>
- <widget class="GtkLabel" id="label20">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Selected Contacts:</property>
- <property name="use_underline">False</property>
- <property name="use_markup">False</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">True</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="left_attach">1</property>
- <property name="right_attach">2</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="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- </packing>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
</child>
+ </widget>
+ <widget>
+ <class>GtkButton</class>
+ <name>button-find</name>
+ <can_focus>True</can_focus>
+ <label>Find</label>
+ <relief>GTK_RELIEF_NORMAL</relief>
<child>
- <widget class="GtkAlignment" id="alignment4">
- <property name="visible">True</property>
- <property name="xalign">7.45058e-09</property>
- <property name="yalign">0.5</property>
- <property name="xscale">1</property>
- <property name="yscale">1</property>
-
- <child>
- <widget class="GtkVBox" id="vbox6">
- <property name="border_width">3</property>
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">3</property>
-
- <child>
- <widget class="GtkHBox" id="hbox1">
- <property name="visible">True</property>
- <property name="homogeneous">False</property>
- <property name="spacing">3</property>
-
- <child>
- <widget class="GtkEntry" id="entry-select">
- <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="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkButton" id="button-find">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="label" translatable="yes">Find</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>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">False</property>
- <property name="fill">False</property>
- </packing>
- </child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
+ </child>
+ </widget>
+ </widget>
- <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">1</property>
+ <widget>
+ <class>GtkAlignment</class>
+ <name>alignment3</name>
+ <xalign>0.5</xalign>
+ <yalign>0.5</yalign>
+ <xscale>1</xscale>
+ <yscale>1</yscale>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
- <child>
- <widget class="Custom" id="table-source">
- <property name="visible">True</property>
- <property name="creation_function">e_addressbook_create_ebook_table</property>
- <property name="int1">0</property>
- <property name="int2">0</property>
- <property name="last_modification_time">Sat, 10 Jun 2000 22:02:57 GMT</property>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- </widget>
- </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>
+ <widget>
+ <class>Custom</class>
+ <name>table-source</name>
+ <creation_function>e_addressbook_create_ebook_table</creation_function>
+ <int1>0</int1>
+ <int2>0</int2>
+ <last_modification_time>Sat, 10 Jun 2000 22:02:57 GMT</last_modification_time>
</widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
+ </widget>
</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>
- </packing>
+ </widget>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkHBox</class>
+ <name>status-hbox</name>
+ <homogeneous>False</homogeneous>
+ <spacing>3</spacing>
+ <child>
+ <left_attach>0</left_attach>
+ <right_attach>1</right_attach>
+ <top_attach>2</top_attach>
+ <bottom_attach>3</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>True</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+
+ <widget>
+ <class>Custom</class>
+ <name>status-image</name>
+ <visible>False</visible>
+ <creation_function>e_create_image_widget</creation_function>
+ <string1>evolution-contacts-mini.png</string1>
+ <int1>0</int1>
+ <int2>0</int2>
+ <last_modification_time>Thu, 28 Nov 2002 22:26:05 GMT</last_modification_time>
+ <child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>False</fill>
</child>
+ </widget>
+ <widget>
+ <class>GtkLabel</class>
+ <name>status-message</name>
+ <label></label>
+ <justify>GTK_JUSTIFY_LEFT</justify>
+ <wrap>False</wrap>
+ <xalign>4.84288e-08</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>3</ypad>
<child>
- <widget class="GtkLabel" id="status-message">
- <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">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">3</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>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
</child>
</widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
+ </widget>
</widget>
- </child>
+ </widget>
</widget>
-</glade-interface>
+</GTK-Interface>
diff --git a/addressbook/gui/contact-editor/e-contact-editor-address.c b/addressbook/gui/contact-editor/e-contact-editor-address.c
index 954be85928..42cb190074 100644
--- a/addressbook/gui/contact-editor/e-contact-editor-address.c
+++ b/addressbook/gui/contact-editor/e-contact-editor-address.c
@@ -24,55 +24,57 @@
#include <e-contact-editor-address.h>
#include <glib.h>
+#include <libgnome/gnome-defs.h>
#include <libgnome/gnome-i18n.h>
+#include <libgnomeui/gnome-stock.h>
#include <libgnomeui/gnome-window-icon.h>
#include <libgnome/gnome-util.h>
#include <gal/widgets/e-unicode.h>
#include <gal/widgets/e-gui-utils.h>
#include <gtk/gtkcombo.h>
-#include <gtk/gtkstock.h>
#include <string.h>
#include <stdlib.h>
#include <locale.h>
static void e_contact_editor_address_init (EContactEditorAddress *card);
static void e_contact_editor_address_class_init (EContactEditorAddressClass *klass);
-static void e_contact_editor_address_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
-static void e_contact_editor_address_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
-static void e_contact_editor_address_dispose (GObject *object);
+static void e_contact_editor_address_set_arg (GtkObject *o, GtkArg *arg, guint arg_id);
+static void e_contact_editor_address_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
+static void e_contact_editor_address_destroy (GtkObject *object);
static void fill_in_info(EContactEditorAddress *editor);
static void extract_info(EContactEditorAddress *editor);
-static GtkDialogClass *parent_class = NULL;
+static GnomeDialogClass *parent_class = NULL;
/* The arguments we take */
enum {
- PROP_0,
- PROP_ADDRESS,
- PROP_EDITABLE
+ ARG_0,
+ ARG_ADDRESS,
+ ARG_EDITABLE
};
-GType
+GtkType
e_contact_editor_address_get_type (void)
{
- static GType contact_editor_address_type = 0;
-
- if (!contact_editor_address_type) {
- static const GTypeInfo contact_editor_address_info = {
- sizeof (EContactEditorAddressClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) e_contact_editor_address_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (EContactEditorAddress),
- 0, /* n_preallocs */
- (GInstanceInitFunc) e_contact_editor_address_init,
- };
-
- contact_editor_address_type = g_type_register_static (GTK_TYPE_DIALOG, "EContactEditorAddress", &contact_editor_address_info, 0);
- }
+ static GtkType contact_editor_address_type = 0;
+
+ if (!contact_editor_address_type)
+ {
+ static const GtkTypeInfo contact_editor_address_info =
+ {
+ "EContactEditorAddress",
+ sizeof (EContactEditorAddress),
+ sizeof (EContactEditorAddressClass),
+ (GtkClassInitFunc) e_contact_editor_address_class_init,
+ (GtkObjectInitFunc) e_contact_editor_address_init,
+ /* reserved_1 */ NULL,
+ /* reserved_2 */ NULL,
+ (GtkClassInitFunc) NULL,
+ };
+
+ contact_editor_address_type = gtk_type_unique (gnome_dialog_get_type (), &contact_editor_address_info);
+ }
return contact_editor_address_type;
}
@@ -80,28 +82,22 @@ e_contact_editor_address_get_type (void)
static void
e_contact_editor_address_class_init (EContactEditorAddressClass *klass)
{
- GObjectClass *object_class;
-
- object_class = G_OBJECT_CLASS (klass);
-
- parent_class = g_type_class_ref (GTK_TYPE_DIALOG);
-
- object_class->set_property = e_contact_editor_address_set_property;
- object_class->get_property = e_contact_editor_address_get_property;
- object_class->dispose = e_contact_editor_address_dispose;
-
- g_object_class_install_property (object_class, PROP_ADDRESS,
- g_param_spec_pointer ("address",
- _("Address"),
- /*_( */"XXX blurb" /*)*/,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_EDITABLE,
- g_param_spec_boolean ("editable",
- _("Editable"),
- /*_( */"XXX blurb" /*)*/,
- FALSE,
- G_PARAM_READWRITE));
+ GtkObjectClass *object_class;
+ GnomeDialogClass *dialog_class;
+
+ object_class = (GtkObjectClass*) klass;
+ dialog_class = (GnomeDialogClass *) klass;
+
+ parent_class = gtk_type_class (gnome_dialog_get_type ());
+
+ gtk_object_add_arg_type ("EContactEditorAddress::address", GTK_TYPE_POINTER,
+ GTK_ARG_READWRITE, ARG_ADDRESS);
+ gtk_object_add_arg_type ("EContactEditorAddress::editable", GTK_TYPE_BOOL,
+ GTK_ARG_READWRITE, ARG_EDITABLE);
+
+ object_class->set_arg = e_contact_editor_address_set_arg;
+ object_class->get_arg = e_contact_editor_address_get_arg;
+ object_class->destroy = e_contact_editor_address_destroy;
}
static GList *
@@ -412,16 +408,17 @@ e_contact_editor_address_init (EContactEditorAddress *e_contact_editor_address)
GtkWidget *widget;
char *icon_path;
- gtk_dialog_add_buttons (GTK_DIALOG (e_contact_editor_address),
- GTK_STOCK_OK, GTK_RESPONSE_OK,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- NULL);
+ gnome_dialog_append_button ( GNOME_DIALOG(e_contact_editor_address),
+ GNOME_STOCK_BUTTON_OK);
+
+ gnome_dialog_append_button ( GNOME_DIALOG(e_contact_editor_address),
+ GNOME_STOCK_BUTTON_CANCEL);
gtk_window_set_policy(GTK_WINDOW(e_contact_editor_address), FALSE, TRUE, FALSE);
e_contact_editor_address->address = NULL;
- gui = glade_xml_new (EVOLUTION_GLADEDIR "/fulladdr.glade", NULL, NULL);
+ gui = glade_xml_new (EVOLUTION_GLADEDIR "/fulladdr.glade", NULL);
e_contact_editor_address->gui = gui;
setup_tab_order (gui);
@@ -432,10 +429,10 @@ e_contact_editor_address_init (EContactEditorAddress *e_contact_editor_address)
GTK_WINDOW (widget)->title);
widget = glade_xml_get_widget(gui, "table-checkaddress");
- g_object_ref(widget);
+ gtk_widget_ref(widget);
gtk_container_remove(GTK_CONTAINER(widget->parent), widget);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (e_contact_editor_address)->vbox), widget, TRUE, TRUE, 0);
- g_object_unref(widget);
+ gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (e_contact_editor_address)->vbox), widget, TRUE, TRUE, 0);
+ gtk_widget_unref(widget);
icon_path = g_concat_dir_and_file (EVOLUTION_ICONSDIR, "evolution-contacts-mini.png");
gnome_window_icon_set_from_file (GTK_WINDOW (e_contact_editor_address), icon_path);
@@ -443,46 +440,39 @@ e_contact_editor_address_init (EContactEditorAddress *e_contact_editor_address)
}
void
-e_contact_editor_address_dispose (GObject *object)
+e_contact_editor_address_destroy (GtkObject *object)
{
EContactEditorAddress *e_contact_editor_address = E_CONTACT_EDITOR_ADDRESS(object);
- if (e_contact_editor_address->gui) {
- g_object_unref(e_contact_editor_address->gui);
- e_contact_editor_address->gui = NULL;
- }
-
- if (e_contact_editor_address->address) {
- e_card_delivery_address_unref(e_contact_editor_address->address);
- e_contact_editor_address->address = NULL;
- }
+ if (e_contact_editor_address->gui)
+ gtk_object_unref(GTK_OBJECT(e_contact_editor_address->gui));
+ e_card_delivery_address_unref(e_contact_editor_address->address);
}
GtkWidget*
e_contact_editor_address_new (const ECardDeliveryAddress *address)
{
- GtkWidget *widget = g_object_new (E_TYPE_CONTACT_EDITOR_ADDRESS, NULL);
- g_object_set (widget,
- "address", address,
- NULL);
+ GtkWidget *widget = GTK_WIDGET (gtk_type_new (e_contact_editor_address_get_type ()));
+ gtk_object_set (GTK_OBJECT(widget),
+ "address", address,
+ NULL);
return widget;
}
static void
-e_contact_editor_address_set_property (GObject *object, guint prop_id,
- const GValue *value, GParamSpec *pspec)
+e_contact_editor_address_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
{
EContactEditorAddress *e_contact_editor_address;
- e_contact_editor_address = E_CONTACT_EDITOR_ADDRESS (object);
+ e_contact_editor_address = E_CONTACT_EDITOR_ADDRESS (o);
- switch (prop_id){
- case PROP_ADDRESS:
+ switch (arg_id){
+ case ARG_ADDRESS:
e_card_delivery_address_unref(e_contact_editor_address->address);
- e_contact_editor_address->address = e_card_delivery_address_copy(g_value_get_pointer (value));
+ e_contact_editor_address->address = e_card_delivery_address_copy(GTK_VALUE_POINTER (*arg));
fill_in_info(e_contact_editor_address);
break;
- case PROP_EDITABLE: {
+ case ARG_EDITABLE: {
int i;
char *widget_names[] = {
"entry-street",
@@ -501,7 +491,7 @@ e_contact_editor_address_set_property (GObject *object, guint prop_id,
"label-code",
NULL
};
- e_contact_editor_address->editable = g_value_get_boolean (value) ? TRUE : FALSE;
+ e_contact_editor_address->editable = GTK_VALUE_BOOL (*arg) ? TRUE : FALSE;
for (i = 0; widget_names[i] != NULL; i ++) {
GtkWidget *w = glade_xml_get_widget(e_contact_editor_address->gui, widget_names[i]);
if (GTK_IS_ENTRY (w)) {
@@ -519,30 +509,26 @@ e_contact_editor_address_set_property (GObject *object, guint prop_id,
}
break;
}
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
}
}
static void
-e_contact_editor_address_get_property (GObject *object, guint prop_id,
- GValue *value, GParamSpec *pspec)
+e_contact_editor_address_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
{
EContactEditorAddress *e_contact_editor_address;
e_contact_editor_address = E_CONTACT_EDITOR_ADDRESS (object);
- switch (prop_id) {
- case PROP_ADDRESS:
+ switch (arg_id) {
+ case ARG_ADDRESS:
extract_info(e_contact_editor_address);
- g_value_set_pointer (value, e_card_delivery_address_ref(e_contact_editor_address->address));
+ GTK_VALUE_POINTER (*arg) = e_card_delivery_address_ref(e_contact_editor_address->address);
break;
- case PROP_EDITABLE:
- g_value_set_boolean (value, e_contact_editor_address->editable ? TRUE : FALSE);
+ case ARG_EDITABLE:
+ GTK_VALUE_BOOL (*arg) = e_contact_editor_address->editable ? TRUE : FALSE;
break;
default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ arg->type = GTK_TYPE_INVALID;
break;
}
}
@@ -550,12 +536,9 @@ e_contact_editor_address_get_property (GObject *object, guint prop_id,
static void
fill_in_field(EContactEditorAddress *editor, char *field, char *string)
{
- GtkEntry *entry = GTK_ENTRY(glade_xml_get_widget(editor->gui, field));
- if (entry) {
- if (string)
- gtk_entry_set_text(entry, string);
- else
- gtk_entry_set_text(entry, "");
+ GtkEditable *editable = GTK_EDITABLE(glade_xml_get_widget(editor->gui, field));
+ if (editable) {
+ e_utf8_gtk_editable_set_text(editable, string);
}
}
diff --git a/addressbook/gui/contact-editor/e-contact-editor-fullname.c b/addressbook/gui/contact-editor/e-contact-editor-fullname.c
index bd51c71605..faf382c729 100644
--- a/addressbook/gui/contact-editor/e-contact-editor-fullname.c
+++ b/addressbook/gui/contact-editor/e-contact-editor-fullname.c
@@ -20,52 +20,52 @@
*/
#include <config.h>
+#include <libgnomeui/gnome-stock.h>
#include <gal/widgets/e-unicode.h>
#include "e-contact-editor-fullname.h"
#include <libgnomeui/gnome-window-icon.h>
#include <libgnome/gnome-util.h>
-#include <libgnome/gnome-i18n.h>
#include <gtk/gtkcombo.h>
-#include <gtk/gtkstock.h>
static void e_contact_editor_fullname_init (EContactEditorFullname *card);
static void e_contact_editor_fullname_class_init (EContactEditorFullnameClass *klass);
-static void e_contact_editor_fullname_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
-static void e_contact_editor_fullname_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
-static void e_contact_editor_fullname_dispose (GObject *object);
+static void e_contact_editor_fullname_set_arg (GtkObject *o, GtkArg *arg, guint arg_id);
+static void e_contact_editor_fullname_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
+static void e_contact_editor_fullname_destroy (GtkObject *object);
static void fill_in_info(EContactEditorFullname *editor);
static void extract_info(EContactEditorFullname *editor);
-static GtkDialogClass *parent_class = NULL;
+static GnomeDialogClass *parent_class = NULL;
/* The arguments we take */
enum {
- PROP_0,
- PROP_NAME,
- PROP_EDITABLE
+ ARG_0,
+ ARG_NAME,
+ ARG_EDITABLE
};
-GType
+GtkType
e_contact_editor_fullname_get_type (void)
{
- static GType contact_editor_fullname_type = 0;
-
- if (!contact_editor_fullname_type) {
- static const GTypeInfo contact_editor_fullname_info = {
- sizeof (EContactEditorFullnameClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) e_contact_editor_fullname_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (EContactEditorFullname),
- 0, /* n_preallocs */
- (GInstanceInitFunc) e_contact_editor_fullname_init,
- };
-
- contact_editor_fullname_type = g_type_register_static (GTK_TYPE_DIALOG, "EContactEditorFullname", &contact_editor_fullname_info, 0);
- }
+ static GtkType contact_editor_fullname_type = 0;
+
+ if (!contact_editor_fullname_type)
+ {
+ static const GtkTypeInfo contact_editor_fullname_info =
+ {
+ "EContactEditorFullname",
+ sizeof (EContactEditorFullname),
+ sizeof (EContactEditorFullnameClass),
+ (GtkClassInitFunc) e_contact_editor_fullname_class_init,
+ (GtkObjectInitFunc) e_contact_editor_fullname_init,
+ /* reserved_1 */ NULL,
+ /* reserved_2 */ NULL,
+ (GtkClassInitFunc) NULL,
+ };
+
+ contact_editor_fullname_type = gtk_type_unique (gnome_dialog_get_type (), &contact_editor_fullname_info);
+ }
return contact_editor_fullname_type;
}
@@ -73,28 +73,23 @@ e_contact_editor_fullname_get_type (void)
static void
e_contact_editor_fullname_class_init (EContactEditorFullnameClass *klass)
{
- GObjectClass *object_class;
+ GtkObjectClass *object_class;
+ GnomeDialogClass *dialog_class;
- object_class = G_OBJECT_CLASS (klass);
+ object_class = (GtkObjectClass*) klass;
+ dialog_class = (GnomeDialogClass *) klass;
- parent_class = g_type_class_ref (GTK_TYPE_DIALOG);
+ parent_class = gtk_type_class (gnome_dialog_get_type ());
- object_class->set_property = e_contact_editor_fullname_set_property;
- object_class->get_property = e_contact_editor_fullname_get_property;
- object_class->dispose = e_contact_editor_fullname_dispose;
+ gtk_object_add_arg_type ("EContactEditorFullname::name", GTK_TYPE_POINTER,
+ GTK_ARG_READWRITE, ARG_NAME);
- g_object_class_install_property (object_class, PROP_NAME,
- g_param_spec_pointer ("name",
- _("Name"),
- /*_( */"XXX blurb" /*)*/,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_EDITABLE,
- g_param_spec_boolean ("editable",
- _("Editable"),
- /*_( */"XXX blurb" /*)*/,
- FALSE,
- G_PARAM_READWRITE));
+ gtk_object_add_arg_type ("EContactEditorFullname::editable", GTK_TYPE_BOOL,
+ GTK_ARG_READWRITE, ARG_EDITABLE);
+
+ object_class->set_arg = e_contact_editor_fullname_set_arg;
+ object_class->get_arg = e_contact_editor_fullname_get_arg;
+ object_class->destroy = e_contact_editor_fullname_destroy;
}
static void
@@ -104,15 +99,16 @@ e_contact_editor_fullname_init (EContactEditorFullname *e_contact_editor_fullnam
GtkWidget *widget;
char *icon_path;
- gtk_dialog_add_buttons (GTK_DIALOG (e_contact_editor_fullname),
- GTK_STOCK_OK, GTK_RESPONSE_OK,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- NULL);
+ gnome_dialog_append_button ( GNOME_DIALOG(e_contact_editor_fullname),
+ GNOME_STOCK_BUTTON_OK);
+
+ gnome_dialog_append_button ( GNOME_DIALOG(e_contact_editor_fullname),
+ GNOME_STOCK_BUTTON_CANCEL);
gtk_window_set_policy(GTK_WINDOW(e_contact_editor_fullname), TRUE, TRUE, FALSE);
e_contact_editor_fullname->name = NULL;
- gui = glade_xml_new (EVOLUTION_GLADEDIR "/fullname.glade", NULL, NULL);
+ gui = glade_xml_new (EVOLUTION_GLADEDIR "/fullname.glade", NULL);
e_contact_editor_fullname->gui = gui;
widget = glade_xml_get_widget(gui, "dialog-checkfullname");
@@ -120,10 +116,10 @@ e_contact_editor_fullname_init (EContactEditorFullname *e_contact_editor_fullnam
GTK_WINDOW (widget)->title);
widget = glade_xml_get_widget(gui, "table-checkfullname");
- g_object_ref(widget);
+ gtk_widget_ref(widget);
gtk_container_remove(GTK_CONTAINER(widget->parent), widget);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (e_contact_editor_fullname)->vbox), widget, TRUE, TRUE, 0);
- g_object_unref(widget);
+ gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (e_contact_editor_fullname)->vbox), widget, TRUE, TRUE, 0);
+ gtk_widget_unref(widget);
icon_path = g_concat_dir_and_file (EVOLUTION_ICONSDIR, "evolution-contacts-mini.png");
gnome_window_icon_set_from_file (GTK_WINDOW (e_contact_editor_fullname), icon_path);
@@ -131,46 +127,39 @@ e_contact_editor_fullname_init (EContactEditorFullname *e_contact_editor_fullnam
}
void
-e_contact_editor_fullname_dispose (GObject *object)
+e_contact_editor_fullname_destroy (GtkObject *object)
{
EContactEditorFullname *e_contact_editor_fullname = E_CONTACT_EDITOR_FULLNAME(object);
- if (e_contact_editor_fullname->gui) {
- g_object_unref(e_contact_editor_fullname->gui);
- e_contact_editor_fullname->gui = NULL;
- }
-
- if (e_contact_editor_fullname->name) {
- e_card_name_unref(e_contact_editor_fullname->name);
- e_contact_editor_fullname->name = NULL;
- }
+ if (e_contact_editor_fullname->gui)
+ gtk_object_unref(GTK_OBJECT(e_contact_editor_fullname->gui));
+ e_card_name_unref(e_contact_editor_fullname->name);
}
GtkWidget*
e_contact_editor_fullname_new (const ECardName *name)
{
- GtkWidget *widget = g_object_new (E_TYPE_CONTACT_EDITOR_FULLNAME, NULL);
- g_object_set (widget,
+ GtkWidget *widget = GTK_WIDGET (gtk_type_new (e_contact_editor_fullname_get_type ()));
+ gtk_object_set (GTK_OBJECT(widget),
"name", name,
NULL);
return widget;
}
static void
-e_contact_editor_fullname_set_property (GObject *object, guint prop_id,
- const GValue *value, GParamSpec *pspec)
+e_contact_editor_fullname_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
{
EContactEditorFullname *e_contact_editor_fullname;
- e_contact_editor_fullname = E_CONTACT_EDITOR_FULLNAME (object);
+ e_contact_editor_fullname = E_CONTACT_EDITOR_FULLNAME (o);
- switch (prop_id){
- case PROP_NAME:
+ switch (arg_id){
+ case ARG_NAME:
e_card_name_unref(e_contact_editor_fullname->name);
- e_contact_editor_fullname->name = e_card_name_copy(g_value_get_pointer (value));
+ e_contact_editor_fullname->name = e_card_name_copy(GTK_VALUE_POINTER (*arg));
fill_in_info(e_contact_editor_fullname);
break;
- case PROP_EDITABLE: {
+ case ARG_EDITABLE: {
int i;
char *widget_names[] = {
"combo-title",
@@ -185,7 +174,8 @@ e_contact_editor_fullname_set_property (GObject *object, guint prop_id,
"label-last",
NULL
};
- e_contact_editor_fullname->editable = g_value_get_boolean (value) ? TRUE : FALSE;
+
+ e_contact_editor_fullname->editable = GTK_VALUE_BOOL (*arg) ? TRUE : FALSE;
for (i = 0; widget_names[i] != NULL; i ++) {
GtkWidget *w = glade_xml_get_widget(e_contact_editor_fullname->gui, widget_names[i]);
if (GTK_IS_ENTRY (w)) {
@@ -203,30 +193,26 @@ e_contact_editor_fullname_set_property (GObject *object, guint prop_id,
}
break;
}
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
}
}
static void
-e_contact_editor_fullname_get_property (GObject *object, guint prop_id,
- GValue *value, GParamSpec *pspec)
+e_contact_editor_fullname_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
{
EContactEditorFullname *e_contact_editor_fullname;
e_contact_editor_fullname = E_CONTACT_EDITOR_FULLNAME (object);
- switch (prop_id) {
- case PROP_NAME:
+ switch (arg_id) {
+ case ARG_NAME:
extract_info(e_contact_editor_fullname);
- g_value_set_pointer (value, e_card_name_ref(e_contact_editor_fullname->name));
+ GTK_VALUE_POINTER (*arg) = e_card_name_ref(e_contact_editor_fullname->name);
break;
- case PROP_EDITABLE:
- g_value_set_boolean (value, e_contact_editor_fullname->editable ? TRUE : FALSE);
+ case ARG_EDITABLE:
+ GTK_VALUE_BOOL (*arg) = e_contact_editor_fullname->editable ? TRUE : FALSE;
break;
default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ arg->type = GTK_TYPE_INVALID;
break;
}
}
@@ -237,7 +223,7 @@ fill_in_field(EContactEditorFullname *editor, char *field, char *string)
GtkEntry *entry = GTK_ENTRY(glade_xml_get_widget(editor->gui, field));
if (entry) {
if (string)
- gtk_entry_set_text(entry, string);
+ e_utf8_gtk_entry_set_text(entry, string);
else
gtk_entry_set_text(entry, "");
}
diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c
index 23b5dc5dd6..8d6a5782d1 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.c
+++ b/addressbook/gui/contact-editor/e-contact-editor.c
@@ -27,17 +27,17 @@
#include <gtk/gtkcheckbutton.h>
#include <gtk/gtkcheckmenuitem.h>
#include <gtk/gtkcombo.h>
-#include <gtk/gtktextview.h>
-#include <gtk/gtkmessagedialog.h>
-#include <gtk/gtkstock.h>
+#include <gtk/gtktext.h>
#include <libgnomeui/gnome-popup-menu.h>
+#include <libgnomeui/gnome-dialog-util.h>
#include <libgnomeui/gnome-window-icon.h>
+#include <libgnomeui/gnome-stock.h>
#include <libgnome/gnome-i18n.h>
#include <bonobo/bonobo-ui-container.h>
#include <bonobo/bonobo-ui-util.h>
-#include <bonobo/bonobo-window.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
+#include <gdk-pixbuf/gnome-canvas-pixbuf.h>
#include <gal/widgets/e-categories.h>
#include <gal/widgets/e-gui-utils.h>
#include <gal/widgets/e-unicode.h>
@@ -56,7 +56,6 @@
#include "e-contact-editor-address.h"
#include "e-contact-editor-fullname.h"
-#include "e-contact-editor-marshal.h"
#include "e-contact-save-as.h"
/* Signal IDs */
@@ -70,9 +69,9 @@ enum {
static void e_contact_editor_init (EContactEditor *card);
static void e_contact_editor_class_init (EContactEditorClass *klass);
-static void e_contact_editor_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
-static void e_contact_editor_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
-static void e_contact_editor_dispose (GObject *object);
+static void e_contact_editor_set_arg (GtkObject *o, GtkArg *arg, guint arg_id);
+static void e_contact_editor_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
+static void e_contact_editor_destroy (GtkObject *object);
#if 0
static GtkWidget *e_contact_editor_build_dialog(EContactEditor *editor, gchar *entry_id, gchar *label_id, gchar *title, GList **list, GnomeUIInfo **info);
@@ -99,13 +98,13 @@ static guint contact_editor_signals[LAST_SIGNAL];
/* The arguments we take */
enum {
- PROP_0,
- PROP_BOOK,
- PROP_CARD,
- PROP_IS_NEW_CARD,
- PROP_EDITABLE,
- PROP_CHANGED,
- PROP_WRITABLE_FIELDS
+ ARG_0,
+ ARG_BOOK,
+ ARG_CARD,
+ ARG_IS_NEW_CARD,
+ ARG_EDITABLE,
+ ARG_CHANGED,
+ ARG_WRITABLE_FIELDS
};
enum {
@@ -116,125 +115,115 @@ enum {
static GSList *all_contact_editors = NULL;
-GType
+GtkType
e_contact_editor_get_type (void)
{
- static GType contact_editor_type = 0;
-
- if (!contact_editor_type) {
- static const GTypeInfo contact_editor_info = {
- sizeof (EContactEditorClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) e_contact_editor_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
- sizeof (EContactEditor),
- 0, /* n_preallocs */
- (GInstanceInitFunc) e_contact_editor_init,
- };
+ static GtkType contact_editor_type = 0;
- contact_editor_type = g_type_register_static (GTK_TYPE_OBJECT, "EContactEditor", &contact_editor_info, 0);
- }
+ if (!contact_editor_type)
+ {
+ static const GtkTypeInfo contact_editor_info =
+ {
+ "EContactEditor",
+ sizeof (EContactEditor),
+ sizeof (EContactEditorClass),
+ (GtkClassInitFunc) e_contact_editor_class_init,
+ (GtkObjectInitFunc) e_contact_editor_init,
+ /* reserved_1 */ NULL,
+ /* reserved_2 */ NULL,
+ (GtkClassInitFunc) NULL,
+ };
+
+ contact_editor_type = gtk_type_unique (GTK_TYPE_OBJECT, &contact_editor_info);
+ }
+
+ return contact_editor_type;
+}
- return contact_editor_type;
+typedef void (*GtkSignal_NONE__INT_OBJECT) (GtkObject * object,
+ gint arg1,
+ GtkObject *arg2,
+ gpointer user_data);
+
+static void
+e_marshal_NONE__INT_OBJECT (GtkObject * object,
+ GtkSignalFunc func,
+ gpointer func_data, GtkArg * args)
+{
+ GtkSignal_NONE__INT_OBJECT rfunc;
+ rfunc = (GtkSignal_NONE__INT_OBJECT) func;
+ (*rfunc) (object,
+ GTK_VALUE_INT (args[0]),
+ GTK_VALUE_OBJECT (args[1]),
+ func_data);
}
static void
e_contact_editor_class_init (EContactEditorClass *klass)
{
- GObjectClass *object_class = G_OBJECT_CLASS (klass);
-
- parent_class = g_type_class_ref (GTK_TYPE_OBJECT);
-
- object_class->set_property = e_contact_editor_set_property;
- object_class->get_property = e_contact_editor_get_property;
- object_class->dispose = e_contact_editor_dispose;
-
- g_object_class_install_property (object_class, PROP_BOOK,
- g_param_spec_object ("book",
- _("Book"),
- /*_( */"XXX blurb" /*)*/,
- E_TYPE_BOOK,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_CARD,
- g_param_spec_object ("card",
- _("Card"),
- /*_( */"XXX blurb" /*)*/,
- E_TYPE_CARD,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_IS_NEW_CARD,
- g_param_spec_boolean ("is_new_card",
- _("Is New Card"),
- /*_( */"XXX blurb" /*)*/,
- FALSE,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_WRITABLE_FIELDS,
- g_param_spec_object ("writable_fields",
- _("Writable Fields"),
- /*_( */"XXX blurb" /*)*/,
- E_TYPE_LIST,
- 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_CHANGED,
- g_param_spec_boolean ("changed",
- _("Changed"),
- /*_( */"XXX blurb" /*)*/,
- FALSE,
- G_PARAM_READWRITE));
+ GtkObjectClass *object_class;
+
+ object_class = (GtkObjectClass*) klass;
+
+ parent_class = gtk_type_class (GTK_TYPE_OBJECT);
+
+ gtk_object_add_arg_type ("EContactEditor::book", GTK_TYPE_OBJECT,
+ GTK_ARG_READWRITE, ARG_BOOK);
+ gtk_object_add_arg_type ("EContactEditor::card", GTK_TYPE_OBJECT,
+ GTK_ARG_READWRITE, ARG_CARD);
+ gtk_object_add_arg_type ("EContactEditor::is_new_card", GTK_TYPE_BOOL,
+ GTK_ARG_READWRITE, ARG_IS_NEW_CARD);
+ gtk_object_add_arg_type ("EContactEditor::writable_fields", GTK_TYPE_POINTER,
+ GTK_ARG_READWRITE, ARG_WRITABLE_FIELDS);
+ gtk_object_add_arg_type ("EContactEditor::editable", GTK_TYPE_BOOL,
+ GTK_ARG_READWRITE, ARG_EDITABLE);
+ gtk_object_add_arg_type ("EContactEditor::changed", GTK_TYPE_BOOL,
+ GTK_ARG_READWRITE, ARG_CHANGED);
contact_editor_signals[CARD_ADDED] =
- g_signal_new ("card_added",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (EContactEditorClass, card_added),
- NULL, NULL,
- ece_marshal_NONE__INT_OBJECT,
- G_TYPE_NONE, 2,
- G_TYPE_INT, G_TYPE_OBJECT);
+ gtk_signal_new ("card_added",
+ GTK_RUN_FIRST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EContactEditorClass, card_added),
+ e_marshal_NONE__INT_OBJECT,
+ GTK_TYPE_NONE, 2,
+ GTK_TYPE_INT, GTK_TYPE_OBJECT);
contact_editor_signals[CARD_MODIFIED] =
- g_signal_new ("card_modified",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (EContactEditorClass, card_modified),
- NULL, NULL,
- ece_marshal_NONE__INT_OBJECT,
- G_TYPE_NONE, 2,
- G_TYPE_INT, G_TYPE_OBJECT);
+ gtk_signal_new ("card_modified",
+ GTK_RUN_FIRST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EContactEditorClass, card_modified),
+ e_marshal_NONE__INT_OBJECT,
+ GTK_TYPE_NONE, 2,
+ GTK_TYPE_INT, GTK_TYPE_OBJECT);
contact_editor_signals[CARD_DELETED] =
- g_signal_new ("card_deleted",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (EContactEditorClass, card_deleted),
- NULL, NULL,
- ece_marshal_NONE__INT_OBJECT,
- G_TYPE_NONE, 2,
- G_TYPE_INT, G_TYPE_OBJECT);
+ gtk_signal_new ("card_deleted",
+ GTK_RUN_FIRST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EContactEditorClass, card_deleted),
+ e_marshal_NONE__INT_OBJECT,
+ GTK_TYPE_NONE, 2,
+ GTK_TYPE_INT, GTK_TYPE_OBJECT);
contact_editor_signals[EDITOR_CLOSED] =
- g_signal_new ("editor_closed",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (EContactEditorClass, editor_closed),
- NULL, NULL,
- ece_marshal_NONE__NONE,
- G_TYPE_NONE, 0);
+ gtk_signal_new ("editor_closed",
+ GTK_RUN_FIRST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EContactEditorClass, editor_closed),
+ gtk_marshal_NONE__NONE,
+ GTK_TYPE_NONE, 0);
+
+ gtk_object_class_add_signals (object_class, contact_editor_signals, LAST_SIGNAL);
+
+ object_class->set_arg = e_contact_editor_set_arg;
+ object_class->get_arg = e_contact_editor_get_arg;
+ object_class->destroy = e_contact_editor_destroy;
}
static void
-_replace_button(EContactEditor *editor, gchar *button_xml, gchar *image, GCallback func)
+_replace_button(EContactEditor *editor, gchar *button_xml, gchar *image, GtkSignalFunc func)
{
GladeXML *gui = editor->gui;
GtkWidget *button = glade_xml_get_widget(gui, button_xml);
@@ -247,29 +236,29 @@ _replace_button(EContactEditor *editor, gchar *button_xml, gchar *image, GCallba
pixmap);
g_free(image_temp);
gtk_widget_show(pixmap);
- g_signal_connect(button, "button_press_event", func, editor);
+ gtk_signal_connect(GTK_OBJECT(button), "button_press_event", func, editor);
}
}
static void
_replace_buttons(EContactEditor *editor)
{
- _replace_button(editor, "button-phone1", "arrow.png", G_CALLBACK (_phone_arrow_pressed));
- _replace_button(editor, "button-phone2", "arrow.png", G_CALLBACK (_phone_arrow_pressed));
- _replace_button(editor, "button-phone3", "arrow.png", G_CALLBACK (_phone_arrow_pressed));
- _replace_button(editor, "button-phone4", "arrow.png", G_CALLBACK (_phone_arrow_pressed));
- _replace_button(editor, "button-address", "arrow.png", G_CALLBACK (_address_arrow_pressed));
- _replace_button(editor, "button-email1", "arrow.png", G_CALLBACK (_email_arrow_pressed));
+ _replace_button(editor, "button-phone1", "arrow.png", _phone_arrow_pressed);
+ _replace_button(editor, "button-phone2", "arrow.png", _phone_arrow_pressed);
+ _replace_button(editor, "button-phone3", "arrow.png", _phone_arrow_pressed);
+ _replace_button(editor, "button-phone4", "arrow.png", _phone_arrow_pressed);
+ _replace_button(editor, "button-address", "arrow.png", _address_arrow_pressed);
+ _replace_button(editor, "button-email1", "arrow.png", _email_arrow_pressed);
}
static void
wants_html_changed (GtkWidget *widget, EContactEditor *editor)
{
gboolean wants_html;
- g_object_get (widget,
+ gtk_object_get(GTK_OBJECT(widget),
"active", &wants_html,
NULL);
- g_object_set (editor->card,
+ gtk_object_set(GTK_OBJECT(editor->card),
"wants_html", wants_html,
NULL);
@@ -305,21 +294,23 @@ phone_entry_changed (GtkWidget *widget, EContactEditor *editor)
static void
email_entry_changed (GtkWidget *widget, EContactEditor *editor)
{
- const gchar *string;
+ gchar *string;
GtkEntry *entry = GTK_ENTRY(widget);
- string = gtk_entry_get_text(entry);
+ string = e_utf8_gtk_entry_get_text(entry);
e_card_simple_set_email(editor->simple, editor->email_choice, string);
+ g_free (string);
+
widget_changed (widget, editor);
}
static void
-address_text_changed (GtkTextBuffer *buffer, EContactEditor *editor)
+address_text_changed (GtkWidget *widget, EContactEditor *editor)
{
+ GtkEditable *editable = GTK_EDITABLE(widget);
ECardAddrLabel *address;
- GtkTextIter start_iter, end_iter;
if (editor->address_choice == -1)
return;
@@ -333,27 +324,18 @@ address_text_changed (GtkTextBuffer *buffer, EContactEditor *editor)
check = glade_xml_get_widget(editor->gui, "checkbutton-mailingaddress");
if (check && GTK_IS_CHECK_BUTTON (check)) {
- g_signal_handlers_block_matched (check,
- G_SIGNAL_MATCH_DATA,
- 0, 0,
- NULL, NULL, editor);
+ gtk_signal_handler_block_by_data (GTK_OBJECT (check), editor);
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), TRUE);
- g_signal_handlers_unblock_matched (check,
- G_SIGNAL_MATCH_DATA,
- 0, 0,
- NULL, NULL, editor);
+ gtk_signal_handler_unblock_by_data (GTK_OBJECT (check), editor);
}
}
- gtk_text_buffer_get_start_iter (GTK_TEXT_BUFFER (buffer), &start_iter);
- gtk_text_buffer_get_end_iter (GTK_TEXT_BUFFER (buffer), &end_iter);
-
- address->data = gtk_text_buffer_get_text (GTK_TEXT_BUFFER (buffer), &start_iter, &end_iter, FALSE);
+ address->data = e_utf8_gtk_editable_get_chars(editable, 0, -1);
e_card_simple_set_address(editor->simple, editor->address_choice, address);
e_card_address_label_unref(address);
- widget_changed (NULL, editor);
+ widget_changed (widget, editor);
}
@@ -371,9 +353,7 @@ address_mailing_changed (GtkWidget *widget, EContactEditor *editor)
/* Mark the current address as the mailing address */
text = glade_xml_get_widget(editor->gui, "text-address");
- if (text && GTK_IS_TEXT_VIEW(text)) {
- GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text));
- GtkTextIter start_iter, end_iter;
+ if (text && GTK_IS_TEXT(text)) {
address = e_card_address_label_new();
@@ -381,12 +361,8 @@ address_mailing_changed (GtkWidget *widget, EContactEditor *editor)
address->flags |= E_CARD_ADDR_DEFAULT;
else
address->flags &= ~E_CARD_ADDR_DEFAULT;
-
- gtk_text_buffer_get_start_iter (GTK_TEXT_BUFFER (buffer), &start_iter);
- gtk_text_buffer_get_end_iter (GTK_TEXT_BUFFER (buffer), &end_iter);
-
- address->data = gtk_text_buffer_get_text (buffer, &start_iter, &end_iter, FALSE);
-
+ address->data = e_utf8_gtk_editable_get_chars(GTK_EDITABLE (text), 0, -1);
+
e_card_simple_set_address(editor->simple, editor->address_choice, address);
e_card_address_label_unref(address);
}
@@ -617,8 +593,8 @@ set_entry_changed_signal_phone(EContactEditor *editor, char *id)
{
GtkWidget *widget = glade_xml_get_widget(editor->gui, id);
if (widget && GTK_IS_ENTRY(widget))
- g_signal_connect(widget, "changed",
- G_CALLBACK (phone_entry_changed), editor);
+ gtk_signal_connect(GTK_OBJECT(widget), "changed",
+ phone_entry_changed, editor);
}
static void
@@ -640,8 +616,8 @@ set_entry_changed_signal_field(EContactEditor *editor, char *id)
{
GtkWidget *widget = glade_xml_get_widget(editor->gui, id);
if (widget && GTK_IS_ENTRY(widget))
- g_signal_connect(widget, "changed",
- G_CALLBACK (field_changed), editor);
+ gtk_signal_connect(GTK_OBJECT(widget), "changed",
+ field_changed, editor);
}
static void
@@ -654,100 +630,98 @@ set_entry_changed_signals(EContactEditor *editor)
set_entry_changed_signal_phone(editor, "entry-phone4");
widget = glade_xml_get_widget(editor->gui, "entry-email1");
if (widget && GTK_IS_ENTRY(widget)) {
- g_signal_connect(widget, "changed",
- G_CALLBACK (email_entry_changed), editor);
+ gtk_signal_connect(GTK_OBJECT(widget), "changed",
+ email_entry_changed, editor);
}
widget = glade_xml_get_widget(editor->gui, "text-address");
- if (widget && GTK_IS_TEXT_VIEW(widget)) {
- GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (widget));
- g_signal_connect(buffer, "changed",
- G_CALLBACK (address_text_changed), editor);
+ if (widget && GTK_IS_TEXT(widget)) {
+ gtk_signal_connect(GTK_OBJECT(widget), "changed",
+ address_text_changed, editor);
}
widget = glade_xml_get_widget(editor->gui, "entry-fullname");
if (widget && GTK_IS_ENTRY(widget)) {
- g_signal_connect(widget, "changed",
- G_CALLBACK (name_entry_changed), editor);
+ gtk_signal_connect(GTK_OBJECT(widget), "changed",
+ name_entry_changed, editor);
}
widget = glade_xml_get_widget(editor->gui, "entry-company");
if (widget && GTK_IS_ENTRY(widget)) {
- g_signal_connect(widget, "changed",
- G_CALLBACK (company_entry_changed), editor);
+ gtk_signal_connect(GTK_OBJECT(widget), "changed",
+ company_entry_changed, editor);
}
widget = glade_xml_get_widget(editor->gui, "entry-web");
if (widget && GTK_IS_ENTRY(widget)) {
- g_signal_connect(widget, "changed",
- G_CALLBACK (widget_changed), editor);
+ gtk_signal_connect(GTK_OBJECT(widget), "changed",
+ widget_changed, editor);
}
widget = glade_xml_get_widget(editor->gui, "entry-categories");
if (widget && GTK_IS_ENTRY(widget)) {
- g_signal_connect(widget, "changed",
- G_CALLBACK (widget_changed), editor);
+ gtk_signal_connect(GTK_OBJECT(widget), "changed",
+ widget_changed, editor);
}
widget = glade_xml_get_widget(editor->gui, "entry-jobtitle");
if (widget && GTK_IS_ENTRY(widget)) {
- g_signal_connect(widget, "changed",
- G_CALLBACK (widget_changed), editor);
+ gtk_signal_connect(GTK_OBJECT(widget), "changed",
+ widget_changed, editor);
}
widget = glade_xml_get_widget(editor->gui, "entry-file-as");
if (widget && GTK_IS_ENTRY(widget)) {
- g_signal_connect(widget, "changed",
- G_CALLBACK (widget_changed), editor);
+ gtk_signal_connect(GTK_OBJECT(widget), "changed",
+ widget_changed, editor);
}
widget = glade_xml_get_widget(editor->gui, "entry-manager");
if (widget && GTK_IS_ENTRY(widget)) {
- g_signal_connect (widget, "changed",
- G_CALLBACK (widget_changed), editor);
+ gtk_signal_connect(GTK_OBJECT(widget), "changed",
+ widget_changed, editor);
}
widget = glade_xml_get_widget(editor->gui, "entry-assistant");
if (widget && GTK_IS_ENTRY(widget)) {
- g_signal_connect (widget, "changed",
- G_CALLBACK (widget_changed), editor);
+ gtk_signal_connect(GTK_OBJECT(widget), "changed",
+ widget_changed, editor);
}
widget = glade_xml_get_widget(editor->gui, "entry-office");
if (widget && GTK_IS_ENTRY(widget)) {
- g_signal_connect (widget, "changed",
- G_CALLBACK (widget_changed), editor);
+ gtk_signal_connect(GTK_OBJECT(widget), "changed",
+ widget_changed, editor);
}
widget = glade_xml_get_widget(editor->gui, "entry-department");
if (widget && GTK_IS_ENTRY(widget)) {
- g_signal_connect (widget, "changed",
- G_CALLBACK (widget_changed), editor);
+ gtk_signal_connect(GTK_OBJECT(widget), "changed",
+ widget_changed, editor);
}
widget = glade_xml_get_widget(editor->gui, "entry-profession");
if (widget && GTK_IS_ENTRY(widget)) {
- g_signal_connect (widget, "changed",
- G_CALLBACK (widget_changed), editor);
+ gtk_signal_connect(GTK_OBJECT(widget), "changed",
+ widget_changed, editor);
}
widget = glade_xml_get_widget(editor->gui, "entry-nickname");
if (widget && GTK_IS_ENTRY(widget)) {
- g_signal_connect (widget, "changed",
- G_CALLBACK (widget_changed), editor);
+ gtk_signal_connect(GTK_OBJECT(widget), "changed",
+ widget_changed, editor);
}
widget = glade_xml_get_widget(editor->gui, "entry-spouse");
if (widget && GTK_IS_ENTRY(widget)) {
- g_signal_connect (widget, "changed",
- G_CALLBACK (widget_changed), editor);
+ gtk_signal_connect(GTK_OBJECT(widget), "changed",
+ widget_changed, editor);
}
widget = glade_xml_get_widget(editor->gui, "text-comments");
- if (widget && GTK_IS_TEXT_VIEW(widget)) {
- GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (widget));
- g_signal_connect (buffer, "changed",
- G_CALLBACK (widget_changed), editor);
+ if (widget && GTK_IS_TEXT(widget)) {
+ gtk_signal_connect(GTK_OBJECT(widget), "changed",
+ widget_changed, editor);
}
widget = glade_xml_get_widget(editor->gui, "dateedit-birthday");
if (widget && E_IS_DATE_EDIT(widget)) {
- g_signal_connect (widget, "changed",
- G_CALLBACK (widget_changed), editor);
+ gtk_signal_connect(GTK_OBJECT(widget), "changed",
+ widget_changed, editor);
}
widget = glade_xml_get_widget(editor->gui, "dateedit-anniversary");
if (widget && E_IS_DATE_EDIT(widget)) {
- g_signal_connect (widget, "changed",
- G_CALLBACK (widget_changed), editor);
+ gtk_signal_connect(GTK_OBJECT(widget), "changed",
+ widget_changed, editor);
}
widget = glade_xml_get_widget(editor->gui, "entry-web");
if (widget && GTK_IS_ENTRY(widget)) {
- g_signal_connect (widget, "changed",
- G_CALLBACK (widget_changed), editor);
+ gtk_signal_connect(GTK_OBJECT(widget), "changed",
+ widget_changed, editor);
}
}
@@ -755,22 +729,21 @@ set_entry_changed_signals(EContactEditor *editor)
static void
full_name_clicked(GtkWidget *button, EContactEditor *editor)
{
- GtkDialog *dialog = GTK_DIALOG(e_contact_editor_fullname_new(editor->name));
+ GnomeDialog *dialog = GNOME_DIALOG(e_contact_editor_fullname_new(editor->name));
int result;
- g_object_set (dialog,
+ gtk_object_set (GTK_OBJECT (dialog),
"editable", editor->fullname_editable,
NULL);
gtk_widget_show(GTK_WIDGET(dialog));
- result = gtk_dialog_run (dialog);
- gtk_widget_hide (GTK_WIDGET (dialog));
+ result = gnome_dialog_run (dialog);
- if (editor->fullname_editable && result == GTK_RESPONSE_OK) {
+ if (editor->fullname_editable && result == 0) {
ECardName *name;
GtkWidget *fname_widget;
int style = 0;
- g_object_get (dialog,
+ gtk_object_get(GTK_OBJECT(dialog),
"name", &name,
NULL);
@@ -788,51 +761,37 @@ full_name_clicked(GtkWidget *button, EContactEditor *editor)
file_as_set_style(editor, style);
}
- gtk_widget_destroy (GTK_WIDGET (dialog));
+ gtk_object_unref(GTK_OBJECT(dialog));
}
static void
full_addr_clicked(GtkWidget *button, EContactEditor *editor)
{
- GtkDialog *dialog;
+ GnomeDialog *dialog;
int result;
const ECardDeliveryAddress *address;
address = e_card_simple_get_delivery_address(editor->simple, editor->address_choice);
- dialog = GTK_DIALOG(e_contact_editor_address_new(address));
- g_object_set (dialog,
- "editable", editor->address_editable[editor->address_choice],
- NULL);
+ dialog = GNOME_DIALOG(e_contact_editor_address_new(address));
+ gtk_object_set (GTK_OBJECT (dialog),
+ "editable", editor->address_editable[editor->address_choice],
+ NULL);
gtk_widget_show(GTK_WIDGET(dialog));
- result = gtk_dialog_run (dialog);
-
- gtk_widget_hide (GTK_WIDGET (dialog));
-
- if (editor->address_editable[editor->address_choice] && result == GTK_RESPONSE_OK) {
+ result = gnome_dialog_run (dialog);
+ if (editor->address_editable[editor->address_choice] && result == 0) {
ECardDeliveryAddress *new_address;
GtkWidget *address_widget;
- g_object_get (dialog,
+ gtk_object_get(GTK_OBJECT(dialog),
"address", &new_address,
NULL);
address_widget = glade_xml_get_widget(editor->gui, "text-address");
- if (address_widget && GTK_IS_TEXT_VIEW(address_widget)) {
- GtkTextBuffer *buffer;
- GtkTextIter start_iter, end_iter;
+ if (address_widget && GTK_IS_EDITABLE(address_widget)) {
char *string = e_card_delivery_address_to_string(new_address);
-
- buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (address_widget));
-
- gtk_text_buffer_get_start_iter (buffer, &start_iter);
- gtk_text_buffer_get_end_iter (buffer, &end_iter);
-
- gtk_text_buffer_delete (buffer, &start_iter, &end_iter);
-
- gtk_text_buffer_insert (buffer, &start_iter, string, strlen (string));
-
+ e_utf8_gtk_editable_set_text(GTK_EDITABLE(address_widget), string);
g_free(string);
} else {
ECardAddrLabel *address = e_card_delivery_address_to_label(new_address);
@@ -844,57 +803,53 @@ full_addr_clicked(GtkWidget *button, EContactEditor *editor)
e_card_delivery_address_unref(new_address);
}
- gtk_widget_destroy (GTK_WIDGET (dialog));
+ gtk_object_unref(GTK_OBJECT(dialog));
}
static void
categories_clicked(GtkWidget *button, EContactEditor *editor)
{
char *categories = NULL;
- GtkDialog *dialog;
+ GnomeDialog *dialog;
int result;
GtkWidget *entry = glade_xml_get_widget(editor->gui, "entry-categories");
ECategoriesMasterList *ecml;
if (entry && GTK_IS_ENTRY(entry))
categories = e_utf8_gtk_entry_get_text(GTK_ENTRY(entry));
else if (editor->card)
- g_object_get (editor->card,
+ gtk_object_get(GTK_OBJECT(editor->card),
"categories", &categories,
NULL);
- dialog = GTK_DIALOG(e_categories_new(categories));
+ dialog = GNOME_DIALOG(e_categories_new(categories));
if (dialog == NULL) {
- GtkWidget *uh_oh = gtk_message_dialog_new (NULL,
- 0, GTK_MESSAGE_ERROR,
- GTK_RESPONSE_OK,
- _("Category editor not available."),
- NULL);
+ GtkWidget *uh_oh = gnome_error_dialog (_("Category editor not available."));
gtk_widget_show (uh_oh);
return;
}
ecml = e_categories_master_list_wombat_new ();
- g_object_set (dialog,
+ gtk_object_set(GTK_OBJECT(dialog),
"header", _("This contact belongs to these categories:"),
"ecml", ecml,
NULL);
- g_object_unref (ecml);
+ gtk_object_unref (GTK_OBJECT (ecml));
gtk_widget_show(GTK_WIDGET(dialog));
- result = gtk_dialog_run (dialog);
+ result = gnome_dialog_run (dialog);
g_free (categories);
- if (result == GTK_RESPONSE_OK) {
- g_object_get (dialog,
+ if (result == 0) {
+ gtk_object_get(GTK_OBJECT(dialog),
"categories", &categories,
NULL);
if (entry && GTK_IS_ENTRY(entry))
e_utf8_gtk_entry_set_text(GTK_ENTRY(entry), categories);
else
- g_object_set (editor->card,
+ gtk_object_set(GTK_OBJECT(editor->card),
"categories", categories,
NULL);
g_free(categories);
}
- gtk_widget_destroy(GTK_WIDGET(dialog));
+ gtk_object_destroy(GTK_OBJECT(dialog));
}
static void
@@ -929,8 +884,8 @@ add_lists (EContactEditor *editor)
ensure_select_names_contact (editor);
entry = e_select_names_manager_create_entry (editor->select_names_contacts,
"contacts");
- g_signal_connect (entry, "changed",
- G_CALLBACK (widget_changed), editor);
+ gtk_signal_connect(GTK_OBJECT(entry), "changed",
+ widget_changed, editor);
gtk_table_attach_defaults (GTK_TABLE (table), entry, 0, 1, 0, 1);
gtk_widget_show (entry);
}
@@ -953,8 +908,8 @@ card_added_cb (EBook *book, EBookStatus status, const char *id, EditorCloseStruc
e_card_set_id (ce->card, id);
- g_signal_emit (ce, contact_editor_signals[CARD_ADDED], 0,
- status, ce->card);
+ gtk_signal_emit (GTK_OBJECT (ce), contact_editor_signals[CARD_ADDED],
+ status, ce->card);
if (status == E_BOOK_STATUS_SUCCESS) {
ce->is_new_card = FALSE;
@@ -968,7 +923,7 @@ card_added_cb (EBook *book, EBookStatus status, const char *id, EditorCloseStruc
}
}
- g_object_unref (ce);
+ gtk_object_unref (GTK_OBJECT (ce));
g_free (ecs);
}
@@ -981,8 +936,8 @@ card_modified_cb (EBook *book, EBookStatus status, EditorCloseStruct *ecs)
gtk_widget_set_sensitive (ce->app, TRUE);
ce->in_async_call = FALSE;
- g_signal_emit (ce, contact_editor_signals[CARD_MODIFIED], 0,
- status, ce->card);
+ gtk_signal_emit (GTK_OBJECT (ce), contact_editor_signals[CARD_MODIFIED],
+ status, ce->card);
if (status == E_BOOK_STATUS_SUCCESS) {
if (should_close) {
@@ -994,7 +949,7 @@ card_modified_cb (EBook *book, EBookStatus status, EditorCloseStruct *ecs)
}
}
- g_object_unref (ce);
+ gtk_object_unref (GTK_OBJECT (ce));
g_free (ecs);
}
@@ -1009,7 +964,7 @@ save_card (EContactEditor *ce, gboolean should_close)
EditorCloseStruct *ecs = g_new(EditorCloseStruct, 1);
ecs->ce = ce;
- g_object_ref (ecs->ce);
+ gtk_object_ref (GTK_OBJECT (ecs->ce));
ecs->should_close = should_close;
@@ -1017,9 +972,9 @@ save_card (EContactEditor *ce, gboolean should_close)
ce->in_async_call = TRUE;
if (ce->is_new_card)
- e_card_merging_book_add_card (ce->book, ce->card, (EBookIdCallback)card_added_cb, ecs);
+ e_card_merging_book_add_card (ce->book, ce->card, GTK_SIGNAL_FUNC(card_added_cb), ecs);
else
- e_card_merging_book_commit_card (ce->book, ce->card, (EBookCallback)card_modified_cb, ecs);
+ e_card_merging_book_commit_card (ce->book, ce->card, GTK_SIGNAL_FUNC(card_modified_cb), ecs);
}
}
@@ -1030,7 +985,7 @@ close_dialog (EContactEditor *ce)
if (ce->app != NULL) {
gtk_widget_destroy (ce->app);
ce->app = NULL;
- g_signal_emit (ce, contact_editor_signals[EDITOR_CLOSED], 0);
+ gtk_signal_emit (GTK_OBJECT (ce), contact_editor_signals[EDITOR_CLOSED]);
}
}
@@ -1041,12 +996,12 @@ prompt_to_save_changes (EContactEditor *editor)
return TRUE;
switch (e_addressbook_prompt_save_dialog (GTK_WINDOW(editor->app))) {
- case GTK_RESPONSE_YES:
+ case 0: /* Save */
save_card (editor, FALSE);
return TRUE;
- case GTK_RESPONSE_NO:
+ case 1: /* Discard */
return TRUE;
- case GTK_RESPONSE_CANCEL:
+ case 2: /* Cancel */
default:
return FALSE;
}
@@ -1123,34 +1078,23 @@ file_send_to_cb (GtkWidget *widget, gpointer data)
}
gboolean
-e_contact_editor_confirm_delete (GtkWindow *parent)
-{
- GtkWidget *dialog;
- gint result;
-
- dialog = gtk_message_dialog_new (parent,
- 0,
- GTK_MESSAGE_QUESTION,
- GTK_BUTTONS_NONE,
-#if notyet
- /* XXX we really need to handle the plural case here.. */
- (plural
- ? _("Are you sure you want\n"
- "to delete these contacts?"))
-#endif
- _("Are you sure you want\n"
- "to delete this contact?"));
+e_contact_editor_confirm_delete(GtkWindow *parent)
+{
+ GnomeDialog *dialog;
+ GladeXML *gui;
+ int result;
- gtk_dialog_add_buttons (GTK_DIALOG (dialog),
- _("Delete"), GTK_RESPONSE_ACCEPT,
- GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT,
- NULL);
+ gui = glade_xml_new (EVOLUTION_GLADEDIR "/e-contact-editor-confirm-delete.glade", NULL);
- result = gtk_dialog_run(GTK_DIALOG (dialog));
+ dialog = GNOME_DIALOG(glade_xml_get_widget(gui, "confirm-dialog"));
- gtk_widget_destroy (dialog);
+ gnome_dialog_set_parent(dialog, parent);
+
+ result = gnome_dialog_run_and_close(dialog);
- return (result == GTK_RESPONSE_ACCEPT);
+ gtk_object_unref(GTK_OBJECT(gui));
+
+ return !result;
}
static void
@@ -1159,8 +1103,8 @@ card_deleted_cb (EBook *book, EBookStatus status, EContactEditor *ce)
gtk_widget_set_sensitive (ce->app, TRUE);
ce->in_async_call = FALSE;
- g_signal_emit (ce, contact_editor_signals[CARD_DELETED], 0,
- status, ce->card);
+ gtk_signal_emit (GTK_OBJECT (ce), contact_editor_signals[CARD_DELETED],
+ status, ce->card);
/* always close the dialog after we successfully delete a card */
if (status == E_BOOK_STATUS_SUCCESS)
@@ -1174,8 +1118,8 @@ delete_cb (GtkWidget *widget, gpointer data)
ECard *card = ce->card;
ECardSimple *simple = ce->simple;
- g_object_ref(card);
- g_object_ref(simple);
+ gtk_object_ref(GTK_OBJECT(card));
+ gtk_object_ref(GTK_OBJECT(simple));
if (e_contact_editor_confirm_delete(GTK_WINDOW(ce->app))) {
@@ -1186,12 +1130,12 @@ delete_cb (GtkWidget *widget, gpointer data)
gtk_widget_set_sensitive (ce->app, FALSE);
ce->in_async_call = TRUE;
- e_book_remove_card (ce->book, card, (EBookCallback)card_deleted_cb, ce);
+ e_book_remove_card (ce->book, card, GTK_SIGNAL_FUNC(card_deleted_cb), ce);
}
}
- g_object_unref(card);
- g_object_unref(simple);
+ gtk_object_unref(GTK_OBJECT(card));
+ gtk_object_unref(GTK_OBJECT(simple));
}
/* Emits the signal to request printing a card */
@@ -1275,7 +1219,7 @@ create_ui (EContactEditor *ce)
bonobo_ui_util_set_ui (ce->uic, EVOLUTION_DATADIR,
"evolution-contact-editor.xml",
- "evolution-contact-editor", NULL);
+ "evolution-contact-editor");
e_pixmaps_update (ce->uic, pixmaps);
}
@@ -1375,7 +1319,7 @@ e_contact_editor_init (EContactEditor *e_contact_editor)
e_contact_editor->in_async_call = FALSE;
e_contact_editor->editable = TRUE;
- gui = glade_xml_new (EVOLUTION_GLADEDIR "/contact-editor.glade", NULL, NULL);
+ gui = glade_xml_new (EVOLUTION_GLADEDIR "/contact-editor.glade", NULL);
e_contact_editor->gui = gui;
setup_tab_order(gui);
@@ -1392,33 +1336,33 @@ e_contact_editor_init (EContactEditor *e_contact_editor)
wants_html = glade_xml_get_widget(e_contact_editor->gui, "checkbutton-htmlmail");
if (wants_html && GTK_IS_TOGGLE_BUTTON(wants_html))
- g_signal_connect (wants_html, "toggled",
- G_CALLBACK (wants_html_changed), e_contact_editor);
+ gtk_signal_connect(GTK_OBJECT(wants_html), "toggled",
+ wants_html_changed, e_contact_editor);
widget = glade_xml_get_widget(e_contact_editor->gui, "checkbutton-mailingaddress");
if (widget && GTK_IS_TOGGLE_BUTTON(widget))
- g_signal_connect (widget, "toggled",
- G_CALLBACK (address_mailing_changed), e_contact_editor);
+ gtk_signal_connect(GTK_OBJECT(widget), "toggled",
+ address_mailing_changed, e_contact_editor);
widget = glade_xml_get_widget(e_contact_editor->gui, "button-fullname");
if (widget && GTK_IS_BUTTON(widget))
- g_signal_connect (widget, "clicked",
- G_CALLBACK (full_name_clicked), e_contact_editor);
+ gtk_signal_connect(GTK_OBJECT(widget), "clicked",
+ full_name_clicked, e_contact_editor);
widget = glade_xml_get_widget(e_contact_editor->gui, "button-fulladdr");
if (widget && GTK_IS_BUTTON(widget))
- g_signal_connect (widget, "clicked",
- G_CALLBACK (full_addr_clicked), e_contact_editor);
+ gtk_signal_connect(GTK_OBJECT(widget), "clicked",
+ full_addr_clicked, e_contact_editor);
widget = glade_xml_get_widget(e_contact_editor->gui, "button-categories");
if (widget && GTK_IS_BUTTON(widget))
- g_signal_connect (widget, "clicked",
- G_CALLBACK (categories_clicked), e_contact_editor);
+ gtk_signal_connect(GTK_OBJECT(widget), "clicked",
+ categories_clicked, e_contact_editor);
widget = glade_xml_get_widget(e_contact_editor->gui, "button-contacts");
if (widget && GTK_IS_BUTTON(widget))
- g_signal_connect (widget, "clicked",
- G_CALLBACK (contacts_clicked), e_contact_editor);
+ gtk_signal_connect(GTK_OBJECT(widget), "clicked",
+ contacts_clicked, e_contact_editor);
/* Construct the app */
@@ -1428,13 +1372,13 @@ e_contact_editor_init (EContactEditor *e_contact_editor)
{
GtkWidget *contents;
- contents = bonobo_dock_get_client_area (gnome_app_get_dock (GNOME_APP(e_contact_editor->app)));
-
+ contents = gnome_dock_get_client_area (
+ GNOME_DOCK (GNOME_APP (e_contact_editor->app)->dock));
if (!contents) {
g_message ("contact_editor_construct(): Could not get contents");
return;
}
- g_object_ref (contents);
+ gtk_widget_ref (contents);
gtk_container_remove (GTK_CONTAINER (contents->parent), contents);
bonobo_window_set_contents (BONOBO_WINDOW (bonobo_win), contents);
gtk_widget_destroy (e_contact_editor->app);
@@ -1442,7 +1386,9 @@ e_contact_editor_init (EContactEditor *e_contact_editor)
}
/* Build the menu and toolbar */
- container = bonobo_window_get_ui_container (BONOBO_WINDOW (e_contact_editor->app));
+
+ container = bonobo_ui_container_new ();
+ bonobo_ui_container_set_win (container, BONOBO_WINDOW (e_contact_editor->app));
e_contact_editor->uic = bonobo_ui_component_new_default ();
if (!e_contact_editor->uic) {
@@ -1450,8 +1396,8 @@ e_contact_editor_init (EContactEditor *e_contact_editor)
return;
}
bonobo_ui_component_set_container (e_contact_editor->uic,
- bonobo_object_corba_objref (BONOBO_OBJECT (container)),
- NULL);
+ bonobo_object_corba_objref (
+ BONOBO_OBJECT (container)));
create_ui (e_contact_editor);
@@ -1461,94 +1407,68 @@ e_contact_editor_init (EContactEditor *e_contact_editor)
/* Connect to the deletion of the dialog */
- g_signal_connect (e_contact_editor->app, "delete_event",
+ gtk_signal_connect (GTK_OBJECT (e_contact_editor->app), "delete_event",
GTK_SIGNAL_FUNC (app_delete_event_cb), e_contact_editor);
/* set the icon */
- icon_path = g_build_filename (EVOLUTION_ICONSDIR, "evolution-contacts-mini.png", NULL);
+ icon_path = g_concat_dir_and_file (EVOLUTION_ICONSDIR, "evolution-contacts-mini.png");
gnome_window_icon_set_from_file (GTK_WINDOW (e_contact_editor->app), icon_path);
g_free (icon_path);
}
void
-e_contact_editor_dispose (GObject *object) {
+e_contact_editor_destroy (GtkObject *object) {
EContactEditor *e_contact_editor = E_CONTACT_EDITOR(object);
if (e_contact_editor->writable_fields) {
- g_object_unref(e_contact_editor->writable_fields);
- e_contact_editor->writable_fields = NULL;
+ gtk_object_unref(GTK_OBJECT(e_contact_editor->writable_fields));
}
if (e_contact_editor->email_list) {
g_list_foreach(e_contact_editor->email_list, (GFunc) g_free, NULL);
g_list_free(e_contact_editor->email_list);
- e_contact_editor->email_list = NULL;
}
if (e_contact_editor->email_info) {
g_free(e_contact_editor->email_info);
- e_contact_editor->email_info = NULL;
}
if (e_contact_editor->email_popup) {
- g_object_unref(e_contact_editor->email_popup);
- e_contact_editor->email_popup = NULL;
+ gtk_widget_unref(e_contact_editor->email_popup);
}
if (e_contact_editor->phone_list) {
g_list_foreach(e_contact_editor->phone_list, (GFunc) g_free, NULL);
g_list_free(e_contact_editor->phone_list);
- e_contact_editor->phone_list = NULL;
}
if (e_contact_editor->phone_info) {
g_free(e_contact_editor->phone_info);
- e_contact_editor->phone_info = NULL;
}
if (e_contact_editor->phone_popup) {
- g_object_unref(e_contact_editor->phone_popup);
- e_contact_editor->phone_popup = NULL;
+ gtk_widget_unref(e_contact_editor->phone_popup);
}
if (e_contact_editor->address_list) {
g_list_foreach(e_contact_editor->address_list, (GFunc) g_free, NULL);
g_list_free(e_contact_editor->address_list);
- e_contact_editor->address_list = NULL;
}
if (e_contact_editor->address_info) {
g_free(e_contact_editor->address_info);
- e_contact_editor->address_info = NULL;
}
if (e_contact_editor->address_popup) {
- g_object_unref(e_contact_editor->address_popup);
- e_contact_editor->address_popup = NULL;
+ gtk_widget_unref(e_contact_editor->address_popup);
}
- if (e_contact_editor->simple) {
- g_object_unref(e_contact_editor->simple);
- e_contact_editor->simple = NULL;
- }
+ if (e_contact_editor->simple)
+ gtk_object_unref(GTK_OBJECT(e_contact_editor->simple));
- if (e_contact_editor->book) {
- g_object_unref(e_contact_editor->book);
- e_contact_editor->book = NULL;
- }
-
- if (e_contact_editor->select_names_contacts) {
- g_object_unref(e_contact_editor->select_names_contacts);
- e_contact_editor->select_names_contacts = NULL;
- }
+ if (e_contact_editor->book)
+ gtk_object_unref(GTK_OBJECT(e_contact_editor->book));
- if (e_contact_editor->name) {
- e_card_name_unref(e_contact_editor->name);
- e_contact_editor->name = NULL;
- }
+ if (e_contact_editor->select_names_contacts)
+ gtk_object_unref(GTK_OBJECT(e_contact_editor->select_names_contacts));
- if (e_contact_editor->company) {
- g_free (e_contact_editor->company);
- e_contact_editor->company = NULL;
- }
+ e_card_name_unref(e_contact_editor->name);
+ g_free (e_contact_editor->company);
- if (e_contact_editor->gui) {
- g_object_unref(e_contact_editor->gui);
- e_contact_editor->gui = NULL;
- }
+ gtk_object_unref(GTK_OBJECT(e_contact_editor->gui));
}
static void
@@ -1577,7 +1497,7 @@ supported_fields_cb (EBook *book, EBookStatus status,
return;
}
- g_object_set (ce,
+ gtk_object_set (GTK_OBJECT (ce),
"writable_fields", fields,
NULL);
@@ -1587,8 +1507,7 @@ supported_fields_cb (EBook *book, EBookStatus status,
}
static void
-contact_editor_destroy_notify (void *data,
- GObject *where_the_object_was)
+contact_editor_destroy_notify (void *data)
{
EContactEditor *ce = E_CONTACT_EDITOR (data);
@@ -1606,20 +1525,17 @@ e_contact_editor_new (EBook *book,
g_return_val_if_fail (E_IS_BOOK (book), NULL);
g_return_val_if_fail (E_IS_CARD (card), NULL);
- ce = g_object_new (E_TYPE_CONTACT_EDITOR, NULL);
+ ce = E_CONTACT_EDITOR (gtk_type_new (E_CONTACT_EDITOR_TYPE));
all_contact_editors = g_slist_prepend (all_contact_editors, ce);
- g_object_weak_ref (G_OBJECT (ce), contact_editor_destroy_notify, ce);
+ gtk_object_weakref (GTK_OBJECT (ce), contact_editor_destroy_notify, ce);
- gtk_object_ref (GTK_OBJECT (ce));
- gtk_object_sink (GTK_OBJECT (ce));
-
- g_object_set (ce,
- "book", book,
- "card", card,
- "is_new_card", is_new_card,
- "editable", editable,
- NULL);
+ gtk_object_set (GTK_OBJECT (ce),
+ "book", book,
+ "card", card,
+ "is_new_card", is_new_card,
+ "editable", editable,
+ NULL);
if (book)
e_book_get_supported_fields (book, (EBookFieldsCallback)supported_fields_cb, ce);
@@ -1628,37 +1544,37 @@ e_contact_editor_new (EBook *book,
}
static void
-e_contact_editor_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+e_contact_editor_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
{
EContactEditor *editor;
- editor = E_CONTACT_EDITOR (object);
+ editor = E_CONTACT_EDITOR (o);
- switch (prop_id){
- case PROP_BOOK:
+ switch (arg_id){
+ case ARG_BOOK:
if (editor->book)
- g_object_unref(editor->book);
- editor->book = E_BOOK(g_value_get_object (value));
- g_object_ref (editor->book);
+ gtk_object_unref(GTK_OBJECT(editor->book));
+ editor->book = E_BOOK(GTK_VALUE_OBJECT (*arg));
+ gtk_object_ref (GTK_OBJECT (editor->book));
/* XXX more here about editable/etc. */
break;
- case PROP_CARD:
+ case ARG_CARD:
if (editor->card)
- g_object_unref(editor->card);
- editor->card = e_card_duplicate(E_CARD(g_value_get_object (value)));
- g_object_set(editor->simple,
- "card", editor->card,
- NULL);
+ gtk_object_unref(GTK_OBJECT(editor->card));
+ editor->card = e_card_duplicate(E_CARD(GTK_VALUE_OBJECT (*arg)));
+ gtk_object_set(GTK_OBJECT(editor->simple),
+ "card", editor->card,
+ NULL);
fill_in_info(editor);
editor->changed = FALSE;
break;
- case PROP_IS_NEW_CARD:
- editor->is_new_card = g_value_get_boolean (value) ? TRUE : FALSE;
+ case ARG_IS_NEW_CARD:
+ editor->is_new_card = GTK_VALUE_BOOL (*arg) ? TRUE : FALSE;
break;
- case PROP_EDITABLE: {
- gboolean new_value = g_value_get_boolean (value) ? TRUE : FALSE;
+ case ARG_EDITABLE: {
+ gboolean new_value = GTK_VALUE_BOOL (*arg) ? TRUE : FALSE;
gboolean changed = (editor->editable != new_value);
editor->editable = new_value;
@@ -1670,8 +1586,8 @@ e_contact_editor_set_property (GObject *object, guint prop_id, const GValue *val
break;
}
- case PROP_CHANGED: {
- gboolean new_value = g_value_get_boolean (value) ? TRUE : FALSE;
+ case ARG_CHANGED: {
+ gboolean new_value = GTK_VALUE_BOOL (*arg) ? TRUE : FALSE;
gboolean changed = (editor->changed != new_value);
editor->changed = new_value;
@@ -1680,60 +1596,57 @@ e_contact_editor_set_property (GObject *object, guint prop_id, const GValue *val
command_state_changed (editor);
break;
}
- case PROP_WRITABLE_FIELDS:
+ case ARG_WRITABLE_FIELDS:
if (editor->writable_fields)
- g_object_unref(editor->writable_fields);
- editor->writable_fields = g_value_get_object (value);
+ gtk_object_unref(GTK_OBJECT(editor->writable_fields));
+ editor->writable_fields = GTK_VALUE_POINTER (*arg);
if (editor->writable_fields)
- g_object_ref (editor->writable_fields);
+ gtk_object_ref (GTK_OBJECT (editor->writable_fields));
else
editor->writable_fields = e_list_new(NULL, NULL, NULL);
enable_writable_fields (editor);
break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
- break;
}
}
static void
-e_contact_editor_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+e_contact_editor_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
{
EContactEditor *e_contact_editor;
e_contact_editor = E_CONTACT_EDITOR (object);
- switch (prop_id) {
- case PROP_BOOK:
- g_value_set_object (value, e_contact_editor->book);
+ switch (arg_id) {
+ case ARG_BOOK:
+ GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(e_contact_editor->book);
break;
- case PROP_CARD:
+ case ARG_CARD:
e_card_simple_sync_card(e_contact_editor->simple);
extract_info(e_contact_editor);
- g_value_set_object (value, e_contact_editor->card);
+ GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(e_contact_editor->card);
break;
- case PROP_IS_NEW_CARD:
- g_value_set_boolean (value, e_contact_editor->is_new_card ? TRUE : FALSE);
+ case ARG_IS_NEW_CARD:
+ GTK_VALUE_BOOL (*arg) = e_contact_editor->is_new_card ? TRUE : FALSE;
break;
- case PROP_EDITABLE:
- g_value_set_boolean (value, e_contact_editor->editable ? TRUE : FALSE);
+ case ARG_EDITABLE:
+ GTK_VALUE_BOOL (*arg) = e_contact_editor->editable ? TRUE : FALSE;
break;
- case PROP_CHANGED:
- g_value_set_boolean (value, e_contact_editor->changed ? TRUE : FALSE);
+ case ARG_CHANGED:
+ GTK_VALUE_BOOL (*arg) = e_contact_editor->changed ? TRUE : FALSE;
break;
- case PROP_WRITABLE_FIELDS:
+ case ARG_WRITABLE_FIELDS:
if (e_contact_editor->writable_fields)
- g_value_set_object (value, e_list_duplicate (e_contact_editor->writable_fields));
+ GTK_VALUE_POINTER (*arg) = e_list_duplicate (e_contact_editor->writable_fields);
else
- g_value_set_object (value, NULL);
+ GTK_VALUE_POINTER (*arg) = NULL;
break;
default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ arg->type = GTK_TYPE_INVALID;
break;
}
}
@@ -1742,15 +1655,14 @@ static void
_popup_position(GtkMenu *menu,
gint *x,
gint *y,
- gboolean *push_in,
gpointer data)
{
GtkWidget *button = GTK_WIDGET(data);
GtkRequisition request;
int mh, mw;
gdk_window_get_origin (button->window, x, y);
- *x += button->allocation.x;
- *y += button->allocation.y;
+ *x += button->allocation.width;
+ *y += button->allocation.height;
gtk_widget_size_request(GTK_WIDGET(menu), &request);
@@ -1769,19 +1681,15 @@ _popup_position(GtkMenu *menu,
if ((*y + mh) > gdk_screen_height ())
*y = gdk_screen_height () - mh;
-
- *push_in = FALSE;
}
static gint
_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEditor *editor, GtkWidget *popup, GList **list, GnomeUIInfo **info, gchar *label, gchar *entry, gchar *dialog_title)
{
gint menu_item;
-
- g_signal_stop_emission_by_name (widget, "button_press_event");
-
+ gtk_signal_emit_stop_by_name(GTK_OBJECT(widget), "button_press_event");
gtk_widget_realize(popup);
- menu_item = gnome_popup_menu_do_popup_modal(popup, _popup_position, widget, button, editor, widget);
+ menu_item = gnome_popup_menu_do_popup_modal(popup, _popup_position, widget, button, editor);
if ( menu_item != -1 ) {
#if 0
if (menu_item == g_list_length (*list)) {
@@ -1790,7 +1698,7 @@ _arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEditor *edito
#endif
GtkWidget *label_widget = glade_xml_get_widget(editor->gui, label);
if (label_widget && GTK_IS_LABEL(label_widget)) {
- g_object_set (label_widget,
+ gtk_object_set(GTK_OBJECT(label_widget),
"label", _(g_list_nth_data(*list, menu_item)),
NULL);
}
@@ -1862,11 +1770,9 @@ e_contact_editor_build_phone_ui (EContactEditor *editor)
e_contact_editor_build_ui_info(editor->phone_list, &editor->phone_info);
if ( editor->phone_popup )
- g_object_unref(editor->phone_popup);
+ gtk_widget_unref(editor->phone_popup);
editor->phone_popup = gnome_popup_menu_new(editor->phone_info);
- g_object_ref (editor->phone_popup);
- gtk_object_sink (GTK_OBJECT (editor->phone_popup));
}
}
@@ -1890,11 +1796,9 @@ e_contact_editor_build_email_ui (EContactEditor *editor)
e_contact_editor_build_ui_info(editor->email_list, &editor->email_info);
if ( editor->email_popup )
- g_object_unref(editor->email_popup);
+ gtk_widget_unref(editor->email_popup);
editor->email_popup = gnome_popup_menu_new(editor->email_info);
- g_object_ref (editor->email_popup);
- gtk_object_sink (GTK_OBJECT (editor->email_popup));
}
}
@@ -1918,13 +1822,96 @@ e_contact_editor_build_address_ui (EContactEditor *editor)
e_contact_editor_build_ui_info(editor->address_list, &editor->address_info);
if ( editor->address_popup )
- g_object_unref(editor->address_popup);
+ gtk_widget_unref(editor->address_popup);
editor->address_popup = gnome_popup_menu_new(editor->address_info);
- g_object_ref (editor->address_popup);
- gtk_object_sink (GTK_OBJECT (editor->address_popup));
}
}
+#if 0
+static void
+_dialog_clicked(GtkWidget *dialog, gint button, EContactEditor *editor)
+{
+ GtkWidget *label = gtk_object_get_data(GTK_OBJECT(dialog),
+ "e_contact_editor_label");
+
+ GtkWidget *dialog_entry = gtk_object_get_data(GTK_OBJECT(dialog),
+ "e_contact_editor_dialog_entry");
+
+ GList **list = gtk_object_get_data(GTK_OBJECT(dialog),
+ "e_contact_editor_list");
+ GList **info = gtk_object_get_data(GTK_OBJECT(dialog),
+ "e_contact_editor_info");
+ switch (button) {
+ case 0:
+ if (label && GTK_IS_LABEL(label)) {
+ gtk_object_set(GTK_OBJECT(label),
+ "label", gtk_entry_get_text(GTK_ENTRY(dialog_entry)),
+ NULL);
+ *list = g_list_append(*list, e_utf8_gtk_entry_get_text(GTK_ENTRY(dialog_entry)));
+ g_free(*info);
+ *info = NULL;
+ }
+ break;
+ }
+ gnome_dialog_close(GNOME_DIALOG(dialog));
+}
+
+static void
+_dialog_destroy(EContactEditor *editor, GtkWidget *dialog)
+{
+ gnome_dialog_close(GNOME_DIALOG(dialog));
+}
+
+static GtkWidget *
+e_contact_editor_build_dialog(EContactEditor *editor, gchar *entry_id, gchar *label_id, gchar *title, GList **list, GnomeUIInfo **info)
+{
+ GtkWidget *dialog_entry = gtk_entry_new();
+ GtkWidget *entry = glade_xml_get_widget(editor->gui, entry_id);
+ GtkWidget *label = glade_xml_get_widget(editor->gui, label_id);
+
+ GtkWidget *dialog = gnome_dialog_new(title,
+ NULL);
+
+ gtk_container_add(GTK_CONTAINER(GNOME_DIALOG(dialog)->vbox),
+ gtk_widget_new (gtk_frame_get_type(),
+ "border_width", 4,
+ "label", title,
+ "child", gtk_widget_new(gtk_alignment_get_type(),
+ "child", dialog_entry,
+ "xalign", .5,
+ "yalign", .5,
+ "xscale", 1.0,
+ "yscale", 1.0,
+ "border_width", 9,
+ NULL),
+ NULL));
+
+ gnome_dialog_append_button_with_pixmap(GNOME_DIALOG(dialog),
+ "Add",
+ GNOME_STOCK_PIXMAP_ADD);
+ gnome_dialog_append_button(GNOME_DIALOG(dialog), GNOME_STOCK_BUTTON_CANCEL);
+ gnome_dialog_set_default(GNOME_DIALOG(dialog), 0);
+
+ gtk_signal_connect(GTK_OBJECT(dialog), "clicked",
+ _dialog_clicked, editor);
+ gtk_signal_connect_while_alive(GTK_OBJECT(editor), "destroy",
+ _dialog_destroy, GTK_OBJECT(dialog), GTK_OBJECT(dialog));
+
+ gtk_object_set_data(GTK_OBJECT(dialog),
+ "e_contact_editor_entry", entry);
+ gtk_object_set_data(GTK_OBJECT(dialog),
+ "e_contact_editor_label", label);
+ gtk_object_set_data(GTK_OBJECT(dialog),
+ "e_contact_editor_dialog_entry", dialog_entry);
+ gtk_object_set_data(GTK_OBJECT(dialog),
+ "e_contact_editor_list", list);
+ gtk_object_set_data(GTK_OBJECT(dialog),
+ "e_contact_editor_info", info);
+
+ gtk_widget_show_all(dialog);
+ return dialog;
+}
+#endif
static void
_phone_arrow_pressed (GtkWidget *widget, GdkEventButton *button, EContactEditor *editor)
@@ -2117,7 +2104,7 @@ set_fields(EContactEditor *editor)
label_widget = glade_xml_get_widget(editor->gui, "label-address");
if (label_widget && GTK_IS_LABEL(label_widget)) {
- g_object_set (label_widget,
+ gtk_object_set(GTK_OBJECT(label_widget),
"label", _(g_list_nth_data(editor->address_list, i)),
NULL);
}
@@ -2132,26 +2119,25 @@ set_address_field(EContactEditor *editor, int result)
text = glade_xml_get_widget(editor->gui, "text-address");
- if (text && GTK_IS_TEXT_VIEW(text)) {
- GtkTextView *text_view = GTK_TEXT_VIEW (text);
- GtkTextBuffer *buffer;
- GtkTextIter start_iter, end_iter;
+ if (text && GTK_IS_TEXT(text)) {
+ int position;
+ GtkEditable *editable;
const ECardAddrLabel *address;
if (result == -1)
result = editor->address_choice;
editor->address_choice = -1;
- buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (text));
-
- gtk_text_buffer_get_start_iter (buffer, &start_iter);
- gtk_text_buffer_get_end_iter (buffer, &end_iter);
-
- gtk_text_buffer_delete (buffer, &start_iter, &end_iter);
+ position = 0;
+ editable = GTK_EDITABLE(text);
+ gtk_editable_delete_text(editable, 0, -1);
address = e_card_simple_get_address(editor->simple, result);
- if (address && address->data)
- gtk_text_buffer_insert (buffer, &start_iter, address->data, strlen (address->data));
+ if (address && address->data) {
+ gchar *u = e_utf8_to_gtk_string ((GtkWidget *) editable, address->data);
+ gtk_editable_insert_text(editable, u, strlen(u), &position);
+ g_free (u);
+ }
check = glade_xml_get_widget(editor->gui, "checkbutton-mailingaddress");
if (check && GTK_IS_CHECK_BUTTON (check)) {
@@ -2207,7 +2193,7 @@ add_field_callback(GtkWidget *widget, EContactEditor *editor)
if (!strcmp(name, builtins[i]))
return;
}
- if (GTK_IS_ENTRY(widget) || GTK_IS_TEXT_VIEW(widget)) {
+ if (GTK_IS_ENTRY(widget) || GTK_IS_TEXT(widget)) {
editor->arbitrary_fields = g_list_prepend(editor->arbitrary_fields, g_strdup(name));
}
}
@@ -2254,7 +2240,7 @@ static void
fill_in_card_field(EContactEditor *editor, ECard *card, char *id, char *key)
{
char *string;
- g_object_get (card,
+ gtk_object_get(GTK_OBJECT(card),
key, &string,
NULL);
fill_in_field(editor, id, string);
@@ -2486,8 +2472,8 @@ enable_writable_fields(EContactEditor *editor)
g_hash_table_destroy (dropdown_hash);
g_hash_table_destroy (supported_hash);
- g_object_unref (simple);
- g_object_unref (card);
+ gtk_object_unref (GTK_OBJECT(simple));
+ gtk_object_unref (GTK_OBJECT(card));
}
static void
@@ -2541,7 +2527,7 @@ fill_in_info(EContactEditor *editor)
GList *list;
gboolean wants_html, wants_html_set;
- g_object_get (card,
+ gtk_object_get(GTK_OBJECT(card),
"file_as", &file_as,
"related_contacts", &related_contacts,
"name", &name,
@@ -2564,7 +2550,7 @@ fill_in_info(EContactEditor *editor)
if (wants_html_set) {
GtkWidget *widget = glade_xml_get_widget(editor->gui, "checkbutton-htmlmail");
if (widget && GTK_IS_CHECK_BUTTON(widget)) {
- g_object_set (widget,
+ gtk_object_set(GTK_OBJECT(widget),
"active", wants_html,
NULL);
}
@@ -2621,11 +2607,11 @@ extract_field(EContactEditor *editor, ECard *card, char *editable_id, char *key)
char *string = e_utf8_gtk_editable_get_chars(editable, 0, -1);
if (string && *string)
- g_object_set (card,
+ gtk_object_set(GTK_OBJECT(card),
key, string,
NULL);
else
- g_object_set (card,
+ gtk_object_set(GTK_OBJECT(card),
key, NULL,
NULL);
@@ -2673,7 +2659,7 @@ extract_info(EContactEditor *editor)
char *string = e_utf8_gtk_editable_get_chars(editable, 0, -1);
if (string && *string)
- g_object_set (card,
+ gtk_object_set(GTK_OBJECT(card),
"file_as", string,
NULL);
@@ -2693,18 +2679,18 @@ extract_info(EContactEditor *editor)
"contacts");
char *string = e_select_names_model_export_destinationv (model);
if (string && *string)
- g_object_set (card,
+ gtk_object_set (GTK_OBJECT (card),
"related_contacts", string,
NULL);
else
- g_object_set (card,
+ gtk_object_set (GTK_OBJECT (card),
"related_contacts", NULL,
NULL);
g_free (string);
}
if (editor->name)
- g_object_set (card,
+ gtk_object_set(GTK_OBJECT(card),
"name", editor->name,
NULL);
@@ -2715,11 +2701,11 @@ extract_info(EContactEditor *editor)
&anniversary.month,
&anniversary.day)) {
/* g_print ("%d %d %d\n", anniversary.year, anniversary.month, anniversary.day); */
- g_object_set (card,
+ gtk_object_set(GTK_OBJECT(card),
"anniversary", &anniversary,
NULL);
} else
- g_object_set (card,
+ gtk_object_set(GTK_OBJECT(card),
"anniversary", NULL,
NULL);
}
@@ -2731,11 +2717,11 @@ extract_info(EContactEditor *editor)
&bday.month,
&bday.day)) {
/* g_print ("%d %d %d\n", bday.year, bday.month, bday.day); */
- g_object_set (card,
+ gtk_object_set(GTK_OBJECT(card),
"birth_date", &bday,
NULL);
} else
- g_object_set (card,
+ gtk_object_set(GTK_OBJECT(card),
"birth_date", NULL,
NULL);
}
@@ -2792,8 +2778,8 @@ enable_widget (GtkWidget *widget, gboolean enabled)
if (GTK_IS_ENTRY (widget)) {
gtk_entry_set_editable (GTK_ENTRY (widget), enabled);
}
- else if (GTK_IS_TEXT_VIEW (widget)) {
- gtk_text_view_set_editable (GTK_TEXT_VIEW (widget), enabled);
+ else if (GTK_IS_TEXT (widget)) {
+ gtk_text_set_editable (GTK_TEXT (widget), enabled);
}
else if (GTK_IS_COMBO (widget)) {
gtk_entry_set_editable (GTK_ENTRY (GTK_COMBO (widget)->entry),
diff --git a/addressbook/gui/contact-editor/e-contact-editor.h b/addressbook/gui/contact-editor/e-contact-editor.h
index f4b8051fed..a7619bd55c 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.h
+++ b/addressbook/gui/contact-editor/e-contact-editor.h
@@ -30,7 +30,10 @@
#include "addressbook/backend/ebook/e-card.h"
#include "addressbook/backend/ebook/e-card-simple.h"
-G_BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#pragma }
+#endif /* __cplusplus */
/* EContactEditor - A dialog displaying information about a contact.
*
@@ -41,11 +44,11 @@ G_BEGIN_DECLS
* card ECard * RW The card currently being edited
*/
-#define E_TYPE_CONTACT_EDITOR (e_contact_editor_get_type ())
-#define E_CONTACT_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_CONTACT_EDITOR, EContactEditor))
-#define E_CONTACT_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_CONTACT_EDITOR, EContactEditorClass))
-#define E_IS_CONTACT_EDITOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_CONTACT_EDITOR))
-#define E_IS_CONTACT_EDITOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TYPE_CONTACT_EDITOR))
+#define E_CONTACT_EDITOR_TYPE (e_contact_editor_get_type ())
+#define E_CONTACT_EDITOR(obj) (GTK_CHECK_CAST ((obj), E_CONTACT_EDITOR_TYPE, EContactEditor))
+#define E_CONTACT_EDITOR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_CONTACT_EDITOR_TYPE, EContactEditorClass))
+#define E_IS_CONTACT_EDITOR(obj) (GTK_CHECK_TYPE ((obj), E_CONTACT_EDITOR_TYPE))
+#define E_IS_CONTACT_EDITOR_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_CONTACT_EDITOR_TYPE))
typedef struct _EContactEditor EContactEditor;
@@ -124,7 +127,7 @@ EContactEditor *e_contact_editor_new (EBook *book,
ECard *card,
gboolean is_new_card,
gboolean editable);
-GType e_contact_editor_get_type (void);
+GtkType e_contact_editor_get_type (void);
void e_contact_editor_show (EContactEditor *editor);
void e_contact_editor_close (EContactEditor *editor);
@@ -134,6 +137,9 @@ gboolean e_contact_editor_confirm_delete (GtkWindow *parent);
gboolean e_contact_editor_request_close_all (void);
-G_END_DECLS
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
#endif /* __E_CONTACT_EDITOR_H__ */
diff --git a/addressbook/gui/contact-editor/fulladdr.glade b/addressbook/gui/contact-editor/fulladdr.glade
index 023c0b57be..fc767c1c89 100644
--- a/addressbook/gui/contact-editor/fulladdr.glade
+++ b/addressbook/gui/contact-editor/fulladdr.glade
@@ -1,446 +1,473 @@
-<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
-<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
+<?xml version="1.0"?>
+<GTK-Interface>
-<glade-interface>
+<project>
+ <name>fulladdr</name>
+ <program_name>fulladdr</program_name>
+ <directory></directory>
+ <source_directory>src</source_directory>
+ <pixmaps_directory>pixmaps</pixmaps_directory>
+ <language>C</language>
+ <gnome_support>True</gnome_support>
+ <gettext_support>True</gettext_support>
+ <use_widget_names>True</use_widget_names>
+ <output_main_file>False</output_main_file>
+ <output_support_files>False</output_support_files>
+ <output_build_files>False</output_build_files>
+</project>
-<widget class="GtkDialog" id="dialog-checkaddress">
- <property name="title" translatable="yes">Check Address</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>
+<widget>
+ <class>GnomeDialog</class>
+ <name>dialog-checkaddress</name>
+ <visible>False</visible>
+ <title>Check Address</title>
+ <type>GTK_WINDOW_TOPLEVEL</type>
+ <position>GTK_WIN_POS_NONE</position>
+ <modal>True</modal>
+ <allow_shrink>False</allow_shrink>
+ <allow_grow>True</allow_grow>
+ <auto_shrink>False</auto_shrink>
+ <auto_close>False</auto_close>
+ <hide_on_close>False</hide_on_close>
- <child internal-child="vbox">
- <widget class="GtkVBox" id="vbox-container">
- <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="button1">
- <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">0</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkButton" id="button2">
- <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>
+ <widget>
+ <class>GtkVBox</class>
+ <child_name>GnomeDialog:vbox</child_name>
+ <name>vbox-container</name>
+ <homogeneous>False</homogeneous>
+ <spacing>8</spacing>
+ <child>
+ <padding>4</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+ <widget>
+ <class>GtkHButtonBox</class>
+ <child_name>GnomeDialog:action_area</child_name>
+ <name>hbuttonbox1</name>
+ <layout_style>GTK_BUTTONBOX_END</layout_style>
+ <spacing>8</spacing>
+ <child_min_width>85</child_min_width>
+ <child_min_height>27</child_min_height>
+ <child_ipad_x>7</child_ipad_x>
+ <child_ipad_y>0</child_ipad_y>
<child>
- <widget class="GtkTable" id="table-checkaddress">
- <property name="border_width">8</property>
- <property name="visible">True</property>
- <property name="n_rows">4</property>
- <property name="n_columns">4</property>
- <property name="homogeneous">False</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">6</property>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>True</fill>
+ <pack>GTK_PACK_END</pack>
+ </child>
- <child>
- <widget class="GtkLabel" id="label-street">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Address:</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">1</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="mnemonic_widget">entry-street</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">fill</property>
- </packing>
- </child>
+ <widget>
+ <class>GtkButton</class>
+ <name>button1</name>
+ <can_default>True</can_default>
+ <has_default>True</has_default>
+ <can_focus>True</can_focus>
+ <stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
+ </widget>
- <child>
- <widget class="GtkLabel" id="label-city">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_City:</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">1</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="mnemonic_widget">entry-city</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">fill</property>
- </packing>
- </child>
+ <widget>
+ <class>GtkButton</class>
+ <name>button2</name>
+ <can_default>True</can_default>
+ <can_focus>True</can_focus>
+ <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
+ </widget>
+ </widget>
- <child>
- <widget class="GtkEntry" id="entry-city">
- <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">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>
+ <widget>
+ <class>GtkTable</class>
+ <name>table-checkaddress</name>
+ <border_width>8</border_width>
+ <rows>4</rows>
+ <columns>4</columns>
+ <homogeneous>False</homogeneous>
+ <row_spacing>6</row_spacing>
+ <column_spacing>6</column_spacing>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
- <child>
- <widget class="GtkEntry" id="entry-ext">
- <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">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>
+ <widget>
+ <class>GtkLabel</class>
+ <name>label-street</name>
+ <label>_Address:</label>
+ <justify>GTK_JUSTIFY_LEFT</justify>
+ <wrap>False</wrap>
+ <xalign>1</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <focus_target>entry-street</focus_target>
+ <child>
+ <left_attach>0</left_attach>
+ <right_attach>1</right_attach>
+ <top_attach>0</top_attach>
+ <bottom_attach>1</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+ </widget>
- <child>
- <widget class="GtkLabel" id="label-po">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_PO Box:</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">1</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="mnemonic_widget">entry-po</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>
+ <widget>
+ <class>GtkLabel</class>
+ <name>label-city</name>
+ <label>_City:</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>1</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <focus_target>entry-city</focus_target>
+ <child>
+ <left_attach>0</left_attach>
+ <right_attach>1</right_attach>
+ <top_attach>2</top_attach>
+ <bottom_attach>3</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+ </widget>
- <child>
- <widget class="GtkLabel" id="label-ext">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Address _2:</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">1</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="mnemonic_widget">entry-ext</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_options">fill</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
+ <widget>
+ <class>GtkEntry</class>
+ <name>entry-city</name>
+ <can_focus>True</can_focus>
+ <editable>True</editable>
+ <text_visible>True</text_visible>
+ <text_max_length>0</text_max_length>
+ <text></text>
+ <child>
+ <left_attach>1</left_attach>
+ <right_attach>2</right_attach>
+ <top_attach>2</top_attach>
+ <bottom_attach>3</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>True</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+ </widget>
- <child>
- <widget class="GtkEntry" id="entry-po">
- <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">3</property>
- <property name="right_attach">4</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>
+ <widget>
+ <class>GtkEntry</class>
+ <name>entry-ext</name>
+ <width>100</width>
+ <can_focus>True</can_focus>
+ <editable>True</editable>
+ <text_visible>True</text_visible>
+ <text_max_length>0</text_max_length>
+ <text></text>
+ <child>
+ <left_attach>1</left_attach>
+ <right_attach>2</right_attach>
+ <top_attach>1</top_attach>
+ <bottom_attach>2</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>True</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+ </widget>
- <child>
- <widget class="GtkEntry" id="entry-street">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="has_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">1</property>
- <property name="right_attach">4</property>
- <property name="top_attach">0</property>
- <property name="bottom_attach">1</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
+ <widget>
+ <class>GtkLabel</class>
+ <name>label-po</name>
+ <label>_PO Box:</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>1</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <focus_target>entry-po</focus_target>
+ <child>
+ <left_attach>2</left_attach>
+ <right_attach>3</right_attach>
+ <top_attach>1</top_attach>
+ <bottom_attach>2</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+ </widget>
- <child>
- <widget class="GtkLabel" id="label-region">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_State/Province:</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">1</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="mnemonic_widget">entry-region</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>
+ <widget>
+ <class>GtkLabel</class>
+ <name>label-ext</name>
+ <label>Address _2:</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>1</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <focus_target>entry-ext</focus_target>
+ <child>
+ <left_attach>0</left_attach>
+ <right_attach>1</right_attach>
+ <top_attach>1</top_attach>
+ <bottom_attach>2</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+ </widget>
- <child>
- <widget class="GtkEntry" id="entry-region">
- <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">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
+ <widget>
+ <class>GtkEntry</class>
+ <name>entry-po</name>
+ <width>100</width>
+ <can_focus>True</can_focus>
+ <editable>True</editable>
+ <text_visible>True</text_visible>
+ <text_max_length>0</text_max_length>
+ <text></text>
+ <child>
+ <left_attach>3</left_attach>
+ <right_attach>4</right_attach>
+ <top_attach>1</top_attach>
+ <bottom_attach>2</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+ </widget>
- <child>
- <widget class="GtkCombo" id="combo-country">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="value_in_list">False</property>
- <property name="allow_empty">True</property>
- <property name="case_sensitive">False</property>
- <property name="enable_arrow_keys">True</property>
- <property name="enable_arrows_always">False</property>
+ <widget>
+ <class>GtkEntry</class>
+ <name>entry-street</name>
+ <can_focus>True</can_focus>
+ <has_focus>True</has_focus>
+ <editable>True</editable>
+ <text_visible>True</text_visible>
+ <text_max_length>0</text_max_length>
+ <text></text>
+ <child>
+ <left_attach>1</left_attach>
+ <right_attach>4</right_attach>
+ <top_attach>0</top_attach>
+ <bottom_attach>1</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>True</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+ </widget>
- <child internal-child="entry">
- <widget class="GtkEntry" id="entry-country">
- <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>
- </child>
+ <widget>
+ <class>GtkLabel</class>
+ <name>label-region</name>
+ <label>_State/Province:</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>1</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <focus_target>entry-region</focus_target>
+ <child>
+ <left_attach>0</left_attach>
+ <right_attach>1</right_attach>
+ <top_attach>3</top_attach>
+ <bottom_attach>4</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+ </widget>
- <child internal-child="list">
- <widget class="GtkList" id="convertwidget1">
- <property name="visible">True</property>
- <property name="selection_mode">GTK_SELECTION_BROWSE</property>
+ <widget>
+ <class>GtkEntry</class>
+ <name>entry-region</name>
+ <can_focus>True</can_focus>
+ <editable>True</editable>
+ <text_visible>True</text_visible>
+ <text_max_length>0</text_max_length>
+ <text></text>
+ <child>
+ <left_attach>1</left_attach>
+ <right_attach>2</right_attach>
+ <top_attach>3</top_attach>
+ <bottom_attach>4</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>True</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+ </widget>
- <child>
- <widget class="GtkListItem" id="convertwidget2">
- <property name="visible">True</property>
+ <widget>
+ <class>GtkCombo</class>
+ <name>combo-country</name>
+ <width>100</width>
+ <can_focus>True</can_focus>
+ <value_in_list>False</value_in_list>
+ <ok_if_empty>True</ok_if_empty>
+ <case_sensitive>False</case_sensitive>
+ <use_arrows>True</use_arrows>
+ <use_arrows_always>False</use_arrows_always>
+ <items></items>
+ <child>
+ <left_attach>3</left_attach>
+ <right_attach>4</right_attach>
+ <top_attach>3</top_attach>
+ <bottom_attach>4</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
- <child>
- <widget class="GtkLabel" id="convertwidget3">
- <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">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>
- </child>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="left_attach">3</property>
- <property name="right_attach">4</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>
+ <widget>
+ <class>GtkEntry</class>
+ <child_name>GtkCombo:entry</child_name>
+ <name>entry-country</name>
+ <can_focus>True</can_focus>
+ <editable>True</editable>
+ <text_visible>True</text_visible>
+ <text_max_length>0</text_max_length>
+ <text></text>
+ </widget>
+ </widget>
- <child>
- <widget class="GtkEntry" id="entry-code">
- <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">3</property>
- <property name="right_attach">4</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>
+ <widget>
+ <class>GtkEntry</class>
+ <name>entry-code</name>
+ <width>100</width>
+ <can_focus>True</can_focus>
+ <editable>True</editable>
+ <text_visible>True</text_visible>
+ <text_max_length>0</text_max_length>
+ <text></text>
+ <child>
+ <left_attach>3</left_attach>
+ <right_attach>4</right_attach>
+ <top_attach>2</top_attach>
+ <bottom_attach>3</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+ </widget>
- <child>
- <widget class="GtkLabel" id="label-code">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_ZIP Code:</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">1</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="mnemonic_widget">entry-code</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>
+ <widget>
+ <class>GtkLabel</class>
+ <name>label-code</name>
+ <label>_ZIP Code:</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>1</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <focus_target>entry-code</focus_target>
+ <child>
+ <left_attach>2</left_attach>
+ <right_attach>3</right_attach>
+ <top_attach>2</top_attach>
+ <bottom_attach>3</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+ </widget>
- <child>
- <widget class="GtkLabel" id="label-country">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Countr_y:</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">1</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="mnemonic_widget">entry-country</property>
- </widget>
- <packing>
- <property name="left_attach">2</property>
- <property name="right_attach">3</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>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
+ <widget>
+ <class>GtkLabel</class>
+ <name>label-country</name>
+ <label>Countr_y:</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>1</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <focus_target>entry-country</focus_target>
+ <child>
+ <left_attach>2</left_attach>
+ <right_attach>3</right_attach>
+ <top_attach>3</top_attach>
+ <bottom_attach>4</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+ </widget>
</widget>
- </child>
+ </widget>
</widget>
-</glade-interface>
+</GTK-Interface>
diff --git a/addressbook/gui/contact-editor/fullname.glade b/addressbook/gui/contact-editor/fullname.glade
index f890d2cb88..fad1642d89 100644
--- a/addressbook/gui/contact-editor/fullname.glade
+++ b/addressbook/gui/contact-editor/fullname.glade
@@ -1,674 +1,389 @@
-<?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-checkfullname">
- <property name="title" translatable="yes">Check Full Name</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="vbox-container">
- <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="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="button2">
- <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>
-
+<?xml version="1.0"?>
+<GTK-Interface>
+
+<project>
+ <name>fullname</name>
+ <program_name>fullname</program_name>
+ <directory></directory>
+ <source_directory>src</source_directory>
+ <pixmaps_directory>pixmaps</pixmaps_directory>
+ <language>C</language>
+ <gnome_support>True</gnome_support>
+ <gettext_support>True</gettext_support>
+ <use_widget_names>True</use_widget_names>
+ <output_main_file>False</output_main_file>
+ <output_support_files>False</output_support_files>
+ <output_build_files>False</output_build_files>
+</project>
+
+<widget>
+ <class>GnomeDialog</class>
+ <name>dialog-checkfullname</name>
+ <visible>False</visible>
+ <title>Check Full Name</title>
+ <type>GTK_WINDOW_TOPLEVEL</type>
+ <position>GTK_WIN_POS_NONE</position>
+ <modal>True</modal>
+ <allow_shrink>True</allow_shrink>
+ <allow_grow>True</allow_grow>
+ <auto_shrink>False</auto_shrink>
+ <auto_close>False</auto_close>
+ <hide_on_close>False</hide_on_close>
+
+ <widget>
+ <class>GtkVBox</class>
+ <child_name>GnomeDialog:vbox</child_name>
+ <name>vbox-container</name>
+ <homogeneous>False</homogeneous>
+ <spacing>8</spacing>
+ <child>
+ <padding>4</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
+
+ <widget>
+ <class>GtkHButtonBox</class>
+ <child_name>GnomeDialog:action_area</child_name>
+ <name>hbuttonbox1</name>
+ <layout_style>GTK_BUTTONBOX_END</layout_style>
+ <spacing>8</spacing>
+ <child_min_width>85</child_min_width>
+ <child_min_height>27</child_min_height>
+ <child_ipad_x>7</child_ipad_x>
+ <child_ipad_y>0</child_ipad_y>
<child>
- <widget class="GtkTable" id="table-checkfullname">
- <property name="border_width">8</property>
- <property name="visible">True</property>
- <property name="n_rows">5</property>
- <property name="n_columns">3</property>
- <property name="homogeneous">False</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">21</property>
-
- <child>
- <widget class="GtkCombo" id="combo-title">
- <property name="visible">True</property>
- <property name="value_in_list">False</property>
- <property name="allow_empty">True</property>
- <property name="case_sensitive">False</property>
- <property name="enable_arrow_keys">True</property>
- <property name="enable_arrows_always">False</property>
-
- <child internal-child="entry">
- <widget class="GtkEntry" id="entry-title">
- <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>
- </child>
-
- <child internal-child="list">
- <widget class="GtkList" id="convertwidget1">
- <property name="visible">True</property>
- <property name="selection_mode">GTK_SELECTION_BROWSE</property>
-
- <child>
- <widget class="GtkListItem" id="convertwidget2">
- <property name="visible">True</property>
-
- <child>
- <widget class="GtkLabel" id="convertwidget3">
- <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">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>
- </child>
- </widget>
- </child>
-
- <child>
- <widget class="GtkListItem" id="convertwidget4">
- <property name="visible">True</property>
-
- <child>
- <widget class="GtkLabel" id="convertwidget5">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Mr.</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>
- </child>
- </widget>
- </child>
-
- <child>
- <widget class="GtkListItem" id="convertwidget6">
- <property name="visible">True</property>
-
- <child>
- <widget class="GtkLabel" id="convertwidget7">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Mrs.</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>
- </child>
- </widget>
- </child>
-
- <child>
- <widget class="GtkListItem" id="convertwidget8">
- <property name="visible">True</property>
-
- <child>
- <widget class="GtkLabel" id="convertwidget9">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Ms.</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>
- </child>
- </widget>
- </child>
-
- <child>
- <widget class="GtkListItem" id="convertwidget10">
- <property name="visible">True</property>
-
- <child>
- <widget class="GtkLabel" id="convertwidget11">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Miss</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>
- </child>
- </widget>
- </child>
-
- <child>
- <widget class="GtkListItem" id="convertwidget12">
- <property name="visible">True</property>
-
- <child>
- <widget class="GtkLabel" id="convertwidget13">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Dr.</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>
- </child>
- </widget>
- </child>
-
- <child>
- <widget class="GtkListItem" id="convertwidget14">
- <property name="visible">True</property>
-
- <child>
- <widget class="GtkLabel" id="convertwidget15">
- <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">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>
- </child>
- </widget>
- </child>
- </widget>
- </child>
- </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"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkCombo" id="combo-suffix">
- <property name="visible">True</property>
- <property name="value_in_list">False</property>
- <property name="allow_empty">True</property>
- <property name="case_sensitive">False</property>
- <property name="enable_arrow_keys">True</property>
- <property name="enable_arrows_always">False</property>
-
- <child internal-child="entry">
- <widget class="GtkEntry" id="entry-suffix">
- <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>
- </child>
-
- <child internal-child="list">
- <widget class="GtkList" id="convertwidget16">
- <property name="visible">True</property>
- <property name="selection_mode">GTK_SELECTION_BROWSE</property>
-
- <child>
- <widget class="GtkListItem" id="convertwidget17">
- <property name="visible">True</property>
-
- <child>
- <widget class="GtkLabel" id="convertwidget18">
- <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">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>
- </child>
- </widget>
- </child>
-
- <child>
- <widget class="GtkListItem" id="convertwidget19">
- <property name="visible">True</property>
-
- <child>
- <widget class="GtkLabel" id="convertwidget20">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Sr.</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>
- </child>
- </widget>
- </child>
-
- <child>
- <widget class="GtkListItem" id="convertwidget21">
- <property name="visible">True</property>
-
- <child>
- <widget class="GtkLabel" id="convertwidget22">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Jr.</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>
- </child>
- </widget>
- </child>
-
- <child>
- <widget class="GtkListItem" id="convertwidget23">
- <property name="visible">True</property>
-
- <child>
- <widget class="GtkLabel" id="convertwidget24">
- <property name="visible">True</property>
- <property name="label" translatable="yes">I</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>
- </child>
- </widget>
- </child>
-
- <child>
- <widget class="GtkListItem" id="convertwidget25">
- <property name="visible">True</property>
-
- <child>
- <widget class="GtkLabel" id="convertwidget26">
- <property name="visible">True</property>
- <property name="label" translatable="yes">II</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>
- </child>
- </widget>
- </child>
-
- <child>
- <widget class="GtkListItem" id="convertwidget27">
- <property name="visible">True</property>
-
- <child>
- <widget class="GtkLabel" id="convertwidget28">
- <property name="visible">True</property>
- <property name="label" translatable="yes">III</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>
- </child>
- </widget>
- </child>
-
- <child>
- <widget class="GtkListItem" id="convertwidget29">
- <property name="visible">True</property>
-
- <child>
- <widget class="GtkLabel" id="convertwidget30">
- <property name="visible">True</property>
- <property name="label" translatable="yes">Esq.</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>
- </child>
- </widget>
- </child>
-
- <child>
- <widget class="GtkListItem" id="convertwidget31">
- <property name="visible">True</property>
-
- <child>
- <widget class="GtkLabel" id="convertwidget32">
- <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">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>
- </child>
- </widget>
- </child>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- <property name="top_attach">4</property>
- <property name="bottom_attach">5</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkEntry" id="entry-first">
- <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">1</property>
- <property name="right_attach">3</property>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkEntry" id="entry-middle">
- <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">1</property>
- <property name="right_attach">3</property>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkEntry" id="entry-last">
- <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">1</property>
- <property name="right_attach">3</property>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
- <property name="y_options"></property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label-first">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_First:</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-first</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_options">fill</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label-title">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Title:</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-title</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">fill</property>
- </packing>
- </child>
+ <padding>0</padding>
+ <expand>False</expand>
+ <fill>True</fill>
+ <pack>GTK_PACK_END</pack>
+ </child>
- <child>
- <widget class="GtkLabel" id="label-middle">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Middle:</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-middle</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">fill</property>
- </packing>
- </child>
+ <widget>
+ <class>GtkButton</class>
+ <name>button1</name>
+ <can_default>True</can_default>
+ <can_focus>True</can_focus>
+ <stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
+ </widget>
+
+ <widget>
+ <class>GtkButton</class>
+ <name>button2</name>
+ <can_default>True</can_default>
+ <can_focus>True</can_focus>
+ <stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
+ </widget>
+ </widget>
- <child>
- <widget class="GtkLabel" id="label-last">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Last:</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-last</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>
+ <widget>
+ <class>GtkTable</class>
+ <name>table-checkfullname</name>
+ <border_width>8</border_width>
+ <rows>5</rows>
+ <columns>3</columns>
+ <homogeneous>False</homogeneous>
+ <row_spacing>6</row_spacing>
+ <column_spacing>21</column_spacing>
+ <child>
+ <padding>0</padding>
+ <expand>True</expand>
+ <fill>True</fill>
+ </child>
- <child>
- <widget class="GtkLabel" id="label-suffix">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Suffix:</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-suffix</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="x_options">fill</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
+ <widget>
+ <class>GtkCombo</class>
+ <name>combo-title</name>
+ <value_in_list>False</value_in_list>
+ <ok_if_empty>True</ok_if_empty>
+ <case_sensitive>False</case_sensitive>
+ <use_arrows>True</use_arrows>
+ <use_arrows_always>False</use_arrows_always>
+ <items>
+Mr.
+Mrs.
+Ms.
+Miss
+Dr.
+</items>
+ <child>
+ <left_attach>1</left_attach>
+ <right_attach>2</right_attach>
+ <top_attach>0</top_attach>
+ <bottom_attach>1</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>True</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>False</yfill>
+ </child>
+
+ <widget>
+ <class>GtkEntry</class>
+ <child_name>GtkCombo:entry</child_name>
+ <name>entry-title</name>
+ <can_focus>True</can_focus>
+ <editable>True</editable>
+ <text_visible>True</text_visible>
+ <text_max_length>0</text_max_length>
+ <text></text>
</widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
+ </widget>
+
+ <widget>
+ <class>GtkCombo</class>
+ <name>combo-suffix</name>
+ <value_in_list>False</value_in_list>
+ <ok_if_empty>True</ok_if_empty>
+ <case_sensitive>False</case_sensitive>
+ <use_arrows>True</use_arrows>
+ <use_arrows_always>False</use_arrows_always>
+ <items>
+Sr.
+Jr.
+I
+II
+III
+Esq.
+</items>
+ <child>
+ <left_attach>1</left_attach>
+ <right_attach>2</right_attach>
+ <top_attach>4</top_attach>
+ <bottom_attach>5</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>True</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>False</yfill>
+ </child>
+
+ <widget>
+ <class>GtkEntry</class>
+ <child_name>GtkCombo:entry</child_name>
+ <name>entry-suffix</name>
+ <can_focus>True</can_focus>
+ <editable>True</editable>
+ <text_visible>True</text_visible>
+ <text_max_length>0</text_max_length>
+ <text></text>
+ </widget>
+ </widget>
+
+ <widget>
+ <class>GtkEntry</class>
+ <name>entry-first</name>
+ <can_focus>True</can_focus>
+ <editable>True</editable>
+ <text_visible>True</text_visible>
+ <text_max_length>0</text_max_length>
+ <text></text>
+ <child>
+ <left_attach>1</left_attach>
+ <right_attach>3</right_attach>
+ <top_attach>1</top_attach>
+ <bottom_attach>2</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>True</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>False</yfill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkEntry</class>
+ <name>entry-middle</name>
+ <can_focus>True</can_focus>
+ <editable>True</editable>
+ <text_visible>True</text_visible>
+ <text_max_length>0</text_max_length>
+ <text></text>
+ <child>
+ <left_attach>1</left_attach>
+ <right_attach>3</right_attach>
+ <top_attach>2</top_attach>
+ <bottom_attach>3</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>True</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>False</yfill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkEntry</class>
+ <name>entry-last</name>
+ <can_focus>True</can_focus>
+ <editable>True</editable>
+ <text_visible>True</text_visible>
+ <text_max_length>0</text_max_length>
+ <text></text>
+ <child>
+ <left_attach>1</left_attach>
+ <right_attach>3</right_attach>
+ <top_attach>3</top_attach>
+ <bottom_attach>4</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>True</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>False</yfill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label-first</name>
+ <label>_First:</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <focus_target>entry-first</focus_target>
+ <child>
+ <left_attach>0</left_attach>
+ <right_attach>1</right_attach>
+ <top_attach>1</top_attach>
+ <bottom_attach>2</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label-title</name>
+ <label>_Title:</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <focus_target>entry-title</focus_target>
+ <child>
+ <left_attach>0</left_attach>
+ <right_attach>1</right_attach>
+ <top_attach>0</top_attach>
+ <bottom_attach>1</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label-middle</name>
+ <label>_Middle:</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <focus_target>entry-middle</focus_target>
+ <child>
+ <left_attach>0</left_attach>
+ <right_attach>1</right_attach>
+ <top_attach>2</top_attach>
+ <bottom_attach>3</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label-last</name>
+ <label>_Last:</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <focus_target>entry-last</focus_target>
+ <child>
+ <left_attach>0</left_attach>
+ <right_attach>1</right_attach>
+ <top_attach>3</top_attach>
+ <bottom_attach>4</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+ </widget>
+
+ <widget>
+ <class>GtkLabel</class>
+ <name>label-suffix</name>
+ <label>_Suffix:</label>
+ <justify>GTK_JUSTIFY_CENTER</justify>
+ <wrap>False</wrap>
+ <xalign>0</xalign>
+ <yalign>0.5</yalign>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <focus_target>entry-suffix</focus_target>
+ <child>
+ <left_attach>0</left_attach>
+ <right_attach>1</right_attach>
+ <top_attach>4</top_attach>
+ <bottom_attach>5</bottom_attach>
+ <xpad>0</xpad>
+ <ypad>0</ypad>
+ <xexpand>False</xexpand>
+ <yexpand>False</yexpand>
+ <xshrink>False</xshrink>
+ <yshrink>False</yshrink>
+ <xfill>True</xfill>
+ <yfill>True</yfill>
+ </child>
+ </widget>
</widget>
- </child>
+ </widget>
</widget>
-</glade-interface>
+</GTK-Interface>
diff --git a/addressbook/gui/widgets/e-addressbook-reflow-adapter.c b/addressbook/gui/widgets/e-addressbook-reflow-adapter.c
index 3c2bb20386..cd306d1627 100644
--- a/addressbook/gui/widgets/e-addressbook-reflow-adapter.c
+++ b/addressbook/gui/widgets/e-addressbook-reflow-adapter.c
@@ -3,18 +3,19 @@
#include <config.h>
-#include <libgnome/gnome-i18n.h>
-#include "e-addressbook-marshal.h"
#include "e-addressbook-reflow-adapter.h"
#include "e-addressbook-model.h"
#include "e-addressbook-view.h"
#include "e-addressbook-util.h"
+#include <gal/util/e-i18n.h>
+
#include "e-minicard.h"
#include <gal/widgets/e-unicode.h>
#include <gal/widgets/e-font.h>
#include <gal/widgets/e-popup-menu.h>
#include <gal/widgets/e-gui-utils.h>
+#include <gal/unicode/gunicode.h>
#include "e-contact-save-as.h"
#include "addressbook/printing/e-contact-print.h"
#include "addressbook/printing/e-contact-print-envelope.h"
@@ -32,11 +33,11 @@ EReflowModel *parent_class;
#define d(x)
enum {
- PROP_0,
- PROP_BOOK,
- PROP_QUERY,
- PROP_EDITABLE,
- PROP_MODEL,
+ ARG_0,
+ ARG_BOOK,
+ ARG_QUERY,
+ ARG_EDITABLE,
+ ARG_MODEL,
};
enum {
@@ -51,27 +52,21 @@ unlink_model(EAddressbookReflowAdapter *adapter)
{
EAddressbookReflowAdapterPrivate *priv = adapter->priv;
- if (priv->model && priv->create_card_id)
- g_signal_handler_disconnect (priv->model,
- priv->create_card_id);
- if (priv->model && priv->remove_card_id)
- g_signal_handler_disconnect (priv->model,
- priv->remove_card_id);
- if (priv->model && priv->modify_card_id)
- g_signal_handler_disconnect (priv->model,
- priv->modify_card_id);
-
- if (priv->model && priv->model_changed_id)
- g_signal_handler_disconnect (priv->model,
- priv->model_changed_id);
+ gtk_signal_disconnect(GTK_OBJECT (priv->model),
+ priv->create_card_id);
+ gtk_signal_disconnect(GTK_OBJECT (priv->model),
+ priv->remove_card_id);
+ gtk_signal_disconnect(GTK_OBJECT (priv->model),
+ priv->modify_card_id);
+ gtk_signal_disconnect(GTK_OBJECT (priv->model),
+ priv->model_changed_id);
priv->create_card_id = 0;
priv->remove_card_id = 0;
priv->modify_card_id = 0;
priv->model_changed_id = 0;
- if (priv->model)
- g_object_unref (priv->model);
+ gtk_object_unref(GTK_OBJECT(priv->model));
priv->model = NULL;
}
@@ -95,7 +90,7 @@ count_lines (const gchar *text)
static int
text_height (GnomeCanvas *canvas, const gchar *text)
{
- EFont *font = e_font_from_gdk_font (gtk_style_get_font (gtk_widget_get_style (GTK_WIDGET (canvas))));
+ EFont *font = e_font_from_gdk_font (((GtkWidget *) canvas)->style->font);
gint height = e_font_height (font) * count_lines (text) / canvas->pixels_per_unit;
e_font_unref (font);
@@ -103,7 +98,7 @@ text_height (GnomeCanvas *canvas, const gchar *text)
}
static void
-addressbook_dispose(GObject *object)
+addressbook_finalize(GtkObject *object)
{
EAddressbookReflowAdapter *adapter = E_ADDRESSBOOK_REFLOW_ADAPTER(object);
@@ -167,7 +162,7 @@ addressbook_height (EReflowModel *erm, int i, GnomeCanvasGroup *parent)
}
height += 2;
- g_object_unref (simple);
+ gtk_object_unref (GTK_OBJECT (simple));
return height;
}
@@ -206,9 +201,9 @@ adapter_drag_begin (EMinicard *card, GdkEvent *event, EAddressbookReflowAdapter
{
gint ret_val = 0;
- g_signal_emit (adapter,
- e_addressbook_reflow_adapter_signals[DRAG_BEGIN], 0,
- event, &ret_val);
+ gtk_signal_emit (GTK_OBJECT(adapter),
+ e_addressbook_reflow_adapter_signals[DRAG_BEGIN],
+ event, &ret_val);
return ret_val;
}
@@ -227,13 +222,13 @@ addressbook_incarnate (EReflowModel *erm, int i, GnomeCanvasGroup *parent)
NULL);
#if 0
- g_signal_connect (item, "selected",
- G_CALLBACK(card_selected), 0, emvm);
+ gtk_signal_connect (GTK_OBJECT (item), "selected",
+ GTK_SIGNAL_FUNC(card_selected), emvm);
#endif
- g_signal_connect (item, "drag_begin",
- G_CALLBACK(adapter_drag_begin), adapter);
-
+ gtk_signal_connect (GTK_OBJECT (item), "drag_begin",
+ GTK_SIGNAL_FUNC(adapter_drag_begin), adapter);
+
return item;
}
@@ -284,112 +279,106 @@ model_changed(EAddressbookModel *model,
}
static void
-addressbook_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
+addressbook_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
{
- EAddressbookReflowAdapter *adapter = E_ADDRESSBOOK_REFLOW_ADAPTER(object);
+ EAddressbookReflowAdapter *adapter = E_ADDRESSBOOK_REFLOW_ADAPTER(o);
EAddressbookReflowAdapterPrivate *priv = adapter->priv;
- switch (prop_id) {
- case PROP_BOOK:
- g_object_set (priv->model,
- "book", g_value_get_object (value),
- NULL);
+ switch (arg_id){
+ case ARG_BOOK:
+ gtk_object_set (GTK_OBJECT (priv->model),
+ "book", GTK_VALUE_OBJECT (*arg),
+ NULL);
break;
- case PROP_QUERY:
- g_object_set (priv->model,
- "query", g_value_get_string (value),
- NULL);
+ case ARG_QUERY:
+ gtk_object_set (GTK_OBJECT (priv->model),
+ "query", GTK_VALUE_STRING (*arg),
+ NULL);
break;
- case PROP_EDITABLE:
- g_object_set (priv->model,
- "editable", g_value_get_boolean (value),
- NULL);
- break;
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ case ARG_EDITABLE:
+ gtk_object_set (GTK_OBJECT (priv->model),
+ "editable", GTK_VALUE_BOOL (*arg),
+ NULL);
break;
}
}
static void
-addressbook_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
+addressbook_get_arg (GtkObject *o, GtkArg *arg, guint arg_id)
{
- EAddressbookReflowAdapter *adapter = E_ADDRESSBOOK_REFLOW_ADAPTER(object);
+ EAddressbookReflowAdapter *adapter = E_ADDRESSBOOK_REFLOW_ADAPTER(o);
EAddressbookReflowAdapterPrivate *priv = adapter->priv;
- switch (prop_id) {
- case PROP_BOOK: {
- g_object_get_property (G_OBJECT (priv->model),
- "book", value);
+ switch (arg_id) {
+ case ARG_BOOK: {
+ EBook *book;
+ gtk_object_get (GTK_OBJECT (priv->model),
+ "book", &book,
+ NULL);
+ if (book)
+ GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(book);
+ else
+ GTK_VALUE_OBJECT (*arg) = NULL;
break;
}
- case PROP_QUERY: {
+ case ARG_QUERY: {
char *query;
- g_object_get_property (G_OBJECT (priv->model),
- "query", value);
+ gtk_object_get (GTK_OBJECT (priv->model),
+ "query", &query,
+ NULL);
+ GTK_VALUE_STRING (*arg) = query;
break;
}
- case PROP_EDITABLE: {
- g_object_get_property (G_OBJECT (priv->model),
- "editable", value);
+ case ARG_EDITABLE: {
+ gboolean editable;
+ gtk_object_get (GTK_OBJECT (priv->model),
+ "editable", &editable,
+ NULL);
+ GTK_VALUE_BOOL (*arg) = editable;
break;
}
- case PROP_MODEL:
- g_value_set_object (value, priv->model);
+ case ARG_MODEL:
+ if (priv->model)
+ GTK_VALUE_OBJECT (*arg) = GTK_OBJECT (priv->model);
+ else
+ GTK_VALUE_OBJECT (*arg) = NULL;
break;
default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ arg->type = GTK_TYPE_INVALID;
break;
}
}
static void
-e_addressbook_reflow_adapter_class_init (GObjectClass *object_class)
+e_addressbook_reflow_adapter_class_init (GtkObjectClass *object_class)
{
EReflowModelClass *model_class = (EReflowModelClass *) object_class;
- parent_class = g_type_class_peek_parent (object_class);
-
- object_class->set_property = addressbook_set_property;
- object_class->get_property = addressbook_get_property;
- object_class->dispose = addressbook_dispose;
-
- g_object_class_install_property (object_class, PROP_BOOK,
- g_param_spec_object ("book",
- _("Book"),
- /*_( */"XXX blurb" /*)*/,
- E_TYPE_BOOK,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (object_class, PROP_QUERY,
- g_param_spec_string ("query",
- _("Query"),
- /*_( */"XXX blurb" /*)*/,
- NULL,
- 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_MODEL,
- g_param_spec_object ("model",
- _("Model"),
- /*_( */"XXX blurb" /*)*/,
- E_TYPE_ADDRESSBOOK_MODEL,
- G_PARAM_READABLE));
+ parent_class = gtk_type_class (PARENT_TYPE);
+
+ object_class->set_arg = addressbook_set_arg;
+ object_class->get_arg = addressbook_get_arg;
+ object_class->finalize = addressbook_finalize;
+
+ gtk_object_add_arg_type ("EAddressbookReflowAdapter::book", GTK_TYPE_OBJECT,
+ GTK_ARG_READWRITE, ARG_BOOK);
+ gtk_object_add_arg_type ("EAddressbookReflowAdapter::query", GTK_TYPE_STRING,
+ GTK_ARG_READWRITE, ARG_QUERY);
+ gtk_object_add_arg_type ("EAddressbookReflowAdapter::editable", GTK_TYPE_BOOL,
+ GTK_ARG_READWRITE, ARG_EDITABLE);
+ gtk_object_add_arg_type ("EAddressbookReflowAdapter::model", E_ADDRESSBOOK_MODEL_TYPE,
+ GTK_ARG_READABLE, ARG_MODEL);
e_addressbook_reflow_adapter_signals [DRAG_BEGIN] =
- g_signal_new ("drag_begin",
- G_OBJECT_CLASS_TYPE(object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EAddressbookReflowAdapterClass, drag_begin),
- NULL, NULL,
- e_addressbook_marshal_INT__POINTER,
- G_TYPE_INT, 1, G_TYPE_POINTER);
+ gtk_signal_new ("drag_begin",
+ GTK_RUN_LAST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EAddressbookReflowAdapterClass, drag_begin),
+ gtk_marshal_INT__POINTER,
+ GTK_TYPE_INT, 1, GTK_TYPE_POINTER);
+
+
+ gtk_object_class_add_signals (object_class, e_addressbook_reflow_adapter_signals, LAST_SIGNAL);
model_class->set_width = addressbook_set_width;
model_class->count = addressbook_count;
@@ -413,25 +402,24 @@ e_addressbook_reflow_adapter_init (GtkObject *object)
priv->model_changed_id = 0;
}
-GType
+GtkType
e_addressbook_reflow_adapter_get_type (void)
{
- static GType type = 0;
+ static GtkType type = 0;
- if (!type) {
- static const GTypeInfo info = {
- sizeof (EAddressbookReflowAdapterClass),
- NULL, /* base_init */
- NULL, /* base_finalize */
- (GClassInitFunc) e_addressbook_reflow_adapter_class_init,
- NULL, /* class_finalize */
- NULL, /* class_data */
+ if (!type){
+ GtkTypeInfo info = {
+ "EAddressbookReflowAdapter",
sizeof (EAddressbookReflowAdapter),
- 0, /* n_preallocs */
- (GInstanceInitFunc) e_addressbook_reflow_adapter_init,
+ sizeof (EAddressbookReflowAdapterClass),
+ (GtkClassInitFunc) e_addressbook_reflow_adapter_class_init,
+ (GtkObjectInitFunc) e_addressbook_reflow_adapter_init,
+ NULL, /* reserved 1 */
+ NULL, /* reserved 2 */
+ (GtkClassInitFunc) NULL
};
- type = g_type_register_static (PARENT_TYPE, "EAddressbookReflowAdapter", &info, 0);
+ type = gtk_type_unique (PARENT_TYPE, &info);
}
return type;
@@ -444,24 +432,24 @@ e_addressbook_reflow_adapter_construct (EAddressbookReflowAdapter *adapter,
EAddressbookReflowAdapterPrivate *priv = adapter->priv;
priv->model = model;
- g_object_ref (priv->model);
-
- priv->create_card_id = g_signal_connect(priv->model,
- "card_added",
- G_CALLBACK(create_card),
- adapter);
- priv->remove_card_id = g_signal_connect(priv->model,
- "card_removed",
- G_CALLBACK(remove_card),
- adapter);
- priv->modify_card_id = g_signal_connect(priv->model,
- "card_changed",
- G_CALLBACK(modify_card),
- adapter);
- priv->model_changed_id = g_signal_connect(priv->model,
- "model_changed",
- G_CALLBACK(model_changed),
+ gtk_object_ref (GTK_OBJECT (priv->model));
+
+ priv->create_card_id = gtk_signal_connect(GTK_OBJECT(priv->model),
+ "card_added",
+ GTK_SIGNAL_FUNC(create_card),
+ adapter);
+ priv->remove_card_id = gtk_signal_connect(GTK_OBJECT(priv->model),
+ "card_removed",
+ GTK_SIGNAL_FUNC(remove_card),
+ adapter);
+ priv->modify_card_id = gtk_signal_connect(GTK_OBJECT(priv->model),
+ "card_changed",
+ GTK_SIGNAL_FUNC(modify_card),
adapter);
+ priv->model_changed_id = gtk_signal_connect(GTK_OBJECT(priv->model),
+ "model_changed",
+ GTK_SIGNAL_FUNC(model_changed),
+ adapter);
}
EReflowModel *
@@ -469,7 +457,7 @@ e_addressbook_reflow_adapter_new (EAddressbookModel *model)
{
EAddressbookReflowAdapter *et;
- et = g_object_new (E_TYPE_ADDRESSBOOK_REFLOW_ADAPTER, NULL);
+ et = gtk_type_new (e_addressbook_reflow_adapter_get_type ());
e_addressbook_reflow_adapter_construct (et, model);
diff --git a/art/ChangeLog b/art/ChangeLog
index 0093315a1e..92c9af2d06 100644
--- a/art/ChangeLog
+++ b/art/ChangeLog
@@ -1,6 +1,7 @@
-2002-11-25 Ettore Perazzoli <ettore@ximian.com>
+2002-11-06 Ettore Perazzoli <ettore@ximian.com>
- * splash.png: New work-in-progress splash from Jakub.
+ * splash.png: New artwork from Jakub.
+ * about-box.png: New artwork from Jakub.
2002-10-28 Ettore Perazzoli <ettore@ximian.com>
diff --git a/art/about-box.png b/art/about-box.png
index 95c06f8f70..7df6464871 100644
--- a/art/about-box.png
+++ b/art/about-box.png
Binary files differ
diff --git a/art/splash.png b/art/splash.png
index d0fbdc16a5..f7b25cd217 100644
--- a/art/splash.png
+++ b/art/splash.png
Binary files differ
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index f895ecf5a9..289e659af8 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,440 +1,61 @@
-2002-11-27 Not Zed <NotZed@Ximian.com>
-
- * gui/itip-utils.[ch]: run fix.sh over this.
-
- * gui/dialogs/*.[ch]: run fix.sh over all of this.
-
-2002-11-26 Richard Li <Richard.Li@Sun.COM>
-
- * cal-client/cal-client.c (cal_client_construct): removed extra call
- to CORBA_exception_init.
-
-2002-11-22 Not Zed <NotZed@Ximian.com>
-
- * gui/dialogs/delete-comp.c (delete_component_dialog): Changed
- e_messagebox -> gtk_messagedialog.
-
-2002-11-21 Not Zed <NotZed@Ximian.com>
-
- * gui/component-factory.c (create_view): pass type to
- bonobo_control_set_property.
-
-2002-11-20 Not Zed <NotZed@Ximian.com>
-
- * gui/Makefile.am (EXTRA_DIST): fix typo, servers_in_files ->
- server_in_files.
-
-2002-11-19 Ettore Perazzoli <ettore@ximian.com>
-
- * Makefile.am: Added rule to generate
- GNOME_Evolution_Calendar.server.in from
- GNOME_Evolution_Calendar.server.in.in, substituting @LIBEXECDIR@.
- Also, install evolution-calendar in $libexecdir instead of
- $bindir.
-
- * gui/GNOME_Evolution_Calendar.server.in.in: Renamed from
- GNOME_Evolution_Calendar.server.in. Prepended the executable name
- with @LIBEXECDIR@.
-
-2002-11-19 Not Zed <NotZed@Ximian.com>
+2002-12-02 Dan Winship <danw@ximian.com>
+
+ * gui/e-itip-control.c (write_recurrence_piece): Describe
+ recurrences, if we can. #30993
+ (set_date_label): If the meeting has recurrences, call
+ write_recurrence_piece after writing the start and end dates.
+ (write_label_piece): Wrap the timezone in <font size=-1> to
+ de-emphasize it a bit and try to keep the timestamp on a single
+ line even with big Outlook timezone names. Add an option to show
+ just the date, for describing the end of recurrences (since the
+ time in the UNTIL is the *beginning* of the last instance, which
+ would confuse people).
+
+2002-11-30 Hans Petter Jansson <hpj@ximian.com>
+
+ * gui/e-meeting-model.c (append_row): Don't leak meeting attendees;
+ unref the attendee after it's assigned to model.
+ (select_names_ok_cb): Free the destinations string after we're done
+ with it.
- * gui/e-meeting-model.c (get_select_name_dialog): pass type to
- bonobo_widget::set_property.
- (select_names_ok_cb): ", for get_property.
+ * gui/dialogs/meeting-page.c (meeting_page_destroy): Free the actual
+ array of deleted attendees.
- * gui/dialogs/e-delegate-dialog.c (e_delegate_dialog_construct):
- pass type to bonobo_widget::set_property & plug small leak.
- (e_delegate_dialog_get_delegate): ", for get_property.
- (e_delegate_dialog_get_delegate_name): "
+ * gui/dialogs/event-editor.c (event_editor_destroy): Free the private
+ structure.
- * gui/dialogs/comp-editor-util.c (comp_editor_contacts_to_widget):
- pass type to bonobo_widget::set_property.
- (comp_editor_contacts_to_component): ", for get_property
+ * gui/itip-utils.c (comp_description): Rework free/busy information
+ composer so we can free date/time information after use. Then free it.
+ (itip_send_comp): Free the allocated CORBA buffer for attachment data.
-2002-11-16 Chris Toshok <toshok@ximian.com>
+ * gui/dialogs/comp-editor-util.c (comp_editor_contacts_to_component):
+ Free the destination contacts string once we're done with it.
- * gui/e-meeting-time-sel.c (e_meeting_time_selector_style_set):
- use new e_table_header_compute_height signature.
+ * gui/e-calendar-table.c (invisible_destroyed): Unref the invisible.
-2002-11-15 Rodney Dawes <dobey@ximian.com>
+ * gui/e-day-view.c (invisible_destroyed): Ditto.
- * gui/component-factory.c: Use bonobo_main_quit instead of gtk
+ * gui/e-week-view.c (invisible_destroyed): Ditto.
-2002-11-13 Federico Mena Quintero <federico@ximian.com>
-
- * cal-client/cal-query.c: #include <string.h>
- (obj_removed_cb): Fixed prototype.
-
- * cal-client/cal-client.c (get_objects_atomically): Fix use of
- g_signal_handler_disconnect().
-
- * cal-client/client-test.c (create_client): Add G_CALLBACK casts.
-
-2002-11-12 Federico Mena Quintero <federico@ximian.com>
-
- * pcs/cal-backend-util.c: #include <string.h>
-
- * pcs/cal.c: Fixed prototypes of the CORBA method implementations.
-
- * pcs/cal-backend-file.c (cal_backend_file_dispose): Added a
- dispose method.
- (cal_backend_file_get_free_busy): Converted to use EConfigListener
- rather than BonoboConfigDatabase.
-
- * gui/alarm-notify/alarm-notify.c: #include <string.h>, fix use of
- g_hash_table_lookup_extended().
-
- * gui/alarm-notify/alarm-notify-dialog.c: Substitute deprecated
- GTK+ functions for new ones.
-
- * gui/alarm-notify/alarm-queue.c: Likewise.
-
- * gui/alarm-notify/notify-main.c: #include <string.h>,
- <gtk/gtkmain.h>.
-
- * gui/alarm-notify/save.c: #include <string.h>.
-
-2002-11-08 Ettore Perazzoli <ettore@ximian.com>
-
- * gui/calendar-commands.c (calendar_control_deactivate): Use
- g_object_set_data(..., NULL) instead of gtk_object_remove_data().
-
- * gui/calendar-commands.c: Use g_object_{set,get}_* functions
- instead of gtk_object_{set,get}_*.
- * gui/calendar-commands.c: Likewise.
- * gui/calendar-config.c: Likewise.
- * gui/control-factory.c: Likewise.
- * gui/e-calendar-table.c: Likewise.
- * gui/e-comp-editor-registry.c: Likewise.
- * gui/e-day-view-main-item.c: Likewise.
- * gui/e-day-view-time-item.c: Likewise.
- * gui/e-day-view-top-item.c: Likewise.
- * gui/e-day-view.c: Likewise.
- * gui/e-meeting-attendee.c: Likewise.
- * gui/e-meeting-model.c: Likewise.
- * gui/e-meeting-time-sel-item.c: Likewise.
- * gui/e-meeting-time-sel.c: Likewise.
- * gui/e-week-view-event-item.c: Likewise.
- * gui/e-week-view-layout.c: Likewise.
- * gui/e-week-view-main-item.c: Likewise.
- * gui/e-week-view-titles-item.c: Likewise.
- * gui/e-week-view.c: Likewise.
- * gui/gnome-cal.c: Likewise.
- * gui/print.c: Likewise.
-
-2002-11-08 Ettore Perazzoli <ettore@ximian.com>
-
- * gui/calendar-commands.c: Use g_object_ref()/g_object_unref()
- instead of gtk_object_ref/gtk_object_unref().
- * gui/calendar-config.c: Likewise.
- * gui/calendar-model.c: Likewise.
- * gui/comp-editor-factory.c: Likewise.
- * gui/comp-util.c: Likewise.
- * gui/e-calendar-table.c: Likewise.
- * gui/e-day-view.c: Likewise.
- * gui/e-itip-control.c: Likewise.
- * gui/e-meeting-model.c: Likewise.
- * gui/e-meeting-time-sel.c: Likewise.
- * gui/e-tasks.c: Likewise.
- * gui/e-timezone-entry.c: Likewise.
- * gui/e-week-view.c: Likewise.
- * gui/gnome-cal.c: Likewise.
- * gui/goto.c: Likewise.
- * gui/itip-utils.c: Likewise.
- * gui/print.c: Likewise.
- * gui/tasks-control.c: Likewise.
- * gui/tasks-migrate.c: Likewise.
-
- * gui/cal-search-bar.c: Use g_object_new() instead of
- gtk_type_new().
- * gui/calendar-model.c: Likewise.
- * gui/calendar-view-factory.c: Likewise.
- * gui/calendar-view.c: Likewise.
- * gui/calendar-view.c: Likewise.
- * gui/comp-editor-factory.c: Likewise.
- * gui/e-calendar-table.c: Likewise.
- * gui/e-cell-date-edit-text.c: Likewise.
- * gui/e-comp-editor-registry.c: Likewise.
- * gui/e-day-view.c: Likewise.
- * gui/e-itip-control.c: Likewise.
- * gui/e-meeting-attendee.c: Likewise.
- * gui/e-meeting-attendee.c: Likewise.
- * gui/e-meeting-model.c: Likewise.
- * gui/e-meeting-time-sel.c: Likewise.
- * gui/e-tasks.c: Likewise.
- * gui/e-timezone-entry.c: Likewise.
- * gui/e-week-view.c: Likewise.
- * gui/gnome-cal.c: Likewise.
- * gui/weekday-picker.c: Likewise.
-
- * gui/e-itip-control.c (get_servers): g_object_unref the
- shell_client instead of using bonobo_object_unref().
-
- * gui/component-factory.c (owner_set_cb): Use
- evolution_shell_client_corba_objref() instead of
- bonobo_object_corba_objref().
-
-2002-11-08 Ettore Perazzoli <ettore@ximian.com>
-
- * gui/calendar-commands.c: Use g_signal_connect() instead of
- gtk_signal_connect().
- * calendar-commands.c: Likewise.
- * calendar-config.c: Likewise.
- * calendar-model.c: Likewise.
- * comp-editor-factory.c: Likewise.
- * component-factory.c: Likewise.
- * control-factory.c: Likewise.
- * e-calendar-table.c: Likewise.
- * e-comp-editor-registry.c: Likewise.
- * e-day-view-time-item.c: Likewise.
- * e-day-view.c: Likewise.
- * e-itip-control.c: Likewise.
- * e-meeting-model.c: Likewise.
- * e-meeting-time-sel.c: Likewise.
- * e-tasks.c: Likewise.
- * e-timezone-entry.c: Likewise.
- * e-week-view.c: Likewise.
- * gnome-cal.c: Likewise.
- * goto.c: Likewise.
- * tasks-control.c: Likewise.
- * tasks-migrate.c: Likewise.
- * weekday-picker.c: Likewise.
-
-2002-11-08 Ettore Perazzoli <ettore@ximian.com>
-
- * gui/calendar-offline-handler.c
- (calendar_offline_handler_class_init): GObjectified.
- (impl_finalize): Finalize impl.
- (impl_dispose): Dispose impl.
- (calendar_offline_handler_new): Use g_object_new().
- (backend_cal_opened): use g_signal_connect() instead of
- gtk_signal_connect().
- (backend_go_offline): Likewise.
- (backend_cal_opened): g_object_unref() instead of
- gtk_object_unref().
- (backend_go_offline): Likewise.
-
-2002-11-08 Rodrigo Moya <rodrigo@ximian.com>
-
- * importers/evolution-calendar-importer.h: use GLib macros.
-
- * importers/main.c (init_importer): use bonobo_generic_factory_new,
- not bonobo_generic_factory_new_multi.
- (main): don't use libgnome functions.
-
-2002-11-07 Rodrigo Moya <rodrigo@ximian.com>
-
- * cal-client/client-test.c: don't use GTK, we don't need it.
+2002-11-26 Dan Winship <danw@ximian.com>
-2002-11-07 JP Rosevear <jpr@ximian.com>
+ * gui/e-itip-control.c (update_item): Set the VCALENDAR's METHOD.
+ (ok_clicked_cb): Use update_item, not remove_item, to process a
+ cancelation. Part of #33875.
- * Initial port of gui/ subdir to GNOME 2
+ * pcs/cal-backend-file.c (cal_backend_file_cancel_object): New,
+ handle an ICAL_METHOD_CANCEL update.
+ (cal_backend_file_update_objects): Call
+ cal_backend_file_update_object or cal_backend_file_cancel_object
+ as appropriate.
-2002-11-07 Rodrigo Moya <rodrigo@ximian.com>
+ * cal-util/cal-component.c (cal_component_set_recurid): If
+ @recur_id is NULL, clear the recurrence-id.
- * importers/icalendar-importer.c: removed non-existant headers.
-
- * importers/Makefile.am: changes for BonoboActivation.
-
- * gui/GNOME_Evolution_Calendar.server.in: install to $libdir, not
- $datadir.
-
-2002-11-07 Rodrigo Moya <rodrigo@ximian.com>
-
- * cal-client/query-listener.[ch]: converted to BonoboObject.
-
- * gui/dialogs/comp-editor-util.c (parse_contact_string): use glib's
- g_utf8_strchr.
-
- * gui/dialogs/delete-comp.c: removed non-existant headers. Use
- GtkStock instead of GnomeStock.
-
- * gui/dialogs/e-delegate-dialog.c: converted to BonoboActivation.
- (e_delegate_dialog_construct): adapted to changes in glade_xml_new.
-
-2002-11-07 Rodrigo Moya <rodrigo@ximian.com>
-
- * pcs/cal.[ch]: converted to BonoboObject.
- (impl_Cal_get_query): bonobo_object_unref the query returned by
- cal_backend_get_query if we can't duplicate it.
-
- * pcs/query.[ch]:
- * pcs/cal-factory.[ch]: converted to BonoboObject.
-
- * pcs/query-backend.[ch]:
- * pcs/cal-backend-file.[ch]:
- * pcs/cal-backend.[ch]: GObjectify.
-
-2002-11-06 Rodrigo Moya <rodrigo@ximian.com>
-
- * gui/cal-prefs-dialog.c: #include gtkoptionmenu.h.
- (cal_prefs_dialog_new): adapted to changes in glade_xml_new.
-
- * gui/dialogs/event-page.h:
- * gui/dialogs/meeting-page.h:
- * gui/dialogs/recurrence-page.h:
- * gui/dialogs/schedule-page.h:
- * gui/dialogs/task-details-page.h:
- * gui/dialogs/task-page.h:
- * gui/cal-prefs-dialog.h: use correctly the macros.
-
- * gui/dialogs/cancel-comp.c:
- * gui/dialogs/changed-comp.c:
- * gui/dialogs/comp-editor-page.c:
- * gui/gnome-cal.h: removed non-existent headers.
-
- * gui/dialogs/comp-editor.c: remove non-existent headers.
- (close_dialog): gtk_widget_destroy the widget.
- (setup_widgets, comp_editor_merge_ui): use BonoboWindow correctly.
- (comp_editor_set_cal_client, comp_editor_send_comp,
- comp_editor_edit_comp): use G_OBJECT_GET_CLASS for
- getting the class of an object.
-
- * gui/dialogs/comp-editor-page.c (comp_editor_page_class_init):
- use g_signal_* functions.
-
- * gui/dialogs/comp-editor-util.c: converted to BonoboActivation.
-
- * gui/dialogs/comp-editor.h: #include bonobo-window.h, not
- bonobo-win.h.
-
-2002-11-06 Rodrigo Moya <rodrigo@ximian.com>
-
- * gui/alarm-notify/GNOME_Evolution_Calendar_AlarmNotify.server.in:
- * gui/GNOME_Evolution_Calendar.server.in: renmaed .oaf.in files.
-
- * gui/alarm-notify/Makefile.am:
- * gui/Makefile.am: fixed rules for .server files.
-
-2002-11-06 Rodrigo Moya <rodrigo@ximian.com>
-
- * gui/dialogs/comp-editor-util.[ch]
- (comp_editor_connect_contacts_changed): don't return a
- Bonobo_EventSource_ListenerId, since it does not exist anymore,
- and was not even being used.
-
- * gui/e-timezone-entry.h: use GLib macros.
-
- * gui/dialogs/*.glade:
- * gui/alarm-notify/*.glade:
- * gui/*.glade: converted to Glade2 format.
-
-2002-11-05 Rodrigo Moya <rodrigo@ximian.com>
-
- * gui/dialogs/alarm-options.c (alarm_options_dialog_run): adapted to
- to new glade_xml_new signature.
-
- * gui/calendar-model.h:
- * gui/dialogs/comp-editor-page.h:
- * gui/dialogs/alarm-page.[ch]: removed non-existant header files.
-
- * gui/dialogs/comp-editor-util.h: added missing headers.
-
-2002-11-05 Rodrigo Moya <rodrigo@ximian.com>
-
- * pcs/cal-backend.c: use libxml2 headers.
-
- * gui/alarm-notify/Makefile.am:
- * gui/dialogs/Makefile.am:
- * gui/Makefile.am: s/XML_I18N/INTLTOOL. Fixed execution of
- $(ORBIT_IDL).
-
- * gui/alarm-notify/alarm-notify.[ch]: converted to BonoboObject.
-
- * gui/alarm-notify/alarm-notify-dialog.c: compilation fixes.
- (alarm_notify_dialog): adapted to new glade_xml_new signature.
-
- * gui/alarm-notify/alarm-queue.c: ported to BonoboActivation and
- GtkStock and GtkDialog.
-
- * gui/alarm-notify/notify-main.c: ported to BonoboActivation and
- use GObject functions instead of GtkObject ones.
-
- * gui/alarm-notify/save.h: removed BonoboConfig related functions.
-
- * gui/alarm-notify/config-data.c: use GObject functions instead of
- GtkObject ones.
-
- * TODO.port: added file for keeping track of disabled things while we
- port.
-
-2002-11-04 Rodrigo Moya <rodrigo@ximian.com>
-
- * cal-util/cal-util-marshal.list: added new marshallers.
-
- * cal-client/cal-client.c (get_objects_atomically): fixed calls to
- g_signal_handler_disconnect_by_func.
- (cal_client_class_init): fixed typos.
-
- * cal-client/cal-client-multi.[ch]:
- * cal-client/cal-client-types.c:
- * cal-client/cal-query.[ch]: ported to GObject.
-
- * cal-client/cal-listener.[ch]: converted to BonoboObject.
-
- * cal-client/Makefile.am:
- * pcs/Makefile.am: fixed flags for orbit-idl
-
-2002-11-04 Rodrigo Moya <rodrigo@ximian.com>
-
- * cal-util/Makefile.am:
- * cal-util/cal-util-marshal.list: added marshallers.
-
- * cal-client/cal-client.[ch]: ported to GObject.
-
-2002-11-04 Rodrigo Moya <rodrigo@ximian.com>
-
- * cal-util/cal-component.[ch]: ported to GObject.
-
- * cal-util/cal-util.c (cal_util_generate_alarms_for_comp): use
- g_object_* instead of gtk_object_*.
-
-2002-11-03 Rodrigo Moya <rodrigo@ximian.com>
-
- * cal-client/cal-client.c (get_default_uri): use EConfigListener
- instead of BonoboConfig.
-
- * cal-client/cal-client.c:
- * cal-client/cal-listener.[ch]:
- * cal-client/query-listener.c: warning free.
-
-2002-11-03 Rodrigo Moya <rodrigo@ximian.com>
-
- * pcs/cal-backend-util.[ch]: don't use BonoboConfig, but
- EConfigListener.
-
- * gui/calendar-config.c: use /apps/Evolution prefix for all
- configuration keys.
-
-2002-10-31 Rodrigo Moya <rodrigo@ximian.com>
-
- * cal-util/cal-component.[ch]:
- * cal-util/cal-recur.h:
- * cal-util/cal-util.[ch]:
- * cal-client/cal-client.h:
- * cal-client/cal-client-multi.h:
- * cal-client/cal-client-types.[ch]:
- * cal-client/cal-listener.h
- * cal-client/cal-query.[ch]:
- * cal-client/query-listener.h:
- * pcs/cal.h:
- * pcs/cal-backend.[ch]:
- * pcs/cal-backend-file.h:
- * pcs/cal-backend-util.h:
- * pcs/cal-common.h:
- * pcs/cal-factory.h:
- * pcs/query.[ch]:
- * pcs/query-backend.[ch]: started GNOME 2 porting.
- cal-util, cal-client and pcs compiled ok.
-
- * cal-client/cal-client.c (cal_client_construct):
- * pcs/cal-factory.c: use b-a instead of OAF and bonobo-config
- instead of bonobo-conf.
-
-2002-10-29 Rodrigo Moya <rodrigo@ximian.com>
+2002-11-26 Richard Li <Richard.Li@Sun.COM>
- * gui/gnome-cal.c (backend_died_cb): cleaned up the status bar
- messages for all widgets.
+ * cal-client/cal-client.c (cal_client_construct): removed extra call
+ to CORBA_exception_init.
2002-10-24 JP Rosevear <jpr@ximian.com>
diff --git a/calendar/cal-client/cal-client.c b/calendar/cal-client/cal-client.c
index d6d92b6239..9a6b5d049d 100644
--- a/calendar/cal-client/cal-client.c
+++ b/calendar/cal-client/cal-client.c
@@ -22,14 +22,14 @@
#include <config.h>
#endif
-#include <string.h>
-#include <bonobo-activation/bonobo-activation.h>
+#include <gtk/gtksignal.h>
+#include <liboaf/liboaf.h>
#include <bonobo/bonobo-exception.h>
+#include <bonobo/bonobo-moniker-util.h>
+#include <bonobo-conf/bonobo-config-database.h>
#include <libgnome/gnome-util.h>
#include "e-util/e-component-listener.h"
-#include "e-util/e-config-listener.h"
-#include "cal-util/cal-util-marshal.h"
#include "cal-client-types.h"
#include "cal-client.h"
#include "cal-listener.h"
@@ -93,9 +93,9 @@ enum {
LAST_SIGNAL
};
-static void cal_client_class_init (CalClientClass *klass);
-static void cal_client_init (CalClient *client, CalClientClass *klass);
-static void cal_client_finalize (GObject *object);
+static void cal_client_class_init (CalClientClass *class);
+static void cal_client_init (CalClient *client);
+static void cal_client_destroy (GtkObject *object);
static char *client_get_password_cb (WombatClient *w_client,
const gchar *prompt,
@@ -109,7 +109,7 @@ static void cal_client_get_object_timezones_cb (icalparameter *param,
static guint cal_client_signals[LAST_SIGNAL];
-static GObjectClass *parent_class;
+static GtkObjectClass *parent_class;
@@ -121,124 +121,121 @@ static GObjectClass *parent_class;
*
* Return value: The type ID of the #CalClient class.
**/
-GType
+GtkType
cal_client_get_type (void)
{
- static GType cal_client_type = 0;
+ static GtkType cal_client_type = 0;
if (!cal_client_type) {
- static GTypeInfo info = {
- sizeof (CalClientClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) cal_client_class_init,
- NULL, NULL,
- sizeof (CalClient),
- 0,
- (GInstanceInitFunc) cal_client_init
- };
- cal_client_type = g_type_register_static (G_TYPE_OBJECT, "CalClient", &info, 0);
+ static const GtkTypeInfo cal_client_info = {
+ "CalClient",
+ sizeof (CalClient),
+ sizeof (CalClientClass),
+ (GtkClassInitFunc) cal_client_class_init,
+ (GtkObjectInitFunc) cal_client_init,
+ NULL, /* reserved_1 */
+ NULL, /* reserved_2 */
+ (GtkClassInitFunc) NULL
+ };
+
+ cal_client_type = gtk_type_unique (GTK_TYPE_OBJECT, &cal_client_info);
}
return cal_client_type;
}
+#define marshal_NONE__ENUM_ENUM gtk_marshal_NONE__INT_INT
+
/* Class initialization function for the calendar client */
static void
-cal_client_class_init (CalClientClass *klass)
+cal_client_class_init (CalClientClass *class)
{
- GObjectClass *object_class;
+ GtkObjectClass *object_class;
- object_class = (GObjectClass *) klass;
+ object_class = (GtkObjectClass *) class;
- parent_class = g_type_class_peek_parent (klass);
+ parent_class = gtk_type_class (GTK_TYPE_OBJECT);
cal_client_signals[CAL_OPENED] =
- g_signal_new ("cal_opened",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (CalClientClass, cal_opened),
- NULL, NULL,
- g_cclosure_marshal_VOID__ENUM,
- G_TYPE_NONE, 1,
- G_TYPE_ENUM);
+ gtk_signal_new ("cal_opened",
+ GTK_RUN_FIRST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (CalClientClass, cal_opened),
+ gtk_marshal_NONE__ENUM,
+ GTK_TYPE_NONE, 1,
+ GTK_TYPE_ENUM);
cal_client_signals[CAL_SET_MODE] =
- g_signal_new ("cal_set_mode",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (CalClientClass, cal_set_mode),
- NULL, NULL,
- cal_util_marshal_VOID__ENUM_ENUM,
- G_TYPE_NONE, 2,
- G_TYPE_ENUM,
- G_TYPE_ENUM);
+ gtk_signal_new ("cal_set_mode",
+ GTK_RUN_FIRST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (CalClientClass, cal_set_mode),
+ marshal_NONE__ENUM_ENUM,
+ GTK_TYPE_NONE, 2,
+ GTK_TYPE_ENUM,
+ GTK_TYPE_ENUM);
cal_client_signals[OBJ_UPDATED] =
- g_signal_new ("obj_updated",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (CalClientClass, obj_updated),
- NULL, NULL,
- g_cclosure_marshal_VOID__STRING,
- G_TYPE_NONE, 1,
- G_TYPE_STRING);
+ gtk_signal_new ("obj_updated",
+ GTK_RUN_FIRST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (CalClientClass, obj_updated),
+ gtk_marshal_NONE__STRING,
+ GTK_TYPE_NONE, 1,
+ GTK_TYPE_STRING);
cal_client_signals[OBJ_REMOVED] =
- g_signal_new ("obj_removed",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (CalClientClass, obj_removed),
- NULL, NULL,
- g_cclosure_marshal_VOID__STRING,
- G_TYPE_NONE, 1,
- G_TYPE_STRING);
+ gtk_signal_new ("obj_removed",
+ GTK_RUN_FIRST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (CalClientClass, obj_removed),
+ gtk_marshal_NONE__STRING,
+ GTK_TYPE_NONE, 1,
+ GTK_TYPE_STRING);
cal_client_signals[BACKEND_ERROR] =
- g_signal_new ("backend_error",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (CalClientClass, backend_error),
- NULL, NULL,
- g_cclosure_marshal_VOID__STRING,
- G_TYPE_NONE, 1,
- G_TYPE_STRING);
+ gtk_signal_new ("backend_error",
+ GTK_RUN_FIRST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (CalClientClass, backend_error),
+ gtk_marshal_NONE__STRING,
+ GTK_TYPE_NONE, 1,
+ GTK_TYPE_STRING);
cal_client_signals[CATEGORIES_CHANGED] =
- g_signal_new ("categories_changed",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (CalClientClass, categories_changed),
- NULL, NULL,
- g_cclosure_marshal_VOID__POINTER,
- G_TYPE_NONE, 1,
- G_TYPE_POINTER);
+ gtk_signal_new ("categories_changed",
+ GTK_RUN_FIRST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (CalClientClass, categories_changed),
+ gtk_marshal_NONE__POINTER,
+ GTK_TYPE_NONE, 1,
+ GTK_TYPE_POINTER);
cal_client_signals[FORGET_PASSWORD] =
- g_signal_new ("forget_password",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (CalClientClass, forget_password),
- NULL, NULL,
- g_cclosure_marshal_VOID__STRING,
- G_TYPE_NONE, 1,
- G_TYPE_STRING);
+ gtk_signal_new ("forget_password",
+ GTK_RUN_FIRST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (CalClientClass, forget_password),
+ gtk_marshal_NONE__STRING,
+ GTK_TYPE_NONE, 1,
+ GTK_TYPE_STRING);
cal_client_signals[BACKEND_DIED] =
- g_signal_new ("backend_died",
- G_TYPE_FROM_CLASS (klass),
- G_SIGNAL_RUN_FIRST,
- G_STRUCT_OFFSET (CalClientClass, backend_died),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ gtk_signal_new ("backend_died",
+ GTK_RUN_FIRST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (CalClientClass, backend_died),
+ gtk_marshal_NONE__NONE,
+ GTK_TYPE_NONE, 0);
+
+ gtk_object_class_add_signals (object_class, cal_client_signals, LAST_SIGNAL);
- klass->cal_opened = NULL;
- klass->obj_updated = NULL;
- klass->obj_removed = NULL;
- klass->categories_changed = NULL;
- klass->forget_password = NULL;
- klass->backend_died = NULL;
+ class->cal_opened = NULL;
+ class->obj_updated = NULL;
+ class->obj_removed = NULL;
+ class->categories_changed = NULL;
+ class->forget_password = NULL;
+ class->backend_died = NULL;
- object_class->finalize = cal_client_finalize;
+ object_class->destroy = cal_client_destroy;
}
/* Object initialization function for the calendar client */
static void
-cal_client_init (CalClient *client, CalClientClass *klass)
+cal_client_init (CalClient *client)
{
CalClientPrivate *priv;
@@ -343,9 +340,9 @@ free_timezone (gpointer key, gpointer value, gpointer data)
icaltimezone_free (value, TRUE);
}
-/* Finalize handler for the calendar client */
+/* Destroy handler for the calendar client */
static void
-cal_client_finalize (GObject *object)
+cal_client_destroy (GtkObject *object)
{
CalClient *client;
CalClientPrivate *priv;
@@ -363,11 +360,8 @@ cal_client_finalize (GObject *object)
}
if (priv->comp_listener) {
- g_signal_handlers_disconnect_matched (G_OBJECT (priv->comp_listener),
- G_SIGNAL_MATCH_DATA,
- 0, 0, NULL, NULL,
- client);
- g_object_unref (G_OBJECT (priv->comp_listener));
+ gtk_signal_disconnect_by_data (GTK_OBJECT (priv->comp_listener), client);
+ gtk_object_unref (GTK_OBJECT (priv->comp_listener));
priv->comp_listener = NULL;
}
@@ -394,8 +388,8 @@ cal_client_finalize (GObject *object)
g_free (priv);
client->priv = NULL;
- if (G_OBJECT_CLASS (parent_class)->finalize)
- (* G_OBJECT_CLASS (parent_class)->finalize) (object);
+ if (GTK_OBJECT_CLASS (parent_class)->destroy)
+ (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}
@@ -410,7 +404,7 @@ backend_died_cb (EComponentListener *cl, gpointer user_data)
priv = client->priv;
priv->load_state = CAL_CLIENT_LOAD_NOT_LOADED;
- g_signal_emit (G_OBJECT (client), cal_client_signals[BACKEND_DIED], 0);
+ gtk_signal_emit (GTK_OBJECT (client), cal_client_signals[BACKEND_DIED]);
}
/* Signal handlers for the listener's signals */
@@ -454,8 +448,8 @@ cal_opened_cb (CalListener *listener,
/* setup component listener */
priv->comp_listener = e_component_listener_new (priv->cal, 0);
- g_signal_connect (G_OBJECT (priv->comp_listener), "component_died",
- G_CALLBACK (backend_died_cb), client);
+ gtk_signal_connect (GTK_OBJECT (priv->comp_listener), "component_died",
+ GTK_SIGNAL_FUNC (backend_died_cb), client);
goto out;
case GNOME_Evolution_Calendar_Listener_ERROR:
@@ -496,10 +490,10 @@ cal_opened_cb (CalListener *listener,
* signal and clean up.
*/
- g_object_ref (G_OBJECT (client));
+ gtk_object_ref (GTK_OBJECT (client));
- g_signal_emit (G_OBJECT (client), cal_client_signals[CAL_OPENED],
- 0, client_status);
+ gtk_signal_emit (GTK_OBJECT (client), cal_client_signals[CAL_OPENED],
+ client_status);
if (client_status != CAL_CLIENT_OPEN_SUCCESS) {
priv->load_state = CAL_CLIENT_LOAD_NOT_LOADED;
@@ -509,7 +503,7 @@ cal_opened_cb (CalListener *listener,
g_assert (priv->load_state != CAL_CLIENT_LOAD_LOADING);
- g_object_unref (G_OBJECT (client));
+ gtk_object_unref (GTK_OBJECT (client));
}
/* Handle the cal_set_mode notification from the listener */
@@ -548,32 +542,32 @@ cal_set_mode_cb (CalListener *listener,
* signal and clean up.
*/
- g_object_ref (G_OBJECT (client));
+ gtk_object_ref (GTK_OBJECT (client));
- g_signal_emit (G_OBJECT (client), cal_client_signals[CAL_SET_MODE],
- 0, client_status, mode);
+ gtk_signal_emit (GTK_OBJECT (client), cal_client_signals[CAL_SET_MODE],
+ client_status, mode);
- g_object_unref (G_OBJECT (client));
+ gtk_object_unref (GTK_OBJECT (client));
}
/* Handle the obj_updated signal from the listener */
static void
-obj_updated_cb (CalListener *listener, const CORBA_char *uid, gpointer data)
+obj_updated_cb (CalListener *listener, const GNOME_Evolution_Calendar_CalObjUID uid, gpointer data)
{
CalClient *client;
client = CAL_CLIENT (data);
- g_signal_emit (G_OBJECT (client), cal_client_signals[OBJ_UPDATED], 0, uid);
+ gtk_signal_emit (GTK_OBJECT (client), cal_client_signals[OBJ_UPDATED], uid);
}
/* Handle the obj_removed signal from the listener */
static void
-obj_removed_cb (CalListener *listener, const CORBA_char *uid, gpointer data)
+obj_removed_cb (CalListener *listener, const GNOME_Evolution_Calendar_CalObjUID uid, gpointer data)
{
CalClient *client;
client = CAL_CLIENT (data);
- g_signal_emit (G_OBJECT (client), cal_client_signals[OBJ_REMOVED], 0, uid);
+ gtk_signal_emit (GTK_OBJECT (client), cal_client_signals[OBJ_REMOVED], uid);
}
/* Handle the error_occurred signal from the listener */
@@ -583,7 +577,7 @@ backend_error_cb (CalListener *listener, const char *message, gpointer data)
CalClient *client;
client = CAL_CLIENT (data);
- g_signal_emit (G_OBJECT (client), cal_client_signals[BACKEND_ERROR], 0, message);
+ gtk_signal_emit (GTK_OBJECT (client), cal_client_signals[BACKEND_ERROR], message);
}
/* Handle the categories_changed signal from the listener */
@@ -603,7 +597,7 @@ categories_changed_cb (CalListener *listener, const GNOME_Evolution_Calendar_Str
for (i = 0; i < categories->_length; i++)
cats->pdata[i] = categories->_buffer[i];
- g_signal_emit (G_OBJECT (client), cal_client_signals[CATEGORIES_CHANGED], 0, cats);
+ gtk_signal_emit (GTK_OBJECT (client), cal_client_signals[CATEGORIES_CHANGED], cats);
g_ptr_array_free (cats, TRUE);
}
@@ -638,9 +632,9 @@ client_forget_password_cb (WombatClient *w_client,
client = CAL_CLIENT (user_data);
g_return_if_fail (IS_CAL_CLIENT (client));
- g_signal_emit (G_OBJECT (client),
- cal_client_signals [FORGET_PASSWORD],
- 0, key);
+ gtk_signal_emit (GTK_OBJECT (client),
+ cal_client_signals [FORGET_PASSWORD],
+ key);
}
@@ -660,7 +654,7 @@ cal_client_construct (CalClient *client)
{
CalClientPrivate *priv;
GNOME_Evolution_Calendar_CalFactory factory;
- Bonobo_ServerInfoList *servers;
+ OAF_ServerInfoList *servers;
CORBA_Environment ev;
int i;
@@ -671,7 +665,7 @@ cal_client_construct (CalClient *client)
CORBA_exception_init (&ev);
- servers = bonobo_activation_query ("repo_ids.has ('IDL:GNOME/Evolution/Calendar/CalFactory:1.0')", NULL, &ev);
+ servers = oaf_query ("repo_ids.has ('IDL:GNOME/Evolution/Calendar/CalFactory:1.0')", NULL, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
g_message ("Cannot perform OAF query for Calendar servers.");
CORBA_exception_free (&ev);
@@ -682,12 +676,12 @@ cal_client_construct (CalClient *client)
g_warning ("No Calendar servers installed.");
for (i = 0; i < servers->_length; i++) {
- const Bonobo_ServerInfo *info;
+ const OAF_ServerInfo *info;
info = servers->_buffer + i;
factory = (GNOME_Evolution_Calendar_CalFactory)
- bonobo_activation_activate_from_id (info->iid, 0, NULL, &ev);
+ oaf_activate_from_id (info->iid, 0, NULL, &ev);
if (BONOBO_EX (&ev)) {
g_warning ("cal_client_construct: Could not activate calendar server %s", info->iid);
CORBA_free (servers);
@@ -718,11 +712,11 @@ cal_client_new (void)
{
CalClient *client;
- client = g_object_new (CAL_CLIENT_TYPE, NULL);
+ client = gtk_type_new (CAL_CLIENT_TYPE);
if (!cal_client_construct (client)) {
g_message ("cal_client_new(): could not construct the calendar client");
- g_object_unref (G_OBJECT (client));
+ gtk_object_unref (GTK_OBJECT (client));
return NULL;
}
@@ -870,21 +864,31 @@ get_fall_back_uri (gboolean tasks)
static char *
get_default_uri (gboolean tasks)
{
- EConfigListener *db;
+ Bonobo_ConfigDatabase db;
char *uri;
+ CORBA_Environment ev;
- db = e_config_listener_new ();
+ CORBA_exception_init (&ev);
+
+ db = bonobo_get_object ("wombat:", "Bonobo/ConfigDatabase", &ev);
+ if (BONOBO_EX (&ev) || db == CORBA_OBJECT_NIL) {
+ CORBA_exception_free (&ev);
+ return NULL;
+ }
+
if (tasks)
- uri = e_config_listener_get_string (db, "/apps/Evolution/DefaultFolders/tasks_uri");
+ uri = bonobo_config_get_string (db, "/DefaultFolders/tasks_uri", &ev);
else
- uri = e_config_listener_get_string (db, "/apps/Evolution/DefaultFolders/calendar_uri");
- g_object_unref (G_OBJECT (db));
+ uri = bonobo_config_get_string (db, "/DefaultFolders/calendar_uri", &ev);
+ bonobo_object_release_unref (db, NULL);
- if (!uri)
+ if (BONOBO_EX (&ev)) {
+ CORBA_exception_free (&ev);
uri = get_fall_back_uri (tasks);
- else
+ } else {
uri = cal_util_expand_uri (uri, tasks);
+ }
return uri;
}
@@ -1049,8 +1053,8 @@ cal_client_is_read_only (CalClient *client)
CORBA_Environment ev;
CORBA_boolean read_only;
- g_return_val_if_fail (client != NULL, FALSE);
- g_return_val_if_fail (IS_CAL_CLIENT (client), FALSE);
+ g_return_val_if_fail (client != NULL, NULL);
+ g_return_val_if_fail (IS_CAL_CLIENT (client), NULL);
priv = client->priv;
@@ -1242,7 +1246,7 @@ cal_client_get_object (CalClient *client, const char *uid, CalComponent **comp)
*comp = cal_component_new ();
if (!cal_component_set_icalcomponent (*comp, icalcomp)) {
icalcomponent_free (icalcomp);
- g_object_unref (G_OBJECT (*comp));
+ gtk_object_unref (GTK_OBJECT (*comp));
*comp = NULL;
retval = CAL_CLIENT_GET_SYNTAX_ERROR;
@@ -1252,7 +1256,7 @@ cal_client_get_object (CalClient *client, const char *uid, CalComponent **comp)
/* Now make sure we have all timezones needed for this object.
We do this to try to avoid any problems caused by getting a timezone
in the middle of other code. Any calls to ORBit result in a
- recursive call of the GLib main loop, which can cause problems for
+ recursive call of the GTK+ main loop, which can cause problems for
code that doesn't expect it. Currently GnomeCanvas has problems if
we try to get a timezone in the middle of a redraw, and there is a
resize pending, which leads to an assert failure and an abort. */
@@ -1357,7 +1361,7 @@ cal_client_get_timezone (CalClient *client,
tmp_zone = icaltimezone_new ();
if (!tmp_zone) {
/* FIXME: Needs better error code - out of memory. Or just
- abort like GLib does? */
+ abort like GTK+ does? */
retval = CAL_CLIENT_GET_NOT_FOUND;
goto out;
}
@@ -1483,7 +1487,7 @@ build_change_list (GNOME_Evolution_Calendar_CalObjChangeSeq *seq)
ccc->comp = cal_component_new ();
if (!cal_component_set_icalcomponent (ccc->comp, icalcomp)) {
icalcomponent_free (icalcomp);
- g_object_unref (G_OBJECT (ccc->comp));
+ gtk_object_unref (GTK_OBJECT (ccc->comp));
continue;
}
ccc->type = corba_coc->type;
@@ -1678,7 +1682,7 @@ cal_client_get_free_busy (CalClient *client, GList *users,
comp = cal_component_new ();
if (!cal_component_set_icalcomponent (comp, icalcomp)) {
icalcomponent_free (icalcomp);
- g_object_unref (G_OBJECT (comp));
+ gtk_object_unref (GTK_OBJECT (comp));
continue;
}
@@ -1715,7 +1719,7 @@ generate_instances_obj_updated_cb (CalClient *client, const char *uid, gpointer
return;
g_hash_table_remove (uid_comp_hash, uid);
- g_object_unref (G_OBJECT (comp));
+ gtk_object_unref (GTK_OBJECT (comp));
status = cal_client_get_object (client, uid, &comp);
@@ -1752,7 +1756,7 @@ generate_instances_obj_removed_cb (CalClient *client, const char *uid, gpointer
return;
g_hash_table_remove (uid_comp_hash, uid);
- g_object_unref (G_OBJECT (comp));
+ gtk_object_unref (GTK_OBJECT (comp));
}
/* Adds a component to the list; called from g_hash_table_foreach() */
@@ -1789,13 +1793,13 @@ get_objects_atomically (CalClient *client, CalObjType type, time_t start, time_t
/* While we are getting the actual object data, keep track of changes */
- obj_updated_id = g_signal_connect (G_OBJECT (client), "obj_updated",
- G_CALLBACK (generate_instances_obj_updated_cb),
- uid_comp_hash);
+ obj_updated_id = gtk_signal_connect (GTK_OBJECT (client), "obj_updated",
+ GTK_SIGNAL_FUNC (generate_instances_obj_updated_cb),
+ uid_comp_hash);
- obj_removed_id = g_signal_connect (G_OBJECT (client), "obj_removed",
- G_CALLBACK (generate_instances_obj_removed_cb),
- uid_comp_hash);
+ obj_removed_id = gtk_signal_connect (GTK_OBJECT (client), "obj_removed",
+ GTK_SIGNAL_FUNC (generate_instances_obj_removed_cb),
+ uid_comp_hash);
/* Get the objects */
@@ -1838,8 +1842,8 @@ get_objects_atomically (CalClient *client, CalObjType type, time_t start, time_t
* notification signals and generate the final list of components.
*/
- g_signal_handler_disconnect (client, obj_updated_id);
- g_signal_handler_disconnect (client, obj_removed_id);
+ gtk_signal_disconnect (GTK_OBJECT (client), obj_updated_id);
+ gtk_signal_disconnect (GTK_OBJECT (client), obj_removed_id);
objects = NULL;
g_hash_table_foreach (uid_comp_hash, add_component, &objects);
@@ -1866,7 +1870,7 @@ add_instance (CalComponent *comp, time_t start, time_t end, gpointer data)
ci = g_new (struct comp_instance, 1);
ci->comp = comp;
- g_object_ref (G_OBJECT (ci->comp));
+ gtk_object_ref (GTK_OBJECT (ci->comp));
ci->start = start;
ci->end = end;
@@ -1904,7 +1908,7 @@ compare_comp_instance (gconstpointer a, gconstpointer b)
* way so that the generated instances are actually in the server at the time
* the initial cal_client_get_objects_in_range() query ends.
*
- * The callback function should do a g_object_ref() of the calendar component
+ * The callback function should do a gtk_object_ref() of the calendar component
* it gets passed if it intends to keep it around.
**/
void
@@ -1939,7 +1943,7 @@ cal_client_generate_instances (CalClient *client, CalObjType type,
cal_recur_generate_instances (comp, start, end, add_instance, &instances,
cal_client_resolve_tzid_cb, client,
priv->default_zone);
- g_object_unref (G_OBJECT (comp));
+ gtk_object_unref (GTK_OBJECT (comp));
}
g_list_free (objects);
@@ -1966,7 +1970,7 @@ cal_client_generate_instances (CalClient *client, CalObjType type,
struct comp_instance *ci;
ci = l->data;
- g_object_unref (G_OBJECT (ci->comp));
+ gtk_object_unref (GTK_OBJECT (ci->comp));
g_free (ci);
}
@@ -2037,7 +2041,7 @@ build_component_alarms_list (GNOME_Evolution_Calendar_CalComponentAlarmsSeq *seq
comp = cal_component_new ();
if (!cal_component_set_icalcomponent (comp, icalcomp)) {
icalcomponent_free (icalcomp);
- g_object_unref (G_OBJECT (comp));
+ gtk_object_unref (GTK_OBJECT (comp));
continue;
}
@@ -2181,7 +2185,7 @@ cal_client_get_alarms_for_object (CalClient *client, const char *uid,
comp = cal_component_new ();
if (!cal_component_set_icalcomponent (comp, icalcomp)) {
icalcomponent_free (icalcomp);
- g_object_unref (G_OBJECT (comp));
+ gtk_object_unref (GTK_OBJECT (comp));
goto out;
}
diff --git a/calendar/cal-util/cal-component.c b/calendar/cal-util/cal-component.c
index 50c2ad95d8..0990926b08 100644
--- a/calendar/cal-util/cal-component.c
+++ b/calendar/cal-util/cal-component.c
@@ -24,6 +24,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <glib.h>
+#include <libgnome/gnome-defs.h>
#include <libgnome/gnome-i18n.h>
#include "cal-component.h"
#include "timeutil.h"
@@ -178,11 +179,11 @@ struct _CalComponentAlarm {
-static void cal_component_class_init (CalComponentClass *klass);
-static void cal_component_init (CalComponent *comp, CalComponentClass *klass);
-static void cal_component_finalize (GObject *object);
+static void cal_component_class_init (CalComponentClass *class);
+static void cal_component_init (CalComponent *comp);
+static void cal_component_destroy (GtkObject *object);
-static GObjectClass *parent_class;
+static GtkObjectClass *parent_class;
@@ -194,23 +195,24 @@ static GObjectClass *parent_class;
*
* Return value: The type ID of the #CalComponent class.
**/
-GType
+GtkType
cal_component_get_type (void)
{
- static GType cal_component_type = 0;
+ static GtkType cal_component_type = 0;
if (!cal_component_type) {
- static GTypeInfo info = {
- sizeof (CalComponentClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) cal_component_class_init,
- NULL, NULL,
- sizeof (CalComponent),
- 0,
- (GInstanceInitFunc) cal_component_init
- };
- cal_component_type = g_type_register_static (G_TYPE_OBJECT, "CalComponent", &info, 0);
+ static const GtkTypeInfo cal_component_info = {
+ "CalComponent",
+ sizeof (CalComponent),
+ sizeof (CalComponentClass),
+ (GtkClassInitFunc) cal_component_class_init,
+ (GtkObjectInitFunc) cal_component_init,
+ NULL, /* reserved_1 */
+ NULL, /* reserved_2 */
+ (GtkClassInitFunc) NULL
+ };
+
+ cal_component_type = gtk_type_unique (GTK_TYPE_OBJECT, &cal_component_info);
}
return cal_component_type;
@@ -218,20 +220,20 @@ cal_component_get_type (void)
/* Class initialization function for the calendar component object */
static void
-cal_component_class_init (CalComponentClass *klass)
+cal_component_class_init (CalComponentClass *class)
{
- GObjectClass *object_class;
+ GtkObjectClass *object_class;
- object_class = (GObjectClass *) klass;
+ object_class = (GtkObjectClass *) class;
- parent_class = g_type_class_peek_parent (klass);
+ parent_class = gtk_type_class (GTK_TYPE_OBJECT);
- object_class->finalize = cal_component_finalize;
+ object_class->destroy = cal_component_destroy;
}
/* Object initialization function for the calendar component object */
static void
-cal_component_init (CalComponent *comp, CalComponentClass *klass)
+cal_component_init (CalComponent *comp)
{
CalComponentPrivate *priv;
@@ -354,9 +356,9 @@ free_icalcomponent (CalComponent *comp, gboolean free)
priv->need_sequence_inc = FALSE;
}
-/* Finalize handler for the calendar component object */
+/* Destroy handler for the calendar component object */
static void
-cal_component_finalize (GObject *object)
+cal_component_destroy (GtkObject *object)
{
CalComponent *comp;
CalComponentPrivate *priv;
@@ -374,8 +376,8 @@ cal_component_finalize (GObject *object)
g_free (priv);
comp->priv = NULL;
- if (G_OBJECT_CLASS (parent_class)->finalize)
- (* G_OBJECT_CLASS (parent_class)->finalize) (object);
+ if (GTK_OBJECT_CLASS (parent_class)->destroy)
+ (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}
@@ -431,7 +433,7 @@ cal_component_gen_uid (void)
CalComponent *
cal_component_new (void)
{
- return CAL_COMPONENT (g_object_new (CAL_COMPONENT_TYPE, NULL));
+ return CAL_COMPONENT (gtk_type_new (CAL_COMPONENT_TYPE));
}
/**
@@ -3238,7 +3240,7 @@ cal_component_set_recurid (CalComponent *comp, CalComponentRange *recur_id)
set_datetime (comp, &priv->recur_id.recur_time,
icalproperty_new_recurrenceid,
icalproperty_set_recurrenceid,
- &recur_id->datetime);
+ recur_id ? &recur_id->datetime : NULL);
}
/**
@@ -4760,7 +4762,7 @@ cal_component_alarms_free (CalComponentAlarms *alarms)
g_return_if_fail (alarms != NULL);
g_assert (alarms->comp != NULL);
- g_object_unref (G_OBJECT (alarms->comp));
+ gtk_object_unref (GTK_OBJECT (alarms->comp));
for (l = alarms->alarms; l; l = l->next) {
CalAlarmInstance *instance;
diff --git a/calendar/gui/dialogs/comp-editor-util.c b/calendar/gui/dialogs/comp-editor-util.c
index 4e68d52022..35910eeb24 100644
--- a/calendar/gui/dialogs/comp-editor-util.c
+++ b/calendar/gui/dialogs/comp-editor-util.c
@@ -26,11 +26,12 @@
#include <string.h>
#include <ical.h>
#include <glib.h>
-#include <gtk/gtklabel.h>
+#include <libgnome/gnome-defs.h>
#include <libgnome/gnome-i18n.h>
-#include <bonobo-activation/bonobo-activation.h>
+#include <liboaf/liboaf.h>
#include <bonobo/bonobo-control.h>
#include <bonobo/bonobo-widget.h>
+#include <gal/unicode/gunicode.h>
#include <ebook/e-destination.h>
#include <e-util/e-time-utils.h>
#include <cal-util/timeutil.h>
@@ -282,11 +283,11 @@ comp_editor_create_contacts_component (void)
CORBA_Environment ev;
CORBA_exception_init (&ev);
- corba_select_names = bonobo_activation_activate_from_id (SELECT_NAMES_OAFID, 0,
- NULL, &ev);
+ corba_select_names = oaf_activate_from_id (SELECT_NAMES_OAFID, 0,
+ NULL, &ev);
/* OAF seems to be broken -- it can return a CORBA_OBJECT_NIL without
- raising an exception in `ev'. Is this true with BonoboActivation? */
+ raising an exception in `ev'. */
if (ev._major != CORBA_NO_EXCEPTION
|| corba_select_names == CORBA_OBJECT_NIL) {
g_warning ("Cannot activate -- %s", SELECT_NAMES_OAFID);
@@ -337,7 +338,7 @@ comp_editor_create_contacts_control (GNOME_Evolution_Addressbook_SelectNames cor
}
-void
+Bonobo_EventSource_ListenerId
comp_editor_connect_contacts_changed (GtkWidget *contacts_entry,
BonoboListenerCallbackFn changed_cb,
gpointer changed_cb_data)
@@ -348,7 +349,7 @@ comp_editor_connect_contacts_changed (GtkWidget *contacts_entry,
cf = bonobo_widget_get_control_frame (BONOBO_WIDGET (contacts_entry));
pb = bonobo_control_frame_get_control_property_bag (cf, NULL);
- bonobo_event_source_client_add_listener (
+ return bonobo_event_source_client_add_listener (
pb, changed_cb,
"Bonobo/Property:change:entry_changed",
NULL, changed_cb_data);
@@ -380,8 +381,8 @@ parse_contact_string (const char *value, char **name, char **email)
return;
}
- lbracket = g_utf8_strchr (value, g_utf8_strlen (value, 0), '<');
- rbracket = g_utf8_strchr (value, g_utf8_strlen (value, 0), '>');
+ lbracket = g_utf8_strchr (value, '<');
+ rbracket = g_utf8_strchr (value, '>');
if (!lbracket || !rbracket || rbracket < lbracket) {
*name = g_strdup (value);
@@ -446,14 +447,14 @@ comp_editor_contacts_to_widget (GtkWidget *contacts_entry,
#endif
bonobo_widget_set_property (BONOBO_WIDGET (contacts_entry),
- "destinations", TC_CORBA_string, contacts_string, NULL);
+ "destinations", contacts_string, NULL);
g_free (contacts_string);
/* We free all dest_array except the last NULL we added. */
for (i = 0; i < dest_array->len - 1; i++) {
dest = g_ptr_array_index (dest_array, i);
- g_object_unref((dest));
+ gtk_object_unref (GTK_OBJECT (dest));
}
g_ptr_array_free (dest_array, TRUE);
}
@@ -471,12 +472,14 @@ comp_editor_contacts_to_component (GtkWidget *contacts_entry,
int i;
bonobo_widget_get_property (BONOBO_WIDGET (contacts_entry),
- "destinations", TC_CORBA_string, &contacts_string, NULL);
+ "destinations", &contacts_string, NULL);
#if 0
g_print ("Contacts string: %s\n", contacts_string ? contacts_string : "");
#endif
contact_destv = e_destination_importv (contacts_string);
+ g_free (contacts_string);
+
if (contact_destv) {
for (i = 0; contact_destv[i] != NULL; i++) {
name = e_destination_get_name (contact_destv[i]);
@@ -501,7 +504,7 @@ comp_editor_contacts_to_component (GtkWidget *contacts_entry,
contact_list = g_slist_prepend (contact_list, t);
- g_object_unref((contact_destv[i]));
+ gtk_object_unref (GTK_OBJECT (contact_destv[i]));
}
}
g_free (contact_destv);
diff --git a/calendar/gui/dialogs/event-editor.c b/calendar/gui/dialogs/event-editor.c
index 59d639f9b9..113e0142b3 100644
--- a/calendar/gui/dialogs/event-editor.c
+++ b/calendar/gui/dialogs/event-editor.c
@@ -128,7 +128,7 @@ event_editor_class_init (EventEditorClass *klass)
object_class = (GtkObjectClass *) klass;
editor_class = (CompEditorClass *) klass;
- parent_class = g_type_class_ref(TYPE_COMP_EDITOR);
+ parent_class = gtk_type_class (TYPE_COMP_EDITOR);
editor_class->set_cal_client = event_editor_set_cal_client;
editor_class->edit_comp = event_editor_edit_comp;
@@ -182,12 +182,12 @@ init_widgets (EventEditor *ee)
priv = ee->priv;
- g_signal_connect((priv->model), "model_row_changed",
- G_CALLBACK (model_row_changed_cb), ee);
- g_signal_connect((priv->model), "model_rows_inserted",
- G_CALLBACK (row_count_changed_cb), ee);
- g_signal_connect((priv->model), "model_rows_deleted",
- G_CALLBACK (row_count_changed_cb), ee);
+ gtk_signal_connect (GTK_OBJECT (priv->model), "model_row_changed",
+ GTK_SIGNAL_FUNC (model_row_changed_cb), ee);
+ gtk_signal_connect (GTK_OBJECT (priv->model), "model_rows_inserted",
+ GTK_SIGNAL_FUNC (row_count_changed_cb), ee);
+ gtk_signal_connect (GTK_OBJECT (priv->model), "model_rows_deleted",
+ GTK_SIGNAL_FUNC (row_count_changed_cb), ee);
}
/* Object initialization function for the event editor */
@@ -309,7 +309,7 @@ event_editor_edit_comp (CompEditor *editor, CalComponent *comp)
ia = E_MEETING_ATTENDEE (e_meeting_attendee_new_from_cal_component_attendee (ca));
e_meeting_model_add_attendee (priv->model, ia);
- g_object_unref((ia));
+ gtk_object_unref (GTK_OBJECT (ia));
}
if (organizer.value != NULL) {
@@ -363,7 +363,7 @@ event_editor_send_comp (CompEditor *editor, CalComponentItipMethod method)
client = e_meeting_model_get_cal_client (priv->model);
result = itip_send_comp (CAL_COMPONENT_METHOD_CANCEL, comp, client, NULL);
- g_object_unref((comp));
+ gtk_object_unref (GTK_OBJECT (comp));
if (!result)
return FALSE;
@@ -389,14 +389,16 @@ event_editor_destroy (GtkObject *object)
ee = EVENT_EDITOR (object);
priv = ee->priv;
- g_object_unref((priv->event_page));
- g_object_unref((priv->alarm_page));
- g_object_unref((priv->recur_page));
- g_object_unref((priv->meet_page));
- g_object_unref((priv->sched_page));
+ gtk_object_unref (GTK_OBJECT (priv->event_page));
+ gtk_object_unref (GTK_OBJECT (priv->alarm_page));
+ gtk_object_unref (GTK_OBJECT (priv->recur_page));
+ gtk_object_unref (GTK_OBJECT (priv->meet_page));
+ gtk_object_unref (GTK_OBJECT (priv->sched_page));
gtk_object_destroy (GTK_OBJECT (priv->model));
- g_object_unref((priv->model));
+ gtk_object_unref (GTK_OBJECT (priv->model));
+
+ g_free (priv);
if (GTK_OBJECT_CLASS (parent_class)->destroy)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
diff --git a/calendar/gui/dialogs/meeting-page.c b/calendar/gui/dialogs/meeting-page.c
index e97386ae62..6821288b7f 100644
--- a/calendar/gui/dialogs/meeting-page.c
+++ b/calendar/gui/dialogs/meeting-page.c
@@ -31,9 +31,10 @@
#include <gtk/gtktogglebutton.h>
#include <gtk/gtkvbox.h>
#include <gtk/gtkwindow.h>
+#include <libgnome/gnome-defs.h>
#include <libgnome/gnome-i18n.h>
#include <glade/glade.h>
-#include <libgnomeui/gnome-stock-icons.h>
+#include <libgnomeui/gnome-stock.h>
#include <gal/e-table/e-cell-combo.h>
#include <gal/e-table/e-cell-text.h>
#include <gal/e-table/e-table-simple.h>
@@ -163,7 +164,7 @@ meeting_page_class_init (MeetingPageClass *class)
editor_page_class = (CompEditorPageClass *) class;
object_class = (GtkObjectClass *) class;
- parent_class = g_type_class_ref(TYPE_COMP_EDITOR_PAGE);
+ parent_class = gtk_type_class (TYPE_COMP_EDITOR_PAGE);
editor_page_class->get_widget = meeting_page_get_widget;
editor_page_class->focus_main_widget = meeting_page_focus_main_widget;
@@ -230,7 +231,7 @@ cleanup_attendees (GPtrArray *attendees)
int i;
for (i = 0; i < attendees->len; i++)
- g_object_unref((g_ptr_array_index (attendees, i)));
+ gtk_object_unref (GTK_OBJECT (g_ptr_array_index (attendees, i)));
}
/* Destroy handler for the task page */
@@ -247,17 +248,17 @@ meeting_page_destroy (GtkObject *object)
priv = mpage->priv;
if (priv->comp != NULL)
- g_object_unref((priv->comp));
+ gtk_object_unref (GTK_OBJECT (priv->comp));
cleanup_attendees (priv->deleted_attendees);
- g_ptr_array_free (priv->deleted_attendees, FALSE);
+ g_ptr_array_free (priv->deleted_attendees, TRUE);
itip_addresses_free (priv->addresses);
- g_object_unref((priv->model));
+ gtk_object_unref (GTK_OBJECT (priv->model));
if (priv->xml) {
- g_object_unref((priv->xml));
+ gtk_object_unref (GTK_OBJECT (priv->xml));
priv->xml = NULL;
}
@@ -328,7 +329,7 @@ meeting_page_fill_widgets (CompEditorPage *page, CalComponent *comp)
/* Clean out old data */
if (priv->comp != NULL)
- g_object_unref((priv->comp));
+ gtk_object_unref (GTK_OBJECT (priv->comp));
priv->comp = NULL;
cleanup_attendees (priv->deleted_attendees);
@@ -409,7 +410,7 @@ meeting_page_fill_component (CompEditorPage *page, CalComponent *comp)
/* Sanity Check */
if (addr == NULL || strlen (addr) == 0) {
- e_notice (NULL, GTK_MESSAGE_ERROR,
+ e_notice (NULL, GNOME_MESSAGE_BOX_ERROR,
_("An organizer is required."));
g_free (addr);
g_free (cn);
@@ -433,7 +434,7 @@ meeting_page_fill_component (CompEditorPage *page, CalComponent *comp)
}
if (e_meeting_model_count_actual_attendees (priv->model) < 1) {
- e_notice (NULL, GTK_MESSAGE_ERROR,
+ e_notice (NULL, GNOME_MESSAGE_BOX_ERROR,
_("At least one attendee is required."));
return FALSE;
}
@@ -551,15 +552,15 @@ init_widgets (MeetingPage *mpage)
priv = mpage->priv;
/* Organizer */
- g_signal_connect((GTK_COMBO (priv->organizer)->entry), "changed",
- G_CALLBACK (field_changed_cb), mpage);
+ gtk_signal_connect (GTK_OBJECT (GTK_COMBO (priv->organizer)->entry), "changed",
+ GTK_SIGNAL_FUNC (field_changed_cb), mpage);
- g_signal_connect((priv->existing_organizer_btn), "clicked",
- G_CALLBACK (change_clicked_cb), mpage);
+ gtk_signal_connect (GTK_OBJECT (priv->existing_organizer_btn), "clicked",
+ GTK_SIGNAL_FUNC (change_clicked_cb), mpage);
/* Invite button */
- g_signal_connect((priv->invite), "clicked",
- G_CALLBACK (invite_cb), mpage);
+ gtk_signal_connect (GTK_OBJECT (priv->invite), "clicked",
+ GTK_SIGNAL_FUNC (invite_cb), mpage);
}
#if 0
@@ -589,7 +590,7 @@ popup_delegate_cb (GtkWidget *widget, gpointer data)
/* Make sure we can add the new delegatee person */
if (e_meeting_model_find_attendee (priv->model, address, NULL) != NULL) {
- e_notice (NULL, GTK_MESSAGE_ERROR,
+ e_notice (NULL, GNOME_MESSAGE_BOX_ERROR,
_("That person is already attending the meeting!"));
goto cleanup;
}
@@ -600,7 +601,7 @@ popup_delegate_cb (GtkWidget *widget, gpointer data)
ib = e_meeting_model_find_attendee (priv->model, itip_strip_mailto (e_meeting_attendee_get_delto (ia)), NULL);
if (ib != NULL) {
- g_object_ref((ib));
+ gtk_object_ref (GTK_OBJECT (ib));
g_ptr_array_add (priv->deleted_attendees, ib);
e_meeting_model_remove_attendee (priv->model, ib);
@@ -619,7 +620,7 @@ popup_delegate_cb (GtkWidget *widget, gpointer data)
cleanup:
g_free (name);
g_free (address);
- g_object_unref((edd));
+ gtk_object_unref (GTK_OBJECT (edd));
}
#endif
@@ -648,7 +649,7 @@ popup_delete_cb (GtkWidget *widget, gpointer data)
while (ia != NULL) {
EMeetingAttendee *ib = NULL;
- g_object_ref((ia));
+ gtk_object_ref (GTK_OBJECT (ia));
g_ptr_array_add (priv->deleted_attendees, ia);
e_meeting_model_remove_attendee (priv->model, ia);
@@ -665,12 +666,12 @@ enum {
static EPopupMenu context_menu[] = {
#if 0
- E_POPUP_ITEM (N_("_Delegate To..."), G_CALLBACK (popup_delegate_cb), CAN_DELEGATE),
+ E_POPUP_ITEM (N_("_Delegate To..."), GTK_SIGNAL_FUNC (popup_delegate_cb), CAN_DELEGATE),
E_POPUP_SEPARATOR,
#endif
- E_POPUP_ITEM (N_("_Delete"), G_CALLBACK (popup_delete_cb), CAN_DELETE),
+ E_POPUP_ITEM (N_("_Delete"), GTK_SIGNAL_FUNC (popup_delete_cb), CAN_DELETE),
E_POPUP_TERMINATOR
};
@@ -690,10 +691,8 @@ right_click_cb (ETable *etable, gint row, gint col, GdkEvent *event, gpointer da
priv->row = e_meeting_model_etable_view_to_model_row (etable, priv->model, view_row);
/* FIXME: if you enable Delegate, then change index to '1' */
-#if 0
context_menu[0].pixmap_widget = gnome_stock_new_with_icon (GNOME_STOCK_MENU_TRASH);
-#endif
-
+
menu = e_popup_menu_create (context_menu, enable_mask, hide_mask, data);
e_auto_kill_popup_menu_on_hide (menu);
@@ -746,7 +745,7 @@ meeting_page_construct (MeetingPage *mpage, EMeetingModel *emm,
priv = mpage->priv;
priv->xml = glade_xml_new (EVOLUTION_GLADEDIR
- "/meeting-page.glade", NULL, NULL);
+ "/meeting-page.glade", NULL);
if (!priv->xml) {
g_message ("meeting_page_construct(): "
"Could not load the Glade XML file!");
@@ -780,7 +779,7 @@ meeting_page_construct (MeetingPage *mpage, EMeetingModel *emm,
}
/* The etable displaying attendees and their status */
- g_object_ref((emm));
+ gtk_object_ref (GTK_OBJECT (emm));
priv->model = emm;
filename = g_strdup_printf ("%s/config/et-header-meeting-page", evolution_dir);
@@ -790,11 +789,11 @@ meeting_page_construct (MeetingPage *mpage, EMeetingModel *emm,
g_free (filename);
real_table = e_table_scrolled_get_table (priv->etable);
- g_signal_connect((real_table),
- "right_click", G_CALLBACK (right_click_cb), mpage);
+ gtk_signal_connect (GTK_OBJECT (real_table),
+ "right_click", GTK_SIGNAL_FUNC (right_click_cb), mpage);
- g_signal_connect((real_table->table_canvas), "focus_out_event",
- G_CALLBACK (table_canvas_focus_out_cb), mpage);
+ gtk_signal_connect (GTK_OBJECT (real_table->table_canvas), "focus_out_event",
+ GTK_SIGNAL_FUNC (table_canvas_focus_out_cb), mpage);
gtk_widget_show (GTK_WIDGET (priv->etable));
gtk_box_pack_start (GTK_BOX (priv->main), GTK_WIDGET (priv->etable), TRUE, TRUE, 2);
@@ -820,7 +819,7 @@ meeting_page_new (EMeetingModel *emm, CalClient *client)
mpage = gtk_type_new (TYPE_MEETING_PAGE);
if (!meeting_page_construct (mpage, emm, client)) {
- g_object_unref((mpage));
+ gtk_object_unref (GTK_OBJECT (mpage));
return NULL;
}
diff --git a/calendar/gui/e-calendar-table.c b/calendar/gui/e-calendar-table.c
index 29fe7910b0..eae88d5cb5 100644
--- a/calendar/gui/e-calendar-table.c
+++ b/calendar/gui/e-calendar-table.c
@@ -37,6 +37,7 @@
#include <gal/e-table/e-cell-toggle.h>
#include <gal/e-table/e-cell-text.h>
#include <gal/e-table/e-cell-combo.h>
+#include <gal/util/e-unicode-i18n.h>
#include <gal/widgets/e-popup-menu.h>
#include <e-util/e-dialog-utils.h>
#include <widgets/misc/e-cell-date-edit.h>
@@ -344,11 +345,11 @@ e_calendar_table_init (ECalendarTable *cal_table)
* Normal string fields.
*/
cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT);
- g_object_set (G_OBJECT (cell),
- "strikeout_column", CAL_COMPONENT_FIELD_COMPLETE,
- "bold_column", CAL_COMPONENT_FIELD_OVERDUE,
- "color_column", CAL_COMPONENT_FIELD_COLOR,
- NULL);
+ gtk_object_set (GTK_OBJECT (cell),
+ "strikeout_column", CAL_COMPONENT_FIELD_COMPLETE,
+ "bold_column", CAL_COMPONENT_FIELD_OVERDUE,
+ "color_column", CAL_COMPONENT_FIELD_COLOR,
+ NULL);
e_table_extras_add_cell (extras, "calstring", cell);
@@ -357,15 +358,15 @@ e_calendar_table_init (ECalendarTable *cal_table)
* Date fields.
*/
cell = e_cell_date_edit_text_new (NULL, GTK_JUSTIFY_LEFT);
- g_object_set (G_OBJECT (cell),
- "strikeout_column", CAL_COMPONENT_FIELD_COMPLETE,
- "bold_column", CAL_COMPONENT_FIELD_OVERDUE,
- "color_column", CAL_COMPONENT_FIELD_COLOR,
- NULL);
+ gtk_object_set (GTK_OBJECT (cell),
+ "strikeout_column", CAL_COMPONENT_FIELD_COMPLETE,
+ "bold_column", CAL_COMPONENT_FIELD_OVERDUE,
+ "color_column", CAL_COMPONENT_FIELD_COLOR,
+ NULL);
popup_cell = e_cell_date_edit_new ();
e_cell_popup_set_child (E_CELL_POPUP (popup_cell), cell);
- g_object_unref (cell);
+ gtk_object_unref (GTK_OBJECT (cell));
e_table_extras_add_cell (extras, "dateedit", popup_cell);
cal_table->dates_cell = E_CELL_DATE_EDIT (popup_cell);
@@ -380,21 +381,21 @@ e_calendar_table_init (ECalendarTable *cal_table)
/* Classification field. */
cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT);
- g_object_set (G_OBJECT (cell),
- "strikeout_column", CAL_COMPONENT_FIELD_COMPLETE,
- "bold_column", CAL_COMPONENT_FIELD_OVERDUE,
- "color_column", CAL_COMPONENT_FIELD_COLOR,
- "editable", FALSE,
- NULL);
+ gtk_object_set (GTK_OBJECT (cell),
+ "strikeout_column", CAL_COMPONENT_FIELD_COMPLETE,
+ "bold_column", CAL_COMPONENT_FIELD_OVERDUE,
+ "color_column", CAL_COMPONENT_FIELD_COLOR,
+ "editable", FALSE,
+ NULL);
popup_cell = e_cell_combo_new ();
e_cell_popup_set_child (E_CELL_POPUP (popup_cell), cell);
- g_object_unref (cell);
+ gtk_object_unref (GTK_OBJECT (cell));
strings = NULL;
- strings = g_list_append (strings, (char*) _("Public"));
- strings = g_list_append (strings, (char*) _("Private"));
- strings = g_list_append (strings, (char*) _("Confidential"));
+ strings = g_list_append (strings, (char*) U_("Public"));
+ strings = g_list_append (strings, (char*) U_("Private"));
+ strings = g_list_append (strings, (char*) U_("Confidential"));
e_cell_combo_set_popdown_strings (E_CELL_COMBO (popup_cell),
strings);
@@ -402,22 +403,22 @@ e_calendar_table_init (ECalendarTable *cal_table)
/* Priority field. */
cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT);
- g_object_set (G_OBJECT (cell),
- "strikeout_column", CAL_COMPONENT_FIELD_COMPLETE,
- "bold_column", CAL_COMPONENT_FIELD_OVERDUE,
- "color_column", CAL_COMPONENT_FIELD_COLOR,
- "editable", FALSE,
- NULL);
+ gtk_object_set (GTK_OBJECT (cell),
+ "strikeout_column", CAL_COMPONENT_FIELD_COMPLETE,
+ "bold_column", CAL_COMPONENT_FIELD_OVERDUE,
+ "color_column", CAL_COMPONENT_FIELD_COLOR,
+ "editable", FALSE,
+ NULL);
popup_cell = e_cell_combo_new ();
e_cell_popup_set_child (E_CELL_POPUP (popup_cell), cell);
- g_object_unref (cell);
+ gtk_object_unref (GTK_OBJECT (cell));
strings = NULL;
- strings = g_list_append (strings, (char*) _("High"));
- strings = g_list_append (strings, (char*) _("Normal"));
- strings = g_list_append (strings, (char*) _("Low"));
- strings = g_list_append (strings, (char*) _("Undefined"));
+ strings = g_list_append (strings, (char*) U_("High"));
+ strings = g_list_append (strings, (char*) U_("Normal"));
+ strings = g_list_append (strings, (char*) U_("Low"));
+ strings = g_list_append (strings, (char*) U_("Undefined"));
e_cell_combo_set_popdown_strings (E_CELL_COMBO (popup_cell),
strings);
@@ -425,28 +426,28 @@ e_calendar_table_init (ECalendarTable *cal_table)
/* Percent field. */
cell = e_cell_percent_new (NULL, GTK_JUSTIFY_LEFT);
- g_object_set (G_OBJECT (cell),
- "strikeout_column", CAL_COMPONENT_FIELD_COMPLETE,
- "bold_column", CAL_COMPONENT_FIELD_OVERDUE,
- "color_column", CAL_COMPONENT_FIELD_COLOR,
- NULL);
+ gtk_object_set (GTK_OBJECT (cell),
+ "strikeout_column", CAL_COMPONENT_FIELD_COMPLETE,
+ "bold_column", CAL_COMPONENT_FIELD_OVERDUE,
+ "color_column", CAL_COMPONENT_FIELD_COLOR,
+ NULL);
popup_cell = e_cell_combo_new ();
e_cell_popup_set_child (E_CELL_POPUP (popup_cell), cell);
- g_object_unref (cell);
+ gtk_object_unref (GTK_OBJECT (cell));
strings = NULL;
- strings = g_list_append (strings, (char*) _("0%"));
- strings = g_list_append (strings, (char*) _("10%"));
- strings = g_list_append (strings, (char*) _("20%"));
- strings = g_list_append (strings, (char*) _("30%"));
- strings = g_list_append (strings, (char*) _("40%"));
- strings = g_list_append (strings, (char*) _("50%"));
- strings = g_list_append (strings, (char*) _("60%"));
- strings = g_list_append (strings, (char*) _("70%"));
- strings = g_list_append (strings, (char*) _("80%"));
- strings = g_list_append (strings, (char*) _("90%"));
- strings = g_list_append (strings, (char*) _("100%"));
+ strings = g_list_append (strings, (char*) U_("0%"));
+ strings = g_list_append (strings, (char*) U_("10%"));
+ strings = g_list_append (strings, (char*) U_("20%"));
+ strings = g_list_append (strings, (char*) U_("30%"));
+ strings = g_list_append (strings, (char*) U_("40%"));
+ strings = g_list_append (strings, (char*) U_("50%"));
+ strings = g_list_append (strings, (char*) U_("60%"));
+ strings = g_list_append (strings, (char*) U_("70%"));
+ strings = g_list_append (strings, (char*) U_("80%"));
+ strings = g_list_append (strings, (char*) U_("90%"));
+ strings = g_list_append (strings, (char*) U_("100%"));
e_cell_combo_set_popdown_strings (E_CELL_COMBO (popup_cell),
strings);
@@ -454,20 +455,20 @@ e_calendar_table_init (ECalendarTable *cal_table)
/* Transparency field. */
cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT);
- g_object_set (G_OBJECT (cell),
- "strikeout_column", CAL_COMPONENT_FIELD_COMPLETE,
- "bold_column", CAL_COMPONENT_FIELD_OVERDUE,
- "color_column", CAL_COMPONENT_FIELD_COLOR,
- "editable", FALSE,
- NULL);
+ gtk_object_set (GTK_OBJECT (cell),
+ "strikeout_column", CAL_COMPONENT_FIELD_COMPLETE,
+ "bold_column", CAL_COMPONENT_FIELD_OVERDUE,
+ "color_column", CAL_COMPONENT_FIELD_COLOR,
+ "editable", FALSE,
+ NULL);
popup_cell = e_cell_combo_new ();
e_cell_popup_set_child (E_CELL_POPUP (popup_cell), cell);
- g_object_unref (cell);
+ gtk_object_unref (GTK_OBJECT (cell));
strings = NULL;
- strings = g_list_append (strings, (char*) _("Free"));
- strings = g_list_append (strings, (char*) _("Busy"));
+ strings = g_list_append (strings, (char*) U_("Free"));
+ strings = g_list_append (strings, (char*) U_("Busy"));
e_cell_combo_set_popdown_strings (E_CELL_COMBO (popup_cell),
strings);
@@ -475,22 +476,22 @@ e_calendar_table_init (ECalendarTable *cal_table)
/* Status field. */
cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT);
- g_object_set (G_OBJECT (cell),
- "strikeout_column", CAL_COMPONENT_FIELD_COMPLETE,
- "bold_column", CAL_COMPONENT_FIELD_OVERDUE,
- "color_column", CAL_COMPONENT_FIELD_COLOR,
- "editable", FALSE,
- NULL);
+ gtk_object_set (GTK_OBJECT (cell),
+ "strikeout_column", CAL_COMPONENT_FIELD_COMPLETE,
+ "bold_column", CAL_COMPONENT_FIELD_OVERDUE,
+ "color_column", CAL_COMPONENT_FIELD_COLOR,
+ "editable", FALSE,
+ NULL);
popup_cell = e_cell_combo_new ();
e_cell_popup_set_child (E_CELL_POPUP (popup_cell), cell);
- g_object_unref (cell);
+ gtk_object_unref (GTK_OBJECT (cell));
strings = NULL;
- strings = g_list_append (strings, (char*) _("Not Started"));
- strings = g_list_append (strings, (char*) _("In Progress"));
- strings = g_list_append (strings, (char*) _("Completed"));
- strings = g_list_append (strings, (char*) _("Cancelled"));
+ strings = g_list_append (strings, (char*) U_("Not Started"));
+ strings = g_list_append (strings, (char*) U_("In Progress"));
+ strings = g_list_append (strings, (char*) U_("Completed"));
+ strings = g_list_append (strings, (char*) U_("Cancelled"));
e_cell_combo_set_popdown_strings (E_CELL_COMBO (popup_cell),
strings);
@@ -531,7 +532,7 @@ e_calendar_table_init (ECalendarTable *cal_table)
extras,
EVOLUTION_ETSPECDIR "/e-calendar-table.etspec",
NULL);
- g_object_unref (extras);
+ gtk_object_unref (GTK_OBJECT (extras));
cal_table->etable = table;
gtk_table_attach (GTK_TABLE (cal_table), table, 0, 1, 0, 1,
@@ -540,9 +541,15 @@ e_calendar_table_init (ECalendarTable *cal_table)
e_table = e_table_scrolled_get_table (E_TABLE_SCROLLED (table));
- g_signal_connect (e_table, "double_click", G_CALLBACK (e_calendar_table_on_double_click), cal_table);
- g_signal_connect (e_table, "right_click", G_CALLBACK (e_calendar_table_on_right_click), cal_table);
- g_signal_connect (e_table, "key_press", G_CALLBACK (e_calendar_table_on_key_press), cal_table);
+ gtk_signal_connect (GTK_OBJECT (e_table), "double_click",
+ GTK_SIGNAL_FUNC (e_calendar_table_on_double_click),
+ cal_table);
+ gtk_signal_connect (GTK_OBJECT (e_table), "right_click",
+ GTK_SIGNAL_FUNC (e_calendar_table_on_right_click),
+ cal_table);
+ gtk_signal_connect (GTK_OBJECT (e_table), "key_press",
+ GTK_SIGNAL_FUNC (e_calendar_table_on_key_press),
+ cal_table);
/* Set up the invisible widget for the clipboard selections */
cal_table->invisible = gtk_invisible_new ();
@@ -550,15 +557,22 @@ e_calendar_table_init (ECalendarTable *cal_table)
clipboard_atom,
GDK_SELECTION_TYPE_STRING,
0);
- g_signal_connect (cal_table->invisible, "selection_get",
- G_CALLBACK (selection_get), cal_table);
- g_signal_connect (cal_table->invisible, "selection_clear_event",
- G_CALLBACK (selection_clear_event), cal_table);
- g_signal_connect (cal_table->invisible, "selection_received",
- G_CALLBACK (selection_received), cal_table);
- g_signal_connect (cal_table->invisible, "destroy",
- G_CALLBACK (invisible_destroyed), cal_table);
-
+ gtk_signal_connect (GTK_OBJECT (cal_table->invisible),
+ "selection_get",
+ GTK_SIGNAL_FUNC (selection_get),
+ (gpointer) cal_table);
+ gtk_signal_connect (GTK_OBJECT (cal_table->invisible),
+ "selection_clear_event",
+ GTK_SIGNAL_FUNC (selection_clear_event),
+ (gpointer) cal_table);
+ gtk_signal_connect (GTK_OBJECT (cal_table->invisible),
+ "selection_received",
+ GTK_SIGNAL_FUNC (selection_received),
+ (gpointer) cal_table);
+ gtk_signal_connect (GTK_OBJECT (cal_table->invisible),
+ "destroy",
+ GTK_SIGNAL_FUNC (invisible_destroyed),
+ (gpointer) cal_table);
cal_table->clipboard_selection = NULL;
}
@@ -574,7 +588,7 @@ e_calendar_table_new (void)
{
GtkWidget *cal_table;
- cal_table = GTK_WIDGET (g_object_new (e_calendar_table_get_type (), NULL));
+ cal_table = GTK_WIDGET (gtk_type_new (e_calendar_table_get_type ()));
return cal_table;
}
@@ -605,7 +619,7 @@ e_calendar_table_destroy (GtkObject *object)
cal_table = E_CALENDAR_TABLE (object);
- g_object_unref (cal_table->model);
+ gtk_object_unref (GTK_OBJECT (cal_table->model));
cal_table->model = NULL;
if (cal_table->invisible)
@@ -1196,6 +1210,7 @@ e_calendar_table_save_state (ECalendarTable *cal_table,
static void
invisible_destroyed (GtkWidget *invisible, ECalendarTable *cal_table)
{
+ gtk_object_unref (GTK_OBJECT (cal_table->invisible));
cal_table->invisible = NULL;
}
@@ -1287,7 +1302,7 @@ selection_received (GtkWidget *invisible,
calendar_model_get_cal_client (cal_table->model),
tmp_comp);
free (uid);
- g_object_unref (tmp_comp);
+ gtk_object_unref (GTK_OBJECT (tmp_comp));
}
subcomp = icalcomponent_get_next_component (
vcal_comp, ICAL_ANY_COMPONENT);
@@ -1303,7 +1318,7 @@ selection_received (GtkWidget *invisible,
cal_client_update_object (
calendar_model_get_cal_client (cal_table->model),
comp);
- g_object_unref (comp);
+ gtk_object_unref (GTK_OBJECT (comp));
}
calendar_model_set_status_message (e_calendar_table_get_model (cal_table), NULL);
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c
index e7d1888d34..492103be00 100644
--- a/calendar/gui/e-day-view.c
+++ b/calendar/gui/e-day-view.c
@@ -42,10 +42,9 @@
#include <gtk/gtkwindow.h>
#include <gal/e-text/e-text.h>
#include <gal/widgets/e-canvas-utils.h>
-#include <gal/widgets/e-popup-menu.h>
#include <gal/widgets/e-gui-utils.h>
#include <gal/widgets/e-unicode.h>
-#include <libgnomecanvas/gnome-canvas-rect-ellipse.h>
+#include <libgnomeui/gnome-canvas-rect-ellipse.h>
#include <libgnome/gnome-i18n.h>
#include <libgnome/gnome-exec.h>
#include <libgnome/gnome-util.h>
@@ -515,11 +514,12 @@ e_day_view_class_init (EDayViewClass *class)
e_day_view_signals[SELECTION_CHANGED] =
gtk_signal_new ("selection_changed",
GTK_RUN_LAST,
- G_TYPE_FROM_CLASS (object_class),
+ object_class->type,
GTK_SIGNAL_OFFSET (EDayViewClass, selection_changed),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
+ gtk_object_class_add_signals (object_class, e_day_view_signals, LAST_SIGNAL);
/* Method override */
object_class->destroy = e_day_view_destroy;
@@ -646,25 +646,39 @@ e_day_view_init (EDayView *day_view)
gtk_table_attach (GTK_TABLE (day_view), day_view->top_canvas,
1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0);
gtk_widget_show (day_view->top_canvas);
- g_signal_connect_after (day_view->top_canvas, "button_press_event",
- G_CALLBACK (e_day_view_on_top_canvas_button_press), day_view);
- g_signal_connect_after (day_view->top_canvas, "button_release_event",
- G_CALLBACK (e_day_view_on_top_canvas_button_release), day_view);
- g_signal_connect_after (day_view->top_canvas, "motion_notify_event",
- G_CALLBACK (e_day_view_on_top_canvas_motion), day_view);
- g_signal_connect_after (day_view->top_canvas, "drag_motion",
- G_CALLBACK (e_day_view_on_top_canvas_drag_motion), day_view);
- g_signal_connect_after (day_view->top_canvas, "drag_leave",
- G_CALLBACK (e_day_view_on_top_canvas_drag_leave), day_view);
-
- g_signal_connect (day_view->top_canvas, "drag_begin",
- G_CALLBACK (e_day_view_on_drag_begin), day_view);
- g_signal_connect (day_view->top_canvas, "drag_end",
- G_CALLBACK (e_day_view_on_drag_end), day_view);
- g_signal_connect (day_view->top_canvas, "drag_data_get",
- G_CALLBACK (e_day_view_on_drag_data_get), day_view);
- g_signal_connect (day_view->top_canvas, "drag_data_received",
- G_CALLBACK (e_day_view_on_top_canvas_drag_data_received), day_view);
+ gtk_signal_connect_after (GTK_OBJECT (day_view->top_canvas), "button_press_event",
+ GTK_SIGNAL_FUNC (e_day_view_on_top_canvas_button_press),
+ day_view);
+ gtk_signal_connect_after (GTK_OBJECT (day_view->top_canvas), "button_release_event",
+ GTK_SIGNAL_FUNC (e_day_view_on_top_canvas_button_release),
+ day_view);
+ gtk_signal_connect_after (GTK_OBJECT (day_view->top_canvas), "motion_notify_event",
+ GTK_SIGNAL_FUNC (e_day_view_on_top_canvas_motion),
+ day_view);
+ gtk_signal_connect_after (GTK_OBJECT (day_view->top_canvas),
+ "drag_motion",
+ GTK_SIGNAL_FUNC (e_day_view_on_top_canvas_drag_motion),
+ day_view);
+ gtk_signal_connect_after (GTK_OBJECT (day_view->top_canvas),
+ "drag_leave",
+ GTK_SIGNAL_FUNC (e_day_view_on_top_canvas_drag_leave),
+ day_view);
+ gtk_signal_connect (GTK_OBJECT (day_view->top_canvas),
+ "drag_begin",
+ GTK_SIGNAL_FUNC (e_day_view_on_drag_begin),
+ day_view);
+ gtk_signal_connect (GTK_OBJECT (day_view->top_canvas),
+ "drag_end",
+ GTK_SIGNAL_FUNC (e_day_view_on_drag_end),
+ day_view);
+ gtk_signal_connect (GTK_OBJECT (day_view->top_canvas),
+ "drag_data_get",
+ GTK_SIGNAL_FUNC (e_day_view_on_drag_data_get),
+ day_view);
+ gtk_signal_connect (GTK_OBJECT (day_view->top_canvas),
+ "drag_data_received",
+ GTK_SIGNAL_FUNC (e_day_view_on_top_canvas_drag_data_received),
+ day_view);
canvas_group = GNOME_CANVAS_GROUP (GNOME_CANVAS (day_view->top_canvas)->root);
@@ -708,38 +722,45 @@ e_day_view_init (EDayView *day_view)
1, 2, 1, 2,
GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_widget_show (day_view->main_canvas);
- g_signal_connect (day_view->main_canvas, "realize",
- G_CALLBACK (e_day_view_on_canvas_realized), day_view);
-
- g_signal_connect_after (day_view->main_canvas,
+ gtk_signal_connect (GTK_OBJECT (day_view->main_canvas), "realize",
+ GTK_SIGNAL_FUNC (e_day_view_on_canvas_realized),
+ day_view);
+ gtk_signal_connect_after (GTK_OBJECT (day_view->main_canvas),
"button_press_event",
- G_CALLBACK (e_day_view_on_main_canvas_button_press),
+ GTK_SIGNAL_FUNC (e_day_view_on_main_canvas_button_press),
day_view);
- g_signal_connect_after (day_view->main_canvas,
+ gtk_signal_connect_after (GTK_OBJECT (day_view->main_canvas),
"button_release_event",
- G_CALLBACK (e_day_view_on_main_canvas_button_release),
+ GTK_SIGNAL_FUNC (e_day_view_on_main_canvas_button_release),
day_view);
- g_signal_connect_after (day_view->main_canvas,
+ gtk_signal_connect_after (GTK_OBJECT (day_view->main_canvas),
"motion_notify_event",
- G_CALLBACK (e_day_view_on_main_canvas_motion),
+ GTK_SIGNAL_FUNC (e_day_view_on_main_canvas_motion),
day_view);
- g_signal_connect_after (day_view->main_canvas,
+ gtk_signal_connect_after (GTK_OBJECT (day_view->main_canvas),
"drag_motion",
- G_CALLBACK (e_day_view_on_main_canvas_drag_motion),
+ GTK_SIGNAL_FUNC (e_day_view_on_main_canvas_drag_motion),
day_view);
- g_signal_connect_after (day_view->main_canvas,
+ gtk_signal_connect_after (GTK_OBJECT (day_view->main_canvas),
"drag_leave",
- G_CALLBACK (e_day_view_on_main_canvas_drag_leave),
+ GTK_SIGNAL_FUNC (e_day_view_on_main_canvas_drag_leave),
day_view);
-
- g_signal_connect (day_view->main_canvas, "drag_begin",
- G_CALLBACK (e_day_view_on_drag_begin), day_view);
- g_signal_connect (day_view->main_canvas, "drag_end",
- G_CALLBACK (e_day_view_on_drag_end), day_view);
- g_signal_connect (day_view->main_canvas, "drag_data_get",
- G_CALLBACK (e_day_view_on_drag_data_get), day_view);
- g_signal_connect (day_view->main_canvas, "drag_data_received",
- G_CALLBACK (e_day_view_on_main_canvas_drag_data_received), day_view);
+ gtk_signal_connect (GTK_OBJECT (day_view->main_canvas),
+ "drag_begin",
+ GTK_SIGNAL_FUNC (e_day_view_on_drag_begin),
+ day_view);
+ gtk_signal_connect (GTK_OBJECT (day_view->main_canvas),
+ "drag_end",
+ GTK_SIGNAL_FUNC (e_day_view_on_drag_end),
+ day_view);
+ gtk_signal_connect (GTK_OBJECT (day_view->main_canvas),
+ "drag_data_get",
+ GTK_SIGNAL_FUNC (e_day_view_on_drag_data_get),
+ day_view);
+ gtk_signal_connect (GTK_OBJECT (day_view->main_canvas),
+ "drag_data_received",
+ GTK_SIGNAL_FUNC (e_day_view_on_main_canvas_drag_data_received),
+ day_view);
canvas_group = GNOME_CANVAS_GROUP (GNOME_CANVAS (day_view->main_canvas)->root);
@@ -813,8 +834,10 @@ e_day_view_init (EDayView *day_view)
0, 1, 1, 2,
GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
gtk_widget_show (day_view->time_canvas);
- g_signal_connect_after (day_view->time_canvas, "button_press_event",
- G_CALLBACK (e_day_view_on_time_canvas_button_press), day_view);
+ gtk_signal_connect_after (GTK_OBJECT (day_view->time_canvas),
+ "button_press_event",
+ GTK_SIGNAL_FUNC (e_day_view_on_time_canvas_button_press),
+ day_view);
canvas_group = GNOME_CANVAS_GROUP (GNOME_CANVAS (day_view->time_canvas)->root);
@@ -858,15 +881,22 @@ e_day_view_init (EDayView *day_view)
clipboard_atom,
GDK_SELECTION_TYPE_STRING,
0);
- g_signal_connect (day_view->invisible, "selection_get",
- G_CALLBACK (selection_get), (gpointer) day_view);
- g_signal_connect (day_view->invisible, "selection_clear_event",
- G_CALLBACK (selection_clear_event), (gpointer) day_view);
- g_signal_connect (day_view->invisible, "selection_received",
- G_CALLBACK (selection_received), (gpointer) day_view);
- g_signal_connect (day_view->invisible, "destroy",
- G_CALLBACK (invisible_destroyed), (gpointer) day_view);
-
+ gtk_signal_connect (GTK_OBJECT (day_view->invisible),
+ "selection_get",
+ GTK_SIGNAL_FUNC (selection_get),
+ (gpointer) day_view);
+ gtk_signal_connect (GTK_OBJECT (day_view->invisible),
+ "selection_clear_event",
+ GTK_SIGNAL_FUNC (selection_clear_event),
+ (gpointer) day_view);
+ gtk_signal_connect (GTK_OBJECT (day_view->invisible),
+ "selection_received",
+ GTK_SIGNAL_FUNC (selection_received),
+ (gpointer) day_view);
+ gtk_signal_connect (GTK_OBJECT (day_view->invisible),
+ "destroy",
+ GTK_SIGNAL_FUNC (invisible_destroyed),
+ (gpointer) day_view);
day_view->clipboard_selection = NULL;
day_view->activity = NULL;
@@ -895,7 +925,7 @@ e_day_view_new (void)
{
GtkWidget *day_view;
- day_view = GTK_WIDGET (g_object_new (e_day_view_get_type (), NULL));
+ day_view = GTK_WIDGET (gtk_type_new (e_day_view_get_type ()));
return day_view;
}
@@ -915,7 +945,7 @@ e_day_view_destroy (GtkObject *object)
if (day_view->client) {
gtk_signal_disconnect_by_data (GTK_OBJECT (day_view->client), day_view);
- g_object_unref (day_view->client);
+ gtk_object_unref (GTK_OBJECT (day_view->client));
day_view->client = NULL;
}
@@ -926,7 +956,7 @@ e_day_view_destroy (GtkObject *object)
if (day_view->query) {
gtk_signal_disconnect_by_data (GTK_OBJECT (day_view->query), day_view);
- g_object_unref (day_view->query);
+ gtk_object_unref (GTK_OBJECT (day_view->query));
day_view->query = NULL;
}
@@ -961,7 +991,7 @@ e_day_view_destroy (GtkObject *object)
}
if (day_view->activity) {
- g_object_unref (day_view->activity);
+ gtk_object_unref (GTK_OBJECT (day_view->activity));
day_view->activity = NULL;
}
@@ -1107,7 +1137,8 @@ e_day_view_unrealize (GtkWidget *widget)
day_view->main_gc = NULL;
colormap = gtk_widget_get_colormap (widget);
- gdk_colormap_free_colors (colormap, day_view->colors, E_DAY_VIEW_COLOR_LAST);
+ for (i = 0; i < E_DAY_VIEW_COLOR_LAST; i++)
+ gdk_colors_free (colormap, &day_view->colors[i].pixel, 1, 0);
gdk_pixmap_unref (day_view->reminder_icon);
day_view->reminder_icon = NULL;
@@ -1139,7 +1170,7 @@ e_day_view_style_set (GtkWidget *widget,
(*GTK_WIDGET_CLASS (parent_class)->style_set)(widget, previous_style);
day_view = E_DAY_VIEW (widget);
- font = gtk_style_get_font (gtk_widget_get_style (widget));
+ font = widget->style->font;
/* Create the large font. */
if (day_view->large_font != NULL)
@@ -1255,10 +1286,12 @@ e_day_view_style_set (GtkWidget *widget,
/* Set the fonts for the text items used when dragging. */
gnome_canvas_item_set (day_view->drag_long_event_item,
- "font_gdk", font, NULL);
+ "font_gdk", GTK_WIDGET (day_view)->style->font,
+ NULL);
gnome_canvas_item_set (day_view->drag_item,
- "font_gdk", font, NULL);
+ "font_gdk", GTK_WIDGET (day_view)->style->font,
+ NULL);
}
@@ -1351,7 +1384,7 @@ e_day_view_recalc_cell_sizes (EDayView *day_view)
char buffer[128];
g_return_if_fail (((GtkWidget*)day_view)->style != NULL);
- font = gtk_style_get_font (gtk_widget_get_style (GTK_WIDGET (day_view)));
+ font = GTK_WIDGET (day_view)->style->font;
/* Calculate the column sizes, using floating point so that pixels
get divided evenly. Note that we use one more element than the
@@ -1438,12 +1471,9 @@ e_day_view_focus_in (GtkWidget *widget, GdkEventFocus *event)
gtk_widget_queue_draw (day_view->main_canvas);
g_assert (GTK_WIDGET_REALIZED (day_view->main_canvas));
-#if 0
- /* FIXME when gal is fixed */
if (E_CANVAS (day_view->main_canvas)->ic)
gdk_im_begin (E_CANVAS (day_view->main_canvas)->ic,
GTK_LAYOUT (day_view->main_canvas)->bin_window);
-#endif
return FALSE;
}
@@ -1466,12 +1496,8 @@ e_day_view_focus_out (GtkWidget *widget, GdkEventFocus *event)
gtk_widget_queue_draw (day_view->main_canvas);
g_assert (GTK_WIDGET_REALIZED (day_view->main_canvas));
-
-#if 0
- /* FIXME when gal is fixed */
if (E_CANVAS (day_view->main_canvas)->ic)
gdk_im_end ();
-#endif
return FALSE;
}
@@ -1544,7 +1570,7 @@ query_obj_updated_cb (CalQuery *query, const char *uid,
g_print ("updated object's dates unchanged\n");
#endif
e_day_view_foreach_event_with_uid (day_view, uid, e_day_view_update_event_cb, comp);
- g_object_unref (comp);
+ gtk_object_unref (GTK_OBJECT (comp));
gtk_widget_queue_draw (day_view->top_canvas);
gtk_widget_queue_draw (day_view->main_canvas);
return;
@@ -1566,7 +1592,7 @@ query_obj_updated_cb (CalQuery *query, const char *uid,
e_day_view_add_event, day_view,
cal_client_resolve_tzid_cb, day_view->client,
day_view->zone);
- g_object_unref (comp);
+ gtk_object_unref (GTK_OBJECT (comp));
e_day_view_queue_layout (day_view);
}
@@ -1672,7 +1698,7 @@ update_query (EDayView *day_view)
if (old_query) {
gtk_signal_disconnect_by_data (GTK_OBJECT (old_query), day_view);
- g_object_unref (old_query);
+ gtk_object_unref (GTK_OBJECT (old_query));
}
g_assert (day_view->sexp != NULL);
@@ -1690,14 +1716,14 @@ update_query (EDayView *day_view)
return;
}
- g_signal_connect (day_view->query, "obj_updated",
- G_CALLBACK (query_obj_updated_cb), day_view);
- g_signal_connect (day_view->query, "obj_removed",
- G_CALLBACK (query_obj_removed_cb), day_view);
- g_signal_connect (day_view->query, "query_done",
- G_CALLBACK (query_query_done_cb), day_view);
- g_signal_connect (day_view->query, "eval_error",
- G_CALLBACK (query_eval_error_cb), day_view);
+ gtk_signal_connect (GTK_OBJECT (day_view->query), "obj_updated",
+ GTK_SIGNAL_FUNC (query_obj_updated_cb), day_view);
+ gtk_signal_connect (GTK_OBJECT (day_view->query), "obj_removed",
+ GTK_SIGNAL_FUNC (query_obj_removed_cb), day_view);
+ gtk_signal_connect (GTK_OBJECT (day_view->query), "query_done",
+ GTK_SIGNAL_FUNC (query_query_done_cb), day_view);
+ gtk_signal_connect (GTK_OBJECT (day_view->query), "eval_error",
+ GTK_SIGNAL_FUNC (query_eval_error_cb), day_view);
}
/* Callback used when the calendar client finishes opening */
@@ -1735,11 +1761,11 @@ e_day_view_set_cal_client (EDayView *day_view,
g_return_if_fail (IS_CAL_CLIENT (client));
if (client)
- g_object_ref (client);
+ gtk_object_ref (GTK_OBJECT (client));
if (day_view->client) {
gtk_signal_disconnect_by_data (GTK_OBJECT (day_view->client), day_view);
- g_object_unref (day_view->client);
+ gtk_object_unref (GTK_OBJECT (day_view->client));
}
day_view->client = client;
@@ -1748,8 +1774,8 @@ e_day_view_set_cal_client (EDayView *day_view,
if (cal_client_get_load_state (day_view->client) == CAL_CLIENT_LOAD_LOADED)
update_query (day_view);
else
- g_signal_connect (day_view->client, "cal_opened",
- G_CALLBACK (cal_opened_cb), day_view);
+ gtk_signal_connect (GTK_OBJECT (day_view->client), "cal_opened",
+ GTK_SIGNAL_FUNC (cal_opened_cb), day_view);
}
}
@@ -1819,9 +1845,9 @@ e_day_view_update_event_cb (EDayView *day_view,
event_num);
}
- g_object_unref (event->comp);
+ gtk_object_unref (GTK_OBJECT (event->comp));
event->comp = comp;
- g_object_ref (comp);
+ gtk_object_ref (GTK_OBJECT (comp));
if (day == E_DAY_VIEW_LONG_EVENT) {
e_day_view_update_long_event_label (day_view, event_num);
@@ -1945,7 +1971,7 @@ e_day_view_remove_event_cb (EDayView *day_view,
if (event->canvas_item)
gtk_object_destroy (GTK_OBJECT (event->canvas_item));
- g_object_unref (event->comp);
+ gtk_object_unref (GTK_OBJECT (event->comp));
if (day == E_DAY_VIEW_LONG_EVENT) {
g_array_remove_index (day_view->long_events, event_num);
@@ -3281,8 +3307,8 @@ e_day_view_on_long_event_button_press (EDayView *day_view,
e = &g_array_index (day_view->long_events, EDayViewEvent, event_num);
destroyed = FALSE;
- id = g_signal_connect (e->comp, "destroy",
- G_CALLBACK (comp_destroy_cb), &destroyed);
+ id = gtk_signal_connect (GTK_OBJECT (e->comp), "destroy",
+ GTK_SIGNAL_FUNC (comp_destroy_cb), &destroyed);
if (!GTK_WIDGET_HAS_FOCUS (day_view))
gtk_widget_grab_focus (GTK_WIDGET (day_view));
@@ -3333,8 +3359,8 @@ e_day_view_on_event_button_press (EDayView *day_view,
e = &g_array_index (day_view->events[day], EDayViewEvent, event_num);
destroyed = FALSE;
- id = g_signal_connect (e->comp, "destroy",
- G_CALLBACK (comp_destroy_cb), &destroyed);
+ id = gtk_signal_connect (GTK_OBJECT (e->comp), "destroy",
+ GTK_SIGNAL_FUNC (comp_destroy_cb), &destroyed);
if (!GTK_WIDGET_HAS_FOCUS (day_view))
gtk_widget_grab_focus (GTK_WIDGET (day_view));
@@ -3387,8 +3413,8 @@ e_day_view_on_long_event_click (EDayView *day_view,
return;
destroyed = FALSE;
- id = g_signal_connect (event->comp, "destroy",
- G_CALLBACK (comp_destroy_cb), &destroyed);
+ id = gtk_signal_connect (GTK_OBJECT (event->comp), "destroy",
+ GTK_SIGNAL_FUNC (comp_destroy_cb), &destroyed);
/* Grab the keyboard focus, so the event being edited is saved
and we can use the Escape key to abort the resize. */
@@ -3467,8 +3493,8 @@ e_day_view_on_event_click (EDayView *day_view,
guint id;
destroyed = FALSE;
- id = g_signal_connect (event->comp, "destroy",
- G_CALLBACK (comp_destroy_cb), &destroyed);
+ id = gtk_signal_connect (GTK_OBJECT (event->comp), "destroy",
+ GTK_SIGNAL_FUNC (comp_destroy_cb), &destroyed);
/* Grab the keyboard focus, so the event being edited is saved
and we can use the Escape key to abort the resize. */
@@ -3624,8 +3650,8 @@ e_day_view_on_event_double_click (EDayView *day_view,
event_num);
destroyed = FALSE;
- id = g_signal_connect (event->comp, "destroy",
- G_CALLBACK (comp_destroy_cb), &destroyed);
+ id = gtk_signal_connect (GTK_OBJECT (event->comp), "destroy",
+ GTK_SIGNAL_FUNC (comp_destroy_cb), &destroyed);
e_day_view_stop_editing_event (day_view);
@@ -3820,7 +3846,8 @@ e_day_view_on_event_right_click (EDayView *day_view,
day_view->popup_event_num = event_num;
popup = e_popup_menu_create (context_menu, disable_mask, hide_mask, day_view);
- g_signal_connect (popup, "selection-done", G_CALLBACK (free_view_popup), day_view);
+ gtk_signal_connect (GTK_OBJECT (popup), "selection-done",
+ GTK_SIGNAL_FUNC (free_view_popup), day_view);
e_popup_menu (popup, (GdkEvent *) bevent);
}
@@ -4075,7 +4102,7 @@ e_day_view_on_publish (GtkWidget *widget, gpointer data)
itip_send_comp (CAL_COMPONENT_METHOD_PUBLISH, comp,
day_view->client, NULL);
- g_object_unref (comp);
+ gtk_object_unref (GTK_OBJECT (comp));
}
g_list_free (comp_list);
@@ -4113,7 +4140,7 @@ e_day_view_on_delete_occurrence (GtkWidget *widget, gpointer data)
if (cal_client_update_object (day_view->client, comp) != CAL_CLIENT_RESULT_SUCCESS)
g_message ("e_day_view_on_delete_occurrence(): Could not update the object!");
- g_object_unref (comp);
+ gtk_object_unref (GTK_OBJECT (comp));
}
static void
@@ -4155,7 +4182,8 @@ e_day_view_on_delete_appointment (GtkWidget *widget, gpointer data)
return;
destroyed = FALSE;
- id = g_signal_connect (event->comp, "destroy", G_CALLBACK (comp_destroy_cb), &destroyed);
+ id = gtk_signal_connect (GTK_OBJECT (event->comp), "destroy",
+ GTK_SIGNAL_FUNC (comp_destroy_cb), &destroyed);
if (day_view->editing_event_day >= 0)
e_day_view_stop_editing_event (day_view);
@@ -4308,12 +4336,12 @@ e_day_view_on_unrecur_appointment (GtkWidget *widget, gpointer data)
if (cal_client_update_object (day_view->client, comp) != CAL_CLIENT_RESULT_SUCCESS)
g_message ("e_day_view_on_unrecur_appointment(): Could not update the object!");
- g_object_unref (comp);
+ gtk_object_unref (GTK_OBJECT (comp));
if (cal_client_update_object (day_view->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);
+ gtk_object_unref (GTK_OBJECT (new_comp));
}
@@ -4851,7 +4879,7 @@ e_day_view_finish_long_event_resize (EDayView *day_view)
g_message ("e_day_view_finish_long_event_resize(): Could not update the object!");
}
- g_object_unref (comp);
+ gtk_object_unref (GTK_OBJECT (comp));
}
@@ -4912,7 +4940,7 @@ e_day_view_finish_resize (EDayView *day_view)
g_message ("e_day_view_finish_resize(): Could not update the object!");
}
- g_object_unref (comp);
+ gtk_object_unref (GTK_OBJECT (comp));
}
@@ -4984,7 +5012,7 @@ e_day_view_free_event_array (EDayView *day_view,
event = &g_array_index (array, EDayViewEvent, event_num);
if (event->canvas_item)
gtk_object_destroy (GTK_OBJECT (event->canvas_item));
- g_object_unref (event->comp);
+ gtk_object_unref (GTK_OBJECT (event->comp));
}
g_array_set_size (array, 0);
@@ -5024,7 +5052,7 @@ e_day_view_add_event (CalComponent *comp,
day_view->zone);
event.comp = comp;
- g_object_ref (comp);
+ gtk_object_ref (GTK_OBJECT (comp));
event.start = start;
event.end = end;
event.canvas_item = NULL;
@@ -5200,7 +5228,7 @@ e_day_view_reshape_long_event (EDayView *day_view,
draw them on top of the resize rect. Nor when editing. */
num_icons = 0;
comp = event->comp;
- font = gtk_style_get_font (gtk_widget_get_style (GTK_WIDGET (day_view)));
+ font = GTK_WIDGET (day_view)->style->font;
if (day_view->resize_drag_pos != E_DAY_VIEW_POS_NONE
&& day_view->resize_event_day == E_DAY_VIEW_LONG_EVENT
@@ -5242,7 +5270,7 @@ e_day_view_reshape_long_event (EDayView *day_view,
event->canvas_item =
gnome_canvas_item_new (GNOME_CANVAS_GROUP (GNOME_CANVAS (day_view->top_canvas)->root),
e_text_get_type (),
- "font_gdk", font,
+ "font_gdk", GTK_WIDGET (day_view)->style->font,
"anchor", GTK_ANCHOR_NW,
"clip", TRUE,
"max_lines", 1,
@@ -5251,8 +5279,9 @@ e_day_view_reshape_long_event (EDayView *day_view,
"draw_background", FALSE,
"fill_color_rgba", GNOME_CANVAS_COLOR(0, 0, 0),
NULL);
- g_signal_connect (event->canvas_item, "event",
- G_CALLBACK (e_day_view_on_text_item_event), day_view);
+ gtk_signal_connect (GTK_OBJECT (event->canvas_item), "event",
+ GTK_SIGNAL_FUNC (e_day_view_on_text_item_event),
+ day_view);
e_day_view_update_long_event_label (day_view, event_num);
}
@@ -5269,7 +5298,9 @@ e_day_view_reshape_long_event (EDayView *day_view,
text_w = item_w;
} else {
/* Get the requested size of the label. */
- g_object_get (G_OBJECT (event->canvas_item), "text", &text, NULL);
+ gtk_object_get (GTK_OBJECT (event->canvas_item),
+ "text", &text,
+ NULL);
text_width = 0;
if (text) {
end_of_line = strchr (text, '\n');
@@ -5394,13 +5425,10 @@ e_day_view_reshape_day_event (EDayView *day_view,
}
if (!event->canvas_item) {
- GdkFont *font;
-
- font = gtk_style_get_font (gtk_widget_get_style (GTK_WIDGET (day_view)));
event->canvas_item =
gnome_canvas_item_new (GNOME_CANVAS_GROUP (GNOME_CANVAS (day_view->main_canvas)->root),
e_text_get_type (),
- "font_gdk", font,
+ "font_gdk", GTK_WIDGET (day_view)->style->font,
"anchor", GTK_ANCHOR_NW,
"line_wrap", TRUE,
"editable", TRUE,
@@ -5409,9 +5437,12 @@ e_day_view_reshape_day_event (EDayView *day_view,
"draw_background", FALSE,
"fill_color_rgba", GNOME_CANVAS_COLOR(0, 0, 0),
NULL);
- g_signal_connect (event->canvas_item, "event",
- G_CALLBACK (e_day_view_on_text_item_event), day_view);
- e_day_view_update_event_label (day_view, day, event_num);
+ gtk_signal_connect (GTK_OBJECT (event->canvas_item),
+ "event",
+ GTK_SIGNAL_FUNC (e_day_view_on_text_item_event),
+ day_view);
+ e_day_view_update_event_label (day_view, day,
+ event_num);
}
item_w = MAX (item_w, 0);
@@ -5441,12 +5472,12 @@ e_day_view_reshape_main_canvas_resize_bars (EDayView *day_view)
hide the resize bars. */
if (day != -1 && day == day_view->drag_event_day
&& event_num == day_view->drag_event_num) {
- g_object_get (G_OBJECT (day_view->drag_rect_item),
- "x1", &x,
- "y1", &y,
- "x2", &w,
- "y2", &h,
- NULL);
+ gtk_object_get (GTK_OBJECT (day_view->drag_rect_item),
+ "x1", &x,
+ "y1", &y,
+ "x2", &w,
+ "y2", &h,
+ NULL);
w -= x;
x++;
h -= y;
@@ -5677,7 +5708,7 @@ e_day_view_key_press (GtkWidget *widget, GdkEventKey *event)
if (initial_text)
g_free (initial_text);
- g_object_unref (comp);
+ gtk_object_unref (GTK_OBJECT (comp));
return TRUE;
}
@@ -6010,9 +6041,9 @@ e_day_view_start_editing_event (EDayView *day_view,
}
/* Try to move the cursor to the end of the text. */
- g_object_get (G_OBJECT (event->canvas_item),
- "event_processor", &event_processor,
- NULL);
+ gtk_object_get (GTK_OBJECT (event->canvas_item),
+ "event_processor", &event_processor,
+ NULL);
if (event_processor) {
command.action = E_TEP_MOVE;
command.position = E_TEP_END_OF_BUFFER;
@@ -6061,9 +6092,9 @@ cancel_editing (EDayView *day_view)
/* Reset the text to what was in the component */
cal_component_get_summary (event->comp, &summary);
- g_object_set (G_OBJECT (event->canvas_item),
- "text", summary.value ? summary.value : "",
- NULL);
+ gtk_object_set (GTK_OBJECT (event->canvas_item),
+ "text", summary.value ? summary.value : "",
+ NULL);
/* Stop editing */
e_day_view_stop_editing_event (day_view);
@@ -6205,9 +6236,9 @@ e_day_view_on_editing_stopped (EDayView *day_view,
day_view->resize_bars_event_day = -1;
day_view->resize_bars_event_num = -1;
- g_object_get (G_OBJECT (event->canvas_item),
- "text", &text,
- NULL);
+ gtk_object_get (GTK_OBJECT (event->canvas_item),
+ "text", &text,
+ NULL);
g_assert (text != NULL);
if (string_is_empty (text) && !cal_comp_is_on_server (event->comp, day_view->client)) {
@@ -6829,7 +6860,7 @@ e_day_view_update_top_canvas_drag (EDayView *day_view,
"y2", item_y + item_h - 1,
NULL);
- font = gtk_style_get_font (gtk_widget_get_style (GTK_WIDGET (day_view)));
+ font = GTK_WIDGET (day_view)->style->font;
gnome_canvas_item_set (day_view->drag_long_event_item,
"font_gdk", font,
"clip_width", item_w - (E_DAY_VIEW_LONG_EVENT_BORDER_WIDTH + E_DAY_VIEW_LONG_EVENT_X_PAD) * 2,
@@ -6989,7 +7020,7 @@ e_day_view_update_main_canvas_drag (EDayView *day_view,
"y2", item_y + item_h - 1,
NULL);
- font = gtk_style_get_font (gtk_widget_get_style (GTK_WIDGET (day_view)));
+ font = GTK_WIDGET (day_view)->style->font;
gnome_canvas_item_set (day_view->drag_item,
"font_gdk", font,
"clip_width", item_w - E_DAY_VIEW_BAR_WIDTH - E_DAY_VIEW_EVENT_X_PAD * 2,
@@ -7311,7 +7342,7 @@ e_day_view_on_top_canvas_drag_data_received (GtkWidget *widget,
"not update the object!");
}
- g_object_unref (comp);
+ gtk_object_unref (GTK_OBJECT (comp));
return;
}
@@ -7425,7 +7456,7 @@ e_day_view_on_main_canvas_drag_data_received (GtkWidget *widget,
"Could not update the object!");
}
- g_object_unref (comp);
+ gtk_object_unref (GTK_OBJECT (comp));
return;
}
@@ -7484,6 +7515,7 @@ e_day_view_get_time_string_width (EDayView *day_view)
static void
invisible_destroyed (GtkWidget *invisible, EDayView *day_view)
{
+ gtk_object_unref (GTK_OBJECT (day_view->invisible));
day_view->invisible = NULL;
}
@@ -7583,7 +7615,7 @@ selection_received (GtkWidget *invisible,
cal_client_update_object (day_view->client, comp);
free (uid);
- g_object_unref (comp);
+ gtk_object_unref (GTK_OBJECT (comp));
}
subcomp = icalcomponent_get_next_component (
@@ -7612,7 +7644,7 @@ selection_received (GtkWidget *invisible,
if (itip_organizer_is_user (comp) && send_component_dialog (comp, TRUE))
itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, day_view->client, NULL);
- g_object_unref (comp);
+ gtk_object_unref (GTK_OBJECT (comp));
}
e_day_view_set_status_message (day_view, NULL);
@@ -7690,7 +7722,7 @@ e_day_view_set_status_message (EDayView *day_view, const char *message)
if (!message || !*message) {
if (day_view->activity) {
- g_object_unref (day_view->activity);
+ gtk_object_unref (GTK_OBJECT (day_view->activity));
day_view->activity = NULL;
}
}
@@ -7699,7 +7731,7 @@ e_day_view_set_status_message (EDayView *day_view, const char *message)
char *client_id = g_strdup_printf ("%p", day_view);
if (progress_icon[0] == NULL)
- progress_icon[0] = gdk_pixbuf_new_from_file (EVOLUTION_IMAGESDIR "/" EVOLUTION_CALENDAR_PROGRESS_IMAGE, NULL);
+ progress_icon[0] = gdk_pixbuf_new_from_file (EVOLUTION_IMAGESDIR "/" EVOLUTION_CALENDAR_PROGRESS_IMAGE);
day_view->activity = evolution_activity_client_new (
global_shell_client, client_id,
progress_icon, message, TRUE, &display);
diff --git a/calendar/gui/e-itip-control.c b/calendar/gui/e-itip-control.c
index 03e4c476a7..c0414c8cf5 100644
--- a/calendar/gui/e-itip-control.c
+++ b/calendar/gui/e-itip-control.c
@@ -30,14 +30,15 @@
#include <fcntl.h>
#include <glib.h>
#include <gtk/gtkmisc.h>
+#include <libgnome/gnome-defs.h>
#include <libgnome/gnome-i18n.h>
#include <libgnome/gnome-util.h>
-#include <libgnomeui/gnome-stock-icons.h>
+#include <libgnomeui/gnome-stock.h>
#include <libgnomeui/gnome-uidefs.h>
#include <libgnomeui/gnome-dialog.h>
#include <libgnomeui/gnome-dialog-util.h>
-#include <bonobo/bonobo-object.h>
#include <bonobo/bonobo-exception.h>
+#include <gal/util/e-unicode-i18n.h>
#include <gal/widgets/e-unicode.h>
#include <gtkhtml/gtkhtml.h>
#include <gtkhtml/gtkhtml-stream.h>
@@ -90,7 +91,7 @@ struct _EItipControlPrivate {
extern EvolutionShellClient *global_shell_client;
-/* We intentionally use "calendar" instead of "calendar/*" here. We
+/* We intentionally use "calendar" instead of "calendar / *" here. We
* don't want public calendars.
*/
static const char *calendar_types[] = { "calendar", NULL };
@@ -168,7 +169,8 @@ start_calendar_server (char *uri)
client = cal_client_new ();
- g_signal_connect (client, "cal_opened", G_CALLBACK (start_calendar_server_cb), &success);
+ gtk_signal_connect (GTK_OBJECT (client), "cal_opened",
+ start_calendar_server_cb, &success);
cal_client_open_calendar (client, uri, TRUE);
@@ -179,7 +181,7 @@ start_calendar_server (char *uri)
if (success)
return client;
- g_object_unref (client);
+ gtk_object_unref (GTK_OBJECT (client));
return NULL;
}
@@ -192,7 +194,8 @@ start_default_server (gboolean tasks)
client = cal_client_new ();
- g_signal_connect (client, "cal_opened", start_calendar_server_cb, &success);
+ gtk_signal_connect (GTK_OBJECT (client), "cal_opened",
+ start_calendar_server_cb, &success);
if (tasks) {
if (!cal_client_open_default_tasks (client, FALSE))
@@ -210,7 +213,7 @@ start_default_server (gboolean tasks)
return client;
error:
- g_object_unref (client);
+ gtk_object_unref (GTK_OBJECT (client));
return NULL;
}
@@ -267,7 +270,7 @@ get_servers (EvolutionShellClient *shell_client, const char *possible_types[], g
CORBA_free (folder_list);
}
- g_object_unref (shell_client);
+ bonobo_object_unref (BONOBO_OBJECT (shell_client));
return servers;
}
@@ -287,8 +290,8 @@ find_server (GPtrArray *servers, CalComponent *comp)
client = g_ptr_array_index (servers, i);
status = cal_client_get_object (client, uid, &found_comp);
if (status == CAL_CLIENT_GET_SUCCESS) {
- g_object_unref (found_comp);
- g_object_ref (client);
+ gtk_object_unref (GTK_OBJECT (found_comp));
+ gtk_object_ref (GTK_OBJECT (client));
return client;
}
@@ -339,9 +342,14 @@ init (EItipControl *itip)
gtk_widget_set_usize (scrolled_window, 600, 400);
gtk_box_pack_start (GTK_BOX (itip), scrolled_window, FALSE, FALSE, 4);
- g_signal_connect (priv->html, "url_requested", G_CALLBACK (url_requested_cb), itip);
- g_signal_connect (priv->html, "object_requested", G_CALLBACK (object_requested_cb), itip);
- g_signal_connect (priv->html, "submit", G_CALLBACK (ok_clicked_cb), itip);
+ gtk_signal_connect (GTK_OBJECT (priv->html), "url_requested",
+ url_requested_cb, itip);
+ gtk_signal_connect (GTK_OBJECT (priv->html), "object_requested",
+ GTK_SIGNAL_FUNC (object_requested_cb),
+ itip);
+ gtk_signal_connect (GTK_OBJECT (priv->html), "submit",
+ ok_clicked_cb, itip);
+
}
static void
@@ -355,7 +363,7 @@ clean_up (EItipControl *itip)
priv->vcalendar = NULL;
if (priv->comp)
- g_object_unref (priv->comp);
+ gtk_object_unref (GTK_OBJECT (priv->comp));
priv->comp = NULL;
icalcomponent_free (priv->top_level);
@@ -396,12 +404,12 @@ destroy (GtkObject *obj)
if (priv->event_clients) {
for (i = 0; i < priv->event_clients->len; i++)
- g_object_unref (g_ptr_array_index (priv->event_clients, i));
+ gtk_object_unref (GTK_OBJECT (g_ptr_array_index (priv->event_clients, i)));
g_ptr_array_free (priv->event_clients, TRUE);
}
if (priv->task_clients) {
for (i = 0; i < priv->task_clients->len; i++)
- g_object_unref (g_ptr_array_index (priv->task_clients, i));
+ gtk_object_unref (GTK_OBJECT (g_ptr_array_index (priv->task_clients, i)));
g_ptr_array_free (priv->task_clients, TRUE);
}
@@ -414,7 +422,7 @@ destroy (GtkObject *obj)
GtkWidget *
e_itip_control_new (void)
{
- return g_object_new (E_TYPE_ITIP_CONTROL, NULL);
+ return gtk_type_new (E_TYPE_ITIP_CONTROL);
}
static void
@@ -524,7 +532,8 @@ find_attendee (icalcomponent *ical_comp, const char *address)
static void
write_label_piece (EItipControl *itip, CalComponentDateTime *dt,
char *buffer, int size,
- const char *stext, const char *etext)
+ const char *stext, const char *etext,
+ gboolean just_date)
{
EItipControlPrivate *priv;
struct tm tmp_tm;
@@ -544,6 +553,8 @@ write_label_piece (EItipControl *itip, CalComponentDateTime *dt,
}
tmp_tm = icaltimetype_to_tm (dt->value);
+ if (just_date)
+ tmp_tm.tm_hour = tmp_tm.tm_min = tmp_tm.tm_sec = 0;
if (stext != NULL)
strcat (buffer, stext);
@@ -562,12 +573,12 @@ write_label_piece (EItipControl *itip, CalComponentDateTime *dt,
}
/* Output timezone after time, e.g. " America/New_York". */
- if (zone) {
+ if (zone && !just_date) {
/* Note that this returns UTF-8, since all iCalendar data is
UTF-8. But it probably is not translated. */
display_name = icaltimezone_get_display_name (zone);
if (display_name && *display_name) {
- strcat (buffer, " ");
+ strcat (buffer, " <font size=-1>[");
/* We check if it is one of our builtin timezone names,
in which case we call gettext to translate it, and
@@ -575,10 +586,11 @@ write_label_piece (EItipControl *itip, CalComponentDateTime *dt,
timezone name, we use it as-is, as it is already
UTF-8. */
if (icaltimezone_get_builtin_timezone (display_name)) {
- strcat (buffer, _(display_name));
+ strcat (buffer, U_(display_name));
} else {
strcat (buffer, display_name);
}
+ strcat (buffer, "]</font>");
}
}
@@ -586,6 +598,188 @@ write_label_piece (EItipControl *itip, CalComponentDateTime *dt,
strcat (buffer, etext);
}
+/* copied from recurrence-page.c, so it should be pre-translated */
+static const char *date_suffix[] = {
+ N_("st"),
+ N_("nd"),
+ N_("rd"),
+ N_("th"),
+ N_("th"),
+ N_("th"),
+ N_("th"),
+ N_("th"),
+ N_("th"),
+ N_("th"),
+ N_("th"),
+ N_("th"),
+ N_("th"),
+ N_("th"),
+ N_("th"),
+ N_("th"),
+ N_("th"),
+ N_("th"),
+ N_("th"),
+ N_("th"),
+ N_("st"),
+ N_("nd"),
+ N_("rd"),
+ N_("th"),
+ N_("th"),
+ N_("th"),
+ N_("th"),
+ N_("th"),
+ N_("th"),
+ N_("th"),
+ N_("st")
+};
+
+static const char *
+nth (int n)
+{
+ static char buffer[10];
+
+ if (n == -1)
+ return "last";
+ if (n < 1 || n >= (sizeof (date_suffix) / sizeof (const char *)))
+ return "?";
+ sprintf (buffer, "%d%s", n, date_suffix[n - 1]);
+ return buffer;
+}
+
+static const char *dayname[] = {
+ N_("Sunday"),
+ N_("Monday"),
+ N_("Tuesday"),
+ N_("Wednesday"),
+ N_("Thursday"),
+ N_("Friday"),
+ N_("Saturday")
+};
+
+static inline char *
+get_dayname (struct icalrecurrencetype *r, int i)
+{
+ enum icalrecurrencetype_weekday day;
+
+ day = icalrecurrencetype_day_day_of_week (r->by_day[i]);
+ g_return_val_if_fail (day > 0 && day < 8, "?");
+
+ return _(dayname[day - 1]);
+}
+
+static void
+write_recurrence_piece (EItipControl *itip, CalComponent *comp,
+ char *buffer, int size)
+{
+ GSList *rrules;
+ struct icalrecurrencetype *r;
+ int len, i;
+
+ strcpy (buffer, "<b>Recurring:</b> ");
+ len = strlen (buffer);
+ buffer += len;
+ size -= len;
+
+ if (!cal_component_has_simple_recurrence (comp)) {
+ strcpy (buffer, _("Yes. (Complex Recurrence)"));
+ return;
+ }
+
+ cal_component_get_rrule_list (comp, &rrules);
+ g_return_if_fail (rrules && !rrules->next);
+
+ r = rrules->data;
+
+ switch (r->freq) {
+ case ICAL_DAILY_RECURRENCE:
+ if (r->interval == 1)
+ strcpy (buffer, _("Every day"));
+ else
+ sprintf (buffer, _("Every %d days"), r->interval);
+ break;
+
+ case ICAL_WEEKLY_RECURRENCE:
+ if (r->by_day[0] == ICAL_RECURRENCE_ARRAY_MAX) {
+ if (r->interval == 1)
+ strcpy (buffer, _("Every week"));
+ else
+ sprintf (buffer, _("Every %d weeks"), r->interval);
+ } else {
+ if (r->interval == 1)
+ strcpy (buffer, _("Every week on "));
+ else
+ sprintf (buffer, _("Every %d weeks on "), r->interval);
+
+ for (i = 1; i < 8 && r->by_day[i] != ICAL_RECURRENCE_ARRAY_MAX; i++) {
+ if (i > 1)
+ strcat (buffer, ", ");
+ strcat (buffer, get_dayname (r, i - 1));
+ }
+ if (i > 1)
+ strcat (buffer, _(" and "));
+ strcat (buffer, get_dayname (r, i - 1));
+ }
+ break;
+
+ case ICAL_MONTHLY_RECURRENCE:
+ if (r->by_month_day[0] != ICAL_RECURRENCE_ARRAY_MAX) {
+ sprintf (buffer, _("The %s day of "),
+ nth (r->by_month_day[0]));
+ } else {
+ int pos;
+
+ /* Outlook 2000 uses BYDAY=TU;BYSETPOS=2, and will not
+ accept BYDAY=2TU. So we now use the same as Outlook
+ by default. */
+
+ pos = icalrecurrencetype_day_position (r->by_day[0]);
+ if (pos == 0)
+ pos = r->by_set_pos[0];
+
+ sprintf (buffer, _("The %s %s of "),
+ nth (pos), get_dayname (r, 0));
+ }
+
+ if (r->interval == 1)
+ strcat (buffer, _("every month"));
+ else {
+ len = strlen (buffer);
+ buffer += len;
+ size -= len;
+ sprintf (buffer, _("every %d months"), r->interval);
+ }
+ break;
+
+ case ICAL_YEARLY_RECURRENCE:
+ if (r->interval == 1)
+ strcpy (buffer, _("Every year"));
+ else {
+ sprintf (buffer, _("Every %d years"), r->interval);
+ }
+ break;
+
+ default:
+ g_assert_not_reached ();
+ }
+
+ len = strlen (buffer);
+ buffer += len;
+ size -= len;
+ if (r->count) {
+ sprintf (buffer, _(" a total of %d times"), r->count);
+ } else if (!icaltime_is_null_time (r->until)) {
+ CalComponentDateTime dt;
+
+ dt.value = &r->until;
+ dt.tzid = r->until.zone;
+
+ write_label_piece (itip, &dt, buffer, size,
+ _(", ending on "), NULL, TRUE);
+ }
+
+ strcat (buffer, "<br>");
+}
+
static void
set_date_label (EItipControl *itip, GtkHTML *html, GtkHTMLStream *html_stream,
CalComponent *comp)
@@ -604,8 +798,8 @@ set_date_label (EItipControl *itip, GtkHTML *html, GtkHTMLStream *html_stream,
cal_component_get_dtstart (comp, &datetime);
if (datetime.value) {
write_label_piece (itip, &datetime, buffer, 1024,
- _("<b>Starts:</b> "),
- "<br>");
+ U_("<b>Starts:</b> "),
+ "<br>", FALSE);
gtk_html_write (html, html_stream, buffer, strlen(buffer));
wrote = TRUE;
}
@@ -614,20 +808,27 @@ set_date_label (EItipControl *itip, GtkHTML *html, GtkHTMLStream *html_stream,
buffer[0] = '\0';
cal_component_get_dtend (comp, &datetime);
if (datetime.value){
- write_label_piece (itip, &datetime, buffer, 1024, _("<b>Ends:</b> "), "<br>");
+ write_label_piece (itip, &datetime, buffer, 1024, U_("<b>Ends:</b> "), "<br>", FALSE);
gtk_html_write (html, html_stream, buffer, strlen (buffer));
wrote = TRUE;
}
cal_component_free_datetime (&datetime);
buffer[0] = '\0';
+ if (cal_component_has_recurrences (comp)) {
+ write_recurrence_piece (itip, comp, buffer, 1024);
+ gtk_html_write (html, html_stream, buffer, strlen (buffer));
+ wrote = TRUE;
+ }
+
+ buffer[0] = '\0';
datetime.tzid = NULL;
cal_component_get_completed (comp, &datetime.value);
if (type == CAL_COMPONENT_TODO && datetime.value) {
/* Pass TRUE as is_utc, so it gets converted to the current
timezone. */
datetime.value->is_utc = TRUE;
- write_label_piece (itip, &datetime, buffer, 1024, _("<b>Completed:</b> "), "<br>");
+ write_label_piece (itip, &datetime, buffer, 1024, U_("<b>Completed:</b> "), "<br>", FALSE);
gtk_html_write (html, html_stream, buffer, strlen (buffer));
wrote = TRUE;
task_completed = TRUE;
@@ -637,7 +838,7 @@ set_date_label (EItipControl *itip, GtkHTML *html, GtkHTMLStream *html_stream,
buffer[0] = '\0';
cal_component_get_due (comp, &datetime);
if (type == CAL_COMPONENT_TODO && !task_completed && datetime.value) {
- write_label_piece (itip, &datetime, buffer, 1024, _("<b>Due:</b> "), "<br>");
+ write_label_piece (itip, &datetime, buffer, 1024, U_("<b>Due:</b> "), "<br>", FALSE);
gtk_html_write (html, html_stream, buffer, strlen (buffer));
wrote = TRUE;
}
@@ -674,7 +875,7 @@ write_error_html (EItipControl *itip, const gchar *itip_err)
html_stream = gtk_html_begin (GTK_HTML (priv->html));
gtk_html_stream_printf (html_stream,
"<html><head><title>%s</title></head>",
- _("iCalendar Information"));
+ U_("iCalendar Information"));
gtk_html_write (GTK_HTML (priv->html), html_stream,
HTML_BODY_START, strlen(HTML_BODY_START));
@@ -689,7 +890,7 @@ write_error_html (EItipControl *itip, const gchar *itip_err)
gtk_html_stream_printf (html_stream, "<td align=\"left\" valign=\"top\">");
/* Title */
- set_message (GTK_HTML (priv->html), html_stream, _("iCalendar Error"), TRUE);
+ set_message (GTK_HTML (priv->html), html_stream, U_("iCalendar Error"), TRUE);
/* Error */
gtk_html_write (GTK_HTML (priv->html), html_stream, itip_err, strlen(itip_err));
@@ -724,7 +925,7 @@ write_html (EItipControl *itip, const gchar *itip_desc, const gchar *itip_title,
html_stream = gtk_html_begin (GTK_HTML (priv->html));
gtk_html_stream_printf (html_stream,
"<html><head><title>%s</title></head>",
- _("iCalendar Information"));
+ U_("iCalendar Information"));
gtk_html_write (GTK_HTML (priv->html), html_stream,
HTML_BODY_START, strlen(HTML_BODY_START));
@@ -755,7 +956,7 @@ write_html (EItipControl *itip, const gchar *itip_desc, const gchar *itip_title,
attendee->cn :
itip_strip_mailto (attendee->value));
} else {
- html = g_strdup_printf (itip_desc, _("An unknown person"));
+ html = g_strdup_printf (itip_desc, U_("An unknown person"));
}
break;
case ICAL_METHOD_REQUEST:
@@ -771,7 +972,7 @@ write_html (EItipControl *itip, const gchar *itip_desc, const gchar *itip_title,
priv->delegator_name :
priv->delegator_address);
else
- html = g_strdup_printf (itip_desc, _("An unknown person"),
+ html = g_strdup_printf (itip_desc, U_("An unknown person"),
priv->delegator_name ?
priv->delegator_name :
priv->delegator_address);
@@ -782,7 +983,7 @@ write_html (EItipControl *itip, const gchar *itip_desc, const gchar *itip_title,
organizer.cn :
itip_strip_mailto (organizer.value));
else
- html = g_strdup_printf (itip_desc, _("An unknown person"));
+ html = g_strdup_printf (itip_desc, U_("An unknown person"));
}
break;
@@ -799,14 +1000,14 @@ write_html (EItipControl *itip, const gchar *itip_desc, const gchar *itip_title,
organizer.cn :
itip_strip_mailto (organizer.value));
else
- html = g_strdup_printf (itip_desc, _("An unknown person"));
+ html = g_strdup_printf (itip_desc, U_("An unknown person"));
break;
}
gtk_html_write (GTK_HTML (priv->html), html_stream, html, strlen(html));
g_free (html);
/* Describe what the user can do */
- const_html = _("<br> Please review the following information, "
+ const_html = U_("<br> Please review the following information, "
"and then select an action from the menu below.");
gtk_html_write (GTK_HTML (priv->html), html_stream, const_html, strlen(const_html));
@@ -821,9 +1022,9 @@ write_html (EItipControl *itip, const gchar *itip_desc, const gchar *itip_title,
/* Summary */
cal_component_get_summary (priv->comp, &text);
- html = e_text_to_html (text.value ? text.value : _("<i>None</i>"), E_TEXT_TO_HTML_CONVERT_NL);
+ html = e_text_to_html (text.value ? text.value : U_("<i>None</i>"), E_TEXT_TO_HTML_CONVERT_NL);
gtk_html_stream_printf (html_stream, "<b>%s</b><br>%s<br><br>",
- _("Summary:"), html);
+ U_("Summary:"), html);
g_free (html);
/* Location */
@@ -831,7 +1032,7 @@ write_html (EItipControl *itip, const gchar *itip_desc, const gchar *itip_title,
if (string != NULL) {
html = e_text_to_html (string, E_TEXT_TO_HTML_CONVERT_NL);
gtk_html_stream_printf (html_stream, "<b>%s</b><br>%s<br><br>",
- _("Location:"), html);
+ U_("Location:"), html);
g_free (html);
}
@@ -845,24 +1046,24 @@ write_html (EItipControl *itip, const gchar *itip_desc, const gchar *itip_title,
CalComponentAttendee *a = alist->data;
gtk_html_stream_printf (html_stream, "<b>%s</b><br>",
- _("Status:"));
+ U_("Status:"));
switch (a->status) {
case ICAL_PARTSTAT_ACCEPTED:
gtk_html_stream_printf (html_stream, "%s<br><br>",
- _("Accepted"));
+ U_("Accepted"));
break;
case ICAL_PARTSTAT_TENTATIVE:
gtk_html_stream_printf (html_stream, "%s<br><br>",
- _("Tentatively Accepted"));
+ U_("Tentatively Accepted"));
break;
case ICAL_PARTSTAT_DECLINED:
gtk_html_stream_printf (html_stream, "%s<br><br>",
- _("Declined"));
+ U_("Declined"));
break;
default:
gtk_html_stream_printf (html_stream, "%s<br><br>",
- _("Unknown"));
+ U_("Unknown"));
}
}
@@ -877,7 +1078,7 @@ write_html (EItipControl *itip, const gchar *itip_desc, const gchar *itip_title,
if (l && text.value) {
html = e_text_to_html (text.value, E_TEXT_TO_HTML_CONVERT_NL);
gtk_html_stream_printf (html_stream, "<b>%s</b><br>%s",
- _("Description:"), html);
+ U_("Description:"), html);
g_free (html);
}
cal_component_free_text_list (l);
@@ -915,9 +1116,9 @@ get_publish_options (gboolean selector)
"</select>&nbsp &nbsp "
"<input TYPE=Submit name=\"ok\" value=\"%s\">"
"</form>",
- _("Choose an action:"),
- _("Update"),
- _("OK"));
+ U_("Choose an action:"),
+ U_("Update"),
+ U_("OK"));
if (selector) {
char *sel;
@@ -943,12 +1144,12 @@ get_request_options (gboolean selector)
"<input TYPE=\"checkbox\" name=\"rsvp\" value=\"1\" checked>%s&nbsp&nbsp"
"<input TYPE=\"submit\" name=\"ok\" value=\"%s\"><br> "
"</form>",
- _("Choose an action:"),
- _("Accept"),
- _("Tentatively accept"),
- _("Decline"),
- _("RSVP"),
- _("OK"));
+ U_("Choose an action:"),
+ U_("Accept"),
+ U_("Tentatively accept"),
+ U_("Decline"),
+ U_("RSVP"),
+ U_("OK"));
if (selector) {
char *sel;
@@ -969,9 +1170,9 @@ get_request_fb_options ()
"<option VALUE=\"F\">%s</option></select>&nbsp &nbsp "
"<input TYPE=Submit name=\"ok\" value=\"%s\">"
"</form>",
- _("Choose an action:"),
- _("Send Free/Busy Information"),
- _("OK"));
+ U_("Choose an action:"),
+ U_("Send Free/Busy Information"),
+ U_("OK"));
}
static char*
@@ -982,9 +1183,9 @@ get_reply_options ()
"<option VALUE=\"R\">%s</option></select>&nbsp &nbsp "
"<input TYPE=Submit name=\"ok\" value=\"%s\">"
"</form>",
- _("Choose an action:"),
- _("Update respondent status"),
- _("OK"));
+ U_("Choose an action:"),
+ U_("Update respondent status"),
+ U_("OK"));
}
static char*
@@ -995,9 +1196,9 @@ get_refresh_options ()
"<option VALUE=\"S\">%s</option></select>&nbsp &nbsp "
"<input TYPE=Submit name=\"ok\" value=\"%s\">"
"</form>",
- _("Choose an action:"),
- _("Send Latest Information"),
- _("OK"));
+ U_("Choose an action:"),
+ U_("Send Latest Information"),
+ U_("OK"));
}
static char*
@@ -1008,9 +1209,9 @@ get_cancel_options ()
"<option VALUE=\"C\">%s</option></select>&nbsp &nbsp "
"<input TYPE=Submit name=\"ok\" value=\"%s\">"
"</form>",
- _("Choose an action:"),
- _("Cancel"),
- _("OK"));
+ U_("Choose an action:"),
+ U_("Cancel"),
+ U_("OK"));
}
@@ -1066,7 +1267,7 @@ adjust_item (EItipControl *itip, CalComponent *comp)
cal_component_set_description_list (comp, l);
cal_component_free_text_list (l);
- g_object_unref (real_comp);
+ gtk_object_unref (GTK_OBJECT (real_comp));
} else {
CalComponentText text = {_("Unknown"), NULL};
@@ -1090,50 +1291,50 @@ show_current_event (EItipControl *itip)
switch (priv->method) {
case ICAL_METHOD_PUBLISH:
- itip_desc = _("<b>%s</b> has published meeting information.");
- itip_title = _("Meeting Information");
+ itip_desc = U_("<b>%s</b> has published meeting information.");
+ itip_title = U_("Meeting Information");
options = get_publish_options (priv->event_client ? FALSE : TRUE);
break;
case ICAL_METHOD_REQUEST:
if (priv->delegator_address != NULL)
- itip_desc = _("<b>%s</b> requests the presence of %s at a meeting.");
+ itip_desc = U_("<b>%s</b> requests the presence of %s at a meeting.");
else
- itip_desc = _("<b>%s</b> requests your presence at a meeting.");
- itip_title = _("Meeting Proposal");
+ itip_desc = U_("<b>%s</b> requests your presence at a meeting.");
+ itip_title = U_("Meeting Proposal");
options = get_request_options (priv->event_client ? FALSE : TRUE);
break;
case ICAL_METHOD_ADD:
- itip_desc = _("<b>%s</b> wishes to add to an existing meeting.");
- itip_title = _("Meeting Update");
+ itip_desc = U_("<b>%s</b> wishes to add to an existing meeting.");
+ itip_title = U_("Meeting Update");
options = get_publish_options (priv->event_client ? FALSE : TRUE);
break;
case ICAL_METHOD_REFRESH:
- itip_desc = _("<b>%s</b> wishes to receive the latest meeting information.");
- itip_title = _("Meeting Update Request");
+ itip_desc = U_("<b>%s</b> wishes to receive the latest meeting information.");
+ itip_title = U_("Meeting Update Request");
options = get_refresh_options ();
/* Provide extra info, since its not in the component */
adjust_item (itip, priv->comp);
break;
case ICAL_METHOD_REPLY:
- itip_desc = _("<b>%s</b> has replied to a meeting request.");
- itip_title = _("Meeting Reply");
+ itip_desc = U_("<b>%s</b> has replied to a meeting request.");
+ itip_title = U_("Meeting Reply");
options = get_reply_options ();
/* Provide extra info, since might not be in the component */
adjust_item (itip, priv->comp);
break;
case ICAL_METHOD_CANCEL:
- itip_desc = _("<b>%s</b> has cancelled a meeting.");
- itip_title = _("Meeting Cancellation");
+ itip_desc = U_("<b>%s</b> has cancelled a meeting.");
+ itip_title = U_("Meeting Cancellation");
options = get_cancel_options ();
/* Provide extra info, since might not be in the component */
adjust_item (itip, priv->comp);
break;
default:
- itip_desc = _("<b>%s</b> has sent an unintelligible message.");
- itip_title = _("Bad Meeting Message");
+ itip_desc = U_("<b>%s</b> has sent an unintelligible message.");
+ itip_title = U_("Bad Meeting Message");
options = NULL;
}
@@ -1157,50 +1358,50 @@ show_current_todo (EItipControl *itip)
switch (priv->method) {
case ICAL_METHOD_PUBLISH:
- itip_desc = _("<b>%s</b> has published task information.");
- itip_title = _("Task Information");
+ itip_desc = U_("<b>%s</b> has published task information.");
+ itip_title = U_("Task Information");
options = get_publish_options (priv->task_client ? FALSE : TRUE);
break;
case ICAL_METHOD_REQUEST:
if (priv->delegator_address != NULL)
- itip_desc = _("<b>%s</b> requests %s to perform a task.");
+ itip_desc = U_("<b>%s</b> requests %s to perform a task.");
else
- itip_desc = _("<b>%s</b> requests you perform a task.");
- itip_title = _("Task Proposal");
+ itip_desc = U_("<b>%s</b> requests you perform a task.");
+ itip_title = U_("Task Proposal");
options = get_request_options (priv->task_client ? FALSE : TRUE);
break;
case ICAL_METHOD_ADD:
- itip_desc = _("<b>%s</b> wishes to add to an existing task.");
- itip_title = _("Task Update");
+ itip_desc = U_("<b>%s</b> wishes to add to an existing task.");
+ itip_title = U_("Task Update");
options = get_publish_options (priv->task_client ? FALSE : TRUE);
break;
case ICAL_METHOD_REFRESH:
- itip_desc = _("<b>%s</b> wishes to receive the latest task information.");
- itip_title = _("Task Update Request");
+ itip_desc = U_("<b>%s</b> wishes to receive the latest task information.");
+ itip_title = U_("Task Update Request");
options = get_refresh_options ();
/* Provide extra info, since its not in the component */
adjust_item (itip, priv->comp);
break;
case ICAL_METHOD_REPLY:
- itip_desc = _("<b>%s</b> has replied to a task assignment.");
- itip_title = _("Task Reply");
+ itip_desc = U_("<b>%s</b> has replied to a task assignment.");
+ itip_title = U_("Task Reply");
options = get_reply_options ();
/* Provide extra info, since might not be in the component */
adjust_item (itip, priv->comp);
break;
case ICAL_METHOD_CANCEL:
- itip_desc = _("<b>%s</b> has cancelled a task.");
- itip_title = _("Task Cancellation");
+ itip_desc = U_("<b>%s</b> has cancelled a task.");
+ itip_title = U_("Task Cancellation");
options = get_cancel_options ();
/* Provide extra info, since might not be in the component */
adjust_item (itip, priv->comp);
break;
default:
- itip_desc = _("<b>%s</b> has sent an unintelligible message.");
- itip_title = _("Bad Task Message");
+ itip_desc = U_("<b>%s</b> has sent an unintelligible message.");
+ itip_title = U_("Bad Task Message");
options = NULL;
}
@@ -1219,23 +1420,23 @@ show_current_freebusy (EItipControl *itip)
switch (priv->method) {
case ICAL_METHOD_PUBLISH:
- itip_desc = _("<b>%s</b> has published free/busy information.");
- itip_title = _("Free/Busy Information");
+ itip_desc = U_("<b>%s</b> has published free/busy information.");
+ itip_title = U_("Free/Busy Information");
options = NULL;
break;
case ICAL_METHOD_REQUEST:
- itip_desc = _("<b>%s</b> requests your free/busy information.");
- itip_title = _("Free/Busy Request");
+ itip_desc = U_("<b>%s</b> requests your free/busy information.");
+ itip_title = U_("Free/Busy Request");
options = get_request_fb_options ();
break;
case ICAL_METHOD_REPLY:
- itip_desc = _("<b>%s</b> has replied to a free/busy request.");
- itip_title = _("Free/Busy Reply");
+ itip_desc = U_("<b>%s</b> has replied to a free/busy request.");
+ itip_title = U_("Free/Busy Reply");
options = NULL;
break;
default:
- itip_desc = _("<b>%s</b> has sent an unintelligible message.");
- itip_title = _("Bad Free/Busy Message");
+ itip_desc = U_("<b>%s</b> has sent an unintelligible message.");
+ itip_title = U_("Bad Free/Busy Message");
options = NULL;
}
@@ -1273,12 +1474,12 @@ show_current (EItipControl *itip)
priv = itip->priv;
if (priv->comp)
- g_object_unref (priv->comp);
+ gtk_object_unref (GTK_OBJECT (priv->comp));
if (priv->event_client != NULL)
- g_object_unref (priv->event_client);
+ gtk_object_unref (GTK_OBJECT (priv->event_client));
priv->event_client = NULL;
if (priv->task_client != NULL)
- g_object_unref (priv->task_client);
+ gtk_object_unref (GTK_OBJECT (priv->task_client));
priv->task_client = NULL;
/* Determine any delegate sections */
@@ -1309,8 +1510,8 @@ show_current (EItipControl *itip)
priv->comp = cal_component_new ();
if (!cal_component_set_icalcomponent (priv->comp, priv->ical_comp)) {
- write_error_html (itip, _("The message does not appear to be properly formed"));
- g_object_unref (priv->comp);
+ write_error_html (itip, U_("The message does not appear to be properly formed"));
+ gtk_object_unref (GTK_OBJECT (priv->comp));
priv->comp = NULL;
return;
};
@@ -1371,7 +1572,7 @@ show_current (EItipControl *itip)
show_current_freebusy (itip);
break;
default:
- write_error_html (itip, _("The message contains only unsupported requests."));
+ write_error_html (itip, U_("The message contains only unsupported requests."));
}
find_my_address (itip, priv->ical_comp);
@@ -1399,13 +1600,13 @@ e_itip_control_set_data (EItipControl *itip, const gchar *text)
priv->main_comp = icalparser_parse_string (priv->vcalendar);
if (priv->main_comp == NULL) {
- write_error_html (itip, _("The attachment does not contain a valid calendar message"));
+ write_error_html (itip, U_("The attachment does not contain a valid calendar message"));
return;
}
prop = icalcomponent_get_first_property (priv->main_comp, ICAL_METHOD_PROPERTY);
if (prop == NULL) {
- write_error_html (itip, _("The attachment does not contain a valid calendar message"));
+ write_error_html (itip, U_("The attachment does not contain a valid calendar message"));
return;
}
@@ -1430,7 +1631,7 @@ e_itip_control_set_data (EItipControl *itip, const gchar *text)
priv->ical_comp = get_next (&priv->iter);
if (priv->ical_comp == NULL) {
- write_error_html (itip, _("The attachment has no viewable calendar items"));
+ write_error_html (itip, U_("The attachment has no viewable calendar items"));
return;
}
@@ -1647,6 +1848,7 @@ update_item (EItipControl *itip)
clone = icalcomponent_new_clone (priv->ical_comp);
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) {
@@ -1767,7 +1969,7 @@ update_attendee_status (EItipControl *itip)
cleanup:
if (comp != NULL)
- g_object_unref (comp);
+ gtk_object_unref (GTK_OBJECT (comp));
gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
}
@@ -1822,7 +2024,7 @@ send_item (EItipControl *itip)
default:
itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, NULL, NULL);
}
- g_object_unref (comp);
+ gtk_object_unref (GTK_OBJECT (comp));
dialog = gnome_ok_dialog (_("Item sent!\n"));
} else {
dialog = gnome_warning_dialog (_("The item could not be sent!\n"));
@@ -1871,7 +2073,7 @@ send_freebusy (EItipControl *itip)
CalComponent *comp = CAL_COMPONENT (l->data);
itip_send_comp (CAL_COMPONENT_METHOD_REPLY, comp, priv->event_client, NULL);
- g_object_unref (comp);
+ gtk_object_unref (GTK_OBJECT (comp));
}
dialog = gnome_ok_dialog (_("Item sent!\n"));
@@ -1898,7 +2100,7 @@ button_selected_cb (EvolutionFolderSelectorButton *button, GNOME_Evolution_Folde
else
uri = cal_util_expand_uri (folder->physicalUri, FALSE);
- g_object_unref (priv->event_client);
+ gtk_object_unref (GTK_OBJECT (priv->event_client));
priv->event_client = start_calendar_server (uri);
g_free (uri);
@@ -1966,7 +2168,8 @@ object_requested_cb (GtkHTML *html, GtkHTMLEmbedded *eb, gpointer data)
button = NULL;
}
- g_signal_connect (button, "selected", G_CALLBACK (button_selected_cb), itip);
+ gtk_signal_connect (GTK_OBJECT (button), "selected",
+ button_selected_cb, itip);
gtk_container_add (GTK_CONTAINER (eb), button);
gtk_widget_show (button);
@@ -2033,7 +2236,7 @@ ok_clicked_cb (GtkHTML *html, const gchar *method, const gchar *url, const gchar
send_item (itip);
break;
case 'C':
- remove_item (itip);
+ update_item (itip);
break;
}
}
@@ -2106,6 +2309,6 @@ ok_clicked_cb (GtkHTML *html, const gchar *method, const gchar *url, const gchar
default:
itip_send_comp (CAL_COMPONENT_METHOD_REPLY, comp, NULL, NULL);
}
- g_object_unref (comp);
+ gtk_object_unref (GTK_OBJECT (comp));
}
}
diff --git a/calendar/gui/e-meeting-model.c b/calendar/gui/e-meeting-model.c
index fd1ffa50df..7af701bf6d 100644
--- a/calendar/gui/e-meeting-model.c
+++ b/calendar/gui/e-meeting-model.c
@@ -25,9 +25,11 @@
#endif
#include <glib.h>
+#include <liboaf/liboaf.h>
#include <bonobo/bonobo-control.h>
#include <bonobo/bonobo-widget.h>
#include <bonobo/bonobo-exception.h>
+#include <libgnome/gnome-defs.h>
#include <libgnome/gnome-i18n.h>
#include <libgnome/gnome-util.h>
#include <libgnomevfs/gnome-vfs.h>
@@ -35,6 +37,7 @@
#include <gal/e-table/e-cell-text.h>
#include <gal/e-table/e-cell-popup.h>
#include <gal/e-table/e-cell-combo.h>
+#include <gal/util/e-unicode-i18n.h>
#include <ebook/e-book.h>
#include <ebook/e-card-types.h>
#include <ebook/e-card-cursor.h>
@@ -406,6 +409,7 @@ append_row (ETableModel *etm, ETableModel *source, int row)
e_meeting_attendee_set_language (ia, g_strdup (e_table_model_value_at (source, E_MEETING_MODEL_LANGUAGE_COL, row)));
e_meeting_model_add_attendee (E_MEETING_MODEL (etm), ia);
+ gtk_object_unref (GTK_OBJECT (ia));
}
static void *
@@ -717,7 +721,7 @@ destroy (GtkObject *obj)
priv = im->priv;
for (i = 0; i < priv->attendees->len; i++)
- g_object_unref (g_ptr_array_index (priv->attendees, i));
+ gtk_object_unref (GTK_OBJECT (g_ptr_array_index (priv->attendees, i)));
g_ptr_array_free (priv->attendees, TRUE);
for (l = priv->tables; l != NULL; l = l->next)
@@ -725,10 +729,10 @@ destroy (GtkObject *obj)
g_list_free (priv->tables);
if (priv->client != NULL)
- g_object_unref (priv->client);
+ gtk_object_unref (GTK_OBJECT (priv->client));
if (priv->ebook != NULL)
- g_object_unref (priv->ebook);
+ gtk_object_unref (GTK_OBJECT (priv->ebook));
if (priv->corba_select_names != CORBA_OBJECT_NIL) {
CORBA_Environment ev;
@@ -751,7 +755,7 @@ destroy (GtkObject *obj)
GtkObject *
e_meeting_model_new (void)
{
- return g_object_new (E_TYPE_MEETING_MODEL, NULL);
+ return gtk_type_new (E_TYPE_MEETING_MODEL);
}
@@ -773,10 +777,10 @@ e_meeting_model_set_cal_client (EMeetingModel *im, CalClient *client)
priv = im->priv;
if (priv->client != NULL)
- g_object_unref (priv->client);
+ gtk_object_unref (GTK_OBJECT (priv->client));
if (client != NULL)
- g_object_ref (client);
+ gtk_object_ref (GTK_OBJECT (client));
priv->client = client;
}
@@ -821,14 +825,14 @@ build_etable (ETableModel *model, const gchar *spec_file, const gchar *state_fil
cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT);
popup_cell = e_cell_combo_new ();
e_cell_popup_set_child (E_CELL_POPUP (popup_cell), cell);
- g_object_unref (cell);
+ gtk_object_unref (GTK_OBJECT (cell));
strings = NULL;
- strings = g_list_append (strings, (char*) _("Individual"));
- strings = g_list_append (strings, (char*) _("Group"));
- strings = g_list_append (strings, (char*) _("Resource"));
- strings = g_list_append (strings, (char*) _("Room"));
- strings = g_list_append (strings, (char*) _("Unknown"));
+ strings = g_list_append (strings, (char*) U_("Individual"));
+ strings = g_list_append (strings, (char*) U_("Group"));
+ strings = g_list_append (strings, (char*) U_("Resource"));
+ strings = g_list_append (strings, (char*) U_("Room"));
+ strings = g_list_append (strings, (char*) U_("Unknown"));
e_cell_combo_set_popdown_strings (E_CELL_COMBO (popup_cell), strings);
e_table_extras_add_cell (extras, "typeedit", popup_cell);
@@ -837,14 +841,14 @@ build_etable (ETableModel *model, const gchar *spec_file, const gchar *state_fil
cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT);
popup_cell = e_cell_combo_new ();
e_cell_popup_set_child (E_CELL_POPUP (popup_cell), cell);
- g_object_unref (cell);
+ gtk_object_unref (GTK_OBJECT (cell));
strings = NULL;
- strings = g_list_append (strings, (char*) _("Chair"));
- strings = g_list_append (strings, (char*) _("Required Participant"));
- strings = g_list_append (strings, (char*) _("Optional Participant"));
- strings = g_list_append (strings, (char*) _("Non-Participant"));
- strings = g_list_append (strings, (char*) _("Unknown"));
+ strings = g_list_append (strings, (char*) U_("Chair"));
+ strings = g_list_append (strings, (char*) U_("Required Participant"));
+ strings = g_list_append (strings, (char*) U_("Optional Participant"));
+ strings = g_list_append (strings, (char*) U_("Non-Participant"));
+ strings = g_list_append (strings, (char*) U_("Unknown"));
e_cell_combo_set_popdown_strings (E_CELL_COMBO (popup_cell), strings);
e_table_extras_add_cell (extras, "roleedit", popup_cell);
@@ -853,11 +857,11 @@ build_etable (ETableModel *model, const gchar *spec_file, const gchar *state_fil
cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT);
popup_cell = e_cell_combo_new ();
e_cell_popup_set_child (E_CELL_POPUP (popup_cell), cell);
- g_object_unref (cell);
+ gtk_object_unref (GTK_OBJECT (cell));
strings = NULL;
- strings = g_list_append (strings, (char*) _("Yes"));
- strings = g_list_append (strings, (char*) _("No"));
+ strings = g_list_append (strings, (char*) U_("Yes"));
+ strings = g_list_append (strings, (char*) U_("No"));
e_cell_combo_set_popdown_strings (E_CELL_COMBO (popup_cell), strings);
e_table_extras_add_cell (extras, "rsvpedit", popup_cell);
@@ -866,30 +870,32 @@ build_etable (ETableModel *model, const gchar *spec_file, const gchar *state_fil
cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT);
popup_cell = e_cell_combo_new ();
e_cell_popup_set_child (E_CELL_POPUP (popup_cell), cell);
- g_object_unref (cell);
+ gtk_object_unref (GTK_OBJECT (cell));
strings = NULL;
- strings = g_list_append (strings, (char*) _("Needs Action"));
- strings = g_list_append (strings, (char*) _("Accepted"));
- strings = g_list_append (strings, (char*) _("Declined"));
- strings = g_list_append (strings, (char*) _("Tentative"));
- strings = g_list_append (strings, (char*) _("Delegated"));
+ strings = g_list_append (strings, (char*) U_("Needs Action"));
+ strings = g_list_append (strings, (char*) U_("Accepted"));
+ strings = g_list_append (strings, (char*) U_("Declined"));
+ strings = g_list_append (strings, (char*) U_("Tentative"));
+ strings = g_list_append (strings, (char*) U_("Delegated"));
e_cell_combo_set_popdown_strings (E_CELL_COMBO (popup_cell), strings);
e_table_extras_add_cell (extras, "statusedit", popup_cell);
etable = e_table_scrolled_new_from_spec_file (model, extras, spec_file, NULL);
real_table = e_table_scrolled_get_table (E_TABLE_SCROLLED (etable));
- g_object_set (G_OBJECT (real_table), "uniform_row_height", TRUE, NULL);
+ gtk_object_set (GTK_OBJECT (real_table), "uniform_row_height", TRUE, NULL);
e_table_load_state (real_table, state_file);
#if 0
- g_signal_connect (real_table, "right_click", G_CALLBACK (right_click_cb), mpage);
+ gtk_signal_connect (GTK_OBJECT (real_table),
+ "right_click", GTK_SIGNAL_FUNC (right_click_cb), mpage);
#endif
- g_signal_connect (etable, "destroy", G_CALLBACK (table_destroy_state_cb), g_strdup (state_file));
+ gtk_signal_connect (GTK_OBJECT (etable), "destroy",
+ GTK_SIGNAL_FUNC (table_destroy_state_cb), g_strdup (state_file));
- g_object_unref (extras);
+ gtk_object_unref (GTK_OBJECT (extras));
return E_TABLE_SCROLLED (etable);
}
@@ -903,10 +909,11 @@ e_meeting_model_add_attendee (EMeetingModel *im, EMeetingAttendee *ia)
e_table_model_pre_change (E_TABLE_MODEL (im));
- g_object_ref (ia);
+ gtk_object_ref (GTK_OBJECT (ia));
g_ptr_array_add (priv->attendees, ia);
- g_signal_connect (ia, "changed", G_CALLBACK (attendee_changed_cb), im);
+ gtk_signal_connect (GTK_OBJECT (ia), "changed",
+ GTK_SIGNAL_FUNC (attendee_changed_cb), im);
e_table_model_row_inserted (E_TABLE_MODEL (im), row_count (E_TABLE_MODEL (im)) - 1);
}
@@ -966,7 +973,7 @@ e_meeting_model_remove_attendee (EMeetingModel *im, EMeetingAttendee *ia)
e_table_model_pre_change (E_TABLE_MODEL (im));
g_ptr_array_remove_index (priv->attendees, row);
- g_object_unref (ia);
+ gtk_object_unref (GTK_OBJECT (ia));
e_table_model_row_deleted (E_TABLE_MODEL (im), row);
}
@@ -986,7 +993,7 @@ e_meeting_model_remove_all_attendees (EMeetingModel *im)
for (i = 0; i < len; i++) {
EMeetingAttendee *ia = g_ptr_array_index (priv->attendees, i);
- g_object_unref (ia);
+ gtk_object_unref (GTK_OBJECT (ia));
}
g_ptr_array_set_size (priv->attendees, 0);
@@ -1181,7 +1188,7 @@ refresh_queue_add (EMeetingModel *im, int row,
g_ptr_array_add (qdata->data, data);
}
- g_object_ref (ia);
+ gtk_object_ref (GTK_OBJECT (ia));
g_ptr_array_add (priv->refresh_queue, ia);
if (priv->refresh_idle_id == -1)
@@ -1207,7 +1214,7 @@ refresh_queue_remove (EMeetingModel *im, EMeetingAttendee *ia)
/* Unref the attendee */
g_ptr_array_remove (priv->refresh_queue, ia);
- g_object_unref (ia);
+ gtk_object_unref (GTK_OBJECT (ia));
}
static void
@@ -1454,8 +1461,7 @@ cursor_cb (EBook *book, EBookStatus status, ECardCursor *cursor, gpointer data)
continue;
/* Read in free/busy data from the url */
- gnome_vfs_async_open (&handle, card->fburl, GNOME_VFS_OPEN_READ,
- GNOME_VFS_PRIORITY_DEFAULT, async_open, qdata);
+ gnome_vfs_async_open (&handle, card->fburl, GNOME_VFS_OPEN_READ, async_open, qdata);
return;
}
@@ -1607,7 +1613,8 @@ e_meeting_model_etable_from_model (EMeetingModel *im, const gchar *spec_file, co
priv->tables = g_list_prepend (priv->tables, ets);
- g_signal_connect (ets, "destroy", G_CALLBACK (table_destroy_list_cb), im);
+ gtk_signal_connect (GTK_OBJECT (ets), "destroy",
+ GTK_SIGNAL_FUNC (table_destroy_list_cb), im);
return ets;
}
@@ -1630,7 +1637,7 @@ e_meeting_model_etable_click_to_add (EMeetingModel *im, gboolean click_to_add)
ets = l->data;
real_table = e_table_scrolled_get_table (ets);
- g_object_set (G_OBJECT (real_table), "use_click_to_add", click_to_add, NULL);
+ gtk_object_set (GTK_OBJECT (real_table), "use_click_to_add", click_to_add, NULL);
}
}
@@ -1711,7 +1718,7 @@ get_select_name_dialog (EMeetingModel *im)
control_widget = bonobo_widget_new_control_from_objref (corba_control, CORBA_OBJECT_NIL);
- bonobo_widget_set_property (BONOBO_WIDGET (control_widget), "text", TC_CORBA_string, "", NULL);
+ bonobo_widget_set_property (BONOBO_WIDGET (control_widget), "text", "", NULL);
}
CORBA_exception_free (&ev);
@@ -1720,7 +1727,7 @@ get_select_name_dialog (EMeetingModel *im)
CORBA_exception_init (&ev);
- priv->corba_select_names = bonobo_activation_activate_from_id (SELECT_NAMES_OAFID, 0, NULL, &ev);
+ priv->corba_select_names = oaf_activate_from_id (SELECT_NAMES_OAFID, 0, NULL, &ev);
for (i = 0; sections[i] != NULL; i++)
add_section (priv->corba_select_names, sections[i]);
@@ -1809,12 +1816,14 @@ select_names_ok_cb (BonoboListener *listener,
control_widget = bonobo_widget_new_control_from_objref
(corba_control, CORBA_OBJECT_NIL);
- bonobo_widget_get_property (BONOBO_WIDGET (control_widget), "destinations", TC_CORBA_string, &string, NULL);
+ bonobo_widget_get_property (BONOBO_WIDGET (control_widget), "destinations", &string, NULL);
destv = e_destination_importv (string);
if (destv != NULL) {
process_section (im, destv, roles[i]);
e_destination_freev (destv);
}
+
+ g_free (string);
}
}
diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c
index 88a6565e16..e850dbc7e2 100644
--- a/calendar/gui/e-week-view.c
+++ b/calendar/gui/e-week-view.c
@@ -39,11 +39,13 @@
#include <gtk/gtkvscrollbar.h>
#include <gtk/gtkwindow.h>
#include <gtk/gtkmain.h>
+#include <libgnome/gnome-defs.h>
+#include <libgnome/gnome-i18n.h>
#include <libgnome/gnome-i18n.h>
#include <libgnome/gnome-exec.h>
#include <libgnome/gnome-util.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <libgnomecanvas/gnome-canvas-pixbuf.h>
+#include <gdk-pixbuf/gnome-canvas-pixbuf.h>
#include <gal/e-text/e-text.h>
#include <gal/widgets/e-canvas-utils.h>
#include <gal/widgets/e-gui-utils.h>
@@ -282,11 +284,13 @@ e_week_view_class_init (EWeekViewClass *class)
e_week_view_signals[SELECTION_CHANGED] =
gtk_signal_new ("selection_changed",
GTK_RUN_LAST,
- G_TYPE_FROM_CLASS (object_class),
+ object_class->type,
GTK_SIGNAL_OFFSET (EWeekViewClass, selection_changed),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
+ gtk_object_class_add_signals (object_class, e_week_view_signals, LAST_SIGNAL);
+
/* Method override */
object_class->destroy = e_week_view_destroy;
@@ -298,6 +302,7 @@ e_week_view_class_init (EWeekViewClass *class)
widget_class->focus_out_event = e_week_view_focus_out;
widget_class->key_press_event = e_week_view_key_press;
widget_class->expose_event = e_week_view_expose_event;
+ widget_class->draw = e_week_view_draw;
class->selection_changed = NULL;
@@ -406,12 +411,18 @@ e_week_view_init (EWeekView *week_view)
"EWeekViewMainItem::week_view", week_view,
NULL);
- g_signal_connect_after (week_view->main_canvas, "button_press_event",
- G_CALLBACK (e_week_view_on_button_press), week_view);
- g_signal_connect_after (week_view->main_canvas, "button_release_event",
- G_CALLBACK (e_week_view_on_button_release), week_view);
- g_signal_connect_after (week_view->main_canvas, "motion_notify_event",
- G_CALLBACK (e_week_view_on_motion), week_view);
+ gtk_signal_connect_after (GTK_OBJECT (week_view->main_canvas),
+ "button_press_event",
+ GTK_SIGNAL_FUNC (e_week_view_on_button_press),
+ week_view);
+ gtk_signal_connect_after (GTK_OBJECT (week_view->main_canvas),
+ "button_release_event",
+ GTK_SIGNAL_FUNC (e_week_view_on_button_release),
+ week_view);
+ gtk_signal_connect_after (GTK_OBJECT (week_view->main_canvas),
+ "motion_notify_event",
+ GTK_SIGNAL_FUNC (e_week_view_on_motion),
+ week_view);
/* Create the buttons to jump to each days. */
pixbuf = gdk_pixbuf_new_from_xpm_data ((const char**) jump_xpm);
@@ -423,8 +434,10 @@ e_week_view_init (EWeekView *week_view)
"GnomeCanvasPixbuf::pixbuf", pixbuf,
NULL);
- g_signal_connect (week_view->jump_buttons[i], "event",
- G_CALLBACK (e_week_view_on_jump_button_event), week_view);
+ gtk_signal_connect (GTK_OBJECT (week_view->jump_buttons[i]),
+ "event",
+ GTK_SIGNAL_FUNC (e_week_view_on_jump_button_event),
+ week_view);
}
gdk_pixbuf_unref (pixbuf);
@@ -433,7 +446,7 @@ e_week_view_init (EWeekView *week_view)
*/
adjustment = gtk_adjustment_new (0, -52, 52, 1, 1, 1);
gtk_signal_connect (adjustment, "value_changed",
- G_CALLBACK (e_week_view_on_adjustment_changed),
+ GTK_SIGNAL_FUNC (e_week_view_on_adjustment_changed),
week_view);
week_view->vscrollbar = gtk_vscrollbar_new (GTK_ADJUSTMENT (adjustment));
@@ -453,16 +466,22 @@ e_week_view_init (EWeekView *week_view)
clipboard_atom,
GDK_SELECTION_TYPE_STRING,
0);
-
- g_signal_connect (week_view->invisible, "selection_get",
- G_CALLBACK (selection_get), (gpointer) week_view);
- g_signal_connect (week_view->invisible, "selection_clear_event",
- G_CALLBACK (selection_clear_event), (gpointer) week_view);
- g_signal_connect (week_view->invisible, "selection_received",
- G_CALLBACK (selection_received), (gpointer) week_view);
- g_signal_connect (week_view->invisible, "destroy",
- G_CALLBACK (invisible_destroyed), (gpointer) week_view);
-
+ gtk_signal_connect (GTK_OBJECT (week_view->invisible),
+ "selection_get",
+ GTK_SIGNAL_FUNC (selection_get),
+ (gpointer) week_view);
+ gtk_signal_connect (GTK_OBJECT (week_view->invisible),
+ "selection_clear_event",
+ GTK_SIGNAL_FUNC (selection_clear_event),
+ (gpointer) week_view);
+ gtk_signal_connect (GTK_OBJECT (week_view->invisible),
+ "selection_received",
+ GTK_SIGNAL_FUNC (selection_received),
+ (gpointer) week_view);
+ gtk_signal_connect (GTK_OBJECT (week_view->invisible),
+ "destroy",
+ GTK_SIGNAL_FUNC (invisible_destroyed),
+ (gpointer) week_view);
week_view->clipboard_selection = NULL;
week_view->activity = NULL;
@@ -480,7 +499,7 @@ e_week_view_new (void)
{
GtkWidget *week_view;
- week_view = GTK_WIDGET (g_object_new (e_week_view_get_type (), NULL));
+ week_view = GTK_WIDGET (gtk_type_new (e_week_view_get_type ()));
return week_view;
}
@@ -501,7 +520,7 @@ e_week_view_destroy (GtkObject *object)
if (week_view->client) {
gtk_signal_disconnect_by_data (GTK_OBJECT (week_view->client), week_view);
- g_object_unref (week_view->client);
+ gtk_object_unref (GTK_OBJECT (week_view->client));
week_view->client = NULL;
}
@@ -512,7 +531,7 @@ e_week_view_destroy (GtkObject *object)
if (week_view->query) {
gtk_signal_disconnect_by_data (GTK_OBJECT (week_view->query), week_view);
- g_object_unref (week_view->query);
+ gtk_object_unref (GTK_OBJECT (week_view->query));
week_view->query = NULL;
}
@@ -538,7 +557,7 @@ e_week_view_destroy (GtkObject *object)
}
if (week_view->activity) {
- g_object_unref (week_view->activity);
+ gtk_object_unref (GTK_OBJECT (week_view->activity));
week_view->activity = NULL;
}
@@ -630,7 +649,8 @@ e_week_view_unrealize (GtkWidget *widget)
week_view->main_gc = NULL;
colormap = gtk_widget_get_colormap (widget);
- gdk_colormap_free_colors (colormap, week_view->colors, E_WEEK_VIEW_COLOR_LAST);
+ for (i = 0; i < E_WEEK_VIEW_COLOR_LAST; i++)
+ gdk_colors_free (colormap, &week_view->colors[i].pixel, 1, 0);
gdk_pixmap_unref (week_view->reminder_icon);
week_view->reminder_icon = NULL;
@@ -659,7 +679,7 @@ e_week_view_style_set (GtkWidget *widget,
(*GTK_WIDGET_CLASS (parent_class)->style_set)(widget, previous_style);
week_view = E_WEEK_VIEW (widget);
- font = gtk_style_get_font (gtk_widget_get_style (widget));
+ font = widget->style->font;
/* Recalculate the height of each row based on the font size. */
week_view->row_height = font->ascent + font->descent + E_WEEK_VIEW_EVENT_BORDER_HEIGHT * 2 + E_WEEK_VIEW_EVENT_TEXT_Y_PAD * 2;
@@ -791,7 +811,6 @@ e_week_view_recalc_cell_sizes (EWeekView *week_view)
gfloat canvas_width, canvas_height, offset;
gint row, col;
GtkWidget *widget;
- GtkStyle *style;
GdkFont *font;
gint width, height, time_width;
@@ -840,13 +859,11 @@ e_week_view_recalc_cell_sizes (EWeekView *week_view)
/* If the font hasn't been set yet just return. */
widget = GTK_WIDGET (week_view);
- style = gtk_widget_get_style (widget);
- if (!style)
- return;
- font = gtk_style_get_font (style);
- if (!font)
+ if (!widget->style || ! widget->style->font)
return;
+ font = widget->style->font;
+
/* Calculate the number of rows of events in each cell, for the large
cells and the compressed weekend cells. */
if (week_view->multi_week_view) {
@@ -950,6 +967,22 @@ e_week_view_expose_event (GtkWidget *widget,
return FALSE;
}
+
+static void
+e_week_view_draw (GtkWidget *widget,
+ GdkRectangle *area)
+{
+ EWeekView *week_view;
+
+ week_view = E_WEEK_VIEW (widget);
+
+ e_week_view_draw_shadow (week_view);
+
+ if (GTK_WIDGET_CLASS (parent_class)->draw)
+ (*GTK_WIDGET_CLASS (parent_class)->draw)(widget, area);
+}
+
+
static void
e_week_view_draw_shadow (EWeekView *week_view)
{
@@ -1062,7 +1095,7 @@ query_obj_updated_cb (CalQuery *query, const char *uid,
g_print ("updated object's dates unchanged\n");
#endif
e_week_view_foreach_event_with_uid (week_view, uid, e_week_view_update_event_cb, comp);
- g_object_unref (comp);
+ gtk_object_unref (GTK_OBJECT (comp));
gtk_widget_queue_draw (week_view->main_canvas);
return;
}
@@ -1087,7 +1120,7 @@ query_obj_updated_cb (CalQuery *query, const char *uid,
cal_client_resolve_tzid_cb, week_view->client,
week_view->zone);
- g_object_unref (comp);
+ gtk_object_unref (GTK_OBJECT (comp));
e_week_view_queue_layout (week_view);
}
@@ -1194,7 +1227,7 @@ update_query (EWeekView *week_view)
if (old_query) {
gtk_signal_disconnect_by_data (GTK_OBJECT (old_query), week_view);
- g_object_unref (old_query);
+ gtk_object_unref (GTK_OBJECT (old_query));
}
g_assert (week_view->sexp != NULL);
@@ -1213,14 +1246,14 @@ update_query (EWeekView *week_view)
return;
}
- g_signal_connect (week_view->query, "obj_updated",
- G_CALLBACK (query_obj_updated_cb), week_view);
- g_signal_connect (week_view->query, "obj_removed",
- G_CALLBACK (query_obj_removed_cb), week_view);
- g_signal_connect (week_view->query, "query_done",
- G_CALLBACK (query_query_done_cb), week_view);
- g_signal_connect (week_view->query, "eval_error",
- G_CALLBACK (query_eval_error_cb), week_view);
+ gtk_signal_connect (GTK_OBJECT (week_view->query), "obj_updated",
+ GTK_SIGNAL_FUNC (query_obj_updated_cb), week_view);
+ gtk_signal_connect (GTK_OBJECT (week_view->query), "obj_removed",
+ GTK_SIGNAL_FUNC (query_obj_removed_cb), week_view);
+ gtk_signal_connect (GTK_OBJECT (week_view->query), "query_done",
+ GTK_SIGNAL_FUNC (query_query_done_cb), week_view);
+ gtk_signal_connect (GTK_OBJECT (week_view->query), "eval_error",
+ GTK_SIGNAL_FUNC (query_eval_error_cb), week_view);
}
/* Callback used when the calendar client finishes opening */
@@ -1258,11 +1291,11 @@ e_week_view_set_cal_client (EWeekView *week_view,
g_return_if_fail (IS_CAL_CLIENT (client));
if (client)
- g_object_ref (client);
+ gtk_object_ref (GTK_OBJECT (client));
if (week_view->client) {
gtk_signal_disconnect_by_data (GTK_OBJECT (week_view->client), week_view);
- g_object_unref (week_view->client);
+ gtk_object_unref (GTK_OBJECT (week_view->client));
}
week_view->client = client;
@@ -1271,8 +1304,8 @@ e_week_view_set_cal_client (EWeekView *week_view,
if (cal_client_get_load_state (week_view->client) == CAL_CLIENT_LOAD_LOADED)
update_query (week_view);
else
- g_signal_connect (week_view->client, "cal_opened",
- G_CALLBACK (cal_opened_cb), week_view);
+ gtk_signal_connect (GTK_OBJECT (week_view->client), "cal_opened",
+ GTK_SIGNAL_FUNC (cal_opened_cb), week_view);
}
}
@@ -1972,9 +2005,9 @@ e_week_view_update_event_cb (EWeekView *week_view,
event = &g_array_index (week_view->events, EWeekViewEvent, event_num);
- g_object_unref (event->comp);
+ gtk_object_unref (GTK_OBJECT (event->comp));
event->comp = comp;
- g_object_ref (comp);
+ gtk_object_ref (GTK_OBJECT (comp));
for (span_num = 0; span_num < event->num_spans; span_num++) {
span = &g_array_index (week_view->spans, EWeekViewEventSpan,
@@ -2059,7 +2092,7 @@ e_week_view_remove_event_cb (EWeekView *week_view,
}
}
- g_object_unref (event->comp);
+ gtk_object_unref (GTK_OBJECT (event->comp));
g_array_remove_index (week_view->events, event_num);
week_view->events_need_layout = TRUE;
@@ -2404,7 +2437,7 @@ e_week_view_free_events (EWeekView *week_view)
for (event_num = 0; event_num < week_view->events->len; event_num++) {
event = &g_array_index (week_view->events, EWeekViewEvent,
event_num);
- g_object_unref (event->comp);
+ gtk_object_unref (GTK_OBJECT (event->comp));
}
g_array_set_size (week_view->events, 0);
@@ -2471,7 +2504,7 @@ e_week_view_add_event (CalComponent *comp,
week_view->zone);
event.comp = comp;
- g_object_ref (event.comp);
+ gtk_object_ref (GTK_OBJECT (event.comp));
event.start = start;
event.end = end;
event.spans_index = 0;
@@ -2633,7 +2666,7 @@ e_week_view_reshape_event_span (EWeekView *week_view,
span = &g_array_index (week_view->spans, EWeekViewEventSpan,
event->spans_index + span_num);
comp = event->comp;
- font = gtk_style_get_font (gtk_widget_get_style (GTK_WIDGET (week_view)));
+ font = GTK_WIDGET (week_view)->style->font;
one_day_event = e_week_view_is_one_day_event (week_view, event_num);
@@ -2705,7 +2738,7 @@ e_week_view_reshape_event_span (EWeekView *week_view,
span->text_item =
gnome_canvas_item_new (GNOME_CANVAS_GROUP (GNOME_CANVAS (week_view->main_canvas)->root),
e_text_get_type (),
- "font_gdk", font,
+ "font_gdk", GTK_WIDGET (week_view)->style->font,
"anchor", GTK_ANCHOR_NW,
"clip", TRUE,
#if 0
@@ -2716,9 +2749,9 @@ e_week_view_reshape_event_span (EWeekView *week_view,
"use_ellipsis", TRUE,
"fill_color_rgba", GNOME_CANVAS_COLOR(0, 0, 0),
NULL);
- g_signal_connect (span->text_item, "event",
- G_CALLBACK (e_week_view_on_text_item_event),
- week_view);
+ gtk_signal_connect (GTK_OBJECT (span->text_item), "event",
+ GTK_SIGNAL_FUNC (e_week_view_on_text_item_event),
+ week_view);
}
/* Calculate the position of the text item.
@@ -2789,7 +2822,9 @@ e_week_view_reshape_event_span (EWeekView *week_view,
/* Get the width of the text of the event. This is a
bit of a hack. It would be better if EText could
tell us this. */
- g_object_get (G_OBJECT (span->text_item), "text", &text, NULL);
+ gtk_object_get (GTK_OBJECT (span->text_item),
+ "text", &text,
+ NULL);
text_width = 0;
if (text) {
/* It should only have one line of text in it.
@@ -2941,7 +2976,9 @@ e_week_view_start_editing_event (EWeekView *week_view,
e_canvas_item_grab_focus (span->text_item, TRUE);
/* Try to move the cursor to the end of the text. */
- g_object_get (G_OBJECT (span->text_item), "event_processor", &event_processor, NULL);
+ gtk_object_get (GTK_OBJECT (span->text_item),
+ "event_processor", &event_processor,
+ NULL);
if (event_processor) {
command.action = E_TEP_MOVE;
command.position = E_TEP_END_OF_BUFFER;
@@ -2988,7 +3025,9 @@ cancel_editing (EWeekView *week_view)
/* Reset the text to what was in the component */
cal_component_get_summary (event->comp, &summary);
- g_object_set (G_OBJECT (span->text_item), "text", summary.value ? summary.value : "", NULL);
+ gtk_object_set (GTK_OBJECT (span->text_item),
+ "text", summary.value ? summary.value : "",
+ NULL);
/* Stop editing */
e_week_view_stop_editing_event (week_view);
@@ -3066,8 +3105,8 @@ e_week_view_on_text_item_event (GnomeCanvasItem *item,
e = &g_array_index (week_view->events, EWeekViewEvent, event_num);
destroyed = FALSE;
- id = g_signal_connect (e->comp, "destroy",
- G_CALLBACK (comp_destroy_cb), &destroyed);
+ id = gtk_signal_connect (GTK_OBJECT (e->comp), "destroy",
+ GTK_SIGNAL_FUNC (comp_destroy_cb), &destroyed);
if (!GTK_WIDGET_HAS_FOCUS (week_view))
gtk_widget_grab_focus (GTK_WIDGET (week_view));
@@ -3212,7 +3251,9 @@ e_week_view_on_editing_stopped (EWeekView *week_view,
if (!uid)
return;
- g_object_get (G_OBJECT (span->text_item), "text", &text, NULL);
+ gtk_object_get (GTK_OBJECT (span->text_item),
+ "text", &text,
+ NULL);
g_assert (text != NULL);
if (string_is_empty (text) && !cal_comp_is_on_server (event->comp, week_view->client)) {
@@ -3427,7 +3468,7 @@ e_week_view_key_press (GtkWidget *widget, GdkEventKey *event)
if (initial_text)
g_free (initial_text);
- g_object_unref (comp);
+ gtk_object_unref (GTK_OBJECT (comp));
return TRUE;
}
@@ -3591,7 +3632,8 @@ e_week_view_show_popup_menu (EWeekView *week_view,
week_view->popup_event_num = event_num;
popup = e_popup_menu_create (context_menu, disable_mask, hide_mask, week_view);
- g_signal_connect (popup, "selection-done", G_CALLBACK (free_view_popup), week_view);
+ gtk_signal_connect (GTK_OBJECT (popup), "selection-done",
+ GTK_SIGNAL_FUNC (free_view_popup), week_view);
e_popup_menu (popup, (GdkEvent *) bevent);
}
@@ -3816,7 +3858,7 @@ e_week_view_on_publish (GtkWidget *widget, gpointer data)
itip_send_comp (CAL_COMPONENT_METHOD_PUBLISH, comp,
week_view->client, NULL);
- g_object_unref (comp);
+ gtk_object_unref (GTK_OBJECT (comp));
}
g_list_free (comp_list);
@@ -3857,7 +3899,7 @@ e_week_view_on_delete_occurrence (GtkWidget *widget, gpointer data)
if (cal_client_update_object (week_view->client, comp) != CAL_CLIENT_RESULT_SUCCESS)
g_message ("e_week_view_on_delete_occurrence(): Could not update the object!");
- g_object_unref (comp);
+ gtk_object_unref (GTK_OBJECT (comp));
}
@@ -4037,12 +4079,12 @@ e_week_view_on_unrecur_appointment (GtkWidget *widget, gpointer data)
if (cal_client_update_object (week_view->client, comp) != CAL_CLIENT_RESULT_SUCCESS)
g_message ("e_week_view_on_unrecur_appointment(): Could not update the object!");
- g_object_unref (comp);
+ gtk_object_unref (GTK_OBJECT (comp));
if (cal_client_update_object (week_view->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);
+ gtk_object_unref (GTK_OBJECT (new_comp));
}
@@ -4126,6 +4168,7 @@ e_week_view_get_time_string_width (EWeekView *week_view)
static void
invisible_destroyed (GtkWidget *invisible, EWeekView *week_view)
{
+ gtk_object_unref (GTK_OBJECT (week_view->invisible));
week_view->invisible = NULL;
}
@@ -4243,7 +4286,7 @@ selection_received (GtkWidget *invisible,
cal_client_update_object (week_view->client, comp);
g_free (uid);
- g_object_unref (comp);
+ gtk_object_unref (GTK_OBJECT (comp));
}
subcomp = icalcomponent_get_next_component (
icalcomp, ICAL_ANY_COMPONENT);
@@ -4285,7 +4328,7 @@ selection_received (GtkWidget *invisible,
itip_send_comp (CAL_COMPONENT_METHOD_REQUEST, comp, week_view->client, NULL);
g_free (uid);
- g_object_unref (comp);
+ gtk_object_unref (GTK_OBJECT (comp));
}
e_week_view_set_status_message (week_view, NULL);
@@ -4365,7 +4408,7 @@ e_week_view_set_status_message (EWeekView *week_view, const char *message)
if (!message || !*message) {
if (week_view->activity) {
- g_object_unref (week_view->activity);
+ gtk_object_unref (GTK_OBJECT (week_view->activity));
week_view->activity = NULL;
}
}
@@ -4374,7 +4417,7 @@ e_week_view_set_status_message (EWeekView *week_view, const char *message)
char *client_id = g_strdup_printf ("%p", week_view);
if (progress_icon[0] == NULL)
- progress_icon[0] = gdk_pixbuf_new_from_file (EVOLUTION_IMAGESDIR "/" EVOLUTION_CALENDAR_PROGRESS_IMAGE, NULL);
+ progress_icon[0] = gdk_pixbuf_new_from_file (EVOLUTION_IMAGESDIR "/" EVOLUTION_CALENDAR_PROGRESS_IMAGE);
week_view->activity = evolution_activity_client_new (
global_shell_client, client_id,
progress_icon, message, TRUE, &display);
diff --git a/calendar/gui/itip-utils.c b/calendar/gui/itip-utils.c
index 6bf95c9732..b00a32ffc9 100644
--- a/calendar/gui/itip-utils.c
+++ b/calendar/gui/itip-utils.c
@@ -26,11 +26,15 @@
#include <bonobo/bonobo-exception.h>
#include <bonobo/bonobo-object.h>
+#include <bonobo/bonobo-object-client.h>
#include <bonobo/bonobo-moniker-util.h>
+#include <bonobo-conf/bonobo-config-database.h>
+#include <libgnome/gnome-defs.h>
#include <libgnome/gnome-i18n.h>
#include <gtk/gtkwidget.h>
#include <gal/widgets/e-gui-utils.h>
#include <gal/widgets/e-unicode.h>
+#include <gal/util/e-unicode-i18n.h>
#include <gal/util/e-util.h>
#include <ical.h>
#include <Evolution-Composer.h>
@@ -340,7 +344,7 @@ comp_from (CalComponentItipMethod method, CalComponent *comp)
case CAL_COMPONENT_METHOD_ADD:
cal_component_get_organizer (comp, &organizer);
if (organizer.value == NULL) {
- e_notice (NULL, GTK_MESSAGE_ERROR,
+ e_notice (NULL, GNOME_MESSAGE_BOX_ERROR,
_("An organizer must be set."));
return NULL;
}
@@ -375,7 +379,7 @@ comp_to_list (CalComponentItipMethod method, CalComponent *comp, GList *users)
cal_component_get_attendee_list (comp, &attendees);
len = g_slist_length (attendees);
if (len <= 0) {
- e_notice (NULL, GTK_MESSAGE_ERROR,
+ e_notice (NULL, GNOME_MESSAGE_BOX_ERROR,
_("At least one attendee is necessary"));
cal_component_free_attendee_list (attendees);
return NULL;
@@ -411,7 +415,7 @@ comp_to_list (CalComponentItipMethod method, CalComponent *comp, GList *users)
case CAL_COMPONENT_METHOD_DECLINECOUNTER:
cal_component_get_organizer (comp, &organizer);
if (organizer.value == NULL) {
- e_notice (NULL, GTK_MESSAGE_ERROR,
+ e_notice (NULL, GNOME_MESSAGE_BOX_ERROR,
_("An organizer must be set."));
return NULL;
}
@@ -455,15 +459,15 @@ comp_subject (CalComponentItipMethod method, CalComponent *comp)
else {
switch (cal_component_get_vtype (comp)) {
case CAL_COMPONENT_EVENT:
- description = _("Event information");
+ description = U_("Event information");
case CAL_COMPONENT_TODO:
- description = _("Task information");
+ description = U_("Task information");
case CAL_COMPONENT_JOURNAL:
- description = _("Journal information");
+ description = U_("Journal information");
case CAL_COMPONENT_FREEBUSY:
- description = _("Free/Busy information");
+ description = U_("Free/Busy information");
default:
- description = _("Calendar information");
+ description = U_("Calendar information");
}
}
@@ -483,13 +487,13 @@ comp_subject (CalComponentItipMethod method, CalComponent *comp)
switch (a->status) {
case ICAL_PARTSTAT_ACCEPTED:
- prefix = _("Accepted");
+ prefix = U_("Accepted");
break;
case ICAL_PARTSTAT_TENTATIVE:
- prefix = _("Tentatively Accepted");
+ prefix = U_("Tentatively Accepted");
break;
case ICAL_PARTSTAT_DECLINED:
- prefix = _("Declined");
+ prefix = U_("Declined");
break;
default:
break;
@@ -499,23 +503,23 @@ comp_subject (CalComponentItipMethod method, CalComponent *comp)
break;
case CAL_COMPONENT_METHOD_ADD:
- prefix = _("Updated");
+ prefix = U_("Updated");
break;
case CAL_COMPONENT_METHOD_CANCEL:
- prefix = _("Cancel");
+ prefix = U_("Cancel");
break;
case CAL_COMPONENT_METHOD_REFRESH:
- prefix = _("Refresh");
+ prefix = U_("Refresh");
break;
case CAL_COMPONENT_METHOD_COUNTER:
- prefix = _("Counter-proposal");
+ prefix = U_("Counter-proposal");
break;
case CAL_COMPONENT_METHOD_DECLINECOUNTER:
- prefix = _("Declined");
+ prefix = U_("Declined");
break;
default:
@@ -564,19 +568,22 @@ comp_description (CalComponent *comp)
switch (cal_component_get_vtype (comp)) {
case CAL_COMPONENT_EVENT:
- return CORBA_string_dup (_("Event information"));
+ return CORBA_string_dup (U_("Event information"));
case CAL_COMPONENT_TODO:
- return CORBA_string_dup (_("Task information"));
+ return CORBA_string_dup (U_("Task information"));
case CAL_COMPONENT_JOURNAL:
- return CORBA_string_dup (_("Journal information"));
+ return CORBA_string_dup (U_("Journal information"));
case CAL_COMPONENT_FREEBUSY:
cal_component_get_dtstart (comp, &dt);
- if (dt.value) {
+ if (dt.value)
start = get_label (dt.value);
- cal_component_get_dtend (comp, &dt);
- if (dt.value)
- end = get_label (dt.value);
- }
+ cal_component_free_datetime (&dt);
+
+ cal_component_get_dtend (comp, &dt);
+ if (dt.value)
+ end = get_label (dt.value);
+ cal_component_free_datetime (&dt);
+
if (start != NULL && end != NULL) {
char *tmp, *tmp_utf;
tmp = g_strdup_printf (_("Free/Busy information (%s to %s)"), start, end);
@@ -585,13 +592,13 @@ comp_description (CalComponent *comp)
g_free (tmp_utf);
g_free (tmp);
} else {
- description = CORBA_string_dup (_("Free/Busy information"));
+ description = CORBA_string_dup (U_("Free/Busy information"));
}
g_free (start);
g_free (end);
return description;
default:
- return CORBA_string_dup (_("iCalendar information"));
+ return CORBA_string_dup (U_("iCalendar information"));
}
}
@@ -617,7 +624,7 @@ comp_server_send (CalComponentItipMethod method, CalComponent *comp, CalClient *
retval = TRUE;
} else if (result == CAL_CLIENT_SEND_BUSY) {
- e_notice (NULL, GTK_MESSAGE_ERROR, error_msg);
+ e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, error_msg);
retval = FALSE;
}
@@ -748,7 +755,7 @@ comp_minimal (CalComponent *comp, gboolean attendee)
cal_component_set_attendee_list (clone, attendees);
if (!comp_limit_attendees (clone)) {
- e_notice (NULL, GTK_MESSAGE_ERROR,
+ e_notice (NULL, GNOME_MESSAGE_BOX_ERROR,
_("You must be an attendee of the event."));
goto error;
}
@@ -799,7 +806,7 @@ comp_minimal (CalComponent *comp, gboolean attendee)
return clone;
error:
- g_object_unref (clone);
+ gtk_object_unref (GTK_OBJECT (clone));
return NULL;
}
@@ -884,7 +891,7 @@ comp_compliant (CalComponentItipMethod method, CalComponent *comp, CalClient *cl
case CAL_COMPONENT_METHOD_REFRESH:
/* Need to remove almost everything */
temp_clone = comp_minimal (clone, TRUE);
- g_object_unref (clone);
+ gtk_object_unref (GTK_OBJECT (clone));
clone = temp_clone;
break;
case CAL_COMPONENT_METHOD_COUNTER:
@@ -892,7 +899,7 @@ comp_compliant (CalComponentItipMethod method, CalComponent *comp, CalClient *cl
case CAL_COMPONENT_METHOD_DECLINECOUNTER:
/* Need to remove almost everything */
temp_clone = comp_minimal (clone, FALSE);
- g_object_unref (clone);
+ gtk_object_unref (GTK_OBJECT (clone));
clone = temp_clone;
break;
default:
@@ -906,7 +913,7 @@ gboolean
itip_send_comp (CalComponentItipMethod method, CalComponent *send_comp,
CalClient *client, icalcomponent *zones)
{
- BonoboObject *bonobo_server;
+ BonoboObjectClient *bonobo_server;
GNOME_Evolution_Composer composer_server;
CalComponent *comp = NULL;
icalcomponent *top_level = NULL;
@@ -924,7 +931,7 @@ itip_send_comp (CalComponentItipMethod method, CalComponent *send_comp,
CORBA_exception_init (&ev);
/* Obtain an object reference for the Composer. */
- bonobo_server = bonobo_activation_activate_from_id (GNOME_EVOLUTION_COMPOSER_OAFIID, 0, NULL, &ev);
+ bonobo_server = bonobo_object_activate (GNOME_EVOLUTION_COMPOSER_OAFIID, 0);
g_return_val_if_fail (bonobo_server != NULL, FALSE);
composer_server = BONOBO_OBJREF (bonobo_server);
@@ -1027,7 +1034,7 @@ itip_send_comp (CalComponentItipMethod method, CalComponent *send_comp,
CORBA_exception_free (&ev);
if (comp != NULL)
- g_object_unref (comp);
+ gtk_object_unref (GTK_OBJECT (comp));
if (top_level != NULL)
icalcomponent_free (top_level);
@@ -1050,8 +1057,10 @@ itip_send_comp (CalComponentItipMethod method, CalComponent *send_comp,
CORBA_free (filename);
if (description != NULL)
CORBA_free (description);
- if (attach_data != NULL)
+ if (attach_data != NULL) {
+ CORBA_free (attach_data->_buffer);
CORBA_free (attach_data);
+ }
return retval;
}
diff --git a/calendar/pcs/cal-backend-file.c b/calendar/pcs/cal-backend-file.c
index 595626f043..ea50dcc7df 100644
--- a/calendar/pcs/cal-backend-file.c
+++ b/calendar/pcs/cal-backend-file.c
@@ -21,7 +21,7 @@
*/
#include <config.h>
-#include <string.h>
+#include <gtk/gtksignal.h>
#include <bonobo/bonobo-exception.h>
#include <bonobo/bonobo-moniker-util.h>
#include <libgnomevfs/gnome-vfs.h>
@@ -74,7 +74,7 @@ struct _CalBackendFilePrivate {
GHashTable *removed_categories;
/* Config database handle for free/busy organizer information */
- EConfigListener *config_listener;
+ Bonobo_ConfigDatabase db;
/* Idle handler for saving the calendar when it is dirty */
guint idle_id;
@@ -87,9 +87,8 @@ struct _CalBackendFilePrivate {
static void cal_backend_file_class_init (CalBackendFileClass *class);
-static void cal_backend_file_init (CalBackendFile *cbfile, CalBackendFileClass *class);
-static void cal_backend_file_dispose (GObject *object);
-static void cal_backend_file_finalize (GObject *object);
+static void cal_backend_file_init (CalBackendFile *cbfile);
+static void cal_backend_file_destroy (GtkObject *object);
static const char *cal_backend_file_get_uri (CalBackend *backend);
static gboolean cal_backend_file_is_read_only (CalBackend *backend);
@@ -138,7 +137,6 @@ static gboolean cal_backend_file_set_default_timezone (CalBackend *backend,
const char *tzid);
static void notify_categories_changed (CalBackendFile *cbfile);
-static void notify_error (CalBackendFile *cbfile, const char *message);
static CalBackendClass *parent_class;
@@ -153,24 +151,24 @@ static CalBackendClass *parent_class;
*
* Return value: The type ID of the #CalBackendFile class.
**/
-GType
+GtkType
cal_backend_file_get_type (void)
{
- static GType cal_backend_file_type = 0;
+ static GtkType cal_backend_file_type = 0;
if (!cal_backend_file_type) {
- static GTypeInfo info = {
- sizeof (CalBackendFileClass),
- (GBaseInitFunc) NULL,
- (GBaseFinalizeFunc) NULL,
- (GClassInitFunc) cal_backend_file_class_init,
- NULL, NULL,
- sizeof (CalBackendFile),
- 0,
- (GInstanceInitFunc) cal_backend_file_init
- };
- cal_backend_file_type = g_type_register_static (CAL_BACKEND_TYPE,
- "CalBackendFile", &info, 0);
+ static const GtkTypeInfo cal_backend_file_info = {
+ "CalBackendFile",
+ sizeof (CalBackendFile),
+ sizeof (CalBackendFileClass),
+ (GtkClassInitFunc) cal_backend_file_class_init,
+ (GtkObjectInitFunc) cal_backend_file_init,
+ NULL, /* reserved_1 */
+ NULL, /* reserved_2 */
+ (GtkClassInitFunc) NULL
+ };
+
+ cal_backend_file_type = gtk_type_unique (CAL_BACKEND_TYPE, &cal_backend_file_info);
}
return cal_backend_file_type;
@@ -180,16 +178,15 @@ cal_backend_file_get_type (void)
static void
cal_backend_file_class_init (CalBackendFileClass *class)
{
- GObjectClass *object_class;
+ GtkObjectClass *object_class;
CalBackendClass *backend_class;
- object_class = (GObjectClass *) class;
+ object_class = (GtkObjectClass *) class;
backend_class = (CalBackendClass *) class;
- parent_class = (CalBackendClass *) g_type_class_peek_parent (class);
+ parent_class = gtk_type_class (CAL_BACKEND_TYPE);
- object_class->dispose = cal_backend_file_dispose;
- object_class->finalize = cal_backend_file_finalize;
+ object_class->destroy = cal_backend_file_destroy;
backend_class->get_uri = cal_backend_file_get_uri;
backend_class->is_read_only = cal_backend_file_is_read_only;
@@ -218,6 +215,24 @@ cal_backend_file_class_init (CalBackendFileClass *class)
backend_class->set_default_timezone = cal_backend_file_set_default_timezone;
}
+static Bonobo_ConfigDatabase
+load_db (void)
+{
+ Bonobo_ConfigDatabase db = CORBA_OBJECT_NIL;
+ CORBA_Environment ev;
+
+ CORBA_exception_init (&ev);
+
+ db = bonobo_get_object ("wombat:", "Bonobo/ConfigDatabase", &ev);
+
+ if (BONOBO_EX (&ev))
+ db = CORBA_OBJECT_NIL;
+
+ CORBA_exception_free (&ev);
+
+ return db;
+}
+
static void
cal_added_cb (CalBackend *backend, gpointer user_data)
{
@@ -226,7 +241,7 @@ cal_added_cb (CalBackend *backend, gpointer user_data)
/* Object initialization function for the file backend */
static void
-cal_backend_file_init (CalBackendFile *cbfile, CalBackendFileClass *class)
+cal_backend_file_init (CalBackendFile *cbfile)
{
CalBackendFilePrivate *priv;
@@ -246,10 +261,10 @@ cal_backend_file_init (CalBackendFile *cbfile, CalBackendFileClass *class)
/* The timezone defaults to UTC. */
priv->default_zone = icaltimezone_get_utc_timezone ();
- priv->config_listener = e_config_listener_new ();
+ priv->db = load_db ();
- g_signal_connect (G_OBJECT (cbfile), "cal_added",
- G_CALLBACK (cal_added_cb), NULL);
+ gtk_signal_connect (GTK_OBJECT (cbfile), "cal_added",
+ GTK_SIGNAL_FUNC (cal_added_cb), NULL);
}
/* g_hash_table_foreach() callback to destroy a CalComponent */
@@ -259,7 +274,7 @@ free_cal_component (gpointer key, gpointer value, gpointer data)
CalComponent *comp;
comp = CAL_COMPONENT (value);
- g_object_unref (comp);
+ gtk_object_unref (GTK_OBJECT (comp));
}
/* Saves the calendar data */
@@ -344,16 +359,23 @@ free_category_cb (gpointer key, gpointer value, gpointer data)
g_free (c);
}
-/* Dispose handler for the file backend */
+/* Destroy handler for the file backend */
static void
-cal_backend_file_dispose (GObject *object)
+cal_backend_file_destroy (GtkObject *object)
{
CalBackendFile *cbfile;
CalBackendFilePrivate *priv;
+ GList *clients;
+
+ g_return_if_fail (object != NULL);
+ g_return_if_fail (IS_CAL_BACKEND_FILE (object));
cbfile = CAL_BACKEND_FILE (object);
priv = cbfile->priv;
+ clients = CAL_BACKEND (cbfile)->clients;
+ g_assert (clients == NULL);
+
/* Save if necessary */
if (priv->idle_id != 0) {
@@ -362,6 +384,13 @@ cal_backend_file_dispose (GObject *object)
priv->idle_id = 0;
}
+ /* Clean up */
+
+ if (priv->uri) {
+ g_free (priv->uri);
+ priv->uri = NULL;
+ }
+
if (priv->comp_uid_hash) {
g_hash_table_foreach (priv->comp_uid_hash,
free_cal_component, NULL);
@@ -376,44 +405,6 @@ cal_backend_file_dispose (GObject *object)
priv->todos = NULL;
priv->journals = NULL;
- if (priv->icalcomp) {
- icalcomponent_free (priv->icalcomp);
- priv->icalcomp = NULL;
- }
-
- if (priv->config_listener) {
- g_object_unref (priv->config_listener);
- priv->config_listener = NULL;
- }
-
- if (G_OBJECT_CLASS (parent_class)->dispose)
- (* G_OBJECT_CLASS (parent_class)->dispose) (object);
-}
-
-/* Finalize handler for the file backend */
-static void
-cal_backend_file_finalize (GObject *object)
-{
- CalBackendFile *cbfile;
- CalBackendFilePrivate *priv;
- GList *clients;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (IS_CAL_BACKEND_FILE (object));
-
- cbfile = CAL_BACKEND_FILE (object);
- priv = cbfile->priv;
-
- clients = CAL_BACKEND (cbfile)->clients;
- g_assert (clients == NULL);
-
- /* Clean up */
-
- if (priv->uri) {
- g_free (priv->uri);
- priv->uri = NULL;
- }
-
g_hash_table_foreach (priv->categories, free_category_cb, NULL);
g_hash_table_destroy (priv->categories);
priv->categories = NULL;
@@ -422,11 +413,19 @@ cal_backend_file_finalize (GObject *object)
g_hash_table_destroy (priv->removed_categories);
priv->removed_categories = NULL;
+ if (priv->icalcomp) {
+ icalcomponent_free (priv->icalcomp);
+ priv->icalcomp = NULL;
+ }
+
+ bonobo_object_release_unref (priv->db, NULL);
+ priv->db = CORBA_OBJECT_NIL;
+
g_free (priv);
cbfile->priv = NULL;
- if (G_OBJECT_CLASS (parent_class)->finalize)
- (* G_OBJECT_CLASS (parent_class)->finalize) (object);
+ if (GTK_OBJECT_CLASS (parent_class)->destroy)
+ (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}
@@ -765,7 +764,7 @@ remove_component (CalBackendFile *cbfile, CalComponent *comp)
update_categories_from_comp (cbfile, comp, FALSE);
- g_object_unref (comp);
+ gtk_object_unref (GTK_OBJECT (comp));
}
/* Scans the toplevel VCALENDAR component and stores the objects it finds */
@@ -1408,7 +1407,7 @@ cal_backend_file_get_free_busy (CalBackend *backend, GList *users, time_t start,
g_return_val_if_fail (start <= end, NULL);
if (users == NULL) {
- if (cal_backend_mail_account_get_default (priv->config_listener, &address, &name)) {
+ if (cal_backend_mail_account_get_default (priv->db, &address, &name)) {
vfb = create_user_free_busy (cbfile, address, name, start, end);
calobj = icalcomponent_as_ical_string (vfb);
obj_list = g_list_append (obj_list, g_strdup (calobj));
@@ -1419,7 +1418,7 @@ cal_backend_file_get_free_busy (CalBackend *backend, GList *users, time_t start,
} else {
for (l = users; l != NULL; l = l->next ) {
address = l->data;
- if (cal_backend_mail_account_is_valid (priv->config_listener, address, &name)) {
+ if (cal_backend_mail_account_is_valid (priv->db, address, &name)) {
vfb = create_user_free_busy (cbfile, address, name, start, end);
calobj = icalcomponent_as_ical_string (vfb);
obj_list = g_list_append (obj_list, g_strdup (calobj));
@@ -1467,7 +1466,7 @@ cal_backend_file_compute_changes_foreach_key (const char *key, gpointer data)
be_data->change_ids = g_list_prepend (be_data->change_ids, g_strdup (key));
g_free (calobj);
- g_object_unref (comp);
+ gtk_object_unref (GTK_OBJECT (comp));
}
}
@@ -1785,14 +1784,14 @@ cal_backend_file_update_object (CalBackendFile *cbfile,
/* Create a CalComponent wrapper for the icalcomponent. */
comp = cal_component_new ();
if (!cal_component_set_icalcomponent (comp, icalcomp)) {
- g_object_unref (comp);
+ gtk_object_unref (GTK_OBJECT (comp));
return NULL;
}
/* Get the UID, and check it isn't empty. */
cal_component_get_uid (comp, &comp_uid);
if (!comp_uid || !comp_uid[0]) {
- g_object_unref (comp);
+ gtk_object_unref (GTK_OBJECT (comp));
return NULL;
}
@@ -1813,7 +1812,31 @@ cal_backend_file_update_object (CalBackendFile *cbfile,
return comp_uid;
}
+static const char*
+cal_backend_file_cancel_object (CalBackendFile *cbfile,
+ icalcomponent *icalcomp)
+{
+ CalComponent *old_comp;
+ icalproperty *uid;
+ const char *comp_uid;
+ /* Get the UID, and check it isn't empty. */
+ uid = icalcomponent_get_first_property (icalcomp, ICAL_UID_PROPERTY);
+ if (!uid)
+ return NULL;
+ comp_uid = icalproperty_get_uid (uid);
+ if (!comp_uid || !comp_uid[0])
+ return NULL;
+
+ /* Find the old version of the component. */
+ old_comp = lookup_component (cbfile, comp_uid);
+ if (!old_comp)
+ return NULL;
+
+ /* And remove it */
+ remove_component (cbfile, old_comp);
+ return comp_uid;
+}
/* Update_objects handler for the file backend. */
static CalBackendResult
@@ -1823,10 +1846,11 @@ cal_backend_file_update_objects (CalBackend *backend, const char *calobj)
CalBackendFilePrivate *priv;
icalcomponent *toplevel_comp, *icalcomp = NULL;
icalcomponent_kind kind;
+ icalproperty_method method;
int old_n_categories, new_n_categories;
icalcomponent *subcomp;
CalBackendResult retval = CAL_BACKEND_RESULT_SUCCESS;
- GList *comp_uid_list = NULL, *elem;
+ GList *updated_uids = NULL, *removed_uids = NULL, *elem;
cbfile = CAL_BACKEND_FILE (backend);
priv = cbfile->priv;
@@ -1858,6 +1882,8 @@ cal_backend_file_update_objects (CalBackend *backend, const char *calobj)
return CAL_BACKEND_RESULT_INVALID_OBJECT;
}
+ method = icalcomponent_get_method (toplevel_comp);
+
/* The list of removed categories must be empty because we are about to
* start a new scanning process.
*/
@@ -1878,18 +1904,20 @@ cal_backend_file_update_objects (CalBackend *backend, const char *calobj)
|| child_kind == ICAL_VJOURNAL_COMPONENT) {
const char *comp_uid;
- comp_uid = cal_backend_file_update_object (cbfile,
- subcomp);
- if (comp_uid) {
- /* We add a copy of the UID to a list, so we
- can emit notification signals later. We do
- a g_strdup() in case any of the components
- get removed while we are emitting
- notification signals. */
- comp_uid_list = g_list_prepend (comp_uid_list,
- g_strdup (comp_uid));
+ if (method == ICAL_METHOD_CANCEL) {
+ comp_uid = cal_backend_file_cancel_object (cbfile, subcomp);
+ if (comp_uid) {
+ removed_uids = g_list_prepend (removed_uids,
+ g_strdup (comp_uid));
+ } else
+ retval = CAL_BACKEND_RESULT_NOT_FOUND;
} else {
- retval = CAL_BACKEND_RESULT_INVALID_OBJECT;
+ comp_uid = cal_backend_file_update_object (cbfile, subcomp);
+ if (comp_uid) {
+ updated_uids = g_list_prepend (updated_uids,
+ g_strdup (comp_uid));
+ } else
+ retval = CAL_BACKEND_RESULT_INVALID_OBJECT;
}
}
subcomp = icalcomponent_get_next_component (toplevel_comp,
@@ -1907,12 +1935,19 @@ cal_backend_file_update_objects (CalBackend *backend, const char *calobj)
/* Now emit notification signals for all of the added components.
We do this after adding them all to make sure the calendar is in a
stable state before emitting signals. */
- for (elem = comp_uid_list; elem; elem = elem->next) {
+ for (elem = updated_uids; elem; elem = elem->next) {
char *comp_uid = elem->data;
notify_update (cbfile, comp_uid);
g_free (comp_uid);
}
- g_list_free (comp_uid_list);
+ g_list_free (updated_uids);
+
+ for (elem = removed_uids; elem; elem = elem->next) {
+ char *comp_uid = elem->data;
+ notify_remove (cbfile, comp_uid);
+ g_free (comp_uid);
+ }
+ g_list_free (removed_uids);
if (old_n_categories != new_n_categories ||
g_hash_table_size (priv->removed_categories) != 0) {
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 9db9d5ec0f..052eafcad8 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,11 +1,9 @@
-2002-12-04 Jeffrey Stedfast <fejj@ximian.com>
+2002-12-03 Jeffrey Stedfast <fejj@ximian.com>
* providers/imap/camel-imap-store-summary.c
(camel_imap_store_summary_add_from_full): Properly handle the case
where the namespace is "". Fixes bug #34975
-2002-12-03 Jeffrey Stedfast <fejj@ximian.com>
-
* broken-date-parser.c (get_tzone): Fixed to not get false
positives when the token is shorter than the actual timezone
string (but matches the first little bit of it).
@@ -13,36 +11,24 @@
token is a special char (such as a '-') that is also used as a
token delimiter.
-2002-11-21 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-tcp-stream-ssl.c (stream_read): Use the new
- camel_operation_cancel_prfd() function to get the cancellation fd
- so we can poll on it for cancellation stuff.
- (stream_write): Same.
-
2002-11-22 Not Zed <NotZed@Ximian.com>
* camel-operation.c (camel_operation_cancel_prfd): Implement, gets
a nspr pr filedesc to poll/wait on
(struct _CamelOperation): include a pr filedesc.
-2002-11-21 Not Zed <NotZed@Ximian.com>
+2002-11-21 Jeffrey Stedfast <fejj@ximian.com>
- * providers/imap/camel-imap-store-summary.c
- (camel_imap_store_summary_namespace_find_path): If we have a
- namespace of "", then always match any path.
- (camel_imap_store_summary_namespace_find_full): Same, for full
- names. Should address #33309 & friends.
+ * camel-tcp-stream-ssl.c (stream_read): Use the new
+ camel_operation_cancel_prfd() function to get the cancellation fd
+ so we can poll on it for cancellation stuff.
+ (stream_write): Same.
2002-11-19 Radek Doulik <rodo@ximian.com>
* camel-mime-filter-tohtml.c (html_convert): added
CAMEL_MIME_FILTER_TOHTML_PRESERVE_8BIT flag
-2002-11-18 Rodney Dawes <dobey@ximian.com>
-
- * tests/*/Makefile.am: Removed $(GNOME_LIBDIR) and $(GNOMEUI_LIBS)
-
2002-11-15 Jeffrey Stedfast <fejj@ximian.com>
* providers/imap/camel-imap-store.c (imap_connect_online): If the
@@ -51,255 +37,6 @@
not returned in the response or if the folder flags contain
\NoSelect, subscribe to INBOX and then try LSUB again.
-2002-11-11 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-mime-filter-tohtml.c (html_convert): Rewritten. Much much
- much cleaner implementation now, though uses malloc/free more
- often than I'd like.
-
-2002-11-11 Jeffrey Stedfast <fejj@ximian.com>
-
- * providers/imap/camel-imap-folder.c (get_message_simple): Use
- g_strerror when setting an exception string (we need it to be in
- UTF-8).
-
- * providers/pop3/camel-pop3-store.c (pop3_try_authenticate): Use
- g_strerror when setting an exception string (we need it to be in
- UTF-8).
-
- * providers/pop3/camel-pop3-folder.c (pop3_refresh_info): Use
- g_strerror when setting an exception string (we need it to be in
- UTF-8).
- (pop3_get_message): Same.
-
- * providers/local/camel-spool-summary.c (spool_summary_sync_full):
- Use g_strerror when setting an exception string (we need it to be
- in UTF-8).
- (spool_summary_check): Here too.
-
- * providers/local/camel-spool-store.c (construct): Use g_strerror
- when setting an exception string (we need it to be in UTF-8).
- (get_folder): Same.
- (scan_dir): Here too.
-
- * providers/local/camel-spool-folder.c (spool_lock): Use
- g_strerror when setting an exception string (we need it to be in
- UTF-8).
-
- * providers/local/camel-mh-summary.c (mh_summary_check): Use
- g_strerror when setting an exception string (we need it to be in
- UTF-8).
-
- * providers/local/camel-mh-store.c (delete_folder): Use g_strerror
- when setting an exception string (we need it to be in UTF-8).
-
- * providers/local/camel-mbox-summary.c (summary_update): Use
- g_strerror when setting an exception string (we need it to be in
- UTF-8).
- (mbox_summary_sync_full): Here too.
- (mbox_summary_sync_quick): Same.
- (mbox_summary_sync): Also here.
- (camel_mbox_summary_sync_mbox): Again here.
-
- * providers/local/camel-mbox-folder.c (mbox_lock): Use g_strerror
- when setting an exception string (we need it to be in UTF-8).
- (mbox_append_message): Same.
- (mbox_get_message): Here too.
-
- * providers/local/camel-maildir-summary.c (maildir_summary_load):
- Use g_strerror when setting an exception string (we need it to be
- in UTF-8).
- (maildir_summary_check): Same.
-
- * providers/local/camel-maildir-store.c (get_folder): Use
- g_strerror when setting an exception string (we need it to be in
- UTF-8).
- (delete_folder): Same.
- (delete_folder): Here too.
-
- * providers/local/camel-local-summary.c (local_summary_sync): Use
- g_strerror when setting an exception string (we need it to be in
- UTF-8).
-
- * providers/local/camel-local-store.c (get_folder): Use g_strerror
- when setting an exception string (we need it to be in UTF-8).
- (create_folder): Same.
- (xrename): Here too.
- (rename_folder): And here.
- (delete_folder): Also here.
-
- * camel-provider.c (camel_provider_init): For debugging printfs,
- we want to use normal strerror (we want locale charset, not
- UTF-8).
-
- * camel-movemail.c (camel_movemail): Use g_strerror when setting
- an exception string (we need it to be in UTF-8).
- (movemail_external): Same.
- (camel_movemail_copy_file): Here too.
- (camel_movemail_solaris): Also here.
-
- * camel-mime-utils.c (rfc2047_decode_word): For debugging printfs,
- we want to use normal strerror (we want locale charset, not
- UTF-8).
- (header_encode_param): Same.
-
- * camel-mime-part-utils.c (convert_buffer): For debugging printfs,
- we want to use normal strerror (we want locale charset, not
- UTF-8).
-
- * camel-lock-client.c (camel_lock_helper_init): Use g_strerror
- when setting an exception string (we need it to be in UTF-8).
-
- * camel-data-cache.c (camel_data_cache_remove): Use g_strerror
- when setting an exception string (we need it to be in UTF-8).
-
- * camel-tcp-stream-raw.c (flaky_tcp_write): For debugging printfs,
- we want to use normal strerror (we want locale charset, not
- UTF-8).
- (flaky_tcp_read): Same.
-
- * camel-gpg-context.c (gpg_ctx_op_step): For debugging printfs, we
- want to use normal strerror (we want locale charset, not UTF-8).
-
- * camel-service.c (camel_gethostbyname): Use g_strerror when
- setting an exception string (we need it to be in UTF-8).
-
- * camel-lock.c (camel_lock_dot): Use g_strerror when setting an
- exception string (we need it to be in UTF-8).
- (camel_lock_fcntl): Same.
-
-2002-11-07 Not Zed <NotZed@Ximian.com>
-
- * camel-mime-part.c (camel_mime_part_set_content_type): constify
- the content_type.
-
-2002-11-07 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-i18n.h: Added.
-
- * camel-object.h: #include camel-i18n.h instead of gnome-i18n.h
-
- * camel-lock.c: Same.
-
-2002-11-07 Rodrigo Moya <rodrigo@ximian.com>
-
- * camel-object.h: removed gnome-defs.h, it does not exist.
-
-2002-11-05 Not Zed <NotZed@Ximian.com>
-
- * Makefile.am (camel_lock_helper_LDADD): Created temporary link
- list, we need to link with something for gettext.
-
- * camel.h: Remove gstring-util.h and hash-table-utils.h.
-
- * camel-text-index.c:
- (text_index_normalise): Changed for g_utf8_strdown api change.
-
- * camel-search-private.c:
- * camel-mime-utils.c:
- * camel-mime-part-utils.c:
- * camel-html-parser.c:
- * camel-charset-map.c: Include glib/gunicode.h from glib instead
- of gal.
-
- * camel-filter-driver.c: Remove include of gtk/gtk.h, should never
- have been there.
-
-2002-11-01 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-mime-utils.c (g_string_append_len): Removed. Glib2 has
- this function.
-
- * providers/local/camel-local-store.c (delete_folder): Use
- g_path_get_basename instead of g_strdup (g_basename (filename)).
-
- * camel-uid-cache.c (camel_uid_cache_new): Use g_path_get_dirname
- since g_dirname has been deprecated.
-
-2002-10-31 Jeffrey Stedfast <fejj@ximian.com>
-
- * camel-gpg-context.c (camel_gpg_context_class_init): Set the
- virtual method pointers to the import/export methods.
- (camel_gpg_context_init): Set the key_protocol string.
- (gpg_hash_to_id): Handle 2 more hash types.
- (gpg_id_to_hash): Same.
- (gpg_ctx_op_step): Slight fixes to support import/export.
- (gpg_ctx_parse_status): Fix to hack around the fact that importing
- keys doesn't write to stdout.
- (gpg_import_keys): Implemented.
- (gpg_export_keys): Implemented.
-
- * camel-cipher-context.c (camel_cipher_context_class_init): Hook
- up default virtual methods for import/export.
- (camel_cipher_import_keys): Implemented.
- (camel_cipher_export_keys): Implemented.
-
-2002-10-31 Jeffrey Stedfast <fejj@ximian.com>
-
- * Makefile.am: Removed hash-table-utils.[c,h] from the build.
-
- * hash-table-utils.[c,h]: Removed.
-
- * string-util.c: Imported g_strcase[hash,equal] into here so we
- can remove hash-table-utils.[c,h].
-
- * camel-medium.c: Removed #include "hash-table-utils.h"
-
- * camel-mime-message.c: Same here.
-
- * camel-mime-part.c: And here.
-
- * camel-session.c: Here too.
-
- * providers/imap/camel-imap-store-summary.c: #include
- string-utils.h instead of hash-table-utils.h
-
- * camel-charset-map.c: Same.
-
- * camel-folder-summary.c: Here too.
-
- * camel-provider.c: Again here.
-
- * camel-store-summary.c: And again...
-
-2002-10-31 Jeffrey Stedfast <fejj@ximian.com>
-
- Remove a ton of useless snot.
-
- * Makefile.am: Remove gstring-util.[c,h] from the build.
-
- * gstring-util.[c,h]: Removed.
-
- * string-utils.c (string_equal_for_glist): Removed.
- (string_split): Removed.
- (string_trim): Removed.
- (string_prefix): Removed.
- (string_unquote): Removed.
- (strip): Removed.
-
- * hash-table-utils.c (g_hash_table_generic_free): Removed.
-
- g_str[n]casecmp functions are deprecated in glib2.
-
- * string-utils.c (strstrcase): Use strncasecmp instead of
- g_strncasecmp.
-
- * hash-table-utils.c (g_strcase_equal): Use strcasecmp
- instead of g_strcasecmp.
-
- * camel-smime-utils.c (camel_smime_is_smime_v3_signed): Same.
- (camel_smime_is_smime_v3_encrypted): Here too.
-
- * camel-sasl-digest-md5.c (decode_data_type): And here.
- (parse_server_challenge): Again here.
-
- * camel-pgp-mime.c (camel_pgp_mime_is_rfc2015_signed): Same.
- (camel_pgp_mime_is_rfc2015_encrypted): Same
-
- * camel-mime-part-utils.c (check_html_charset): Here too.
-
- * camel-folder-summary.c (camel_system_flag): Same.
-
2002-10-25 Jeffrey Stedfast <fejj@ximian.com>
* camel-gpg-context.c (gpg_ctx_parse_status): Don't prematurely
diff --git a/camel/camel-mime-filter-tohtml.c b/camel/camel-mime-filter-tohtml.c
index db84b7f9fe..b638a315b4 100644
--- a/camel/camel-mime-filter-tohtml.c
+++ b/camel/camel-mime-filter-tohtml.c
@@ -28,34 +28,14 @@
#include <stdio.h>
#include <string.h>
#include <ctype.h>
-#include <regex.h>
#include "camel-mime-filter-tohtml.h"
#define d(x)
-
-struct _UrlRegexPattern {
- unsigned int mask;
- char *pattern;
- char *prefix;
- regex_t *preg;
- regmatch_t matches;
-};
-
-static struct _UrlRegexPattern patterns[] = {
- { CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS, "(news|nntp|telnet|file|ftp|http|https)://([-a-z0-9]+(:[-a-z0-9]+)?@)?[-a-z0-9.]+[-a-z0-9](:[0-9]*)?(/[-a-z0-9_$.+!*(),;:@%&=?/~#]*[^]'.}>\\) ,?!;:\"]?)?", "", NULL, { 0, 0 } },
- { CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS, "www\\.[-a-z0-9.]+[-a-z0-9](:[0-9]*)?(/[-A-Za-z0-9_$.+!*(),;:@%&=?/~#]*[^]'.}>\\) ,?!;:\"]?)?", "http://", NULL, { 0, 0 } },
- { CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS, "ftp\\.[-a-z0-9.]+[-a-z0-9](:[0-9]*)?(/[-A-Za-z0-9_$.+!*(),;:@%&=?/~#]*[^]'.}>\\) ,?!;:\"]?)?", "ftp://", NULL, { 0, 0 } },
- { CAMEL_MIME_FILTER_TOHTML_CONVERT_ADDRESSES, "([-_a-z0-9.\\+]+@[-_a-z0-9.]+)", "mailto:", NULL, { 0, 0 } }
-};
-
-#define NUM_URL_REGEX_PATTERNS (sizeof (patterns) / sizeof (patterns[0]))
-
-
static void camel_mime_filter_tohtml_class_init (CamelMimeFilterToHTMLClass *klass);
-static void camel_mime_filter_tohtml_init (CamelMimeFilterToHTML *filter);
-static void camel_mime_filter_tohtml_finalize (CamelObject *obj);
+static void camel_mime_filter_tohtml_init (CamelObject *o);
+static void camel_mime_filter_tohtml_finalize (CamelObject *o);
static CamelMimeFilterClass *camel_mime_filter_tohtml_parent;
@@ -80,43 +60,15 @@ camel_mime_filter_tohtml_get_type (void)
}
static void
-camel_mime_filter_tohtml_finalize (CamelObject *obj)
+camel_mime_filter_tohtml_finalize (CamelObject *o)
{
- CamelMimeFilterToHTML *filter = (CamelMimeFilterToHTML *) obj;
- int i;
-
- for (i = 0; i < NUM_URL_REGEX_PATTERNS; i++) {
- if (filter->patterns[i].preg) {
- regfree (filter->patterns[i].preg);
- g_free (filter->patterns[i].preg);
- }
- }
-
- g_free (filter->patterns);
+ ;
}
static void
-camel_mime_filter_tohtml_init (CamelMimeFilterToHTML *filter)
+camel_mime_filter_tohtml_init (CamelObject *o)
{
- int i;
-
- /* FIXME: use a global set of patterns instead? */
- filter->patterns = g_malloc (sizeof (patterns));
- memcpy (filter->patterns, patterns, sizeof (patterns));
-
- for (i = 0; i < NUM_URL_REGEX_PATTERNS; i++) {
- filter->patterns[i].preg = g_malloc (sizeof (regex_t));
- if (regcomp (filter->patterns[i].preg, patterns[i].pattern, REG_EXTENDED) == -1) {
- /* error building the regex_t so we can't use this pattern */
- filter->patterns[i].preg = NULL;
- filter->patterns[i].mask = 0;
- }
- }
-
- filter->flags = 0;
- filter->colour = 0;
- filter->column = 0;
- filter->pre_open = FALSE;
+ ;
}
@@ -137,261 +89,382 @@ check_size (CamelMimeFilter *filter, char *outptr, char **outend, size_t len)
return filter->outbuf + offset;
}
-static int
-citation_depth (const char *in)
+
+static unsigned short special_chars[128] = {
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 7, 7, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 7, 4, 3, 0, 0, 0, 0, 7, 3, 7, 0, 0, 7, 12, 12, 1,
+ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 5, 7, 3, 0, 7, 4,
+ 1, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
+ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 3, 7, 3, 0, 4,
+ 7, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8,
+ 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 0, 7, 4, 0, 0,
+};
+
+
+#define IS_NON_ADDR (1 << 0)
+#define IS_NON_URL (1 << 1)
+#define IS_GARBAGE (1 << 2)
+#define IS_DOMAIN (1 << 3)
+
+#define NON_EMAIL_CHARS "()<>@,;:\\\"/[]`'|\n\t "
+#define NON_URL_CHARS "()<>,;\\\"[]`'|\n\t "
+#define TRAILING_URL_GARBAGE ",.!?;:>)}\\`'-_|\n\t "
+
+#define is_addr_char(c) ((unsigned char) (c) < 128 && !(special_chars[(unsigned char) (c)] & IS_NON_ADDR))
+#define is_url_char(c) ((unsigned char) (c) < 128 && !(special_chars[(unsigned char) (c)] & IS_NON_URL))
+#define is_trailing_garbage(c) ((unsigned char) (c) > 127 || (special_chars[(unsigned char) (c)] & IS_GARBAGE))
+#define is_domain_name_char(c) ((unsigned char) (c) < 128 && (special_chars[(unsigned char) (c)] & IS_DOMAIN))
+
+
+#if 0
+static void
+table_init (void)
{
- register const char *inptr = in;
- int depth = 1;
+ int max, ch, i;
+ char *c;
- if (*inptr++ != '>')
- return 0;
+ memset (special_chars, 0, sizeof (special_chars));
+ for (c = NON_EMAIL_CHARS; *c; c++)
+ special_chars[(int) *c] |= IS_NON_ADDR;
+ for (c = NON_URL_CHARS; *c; c++)
+ special_chars[(int) *c] |= IS_NON_URL;
+ for (c = TRAILING_URL_GARBAGE; *c; c++)
+ special_chars[(int) *c] |= IS_GARBAGE;
- /* check that it isn't an escaped From line */
- if (!strncmp (inptr, "From", 4))
- return 0;
+#define is_ascii_alpha(c) (((c) >= 'A' && (c) <= 'Z') || ((c) >= 'a' && (c) <= 'z'))
- while (*inptr != '\n') {
- if (*inptr == ' ')
- inptr++;
-
- if (*inptr++ != '>')
- break;
-
- depth++;
+ for (ch = 0; ch < 128; ch++) {
+ if (is_ascii_alpha (ch) || isdigit (ch) || ch == '.' || ch == '-')
+ special_chars[ch] |= IS_DOMAIN;
+ }
+
+ max = sizeof (special_chars) / sizeof (special_chars[0]);
+ printf ("static unsigned short special_chars[%d] = {", max);
+ for (i = 0; i < max; i++) {
+ if (i % 16 == 0)
+ printf ("\n\t");
+ printf ("%3d,", special_chars[i]);
+ }
+ printf ("\n};\n");
+}
+#endif
+
+static char *
+url_extract (char **in, int inlen, gboolean check, gboolean *backup)
+{
+ unsigned char *inptr, *inend, *p;
+ char *url;
+
+ inptr = (unsigned char *) *in;
+ inend = inptr + inlen;
+
+ while (inptr < inend && is_url_char (*inptr))
+ inptr++;
+
+ if ((char *) inptr == *in)
+ return NULL;
+
+ /* back up if we probably went too far. */
+ while (inptr > (unsigned char *) *in && is_trailing_garbage (*(inptr - 1)))
+ inptr--;
+
+ if (check) {
+ /* make sure we weren't fooled. */
+ p = memchr (*in, ':', (char *) inptr - *in);
+ if (!p)
+ return NULL;
}
- return depth;
+ if (inptr == inend && backup) {
+ *backup = TRUE;
+ return NULL;
+ }
+
+ url = g_strndup (*in, (char *) inptr - *in);
+ *in = inptr;
+
+ return url;
}
static char *
-writeln (CamelMimeFilter *filter, const char *in, const char *inend, char *outptr, char **outend)
+email_address_extract (char **in, char *inend, char *start, char **outptr, gboolean *backup)
+{
+ char *addr, *pre, *end, *dot;
+
+ /* *in points to the '@'. Look backward for a valid local-part */
+ pre = *in;
+ while (pre - 1 >= start && is_addr_char (*(pre - 1)))
+ pre--;
+
+ if (pre == *in)
+ return NULL;
+
+ /* Now look forward for a valid domain part */
+ for (end = *in + 1, dot = NULL; end < inend && is_domain_name_char (*end); end++) {
+ if (*end == '.' && !dot)
+ dot = end;
+ }
+
+ if (end >= inend && backup) {
+ *backup = TRUE;
+ *outptr -= (*in - pre);
+ *in = pre;
+ return NULL;
+ }
+
+ if (!dot)
+ return NULL;
+
+ /* Remove trailing garbage */
+ while (end > *in && is_trailing_garbage (*(end - 1)))
+ end--;
+ if (dot > end)
+ return NULL;
+
+ addr = g_strndup (pre, end - pre);
+ *outptr -= (*in - pre);
+ *in = end;
+
+ return addr;
+}
+
+static gboolean
+is_citation (char *inptr, char *inend, gboolean saw_citation, gboolean *backup)
+{
+ if (*inptr != '>')
+ return FALSE;
+
+ if (inend - inptr >= 6) {
+ /* make sure this isn't just mbox From-magling... */
+ if (strncmp (inptr, ">From ", 6) != 0)
+ return TRUE;
+ } else if (backup) {
+ /* we don't have enough data to tell, so return */
+ *backup = TRUE;
+ return saw_citation;
+ }
+
+ /* if the previous line was a citation, then say this one is too */
+ if (saw_citation)
+ return TRUE;
+
+ /* otherwise it was just an isolated ">From " line */
+ return FALSE;
+}
+
+static gboolean
+is_protocol (char *inptr, char *inend, gboolean *backup)
+{
+ if (inend - inptr >= 8) {
+ if (!strncasecmp (inptr, "http://", 7) ||
+ !strncasecmp (inptr, "https://", 8) ||
+ !strncasecmp (inptr, "ftp://", 6) ||
+ !strncasecmp (inptr, "nntp://", 7) ||
+ !strncasecmp (inptr, "mailto:", 7) ||
+ !strncasecmp (inptr, "news:", 5) ||
+ !strncasecmp (inptr, "file:", 5))
+ return TRUE;
+ } else if (backup) {
+ *backup = TRUE;
+ return FALSE;
+ }
+
+ return FALSE;
+}
+
+static void
+html_convert (CamelMimeFilter *filter, char *in, size_t inlen, size_t prespace,
+ char **out, size_t *outlen, size_t *outprespace, gboolean flush)
{
CamelMimeFilterToHTML *html = (CamelMimeFilterToHTML *) filter;
- register const char *inptr = in;
+ char *inptr, *inend, *outptr, *outend, *start;
+ gboolean backup = FALSE;
+
+ camel_mime_filter_set_size (filter, inlen * 2 + 6, FALSE);
+
+ inptr = start = in;
+ inend = in + inlen;
+ outptr = filter->outbuf;
+ outend = filter->outbuf + filter->outsize;
+
+ if (html->flags & CAMEL_MIME_FILTER_TOHTML_PRE && !html->pre_open) {
+ outptr += sprintf (outptr, "%s", "<pre>");
+ html->pre_open = TRUE;
+ }
while (inptr < inend) {
unsigned char u;
- outptr = check_size (filter, outptr, outend, 9);
+ if (html->flags & CAMEL_MIME_FILTER_TOHTML_MARK_CITATION && html->column == 0) {
+ html->saw_citation = is_citation (inptr, inend, html->saw_citation,
+ flush ? &backup : NULL);
+ if (backup)
+ break;
+
+ if (html->saw_citation) {
+ if (!html->coloured) {
+ char font[25];
+
+ g_snprintf (font, 25, "<font color=\"#%06x\">", html->colour);
+
+ outptr = check_size (filter, outptr, &outend, 25);
+ outptr += sprintf (outptr, "%s", font);
+ html->coloured = TRUE;
+ }
+ } else if (html->coloured) {
+ outptr = check_size (filter, outptr, &outend, 10);
+ outptr += sprintf (outptr, "%s", "</font>");
+ html->coloured = FALSE;
+ }
+
+ /* display mbox-mangled ">From " as "From " */
+ if (*inptr == '>' && !html->saw_citation)
+ inptr++;
+ } else if (html->flags & CAMEL_MIME_FILTER_TOHTML_CITE && html->column == 0) {
+ outptr = check_size (filter, outptr, &outend, 6);
+ outptr += sprintf (outptr, "%s", "&gt; ");
+ }
+
+ if (html->flags & CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS && isalpha ((int) *inptr)) {
+ char *refurl = NULL, *dispurl = NULL;
+
+ if (is_protocol (inptr, inend, flush ? &backup : NULL)) {
+ dispurl = url_extract (&inptr, inend - inptr, TRUE,
+ flush ? &backup : NULL);
+ if (backup)
+ break;
+
+ if (dispurl)
+ refurl = g_strdup (dispurl);
+ } else {
+ if (backup)
+ break;
+
+ if (!strncasecmp (inptr, "www.", 4) && ((unsigned char) inptr[4]) < 0x80
+ && isalnum ((int) inptr[4])) {
+ dispurl = url_extract (&inptr, inend - inptr, FALSE,
+ flush ? &backup : NULL);
+ if (backup)
+ break;
+
+ if (dispurl)
+ refurl = g_strdup_printf ("http://%s", dispurl);
+ }
+ }
+
+ if (dispurl) {
+ outptr = check_size (filter, outptr, &outend,
+ strlen (refurl) +
+ strlen (dispurl) + 15);
+ outptr += sprintf (outptr, "<a href=\"%s\">%s</a>",
+ refurl, dispurl);
+ html->column += strlen (dispurl);
+ g_free (refurl);
+ g_free (dispurl);
+ }
+
+ if (inptr >= inend)
+ break;
+ }
+
+ if (*inptr == '@' && (html->flags & CAMEL_MIME_FILTER_TOHTML_CONVERT_ADDRESSES)) {
+ char *addr, *outaddr;
+
+ addr = email_address_extract (&inptr, inend, start, &outptr,
+ flush ? &backup : NULL);
+ if (backup)
+ break;
+
+ if (addr) {
+ outaddr = g_strdup_printf ("<a href=\"mailto:%s\">%s</a>",
+ addr, addr);
+ outptr = check_size (filter, outptr, &outend, strlen (outaddr));
+ outptr += sprintf (outptr, "%s", outaddr);
+ html->column += strlen (addr);
+ g_free (addr);
+ g_free (outaddr);
+ }
+ }
+
+ outptr = check_size (filter, outptr, &outend, 32);
switch ((u = (unsigned char) *inptr++)) {
case '<':
- outptr = g_stpcpy (outptr, "&lt;");
+ outptr += sprintf (outptr, "%s", "&lt;");
html->column++;
break;
+
case '>':
- outptr = g_stpcpy (outptr, "&gt;");
+ outptr += sprintf (outptr, "%s", "&gt;");
html->column++;
break;
+
case '&':
- outptr = g_stpcpy (outptr, "&amp;");
+ outptr += sprintf (outptr, "%s", "&amp;");
html->column++;
break;
+
case '"':
- outptr = g_stpcpy (outptr, "&quot;");
+ outptr += sprintf (outptr, "%s", "&quot;");
html->column++;
break;
+
+ case '\n':
+ if (html->flags & CAMEL_MIME_FILTER_TOHTML_CONVERT_NL)
+ outptr += sprintf (outptr, "%s", "<br>");
+
+ *outptr++ = '\n';
+ start = inptr;
+ html->column = 0;
+ break;
+
case '\t':
if (html->flags & (CAMEL_MIME_FILTER_TOHTML_CONVERT_SPACES)) {
do {
- outptr = check_size (filter, outptr, outend, 7);
- outptr = g_stpcpy (outptr, "&nbsp;");
+ outptr = check_size (filter, outptr, &outend, 7);
+ outptr += sprintf (outptr, "%s", "&nbsp;");
html->column++;
} while (html->column % 8);
break;
}
/* otherwise, FALL THROUGH */
+
case ' ':
if (html->flags & CAMEL_MIME_FILTER_TOHTML_CONVERT_SPACES) {
- if (inptr == (in + 1) || *inptr == ' ' || *inptr == '\t') {
- outptr = g_stpcpy (outptr, "&nbsp;");
+ if (inptr == in || (inptr < inend && (*(inptr + 1) == ' ' ||
+ *(inptr + 1) == '\t' ||
+ *(inptr - 1) == '\n'))) {
+ outptr += sprintf (outptr, "%s", "&nbsp;");
html->column++;
break;
}
}
/* otherwise, FALL THROUGH */
+
default:
- if (!(u >= 0x20 && u < 0x80) && !(html->flags & CAMEL_MIME_FILTER_TOHTML_PRESERVE_8BIT)) {
+ if ((u >= 0x20 && u < 0x80) ||
+ (u == '\r' || u == '\t') || html->flags & CAMEL_MIME_FILTER_TOHTML_PRESERVE_8BIT) {
+ /* Default case, just copy. */
+ *outptr++ = (char) u;
+ } else {
if (html->flags & CAMEL_MIME_FILTER_TOHTML_ESCAPE_8BIT)
*outptr++ = '?';
else
outptr += g_snprintf (outptr, 9, "&#%d;", (int) u);
- } else {
- *outptr++ = (char) u;
}
html->column++;
break;
}
}
- return outptr;
-}
-
-static void
-html_convert (CamelMimeFilter *filter, char *in, size_t inlen, size_t prespace,
- char **out, size_t *outlen, size_t *outprespace, gboolean flush)
-{
- CamelMimeFilterToHTML *html = (CamelMimeFilterToHTML *) filter;
- register char *inptr, *outptr;
- char *start, *outend;
- const char *inend;
- int depth;
-
- camel_mime_filter_set_size (filter, inlen * 2 + 6, FALSE);
+ if (inptr < inend)
+ camel_mime_filter_backup (filter, inptr, inend - inptr);
- inptr = in;
- inend = in + inlen;
- outptr = filter->outbuf;
- outend = filter->outbuf + filter->outsize;
-
- if (html->flags & CAMEL_MIME_FILTER_TOHTML_PRE && !html->pre_open) {
- outptr = g_stpcpy (outptr, "<pre>");
- html->pre_open = TRUE;
- }
-
- start = inptr;
- while (inptr < inend && *inptr != '\n')
- inptr++;
-
- while (inptr < inend) {
- html->column = 0;
- depth = 0;
-
- if (html->flags & CAMEL_MIME_FILTER_TOHTML_MARK_CITATION) {
- if ((depth = citation_depth (start)) > 0) {
- char font[25];
-
- /* FIXME: we could easily support multiple colour depths here */
-
- g_snprintf (font, 25, "<font color=\"#%06x\">", html->colour);
-
- outptr = check_size (filter, outptr, &outend, 25);
- outptr = g_stpcpy (outptr, font);
- } else if (*start == '>') {
- /* >From line */
- start++;
- }
- } else if (html->flags & CAMEL_MIME_FILTER_TOHTML_CITE) {
- outptr = check_size (filter, outptr, &outend, 6);
- outptr = g_stpcpy (outptr, "&gt; ");
- html->column += 2;
- }
-
-#define CONVERT_URLS (CAMEL_MIME_FILTER_TOHTML_CONVERT_URLS | CAMEL_MIME_FILTER_TOHTML_CONVERT_ADDRESSES)
- if (html->flags & CONVERT_URLS) {
- struct _UrlRegexPattern *fmatch, *pat;
- size_t matchlen, len;
- regoff_t offset;
- char *linebuf;
- char save;
- int i;
-
- len = inptr - start;
- linebuf = g_malloc (len + 1);
- memcpy (linebuf, start, len);
- linebuf[len] = '\0';
-
- start = linebuf;
- save = '\0';
-
- do {
- /* search for all of our patterns */
- offset = 0;
- fmatch = NULL;
- for (i = 0; i < NUM_URL_REGEX_PATTERNS; i++) {
- pat = html->patterns + i;
- if ((html->flags & pat->mask) &&
- !regexec (pat->preg, start, 1, &pat->matches, 0)) {
- if (pat->matches.rm_so < offset) {
- *(start + offset) = save;
- fmatch = NULL;
- }
-
- if (!fmatch) {
- fmatch = pat;
- offset = pat->matches.rm_so;
-
- /* optimisation so we don't have to search the
- entire line buffer for the next pattern */
- save = *(start + offset);
- *(start + offset) = '\0';
- }
- }
- }
-
- if (fmatch) {
- /* restore our char */
- *(start + offset) = save;
-
- /* write out anything before the first regex match */
- outptr = writeln (filter, start, start + offset, outptr, &outend);
- start += offset;
- len -= offset;
-
-#define MATCHLEN(matches) (matches.rm_eo - matches.rm_so)
- matchlen = MATCHLEN (fmatch->matches);
-
- i = 20 + strlen (fmatch->prefix) + matchlen + matchlen;
- outptr = check_size (filter, outptr, &outend, i);
-
- /* write out the href tag */
- outptr = g_stpcpy (outptr, "<a href=\"");
- outptr = g_stpcpy (outptr, fmatch->prefix);
- memcpy (outptr, start, matchlen);
- outptr += matchlen;
- outptr = g_stpcpy (outptr, "\">");
-
- /* now write the matched string */
- memcpy (outptr, start, matchlen);
- html->column += matchlen;
- outptr += matchlen;
- start += matchlen;
- len -= matchlen;
-
- /* close the href tag */
- outptr = g_stpcpy (outptr, "</a>");
- } else {
- /* nothing matched so write out the remainder of this line buffer */
- outptr = writeln (filter, start, start + len, outptr, &outend);
- break;
- }
- } while (len > 0);
-
- g_free (linebuf);
- } else {
- outptr = writeln (filter, start, inptr, outptr, &outend);
- }
-
- if ((html->flags & CAMEL_MIME_FILTER_TOHTML_MARK_CITATION) && depth > 0) {
- outptr = check_size (filter, outptr, &outend, 8);
- outptr = g_stpcpy (outptr, "</font>");
- }
-
- if (html->flags & CAMEL_MIME_FILTER_TOHTML_CONVERT_NL) {
- outptr = check_size (filter, outptr, &outend, 5);
- outptr = g_stpcpy (outptr, "<br>");
- }
-
- *outptr++ = '\n';
-
- start = ++inptr;
- while (inptr < inend && *inptr != '\n')
- inptr++;
- }
-
- if (flush) {
- /* flush the rest of our input buffer */
- if (start < inend)
- outptr = writeln (filter, start, inend, outptr, &outend);
-
- if (html->pre_open) {
- /* close the pre-tag */
- outptr = check_size (filter, outptr, &outend, 10);
- outptr = g_stpcpy (outptr, "</pre>");
- }
- } else if (start < inend) {
- /* backup */
- camel_mime_filter_backup (filter, start, (unsigned) (inend - start));
+ if (flush && html->pre_open) {
+ outptr = check_size (filter, outptr, &outend, 10);
+ outptr += sprintf (outptr, "%s", "</pre>");
+ html->pre_open = FALSE;
}
*out = filter->outbuf;
@@ -420,6 +493,8 @@ filter_reset (CamelMimeFilter *filter)
html->column = 0;
html->pre_open = FALSE;
+ html->saw_citation = FALSE;
+ html->coloured = FALSE;
}
static void
diff --git a/camel/camel-mime-filter-tohtml.h b/camel/camel-mime-filter-tohtml.h
index 0dff90d651..a37c02ae3c 100644
--- a/camel/camel-mime-filter-tohtml.h
+++ b/camel/camel-mime-filter-tohtml.h
@@ -51,13 +51,13 @@ typedef struct _CamelMimeFilterToHTML CamelMimeFilterToHTML;
struct _CamelMimeFilterToHTML {
CamelMimeFilter parent;
- struct _UrlRegexPattern *patterns;
-
guint32 flags;
guint32 colour;
- guint32 column : 31;
- guint32 pre_open : 1;
+ guint32 column : 29;
+ guint32 pre_open : 1;
+ guint32 saw_citation : 1;
+ guint32 coloured : 1;
};
struct _CamelMimeFilterToHTMLClass {
diff --git a/camel/camel-tcp-stream-ssl.c b/camel/camel-tcp-stream-ssl.c
index b20b6d255e..b67d1a8def 100644
--- a/camel/camel-tcp-stream-ssl.c
+++ b/camel/camel-tcp-stream-ssl.c
@@ -628,34 +628,34 @@ camel_certdb_nss_cert_get(CamelCertDB *certdb, CERTCertificate *cert)
int fd;
ssize_t len;
struct stat st;
-
- fingerprint = cert_fingerprint (cert);
- ccert = camel_certdb_get_cert (certdb, fingerprint);
+
+ fingerprint = cert_fingerprint(cert);
+ ccert = camel_certdb_get_cert(certdb, fingerprint);
if (ccert == NULL) {
- g_free (fingerprint);
+ g_free(fingerprint);
return ccert;
}
-
+
if (ccert->rawcert == NULL) {
- path = g_strdup_printf ("%s/.camel_certs/%s", getenv ("HOME"), fingerprint);
- if (stat (path, &st) == -1
- || (fd = open (path, O_RDONLY)) == -1) {
- g_warning ("could not load cert %s: %s", path, strerror (errno));
- g_free (fingerprint);
- g_free (path);
- camel_cert_set_trust (certdb, ccert, CAMEL_CERT_TRUST_UNKNOWN);
- camel_certdb_touch (certdb);
-
+ path = g_strdup_printf("%s/.camel_certs/%s", getenv("HOME"), fingerprint);
+ if (stat(path, &st) == -1
+ || (fd = open(path, O_RDONLY)) == -1) {
+ g_warning("could not load cert %s: %s", path, strerror(errno));
+ g_free(fingerprint);
+ g_free(path);
+ camel_cert_set_trust(certdb, ccert, CAMEL_CERT_TRUST_UNKNOWN);
+ camel_certdb_touch(certdb);
+
return ccert;
}
g_free(path);
- ccert->rawcert = g_byte_array_new ();
+ ccert->rawcert = g_byte_array_new();
g_byte_array_set_size(ccert->rawcert, st.st_size);
len = read(fd, ccert->rawcert->data, st.st_size);
close(fd);
if (len != st.st_size) {
- g_warning ("cert size read truncated %s: %d != %ld", path, len, st.st_size);
+ g_warning("cert size read truncated %s: %d != %ld", path, len, st.st_size);
g_byte_array_free(ccert->rawcert, TRUE);
ccert->rawcert = NULL;
g_free(fingerprint);
@@ -711,12 +711,11 @@ camel_certdb_nss_cert_set(CamelCertDB *certdb, CamelCert *ccert, CERTCertificate
struct stat st;
fingerprint = ccert->fingerprint;
-
+
if (ccert->rawcert == NULL)
- ccert->rawcert = g_byte_array_new ();
-
- g_byte_array_set_size (ccert->rawcert, cert->derCert.len);
- memcpy (ccert->rawcert->data, cert->derCert.data, cert->derCert.len);
+ ccert->rawcert = g_byte_array_new();
+ g_byte_array_set_size(ccert->rawcert, cert->derCert.len);
+ memcpy(ccert->rawcert->data, cert->derCert.data, cert->derCert.len);
dir = g_strdup_printf ("%s/.camel_certs", getenv ("HOME"));
if (stat (dir, &st) == -1 && mkdir (dir, 0700) == -1) {
@@ -728,19 +727,19 @@ camel_certdb_nss_cert_set(CamelCertDB *certdb, CamelCert *ccert, CERTCertificate
path = g_strdup_printf ("%s/%s", dir, fingerprint);
g_free (dir);
- stream = camel_stream_fs_new_with_name (path, O_WRONLY | O_CREAT | O_TRUNC, 0600);
+ stream = camel_stream_fs_new_with_name(path, O_WRONLY|O_CREAT|O_TRUNC, 0600);
if (stream != NULL) {
- if (camel_stream_write (stream, ccert->rawcert->data, ccert->rawcert->len) == -1) {
- g_warning ("Could not save cert: %s: %s", path, strerror (errno));
- unlink (path);
+ if (camel_stream_write(stream, ccert->rawcert->data, ccert->rawcert->len) != ccert->rawcert->len) {
+ g_warning("Could not save cert: %s: %s", path, strerror(errno));
+ unlink(path);
}
- camel_stream_close (stream);
- camel_object_unref (stream);
+ camel_stream_close(stream);
+ camel_object_unref(stream);
} else {
- g_warning ("Could not save cert: %s: %s", path, strerror (errno));
+ g_warning("Could not save cert: %s: %s", path, strerror(errno));
}
- g_free (path);
+ g_free(path);
}
diff --git a/camel/providers/imap/camel-imap-store-summary.c b/camel/providers/imap/camel-imap-store-summary.c
index 5ba3f955e2..63444f44c3 100644
--- a/camel/providers/imap/camel-imap-store-summary.c
+++ b/camel/providers/imap/camel-imap-store-summary.c
@@ -32,7 +32,7 @@
#include "camel-file-utils.h"
-#include "string-utils.h"
+#include "hash-table-utils.h"
#include "e-util/md5-utils.h"
#include "e-util/e-memory.h"
@@ -366,7 +366,7 @@ CamelImapStoreNamespace *camel_imap_store_summary_namespace_new(CamelImapStoreSu
CamelImapStoreNamespace *ns;
char *p;
int len;
-
+
ns = g_malloc0(sizeof(*ns));
ns->full_name = g_strdup(full_name);
len = strlen(ns->full_name)-1;
diff --git a/composer/ChangeLog b/composer/ChangeLog
index ae0520d217..90e921306c 100644
--- a/composer/ChangeLog
+++ b/composer/ChangeLog
@@ -1,199 +1,20 @@
-2002-12-03 Jeffrey Stedfast <fejj@ximian.com>
+2002-12-05 Ettore Perazzoli <ettore@ximian.com>
- * e-msg-composer.c (message_rfc822_dnd): Get rid of the unused
- exception variable.
+ [Patch from Chris Lahey <clahey@ximian.com>.]
-2002-11-27 Not Zed <NotZed@Ximian.com>
-
- * e-msg-composer.c (save): removed warning about e_notice. its
- used too much, its here to stay.
-
- * *.[ch]: run fix.sh over everything.
+ * evolution-composer.c (factory_fn): Do not return a composer if
+ the mailer isn't ready.
2002-12-01 Jeffrey Stedfast <fejj@ximian.com>
- * e-msg-composer.c: s/g_str[n]casecmp/str[n]casecmp
-
-2002-11-26 Not Zed <NotZed@Ximian.com>
-
- * e-msg-composer.c (composer_finalise): properly chain finalise.
-
-2002-11-25 Not Zed <NotZed@Ximian.com>
-
- * e-msg-composer-attachment-bar.c (init): Remove the window size
- setting.
- (e_msg_composer_attachment_bar_new): Move the window size setting
- here. Also set icon width based on 15 approximate characters, so
- the icon text is more readable.
-
-2002-11-22 Not Zed <NotZed@Ximian.com>
-
- * e-msg-composer-select-file.c: rewrote most of this. Just use
- gtkfileselection directly, no e-file-selector, much
- smaller/simpler.
-
-2002-11-21 Not Zed <NotZed@Ximian.com>
-
- * e-msg-composer-attachment-bar.c (remove_attachment): fix
- g_signal_emit params, detail in wrong spot.
- (add_common): Same.
-
- * e-icon-list.c (icon_new_from_pixbuf): remove the
- 'use_broken_event_handling' set.
- (emit_select): Add detail to signal emit.
- (text_changed): Same.
-
- * e-msg-composer.c (subject_changed_cb): Duh! dont free subject &
- simplify logic a little.
-
-2002-11-20 Not Zed <NotZed@Ximian.com>
-
- * e-msg-composer-hdrs.c (entry_changed): duh, emit the signal
- using an initialised value(!).
+ * e-msg-composer.c (e_msg_composer_new_with_message): Make sure to
+ save References and In-Reply-To headers. Fixes bug #32932.
2002-11-19 Radek Doulik <rodo@ximian.com>
* e-msg-composer.c (e_msg_composer_get_sig_file_content): use
CAMEL_MIME_FILTER_TOHTML_PRESERVE_8BIT flag
-2002-11-19 Not Zed <NotZed@Ximian.com>
-
- * e-msg-composer-attachment-bar.c (add_from_file): dont unref
- after destroy. duh.
-
- * e-msg-composer-hdrs.c (e_msg_composer_hdrs_set_to): Add type
- code to set_property call.
- (e_msg_composer_hdrs_set_cc): "
- (e_msg_composer_hdrs_set_bcc): "
- (e_msg_composer_hdrs_get_to): Do the same for get_property calls.
- (init): ref/sink the tooltip object.
- (e_msg_composer_hdrs_get_type): fix return type.
-
- * e-msg-composer.c (GNOME_GTKHTML_EDITOR_CONTROL_ID): we want
- version 3.0 not 1.1.
- (create_composer): Add type code to set property call.
- (autosave_manager_query_load_orphans): my bad, we dont unref
- dialog's once we've destroyed 'em.
- (build_message): "
- (get_file_content): "
- (save): "
- (do_exit): "
- (composer_dispose): moved the autosave shutdown here.
-
-2002-11-18 Not Zed <NotZed@Ximian.com>
-
- * e-msg-composer.c (create_composer): Remove check for
- gtk_main_level(). as far as i can tell it serves no real purpose,
- and i think gtkmain is now redundant.
- (e_msg_composer_new_with_message): Same here.
- (destroy): moved some stuff into finalise, and made destroy
- mulitcall safe.
-
-2002-11-13 Ettore Perazzoli <ettore@ximian.com>
-
- * listener.h: Removed {BEGIN,END}_GNOME_DECLS.
-
- * e-msg-composer-select-file.c: Do not #include
- <libgnome/gnome-defs.h>.
- * e-msg-composer.c: Likewise.
- * listener.h: Likewise.
-
-2002-11-13 Not Zed <NotZed@Ximian.com>
-
- * e-msg-composer.c (setup_ui): bonobo api changes.
-
- * e-icon-list.c (e_icon_list_new): Use the right object_new method.
-
- * e-icon-list.h: get rid of BEGIN/END_GNOME_DECLS stuff.
-
-2002-11-11 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-msg-composer-attachment-bar.c: Remove some unused ehaders and
- ones that cause compilation failures (such as gnome-defs.h).
-
- * e-icon-list.h: Same.
-
-2002-11-08 Not Zed <NotZed@Ximian.com>
-
- * listener.c: Fix bonobo object setup.
-
- * e-msg-composer-hdrs.c: Remove oaf stuff, fix destroy to be
- multi-call safe.
-
- * e-msg-composer-attachment.c (e_msg_composer_attachment_new):
- Remove utf8 from locale conversions, & glib api changes.
- (ok_cb): "
-
- * e-msg-composer-attachment-bar.c (add_from_file): gtk message
- dialog.
- (pixbuf_for_mime_type): glib,gnome-vfs api changes.
- (init): Estimate the icon_height based on the pango font
- description size, this is probably not correct.
- (properties_cb):
- (remove_cb): Changed signature for gnomeui callbacks.
- (popup_icon_context_menu):
- (popup_context_menu): popup_menu api change
- (destroy): Protect from multiple calls.
- (e_msg_composer_attachment_bar_new): Remove push/pop
- visual/colormap stuff.
-
- * composer-marshal.list: The list of marshallers used by the
- composer.
-
- * Makefile.am (composer-marshal.h): Added composer marshal builder.
-
- * evolution-composer.c (class_init): bonobo object epv setup change.
- (factory_fn): Fix changes to factory callback.
-
- * e-icon-list.c: (icon_get_height): Use bounding box to calc
- height.
- (icon_event): drop gtk_selection_extended.
- (e_icon_list_remove): "
- (select_icon):
- (unselect_icon): "
-
- * e-msg-composer.c (autosave_save_draft): Dup fd rather than poke
- camel_stream_fd's data. Also, use camel_stream_close() rather
- than flush.
- (autosave_manager_query_load_orphans): Port to gtk dialog.
- (autosave_query_cb): Removed, redundant.
- (save): Port to gtkdialog.
- (prepare_engine): Fix bonobo-object-client code.
- (get_file_content): gtk dialog
- (do_exit): gtk dialog.
- (setup_signatures_menu): dump gtkutf8 stuff.
- (marshal_NONE__NONE_INT): What WAS jeff thinking? Removed :)
- (class_init): g object setup.
- (e_msg_composer_get_type): "
- (create_composer): remove bonobo_window_construct, use create
- property instead. g_signal stuff. bonobo stuff.
- (is_special_header): Use ascii_strncasecmp
- (e_msg_composer_set_pending_body): gtk->g_object_get/set_data.
- (e_msg_composer_set_body): use ascii_strncasecmp
- (e_msg_composer_add_inline_image_from_mime_part): make cid const.
- (autosave_manager_register):
- (autosave_manager_unregister): Use g_path_get_basename() & account
- for differences.
- (composer_shutdown): rename to finalise/etc.
- (class_init): Use object:finalize instead of shutdown.
- (e_msg_composer_set_body): Use _() rather than U_().
- (build_message): gtk dialog.
-
-2002-11-06 Not Zed <NotZed@Ximian.com>
-
- * e-msg-composer-attachment-bar.c (pixbuf_for_mime_type): Add
- error return to gdk_pixbuf_new_from_file().
-
-2002-11-01 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-msg-composer.c (e_msg_composer_new_from_url): Add support for
- an attach option in the mailto: url.
-
-2002-10-29 Jeffrey Stedfast <fejj@ximian.com>
-
- * e-msg-composer.c (e_msg_composer_new_with_message): Make sure to
- save References and In-Reply-To headers. Fixes bug #32932.
-
2002-10-26 Jeffrey Stedfast <fejj@ximian.com>
* e-msg-composer-attachment-bar.c (attach_to_multipart): Don't set
diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c
index 01c95e22b7..e788d85353 100644
--- a/composer/e-msg-composer.c
+++ b/composer/e-msg-composer.c
@@ -51,16 +51,23 @@
#include <sys/wait.h>
#include <unistd.h>
-#include <glib/gunicode.h>
-
#include <gtk/gtkoptionmenu.h>
+#include <gal/unicode/gunicode.h>
+#include <gal/util/e-unicode-i18n.h>
+#include <gal/widgets/e-unicode.h>
+#include <libgnome/gnome-defs.h>
#include <libgnome/gnome-exec.h>
+#include <libgnomeui/gnome-app.h>
#include <libgnomeui/gnome-uidefs.h>
+#include <libgnomeui/gnome-dialog.h>
+#include <libgnomeui/gnome-dialog-util.h>
+#include <libgnomeui/gnome-stock.h>
#include <libgnomeui/gnome-window-icon.h>
#include <bonobo/bonobo-exception.h>
#include <bonobo/bonobo-moniker-util.h>
+#include <bonobo/bonobo-object-client.h>
#include <bonobo/bonobo-stream-memory.h>
#include <bonobo/bonobo-ui-util.h>
#include <bonobo/bonobo-widget.h>
@@ -73,15 +80,16 @@
#include <gal/widgets/e-scroll-frame.h>
#include <gal/e-text/e-entry.h>
+#include <gtkhtml/gtkhtml.h>
+#include <gtkhtml/htmlselection.h>
+
#include "widgets/misc/e-charset-picker.h"
#include "camel/camel.h"
#include "camel/camel-charset-map.h"
#include "camel/camel-session.h"
-#warning "need to re-add mail.h"
-/*#include "mail.h"*/
-#include "mail/mail-callbacks.h"
+#include "mail/mail.h"
#include "mail/mail-crypto.h"
#include "mail/mail-tools.h"
#include "mail/mail-ops.h"
@@ -100,7 +108,7 @@
#include "Editor.h"
#include "listener.h"
-#define GNOME_GTKHTML_EDITOR_CONTROL_ID "OAFIID:GNOME_GtkHTML_Editor:3.0"
+#define GNOME_GTKHTML_EDITOR_CONTROL_ID "OAFIID:GNOME_GtkHTML_Editor:1.1"
#define d(x) x
@@ -334,7 +342,7 @@ build_message (EMsgComposer *composer, gboolean save_html_object_data)
/* evil kludgy hack for Redirect */
if (composer->redirect) {
e_msg_composer_hdrs_to_redirect (hdrs, composer->redirect);
- camel_object_ref (composer->redirect);
+ camel_object_ref (CAMEL_OBJECT (composer->redirect));
return composer->redirect;
}
@@ -375,7 +383,7 @@ build_message (EMsgComposer *composer, gboolean save_html_object_data)
plain = camel_data_wrapper_new ();
stream = camel_stream_mem_new_with_byte_array (data);
camel_data_wrapper_construct_from_stream (plain, stream);
- camel_object_unref (stream);
+ camel_object_unref (CAMEL_OBJECT (stream));
camel_data_wrapper_set_mime_type_field (plain, type);
header_content_type_unref (type);
@@ -395,14 +403,14 @@ build_message (EMsgComposer *composer, gboolean save_html_object_data)
if (!data) {
/* The component has probably died */
- camel_object_unref (new);
- camel_object_unref (plain);
+ camel_object_unref (CAMEL_OBJECT (new));
+ camel_object_unref (CAMEL_OBJECT (plain));
return NULL;
}
html = camel_data_wrapper_new ();
stream = camel_stream_mem_new_with_byte_array (data);
camel_data_wrapper_construct_from_stream (html, stream);
- camel_object_unref (stream);
+ camel_object_unref (CAMEL_OBJECT (stream));
camel_data_wrapper_set_mime_type (html, "text/html; charset=utf-8");
/* Build the multipart/alternative */
@@ -413,16 +421,16 @@ build_message (EMsgComposer *composer, gboolean save_html_object_data)
part = camel_mime_part_new ();
camel_medium_set_content_object (CAMEL_MEDIUM (part), plain);
- camel_object_unref (plain);
+ camel_object_unref (CAMEL_OBJECT (plain));
camel_mime_part_set_encoding (part, plain_encoding);
camel_multipart_add_part (body, part);
- camel_object_unref (part);
+ camel_object_unref (CAMEL_OBJECT (part));
part = camel_mime_part_new ();
camel_medium_set_content_object (CAMEL_MEDIUM (part), html);
- camel_object_unref (html);
+ camel_object_unref (CAMEL_OBJECT (html));
camel_multipart_add_part (body, part);
- camel_object_unref (part);
+ camel_object_unref (CAMEL_OBJECT (part));
/* If there are inlined images, construct a
* multipart/related containing the
@@ -439,9 +447,9 @@ build_message (EMsgComposer *composer, gboolean save_html_object_data)
part = camel_mime_part_new ();
camel_medium_set_content_object (CAMEL_MEDIUM (part), CAMEL_DATA_WRAPPER (body));
- camel_object_unref (body);
+ camel_object_unref (CAMEL_OBJECT (body));
camel_multipart_add_part (html_with_images, part);
- camel_object_unref (part);
+ camel_object_unref (CAMEL_OBJECT (part));
add_inlined_images (composer, html_with_images);
clear_current_images (composer);
@@ -467,9 +475,9 @@ build_message (EMsgComposer *composer, gboolean save_html_object_data)
camel_medium_set_content_object (CAMEL_MEDIUM (part), current);
if (current == plain)
camel_mime_part_set_encoding (part, plain_encoding);
- camel_object_unref (current);
+ camel_object_unref (CAMEL_OBJECT (current));
camel_multipart_add_part (multipart, part);
- camel_object_unref (part);
+ camel_object_unref (CAMEL_OBJECT (part));
e_msg_composer_attachment_bar_to_multipart (attachment_bar, multipart, composer->charset);
@@ -492,7 +500,7 @@ build_message (EMsgComposer *composer, gboolean save_html_object_data)
camel_medium_set_content_object (CAMEL_MEDIUM (part), current);
if (current == plain)
camel_mime_part_set_encoding (part, plain_encoding);
- camel_object_unref (current);
+ camel_object_unref (CAMEL_OBJECT (current));
if (composer->pgp_sign) {
CamelInternetAddress *from = NULL;
@@ -623,14 +631,14 @@ build_message (EMsgComposer *composer, gboolean save_html_object_data)
}
current = camel_medium_get_content_object (CAMEL_MEDIUM (part));
- camel_object_ref (current);
- camel_object_unref (part);
+ camel_object_ref (CAMEL_OBJECT (current));
+ camel_object_unref (CAMEL_OBJECT (part));
}
camel_medium_set_content_object (CAMEL_MEDIUM (new), current);
if (current == plain)
camel_mime_part_set_encoding (CAMEL_MIME_PART (new), plain_encoding);
- camel_object_unref (current);
+ camel_object_unref (CAMEL_OBJECT (current));
#if defined (HAVE_NSS) && defined (SMIME_SUPPORTED)
if (composer->smime_sign) {
@@ -651,12 +659,12 @@ build_message (EMsgComposer *composer, gboolean save_html_object_data)
smime_mesg = mail_crypto_smime_sign (new, certname, TRUE, TRUE, &ex);
if (from)
- camel_object_unref (from);
+ camel_object_unref (CAMEL_OBJECT (from));
if (camel_exception_is_set (&ex))
goto exception;
- camel_object_unref (new);
+ camel_object_unref (CAMEL_OBJECT (new));
new = smime_mesg;
}
@@ -685,7 +693,7 @@ build_message (EMsgComposer *composer, gboolean save_html_object_data)
g_ptr_array_add (recipients, g_strdup (address));
if (from)
- camel_object_unref (addr);
+ camel_object_unref (CAMEL_OBJECT (addr));
}
addr = camel_mime_message_get_recipients (new, CAMEL_RECIPIENT_TYPE_TO);
@@ -714,7 +722,7 @@ build_message (EMsgComposer *composer, gboolean save_html_object_data)
smime_mesg = mail_crypto_smime_encrypt (new, address, recipients, &ex);
- camel_object_unref (from);
+ camel_object_unref (CAMEL_OBJECT (from));
for (i = 0; i < recipients->len; i++)
g_free (recipients->pdata[i]);
@@ -723,7 +731,7 @@ build_message (EMsgComposer *composer, gboolean save_html_object_data)
if (camel_exception_is_set (&ex))
goto exception;
- camel_object_unref (new);
+ camel_object_unref (CAMEL_OBJECT (new));
new = smime_mesg;
}
@@ -742,19 +750,16 @@ build_message (EMsgComposer *composer, gboolean save_html_object_data)
exception:
if (part != CAMEL_MIME_PART (new))
- camel_object_unref (part);
+ camel_object_unref (CAMEL_OBJECT (part));
- camel_object_unref (new);
+ camel_object_unref (CAMEL_OBJECT (new));
if (camel_exception_is_set (&ex)) {
GtkWidget *dialog;
-
- dialog = gtk_message_dialog_new(GTK_WINDOW(composer),
- GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
- "%s", camel_exception_get_description (&ex));
- gtk_dialog_run(GTK_DIALOG(dialog));
- gtk_widget_destroy(dialog);
+
+ dialog = gnome_error_dialog_parented (camel_exception_get_description (&ex),
+ GTK_WINDOW (composer));
+ gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
camel_exception_clear (&ex);
}
@@ -776,16 +781,13 @@ get_file_content (EMsgComposer *composer, const char *file_name, gboolean want_h
fd = open (file_name, O_RDONLY);
if (fd == -1) {
+ char *msg;
+
if (warn) {
- GtkWidget *dialog;
-
- dialog = gtk_message_dialog_new(GTK_WINDOW(composer),
- GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
- _("Error while reading file %s:\n%s"),
- file_name, g_strerror (errno));
- gtk_dialog_run(GTK_DIALOG(dialog));
- gtk_widget_destroy(dialog);
+ msg = g_strdup_printf (_("Error while reading file %s:\n%s"),
+ file_name, g_strerror (errno));
+ gnome_error_dialog (msg);
+ g_free (msg);
}
return g_strdup ("");
}
@@ -864,8 +866,8 @@ prepare_engine (EMsgComposer *composer)
/* printf ("prepare_engine\n"); */
CORBA_exception_init (&ev);
- composer->editor_engine = (GNOME_GtkHTML_Editor_Engine) Bonobo_Unknown_queryInterface
- (bonobo_widget_get_objref (BONOBO_WIDGET (composer->editor)), "IDL:GNOME/GtkHTML/Editor/Engine:1.0", &ev);
+ composer->editor_engine = (GNOME_GtkHTML_Editor_Engine) bonobo_object_client_query_interface
+ (bonobo_widget_get_server (BONOBO_WIDGET (composer->editor)), "IDL:GNOME/GtkHTML/Editor/Engine:1.0", &ev);
if ((composer->editor_engine != CORBA_OBJECT_NIL) && (ev._major == CORBA_NO_EXCEPTION)) {
/* printf ("trying set listener\n"); */
@@ -1107,11 +1109,9 @@ set_config (EMsgComposer *composer, char *key, int val)
return;
full_key = g_strconcat ("/Mail/Composer/", key, NULL);
-
-#warning "bonobo config"
-#if 0
+
bonobo_config_set_long (composer->config_db, full_key, val, NULL);
-#endif
+
g_free (full_key);
}
@@ -1155,18 +1155,25 @@ save (EMsgComposer *composer, const char *file_name)
/* check to see if we already have the file */
if ((fd = open (my_file_name, O_RDONLY | O_CREAT | O_EXCL, 0777)) == -1) {
- GtkWidget *dialog;
- int resp;
-
- dialog = gtk_message_dialog_new(GTK_WINDOW(composer),
- GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO,
- _("File exists, overwrite?"));
- resp = gtk_dialog_run(GTK_DIALOG(dialog));
- gtk_widget_destroy(dialog);
- if (resp != GTK_RESPONSE_YES) {
- g_free(my_file_name);
+ GtkWidget *dialog, *label;
+
+ dialog = gnome_dialog_new (_("Warning!"),
+ GNOME_STOCK_BUTTON_YES,
+ GNOME_STOCK_BUTTON_NO,
+ NULL);
+ label = gtk_label_new (_("File exists, overwrite?"));
+ gtk_widget_show (label);
+ gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), label, TRUE, TRUE, 0);
+
+ switch (gnome_dialog_run_and_close (GNOME_DIALOG (dialog))) {
+ case -1:
+ gtk_widget_destroy (dialog);
return;
+ case 1:
+ return;
+ default:
+ /* ie, the user hit "Yes" so just continue as normal */
+ break;
}
} else
close (fd);
@@ -1176,11 +1183,8 @@ save (EMsgComposer *composer, const char *file_name)
Bonobo_PersistFile_save (composer->persist_file_interface, my_file_name, &ev);
if (ev._major != CORBA_NO_EXCEPTION) {
- char *tmp = g_path_get_basename(my_file_name);
-
- e_notice (GTK_WINDOW (composer), GTK_MESSAGE_ERROR,
- _("Error saving file: %s"), tmp);
- g_free(tmp);
+ e_notice (GTK_WINDOW (composer), GNOME_MESSAGE_BOX_ERROR,
+ _("Error saving file: %s"), g_basename (my_file_name));
} else
GNOME_GtkHTML_Editor_Engine_runCommand (composer->editor_engine, "saved", &ev);
@@ -1198,13 +1202,9 @@ load (EMsgComposer *composer, const char *file_name)
Bonobo_PersistFile_load (composer->persist_file_interface, file_name, &ev);
- if (ev._major != CORBA_NO_EXCEPTION) {
- char *tmp = g_path_get_basename(file_name);
-
- e_notice (GTK_WINDOW (composer), GTK_MESSAGE_ERROR,
- _("Error loading file: %s"), tmp);
- g_free(tmp);
- }
+ if (ev._major != CORBA_NO_EXCEPTION)
+ e_notice (GTK_WINDOW (composer), GNOME_MESSAGE_BOX_ERROR,
+ _("Error loading file: %s"), g_basename (file_name));
CORBA_exception_free (&ev);
}
@@ -1229,14 +1229,14 @@ autosave_save_draft (EMsgComposer *composer)
CamelMimeMessage *message;
CamelStream *stream;
char *file;
- int fd, camelfd;
+ int fd;
gboolean success = TRUE;
fd = composer->autosave_fd;
file = composer->autosave_file;
if (fd == -1) {
- e_notice (GTK_WINDOW (composer), GTK_MESSAGE_ERROR,
+ e_notice (GTK_WINDOW (composer), GNOME_MESSAGE_BOX_ERROR,
_("Error accessing file: %s"), file);
return FALSE;
}
@@ -1244,47 +1244,40 @@ autosave_save_draft (EMsgComposer *composer)
message = e_msg_composer_get_message_draft (composer);
if (message == NULL) {
- e_notice (GTK_WINDOW (composer), GTK_MESSAGE_ERROR,
+ e_notice (GTK_WINDOW (composer), GNOME_MESSAGE_BOX_ERROR,
_("Unable to retrieve message from editor"));
return FALSE;
}
if (lseek (fd, (off_t)0, SEEK_SET) == -1) {
- camel_object_unref (message);
- e_notice (GTK_WINDOW (composer), GTK_MESSAGE_ERROR,
+ camel_object_unref (CAMEL_OBJECT (message));
+ e_notice (GTK_WINDOW (composer), GNOME_MESSAGE_BOX_ERROR,
_("Unable to seek on file: %s\n%s"), file, g_strerror (errno));
return FALSE;
}
if (ftruncate (fd, (off_t)0) == -1) {
- camel_object_unref (message);
- e_notice (GTK_WINDOW (composer), GTK_MESSAGE_ERROR,
+ camel_object_unref (CAMEL_OBJECT (message));
+ e_notice (GTK_WINDOW (composer), GNOME_MESSAGE_BOX_ERROR,
_("Unable to truncate file: %s\n%s"), file, g_strerror (errno));
return FALSE;
}
-
- /* dup the fd because we dont want camel to close it when done */
- camelfd = dup(fd);
- if (fd == -1) {
- camel_object_unref (message);
- e_notice (GTK_WINDOW (composer), GTK_MESSAGE_ERROR,
- _("Unable to copy file descriptor: %s\n%s"), file, g_strerror (errno));
- return FALSE;
- }
/* this does an lseek so we don't have to */
- stream = camel_stream_fs_new_with_fd (camelfd);
+ stream = camel_stream_fs_new_with_fd (fd);
if (camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), stream) == -1
- || camel_stream_close (CAMEL_STREAM (stream)) == -1) {
- e_notice (GTK_WINDOW (composer), GTK_MESSAGE_ERROR,
+ || camel_stream_flush (CAMEL_STREAM (stream)) == -1) {
+ e_notice (GTK_WINDOW (composer), GNOME_MESSAGE_BOX_ERROR,
_("Error autosaving message: %s\n %s"), file, strerror(errno));
success = FALSE;
}
- camel_object_unref (stream);
+ /* set the fd to -1 in the stream so camel doesn't close it we want to keep it open */
+ CAMEL_STREAM_FS (stream)->fd = -1;
+ camel_object_unref (CAMEL_OBJECT (stream));
- camel_object_unref (message);
+ camel_object_unref (CAMEL_OBJECT (message));
return success;
}
@@ -1313,13 +1306,13 @@ autosave_load_draft (const char *filename)
if (composer) {
autosave_save_draft (composer);
- g_signal_connect (GTK_OBJECT (composer), "send",
- G_CALLBACK (composer_send_cb), NULL);
+ gtk_signal_connect (GTK_OBJECT (composer), "send",
+ GTK_SIGNAL_FUNC (composer_send_cb), NULL);
gtk_widget_show (GTK_WIDGET (composer));
}
- camel_object_unref (stream);
+ camel_object_unref ((CamelObject *)stream);
return composer;
}
@@ -1330,6 +1323,14 @@ autosave_is_owned (AutosaveManager *am, const char *file)
}
static void
+autosave_query_cb (gint reply, gpointer data)
+{
+ int *yes = data;
+
+ *yes = !reply;
+}
+
+static void
autosave_manager_query_load_orphans (AutosaveManager *am, EMsgComposer *composer)
{
GtkWidget *dialog;
@@ -1355,7 +1356,7 @@ autosave_manager_query_load_orphans (AutosaveManager *am, EMsgComposer *composer
* check if the file has any length, It is a valid case if it doesn't
* so we simply don't ask then.
*/
- if (stat (filename, &st) == -1 || st.st_size == 0) {
+ if (stat (filename, &st) < 0 || st.st_size == 0) {
unlink (filename);
g_free (filename);
continue;
@@ -1367,15 +1368,11 @@ autosave_manager_query_load_orphans (AutosaveManager *am, EMsgComposer *composer
closedir (dir);
if (match != NULL) {
- GtkWidget *dialog;
-
- dialog = gtk_message_dialog_new(GTK_WINDOW(composer),
- GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR, GTK_BUTTONS_YES_NO,
- _("Ximian Evolution has found unsaved files from a previous session.\n"
- "Would you like to try to recover them?"));
- load = gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_YES;
- gtk_widget_destroy(dialog);
+ dialog = gnome_question_dialog_parented (_("Ximian Evolution has found unsaved files from a previous session.\n"
+ "Would you like to try to recover them?"),
+ autosave_query_cb, &load, GTK_WINDOW (composer));
+
+ gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
}
while (match != NULL) {
@@ -1465,7 +1462,7 @@ autosave_manager_register (AutosaveManager *am, EMsgComposer *composer)
g_return_if_fail (composer != NULL);
if (autosave_init_file (composer)) {
- key = g_path_get_basename (composer->autosave_file);
+ key = g_basename (composer->autosave_file);
g_hash_table_insert (am->table, key, composer);
if (am->ask) {
/* keep recursion out of our bedrooms. */
@@ -1480,18 +1477,10 @@ autosave_manager_register (AutosaveManager *am, EMsgComposer *composer)
static void
autosave_manager_unregister (AutosaveManager *am, EMsgComposer *composer)
{
- char *key, *oldkey;
- void *olddata;
-
if (!composer->autosave_file)
return;
- key = g_path_get_basename(composer->autosave_file);
- if (g_hash_table_lookup_extended(am->table, key, (void **)&oldkey, &olddata)) {
- g_hash_table_remove(am->table, oldkey);
- g_free(oldkey);
- g_free(key);
- }
+ g_hash_table_remove (am->table, g_basename (composer->autosave_file));
/* only remove the file if we can successfully save it */
/* FIXME this test could probably be more efficient */
@@ -1509,7 +1498,7 @@ autosave_manager_unregister (AutosaveManager *am, EMsgComposer *composer)
static void
menu_file_save_draft_cb (BonoboUIComponent *uic, void *data, const char *path)
{
- g_signal_emit (data, signals[SAVE_DRAFT], 0, FALSE);
+ gtk_signal_emit (GTK_OBJECT (data), signals[SAVE_DRAFT], FALSE);
e_msg_composer_unset_changed (E_MSG_COMPOSER (data));
}
@@ -1518,7 +1507,7 @@ menu_file_save_draft_cb (BonoboUIComponent *uic, void *data, const char *path)
static void
do_exit (EMsgComposer *composer)
{
- char *subject;
+ char *subject, *subject_utf8, *label;
GtkWidget *dialog;
int button;
@@ -1528,31 +1517,39 @@ do_exit (EMsgComposer *composer)
}
gdk_window_raise (GTK_WIDGET (composer)->window);
-
- subject = e_msg_composer_hdrs_get_subject (E_MSG_COMPOSER_HDRS (composer->hdrs));
- dialog = gtk_message_dialog_new(GTK_WINDOW(composer),
- GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR, GTK_BUTTONS_YES_NO,
- _("The message \"%s\" has not been sent.\n\nDo you wish to save your changes?"),
- subject);
- g_free(subject);
- gtk_dialog_add_button (GTK_DIALOG(dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
+
+ subject_utf8 = e_msg_composer_hdrs_get_subject (E_MSG_COMPOSER_HDRS (composer->hdrs));
+ subject = e_utf8_to_locale_string (subject_utf8);
+ g_free (subject_utf8);
+
+ label = g_strdup_printf (_("The message \"%s\" has not been sent.\n\nDo you wish to save your changes?"), subject);
+ g_free (subject);
+
+ dialog = gnome_message_box_new (label, GNOME_MESSAGE_BOX_QUESTION,
+ GNOME_STOCK_BUTTON_YES, /* Save */
+ GNOME_STOCK_BUTTON_NO, /* Don't save */
+ GNOME_STOCK_BUTTON_CANCEL, /* Cancel */
+ NULL);
+
+ g_free (label);
+
gtk_window_set_title (GTK_WINDOW (dialog), _("Warning: Modified Message"));
- gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_YES);
- button = gtk_dialog_run(GTK_DIALOG(dialog));
- gtk_widget_destroy(dialog);
-
- switch(button) {
- case GTK_RESPONSE_YES:
+ gnome_dialog_set_parent (GNOME_DIALOG (dialog), GTK_WINDOW (composer));
+ gnome_dialog_set_default (GNOME_DIALOG (dialog), 0);
+ button = gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
+
+ switch (button) {
+ case 0:
/* Save */
- g_signal_emit (GTK_OBJECT (composer), signals[SAVE_DRAFT], 0, TRUE);
+ gtk_signal_emit (GTK_OBJECT (composer), signals[SAVE_DRAFT], TRUE);
e_msg_composer_unset_changed (composer);
break;
- case GTK_RESPONSE_NO:
+ case 1:
/* Don't save */
gtk_widget_destroy (GTK_WIDGET (composer));
break;
- case GTK_RESPONSE_CANCEL:
+ default:
+ /* Cancel */
break;
}
}
@@ -1964,7 +1961,7 @@ setup_signatures_menu (EMsgComposer *composer)
#define ADD(x) \
mi = (x ? gtk_menu_item_new_with_label (x) : gtk_menu_item_new ()); \
gtk_widget_show (mi); \
- gtk_menu_shell_append(GTK_MENU_SHELL(menu), mi);
+ gtk_menu_append (GTK_MENU (menu), mi);
menu = gtk_menu_new ();
ADD (_("None"));
@@ -1973,7 +1970,11 @@ setup_signatures_menu (EMsgComposer *composer)
list = mail_config_get_signature_list ();
if (list)
for (l = list; l; len ++, l = l->next) {
- ADD(((MailConfigSignature *)l->data)->name);
+ gchar *gtk_str;
+
+ gtk_str = e_utf8_to_gtk_string (menu, ((MailConfigSignature *)l->data)->name);
+ ADD (gtk_str);
+ g_free (gtk_str);
}
#undef ADD
@@ -1981,7 +1982,7 @@ setup_signatures_menu (EMsgComposer *composer)
gtk_option_menu_set_menu (GTK_OPTION_MENU (composer->sig_omenu), menu);
sig_select_item (composer);
- g_signal_connect (menu, "selection-done", (GCallback)signature_cb, composer);
+ gtk_signal_connect (GTK_OBJECT (menu), "selection-done", signature_cb, composer);
}
static void
@@ -1991,11 +1992,11 @@ setup_ui (EMsgComposer *composer)
char *default_charset;
gboolean hide_smime;
- container = bonobo_window_get_ui_container(BONOBO_WINDOW (composer));
+ container = bonobo_ui_container_new ();
+ bonobo_ui_container_set_win (container, BONOBO_WINDOW (composer));
composer->uic = bonobo_ui_component_new_default ();
- /* FIXME: handle bonobo exceptions */
- bonobo_ui_component_set_container (composer->uic, bonobo_object_corba_objref (BONOBO_OBJECT (container)), NULL);
+ bonobo_ui_component_set_container (composer->uic, bonobo_object_corba_objref (BONOBO_OBJECT (container)));
bonobo_ui_component_add_verb_list_with_data (composer->uic, verbs, composer);
@@ -2003,20 +2004,15 @@ setup_ui (EMsgComposer *composer)
bonobo_ui_util_set_ui (composer->uic, EVOLUTION_DATADIR,
"evolution-message-composer.xml",
- "evolution-message-composer", NULL);
+ "evolution-message-composer");
e_pixmaps_update (composer->uic, pixcache);
/* Populate the Charset Encoding menu and default it to whatever the user
chose as his default charset in the mailer */
-#warning "bonobo_config"
-#if 0
default_charset = bonobo_config_get_string (composer->config_db,
"/Mail/Format/default_charset",
NULL);
-#else
- default_charset = g_strdup("iso-8859-1");
-#endif
e_charset_picker_bonobo_ui_populate (composer->uic, "/menu/Edit/EncodingPlaceholder",
default_charset,
menu_changed_charset_cb,
@@ -2152,7 +2148,12 @@ subject_changed_cb (EMsgComposerHdrs *hdrs,
composer = E_MSG_COMPOSER (data);
- gtk_window_set_title (GTK_WINDOW (composer), subject[0]?subject:_("Compose a message"));
+ if (strlen (subject))
+ gtk_window_set_title (GTK_WINDOW (composer), subject);
+ else
+ gtk_window_set_title (GTK_WINDOW (composer),
+ _("Compose a message"));
+ g_free (subject);
}
static void
@@ -2217,7 +2218,7 @@ update_auto_recipients (EMsgComposerHdrs *hdrs, int mode, const char *auto_addrs
}
}
- camel_object_unref (iaddr);
+ camel_object_unref (CAMEL_OBJECT (iaddr));
}
switch (mode) {
@@ -2284,7 +2285,7 @@ from_changed_cb (EMsgComposerHdrs *hdrs, void *data)
e_msg_composer_set_pgp_sign (composer,
account->pgp_always_sign &&
(!account->pgp_no_imip_sign || !composer->mime_type ||
- strncasecmp (composer->mime_type, "text/calendar", 13) != 0));
+ g_strncasecmp (composer->mime_type, "text/calendar", 13) != 0));
e_msg_composer_set_smime_sign (composer, account->smime_always_sign);
update_auto_recipients (hdrs, UPDATE_AUTO_CC, account->always_cc ? account->cc_addrs : NULL);
update_auto_recipients (hdrs, UPDATE_AUTO_BCC, account->always_bcc ? account->bcc_addrs : NULL);
@@ -2298,113 +2299,93 @@ from_changed_cb (EMsgComposerHdrs *hdrs, void *data)
}
-/* GObject methods. */
-
-static void
-composer_finalise (GObject *object)
-{
- EMsgComposer *composer;
-
- composer = E_MSG_COMPOSER (object);
-
- mail_config_signature_unregister_client ((MailConfigSignatureClient) sig_event_client, composer);
-
- if (composer->extra_hdr_names) {
- int i;
-
- for (i = 0; i < composer->extra_hdr_names->len; i++) {
- g_free (composer->extra_hdr_names->pdata[i]);
- g_free (composer->extra_hdr_values->pdata[i]);
- }
- g_ptr_array_free (composer->extra_hdr_names, TRUE);
- g_ptr_array_free (composer->extra_hdr_values, TRUE);
- }
-
- e_msg_composer_clear_inlined_table (composer);
- g_hash_table_destroy (composer->inline_images);
- g_hash_table_destroy (composer->inline_images_by_url);
-
- g_free (composer->charset);
- g_free (composer->mime_type);
- g_free (composer->mime_body);
-
- if (composer->redirect)
- camel_object_unref (composer->redirect);
-
- if (G_OBJECT_CLASS (parent_class)->finalize != NULL)
- (* G_OBJECT_CLASS (parent_class)->finalize) (object);
-}
+/* GtkObject methods. */
static void
-composer_dispose(GObject *object)
+composer_shutdown (GtkObject *object)
{
/* When destroy() is called, the contents of the window
* (including the remote editor control) will already have
* been destroyed, so we have to do this here.
*/
autosave_manager_unregister (am, E_MSG_COMPOSER (object));
- if (G_OBJECT_CLASS (parent_class)->dispose != NULL)
- (* G_OBJECT_CLASS (parent_class)->dispose) (object);
+ if (GTK_OBJECT_CLASS (parent_class)->shutdown != NULL)
+ (* GTK_OBJECT_CLASS (parent_class)->shutdown) (object);
}
-/* GtkObject methods */
static void
destroy (GtkObject *object)
{
EMsgComposer *composer;
CORBA_Environment ev;
-
+
composer = E_MSG_COMPOSER (object);
-
+
+ mail_config_signature_unregister_client ((MailConfigSignatureClient) sig_event_client, composer);
+
CORBA_exception_init (&ev);
if (composer->config_db) {
Bonobo_ConfigDatabase_sync (composer->config_db, &ev);
bonobo_object_release_unref (composer->config_db, NULL);
- composer->config_db = NULL;
}
+ composer->config_db = NULL;
- if (composer->uic) {
+ if (composer->uic)
bonobo_object_unref (BONOBO_OBJECT (composer->uic));
- composer->uic = NULL;
- }
+ composer->uic = NULL;
/* FIXME? I assume the Bonobo widget will get destroyed
normally? */
- if (composer->address_dialog != NULL) {
+ if (composer->address_dialog != NULL)
gtk_widget_destroy (composer->address_dialog);
- composer->address_dialog = NULL;
- }
- if (composer->hdrs != NULL) {
+ if (composer->hdrs != NULL)
gtk_widget_destroy (composer->hdrs);
- composer->hdrs = NULL;
+
+ if (composer->extra_hdr_names) {
+ int i;
+
+ for (i = 0; i < composer->extra_hdr_names->len; i++) {
+ g_free (composer->extra_hdr_names->pdata[i]);
+ g_free (composer->extra_hdr_values->pdata[i]);
+ }
+ g_ptr_array_free (composer->extra_hdr_names, TRUE);
+ g_ptr_array_free (composer->extra_hdr_values, TRUE);
}
+ e_msg_composer_clear_inlined_table (composer);
+ g_hash_table_destroy (composer->inline_images);
+ g_hash_table_destroy (composer->inline_images_by_url);
+
+ g_free (composer->charset);
+ g_free (composer->mime_type);
+ g_free (composer->mime_body);
+
+ CORBA_exception_init (&ev);
+
if (composer->persist_stream_interface != CORBA_OBJECT_NIL) {
Bonobo_Unknown_unref (composer->persist_stream_interface, &ev);
CORBA_Object_release (composer->persist_stream_interface, &ev);
- composer->persist_stream_interface = CORBA_OBJECT_NIL;
}
if (composer->persist_file_interface != CORBA_OBJECT_NIL) {
Bonobo_Unknown_unref (composer->persist_file_interface, &ev);
CORBA_Object_release (composer->persist_file_interface, &ev);
- composer->persist_file_interface = CORBA_OBJECT_NIL;
}
if (composer->editor_engine != CORBA_OBJECT_NIL) {
Bonobo_Unknown_unref (composer->editor_engine, &ev);
CORBA_Object_release (composer->editor_engine, &ev);
- composer->editor_engine = CORBA_OBJECT_NIL;
}
CORBA_exception_free (&ev);
- if (composer->editor_listener) {
+ if (composer->redirect)
+ camel_object_unref (CAMEL_OBJECT (composer->redirect));
+
+ if (composer->editor_listener)
bonobo_object_unref (composer->editor_listener);
- composer->editor_listener = NULL;
- }
if (GTK_OBJECT_CLASS (parent_class)->destroy != NULL)
(* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
@@ -2426,18 +2407,21 @@ static void
message_rfc822_dnd (EMsgComposer *composer, CamelStream *stream)
{
CamelMimeParser *mp;
+ CamelException *ex;
mp = camel_mime_parser_new ();
camel_mime_parser_scan_from (mp, TRUE);
camel_mime_parser_init_with_stream (mp, stream);
+ ex = camel_exception_new ();
+
while (camel_mime_parser_step (mp, 0, 0) == HSCAN_FROM) {
CamelMimeMessage *message;
CamelMimePart *part;
message = camel_mime_message_new ();
if (camel_mime_part_construct_from_parser (CAMEL_MIME_PART (message), mp) == -1) {
- camel_object_unref (message);
+ camel_object_unref (CAMEL_OBJECT (message));
break;
}
@@ -2448,14 +2432,16 @@ message_rfc822_dnd (EMsgComposer *composer, CamelStream *stream)
camel_mime_part_set_content_type (part, "message/rfc822");
e_msg_composer_attachment_bar_attach_mime_part (E_MSG_COMPOSER_ATTACHMENT_BAR (composer->attachment_bar),
part);
- camel_object_unref (message);
- camel_object_unref (part);
+ camel_object_unref (CAMEL_OBJECT (message));
+ camel_object_unref (CAMEL_OBJECT (part));
+ camel_exception_clear (ex);
/* skip over the FROM_END state */
camel_mime_parser_step (mp, 0, 0);
}
- camel_object_unref (mp);
+ camel_object_unref (CAMEL_OBJECT (mp));
+ camel_exception_free (ex);
}
static void
@@ -2478,7 +2464,7 @@ drag_data_received (EMsgComposer *composer, GdkDragContext *context,
camel_stream_reset (stream);
message_rfc822_dnd (composer, stream);
- camel_object_unref (stream);
+ camel_object_unref (CAMEL_OBJECT (stream));
break;
case DND_TYPE_TEXT_URI_LIST:
d(printf ("dropping a text/uri-list\n"));
@@ -2515,49 +2501,58 @@ drag_data_received (EMsgComposer *composer, GdkDragContext *context,
(E_MSG_COMPOSER_ATTACHMENT_BAR (composer->attachment_bar),
mime_part);
- camel_object_unref (mime_part);
+ camel_object_unref (CAMEL_OBJECT (mime_part));
default:
d(printf ("dropping an unknown\n"));
break;
}
}
+typedef void (*GtkSignal_NONE__NONE_INT) (GtkObject *, int, gpointer);
+
+static void marshal_NONE__NONE_INT (GtkObject *object, GtkSignalFunc func,
+ gpointer func_data, GtkArg *args)
+{
+ GtkSignal_NONE__NONE_INT rfunc;
+
+ rfunc = (GtkSignal_NONE__NONE_INT) func;
+ (*rfunc)(object, GTK_VALUE_INT (args[0]), func_data);
+}
+
+
static void
class_init (EMsgComposerClass *klass)
{
GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
- GObjectClass *gobject_class;
-
- gobject_class = G_OBJECT_CLASS(klass);
+
object_class = GTK_OBJECT_CLASS (klass);
widget_class = GTK_WIDGET_CLASS (klass);
- gobject_class->finalize = composer_finalise;
- gobject_class->dispose = composer_dispose;
+ object_class->shutdown = composer_shutdown;
object_class->destroy = destroy;
+
widget_class->delete_event = delete_event;
- parent_class = g_type_class_ref(bonobo_window_get_type ());
+ parent_class = gtk_type_class (bonobo_window_get_type ());
signals[SEND] =
- g_signal_new ("send",
- E_TYPE_MSG_COMPOSER,
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EMsgComposerClass, send),
- NULL, NULL,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ gtk_signal_new ("send",
+ GTK_RUN_LAST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EMsgComposerClass, send),
+ gtk_marshal_NONE__NONE,
+ GTK_TYPE_NONE, 0);
signals[SAVE_DRAFT] =
- g_signal_new ("save-draft",
- E_TYPE_MSG_COMPOSER,
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EMsgComposerClass, save_draft),
- NULL, NULL,
- g_cclosure_marshal_VOID__BOOLEAN,
- G_TYPE_NONE,
- 1, G_TYPE_BOOLEAN);
+ gtk_signal_new ("save-draft",
+ GTK_RUN_LAST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EMsgComposerClass, save_draft),
+ marshal_NONE__NONE_INT,
+ GTK_TYPE_NONE, 1, GTK_TYPE_INT);
+
+ gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
}
static void
@@ -2606,20 +2601,21 @@ init (EMsgComposer *composer)
GtkType
e_msg_composer_get_type (void)
{
- static GType type = 0;
+ static GtkType type = 0;
if (type == 0) {
- static const GTypeInfo info = {
- sizeof (EMsgComposerClass),
- NULL, NULL,
- (GClassInitFunc) class_init,
- NULL, NULL,
+ static const GtkTypeInfo info = {
+ "EMsgComposer",
sizeof (EMsgComposer),
- 0,
- (GInstanceInitFunc) init,
+ sizeof (EMsgComposerClass),
+ (GtkClassInitFunc) class_init,
+ (GtkObjectInitFunc) init,
+ /* reserved_1 */ NULL,
+ /* reserved_2 */ NULL,
+ (GtkClassInitFunc) NULL,
};
-
- type = g_type_register_static (bonobo_window_get_type (), "EMsgComposer", &info, 0);
+
+ type = gtk_type_unique (bonobo_window_get_type (), &info);
}
return type;
@@ -2628,7 +2624,6 @@ e_msg_composer_get_type (void)
static void
load_from_config_db (EMsgComposer *composer)
{
-#if 0
Bonobo_ConfigDatabase db = composer->config_db;
composer->view_from = bonobo_config_get_long_with_default (
@@ -2641,7 +2636,6 @@ load_from_config_db (EMsgComposer *composer)
db, "Mail/Composer/ViewBCC", 0, NULL);
composer->view_subject = bonobo_config_get_long_with_default (
db, "Mail/Composer/ViewSubject", 1, NULL);
-#endif
}
static void
@@ -2704,12 +2698,11 @@ map_default_cb (EMsgComposer *composer, gpointer user_data)
to = e_msg_composer_hdrs_get_to_entry (E_MSG_COMPOSER_HDRS (composer->hdrs));
cf = bonobo_widget_get_control_frame (BONOBO_WIDGET (to));
pb = bonobo_control_frame_get_control_property_bag (cf, NULL);
- text = bonobo_pbclient_get_string (pb, "text", NULL);
+ text = bonobo_property_bag_client_get_value_string (pb, "text", NULL);
bonobo_object_release_unref (pb, NULL);
if (!text || text[0] == '\0') {
-#warning "bonobo control frame focus child?"
- /*bonobo_control_frame_focus_child (cf, GTK_DIR_TAB_FORWARD);*/
+ bonobo_control_frame_focus_child (cf, GTK_DIR_TAB_FORWARD);
g_free (text);
return;
}
@@ -2750,7 +2743,7 @@ composer_key_pressed (GtkWidget *widget, GdkEventKey *event, gpointer user_data)
if (event->keyval == GDK_Escape) {
do_exit (E_MSG_COMPOSER (widget));
- g_signal_stop_emission_by_name(widget, "key-press-event");
+ gtk_signal_emit_stop_by_name (GTK_OBJECT (widget), "key-press-event");
return TRUE; /* Handled. */
}
@@ -2762,32 +2755,34 @@ create_composer (int visible_mask)
{
EMsgComposer *composer;
GtkWidget *vbox;
- Bonobo_Unknown editor_server;
- CORBA_Environment ev;
+ BonoboObject *editor_server;
int vis;
-#warning " does win_name need qualifying? "
- composer = g_object_new (E_TYPE_MSG_COMPOSER, "win_name", _("Compose a message"), NULL);
+ g_return_val_if_fail (gtk_main_level () > 0, NULL);
+
+ composer = gtk_type_new (E_TYPE_MSG_COMPOSER);
all_composers = g_slist_prepend (all_composers, composer);
- g_signal_connect (composer, "key-press-event",
- G_CALLBACK (composer_key_pressed),
- NULL);
- g_signal_connect (composer, "destroy",
- G_CALLBACK (msg_composer_destroy_notify),
- NULL);
+ gtk_signal_connect (GTK_OBJECT (composer), "key-press-event",
+ GTK_SIGNAL_FUNC (composer_key_pressed),
+ NULL);
+ gtk_signal_connect (GTK_OBJECT (composer), "destroy",
+ GTK_SIGNAL_FUNC (msg_composer_destroy_notify),
+ NULL);
gtk_window_set_default_size (GTK_WINDOW (composer),
DEFAULT_WIDTH, DEFAULT_HEIGHT);
gnome_window_icon_set_from_file (GTK_WINDOW (composer), EVOLUTION_DATADIR
"/images/evolution/compose-message.png");
+ bonobo_window_construct (BONOBO_WINDOW (composer), "e-msg-composer",
+ _("Compose a message"));
/* DND support */
gtk_drag_dest_set (GTK_WIDGET (composer), GTK_DEST_DEFAULT_ALL,
drop_types, num_drop_types, GDK_ACTION_COPY);
- g_signal_connect (composer, "drag_data_received",
- G_CALLBACK (drag_data_received), NULL);
+ gtk_signal_connect (GTK_OBJECT (composer), "drag_data_received",
+ GTK_SIGNAL_FUNC (drag_data_received), NULL);
e_msg_composer_load_config (composer);
setup_ui (composer);
@@ -2807,12 +2802,12 @@ create_composer (int visible_mask)
}
gtk_box_pack_start (GTK_BOX (vbox), composer->hdrs, FALSE, FALSE, 0);
- g_signal_connect (composer->hdrs, "subject_changed",
- G_CALLBACK (subject_changed_cb), composer);
- g_signal_connect (composer->hdrs, "hdrs_changed",
- G_CALLBACK (hdrs_changed_cb), composer);
- g_signal_connect (composer->hdrs, "from_changed",
- G_CALLBACK (from_changed_cb), composer);
+ gtk_signal_connect (GTK_OBJECT (composer->hdrs), "subject_changed",
+ GTK_SIGNAL_FUNC (subject_changed_cb), composer);
+ gtk_signal_connect (GTK_OBJECT (composer->hdrs), "hdrs_changed",
+ GTK_SIGNAL_FUNC (hdrs_changed_cb), composer);
+ gtk_signal_connect (GTK_OBJECT (composer->hdrs), "from_changed",
+ GTK_SIGNAL_FUNC (from_changed_cb), composer);
gtk_widget_show (composer->hdrs);
prepare_signatures_menu (composer);
@@ -2836,19 +2831,16 @@ create_composer (int visible_mask)
/* let the editor know which mode we are in */
bonobo_widget_set_property (BONOBO_WIDGET (composer->editor),
- "FormatHTML", TC_CORBA_boolean, composer->send_html,
+ "FormatHTML", composer->send_html,
NULL);
- editor_server = bonobo_widget_get_objref (BONOBO_WIDGET (composer->editor));
-
- /* FIXME: handle exceptions */
- CORBA_exception_init(&ev);
+ editor_server = BONOBO_OBJECT (bonobo_widget_get_server (BONOBO_WIDGET (composer->editor)));
+
composer->persist_file_interface
- = Bonobo_Unknown_queryInterface (editor_server, "IDL:Bonobo/PersistFile:1.0", &ev);
+ = bonobo_object_query_interface (editor_server, "IDL:Bonobo/PersistFile:1.0");
composer->persist_stream_interface
- = Bonobo_Unknown_queryInterface (editor_server, "IDL:Bonobo/PersistStream:1.0", &ev);
- CORBA_exception_free (&ev);
-
+ = bonobo_object_query_interface (editor_server, "IDL:Bonobo/PersistStream:1.0");
+
gtk_box_pack_start (GTK_BOX (vbox), composer->editor, TRUE, TRUE, 0);
/* Attachment editor, wrapped into an EScrollFrame. We don't
@@ -2868,8 +2860,8 @@ create_composer (int visible_mask)
composer->attachment_scroll_frame,
FALSE, FALSE, GNOME_PAD_SMALL);
- g_signal_connect (composer->attachment_bar, "changed",
- G_CALLBACK (attachment_bar_changed_cb), composer);
+ gtk_signal_connect (GTK_OBJECT (composer->attachment_bar), "changed",
+ GTK_SIGNAL_FUNC (attachment_bar_changed_cb), composer);
bonobo_window_set_contents (BONOBO_WINDOW (composer), vbox);
gtk_widget_show (vbox);
@@ -2892,7 +2884,7 @@ create_composer (int visible_mask)
return NULL;
}
- g_signal_connect (composer, "map", (GCallback)map_default_cb, NULL);
+ gtk_signal_connect (GTK_OBJECT (composer), "map", map_default_cb, NULL);
if (am == NULL) {
am = autosave_manager_new ();
@@ -2975,10 +2967,10 @@ is_special_header (const char *hdr_name)
1. it's not a X-* header or
2. it's an X-Evolution* header
*/
- if (g_ascii_strncasecmp (hdr_name, "X-", 2))
+ if (g_strncasecmp (hdr_name, "X-", 2))
return TRUE;
- if (!g_ascii_strncasecmp (hdr_name, "X-Evolution", 11))
+ if (!g_strncasecmp (hdr_name, "X-Evolution", 11))
return TRUE;
/* we can keep all other X-* headers */
@@ -2991,9 +2983,9 @@ e_msg_composer_set_pending_body (EMsgComposer *composer, char *text)
{
char *old;
- old = g_object_get_data (G_OBJECT(composer), "body:text");
+ old = gtk_object_get_data (GTK_OBJECT (composer), "body:text");
g_free (old);
- g_object_set_data (G_OBJECT(composer), "body:text", text);
+ gtk_object_set_data (GTK_OBJECT (composer), "body:text", text);
}
static void
@@ -3001,12 +2993,12 @@ e_msg_composer_flush_pending_body (EMsgComposer *composer, gboolean apply)
{
char *body;
- body = g_object_get_data (G_OBJECT(composer), "body:text");
+ body = gtk_object_get_data (GTK_OBJECT (composer), "body:text");
if (body) {
if (apply)
set_editor_text (composer, body);
- g_object_set_data (G_OBJECT(composer), "body:text", NULL);
+ gtk_object_set_data (GTK_OBJECT (composer), "body:text", NULL);
g_free (body);
}
}
@@ -3388,6 +3380,8 @@ e_msg_composer_new_with_message (CamelMimeMessage *message)
XEvolution *xev;
int len, i;
+ g_return_val_if_fail (gtk_main_level () > 0, NULL);
+
postto = camel_medium_get_header (CAMEL_MEDIUM (message), "X-Evolution-PostTo");
new = create_composer (postto ? E_MSG_COMPOSER_VISIBLE_MASK_POST : E_MSG_COMPOSER_VISIBLE_MASK_MAIL);
@@ -3526,7 +3520,7 @@ e_msg_composer_new_with_message (CamelMimeMessage *message)
while (*format && isspace ((unsigned) *format))
format++;
- if (!strcasecmp (format, "text/html"))
+ if (!g_strcasecmp (format, "text/html"))
e_msg_composer_set_send_html (new, TRUE);
else
e_msg_composer_set_send_html (new, FALSE);
@@ -3623,7 +3617,7 @@ e_msg_composer_new_redirect (CamelMimeMessage *message, const char *resent_from)
subject = camel_mime_message_get_subject (message);
composer->redirect = message;
- camel_object_ref (message);
+ camel_object_ref (CAMEL_OBJECT (message));
e_msg_composer_set_headers (composer, resent_from, NULL, NULL, NULL, subject);
@@ -3678,7 +3672,7 @@ e_msg_composer_new_from_url (const char *url_in)
char *content;
int len, clen;
- g_return_val_if_fail (strncasecmp (url_in, "mailto:", 7) == 0, NULL);
+ g_return_val_if_fail (g_strncasecmp (url_in, "mailto:", 7) == 0, NULL);
composer = e_msg_composer_new ();
if (!composer)
@@ -3713,22 +3707,20 @@ e_msg_composer_new_from_url (const char *url_in)
content = g_strndup (p, clen);
camel_url_decode (content);
- if (!strncasecmp (header, "to", len)) {
+ if (!g_strncasecmp (header, "to", len)) {
to = add_recipients (to, content, FALSE);
- } else if (!strncasecmp (header, "cc", len)) {
+ } else if (!g_strncasecmp (header, "cc", len)) {
cc = add_recipients (cc, content, FALSE);
- } else if (!strncasecmp (header, "bcc", len)) {
+ } else if (!g_strncasecmp (header, "bcc", len)) {
bcc = add_recipients (bcc, content, FALSE);
- } else if (!strncasecmp (header, "subject", len)) {
+ } else if (!g_strncasecmp (header, "subject", len)) {
g_free (subject);
subject = g_strdup (content);
- } else if (!strncasecmp (header, "body", len)) {
+ } else if (!g_strncasecmp (header, "body", len)) {
g_free (body);
body = g_strdup (content);
- } else if (!strncasecmp (header, "attach", len)) {
- e_msg_composer_attachment_bar_attach (E_MSG_COMPOSER_ATTACHMENT_BAR (composer->attachment_bar), content);
} else {
- /* add an arbitrary header? */
+ /* add an arbitrary header */
e_msg_composer_add_header (composer, header, content);
}
@@ -3865,9 +3857,9 @@ e_msg_composer_set_body (EMsgComposer *composer, const char *body,
{
g_return_if_fail (E_IS_MSG_COMPOSER (composer));
- set_editor_text (composer, _("<b>(The composer contains a non-text "
- "message body, which cannot be "
- "edited.)<b>"));
+ set_editor_text (composer, U_("<b>(The composer contains a non-text "
+ "message body, which cannot be "
+ "edited.)<b>"));
e_msg_composer_set_send_html (composer, FALSE);
disable_editor (composer);
@@ -3876,7 +3868,7 @@ e_msg_composer_set_body (EMsgComposer *composer, const char *body,
g_free (composer->mime_type);
composer->mime_type = g_strdup (mime_type);
- if (g_ascii_strncasecmp (composer->mime_type, "text/calendar", 13) == 0) {
+ if (g_strncasecmp (composer->mime_type, "text/calendar", 13) == 0) {
EMsgComposerHdrs *hdrs = E_MSG_COMPOSER_HDRS (composer->hdrs);
if (hdrs->account && hdrs->account->pgp_no_imip_sign)
e_msg_composer_set_pgp_sign (composer, FALSE);
@@ -3942,7 +3934,7 @@ CamelMimePart *
e_msg_composer_add_inline_image_from_file (EMsgComposer *composer,
const char *file_name)
{
- char *mime_type, *cid, *url, *name;
+ char *mime_type, *cid, *url;
CamelStream *stream;
CamelDataWrapper *wrapper;
CamelMimePart *part;
@@ -3966,13 +3958,11 @@ e_msg_composer_add_inline_image_from_file (EMsgComposer *composer,
part = camel_mime_part_new ();
camel_medium_set_content_object (CAMEL_MEDIUM (part), wrapper);
- camel_object_unref (wrapper);
+ camel_object_unref (CAMEL_OBJECT (wrapper));
cid = header_msgid_generate ();
camel_mime_part_set_content_id (part, cid);
- name = g_path_get_basename(file_name);
- camel_mime_part_set_filename (part, name);
- g_free(name);
+ camel_mime_part_set_filename (part, g_basename (file_name));
camel_mime_part_set_encoding (part, CAMEL_MIME_PART_ENCODING_BASE64);
url = g_strdup_printf ("file:%s", file_name);
@@ -3998,18 +3988,18 @@ void
e_msg_composer_add_inline_image_from_mime_part (EMsgComposer *composer,
CamelMimePart *part)
{
- char *url;
- const char *location, *cid;
-
- cid = camel_mime_part_get_content_id (part);
+ char *cid, *url;
+ const char *location;
+
+ cid = (char *)camel_mime_part_get_content_id (part);
if (!cid) {
camel_mime_part_set_content_id (part, NULL);
- cid = camel_mime_part_get_content_id (part);
+ cid = (char *)camel_mime_part_get_content_id (part);
}
url = g_strdup_printf ("cid:%s", cid);
g_hash_table_insert (composer->inline_images, url, part);
- camel_object_ref (part);
+ camel_object_ref (CAMEL_OBJECT (part));
location = camel_mime_part_get_content_location (part);
if (location) {
@@ -4183,9 +4173,8 @@ e_msg_composer_set_send_html (EMsgComposer *composer,
"state", composer->send_html ? "1" : "0", NULL);
/* let the editor know which mode we are in */
- bonobo_widget_set_property (BONOBO_WIDGET (composer->editor),
- "FormatHTML", TC_CORBA_boolean, composer->send_html,
- NULL);
+ bonobo_widget_set_property (BONOBO_WIDGET (composer->editor), "FormatHTML",
+ composer->send_html, NULL);
set_config (composer, "FormatHTML", composer->send_html);
GNOME_GtkHTML_Editor_Engine_runCommand (composer->editor_engine, "unblock-redraw", &ev);
diff --git a/composer/evolution-composer.c b/composer/evolution-composer.c
index be540b8d2e..d816a6d897 100644
--- a/composer/evolution-composer.c
+++ b/composer/evolution-composer.c
@@ -33,6 +33,7 @@
#include <camel/camel.h>
#include "evolution-composer.h"
#include "mail/mail-config.h"
+#include "mail/mail-session.h"
#include "e-util/e-html-utils.h"
#define PARENT_TYPE BONOBO_OBJECT_TYPE
@@ -172,7 +173,7 @@ impl_Composer_attach_MIME (PortableServer_Servant servant,
attachment = camel_mime_part_new ();
status = camel_data_wrapper_construct_from_stream (
CAMEL_DATA_WRAPPER (attachment), mem_stream);
- camel_object_unref (mem_stream);
+ camel_object_unref (CAMEL_OBJECT (mem_stream));
if (status == -1) {
CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
@@ -213,7 +214,7 @@ impl_Composer_attach_data (PortableServer_Servant servant,
"inline" : "attachment");
e_msg_composer_attach (composer->composer, attachment);
- camel_object_unref (attachment);
+ camel_object_unref (CAMEL_OBJECT (attachment));
}
static void
@@ -267,49 +268,38 @@ destroy (GtkObject *object)
{
EvolutionComposer *composer = EVOLUTION_COMPOSER (object);
- if (composer->composer) {
- g_object_unref((composer->composer));
- composer->composer = NULL;
- }
+ if (composer->composer)
+ gtk_object_unref (GTK_OBJECT (composer->composer));
GTK_OBJECT_CLASS (parent_class)->destroy (object);
}
static void
-evolution_composer_class_init (EvolutionComposerClass *klass)
+class_init (EvolutionComposerClass *klass)
{
GtkObjectClass *object_class;
- POA_GNOME_Evolution_Composer__epv *epv;
object_class = GTK_OBJECT_CLASS (klass);
object_class->destroy = destroy;
- parent_class = g_type_class_ref(bonobo_object_get_type ());
+ parent_class = gtk_type_class (bonobo_object_get_type ());
- epv = &klass->epv;
-
- epv->setHeaders = impl_Composer_set_headers;
- epv->setMultipartType = impl_Composer_set_multipart_type;
- epv->setBody = impl_Composer_set_body;
- epv->attachMIME = impl_Composer_attach_MIME;
- epv->attachData = impl_Composer_attach_data;
- epv->show = impl_Composer_show;
- epv->send = impl_Composer_send;
+ Composer_vepv.Bonobo_Unknown_epv = bonobo_object_get_epv ();
+ Composer_vepv.GNOME_Evolution_Composer_epv = evolution_composer_get_epv ();
}
static void
-evolution_composer_init (EvolutionComposer *composer)
+init (EvolutionComposer *composer)
{
const MailConfigAccount *account;
- BonoboObject *item_handler;
account = mail_config_get_default_account ();
composer->composer = e_msg_composer_new ();
- g_signal_connect (composer->composer, "send",
- G_CALLBACK (send_cb), NULL);
- g_signal_connect (composer->composer, "save-draft",
- G_CALLBACK (save_draft_cb), NULL);
+ gtk_signal_connect (GTK_OBJECT (composer->composer), "send",
+ GTK_SIGNAL_FUNC (send_cb), NULL);
+ gtk_signal_connect (GTK_OBJECT (composer->composer), "save-draft",
+ GTK_SIGNAL_FUNC (save_draft_cb), NULL);
}
#if 0
@@ -356,7 +346,7 @@ evolution_composer_construct (EvolutionComposer *composer,
g_return_if_fail (EVOLUTION_IS_COMPOSER (composer));
g_return_if_fail (corba_object != CORBA_OBJECT_NIL);
- /*bonobo_object_construct (BONOBO_OBJECT (composer), corba_object);*/
+ bonobo_object_construct (BONOBO_OBJECT (composer), corba_object);
item_handler = BONOBO_OBJECT (
bonobo_item_handler_new (NULL, get_object, composer));
@@ -367,11 +357,10 @@ EvolutionComposer *
evolution_composer_new (void)
{
EvolutionComposer *new;
-#if 0
POA_GNOME_Evolution_Composer *servant;
CORBA_Environment ev;
GNOME_Evolution_Composer corba_object;
-
+
servant = (POA_GNOME_Evolution_Composer *) g_new0 (BonoboObjectServant, 1);
servant->vepv = &Composer_vepv;
@@ -387,28 +376,30 @@ evolution_composer_new (void)
new = gtk_type_new (evolution_composer_get_type ());
corba_object = bonobo_object_activate_servant (BONOBO_OBJECT (new),
servant);
-#endif
- new = g_object_new(EVOLUTION_TYPE_COMPOSER, NULL);
- evolution_composer_construct (new, NULL);
+ evolution_composer_construct (new, corba_object);
return new;
}
-BONOBO_TYPE_FUNC_FULL(EvolutionComposer, GNOME_Evolution_Composer, BONOBO_TYPE_OBJECT, evolution_composer)
+E_MAKE_TYPE (evolution_composer, "EvolutionComposer", EvolutionComposer, class_init, init, PARENT_TYPE)
#define GNOME_EVOLUTION_MAIL_COMPOSER_FACTORY_ID "OAFIID:GNOME_Evolution_Mail_ComposerFactory"
static BonoboObject *
-factory_fn (BonoboGenericFactory *factory, const char *id, void *closure)
+factory_fn (BonoboGenericFactory *factory, void *closure)
{
if (!mail_config_is_configured ()) {
- e_notice (NULL, GTK_MESSAGE_ERROR,
+ e_notice (NULL, GNOME_MESSAGE_BOX_ERROR,
_("Could not create composer window, because you "
"have not yet\nconfigured any identities in the "
"mail component."));
return NULL;
}
+ if (! (session && mail_session_get_interactive ())) {
+ /* Don't return a composer if mailer isn't ready. */
+ return NULL;
+ }
return BONOBO_OBJECT (evolution_composer_new ());
}
@@ -418,7 +409,7 @@ evolution_composer_factory_init (void (*send) (EMsgComposer *, gpointer),
{
if (bonobo_generic_factory_new (GNOME_EVOLUTION_MAIL_COMPOSER_FACTORY_ID,
factory_fn, NULL) == NULL) {
- e_notice (NULL, GTK_MESSAGE_ERROR,
+ e_notice (NULL, GNOME_MESSAGE_BOX_ERROR,
_("Cannot initialize the Evolution composer."));
exit (1);
}
diff --git a/configure.in b/configure.in
index 20c6903831..365053ff1a 100644
--- a/configure.in
+++ b/configure.in
@@ -1,10 +1,5 @@
# Process this file with autoconf to produce a configure script.
-AC_PREREQ(2.52)
-
-AC_INIT(Evolution, 1.3.0.99, http://bugzilla.ximian.com/enter_bug.cgi?product=Evolution)
-AC_CONFIG_SRCDIR(README)
-AM_INIT_AUTOMAKE(AC_PACKAGE_NAME, AC_PACKAGE_VERSION)
-
+AC_INIT(camel)
AM_CONFIG_HEADER(config.h)
if test -f libversit/CVS/Repository; then
@@ -22,8 +17,40 @@ if test -f libversit/CVS/Repository; then
esac
fi
+EVOLUTION_MAJOR_VERSION=1
+EVOLUTION_MINOR_VERSION=2
+EVOLUTION_MICRO_VERSION=0
+EVOLUTION_NANO_VERSION=99
+VERSION=$EVOLUTION_MAJOR_VERSION.$EVOLUTION_MINOR_VERSION.$EVOLUTION_MICRO_VERSION.$EVOLUTION_NANO_VERSION
+PACKAGE=evolution
+
+AM_INIT_AUTOMAKE($PACKAGE, $VERSION)
+AC_SUBST(VERSION)
+
AC_CANONICAL_HOST
-AC_DEFINE_UNQUOTED(VERSION_COMMENT, "(Preview Release)")
+
+AC_DEFINE_UNQUOTED(VERSION_COMMENT, "")
+
+SCROLLKEEPER_REQUIRED=0.1.4
+AC_SUBST(SCROLLKEEPER_REQUIRED)
+
+dnl Check for scrollkeeper
+AC_PATH_PROG(SCROLLKEEPER_CONFIG, scrollkeeper-config,no)
+if test x$SCROLLKEEPER_CONFIG = xno; then
+ AC_MSG_ERROR(Couldn't find scrollkeeper-config -- please install the scrollkeeper package)
+fi
+SCROLLKEEPER_LOCALSTATE_DIR=`scrollkeeper-config --pkglocalstatedir`
+AC_SUBST(SCROLLKEEPER_LOCALSTATE_DIR)
+
+dnl Test whether jw is installed
+AC_PATH_PROG(JW,jw,no)
+if test x$JW = xno; then
+ HAVE_JW="no"
+else
+ HAVE_JW="yes"
+fi
+AM_CONDITIONAL(HAVE_JW, test "x$HAVE_JW" = "xyes")
+AC_SUBST(HAVE_JW)
dnl Initialize maintainer mode
AM_MAINTAINER_MODE
@@ -44,24 +71,17 @@ AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MAKE_SET
-dnl Test whether jw is installed
-AC_PATH_PROG(JW,jw,no)
-if test x$JW = xno; then
- HAVE_JW="no"
-else
- HAVE_JW="yes"
-fi
-AM_CONDITIONAL(HAVE_JW, test "x$HAVE_JW" = "xyes")
-AC_SUBST(HAVE_JW)
-
-dnl I18N stuff
-AC_PROG_INTLTOOL
-AM_GLIB_GNU_GETTEXT
+dnl Initialize xml-i18n-tools
+AM_PROG_XML_I18N_TOOLS
dnl Initialize libtool
AM_PROG_LIBTOOL
-dnl alloca()
+AM_ACLOCAL_INCLUDE(macros)
+GNOME_INIT()
+GNOME_COMPILE_WARNINGS
+GNOME_X_CHECKS
+EVO_CHECK_LIB(gnome-libs, gnome, 1.2.9)
AC_CHECK_HEADERS(alloca.h)
dnl check for socklen_t (in Unix98)
@@ -77,16 +97,8 @@ AC_DEFINE(socklen_t,size_t)], [
AC_MSG_RESULT(int)
AC_DEFINE(socklen_t,int)])])
-dnl
-dnl Gettext
-dnl
-
ALL_LINGUAS="az bg ca cs da de el en_AU en_GB es et eu fi fr ga gl hu it ja ko lt lv nl nn no pl pt pt_BR ro ru sk sl sv tr uk vi zh_CN zh_TW"
-
-GETTEXT_PACKAGE=evolution-1.4
-AC_SUBST(GETTEXT_PACKAGE)
-AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE")
-
+AM_GNOME_GETTEXT
localedir='$(prefix)/$(DATADIRNAME)/locale'
AC_SUBST(localedir)
@@ -459,33 +471,33 @@ else
fi
AM_CONDITIONAL(ENABLE_NNTP, test x$enable_nntp = xyes)
-
dnl **************************************************
dnl * Posix thread support
dnl **************************************************
-dnl GLIB_CONFIG=${GLIB_CONFIG-glib-config}
-dnl GNOME_PTHREAD_CHECK
+dnl Hah! Threads are no longer an option
+dnl AC_ARG_WITH(threads, [ --with-threads Include thread support],[
+dnl FIXME: support more thread types, pth at least
+
+GLIB_CONFIG=${GLIB_CONFIG-glib-config}
+GNOME_PTHREAD_CHECK
-dnl if test "x$PTHREAD_LIB" = "x" ; then
-dnl AC_MSG_ERROR([POSIX threads are currently required for Evolution])
-dnl fi
+if test "x$PTHREAD_LIB" = "x" ; then
+ AC_MSG_ERROR([POSIX threads are currently required for Evolution])
+fi
dnl
dnl Notice that this is a hack, and we wont be able to use this forever, but
dnl at least for some time
dnl
-EVO_PTHREAD_CHECK
-
-THREADS_LIBS="$PTHREAD_LIB"
-THREADS_CFLAGS="$PTHREAD_CFLAGS"
+THREADS_LIBS="$PTHREAD_LIB `$GLIB_CONFIG --libs gthread`"
+THREADS_CFLAGS="`$GLIB_CONFIG --cflags gthread`"
AC_SUBST(THREADS_LIBS)
AC_SUBST(THREADS_CFLAGS)
AC_DEFINE(ENABLE_THREADS)
-
dnl **************************************************
dnl * File locking
dnl **************************************************
@@ -513,7 +525,6 @@ else
fi
fi
-
dnl **************************************************
dnl * sendmail operation
dnl **************************************************
@@ -532,7 +543,6 @@ fi
AC_MSG_RESULT($with_broken_spool)
-
dnl ***************************************************************
dnl Whether to build shlib components (instead of out-of-proc ones)
dnl ***************************************************************
@@ -557,25 +567,29 @@ AC_SUBST(OAF_SHLIB_TYPE)
AC_SUBST(OAF_SHLIB_PREFIX)
AC_SUBST(OAF_SHLIB_SUFFIX)
-
-dnl *********
-dnl Libraries
-dnl *********
-
-dnl EVO_CHECK_LIB(GAL, gal, 0.21)
-PKG_CHECK_MODULES(GTKHTML, libgtkhtml-3.0)
+dnl ***************
+dnl GNOME Libraries
+dnl ***************
+EVO_CHECK_LIB(Bonobo, bonobox, 1.0.3)
+EVO_CHECK_LIB(OAF, oaf, 0.6.10)
+EVO_CHECK_LIB(libglade, libglade, 0.14)
+EVO_CHECK_LIB(gdk-pixbuf with GNOME canvas support, gnomecanvaspixbuf, 0.18.0)
+EVO_CHECK_LIB(GNOME-VFS, vfs, 1.0.5)
+EVO_CHECK_LIB(libxml, xml, 1.8.17, 2.0)
+EVO_CHECK_LIB(bonobo-conf, bonobo_conf, 0.11)
+
+EVO_CHECK_LIB(GAL, gal, 0.21)
+PKG_CHECK_MODULES(GTKHTML, gtkhtml-1.1 >= 1.1.4)
AC_SUBST(GTKHTML_CFLAGS)
AC_SUBST(GTKHTML_LIBS)
-GTKHTML_DATADIR=`$PKG_CONFIG --variable gtkhtml_datadir libgtkhtml-3.0`
+GTKHTML_DATADIR=`$PKG_CONFIG --variable gtkhtml_datadir gtkhtml-1.1`
AC_SUBST(GTKHTML_DATADIR)
+EVO_CHECK_LIB(Libsoup, soup, 0.7)
-dnl PKG_CHECK_MODULES(SOUP, soup-2.0)
-dnl (from the libsoup module in GNOME CVS)
-
-dnl AM_PATH_GCONF(1.0,,,gconf gconf-gtk)
-dnl if test "x$GCONF_CFLAGS" = "x" ; then
-dnl AC_MSG_ERROR(Evolution requires GConf to be installed)
-dnl fi
+AM_PATH_GCONF(1.0,,,gconf gconf-gtk)
+if test "x$GCONF_CFLAGS" = "x" ; then
+ AC_MSG_ERROR(Evolution requires GConf to be installed)
+fi
dnl ******************************
dnl Pilot checking
@@ -933,11 +947,29 @@ AC_MSG_RESULT([$DTAPPINTEGRATE])
AC_SUBST(DTAPPINTEGRATE)
AM_CONDITIONAL(HAVE_DTAPPINTEGRATE, test "x$DTAPPINTEGRATE" != "xno")
+dnl *****************
+dnl killall or pkill?
+dnl *****************
+
+AC_MSG_CHECKING(for command to kill processes)
+
+if test `uname -s` = "SunOS" ; then
+ KILL_PROCESS_CMD="pkill";
+else
+ KILL_PROCESS_CMD="killall";
+fi
+
+KILL_PROCESS_CMD=`which $KILL_PROCESS_CMD`
+if test -z "$KILL_PROCESS_CMD" ; then
+ AC_MSG_RESULT(none)
+else
+ AC_MSG_RESULT($KILL_PROCESS_CMD)
+ AC_DEFINE_UNQUOTED(KILL_PROCESS_CMD, "$KILL_PROCESS_CMD")
+fi
+
dnl ****************************************************
dnl GNOME_PREFIX is is needed by shell/evolution-nognome
dnl ****************************************************
-dnl
-dnl FIXME this doesn't work with GNOME 2.
GNOME_PREFIX="`gnome-config --prefix`"
AC_SUBST(GNOME_PREFIX)
@@ -1015,107 +1047,95 @@ dnl *************************
dnl CFLAGS and LIBS and stuff
dnl *************************
-AM_PATH_ORBIT2
-
-AC_MSG_CHECKING(for CORBA include paths)
-IDL_INCLUDES="-I "`pkg-config --variable=idldir libbonobo-2.0`" -I "`pkg-config --variable=idldir bonobo-activation-2.0`
-AC_MSG_RESULT($IDL_INCLUDES)
-AC_SUBST(IDL_INCLUDES)
-
-AM_PATH_GLIB_2_0
-
-COMPONENT_DIR=$prefix/lib/evolution/components
-AC_SUBST(COMPONENT_DIR)
-
dnl Utility macro to set compiler flags for a specific lib.
AC_DEFUN(EVO_SET_COMPILE_FLAGS, [
deps="$2"
extra_cflags="$3"
extra_libs="$4"
- PKG_CHECK_MODULES(foo, $deps)
- $1_CFLAGS="$foo_CFLAGS \$(WERROR) $extra_cflags"
- $1_LIBS="$foo_LIBS $extra_libs"
+ $1_CFLAGS="\$(WERROR) `gnome-config --cflags $deps` $extra_cflags"
+ $1_LIBS="`gnome-config --libs $deps` $extra_libs"
])
dnl --- Flags to get all the GNOME stuff
-dnl --- We require at least this version of GAL.
-GAL_VERSION=0.0.9.99
+FULL_GNOME_DEPS="bonobo_conf bonobox_print gal gdk_pixbuf gnomecanvaspixbuf gnomeui libglade oaf vfs"
-FULL_GNOME_DEPS="libbonoboui-2.0 gnome-vfs-2.0 libgnomeui-2.0 libglade-2.0 libgnomecanvas-2.0 libxml-2.0 gconf-2.0 gal-2.0 >= $GAL_VERSION"
-
-EVO_SET_COMPILE_FLAGS(GNOME_FULL, $FULL_GNOME_DEPS)
+EVO_SET_COMPILE_FLAGS(GNOME_FULL, $FULL_GNOME_DEPS, ${GTKHTML_CFLAGS}, ${GTKHTML_LIBS})
AC_SUBST(GNOME_FULL_CFLAGS)
AC_SUBST(GNOME_FULL_LIBS)
dnl --- Flags for the various libraries we build
-EVO_SET_COMPILE_FLAGS(CAMEL, glib-2.0 gal-2.0 >= $GAL_VERSION,
+EVO_SET_COMPILE_FLAGS(CAMEL, gal xml,
$THREADS_CFLAGS $KRB4_CFLAGS $NSS_CFLAGS $NSPR_CFLAGS $OPENSSL_CFLAGS,
$THREADS_LIBS $KRB4_LDFLAGS $NSS_LDFLAGS $NSPR_LDFLAGS $OPENSSL_LDFLAGS)
AC_SUBST(CAMEL_CFLAGS)
AC_SUBST(CAMEL_LIBS)
-EVO_SET_COMPILE_FLAGS(E_NAME, libgnomeui-2.0 libbonoboui-2.0 gal-2.0 >= $GAL_VERSION)
+EVO_SET_COMPILE_FLAGS(E_NAME, bonobox gal oaf)
AC_SUBST(E_NAME_CFLAGS)
AC_SUBST(E_NAME_LIBS)
-EVO_SET_COMPILE_FLAGS(E_UTIL, gconf-2.0 libxml-2.0 libbonoboui-2.0 libglade-2.0 gal-2.0 >= $GAL_VERSION libgnomeui-2.0 libgnome-2.0 libgnomecanvas-2.0 soup-2.0, $THREADS_CFLAGS $NSPR_CFLAGS, $THREADS_LIBS $NSPR_LDFLAGS)
+EVO_SET_COMPILE_FLAGS(E_UTIL, bonobox gal oaf libglade bonobo_conf soup,
+ $GCONF_CFLAGS $THREADS_CFLAGS $NSPR_CFLAGS,
+ $GCONF_LIBS $THREADS_LIBS $NSPR_LDFLAGS)
AC_SUBST(E_UTIL_CFLAGS)
AC_SUBST(E_UTIL_LIBS)
-dnl
-dnl EVO_SET_COMPILE_FLAGS(E_WIDGETS, bonobo_conf bonobox_print gdk_pixbuf gnomecanvaspixbuf gnomeui libglade oaf vfs)
-dnl AC_SUBST(E_WIDGETS_CFLAGS)
-dnl AC_SUBST(E_WIDGETS_LIBS)
-dnl
-EVO_SET_COMPILE_FLAGS(IMPORTERS, gconf-2.0 libglade-2.0 libbonoboui-2.0 libgnomeui-2.0)
+EVO_SET_COMPILE_FLAGS(E_WIDGETS, bonobo_conf bonobox_print gdk_pixbuf gnomecanvaspixbuf gnomeui libglade oaf vfs)
+AC_SUBST(E_WIDGETS_CFLAGS)
+AC_SUBST(E_WIDGETS_LIBS)
+
+EVO_SET_COMPILE_FLAGS(IMPORTERS, bonobo_conf bonobox_print gdk_pixbuf gnomecanvaspixbuf gnomeui libglade oaf vfs)
AC_SUBST(IMPORTERS_CFLAGS)
AC_SUBST(IMPORTERS_LIBS)
-dnl
+
dnl libibex is now deprecated
dnl EVO_SET_COMPILE_FLAGS(LIBIBEX, bonobo_conf bonobox_print gal gdk_pixbuf gnomecanvaspixbuf gnomeui libglade oaf vfs,
dnl $THREADS_CFLAGS, $THREADS_LIBS)
dnl AC_SUBST(LIBIBEX_CFLAGS)
dnl AC_SUBST(LIBIBEX_LIBS)
-EVO_SET_COMPILE_FLAGS(LIBFILTER, libgnome-2.0 libgnomeui-2.0 libglade-2.0 libxml-2.0 gconf-2.0 gal-2.0 >= $GAL_VERSION)
+EVO_SET_COMPILE_FLAGS(LIBFILTER, bonobo gal gdk_pixbuf gnomecanvaspixbuf gnomeui libglade)
AC_SUBST(LIBFILTER_CFLAGS)
AC_SUBST(LIBFILTER_LIBS)
dnl --- evolution (shell) flags
-EVO_SET_COMPILE_FLAGS(SHELL, libgnome-2.0 libgnomeui-2.0 libbonoboui-2.0 gal-2.0 >= $GAL_VERSION libglade-2.0 gnome-vfs-2.0 libgtkhtml-3.0)
+EVO_SET_COMPILE_FLAGS(SHELL, bonobo_conf bonobox_print gal gdk_pixbuf gnomecanvaspixbuf gnomeui libglade oaf vfs, ${GTKHTML_CFLAGS}, ${GTKHTML_LIBS})
AC_SUBST(SHELL_CFLAGS)
AC_SUBST(SHELL_LIBS)
dnl --- evolution-addressbook flags
-EVOLUTION_ADDRESSBOOK_DEPS="gconf-2.0 libbonoboui-2.0 libglade-2.0 gal-2.0 >= $GAL_VERSION libgnomeui-2.0 libgnome-2.0 libgnomecanvas-2.0 gnome-vfs-2.0 libgnomeprintui-2.0"
+EVOLUTION_ADDRESSBOOK_DEPS="bonobo_conf bonobox_print gal gdk_pixbuf gnomecanvaspixbuf gnomeui libglade oaf vfs"
-EVO_SET_COMPILE_FLAGS(EVOLUTION_ADDRESSBOOK, $EVOLUTION_ADDRESSBOOK_DEPS)
+EVO_SET_COMPILE_FLAGS(EVOLUTION_ADDRESSBOOK, $EVOLUTION_ADDRESSBOOK_DEPS, ${GTKHTML_CFLAGS}, ${GTKHTML_LIBS})
AC_SUBST(EVOLUTION_ADDRESSBOOK_CFLAGS)
AC_SUBST(EVOLUTION_ADDRESSBOOK_LIBS)
-dnl EVO_SET_COMPILE_FLAGS(EVOLUTION_ADDRESSBOOK_CONDUIT, gpilot $EVOLUTION_ADDRESSBOOK_DEPS, $PISOCK_CFLAGS)
-dnl AC_SUBST(EVOLUTION_ADDRESSBOOK_CONDUIT_CFLAGS)
-dnl AC_SUBST(EVOLUTION_ADDRESSBOOK_CONDUIT_LIBS)
+EVO_SET_COMPILE_FLAGS(EVOLUTION_ADDRESSBOOK_CONDUIT, gpilot $EVOLUTION_ADDRESSBOOK_DEPS, $PISOCK_CFLAGS)
+AC_SUBST(EVOLUTION_ADDRESSBOOK_CONDUIT_CFLAGS)
+AC_SUBST(EVOLUTION_ADDRESSBOOK_CONDUIT_LIBS)
dnl -- evolution-executive-summary flags
-EVO_SET_COMPILE_FLAGS(EVOLUTION_EXECUTIVE_SUMMARY, libbonoboui-2.0 libbonoboui-2.0 gal-2.0 >= $GAL_VERSION libgnomeui-2.0 libglade-2.0 libgnomeprint-2.0 libgnomeprintui-2.0 soup-2.0 libgtkhtml-3.0)
+EVO_SET_COMPILE_FLAGS(EVOLUTION_EXECUTIVE_SUMMARY,
+ bonobo_conf bonobox bonobox_print gal gdk_pixbuf gnomecanvaspixbuf gnomeui libglade oaf soup vfs, ${GTKHTML_CFLAGS}, ${GTKHTML_LIBS})
AC_SUBST(EVOLUTION_EXECUTIVE_SUMMARY_CFLAGS)
AC_SUBST(EVOLUTION_EXECUTIVE_SUMMARY_LIBS)
dnl --- evolution-calendar flags
-EVO_SET_COMPILE_FLAGS(EVOLUTION_CALENDAR, libgnome-2.0 libgnomeui-2.0 libbonoboui-2.0 gal-2.0 >= $GAL_VERSION libglade-2.0 gnome-vfs-2.0 libgnomeprint-2.0 libgnomeprintui-2.0 libgtkhtml-3.0, ${GTKHTML_CFLAGS}, ${GTKHTML_LIBS})
+EVOLUTION_CALENDAR_DEPS="bonobo_conf bonobox bonobox_print gal gdk_pixbuf gnomecanvaspixbuf gnomeui libglade oaf vfs"
+
+EVO_SET_COMPILE_FLAGS(EVOLUTION_CALENDAR, $EVOLUTION_CALENDAR_DEPS, ${GTKHTML_CFLAGS}, ${GTKHTML_LIBS})
AC_SUBST(EVOLUTION_CALENDAR_CFLAGS)
AC_SUBST(EVOLUTION_CALENDAR_LIBS)
-dnl EVO_SET_COMPILE_FLAGS(EVOLUTION_CALENDAR_CONDUIT, gpilot $EVOLUTION_CALENDAR_DEPS, $PISOCK_CFLAGS)
-dnl AC_SUBST(EVOLUTION_CALENDAR_CONDUIT_CFLAGS)
-dnl AC_SUBST(EVOLUTION_CALENDAR_CONDUIT_LIBS)
+EVO_SET_COMPILE_FLAGS(EVOLUTION_CALENDAR_CONDUIT, gpilot $EVOLUTION_CALENDAR_DEPS, $PISOCK_CFLAGS)
+AC_SUBST(EVOLUTION_CALENDAR_CONDUIT_CFLAGS)
+AC_SUBST(EVOLUTION_CALENDAR_CONDUIT_LIBS)
dnl --- evolution-mail flags
@@ -1129,13 +1149,13 @@ AC_SUBST(privlibdir)
camel_providerdir="$privlibdir/camel-providers"
AC_SUBST(camel_providerdir)
-EVO_SET_COMPILE_FLAGS(EVOLUTION_MAIL, libgnome-2.0 libgnomeui-2.0 libbonoboui-2.0 gal-2.0 >= $GAL_VERSION libglade-2.0 soup-2.0 libgnomeprint-2.0 libgtkhtml-3.0 libxml-2.0 bonobo-activation-2.0 gthread-2.0 gconf-2.0)
+EVO_SET_COMPILE_FLAGS(EVOLUTION_MAIL, $FULL_GNOME_DEPS soup, $GCONF_CFLAGS $THREADS_CFLAGS ${GTKHTML_CFLAGS}, $GCONF_LIBS $THREADS_LIBS ${GTKHTML_LIBS})
AC_SUBST(EVOLUTION_MAIL_CFLAGS)
AC_SUBST(EVOLUTION_MAIL_LIBS)
dnl -- wombat flags
-EVO_SET_COMPILE_FLAGS(WOMBAT, libgnome-2.0, $LDAP_CFLAGS, $LDAP_LIBS)
+EVO_SET_COMPILE_FLAGS(WOMBAT, $FULL_GNOME_DEPS, $LDAP_CFLAGS, $LDAP_LIBS)
AC_SUBST(WOMBAT_CFLAGS)
AC_SUBST(WOMBAT_LIBS)
@@ -1183,12 +1203,6 @@ fi
AM_CONDITIONAL(ENABLE_GTK_DOC, test x$enable_gtk_doc = xyes)
-dnl ***********
-dnl GConf stuff
-dnl ***********
-AC_PATH_PROG(GCONFTOOL, gconftool-2, no)
-AM_GCONF_SOURCE_2
-
dnl ******************
dnl Sub-version number
dnl ******************
@@ -1245,9 +1259,14 @@ AC_CONFIG_SUBDIRS(libical)
EVOLUTION_DIR=`(cd $srcdir; pwd)`
AC_SUBST(EVOLUTION_DIR)
-AC_OUTPUT([ po/Makefile.in
+AC_OUTPUT([
Makefile
addressbook/Makefile
+addressbook/backend/Makefile
+addressbook/backend/ebook/Makefile
+addressbook/backend/idl/Makefile
+addressbook/backend/pas/Makefile
+addressbook/conduit/Makefile
addressbook/gui/Makefile
addressbook/gui/component/Makefile
addressbook/gui/component/select-names/Makefile
@@ -1256,12 +1275,20 @@ addressbook/gui/contact-list-editor/Makefile
addressbook/gui/merging/Makefile
addressbook/gui/search/Makefile
addressbook/gui/widgets/Makefile
-addressbook/backend/Makefile
-addressbook/backend/ebook/Makefile
-addressbook/backend/pas/Makefile
-addressbook/backend/idl/Makefile
addressbook/printing/Makefile
art/Makefile
+calendar/Makefile
+calendar/cal-client/Makefile
+calendar/cal-util/Makefile
+calendar/conduits/Makefile
+calendar/conduits/calendar/Makefile
+calendar/conduits/todo/Makefile
+calendar/gui/Makefile
+calendar/gui/alarm-notify/Makefile
+calendar/gui/dialogs/Makefile
+calendar/idl/Makefile
+calendar/importers/Makefile
+calendar/pcs/Makefile
camel/Makefile
camel/providers/Makefile
camel/providers/imap/Makefile
@@ -1278,6 +1305,7 @@ camel/tests/mime-filter/Makefile
camel/tests/misc/Makefile
camel/tests/smime/Makefile
camel/tests/stream/Makefile
+composer/Makefile
data/Makefile
data/cde_app_root/Makefile
data/cde_app_root/dt/Makefile
@@ -1300,15 +1328,33 @@ default_user/local/Outbox/Makefile
default_user/local/Sent/Makefile
default_user/local/Tasks/Makefile
default_user/local/Trash/Makefile
+doc/Makefile
+doc/devel/Makefile
+doc/devel/calendar/Makefile
+doc/devel/calendar/cal-client/Makefile
+doc/devel/calendar/cal-util/Makefile
e-util/Makefile
e-util/ename/Makefile
filter/Makefile
+help/Makefile
+help/C/Makefile
+help/no/Makefile
+importers/Makefile
+intl/Makefile
libversit/Makefile
+libwombat/Makefile
+macros/Makefile
+mail/Makefile
+mail/importers/Makefile
+my-evolution/Makefile
+omf-install/Makefile
+po/Makefile.in
shell/Makefile
shell/evolution-nognome
shell/glade/Makefile
shell/importer/Makefile
-my-evolution/Makefile
+sounds/Makefile
+tools/Makefile
ui/Makefile
views/Makefile
views/addressbook/Makefile
@@ -1320,19 +1366,8 @@ widgets/e-timezone-dialog/Makefile
widgets/menus/Makefile
widgets/misc/Makefile
wombat/Makefile
-libwombat/Makefile
-calendar/Makefile
-calendar/idl/Makefile
-calendar/cal-util/Makefile
-calendar/cal-client/Makefile
-calendar/pcs/Makefile
-calendar/gui/Makefile
-calendar/gui/alarm-notify/Makefile
-calendar/gui/dialogs/Makefile
-calendar/importers/Makefile
-composer/Makefile
-mail/Makefile
-mail/importers/Makefile
+
+my-evolution/GNOME_Evolution_Summary.oaf.in
])
if test "x$with_sub_version" != "x"; then
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 97f643ad23..bf54b11d21 100644
--- a/e-util/ChangeLog
+++ b/e-util/ChangeLog
@@ -1,4 +1,4 @@
-2002-11-26 Dan Winship <danw@ximian.com>
+2002-11-25 Dan Winship <danw@ximian.com>
* e-lang-utils.c (e_get_language_list): If the language is
something like "fr_FR", return both "fr_FR" and "fr" in the list.
@@ -16,142 +16,6 @@
(e_msgport_get): skim off a notify byte on the pr pipe if set.
(): Include config.h, and nspr stuff if HAVE_NSS is set.
-2002-11-13 Ettore Perazzoli <ettore@ximian.com>
-
- * e-config-listener.c (e_config_listener_get_string_with_default):
- Make sure we don't use a string value from a GConfValue that got
- freed.
-
-2002-11-12 Chris Toshok <toshok@ximian.com>
-
- * Makefile.am
- (eutilinclude_HEADERS): add e-password.h
- (libeutil_la_SOURCES): add e-password.c
-
- * e-passwords.[ch]: port this to gnome2's gnome-config-private.
-
-2002-11-11 Ettore Perazzoli <ettore@ximian.com>
-
- * e-config-listener.c (add_key): g_strdup() the value in the case
- of a string value.
-
-2002-11-11 Jeffrey Stedfast <fejj@ximian.com>
-
- * Makefile.am: Re-add e-proxy.c to the build.
-
-2002-11-08 Chris Toshok <toshok@ximian.com>
-
- * Makefile.am (eutilinclude_HEADERS): add e-categories-config.h
- and e-categories-master-list-wombat.h
- (libeutil_la_SOURCES): add e-categories-master-list-wombat.c
-
- * e-categories-master-list-wombat.[ch]: port work.
-
-2002-11-07 JP Rosevear <jpr@ximian.com>
-
- * e-categories-config.c (e_categories_config_get_icon_for): pass
- extra pixbuf param
-
- * e-categories-config.h: use G_*_DECLS
-
- * e-dialog-utils.c (save_ok): update g_file_test params
-
- * Makefile.am: Compile some additional files
-
-2002-11-06 Chris Toshok <toshok@ximian.com>
-
- * e-config-listener.c (e_config_listener_set_boolean): init err to
- NULL so if there isn't an error we aren't left with an unitialized
- GError. Fixes crash.
- (e_config_listener_set_float): same.
- (e_config_listener_set_long): same.
- (e_config_listener_set_string): same.
-
-2002-11-05 Rodrigo Moya <rodrigo@ximian.com>
-
- * e-component-listener.[ch]: ported to GObject.
-
- * Makefile.am: re-enabled e-component-listener.[ch]
-
-2002-11-03 Rodrigo Moya <rodrigo@ximian.com>
-
- * e-config-listener.[ch] (e_config_listener_get_boolean,
- e_config_listener_get_float, e_config_listener_get_long,
- e_config_listener_get_string): new simpler functions, without
- a default value.
-
-2002-11-03 Ettore Perazzoli <ettore@ximian.com>
-
- * e-config-listener.c (e_config_listener_get_float_with_default):
- Removed unused variable.
- (e_config_listener_get_long_with_default): Likewise.
- (e_config_listener_get_string_with_default): Likewise.
-
- * Makefile.am: Compile e-config-listener.[ch].
-
-2002-11-02 Chris Toshok <toshok@ximian.com>
-
- * Makefile.am: add marshal building stuff, add e-util-marshal.c to
- SOURCES, and add e-util-marshal.list to EXTRA_DIST.
-
- * e-util-marshal.list: add marshallers for e-util.
-
- * e-list.c: convert to GObject.
-
- * e-list.h: convert to GObject.
-
- * e-iterator.c: convert to GObject.
-
- * e-iterator.h: convert to GObject.
-
- * e-list-iterator.c: convert to GObject.
-
- * e-list-iterator.h: convert to GObject.
-
- * .cvsignore: ignore e-util-marshal.[ch]
-
-2002-11-02 Ettore Perazzoli <ettore@ximian.com>
-
- * ename/Makefile.am (INCLUDES): Removed -I$(includedir).
-
- * ename/test-ename-western-gtk.c: #include
- <libgnomeui/gnome-ui-init.h> instead of <libgnomeui/gnome-init.h>.
- (create_window): Added GTK_SIGNAL_FUNC() cast.
- (main): Use gnome_program_init().
-
- * e-db3-utils.c: Do not #include <libgnome/gnome-defs.h>.
-
- * e-request.c: Do not #include <libgnomeui/gnome-stock.h>.
-
- * e-memory.c (e_memchunk_clean): Replace GSearchFunc with
- GCompareFunc.
-
- * e-iterator.c (e_iterator_class_init): GTK2-ified.
- (ECI_CLASS): Likewise.
-
- * e-html-utils.c: Do not #include <gal/unicode/gunicode.h>.
-
- * e-gui-utils.c: Don't #include <libgnome/gnome-defs.h>.
- (e_create_image_widget): Pass NULL to gdk_pixbuf_new_from_file()
- for the error arg.
-
- * e-corba-utils.h: #include <orbit/orbit.h> instead of
- <orb/orbit.h>.
-
- * Makefile.am: Removed bonobo-factory-util.c,
- bonobo-factory-util.h, e-categories-master-list-wombat.h,
- e-categories-master-list-wombat.c, e-dialog-utils.c,
- e-dialog-utils.h, e-proxy.c e-proxy.h for now.
-
-2002-11-02 Rodrigo Moya <rodrigo@ximian.com>
-
- * e-config-listener.[ch]: ported to GConf and GObject.
-
-2002-11-01 Rodrigo Moya <rodrigo@ximian.com>
-
- * e-config-listener.[ch]:
- * e-component-listener.[ch]: compilation fixes for GNOME 2 porting.
-
2002-10-24 Rodrigo Moya <rodrigo@ximian.com>
Fixes #32764
diff --git a/e-util/e-bit-array.c b/e-util/e-bit-array.c
deleted file mode 100644
index 2a79e1bab2..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) {
- e_bit_array_select_single_row (eba, row > 0 ? row - 1 : 0);
- }
- }
-}
-
-/* FIXME : Improve efficiency here. */
-void
-e_bit_array_delete(EBitArray *eba, int row, int count)
-{
- int i;
- for (i = 0; i < count; i++)
- e_bit_array_delete_real(eba, row, FALSE);
-}
-
-/* FIXME : Improve efficiency here. */
-void
-e_bit_array_delete_single_mode(EBitArray *eba, int row, int count)
-{
- int i;
- for (i = 0; i < count; i++)
- e_bit_array_delete_real(eba, row, TRUE);
-}
-
-/* FIXME : Improve efficiency here. */
-void
-e_bit_array_insert(EBitArray *eba, int row, int count)
-{
- int i;
- for (i = 0; i < count; i++)
- e_bit_array_insert_real(eba, row);
-}
-
-/* FIXME: Implement this more efficiently. */
-void
-e_bit_array_move_row(EBitArray *eba, int old_row, int new_row)
-{
- e_bit_array_delete_real(eba, old_row, FALSE);
- e_bit_array_insert_real(eba, new_row);
-}
-
-static void
-eba_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-i18n.h b/e-util/e-i18n.h
deleted file mode 100644
index 2bc8b93a04..0000000000
--- a/e-util/e-i18n.h
+++ /dev/null
@@ -1,75 +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
-# define _(String) dgettext (GNOME_EXPLICIT_TRANSLATION_DOMAIN, String)
-/* No parentheses allowed here since that breaks string concatenation. */
-# define E_I18N_DOMAIN GNOME_EXPLICIT_TRANSLATION_DOMAIN
-# else
-# define _(String) dgettext (PACKAGE, String)
-/* No parentheses allowed here since that breaks string concatenation. */
-# define E_I18N_DOMAIN PACKAGE
-# endif
-# 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 0997878e81..0000000000
--- a/e-util/e-iconv.c
+++ /dev/null
@@ -1,496 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-iconv.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Michael Zucchi <notzed@ximian.com>
- * Jeffery Stedfast <fejj@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <string.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-#include <glib.h>
-#include "e-iconv.h"
-
-#include <locale.h>
-
-#ifdef HAVE_ALLOCA_H
-#include <alloca.h>
-#endif
-
-#ifdef HAVE_CODESET
-#include <langinfo.h>
-#endif
-
-#include "iconv-detect.h"
-
-#define cd(x)
-
-#ifdef G_THREADS_ENABLED
-static GStaticMutex lock = G_STATIC_MUTEX_INIT;
-#define LOCK() g_static_mutex_lock(&lock)
-#define UNLOCK() g_static_mutex_unlock(&lock)
-#else
-#define LOCK()
-#define UNLOCK()
-#endif
-
-typedef struct _EDListNode {
- struct _EDListNode *next;
- struct _EDListNode *prev;
-} EDListNode;
-
-typedef struct _EDList {
- struct _EDListNode *head;
- struct _EDListNode *tail;
- struct _EDListNode *tailpred;
-} EDList;
-
-#define E_DLIST_INITIALISER(l) { (EDListNode *)&l.tail, 0, (EDListNode *)&l.head }
-
-struct _iconv_cache_node {
- struct _iconv_cache_node *next;
- struct _iconv_cache_node *prev;
-
- struct _iconv_cache *parent;
-
- int busy;
- iconv_t ip;
-};
-
-struct _iconv_cache {
- struct _iconv_cache *next;
- struct _iconv_cache *prev;
-
- char *conv;
-
- EDList open; /* stores iconv_cache_nodes, busy ones up front */
-};
-
-#define E_ICONV_CACHE_SIZE (16)
-
-static EDList iconv_cache_list;
-static GHashTable *iconv_cache;
-static GHashTable *iconv_cache_open;
-static unsigned int iconv_cache_size = 0;
-
-static GHashTable *iconv_charsets = NULL;
-static char *locale_charset = NULL;
-
-struct {
- char *charset;
- char *iconv_name;
-} known_iconv_charsets[] = {
-#if 0
- /* charset name, iconv-friendly charset name */
- { "iso-8859-1", "iso-8859-1" },
- { "iso8859-1", "iso-8859-1" },
- /* the above mostly serves as an example for iso-style charsets,
- but we have code that will populate the iso-*'s if/when they
- show up in e_iconv_charset_name() so I'm
- not going to bother putting them all in here... */
- { "windows-cp1251", "cp1251" },
- { "windows-1251", "cp1251" },
- { "cp1251", "cp1251" },
- /* the above mostly serves as an example for windows-style
- charsets, but we have code that will parse and convert them
- to their cp#### equivalents if/when they show up in
- e_iconv_charset_name() so I'm not going to bother
- putting them all in here either... */
-#endif
- /* charset name (lowercase!), iconv-friendly name (sometimes case sensitive) */
- { "utf-8", "UTF-8" },
-
- /* 10646 is a special case, its usually UCS-2 big endian */
- /* This might need some checking but should be ok for solaris/linux */
- { "iso-10646-1", "UCS-2BE" },
- { "iso_10646-1", "UCS-2BE" },
- { "iso10646-1", "UCS-2BE" },
- { "iso-10646", "UCS-2BE" },
- { "iso_10646", "UCS-2BE" },
- { "iso10646", "UCS-2BE" },
-
- { "ks_c_5601-1987", "EUC-KR" },
-
- /* FIXME: Japanese/Korean/Chinese stuff needs checking */
- { "euckr-0", "EUC-KR" },
- { "big5-0", "BIG5" },
- { "big5.eten-0", "BIG5" },
- { "big5hkscs-0", "BIG5HKCS" },
- { "gb2312-0", "gb2312" },
- { "gb2312.1980-0", "gb2312" },
- { "gb18030-0", "gb18030" },
- { "gbk-0", "GBK" },
-
- { "eucjp-0", "eucJP" },
- { "ujis-0", "ujis" },
- { "jisx0208.1983-0","SJIS" },
- { "jisx0212.1990-0","SJIS" },
- { NULL, NULL }
-};
-
-
-
-/* Another copy of this trivial list implementation
- Why? This stuff gets called a lot (potentially), should run fast,
- and g_list's are f@@#$ed up to make this a hassle */
-static void e_dlist_init(EDList *v)
-{
- v->head = (EDListNode *)&v->tail;
- v->tail = 0;
- v->tailpred = (EDListNode *)&v->head;
-}
-
-static EDListNode *e_dlist_addhead(EDList *l, EDListNode *n)
-{
- n->next = l->head;
- n->prev = (EDListNode *)&l->head;
- l->head->prev = n;
- l->head = n;
- return n;
-}
-
-static EDListNode *e_dlist_addtail(EDList *l, EDListNode *n)
-{
- n->next = (EDListNode *)&l->tail;
- n->prev = l->tailpred;
- l->tailpred->next = n;
- l->tailpred = n;
- return n;
-}
-
-static EDListNode *e_dlist_remove(EDListNode *n)
-{
- n->next->prev = n->prev;
- n->prev->next = n->next;
- return n;
-}
-
-/*
- we don't want to lower charset names in native locale (look what does in such case ISO-8859-9),
- but rather lower them in "pure" C locale
- this fixes bug #24179
-*/
-static void
-C_g_strdown (gchar *string)
-{
- gchar *old_locale;
-
- old_locale = g_strdup (setlocale (LC_CTYPE, NULL));
- setlocale (LC_CTYPE, "C");
- g_strdown (string);
- setlocale (LC_CTYPE, old_locale);
- g_free (old_locale);
-}
-
-/* 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);
- C_g_strdown(from);
- g_hash_table_insert(iconv_charsets, from, to);
- }
-
- e_dlist_init(&iconv_cache_list);
- iconv_cache = g_hash_table_new(g_str_hash, g_str_equal);
- iconv_cache_open = g_hash_table_new(NULL, NULL);
-
- locale = setlocale (LC_ALL, NULL);
-
- if (!locale || !strcmp (locale, "C") || !strcmp (locale, "POSIX")) {
- /* The locale "C" or "POSIX" is a portable locale; its
- * LC_CTYPE part corresponds to the 7-bit ASCII character
- * set.
- */
-
- locale_charset = NULL;
- } else {
-#ifdef HAVE_CODESET
- locale_charset = g_strdup(nl_langinfo(CODESET));
- C_g_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);
- C_g_strdown (locale_charset);
- } else {
- /* charset unknown */
- locale_charset = NULL;
- }
-#endif
- }
-
- if (!keep)
- UNLOCK();
-}
-
-const char *e_iconv_charset_name(const char *charset)
-{
- char *name, *ret, *tmp;
-
- if (charset == NULL)
- return NULL;
-
- name = alloca(strlen(charset)+1);
- strcpy(name, charset);
- C_g_strdown(name);
-
- e_iconv_init(TRUE);
- ret = g_hash_table_lookup(iconv_charsets, name);
- if (ret != NULL) {
- UNLOCK();
- return ret;
- }
-
- /* Unknown, try canonicalise some basic charset types to something that should work */
- if (strncmp(name, "iso", 3) == 0) {
- /* Convert iso-nnnn-n or isonnnn-n or iso_nnnn-n to iso-nnnn-n or isonnnn-n */
- int iso, codepage;
- char *p;
-
- tmp = name + 3;
- if (*tmp == '-' || *tmp == '_')
- tmp++;
-
- iso = strtoul (tmp, &p, 10);
-
- if (iso == 10646) {
- /* they all become ICONV_10646 */
- ret = g_strdup (ICONV_10646);
- } else {
- tmp = p;
- if (*tmp == '-' || *tmp == '_')
- tmp++;
-
- codepage = strtoul (tmp, &p, 10);
-
- if (p > tmp) {
- /* codepage is numeric */
-#ifdef __aix__
- if (codepage == 13)
- ret = g_strdup ("IBM-921");
- else
-#endif /* __aix__ */
- ret = g_strdup_printf (ICONV_ISO_D_FORMAT, iso, codepage);
- } else {
- /* codepage is a string - probably iso-2022-jp or something */
- ret = g_strdup_printf (ICONV_ISO_S_FORMAT, iso, p);
- }
- }
- } else if (strncmp(name, "windows-", 8) == 0) {
- /* Convert windows-nnnnn or windows-cpnnnnn to cpnnnn */
- tmp = name+8;
- if (!strncmp(tmp, "cp", 2))
- tmp+=2;
- ret = g_strdup_printf("CP%s", tmp);
- } else if (strncmp(name, "microsoft-", 10) == 0) {
- /* Convert microsoft-nnnnn or microsoft-cpnnnnn to cpnnnn */
- tmp = name+10;
- if (!strncmp(tmp, "cp", 2))
- tmp+=2;
- ret = g_strdup_printf("CP%s", tmp);
- } else {
- /* Just assume its ok enough as is, case and all */
- ret = g_strdup(charset);
- }
-
- g_hash_table_insert(iconv_charsets, g_strdup(name), ret);
- UNLOCK();
-
- return ret;
-}
-
-static void
-flush_entry(struct _iconv_cache *ic)
-{
- struct _iconv_cache_node *in, *nn;
-
- in = (struct _iconv_cache_node *)ic->open.head;
- nn = in->next;
- while (nn) {
- if (in->ip != (iconv_t)-1) {
- g_hash_table_remove(iconv_cache_open, in->ip);
- iconv_close(in->ip);
- }
- g_free(in);
- in = nn;
- nn = in->next;
- }
- g_free(ic->conv);
- g_free(ic);
-}
-
-/* This should run pretty quick, its called a lot */
-iconv_t e_iconv_open(const char *oto, const char *ofrom)
-{
- const char *to, *from;
- char *tofrom;
- struct _iconv_cache *ic;
- struct _iconv_cache_node *in;
- iconv_t ip;
-
- if (oto == NULL || ofrom == NULL)
- return (iconv_t)-1;
-
- to = e_iconv_charset_name (oto);
- from = e_iconv_charset_name (ofrom);
- tofrom = alloca(strlen(to) +strlen(from) + 2);
- sprintf(tofrom, "%s%%%s", to, from);
-
- LOCK();
-
- ic = g_hash_table_lookup(iconv_cache, tofrom);
- if (ic) {
- e_dlist_remove((EDListNode *)ic);
- } else {
- struct _iconv_cache *last = (struct _iconv_cache *)iconv_cache_list.tailpred;
- struct _iconv_cache *prev;
-
- prev = last->prev;
- while (prev && iconv_cache_size > E_ICONV_CACHE_SIZE) {
- in = (struct _iconv_cache_node *)last->open.head;
- if (in->next && !in->busy) {
- cd(printf("Flushing iconv converter '%s'\n", last->conv));
- e_dlist_remove((EDListNode *)last);
- g_hash_table_remove(iconv_cache, last->conv);
- flush_entry(last);
- iconv_cache_size--;
- }
- last = prev;
- prev = last->prev;
- }
-
- iconv_cache_size++;
-
- ic = g_malloc(sizeof(*ic));
- e_dlist_init(&ic->open);
- ic->conv = g_strdup(tofrom);
- g_hash_table_insert(iconv_cache, ic->conv, ic);
-
- cd(printf("Creating iconv converter '%s'\n", ic->conv));
- }
- e_dlist_addhead(&iconv_cache_list, (EDListNode *)ic);
-
- /* If we have a free iconv, use it */
- in = (struct _iconv_cache_node *)ic->open.tailpred;
- if (in->prev && !in->busy) {
- cd(printf("using existing iconv converter '%s'\n", ic->conv));
- ip = in->ip;
- if (ip != (iconv_t)-1) {
- /* work around some broken iconv implementations
- * that die if the length arguments are NULL
- */
- size_t buggy_iconv_len = 0;
- gchar *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 {
- g_warning("Could not open converter for '%s' to '%s' charset", from, to);
- in->busy = FALSE;
- }
- }
-
- UNLOCK();
-
- return ip;
-}
-
-size_t e_iconv(iconv_t cd, const char **inbuf, size_t *inbytesleft, char ** outbuf, size_t *outbytesleft)
-{
- return iconv(cd, (char **) inbuf, inbytesleft, outbuf, outbytesleft);
-}
-
-void
-e_iconv_close(iconv_t ip)
-{
- struct _iconv_cache_node *in;
-
- if (ip == (iconv_t)-1)
- return;
-
- LOCK();
- in = g_hash_table_lookup(iconv_cache_open, ip);
- if (in) {
- cd(printf("closing iconv converter '%s'\n", in->parent->conv));
- e_dlist_remove((EDListNode *)in);
- in->busy = FALSE;
- e_dlist_addtail(&in->parent->open, (EDListNode *)in);
- } else {
- g_warning("trying to close iconv i dont know about: %p", ip);
- iconv_close(ip);
- }
- UNLOCK();
-
-}
-
-const char *e_iconv_locale_charset(void)
-{
- e_iconv_init(FALSE);
-
- return locale_charset;
-}
-
diff --git a/e-util/e-iconv.h b/e-util/e-iconv.h
deleted file mode 100644
index daf97a30ab..0000000000
--- a/e-util/e-iconv.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-iconv.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Michael Zucchi <notzed@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#ifndef _E_ICONV_H_
-#define _E_ICONV_H_
-
-#include <iconv.h>
-
-#ifdef __cplusplus
-extern "C" {
-#pragma }
-#endif /* __cplusplus */
-
-const char *e_iconv_charset_name(const char *charset);
-iconv_t e_iconv_open(const char *oto, const char *ofrom);
-size_t e_iconv(iconv_t cd, const char **inbuf, size_t *inbytesleft, char ** outbuf, size_t *outbytesleft);
-void e_iconv_close(iconv_t ip);
-const char *e_iconv_locale_charset(void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* !_E_ICONV_H_ */
diff --git a/e-util/e-sorter-array.c b/e-util/e-sorter-array.c
deleted file mode 100644
index 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 6c50331011..0000000000
--- a/e-util/e-util.c
+++ /dev/null
@@ -1,1153 +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, 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 (mkdir (copy, mode) == -1) {
- switch (errno) {
- case EEXIST:
- break;
- default:
- 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;
-
- g_return_if_fail (string != NULL);
-
- for (p = string; *p; p++) {
- if (!isprint ((unsigned char)*p) || strchr (" /'\"`&();|<>${}!", *p))
- *p = '_';
- }
-}
-
-static gint
-epow10 (gint number) {
- gint value;
-
- for (value = 1; number > 0; number --) {
- value *= 10;
- }
- return value;
-}
-
-gchar *
-e_format_number (gint number)
-{
- GList *iterator, *list = NULL;
- struct lconv *locality;
- gint char_length = 0;
- gint group_count = 0;
- guchar *grouping;
- int last_count = 3;
- int divider;
- char *value;
- char *value_iterator;
-
- locality = localeconv();
- grouping = locality->grouping;
- while (number) {
- char *group;
- switch (*grouping) {
- default:
- last_count = *grouping;
- grouping++;
- case 0:
- divider = epow10(last_count);
- if (number >= divider) {
- group = g_strdup_printf("%0*d", last_count, number % divider);
- } else {
- group = g_strdup_printf("%d", number % divider);
- }
- number /= divider;
- break;
- case CHAR_MAX:
- group = g_strdup_printf("%d", number);
- number = 0;
- break;
- }
- char_length += strlen(group);
- list = g_list_prepend(list, group);
- group_count ++;
- }
-
- if (list) {
- value = g_new(char, 1 + char_length + (group_count - 1) * strlen(locality->thousands_sep));
-
- iterator = list;
- value_iterator = value;
-
- strcpy(value_iterator, iterator->data);
- value_iterator += strlen(iterator->data);
- for (iterator = iterator->next; iterator; iterator = iterator->next) {
- strcpy(value_iterator, locality->thousands_sep);
- value_iterator += strlen(locality->thousands_sep);
-
- strcpy(value_iterator, iterator->data);
- value_iterator += strlen(iterator->data);
- }
- e_free_string_list (list);
- return value;
- } else {
- return g_strdup("0");
- }
-}
-
-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
-}
-
-
-/**
- * Function to do a last minute fixup of the AM/PM stuff if the locale
- * and gettext haven't done it right. Most English speaking countries
- * except the USA use the 24 hour clock (UK, Australia etc). However
- * since they are English nobody bothers to write a language
- * translation (gettext) file. So the locale turns off the AM/PM, but
- * gettext does not turn on the 24 hour clock. Leaving a mess.
- *
- * This routine checks if AM/PM are defined in the locale, if not it
- * forces the use of the 24 hour clock.
- *
- * The function itself is a front end on strftime and takes exactly
- * the same arguments.
- *
- * TODO: Actually remove the '%p' from the fixed up string so that
- * there isn't a stray space.
- **/
-
-size_t e_strftime_fix_am_pm(char *s, size_t max, const char *fmt, const struct tm *tm)
-{
- char buf[10];
- char *sp;
- char *ffmt;
- size_t ret;
-
- if (strstr(fmt, "%p")==NULL && strstr(fmt, "%P")==NULL) {
- /* No AM/PM involved - can use the fmt string directly */
- ret=e_strftime(s, max, fmt, tm);
- } else {
- /* Get the AM/PM symbol from the locale */
- e_strftime (buf, 10, "%p", tm);
-
- if (buf[0]) {
- /**
- * AM/PM have been defined in the locale
- * so we can use the fmt string directly
- **/
- ret=e_strftime(s, max, fmt, tm);
- } else {
- /**
- * No AM/PM defined by locale
- * must change to 24 hour clock
- **/
- ffmt=g_strdup(fmt);
- for (sp=ffmt; (sp=strstr(sp, "%l")); sp++) {
- /**
- * Maybe this should be 'k', but I have never
- * seen a 24 clock actually use that format
- **/
- sp[1]='H';
- }
- for (sp=ffmt; (sp=strstr(sp, "%I")); sp++) {
- sp[1]='H';
- }
- ret=e_strftime(s, max, ffmt, tm);
- g_free(ffmt);
- }
- }
- return(ret);
-}
-
-/**
- * e_flexible_strtod:
- * @nptr: the string to convert to a numeric value.
- * @endptr: if non-NULL, it returns the character after
- * the last character used in the conversion.
- *
- * Converts a string to a gdouble value. This function detects
- * strings either in the standard C locale or in the current locale.
- *
- * This function is typically used when reading configuration files or
- * other non-user input that should not be locale dependent, but may
- * have been in the past. To handle input from the user you should
- * normally use the locale-sensitive system strtod function.
- *
- * To convert from a double to a string in a locale-insensitive way, use
- * @g_ascii_dtostr.
- *
- * Return value: the gdouble value.
- **/
-gdouble
-e_flexible_strtod (const gchar *nptr,
- gchar **endptr)
-{
- gchar *fail_pos;
- gdouble val;
- struct lconv *locale_data;
- const char *decimal_point;
- int decimal_point_len;
- const char *p, *decimal_point_pos;
- const char *end = NULL; /* Silence gcc */
- char *copy, *c;
-
- g_return_val_if_fail (nptr != NULL, 0);
-
- fail_pos = NULL;
-
- locale_data = localeconv ();
- decimal_point = locale_data->decimal_point;
- decimal_point_len = strlen (decimal_point);
-
- g_assert (decimal_point_len != 0);
-
- decimal_point_pos = NULL;
- if (!strcmp (decimal_point, "."))
- return strtod (nptr, endptr);
-
- p = nptr;
-
- /* Skip leading space */
- while (isspace ((guchar)*p))
- p++;
-
- /* Skip leading optional sign */
- if (*p == '+' || *p == '-')
- p++;
-
- if (p[0] == '0' &&
- (p[1] == 'x' || p[1] == 'X')) {
- p += 2;
- /* HEX - find the (optional) decimal point */
-
- while (isxdigit ((guchar)*p))
- p++;
-
- if (*p == '.') {
- decimal_point_pos = p++;
-
- while (isxdigit ((guchar)*p))
- p++;
-
- if (*p == 'p' || *p == 'P')
- p++;
- if (*p == '+' || *p == '-')
- p++;
- while (isdigit ((guchar)*p))
- p++;
- end = p;
- } else if (strncmp (p, decimal_point, decimal_point_len) == 0) {
- return strtod (nptr, endptr);
- }
- } else {
- while (isdigit ((guchar)*p))
- p++;
-
- if (*p == '.') {
- decimal_point_pos = p++;
-
- while (isdigit ((guchar)*p))
- p++;
-
- if (*p == 'e' || *p == 'E')
- p++;
- if (*p == '+' || *p == '-')
- p++;
- while (isdigit ((guchar)*p))
- p++;
- end = p;
- } else if (strncmp (p, decimal_point, decimal_point_len) == 0) {
- return strtod (nptr, endptr);
- }
- }
- /* For the other cases, we need not convert the decimal point */
-
- if (!decimal_point_pos)
- return strtod (nptr, endptr);
-
- /* We need to convert the '.' to the locale specific decimal point */
- copy = g_malloc (end - nptr + 1 + decimal_point_len);
-
- c = copy;
- memcpy (c, nptr, decimal_point_pos - nptr);
- c += decimal_point_pos - nptr;
- memcpy (c, decimal_point, decimal_point_len);
- c += decimal_point_len;
- memcpy (c, decimal_point_pos + 1, end - (decimal_point_pos + 1));
- c += end - (decimal_point_pos + 1);
- *c = 0;
-
- val = strtod (copy, &fail_pos);
-
- if (fail_pos) {
- if (fail_pos > decimal_point_pos)
- fail_pos = (char *)nptr + (fail_pos - copy) - (decimal_point_len - 1);
- else
- fail_pos = (char *)nptr + (fail_pos - copy);
- }
-
- g_free (copy);
-
- if (endptr)
- *endptr = fail_pos;
-
- return val;
-}
-
-/**
- * e_ascii_dtostr:
- * @buffer: A buffer to place the resulting string in
- * @buf_len: The length of the buffer.
- * @format: The printf-style format to use for the
- * code to use for converting.
- * @d: The double to convert
- *
- * Converts a double to a string, using the '.' as
- * decimal_point. To format the number you pass in
- * a printf-style formating string. Allowed conversion
- * specifiers are eEfFgG.
- *
- * If you want to generates enough precision that converting
- * the string back using @g_strtod gives the same machine-number
- * (on machines with IEEE compatible 64bit doubles) use the format
- * string "%.17g". If you do this it is guaranteed that the size
- * of the resulting string will never be larger than
- * @G_ASCII_DTOSTR_BUF_SIZE bytes.
- *
- * Return value: The pointer to the buffer with the converted string.
- **/
-gchar *
-e_ascii_dtostr (gchar *buffer,
- gint buf_len,
- const gchar *format,
- gdouble d)
-{
- struct lconv *locale_data;
- const char *decimal_point;
- int decimal_point_len;
- gchar *p;
- int rest_len;
- gchar format_char;
-
- g_return_val_if_fail (buffer != NULL, NULL);
- g_return_val_if_fail (format[0] == '%', NULL);
- g_return_val_if_fail (strpbrk (format + 1, "'l%") == NULL, NULL);
-
- format_char = format[strlen (format) - 1];
-
- g_return_val_if_fail (format_char == 'e' || format_char == 'E' ||
- format_char == 'f' || format_char == 'F' ||
- format_char == 'g' || format_char == 'G',
- NULL);
-
- if (format[0] != '%')
- return NULL;
-
- if (strpbrk (format + 1, "'l%"))
- return NULL;
-
- if (!(format_char == 'e' || format_char == 'E' ||
- format_char == 'f' || format_char == 'F' ||
- format_char == 'g' || format_char == 'G'))
- return NULL;
-
-
- g_snprintf (buffer, buf_len, format, d);
-
- locale_data = localeconv ();
- decimal_point = locale_data->decimal_point;
- decimal_point_len = strlen (decimal_point);
-
- g_assert (decimal_point_len != 0);
-
- if (strcmp (decimal_point, ".")) {
- p = buffer;
-
- if (*p == '+' || *p == '-')
- p++;
-
- while (isdigit ((guchar)*p))
- p++;
-
- if (strncmp (p, decimal_point, decimal_point_len) == 0) {
- *p = '.';
- p++;
- if (decimal_point_len > 1) {
- rest_len = strlen (p + (decimal_point_len-1));
- memmove (p, p + (decimal_point_len-1),
- rest_len);
- p[rest_len] = 0;
- }
- }
- }
-
- return buffer;
-}
-
-gchar *
-e_strdup_append_strings (gchar *first_string, ...)
-{
- gchar *buffer;
- gchar *current;
- gint length;
- va_list args1;
- va_list args2;
- char *v_string;
- int v_int;
-
- va_start (args1, first_string);
- G_VA_COPY (args2, args1);
-
- length = 0;
-
- v_string = first_string;
- while (v_string) {
- v_int = va_arg (args1, int);
- if (v_int >= 0)
- length += v_int;
- else
- length += strlen (v_string);
- v_string = va_arg (args1, char *);
- }
-
- buffer = g_new (char, length + 1);
- current = buffer;
-
- v_string = first_string;
- while (v_string) {
- v_int = va_arg (args2, int);
- if (v_int < 0) {
- int i;
- for (i = 0; v_string[i]; i++) {
- *(current++) = v_string[i];
- }
- } else {
- int i;
- for (i = 0; v_string[i] && i < v_int; i++) {
- *(current++) = v_string[i];
- }
- }
- v_string = va_arg (args2, char *);
- }
- *(current++) = 0;
-
- va_end (args1);
- va_end (args2);
-
- return buffer;
-}
-
-gchar **
-e_strdupv (const gchar **str_array)
-{
- if (str_array) {
- gint i;
- gchar **retval;
-
- i = 0;
- while (str_array[i])
- i++;
-
- retval = g_new (gchar*, i + 1);
-
- i = 0;
- while (str_array[i]) {
- retval[i] = g_strdup (str_array[i]);
- i++;
- }
- retval[i] = NULL;
-
- return retval;
- } else {
- return NULL;
- }
-}
-
-char *
-e_gettext (const char *msgid)
-{
- static gboolean initialized = FALSE;
-
- if (!initialized) {
- bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
- bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
- initialized = TRUE;
- }
-
- return dgettext (GETTEXT_PACKAGE, msgid);
-}
-
diff --git a/e-util/e-util.h b/e-util/e-util.h
deleted file mode 100644
index 2937265f6b..0000000000
--- a/e-util/e-util.h
+++ /dev/null
@@ -1,221 +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);
-
-/* 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 4bc1b9e7d7..0000000000
--- a/e-util/e-xml-utils.c
+++ /dev/null
@@ -1,443 +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
-
-#ifdef HAVE_ALLOCA_H
-#include <alloca.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;
-}
-
-
diff --git a/e-util/e-xml-utils.h b/e-util/e-xml-utils.h
deleted file mode 100644
index ad16b10ea6..0000000000
--- a/e-util/e-xml-utils.h
+++ /dev/null
@@ -1,99 +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);
-
-G_END_DECLS
-
-#endif /* __E_XML_UTILS__ */
diff --git a/filter/ChangeLog b/filter/ChangeLog
index 1f26d43331..28c3cf5812 100644
--- a/filter/ChangeLog
+++ b/filter/ChangeLog
@@ -1,178 +1,3 @@
-2002-11-26 Not Zed <NotZed@Ximian.com>
-
- * vfolder-rule.c (get_widget): Add a textcellrenderer to display
- the folders.
- (get_widget): Remove FIXME which was wrong.
-
- * filter-rule.c (filter_rule_validate): FILTER_RULE_CLASS ->
- _GET_CLASS
-
- * rule-context.c (rule_context_save): RULE_CONTEXT_CLASS ->
- RULE_CONTEXT_GET_CLASS
- (rule_context_revert): "
-
- * *.[ch]: Ran fix.sh over all files.
-
- * rule-editor.c (rule_add): widget:set_parent ->
- window:set_transient_for
- (editor_response): renamed from editor_clicked, handle gtk dialog
- response codes.
- (rule_edit): connect to response rather than clicked.
- (rule_editor_construct): Setup a text column in the tree view.
- Not sure if this can be handled via glade.
-
-2002-11-20 Jeffrey Stedfast <fejj@ximian.com>
-
- * filter-label.c (xml_create): gconfify.
-
-2002-11-18 Jeffrey Stedfast <fejj@ximian.com>
-
- * rule-editor.c: Updated to use GtkTreeView.
-
- * vfolder-rule.c: Same.
-
-2002-11-13 Not Zed <NotZed@Ximian.com>
-
- * rule-context.c (load): Get the root node properly.
-
- * rule-editor.c (rule_add): cast g_object_weak_ref
- (rule_edit): "
-
- * all: xml2 node change - childs->children. Also, ignore 'text'
- nodes while scanning tree.
-
- * rule-context.h: gnome-xml->libxml.
-
- * filter-element.h: gnome-xml->libxml
-
- * vfolder-rule.c (source_add): comment out gtk_destroyed check.
-
- * filter-label.c: Added back some of the guts. Might not work but
- some of the code uses it :-/. Gives u a fixed set of non-editable
- labels.
-
-2002-11-08 Jeffrey Stedfast <fejj@ximian.com>
-
- * rule-editor.c (rule_edit): Use weak_ref instead of connecting to
- "destroy".
- (rule_add): Same.
-
-2002-11-07 Jeffrey Stedfast <fejj@ximian.com>
-
- * vfolder-rule.c (validate): Use a GtkDialog instead of a
- GnomeDialog for reporting errors.
-
- * rule-editor.c (rule_add): Use a GtkDialog instead of
- GnomeDialog.
- (rule_edit): Same.
- (add_editor_response): Use a GtkMessageDialog for the error
- reporting instead of a GnomeDialog.
- (edit_editor_response): Same.
-
- * rule-context.c (rule_context_add_rule_gui): Use a GtkDialog
- instead of a GnomeDialog.
-
- * filter-rule.c (validate): Use GtkDialog instead of GnomeDialog
- here.
-
- * filter-input.c (validate): Use GtkDialog instead of GnomeDialog
- here.
-
- * filter-folder.c (validate): Use GtkDialog instead of GnomeDialog
- here.
-
- * filter-file.c (validate): Use GtkDialog instead of GnomeDialog
- here.
-
- * rule-editor.c: Subclass GtkDialog instead of GnomeDialog.
-
- * filter-datespec.c (validate): Use GtkDialog instead of
- GnomeDialog.
- (button_clicked): Same.
-
-2002-11-06 Jeffrey Stedfast <fejj@ximian.com>
-
- * filter-label.c (xml_create): Deleted most of the internals until
- we devise a gconf schema and redesign how we want to do this. It
- didn't work correctly for 1.2 anyway.
-
- * filter.glade: Converted to the glade-2 format.
-
-2002-11-05 Jeffrey Stedfast <fejj@ximian.com>
-
- * filter-filter.c: Ported.
-
- * filter-source.c (get_widget): Don't use e_utf8_to_gtk_string.
-
- * filter-option.c (xml_create): Don't use e_utf8_xml1_decode.
-
- * filter-input.c (xml_encode): Don't use e_utf8_xml1_encode.
- (xml_decode): Don't use e_utf8_xml1_decode.
- (entry_changed): Don't use e_utf8_gtk_entry_get_text.
- (get_widget): Don't use e_utf8_gtk_entry_set_text.
-
- * filter-file.c (xml_encode): Don't use e_utf8_xml1_encode shit.
- (xml_decode): Don't use e_utf8_xml1_decode.
- (entry_changed): Don't use e_utf8_gtk_entry_get_text.
- (get_widget): Don't use e_utf8_gtk_entry_set_text.
-
-2002-11-05 Jeffrey Stedfast <fejj@ximian.com>
-
- * vfolder-rule.c: Ported.
-
- * vfolder-editor.c: Ported.
-
- * vfolder-context.c: Ported.
-
-2002-11-05 Jeffrey Stedfast <fejj@ximian.com>
-
- * filter-rule.c: Ported.
-
- * score-rule.c: Ported.
-
- * score-editor.c: Ported. Again, thise code seems to be unused.
-
- * score-context.c: Ported. Although it seems this code isn't
- really used anywhere?
-
-2002-11-04 Jeffrey Stedfast <fejj@ximian.com>
-
- * filter-part.c: Ported.
-
- * filter-editor.c: Also ported.
-
- * rule-editor.c: Ported to gtk2 and removed unnecessary e_utf8 snot.
-
-2002-11-02 Jeffrey Stedfast <fejj@ximian.com>
-
- * filter-context.c: Ported this too.
-
- * rule-context.c: Ported to glib2/GObject.
-
-2002-11-01 Jeffrey Stedfast <fejj@ximian.com>
-
- * filter-element.c: Ported to GObject.
-
- * filter-input.c: Same.
-
- * filter-code.c: This too.
-
- * filter-colour.c: And this.
-
- * filter-datespec.c: You guessed it.
-
- * filter-file.c: And again...
-
- * filter-folder.c: Wheee! This is fun...
-
- * filter-int.c: Gee, I wonder...
-
- * filter-label.c: Also ported.
-
- * filter-option.c: Yep, this too.
-
- * filter-source.c: And finally this one.
-
2002-10-30 Dan Winship <danw@ximian.com>
* rule-editor.c (rule_add): Adjust default rule editor size to
diff --git a/filter/rule-editor.c b/filter/rule-editor.c
index f86c8718bc..fac6f47476 100644
--- a/filter/rule-editor.c
+++ b/filter/rule-editor.c
@@ -1,10 +1,8 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
- * Copyright (C) 2000-2002 Ximian Inc.
+ * Copyright (C) 2000 Ximian Inc.
*
* Authors: Not Zed <notzed@lostzed.mmc.com.au>
* Jeffrey Stedfast <fejj@ximian.com>
- *
* This program is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
* License as published by the Free Software Foundation.
@@ -20,32 +18,39 @@
* Boston, MA 02111-1307, USA.
*/
-
-#ifdef HAVE_CONFIG_H
#include <config.h>
-#endif
-
-/* for getenv only, remove when getenv need removed */
-#include <stdlib.h>
+#include <glib.h>
+#include <gtk/gtkframe.h>
+#include <libgnome/gnome-defs.h>
#include <libgnome/gnome-i18n.h>
-
+#include <libgnomeui/gnome-stock.h>
+#include <libgnomeui/gnome-dialog.h>
+#include <libgnomeui/gnome-dialog-util.h>
+#include <glade/glade.h>
+#include <gal/widgets/e-unicode.h>
+#include <gal/util/e-unicode-i18n.h>
#include "rule-editor.h"
+#include "rule-context.h"
+#include "filter-rule.h"
-static int enable_undo = 0;
+/* for getenv only, remove when getenv need removed */
+#include <stdlib.h>
+
+static int enable_undo;
-void rule_editor_add_undo (RuleEditor *re, int type, FilterRule *rule, int rank, int newrank);
-void rule_editor_play_undo (RuleEditor *re);
+void rule_editor_add_undo(RuleEditor *re, int type, FilterRule *rule, int rank, int newrank);
+void rule_editor_play_undo(RuleEditor *re);
#define d(x) x
-static void set_source (RuleEditor *re, const char *source);
-static void set_sensitive (RuleEditor *re);
-static FilterRule *create_rule (RuleEditor *re);
+static void set_source(RuleEditor *re, const char *source);
+static void set_sensitive(RuleEditor *re);
+static FilterRule *create_rule(RuleEditor *re);
-static void rule_editor_class_init (RuleEditorClass *klass);
-static void rule_editor_init (RuleEditor *re);
-static void rule_editor_finalise (GObject *obj);
+static void rule_editor_class_init(RuleEditorClass *class);
+static void rule_editor_init (RuleEditor *gspaper);
+static void rule_editor_finalise (GtkObject *obj);
static void rule_editor_destroy (GtkObject *obj);
#define _PRIVATE(x)(((RuleEditor *)(x))->priv)
@@ -63,76 +68,84 @@ struct _RuleEditorPrivate {
GtkButton *buttons[BUTTON_LAST];
};
-static GtkDialogClass *parent_class = NULL;
+static GnomeDialogClass *parent_class;
+
+enum {
+ LAST_SIGNAL
+};
+static guint signals[LAST_SIGNAL] = { 0 };
-GtkType
-rule_editor_get_type (void)
+guint
+rule_editor_get_type(void)
{
- static GtkType type = 0;
+ static guint type = 0;
if (!type) {
- static const GtkTypeInfo info = {
+ GtkTypeInfo type_info = {
"RuleEditor",
sizeof (RuleEditor),
sizeof (RuleEditorClass),
(GtkClassInitFunc) rule_editor_class_init,
(GtkObjectInitFunc) rule_editor_init,
- /* reserved_1 */ NULL,
- /* reserved_2 */ NULL,
- (GtkClassInitFunc) NULL,
+ (GtkArgSetFunc) NULL,
+ (GtkArgGetFunc) NULL
};
-
+
/* TODO: Remove when it works (or never will) */
- enable_undo = getenv ("EVOLUTION_RULE_UNDO") != NULL;
-
- type = gtk_type_unique (gtk_dialog_get_type (), &info);
+ enable_undo = getenv("EVOLUTION_RULE_UNDO") != NULL;
+
+ type = gtk_type_unique (gnome_dialog_get_type (), &type_info);
}
return type;
}
static void
-rule_editor_class_init (RuleEditorClass *klass)
+rule_editor_class_init (RuleEditorClass *class)
{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- GtkObjectClass *object_class = (GtkObjectClass *) klass;
+ GtkObjectClass *object_class;
- parent_class = g_type_class_ref(gtk_dialog_get_type ());
+ object_class = (GtkObjectClass *)class;
+ parent_class = gtk_type_class(gnome_dialog_get_type());
- gobject_class->finalize = rule_editor_finalise;
+ object_class->finalize = rule_editor_finalise;
object_class->destroy = rule_editor_destroy;
/* override methods */
- klass->set_source = set_source;
- klass->set_sensitive = set_sensitive;
- klass->create_rule = create_rule;
+ class->set_source = set_source;
+ class->set_sensitive = set_sensitive;
+ class->create_rule = create_rule;
+
+ /* signals */
+
+ gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
}
static void
-rule_editor_init (RuleEditor *re)
+rule_editor_init (RuleEditor *o)
{
- re->priv = g_malloc0 (sizeof (*re->priv));
+ o->priv = g_malloc0 (sizeof (*o->priv));
}
static void
-rule_editor_finalise (GObject *obj)
+rule_editor_finalise (GtkObject *obj)
{
RuleEditor *re = (RuleEditor *)obj;
RuleEditorUndo *undo, *next;
-
- g_object_unref (re->context);
+
+ gtk_object_unref (GTK_OBJECT (re->context));
g_free (re->priv);
-
+
undo = re->undo_log;
while (undo) {
next = undo->next;
- g_object_unref (undo->rule);
- g_free (undo);
+ gtk_object_unref((GtkObject *)undo->rule);
+ g_free(undo);
undo = next;
}
- G_OBJECT_CLASS (parent_class)->finalize (obj);
+ ((GtkObjectClass *)(parent_class))->finalize (obj);
}
static void
@@ -140,10 +153,8 @@ rule_editor_destroy (GtkObject *obj)
{
RuleEditor *re = (RuleEditor *) obj;
- if (re->dialog) {
+ if (re->dialog)
gtk_widget_destroy (GTK_WIDGET (re->dialog));
- re->dialog = NULL;
- }
((GtkObjectClass *)(parent_class))->destroy (obj);
}
@@ -156,42 +167,42 @@ rule_editor_destroy (GtkObject *obj)
* Return value: A new #RuleEditor object.
**/
RuleEditor *
-rule_editor_new (RuleContext *rc, const char *source)
+rule_editor_new (RuleContext *f, const char *source)
{
- RuleEditor *re = (RuleEditor *) gtk_type_new (rule_editor_get_type ());
GladeXML *gui;
+ RuleEditor *o = (RuleEditor *)gtk_type_new (rule_editor_get_type ());
GtkWidget *w;
- gui = glade_xml_new (FILTER_GLADEDIR "/filter.glade", "rule_editor", NULL);
- rule_editor_construct (re, rc, gui, source);
+ gui = glade_xml_new (FILTER_GLADEDIR "/filter.glade", "rule_editor");
+ rule_editor_construct (o, f, gui, source);
w = glade_xml_get_widget (gui, "rule_frame");
- gtk_frame_set_label ((GtkFrame *) w, _("Rules"));
+ gtk_frame_set_label ((GtkFrame *)w, _("Rules"));
- g_object_unref (gui);
+ gtk_object_unref (GTK_OBJECT (gui));
- return re;
+ return o;
}
/* used internally by implementations if required */
void
rule_editor_set_sensitive (RuleEditor *re)
{
- return RULE_EDITOR_GET_CLASS (re)->set_sensitive (re);
+ return ((RuleEditorClass *)((GtkObject *)re)->klass)->set_sensitive(re);
}
/* used internally by implementations */
void
rule_editor_set_source (RuleEditor *re, const char *source)
{
- return RULE_EDITOR_GET_CLASS (re)->set_source (re, source);
+ return ((RuleEditorClass *)((GtkObject *)re)->klass)->set_source(re, source);
}
/* factory method for "add" button */
FilterRule *
rule_editor_create_rule (RuleEditor *re)
{
- return RULE_EDITOR_GET_CLASS (re)->create_rule (re);
+ return ((RuleEditorClass *)((GtkObject *)re)->klass)->create_rule(re);
}
static FilterRule *
@@ -208,60 +219,69 @@ create_rule (RuleEditor *re)
}
static void
-editor_destroy (RuleEditor *re, GObject *deadbeef)
+add_editor_clicked (GtkWidget *dialog, int button, RuleEditor *re)
{
- if (re->edit) {
- g_object_unref (re->edit);
- re->edit = NULL;
- }
-
- re->dialog = NULL;
-
- gtk_widget_set_sensitive (GTK_WIDGET (re), TRUE);
- rule_editor_set_sensitive (re);
-}
+ GtkWidget *item;
+ GList *l = NULL;
+ char *string;
-static void
-add_editor_response (GtkWidget *dialog, int button, RuleEditor *re)
-{
- GtkTreeSelection *selection;
- GtkTreePath *path;
- GtkTreeIter iter;
-
- if (button == GTK_RESPONSE_ACCEPT) {
+ switch (button) {
+ case 0:
if (!filter_rule_validate (re->edit)) {
/* no need to popup a dialog because the validate code does that. */
return;
}
-
- if (rule_context_find_rule (re->context, re->edit->name, re->edit->source)) {
- dialog = gtk_message_dialog_new ((GtkWindow *) dialog, GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
- _("Rule name '%s' is not unique, choose another."),
- re->edit->name);
-
- gtk_dialog_run ((GtkDialog *) dialog);
- gtk_widget_destroy (dialog);
-
+
+ if (rule_context_find_rule(re->context, re->edit->name, re->edit->source)) {
+ GtkWidget *dialog;
+ char *what;
+
+ what = g_strdup_printf(_("Rule name '%s' is not unique, choose another"), re->edit->name);
+ dialog = gnome_ok_dialog (what);
+ g_free(what);
+ gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
+
return;
}
- g_object_ref (re->edit);
+ gtk_object_ref (GTK_OBJECT (re->edit));
+ string = e_utf8_to_gtk_string (GTK_WIDGET (re->list), re->edit->name);
+ item = gtk_list_item_new_with_label (string);
+ g_free (string);
+
+ gtk_object_set_data (GTK_OBJECT (item), "rule", re->edit);
+ gtk_widget_show (item);
- gtk_list_store_append (re->model, &iter);
- gtk_list_store_set (re->model, &iter, 0, re->edit->name, 1, re->edit, -1);
- selection = gtk_tree_view_get_selection (re->list);
- gtk_tree_selection_select_iter (selection, &iter);
+ l = g_list_append (l, GTK_LIST_ITEM (item));
+
+ gtk_list_append_items (re->list, l);
+ gtk_list_select_child (re->list, item);
re->current = re->edit;
rule_context_add_rule (re->context, re->current);
+
+ gtk_object_ref((GtkObject *)re->current);
+ rule_editor_add_undo(re, RULE_EDITOR_LOG_ADD, re->current, rule_context_get_rank_rule (re->context, re->current, re->current->source), 0);
+ case 1:
+ default:
+ gnome_dialog_close (GNOME_DIALOG (dialog));
+ case -1:
+ if (re->edit) {
+ gtk_object_unref (GTK_OBJECT (re->edit));
+ re->edit = NULL;
+ }
- g_object_ref (re->current);
- rule_editor_add_undo (re, RULE_EDITOR_LOG_ADD, re->current,
- rule_context_get_rank_rule (re->context, re->current, re->current->source), 0);
+ re->dialog = NULL;
+
+ gtk_widget_set_sensitive (GTK_WIDGET (re), TRUE);
+ rule_editor_set_sensitive (re);
}
-
- gtk_widget_destroy (dialog);
+}
+
+static void
+add_editor_destroyed(GtkWidget *w, RuleEditor *re)
+{
+ add_editor_clicked(w, -1, re);
}
static void
@@ -276,69 +296,82 @@ rule_add (GtkWidget *widget, RuleEditor *re)
filter_rule_set_source (re->edit, re->source);
rules = filter_rule_get_widget (re->edit, re->context);
- re->dialog = gtk_dialog_new ();
- gtk_dialog_add_buttons ((GtkDialog *) re->dialog, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
- GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, NULL);
+ re->dialog = gnome_dialog_new (_("Add Rule"),
+ GNOME_STOCK_BUTTON_OK,
+ GNOME_STOCK_BUTTON_CANCEL,
+ NULL);
- gtk_window_set_title ((GtkWindow *) re->dialog, _("Add Rule"));
gtk_window_set_default_size (GTK_WINDOW (re->dialog), 650, 400);
gtk_window_set_policy (GTK_WINDOW (re->dialog), FALSE, TRUE, FALSE);
- gtk_window_set_transient_for((GtkWindow *)re->dialog, (GtkWindow *)re);
-
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (re->dialog)->vbox), rules, TRUE, TRUE, 0);
-
- g_signal_connect (re->dialog, "response", G_CALLBACK (add_editor_response), re);
- g_object_weak_ref ((GObject *)re->dialog, (GWeakNotify) editor_destroy, re);
-
+ gtk_widget_set_parent_window (GTK_WIDGET (re->dialog), GTK_WIDGET (re)->window);
+ gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (re->dialog)->vbox), rules, TRUE, TRUE, 0);
+ gtk_signal_connect (GTK_OBJECT (re->dialog), "clicked", add_editor_clicked, re);
+ gtk_signal_connect (GTK_OBJECT (re->dialog), "destroy", add_editor_destroyed, re);
gtk_widget_set_sensitive (GTK_WIDGET (re), FALSE);
gtk_widget_show (re->dialog);
}
static void
-edit_editor_response (GtkWidget *dialog, int button, RuleEditor *re)
+edit_editor_clicked (GtkWidget *dialog, int button, RuleEditor *re)
{
- FilterRule *rule;
- GtkTreePath *path;
- GtkTreeIter iter;
+ GtkWidget *item;
+ char *string;
int pos;
-
- if (button == GTK_RESPONSE_ACCEPT) {
+ struct _FilterRule *rule;
+
+ switch (button) {
+ case 0:
if (!filter_rule_validate (re->edit)) {
/* no need to popup a dialog because the validate code does that. */
return;
}
-
- rule = rule_context_find_rule (re->context, re->edit->name, re->edit->source);
+
+ rule = rule_context_find_rule(re->context, re->edit->name, re->edit->source);
if (rule != NULL && rule != re->current) {
- dialog = gtk_message_dialog_new ((GtkWindow *) dialog, GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
- _("Rule name '%s' is not unique, choose another."),
- re->edit->name);
-
- gtk_dialog_run ((GtkDialog *) dialog);
- gtk_widget_destroy (dialog);
-
+ GtkWidget *dialog;
+ char *what;
+
+ what = g_strdup_printf(_("Rule name '%s' is not unique, choose another"), re->edit->name);
+ dialog = gnome_ok_dialog (what);
+ g_free(what);
+ gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
+
return;
}
pos = rule_context_get_rank_rule (re->context, re->current, re->source);
if (pos != -1) {
- path = gtk_tree_path_new ();
- gtk_tree_path_append_index (path, pos);
- gtk_tree_model_get_iter (GTK_TREE_MODEL (re->model), &iter, path);
- gtk_tree_path_free (path);
-
- gtk_list_store_set (re->model, &iter, 0, re->edit->name, -1);
-
- rule_editor_add_undo (re, RULE_EDITOR_LOG_EDIT, filter_rule_clone (re->current), pos, 0);
-
+ item = g_list_nth_data (GTK_LIST (re->list)->children, pos);
+ string = e_utf8_to_gtk_string (GTK_WIDGET (item), re->edit->name);
+ gtk_label_set_text (GTK_LABEL (GTK_BIN (item)->child), string);
+ g_free (string);
+
+ rule_editor_add_undo(re, RULE_EDITOR_LOG_EDIT, filter_rule_clone(re->current), pos, 0);
+
/* replace the old rule with the new rule */
filter_rule_copy (re->current, re->edit);
}
+ case 1:
+ default:
+ gnome_dialog_close (GNOME_DIALOG (dialog));
+ case -1:
+ if (re->edit) {
+ gtk_object_unref (GTK_OBJECT (re->edit));
+ re->edit = NULL;
+ }
+
+ re->dialog = NULL;
+
+ gtk_widget_set_sensitive (GTK_WIDGET (re), TRUE);
+ rule_editor_set_sensitive (re);
}
-
- gtk_widget_destroy (dialog);
+}
+
+static void
+edit_editor_destroyed(GtkWidget *w, RuleEditor *re)
+{
+ edit_editor_clicked(w, -1, re);
}
static void
@@ -352,20 +385,17 @@ rule_edit (GtkWidget *widget, RuleEditor *re)
re->edit = filter_rule_clone (re->current);
rules = filter_rule_get_widget (re->edit, re->context);
+ re->dialog = gnome_dialog_new (_("Edit Rule"),
+ GNOME_STOCK_BUTTON_OK,
+ GNOME_STOCK_BUTTON_CANCEL,
+ NULL);
- re->dialog = gtk_dialog_new ();
- gtk_dialog_add_buttons ((GtkDialog *) re->dialog, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
- GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, NULL);
-
- gtk_window_set_title ((GtkWindow *) re->dialog, _("Edit Rule"));
- gtk_window_set_default_size (GTK_WINDOW (re->dialog), 650, 400);
+ gnome_dialog_set_parent (GNOME_DIALOG (re->dialog), GTK_WINDOW (re));
+ gtk_window_set_default_size (GTK_WINDOW (re->dialog), 600, 400);
gtk_window_set_policy (GTK_WINDOW (re->dialog), FALSE, TRUE, FALSE);
- gtk_widget_set_parent_window (GTK_WIDGET (re->dialog), GTK_WIDGET (re)->window);
-
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (re->dialog)->vbox), rules, TRUE, TRUE, 0);
-
- g_signal_connect (re->dialog, "response", G_CALLBACK (edit_editor_response), re);
- g_object_weak_ref ((GObject *)re->dialog, (GWeakNotify) editor_destroy, re);
+ gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (re->dialog)->vbox), rules, TRUE, TRUE, 0);
+ gtk_signal_connect (GTK_OBJECT (re->dialog), "clicked", edit_editor_clicked, re);
+ gtk_signal_connect (GTK_OBJECT (re->dialog), "destroy", edit_editor_destroyed, re);
gtk_widget_set_sensitive (GTK_WIDGET (re), FALSE);
@@ -375,40 +405,32 @@ rule_edit (GtkWidget *widget, RuleEditor *re)
static void
rule_delete (GtkWidget *widget, RuleEditor *re)
{
- GtkTreeSelection *selection;
- GtkTreePath *path;
- GtkTreeIter iter;
- int pos, len;
+ int pos;
+ GList *l;
+ GtkListItem *item;
d(printf ("delete rule\n"));
pos = rule_context_get_rank_rule (re->context, re->current, re->source);
if (pos != -1) {
+ int len;
+
rule_context_remove_rule (re->context, re->current);
- path = gtk_tree_path_new ();
- gtk_tree_path_append_index (path, pos);
- gtk_tree_model_get_iter (GTK_TREE_MODEL (re->model), &iter, path);
- gtk_list_store_remove (re->model, &iter);
- gtk_tree_path_free (path);
+ item = g_list_nth_data (GTK_LIST (re->list)->children, pos);
+ l = g_list_append (NULL, item);
+ gtk_list_remove_items (re->list, l);
+ g_list_free (l);
- rule_editor_add_undo (re, RULE_EDITOR_LOG_REMOVE, re->current,
- rule_context_get_rank_rule (re->context, re->current, re->current->source), 0);
+ rule_editor_add_undo(re, RULE_EDITOR_LOG_REMOVE, re->current, rule_context_get_rank_rule(re->context, re->current, re->current->source), 0);
#if 0
- g_object_unref (re->current);
+ gtk_object_unref (GTK_OBJECT (re->current));
#endif
re->current = NULL;
/* now select the next rule */
- len = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (re->model), NULL);
+ len = g_list_length (GTK_LIST (re->list)->children);
pos = pos >= len ? len - 1 : pos;
-
- path = gtk_tree_path_new ();
- gtk_tree_path_append_index (path, pos);
- gtk_tree_model_get_iter (GTK_TREE_MODEL (re->model), &iter, path);
- gtk_tree_path_free (path);
-
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (re->list));
- gtk_tree_selection_select_iter (selection, &iter);
+ gtk_list_select_item (GTK_LIST (re->list), pos);
}
rule_editor_set_sensitive (re);
@@ -417,30 +439,20 @@ rule_delete (GtkWidget *widget, RuleEditor *re)
static void
rule_move (RuleEditor *re, int from, int to)
{
- GtkTreeSelection *selection;
- GtkTreePath *path;
- GtkTreeIter iter;
- FilterRule *rule;
-
- g_object_ref (re->current);
- rule_editor_add_undo (re, RULE_EDITOR_LOG_RANK, re->current,
- rule_context_get_rank_rule (re->context, re->current, re->current->source), to);
+ GList *l;
+ GtkListItem *item;
+
+ gtk_object_ref((GtkObject *)re->current);
+ rule_editor_add_undo(re, RULE_EDITOR_LOG_RANK, re->current, rule_context_get_rank_rule(re->context, re->current, re->current->source), to);
d(printf ("moving %d to %d\n", from, to));
rule_context_rank_rule (re->context, re->current, to);
- path = gtk_tree_path_new ();
- gtk_tree_path_append_index (path, from);
- gtk_tree_model_get_iter (GTK_TREE_MODEL (re->model), &iter, path);
- gtk_tree_path_free (path);
-
- gtk_tree_model_get (GTK_TREE_MODEL (re->model), &iter, 1, &rule, -1);
- g_assert (rule != NULL);
-
- gtk_list_store_remove (re->model, &iter);
- gtk_list_store_insert (re->model, &iter, to);
-
- gtk_list_store_set (re->model, &iter, 0, rule->name, 1, rule, -1);
+ item = g_list_nth_data (re->list->children, from);
+ l = g_list_append (NULL, item);
+ gtk_list_remove_items_no_unref (re->list, l);
+ gtk_list_insert_items (re->list, l, to);
+ gtk_list_select_child (re->list, GTK_WIDGET (item));
rule_editor_set_sensitive (re);
}
@@ -471,11 +483,11 @@ static struct {
char *name;
GtkSignalFunc func;
} edit_buttons[] = {
- { "rule_add", G_CALLBACK (rule_add) },
- { "rule_edit", G_CALLBACK (rule_edit) },
- { "rule_delete", G_CALLBACK (rule_delete) },
- { "rule_up", G_CALLBACK (rule_up) },
- { "rule_down", G_CALLBACK (rule_down) },
+ { "rule_add", rule_add },
+ { "rule_edit", rule_edit },
+ { "rule_delete", rule_delete },
+ { "rule_up", rule_up },
+ { "rule_down", rule_down },
};
static void
@@ -484,7 +496,7 @@ set_sensitive (RuleEditor *re)
FilterRule *rule = NULL;
int index = -1, count = 0;
- while ((rule = rule_context_next_rule (re->context, rule, re->source))) {
+ while ((rule = rule_context_next_rule(re->context, rule, re->source))) {
if (rule == re->current)
index = count;
count++;
@@ -502,17 +514,9 @@ set_sensitive (RuleEditor *re)
static void
-cursor_changed (GtkWidget *list, RuleEditor *re)
+select_rule (GtkWidget *w, GtkWidget *child, RuleEditor *re)
{
- GtkTreeViewColumn *column;
- GtkTreePath *path;
- GtkTreeIter iter;
-
- gtk_tree_view_get_cursor (re->list, &path, &column);
- gtk_tree_model_get_iter (GTK_TREE_MODEL (re->model), &iter, path);
- gtk_tree_path_free (path);
-
- gtk_tree_model_get (GTK_TREE_MODEL (re->model), &iter, 1, &re->current, -1);
+ re->current = gtk_object_get_data (GTK_OBJECT (child), "rule");
g_assert (re->current);
@@ -532,17 +536,25 @@ static void
set_source (RuleEditor *re, const char *source)
{
FilterRule *rule = NULL;
- GtkTreeIter iter;
+ GList *newitems = NULL;
- gtk_list_store_clear (re->model);
+ gtk_list_clear_items(GTK_LIST(re->list), 0, -1);
d(printf("Checking for rules that are of type %s\n", source?source:"<nil>"));
- while ((rule = rule_context_next_rule (re->context, rule, source)) != NULL) {
- d(printf("Adding row '%s'\n", rule->name));
- gtk_list_store_append (re->model, &iter);
- gtk_list_store_set (re->model, &iter, 0, rule->name, 1, rule, -1);
+ while ((rule = rule_context_next_rule(re->context, rule, source)) != NULL) {
+ GtkWidget *item;
+ char *s;
+
+ d(printf(" hit %s(%s)\n", rule->name, source?source:"<nil>"));
+ s = e_utf8_to_gtk_string (GTK_WIDGET (re->list), rule->name);
+ item = gtk_list_item_new_with_label (s);
+ g_free (s);
+ gtk_object_set_data (GTK_OBJECT (item), "rule", rule);
+ gtk_widget_show (GTK_WIDGET (item));
+ newitems = g_list_append (newitems, item);
}
+ gtk_list_append_items (re->list, newitems);
g_free (re->source);
re->source = g_strdup (source);
re->current = NULL;
@@ -550,30 +562,30 @@ set_source (RuleEditor *re, const char *source)
}
void
-rule_editor_add_undo (RuleEditor *re, int type, FilterRule *rule, int rank, int newrank)
+rule_editor_add_undo(RuleEditor *re, int type, FilterRule *rule, int rank, int newrank)
{
RuleEditorUndo *undo;
-
+
if (!re->undo_active && enable_undo) {
- undo = g_malloc0 (sizeof (*undo));
+ undo = g_malloc0(sizeof(*undo));
undo->rule = rule;
undo->type = type;
undo->rank = rank;
undo->newrank = newrank;
-
+
undo->next = re->undo_log;
re->undo_log = undo;
} else {
- g_object_unref (rule);
+ gtk_object_unref((GtkObject *)rule);
}
}
void
-rule_editor_play_undo (RuleEditor *re)
+rule_editor_play_undo(RuleEditor *re)
{
RuleEditorUndo *undo, *next;
FilterRule *rule;
-
+
re->undo_active = TRUE;
undo = re->undo_log;
re->undo_log = NULL;
@@ -599,7 +611,7 @@ rule_editor_play_undo (RuleEditor *re)
break;
case RULE_EDITOR_LOG_REMOVE:
printf("Undoing remove on rule '%s'\n", undo->rule->name);
- g_object_ref (undo->rule);
+ gtk_object_ref((GtkObject *)undo->rule);
rule_context_add_rule(re->context, undo->rule);
rule_context_rank_rule(re->context, undo->rule, undo->rank);
break;
@@ -609,7 +621,7 @@ rule_editor_play_undo (RuleEditor *re)
rule_context_rank_rule(re->context, rule, undo->rank);
break;
}
- g_object_unref (undo->rule);
+ gtk_object_unref((GtkObject *)undo->rule);
g_free(undo);
undo = next;
}
@@ -617,20 +629,20 @@ rule_editor_play_undo (RuleEditor *re)
}
static void
-editor_response (GtkWidget *dialog, int button, RuleEditor *re)
+editor_clicked (GtkWidget *dialog, int button, RuleEditor *re)
{
- if (button == GTK_RESPONSE_REJECT) {
+ if (button != 0) {
if (enable_undo)
- rule_editor_play_undo (re);
+ rule_editor_play_undo(re);
else {
RuleEditorUndo *undo, *next;
-
+
undo = re->undo_log;
re->undo_log = 0;
while (undo) {
next = undo->next;
- g_object_unref (undo->rule);
- g_free (undo);
+ gtk_object_unref((GtkObject *)undo->rule);
+ g_free(undo);
undo = next;
}
}
@@ -640,42 +652,33 @@ editor_response (GtkWidget *dialog, int button, RuleEditor *re)
void
rule_editor_construct (RuleEditor *re, RuleContext *context, GladeXML *gui, const char *source)
{
- GtkTreeSelection *selection;
GtkWidget *w;
int i;
re->context = context;
- g_object_ref (context);
+ gtk_object_ref (GTK_OBJECT (context));
gtk_window_set_policy (GTK_WINDOW (re), FALSE, TRUE, FALSE);
w = glade_xml_get_widget (gui, "rule_editor");
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (re)->vbox), w, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (re)->vbox), w, TRUE, TRUE, 0);
for (i = 0; i < BUTTON_LAST; i++) {
- re->priv->buttons[i] = (GtkButton *) w = glade_xml_get_widget (gui, edit_buttons[i].name);
- g_signal_connect (w, "clicked", edit_buttons[i].func, re);
+ re->priv->buttons[i] = (GtkButton *)w = glade_xml_get_widget (gui, edit_buttons[i].name);
+ gtk_signal_connect (GTK_OBJECT (w), "clicked", edit_buttons[i].func, re);
}
- re->model = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_POINTER);
- re->list = (GtkTreeView *) glade_xml_get_widget (gui, "rule_list");
- gtk_tree_view_set_model (re->list, (GtkTreeModel *) re->model);
- gtk_tree_view_insert_column_with_attributes(re->list, -1, _("Rule(s)"),
- gtk_cell_renderer_text_new(),
- "text", 0,
- NULL);
- selection = gtk_tree_view_get_selection (re->list);
- gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
-
- g_signal_connect (re->list, "cursor-changed", G_CALLBACK (cursor_changed), re);
- g_signal_connect (re->list, "button_press_event", G_CALLBACK (double_click), re);
-
- g_signal_connect (re, "response", G_CALLBACK(editor_response), re);
+ re->list = (GtkList *) w = glade_xml_get_widget(gui, "rule_list");
+ gtk_signal_connect (GTK_OBJECT (w), "select_child", select_rule, re);
+ gtk_signal_connect (GTK_OBJECT (w), "button_press_event",
+ GTK_SIGNAL_FUNC (double_click), re);
+
+ gtk_signal_connect (GTK_OBJECT (re), "clicked", editor_clicked, re);
rule_editor_set_source (re, source);
-
+
if (enable_undo) {
- gtk_dialog_add_buttons ((GtkDialog *) re, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
- GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, NULL);
+ gnome_dialog_append_buttons (GNOME_DIALOG (re), GNOME_STOCK_BUTTON_OK,
+ GNOME_STOCK_BUTTON_CANCEL, NULL);
} else
- gtk_dialog_add_buttons ((GtkDialog *) re, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL);
+ gnome_dialog_append_buttons (GNOME_DIALOG (re), GNOME_STOCK_BUTTON_OK, NULL);
}
diff --git a/help/C/Makefile.am b/help/C/Makefile.am
index c8d1c15c81..3e13cdce11 100644
--- a/help/C/Makefile.am
+++ b/help/C/Makefile.am
@@ -29,29 +29,28 @@ figs = \
figures/small_desktop.png \
figures/summary.png \
figures/vfolder-createrule-fig.png
-figdir = figures
+
docname = evolution
lang = C
omffile = evolution-C.omf
-entities = \
- apx-authors.xml \
- apx-bugs.xml \
- apx-fdl.xml \
- apx-gloss.xml \
- apx-gpl.xml \
- config-prefs.xml \
- config-sync.xml \
- legal.xml \
- menuref.xml \
- preface.xml \
- usage-calendar.xml \
- usage-contact.xml \
- usage-exec-summary.xml \
- usage-exchange.xml \
- usage-mail-org.xml \
- usage-mail.xml \
- usage-mainwindow.xml \
- usage-print.xml \
- usage-sync.xml \
-include $(top_srcdir)/help/xmldocs.make
+sgml_ents = \
+ apx-authors.sgml \
+ apx-bugs.sgml \
+ apx-gloss.sgml \
+ apx-fdl.sgml \
+ apx-gpl.sgml \
+ config-prefs.sgml \
+ config-sync.sgml \
+ menuref.sgml \
+ preface.sgml \
+ usage-calendar.sgml \
+ usage-contact.sgml \
+ usage-exec-summary.sgml \
+ usage-exchange.sgml \
+ usage-mail-org.sgml \
+ usage-mail.sgml \
+ usage-mainwindow.sgml \
+ usage-print.sgml \
+ usage-sync.sgml
+include $(top_srcdir)/help/sgmldocs.make
dist-hook: app-dist-hook
diff --git a/help/C/apx-authors.sgml b/help/C/apx-authors.sgml
new file mode 100644
index 0000000000..a09e849b73
--- /dev/null
+++ b/help/C/apx-authors.sgml
@@ -0,0 +1,74 @@
+ <appendix id="authors">
+ <title>Authors</title>
+ <para>
+ <application>Evolution</application> was written by the Ximian
+ Evolution team and numerous other dedicated GNOME programmers.
+ You can see their names by selecting <menuchoice>
+ <guimenu>Help</guimenu> <guimenuitem>About</guimenuitem>
+ </menuchoice> from any Evolution window.
+ </para>
+ <para>
+ The <application>Evolution</application> code owes a great debt
+ to the <application>GNOME-pim</application> and
+ <application>GNOME-Calendar</application> applications, and to
+ <application>KHTMLW</application>. The developers of
+ <application>Evolution</application> acknowledge the efforts
+ and contributions of all who worked on those projects.
+ </para>
+
+ <para>
+ Ximian would like to thank everyone who helped out with the bug
+ tracking process, particularly Miles Lane, and also the staff of
+ El Pelon Taqueria, on Peterborough St. in Boston, for
+ sustenance.
+ </para>
+
+ <para>
+ For more information please visit the
+ <application>Evolution</application> <ulink
+ url="http://www.ximian.com/products/evolution/"
+ type="http">Web page</ulink>. Please send all comments,
+ suggestions, and bug reports to the <ulink
+ url="http://bugzilla.ximian.com" type="http">Ximian bug tracking
+ database</ulink>. Instructions for submitting bug reports can be
+ found on-line at the same location. You can also use the GNOME
+ bug report tool, <command>bug-buddy</command>, to submit your
+ defect reports.
+ </para>
+ <para>
+ This manual was written by Aaron Weber
+ (<email>aaron@ximian.com</email>), Kevin Breit
+ (<email>mrproper@ximian.com</email>) Duncan Mak
+ (<email>duncan@ximian.com</email>) and Ettore Perazzoli
+ (<email>ettore@ximian.com</email>) with the help of the
+ application programmers and the GNOME Documentation Project.
+ Please file comments and suggestions for this manual as bugs in
+ the Ximian bug tracking system. If you contributed to this
+ project but do not see your name here, please contact Aaron
+ Weber (<email>aaron@ximian.com</email>) and he'll list you. The
+ list of translators, in particular, is lacking numerous
+ contributors.
+ </para>
+ <para>
+ This product has been translated into many languages. Some of
+ the translators are listed here:
+ <itemizedlist>
+ <listitem><para>
+ Daniel Persson for .se
+ </para></listitem>
+
+ <listitem><para>
+ Hector Garcia Alvarez for .es
+ </para></listitem>
+
+ <listitem><para>
+ Kjartan Maraas for .no
+ </para></listitem>
+ </itemizedlist>
+ </para>
+ </appendix>
+
+
+
+
+
diff --git a/help/C/apx-fdl.sgml b/help/C/apx-fdl.sgml
new file mode 100644
index 0000000000..4af2a495fa
--- /dev/null
+++ b/help/C/apx-fdl.sgml
@@ -0,0 +1,667 @@
+<!--
+ The GNU Free Documentation License 1.1 in DocBook
+ Markup by Eric Baudais <baudais@okstate.edu>
+ Maintained by the GNOME Documentation Project
+ http://developer.gnome.org/projects/gdp
+ Version: 1.0.1
+ Last Modified: Nov 16, 2000
+-->
+
+<appendix id="apx-fdl">
+ <appendixinfo>
+ <releaseinfo>
+ Version 1.1, March 2000
+ </releaseinfo>
+ <copyright>
+ <year>2000</year><holder>Free Software Foundation, Inc.</holder>
+ </copyright>
+ <legalnotice id="fdl-legalnotice">
+ <para>
+ <address>Free Software Foundation, Inc. <street>59 Temple Place,
+ Suite 330</street>, <city>Boston</city>, <state>MA</state>
+ <postcode>02111-1307</postcode> <country>USA</country></address>
+ Everyone is permitted to copy and distribute verbatim copies of this
+ license document, but changing it is not allowed.
+ </para>
+ </legalnotice>
+ </appendixinfo>
+ <title>GNU Free Documentation License</title>
+
+ <sect1 id="fdl-preamble">
+ <title>0. PREAMBLE</title>
+ <para>
+ The purpose of this License is to make a manual, textbook, or
+ other written document <quote>free</quote> in the sense of
+ freedom: to assure everyone the effective freedom to copy and
+ redistribute it, with or without modifying it, either
+ commercially or noncommercially. Secondarily, this License
+ preserves for the author and publisher a way to get credit for
+ their work, while not being considered responsible for
+ modifications made by others.
+ </para>
+
+ <para>
+ This License is a kind of <quote>copyleft</quote>, which means
+ that derivative works of the document must themselves be free in
+ the same sense. It complements the GNU General Public License,
+ which is a copyleft license designed for free software.
+ </para>
+
+ <para>
+ We have designed this License in order to use it for manuals for
+ free software, because free software needs free documentation: a
+ free program should come with manuals providing the same
+ freedoms that the software does. But this License is not limited
+ to software manuals; it can be used for any textual work,
+ regardless of subject matter or whether it is published as a
+ printed book. We recommend this License principally for works
+ whose purpose is instruction or reference.
+ </para>
+ </sect1>
+ <sect1 id="fdl-section1">
+ <title>1. APPLICABILITY AND DEFINITIONS</title>
+ <para id="fdl-document">
+ This License applies to any manual or other work that contains a
+ notice placed by the copyright holder saying it can be
+ distributed under the terms of this License. The
+ <quote>Document</quote>, below, refers to any such manual or
+ work. Any member of the public is a licensee, and is addressed
+ as <quote>you</quote>.
+ </para>
+
+ <para id="fdl-modified">
+ A <quote>Modified Version</quote> of the Document means any work
+ containing the Document or a portion of it, either copied
+ verbatim, or with modifications and/or translated into another
+ language.
+ </para>
+
+ <para id="fdl-secondary">
+ A <quote>Secondary Section</quote> is a named appendix or a
+ front-matter section of the <link
+ linkend="fdl-document">Document</link> that deals exclusively
+ with the relationship of the publishers or authors of the
+ Document to the Document's overall subject (or to related
+ matters) and contains nothing that could fall directly within
+ that overall subject. (For example, if the Document is in part a
+ textbook of mathematics, a Secondary Section may not explain any
+ mathematics.) The relationship could be a matter of historical
+ connection with the subject or with related matters, or of
+ legal, commercial, philosophical, ethical or political position
+ regarding them.
+ </para>
+
+ <para id="fdl-invariant">
+ The <quote>Invariant Sections</quote> are certain <link
+ linkend="fdl-secondary"> Secondary Sections</link> whose titles
+ are designated, as being those of Invariant Sections, in the
+ notice that says that the <link
+ linkend="fdl-document">Document</link> is released under this
+ License.
+ </para>
+
+ <para id="fdl-cover-texts">
+ The <quote>Cover Texts</quote> are certain short passages of
+ text that are listed, as Front-Cover Texts or Back-Cover Texts,
+ in the notice that says that the <link
+ linkend="fdl-document">Document</link> is released under this
+ License.
+ </para>
+
+ <para id="fdl-transparent">
+ A <quote>Transparent</quote> copy of the <link
+ linkend="fdl-document"> Document</link> means a machine-readable
+ copy, represented in a format whose specification is available
+ to the general public, whose contents can be viewed and edited
+ directly and straightforwardly with generic text editors or (for
+ images composed of pixels) generic paint programs or (for
+ drawings) some widely available drawing editor, and that is
+ suitable for input to text formatters or for automatic
+ translation to a variety of formats suitable for input to text
+ formatters. A copy made in an otherwise Transparent file format
+ whose markup has been designed to thwart or discourage
+ subsequent modification by readers is not Transparent. A copy
+ that is not <quote>Transparent</quote> is called
+ <quote>Opaque</quote>.
+ </para>
+
+ <para>
+ Examples of suitable formats for Transparent copies include
+ plain ASCII without markup, Texinfo input format, LaTeX input
+ format, SGML or XML using a publicly available DTD, and
+ standard-conforming simple HTML designed for human
+ modification. Opaque formats include PostScript, PDF,
+ proprietary formats that can be read and edited only by
+ proprietary word processors, SGML or XML for which the DTD
+ and/or processing tools are not generally available, and the
+ machine-generated HTML produced by some word processors for
+ output purposes only.
+ </para>
+
+ <para id="fdl-title-page">
+ The <quote>Title Page</quote> means, for a printed book, the
+ title page itself, plus such following pages as are needed to
+ hold, legibly, the material this License requires to appear in
+ the title page. For works in formats which do not have any title
+ page as such, <quote>Title Page</quote> means the text near the
+ most prominent appearance of the work's title, preceding the
+ beginning of the body of the text.
+ </para>
+ </sect1>
+
+ <sect1 id="fdl-section2">
+ <title>2. VERBATIM COPYING</title>
+ <para>
+ You may copy and distribute the <link
+ linkend="fdl-document">Document</link> in any medium, either
+ commercially or noncommercially, provided that this License, the
+ copyright notices, and the license notice saying this License
+ applies to the Document are reproduced in all copies, and that
+ you add no other conditions whatsoever to those of this
+ License. You may not use technical measures to obstruct or
+ control the reading or further copying of the copies you make or
+ distribute. However, you may accept compensation in exchange for
+ copies. If you distribute a large enough number of copies you
+ must also follow the conditions in <link
+ linkend="fdl-section3">section 3</link>.
+ </para>
+
+ <para>
+ You may also lend copies, under the same conditions stated
+ above, and you may publicly display copies.
+ </para>
+ </sect1>
+
+ <sect1 id="fdl-section3">
+ <title>3. COPYING IN QUANTITY</title>
+ <para>
+ If you publish printed copies of the <link
+ linkend="fdl-document">Document</link> numbering more than 100,
+ and the Document's license notice requires <link
+ linkend="fdl-cover-texts">Cover Texts</link>, you must enclose
+ the copies in covers that carry, clearly and legibly, all these
+ Cover Texts: Front-Cover Texts on the front cover, and
+ Back-Cover Texts on the back cover. Both covers must also
+ clearly and legibly identify you as the publisher of these
+ copies. The front cover must present the full title with all
+ words of the title equally prominent and visible. You may add
+ other material on the covers in addition. Copying with changes
+ limited to the covers, as long as they preserve the title of the
+ <link linkend="fdl-document">Document</link> and satisfy these
+ conditions, can be treated as verbatim copying in other
+ respects.
+ </para>
+
+ <para>
+ If the required texts for either cover are too voluminous to fit
+ legibly, you should put the first ones listed (as many as fit
+ reasonably) on the actual cover, and continue the rest onto
+ adjacent pages.
+ </para>
+
+ <para>
+ If you publish or distribute <link
+ linkend="fdl-transparent">Opaque</link> copies of the <link
+ linkend="fdl-document">Document</link> numbering more than 100,
+ you must either include a machine-readable <link
+ linkend="fdl-transparent">Transparent</link> copy along with
+ each Opaque copy, or state in or with each Opaque copy a
+ publicly-accessible computer-network location containing a
+ complete Transparent copy of the Document, free of added
+ material, which the general network-using public has access to
+ download anonymously at no charge using public-standard network
+ protocols. If you use the latter option, you must take
+ reasonably prudent steps, when you begin distribution of Opaque
+ copies in quantity, to ensure that this Transparent copy will
+ remain thus accessible at the stated location until at least one
+ year after the last time you distribute an Opaque copy (directly
+ or through your agents or retailers) of that edition to the
+ public.
+ </para>
+
+ <para>
+ It is requested, but not required, that you contact the authors
+ of the <link linkend="fdl-document">Document</link> well before
+ redistributing any large number of copies, to give them a chance
+ to provide you with an updated version of the Document.
+ </para>
+ </sect1>
+
+ <sect1 id="fdl-section4">
+ <title>4. MODIFICATIONS</title>
+ <para>
+ You may copy and distribute a <link
+ linkend="fdl-modified">Modified Version</link> of the <link
+ linkend="fdl-document">Document</link> under the conditions of
+ sections <link linkend="fdl-section2">2</link> and <link
+ linkend="fdl-section3">3</link> above, provided that you release
+ the Modified Version under precisely this License, with the
+ Modified Version filling the role of the Document, thus
+ licensing distribution and modification of the Modified Version
+ to whoever possesses a copy of it. In addition, you must do
+ these things in the Modified Version:
+ </para>
+
+ <itemizedlist mark="opencircle">
+ <listitem>
+ <formalpara>
+ <title>A</title>
+ <para>
+ Use in the <link linkend="fdl-title-page">Title
+ Page</link> (and on the covers, if any) a title distinct
+ from that of the <link
+ linkend="fdl-document">Document</link>, and from those of
+ previous versions (which should, if there were any, be
+ listed in the History section of the Document). You may
+ use the same title as a previous version if the original
+ publisher of that version gives permission.
+ </para>
+ </formalpara>
+ </listitem>
+
+ <listitem>
+ <formalpara>
+ <title>B</title>
+ <para>
+ List on the <link linkend="fdl-title-page">Title
+ Page</link>, as authors, one or more persons or entities
+ responsible for authorship of the modifications in the
+ <link linkend="fdl-modified">Modified Version</link>,
+ together with at least five of the principal authors of
+ the <link linkend="fdl-document">Document</link> (all of
+ its principal authors, if it has less than five).
+ </para>
+ </formalpara>
+ </listitem>
+
+ <listitem>
+ <formalpara>
+ <title>C</title>
+ <para>
+ State on the <link linkend="fdl-title-page">Title
+ Page</link> the name of the publisher of the <link
+ linkend="fdl-modified">Modified Version</link>, as the
+ publisher.
+ </para>
+ </formalpara>
+ </listitem>
+
+ <listitem>
+ <formalpara>
+ <title>D</title>
+ <para>
+ Preserve all the copyright notices of the <link
+ linkend="fdl-document">Document</link>.
+ </para>
+ </formalpara>
+ </listitem>
+
+ <listitem>
+ <formalpara>
+ <title>E</title>
+ <para>
+ Add an appropriate copyright notice for your modifications
+ adjacent to the other copyright notices.
+ </para>
+ </formalpara>
+ </listitem>
+
+ <listitem>
+ <formalpara>
+ <title>F</title>
+ <para>
+ Include, immediately after the copyright notices, a
+ license notice giving the public permission to use the
+ <link linkend="fdl-modified">Modified Version</link> under
+ the terms of this License, in the form shown in the
+ Addendum below.
+ </para>
+ </formalpara>
+ </listitem>
+
+ <listitem>
+ <formalpara>
+ <title>G</title>
+ <para>
+ Preserve in that license notice the full lists of <link
+ linkend="fdl-invariant"> Invariant Sections</link> and
+ required <link linkend="fdl-cover-texts">Cover
+ Texts</link> given in the <link
+ linkend="fdl-document">Document's</link> license notice.
+ </para>
+ </formalpara>
+ </listitem>
+
+ <listitem>
+ <formalpara>
+ <title>H</title>
+ <para>
+ Include an unaltered copy of this License.
+ </para>
+ </formalpara>
+ </listitem>
+
+ <listitem>
+ <formalpara>
+ <title>I</title>
+ <para>
+ Preserve the section entitled <quote>History</quote>, and
+ its title, and add to it an item stating at least the
+ title, year, new authors, and publisher of the <link
+ linkend="fdl-modified">Modified Version </link>as given on
+ the <link linkend="fdl-title-page">Title Page</link>. If
+ there is no section entitled <quote>History</quote> in the
+ <link linkend="fdl-document">Document</link>, create one
+ stating the title, year, authors, and publisher of the
+ Document as given on its Title Page, then add an item
+ describing the Modified Version as stated in the previous
+ sentence.
+ </para>
+ </formalpara>
+ </listitem>
+
+ <listitem>
+ <formalpara>
+ <title>J</title>
+ <para>
+ Preserve the network location, if any, given in the <link
+ linkend="fdl-document">Document</link> for public access
+ to a <link linkend="fdl-transparent">Transparent</link>
+ copy of the Document, and likewise the network locations
+ given in the Document for previous versions it was based
+ on. These may be placed in the <quote>History</quote>
+ section. You may omit a network location for a work that
+ was published at least four years before the Document
+ itself, or if the original publisher of the version it
+ refers to gives permission.
+ </para>
+ </formalpara>
+ </listitem>
+
+ <listitem>
+ <formalpara>
+ <title>K</title>
+ <para>
+ In any section entitled <quote>Acknowledgements</quote> or
+ <quote>Dedications</quote>, preserve the section's title,
+ and preserve in the section all the substance and tone of
+ each of the contributor acknowledgements and/or
+ dedications given therein.
+ </para>
+ </formalpara>
+ </listitem>
+
+ <listitem>
+ <formalpara>
+ <title>L</title>
+ <para>
+ Preserve all the <link linkend="fdl-invariant">Invariant
+ Sections</link> of the <link
+ linkend="fdl-document">Document</link>, unaltered in their
+ text and in their titles. Section numbers or the
+ equivalent are not considered part of the section titles.
+ </para>
+ </formalpara>
+ </listitem>
+
+ <listitem>
+ <formalpara>
+ <title>M</title>
+ <para>
+ Delete any section entitled
+ <quote>Endorsements</quote>. Such a section may not be
+ included in the <link linkend="fdl-modified">Modified
+ Version</link>.
+ </para>
+ </formalpara>
+ </listitem>
+
+ <listitem>
+ <formalpara>
+ <title>N</title>
+ <para>
+ Do not retitle any existing section as
+ <quote>Endorsements</quote> or to conflict in title with
+ any <link linkend="fdl-invariant">Invariant
+ Section</link>.
+ </para>
+ </formalpara>
+ </listitem>
+ </itemizedlist>
+
+ <para>
+ If the <link linkend="fdl-modified">Modified Version</link>
+ includes new front-matter sections or appendices that qualify as
+ <link linkend="fdl-secondary">Secondary Sections</link> and
+ contain no material copied from the Document, you may at your
+ option designate some or all of these sections as invariant. To
+ do this, add their titles to the list of <link
+ linkend="fdl-invariant">Invariant Sections</link> in the
+ Modified Version's license notice. These titles must be
+ distinct from any other section titles.
+ </para>
+
+ <para>
+ You may add a section entitled <quote>Endorsements</quote>,
+ provided it contains nothing but endorsements of your <link
+ linkend="fdl-modified">Modified Version</link> by various
+ parties--for example, statements of peer review or that the text
+ has been approved by an organization as the authoritative
+ definition of a standard.
+ </para>
+
+ <para>
+ You may add a passage of up to five words as a <link
+ linkend="fdl-cover-texts">Front-Cover Text</link>, and a passage
+ of up to 25 words as a <link
+ linkend="fdl-cover-texts">Back-Cover Text</link>, to the end of
+ the list of <link linkend="fdl-cover-texts">Cover Texts</link>
+ in the <link linkend="fdl-modified">Modified Version</link>.
+ Only one passage of Front-Cover Text and one of Back-Cover Text
+ may be added by (or through arrangements made by) any one
+ entity. If the <link linkend="fdl-document">Document</link>
+ already includes a cover text for the same cover, previously
+ added by you or by arrangement made by the same entity you are
+ acting on behalf of, you may not add another; but you may
+ replace the old one, on explicit permission from the previous
+ publisher that added the old one.
+ </para>
+
+ <para>
+ The author(s) and publisher(s) of the <link
+ linkend="fdl-document">Document</link> do not by this License
+ give permission to use their names for publicity for or to
+ assert or imply endorsement of any <link
+ linkend="fdl-modified">Modified Version </link>.
+ </para>
+ </sect1>
+
+ <sect1 id="fdl-section5">
+ <title>5. COMBINING DOCUMENTS</title>
+ <para>
+ You may combine the <link linkend="fdl-document">Document</link>
+ with other documents released under this License, under the
+ terms defined in <link linkend="fdl-section4">section 4</link>
+ above for modified versions, provided that you include in the
+ combination all of the <link linkend="fdl-invariant">Invariant
+ Sections</link> of all of the original documents, unmodified,
+ and list them all as Invariant Sections of your combined work in
+ its license notice.
+ </para>
+
+ <para>
+ The combined work need only contain one copy of this License,
+ and multiple identical <link linkend="fdl-invariant">Invariant
+ Sections</link> may be replaced with a single copy. If there are
+ multiple Invariant Sections with the same name but different
+ contents, make the title of each such section unique by adding
+ at the end of it, in parentheses, the name of the original
+ author or publisher of that section if known, or else a unique
+ number. Make the same adjustment to the section titles in the
+ list of Invariant Sections in the license notice of the combined
+ work.
+ </para>
+
+ <para>
+ In the combination, you must combine any sections entitled
+ <quote>History</quote> in the various original documents,
+ forming one section entitled <quote>History</quote>; likewise
+ combine any sections entitled <quote>Acknowledgements</quote>,
+ and any sections entitled <quote>Dedications</quote>. You must
+ delete all sections entitled <quote>Endorsements.</quote>
+ </para>
+ </sect1>
+
+ <sect1 id="fdl-section6">
+ <title>6. COLLECTIONS OF DOCUMENTS</title>
+ <para>
+ You may make a collection consisting of the <link
+ linkend="fdl-document">Document</link> and other documents
+ released under this License, and replace the individual copies
+ of this License in the various documents with a single copy that
+ is included in the collection, provided that you follow the
+ rules of this License for verbatim copying of each of the
+ documents in all other respects.
+ </para>
+
+ <para>
+ You may extract a single document from such a collection, and
+ dispbibute it individually under this License, provided you
+ insert a copy of this License into the extracted document, and
+ follow this License in all other respects regarding verbatim
+ copying of that document.
+ </para>
+ </sect1>
+
+ <sect1 id="fdl-section7">
+ <title>7. AGGREGATION WITH INDEPENDENT WORKS</title>
+ <para>
+ A compilation of the <link
+ linkend="fdl-document">Document</link> or its derivatives with
+ other separate and independent documents or works, in or on a
+ volume of a storage or distribution medium, does not as a whole
+ count as a <link linkend="fdl-modified">Modified Version</link>
+ of the Document, provided no compilation copyright is claimed
+ for the compilation. Such a compilation is called an
+ <quote>aggregate</quote>, and this License does not apply to the
+ other self-contained works thus compiled with the Document , on
+ account of their being thus compiled, if they are not themselves
+ derivative works of the Document. If the <link
+ linkend="fdl-cover-texts">Cover Text</link> requirement of <link
+ linkend="fdl-section3">section 3</link> is applicable to these
+ copies of the Document, then if the Document is less than one
+ quarter of the entire aggregate, the Document's Cover Texts may
+ be placed on covers that surround only the Document within the
+ aggregate. Otherwise they must appear on covers around the whole
+ aggregate.
+ </para>
+ </sect1>
+
+ <sect1 id="fdl-section8">
+ <title>8. TRANSLATION</title>
+ <para>
+ Translation is considered a kind of modification, so you may
+ distribute translations of the <link
+ linkend="fdl-document">Document</link> under the terms of <link
+ linkend="fdl-section4">section 4</link>. Replacing <link
+ linkend="fdl-invariant"> Invariant Sections</link> with
+ translations requires special permission from their copyright
+ holders, but you may include translations of some or all
+ Invariant Sections in addition to the original versions of these
+ Invariant Sections. You may include a translation of this
+ License provided that you also include the original English
+ version of this License. In case of a disagreement between the
+ translation and the original English version of this License,
+ the original English version will prevail.
+ </para>
+ </sect1>
+
+ <sect1 id="fdl-section9">
+ <title>9. TERMINATION</title>
+ <para>
+ You may not copy, modify, sublicense, or distribute the <link
+ linkend="fdl-document">Document</link> except as expressly
+ provided for under this License. Any other attempt to copy,
+ modify, sublicense or distribute the Document is void, and will
+ automatically terminate your rights under this License. However,
+ parties who have received copies, or rights, from you under this
+ License will not have their licenses terminated so long as such
+ parties remain in full compliance.
+ </para>
+ </sect1>
+
+ <sect1 id="fdl-section10">
+ <title>10. FUTURE REVISIONS OF THIS LICENSE</title>
+ <para>
+ The <ulink type="http"
+ url="http://www.gnu.org/fsf/fsf.html">Free Software
+ Foundation</ulink> may publish new, revised versions of the GNU
+ Free Documentation License from time to time. Such new versions
+ will be similar in spirit to the present version, but may differ
+ in detail to address new problems or concerns. See <ulink
+ type="http"
+ url="http://www.gnu.org/copyleft">http://www.gnu.org/copyleft/</ulink>.
+ </para>
+
+ <para>
+ Each version of the License is given a distinguishing version
+ number. If the <link linkend="fdl-document">Document</link>
+ specifies that a particular numbered version of this License
+ <quote>or any later version</quote> applies to it, you have the
+ option of following the terms and conditions either of that
+ specified version or of any later version that has been
+ published (not as a draft) by the Free Software Foundation. If
+ the Document does not specify a version number of this License,
+ you may choose any version ever published (not as a draft) by
+ the Free Software Foundation.
+ </para>
+ </sect1>
+
+ <sect1 id="fdl-using">
+ <title>Addendum</title>
+ <para>
+ To use this License in a document you have written, include a copy of
+ the License in the document and put the following copyright and
+ license notices just after the title page:
+ </para>
+
+ <blockquote>
+ <para>
+ Copyright YEAR YOUR NAME.
+ </para>
+ <para>
+ Permission is granted to copy, distribute and/or modify this
+ document under the terms of the GNU Free Documentation
+ License, Version 1.1 or any later version published by the
+ Free Software Foundation; with the <link
+ linkend="fdl-invariant">Invariant Sections</link> being LIST
+ THEIR TITLES, with the <link
+ linkend="fdl-cover-texts">Front-Cover Texts</link> being LIST,
+ and with the <link linkend="fdl-cover-texts">Back-Cover
+ Texts</link> being LIST. A copy of the license is included in
+ the section entitled <quote>GNU Free Documentation
+ License</quote>.
+ </para>
+ </blockquote>
+
+ <para>
+ If you have no <link linkend="fdl-invariant">Invariant
+ Sections</link>, write <quote>with no Invariant Sections</quote>
+ instead of saying which ones are invariant. If you have no
+ <link linkend="fdl-cover-texts">Front-Cover Texts</link>, write
+ <quote>no Front-Cover Texts</quote> instead of
+ <quote>Front-Cover Texts being LIST</quote>; likewise for <link
+ linkend="fdl-cover-texts">Back-Cover Texts</link>.
+ </para>
+
+ <para>
+ If your document contains nontrivial examples of program code,
+ we recommend releasing these examples in parallel under your
+ choice of free software license, such as the <ulink type="http"
+ url="http://www.gnu.org/copyleft/gpl.html"> GNU General Public
+ License</ulink>, to permit their use in free software.
+ </para>
+ </sect1>
+</appendix>
+
+
diff --git a/help/C/apx-gpl.sgml b/help/C/apx-gpl.sgml
new file mode 100644
index 0000000000..8404e9ff3c
--- /dev/null
+++ b/help/C/apx-gpl.sgml
@@ -0,0 +1,417 @@
+<appendix id="apx-gpl">
+<title>GNU General Public License</title>
+<para>
+Copyright (c) 2000 Free Software Foundation, Inc.
+ <address>Free Software Foundation, Inc.
+ <street>59 Temple Place, Suite 330</street>,
+ <city>Boston</city>,
+ <state>MA</state> <postcode>02111-1307</postcode>
+ <country>USA</country>
+ </address>.
+ </para>
+
+<para>
+This is version 2
+</para>
+
+ <para>
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+ </para>
+
+
+ <sect1 id="preamble">
+ <title>Preamble</title>
+
+ <para>
+ The licenses for most software are designed to take away your
+ freedom to share and change it. By contrast, the GNU General Public
+ License is intended to guarantee your freedom to share and change
+ free software - to make sure the software is free for all its users.
+ This General Public License applies to most of the Free Software
+ Foundation's software and to any other program whose authors commit
+ to using it. (Some other Free Software Foundation software is covered
+ by the GNU Library General Public License instead.) You can apply it
+ to your programs, too.
+ </para>
+
+ <para>
+ When we speak of free software, we are referring to freedom, not price.
+ Our General Public Licenses are designed to make sure that you have the
+ freedom to distribute copies of free software (and charge for this
+ service if you wish), that you receive source code or can get it if you
+ want it, that you can change the software or use pieces of it in new free
+ programs; and that you know you can do these things.
+ </para>
+
+ <para>
+ To protect your rights, we need to make restrictions that forbid anyone
+ to deny you these rights or to ask you to surrender the rights. These
+ restrictions translate to certain responsibilities for you if you distribute
+ copies of the software, or if you modify it.
+ </para>
+
+ <para>
+ For example, if you distribute copies of such a program, whether gratis or
+ for a fee, you must give the recipients all the rights that you have. You
+ must make sure that they, too, receive or can get the source code. And you
+ must show them these terms so they know their rights.
+ </para>
+
+ <para>
+ We protect your rights with two steps:
+
+ <orderedlist numeration="arabic">
+ <listitem>
+ <para>
+ copyright the software, and
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ offer you this license which gives you legal permission to copy,
+ distribute and/or modify the software.
+ </para>
+ </listitem>
+ </orderedlist>
+ </para>
+
+ <para>
+ Also, for each author's protection and ours, we want to make certain that
+ everyone understands that there is no warranty for this free software. If
+ the software is modified by someone else and passed on, we want its
+ recipients to know that what they have is not the original, so that any
+ problems introduced by others will not reflect on the original authors'
+ reputations.
+ </para>
+
+ <para>
+ Finally, any free program is threatened constantly by software patents.
+ We wish to avoid the danger that redistributors of a free program will
+ individually obtain patent licenses, in effect making the program
+ proprietary. To prevent this, we have made it clear that any patent must be
+ licensed for everyone's free use or not licensed at all.
+ </para>
+
+ <para>
+ The precise terms and conditions for copying, distribution and modification
+ follow.
+ </para>
+
+ </sect1>
+
+ <sect1 id="terms">
+ <title>TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION</title>
+
+ <sect2 id="sect0">
+ <title>Section 0</title>
+ <para>
+ This License applies to any program or other work which contains a notice
+ placed by the copyright holder saying it may be distributed under the terms
+ of this General Public License. The "Program", below, refers to any such
+ program or work, and a <quote>work based on the Program</quote> means either
+ the Program or any derivative work under copyright law: that is to say, a
+ work containing the Program or a portion of it, either verbatim or with
+ modifications and/or translated into another language. (Hereinafter, translation
+ is included without limitation in the term <quote>modification</quote>.) Each
+ licensee is addressed as <quote>you</quote>.
+ </para>
+
+ <para>
+ Activities other than copying, distribution and modification are not covered by
+ this License; they are outside its scope. The act of running the Program is not
+ restricted, and the output from the Program is covered only if its contents
+ constitute a work based on the Program (independent of having been made by running
+ the Program). Whether that is true depends on what the Program does.
+ </para>
+ </sect2>
+
+ <sect2 id="sect1">
+ <title>Section 1</title>
+ <para>
+ You may copy and distribute verbatim copies of the Program's source code as you
+ receive it, in any medium, provided that you conspicuously and appropriately
+ publish on each copy an appropriate copyright notice and disclaimer of warranty;
+ keep intact all the notices that refer to this License and to the absence of any
+ warranty; and give any other recipients of the Program a copy of this License
+ along with the Program.
+ </para>
+
+ <para>
+ You may charge a fee for the physical act of transferring a copy, and you may at
+ your option offer warranty protection in exchange for a fee.
+ </para>
+ </sect2>
+
+ <sect2 id="sect2">
+ <title>Section 2</title>
+ <para>
+ You may modify your copy or copies of the Program or any portion of it, thus
+ forming a work based on the Program, and copy and distribute such modifications
+ or work under the terms of <link linkend="sect1">Section 1</link> above, provided
+ that you also meet all of these conditions:
+
+ <orderedlist numeration="loweralpha">
+ <listitem>
+ <para>
+ You must cause the modified files to carry prominent notices stating that
+ you changed the files and the date of any change.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ You must cause any work that you distribute or publish, that in whole or
+ in part contains or is derived from the Program or any part thereof, to be
+ licensed as a whole at no charge to all third parties under the terms of
+ this License.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ If the modified program normally reads commands interactively when run, you
+ must cause it, when started running for such interactive use in the most
+ ordinary way, to print or display an announcement including an appropriate
+ copyright notice and a notice that there is no warranty (or else, saying
+ that you provide a warranty) and that users may redistribute the program
+ under these conditions, and telling the user how to view a copy of this
+ License.
+
+ <note>
+ <title>Exception:</title>
+ <para>
+ If the Program itself is interactive but does not normally print such an
+ announcement, your work based on the Program is not required to print an
+ announcement.)
+ </para>
+ </note>
+
+ </para>
+ </listitem>
+ </orderedlist>
+ </para>
+
+ <para>
+ These requirements apply to the modified work as a whole. If identifiable sections
+ of that work are not derived from the Program, and can be reasonably considered
+ independent and separate works in themselves, then this License, and its terms,
+ do not apply to those sections when you distribute them as separate works. But when
+ you distribute the same sections as part of a whole which is a work based on the
+ Program, the distribution of the whole must be on the terms of this License, whose
+ permissions for other licensees extend to the entire whole, and thus to each and
+ every part regardless of who wrote it.
+ </para>
+
+ <para>
+ Thus, it is not the intent of this section to claim rights or contest your rights
+ to work written entirely by you; rather, the intent is to exercise the right to control
+ the distribution of derivative or collective works based on the Program.
+ </para>
+
+ <para>
+ In addition, mere aggregation of another work not based on the Program with the Program
+ (or with a work based on the Program) on a volume of a storage or distribution medium
+ does not bring the other work under the scope of this License.
+ </para>
+ </sect2>
+
+ <sect2 id="sect3">
+ <title>Section 3</title>
+
+ <para>
+ You may copy and distribute the Program (or a work based on it, under
+ <link linkend="sect2">Section 2</link> in object code or executable form under the terms of
+ <link linkend="sect1">Sections 1</link> and <link linkend="sect2">2</link> above provided that
+ you also do one of the following:
+
+ <orderedlist numeration="loweralpha">
+ <listitem>
+ <para>
+ Accompany it with the complete corresponding machine-readable source code, which
+
+ must be distributed under the terms of Sections 1 and 2 above on a medium
+ customarily used for software interchange; or,
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Accompany it with a written offer, valid for at least three years, to give any
+ third party, for a charge no more than your cost of physically performing source
+ distribution, a complete machine-readable copy of the corresponding source code,
+ to be distributed under the terms of Sections and above on a medium customarily
+ used for software interchange; or,
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Accompany it with the information you received as to the offer to distribute
+ corresponding source code. (This alternative is allowed only for noncommercial
+ distribution and only if you received the program in object code or executable form
+ with such an offer, in accord with Subsection b above.)
+ </para>
+ </listitem>
+ </orderedlist>
+ </para>
+
+ <para>
+ The source code for a work means the preferred form of the work for making modifications
+ to it. For an executable work, complete source code means all the source code for all modules
+ it contains, plus any associated interface definition files, plus the scripts used to control
+ compilation and installation of the executable. However, as a special exception, the source
+ code distributed need not include anything that is normally distributed (in either source or
+ binary form) with the major components (compiler, kernel, and so on) of the operating system
+ on which the executable runs, unless that component itself accompanies the executable.
+ </para>
+
+ <para>
+ If distribution of executable or object code is made by offering access to copy from a
+ designated place, then offering equivalent access to copy the source code from the same place
+ counts as distribution of the source code, even though third parties are not compelled to
+ copy the source along with the object code.
+ </para>
+ </sect2>
+
+ <sect2 id="sect4">
+ <title>Section 4</title>
+
+ <para>
+ You may not copy, modify, sublicense, or distribute the Program except as expressly provided
+ under this License. Any attempt otherwise to copy, modify, sublicense or distribute the
+ Program is void, and will automatically terminate your rights under this License. However,
+ parties who have received copies, or rights, from you under this License will not have their
+ licenses terminated so long as such parties remain in full compliance.
+ </para>
+ </sect2>
+
+ <sect2 id="sect5">
+ <title>Section 5</title>
+
+ <para>
+ You are not required to accept this License, since you have not signed it. However, nothing
+ else grants you permission to modify or distribute the Program or its derivative works.
+ These actions are prohibited by law if you do not accept this License. Therefore, by modifying
+ or distributing the Program (or any work based on the Program), you indicate your acceptance
+ of this License to do so, and all its terms and conditions for copying, distributing or
+ modifying the Program or works based on it.
+ </para>
+ </sect2>
+
+ <sect2 id="sect6">
+ <title>Section 6</title>
+
+ <para>
+ Each time you redistribute the Program (or any work based on the Program), the recipient
+ automatically receives a license from the original licensor to copy, distribute or modify
+ the Program subject to these terms and conditions. You may not impose any further restrictions
+ on the recipients' exercise of the rights granted herein. You are not responsible for enforcing
+ compliance by third parties to this License.
+ </para>
+ </sect2>
+
+ <sect2 id="sect7">
+ <title>Section 7</title>
+
+ <para>
+ If, as a consequence of a court judgment or allegation of patent infringement or for any other
+ reason (not limited to patent issues), conditions are imposed on you (whether by court order,
+ agreement or otherwise) that contradict the conditions of this License, they do not excuse you
+ from the conditions of this License. If you cannot distribute so as to satisfy simultaneously
+ your obligations under this License and any other pertinent obligations, then as a consequence
+ you may not distribute the Program at all. For example, if a patent license would not permit
+ royalty-free redistribution of the Program by all those who receive copies directly or
+ indirectly through you, then the only way you could satisfy both it and this License would be
+ to refrain entirely from distribution of the Program.
+ </para>
+
+ <para>
+ If any portion of this section is held invalid or unenforceable under any particular circumstance,
+ the balance of the section is intended to apply and the section as a whole is intended to apply
+ in other circumstances.
+ </para>
+
+ <para>
+ It is not the purpose of this section to induce you to infringe any patents or other property
+ right claims or to contest validity of any such claims; this section has the sole purpose of
+ protecting the integrity of the free software distribution system, which is implemented by public
+ license practices. Many people have made generous contributions to the wide range of software
+ distributed through that system in reliance on consistent application of that system; it is up
+ to the author/donor to decide if he or she is willing to distribute software through any other
+ system and a licensee cannot impose that choice.
+ </para>
+
+ <para>
+ This section is intended to make thoroughly clear what is believed to be a consequence of the
+ rest of this License.
+ </para>
+ </sect2>
+
+ <sect2 id="sect8">
+ <title>Section 8</title>
+
+ <para>
+ If the distribution and/or use of the Program is restricted in certain countries either by patents
+ or by copyrighted interfaces, the original copyright holder who places the Program under this License
+ may add an explicit geographical distribution limitation excluding those countries, so that
+ distribution is permitted only in or among countries not thus excluded. In such case, this License
+ incorporates the limitation as if written in the body of this License.
+ </para>
+ </sect2>
+
+ <sect2 id="sect9">
+ <title>Section 9</title>
+
+ <para>
+ The Free Software Foundation may publish revised and/or new versions of the General Public License
+ from time to time. Such new versions will be similar in spirit to the present version, but may differ
+ in detail to address new problems or concerns.
+ </para>
+
+ <para>
+ Each version is given a distinguishing version number. If the Program specifies a version number of
+ this License which applies to it and "any later version", you have the option of following the terms
+ and conditions either of that version or of any later version published by the Free Software
+ Foundation. If the Program does not specify a version number of this License, you may choose any
+ version ever published by the Free Software Foundation.
+ </para>
+ </sect2>
+
+ <sect2 id="sect10">
+ <title>Section 10</title>
+
+ <para>
+ If you wish to incorporate parts of the Program into other free programs whose distribution
+ conditions are different, write to the author to ask for permission. For software which is copyrighted
+ by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions
+ for this. Our decision will be guided by the two goals of preserving the free status of all
+ derivatives of our free software and of promoting the sharing and reuse of software generally.
+ </para>
+ </sect2>
+
+ <sect2 id="sect11">
+ <title>NO WARRANTY</title>
+ <subtitle>Section 11</subtitle>
+
+ <para>
+ BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT
+ PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+ OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
+ PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+ </para>
+ </sect2>
+
+ <sect2 id="sect12">
+ <title>Section 12</title>
+
+ <para>
+ IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR
+ ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU
+ FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
+ USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED
+ INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH
+ ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+ DAMAGES.
+ </para>
+ </sect2>
+ </sect1>
+ </appendix> \ No newline at end of file
diff --git a/help/C/config-prefs.sgml b/help/C/config-prefs.sgml
new file mode 100644
index 0000000000..e771bcaf13
--- /dev/null
+++ b/help/C/config-prefs.sgml
@@ -0,0 +1,908 @@
+<!--
+<!DOCTYPE Chapter PUBLIC "-//GNOME//DTD DocBook PNG Variant V1.1//EN">
+-->
+<chapter id="config-prefs">
+
+ <title>Advanced Configuration</title>
+ <para>
+ Perhaps your mail server has changed names. Perhaps you've
+ grown tired of a certain layout for your appointments.
+ Whatever the reason, you want to change your
+ <application>Evolution</application> settings. This chapter
+ will tell you how to do just that.
+ </para>
+ <para>
+ Evolution 1.2 brings with it a redesigned comprehensive
+ settings window that you can open by choosing <menuchoice>
+ <guimenu>Tools</guimenu>
+ <guimenuitem>Configure</guimenuitem></menuchoice>, no matter
+ where you are in Evolution. On the left half of the settings
+ window is a column, similar to the Evolution shortcut bar,
+ which lets you choose which portion of Evolution to
+ customize. The right half of the window is where you'll make
+ your actual changes.
+ </para>
+
+
+ <!-- ==============Figure===================== -->
+ <figure id="config-prefs-mail-fig">
+ <title>Changing Mail Settings</title>
+ <screenshot>
+ <screeninfo>Changing Mail Settings</screeninfo>
+ <mediaobject><imageobject><imagedata fileref="figures/config-mail" format="png" srccredit="Aaron Weber">
+ </imageobject></mediaobject>
+ </screenshot>
+ </figure>
+ <!-- ==============End of Figure================-->
+
+ <para>
+ There are eight items you can customize. From top to bottom, they
+ are:
+ <variablelist>
+ <varlistentry>
+ <term>Mail Accounts</term>
+ <listitem>
+ <para>
+ Here, add or change information about your email
+ accounts: the servers to which you connect, the way you
+ download mail, your password authentication mode, and so
+ forth. This is the most complex item in the list, and is
+ covered in <xref linkend="config-prefs-mail-identity">.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>Folder Settings</term>
+ <listitem>
+ <para>
+ Here, you can choose the default folders for various
+ components of Evolution, the folders that will be cached
+ locally when you go to offline mode, and the folders that
+ Evolution will use when it is searching for
+ autocompletion information as you address a mail.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>Mail Preferences</term>
+ <listitem>
+ <para>
+ These are overall mail reading preferences: display
+ settings, notification options, security, and so
+ forth. These are covered in <xref
+ linkend="config-prefs-mail-display">.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>Composer Preferences</term>
+ <listitem>
+ <para>
+ Settings for the way that you use the mail composer:
+ shortcuts, signatures, spelling, and so forth. One fun
+ feature here is the ability to substitute graphical
+ smiley-faces for "emoticons" such as :) that many people
+ use in email. This tool is covered in <xref
+ linkend="config-prefs-mail-composer">.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>Calendar and Tasks</term>
+ <listitem>
+ <para>
+ Here, you can set the way the calendar behaves, including
+ your time zone and the length of your work-week.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>Directory Servers</term>
+ <listitem>
+ <para>
+ If you want to use a shared directory server (LDAP
+ server), this is the place to set it up.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>Font Preferences</term>
+ <listitem>
+ <para>
+ Choose the fonts that Evolution will use to display email
+ here. You can choose fonts for the mail composer by
+ selecting <menuchoice> <guimenu>Edit</guimenu>
+ <guimenuitem>Properties</guimenuitem> </menuchoice> from
+ within the composer window.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>Summary Preferences</term>
+ <listitem>
+ <para>
+ Set the mail folders, news feeds, schedule summary
+ length, and weather locations to be displayed here. For
+ news feeds, enter the web address of any RDF file.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+
+ </para>
+
+ <sect1 id="config-prefs-mail">
+ <title>Mail Settings</title>
+ <para>
+ The first few tools, with the exception of the folder tool,
+ cover mail tasks:
+ </para>
+
+ <sect2 id="config-prefs-mail-identity">
+ <title>Working with Mail Accounts</title>
+ <para>
+ <application>Ximian Evolution</application> allows you to
+ maintain multiple accounts, or identities. This is useful
+ want to keep personal and professional email separate, or if
+ you wear several hats at work. When you are writing an email
+ message, you can which account to use by selecting from the
+ drop-down list next to the <guilabel>From</guilabel> entry in
+ the message composer.
+ </para>
+
+ <para>
+ Clicking <guibutton>Get Mail</guibutton> will refresh any
+ IMAP, <filename>mh</filename>, or
+ <filename>mbox</filename> listings
+ and check and download mail from all POP servers. In other
+ words, <guibutton>Get Mail</guibutton> gets your mail, no
+ matter how many sources you have, or what types they are. If
+ you don't want to check mail for a given account, select it
+ in the <guilabel>Accounts</guilabel> tab and click the
+ <guibutton>Disable</guibutton> button.
+ </para>
+
+ <para>
+ To add a new account, simply click <guibutton>Add</guibutton>
+ to open the mail configuration assistant. To alter an
+ existing identity, select it in the
+ <interface>Preferences</interface> window, and then click
+ <guibutton>Edit</guibutton> to open the account editor
+ dialog.
+ </para>
+
+ <para>
+ The account editor dialog has six sections:
+ <variablelist>
+
+ <varlistentry>
+ <term>Identity:</term>
+ <listitem>
+ <para>
+ Here, enter the name,
+ email address, and other identifying information for the
+ account.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Receiving Mail</term>
+ <listitem>
+ <para>
+ Here, select the way you will be getting mail: you may
+ download mail from a server (<glossterm
+ linkend="pop">POP</glossterm>), read and keep it on the
+ server (Microsoft Exchange or <glossterm
+ linkend="imap">IMAP</glossterm>), or read it from files
+ that already exist on your desktop computer. If you use
+ a server, it may permit or require you to use a Secure
+ Socket Layer (SSL) connection. To turn SSL connections
+ on, just click the <guibutton>Use Secure Connection
+ (SSL)</guibutton> button.
+
+<note id="config-arbitrary-port">
+<title>Specifying Port Numbers</title>
+<para>
+Your system administrator may ask you to connect to a specific port on
+a mail server. To specify which port you use, just type a colon and
+the port number after the server name. For example, to connect to port
+143 on the server smtp.omniport.com, you would enter
+as
+<userinput>
+smtp.omniport.com:143
+</userinput> as the server name.
+</para>
+</note>
+
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Receiving Options</term>
+ <listitem>
+ <para>
+ Here, decide whether you'd like to check for mail
+ automatically and how often, as well as other message
+ retrieval options.
+
+ <variablelist>
+ <varlistentry>
+ <term>If you chose POP:</term>
+ <listitem>
+ <para>
+ <itemizedlist>
+ <listitem>
+ <para>Checking for new mail: If you would
+ like <application>Evolution</application>
+ to check for new mail automatically,
+ check the box and select a frequency in
+ minutes.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ Message Storage: If you'd like to store
+ copies of your mail on the server, check
+ this option.
+ </para>
+ </listitem>
+
+
+ <listitem>
+ <para>Store Store status headers in
+ Elm/Pine/Mutt format: If you would like to
+ use the X-Status header format used by the
+ mail clients Elm, Pine, and Mutt, select
+ this option. This option is useful if you
+ plan to check your mail with those clients
+ from time to time.
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>If you chose Microsoft Exchange:</term>
+ <listitem>
+ <para>
+
+ <itemizedlist> <listitem>
+ <para>Checking for new mail: If you would like
+ <application>Evolution</application> to check for new mail
+ automatically, check the box and select a frequency in
+ minutes.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>Exchange Server: If your active directory user name
+ is different from your Exchange mail user name, check this
+ box and enter your mail username here.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>Create a Global Address List folder: If you would
+ like to have a seperate folder for the Active Directory's
+ Global Address List, leave this box checked. </para>
+ </listitem>
+
+ <listitem>
+ <para>
+ Active Directory Server Name: In most organizations,
+ the Active Directory server will be different from
+ the Exchange mail server. If so, check the box and
+ enter the Active Directory server name here.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>Limit number of Responses: Select a maximum number
+ of results for an address search. A maximum number of
+ results limits the load on your system and on your network.
+ </para>
+ </listitem>
+ </itemizedlist>
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>If you chose IMAP:</term>
+ <listitem>
+ <para>
+
+ <itemizedlist>
+ <listitem>
+ <para>Checking for new mail: If you would like
+ <application>Evolution</application> to check for new mail
+ automatically, check the box and select a frequency in
+ minutes.
+ </para>
+ </listitem>
+
+ <listitem>
+ <para>If you want <application>Evolution</application>
+ to check for new messages in <emphasis>all</emphasis> your
+ IMAP folders, make sure the <guilabel>Check for new
+ messages in all folders</guilabel> box is selected.</para>
+ </listitem>
+
+ <listitem>
+ <para>Show only subscribed folders: Check this box if you
+ have more folders in your IMAP view than you want to
+ read.</para>
+ </listitem>
+
+ <listitem>
+ <para>
+ Override server-supplied namespace: If you like, enter a
+ specific directory where your server stores mail for
+ you. Typical values are "mail" and "Mail." For more
+ information about how to use IMAP mail, see <xref
+ linkend="usage-mail-subscriptions">.</para>
+ </listitem>
+
+ <listitem>
+ <para>Apply filters to new messages in INBOX on this
+ server: If you'd like your filters to work on this account
+ as well as on locally downloaded mail, check this box.</para>
+ </listitem>
+
+ <listitem>
+ <para>Store Store status headers in Elm/Pine/Mutt format:
+ If you would like to use the X-Status header format used
+ by the mail clients Elm, Pine, and Mutt, select this
+ option. This option is useful if you plan to check your
+ mail with those clients from time to time.
+ </para>
+ </listitem>
+
+ </itemizedlist>
+ </para>
+ </listitem>
+ </varlistentry>
+
+
+ </variablelist>
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Sending Mail</term>
+ <listitem>
+ <para>
+ In this section, you will choose and configure a method
+ for sending mail. You may choose <glossterm
+ linkend="smtp">SMTP</glossterm>, Microsoft Exchange (if
+ you have purchased the Ximian Connector for Microsoft
+ Exchange) or <glossterm
+ linkend="sendmail">sendmail</glossterm>.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Special Folders</term>
+ <listitem>
+ <para>
+ Here, you can decide where this account will store the
+ messages that it has sent, and the messages that you
+ save as drafts.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Security</term>
+ <listitem>
+ <para>
+ In this section, you will set the security options for
+ this account. Enter your PGP Key ID and decide how
+ frequently to encrypt and sign your messages. You can
+ learn more about PGP and encryption in <xref
+ linkend="encryption">.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+ </sect2>
+
+
+ <sect2 id="config-prefs-mail-display">
+ <title>Mail Display Options</title>
+ <para>
+ In this tab you can decide how you would like
+ <application>Ximian Evolution</application> to display your
+ mail: how to display citations, how long to wait before
+ marking a message as read, and so forth.
+ </para>
+ <para>
+ This is also where you can decide how you would like
+ <application>Ximian Evolution</application> to handle inline
+ images in HTML mail that you get. There is a detailed
+ discussion of the issues surrounding these options in <xref
+ linkend="usage-mail-getnsend-get-attach-html">.
+ </para>
+ <para>
+ To change the font which <application>Ximian
+ Evolution</application> uses to display mail, do the
+ following:
+ <orderedlist numeration="arabic">
+ <listitem>
+ <para>
+ Open the Control Center by selecting <menuchoice>
+ <guimenu>System</guimenu>
+ <guimenuitem>Settings</guimenuitem> </menuchoice> from
+ the menu panel.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Select the HTML Viewer settings tool.
+ </para>
+ </listitem>
+ <listitem>
+ <para>Choose the font and font size you would like to use.
+ </para>
+ </listitem>
+ </orderedlist>
+
+ Alternately, open a terminal and run the
+ <command>gtkhtml-properties-capplet</command> command. This
+ will open the GNOME HTML Display Properties tool, and you can
+ select a font and other attributes of your HTML display,
+ including that in <application>Ximian Evolution</application>.
+ </para>
+ </sect2>
+
+ <sect2 id="config-prefs-mail-composer">
+ <title>Message Composer Preferences</title>
+ <para>
+ There are three whole tabs of settings you can change for the
+ message composer. The General tab covers shortcuts and
+ assorted behavior, and the other two control signatures and
+ spell checking. In the General tab, you can set:
+
+ <variablelist>
+
+ <varlistentry>
+ <term>Shortcuts Type</term>
+ <listitem>
+ <para>
+ Choose a keyboard shortcut scheme: do you prefer
+ keyboard shortcuts similar to those of Microsoft
+ Windows, XEmacs, or Emacs?
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>Default Behavior</term>
+ <listitem>
+ <para>
+ Choose how you will normally forward and reply
+ messages, what character set they will use, whether
+ they will be in HTML, and whether that HTML can
+ contain smiley face images.
+ </para>
+ </listitem>
+ </varlistentry>
+
+
+ <varlistentry>
+ <term>Alerts</term>
+ <listitem>
+ <para>
+ There are two optional alerts here:
+ <variablelist>
+ <varlistentry>
+ <term>Prompt when sending messages with an empty subject</term>
+ <listitem>
+ <para>
+ The composer will warn you if you try to send a
+ message without a subject.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>Prompt when sending messages with only Bcc recipients defined</term>
+ <listitem>
+ <para>
+ The composer will warn you if you try to send a
+ message that has only <guilabel>Bcc</guilabel>
+ recipients. This is important because some mail
+ servers will fail to honor blind carbon copy if you
+ do not have at least one recipient that is visible to
+ all readers.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+
+ <para>
+ The signature editor is new for Evolution 1.2. It allows you
+ to create several different signatures in plain text or in
+ HTML, and to specify which of them will be added to emails
+ you create in the message composer. If you prefer to use an
+ alternate signature or none at all, you can select it from
+ the mail composer itself.
+ </para>
+ <para>
+ In the spell-checking tool, you can set spelling options,
+ including the language or languages you will use. Note that you
+ must install the gnome-spell package, available through Red
+ Carpet, for spell-checking to be available in
+ Evolution. Alternate dictionaries are aslo available through
+ Red Carpet and are detected automatically if you have installed
+ them.
+ </para>
+ </sect2>
+
+
+<!-- NOT FOR 1.0, see usage-mail.sgml
+ <sect1 id="config-prefs-news">
+ <title>News Servers</title>
+ <para>
+ Newsgroups are so much like mailing lists that there's no
+ reason not to keep them right next to your mail. When you
+ first select the <guilabel>News Servers</guilabel> tab,
+ you will see a blank box with the three familiar buttons
+ on the right: <guibutton>Add</guibutton>,
+ <guibutton>Edit</guibutton>, and
+ <guibutton>Delete</guibutton>.
+ </para>
+ <para>
+ Click <guibutton>Add</guibutton> to add a news server; you
+ will be prompted for its name. Enter the name, click
+ <guibutton>OK</guibutton>, and you're done. You can have
+ as many news servers as you like, of course. News servers
+ will appear next to your IMAP servers in the
+ <interface>folder bar</interface>.
+ </para>
+ </sect2>
+-->
+ </sect1>
+
+ <sect1 id="config-prefs-cal">
+ <title>Calendar and Task List Settings</title>
+ <para>
+ The calendar configuration tool has two tabs
+ <guilabel>General</guilabel> and
+ <guilabel>Display</guilabel>, and is illustrated in <xref
+ linkend="config-prefs-cal-fig">.
+
+ <!-- ==============Figure===================== -->
+ <figure id="config-prefs-cal-fig">
+ <title>Calendar Preferences Dialog</title>
+ <screenshot>
+ <screeninfo>Calendar Configuration</screeninfo>
+ <mediaobject><imageobject><imagedata fileref="figures/config-cal" format="png" srccredit="Aaron Weber">
+ </imageobject></mediaobject>
+ </screenshot>
+ </figure>
+ <!-- ==============End of Figure================-->
+ </para>
+
+ <para>
+ The <guilabel>General</guilabel> tab lets you set the
+ following:
+ <variablelist>
+ <varlistentry>
+ <term>Time zone</term>
+ <listitem>
+ <para>
+ The city you're located in, to judge your time zone.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Time format</term>
+ <listitem>
+ <para>You may choose between twelve-hour (AM/PM) and
+ twenty-four hour time formats here by clicking the
+ appropriate radio button.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Work Week</term>
+ <listitem>
+ <para>
+ When does your work day start, and when does it end?
+ In the day and week views,
+ <application>Evolution</application> displays all the
+ hours in the range you select here, even if there are
+ no appointments for those times. Of course, you can
+ still schedule an appointment outside of these hours,
+ and if you do, the display will be extended to show
+ it.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>First day of the week</term>
+ <listitem>
+ <para>You can set weeks to start on Sunday or on Monday.</para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Start of day</term>
+ <listitem>
+ <para>
+ Says what time of the day your weekday starts. This
+ will show all times till the end of the day,
+ regardless of there is an appointment during the time
+ period.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>End of day</term>
+ <listitem>
+ <para>
+ Sets the time the day ends at.
+ </para>
+ </listitem>
+ </varlistentry>
+
+
+ <varlistentry>
+ <term>Alerts</term>
+ <listitem>
+ <para>
+ If you'd like to be warned before you delete any
+ appointment, or to have a reminder automatically
+ appear for each event, select the check boxes here.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+
+ <para>
+ The <interface>Display</interface> section lets you choose how
+ your appointments and tasks will appear in your calendar.
+ </para>
+ <para>The display properties you can set are:
+
+ <variablelist>
+ <varlistentry>
+ <term>Time divisions</term>
+ <listitem>
+ <para>
+ Sets the increments shown on the daily view in the
+ calendar. You can set this to be anywhere from five
+ minutes to an hour, in five minute increments.</para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>Show appointment end times in week and month views</term>
+ <listitem>
+ <para>
+ If there is space,
+ <application>Evolution</application> will show the end
+ times in the week and month views for each
+ appointment.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Compress weekends in month view</term>
+ <listitem>
+ <para>
+ If checked, your weekends will be shown in one box,
+ instead of one for each day in the month view.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>Show week numbers in date navigator</term>
+ <listitem>
+ <para>
+ This will show the week numbers next to the respective
+ weeks in the calendar.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>Tasks due today</term>
+ <listitem>
+ <para>
+ Configures what color to set your tasks that are due
+ today to.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Overdue tasks</term>
+ <listitem>
+ <para>
+ Choose the color for overdue tasks.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+ </sect1>
+ <sect1 id="config-prefs-contact">
+ <title>Managing the Addressbook</title>
+ <para>
+ Addressbook settings are limited to the usage and
+ configuration of directory servers (LDAP and
+ Exchange). Contact folders for the mailer's autocompletion
+ feature are set in the Folders tool above, and all other
+ addressbook controls are available in the addressbook window
+ itself.
+ </para>
+
+ <sect2 id="config-prefs-contact-ldap-add">
+ <title>Adding Directory Servers</title>
+ <para>
+ To add a new <glossterm linkend="ldap">LDAP</glossterm> server
+ to your available contact folders:
+ <orderedlist numeration="arabic">
+ <listitem>
+ <para>
+ Select
+ <menuchoice>
+ <guimenu>Tools</guimenu>
+ <guimenuitem>Addressbook Sources</guimenuitem>
+ </menuchoice>
+ from the menu.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Click the <guibutton>Add</guibutton> button on the right
+ side.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Enter the server information:
+ <variablelist>
+ <varlistentry>
+ <term>Account name</term>
+ <listitem>
+ <para>
+ The name that you see on the screen. This could
+ be anything you wish.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Server name</term>
+ <listitem>
+ <para>
+ Address of the server where the addressbook is located.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>My server requires authentication</term>
+ <listitem>
+ <para>
+ Select this if the server requires
+ <application>Evolution</application> to provide
+ a server in order to access the LDAP contacts.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Port</term>
+ <listitem>
+ <para>
+ The internet port
+ <application>Evolution</application> connects to
+ in order to access the LDAP database. This is
+ normally 389.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><glossterm linkend="search-base">Search base</glossterm></term>
+ <listitem>
+ <para>
+ The base entry to use for all your searches.
+ Contact your administrator for information about
+ the correct settings.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term><glossterm linkend="search-scope">Search scope</glossterm></term>
+ <listitem>
+ <para>
+ How broad the search is in the directory. The
+ following options are available:
+ <variablelist>
+ <varlistentry>
+ <term>Base</term>
+ <listitem>
+ <para>
+ Searches just the Search Base. Most of the time,
+ not very useful.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>One</term>
+ <listitem>
+ <para>
+ Searches the Search Base and one entry
+ below it.
+ </para>
+ </listitem>
+ </varlistentry>
+ <varlistentry>
+ <term>Sub</term>
+ <listitem>
+ <para>
+ Searches the Search Base and all entries
+ below it.
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+ </listitem>
+ </varlistentry>
+ </variablelist>
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Click <guibutton>OK</guibutton>.
+ </para>
+ </listitem>
+ <listitem>
+ <para>
+ Click <guibutton>OK</guibutton> to permanenty make
+ changes or <guibutton>Apply</guibutton> to temporarily
+ set the changes.
+ </para>
+ </listitem>
+ </orderedlist>
+
+
+<!-- Finish this example:
+
+ <example id="ldap-config-example">
+ <title>LDAP Configuration</title>
+ <para>
+ Rich works at omniport.net and needs to access the
+ company's LDAP server so that he can look up the email
+ addresses of his co-workers.
+ </para>
+ <para>
+ He uses his email address, rich@omniport.net,
+ </para>
+ <para>
+ His Server Name is: ldap.wemakechips.com
+ </para>
+ </example>
+-->
+ </para>
+ </sect2>
+ </sect1>
+</chapter> \ No newline at end of file
diff --git a/help/C/evolution-C.omf b/help/C/evolution-C.omf
index 23dc3fdb86..348238680f 100644
--- a/help/C/evolution-C.omf
+++ b/help/C/evolution-C.omf
@@ -1,24 +1,18 @@
-<?xml version="1.0" standalone="no"?>
+<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
+<!DOCTYPE omf PUBLIC "-//OMF//DTD Scrollkeeper OMF Variant V1.0//EN" "http://scrollkeeper.sourceforge.net/dtds/scrollkeeper-omf-1.0/scrollkeeper-omf.dtd">
<omf>
<resource>
- <creator>
- Ximian, Inc.
- </creator>
+ <creator>
+ Ximian, Inc.
+ </creator>
<title>
Evolution Manual
</title>
<date>2002</date>
<subject category="GNOME|Applications"/>
- <description>
- A user's guide to Ximian Evolution which explains how to use
- its mail, calendar, addressbook, and task list features.
- </description>
- <type>
- manual
- </type>
- <format mime="text/xml" dtd="-//OASIS//DTD DocBook XML V4.1.2//EN"//>
- <identifier url="/"/>
+ <format mime="text/html"/>
+ <identifier url="index.html"/>
<language code="C"/>
- <rights type="GNU FDL" license.version="1.1" license="http://www.gnu.org/licenses/fdl.html" holder="Ximian, Inc."/>
+ <relation seriesid="6a2207d8-8aa4-11d6-8cb4-f0bb5a765891"/>
</resource>
</omf>
diff --git a/help/C/evolution.sgml b/help/C/evolution.sgml
new file mode 100644
index 0000000000..5b199c0fae
--- /dev/null
+++ b/help/C/evolution.sgml
@@ -0,0 +1,111 @@
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V4.1//EN"[
+
+<!ENTITY PREFACE SYSTEM "preface.sgml">
+<!ENTITY USAGE-MAINWINDOW SYSTEM "usage-mainwindow.sgml">
+<!ENTITY USAGE-EXEC-SUMMARY SYSTEM "usage-exec-summary.sgml">
+<!ENTITY USAGE-MAIL SYSTEM "usage-mail.sgml">
+<!ENTITY USAGE-MAIL-ORG SYSTEM "usage-mail-org.sgml">
+<!ENTITY USAGE-CONTACT SYSTEM "usage-contact.sgml">
+<!ENTITY USAGE-CALENDAR SYSTEM "usage-calendar.sgml">
+<!ENTITY USAGE-EXCHANGE SYSTEM "usage-exchange.sgml">
+<!ENTITY USAGE-SYNC SYSTEM "usage-sync.sgml">
+<!ENTITY USAGE-PRINT SYSTEM "usage-print.sgml">
+<!ENTITY CONFIG-PREFS SYSTEM "config-prefs.sgml">
+<!ENTITY CONFIG-SYNC SYSTEM "config-sync.sgml">
+<!ENTITY MENUREF SYSTEM "menuref.sgml">
+<!ENTITY APX-GLOSS SYSTEM "apx-gloss.sgml">
+<!ENTITY APX-COMMON-TASKS SYSTEM "apx-common-tasks.sgml">
+<!ENTITY APX-BUGS SYSTEM "apx-bugs.sgml">
+<!ENTITY APX-AUTHORS SYSTEM "apx-authors.sgml">
+<!ENTITY APX-FDL SYSTEM "apx-fdl.sgml">
+<!ENTITY APX-GPL SYSTEM "apx-gpl.sgml">
+
+]>
+
+
+<!-- Almost every chapter is an entity. Files, Chapter id's, and
+entity names correspond. APX is for appendix. -->
+
+<book id="index">
+ <bookinfo>
+ <title>A User's Guide to Ximian Evolution</title>
+ <authorgroup>
+ <author><firstname>Aaron</firstname><surname>Weber</surname></author>
+ <author><firstname>Kevin</firstname><surname>Breit</surname></author>
+ <author><firstname>Ettore</firstname><surname>Perazzoli</surname></author>
+ <author><firstname>Duncan</firstname><surname>Mak</surname></author>
+ </authorgroup>
+ <copyright>
+ <year>2000-2002</year>
+ <holder>Ximian, Inc.</holder>
+ </copyright>
+
+ <legalnotice id="legalnotice">
+ <para>
+ See the preface for legal information regarding the GNU
+ General Public License and Free Documentation License.
+ </para>
+ </legalnotice>
+
+ <releaseinfo>
+ This is version 1.2 of the Ximian Evolution manual. It describes
+ version 1.2 of the Ximian Evolution groupware suite.
+ </releaseinfo>
+
+ </bookinfo>
+
+ &PREFACE;
+
+ <part id="usage">
+ <title>Getting Started with Ximian Evolution</title>
+ <partintro>
+ <para>
+ Part one of the <application>Ximian Evolution</application> manual
+ describes how to use <application>Ximian Evolution</application> for
+ email, contact management, and appointment and task
+ scheduling. You'll find as you go along that there's more
+ than one way to do things, and you can pick whichever method
+ you like best.
+ </para>
+ </partintro>
+
+ &USAGE-MAINWINDOW;
+ &USAGE-EXEC-SUMMARY;
+ &USAGE-MAIL;
+ &USAGE-MAIL-ORG;
+ &USAGE-CONTACT;
+ &USAGE-CALENDAR;
+ &USAGE-EXCHANGE;
+ &USAGE-SYNC;
+ &USAGE-PRINT;
+ </part>
+ <part id="config">
+ <title>Configuring and Managing Ximian Evolution</title>
+ <partintro>
+ <para>
+ <application>Ximian Evolution</application> is highly
+ configurable. Usually, when developers say that, they mean
+ that they didn't test it out thoroughly and have left it to
+ other programmers to "configure" themselves a working
+ system. In the case of <application>Ximian
+ Evolution</application>, "configurable" means that, while you
+ can expect the program to work perfectly well with the default
+ settings, it's also easy to alter its behavior in a wide
+ variety of ways, so that it fits your needs exactly. This
+ part of the book will describe that process, from the quickest
+ glimpse of the Setup Assistant to an in-depth guide to obscure
+ preferences settings.
+ </para>
+ </partintro>
+
+ &CONFIG-PREFS;
+ &CONFIG-SYNC;
+ </part>
+
+ &MENUREF;
+ &APX-GLOSS;
+ &APX-BUGS;
+ &APX-AUTHORS;
+ &APX-FDL;
+ &APX-GPL;
+</book> \ No newline at end of file
diff --git a/help/C/preface.sgml b/help/C/preface.sgml
new file mode 100644
index 0000000000..fd1aa0ff1a
--- /dev/null
+++ b/help/C/preface.sgml
@@ -0,0 +1,411 @@
+ <preface id="introduction">
+ <title>Introduction</title>
+
+ <para>
+ Welcome to the users guide for Ximian Evolution and Ximian
+ Connector for Microsoft Exchange 2000. This section of the
+ manual will tell you a bit about what you've got waiting for
+ you. First, however, we have some legal information.
+ </para>
+
+ <sect1 id="actual-legal-info">
+ <title>Legal Information and Licensing</title>
+ <para>
+ Permission is granted to copy, distribute and/or modify this
+ document under the terms of the GNU Free Documentation
+ License, Version 1.1 or any later version published by the
+ Free Software Foundation with no Invariant Sections, no
+ Front-Cover Texts, and no Back-Cover Texts. You will find a
+ copy of the <citetitle>GNU Free Documentation
+ License</citetitle> attached to this manual in <xref
+ linkend="apx-fdl">. You may also obtain a copy of the
+ license from the Free Software Foundation by visiting <ulink
+ type="http" url="http://www.fsf.org">their Web site</ulink>
+ or by writing to: Free Software Foundation, Inc., 59 Temple
+ Place - Suite 330, Boston, MA 02111-1307, USA.
+ </para>
+
+ <para>
+ The actual application Ximian Evolution is covered by the GNU
+ General Public License (GPL), and its source code is
+ available from the GNOME cvs repository at <ulink
+ url="http://cvs.gnome.org">cvs.gnome.org</ulink>. You will
+ find a copy of the GPL attached to this document in <xref
+ linkend="apx-gpl">. You may also obtain a copy of the license
+ from the Free Software Foundation by visiting <ulink
+ type="http" url="http://www.fsf.org">their Web site</ulink>
+ or by writing to: Free Software Foundation, Inc., 59 Temple
+ Place - Suite 330, Boston, MA 02111-1307, USA.
+ </para>
+
+ <para>
+ Ximian Connector for Microsoft Exchange 2000 is not Free
+ Software. There are certain restrictions on its usage, and it
+ may not be redistributed. Before downloading it you must
+ agree to the terms of license, which will be (or have been)
+ presented to you upon download. You may review the terms of
+ license for Ximian Connector at <ulink
+ url="http://support.ximian.com/q?92">http://support.ximian.com/q?92</ulink>.
+ </para>
+ </sect1>
+
+ <sect1 id="organization">
+ <title>How This Book is Organized</title>
+ <para>
+ This book is divided into two parts, with several
+ appendices. The first part is a <link linkend="usage">guided
+ tour</link>, which will explain how to use
+ <application>Evolution</application>. If you are new to
+ <application>Evolution</application> or to groupware in
+ general, this section is for you. The second section, covering
+ <link linkend="config">configuration</link>, is targeted at
+ more advanced users, but anyone who wants to change the way
+ <application>Evolution</application> looks or acts can benefit
+ from reading it.
+ </para>
+ </sect1>
+
+ <sect1 id="typography">
+ <title>Typographical Conventions</title>
+ <para>
+ In this book, we'll mark some words with special typography:
+ <simplelist>
+ <member><application>Applications</application></member>
+ <member><command>Commands</command> you type at the command line</member>
+ <member><guilabel>Labels</guilabel> for buttons and other portions of the graphical interface</member>
+
+ <member> Menu selections look like this:
+ <menuchoice>
+ <guimenu>Menu</guimenu>
+ <guisubmenu>Submenu</guisubmenu>
+ <guimenuitem>Menu Item</guimenuitem>
+ </menuchoice>
+ </member>
+ <member><guibutton>Buttons</guibutton> you can
+ click</member> <member><userinput>Anything you type
+ in</userinput></member> <member><computeroutput>Text
+ output from a computer</computeroutput></member>
+ <member><glossterm linkend="apx-gloss">Words</glossterm>
+ that are defined in the <xref linkend="apx-gloss">.</member>
+ </simplelist>
+</para>
+<para>
+We'll provide assorted bits of additional information in tips set off from the rest of the book, as well.
+
+ <tip id="example-tip">
+ <title>Tip</title>
+ <para>
+ Tips and bits of extra information will look like
+ this.
+ </para>
+ </tip>
+</para>
+
+<para>
+Examples are also set off from the rest of the text. They look like this:
+
+ <example>
+ <title>Example Example</title>
+ <para>
+ This is what an example looks like. We'll provide
+ examples for some of the more complicated tasks you
+ might be performing.
+ </para>
+ </example>
+</para>
+<para>
+Lastly, we'll have warnings, in cases where you should be careful:
+
+ <warning id="example-warning">
+ <title>Example Warning</title>
+ <para>
+ This is what a warning looks like. If there's a chance
+ you'll run into trouble, we'll warn you beforehand.
+ </para>
+ </warning>
+ </para>
+ </sect1>
+
+
+ <sect1 id="other-help">
+ <title>Additional Help Sources</title>
+ <para>
+ You can find additional help in three places. For information
+ about command-line options, open a terminal window and type
+ <command> man evolution</command> or <command>evolution
+ --help</command>. For support, late-breaking news, and errata,
+ visit the Ximian support center at <ulink
+ url="http://support.ximian.com">support.ximian.com</ulink>.
+ </para>
+ </sect1>
+
+ <sect1 id="whats-new-in-one-two">
+ <title>What's New in Evolution 1.2</title>
+ <para>
+ If you're already familiar with Ximian Evolution 1.0, our new
+ version has a lot to add. Here are some of the new and
+ changed features. Ximian Connector for Microsoft Exchange also
+ has new features, which are covered in "new-in-connector-one-two">.
+ <variablelist>
+ <varlistentry>
+ <term>Evolution Settings Interface</term>
+ <listitem>
+ <para>
+ The preferences dialogs have been completely
+ overhauled. There is now a single configuration dialog
+ window for all components of the program, and you can
+ access it from anywhere. To change your preferences,
+ select
+ <menuchoice>
+ <guimenu>
+ Tools
+ </guimenu>
+ <guimenuitem>
+ Preferences
+ </guimenuitem>
+ </menuchoice>. Detailed help for the preferences
+ dialogs has been added to <xref
+ linkend="config-prefs">.
+ </para>
+ </listitem>
+ </varlistentry>
+
+
+ <varlistentry>
+ <term>Mail Composer Autocomplete</term>
+ <listitem>
+ <para>
+ Email addresses in the message composer can now work
+ with LDAP address books. Add your LDAP address book to
+ the list of folders searched for address completion in
+ the <guilabel>Folder Settings</guilabel> section of
+ the Settings dialog.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>Performance Improvements</term>
+ <listitem>
+ <para>
+ Startup time has decreased, POP server interactions
+ are more efficient, and indexing of locally cached
+ mail is now faster.
+ </para>
+ </listitem>
+ </varlistentry>
+
+
+ <varlistentry>
+ <term>Mail Composer HTML Improvements</term>
+ <listitem>
+ <para>
+ Pasting into the mail composer from another message
+ or from a web page preserves the HTML formatting of
+ the source document. Multiple levels of reply
+ quotation in messages are clearer and use a vertical
+ blue line on the left side to indicate quotation. Text
+ "smileys" are now automatically converted to small
+ images displaying the appropriate emotion. You can
+ turn this option off in the
+ <guilabel>Composer</guilabel> section of the Settings
+ dialog.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>Signature Editor</term>
+ <listitem>
+ <para>
+ There is now a signature editor, which can be used to
+ create plain text or HTML signatures.
+ click the the <guilabel>Signatures</guilabel> tab in
+ the Composer Settings section of the Evolution
+ Settings window.
+ </para>
+ </listitem>
+ </varlistentry>
+
+
+ <varlistentry>
+ <term>Keyboard Navigation Overhaul</term>
+ <listitem>
+ <para>
+ All unmodified letter keys have changed function-- the
+ <keycap>N</keycap> and <keycap>P</keycap> keys, for
+ example, no longer take you to the next you to the
+ next or previous message. Pressing a letter will now
+ take you to the nearest message whose data in the sort
+ column begins with that letter. That is, if you press
+ N and you are sorting your list by sender, you will
+ move to a message from Nadine. If you are sorting by
+ subject, you'll move to the message about
+ nectarines. This should also work in the folder list
+ for folder navigation.
+ </para>
+ <para>
+ This means that the old single letter shortcuts have
+ changed as well. The new shortcuts:
+ <simplelist>
+ <member>
+ <keycap>,</keycap> (comma) and <keycap>.</keycap>
+ (period) are now the keyboard shortcuts for Next
+ and Previous unread messages. You can also use the
+ square brackets <keycap>]</keycap> and
+ <keycap>[</keycap>.
+ </member>
+ <member>
+ <keycap>`</keycap> (backtick) toggles
+ the message preview pane.
+ </member>
+ </simplelist>
+ Shortcuts that use the <keycap>Control</keycap> key
+ have not changed.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>Added Functionality for the "New" Button</term>
+ <listitem>
+ <para>
+ The <guibutton>New</guibutton> now has a menu next to
+ it. As in Evolution 1.0, you can click the button once
+ to get a new item for the Evolution tool you're
+ using. However, if you click the small arrow menu to
+ the right of the button, you will find a menu that
+ allows you to create new items for the rest of
+ Evolution: All day appointments, regular appointments,
+ tasks and meetings for the calendar; mail messages for
+ the mail tool; and contacts and contact lists for the
+ address book.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>Import Tool Now Imports Netscape Filters</term>
+ <listitem>
+ <para>
+ You can now import your filters, as well as your email
+ messages, from the Netscape mail client.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>Folder Naming Internationalization</term>
+ <listitem>
+ <para>
+ You can now use Unicode (UTF-8) characters in the
+ names for IMAP folders.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>Executive Summary now Reads IMAP</term>
+ <listitem>
+ <para>
+ The Executive Summary tool in Evolution now displays
+ email messages in IMAP as well as local mail folders.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>Filters and vFolders Notice Moved or Missing Folders</term>
+ <listitem>
+ <para>
+ vFolders and filters now notice if you move or delete
+ a folder that they use.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>vFolder "Original Location" Feature</term>
+ <listitem>
+ <para>
+ vFolders can now display the actual folder location
+ for each message they contain. To do so, right click
+ on the column headers in the message list of any
+ vFolder, select <guimenuitem>Add a
+ Column</guimenuitem>, and drag the <guibutton>Original
+ Location</guibutton> item into position.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>New Criteria and Actions</term>
+ <listitem>
+ <para>
+ There are many new filter criteria and actions,
+ including additional message flags such as Flag for
+ Followup.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>Folder Selection for Offline Mode</term>
+ <listitem>
+ <para>
+ You may now select which network folders which will be
+ cached locally when you go into Offline mode. This
+ setting may be changed from the Folders section of the
+ Evolution Settings window.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>Resend (Bounce) Feature Added</term>
+ <listitem>
+ <para>
+ This feature is often called "Bounce" or "Redirect." To
+ resend a message with all its headers instead of merely
+ forwarding it, select the message and choose
+ <menuchoice>
+ <guimenu>
+ Actions
+ </guimenu>
+ <guisubmenu>
+ Forward
+ </guisubmenu>
+ <guimenuitem>
+ Resend
+ </guimenuitem>
+ </menuchoice>.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>Digest-mode Display of Forwarded Messages</term>
+ <listitem>
+ <para>
+ Messages that contain multiple forwarded messages are
+ now displayed as a digest rather than inline or as a
+ series of attachments.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ <varlistentry>
+ <term>New Mail Notification</term>
+ <listitem>
+ <para>
+ When new mail arrives, you may opt to have Evolution
+ beep or play a sound file that you specify.
+ </para>
+ </listitem>
+ </varlistentry>
+
+ </variablelist>
+ </para>
+ </sect1>
+</preface>
+
diff --git a/help/ChangeLog b/help/ChangeLog
index 1794e0efbb..8960fab139 100644
--- a/help/ChangeLog
+++ b/help/ChangeLog
@@ -1,22 +1,10 @@
-2002-11-11 Aaron Weber <aaron@ximian.com>
+2002-11-12 Frederic Crozat <fcrozat@mandrakesoft.com>
- * C/config-prefs.xml: fix bug 27336, which is about how the Search
- Base option description is wrong.
+ reviewed by: Ettore
-2002-11-04 Aaron Weber <aaron@ximian.com>
-
- * C/*.sgml: All sgml files replaced with xml files. XML files
- validated. Two new XML files-- apx-fdl.xml and legal.xml
-
- * C/evolution-C.omf: Altered to fit the GDP template. This may now
- work with the GNOME 2.0 DTD, although I could be wrong.
-
- * sgmldocs.make: removed and replaced with xmldocs.make. This will
- break all translations until they are also ported to XML. I will
- probably begin doing that tomorrow, since it's just markup and not
- language stuff.
-
- * C/Makefile.am: added two files
+ * C/evolution-C.omf:
+ * no/evolution-no.omf:
+ fixe compliance with OMF V1.0 DTD (needed for scrollkeeper >= 0.3)
2002-10-22 Aaron Weber <aaron@ximian.com>
@@ -1931,4 +1919,4 @@
2000-02-25 Federico Mena Quintero <federico@helixcode.com>
- * calendar.sgml: New file for the Evolution calendaring white paper. \ No newline at end of file
+ * calendar.sgml: New file for the Evolution calendaring white paper.
diff --git a/help/devel/executive-summary/evolution-services.hierarchy b/help/devel/executive-summary/evolution-services.hierarchy
deleted file mode 100644
index 37559d819d..0000000000
--- a/help/devel/executive-summary/evolution-services.hierarchy
+++ /dev/null
@@ -1,7 +0,0 @@
-GtkObject
- BonoboObject
- ExecutiveSummaryComponent
- ExecutiveSummaryComponentFactory
- Handle to remote Bonobo::Unknown
- ExecutiveSummaryComponentFactoryClient
- ExecutiveSummaryHtmlView
diff --git a/help/devel/importer/evolution-shell-importer.hierarchy b/help/devel/importer/evolution-shell-importer.hierarchy
deleted file mode 100644
index c46ebdf782..0000000000
--- a/help/devel/importer/evolution-shell-importer.hierarchy
+++ /dev/null
@@ -1,7 +0,0 @@
-GtkObject
- BonoboObject
- BonoboXObject
- EvolutionImporter
- EvolutionImporterListener
- Handle to remote Bonobo::Unknown
- EvolutionImporterClient
diff --git a/help/no/evolution-no.omf b/help/no/evolution-no.omf
index 3f8c797af6..4d059a70c3 100644
--- a/help/no/evolution-no.omf
+++ b/help/no/evolution-no.omf
@@ -1,4 +1,5 @@
-<?xml version="1.0" standalone="no"?>
+<?xml version="1.0" encoding="ISO-8859-1" standalone="no"?>
+<!DOCTYPE omf PUBLIC "-//OMF//DTD Scrollkeeper OMF Variant V1.0//EN" "http://scrollkeeper.sourceforge.net/dtds/scrollkeeper-omf-1.0/scrollkeeper-omf.dtd">
<omf>
<resource>
<creator>
@@ -12,5 +13,6 @@
<format mime="text/sgml"/>
<identifier url="index.html"/>
<language code="no"/>
+ <relation seriesid="6a2207d8-8aa4-11d6-8cb4-f0bb5a765891"/>
</resource>
</omf>
diff --git a/libibex/TODO b/libibex/TODO
new file mode 100644
index 0000000000..a087c8d1f3
--- /dev/null
+++ b/libibex/TODO
@@ -0,0 +1,61 @@
+Stability
+---------
+* ibex_open should never crash, and should never return NULL without
+errno being set. Should check for errors when reading.
+
+
+Performance
+-----------
+* Profiling, keep thinking about data structures, etc.
+
+* Check memory usage
+
+* See if writing the "inverse image" of long ref streams helps
+compression without hurting performance now. (ie, if a word appears in
+more than half of the files, write out the list of files it _doesn't_
+appear in). (I tried this before, and it wasn't working well, but the
+file format and data structures have changed a lot.)
+
+* We could save a noticeable chunk of time if normalize_word computed
+the hash of the word and then we could pass that into
+g_hash_table_insert somehow.
+
+* Make a copy of the buffer to be indexed (or provide interface for
+caller to say ibex can munge the provided data) and then use that
+rather than constantly copying things. ?
+
+
+Functionality
+-------------
+* ibex file locking
+
+* specify file mode in ibex_open
+
+* ibex_find* need to normalize the search words... should this be done
+by the caller or by ibex_find?
+
+* Needs to be some way to do a secondary search after getting results
+back from ibex_find* (ie, for "foo near bar"). This either has to be
+done by ibex, or requires us to export the normalize interface.
+
+* Does there need to be an ibex_find_any, or is that easy enough for the
+caller to do?
+
+* utf8_trans needs to cover at least two more code pages. This is
+tricky because it's not clear whether some of the letters there should
+be translated to ASCII or left as UTF8. This requires some
+investigation.
+
+* ibex_index_* need to ignore HTML tags.
+ NAME = [A-Za-z][A-Za-z0-9.-]*
+ </?{NAME}(\s*{NAME}(\s*=\s*({NAME}|"[^"]*"|'[^']*')))*>
+ <!(--([^-]*|-[^-])--\s*)*>
+
+ ugh. ok, simplifying, we get:
+ <[^!](([^"'>]*("[^"]*"|'[^']*'))*> or
+ <!(--([^-]*|-[^-])--\s*)*>
+
+ which is still not simple. sigh.
+
+* ibex_index_* need to recognize and ignore "non-text". Particularly
+BinHex and uuencoding.
diff --git a/libical/ChangeLog b/libical/ChangeLog
index 115ca75374..3ef79d9cce 100644
--- a/libical/ChangeLog
+++ b/libical/ChangeLog
@@ -1,3 +1,12 @@
+2002-11-30 Hans Petter Jansson <hpj@ximian.com>
+
+ * scripts/mkderivedparameters.pl: Generate code to free old
+ string value when a new one is set.
+
+ * 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.
+
2002-11-26 Rodrigo Moya <rodrigo@ximian.com>
* src/libical/icalyacc.y: added missing ';' for new bison to not
diff --git a/libical/scripts/mkderivedparameters.pl b/libical/scripts/mkderivedparameters.pl
index 5772065ec4..89f25306a5 100755
--- a/libical/scripts/mkderivedparameters.pl
+++ b/libical/scripts/mkderivedparameters.pl
@@ -188,7 +188,9 @@ foreach $param (keys %params){
$charorenum = " icalerror_check_arg_rz( (param!=0), \"param\");\n return ($type)((struct icalparameter_impl*)param)->string;";
- $set_code = "((struct icalparameter_impl*)param)->string = icalmemory_strdup(v);";
+ $set_code = "if (((struct icalparameter_impl*)param)->string != 0)\n" .
+ " free((void *) ((struct icalparameter_impl*)param)->string);\n" .
+ " ((struct icalparameter_impl*)param)->string = icalmemory_strdup(v);";
$pointer_check = "icalerror_check_arg_rz( (v!=0),\"v\");";
$pointer_check_v = "icalerror_check_arg_rv( (v!=0),\"v\");";
diff --git a/libical/src/libical/icalperiod.c b/libical/src/libical/icalperiod.c
index 6117df526f..b8c8cad1a5 100644
--- a/libical/src/libical/icalperiod.c
+++ b/libical/src/libical/icalperiod.c
@@ -137,8 +137,9 @@ const char* icalperiodtype_as_ical_string(struct icalperiodtype p)
icalmemory_append_string(&buf, &buf_ptr, &buf_size, end);
-
- return buf;
+ buf_ptr = icalmemory_tmp_copy (buf);
+ icalmemory_free_buffer (buf);
+ return buf_ptr;
}
diff --git a/libical/src/libical/icalyacc.y b/libical/src/libical/icalyacc.y
index 51a03d6028..c656ad4981 100644
--- a/libical/src/libical/icalyacc.y
+++ b/libical/src/libical/icalyacc.y
@@ -6,7 +6,7 @@
DESCRIPTION:
- $Id: icalyacc.y,v 1.14 2002/11/27 00:33:20 rodrigo Exp $
+ $Id: icalyacc.y,v 1.13.6.1 2002/11/27 00:32:24 rodrigo Exp $
$Locker: $
(C) COPYRIGHT 1999 Eric Busboom
diff --git a/mail/ChangeLog b/mail/ChangeLog
index ddd57b115f..83a93c7f3c 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,4 +1,4 @@
-2002-12-03 Jeffrey Stedfast <fejj@ximian.com>
+2002-12-02 Jeffrey Stedfast <fejj@ximian.com>
* mail-callbacks.c (guess_me_from_accounts): Use the same logic as
mail_generate_reply(). Fixes bug #34882
@@ -12,236 +12,28 @@
retval from message_rfc822_dnd() rather than relying on an
exception, because one will not always necessarily be set. For
MESSAGE_RFC822, also use the retval from message_rfc822_dnd().
-
-2002-12-03 Not Zed <NotZed@Ximian.com>
-
- * folder-browser.c (folder_browser_finalise/destroy): frobbed
- around with these till it exits without crashing.
-
- * message-list.c (message_list_destroy): made a destroy
- handler again (was dispose). Frobbed around with this and
- finalise till it can destroy without crashing.
-
- * message-browser.c (message_browser_new): ref/sink the
- folderbrowser.
+ Based on preliminary work by Yuedong Du.
2002-11-25 Radek Doulik <rodo@ximian.com>
* mail-preferences.c (mail_preferences_construct): magic_check -->
magic_links_check
-2002-11-27 Not Zed <NotZed@Ximian.com>
-
- * message-tag-followup.c (construct): gnome_pixmap -> gtkimage.
- (construct): gtk_clist -> gtk_tree_view, setup columns. They dont
- size well :-/
- (message_tag_followup_append_message): Append using model, remove
- clist stuff.
- (construct): Show date edit (glade bugs?)
-
- * folder-browser.c (folder_browser_class_init): gtk_marshal -> g_cclosure_marshal
- (setup_popup_icons): gnome_pixmap -> gtk_image.
- (on_right_click): gtk_pixmap -> gtk_image.
-
- * mail-accounts.c (account_delete_clicked): removed #if 0'd out code.
-
- * mail-send-recv.c (receive_done): remove FIXME and extra unref.
-
- * mail-session.c (request_password): Removed #if 0'd out stuff.
-
- * mail-vfolder.c (new_rule_clicked): proper cast for g_object_get_data.
-
- * mail-local.c (reconfigure_response): cast for g_object_get_data.
-
- * mail-account-editor.c (construct): GNOME_DIALOG -> GTK_DIALOG.
-
- * *.[ch]: re-ran fix.sh for e_notice change
-
- * mail-callbacks.c (save_msg_ok): g_object_get_data +
- gtk_object_remove_no_notify -> g_object_steal_data.
- (find_socket): gtk_container_children ->
- gtk_container_get_children
- (edit_msg): gnome_*_dialog -> gtk_message_dialog.
- (resent_msg): "
- (search_msg): "
- (confirm_goto_next_folder): gtkmessagedialogised (even if not
- used).
- (confirm_expunge): gtkmessagedialogised
- (filter_edit): "
- (do_mail_print): e_notice -> gtk_message_dialog.
- (are_you_sure): removed e_gnome_ok_cancel_dialog crap, replaced
- with a gtk dialog.
- (are_you_sure): gtkmessagedialogised.
- (edit_msg_internal): Dont free uids array, are_you_sure() free's
- it.
- (resend_msg): Same.
- (check_send_configuration): Use e_notice for stuff. Sigh, here we
- go again ...!
- (e_question): A utility function to ask a question, potentially
- with 'dont ask again' as well.
- (configure_mail): use e_question to save code. Here we go again,
- again ...
- (ask_confirm_for_unwanted_html_mail): "
- (ask_confirm_for_only_bcc): "
- (ask_confirm_for_only_bcc): "
- (composer_get_message): Use e_notice.
- (composer_save_draft_cb): Use e_question
- (edit_msg): use e_notice, & change to an ERROR.
- (resend_msg): same.
- (save_msg_ok): Properly initialise ret to OK, and use e_question,
- and use access() to determine existance/write access rather than
- stat, display an error if we can't write to a file that exists,
- and print the filename in all dialogues.
- (confirm_goto_next_folder): Use e_question.
- (confirm_expunge): use e_question.
- (filter_edit): Use e_notice.
- (do_mail_print): use e_notice.
-
-2002-11-26 Not Zed <NotZed@Ximian.com>
-
- * mail-vfolder.c (vfolder_gui_add_rule): clicked->response signal
- for gtk dialogue.
- (new_rule_clicked): Dont unref after destroy (duh, idiot again).
- (edit_rule_response): Same here.
- (mail_vfolder_delete_uri): Connect response signal to
- gtk_widget_destroy directrly using g_signal_connect_swapped.
- (close_dialogue): Removed, as no longer needed.
-
- * message-list.c (get_normalised_string): Duh idiot, "un-fixed"
- the memleak i added.
-
- * mail-callbacks.c (composer_get_message): Set parent window in
- message dialogue & DESTROY_WITH_PARENT flag.
- (composer_save_draft_cb):
- (configure_mail):
- (check_send_configuration): Add DESTROY_WITH_PARENT flag to
- gtk_message_dialog's
- (local_configure_done): remove some unecessary/wrong casts.
- (empty_trash_expunged_cb): "
- (do_mail_print): use gtk_window_set_transient_for instead of
- e_dialog_set_parent.
-
-2002-11-26 Not Zed <NotZed@Ximian.com>
-
- * mail-account-editor.c (mail_account_editor_new):
- gtk_widget_set_parent_window -> gtk_window_set_transient_for.
-
- * mail-callbacks.c (composer_send_queued_cb): dont unref composer.
-
- * message-browser.c (message_browser_destroy): moved back from
- finalise.
-
-2002-11-25 Not Zed <NotZed@Ximian.com>
-
- * message-list.c (message_list_dispose): move saving tree state
- here.
- (message_list_finalise): And take it from here.
-
- * mail-display.c (mail_display_destroy): @#$@# gtk. changed this
- around a bit.
- (mail_display_init): Fix prototype, its a gobject.
- (mail_display_init): ref/sink the invisible gtkobject.
-
-2002-11-22 Not Zed <NotZed@Ximian.com>
-
- * mail-callbacks.c (ask_confirm_for_unwanted_html_mail): removed
- e_messagebox, and use gtk_message_dialog directly.
- (ask_confirm_for_empty_subject): and here.
- (ask_confirm_for_only_bcc): And here too.
- (msgbox_destroy_cb): Removed, since no longer needed.
-
2002-11-15 Harry Lu <harry.lu@sun.com>
* mail-display.c (write_data_to_file): Show file name when prompt
- to user for overwrite. Fixes bug #34180.
+ to user for overwrite.
-2002-11-21 Harry Lu <harry.lu@sun.com>
+2002-11-20 Harry Lu <harry.lu@sun.com>
- * mail-display.c (do_attachment_header): Enable dragging of all
+ * mail-display.c (do_attachment_header): Enable dragging of all
attachments. For bug #34327.
-2002-11-21 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-preferences.c (mail_preferences_construct): Since the
- GSList returned from gconf needs to be free'd by us, we don't need
- to strdup the values. Also make sure we don't leak the GSList
- itself.
- (mail_preferences_apply): Don't leak our GSList data.
-
-2002-08-30 Radek Doulik <rodo@ximian.com>
-
- * mail-display.c (mail_display_render): don't set margins for raw
- message view
-
- * mail-format.c (mail_format_raw_message): as below
- (handle_text_plain_flowed): as below
- (mail_format_raw_message): don't use data_urls
-
- * mail-display.c (mail_text_write): put text in iframe, so it has
- margins and should not be placed in table which changes wrapping
- behavior
-
-2002-11-20 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-composer-prefs.c (mail_composer_prefs_construct): gconfify.
- (mail_composer_prefs_apply): gconfify this also.
-
- * mail-preferences.c (mail_preferences_construct):
- gconf_client_get_string() probably returns an allocated buffer.
-
-2002-11-20 Not Zed <NotZed@Ximian.com>
-
- * importers/Makefile.am (%.server.in): provide a proper implicit
- rule for building .server.in from .server.in.in. The other one
- just copied the first target to all destinations(!).
-
- * importers/evolution-outlook-importer.c (outlook_factory_fn):
- destroy -> weak ref.
-
-2002-11-19 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-preferences.c (mail_preferences_apply): Save the settings
- via gconf.
- (mail_preferences_construct): Load the values from gconf.
-
2002-11-19 Radek Doulik <rodo@ximian.com>
* mail-composer-prefs.c (sig_load_preview): use
gtk_html_begin_content to specify utf-8
-2002-11-19 Not Zed <NotZed@Ximian.com>
-
- * importers/evolution-mbox-importer.c (mail_importer_module_init):
- fix warning message, outlook->mbox.
-
- * importers/Makefile.am: fix serverdir to point to
- $libdir/bonobo/servers.
-
- * mail-callbacks.c (addrbook_sender): add type to
- bonobo_widget_set_property.
-
- * mail-vfolder.c (vfolder_editor_response): dont unref after destroy.
-
- * mail-session.c (pass_response): dont unref aftrer destroy.
-
- * mail-local.c (reconfigure_response): dont unref after destroy.
-
- * mail-display.c (launch_cb): dont unref after destroy.
- (launch_cb): "
- (drag_data_get_cb): "
- (html_button_press_event): add type to bonobo_widget::set_property
-
- * mail-config.c (mail_config_check_service): dont unref after
- destroy.
-
- * component-factory.c (send_receive_cb): dont unref after destroy.
- (request_quit): "
-
- * mail-signature-editor.c (mail_signature_editor): Use version 3.0
- of gtkhtml editor interfaces.
- (do_exit): dont unref after destroy.
- (format_html_cb): Add type to bonobo_widget::set_property.
-
2002-11-18 Radek Doulik <rodo@ximian.com>
* mail-composer-prefs.c (spell_setup_check_options): check
@@ -249,407 +41,13 @@
2002-11-18 Jeffrey Stedfast <fejj@ximian.com>
- * mail-accounts.c (mail_accounts_load): Specify the default
- account. Also, don't need to use e_utf8_to_gtk_string() here.
-
-2002-11-18 Not Zed <NotZed@Ximian.com>
-
- * Makefile.am (evolution_mail_LDADD): Added back
- libevolution-importer stuff.
- (SUBDIRS): Added back importers.
-
- * importers/evolution-mbox-importer.c (load_file_fn): build the
- uri without deprecated funcs.
- (load_file_fn): dont free/alloc a camel_exception for no obvious
- purpose.
- (mbox_factory_fn): use weak_ref rather than destroy.
- (importer_destroy_cb): fix signature for weak ref notify.
- (mbox_factory_fn): add cid param.
-
- * importers/*.[ch]: ran fix script over everything.
-
- * importers/*.server.in.in: Added bonobo activation files. Moved
- evolution-mail to @LIBEXEC@ as below.
-
- * importers/Makefile.am: oaf->bonobo activation stuff.
-
- * importers/evolution-outlook-importer.c (outlook_factory_fn): Add
- component id to callback.
-
-2002-11-15 Ettore Perazzoli <ettore@ximian.com>
-
- * Makefile.am: Add rules to substitute @LIBEXEC@ in
- GNOME_Evolution_Mail.server.in.in and install evolution-mail in
- $(libexecdir) instead of $(bindir).
+ * mail-accounts.c (mail_accounts_load): Specify which account is
+ the default account.
- * GNOME_Evolution_Mail.server.in.in: Replaced evolution-mail with
- @LIBEXECDIR@/evolution-mail.
-
-2002-11-15 Rodney Dawes <dobey@ximian.com>
-
- * component-factory.c: Use bonobo_main_quit instead of gtk
-
2002-11-15 Jeffrey Stedfast <fejj@ximian.com>
* mail-composer-prefs.c (sig_edit): Correctly spell Advanced.
-2002-11-15 Not Zed <NotZed@Ximian.com>
-
- * mail-summary.c (create_summary_view): weak notify -> ref.
-
- * mail-send-recv.c (build_dialogue): weak notify -> ref.
-
- * mail-accounts.c (account_edit_clicked): weak notify -> ref, i
- presume this is what jeff meant, 'cause it dont compile otherwise.
-
-2002-11-14 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-accounts.c (account_edit_clicked): Use g_object_weak_ref
- rather than connecting to destroy.
- (account_add_clicked): Same.
-
- * mail-callbacks.c (addrbook_sender): Make this use
- g_object_weak_notify also.
- (subscribe_dialog_destroy): Add NULL guards here since I think we
- really do want to connect to the "destroy" signal in the function
- that connects us to that signal.
-
- * mail-config-factory.c (config_control_factory_cb): Same.
-
- * mail-display.c (save_part): Here too.
- (make_popup_window): And here.
-
- * mail-send-recv.c (build_dialogue): Same here.
-
- * mail-summary.c (create_summary_view): Use g_object_weak_notify
- instead of connecting to the destroy signal.
-
-2002-11-14 Ettore Perazzoli <ettore@ximian.com>
-
- * component-factory.c (owner_set_cb): Want a (GWeakNotify) cast
- here, not (GWeakNotify *).
-
- * subscribe-dialog.c (fete_init): g_object_set() instead of
- gtk_object_set().
- (populate_store_list): Likewise.
- (menu_item_selected): g_object_get_data() instead of
- gtk_object_get_data().
-
- * message-list.c (message_list_create_extras): g_object_set()
- instead of gtk_object_set().
-
- * message-browser.c (message_browser_message_list_built):
- g_object_get_data() instead of gtk_object_get_data().
-
- * mail-vfolder.c (edit_rule_response): g_object_get_data() instead
- of gtk_object_get_data().
-
- * mail-summary.c (generate_folder_summaries): g_object_unref() the
- context instead of gtk_object_destroy().
-
- * mail-local.c (reconfigure_response): g_object_get_data() instead
- of gtk_object_get_data().
-
- * mail-display.c (pixbuf_gen_idle): g_object_unref() the GdkPixbuf
- loader instead of gtk_object_destroy().
- (pixbuf_gen_idle): Likewise.
- (embeddable_destroy_cb): Likewise.
-
- * mail-config-druid.c (mail_config_druid_destroy): No need to
- gtk_object_destroy() the GladeXML object.
- (construct): g_object_set() instead of gtk_object_set().
-
- * folder-browser.c (folder_browser_gui_init): g_object_get_data()
- instead of gtk_object_get_data().
-
-2002-11-14 Not Zed <NotZed@Ximian.com>
-
- * component-factory.c (create_view): shell client objref.
- (mail_add_storage): "
- (mail_remove_storage): "
-
-2002-11-13 Joe Shaw <joe@ximian.com>
-
- * Makefile.am: Remove a couple backslashes that were causing
- automake to complain, even though they were on lines that were
- -commented out-. Sigh.
-
-2002-11-13 Ettore Perazzoli <ettore@ximian.com>
-
- * folder-info.c (evolution_folder_info_factory_fn): Use
- g_object_new() instead of gtk_type_new().
- * folder-browser.c (folder_browser_new): Likewise.
- * mail-account-gui.c
- (mail_account_gui_folder_selector_button_new): Likewise.
- * mail-font-prefs.c (mail_font_prefs_new): Likewise.
-
-2002-11-13 Ettore Perazzoli <ettore@ximian.com>
-
- * mail-format.c: Do not #include <libgnome/gnome-defs.h>.
- * mail-importer.c: Likewise.
- * mail-mt.c: Likewise.
- * mail-ops.c: Likewise.
- * mail-search-dialogue.c: Likewise.
- * mail-session.c: Likewise.
- * mail-vfolder.c: Likewise.
- * message-tag-followup.c: Likewise.
- * main.c: Likewise, and <libgnomeui/gnome-init.h>.
-
- * mail-callbacks.c: Do not #include <libgnome/gnome-paper.h>.
- (do_mail_print): Remove the GnomePaper local variable.
-
-2002-11-13 Not Zed <NotZed@Ximian.com>
-
- * component-factory.c (owner_set_cb): destroy->weak ref.
- (owner_set_cb): shell client changes.
-
- * mail-signature-editor.c (mail_signature_editor): bonobo api changes.
-
- * mail-local.c (save_metainfo): go back to using xmlSaveFile.
-
- * Makefile.am: Removed libevolution-importer from mail.
-
-2002-11-13 Not Zed <NotZed@Ximian.com>
-
- * GNOME_Evolution_Mail.server.in.in: Added to cvs. Currently
- contains no configurable stuff, but maybe it will one day.
-
- * Makefile.am (server_DATA): change oaf stuff to server stuff for
- bonobo activation.
-
- * mail-preferences.c (mail_preferences_apply): handle const entry text.
-
- * mail-composer-prefs.c (url_requested): Fixed typo.
- (mail_composer_prefs_construct): gnomepixmap->gtkimage.
-
- * mail-callbacks.c (configure_mail): destroy dialogue before dealing
- with response.
- (mail_generate_reply): Fix a typo.
- (popup_listener_cb): fix prototype.
- (tag_editor_response): Handle gtk dialog response.
- (flag_for_followup): Change gnome dialog to gtk dialog stuff.
- (tag_editor_destroy_cb):
- (tag_editor_cancel):
- (tag_editor_ok): Removed, handled in _response().
- (filter_editor_response): renamed from _clicked, handle gtk
- dialogue signal.
- (filter_editor_destroy): Removed.
- (footer_info_new): gnome font api changes.
- (do_mail_print): port to gnome print 2.
-
- * mail-autofilter.c (mail_filter_delete_uri): message_dialog uses
- a specific button enum, not the stock ones.
-
- * mail-accounts.c (mail_accounts_tab_get_type): gobjectify.
- (account_delete_clicked): gdkdialogise.
-
- * mail-account-gui.c (mail_account_gui_setup): Hack around font
- metric determination code.
-
- * mail-account-editor.c (mail_account_editor_get_type):
- gobjectise.
- (mail_account_editor_new): ""
-
- * folder-info.c (evolution_folder_info_notify_ready): use pbclient
- interface.
-
- * folder-browser-factory.c (control_destroy_cb): fix a typo.
- (folder_browser_factory_new_control): More typos.
-
- * folder-browser.c (on_right_click): cast around const warning.
- (context_menu_position_func): fix for api change.
-
- * e-searching-tokenizer.c (e_searching_tokenizer_finalise):
- Changed from destroy since it only frees memory.
- (e_searching_tokenizer_get_type): glibify.
-
- * component-factory.c (request_quit): gtkdialogise.
- (send_receive_cb): "
- (create_component): gdk_pixbuf api.
- (component_factory_init): bonobo activation stuff.
- (warning_response): renamed from warning_clicked.
- (owner_set_cb): gtkdialogise.
-
-2002-11-12 Jeffrey Stedfast <fejj@ximian.com>
-
- * Makefile.am: Added files I've ported.
-
- * mail-config.c: Remove gnome-defs.h, this header no longer exists
- in GNOME2.
-
-2002-11-13 Not Zed <NotZed@Ximian.com>
-
- * Makefile.am: Commented out stuff that doesn't build yet. Also
- fixed idl build rule. importers still not built.
-
- * main.c (main): bonobactivationise. remove push visual/colormap.
- (main): no longer activate activation, let bonobo_init do it.
-
- * mail-signature-editor.c (menu_help): Change help api.
-
- * mail-session.c (user_message_destroy_noreply): removed. Not
- used?
-
- * mail-local.c (load_metainfo): xml root->children.
-
- * mail-format.c (g_string_append_len): Removed, it exists now.
-
-2002-11-12 Not Zed <NotZed@Ximian.com>
-
- * subscribe-dialog.c: gnome2ised, use gtkdialog.
- (subscribe_get_global_extras): use a weak ref rather than destroy
- signal.
-
- * message-tag-followup.c: gnome2ised.
-
- * message-tag-editor.c: gnome2ised & converted to gtkdialog.
-
- * message-list.c: gnome2ised.
- (message_list_finalise): From destroy method. maybe should be
- destroy still.
-
- * message-browser.c: port to gnome2
- (message_browser_finalise): renamed from destroy method.
-
- * mail-stream-gtkhtml.c: removed redundant
- camel_class_get_global_classfuncs() call.
-
- * mail-signature-editor.c: gtkdialogised, & bonobo api changes.
-
-
- * mail-search-dialogue.c: gtkdialogised.
-
- * mail-folder-cache.c: cleaned up camel ref/hook casts.
-
- * mail-composer-prefs.c (mail_composer_prefs_get_type): convert to
- gtype.
-
- * mail-font-prefs.c (mail_font_prefs_destroy): from finalise.
-
- * mail-config.c: s/bonobo_config/e_config_listener/ Added
- /apps/Evolution prefix to the evolution keys. Changed to use
- e_config_listener, etc.
- (mail_config_init): remove bonobo_config stuff.
- (mail_config_check_service): gtk dialogise.
- (check_response): from check_cancelled.
-
- * mail-config-druid.c (mail_config_druid_destroy): renamed from
- _finalize, turned into destroy handler.
- (construct): set type to toplevel, GTK_WINDOW_DIALOG no longer
- exists.
-
- * mail-config-factory.c (mail_config_register_factory): bonobo api
- changes.
-
- * mail-crypto.c (mail_crypto_get_pgp_cipher_context): cleaned up
- unref casts.
-
- * mail-display.c (write_data_to_file): gnome->gtkdialog.
- (on_link_clicked): use ascii_str*cmp on url.
- (save_part): g_path stuff.
- (launch_cb): gtk dialog.
- (pixmap_press): de-oafify.
- (pixbuf_for_mime_type): gnome-vfs api changes.
- (do_attachment_header): Change the pixmap to a gtkimage.
- (do_signature): "
- (pixbuf_gen_idle): "
- (do_attachment_header): ascii_str*cmp
- (do_attachment_header): gnome pixmap->gtkimage.
- (mail_display_destroy): protect against gtk mentalness.
- (html_button_press_event): ascii_str*cmp
- (drag_data_get_cb): added comment for translators of filename.
-
- * mail-format.c (component_supports): de-oafise.
- (is_anonymous): ascii_strncmp
- (attachment_header): remove utf8<>locale stuff, and gnomevfs api
- changes.
- (format_mime_part): fix g_strdown call.
- (write_field_row_begin): kill utf8->gtk stuff.
- (write_address): "
- (default_header_index): ascii_strcasecmp
- (handle_text_plain): "
- (handle_text_enriched): "
- (handle_multipart_encrypted): remove utf/gtk stuff.
- (handle_message_external_body): ascii_str*cmp
-
- * mail-identify.c (mail_identify_mime_part):
- (identify_by_magic): gnome vfs api changes.
-
- * mail-importer.c: Converted.
-
- * mail-local.c (load_metainfo): xml childs -> children.
- (mls_get_folder): g_strerror.
- (mls_delete_folder): g_strerror.
- (reconfigure_got_folder): Gnome->GtkDialog
- (reconfigure_response): from reconfigure_clicked.
-
- * mail-mt.c (mail_msg_check_error): gnome -> gtk dialog
- (error_response): renmae from error_gone. destroy widget on any
- response.
-
- * mail-offline-handler.c (impl_finalise): renamed from
- impl_destroy since thats what it should be anyway.
-
- * mail-ops.c: removed utf8 widget conversion & camel_object_un/ref
- casts.
-
- * mail-preferences.c (mail_preferences_get_type): glib2'ised.
-
- * mail-search.c (mail_search_finalise): renmaed from destroy &
- properly chain.
- (mail_search_get_type): glib2 & make gtkdialog parent.
- (entry_run_search): run search when entry activated. not sure if
- gtkdialog has anohter way to do this on an arbitrary widget.
-
- * mail-send-recv.c (dialogue_response): renamed from clicked. Use
- gtkdialog.
-
- * mail-session.c (request_password_deleted): removed, redundant.
- (pass_response): rename from pass_got, changed for gtkdialog.
- (user_message_destroy): Removed, redundant.
- (user_message_response): Renamed from user_message_clicked.
-
-2002-11-11 Not Zed <NotZed@Ximian.com>
-
- * mail-stream-gtkhtml.c (mail_stream_gtkhtml_class_init): dont use
- get_global_classfuncs, just get the type
-
- * mail-tools.c: converted gnome2 api's.
-
- * mail-vfolder.c (vfolder_editor_response): clicked->response.
- (vfolder_editor_destroy): Removed.
- (vfolder_edit): gtk dialog api
- (edit_rule_response): clicked->response.
- (vfolder_edit_rule): gnomedialog->gtkdialog.
- (vfolder_gui_add_rule): "
- (new_rule_clicked): clicked->response
-
-2002-11-11 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-callbacks.c: Half way ported. I'll finish the rest later.
-
- * mail-autofilter.c: Ported.
-
- * mail-account-gui.c: Ported.
-
- * mail-account-editor.c: Ported.
-
- * folder-browser-ui.c: Ported.
-
- * folder-browser-factory.c: Ported.
-
- * folder-browser.c: Ported.
-
- * e-searching-tokenizer.c: Roughly ported.
-
-2002-11-10 Jeffrey Stedfast <fejj@ximian.com>
-
- * *.glade: Converted to libglade-2's format.
-
-2002-11-08 Jeffrey Stedfast <fejj@ximian.com>
-
- * mail-composer-prefs.c: Ported.
-
2002-10-28 Jeffrey Stedfast <fejj@ximian.com>
* folder-browser.c (folder_browser_query_changed): No longer need
diff --git a/mail/component-factory.c b/mail/component-factory.c
index 03aaa2c5b6..f1c94572a8 100644
--- a/mail/component-factory.c
+++ b/mail/component-factory.c
@@ -27,8 +27,6 @@
#include <bonobo/bonobo-generic-factory.h>
#include <gal/widgets/e-gui-utils.h>
-#include <string.h>
-
#include "camel.h"
#include "Evolution.h"
@@ -149,7 +147,7 @@ create_view (EvolutionShellComponent *shell_component,
BonoboControl *control;
shell_client = evolution_shell_component_get_owner (shell_component);
- corba_shell = evolution_shell_client_corba_objref(shell_client);
+ corba_shell = bonobo_object_corba_objref (BONOBO_OBJECT (shell_client));
if (type_is_mail (folder_type)) {
const char *noselect;
@@ -157,14 +155,14 @@ create_view (EvolutionShellComponent *shell_component,
url = camel_url_new (physical_uri, NULL);
noselect = url ? camel_url_get_param (url, "noselect") : NULL;
- if (noselect && !strcasecmp (noselect, "yes"))
+ if (noselect && !g_strcasecmp (noselect, "yes"))
control = create_noselect_control ();
else
control = folder_browser_factory_new_control (physical_uri,
corba_shell);
camel_url_free (url);
} else if (type_is_vtrash (folder_type)) {
- if (!strncasecmp (physical_uri, "file:", 5))
+ if (!g_strncasecmp (physical_uri, "file:", 5))
control = folder_browser_factory_new_control ("vtrash:file:/", corba_shell);
else
control = folder_browser_factory_new_control (physical_uri, corba_shell);
@@ -343,7 +341,7 @@ xfer_folder (EvolutionShellComponent *shell_component,
if (remove && strcmp(src->protocol, dst->protocol) == 0) {
char *sname, *dname;
CamelStore *store;
-
+
if (src->fragment)
sname = src->fragment;
else {
@@ -352,7 +350,7 @@ xfer_folder (EvolutionShellComponent *shell_component,
else
sname = "";
}
-
+
if (dst->fragment)
dname = dst->fragment;
else {
@@ -361,11 +359,11 @@ xfer_folder (EvolutionShellComponent *shell_component,
else
dname = "";
}
-
+
store = camel_session_get_store(session, source_physical_uri, &ex);
if (store != NULL)
camel_store_rename_folder(store, sname, dname, &ex);
-
+
if (camel_exception_is_set(&ex))
GNOME_Evolution_ShellComponentListener_notifyResult (listener, GNOME_Evolution_ShellComponentListener_INVALID_URI, &ev);
else {
@@ -377,7 +375,7 @@ xfer_folder (EvolutionShellComponent *shell_component,
camel_object_unref((CamelObject *)store);
} else {
source = mail_tool_uri_to_folder (source_physical_uri, 0, &ex);
-
+
if (source) {
xfer_folder_data *xfd;
@@ -385,17 +383,17 @@ xfer_folder (EvolutionShellComponent *shell_component,
xfd->remove_source = remove_source;
xfd->source_uri = g_strdup (source_physical_uri);
xfd->listener = CORBA_Object_duplicate (listener, &ev);
-
+
uids = camel_folder_get_uids (source);
mail_transfer_messages (source, uids, remove_source, destination_physical_uri, CAMEL_STORE_FOLDER_CREATE, xfer_folder_done, xfd);
camel_object_unref (CAMEL_OBJECT (source));
} else
GNOME_Evolution_ShellComponentListener_notifyResult (listener, GNOME_Evolution_ShellComponentListener_INVALID_URI, &ev);
}
-
+
CORBA_exception_free (&ev);
camel_exception_clear (&ex);
-
+
camel_url_free(src);
camel_url_free(dst);
}
@@ -404,12 +402,13 @@ static void
configure_folder_popup(BonoboUIComponent *component, void *user_data, const char *cname)
{
char *uri = user_data;
-
+
+
if (strncmp(uri, "vfolder:", 8) == 0)
vfolder_edit_rule(uri);
else {
FolderBrowser *fb = folder_browser_factory_get_browser(uri);
-
+
if (fb)
configure_folder(component, fb, cname);
else
@@ -433,16 +432,14 @@ populate_folder_context_menu (EvolutionShellComponent *shell_component,
if (!type_is_mail (type))
return;
-
+
/* FIXME: handle other types */
-
+
/* the unmatched test is a bit of a hack but it works */
if ((strncmp(physical_uri, "vfolder:", 8) == 0
&& strstr(physical_uri, "#" CAMEL_UNMATCHED_NAME) == NULL)
|| strncmp(physical_uri, "file:", 5) == 0) {
- bonobo_ui_component_add_verb_full(uic, "ChangeFolderPropertiesPopUp",
- g_cclosure_new(G_CALLBACK(configure_folder_popup),
- g_strdup(physical_uri), (GClosureNotify)g_free));
+ bonobo_ui_component_add_verb_full(uic, "ChangeFolderPropertiesPopUp", configure_folder_popup, g_strdup(physical_uri), g_free);
bonobo_ui_component_set_translate (uic, EVOLUTION_SHELL_COMPONENT_POPUP_PLACEHOLDER, popup_xml, NULL);
}
}
@@ -456,9 +453,9 @@ unpopulate_folder_context_menu (EvolutionShellComponent *shell_component,
{
if (!type_is_mail (type))
return;
-
+
/* FIXME: handle other types */
-
+
/* the unmatched test is a bit of a hack but it works */
if ((strncmp(physical_uri, "vfolder:", 8) == 0
&& strstr(physical_uri, "#" CAMEL_UNMATCHED_NAME) == NULL)
@@ -496,7 +493,7 @@ destination_folder_handle_motion (EvolutionShellComponentDndDestinationFolder *f
url = camel_url_new (physical_uri, NULL);
noselect = url ? camel_url_get_param (url, "noselect") : NULL;
- if (noselect && !strcasecmp (noselect, "yes"))
+ if (noselect && !g_strcasecmp (noselect, "yes"))
/* uh, no way to say "illegal" */
*suggested_action_return = GNOME_Evolution_ShellComponentDnd_ACTION_DEFAULT;
else
@@ -526,7 +523,7 @@ message_rfc822_dnd (CamelFolder *dest, CamelStream *stream, CamelException *ex)
msg = camel_mime_message_new ();
if (camel_mime_part_construct_from_parser (CAMEL_MIME_PART (msg), mp) == -1) {
- camel_object_unref (msg);
+ camel_object_unref (CAMEL_OBJECT (msg));
handled = FALSE;
break;
}
@@ -534,7 +531,7 @@ message_rfc822_dnd (CamelFolder *dest, CamelStream *stream, CamelException *ex)
/* append the message to the folder... */
info = g_new0 (CamelMessageInfo, 1);
camel_folder_append_message (dest, msg, info, NULL, ex);
- camel_object_unref (msg);
+ camel_object_unref (CAMEL_OBJECT (msg));
if (camel_exception_is_set (ex)) {
handled = FALSE;
@@ -545,7 +542,7 @@ message_rfc822_dnd (CamelFolder *dest, CamelStream *stream, CamelException *ex)
camel_mime_parser_step (mp, 0, 0);
}
- camel_object_unref (mp);
+ camel_object_unref (CAMEL_OBJECT (mp));
return handled;
}
@@ -578,7 +575,7 @@ destination_folder_handle_drop (EvolutionShellComponentDndDestinationFolder *des
uri = camel_url_new (physical_uri, NULL);
noselect = uri ? camel_url_get_param (uri, "noselect") : NULL;
- if (noselect && !strcasecmp (noselect, "yes")) {
+ if (noselect && !g_strcasecmp (noselect, "yes")) {
camel_url_free (uri);
return FALSE;
}
@@ -630,8 +627,8 @@ destination_folder_handle_drop (EvolutionShellComponentDndDestinationFolder *des
stream = camel_stream_fs_new_with_fd (fd);
retval = message_rfc822_dnd (folder, stream, &ex);
- camel_object_unref (stream);
- camel_object_unref (folder);
+ camel_object_unref (CAMEL_OBJECT (stream));
+ camel_object_unref (CAMEL_OBJECT (folder));
if (action == GNOME_Evolution_ShellComponentDnd_ACTION_MOVE && retval)
unlink (url);
@@ -654,8 +651,8 @@ destination_folder_handle_drop (EvolutionShellComponentDndDestinationFolder *des
camel_stream_reset (stream);
retval = message_rfc822_dnd (folder, stream, &ex);
- camel_object_unref (stream);
- camel_object_unref (folder);
+ camel_object_unref (CAMEL_OBJECT (stream));
+ camel_object_unref (CAMEL_OBJECT (folder));
break;
case ACCEPTED_DND_TYPE_X_EVOLUTION_MESSAGE:
folder = mail_tools_x_evolution_message_parse (data->bytes._buffer,
@@ -669,7 +666,7 @@ destination_folder_handle_drop (EvolutionShellComponentDndDestinationFolder *des
action == GNOME_Evolution_ShellComponentDnd_ACTION_MOVE,
physical_uri, 0, NULL, NULL);
- camel_object_unref (folder);
+ camel_object_unref (CAMEL_OBJECT (folder));
break;
default:
break;
@@ -741,7 +738,7 @@ shell_client_destroy (GtkObject *object)
}
static void
-warning_response (GtkWidget *dialog, int button, gpointer user_data)
+warning_clicked (GtkWidget *dialog, gpointer user_data)
{
gtk_widget_destroy (dialog);
}
@@ -758,7 +755,8 @@ owner_set_cb (EvolutionShellComponent *shell_component,
/* FIXME: should we ref this? */
global_shell_client = shell_client;
- g_object_weak_ref(G_OBJECT(shell_client), (GWeakNotify)shell_client_destroy, NULL);
+ gtk_signal_connect (GTK_OBJECT (shell_client), "destroy",
+ shell_client_destroy, NULL);
evolution_dir = g_strdup (evolution_homedir);
mail_session_init ();
@@ -767,7 +765,7 @@ owner_set_cb (EvolutionShellComponent *shell_component,
storages_hash = g_hash_table_new (NULL, NULL);
- corba_shell = evolution_shell_client_corba_objref(shell_client);
+ corba_shell = bonobo_object_corba_objref (BONOBO_OBJECT (shell_client));
for (i = 0; i < sizeof (standard_folders) / sizeof (standard_folders[0]); i++)
*standard_folders[i].uri = g_strdup_printf ("file://%s/local/%s", evolution_dir, standard_folders[i].name);
@@ -793,8 +791,8 @@ owner_set_cb (EvolutionShellComponent *shell_component,
char *system = g_strdup (EVOLUTION_DATADIR "/evolution/vfoldertypes.xml");
search_context = rule_context_new ();
- g_object_set_data_full(G_OBJECT(search_context), "user", user, g_free);
- g_object_set_data_full(G_OBJECT(search_context), "system", system, g_free);
+ gtk_object_set_data_full (GTK_OBJECT (search_context), "user", user, g_free);
+ gtk_object_set_data_full (GTK_OBJECT (search_context), "system", system, g_free);
rule_context_add_part_set (search_context, "partset", filter_part_get_type (),
rule_context_add_part, rule_context_next_part);
@@ -809,11 +807,11 @@ owner_set_cb (EvolutionShellComponent *shell_component,
if (mail_config_is_corrupt ()) {
GtkWidget *dialog;
-
- dialog = gtk_message_dialog_new(NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_WARNING, GTK_BUTTONS_CLOSE,
- _("Some of your mail settings seem corrupt, "
+
+ dialog = gnome_warning_dialog (_("Some of your mail settings seem corrupt, "
"please check that everything is in order."));
- g_signal_connect(dialog, "response", G_CALLBACK(warning_response), NULL);
+ gtk_signal_connect (GTK_OBJECT (dialog), "clicked", warning_clicked, NULL);
+ gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
gtk_widget_show (dialog);
}
@@ -913,7 +911,7 @@ idle_quit (gpointer user_data)
if (e_list_length (folder_browser_factory_get_control_list ()))
return TRUE;
- bonobo_main_quit ();
+ gtk_main_quit ();
return FALSE;
}
@@ -923,16 +921,16 @@ static void owner_unset_cb (EvolutionShellComponent *shell_component, gpointer u
/* Table for signal handler setup/cleanup */
static struct {
char *sig;
- GCallback func;
+ GtkSignalFunc func;
int hand;
} shell_component_handlers[] = {
- { "owner_set", G_CALLBACK(owner_set_cb), },
- { "owner_unset", G_CALLBACK(owner_unset_cb), },
- { "debug", G_CALLBACK(debug_cb), },
- { "interactive", G_CALLBACK(interactive_cb) },
- { "destroy", G_CALLBACK(owner_unset_cb), },
- { "handle_external_uri", G_CALLBACK(handle_external_uri_cb), },
- { "user_create_new_item", G_CALLBACK(user_create_new_item_cb) }
+ { "owner_set", owner_set_cb, },
+ { "owner_unset", owner_unset_cb, },
+ { "debug", debug_cb, },
+ { "interactive", interactive_cb },
+ { "destroy", owner_unset_cb, },
+ { "handle_external_uri", handle_external_uri_cb, },
+ { "user_create_new_item", user_create_new_item_cb }
};
static void
@@ -941,7 +939,7 @@ owner_unset_cb (EvolutionShellComponent *shell_component, gpointer user_data)
int i;
for (i=0;i<sizeof(shell_component_handlers)/sizeof(shell_component_handlers[0]);i++)
- g_signal_handler_disconnect((GtkObject *)shell_component, shell_component_handlers[i].hand);
+ gtk_signal_disconnect((GtkObject *)shell_component, shell_component_handlers[i].hand);
if (mail_config_get_empty_trash_on_exit ())
empty_trash (NULL, NULL, NULL);
@@ -952,7 +950,7 @@ owner_unset_cb (EvolutionShellComponent *shell_component, gpointer user_data)
global_shell_client = NULL;
mail_session_set_interactive (FALSE);
- g_object_unref((search_context));
+ gtk_object_unref (GTK_OBJECT (search_context));
search_context = NULL;
g_timeout_add(100, idle_quit, NULL);
@@ -975,10 +973,9 @@ send_receive_cb (EvolutionShellComponent *shell_component,
if (!account || !account->transport) {
GtkWidget *dialog;
- dialog = gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE,
- _("You have not set a mail transport method"));
- gtk_dialog_run((GtkDialog *)dialog);
- gtk_widget_destroy(dialog);
+ dialog = gnome_error_dialog (_("You have not set a mail transport method"));
+ gnome_dialog_set_close (GNOME_DIALOG (dialog), TRUE);
+ gtk_widget_show (dialog);
return;
}
@@ -991,21 +988,25 @@ request_quit (EvolutionShellComponent *shell_component,
void *closure)
{
GtkWidget *dialog;
- int resp;
-
+
if (!e_msg_composer_request_close_all ())
return FALSE;
if (!outbox_folder || !camel_folder_get_message_count (outbox_folder))
return TRUE;
-
- dialog = gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_INFO, GTK_BUTTONS_YES_NO,
- _("You have unsent messages, do you wish to quit anyway?"));
- gtk_dialog_set_default_response((GtkDialog *)dialog, GTK_RESPONSE_NO);
- resp = gtk_dialog_run((GtkDialog *)dialog);
- gtk_widget_destroy(dialog);
-
- return resp == GTK_RESPONSE_YES;
+
+ dialog = gnome_message_box_new (_("You have unsent messages, do you wish to quit anyway?"),
+ GNOME_MESSAGE_BOX_QUESTION,
+ GNOME_STOCK_BUTTON_YES, /* Quit */
+ GNOME_STOCK_BUTTON_NO, /* Don't quit */
+ NULL);
+
+ gtk_window_set_title (GTK_WINDOW (dialog), _("Warning: Unsent Messages"));
+ gnome_dialog_set_default (GNOME_DIALOG (dialog), 1);
+ if (gnome_dialog_run_and_close (GNOME_DIALOG (dialog)) == 0)
+ return TRUE;
+
+ return FALSE;
}
static BonoboObject *
@@ -1028,8 +1029,8 @@ create_component (void)
request_quit,
NULL);
- g_signal_connect((shell_component), "send_receive",
- G_CALLBACK (send_receive_cb), NULL);
+ gtk_signal_connect (GTK_OBJECT (shell_component), "send_receive",
+ GTK_SIGNAL_FUNC (send_receive_cb), NULL);
destination_interface = evolution_shell_component_dnd_destination_folder_new (destination_folder_handle_motion,
destination_folder_handle_drop,
@@ -1040,26 +1041,26 @@ create_component (void)
evolution_mail_config_wizard_init ();
- icon = gdk_pixbuf_new_from_file (EVOLUTION_ICONSDIR "/new-message.xpm", NULL);
+ icon = gdk_pixbuf_new_from_file (EVOLUTION_ICONSDIR "/new-message.xpm");
evolution_shell_component_add_user_creatable_item (shell_component, "message",
_("New Mail Message"), _("_Mail Message"),
_("Compose a new mail message"),
"mail", 'm',
icon);
if (icon != NULL)
- g_object_unref (icon);
+ gdk_pixbuf_unref (icon);
- icon = gdk_pixbuf_new_from_file (EVOLUTION_ICONSDIR "/post-message-16.png", NULL);
+ icon = gdk_pixbuf_new_from_file (EVOLUTION_ICONSDIR "/post-message-16.png");
evolution_shell_component_add_user_creatable_item (shell_component, "post",
_("New Message Post"), _("_Post Message"),
_("Post a new mail message"),
"mail/public", 'p',
icon);
if (icon != NULL)
- g_object_unref (icon);
+ gdk_pixbuf_unref (icon);
for (i=0;i<sizeof(shell_component_handlers)/sizeof(shell_component_handlers[0]);i++) {
- shell_component_handlers[i].hand = g_signal_connect((shell_component),
+ shell_component_handlers[i].hand = gtk_signal_connect(GTK_OBJECT(shell_component),
shell_component_handlers[i].sig,
shell_component_handlers[i].func, NULL);
}
@@ -1077,24 +1078,24 @@ component_factory_init (void)
int result;
shell_component = create_component ();
- result = bonobo_activation_active_server_register (COMPONENT_ID, bonobo_object_corba_objref (shell_component));
- if (result == Bonobo_ACTIVATION_REG_ERROR) {
- e_notice (NULL, GTK_MESSAGE_ERROR,
+ result = oaf_active_server_register (COMPONENT_ID, bonobo_object_corba_objref (shell_component));
+ if (result == OAF_REG_ERROR) {
+ e_notice (NULL, GNOME_MESSAGE_BOX_ERROR,
_("Cannot initialize the Evolution mail component."));
exit (1);
- } else if (result == Bonobo_ACTIVATION_REG_ALREADY_ACTIVE) {
+ } else if (result == OAF_REG_ALREADY_ACTIVE) {
g_warning ("evolution-mail is already running");
exit (1);
}
if (evolution_mail_config_factory_init () == FALSE) {
- e_notice (NULL, GTK_MESSAGE_ERROR,
+ e_notice (NULL, GNOME_MESSAGE_BOX_ERROR,
_("Cannot initialize Evolution's mail config component."));
exit (1);
}
if (evolution_folder_info_factory_init () == FALSE) {
- e_notice (NULL, GTK_MESSAGE_ERROR,
+ e_notice (NULL, GNOME_MESSAGE_BOX_ERROR,
_("Cannot initialize Evolution's folder info component."));
exit (1);
}
@@ -1357,10 +1358,10 @@ add_storage (const char *name, const char *uri, CamelService *store,
EvolutionStorageResult res;
storage = evolution_storage_new (name, FALSE);
- g_signal_connect(storage, "open_folder", G_CALLBACK(storage_connect), store);
- g_signal_connect(storage, "create_folder", G_CALLBACK(storage_create_folder), store);
- g_signal_connect(storage, "remove_folder", G_CALLBACK(storage_remove_folder), store);
- g_signal_connect(storage, "xfer_folder", G_CALLBACK(storage_xfer_folder), store);
+ gtk_signal_connect (GTK_OBJECT (storage), "open_folder", storage_connect, store);
+ gtk_signal_connect (GTK_OBJECT (storage), "create_folder", storage_create_folder, store);
+ gtk_signal_connect (GTK_OBJECT (storage), "remove_folder", storage_remove_folder, store);
+ gtk_signal_connect ((GtkObject *)storage, "xfer_folder", storage_xfer_folder, store);
res = evolution_storage_register_on_shell (storage, corba_shell);
@@ -1393,7 +1394,7 @@ mail_add_storage (CamelStore *store, const char *name, const char *uri)
g_return_if_fail (CAMEL_IS_STORE (store));
shell_client = evolution_shell_component_get_owner (shell_component);
- shell = evolution_shell_client_corba_objref (shell_client);
+ shell = bonobo_object_corba_objref (BONOBO_OBJECT (shell_client));
camel_exception_init (&ex);
@@ -1552,7 +1553,7 @@ mail_remove_storage (CamelStore *store)
mail_note_store_remove(store);
shell_client = evolution_shell_component_get_owner (shell_component);
- corba_shell = evolution_shell_client_corba_objref(shell_client);
+ corba_shell = bonobo_object_corba_objref (BONOBO_OBJECT (shell_client));
evolution_storage_deregister_on_shell (storage, corba_shell);
diff --git a/mail/mail-accounts.c b/mail/mail-accounts.c
index 43b957ff05..1ad5c066fa 100644
--- a/mail/mail-accounts.c
+++ b/mail/mail-accounts.c
@@ -27,9 +27,12 @@
#include "mail-accounts.h"
+#include <libgnomeui/gnome-stock.h>
+#include <libgnomeui/gnome-messagebox.h>
#include <gal/e-table/e-table-memory-store.h>
#include <gal/e-table/e-table-scrolled.h>
#include <gal/e-table/e-cell-toggle.h>
+#include <gal/util/e-unicode-i18n.h>
#include <gal/widgets/e-unicode.h>
#include <camel/camel-url.h>
@@ -47,7 +50,7 @@
static void mail_accounts_tab_class_init (MailAccountsTabClass *class);
static void mail_accounts_tab_init (MailAccountsTab *prefs);
-static void mail_accounts_tab_finalise (GObject *obj);
+static void mail_accounts_tab_finalise (GtkObject *obj);
static void mail_accounts_load (MailAccountsTab *tab);
@@ -60,23 +63,23 @@ static GtkVBoxClass *parent_class = NULL;
#define PREFS_WINDOW(prefs) GTK_WINDOW (gtk_widget_get_ancestor (GTK_WIDGET (prefs), GTK_TYPE_WINDOW))
-GType
+GtkType
mail_accounts_tab_get_type (void)
{
- static GType type = 0;
+ static GtkType type = 0;
if (!type) {
- GTypeInfo type_info = {
- sizeof (MailAccountsTabClass),
- NULL, NULL,
- (GClassInitFunc) mail_accounts_tab_class_init,
- NULL, NULL,
+ GtkTypeInfo type_info = {
+ "MailAccountsTab",
sizeof (MailAccountsTab),
- 0,
- (GInstanceInitFunc) mail_accounts_tab_init,
+ sizeof (MailAccountsTabClass),
+ (GtkClassInitFunc) mail_accounts_tab_class_init,
+ (GtkObjectInitFunc) mail_accounts_tab_init,
+ (GtkArgSetFunc) NULL,
+ (GtkArgGetFunc) NULL
};
- type = g_type_register_static (gtk_vbox_get_type (), "MailAccountsTab", &type_info, 0);
+ type = gtk_type_unique (gtk_vbox_get_type (), &type_info);
}
return type;
@@ -85,10 +88,10 @@ mail_accounts_tab_get_type (void)
static void
mail_accounts_tab_class_init (MailAccountsTabClass *klass)
{
- GObjectClass *object_class;
+ GtkObjectClass *object_class;
- object_class = (GObjectClass *) klass;
- parent_class = g_type_class_ref(gtk_vbox_get_type ());
+ object_class = (GtkObjectClass *) klass;
+ parent_class = gtk_type_class (gtk_vbox_get_type ());
object_class->finalize = mail_accounts_tab_finalise;
/* override methods */
@@ -109,30 +112,29 @@ mail_accounts_tab_init (MailAccountsTab *prefs)
}
static void
-mail_accounts_tab_finalise (GObject *obj)
+mail_accounts_tab_finalise (GtkObject *obj)
{
MailAccountsTab *prefs = (MailAccountsTab *) obj;
- g_object_unref((prefs->gui));
+ gtk_object_unref (GTK_OBJECT (prefs->gui));
gdk_pixmap_unref (prefs->mark_pixmap);
- g_object_unref (prefs->mark_bitmap);
+ gdk_bitmap_unref (prefs->mark_bitmap);
- ((GObjectClass *)(parent_class))->finalize (obj);
+ ((GtkObjectClass *)(parent_class))->finalize (obj);
}
static void
-account_add_finished (MailAccountsTab *prefs, GObject *deadbeef)
+account_add_finished (GtkWidget *widget, gpointer user_data)
{
/* Either Cancel or Finished was clicked in the druid so reload the accounts */
+ MailAccountsTab *prefs = user_data;
+
prefs->druid = NULL;
-#warning "GTK_OBJECT_DESTROYED"
-#if 0
if (!GTK_OBJECT_DESTROYED (prefs))
-#endif
mail_accounts_load (prefs);
- g_object_unref (prefs);
+ gtk_object_unref ((GtkObject *) prefs);
}
static void
@@ -142,28 +144,27 @@ account_add_clicked (GtkButton *button, gpointer user_data)
if (prefs->druid == NULL) {
prefs->druid = (GtkWidget *) mail_config_druid_new (prefs->shell);
- g_object_weak_ref ((GObject *) prefs->druid,
- (GWeakNotify) account_add_finished, prefs);
+ gtk_signal_connect (GTK_OBJECT (prefs->druid), "destroy",
+ GTK_SIGNAL_FUNC (account_add_finished), prefs);
gtk_widget_show (prefs->druid);
- g_object_ref (prefs);
+ gtk_object_ref ((GtkObject *) prefs);
} else {
gdk_window_raise (prefs->druid->window);
}
}
static void
-account_edit_finished (MailAccountsTab *prefs, GObject *deadbeef)
+account_edit_finished (GtkWidget *widget, gpointer user_data)
{
+ MailAccountsTab *prefs = user_data;
+
prefs->editor = NULL;
-#warning "GTK_OBJECT_DESTROYED"
-#if 0
if (!GTK_OBJECT_DESTROYED (prefs))
-#endif
mail_accounts_load (prefs);
- g_object_unref (prefs);
+ gtk_object_unref ((GtkObject *) prefs);
}
static void
@@ -190,9 +191,11 @@ account_edit_clicked (GtkButton *button, gpointer user_data)
account = gtk_clist_get_row_data (prefs->table, row);
#endif
prefs->editor = (GtkWidget *) mail_account_editor_new (account, GTK_WINDOW (window), prefs);
- g_object_weak_ref ((GObject *) prefs->editor, (GWeakNotify) account_edit_finished, prefs);
+ gtk_signal_connect (GTK_OBJECT (prefs->editor), "destroy",
+ GTK_SIGNAL_FUNC (account_edit_finished),
+ prefs);
gtk_widget_show (prefs->editor);
- g_object_ref (prefs);
+ gtk_object_ref ((GtkObject *) prefs);
}
} else {
gdk_window_raise (prefs->editor->window);
@@ -204,8 +207,7 @@ account_delete_clicked (GtkButton *button, gpointer user_data)
{
MailAccountsTab *prefs = user_data;
const MailConfigAccount *account;
- GtkDialog *confirm;
- GtkButton *tmp;
+ GnomeDialog *confirm;
const GSList *list;
int row, ans;
@@ -218,22 +220,19 @@ account_delete_clicked (GtkButton *button, gpointer user_data)
/* make sure we have a valid account selected and that we aren't editing anything... */
if (row < 0 || prefs->editor != NULL)
return;
-
- confirm = (GtkDialog *)gtk_message_dialog_new(PREFS_WINDOW (prefs),
- GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE,
- _("Are you sure you want to delete this account?"));
- tmp = (GtkButton *)gtk_button_new_from_stock(GTK_STOCK_YES);
- gtk_button_set_label(tmp, _("Delete"));
- gtk_dialog_add_action_widget(confirm, (GtkWidget *)tmp, GTK_RESPONSE_YES);
- tmp = (GtkButton *)gtk_button_new_from_stock(GTK_STOCK_NO);
- gtk_button_set_label(tmp, _("Don't delete"));
- gtk_dialog_add_action_widget(confirm, (GtkWidget *)tmp, GTK_RESPONSE_NO);
- ans = gtk_dialog_run(confirm);
- gtk_widget_destroy((GtkWidget *)confirm);
- g_object_unref(confirm);
-
- if (ans == GTK_RESPONSE_YES) {
+
+ confirm = GNOME_DIALOG (gnome_message_box_new (_("Are you sure you want to delete this account?"),
+ GNOME_MESSAGE_BOX_QUESTION,
+ NULL));
+ gnome_dialog_append_button_with_pixmap (confirm, _("Delete"), GNOME_STOCK_BUTTON_YES);
+ gnome_dialog_append_button_with_pixmap (confirm, _("Don't delete"), GNOME_STOCK_BUTTON_NO);
+ gtk_window_set_policy (GTK_WINDOW (confirm), TRUE, TRUE, TRUE);
+ gtk_window_set_modal (GTK_WINDOW (confirm), TRUE);
+ gtk_window_set_title (GTK_WINDOW (confirm), _("Really delete account?"));
+ gnome_dialog_set_parent (confirm, PREFS_WINDOW (prefs));
+ ans = gnome_dialog_run_and_close (confirm);
+
+ if (ans == 0) {
int select, len;
#if USE_ETABLE
@@ -457,18 +456,20 @@ mail_accounts_load (MailAccountsTab *prefs)
#else
{
const MailConfigAccount *default_account;
- char *text[3];
+ char *str, *text[3];
default_account = mail_config_get_default_account ();
+ str = e_utf8_to_gtk_string (GTK_WIDGET (prefs->table), account->name);
+
text[0] = NULL;
- text[1] = g_strdup_printf ("%s%s%s", account->name,
- account == default_account ? " " : "",
+ text[1] = g_strdup_printf ("%s%s%s", str, account == default_account ? " " : "",
account == default_account ? _("[Default]") : "");
text[2] = url && url->protocol ? url->protocol : (char *) _("None");
gtk_clist_insert (prefs->table, row, text);
+ g_free (str);
g_free (text[1]);
if (account->source->enabled)
@@ -543,7 +544,7 @@ mail_accounts_etable_new (char *widget_name, char *string1, char *string2, int i
gtk_container_add (GTK_CONTAINER (scrolled), table);
- g_object_set_data(G_OBJECT(scrolled), "table", table);
+ gtk_object_set_data (GTK_OBJECT (scrolled), "table", table);
gtk_widget_show (scrolled);
gtk_widget_show (table);
@@ -558,7 +559,7 @@ mail_accounts_tab_construct (MailAccountsTab *prefs)
GtkWidget *toplevel, *widget;
GladeXML *gui;
- gui = glade_xml_new (EVOLUTION_GLADEDIR "/mail-config.glade", "accounts_tab", NULL);
+ gui = glade_xml_new (EVOLUTION_GLADEDIR "/mail-config.glade", "accounts_tab");
prefs->gui = gui;
/* get our toplevel widget */
@@ -576,18 +577,19 @@ mail_accounts_tab_construct (MailAccountsTab *prefs)
prefs->table = e_table_scrolled_get_table (E_TABLE_SCROLLED (widget));
prefs->model = prefs->table->model;
- g_signal_connect((prefs->table), "cursor_change",
+ gtk_signal_connect (GTK_OBJECT (prefs->table), "cursor_change",
account_cursor_change, prefs);
- g_signal_connect((prefs->table), "double_click",
+ gtk_signal_connect (GTK_OBJECT (prefs->table), "double_click",
account_double_click, prefs);
mail_accounts_load (prefs);
#else
- prefs->table = GTK_CLIST (g_object_get_data(G_OBJECT(widget), "table"));
+ prefs->table = GTK_CLIST (gtk_object_get_data (GTK_OBJECT (widget), "table"));
gtk_clist_set_column_justification (prefs->table, 0, GTK_JUSTIFY_RIGHT);
- g_signal_connect(prefs->table, "select-row", G_CALLBACK(account_cursor_change), prefs);
+ gtk_signal_connect (GTK_OBJECT (prefs->table), "select-row",
+ account_cursor_change, prefs);
mail_accounts_load (prefs);
@@ -601,19 +603,24 @@ mail_accounts_tab_construct (MailAccountsTab *prefs)
#endif
prefs->mail_add = GTK_BUTTON (glade_xml_get_widget (gui, "cmdAccountAdd"));
- g_signal_connect(prefs->mail_add, "clicked", G_CALLBACK(account_add_clicked), prefs);
-
+ gtk_signal_connect (GTK_OBJECT (prefs->mail_add), "clicked",
+ account_add_clicked, prefs);
+
prefs->mail_edit = GTK_BUTTON (glade_xml_get_widget (gui, "cmdAccountEdit"));
- g_signal_connect(prefs->mail_edit, "clicked", G_CALLBACK(account_edit_clicked), prefs);
+ gtk_signal_connect (GTK_OBJECT (prefs->mail_edit), "clicked",
+ account_edit_clicked, prefs);
prefs->mail_delete = GTK_BUTTON (glade_xml_get_widget (gui, "cmdAccountDelete"));
- g_signal_connect(prefs->mail_delete, "clicked", G_CALLBACK(account_delete_clicked), prefs);
+ gtk_signal_connect (GTK_OBJECT (prefs->mail_delete), "clicked",
+ account_delete_clicked, prefs);
prefs->mail_default = GTK_BUTTON (glade_xml_get_widget (gui, "cmdAccountDefault"));
- g_signal_connect(prefs->mail_default, "clicked", G_CALLBACK(account_default_clicked), prefs);
+ gtk_signal_connect (GTK_OBJECT (prefs->mail_default), "clicked",
+ account_default_clicked, prefs);
prefs->mail_able = GTK_BUTTON (glade_xml_get_widget (gui, "cmdAccountAble"));
- g_signal_connect(prefs->mail_able, "clicked", G_CALLBACK(account_able_clicked), prefs);
+ gtk_signal_connect (GTK_OBJECT (prefs->mail_able), "clicked",
+ account_able_clicked, prefs);
}
@@ -622,7 +629,7 @@ mail_accounts_tab_new (GNOME_Evolution_Shell shell)
{
MailAccountsTab *new;
- new = (MailAccountsTab *) g_object_new (mail_accounts_tab_get_type (), NULL);
+ new = (MailAccountsTab *) gtk_type_new (mail_accounts_tab_get_type ());
mail_accounts_tab_construct (new);
new->shell = shell;
diff --git a/mail/mail-callbacks.c b/mail/mail-callbacks.c
index 4d655f6950..367b10d63d 100644
--- a/mail/mail-callbacks.c
+++ b/mail/mail-callbacks.c
@@ -29,22 +29,21 @@
#include <config.h>
#endif
-#include <time.h>
#include <errno.h>
-#include <gtkhtml/gtkhtml.h>
-
-#include <gtk/gtkmessagedialog.h>
-
+#include <time.h>
+#include <libgnome/gnome-paper.h>
+#include <libgnomeui/gnome-stock.h>
+#include <libgnome/gnome-paper.h>
#include <libgnomeprint/gnome-print-master.h>
-#include <libgnomeprintui/gnome-print-dialog.h>
-#include <libgnomeprintui/gnome-print-master-preview.h>
-
+#include <libgnomeprint/gnome-print-master-preview.h>
#include <bonobo/bonobo-widget.h>
#include <bonobo/bonobo-socket.h>
#include <gal/e-table/e-table.h>
#include <gal/widgets/e-gui-utils.h>
+#include <gal/widgets/e-unicode.h>
#include <e-util/e-dialog-utils.h>
#include <filter/filter-editor.h>
+#include <gtkhtml/gtkhtml.h>
#include "mail.h"
#include "message-browser.h"
@@ -64,6 +63,7 @@
#include "subscribe-dialog.h"
#include "message-tag-editor.h"
#include "message-tag-followup.h"
+#include "e-messagebox.h"
#include "Evolution.h"
#include "evolution-storage.h"
@@ -75,40 +75,6 @@
#define FB_WINDOW(fb) GTK_WINDOW (gtk_widget_get_ancestor (GTK_WIDGET (fb), GTK_TYPE_WINDOW))
-/* default is default gtk response
- if again is != NULL, a checkbox "dont show this again" will appear, and the result stored in *again
-*/
-static gboolean
-e_question(GtkWindow *parent, int def, gboolean *again, const char *fmt, ...)
-{
- GtkWidget *mbox, *check = NULL;
- va_list ap;
- int button;
- char *str;
-
- va_start(ap, fmt);
- str = g_strdup_vprintf(fmt, ap);
- va_end(ap);
- mbox = gtk_message_dialog_new(parent, GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO,
- "%s", str);
- g_free(str);
- gtk_dialog_set_default_response ((GtkDialog *)mbox, def);
- if (again) {
- check = gtk_check_button_new_with_label (_("Don't show this message again."));
- gtk_box_pack_start((GtkBox *)((GtkDialog *)mbox)->vbox, check, TRUE, TRUE, 10);
- gtk_widget_show(check);
- }
-
- button = gtk_dialog_run((GtkDialog *)mbox);
- if (again)
- *again = !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check));
- gtk_widget_destroy(mbox);
-
- return button == GTK_RESPONSE_YES;
-}
-
-
struct _composer_callback_data {
unsigned int ref_count;
@@ -166,14 +132,14 @@ ccd_unref (struct _composer_callback_data *ccd)
static void
-composer_destroy_cb (gpointer user_data, GObject *deadbeef)
+composer_destroy_cb (GtkWidget *composer, gpointer user_data)
{
ccd_unref (user_data);
}
static void
-druid_destroy_cb (gpointer user_data, GObject *deadbeef)
+druid_destroyed (void)
{
gtk_main_quit ();
}
@@ -182,17 +148,37 @@ static gboolean
configure_mail (FolderBrowser *fb)
{
MailConfigDruid *druid;
-
- if (e_question(FB_WINDOW(fb), GTK_RESPONSE_YES, NULL,
- _("You have not configured the mail client.\n"
- "You need to do this before you can send,\n"
- "receive or compose mail.\n"
- "Would you like to configure it now?"))) {
+ GtkWidget *dialog;
+
+ dialog = gnome_message_box_new (
+ _("You have not configured the mail client.\n"
+ "You need to do this before you can send,\n"
+ "receive or compose mail.\n"
+ "Would you like to configure it now?"),
+ GNOME_MESSAGE_BOX_QUESTION,
+ GNOME_STOCK_BUTTON_YES,
+ GNOME_STOCK_BUTTON_NO, NULL);
+
+ /*
+ * Focus YES
+ */
+ gnome_dialog_set_default (GNOME_DIALOG (dialog), 0);
+ gtk_widget_grab_focus (GTK_WIDGET (GNOME_DIALOG (dialog)->buttons->data));
+
+ e_gnome_dialog_set_parent (GNOME_DIALOG (dialog), FB_WINDOW (fb));
+
+ switch (gnome_dialog_run_and_close (GNOME_DIALOG (dialog))) {
+ case 0:
druid = mail_config_druid_new (fb->shell);
- g_object_weak_ref ((GObject *) druid, (GWeakNotify) druid_destroy_cb, NULL);
- gtk_widget_show ((GtkWidget *)druid);
- gtk_grab_add ((GtkWidget *)druid);
+ gtk_signal_connect (GTK_OBJECT (druid), "destroy",
+ GTK_SIGNAL_FUNC (druid_destroyed), NULL);
+ gtk_widget_show (GTK_WIDGET (druid));
+ gtk_grab_add (GTK_WIDGET (druid));
gtk_main ();
+ break;
+ case 1:
+ default:
+ break;
}
return mail_config_is_configured ();
@@ -202,7 +188,6 @@ static gboolean
check_send_configuration (FolderBrowser *fb)
{
const MailConfigAccount *account;
- GtkWidget *dialog;
/* Check general */
if (!mail_config_is_configured () && !configure_mail (fb))
@@ -213,31 +198,58 @@ check_send_configuration (FolderBrowser *fb)
/* Check for an identity */
if (!account) {
- e_notice(FB_WINDOW(fb), GTK_MESSAGE_WARNING,
- _("You need to configure an identity\nbefore you can compose mail."));
+ GtkWidget *message;
+
+ message = e_gnome_warning_dialog_parented (_("You need to configure an identity\n"
+ "before you can compose mail."),
+ FB_WINDOW (fb));
+
+ gnome_dialog_set_close (GNOME_DIALOG (message), TRUE);
+ gtk_widget_show (message);
+
return FALSE;
}
/* Check for a transport */
if (!account->transport || !account->transport->url) {
- e_notice(FB_WINDOW(fb), GTK_MESSAGE_WARNING,
- _("You need to configure a mail transport\n"
- "before you can compose mail."));
+ GtkWidget *message;
+
+ message = e_gnome_warning_dialog_parented (_("You need to configure a mail transport\n"
+ "before you can compose mail."),
+ GTK_WINDOW (gtk_widget_get_ancestor (GTK_WIDGET (fb),
+ GTK_TYPE_WINDOW)));
+
+ gnome_dialog_set_close (GNOME_DIALOG (message), TRUE);
+ gtk_widget_show (message);
+
return FALSE;
}
return TRUE;
}
+static void
+msgbox_destroyed (GtkWidget *widget, gpointer data)
+{
+ gboolean *show_again = data;
+ GtkWidget *checkbox;
+
+ checkbox = e_message_box_get_checkbox (E_MESSAGE_BOX (widget));
+ *show_again = !gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbox));
+}
+
static gboolean
ask_confirm_for_unwanted_html_mail (EMsgComposer *composer, EDestination **recipients)
{
- gboolean show_again, res;
+ gboolean show_again = TRUE;
GString *str;
- int i;
-
- if (!mail_config_get_confirm_unwanted_html ())
+ GtkWidget *mbox;
+ int i, button;
+
+ if (!mail_config_get_confirm_unwanted_html ()) {
+ g_message ("doesn't want to see confirm html messages!");
return TRUE;
+ }
/* FIXME: this wording sucks */
str = g_string_new (_("You are sending an HTML-formatted message. Please make sure that\n"
@@ -245,42 +257,91 @@ ask_confirm_for_unwanted_html_mail (EMsgComposer *composer, EDestination **recip
for (i = 0; recipients[i] != NULL; ++i) {
if (!e_destination_get_html_mail_pref (recipients[i])) {
const char *name;
+ char *buf;
name = e_destination_get_textrep (recipients[i]);
+ buf = e_utf8_to_locale_string (name);
- g_string_sprintfa (str, " %s\n", name);
+ g_string_sprintfa (str, " %s\n", buf);
+ g_free (buf);
}
}
g_string_append (str, _("Send anyway?"));
- res = e_question((GtkWindow *)composer, GTK_RESPONSE_YES, &show_again, "%s", str->str);
- g_string_free(str, TRUE);
- mail_config_set_confirm_unwanted_html (show_again);
-
- return res;
+
+ mbox = e_message_box_new (str->str,
+ E_MESSAGE_BOX_QUESTION,
+ GNOME_STOCK_BUTTON_YES,
+ GNOME_STOCK_BUTTON_NO,
+ NULL);
+
+ g_string_free (str, TRUE);
+
+ gtk_signal_connect (GTK_OBJECT (mbox), "destroy",
+ msgbox_destroyed, &show_again);
+
+ button = gnome_dialog_run_and_close (GNOME_DIALOG (mbox));
+
+ if (!show_again) {
+ mail_config_set_confirm_unwanted_html (show_again);
+ g_message ("don't show HTML warning again");
+ }
+
+ if (button == 0)
+ return TRUE;
+ else
+ return FALSE;
}
static gboolean
ask_confirm_for_empty_subject (EMsgComposer *composer)
{
- gboolean show_again, res;
- GtkWidget *mbox, *check;
+ /* FIXME: EMessageBox should really handle this stuff
+ automagically. What Miguel thinks would be nice is to pass
+ in a unique id which could be used as a key in the config
+ file and the value would be an int. -1 for always show or
+ the button pressed otherwise. This probably means we'd have
+ to write e_messagebox_run () */
+ gboolean show_again = TRUE;
+ GtkWidget *mbox;
+ int button;
if (!mail_config_get_prompt_empty_subject ())
return TRUE;
-
- res = e_question((GtkWindow *)composer, GTK_RESPONSE_YES, &show_again,
- _("This message has no subject.\nReally send?"));
+
+ mbox = e_message_box_new (_("This message has no subject.\nReally send?"),
+ E_MESSAGE_BOX_QUESTION,
+ GNOME_STOCK_BUTTON_YES,
+ GNOME_STOCK_BUTTON_NO,
+ NULL);
+
+ gtk_signal_connect (GTK_OBJECT (mbox), "destroy",
+ msgbox_destroyed, &show_again);
+
+ button = gnome_dialog_run_and_close (GNOME_DIALOG (mbox));
+
mail_config_set_prompt_empty_subject (show_again);
- return res;
+ if (button == 0)
+ return TRUE;
+ else
+ return FALSE;
}
static gboolean
ask_confirm_for_only_bcc (EMsgComposer *composer, gboolean hidden_list_case)
{
- gboolean show_again, res;
+ /* FIXME: EMessageBox should really handle this stuff
+ automagically. What Miguel thinks would be nice is to pass
+ in a message-id which could be used as a key in the config
+ file and the value would be an int. -1 for always show or
+ the button pressed otherwise. This probably means we'd have
+ to write e_messagebox_run () */
+ gboolean show_again = TRUE;
+ GtkWidget *mbox;
+ int button;
const char *first_text;
+ char *message_text;
if (!mail_config_get_prompt_only_bcc ())
return TRUE;
@@ -298,15 +359,30 @@ ask_confirm_for_only_bcc (EMsgComposer *composer, gboolean hidden_list_case)
} else {
first_text = _("This message contains only Bcc recipients.");
}
-
- res = e_question((GtkWindow *)composer, GTK_RESPONSE_YES, &show_again,
- "%s\n%s", first_text,
- _("It is possible that the mail server may reveal the recipients "
- "by adding an Apparently-To header.\nSend anyway?"));
+
+ message_text = g_strdup_printf ("%s\n%s", first_text,
+ _("It is possible that the mail server may reveal the recipients "
+ "by adding an Apparently-To header.\nSend anyway?"));
+
+ mbox = e_message_box_new (message_text,
+ E_MESSAGE_BOX_QUESTION,
+ GNOME_STOCK_BUTTON_YES,
+ GNOME_STOCK_BUTTON_NO,
+ NULL);
+
+ gtk_signal_connect (GTK_OBJECT (mbox), "destroy",
+ msgbox_destroyed, &show_again);
+
+ button = gnome_dialog_run_and_close (GNOME_DIALOG (mbox));
mail_config_set_prompt_only_bcc (show_again);
- return res;
+ g_free (message_text);
+
+ if (button == 0)
+ return TRUE;
+ else
+ return FALSE;
}
@@ -357,20 +433,23 @@ composer_send_queued_cb (CamelFolder *folder, CamelMimeMessage *msg, CamelMessag
ccd = ccd_new ();
/* disconnect the previous signal handlers */
- g_signal_handlers_disconnect_matched(send->composer, G_SIGNAL_MATCH_FUNC, 0,
- 0, NULL, composer_send_cb, NULL);
- g_signal_handlers_disconnect_matched(send->composer, G_SIGNAL_MATCH_FUNC, 0,
- 0, NULL, composer_save_draft_cb, NULL);
+ gtk_signal_disconnect_by_func (GTK_OBJECT (send->composer),
+ GTK_SIGNAL_FUNC (composer_send_cb), NULL);
+ gtk_signal_disconnect_by_func (GTK_OBJECT (send->composer),
+ GTK_SIGNAL_FUNC (composer_save_draft_cb), NULL);
/* reconnect to the signals using a non-NULL ccd for the callback data */
- g_signal_connect (send->composer, "send", G_CALLBACK (composer_send_cb), ccd);
- g_signal_connect (send->composer, "save-draft", G_CALLBACK (composer_save_draft_cb), ccd);
-
- g_object_weak_ref ((GObject *) send->composer, (GWeakNotify) composer_destroy_cb, ccd);
+ gtk_signal_connect (GTK_OBJECT (send->composer), "send",
+ GTK_SIGNAL_FUNC (composer_send_cb), ccd);
+ gtk_signal_connect (GTK_OBJECT (send->composer), "save-draft",
+ GTK_SIGNAL_FUNC (composer_save_draft_cb), ccd);
+ gtk_signal_connect (GTK_OBJECT (send->composer), "destroy",
+ GTK_SIGNAL_FUNC (composer_destroy_cb), ccd);
}
e_msg_composer_set_enable_autosave (send->composer, TRUE);
gtk_widget_show (GTK_WIDGET (send->composer));
+ gtk_object_unref (GTK_OBJECT (send->composer));
}
camel_message_info_free (info);
@@ -429,8 +508,15 @@ composer_get_message (EMsgComposer *composer, gboolean post, gboolean save_html_
/* I'm sensing a lack of love, er, I mean recipients. */
if (num == 0 && !post) {
- e_notice((GtkWindow *)composer, GTK_MESSAGE_WARNING,
- _("You must specify recipients in order to send this message."));
+ GtkWidget *message_box;
+
+ message_box = gnome_message_box_new (_("You must specify recipients in order to "
+ "send this message."),
+ GNOME_MESSAGE_BOX_WARNING,
+ GNOME_STOCK_BUTTON_OK,
+ NULL);
+
+ gnome_dialog_run_and_close (GNOME_DIALOG (message_box));
goto finished;
}
@@ -507,7 +593,7 @@ got_post_folder (char *uri, CamelFolder *folder, void *data)
*fp = folder;
if (folder)
- camel_object_ref (folder);
+ camel_object_ref (CAMEL_OBJECT (folder));
}
void
@@ -558,7 +644,7 @@ composer_send_cb (EMsgComposer *composer, gpointer user_data)
ccd_ref (send->ccd);
send->send = !post;
send->composer = composer;
- g_object_ref (composer);
+ gtk_object_ref (GTK_OBJECT (composer));
gtk_widget_hide (GTK_WIDGET (composer));
e_msg_composer_set_enable_autosave (composer, FALSE);
@@ -593,15 +679,17 @@ save_draft_done (CamelFolder *folder, CamelMimeMessage *msg, CamelMessageInfo *i
/* disconnect the previous signal handlers */
gtk_signal_disconnect_by_func (GTK_OBJECT (sdi->composer),
- G_CALLBACK (composer_send_cb), NULL);
+ GTK_SIGNAL_FUNC (composer_send_cb), NULL);
gtk_signal_disconnect_by_func (GTK_OBJECT (sdi->composer),
- G_CALLBACK (composer_save_draft_cb), NULL);
+ GTK_SIGNAL_FUNC (composer_save_draft_cb), NULL);
/* reconnect to the signals using a non-NULL ccd for the callback data */
- g_signal_connect (sdi->composer, "send", G_CALLBACK (composer_send_cb), ccd);
- g_signal_connect (sdi->composer, "save-draft", G_CALLBACK (composer_save_draft_cb), ccd);
-
- g_object_weak_ref ((GObject *) sdi->composer, (GWeakNotify) composer_destroy_cb, ccd);
+ gtk_signal_connect (GTK_OBJECT (sdi->composer), "send",
+ GTK_SIGNAL_FUNC (composer_send_cb), ccd);
+ gtk_signal_connect (GTK_OBJECT (sdi->composer), "save-draft",
+ GTK_SIGNAL_FUNC (composer_save_draft_cb), ccd);
+ gtk_signal_connect (GTK_OBJECT (sdi->composer), "destroy",
+ GTK_SIGNAL_FUNC (composer_destroy_cb), ccd);
}
if (ccd->drafts_folder) {
@@ -634,7 +722,7 @@ save_draft_done (CamelFolder *folder, CamelMimeMessage *msg, CamelMessageInfo *i
gtk_widget_destroy (GTK_WIDGET (sdi->composer));
done:
- g_object_unref (sdi->composer);
+ gtk_object_unref (GTK_OBJECT (sdi->composer));
if (sdi->ccd)
ccd_unref (sdi->ccd);
g_free (info);
@@ -649,7 +737,7 @@ use_default_drafts_cb (int reply, gpointer data)
if (reply == 0) {
*folder = drafts_folder;
- camel_object_ref (drafts_folder);
+ camel_object_ref (CAMEL_OBJECT (*folder));
}
}
@@ -660,7 +748,7 @@ save_draft_folder (char *uri, CamelFolder *folder, gpointer data)
if (folder) {
*save = folder;
- camel_object_ref (folder);
+ camel_object_ref (CAMEL_OBJECT (folder));
}
}
@@ -684,18 +772,18 @@ composer_save_draft_cb (EMsgComposer *composer, int quit, gpointer user_data)
mail_msg_wait (id);
if (!folder) {
- gboolean res;
- if (!e_question((GtkWindow *)composer, GTK_RESPONSE_YES, NULL,
- _("Unable to open the drafts folder for this account.\n"
- "Would you like to use the default drafts folder?")))
- return;
+ GtkWidget *dialog;
- folder = drafts_folder;
- camel_object_ref (drafts_folder);
+ dialog = gnome_ok_cancel_dialog_parented (_("Unable to open the drafts folder for this account.\n"
+ "Would you like to use the default drafts folder?"),
+ use_default_drafts_cb, &folder, GTK_WINDOW (composer));
+ gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
+ if (!folder)
+ return;
}
} else {
folder = drafts_folder;
- camel_object_ref (folder);
+ camel_object_ref (CAMEL_OBJECT (folder));
}
msg = e_msg_composer_get_message_draft (composer);
@@ -705,15 +793,15 @@ composer_save_draft_cb (EMsgComposer *composer, int quit, gpointer user_data)
sdi = g_malloc (sizeof (struct _save_draft_info));
sdi->composer = composer;
- g_object_ref (composer);
+ gtk_object_ref (GTK_OBJECT (composer));
sdi->ccd = user_data;
if (sdi->ccd)
ccd_ref (sdi->ccd);
sdi->quit = quit;
mail_append_mail (folder, msg, info, save_draft_done, sdi);
- camel_object_unref (folder);
- camel_object_unref (msg);
+ camel_object_unref (CAMEL_OBJECT (folder));
+ camel_object_unref (CAMEL_OBJECT (msg));
}
static GtkWidget *
@@ -768,10 +856,12 @@ compose_msg (GtkWidget *widget, gpointer user_data)
ccd = ccd_new ();
- g_signal_connect (composer, "send", G_CALLBACK (composer_send_cb), ccd);
- g_signal_connect (composer, "save-draft", G_CALLBACK (composer_save_draft_cb), ccd);
-
- g_object_weak_ref ((GObject *) composer, (GWeakNotify) composer_destroy_cb, ccd);
+ gtk_signal_connect (GTK_OBJECT (composer), "send",
+ GTK_SIGNAL_FUNC (composer_send_cb), ccd);
+ gtk_signal_connect (GTK_OBJECT (composer), "save-draft",
+ GTK_SIGNAL_FUNC (composer_save_draft_cb), ccd);
+ gtk_signal_connect (GTK_OBJECT (composer), "destroy",
+ GTK_SIGNAL_FUNC (composer_destroy_cb), ccd);
gtk_widget_show (composer);
}
@@ -795,10 +885,12 @@ send_to_url (const char *url)
ccd = ccd_new ();
- g_signal_connect (composer, "send", G_CALLBACK (composer_send_cb), ccd);
- g_signal_connect (composer, "save-draft", G_CALLBACK (composer_save_draft_cb), ccd);
-
- g_object_weak_ref ((GObject *) composer, (GWeakNotify) composer_destroy_cb, ccd);
+ gtk_signal_connect (GTK_OBJECT (composer), "send",
+ GTK_SIGNAL_FUNC (composer_send_cb), ccd);
+ gtk_signal_connect (GTK_OBJECT (composer), "save-draft",
+ GTK_SIGNAL_FUNC (composer_save_draft_cb), ccd);
+ gtk_signal_connect (GTK_OBJECT (composer), "destroy",
+ GTK_SIGNAL_FUNC (composer_destroy_cb), ccd);
gtk_widget_show (composer);
}
@@ -941,7 +1033,7 @@ mail_generate_reply (CamelFolder *folder, CamelMimeMessage *message, const char
const CamelInternetAddress *reply_to, *sender, *to_addrs, *cc_addrs;
const char *name = NULL, *address = NULL, *source = NULL;
const char *message_id, *references, *mlist = NULL;
- char *text = NULL, *subject, format[256];
+ char *text = NULL, *subject, date_str[100], *format;
const MailConfigAccount *def, *account, *me = NULL;
const GSList *l, *accounts = NULL;
GHashTable *account_hash = NULL;
@@ -1030,7 +1122,7 @@ mail_generate_reply (CamelFolder *folder, CamelMimeMessage *message, const char
max = camel_address_length (CAMEL_ADDRESS (to_addrs));
for (i = 0; i < max; i++) {
camel_internet_address_get (to_addrs, i, &name, &address);
- if (!strcasecmp (address, mlist))
+ if (!g_strcasecmp (address, mlist))
break;
}
@@ -1038,7 +1130,7 @@ mail_generate_reply (CamelFolder *folder, CamelMimeMessage *message, const char
max = camel_address_length (CAMEL_ADDRESS (cc_addrs));
for (i = 0; i < max; i++) {
camel_internet_address_get (cc_addrs, i, &name, &address);
- if (!strcasecmp (address, mlist))
+ if (!g_strcasecmp (address, mlist))
break;
}
}
@@ -1129,7 +1221,7 @@ mail_generate_reply (CamelFolder *folder, CamelMimeMessage *message, const char
/* attach the original message as an attachment */
part = mail_tool_make_message_attachment (message);
e_msg_composer_attach (composer, part);
- camel_object_unref (part);
+ camel_object_unref (CAMEL_OBJECT (part));
break;
case MAIL_CONFIG_REPLY_QUOTED:
default:
@@ -1142,9 +1234,12 @@ mail_generate_reply (CamelFolder *folder, CamelMimeMessage *message, const char
}
date = camel_mime_message_get_date (message, NULL);
- strftime (format, sizeof (format), _("On %a, %Y-%m-%d at %H:%M, %%s wrote:"), localtime (&date));
+ strftime (date_str, sizeof (date_str), _("On %a, %Y-%m-%d at %H:%M, %%s wrote:"),
+ localtime (&date));
+ format = e_utf8_from_locale_string (date_str);
text = mail_tool_quote_message (message, format, name && *name ? name : address);
mail_ignore (composer, name, address);
+ g_free (format);
if (text) {
e_msg_composer_set_body_text (composer, text);
g_free (text);
@@ -1157,7 +1252,7 @@ mail_generate_reply (CamelFolder *folder, CamelMimeMessage *message, const char
if (!subject)
subject = g_strdup ("");
else {
- if (!strncasecmp (subject, "Re: ", 4))
+ if (!g_strncasecmp (subject, "Re: ", 4))
subject = g_strndup (subject, MAX_SUBJECT_LEN);
else {
if (strlen (subject) < MAX_SUBJECT_LEN) {
@@ -1252,10 +1347,12 @@ mail_reply (CamelFolder *folder, CamelMimeMessage *msg, const char *uid, int mod
ccd->flags |= CAMEL_MESSAGE_ANSWERED_ALL;
ccd->set = ccd->flags;
- g_signal_connect (composer, "send", G_CALLBACK (composer_send_cb), ccd);
- g_signal_connect (composer, "save-draft", G_CALLBACK (composer_save_draft_cb), ccd);
-
- g_object_weak_ref ((GObject *) composer, (GWeakNotify) composer_destroy_cb, ccd);
+ gtk_signal_connect (GTK_OBJECT (composer), "send",
+ GTK_SIGNAL_FUNC (composer_send_cb), ccd);
+ gtk_signal_connect (GTK_OBJECT (composer), "save-draft",
+ GTK_SIGNAL_FUNC (composer_save_draft_cb), ccd);
+ gtk_signal_connect (GTK_OBJECT (composer), "destroy",
+ GTK_SIGNAL_FUNC (composer_destroy_cb), ccd);
gtk_widget_show (GTK_WIDGET (composer));
e_msg_composer_unset_changed (composer);
@@ -1335,10 +1432,12 @@ forward_get_composer (CamelMimeMessage *message, const char *subject)
if (composer) {
ccd = ccd_new ();
- g_signal_connect (composer, "send", G_CALLBACK (composer_send_cb), ccd);
- g_signal_connect (composer, "save-draft", G_CALLBACK (composer_save_draft_cb), ccd);
-
- g_object_weak_ref ((GObject *) composer, (GWeakNotify) composer_destroy_cb, ccd);
+ gtk_signal_connect (GTK_OBJECT (composer), "send",
+ GTK_SIGNAL_FUNC (composer_send_cb), ccd);
+ gtk_signal_connect (GTK_OBJECT (composer), "save-draft",
+ GTK_SIGNAL_FUNC (composer_save_draft_cb), ccd);
+ gtk_signal_connect (GTK_OBJECT (composer), "destroy",
+ GTK_SIGNAL_FUNC (composer_destroy_cb), ccd);
e_msg_composer_set_headers (composer, account->name, NULL, NULL, NULL, subject);
} else {
@@ -1472,10 +1571,12 @@ post_to_url (const char *url)
ccd = ccd_new ();
- g_signal_connect (composer, "send", G_CALLBACK (composer_send_cb), ccd);
- g_signal_connect (composer, "save-draft", G_CALLBACK (composer_save_draft_cb), ccd);
-
- g_object_weak_ref ((GObject *) composer, (GWeakNotify) composer_destroy_cb, ccd);
+ gtk_signal_connect (GTK_OBJECT (composer), "send",
+ GTK_SIGNAL_FUNC (composer_send_cb), ccd);
+ gtk_signal_connect (GTK_OBJECT (composer), "save-draft",
+ GTK_SIGNAL_FUNC (composer_save_draft_cb), ccd);
+ gtk_signal_connect (GTK_OBJECT (composer), "destroy",
+ GTK_SIGNAL_FUNC (composer_destroy_cb), ccd);
gtk_widget_show (composer);
}
@@ -1543,10 +1644,12 @@ redirect_get_composer (CamelMimeMessage *message)
if (composer) {
ccd = ccd_new ();
- g_signal_connect (composer, "send", G_CALLBACK (composer_send_cb), ccd);
- g_signal_connect (composer, "save-draft", G_CALLBACK (composer_save_draft_cb), ccd);
-
- g_object_weak_ref ((GObject *) composer, (GWeakNotify) composer_destroy_cb, ccd);
+ gtk_signal_connect (GTK_OBJECT (composer), "send",
+ GTK_SIGNAL_FUNC (composer_send_cb), ccd);
+ gtk_signal_connect (GTK_OBJECT (composer), "save-draft",
+ GTK_SIGNAL_FUNC (composer_save_draft_cb), ccd);
+ gtk_signal_connect (GTK_OBJECT (composer), "destroy",
+ GTK_SIGNAL_FUNC (composer_destroy_cb), ccd);
} else {
g_warning ("Could not create composer");
}
@@ -1612,7 +1715,7 @@ transfer_msg_done (gboolean ok, void *data)
0, 0, FALSE);
}
- g_object_unref (fb);
+ gtk_object_unref (GTK_OBJECT (fb));
}
static void
@@ -1652,7 +1755,7 @@ transfer_msg (FolderBrowser *fb, gboolean delete_from_source)
message_list_foreach (fb->message_list, enumerate_msg, uids);
if (delete_from_source) {
- g_object_ref (fb);
+ gtk_object_ref (GTK_OBJECT (fb));
mail_transfer_messages (fb->folder, uids, delete_from_source,
folder->physicalUri, 0,
transfer_msg_done, fb);
@@ -1660,7 +1763,6 @@ transfer_msg (FolderBrowser *fb, gboolean delete_from_source)
mail_transfer_messages (fb->folder, uids, delete_from_source,
folder->physicalUri, 0, NULL, NULL);
}
-
CORBA_free (folder);
}
@@ -1694,7 +1796,7 @@ find_socket (GtkContainer *container)
{
GList *children, *tmp;
- children = gtk_container_get_children (container);
+ children = gtk_container_children (container);
while (children) {
if (BONOBO_IS_SOCKET (children->data))
return children->data;
@@ -1707,14 +1809,13 @@ find_socket (GtkContainer *container)
g_list_free_1 (children);
children = tmp;
}
-
- return NULL;
+ return NULL;
}
static void
popup_listener_cb (BonoboListener *listener,
- const char *event_name,
- const CORBA_any *any,
+ char *event_name,
+ CORBA_any *any,
CORBA_Environment *ev,
gpointer user_data)
{
@@ -1738,17 +1839,18 @@ addrbook_sender (GtkWidget *widget, gpointer user_data)
GtkWidget *socket;
GPtrArray *uids;
int i;
-
+
if (FOLDER_BROWSER_IS_DESTROYED (fb))
return;
-
- uids = g_ptr_array_new ();
- message_list_foreach (fb->message_list, enumerate_msg, uids);
+
+ uids = g_ptr_array_new();
+ message_list_foreach(fb->message_list, enumerate_msg, uids);
if (uids->len != 1)
goto done;
-
- info = camel_folder_get_message_info (fb->folder, uids->pdata[0]);
- if (info == NULL || (addr_str = camel_message_info_from (info)) == NULL)
+
+ info = camel_folder_get_message_info(fb->folder, uids->pdata[0]);
+ if (info == NULL
+ || (addr_str = camel_message_info_from(info)) == NULL)
goto done;
win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
@@ -1757,23 +1859,25 @@ addrbook_sender (GtkWidget *widget, gpointer user_data)
control = bonobo_widget_new_control ("OAFIID:GNOME_Evolution_Addressbook_AddressPopup",
CORBA_OBJECT_NIL);
bonobo_widget_set_property (BONOBO_WIDGET (control),
- "email", TC_CORBA_string, addr_str,
+ "email", addr_str,
NULL);
bonobo_event_source_client_add_listener (bonobo_widget_get_objref (BONOBO_WIDGET (control)),
popup_listener_cb, NULL, NULL, win);
socket = find_socket (GTK_CONTAINER (control));
-
- g_object_weak_ref ((GObject *) socket, (GWeakNotify) gtk_widget_destroy, win);
+ gtk_signal_connect_object (GTK_OBJECT (socket),
+ "destroy",
+ GTK_SIGNAL_FUNC (gtk_widget_destroy),
+ GTK_OBJECT (win));
gtk_container_add (GTK_CONTAINER (win), control);
gtk_widget_show_all (win);
done:
- for (i = 0; i < uids->len; i++)
- g_free (uids->pdata[i]);
- g_ptr_array_free (uids, TRUE);
+ for (i=0; i < uids->len; i++)
+ g_free(uids->pdata[i]);
+ g_ptr_array_free(uids, TRUE);
}
void
@@ -1945,13 +2049,13 @@ toggle_flags (FolderBrowser *fb, guint32 mask)
guint32 flags;
flags = ~(camel_folder_get_message_flags (fb->folder, uids->pdata[i]));
-
+
/* if we're flagging a message important, always undelete it too */
if (mask & flags & CAMEL_MESSAGE_FLAGGED) {
flags &= ~CAMEL_MESSAGE_DELETED;
mask |= CAMEL_MESSAGE_DELETED;
}
-
+
/* if we're flagging a message deleted, mark it seen. If
* we're undeleting it, we also want it to be seen, so always do this.
*/
@@ -1959,9 +2063,9 @@ toggle_flags (FolderBrowser *fb, guint32 mask)
flags |= CAMEL_MESSAGE_SEEN;
mask |= CAMEL_MESSAGE_SEEN;
}
-
+
camel_folder_set_message_flags (fb->folder, uids->pdata[i], mask, flags);
-
+
g_free (uids->pdata[i]);
}
camel_folder_thaw (fb->folder);
@@ -2038,33 +2142,51 @@ struct _tag_editor_data {
};
static void
-tag_editor_response(GtkWidget *gd, int button, struct _tag_editor_data *data)
+tag_editor_ok (GtkWidget *button, gpointer user_data)
{
+ struct _tag_editor_data *data = user_data;
CamelFolder *folder;
CamelTag *tags, *t;
GPtrArray *uids;
int i;
-
- /*if (FOLDER_BROWSER_IS_DESTROYED (data->fb))
- goto done;*/
-
- if (button == GTK_RESPONSE_OK
- && (tags = message_tag_editor_get_tag_list (data->editor))) {
- folder = data->fb->folder;
- uids = data->uids;
- camel_folder_freeze (folder);
- for (i = 0; i < uids->len; i++) {
- for (t = tags; t; t = t->next)
- camel_folder_set_message_user_tag (folder, uids->pdata[i], t->name, t->value);
- }
- camel_folder_thaw (folder);
- camel_tag_list_free (&tags);
+ if (FOLDER_BROWSER_IS_DESTROYED (data->fb))
+ goto done;
+
+ tags = message_tag_editor_get_tag_list (data->editor);
+ if (tags == NULL)
+ goto done;
+
+ folder = data->fb->folder;
+ uids = data->uids;
+
+ camel_folder_freeze (folder);
+ for (i = 0; i < uids->len; i++) {
+ for (t = tags; t; t = t->next)
+ camel_folder_set_message_user_tag (folder, uids->pdata[i], t->name, t->value);
}
+ camel_folder_thaw (folder);
+
+ camel_tag_list_free (&tags);
+
+ done:
+ gtk_widget_destroy (GTK_WIDGET (data->editor));
+}
- gtk_widget_destroy(gd);
+static void
+tag_editor_cancel (GtkWidget *button, gpointer user_data)
+{
+ struct _tag_editor_data *data = user_data;
+
+ gtk_widget_destroy (GTK_WIDGET (data->editor));
+}
- g_object_unref (data->fb);
+static void
+tag_editor_destroy (GnomeDialog *dialog, gpointer user_data)
+{
+ struct _tag_editor_data *data = user_data;
+
+ gtk_object_unref (GTK_OBJECT (data->fb));
g_ptr_array_free (data->uids, TRUE);
g_free (data);
}
@@ -2100,8 +2222,10 @@ flag_for_followup (BonoboUIComponent *uih, void *user_data, const char *path)
camel_message_info_from (info),
camel_message_info_subject (info));
}
-
- g_signal_connect(editor, "response", G_CALLBACK(tag_editor_response), data);
+
+ gnome_dialog_button_connect (GNOME_DIALOG (editor), 0, tag_editor_ok, data);
+ gnome_dialog_button_connect (GNOME_DIALOG (editor), 1, tag_editor_cancel, data);
+ gnome_dialog_set_close (GNOME_DIALOG (editor), TRUE);
/* special-case... */
if (uids->len == 1) {
@@ -2115,6 +2239,9 @@ flag_for_followup (BonoboUIComponent *uih, void *user_data, const char *path)
}
}
+ gtk_signal_connect (GTK_OBJECT (editor), "destroy",
+ tag_editor_destroy, data);
+
gtk_widget_show (editor);
}
@@ -2235,10 +2362,12 @@ do_edit_messages (CamelFolder *folder, GPtrArray *uids, GPtrArray *messages, voi
ccd->drafts_uid = g_strdup (uids->pdata[i]);
}
- g_signal_connect (composer, "send", G_CALLBACK (composer_send_cb), ccd);
- g_signal_connect (composer, "save-draft", G_CALLBACK (composer_save_draft_cb), ccd);
-
- g_object_weak_ref ((GObject *) composer, (GWeakNotify) composer_destroy_cb, ccd);
+ gtk_signal_connect (GTK_OBJECT (composer), "send",
+ GTK_SIGNAL_FUNC (composer_send_cb), ccd);
+ gtk_signal_connect (GTK_OBJECT (composer), "save-draft",
+ GTK_SIGNAL_FUNC (composer_save_draft_cb), ccd);
+ gtk_signal_connect (GTK_OBJECT (composer), "destroy",
+ GTK_SIGNAL_FUNC (composer_destroy_cb), ccd);
gtk_widget_show (GTK_WIDGET (composer));
}
@@ -2251,20 +2380,17 @@ are_you_sure (const char *msg, GPtrArray *uids, FolderBrowser *fb)
GtkWidget *dialog;
char *buf;
int button, i;
-
- dialog = gtk_message_dialog_new (FB_WINDOW (fb), GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL,
- msg, uids->len);
- button = gtk_dialog_run((GtkDialog *)dialog);
- gtk_widget_destroy(dialog);
-
- if (button != GTK_RESPONSE_OK) {
+
+ buf = g_strdup_printf (msg, uids->len);
+ dialog = e_gnome_ok_cancel_dialog_parented (buf, NULL, NULL, FB_WINDOW (fb));
+ button = gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
+ if (button != 0) {
for (i = 0; i < uids->len; i++)
g_free (uids->pdata[i]);
g_ptr_array_free (uids, TRUE);
}
- return button == GTK_RESPONSE_OK;
+ return button == 0;
}
static void
@@ -2278,8 +2404,16 @@ edit_msg_internal (FolderBrowser *fb)
uids = g_ptr_array_new ();
message_list_foreach (fb->message_list, enumerate_msg, uids);
- if (uids->len > 10 && !are_you_sure (_("Are you sure you want to edit all %d messages?"), uids, fb))
+ if (uids->len > 10 && !are_you_sure (_("Are you sure you want to edit all %d messages?"), uids, fb)) {
+ int i;
+
+ for (i = 0; i < uids->len; i++)
+ g_free (uids->pdata[i]);
+
+ g_ptr_array_free (uids, TRUE);
+
return;
+ }
mail_get_messages (fb->folder, uids, do_edit_messages, fb);
}
@@ -2293,8 +2427,13 @@ edit_msg (GtkWidget *widget, gpointer user_data)
return;
if (!folder_browser_is_drafts (fb)) {
- e_notice(FB_WINDOW(fb), GTK_MESSAGE_ERROR,
- _("You may only edit messages saved\nin the Drafts folder."));
+ GtkWidget *dialog;
+
+ dialog = gnome_warning_dialog_parented (_("You may only edit messages saved\n"
+ "in the Drafts folder."),
+ FB_WINDOW (fb));
+ gnome_dialog_set_close (GNOME_DIALOG (dialog), TRUE);
+ gtk_widget_show (dialog);
return;
}
@@ -2328,9 +2467,12 @@ resend_msg (GtkWidget *widget, gpointer user_data)
if (!folder_browser_is_sent (fb)) {
GtkWidget *dialog;
-
- e_notice(FB_WINDOW(fb), GTK_MESSAGE_ERROR,
- _("You may only resend messages\nin the Sent folder."));
+
+ dialog = gnome_warning_dialog_parented (_("You may only resend messages\n"
+ "in the Sent folder."),
+ FB_WINDOW (fb));
+ gnome_dialog_set_close (GNOME_DIALOG (dialog), TRUE);
+ gtk_widget_show (dialog);
return;
}
@@ -2340,8 +2482,16 @@ resend_msg (GtkWidget *widget, gpointer user_data)
uids = g_ptr_array_new ();
message_list_foreach (fb->message_list, enumerate_msg, uids);
- if (uids->len > 10 && !are_you_sure (_("Are you sure you want to resend all %d messages?"), uids, fb))
+ if (uids->len > 10 && !are_you_sure (_("Are you sure you want to resend all %d messages?"), uids, fb)) {
+ int i;
+
+ for (i = 0; i < uids->len; i++)
+ g_free (uids->pdata[i]);
+
+ g_ptr_array_free (uids, TRUE);
+
return;
+ }
mail_get_messages (fb->folder, uids, do_resend_messages, fb);
}
@@ -2358,10 +2508,8 @@ search_msg (GtkWidget *widget, gpointer user_data)
if (fb->mail_display->current_message == NULL) {
GtkWidget *dialog;
- dialog = gtk_message_dialog_new(FB_WINDOW(fb), GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_WARNING, GTK_BUTTONS_CLOSE,
- _("No Message Selected"));
- g_signal_connect_swapped (dialog, "response", G_CALLBACK (gtk_widget_destroy), dialog);
+ dialog = gnome_warning_dialog_parented (_("No Message Selected"), FB_WINDOW (fb));
+ gnome_dialog_set_close (GNOME_DIALOG (dialog), TRUE);
gtk_widget_show (dialog);
return;
}
@@ -2387,8 +2535,8 @@ save_msg_ok (GtkWidget *widget, gpointer user_data)
CamelFolder *folder;
GPtrArray *uids;
const char *path;
+ int fd, ret = 0;
struct stat st;
- gboolean ret = TRUE;
path = gtk_file_selection_get_filename (GTK_FILE_SELECTION (user_data));
if (path[0] == '\0')
@@ -2397,21 +2545,33 @@ save_msg_ok (GtkWidget *widget, gpointer user_data)
/* make sure we can actually save to it... */
if (stat (path, &st) != -1 && !S_ISREG (st.st_mode))
return;
-
- if (access(path, F_OK) == 0) {
- if (access(path, W_OK) != 0) {
- e_notice(GTK_WINDOW(user_data), GTK_MESSAGE_ERROR,
- _("Cannot save to `%s'\n %s"), path, g_strerror(errno));
- return;
- }
-
- ret = e_question(GTK_WINDOW(user_data), GTK_RESPONSE_NO, NULL,
- _("`%s' already exists.\nOverwrite it?"), path);
+
+ fd = open (path, O_RDONLY);
+ if (fd != -1) {
+ GtkWidget *dialog;
+ GtkWidget *text;
+
+ close (fd);
+
+ dialog = gnome_dialog_new (_("Overwrite file?"),
+ GNOME_STOCK_BUTTON_YES,
+ GNOME_STOCK_BUTTON_NO,
+ NULL);
+
+ e_gnome_dialog_set_parent (GNOME_DIALOG (dialog), GTK_WINDOW (user_data));
+
+ text = gtk_label_new (_("A file by that name already exists.\nOverwrite it?"));
+ gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), text, TRUE, TRUE, 4);
+ gtk_window_set_policy (GTK_WINDOW (dialog), FALSE, TRUE, FALSE);
+ gtk_widget_show (text);
+
+ ret = gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
}
- if (ret == GTK_RESPONSE_OK) {
- folder = g_object_get_data ((GObject *) user_data, "folder");
- uids = g_object_steal_data (G_OBJECT (user_data), "uids");
+ if (ret == 0) {
+ folder = gtk_object_get_data (GTK_OBJECT (user_data), "folder");
+ uids = gtk_object_get_data (GTK_OBJECT (user_data), "uids");
+ gtk_object_remove_no_notify (GTK_OBJECT (user_data), "uids");
mail_save_messages (folder, uids, path, NULL, NULL);
gtk_widget_destroy (GTK_WIDGET (user_data));
}
@@ -2455,13 +2615,13 @@ save_msg (GtkWidget *widget, gpointer user_data)
path = g_strdup_printf ("%s/", g_get_home_dir ());
gtk_file_selection_set_filename (filesel, path);
g_free (path);
-
- g_object_set_data_full ((GObject *) filesel, "uids", uids, save_msg_destroy);
- g_object_set_data ((GObject *) filesel, "folder", fb->folder);
-
- g_signal_connect (filesel->ok_button, "clicked", G_CALLBACK (save_msg_ok), filesel);
- g_signal_connect_swapped (filesel->cancel_button, "clicked",
- G_CALLBACK (gtk_widget_destroy), filesel);
+ gtk_object_set_data_full (GTK_OBJECT (filesel), "uids", uids, save_msg_destroy);
+ gtk_object_set_data (GTK_OBJECT (filesel), "folder", fb->folder);
+ gtk_signal_connect (GTK_OBJECT (filesel->ok_button),
+ "clicked", GTK_SIGNAL_FUNC (save_msg_ok), filesel);
+ gtk_signal_connect_object (GTK_OBJECT (filesel->cancel_button),
+ "clicked", GTK_SIGNAL_FUNC (gtk_widget_destroy),
+ GTK_OBJECT (filesel));
gtk_widget_show (GTK_WIDGET (filesel));
}
@@ -2491,7 +2651,7 @@ delete_msg (GtkWidget *button, gpointer user_data)
/* If this is the last message and deleted messages
are hidden, select the previous */
- if ((row + 1 == e_tree_row_count (fb->message_list->tree))
+ if ((row+1 == e_tree_row_count (fb->message_list->tree))
&& mail_config_get_hide_deleted ())
message_list_select (fb->message_list, MESSAGE_LIST_SELECT_PREVIOUS,
0, CAMEL_MESSAGE_DELETED, FALSE);
@@ -2512,20 +2672,46 @@ undelete_msg (GtkWidget *button, gpointer user_data)
static gboolean
confirm_goto_next_folder (FolderBrowser *fb)
{
- gboolean res, show_again;
+ GtkWidget *dialog, *label, *checkbox;
+ int button;
if (!mail_config_get_confirm_goto_next_folder ())
return mail_config_get_goto_next_folder ();
-
- /*gtk_window_set_title((GtkWindow *)dialog, _("Go to next folder with unread messages?"));*/
-
- res = e_question(FB_WINDOW(fb), GTK_RESPONSE_YES, &show_again,
- _("There are no more new messages in this folder.\n"
- "Would you like to go to the next folder?"));
- mail_config_set_confirm_goto_next_folder(show_again);
- mail_config_set_goto_next_folder (res);
-
- return res;
+
+ dialog = gnome_dialog_new (_("Go to next folder with unread messages?"),
+ GNOME_STOCK_BUTTON_YES,
+ GNOME_STOCK_BUTTON_NO,
+ NULL);
+
+ e_gnome_dialog_set_parent (GNOME_DIALOG (dialog), FB_WINDOW (fb));
+
+ label = gtk_label_new (_("There are no more new messages in this folder.\n"
+ "Would you like to go to the next folder?"));
+
+ gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
+ gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
+ gtk_widget_show (label);
+ gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), label, TRUE, TRUE, 4);
+
+ checkbox = gtk_check_button_new_with_label (_("Do not ask me again."));
+ gtk_object_ref (GTK_OBJECT (checkbox));
+ gtk_widget_show (checkbox);
+ gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), checkbox, TRUE, TRUE, 4);
+
+ button = gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
+
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbox)))
+ mail_config_set_confirm_goto_next_folder (FALSE);
+
+ gtk_object_unref (GTK_OBJECT (checkbox));
+
+ if (button == 0) {
+ mail_config_set_goto_next_folder (TRUE);
+ return TRUE;
+ } else {
+ mail_config_set_goto_next_folder (FALSE);
+ return FALSE;
+ }
}
static CamelFolderInfo *
@@ -2729,19 +2915,45 @@ expunged_folder (CamelFolder *f, void *data)
static gboolean
confirm_expunge (FolderBrowser *fb)
{
- gboolean res, show_again;
-
+ GtkWidget *dialog, *label, *checkbox;
+ int button;
+
if (!mail_config_get_confirm_expunge ())
return TRUE;
-
- res = e_question(FB_WINDOW(fb), GTK_RESPONSE_NO, &show_again,
- _("This operation will permanently erase all messages marked as\n"
- "deleted. If you continue, you will not be able to recover these messages.\n"
- "\nReally erase these messages?"));
-
- mail_config_set_confirm_expunge(show_again);
-
- return res;
+
+ dialog = gnome_dialog_new (_("Warning"),
+ GNOME_STOCK_BUTTON_YES,
+ GNOME_STOCK_BUTTON_NO,
+ NULL);
+
+ e_gnome_dialog_set_parent (GNOME_DIALOG (dialog), FB_WINDOW (fb));
+
+ label = gtk_label_new (_("This operation will permanently erase all messages marked as deleted. If you continue, you will not be able to recover these messages.\n\nReally erase these messages?"));
+
+ gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
+ gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
+ gtk_widget_show (label);
+ gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), label, TRUE, TRUE, 4);
+
+ checkbox = gtk_check_button_new_with_label (_("Do not ask me again."));
+ gtk_object_ref (GTK_OBJECT (checkbox));
+ gtk_widget_show (checkbox);
+ gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), checkbox, TRUE, TRUE, 4);
+
+ /* Set the 'No' button as the default */
+ gnome_dialog_set_default (GNOME_DIALOG (dialog), 1);
+
+ button = gnome_dialog_run_and_close (GNOME_DIALOG (dialog));
+
+ if (button == 0 && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (checkbox)))
+ mail_config_set_confirm_expunge (FALSE);
+
+ gtk_object_unref (GTK_OBJECT (checkbox));
+
+ if (button == 0)
+ return TRUE;
+ else
+ return FALSE;
}
void
@@ -2777,22 +2989,28 @@ expunge_folder (BonoboUIComponent *uih, void *user_data, const char *path)
static GtkWidget *filter_editor = NULL;
static void
-filter_editor_response (GtkWidget *dialog, int button, FolderBrowser *fb)
+filter_editor_destroy (GtkWidget *dialog, gpointer user_data)
+{
+ filter_editor = NULL;
+}
+
+static void
+filter_editor_clicked (GtkWidget *dialog, int button, FolderBrowser *fb)
{
FilterContext *fc;
- if (button == GTK_RESPONSE_ACCEPT) {
+ if (button == 0) {
char *user;
- fc = g_object_get_data(G_OBJECT(dialog), "context");
+ fc = gtk_object_get_data (GTK_OBJECT (dialog), "context");
user = g_strdup_printf ("%s/filters.xml", evolution_dir);
rule_context_save ((RuleContext *)fc, user);
g_free (user);
}
-
- gtk_widget_destroy(dialog);
-
- filter_editor = NULL;
+
+ if (button != -1) {
+ gnome_dialog_close (GNOME_DIALOG (dialog));
+ }
}
static const char *filter_source_names[] = {
@@ -2820,19 +3038,27 @@ filter_edit (BonoboUIComponent *uih, void *user_data, const char *path)
g_free (user);
if (((RuleContext *)fc)->error) {
- e_notice(FB_WINDOW (fb), GTK_MESSAGE_ERROR,
- _("Error loading filter information:\n%s"),
- ((RuleContext *)fc)->error);
+ GtkWidget *dialog;
+ char *err;
+
+ err = g_strdup_printf (_("Error loading filter information:\n%s"),
+ ((RuleContext *)fc)->error);
+ dialog = gnome_warning_dialog_parented (err, FB_WINDOW (fb));
+ g_free (err);
+
+ gnome_dialog_set_close (GNOME_DIALOG (dialog), TRUE);
+ gtk_widget_show (dialog);
return;
}
filter_editor = (GtkWidget *)filter_editor_new (fc, filter_source_names);
- /* maybe this needs destroy func? */
- gtk_window_set_transient_for((GtkWindow *)filter_editor, FB_WINDOW(fb));
+ gnome_dialog_set_parent (GNOME_DIALOG (filter_editor), FB_WINDOW (fb));
gtk_window_set_title (GTK_WINDOW (filter_editor), _("Filters"));
- gtk_dialog_add_button((GtkDialog *)filter_editor, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
- g_object_set_data_full(G_OBJECT(filter_editor), "context", fc, (GtkDestroyNotify)g_object_unref);
- g_signal_connect(filter_editor, "response", G_CALLBACK(filter_editor_response), fb);
+
+ gtk_object_set_data_full (GTK_OBJECT (filter_editor), "context", fc, (GtkDestroyNotify)gtk_object_unref);
+ gtk_signal_connect (GTK_OBJECT (filter_editor), "clicked", filter_editor_clicked, fb);
+ gtk_signal_connect (GTK_OBJECT (filter_editor), "destroy", filter_editor_destroy, NULL);
+ gnome_dialog_append_buttons(GNOME_DIALOG(filter_editor), GNOME_STOCK_BUTTON_CANCEL, NULL);
gtk_widget_show (GTK_WIDGET (filter_editor));
}
@@ -2872,9 +3098,7 @@ footer_print_cb (GtkHTML *html, GnomePrintContext *print_context,
if (info->local_font) {
gchar *text = g_strdup_printf (_("Page %d of %d"), info->page_num, info->pages);
- /*gdouble tw = gnome_font_get_width_string (info->local_font, text);*/
- /* FIXME: work out how to measure this */
- gdouble tw = strlen(text) * 8;
+ gdouble tw = gnome_font_get_width_string (info->local_font, text);
gnome_print_gsave (print_context);
gnome_print_newpath (print_context);
@@ -2903,7 +3127,7 @@ footer_info_new (GtkHTML *html, GnomePrintContext *pc, gdouble *line)
struct footer_info *info;
info = g_new (struct footer_info, 1);
- info->local_font = gnome_font_find_closest ("Helvetica", 10.0);
+ info->local_font = gnome_font_new_closest ("Helvetica", GNOME_FONT_BOOK, FALSE, 10);
if (info->local_font) {
*line = gnome_font_get_ascender (info->local_font) + gnome_font_get_descender (info->local_font);
}
@@ -2920,39 +3144,47 @@ do_mail_print (FolderBrowser *fb, gboolean preview)
GnomePrintContext *print_context;
GnomePrintMaster *print_master;
GnomePrintDialog *dialog;
- GnomePrintConfig *config = NULL;
+ GnomePrinter *printer = NULL;
+ GnomePaper *paper;
gdouble line = 0.0;
+ int copies = 1;
+ int collate = FALSE;
struct footer_info *info;
if (!preview) {
dialog = GNOME_PRINT_DIALOG (gnome_print_dialog_new (_("Print Message"),
GNOME_PRINT_DIALOG_COPIES));
- gtk_dialog_set_default_response((GtkDialog *)dialog, GNOME_PRINT_DIALOG_RESPONSE_PRINT);
- gtk_window_set_transient_for((GtkWindow *)dialog, (GtkWindow *)fb);
+ gnome_dialog_set_default (GNOME_DIALOG (dialog), GNOME_PRINT_PRINT);
+ e_gnome_dialog_set_parent (GNOME_DIALOG (dialog), FB_WINDOW (fb));
- switch(gtk_dialog_run((GtkDialog *)dialog)) {
- case GNOME_PRINT_DIALOG_RESPONSE_PRINT:
+ switch (gnome_dialog_run (GNOME_DIALOG (dialog))) {
+ case GNOME_PRINT_PRINT:
break;
- case GNOME_PRINT_DIALOG_RESPONSE_PREVIEW:
+ case GNOME_PRINT_PREVIEW:
preview = TRUE;
break;
+ case -1:
+ return;
default:
- gtk_widget_destroy((GtkWidget *)dialog);
+ gnome_dialog_close (GNOME_DIALOG (dialog));
return;
}
- config = gnome_print_dialog_get_config(dialog);
- gtk_widget_destroy((GtkWidget *)dialog);
+ gnome_print_dialog_get_copies (dialog, &copies, &collate);
+ printer = gnome_print_dialog_get_printer (dialog);
+ gnome_dialog_close (GNOME_DIALOG (dialog));
}
- if (config) {
- print_master = gnome_print_master_new_from_config(config);
- gnome_print_config_unref(config);
- } else
- print_master = gnome_print_master_new ();
+ print_master = gnome_print_master_new ();
- /* paper size settings? */
- /*gnome_print_master_set_paper (print_master, paper);*/
+ if (printer)
+ gnome_print_master_set_printer (print_master, printer);
+ paper = (GnomePaper *) gnome_paper_with_name (_("US-Letter"));
+
+ if (!paper)
+ paper = (GnomePaper *) gnome_paper_with_name (gnome_paper_name_default ());
+ gnome_print_master_set_paper (print_master, paper);
+ gnome_print_master_set_copies (print_master, copies, collate);
print_context = gnome_print_master_get_context (print_master);
html = GTK_HTML (gtk_html_new ());
@@ -2977,15 +3209,19 @@ do_mail_print (FolderBrowser *fb, gboolean preview)
gnome_print_master_close (print_master);
if (preview){
- GtkWidget *preview;
-
- preview = gnome_print_master_preview_new(print_master, _("Print Preview"));
- gtk_widget_show(preview);
+ gboolean landscape = FALSE;
+ GnomePrintMasterPreview *preview;
+
+ preview = gnome_print_master_preview_new_with_orientation (
+ print_master, _("Print Preview"), landscape);
+ gtk_widget_show (GTK_WIDGET (preview));
} else {
int result = gnome_print_master_print (print_master);
- if (result == -1)
- e_notice(FB_WINDOW(fb), GTK_MESSAGE_ERROR, _("Printing of message failed"));
+ if (result == -1){
+ e_notice (NULL, GNOME_MESSAGE_BOX_ERROR,
+ _("Printing of message failed"));
+ }
}
/* FIXME: We are leaking the GtkHTML object */
@@ -3088,10 +3324,8 @@ static GtkObject *subscribe_dialog = NULL;
static void
subscribe_dialog_destroy (GtkWidget *widget, gpointer user_data)
{
- if (subscribe_dialog) {
- g_object_unref (subscribe_dialog);
- subscribe_dialog = NULL;
- }
+ gtk_object_unref (subscribe_dialog);
+ subscribe_dialog = NULL;
}
void
@@ -3099,8 +3333,8 @@ manage_subscriptions (BonoboUIComponent *uih, void *user_data, const char *path)
{
if (!subscribe_dialog) {
subscribe_dialog = subscribe_dialog_new ();
- g_signal_connect (SUBSCRIBE_DIALOG (subscribe_dialog)->app, "destroy",
- G_CALLBACK (subscribe_dialog_destroy), NULL);
+ gtk_signal_connect (GTK_OBJECT (SUBSCRIBE_DIALOG (subscribe_dialog)->app), "destroy",
+ subscribe_dialog_destroy, NULL);
subscribe_dialog_show (subscribe_dialog);
} else {
@@ -3116,7 +3350,7 @@ local_configure_done(const char *uri, CamelFolder *folder, void *data)
FolderBrowser *fb = data;
if (FOLDER_BROWSER_IS_DESTROYED (fb)) {
- g_object_unref(fb);
+ gtk_object_unref((GtkObject *)fb);
return;
}
@@ -3124,7 +3358,7 @@ local_configure_done(const char *uri, CamelFolder *folder, void *data)
folder = fb->folder;
message_list_set_folder(fb->message_list, folder, FALSE);
- g_object_unref(fb);
+ gtk_object_unref((GtkObject *)fb);
}
void
@@ -3140,7 +3374,7 @@ configure_folder (BonoboUIComponent *uih, void *user_data, const char *path)
vfolder_edit_rule (fb->uri);
} else {
message_list_set_folder(fb->message_list, NULL, FALSE);
- g_object_ref((GtkObject *)fb);
+ gtk_object_ref((GtkObject *)fb);
mail_local_reconfigure_folder(fb->uri, local_configure_done, fb);
}
}
@@ -3223,7 +3457,7 @@ stop_threads (BonoboUIComponent *uih, void *user_data, const char *path)
static void
empty_trash_expunged_cb (CamelFolder *folder, void *data)
{
- camel_object_unref (folder);
+ camel_object_unref (CAMEL_OBJECT (folder));
}
void
diff --git a/mail/mail-composer-prefs.c b/mail/mail-composer-prefs.c
index 647552af73..8e6cbb54f8 100644
--- a/mail/mail-composer-prefs.c
+++ b/mail/mail-composer-prefs.c
@@ -25,15 +25,16 @@
#include <config.h>
#endif
-#include <string.h>
-
#include "mail-composer-prefs.h"
#include "composer/e-msg-composer.h"
+#include <gtk/gtksignal.h>
+
#include <bonobo/bonobo-generic-factory.h>
+#include <bonobo/bonobo-object-client.h>
#include <gal/widgets/e-gui-utils.h>
-#include <gal/util/e-iconv.h>
+#include <gal/widgets/e-unicode.h>
#include "widgets/misc/e-charset-picker.h"
@@ -47,30 +48,30 @@
static void mail_composer_prefs_class_init (MailComposerPrefsClass *class);
static void mail_composer_prefs_init (MailComposerPrefs *dialog);
static void mail_composer_prefs_destroy (GtkObject *obj);
-static void mail_composer_prefs_finalise (GObject *obj);
+static void mail_composer_prefs_finalise (GtkObject *obj);
static void sig_event_client (MailConfigSigEvent event, MailConfigSignature *sig, MailComposerPrefs *prefs);
static GtkVBoxClass *parent_class = NULL;
-GType
+GtkType
mail_composer_prefs_get_type (void)
{
- static GType type = 0;
+ static GtkType type = 0;
if (!type) {
- static const GTypeInfo info = {
- sizeof (MailComposerPrefsClass),
- NULL, NULL,
- (GClassInitFunc) mail_composer_prefs_class_init,
- NULL, NULL,
+ GtkTypeInfo type_info = {
+ "MailComposerPrefs",
sizeof (MailComposerPrefs),
- 0,
- (GInstanceInitFunc) mail_composer_prefs_init,
+ sizeof (MailComposerPrefsClass),
+ (GtkClassInitFunc) mail_composer_prefs_class_init,
+ (GtkObjectInitFunc) mail_composer_prefs_init,
+ (GtkArgSetFunc) NULL,
+ (GtkArgGetFunc) NULL
};
- type = g_type_register_static(gtk_vbox_get_type (), "MailComposerPrefs", &info, 0);
+ type = gtk_type_unique (gtk_vbox_get_type (), &type_info);
}
return type;
@@ -79,13 +80,15 @@ mail_composer_prefs_get_type (void)
static void
mail_composer_prefs_class_init (MailComposerPrefsClass *klass)
{
- GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
- GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass);
+ GtkObjectClass *object_class;
- parent_class = g_type_class_ref (gtk_vbox_get_type ());
+ object_class = (GtkObjectClass *) klass;
+ parent_class = gtk_type_class (gtk_vbox_get_type ());
object_class->destroy = mail_composer_prefs_destroy;
- gobject_class->finalize = mail_composer_prefs_finalise;
+ object_class->finalize = mail_composer_prefs_finalise;
+ /* override methods */
+
}
static void
@@ -97,27 +100,28 @@ mail_composer_prefs_init (MailComposerPrefs *composer_prefs)
}
static void
-mail_composer_prefs_finalise (GObject *obj)
+mail_composer_prefs_finalise (GtkObject *obj)
{
MailComposerPrefs *prefs = (MailComposerPrefs *) obj;
- g_object_unref ((prefs->gui));
- g_object_unref ((prefs->pman));
- g_object_unref (prefs->enabled_pixbuf);
+ gtk_object_unref (GTK_OBJECT (prefs->gui));
+ gtk_object_unref (GTK_OBJECT (prefs->pman));
+ gdk_pixbuf_unref (prefs->enabled_pixbuf);
gdk_pixmap_unref (prefs->mark_pixmap);
- g_object_unref (prefs->mark_bitmap);
-
- G_OBJECT_CLASS (parent_class)->finalize (obj);
+ gdk_bitmap_unref (prefs->mark_bitmap);
+
+ ((GtkObjectClass *)(parent_class))->finalize (obj);
}
static void
mail_composer_prefs_destroy (GtkObject *obj)
{
MailComposerPrefs *prefs = (MailComposerPrefs *) obj;
-
+
mail_config_signature_unregister_client ((MailConfigSignatureClient) sig_event_client, prefs);
- GTK_OBJECT_CLASS (parent_class)->destroy (obj);
+ if (GTK_OBJECT_CLASS (parent_class))
+ (* GTK_OBJECT_CLASS (parent_class)->destroy) (obj);
}
static void
@@ -125,7 +129,7 @@ attach_style_info (GtkWidget *item, gpointer user_data)
{
int *style = user_data;
- g_object_set_data ((GObject *) item, "style", GINT_TO_POINTER (*style));
+ gtk_object_set_data (GTK_OBJECT (item), "style", GINT_TO_POINTER (*style));
(*style)++;
}
@@ -159,7 +163,8 @@ option_menu_connect (GtkOptionMenu *omenu, gpointer user_data)
items = GTK_MENU_SHELL (menu)->children;
while (items) {
item = items->data;
- g_signal_connect (item, "activate", G_CALLBACK (menu_changed), user_data);
+ gtk_signal_connect (GTK_OBJECT (item), "activate",
+ menu_changed, user_data);
items = items->next;
}
}
@@ -173,7 +178,7 @@ sig_load_preview (MailComposerPrefs *prefs, MailConfigSignature *sig)
gtk_html_load_from_string (GTK_HTML (prefs->sig_preview), " ", 1);
return;
}
-
+
if (sig->script)
str = mail_config_signature_run_script (sig->script);
else
@@ -214,7 +219,7 @@ sig_edit (GtkWidget *widget, MailComposerPrefs *prefs)
if (sig->filename && *sig->filename)
mail_signature_editor (sig);
else
- e_notice (GTK_WINDOW (prefs), GTK_MESSAGE_ERROR,
+ e_notice (GTK_WINDOW (prefs), GNOME_MESSAGE_BOX_ERROR,
_("Please specify signature filename\nin Advanced section of signature settings."));
}
@@ -228,10 +233,16 @@ mail_composer_prefs_new_signature (MailComposerPrefs *prefs, gboolean html, cons
sig = mail_config_signature_add (html, script);
if (prefs) {
- if (sig->name)
- name[0] = g_strconcat (sig->name, " ", _("[script]"), NULL);
- else
- name[0] = g_strdup (_("[script]"));
+ if (!(name[0] = e_utf8_to_gtk_string (GTK_WIDGET (prefs->sig_clist), sig->name)))
+ name[0] = g_strdup ("");
+
+ if (sig->script) {
+ char *tmp;
+
+ tmp = name[0];
+ name[0] = g_strconcat (tmp, _(" [script]"), NULL);
+ g_free (tmp);
+ }
row = gtk_clist_append (prefs->sig_clist, name);
gtk_clist_set_row_data (prefs->sig_clist, row, sig);
@@ -270,43 +281,39 @@ sig_add (GtkWidget *widget, MailComposerPrefs *prefs)
}
static void
-sig_add_script_response (GtkWidget *widget, int button, MailComposerPrefs *prefs)
+sig_add_script_add (GtkWidget *widget, MailComposerPrefs *prefs)
{
- const char *script, *name;
- GtkWidget *dialog;
+ char *script, *name;
GtkWidget *entry;
- if (button == GTK_RESPONSE_ACCEPT) {
- entry = glade_xml_get_widget (prefs->sig_script_gui, "fileentry_add_script_script");
- script = gtk_entry_get_text (GTK_ENTRY (gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (entry))));
+ entry = glade_xml_get_widget (prefs->sig_script_gui, "fileentry_add_script_script");
+ script = gtk_entry_get_text (GTK_ENTRY (gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (entry))));
+
+ entry = glade_xml_get_widget (prefs->sig_script_gui, "entry_add_script_name");
+ name = e_utf8_gtk_entry_get_text (GTK_ENTRY (entry));
+ if (script && *script) {
+ struct stat st;
- entry = glade_xml_get_widget (prefs->sig_script_gui, "entry_add_script_name");
- name = gtk_entry_get_text (GTK_ENTRY (entry));
- if (script && *script) {
- struct stat st;
+ if (!stat (script, &st)
+ && S_ISREG (st.st_mode) && (st.st_mode & (S_IXOTH | S_IXGRP | S_IXUSR))) {
+ MailConfigSignature *sig;
+
+ sig = mail_composer_prefs_new_signature (prefs, TRUE, script);
+ mail_config_signature_set_name (sig, name);
+ g_free (name);
+ gtk_widget_hide (prefs->sig_script_dialog);
- if (!stat (script, &st) && S_ISREG (st.st_mode) && (st.st_mode & (S_IXOTH | S_IXGRP | S_IXUSR))) {
- MailConfigSignature *sig;
-
- sig = mail_composer_prefs_new_signature (prefs, TRUE, script);
- mail_config_signature_set_name (sig, name);
- gtk_widget_hide (prefs->sig_script_dialog);
-
- return;
- }
+ return;
}
-
- dialog = gtk_message_dialog_new (GTK_WINDOW (prefs->sig_script_dialog),
- GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_MESSAGE_ERROR,
- GTK_BUTTONS_CLOSE,
- "%s", _("You must specify a valid script name."));
-
- gtk_dialog_run ((GtkDialog *) dialog);
- gtk_widget_destroy (dialog);
}
-
- gtk_widget_hide (widget);
+ gnome_dialog_run_and_close (GNOME_DIALOG (gnome_ok_dialog_parented (_("Please specify a valid script name"),
+ GTK_WINDOW (prefs->sig_script_dialog))));
+}
+
+static void
+sig_add_script_cancel (GtkWidget *widget, MailComposerPrefs *prefs)
+{
+ gnome_dialog_close (GNOME_DIALOG (prefs->sig_script_dialog));
}
static void
@@ -347,21 +354,23 @@ sig_row_unselect (GtkCList *clist, int row, int col, GdkEvent *event, MailCompos
static void
sig_fill_clist (GtkCList *clist)
{
- char *name[1];
GList *l;
+ char *name[1];
int row;
gtk_clist_freeze (clist);
for (l = mail_config_get_signature_list (); l; l = l->next) {
- name[0] = ((MailConfigSignature *) l->data)->name;
- if (((MailConfigSignature *) l->data)->script)
- name[0] = g_strconcat (name[0], " ", _("[script]"), NULL);
- else
- name[0] = g_strdup (name[0]);
-
+ name[0] = e_utf8_to_gtk_string (GTK_WIDGET (clist), ((MailConfigSignature *) l->data)->name);
+ if (((MailConfigSignature *) l->data)->script) {
+ char *tmp;
+
+ tmp = name [0];
+ name[0] = g_strconcat (name[0], _(" [script]"), NULL);
+ g_free (tmp);
+ }
row = gtk_clist_append (clist, name);
gtk_clist_set_row_data (clist, row, l->data);
- g_free (name[0]);
+ g_free (name [0]);
}
gtk_clist_thaw (clist);
}
@@ -370,8 +379,6 @@ static void
url_requested (GtkHTML *html, const char *url, GtkHTMLStream *handle)
{
GtkHTMLStreamStatus status;
- char buf[128];
- ssize_t size;
int fd;
if (!strncmp (url, "file:", 5))
@@ -380,12 +387,14 @@ url_requested (GtkHTML *html, const char *url, GtkHTMLStream *handle)
fd = open (url, O_RDONLY);
status = GTK_HTML_STREAM_OK;
if (fd != -1) {
- while ((size = read (fd, buf, sizeof (buf)))) {
+ ssize_t size;
+ void *buf = alloca (1 << 7);
+ while ((size = read (fd, buf, 1 << 7))) {
if (size == -1) {
status = GTK_HTML_STREAM_ERROR;
break;
} else
- gtk_html_write (html, handle, buf, size);
+ gtk_html_write (html, handle, (const gchar *) buf, size);
}
} else
status = GTK_HTML_STREAM_ERROR;
@@ -396,18 +405,24 @@ url_requested (GtkHTML *html, const char *url, GtkHTMLStream *handle)
static void
sig_event_client (MailConfigSigEvent event, MailConfigSignature *sig, MailComposerPrefs *prefs)
{
- char *text;
+ char *tmp, *tmp1;
switch (event) {
case MAIL_CONFIG_SIG_EVENT_NAME_CHANGED:
d(printf ("accounts NAME CHANGED\n"));
- if (sig->script)
- text = g_strconcat (sig->name, " ", _("[script]"), NULL);
- else
- text = g_strdup (sig->name);
-
- gtk_clist_set_text (GTK_CLIST (prefs->sig_clist), sig->id, 0, text);
- g_free (text);
+ tmp = e_utf8_to_gtk_string (GTK_WIDGET (prefs->sig_clist), sig->name);
+ if (sig->script) {
+ tmp1 = tmp;
+ tmp = g_strconcat (tmp, _(" [script]"), NULL);
+ g_free (tmp1);
+ }
+ gtk_clist_set_text (GTK_CLIST (prefs->sig_clist), sig->id, 0, tmp);
+ g_free (tmp);
+ if (sig == sig_current_sig (prefs)) {
+ prefs->sig_switch = TRUE;
+ /*e_utf8_gtk_entry_set_text (GTK_ENTRY (prefs->sig_name), sig->name);*/
+ prefs->sig_switch = FALSE;
+ }
break;
case MAIL_CONFIG_SIG_EVENT_CONTENT_CHANGED:
d(printf ("accounts CONTENT CHANGED\n"));
@@ -650,9 +665,9 @@ spell_language_enable (GtkWidget *widget, MailComposerPrefs *prefs)
GList *sel = GTK_CLIST (prefs->language)->selection;
if (sel) {
- int row = GPOINTER_TO_INT (sel->data);
GdkPixmap *pmap = NULL;
GdkBitmap *bmap;
+ int row = GPOINTER_TO_INT (sel->data);
gtk_clist_get_pixmap (GTK_CLIST (prefs->language), row, 0, &pmap, &bmap);
if (pmap) {
@@ -678,7 +693,7 @@ spell_language_button_press (GtkWidget *widget, GdkEventButton *event, MailCompo
GdkPixmap *pmap = NULL;
GdkBitmap *bmap;
- g_signal_stop_emission_by_name (widget, "button_press_event");
+ gtk_signal_emit_stop_by_name (GTK_OBJECT (widget), "button_press_event");
gtk_clist_get_pixmap (GTK_CLIST (prefs->language), row, 0, &pmap, &bmap);
if (pmap)
@@ -707,9 +722,9 @@ spell_setup (MailComposerPrefs *prefs)
char *texts[2];
texts[0] = NULL;
- texts[1] = _(prefs->language_seq->_buffer[i].name);
+ texts[1] = _(prefs->language_seq->_buffer [i].name);
gtk_clist_append (GTK_CLIST (prefs->language), texts);
- gtk_clist_set_row_data (GTK_CLIST (prefs->language), i, prefs->language_seq->_buffer[i].abrev);
+ gtk_clist_set_row_data (GTK_CLIST (prefs->language), i, prefs->language_seq->_buffer [i].abrev);
}
}
gtk_clist_thaw (GTK_CLIST (prefs->language));
@@ -717,37 +732,40 @@ spell_setup (MailComposerPrefs *prefs)
spell_load_values (prefs);
spell_set_ui (prefs);
- glade_xml_signal_connect_data (prefs->gui, "spellColorSet", G_CALLBACK (spell_color_set), prefs);
+ glade_xml_signal_connect_data (prefs->gui, "spellColorSet", GTK_SIGNAL_FUNC (spell_color_set), prefs);
glade_xml_signal_connect_data (prefs->gui, "spellLanguageSelectRow",
- G_CALLBACK (spell_language_select_row), prefs);
+ GTK_SIGNAL_FUNC (spell_language_select_row), prefs);
glade_xml_signal_connect_data (prefs->gui, "spellLanguageUnselectRow",
- G_CALLBACK (spell_language_unselect_row), prefs);
- glade_xml_signal_connect_data (prefs->gui, "spellLanguageEnable", G_CALLBACK (spell_language_enable), prefs);
+ GTK_SIGNAL_FUNC (spell_language_unselect_row), prefs);
+ glade_xml_signal_connect_data (prefs->gui, "spellLanguageEnable", GTK_SIGNAL_FUNC (spell_language_enable), prefs);
- g_signal_connect (prefs->language, "button_press_event", G_CALLBACK (spell_language_button_press), prefs);
+ gtk_signal_connect (GTK_OBJECT (prefs->language), "button_press_event", spell_language_button_press, prefs);
}
static gboolean
spell_setup_check_options (MailComposerPrefs *prefs)
{
+ BonoboObjectClient *dictionary_client;
GNOME_Spell_Dictionary dict;
CORBA_Environment ev;
char *dictionary_id;
-
+
dictionary_id = "OAFIID:GNOME_Spell_Dictionary:" SPELL_API_VERSION;
- dict = bonobo_activation_activate_from_id(dictionary_id, 0, NULL, NULL);
- if (dict == CORBA_OBJECT_NIL) {
+ dictionary_client = bonobo_object_activate (dictionary_id, 0);
+
+ if (!dictionary_client) {
g_warning ("Cannot activate %s", dictionary_id);
return FALSE;
}
+ dict = bonobo_object_corba_objref (BONOBO_OBJECT (dictionary_client));
CORBA_exception_init (&ev);
prefs->language_seq = GNOME_Spell_Dictionary_getLanguages (dict, &ev);
if (ev._major != CORBA_NO_EXCEPTION)
prefs->language_seq = NULL;
CORBA_exception_free (&ev);
-
+
if (prefs->language_seq == NULL)
return FALSE;
@@ -766,11 +784,8 @@ static void
mail_composer_prefs_construct (MailComposerPrefs *prefs)
{
GtkWidget *toplevel, *widget, *menu, *info_pixmap;
- GtkDialog *dialog;
GladeXML *gui;
- gboolean bool;
int style;
- char *buf;
char *names[][2] = {
{ "live_spell_check", "chkEnableSpellChecking" },
{ "magic_smileys_check", "chkAutoSmileys" },
@@ -780,9 +795,9 @@ mail_composer_prefs_construct (MailComposerPrefs *prefs)
prefs->gconf = gconf_client_get_default ();
- gui = glade_xml_new (EVOLUTION_GLADEDIR "/mail-config.glade", "composer_tab", NULL);
+ gui = glade_xml_new (EVOLUTION_GLADEDIR "/mail-config.glade", "composer_tab");
prefs->gui = gui;
- prefs->sig_script_gui = glade_xml_new (EVOLUTION_GLADEDIR "/mail-config.glade", "vbox_add_script_signature", NULL);
+ prefs->sig_script_gui = glade_xml_new (EVOLUTION_GLADEDIR "/mail-config.glade", "vbox_add_script_signature");
/* get our toplevel widget */
toplevel = glade_xml_get_widget (gui, "toplevel");
@@ -797,42 +812,37 @@ mail_composer_prefs_construct (MailComposerPrefs *prefs)
/* Default Behavior */
prefs->send_html = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkSendHTML"));
- bool = gconf_client_get_bool (prefs->gconf, "/apps/evolution/mail/composer/send_html", NULL);
- gtk_toggle_button_set_active (prefs->send_html, bool);
- g_signal_connect (prefs->send_html, "toggled", G_CALLBACK (toggle_button_toggled), prefs);
+ gtk_toggle_button_set_active (prefs->send_html, mail_config_get_send_html ());
+ gtk_signal_connect (GTK_OBJECT (prefs->send_html), "toggled",
+ toggle_button_toggled, prefs);
prefs->auto_smileys = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkAutoSmileys"));
- /* FIXME: set active? */
- g_signal_connect (prefs->auto_smileys, "toggled", G_CALLBACK (toggle_button_toggled), prefs);
+ gtk_signal_connect (GTK_OBJECT (prefs->auto_smileys), "toggled",
+ toggle_button_toggled, prefs);
prefs->prompt_empty_subject = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkPromptEmptySubject"));
- bool = gconf_client_get_bool (prefs->gconf, "/apps/evolution/mail/prompts/empty_subject", NULL);
- gtk_toggle_button_set_active (prefs->prompt_empty_subject, bool);
- g_signal_connect (prefs->prompt_empty_subject, "toggled", G_CALLBACK (toggle_button_toggled), prefs);
+ gtk_toggle_button_set_active (prefs->prompt_empty_subject, mail_config_get_prompt_empty_subject ());
+ gtk_signal_connect (GTK_OBJECT (prefs->prompt_empty_subject), "toggled",
+ toggle_button_toggled, prefs);
prefs->prompt_bcc_only = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkPromptBccOnly"));
- bool = gconf_client_get_bool (prefs->gconf, "/apps/evolution/mail/prompts/only_bcc", NULL);
- gtk_toggle_button_set_active (prefs->prompt_bcc_only, bool);
- g_signal_connect (prefs->prompt_bcc_only, "toggled", G_CALLBACK (toggle_button_toggled), prefs);
+ gtk_toggle_button_set_active (prefs->prompt_bcc_only, mail_config_get_prompt_only_bcc ());
+ gtk_signal_connect (GTK_OBJECT (prefs->prompt_bcc_only), "toggled",
+ toggle_button_toggled, prefs);
prefs->charset = GTK_OPTION_MENU (glade_xml_get_widget (gui, "omenuCharset"));
- buf = gconf_client_get_string (prefs->gconf, "/apps/evolution/mail/composer/charset", NULL);
- menu = e_charset_picker_new (buf ? buf : e_iconv_locale_charset ());
+ menu = e_charset_picker_new (mail_config_get_default_charset ());
gtk_option_menu_set_menu (prefs->charset, GTK_WIDGET (menu));
option_menu_connect (prefs->charset, prefs);
- g_free (buf);
-#warning "gtkhtml prop manager"
-#if 0
/* Spell Checking: GtkHTML part */
prefs->pman = GTK_HTML_PROPMANAGER (gtk_html_propmanager_new (NULL));
- g_signal_connect (prefs->pman, "changed", G_CALLBACK(toggle_button_toggled), prefs);
- g_object_ref ((prefs->pman));
+ gtk_signal_connect (GTK_OBJECT (prefs->pman), "changed", toggle_button_toggled, prefs);
+ gtk_object_ref (GTK_OBJECT (prefs->pman));
gtk_html_propmanager_set_names (prefs->pman, names);
gtk_html_propmanager_set_gui (prefs->pman, gui, NULL);
-#endif
-
+
/* Spell Checking: GNOME Spell part */
prefs->colour = GNOME_COLOR_PICKER (glade_xml_get_widget (gui, "colorpickerSpellCheckColor"));
prefs->language = GTK_CLIST (glade_xml_get_widget (gui, "clistSpellCheckLanguage"));
@@ -840,7 +850,7 @@ mail_composer_prefs_construct (MailComposerPrefs *prefs)
info_pixmap = glade_xml_get_widget (gui, "pixmapSpellInfo");
gtk_clist_set_column_justification (prefs->language, 0, GTK_JUSTIFY_RIGHT);
gtk_clist_set_column_auto_resize (prefs->language, 0, TRUE);
- gtk_image_set_from_file(GTK_IMAGE (info_pixmap), EVOLUTION_IMAGES "/info-bulb.png");
+ gnome_pixmap_load_file (GNOME_PIXMAP (info_pixmap), EVOLUTION_IMAGES "/info-bulb.png");
if (!spell_setup_check_options (prefs)) {
gtk_widget_hide (GTK_WIDGET (prefs->colour));
@@ -849,46 +859,48 @@ mail_composer_prefs_construct (MailComposerPrefs *prefs)
/* Forwards and Replies */
prefs->forward_style = GTK_OPTION_MENU (glade_xml_get_widget (gui, "omenuForwardStyle"));
- style = gconf_client_get_int (prefs->gconf, "/apps/evolution/mail/format/forward_style", NULL);
- gtk_option_menu_set_history (prefs->forward_style, style);
+ gtk_option_menu_set_history (prefs->forward_style, mail_config_get_default_forward_style ());
style = 0;
gtk_container_foreach (GTK_CONTAINER (gtk_option_menu_get_menu (prefs->forward_style)),
attach_style_info, &style);
option_menu_connect (prefs->forward_style, prefs);
prefs->reply_style = GTK_OPTION_MENU (glade_xml_get_widget (gui, "omenuReplyStyle"));
- style = gconf_client_get_int (prefs->gconf, "/apps/evolution/mail/format/reply_style", NULL);
- gtk_option_menu_set_history (prefs->reply_style, style);
+ gtk_option_menu_set_history (prefs->reply_style, mail_config_get_default_reply_style ());
style = 0;
gtk_container_foreach (GTK_CONTAINER (gtk_option_menu_get_menu (prefs->reply_style)),
attach_style_info, &style);
option_menu_connect (prefs->reply_style, prefs);
/* Signatures */
- dialog = (GtkDialog *) gtk_dialog_new ();
- prefs->sig_script_dialog = (GtkWidget *) dialog;
- gtk_dialog_add_buttons (dialog, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT,
- GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, NULL);
- gtk_window_set_title ((GtkWindow *) dialog, _("Add script signature"));
- g_signal_connect (dialog, "response", G_CALLBACK (sig_add_script_response), prefs);
- widget = glade_xml_get_widget (prefs->sig_script_gui, "vbox_add_script_signature");
- gtk_box_pack_start_defaults ((GtkBox *) dialog->vbox, widget);
-
prefs->sig_add = GTK_BUTTON (glade_xml_get_widget (gui, "cmdSignatureAdd"));
- g_signal_connect (prefs->sig_add, "clicked", G_CALLBACK (sig_add), prefs);
+ gtk_signal_connect (GTK_OBJECT (prefs->sig_add), "clicked",
+ GTK_SIGNAL_FUNC (sig_add), prefs);
+
+ prefs->sig_script_dialog = gnome_dialog_new (_("Add script signature"),
+ _("Add Signature"), GNOME_STOCK_BUTTON_CANCEL, NULL);
+ gnome_dialog_close_hides (GNOME_DIALOG (prefs->sig_script_dialog), TRUE);
+ gtk_box_pack_start_defaults (GTK_BOX (GNOME_DIALOG (prefs->sig_script_dialog)->vbox),
+ glade_xml_get_widget (prefs->sig_script_gui, "vbox_add_script_signature"));
+ gnome_dialog_button_connect (GNOME_DIALOG (prefs->sig_script_dialog), 0, sig_add_script_add, prefs);
+ gnome_dialog_button_connect (GNOME_DIALOG (prefs->sig_script_dialog), 1, sig_add_script_cancel, prefs);
- glade_xml_signal_connect_data (gui, "cmdSignatureAddScriptClicked", G_CALLBACK(sig_add_script), prefs);
+ glade_xml_signal_connect_data (gui, "cmdSignatureAddScriptClicked", sig_add_script, prefs);
prefs->sig_edit = GTK_BUTTON (glade_xml_get_widget (gui, "cmdSignatureEdit"));
- g_signal_connect (prefs->sig_edit, "clicked", G_CALLBACK (sig_edit), prefs);
+ gtk_signal_connect (GTK_OBJECT (prefs->sig_edit), "clicked",
+ GTK_SIGNAL_FUNC (sig_edit), prefs);
prefs->sig_delete = GTK_BUTTON (glade_xml_get_widget (gui, "cmdSignatureDelete"));
- g_signal_connect (prefs->sig_delete, "clicked", G_CALLBACK (sig_delete), prefs);
+ gtk_signal_connect (GTK_OBJECT (prefs->sig_delete), "clicked",
+ GTK_SIGNAL_FUNC (sig_delete), prefs);
prefs->sig_clist = GTK_CLIST (glade_xml_get_widget (gui, "clistSignatures"));
sig_fill_clist (prefs->sig_clist);
- g_signal_connect (prefs->sig_clist, "select_row", G_CALLBACK (sig_row_select), prefs);
- g_signal_connect (prefs->sig_clist, "unselect_row", G_CALLBACK (sig_row_unselect), prefs);
+ gtk_signal_connect (GTK_OBJECT (prefs->sig_clist), "select_row",
+ GTK_SIGNAL_FUNC (sig_row_select), prefs);
+ gtk_signal_connect (GTK_OBJECT (prefs->sig_clist), "unselect_row",
+ GTK_SIGNAL_FUNC (sig_row_unselect), prefs);
if (mail_config_get_signature_list () == NULL) {
gtk_widget_set_sensitive ((GtkWidget *) prefs->sig_delete, FALSE);
gtk_widget_set_sensitive ((GtkWidget *) prefs->sig_edit, FALSE);
@@ -897,7 +909,7 @@ mail_composer_prefs_construct (MailComposerPrefs *prefs)
/* preview GtkHTML widget */
widget = glade_xml_get_widget (gui, "scrolled-sig");
prefs->sig_preview = (GtkHTML *) gtk_html_new ();
- g_signal_connect (prefs->sig_preview, "url_requested", G_CALLBACK (url_requested), NULL);
+ gtk_signal_connect (GTK_OBJECT (prefs->sig_preview), "url_requested", GTK_SIGNAL_FUNC (url_requested), NULL);
gtk_widget_show (GTK_WIDGET (prefs->sig_preview));
gtk_container_add (GTK_CONTAINER (widget), GTK_WIDGET (prefs->sig_preview));
@@ -913,7 +925,7 @@ mail_composer_prefs_new (void)
{
MailComposerPrefs *new;
- new = (MailComposerPrefs *) g_object_new (mail_composer_prefs_get_type (), NULL);
+ new = (MailComposerPrefs *) gtk_type_new (mail_composer_prefs_get_type ());
mail_composer_prefs_construct (new);
return (GtkWidget *) new;
@@ -930,45 +942,35 @@ mail_composer_prefs_apply (MailComposerPrefs *prefs)
/* General tab */
/* Default Behavior */
- gconf_client_set_bool (prefs->gconf, "/apps/evolution/mail/composer/send_html",
- gtk_toggle_button_get_active (prefs->send_html), NULL);
-
- gconf_client_set_bool (prefs->gconf, "/apps/evolution/mail/prompts/empty_subject",
- gtk_toggle_button_get_active (prefs->prompt_empty_subject), NULL);
-
- gconf_client_set_bool (prefs->gconf, "/apps/evolution/mail/prompts/only_bcc",
- gtk_toggle_button_get_active (prefs->prompt_bcc_only), NULL);
+ mail_config_set_send_html (gtk_toggle_button_get_active (prefs->send_html));
+ mail_config_set_prompt_empty_subject (gtk_toggle_button_get_active (prefs->prompt_empty_subject));
+ mail_config_set_prompt_only_bcc (gtk_toggle_button_get_active (prefs->prompt_bcc_only));
menu = gtk_option_menu_get_menu (prefs->charset);
- if (!(string = e_charset_picker_get_charset (menu)))
- string = g_strdup (e_iconv_locale_charset ());
-
- gconf_client_set_string (prefs->gconf, "/apps/evolution/mail/composer/charset", string, NULL);
- g_free (string);
+ string = e_charset_picker_get_charset (menu);
+ if (string) {
+ mail_config_set_default_charset (string);
+ g_free (string);
+ }
/* Spell Checking */
-#warning "gtkhtml propmanager"
-#if 0
gtk_html_propmanager_apply (prefs->pman);
-#endif
spell_apply (prefs);
/* Forwards and Replies */
menu = gtk_option_menu_get_menu (prefs->forward_style);
item = gtk_menu_get_active (GTK_MENU (menu));
- val = GPOINTER_TO_INT (g_object_get_data ((GObject *) item, "style"));
- gconf_client_set_int (prefs->gconf, "/apps/evolution/mail/format/forward_style", val, NULL);
+ val = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (item), "style"));
+ mail_config_set_default_forward_style (val);
menu = gtk_option_menu_get_menu (prefs->reply_style);
item = gtk_menu_get_active (GTK_MENU (menu));
- val = GPOINTER_TO_INT (g_object_get_data ((GObject *) item, "style"));
- gconf_client_set_int (prefs->gconf, "/apps/evolution/mail/format/reply_style", val, NULL);
+ val = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (item), "style"));
+ mail_config_set_default_reply_style (val);
/* Keyboard Shortcuts */
/* FIXME: implement me */
/* Signatures */
/* FIXME: implement me */
-
- gconf_client_suggest_sync (prefs->gconf, NULL);
}
diff --git a/mail/mail-display.c b/mail/mail-display.c
index 88fb1dc6eb..d4b213a475 100644
--- a/mail/mail-display.c
+++ b/mail/mail-display.c
@@ -33,16 +33,19 @@
#include <ctype.h>
#include <fcntl.h>
#include <errno.h>
-#include <string.h>
+#include <libgnorba/gnorba.h>
+#include <libgnomevfs/gnome-vfs-mime-info.h>
#include <libgnomevfs/gnome-vfs-mime-handlers.h>
#include <libgnomevfs/gnome-vfs.h>
#include <bonobo/bonobo-control-frame.h>
#include <bonobo/bonobo-stream-memory.h>
+#include <bonobo/bonobo-ui-toolbar-icon.h>
#include <bonobo/bonobo-widget.h>
#include <bonobo/bonobo-socket.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#include <gdk-pixbuf/gdk-pixbuf-loader.h>
#include <gal/util/e-util.h>
+#include <gal/util/e-unicode-i18n.h>
#include <gal/widgets/e-popup-menu.h>
#include <gal/widgets/e-unicode.h>
#include <gtk/gtkinvisible.h>
@@ -54,7 +57,6 @@
#include <gtkhtml/htmlinterval.h>
#include <gtkhtml/gtkhtml-stream.h>
#include <libsoup/soup-message.h>
-#include <libgnome/gnome-program.h>
#include "e-util/e-html-utils.h"
#include "e-util/e-mktemp.h"
@@ -173,25 +175,31 @@ write_data_written(CamelMimePart *part, char *name, int done, void *data)
static gboolean
write_data_to_file (CamelMimePart *part, const char *name, gboolean unique)
{
- int fd, ret = FALSE;
+ int fd;
+ int ret = FALSE;
g_return_val_if_fail (CAMEL_IS_MIME_PART (part), FALSE);
fd = open (name, O_WRONLY | O_CREAT | O_EXCL, 0666);
if (fd == -1 && errno == EEXIST && !unique) {
GtkWidget *dlg;
- int button;
+ GtkWidget *text;
+ char *msg;
- dlg = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO,
- _("File `%s' already exists.\nOverwrite it?"),
- name);
+ dlg = gnome_dialog_new (_("Overwrite file?"),
+ GNOME_STOCK_BUTTON_YES,
+ GNOME_STOCK_BUTTON_NO,
+ NULL);
- g_object_set (dlg, "title", _("Overwrite file?"), "allow_grow", TRUE, NULL);
- button = gtk_dialog_run ((GtkDialog *) dlg);
- gtk_widget_destroy (dlg);
- g_object_unref (dlg);
+ msg = g_strdup_printf (_("File `%s' already exists.\nOverwrite it?"), name);
+ text = gtk_label_new (msg);
+ g_free (msg);
- if (button != GTK_RESPONSE_YES)
+ gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dlg)->vbox), text, TRUE, TRUE, 4);
+ gtk_window_set_policy (GTK_WINDOW (dlg), FALSE, TRUE, FALSE);
+ gtk_widget_show (text);
+
+ if (gnome_dialog_run_and_close (GNOME_DIALOG (dlg)) != 0)
return FALSE;
}
@@ -245,7 +253,7 @@ save_data_cb (GtkWidget *widget, gpointer user_data)
FALSE);
/* preserve the pathname */
- dir = g_path_get_dirname (gtk_file_selection_get_filename (file_select));
+ dir = g_dirname (gtk_file_selection_get_filename (file_select));
mail_config_set_last_filesel_dir (dir);
g_free (dir);
@@ -253,9 +261,9 @@ save_data_cb (GtkWidget *widget, gpointer user_data)
}
static void
-save_destroy_cb (CamelMimePart *part, GObject *deadbeef)
+save_destroy_cb (GtkWidget *widget, CamelMimePart *part)
{
- camel_object_unref (part);
+ camel_object_unref (CAMEL_OBJECT (part));
}
static gboolean
@@ -292,9 +300,9 @@ mail_display_jump_to_anchor (MailDisplay *md, const char *url)
static void
on_link_clicked (GtkHTML *html, const char *url, MailDisplay *md)
{
- if (!g_ascii_strncasecmp (url, "news:", 5) || !g_ascii_strncasecmp (url, "nntp:", 5)) {
+ if (!g_strncasecmp (url, "news:", 5) || !g_strncasecmp (url, "nntp:", 5)) {
g_warning ("Can't handle news URLs yet.");
- } else if (!g_ascii_strncasecmp (url, "mailto:", 7)) {
+ } else if (!g_strncasecmp (url, "mailto:", 7)) {
send_to_url (url);
} else if (*url == '#') {
mail_display_jump_to_anchor (md, url);
@@ -307,7 +315,7 @@ static void
save_part (CamelMimePart *part)
{
GtkFileSelection *file_select;
- char *filename, *base;
+ char *filename;
g_return_if_fail (part != NULL);
camel_object_ref (CAMEL_OBJECT (part));
@@ -318,28 +326,26 @@ save_part (CamelMimePart *part)
gtk_file_selection_new (_("Save Attachment")));
gtk_file_selection_set_filename (file_select, filename);
/* set the GtkEntry with the locale filename by breaking abstraction */
- base = g_path_get_basename(filename);
- gtk_entry_set_text(GTK_ENTRY (file_select->selection_entry), base);
- g_free(base);
+ e_utf8_gtk_entry_set_text (GTK_ENTRY (file_select->selection_entry), g_basename (filename));
g_free (filename);
- g_signal_connect(file_select->ok_button, "clicked",
- G_CALLBACK (save_data_cb), part);
- /* FIXME: deprecated */
+ gtk_signal_connect (GTK_OBJECT (file_select->ok_button), "clicked",
+ GTK_SIGNAL_FUNC (save_data_cb), part);
gtk_signal_connect_object (GTK_OBJECT (file_select->cancel_button),
"clicked",
- G_CALLBACK (gtk_widget_destroy),
+ GTK_SIGNAL_FUNC (gtk_widget_destroy),
GTK_OBJECT (file_select));
- g_object_weak_ref ((GObject *) file_select, (GWeakNotify) save_destroy_cb, part);
-
+ gtk_signal_connect (GTK_OBJECT (file_select), "destroy",
+ GTK_SIGNAL_FUNC (save_destroy_cb), part);
+
gtk_widget_show (GTK_WIDGET (file_select));
}
static void
save_cb (GtkWidget *widget, gpointer user_data)
{
- CamelMimePart *part = g_object_get_data((user_data), "CamelMimePart");
+ CamelMimePart *part = gtk_object_get_data (GTK_OBJECT (user_data), "CamelMimePart");
save_part (part);
}
@@ -347,18 +353,18 @@ save_cb (GtkWidget *widget, gpointer user_data)
static void
launch_cb (GtkWidget *widget, gpointer user_data)
{
- CamelMimePart *part = g_object_get_data(user_data, "CamelMimePart");
+ CamelMimePart *part = gtk_object_get_data (user_data, "CamelMimePart");
MailMimeHandler *handler;
GList *apps, *children, *c;
GnomeVFSMimeApplication *app;
char *command, *filename;
const char *tmpdir;
- handler = mail_lookup_handler (g_object_get_data(user_data, "mime_type"));
+ handler = mail_lookup_handler (gtk_object_get_data (user_data, "mime_type"));
g_return_if_fail (handler != NULL && handler->applications != NULL);
/* Yum. Too bad EPopupMenu doesn't allow per-item closures. */
- children = gtk_container_get_children(GTK_CONTAINER (widget->parent));
+ children = gtk_container_children (GTK_CONTAINER (widget->parent));
g_return_if_fail (children != NULL && children->next != NULL && children->next->next != NULL);
for (c = children->next->next, apps = handler->applications; c && apps; c = c->next, apps = apps->next) {
@@ -372,29 +378,21 @@ launch_cb (GtkWidget *widget, gpointer user_data)
tmpdir = e_mkdtemp ("evolution.XXXXXX");
if (!tmpdir) {
- GtkDialog *dialogue;
-
- dialogue = (GtkDialog *)gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_ERROR, GTK_RESPONSE_CLOSE,
- _("Could not create temporary directory: %s"),
- g_strerror (errno));
- /* FIXME: this should be async */
- gtk_dialog_run(dialogue);
- gtk_widget_destroy((GtkWidget *)dialogue);
+ char *msg = g_strdup_printf (_("Could not create temporary directory: %s"),
+ g_strerror (errno));
+ gnome_error_dialog (msg);
+ g_free (msg);
return;
}
filename = make_safe_filename (tmpdir, part);
if (!write_data_to_file (part, filename, TRUE)) {
- GtkDialog *dialogue;
-
- dialogue = (GtkDialog *)gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_ERROR, GTK_RESPONSE_CLOSE,
- _("Could not create temporary file '%s': %s"),
- filename, g_strerror (errno));
- /* FIXME: this should be async */
- gtk_dialog_run(dialogue);
- gtk_widget_destroy((GtkWidget *)dialogue);
- g_free(filename);
+ char *msg = g_strdup_printf (_("Could not create temporary file '%s': %s"),
+ filename, g_strerror (errno));
+ gnome_error_dialog (msg);
+ g_free (filename);
+ g_free (msg);
return;
}
@@ -410,8 +408,8 @@ launch_cb (GtkWidget *widget, gpointer user_data)
static void
inline_cb (GtkWidget *widget, gpointer user_data)
{
- MailDisplay *md = g_object_get_data(user_data, "MailDisplay");
- CamelMimePart *part = g_object_get_data(user_data, "CamelMimePart");
+ MailDisplay *md = gtk_object_get_data (user_data, "MailDisplay");
+ CamelMimePart *part = gtk_object_get_data (user_data, "CamelMimePart");
mail_part_toggle_displayed (part, md);
mail_display_queue_redisplay (md);
@@ -422,7 +420,7 @@ button_press (GtkWidget *widget, CamelMimePart *part)
{
MailDisplay *md;
- md = g_object_get_data(G_OBJECT(widget), "MailDisplay");
+ md = gtk_object_get_data (GTK_OBJECT (widget), "MailDisplay");
if (md == NULL) {
g_warning ("No MailDisplay on button!");
return;
@@ -436,9 +434,9 @@ static gboolean
pixmap_press (GtkWidget *widget, GdkEventButton *event, EScrollFrame *user_data)
{
EPopupMenu *menu;
- EPopupMenu save_item = E_POPUP_ITEM (N_("Save Attachment..."), G_CALLBACK (save_cb), 0);
- EPopupMenu view_item = E_POPUP_ITEM (N_("View Inline"), G_CALLBACK (inline_cb), 2);
- EPopupMenu open_item = E_POPUP_ITEM (N_("Open in %s..."), G_CALLBACK (launch_cb), 1);
+ EPopupMenu save_item = E_POPUP_ITEM (N_("Save Attachment..."), GTK_SIGNAL_FUNC (save_cb), 0);
+ EPopupMenu view_item = E_POPUP_ITEM (N_("View Inline"), GTK_SIGNAL_FUNC (inline_cb), 2);
+ EPopupMenu open_item = E_POPUP_ITEM (N_("Open in %s..."), GTK_SIGNAL_FUNC (launch_cb), 1);
MailDisplay *md;
CamelMimePart *part;
MailMimeHandler *handler;
@@ -460,11 +458,12 @@ pixmap_press (GtkWidget *widget, GdkEventButton *event, EScrollFrame *user_data)
/* Stop the signal, since we don't want the button's class method to
mess up our popup. */
- g_signal_stop_emission_by_name(widget, "button_press_event");
+ gtk_signal_emit_stop_by_name (GTK_OBJECT (widget), "button_press_event");
+
+ part = gtk_object_get_data (GTK_OBJECT (widget), "CamelMimePart");
+ handler = mail_lookup_handler (gtk_object_get_data (GTK_OBJECT (widget),
+ "mime_type"));
- part = g_object_get_data(G_OBJECT(widget), "CamelMimePart");
- handler = mail_lookup_handler (g_object_get_data(G_OBJECT(widget), "mime_type"));
-
if (handler && handler->applications)
nitems = g_list_length (handler->applications) + 2;
else
@@ -478,22 +477,26 @@ pixmap_press (GtkWidget *widget, GdkEventButton *event, EScrollFrame *user_data)
/* Inline view item */
memcpy (&menu[1], &view_item, sizeof (menu[1]));
if (handler && handler->builtin) {
- md = g_object_get_data(G_OBJECT(widget), "MailDisplay");
-
+ md = gtk_object_get_data (GTK_OBJECT (widget), "MailDisplay");
+
if (!mail_part_is_displayed_inline (part, md)) {
if (handler->component) {
- Bonobo_ActivationProperty *prop;
+ OAF_Property *prop;
char *name;
- prop = bonobo_server_info_prop_find(handler->component, "name");
+ prop = oaf_server_info_prop_find (
+ handler->component, "name");
if (!prop) {
- prop = bonobo_server_info_prop_find(handler->component, "description");
+ prop = oaf_server_info_prop_find (
+ handler->component,
+ "description");
}
- if (prop && prop->v._d == Bonobo_ACTIVATION_P_STRING)
+ if (prop && prop->v._d == OAF_P_STRING)
name = prop->v._u.value_string;
else
name = "bonobo";
- menu[1].name = g_strdup_printf(_("View Inline (via %s)"), name);
+ menu[1].name = g_strdup_printf (
+ _("View Inline (via %s)"), name);
} else
menu[1].name = g_strdup (_(menu[1].name));
} else
@@ -517,7 +520,8 @@ pixmap_press (GtkWidget *widget, GdkEventButton *event, EScrollFrame *user_data)
}
} else {
memcpy (&menu[2], &open_item, sizeof (menu[2]));
- menu[2].name = g_strdup_printf (_(menu[2].name), _("External Viewer"));
+ menu[2].name = g_strdup_printf (_(menu[2].name),
+ _("External Viewer"));
mask |= 1;
}
@@ -536,43 +540,48 @@ pixbuf_for_mime_type (const char *mime_type)
char *filename = NULL;
GdkPixbuf *pixbuf = NULL;
- icon_name = gnome_vfs_mime_get_icon(mime_type);
-
+ /* GnomeVFS changed the key from icon-filename to
+ icon_filename, so check icon_filename first and if that
+ fails, fall back to the old key name */
+ if (!(icon_name = gnome_vfs_mime_get_value (mime_type, "icon_filename")))
+ icon_name = gnome_vfs_mime_get_value (mime_type, "icon-filename");
+
if (icon_name) {
if (*icon_name == '/') {
- pixbuf = gdk_pixbuf_new_from_file (icon_name, NULL);
+ pixbuf = gdk_pixbuf_new_from_file (icon_name);
if (pixbuf)
return pixbuf;
}
- filename = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_PIXMAP, icon_name, TRUE, NULL);
+ filename = gnome_pixmap_file (icon_name);
if (!filename) {
char *fm_icon;
fm_icon = g_strdup_printf ("nautilus/%s", icon_name);
- filename = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_PIXMAP, fm_icon, TRUE, NULL);
+ filename = gnome_pixmap_file (fm_icon);
if (!filename) {
g_free (fm_icon);
fm_icon = g_strdup_printf ("mc/%s", icon_name);
- filename = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_PIXMAP, fm_icon, TRUE, NULL);
+ filename = gnome_pixmap_file (fm_icon);
}
g_free (fm_icon);
}
if (filename) {
- pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
+ pixbuf = gdk_pixbuf_new_from_file (filename);
g_free (filename);
}
}
if (!pixbuf) {
- filename = gnome_program_locate_file (NULL, GNOME_FILE_DOMAIN_PIXMAP, "gnome-unknown.png", TRUE, NULL);
+ filename = gnome_pixmap_file ("gnome-unknown.png");
if (filename) {
- pixbuf = gdk_pixbuf_new_from_file (filename, NULL);
+ pixbuf = gdk_pixbuf_new_from_file (filename);
g_free (filename);
} else {
g_warning ("Could not get any icon for %s!",mime_type);
- pixbuf = gdk_pixbuf_new_from_xpm_data((const char **)empty_xpm);
+ pixbuf = gdk_pixbuf_new_from_xpm_data (
+ (const char **)empty_xpm);
}
}
@@ -585,7 +594,7 @@ pixbuf_uncache (gpointer key)
GdkPixbuf *pixbuf;
pixbuf = g_hash_table_lookup (thumbnail_cache, key);
- g_object_unref (pixbuf);
+ gdk_pixbuf_unref (pixbuf);
g_hash_table_remove (thumbnail_cache, key);
g_free (key);
return FALSE;
@@ -606,19 +615,20 @@ pixbuf_gen_idle (struct _PixbufLoader *pbl)
width = gdk_pixbuf_get_width (mini);
height = gdk_pixbuf_get_height (mini);
- gtk_image_set_from_pixbuf((GtkImage *)pbl->pixmap, mini);
- gtk_widget_set_size_request (pbl->pixmap, width, height);
+ bonobo_ui_toolbar_icon_set_pixbuf (
+ BONOBO_UI_TOOLBAR_ICON (pbl->pixmap), mini);
+ gtk_widget_set_usize (pbl->pixmap, width, height);
/* Restart the cache-cleaning timer */
g_source_remove_by_user_data (orig_key);
g_timeout_add (5 * 60 * 1000, pixbuf_uncache, orig_key);
if (pbl->loader) {
- gdk_pixbuf_loader_close (pbl->loader, NULL);
- g_object_unref (pbl->loader);
- camel_object_unref (pbl->mstream);
+ gdk_pixbuf_loader_close (pbl->loader);
+ gtk_object_destroy (GTK_OBJECT (pbl->loader));
+ camel_object_unref (CAMEL_OBJECT (pbl->mstream));
}
- g_signal_handler_disconnect((pbl->eb), pbl->destroy_id);
+ gtk_signal_disconnect (GTK_OBJECT (pbl->eb), pbl->destroy_id);
g_free (pbl->type);
g_free (pbl->cid);
g_free (pbl);
@@ -631,11 +641,11 @@ pixbuf_gen_idle (struct _PixbufLoader *pbl)
if (!GTK_IS_WIDGET (pbl->pixmap)) {
/* Widget has died */
if (pbl->mstream)
- camel_object_unref (pbl->mstream);
+ camel_object_unref (CAMEL_OBJECT (pbl->mstream));
if (pbl->loader) {
- gdk_pixbuf_loader_close (pbl->loader, NULL);
- g_object_unref (pbl->loader);
+ gdk_pixbuf_loader_close (pbl->loader);
+ gtk_object_destroy (GTK_OBJECT (pbl->loader));
}
g_free (pbl->type);
@@ -650,7 +660,7 @@ pixbuf_gen_idle (struct _PixbufLoader *pbl)
len = camel_stream_read (pbl->mstream, tmp, 4096);
if (len > 0) {
- error = !gdk_pixbuf_loader_write (pbl->loader, tmp, len, NULL);
+ error = !gdk_pixbuf_loader_write (pbl->loader, tmp, len);
if (!error)
return TRUE;
} else if (!camel_stream_eos (pbl->mstream))
@@ -661,7 +671,7 @@ pixbuf_gen_idle (struct _PixbufLoader *pbl)
if (pbl->type)
pixbuf = pixbuf_for_mime_type (pbl->type);
else
- pixbuf = gdk_pixbuf_new_from_file (EVOLUTION_ICONSDIR "/pgp-signature-nokey.png", NULL);
+ pixbuf = gdk_pixbuf_new_from_file (EVOLUTION_ICONSDIR "/pgp-signature-nokey.png");
} else
pixbuf = gdk_pixbuf_loader_get_pixbuf (pbl->loader);
@@ -682,20 +692,22 @@ pixbuf_gen_idle (struct _PixbufLoader *pbl)
}
}
- mini = gdk_pixbuf_scale_simple (pixbuf, width, height, GDK_INTERP_BILINEAR);
+ mini = gdk_pixbuf_scale_simple (pixbuf, width, height,
+ GDK_INTERP_BILINEAR);
if (error || !pbl->mstream)
- g_object_unref (pixbuf);
- gtk_image_set_from_pixbuf((GtkImage *)pbl->pixmap, mini);
+ gdk_pixbuf_unref (pixbuf);
+ bonobo_ui_toolbar_icon_set_pixbuf (
+ BONOBO_UI_TOOLBAR_ICON (pbl->pixmap), mini);
/* Add the pixbuf to the cache */
g_hash_table_insert (thumbnail_cache, pbl->cid, mini);
g_timeout_add (5 * 60 * 1000, pixbuf_uncache, pbl->cid);
- g_signal_handler_disconnect(pbl->eb, pbl->destroy_id);
+ gtk_signal_disconnect (GTK_OBJECT (pbl->eb), pbl->destroy_id);
if (pbl->loader) {
- gdk_pixbuf_loader_close (pbl->loader, NULL);
- g_object_unref(pbl->loader);
- camel_object_unref (pbl->mstream);
+ gdk_pixbuf_loader_close (pbl->loader);
+ gtk_object_unref (GTK_OBJECT (pbl->loader));
+ camel_object_unref (CAMEL_OBJECT (pbl->mstream));
}
g_free (pbl->type);
g_free (pbl);
@@ -711,11 +723,11 @@ embeddable_destroy_cb (GtkObject *embeddable,
{
g_idle_remove_by_data (pbl);
if (pbl->mstream)
- camel_object_unref (pbl->mstream);
+ camel_object_unref (CAMEL_OBJECT (pbl->mstream));
if (pbl->loader) {
- gdk_pixbuf_loader_close (pbl->loader, NULL);
- g_object_unref (pbl->loader);
+ gdk_pixbuf_loader_close (pbl->loader);
+ gtk_object_destroy (GTK_OBJECT (pbl->loader));
}
g_free (pbl->type);
@@ -735,8 +747,6 @@ get_embedded_for_component (const char *iid, MailDisplay *md)
*/
embedded = bonobo_widget_new_control (iid, NULL);
if (embedded == NULL) {
-#warning "what about bonobo_widget_new_subdoc?"
-#if 0
/*
* No control, try an embeddable instead.
*/
@@ -752,7 +762,6 @@ get_embedded_for_component (const char *iid, MailDisplay *md)
return embedded;
}
-#endif
}
if (embedded == NULL)
@@ -826,14 +835,14 @@ save_url (MailDisplay *md, const char *url)
memstream = camel_stream_mem_new_with_buffer (ba->data, ba->len);
wrapper = camel_data_wrapper_new ();
camel_data_wrapper_construct_from_stream (wrapper, memstream);
- camel_object_unref (memstream);
+ camel_object_unref (CAMEL_OBJECT (memstream));
part = camel_mime_part_new ();
camel_medium_set_content_object (CAMEL_MEDIUM (part), wrapper);
- camel_object_unref (wrapper);
+ camel_object_unref (CAMEL_OBJECT (wrapper));
camel_mime_part_set_filename (part, name);
}
} else {
- camel_object_ref (part);
+ camel_object_ref (CAMEL_OBJECT (part));
}
if (part) {
@@ -847,7 +856,7 @@ save_url (MailDisplay *md, const char *url)
}
save_part (part);
- camel_object_unref (part);
+ camel_object_unref (CAMEL_OBJECT (part));
return NULL;
}
@@ -870,7 +879,7 @@ drag_data_get_cb (GtkWidget *widget,
switch (info) {
case DND_TARGET_TYPE_TEXT_URI_LIST:
/* Kludge around Nautilus requesting the same data many times */
- uri_list = g_object_get_data(G_OBJECT(widget), "uri-list");
+ uri_list = gtk_object_get_data (GTK_OBJECT (widget), "uri-list");
if (uri_list) {
gtk_selection_data_set (selection_data, selection_data->target, 8,
uri_list, strlen (uri_list));
@@ -879,18 +888,15 @@ drag_data_get_cb (GtkWidget *widget,
tmpdir = e_mkdtemp ("drag-n-drop-XXXXXX");
if (!tmpdir) {
- GtkDialog *dialogue;
-
- dialogue = (GtkDialog *)gtk_message_dialog_new(NULL, 0, GTK_MESSAGE_ERROR, GTK_RESPONSE_CLOSE,
- _("Could not create temporary directory: %s"),
- g_strerror (errno));
- /* FIXME: this should be async */
- gtk_dialog_run(dialogue);
- gtk_widget_destroy((GtkWidget *)dialogue);
+ char *msg;
+
+ msg = g_strdup_printf (_("Could not create temporary directory: %s"),
+ g_strerror (errno));
+ gnome_error_dialog (msg);
+ g_free (msg);
}
filename = camel_mime_part_get_filename (part);
- /* This is the default filename used for dnd temporary target of attachment */
if (!filename)
filename = _("Unknown");
@@ -904,7 +910,7 @@ drag_data_get_cb (GtkWidget *widget,
gtk_selection_data_set (selection_data, selection_data->target, 8,
uri_list, strlen (uri_list));
- g_object_set_data_full(G_OBJECT(widget), "uri-list", uri_list, g_free);
+ gtk_object_set_data_full (GTK_OBJECT (widget), "uri-list", uri_list, g_free);
break;
case DND_TARGET_TYPE_PART_MIME_TYPE:
if (header_content_type_is (part->content_type, "text", "*")) {
@@ -918,16 +924,19 @@ drag_data_get_cb (GtkWidget *widget,
}
} else {
CamelDataWrapper *wrapper;
- CamelStreamMem *cstream;
+ CamelStream *cstream;
+ GByteArray *ba;
+
+ ba = g_byte_array_new ();
- cstream = (CamelStreamMem *)camel_stream_mem_new();
+ cstream = camel_stream_mem_new_with_byte_array (ba);
wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (part));
- camel_data_wrapper_write_to_stream (wrapper, (CamelStream *)cstream);
+ camel_data_wrapper_write_to_stream (wrapper, cstream);
gtk_selection_data_set (selection_data, selection_data->target, 8,
- cstream->buffer->data, cstream->buffer->len);
+ ba->data, ba->len);
- camel_object_unref (cstream);
+ camel_object_unref (CAMEL_OBJECT (cstream));
}
break;
default:
@@ -942,10 +951,10 @@ drag_data_delete_cb (GtkWidget *widget,
{
char *uri_list;
- uri_list = g_object_get_data(G_OBJECT(widget), "uri-list");
+ uri_list = gtk_object_get_data (GTK_OBJECT (widget), "uri-list");
if (uri_list) {
unlink (uri_list + 7);
- g_object_set_data(G_OBJECT(widget), "uri-list", NULL);
+ gtk_object_set_data (GTK_OBJECT (widget), "uri-list", NULL);
}
}
@@ -958,7 +967,7 @@ do_attachment_header (GtkHTML *html, GtkHTMLEmbedded *eb,
struct _PixbufLoader *pbl;
pbl = g_new0 (struct _PixbufLoader, 1);
- if (g_ascii_strncasecmp (eb->type, "image/", 6) == 0) {
+ if (g_strncasecmp (eb->type, "image/", 6) == 0) {
CamelDataWrapper *content;
content = camel_medium_get_content_object (CAMEL_MEDIUM (part));
@@ -970,23 +979,25 @@ do_attachment_header (GtkHTML *html, GtkHTMLEmbedded *eb,
}
pbl->type = g_strdup (eb->type);
pbl->cid = g_strdup (eb->classid + 6);
- pbl->pixmap = gtk_image_new();
- gtk_widget_set_size_request (pbl->pixmap, 24, 24);
+ pbl->pixmap = bonobo_ui_toolbar_icon_new ();
+ gtk_widget_set_usize (pbl->pixmap, 24, 24);
pbl->eb = eb;
- pbl->destroy_id = g_signal_connect(G_OBJECT(eb), "destroy", G_CALLBACK(embeddable_destroy_cb), pbl);
+ pbl->destroy_id = gtk_signal_connect (GTK_OBJECT (eb), "destroy",
+ embeddable_destroy_cb, pbl);
- g_idle_add_full (G_PRIORITY_LOW, (GSourceFunc)pixbuf_gen_idle, pbl, NULL);
+ g_idle_add_full (G_PRIORITY_LOW, (GSourceFunc)pixbuf_gen_idle,
+ pbl, NULL);
mainbox = gtk_hbox_new (FALSE, 0);
button = gtk_button_new ();
GTK_WIDGET_UNSET_FLAGS (button, GTK_CAN_FOCUS);
- g_object_set_data(G_OBJECT(button), "MailDisplay", md);
+ gtk_object_set_data (GTK_OBJECT (button), "MailDisplay", md);
handler = mail_lookup_handler (eb->type);
if (handler && handler->builtin)
- g_signal_connect (button, "clicked",
- G_CALLBACK (button_press), part);
+ gtk_signal_connect (GTK_OBJECT (button), "clicked",
+ GTK_SIGNAL_FUNC (button_press), part);
/* Drag & Drop */
drag_types[DND_TARGET_TYPE_PART_MIME_TYPE].target = header_content_type_simple(part->content_type);
@@ -995,20 +1006,21 @@ do_attachment_header (GtkHTML *html, GtkHTMLEmbedded *eb,
gtk_drag_source_set (button, GDK_BUTTON1_MASK,
drag_types, num_drag_types,
GDK_ACTION_COPY);
- g_signal_connect(G_OBJECT(button), "drag-data-get", G_CALLBACK(drag_data_get_cb), part);
- g_signal_connect(G_OBJECT(button), "drag-data-delete", G_CALLBACK(drag_data_delete_cb), part);
+ gtk_signal_connect (GTK_OBJECT (button), "drag-data-get",
+ drag_data_get_cb, part);
+ gtk_signal_connect (GTK_OBJECT (button), "drag-data-delete",
+ drag_data_delete_cb, part);
g_free (drag_types[DND_TARGET_TYPE_PART_MIME_TYPE].target);
drag_types[DND_TARGET_TYPE_PART_MIME_TYPE].target = NULL;
hbox = gtk_hbox_new (FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 2);
-
- /* should this be a gtk_arrow? */
+
if (handler && mail_part_is_displayed_inline (part, md))
- arrow = gtk_image_new_from_stock(GTK_STOCK_GO_DOWN, GTK_ICON_SIZE_BUTTON);
+ arrow = gnome_stock_new_with_icon (GNOME_STOCK_PIXMAP_DOWN);
else
- arrow = gtk_image_new_from_stock(GTK_STOCK_GO_FORWARD, GTK_ICON_SIZE_BUTTON);
+ arrow = gnome_stock_new_with_icon (GNOME_STOCK_PIXMAP_FORWARD);
gtk_box_pack_start (GTK_BOX (hbox), arrow, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (hbox), pbl->pixmap, TRUE, TRUE, 0);
gtk_container_add (GTK_CONTAINER (button), hbox);
@@ -1019,11 +1031,13 @@ do_attachment_header (GtkHTML *html, GtkHTMLEmbedded *eb,
gtk_arrow_new (GTK_ARROW_DOWN,
GTK_SHADOW_ETCHED_IN));
- g_object_set_data(G_OBJECT(popup), "MailDisplay", md);
- g_object_set_data(G_OBJECT(popup), "CamelMimePart", part);
- g_object_set_data_full(G_OBJECT(popup), "mime_type", g_strdup (eb->type), (GDestroyNotify)g_free);
+ gtk_object_set_data (GTK_OBJECT (popup), "MailDisplay", md);
+ gtk_object_set_data (GTK_OBJECT (popup), "CamelMimePart", part);
+ gtk_object_set_data_full (GTK_OBJECT (popup), "mime_type",
+ g_strdup (eb->type), (GDestroyNotify)g_free);
- g_signal_connect(popup, "button_press_event", G_CALLBACK (pixmap_press), md->scroll);
+ gtk_signal_connect (GTK_OBJECT (popup), "button_press_event",
+ GTK_SIGNAL_FUNC (pixmap_press), md->scroll);
gtk_box_pack_start (GTK_BOX (mainbox), button, TRUE, TRUE, 0);
gtk_box_pack_start (GTK_BOX (mainbox), popup, TRUE, TRUE, 0);
@@ -1039,12 +1053,13 @@ do_external_viewer (GtkHTML *html, GtkHTMLEmbedded *eb,
CamelMimePart *part, MailDisplay *md)
{
CamelDataWrapper *wrapper;
- Bonobo_ServerInfo *component;
+ OAF_ServerInfo *component;
GtkWidget *embedded;
+ BonoboObjectClient *server;
Bonobo_PersistStream persist;
CORBA_Environment ev;
GByteArray *ba;
- CamelStreamMem *cstream;
+ CamelStream *cstream;
BonoboStream *bstream;
component = gnome_vfs_mime_get_default_component (eb->type);
@@ -1056,26 +1071,29 @@ do_external_viewer (GtkHTML *html, GtkHTMLEmbedded *eb,
if (!embedded)
return FALSE;
- persist = (Bonobo_PersistStream) Bonobo_Unknown_queryInterface(bonobo_widget_get_objref (BONOBO_WIDGET (embedded)),
- "IDL:Bonobo/PersistStream:1.0", NULL);
+ server = bonobo_widget_get_server (BONOBO_WIDGET (embedded));
+ persist = (Bonobo_PersistStream) bonobo_object_client_query_interface (
+ server, "IDL:Bonobo/PersistStream:1.0", NULL);
if (persist == CORBA_OBJECT_NIL) {
gtk_object_sink (GTK_OBJECT (embedded));
return FALSE;
}
/* Write the data to a CamelStreamMem... */
- cstream = (CamelStreamMem *)camel_stream_mem_new();
+ ba = g_byte_array_new ();
+ cstream = camel_stream_mem_new_with_byte_array (ba);
wrapper = camel_medium_get_content_object (CAMEL_MEDIUM (part));
- camel_data_wrapper_write_to_stream (wrapper, (CamelStream *)cstream);
+ camel_data_wrapper_write_to_stream (wrapper, cstream);
/* ...convert the CamelStreamMem to a BonoboStreamMem... */
- bstream = bonobo_stream_mem_create (cstream->buffer->data, cstream->buffer->len, TRUE, FALSE);
- camel_object_unref (cstream);
+ bstream = bonobo_stream_mem_create (ba->data, ba->len, TRUE, FALSE);
+ camel_object_unref (CAMEL_OBJECT (cstream));
/* ...and hydrate the PersistStream from the BonoboStream. */
CORBA_exception_init (&ev);
Bonobo_PersistStream_load (persist,
- bonobo_object_corba_objref(BONOBO_OBJECT (bstream)),
+ bonobo_object_corba_objref (
+ BONOBO_OBJECT (bstream)),
eb->type, &ev);
bonobo_object_unref (BONOBO_OBJECT (bstream));
Bonobo_Unknown_unref (persist, &ev);
@@ -1104,17 +1122,20 @@ do_signature (GtkHTML *html, GtkHTMLEmbedded *eb,
pbl = g_new0 (struct _PixbufLoader, 1);
pbl->type = NULL;
pbl->cid = g_strdup (eb->classid);
- pbl->pixmap = gtk_image_new();
- gtk_widget_set_size_request (pbl->pixmap, 24, 24);
+ pbl->pixmap = bonobo_ui_toolbar_icon_new ();
+ gtk_widget_set_usize (pbl->pixmap, 24, 24);
pbl->eb = eb;
- pbl->destroy_id = g_signal_connect(eb, "destroy", G_CALLBACK(embeddable_destroy_cb), pbl);
-
- g_idle_add_full (G_PRIORITY_LOW, (GSourceFunc)pixbuf_gen_idle, pbl, NULL);
-
+ pbl->destroy_id = gtk_signal_connect (GTK_OBJECT (eb), "destroy",
+ embeddable_destroy_cb, pbl);
+
+ g_idle_add_full (G_PRIORITY_LOW, (GSourceFunc)pixbuf_gen_idle,
+ pbl, NULL);
+
button = gtk_button_new ();
GTK_WIDGET_UNSET_FLAGS (button, GTK_CAN_FOCUS);
- g_object_set_data ((GObject *) button, "MailDisplay", md);
- g_signal_connect (button, "clicked", G_CALLBACK (button_press), part);
+ gtk_object_set_data (GTK_OBJECT (button), "MailDisplay", md);
+ gtk_signal_connect (GTK_OBJECT (button), "clicked",
+ GTK_SIGNAL_FUNC (button_press), part);
gtk_container_add (GTK_CONTAINER (button), pbl->pixmap);
gtk_widget_show_all (button);
gtk_container_add (GTK_CONTAINER (eb), button);
@@ -1215,7 +1236,7 @@ on_url_requested (GtkHTML *html, const char *url, GtkHTMLStream *handle,
html_stream = mail_stream_gtkhtml_new (html, handle);
camel_data_wrapper_write_to_stream (data, html_stream);
- camel_object_unref (html_stream);
+ camel_object_unref (CAMEL_OBJECT (html_stream));
}
gtk_html_end (html, handle, GTK_HTML_STREAM_OK);
@@ -1353,7 +1374,7 @@ static void fetch_remote(MailDisplay *md, const char *uri, GtkHTML *html, GtkHTM
rd->md = md; /* dont ref */
rd->uri = g_strdup(uri);
rd->html = html;
- g_object_ref(html);
+ gtk_object_ref((GtkObject *)html);
rd->stream = stream;
rd->cstream = cstream;
@@ -1408,7 +1429,7 @@ static void fetch_data(SoupMessage *req, void *data)
static void fetch_free(struct _remote_data *rd)
{
- g_object_unref(rd->html);
+ gtk_object_unref((GtkObject *)rd->html);
if (rd->cstream)
camel_object_unref(rd->cstream);
g_free(rd->uri);
@@ -1509,7 +1530,7 @@ try_part_urls (struct _load_content_msg *m)
html_stream = mail_stream_gtkhtml_new (m->html, m->handle);
camel_data_wrapper_write_to_stream (data, html_stream);
- camel_object_unref (html_stream);
+ camel_object_unref (CAMEL_OBJECT (html_stream));
gtk_html_end (m->html, m->handle, GTK_HTML_STREAM_OK);
return TRUE;
@@ -1527,9 +1548,12 @@ try_data_urls (struct _load_content_msg *m)
urls = g_datalist_get_data (m->display->data, "data_urls");
ba = g_hash_table_lookup (urls, m->url);
+ printf ("url: %s data: %p len: %d\n", m->url, ba, ba ? ba->len : -1);
if (ba) {
- if (ba->len)
+ if (ba->len) {
+ printf ("writing ...\n");
gtk_html_write (m->html, m->handle, ba->data, ba->len);
+ }
gtk_html_end (m->html, m->handle, GTK_HTML_STREAM_OK);
return TRUE;
}
@@ -1541,15 +1565,15 @@ static void
load_content_loaded (struct _mail_msg *mm)
{
struct _load_content_msg *m = (struct _load_content_msg *)mm;
-
-#warning "object_destroy check?"
-#if 0
+
if (GTK_OBJECT_DESTROYED (m->display))
return;
-#endif
if (m->display->current_message == m->message) {
if (m->handle) {
+ printf ("handle: %p orig: %d actual: %d\n", m->handle,
+ m->redisplay_counter,
+ m->display->redisplay_counter);
if (m->redisplay_counter == m->display->redisplay_counter) {
if (!try_part_urls (m) && !try_data_urls (m))
gtk_html_end (m->html, m->handle, GTK_HTML_STREAM_ERROR);
@@ -1565,9 +1589,9 @@ load_content_free (struct _mail_msg *mm)
struct _load_content_msg *m = (struct _load_content_msg *)mm;
g_free (m->url);
- g_object_unref((m->html));
- g_object_unref((m->display));
- camel_object_unref (m->message);
+ gtk_object_unref (GTK_OBJECT (m->html));
+ gtk_object_unref (GTK_OBJECT (m->display));
+ camel_object_unref (CAMEL_OBJECT (m->message));
}
static struct _mail_msg_op load_content_op = {
@@ -1588,11 +1612,10 @@ stream_write_or_redisplay_when_loaded (MailDisplay *md,
{
struct _load_content_msg *m;
GHashTable *loading;
-
-#if 0
+
if (GTK_OBJECT_DESTROYED (md))
return;
-#endif
+
loading = g_datalist_get_data (md->data, "loading");
if (loading) {
if (g_hash_table_lookup (loading, key))
@@ -1606,14 +1629,14 @@ stream_write_or_redisplay_when_loaded (MailDisplay *md,
m = mail_msg_new (&load_content_op, NULL, sizeof (*m));
m->display = md;
- g_object_ref((m->display));
+ gtk_object_ref (GTK_OBJECT (m->display));
m->html = html;
- g_object_ref((html));
+ gtk_object_ref (GTK_OBJECT (html));
m->handle = handle;
m->url = g_strdup (url);
m->redisplay_counter = md->redisplay_counter;
m->message = md->current_message;
- camel_object_ref (m->message);
+ camel_object_ref (CAMEL_OBJECT (m->message));
m->callback = callback;
m->data = data;
@@ -1644,13 +1667,8 @@ mail_display_redisplay_when_loaded (MailDisplay *md,
}
void
-mail_text_write (GtkHTML *html, GtkHTMLStream *stream, MailDisplay *md, CamelMimePart *part, gint idx, gboolean printing, const char *text)
+mail_text_write (GtkHTML *html, GtkHTMLStream *stream, gboolean printing, const char *text)
{
- GByteArray *ba;
- gchar *xed, *iframe;
- gchar *btt = "<tt>\n";
- gchar *ett = "</tt>\n";
-
guint flags;
char *htmltext;
@@ -1664,17 +1682,10 @@ mail_text_write (GtkHTML *html, GtkHTMLStream *stream, MailDisplay *md, CamelMim
htmltext = e_text_to_html_full (text, flags, mail_config_get_citation_color ());
- ba = g_byte_array_new ();
- g_byte_array_append (ba, (const guint8 *) btt, strlen (btt) + 1);
- g_byte_array_append (ba, (const guint8 *) htmltext, strlen (htmltext) + 1);
- g_byte_array_append (ba, (const guint8 *) ett, strlen (ett) + 1);
+ gtk_html_write (html, stream, "<tt>", 4);
+ gtk_html_write (html, stream, htmltext, strlen (htmltext));
+ gtk_html_write (html, stream, "</tt>", 5);
g_free (htmltext);
-
- xed = g_strdup_printf ("x-evolution-data:%p-%d", part, idx);
- iframe = g_strdup_printf ("<iframe src=\"%s\" frameborder=0 scrolling=no>could not get %s</iframe>", xed, xed);
- mail_display_add_url (md, "data_urls", xed, ba);
- gtk_html_write (html, stream, iframe, strlen (iframe));
- g_free (iframe);
}
void
@@ -1720,10 +1731,7 @@ mail_display_render (MailDisplay *md, GtkHTML *html, gboolean reset_scroll)
"<!doctype html public \"-//W3C//DTD HTML 4.0 TRANSITIONAL//EN\">\n"
"<html>\n"
"<head>\n<meta name=\"generator\" content=\"Evolution Mail Component\">\n</head>\n");
- if (md->current_message && md->display_style == MAIL_CONFIG_DISPLAY_SOURCE)
- mail_html_write (html, stream, "<body>\n");
- else
- mail_html_write (html, stream, "<body marginwidth=0 marginheight=0>\n");
+ mail_html_write (html, stream, "<body marginwidth=0 marginheight=0>\n");
flag = md->info ? camel_tag_get (&md->info->user_tags, "follow-up") : NULL;
completed = md->info ? camel_tag_get (&md->info->user_tags, "completed-on") : NULL;
@@ -1737,7 +1745,6 @@ mail_display_render (MailDisplay *md, GtkHTML *html, gboolean reset_scroll)
int offset;
/* my favorite thing to do... muck around with colors so we respect people's stupid themes. */
- /* FIXME: this is also in mail-format.c */
style = gtk_widget_get_style (GTK_WIDGET (html));
if (style && !md->printing) {
int state = GTK_WIDGET_STATE (GTK_WIDGET (html));
@@ -1774,7 +1781,7 @@ mail_display_render (MailDisplay *md, GtkHTML *html, gboolean reset_scroll)
target_date = header_decode_date (due_by, &offset);
now = time (NULL);
if (now >= target_date)
- overdue = _("Overdue:");
+ overdue = U_("Overdue:");
localtime_r (&target_date, &due);
@@ -1817,10 +1824,9 @@ mail_display_render (MailDisplay *md, GtkHTML *html, gboolean reset_scroll)
void
mail_display_redisplay (MailDisplay *md, gboolean reset_scroll)
{
-#if 0
if (GTK_OBJECT_DESTROYED (md))
return;
-#endif
+
fetch_cancel(md);
md->last_active = NULL;
@@ -1853,7 +1859,7 @@ mail_display_set_message (MailDisplay *md, CamelMedium *medium, CamelFolder *fol
/* Clean up from previous message. */
if (md->current_message) {
fetch_cancel (md);
- camel_object_unref (md->current_message);
+ camel_object_unref (CAMEL_OBJECT (md->current_message));
g_datalist_clear (md->data);
}
@@ -1917,7 +1923,7 @@ mail_display_load_images (MailDisplay *md)
*----------------------------------------------------------------------*/
static void
-mail_display_init (GObject *object)
+mail_display_init (GtkObject *object)
{
MailDisplay *mail_display = MAIL_DISPLAY (object);
@@ -1934,8 +1940,6 @@ mail_display_init (GObject *object)
mail_display->data = NULL;
mail_display->invisible = gtk_invisible_new ();
- g_object_ref(mail_display->invisible);
- gtk_object_sink((GtkObject *)mail_display->invisible);
mail_display->display_style = mail_config_get_message_display_style ();
@@ -1951,46 +1955,33 @@ mail_display_destroy (GtkObject *object)
{
MailDisplay *mail_display = MAIL_DISPLAY (object);
- if (mail_display->html) {
- g_object_unref(mail_display->html);
- mail_display->html = NULL;
- }
+ gtk_object_unref (GTK_OBJECT (mail_display->html));
if (mail_display->current_message) {
camel_object_unref (mail_display->current_message);
g_datalist_clear (mail_display->data);
fetch_cancel(mail_display);
- mail_display->current_message = NULL;
}
g_free (mail_display->charset);
- mail_display->charset = NULL;
g_free (mail_display->selection);
- mail_display->selection = NULL;
-
+
if (mail_display->folder) {
if (mail_display->info)
camel_folder_free_message_info (mail_display->folder, mail_display->info);
camel_object_unref (mail_display->folder);
- mail_display->folder = NULL;
}
-
+
g_free (mail_display->data);
mail_display->data = NULL;
-
- if (mail_display->idle_id) {
+
+ if (mail_display->idle_id)
gtk_timeout_remove (mail_display->idle_id);
- mail_display->idle_id = 0;
- }
-
- if (mail_display->invisible) {
- g_object_unref (mail_display->invisible);
- mail_display->invisible = NULL;
- }
+
+ gtk_widget_unref (mail_display->invisible);
g_free(mail_display->priv);
- mail_display->priv = NULL;
-
+
mail_display_parent_class->destroy (object);
}
@@ -2045,8 +2036,9 @@ mail_display_class_init (GtkObjectClass *object_class)
camel_data_cache_set_expire_age(fetch_cache, 24*60*60);
camel_data_cache_set_expire_access(fetch_cache, 2*60*60);
- mail_display_parent_class = g_type_class_ref(PARENT_TYPE);
+ mail_display_parent_class = gtk_type_class (PARENT_TYPE);
thumbnail_cache = g_hash_table_new (g_str_hash, g_str_equal);
+
}
}
@@ -2097,7 +2089,7 @@ image_save_as (GtkWidget *w, MailDisplay *mail_display)
{
const char *src;
- src = g_object_get_data(G_OBJECT(mail_display), "current_src_uri");
+ src = gtk_object_get_data (GTK_OBJECT (mail_display), "current_src_uri");
g_warning ("loading uri=%s", src);
@@ -2120,12 +2112,12 @@ enum {
#define TERMINATOR { NULL, NULL, (NULL), NULL, 0 }
static EPopupMenu link_menu [] = {
- E_POPUP_ITEM (N_("Open Link in Browser"), G_CALLBACK (link_open_in_browser), MASK_URL),
- E_POPUP_ITEM (N_("Copy Link Location"), G_CALLBACK (link_copy_location), MASK_URL),
+ E_POPUP_ITEM (N_("Open Link in Browser"), GTK_SIGNAL_FUNC (link_open_in_browser), MASK_URL),
+ E_POPUP_ITEM (N_("Copy Link Location"), GTK_SIGNAL_FUNC (link_copy_location), MASK_URL),
#if 0
- E_POPUP_ITEM (N_("Save Link as (FIXME)"), G_CALLBACK (link_save_as), MASK_URL),
+ E_POPUP_ITEM (N_("Save Link as (FIXME)"), GTK_SIGNAL_FUNC (link_save_as), MASK_URL),
#endif
- E_POPUP_ITEM (N_("Save Image as..."), G_CALLBACK (image_save_as), MASK_SRC),
+ E_POPUP_ITEM (N_("Save Image as..."), GTK_SIGNAL_FUNC (image_save_as), MASK_SRC),
TERMINATOR
};
@@ -2142,7 +2134,7 @@ struct _PopupInfo {
GtkWidget *win;
guint destroy_timeout;
guint widget_destroy_handle;
- Bonobo_Listener listener;
+ Bonobo_EventSource_ListenerId listener_id;
gboolean hidden;
};
@@ -2157,18 +2149,20 @@ popup_info_free (PopupInfo *pop)
gtk_timeout_remove (pop->destroy_timeout);
bonobo_event_source_client_remove_listener (bonobo_widget_get_objref (BONOBO_WIDGET (pop->w)),
- pop->listener,
+ pop->listener_id,
NULL);
- CORBA_Object_release (pop->listener, NULL);
+
g_free (pop);
}
}
static void
-popup_window_destroy_cb (PopupInfo *pop, GObject *deadbeef)
+popup_window_destroy_cb (GtkWidget *w, gpointer user_data)
{
+ PopupInfo *pop = (PopupInfo *) user_data;
+
the_popup = NULL;
-
+
popup_info_free (pop);
}
@@ -2247,31 +2241,45 @@ make_popup_window (GtkWidget *w)
{
PopupInfo *pop = g_new0 (PopupInfo, 1);
GtkWidget *fr;
-
+
/* Only allow for one popup at a time. Ugly. */
if (the_popup)
gtk_widget_destroy (the_popup);
-
+
pop->w = w;
the_popup = pop->win = gtk_window_new (GTK_WINDOW_POPUP);
fr = gtk_frame_new (NULL);
-
+
gtk_container_add (GTK_CONTAINER (pop->win), fr);
gtk_container_add (GTK_CONTAINER (fr), w);
-
+
gtk_window_set_policy (GTK_WINDOW (pop->win), FALSE, FALSE, FALSE);
-
- g_signal_connect (pop->win, "enter_notify_event", G_CALLBACK (popup_enter_cb), pop);
- g_signal_connect (pop->win, "leave_notify_event", G_CALLBACK (popup_leave_cb), pop);
- g_signal_connect_after (pop->win, "realize", G_CALLBACK (popup_realize_cb), pop);
- g_signal_connect (pop->win, "size_allocate", G_CALLBACK (popup_size_allocate_cb), pop);
-
- g_object_weak_ref ((GObject *) pop->win, (GWeakNotify) popup_window_destroy_cb, pop);
-
+
+ gtk_signal_connect (GTK_OBJECT (pop->win),
+ "destroy",
+ GTK_SIGNAL_FUNC (popup_window_destroy_cb),
+ pop);
+ gtk_signal_connect (GTK_OBJECT (pop->win),
+ "enter_notify_event",
+ GTK_SIGNAL_FUNC (popup_enter_cb),
+ pop);
+ gtk_signal_connect (GTK_OBJECT (pop->win),
+ "leave_notify_event",
+ GTK_SIGNAL_FUNC (popup_leave_cb),
+ pop);
+ gtk_signal_connect_after (GTK_OBJECT (pop->win),
+ "realize",
+ GTK_SIGNAL_FUNC (popup_realize_cb),
+ pop);
+ gtk_signal_connect (GTK_OBJECT (pop->win),
+ "size_allocate",
+ GTK_SIGNAL_FUNC (popup_size_allocate_cb),
+ pop);
+
gtk_widget_show (w);
gtk_widget_show (fr);
gtk_widget_show (pop->win);
-
+
return pop;
}
@@ -2325,7 +2333,7 @@ html_button_press_event (GtkWidget *widget, GdkEventButton *event, MailDisplay *
url = html_object_get_url (point->object);
src = html_object_get_src (point->object);
- if (url && !g_ascii_strncasecmp (url, "mailto:", 7)) {
+ if (url && !g_strncasecmp (url, "mailto:", 7)) {
PopupInfo *pop;
gchar *url_decoded;
@@ -2338,16 +2346,16 @@ html_button_press_event (GtkWidget *widget, GdkEventButton *event, MailDisplay *
CORBA_OBJECT_NIL);
bonobo_widget_set_property (BONOBO_WIDGET (popup_thing),
- "email", TC_CORBA_string, url_decoded+7,
+ "email", url_decoded+7,
NULL);
g_free (url_decoded);
pop = make_popup_window (popup_thing);
- pop->listener = bonobo_event_source_client_add_listener_full(
- bonobo_widget_get_objref (BONOBO_WIDGET (popup_thing)),
- g_cclosure_new(G_CALLBACK(listener_cb), pop, NULL),
- NULL, NULL);
+ pop->listener_id =
+ bonobo_event_source_client_add_listener (bonobo_widget_get_objref (BONOBO_WIDGET (popup_thing)),
+ listener_cb, NULL, NULL, pop);
+
} else if (url || src) {
gint hide_mask = 0;
@@ -2357,11 +2365,11 @@ html_button_press_event (GtkWidget *widget, GdkEventButton *event, MailDisplay *
if (!src)
hide_mask |= MASK_SRC;
- g_free (g_object_get_data(G_OBJECT(mail_display), "current_src_uri"));
- g_object_set_data(G_OBJECT(mail_display), "current_src_uri",
- gtk_html_get_url_object_relative (GTK_HTML (widget),
- point->object,
- src));
+ g_free (gtk_object_get_data (GTK_OBJECT (mail_display), "current_src_uri"));
+ gtk_object_set_data (GTK_OBJECT (mail_display), "current_src_uri",
+ gtk_html_get_url_object_relative (GTK_HTML (widget),
+ point->object,
+ src));
e_popup_menu_run (link_menu, (GdkEvent *) event, 0, hide_mask, mail_display);
@@ -2444,12 +2452,12 @@ html_motion_notify_event (GtkWidget *widget, GdkEventMotion *event, MailDisplay
static void
html_iframe_created (GtkWidget *w, GtkHTML *iframe, MailDisplay *mail_display)
{
- g_signal_connect(iframe, "button_press_event",
- G_CALLBACK (html_button_press_event), mail_display);
- g_signal_connect(iframe, "motion_notify_event",
- G_CALLBACK (html_motion_notify_event), mail_display);
- g_signal_connect(iframe, "enter_notify_event",
- G_CALLBACK (html_enter_notify_event), mail_display);
+ gtk_signal_connect (GTK_OBJECT (iframe), "button_press_event",
+ GTK_SIGNAL_FUNC (html_button_press_event), mail_display);
+ gtk_signal_connect (GTK_OBJECT (iframe), "motion_notify_event",
+ GTK_SIGNAL_FUNC (html_motion_notify_event), mail_display);
+ gtk_signal_connect (GTK_OBJECT (iframe), "enter_notify_event",
+ GTK_SIGNAL_FUNC (html_enter_notify_event), mail_display);
}
static GNOME_Evolution_ShellView
@@ -2459,7 +2467,7 @@ retrieve_shell_view_interface_from_control (BonoboControl *control)
GNOME_Evolution_ShellView shell_view_interface;
CORBA_Environment ev;
- control_frame = bonobo_control_get_control_frame (control, NULL);
+ control_frame = bonobo_control_get_control_frame (control);
if (control_frame == NULL)
return CORBA_OBJECT_NIL;
@@ -2471,9 +2479,9 @@ retrieve_shell_view_interface_from_control (BonoboControl *control)
CORBA_exception_free (&ev);
if (shell_view_interface != CORBA_OBJECT_NIL)
- g_object_set_data(G_OBJECT(control),
- "mail_threads_shell_view_interface",
- shell_view_interface);
+ gtk_object_set_data (GTK_OBJECT (control),
+ "mail_threads_shell_view_interface",
+ shell_view_interface);
else
g_warning ("Control frame doesn't have Evolution/ShellView.");
@@ -2494,7 +2502,7 @@ set_status_message (const char *message, int busy)
control = BONOBO_CONTROL (e_iterator_get (it));
- shell_view_interface = g_object_get_data(G_OBJECT(control), "mail_threads_shell_view_interface");
+ shell_view_interface = gtk_object_get_data (GTK_OBJECT (control), "mail_threads_shell_view_interface");
if (shell_view_interface == CORBA_OBJECT_NIL)
shell_view_interface = retrieve_shell_view_interface_from_control (control);
@@ -2515,7 +2523,7 @@ set_status_message (const char *message, int busy)
random ones lying around otherwise. Shrug. */
break;
}
- g_object_unref(it);
+ gtk_object_unref (GTK_OBJECT(it));
}
/* For now show every url but possibly limit it to showing only http:
@@ -2541,7 +2549,7 @@ html_on_url (GtkHTML *html,
GtkWidget *
mail_display_new (void)
{
- MailDisplay *mail_display = g_object_new (mail_display_get_type (), NULL);
+ MailDisplay *mail_display = gtk_type_new (mail_display_get_type ());
GtkWidget *scroll, *html;
GdkAtom clipboard_atom;
HTMLTokenizer *tok;
@@ -2560,17 +2568,17 @@ mail_display_new (void)
html = gtk_html_new ();
tok = e_searching_tokenizer_new ();
html_engine_set_tokenizer (GTK_HTML (html)->engine, tok);
- g_object_unref((tok));
+ gtk_object_unref (GTK_OBJECT (tok));
mail_display_initialize_gtkhtml (mail_display, GTK_HTML (html));
gtk_container_add (GTK_CONTAINER (scroll), html);
gtk_widget_show (GTK_WIDGET (html));
- g_signal_connect(mail_display->invisible, "selection_get",
- G_CALLBACK (invisible_selection_get_callback), mail_display);
- g_signal_connect(mail_display->invisible, "selection_clear_event",
- G_CALLBACK (invisible_selection_clear_event_callback), mail_display);
+ gtk_signal_connect (GTK_OBJECT (mail_display->invisible), "selection_get",
+ GTK_SIGNAL_FUNC (invisible_selection_get_callback), mail_display);
+ gtk_signal_connect (GTK_OBJECT (mail_display->invisible), "selection_clear_event",
+ GTK_SIGNAL_FUNC (invisible_selection_clear_event_callback), mail_display);
gtk_selection_add_target (mail_display->invisible,
GDK_SELECTION_PRIMARY, GDK_SELECTION_TYPE_STRING, 1);
@@ -2582,7 +2590,7 @@ mail_display_new (void)
mail_display->scroll = E_SCROLL_FRAME (scroll);
mail_display->html = GTK_HTML (html);
- g_object_ref(mail_display->html);
+ gtk_object_ref (GTK_OBJECT (mail_display->html));
mail_display->last_active = NULL;
mail_display->data = g_new0 (GData *, 1);
g_datalist_init (mail_display->data);
@@ -2598,25 +2606,25 @@ mail_display_initialize_gtkhtml (MailDisplay *mail_display, GtkHTML *html)
gtk_html_set_editable (GTK_HTML (html), FALSE);
- g_signal_connect(html, "url_requested",
- G_CALLBACK (on_url_requested),
- mail_display);
- g_signal_connect(html, "object_requested",
- G_CALLBACK (on_object_requested),
- mail_display);
- g_signal_connect(html, "link_clicked",
- G_CALLBACK (on_link_clicked),
- mail_display);
- g_signal_connect(html, "button_press_event",
- G_CALLBACK (html_button_press_event), mail_display);
- g_signal_connect(html, "motion_notify_event",
- G_CALLBACK (html_motion_notify_event), mail_display);
- g_signal_connect(html, "enter_notify_event",
- G_CALLBACK (html_enter_notify_event), mail_display);
- g_signal_connect(html, "iframe_created",
- G_CALLBACK (html_iframe_created), mail_display);
- g_signal_connect(html, "on_url",
- G_CALLBACK (html_on_url), mail_display);
+ gtk_signal_connect (GTK_OBJECT (html), "url_requested",
+ GTK_SIGNAL_FUNC (on_url_requested),
+ mail_display);
+ gtk_signal_connect (GTK_OBJECT (html), "object_requested",
+ GTK_SIGNAL_FUNC (on_object_requested),
+ mail_display);
+ gtk_signal_connect (GTK_OBJECT (html), "link_clicked",
+ GTK_SIGNAL_FUNC (on_link_clicked),
+ mail_display);
+ gtk_signal_connect (GTK_OBJECT (html), "button_press_event",
+ GTK_SIGNAL_FUNC (html_button_press_event), mail_display);
+ gtk_signal_connect (GTK_OBJECT (html), "motion_notify_event",
+ GTK_SIGNAL_FUNC (html_motion_notify_event), mail_display);
+ gtk_signal_connect (GTK_OBJECT (html), "enter_notify_event",
+ GTK_SIGNAL_FUNC (html_enter_notify_event), mail_display);
+ gtk_signal_connect (GTK_OBJECT (html), "iframe_created",
+ GTK_SIGNAL_FUNC (html_iframe_created), mail_display);
+ gtk_signal_connect (GTK_OBJECT (html), "on_url",
+ GTK_SIGNAL_FUNC (html_on_url), mail_display);
}
static void
@@ -2669,7 +2677,7 @@ mail_display_get_url_for_icon (MailDisplay *md, const char *icon_name)
if (*icon_name == '/')
icon_path = g_strdup (icon_name);
else {
- icon_path = gnome_program_locate_file(NULL, GNOME_FILE_DOMAIN_PIXMAP, icon_name, TRUE, NULL);
+ icon_path = gnome_pixmap_file (icon_name);
if (!icon_path)
return "file:///dev/null";
}
diff --git a/mail/mail-preferences.c b/mail/mail-preferences.c
index 2941618608..2046859174 100644
--- a/mail/mail-preferences.c
+++ b/mail/mail-preferences.c
@@ -25,24 +25,21 @@
#include <config.h>
#endif
-#include <string.h>
-
#include "mail-preferences.h"
-#include <gconf/gconf.h>
+#include <gal/widgets/e-unicode.h>
+#include <gal/util/e-unicode-i18n.h>
#include <gtkhtml/gtkhtml-properties.h>
#include "widgets/misc/e-charset-picker.h"
#include <bonobo/bonobo-generic-factory.h>
-#include "gal/util/e-iconv.h"
-
#include "mail-config.h"
static void mail_preferences_class_init (MailPreferencesClass *class);
static void mail_preferences_init (MailPreferences *dialog);
-static void mail_preferences_finalise (GObject *obj);
+static void mail_preferences_finalise (GtkObject *obj);
static GtkVBoxClass *parent_class = NULL;
@@ -50,20 +47,20 @@ static GtkVBoxClass *parent_class = NULL;
GtkType
mail_preferences_get_type (void)
{
- static GType type = 0;
+ static GtkType type = 0;
if (!type) {
- GTypeInfo type_info = {
- sizeof (MailPreferencesClass),
- NULL, NULL,
- (GClassInitFunc) mail_preferences_class_init,
- NULL, NULL,
+ GtkTypeInfo type_info = {
+ "MailPreferences",
sizeof (MailPreferences),
- 0,
- (GInstanceInitFunc) mail_preferences_init,
+ sizeof (MailPreferencesClass),
+ (GtkClassInitFunc) mail_preferences_class_init,
+ (GtkObjectInitFunc) mail_preferences_init,
+ (GtkArgSetFunc) NULL,
+ (GtkArgGetFunc) NULL
};
- type = g_type_register_static (gtk_vbox_get_type (), "MailPreferences", &type_info, 0);
+ type = gtk_type_unique (gtk_vbox_get_type (), &type_info);
}
return type;
@@ -72,12 +69,14 @@ mail_preferences_get_type (void)
static void
mail_preferences_class_init (MailPreferencesClass *klass)
{
- GObjectClass *object_class;
+ GtkObjectClass *object_class;
- object_class = (GObjectClass *) klass;
- parent_class = g_type_class_ref (gtk_vbox_get_type ());
+ object_class = (GtkObjectClass *) klass;
+ parent_class = gtk_type_class (gtk_vbox_get_type ());
object_class->finalize = mail_preferences_finalise;
+ /* override methods */
+
}
static void
@@ -87,15 +86,15 @@ mail_preferences_init (MailPreferences *preferences)
}
static void
-mail_preferences_finalise (GObject *obj)
+mail_preferences_finalise (GtkObject *obj)
{
MailPreferences *prefs = (MailPreferences *) obj;
- g_object_unref (prefs->gui);
- g_object_unref (prefs->pman);
- g_object_unref (prefs->gconf);
+ gtk_object_unref (GTK_OBJECT (prefs->gui));
+ gtk_object_unref (GTK_OBJECT (prefs->pman));
+ gtk_object_unref (GTK_OBJECT (prefs->gconf));
- ((GObjectClass *)(parent_class))->finalize (obj);
+ ((GtkObjectClass *)(parent_class))->finalize (obj);
}
@@ -156,7 +155,7 @@ restore_labels_clicked (GtkWidget *widget, gpointer user_data)
int i;
for (i = 0; i < 5; i++) {
- gtk_entry_set_text (prefs->labels[i].name, _(label_defaults[i].name));
+ e_utf8_gtk_entry_set_text (prefs->labels[i].name, U_(label_defaults[i].name));
colorpicker_set_color (prefs->labels[i].color, label_defaults[i].color);
}
}
@@ -181,7 +180,8 @@ option_menu_connect (GtkOptionMenu *omenu, gpointer user_data)
items = GTK_MENU_SHELL (menu)->children;
while (items) {
item = items->data;
- g_signal_connect (item, "activate", G_CALLBACK (menu_changed), user_data);
+ gtk_signal_connect (GTK_OBJECT (item), "activate",
+ menu_changed, user_data);
items = items->next;
}
}
@@ -191,20 +191,15 @@ mail_preferences_construct (MailPreferences *prefs)
{
GtkWidget *widget, *toplevel, *menu;
const char *text;
- GSList *list, *l;
- GdkColor colour;
GladeXML *gui;
- gboolean bool;
- guint32 rgb;
- int i, val;
- char *buf;
+ int i;
char *names[][2] = {
{ "anim_check", "chkShowAnimatedImages" },
{ "magic_links_check", "chkAutoDetectLinks" },
{ NULL, NULL }
};
- gui = glade_xml_new (EVOLUTION_GLADEDIR "/mail-config.glade", "preferences_tab", NULL);
+ gui = glade_xml_new (EVOLUTION_GLADEDIR "/mail-config.glade", "preferences_tab");
prefs->gui = gui;
/* get our toplevel widget */
@@ -220,147 +215,122 @@ mail_preferences_construct (MailPreferences *prefs)
/* Message Display */
prefs->timeout_toggle = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkMarkTimeout"));
- bool = gconf_client_get_bool (prefs->gconf, "/apps/evolution/mail/display/mark_seen", NULL);
- gtk_toggle_button_set_active (prefs->timeout_toggle, bool);
- g_signal_connect (prefs->timeout_toggle, "toggled", G_CALLBACK (toggle_button_toggled), prefs);
+ gtk_toggle_button_set_active (prefs->timeout_toggle, mail_config_get_do_seen_timeout ());
+ gtk_signal_connect (GTK_OBJECT (prefs->timeout_toggle), "toggled",
+ toggle_button_toggled, prefs);
prefs->timeout = GTK_SPIN_BUTTON (glade_xml_get_widget (gui, "spinMarkTimeout"));
- val = gconf_client_get_int (prefs->gconf, "/apps/evolution/mail/display/mark_seen_timeout", NULL);
- gtk_spin_button_set_value (prefs->timeout, (1.0 * val) / 1000.0);
- g_signal_connect (prefs->timeout, "changed", G_CALLBACK (entry_changed), prefs);
+ gtk_spin_button_set_value (prefs->timeout, (1.0 * mail_config_get_mark_as_seen_timeout ()) / 1000.0);
+ gtk_signal_connect (GTK_OBJECT (prefs->timeout), "changed",
+ entry_changed, prefs);
prefs->charset = GTK_OPTION_MENU (glade_xml_get_widget (gui, "omenuCharset"));
- buf = gconf_client_get_string (prefs->gconf, "/apps/evolution/mail/format/charset", NULL);
- menu = e_charset_picker_new (buf ? buf : e_iconv_locale_charset ());
+ menu = e_charset_picker_new (mail_config_get_default_charset ());
gtk_option_menu_set_menu (prefs->charset, GTK_WIDGET (menu));
option_menu_connect (prefs->charset, prefs);
- g_free (buf);
prefs->citation_highlight = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkHighlightCitations"));
- bool = gconf_client_get_bool (prefs->gconf, "/apps/evolution/mail/display/highlight_citations", NULL);
- gtk_toggle_button_set_active (prefs->citation_highlight, bool);
- g_signal_connect (prefs->citation_highlight, "toggled", G_CALLBACK (toggle_button_toggled), prefs);
+ gtk_toggle_button_set_active (prefs->citation_highlight, mail_config_get_citation_highlight ());
+ gtk_signal_connect (GTK_OBJECT (prefs->citation_highlight), "toggled",
+ toggle_button_toggled, prefs);
prefs->citation_color = GNOME_COLOR_PICKER (glade_xml_get_widget (gui, "colorpickerHighlightCitations"));
- buf = gconf_client_get_string (prefs->gconf, "/apps/evolution/mail/display/citation_colour", NULL);
- gdk_color_parse (buf ? buf : "#737373", &colour);
- rgb = ((colour.red & 0xff00) << 8) | (colour.green & 0xff00) | ((colour.blue & 0xff) >> 8);
- colorpicker_set_color (prefs->citation_color, rgb);
- g_signal_connect (prefs->citation_color, "color-set", G_CALLBACK (color_set), prefs);
- g_free (buf);
+ colorpicker_set_color (prefs->citation_color, mail_config_get_citation_color ());
+ gtk_signal_connect (GTK_OBJECT (prefs->citation_color), "color-set",
+ color_set, prefs);
/* Deleting Mail */
prefs->empty_trash = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkEmptyTrashOnExit"));
- bool = gconf_client_get_bool (prefs->gconf, "/apps/evolution/mail/trash/empty_on_exit", NULL);
- gtk_toggle_button_set_active (prefs->empty_trash, bool);
- g_signal_connect (prefs->empty_trash, "toggled", G_CALLBACK (toggle_button_toggled), prefs);
+ gtk_toggle_button_set_active (prefs->empty_trash, mail_config_get_empty_trash_on_exit ());
+ gtk_signal_connect (GTK_OBJECT (prefs->empty_trash), "toggled",
+ toggle_button_toggled, prefs);
prefs->confirm_expunge = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkConfirmExpunge"));
- bool = gconf_client_get_bool (prefs->gconf, "/apps/evolution/mail/prompts/expunge", NULL);
- gtk_toggle_button_set_active (prefs->confirm_expunge, bool);
- g_signal_connect (prefs->confirm_expunge, "toggled", G_CALLBACK (toggle_button_toggled), prefs);
+ gtk_toggle_button_set_active (prefs->confirm_expunge, mail_config_get_confirm_expunge ());
+ gtk_signal_connect (GTK_OBJECT (prefs->confirm_expunge), "toggled",
+ toggle_button_toggled, prefs);
/* New Mail Notification */
- val = gconf_client_get_int (prefs->gconf, "/apps/evolution/mail/notify/type", NULL);
prefs->notify_not = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radNotifyNot"));
- gtk_toggle_button_set_active (prefs->notify_not, val == MAIL_CONFIG_NOTIFY_NOT);
- g_signal_connect (prefs->notify_not, "toggled", G_CALLBACK (toggle_button_toggled), prefs);
+ gtk_toggle_button_set_active (prefs->notify_not, mail_config_get_new_mail_notify () == MAIL_CONFIG_NOTIFY_NOT);
+ gtk_signal_connect (GTK_OBJECT (prefs->notify_not), "toggled",
+ toggle_button_toggled, prefs);
prefs->notify_beep = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radNotifyBeep"));
- gtk_toggle_button_set_active (prefs->notify_beep, val == MAIL_CONFIG_NOTIFY_BEEP);
- g_signal_connect (prefs->notify_beep, "toggled", G_CALLBACK (toggle_button_toggled), prefs);
+ gtk_toggle_button_set_active (prefs->notify_beep, mail_config_get_new_mail_notify () == MAIL_CONFIG_NOTIFY_BEEP);
+ gtk_signal_connect (GTK_OBJECT (prefs->notify_beep), "toggled",
+ toggle_button_toggled, prefs);
prefs->notify_play_sound = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radNotifyPlaySound"));
- gtk_toggle_button_set_active (prefs->notify_play_sound, val == MAIL_CONFIG_NOTIFY_PLAY_SOUND);
- g_signal_connect (prefs->notify_play_sound, "toggled", G_CALLBACK (toggle_button_toggled), prefs);
+ gtk_toggle_button_set_active (prefs->notify_play_sound,
+ mail_config_get_new_mail_notify () == MAIL_CONFIG_NOTIFY_PLAY_SOUND);
+ gtk_signal_connect (GTK_OBJECT (prefs->notify_play_sound), "toggled",
+ toggle_button_toggled, prefs);
prefs->notify_sound_file = GNOME_FILE_ENTRY (glade_xml_get_widget (gui, "fileNotifyPlaySound"));
- buf = gconf_client_get_string (prefs->gconf, "/apps/evolution/mail/notify/sound", NULL);
- gtk_entry_set_text (GTK_ENTRY (gnome_file_entry_gtk_entry (prefs->notify_sound_file)), buf ? buf : "");
- g_signal_connect (gnome_file_entry_gtk_entry (prefs->notify_sound_file), "changed",
- G_CALLBACK (entry_changed), prefs);
- g_free (buf);
+ text = mail_config_get_new_mail_notify_sound_file ();
+ gtk_entry_set_text (GTK_ENTRY (gnome_file_entry_gtk_entry (prefs->notify_sound_file)),
+ text ? text : "");
+ gtk_signal_connect (GTK_OBJECT (gnome_file_entry_gtk_entry (prefs->notify_sound_file)), "changed",
+ entry_changed, prefs);
/* HTML Mail tab */
/* Loading Images */
- val = gconf_client_get_int (prefs->gconf, "/apps/evolution/mail/display/load_http_images", NULL);
prefs->images_never = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radImagesNever"));
- gtk_toggle_button_set_active (prefs->images_never, val == MAIL_CONFIG_HTTP_NEVER);
- g_signal_connect (prefs->images_never, "toggled", G_CALLBACK (toggle_button_toggled), prefs);
+ gtk_toggle_button_set_active (prefs->images_never, mail_config_get_http_mode () == MAIL_CONFIG_HTTP_NEVER);
+ gtk_signal_connect (GTK_OBJECT (prefs->images_never), "toggled",
+ toggle_button_toggled, prefs);
prefs->images_sometimes = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radImagesSometimes"));
- gtk_toggle_button_set_active (prefs->images_sometimes, val == MAIL_CONFIG_HTTP_SOMETIMES);
- g_signal_connect (prefs->images_sometimes, "toggled", G_CALLBACK (toggle_button_toggled), prefs);
+ gtk_toggle_button_set_active (prefs->images_sometimes, mail_config_get_http_mode () == MAIL_CONFIG_HTTP_SOMETIMES);
+ gtk_signal_connect (GTK_OBJECT (prefs->images_sometimes), "toggled",
+ toggle_button_toggled, prefs);
prefs->images_always = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "radImagesAlways"));
- gtk_toggle_button_set_active (prefs->images_always, val == MAIL_CONFIG_HTTP_ALWAYS);
- g_signal_connect (prefs->images_always, "toggled", G_CALLBACK (toggle_button_toggled), prefs);
+ gtk_toggle_button_set_active (prefs->images_always, mail_config_get_http_mode () == MAIL_CONFIG_HTTP_ALWAYS);
+ gtk_signal_connect (GTK_OBJECT (prefs->images_always), "toggled",
+ toggle_button_toggled, prefs);
-#warning "gtkhtml prop manager"
-#if 0
prefs->pman = GTK_HTML_PROPMANAGER (gtk_html_propmanager_new (prefs->gconf));
- g_signal_connect (prefs->pman, "changed", G_CALLBACK (toggle_button_toggled), prefs);
- g_object_ref (prefs->pman);
+ gtk_signal_connect (GTK_OBJECT (prefs->pman), "changed", toggle_button_toggled, prefs);
+ gtk_object_ref (GTK_OBJECT (prefs->pman));
gtk_html_propmanager_set_names (prefs->pman, names);
gtk_html_propmanager_set_gui (prefs->pman, gui, NULL);
for (i = 0; names[i][0] != NULL; i++) {
widget = glade_xml_get_widget (gui, names[i][1]);
- g_signal_connect (widget, "toggled", G_CALLBACK (toggle_button_toggled), prefs);
+ gtk_signal_connect (GTK_OBJECT (widget), "toggled",
+ toggle_button_toggled, prefs);
}
-#endif
prefs->prompt_unwanted_html = GTK_TOGGLE_BUTTON (glade_xml_get_widget (gui, "chkPromptWantHTML"));
- bool = gconf_client_get_bool (prefs->gconf, "/apps/evolution/mail/prompts/unwanted_html", NULL);
- gtk_toggle_button_set_active (prefs->prompt_unwanted_html, bool);
- g_signal_connect (prefs->prompt_unwanted_html, "toggled", G_CALLBACK (toggle_button_toggled), prefs);
-
- l = list = gconf_client_get_list (prefs->gconf, "/apps/evolution/mail/labels", GCONF_VALUE_STRING, NULL);
+ gtk_toggle_button_set_active (prefs->prompt_unwanted_html, mail_config_get_confirm_unwanted_html ());
+ gtk_signal_connect (GTK_OBJECT (prefs->prompt_unwanted_html), "toggled",
+ toggle_button_toggled, prefs);
/* Labels and Colours tab */
for (i = 0; i < 5; i++) {
- char *widget_name, *label, *p;
+ char *widget_name;
widget_name = g_strdup_printf ("txtLabel%d", i);
prefs->labels[i].name = GTK_ENTRY (glade_xml_get_widget (gui, widget_name));
g_free (widget_name);
+ text = mail_config_get_label_name (i);
+ e_utf8_gtk_entry_set_text (prefs->labels[i].name, text ? text : "");
+ gtk_signal_connect (GTK_OBJECT (prefs->labels[i].name), "changed",
+ entry_changed, prefs);
widget_name = g_strdup_printf ("colorLabel%d", i);
prefs->labels[i].color = GNOME_COLOR_PICKER (glade_xml_get_widget (gui, widget_name));
g_free (widget_name);
-
- label = l ? (char *) l->data : g_strdup (_(label_defaults[i].name));
- if ((p = strrchr (label, ':'))) {
- *p++ = '\0';
- gdk_color_parse (p, &colour);
- rgb = ((colour.red & 0xff00) << 8) | (colour.green & 0xff00) | ((colour.blue & 0xff) >> 8);
- } else {
- rgb = label_defaults[i].color;
- }
-
- gtk_entry_set_text (prefs->labels[i].name, label);
- g_free (label);
-
- g_signal_connect (prefs->labels[i].name, "changed", G_CALLBACK (entry_changed), prefs);
-
- colorpicker_set_color (prefs->labels[i].color, rgb);
- g_signal_connect (prefs->labels[i].color, "color_set", G_CALLBACK (color_set), prefs);
-
- if (l != NULL)
- l = l->next;
+ colorpicker_set_color (prefs->labels[i].color, mail_config_get_label_color (i));
+ gtk_signal_connect (GTK_OBJECT (prefs->labels[i].color), "color_set",
+ color_set, prefs);
}
-
- /* this is in case somehow the gconf list is longer than 5... */
- while (l != NULL) {
- g_free (l->data);
- l = l->next;
- }
-
- g_slist_free (list);
-
prefs->restore_labels = GTK_BUTTON (glade_xml_get_widget (gui, "cmdRestoreLabels"));
- g_signal_connect (prefs->restore_labels, "clicked", G_CALLBACK (restore_labels_clicked), prefs);
+ gtk_signal_connect (GTK_OBJECT (prefs->restore_labels), "clicked",
+ restore_labels_clicked, prefs);
}
@@ -369,7 +339,7 @@ mail_preferences_new (void)
{
MailPreferences *new;
- new = (MailPreferences *) g_object_new (mail_preferences_get_type (), NULL);
+ new = (MailPreferences *) gtk_type_new (mail_preferences_get_type ());
mail_preferences_construct (new);
return (GtkWidget *) new;
@@ -380,91 +350,70 @@ void
mail_preferences_apply (MailPreferences *prefs)
{
GtkWidget *entry, *menu;
- char *string, buf[20];
- const char *cstring;
- GSList *list, *l;
+ char *string;
guint32 rgb;
int i, val;
/* General tab */
/* Message Display */
- gconf_client_set_bool (prefs->gconf, "/apps/evolution/mail/display/mark_seen",
- gtk_toggle_button_get_active (prefs->timeout_toggle), NULL);
+ mail_config_set_do_seen_timeout (gtk_toggle_button_get_active (prefs->timeout_toggle));
- val = (int) (gtk_spin_button_get_value (prefs->timeout) * 1000.0);
- gconf_client_set_int (prefs->gconf, "/apps/evolution/mail/display/mark_seen_timeout", val, NULL);
+ val = (int) (gtk_spin_button_get_value_as_float (prefs->timeout) * 1000);
+ mail_config_set_mark_as_seen_timeout (val);
menu = gtk_option_menu_get_menu (prefs->charset);
- if (!(string = e_charset_picker_get_charset (menu)))
- string = g_strdup (e_iconv_locale_charset ());
-
- gconf_client_set_string (prefs->gconf, "/apps/evolution/mail/format/charset", string, NULL);
- g_free (string);
+ string = e_charset_picker_get_charset (menu);
+ if (string) {
+ mail_config_set_default_charset (string);
+ g_free (string);
+ }
- gconf_client_set_bool (prefs->gconf, "/apps/evolution/mail/display/highlight_citations",
- gtk_toggle_button_get_active (prefs->citation_highlight), NULL);
+ mail_config_set_citation_highlight (gtk_toggle_button_get_active (prefs->citation_highlight));
rgb = colorpicker_get_color (prefs->citation_color);
- g_snprintf (buf, sizeof (buf), "#%0.6x", rgb);
- gconf_client_set_string (prefs->gconf, "/apps/evolution/mail/display/citation_colour", buf, NULL);
+ mail_config_set_citation_color (rgb);
/* Deleting Mail */
- gconf_client_set_bool (prefs->gconf, "/apps/evolution/mail/trash/empty_on_exit",
- gtk_toggle_button_get_active (prefs->empty_trash), NULL);
+ mail_config_set_empty_trash_on_exit (gtk_toggle_button_get_active (prefs->empty_trash));
- gconf_client_set_bool (prefs->gconf, "/apps/evolution/mail/prompts/expunge",
- gtk_toggle_button_get_active (prefs->confirm_expunge), NULL);
+ mail_config_set_confirm_expunge (gtk_toggle_button_get_active (prefs->confirm_expunge));
/* New Mail Notification */
if (gtk_toggle_button_get_active (prefs->notify_not))
- val = MAIL_CONFIG_NOTIFY_NOT;
+ mail_config_set_new_mail_notify (MAIL_CONFIG_NOTIFY_NOT);
else if (gtk_toggle_button_get_active (prefs->notify_beep))
- val = MAIL_CONFIG_NOTIFY_BEEP;
+ mail_config_set_new_mail_notify (MAIL_CONFIG_NOTIFY_BEEP);
else
- val = MAIL_CONFIG_NOTIFY_PLAY_SOUND;
-
- gconf_client_set_int (prefs->gconf, "/apps/evolution/mail/notify/type", val, NULL);
+ mail_config_set_new_mail_notify (MAIL_CONFIG_NOTIFY_PLAY_SOUND);
entry = gnome_file_entry_gtk_entry (GNOME_FILE_ENTRY (prefs->notify_sound_file));
- cstring = gtk_entry_get_text (GTK_ENTRY (entry));
- gconf_client_set_string (prefs->gconf, "/apps/evolution/mail/notify/sound", cstring, NULL);
+ string = gtk_entry_get_text (GTK_ENTRY (entry));
+ mail_config_set_new_mail_notify_sound_file (string);
/* HTML Mail */
if (gtk_toggle_button_get_active (prefs->images_always))
- val = MAIL_CONFIG_HTTP_ALWAYS;
+ mail_config_set_http_mode (MAIL_CONFIG_HTTP_ALWAYS);
else if (gtk_toggle_button_get_active (prefs->images_sometimes))
- val = MAIL_CONFIG_HTTP_SOMETIMES;
+ mail_config_set_http_mode (MAIL_CONFIG_HTTP_SOMETIMES);
else
- val = MAIL_CONFIG_HTTP_NEVER;
+ mail_config_set_http_mode (MAIL_CONFIG_HTTP_NEVER);
- gconf_client_set_int (prefs->gconf, "/apps/evolution/mail/display/load_http_images", val, NULL);
-
-#warning "gtkhtml propmanager"
-#if 0
gtk_html_propmanager_apply (prefs->pman);
-#endif
- gconf_client_set_bool (prefs->gconf, "/apps/evolution/mail/prompts/unwanted_html",
- gtk_toggle_button_get_active (prefs->prompt_unwanted_html), NULL);
+ mail_config_set_confirm_unwanted_html (gtk_toggle_button_get_active (prefs->prompt_unwanted_html));
/* Labels and Colours */
- list = NULL;
- for (i = 4; i >= 0; i--) {
- cstring = gtk_entry_get_text (prefs->labels[i].name);
+ for (i = 0; i < 5; i++) {
+ /* save the label... */
+ string = e_utf8_gtk_entry_get_text (prefs->labels[i].name);
+ mail_config_set_label_name (i, string);
+ g_free (string);
+
+ /* save the colour... */
rgb = colorpicker_get_color (prefs->labels[i].color);
- string = g_strdup_printf ("%s:#%0.6x", cstring, rgb);
- list = g_slist_prepend (list, string);
- }
-
- gconf_client_set_list (prefs->gconf, "/apps/evolution/mail/labels", GCONF_VALUE_STRING, list, NULL);
-
- l = list;
- while (l != NULL) {
- g_free (l->data);
- l = l->next;
+ mail_config_set_label_color (i, rgb);
}
- g_slist_free (list);
- gconf_client_suggest_sync (prefs->gconf, NULL);
+ mail_config_write ();
}
diff --git a/shell/ChangeLog b/shell/ChangeLog
index d570b7b0f4..65644132af 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,1348 +1,58 @@
-2002-12-04 Ettore Perazzoli <ettore@ximian.com>
+2002-12-05 Chris Toshok <toshok@ximian.com>
- * e-component-registry.c (component_free): Only invoke
- wait_for_corba_object_to_die on components that are out-of-proc.
+ * e-shell-config-default-folders.c: use "contacts",
+ "contacts/ldap" as the accepted contacts types, so it'll allow
+ both normal and ldap contact folders.
-2002-11-27 Not Zed <NotZed@Ximian.com>
+2002-11-26 Ettore Perazzoli <ettore@ximian.com>
- * main.c (show_development_warning): changed to use a gtkdialog
- instead of a gnome one.
- (warning_dialog_response_callback): clicked->response.
+ * main.c (kill_old_wombat): New function to kill running wombat
+ processes whose version is different from ours, using the
+ WombatInterfaceCheck interface.
+ (kill_wombat): New.
+ (idle_cb): Invoke kill_old_wombat().
- * e-shell-folder-selection-dialog.c: Include gtk/gtkstock.h
+ * e-storage-set-view.c (path_free_func): New GHFunc to free keys.
+ (impl_destroy): g_hash_table_foreach() it on
+ priv->path_to_etree_node befor destroying the hash table.
+ (e_storage_set_view_set_show_checkboxes): Unref the state object.
- * e-shell-folder-creation-dialog.c: include gnome-dialog.h
- (dialog_response_cb): gtk_entry_get_text now returns const. Dont
- free result.
-
- * e-setup.c: include gnome-messagebox.h
-
- * *.c: (re)run fix.sh over all, for e_notice changes & pick up
- some deprecated functions.
+ * e-shell-user-creatable-items-handler.c
+ (append_xml_for_menu_item): Free return value from
+ bonobo_ui_util_pixbuf_to_xml().
- * e-shell-shared-folder-picker-dialog.c
- (shared_folder_discovery_callback): reformat e_notice call for
- script.
+ * e-shell-folder-title-bar.c (create_pixmap_widget_from_xpm):
+ Unref the pixbuf.
- * e-shell-offline-sync.c
- (impl_SyncFolderProgressListener_reportFailure): Fix e_notice
- call, we weren't passing type in.
+ * e-corba-storage-registry.c (listener_notify): CORBA_free the
+ name string.
- * e-shell-folder-commands.c (xfer_result_callback): changed around
- slightly to save some processing & allow a script to run.
- (e_shell_command_rename_folder): reformat e_notice call to help script.
- Include gnome-messagebox.h
+ * e-storage.c (e_storage_has_subfolders): Free local variable
+ pseudofolder_path.
2002-11-25 Dan Winship <danw@ximian.com>
* e-shell-settings-dialog.c (page_new): e_get_language_list now
returns language codes that actually work with oaf, making the
- _()s here redundant.
+ U_()s here redundant.
* e-component-info.c (get_i18n_value): Remove code to turn "fr_FR"
into "fr", since e_get_language_list will return both now.
-2002-11-25 Ettore Perazzoli <ettore@ximian.com>
-
- * apps_evolution_shell.schemas: Fix <key> -> <applyto> typo.
-
-2002-11-25 Ettore Perazzoli <ettore@ximian.com>
-
- * e-shell-offline-sync.c (e_shell_offline_sync_all_folders):
- Filled in, use GConf.
- (cleanup): Re-enabled again.
- (sync_folder): Likewise.
- (progress_dialog_close_callback): Likewise.
- (progress_dialog_clicked_callback): Likewise.
- (setup_dialog): Likewise.
- (setup_progress_listener): Likewise.
- (impl_SyncFolderProgressListener_reportFailure): Likewise.
- (impl_SyncFolderProgressListener_reportSuccess): Likewise.
- (impl_SyncFolderProgressListener_updateProgress): Likewise.
- (progress_listener_servant_free): Likewise.
- (progress_listener_servant_new): Likewise.
-
-2002-11-25 Ettore Perazzoli <ettore@ximian.com>
-
- * evolution-storage-set-view.c
- (impl_StorageSetView__set_checkedFolders): Updated to pass a
- GSList to e_storage_set_view_set_checkboxes_list() [instead of a
- GList].
- (impl_StorageSetView__get_checkedFolders): Likewise with the
- return value from e_storage_set_view_get_checkboxes_list().
-
- * e-shell-config-offline.c (config_control_apply_callback): Filled
- in, using GConf.
- (init_storage_set_view_status_from_config): Likewise.
-
- * e-storage-set-view.c (e_storage_set_view_get_checkboxes_list):
- Return a GSList instead of a GList.
- (essv_add_to_list): Update for the GSList.
- (e_storage_set_view_set_checkboxes_list): Get a GSList instead of
- a GList.
-
- * apps_evolution_shell.schemas: Added
- /schemas/apps/evolution/shell/offline/folder_paths.
-
-2002-11-20 Ettore Perazzoli <ettore@ximian.com>
-
- * main.c (idle_cb): Set displayed_any in the case when we are
- calling e_shell_create_view(). Also initialize displayed_any to
- FALSE earlier so we dont' end up opening two views at startup by
- default.
-
-2002-11-20 Ettore Perazzoli <ettore@ximian.com>
-
- * e-shell-folder-selection-dialog.c (impl_dispose): Save the
- expansion state for the EStorageSetView here.
- (impl_finalize): Instead of here.
-
-2002-11-20 Chris Toshok <toshok@ximian.com>
-
- * e-folder-list.c (e_folder_list_class_init): use e_shell_
- marshallers, and make sure STRING parameters map to *_STRING*
- marshallers.
-
- * evolution-wizard.c (evolution_wizard_class_init): same.
-
- * evolution-storage.c (class_init): same.
-
- * evolution-storage-set-view-listener.c (class_init): same.
-
- * evolution-storage-listener.c (class_init): same.
-
- * evolution-shell-view.c (class_init): same.
-
- * evolution-session.c (class_init): same.
-
- * evolution-folder-selector-button.c (class_init): same.
-
- * evolution-config-control.c (class_init): same.
-
- * evolution-activity-client.c (class_init): same.
-
- * e-storage-set.c (class_init): same.
-
- * e-shortcuts.c (class_init): same.
-
- * e-shortcuts-view.c (class_init): same.
-
- * e-shell.c (class_init): same.
-
- * e-shell-view.c (class_init): same.
-
- * e-shell-offline-handler.c (class_init): same.
-
- * e-shell-folder-title-bar.c (class_init): same.
-
- * e-shell-folder-selection-dialog.c (class_init): same.
-
- * e-folder.c (class_init): same.
-
- * e-shell-marshal.list: add all the STRING marshallers.
-
-2002-11-20 Not Zed <NotZed@Ximian.com>
-
- * e-shell-importer.c (prepare_intelligent_page): gnome message box
- -> gtk message dialog.
- (prepare_intelligent_page): Fix the signature on this. This could
- NEVER have worked.
-
-2002-11-19 Ettore Perazzoli <ettore@ximian.com>
-
- * main.c (upgrade_from_1_0_if_needed): Disabled for now.
-
- * e-shell-startup-wizard.c: Removed member config_listener from
- struct SWData.
- (e_shell_startup_wizard_create): Updated accordingly, just use
- GConf, checking the /apps/evolution/mail/account-list key.
- (finish_func): Use GConf.
-
- * e-shell-config-default-folders.c: Removed member config_listener
- in struct EvolutionDefaultFolderConfig.
- (e_shell_config_default_folders_create_widget): Do not initialize
- here. GConfified the paths.
- (config_control_destroy_notify): No unref of the config_listener
- anymore.
- (config_control_apply_cb): Use GConf.
- (setup_folder_selector): Likewise.
-
- * e-shell-config-autocompletion.c: Removed member config_listener
- from EvolutionAutocompletionConfig.
- (config_control_destroy_notify): Do not unref.
- (config_control_apply_callback): Use a GConfClient.
-
- * e-folder-list.c (e_folder_list_init): Add missing cast.
-
- * main.c (show_development_warning): Use GConf.
-
- * e-setup.c (e_setup_check_config): Removed arg @listener.
- GConfified.
-
- * e-shell-view.c (e_shell_view_save_defaults): New.
- (e_shell_view_save_settings): Removed.
- (e_shell_view_load_settings): Removed.
- (setup_defaults): New helper function.
- (e_shell_view_construct): New arg @uri.
- (e_shell_view_new): New arg @uri.
-
- * e-shell.c: Removed member config_listener in struct
- EShellPrivate.
- (impl_dispose): Do not unref.
- (init): Do not initialize.
- (get_config_start_offline): New helper function.
- (e_shell_construct): Use this to get the startup mode in case
- E_SHELL_STARTUP_LINE_MODE_CONFIG.
- (save_misc_settings): Changed to use GConfClient instead of
- EConfigListener.
- (e_shell_create_view_from_settings): Removed.
- (e_shell_restore_from_settings): Removed.
- (e_shell_get_config_listener): Removed.
- (e_shell_disconnect_db): Removed.
- (parse_default_uri): Use GConf.
-
- * main.c (idle_cb): Simplified the logic here. Always assume that
- the view will be created with the default folder open by just
- using e_shell_create_view().
-
-2002-11-19 Not Zed <NotZed@Ximian.com>
-
- * e-shell-shared-folder-picker-dialog.c (show_dialog): Pass type
- to bonobo_widget::set_property.
-
-2002-11-18 Not Zed <NotZed@Ximian.com>
-
- * e-shell-view-menu.c (file_verbs[]): re-enable importer wizard.
-
- * importer/importer.c (dialog_response_cb): from clicked_cb.
- (start_import): gtkdialogise.
-
- * e-shell-importer.c: removed redundant header.
- (create_html): Removed utf8 from locale stuff.
- (get_name_from_component_info): oaf->bonobo activation.
- (get_iid_for_filetype): "
- (create_plugin_menu): Likewise, and change oafiid to bonoboiid
- (get_intelligent_importers): "
- (prepare_intelligent_page): "
- (show_import_wizard): add null domain to glade_xml_new.
- (choose_importer_from_list): gtkdialogise.
- (dialog_response_cb): changed from dialog_clicked_cb.
- (start_import): gtkdialogise.
- (show_error): use gtk message box.
- (error_response_cb): callback to close error box.
- (show_import_wizard): gnome_druid_page_start/finish ->
- gnome_druid_page_edge.
- (prepare_file_page):
- (filename_changed): set HELP button insensitive.
- (create_plugin_menu): casts for warnings and fix a typo,
- set_data->set_data_full.
- (import_druid_finish): folder_selection_dialog api change(?),
- allow create.
- (dialog_weak_notify): renamed from close_dialog().
- (show_import_wizard): remove gnome_dialog_close_hides -> its a
- gtkwindow anyway(!).
-
- * Makefile.am (evolution_LDADD): Added back importer.
- (evolution_SOURCES): Added back importer.
-
- * importer/intelligent.c (get_intelligent_importers):
- bonobo-activationised.
- (create_gui): gtkdialogise.
- (intelligent_importer_init): gtkdialogise.
- (create_gui): remove gnome_util_user_home().
- (intelligent_importer_init): "
-
- * importer/evolution-importer.c (finalise): from destroy.
- (evolution_importer_new): type_new->object_new.
-
- * importer/evolution-importer-listener.c (finalise): from destroy.
- (evolution_importer_listener_new): type_new->object_new.
-
- * importer/evolution-importer-client.c (destroy): removed, as it
- wasn't used anyway.
- (evolution_importer_client_new): g_object_new.
- (finalise): added, tho doesn't do anythign yet, should it unref
- the client->objref? This whole class doesn't seem much use.
-
- * importer/evolution-importer-client.h: removed
- bonobo-object-client, change to g_object.
-
- * importer/*.[ch]: ran fix script over everything.
-
- * importer/evolution-intelligent-importer.c: gobjectise.
- (finalise): renamed from destroy.
- (evolution_intelligent_importer_new): gtk_type_new -> g_object_new
-
-2002-11-18 Chris Toshok <toshok@ximian.com>
-
- * importer/import.glade: run libglade-convert.
-
-2002-11-16 Chris Toshok <toshok@ximian.com>
-
- * e-folder-list.c (e_folder_list_init): force the scrolled table
- to be shown, apparently a bug in libglade2.
-
- * e-shell-config-default-folders.c (setup_folder_selector): same,
- but with the evolution-folder-selector-button's.
-
-2002-11-16 Chris Toshok <toshok@ximian.com>
-
- * e-shell-settings-dialog.c (load_pages): init the corba exception
- before loading each config page, so previous errors don't make
- subsequence pages to fail to load.
-
-2002-11-15 Ettore Perazzoli <ettore@ximian.com>
-
- * Makefile.am: Added rule to generate
- GNOME_Evolution_Shell.server.in from
- GNOME_Evolution_Shell.server.in.in, substituting @BINDIR@.
-
- * GNOME_Evolution_Shell.server.in.in: Renamed from
- GNOME_Evolution_Shell.server.in. Prepend @BINDIR@ to the location
- of the executable.
-
-2002-11-15 Ettore Perazzoli <ettore@ximian.com>
-
- * evolution-storage.c (impl_finalize): Fix typo; p -> sp.
-
-2002-11-15 Ettore Perazzoli <ettore@ximian.com>
-
- * e-activity-handler.c (impl_operationStarted): No need to check
- for priv being NULL here anymore.
- (impl_operationProgressing): Likewise.
- (impl_operationFinished): Likewise.
- (impl_requestDialog): Likewise.
-
- * evolution-folder-selector-button.c (clicked): Use
- g_object_add_weak_pointer() on the parent_window instead of using
- GTK_OBJECT_DESTROYED().
-
-2002-11-15 Ettore Perazzoli <ettore@ximian.com>
-
- * e-shell-startup-wizard.c (e_shell_startup_wizard_create): For
- now, always return TRUE.
-
-2002-11-14 Ettore Perazzoli <ettore@ximian.com>
-
- * evolution-shell-client.c (class_init): Pass the right parent
- type to gtk_type_class().
-
-2002-11-14 Ettore Perazzoli <ettore@ximian.com>
-
- * e-shell-user-creatable-items-handler.c,
- * e-shell-user-creatable-items-handler.c: Changed into a GObject
- subclass instead of a GtkObject subclass.
-
- * e-component-registry.c,
- * e-component-registri.h: Changed into a GObject subclass instead
- of a GtkObject subclass.
-
- * evolution-shell-view.c (impl_ShellView_set_message): Remove
- bogus GTK_OBJECT() cast in call to g_signal_emit().
- (impl_ShellView_unset_message): Likewise.
- (impl_ShellView_change_current_view): Likewise.
- (impl_ShellView_set_title): Likewise.
-
- * e-shell-view.c (init): Ref/sink the GtkTooltips.
-
- * e-uri-schema-registry.c (schema_handler_free): g_object_unref()
- on the component instead of bonobo_object_unref().
-
-2002-11-14 Ettore Perazzoli <ettore@ximian.com>
-
- * main.c (no_views_left_cb): Use bonobo_main_quit() instead of
- gtk_main_quit().
- (shell_weak_notify): Likewise.
- (idle_cb): Likewise.
-
- * e-shell.c (notify_no_views_left_idle_cb): New idle function to
- emit the "no_views_left" signal.
- (view_weak_notify): Put it on the idle loop instead of firing the
- signal here.
-
- * e-task-widget.c (e_task_widget_construct): Ref/sink the
- GtkTooltips object.
-
-2002-11-14 Ettore Perazzoli <ettore@ximian.com>
-
- * e-shell.c (save_settings_for_views): Removed.
- (e_shell_save_settings): Do not call it here.
-
-2002-11-14 Ettore Perazzoli <ettore@ximian.com>
-
- * e-storage-set-view.c (impl_dispose): NULL priv->ui_component
- after unreffing it.
-
-2002-11-14 Ettore Perazzoli <ettore@ximian.com>
-
- * evolution-shell-component-client.c (destroy_listener_interface):
- Avoid freeing the servant for now, it looks like something is
- messed up and this causes a crash on exit.
-
- * evolution-storage-set-view-listener.c (impl_finalize): Do not
- invoke POA_GNOME_Evolution_StorageSetViewListener__fini().
-
- * evolution-storage-listener.c (impl_finalize): Do not invoke
- POA_GNOME_Evolution_StorageListener__fini().
-
- * e-shell-offline-sync.c (progress_listener_servant_free): Do not
- invoke POA_GNOME_Evolution_SyncFolderProgressListener__fini().
-
- * e-shell-offline-handler.c (progress_listener_servant_free): Do
- not invoke POA_GNOME_Evolution_OfflineProgressListener__fini().
-
- * e-corba-storage.c (impl_dispose): Do not invoke
- POA_GNOME_Evolution_StorageListener__fini().
-
- * evolution-shell-component-client.c (destroy_listener_interface):
- Do not invoke POA_GNOME_Evolution_ShellComponentListener__fini().
-
-2002-11-14 Ettore Perazzoli <ettore@ximian.com>
-
- * main.c (quit_box_destroyed_callback): Removed.
- (no_views_left_cb): Use g_object_add_weak_pointer() instad of
- connecting to the "destroy" signal.
- (destroy_cb): Removed.
- (shell_weak_notify): New.
- (idle_cb): Use g_object_weak_ref() on the shell object instead of
- connecting to the "destroy" signal.
-
- * evolution-test-component.c (dialog_destroy_callback): Removed.
- (dialog_weak_notify): New.
- (create_new_folder_selector): Use g_object_weak_ref() on the
- dialog instead of connecting the "destroy" signal.
-
- * e-shortcuts.c (view_destroyed_cb): Removed.
- (view_weak_notify): New.
- (e_shortcuts_new_view): g_object_weak_ref() the new view instead
- of connecting the "destroy" signal.
- (impl_dispose): Free the ->views and g_object_weak_unref() all the
- items.
-
- * e-shell.c (view_destroy_cb): Removed.
- (view_weak_notify): New.
- (create_view): Use g_object_weak_ref() on the newly created view
- instead of connecting to the "destroy" signal.
- (impl_dispose): g_object_weak_unref() the views.
- (e_shell_show_settings): Use g_object_add_weak_pointer() on the
- settings_dialog instead of connecting to the "destroy" signal.
- (settings_dialog_destroy_cb): Removed.
-
- * e-shell-shared-folder-picker-dialog.c
- (progress_bar_weak_notify): New.
- (progress_bar_destroy_callback): Removed.
- (create_progress_dialog): Use g_object_weak_ref() on the progress
- bar object instead of connecting to its "destroy" signal.
- (shell_destroy_callback): Removed.
- (shell_view_destroy_callback): Removed.
- (storage_destroy_callback): Removed.
- (shell_weak_notify): New.
- (shell_view_weak_notify): New.
- (storage_weak_notify): New.
- (discover_folder): Use g_object_weak_ref() on the shell, parent,
- storage objects instead of connecting to their "destroy" signals.
-
- * e-shell-importer.c: Removed member destroyed from
- ImporterComponentData.
- (import_cb): Instead of checking if ->destroyed is TRUE, check if
- ->dialog is NULL to decide whether the dialog has been destroyed
- or not.
- (dialog_destroy_cb): Removed.
- (start_import): Use g_object_weak_ref() on the dialog object
- instead of connecting to its "destroy" signal.
- (dialog_close): Removed.
- (dialog_weak_notify): New.
- (show_import_wizard): Use g_object_weak_ref() on the dialog object
- instead of connecting to its "destroy" signal.
- (import_druid_destroy): New.
- (import_druid_weak_notify): New.
- (show_import_wizard): Use g_object_weak_ref() on the druid object
- instead of connecting to its "destroy" signal.
-
- * e-shell-folder-selection-dialog.c
- (e_shell_folder_selection_dialog_construct): g_object_weak_ref()
- the shell object instead of connecting to its "destroy" signal.
-
- * e-shell-folder-creation-dialog.c (dialog_destroy_cb): Removed.
- (dialog_destroy_notify): New.
- (e_shell_show_folder_creation_dialog): g_object_weak_ref() the
- dialog instead of connecting to its "destroy" signal.
- (shell_destroy_cb): Removed.
- (shell_destroy_notify): New.
- (e_shell_show_folder_creation_dialog): g_object_weak_ref() the
- shell object instead of connecting to its "destroy" signal.
-
- * e-shell-config-offline.c (config_control_destroy_callback):
- Removed.
- (config_control_destroy_notify): New.
- (e_shell_config_offline_create_widget): g_object_weak_ref() the
- config_control instead of connecting to its "destroy" signal.
-
- * e-shell-config-default-folders.c
- (config_control_destroy_callback): Removed.
- (config_control_destroy_notify): New.
- (e_shell_config_default_folders_create_widget):
- g_object_weak_ref() instead of connecting to the "destroy" signal.
-
- * e-shell-config-autocompletion.c (config_control_destroy_notify):
- New.
- (config_control_destroy_callback): Removed.
- (e_shell_config_autocompletion_create_widget):
- g_object_weak_ref() instead of connecting to the "destroy" signal.
-
- * e-activity-handler.c (task_bar_destroy_cb): Removed.
- (task_bar_destroy_notify): New.
- (e_activity_handler_attach_task_bar): Weak_ref the task_bar using
- task_bar_destroy_notify.
- (impl_dispose): Weak_unref the task bars in priv->task_bars.
-
-2002-11-13 Ettore Perazzoli <ettore@ximian.com>
-
- * e-shell-startup-wizard.c: Change type of member etd in
- TimezoneDialogPage to GObject from GtkObject.
- (make_timezone_page): Cast to G_OBJECT() not GTK_OBJECT().
-
-2002-11-13 Ettore Perazzoli <ettore@ximian.com>
-
- * e-shell-startup-wizard.c (e_shell_startup_wizard_create):
- Connect finish_func to the "next" signal for now, since GnomeDruid
- seems to be borked.
-
- * e-uri-schema-registry.c (schema_handler_new): g_object_ref()
- @component instead of bonobo_object_ref().
-
- * e-local-storage.c (create_folder): g_object_ref() for the
- component_client, instead of bonobo_object_ref().
- (remove_folder_step): Likewise.
-
-2002-11-13 Not Zed <NotZed@Ximian.com>
-
- * evolution-storage.c: remove GTK_OBJECT cast and other GTK stuff.
-
- * evolution-storage.h: this is a gobject not a gtkobject, fix cast
- macros, and get_type call.
-
-2002-11-11 Chris Toshok <toshok@ximian.com>
-
- * e-task-widget.c (impl_finalize): need to assign priv here, fixes
- a crash.
-
-2002-11-11 Ettore Perazzoli <ettore@ximian.com>
-
- * e-shell.c (impl_dispose): Do unref the config_listener here [I
- fixed the finalize crash we were getting].
-
-2002-11-11 Ettore Perazzoli <ettore@ximian.com>
-
- * e-storage-set-view.c (impl_finalize): Protect against
- priv->checkboxes being NULL.
-
-2002-11-11 Ettore Perazzoli <ettore@ximian.com>
-
- * e-component-registry.c: Make separate dispose/finalize overrides
- of just overriding destroy.
- * e-corba-config-page.c: Likewise.
- * e-corba-storage.c: Likewise.
- * e-folder-type-registry.c: Likewise.
- * e-folder.c: Likewise.
- * e-history.c: Likewise.
- * e-local-folder.c: Likewise.
- * e-local-storage.c: Likewise.
- * e-shell-folder-selection-dialog.c: Likewise.
- * e-shell-folder-title-bar.c: Likewise.
- * e-shell-offline-handler.c: Likewise.
- * e-shell-settings-dialog.c: Likewise.
- * e-shell-user-creatable-items-handler.c: Likewise.
- * e-shell-view.c: Likewise.
- * e-shortcuts-view-model.c: Likewise.
- * e-shortcuts-view.c: Likewise.
- * e-shortcuts.c: Likewise.
- * e-storage-set-view.c: Likewise.
- * e-storage-set.c: Likewise.
- * e-storage.c: Likewise.
- * e-task-bar.c: Likewise.
- * e-task-widget.c: Likewise.
- * e-uri-schema-registry.c: Likewise.
- * evolution-activity-client.c: Likewise.
- * evolution-folder-selector-button.c: Likewise.
- * evolution-storage-listener.c: Likewise.
- * evolution-storage-set-view-listener.c: Likewise.
- * evolution-test-component.c: Likewise.
-
-2002-11-08 Rodrigo Moya <rodrigo@ximian.com>
-
- * importer/Makefile.am: use correctly IDL flags.
-
-2002-11-07 Chris Toshok <toshok@ximian.com>
-
- * e-task-widget.c (impl_destroy): guard against multiple calls.
- fixes a crash whenever a task finishes (the addressbook finishing
- loading, etc.).
-
- * e-shell-marshal.list: add NONE:BOOL for
- evolution-shell-component.
-
- * evolution-shell-component.c (class_init): register the signals
- with g_signal_new.
+2002-11-12 Frederic Crozat <fcrozat@mandrakesoft.com>
-2002-11-05 Ettore Perazzoli <ettore@ximian.com>
+ reviewed by: Ettore Perazzoli
- * e-shell.c (e_shell_show_settings): Allow type being NULL.
+ * e-shell-settings-dialog.c: (page_new): Ensure we get
+ an UTF-8 translated string.
-2002-11-05 Ettore Perazzoli <ettore@ximian.com>
+2002-11-06 Ettore Perazzoli <ettore@ximian.com>
- * e-local-storage.c (load_folder): Do add folders with an unknown
- type.
-
-2002-11-05 Ettore Perazzoli <ettore@ximian.com>
-
- * glade/e-shell-folder-creation-dialog.glade (ok_button): Set
- response_id to GTK_RESPONSE_OK.
- (cancel_button): Likewise, with GTK_RESPONSE_CANCEL.
-
- * e-shell-folder-creation-dialog.h,
- e-shell-folder-creation-dialog.c: Ported to GtkDialog.
-
-2002-11-05 Ettore Perazzoli <ettore@ximian.com>
-
- * e-folder-list.c: Use g_object_get_data() instead of
- gtk_object_get_data().
- * e-shell-config-default-folders.c: Likewise.
- * e-shell-folder-creation-dialog.c: Likewise.
- * e-shell-importer.c: Likewise.
- * e-shell-shared-folder-picker-dialog.c: Likewise.
- * e-shell-user-creatable-items-handler.c: Likewise.
- * e-shell-view.c: Likewise.
- * e-shell.c: Likewise.
- * e-storage.c: Likewise.
-
-2002-11-05 Ettore Perazzoli <ettore@ximian.com>
-
- * e-activity-handler.c: Split finalize/dispose.
- * e-corba-shortcuts.c: Likewise.
- * e-corba-storage-registry.c: Likewise.
- * e-shell-about-box.c: Likewise.
- * e-shell.c: Likewise.
- * e-splash.c: Likewise.
- * evolution-config-control.c: Likewise.
- * evolution-session.c: Likewise.
- * evolution-shell-component.c: Likewise.
- * evolution-shell-view.c: Likewise.
- * evolution-storage-set-view.c: Likewise.
- * evolution-storage.c: Likewise.
- * evolution-wizard.c: Likewise.
-
-2002-11-05 Ettore Perazzoli <ettore@ximian.com>
-
- * All: g_object_unref instead of bonobo_object_unref for the
- EvolutionShellComponentClient and EvolutionShellClient interfaces.
-
-2002-11-05 Ettore Perazzoli <ettore@ximian.com>
-
- * evolution-shell-client.c (impl_dispose): New.
- (impl_finalize): New.
- (destroy): Removed.
- (class_init): Install dispose, finalize handlers.
-
- * All: Use evolution_shell_client_corba_objref() or
- evolution_shell_component_client_corba_objref() instead of
- BONOBO_OBJREF() or bonobo_object_corba_objref() where needed.
-
- * e-folder-type-registry.c (set_handler): Use g_object_ref() for
- the handler, not bonobo_object_ref().
- (folder_type_free): Likewise for unref.
-
- * evolution-shell-component-client.c
- (evolution_shell_component_client_corba_objref): New.
- (impl_dispose): Moved from impl_destroy; only unref things.
- (impl_finalize) New.
- (class_init): Install dispose/finalize.
- (evolution_shell_component_client_get_dnd_source_interface): Use
- priv->corba_objref instead of bonobo_object_corba_objref() since
- we are not a BonoboObject anymore.
- (evolution_shell_component_client_get_dnd_destination_interface):
- Likewise.
- (evolution_shell_component_client_get_offline_interface): Likewise.
- (evolution_shell_component_client_set_owner): Likewise.
- (evolution_shell_component_client_unset_owner): Likewise.
- (evolution_shell_component_client_create_view): Likewise.
- (evolution_shell_component_client_handle_external_uri): Likewise.
- (evolution_shell_component_client_async_create_folder): Likewise.
- (evolution_shell_component_client_async_xfer_folder): Likewise.
- (evolution_shell_component_client_populate_folder_context_menu): Likewise.
- (evolution_shell_component_client_unpopulate_folder_context_menu): Likewise.
-
- * e-component-registry.c (register_component): Use
- evolution_shell_component_client_corba_objref().
- (e_component_registry_restart_component): Likewise.
- (component_free): Likewise.
-
- * evolution-shell-component-client.c: g_object_new() instead of gtk_type_new().
- * e-component-registry.c: Likewise.
- * e-corba-config-page.c
- * e-folder-list.c: Likewise.
- * e-folder-type-registry.c: Likewise.
- * e-folder.c: Likewise.
- * e-gray-bar.c: Likewise.
- * e-history.c: Likewise.
- * e-local-folder.c: Likewise.
- * e-local-folder.c: Likewise.
- * e-local-storage.c: Likewise.
- * e-shell-about-box.c: Likewise.
- * e-shell-config-default-folders.c: Likewise.
- * e-shell-folder-selection-dialog.c: Likewise.
- * e-shell-folder-title-bar.c: Likewise.
- * e-shell-offline-handler.c: Likewise.
- * e-shell-settings-dialog.c: Likewise.
- * e-shell-user-creatable-items-handler.c: Likewise.
- * e-shell-view.c: Likewise.
- * e-shortcuts-view-model.c: Likewise.
- * e-shortcuts-view.c: Likewise.
- * e-shortcuts.c: Likewise.
- * e-splash.c: Likewise.
- * e-storage-set-view.c: Likewise.
- * e-storage-set.c: Likewise.
- * e-storage.c: Likewise.
- * e-task-bar.c: Likewise.
- * e-task-widget.c: Likewise.
- * e-uri-schema-registry.c: Likewise.
- * evolution-activity-client.c: Likewise.
- * evolution-folder-selector-button.c: Likewise.
- * evolution-shell-client.c: Likewise.
- * evolution-shell-view.c: Likewise.
- * evolution-storage-listener.c: Likewise.
- * evolution-storage-set-view-listener.c: Likewise.
- * evolution-storage-set-view.c: Likewise.
- * evolution-wizard.c: Likewise.
-
- * GNOME_Evolution_TestComponent.server: Renamed from
- GNOME_Evolution_TestComponent.oaf.
-
- * evolution-test-component.c (spit_out_shortcuts): Use
- BONOBO_EX_REPOID().
- (create_new_folder_selector): Ported to use GtkDialog instead of
- GnomeDialog.
- (storage_cancel_discover_shared_folder_callback): Add missing
- G_OBJECT() cast.
- (shared_folder_discovery_timeout_callback): Likewise.
- (storage_discover_shared_folder_callback): Likewise.
- (timeout_callback_2): Likewise.
- (timeout_callback_1): Likewise.
- (shared_folder_discovery_timeout_callback): Use
- g_object_get_data() instead of gtk_object_get_data().
- (storage_cancel_discover_shared_folder_callback): Likewise.
- (timeout_callback_2): Likewise.
- (timeout_callback_2): g_timeout_add() instead of
- gtk_timeout_add().
- (create_view_fn): Likewise.
- (timeout_callback_1): Likewise.
- (timeout_callback_1): Pass NULL as the error arg to
- gdk_pixbuf_new_from_file().
- (register_component): Use bonobo-activation instead of OAF.
-
- * e-shell-about-box.c (impl_destroy): Removed.
- (impl_finalize): New.
- (class_init): Install finalize handler, not destroy.
-
- * e-shell-view-menu.c (command_about_box): Use a GtkWindow again.
- Set the GTK_WINDOW_TYPE_HINT_DIALOG hint.
-
- * e-shell-about-box.c (e_shell_about_box_construct): Removed.
-
-2002-11-04 Ettore Perazzoli <ettore@ximian.com>
-
- * e-shell-folder-commands.c (e_shell_command_copy_folder): Pass
- TRUE for arg allow_creation to
- e_shell_folder_selection_dialog_new().
- (e_shell_command_move_folder): Likewise.
- * e-shell-view-menu.c (command_goto_folder): Likewise.
- (command_new_shortcut): Likewise.
- * e-shell.c (impl_Shell_selectUserFolder): Likewise.
-
- * e-shell-folder-selection-dialog.c
- (e_shell_folder_selection_dialog_set_allow_creation): Removed.
- (e_shell_folder_selection_dialog_get_allow_creation): Removed.
- (e_shell_folder_selection_dialog_new): New arg allow_creation.
- (e_shell_folder_selection_dialog_construct): Likewise. Also, do
- set priv->shell.
-
- * e-shell-folder-selection-dialog.h,
- e-shell-folder-selection-dialog.c: Port to GtkDialog.
-
-2002-11-04 Ettore Perazzoli <ettore@ximian.com>
-
- * e-folder-type-registry.c
- (e_folder_type_registry_get_handler_for_type): Remove warning for
- when the type is unknown.
- (e_folder_type_registry_type_is_user_creatable): Likewise.
- (e_folder_type_registry_get_display_name_for_type): Likewise.
- (e_folder_type_registry_get_description_for_type): Likewise.
- (e_folder_type_registry_get_exported_dnd_types_for_type):
- Likewise.
- (e_folder_type_registry_get_accepted_dnd_types_for_type):
- Likewise.
- (e_folder_type_registry_unregister_type): Likewise.
- (e_folder_type_registry_get_icon_name_for_type): Likewise.
- (e_folder_type_registry_get_icon_for_type): Likewise.
- (set_handler): Removed warning here too.
-
-2002-11-04 Ettore Perazzoli <ettore@ximian.com>
-
- * e-folder-list.c: Replace gtk_signal_emit() with g_signal_emit().
- * e-folder.c: Likewise.
- * e-shell-folder-selection-dialog.c: Likewise.
- * e-shell-folder-title-bar.c: Likewise.
- * e-shell-offline-handler.c: Likewise.
- * e-shell-view.c: Likewise.
- * e-shortcuts-view.c: Likewise.
- * e-shortcuts.c: Likewise.
- * e-storage-set-view.c: Likewise.
- * e-storage-set.c: Likewise.
- * e-storage.c: Likewise.
- * evolution-activity-client.c: Likewise.
- * evolution-folder-selector-button.c: Likewise.
- * evolution-storage-listener.c: Likewise.
- * evolution-storage-set-view-listener.c: Likewise.
-
-2002-11-04 Ettore Perazzoli <ettore@ximian.com>
-
- * e-folder-list.c: Use g_object_set_data() instead of
- gtk_object_set_data().
- * e-shell-config-default-folders.c: Likewise.
- * e-shell-folder-creation-dialog.c: Likewise.
- * e-shell-importer.c: Likewise.
- * e-shell-shared-folder-picker-dialog.c: Likewise.
- * e-shell-user-creatable-items-handler.c: Likewise.
- * e-shell-view.c: Likewise.
- * e-shell.c: Likewise.
- * e-storage-set-view.c: Likewise.
- * e-storage.c: Likewise.
- * evolution-test-component.c: Likewise.
-
- * e-storage-set-view.c (e_storage_set_view_construct): Use
- g_object_weakref() instead of gtk_object_weakref() for the
- ui_container.
- (ui_container_destroy_notify): Add param where_the_object_was to
- match the GWeakNotify prototype.
-
- * e-shell.c: Use g_signal_emit() instead of gtk_signal_emit().
-
-2002-11-03 Ettore Perazzoli <ettore@ximian.com>
-
- * glade/e-active-connection-dialog.glade: Converted to Glade2
- format.
- * glade/evolution-startup-wizard.glade: Likewise.
- * glade/e-shell-shared-folder-picker-dialog.glade: Likewise.
- * glade/e-shell-folder-creation-dialog.glade: Likewise.
- * glade/e-shell-config-default-folders.glade: Likewise.
- * glade/e-folder-list.glade: Likewise.
-
-2002-11-03 Ettore Perazzoli <ettore@ximian.com>
-
- * *.c, *.h: Changed all gtk_object_refs()/gtk_object_unrefs() into
- g_object_refs()/g_object_unrefs() and all gtk_signal_connect_*()
- into g_signal_connect_*(). [Except for some case where we have
- gtk_signal_connect_full() or gtk_signal_connect_while_alive()
- calls that cannot be trivially ported to use the g_signal_*
- functions, we'll have to fix those later.]
-
- * e-splash.c (impl_finalize): Finalize implementation, copied over
- from impl_destroy.
- (impl_destroy): Removed.
- (class_init): Override finalize, not destroy.
-
- * e-activity-handler.c: Ported from GtkObject to GObject.
- * evolution-storage.c: Likewise.
- * e-corba-shortcuts.c: Likewise.
- * evolution-session.h: Likewise.
- * evolution-config-control.c: Likewise.
- * evolution-shell-component-dnd.c: Likewise.
- * evolution-shell-component.c: Likewise.
- * evolution-shell-view.c: Likewise.
- * evolution-storage-set-view.c: Likewise.
- * evolution-wizard.c: Likewise.
-
-2002-11-03 Ettore Perazzoli <ettore@ximian.com>
-
- * e-component-info.c: Updated for libxml2.
- * e-shortcuts.c: Likewise.
- * e-folder-list.c: Likewise.
- * e-local-folder.c: Likewise.
-
-2002-11-03 Ettore Perazzoli <ettore@ximian.com>
-
- * GNOME_Evolution_Shell.server.in: Renamed from
- GNOME_Evolution_Shell.oaf.in.
-
- * Makefile.am: Port from OAF to bonobo-activation.
- (INCLUDES): Define SYSCONFDIR, DATADIR, LIBDIR.
-
- * main.c (main): Use gnome_program_init().
-
- * e-corba-storage-registry.c (e_corba_storage_registry_new):
- g_object_new(), not gtk_type_new().
- (impl_finalize): New, ported over from destroy.
- (destroy): Removed.
- (class_init): Install finalize handler, not destroy handler, since
- we are not a GtkObject anymore.
-
- * e-corba-storage.c (e_corba_storage_new): g_object_new(), not
- gtk_type_new().
-
- * e-shell.c (class_init): Override finalize, not destroy.
- (impl_finalize): Finalize implementation, basically the old
- destroy renamed.
- (e_shell_new): g_object_new(), not gtk_type_new().
- (class_init): Use e_shell_marshal_NONE__INT for
- line_status_changed instead of using an ENUM.
- (e_shell_construct): Use g_signal_connect_object() instead of
- gtk_signal_connect_while_alive().
-
- * e-setup.c (e_setup): Do not unref local_folder if NULL.
-
- * e-folder.c (init): Make not floating.
- (e_folder_construct): No need to make it floating here anymore.
-
- * e-shell.c (impl_Shell_selectUserFolder): For now don't set
- dialog parent from xid.
-
- * main.c (no_views_left_cb): Add missing GTK_SIGNAL_FUNC() cast.
- (new_view_created_callback): Likewise.
- (warning_dialog_clicked_callback): Update to use the
- EConfigListener from the shell instead of bonobo-conf.
- (show_development_warning): Likewise.
- (upgrade_from_1_0_if_needed): BONOBO_EX_ID -> BONOBO_EX_REPOID.
- (idle_cb): Use bonobo-activation and BONOBO_EX_REPOID().
- (main): Cleaned up the various things that are unneeded in GNOME
- 2.
- (upgrade_from_1_0_if_needed): Use EConfigListener.
-
- * evolution-storage-set-view.h, evolution-storage-set-view.c:
- BonoboXObjectified.
-
- * e-storage.c (class_init): GLIB2-ified and made to use
- e-shell-marshal.h.
- (ES_CLASS): Use GTK_OBJECT_GET_CLASS().
- (e_storage_new_folder): Added missing GTK_SIGNAL_FUNC() prototype.
-
- * e-storage-set.c (class_init): GLIB2-ified and made to use
- e-shell-marshal.h.
-
- * e-storage-set-view.c (popup_folder_menu): For now, do not add
- the pop-up since we lack bonobo_ui_container_get_win() and I am
- not sure how to work around it.
- (popup_folder_menu): Pass self as the for_widget arg to
- gnome_popup_menu_do_popup_modal().
- (class_init): GLIB2-ified, and got to use e-shell-marshal.h.
- (marshal_NONE__GDKDRAGCONTEXT_STRING_STRING_STRING): Removed.
- (impl_tree_drag_data_get): Don't set the selection for now -- we
- have to fix the CORBA target stuff to match GTK 2.
- (e_storage_set_view_construct): Pass NULL as the opt_ev arg to
- bonobo_ui_component_set_container().
-
- * e-splash.c: #include <libgnomecanvas/gnome-canvas-pixbuf.h>
- instead of <gdk-pixbuf/gnome-canvas-pixbuf.h>.
- (e_splash_new): Pass NULL as the error arg to
- gdk_pixbuf_new_from_file().
-
- * e-shortcuts.c (class_init): GLIB2-ified. Also use the
- e-shell-marshal marshallers.
- (e_shortcuts_new_view): Add missing GTK_SIGNAL_FUNC() cast.
-
- * e-shortcuts-view.c: Use GTK_STOCK_* stuff instead of
- GNOME_STOCK_* stuff.
- (pop_up_right_click_menu_for_group): Pass self as the for_widget
- arg to gnome_popup_menu_do_popup_modal().
- (pop_up_right_click_menu_for_shortcut): Likewise.
- (class_init): GLIB2-ified.
-
- * e-shell.c: Do not #include <gal/util/e-unicode-i18n.h> or
- #include <libgnome/gnome-defs.h>.
- (set_interactive): Use BONOBO_EX_REPOID().
- (setup_local_storage): Use _() not U_().
- (destroy): Use gtk_widget_destroy() instead of
- gtk_object_destroy() on priv->settings_dialog.
- (class_init): GLIB2-ized.
- (init): Initialize config_listener member.
- (get_icon_path_for_component_info): Port to bonobo-activation from
- OAF.
- (setup_components): Likewise.
- (destroy): Likewise.
- (e_shell_construct): Use e_setup_check_config(), not
- e_setup_check_db (). Use the e_config_listener instead of
- bonobo-conf.
- (save_settings_for_views): Likewise.
- (save_misc_settings): Likewise.
- (e_shell_restore_from_settings): Likewise.
- (parse_default_uri): Likewise.
- (e_shell_component_maybe_crashed): Pass NULL for opt_ev arg to
- bonobo_unkown_ping()
- (e_shell_component_maybe_crashed): Use
- bonobo_engine_deregister_dead_components() instead of
- bonobo_window_deregister_component_by_ref() which is no more.
- (e_shell_send_receive): BONOBO_EX_REPOID() instead of
- BONOBO_EX_ID().
- (e_shell_get_config_listener): Return the config_listener.
-
- * e-shell-view.c (find_inbox_in_storage): Use _() instead of U_().
- (load_images): Pass NULL as the error arg to
- gdk_pixbuf_new_from_file().
- (load_images): Likewise.
- (find_inbox_in_storage): Work around the lack of
- g_utf8_strcasecmp() in glib-2.0.
- (class_init): GLIB2-ified. Also, use the marshallers in
- e-shell-marshal.h.
- (pop_up_folder_bar): Use gtk_window_move()/gtk_widget_show()
- instead gtk_widget_popup().
- (unmerge_on_error): Work around the death of
- bonobo_ui_component_get_win() and
- bonobo_window_deregister_component_by_ref().
- (e_shell_view_construct): Pass NULL as the uic arg to
- bonobo_window_construct(). Add missing GTK_SIGNAL_FUNC() cast.
- Match the new BonoboWindow behavior wrt the UIContainer and the
- new opt_ev args.
- (display_uri): Use bonobo_ui_engine_freeze() and
- bonobo_ui_engine_thaw() since bonobo_window_freeze() and
- bonobo_window_thaw() got axed [sigh].
- (e_shell_view_save_settings): Use EConfigListener.
- (e_shell_view_load_settings): Likewise.
- (get_view_for_uri): Use bonobo_widget_new_control_from_objref()
- instead of e_bonobo_widget_new_control_from_objref().
-
- * e-shell-view-menu.c (command_help_faq): Pass NULL for the error
- arg to gnome_url_show().
- (command_about_box): Use GtkDialog instead of a GtkWindow of a
- type GTK_WINDOW_DIALOG [which does not exist anymore].
- (command_xml_dump): Removed.
- (menu_do_misc): Do not add the corresponding verb.
-
- * e-shell-user-creatable-items-handler.c (execute_verb): Use
- BONOBO_EX_REPOID().
-
- * e-shell-startup-wizard.c: Remove id member from SWData. Replace
- member db with config_listener.
- (e_shell_startup_wizard_create): Initialize config_listener.
- (make_mail_dialog_pages): Do not set the listener id here.
- (druid_event_notify_cb): Pass FALSE as the help_sensitive arg to
- gnome_druid_set_buttons_sensitive().
- (e_shell_startup_wizard_create): Likewise.
- (make_mail_dialog_pages): Use bonobo-activation instead of OAF.
- (get_intelligent_importers): Likewise.
- (prepare_importer_page): Likewise.
- (start_importers): Do nothing here for now.
- (finish_func): Constify local variable displayname.
- (finish_func): Updated to use the config_listener instead of the
- bono-conf db.
- (prepare_importer_page): Do not actually run the importer yet.
- (e_shell_startup_wizard_create): Pass NULL as the domain arg to
- glade_xml_new(). Use the config_listener.
-
- * e-shell-shared-folder-picker-dialog.c (user_clicked):
- BONOBO_EX_REPOID() instead of BONOBO_EX_ID().
- (setup_name_selector): Likewise.
- (setup_name_selector): Use bonobo-activation.
- (show_dialog): Pass NULL as the domain arg to glade_xml_new().
- (setup_name_selector): Add a missing GTK_SIGNAL_FUNC() cast.
-
- * e-shell-settings-dialog.c: #include
- <bonobo-activation/bonobo-activation.h>. Use
- Bonobo_ActivationProperty instead of OAF_Property.
- (set_dialog_size): Use gtk_style_get_font() to get the font from
- the widget->style.
- (load_pages): Converted to use bonobo-activation instead of OAF.
- Pass NULL as the error arg to gdk_pixbuf_new_from_file().
-
- * e-shell-offline-sync.c (sync_folder): BONOBO_EX_REPOID(), not
- BONOBO_EX_ID().
- (e_shell_offline_sync_all_folders): For now, avoid doing anything
- [see changes to e-shell-config-offline.c below].
- (setup_progress_listener): #if 0 for now.
- (setup_dialog): Likewise.
- (sync_folder): Likewise.
- (cleanup): Likewise.
- (progress_listener_servant_free): Likewise.
- (progress_listener_servant_new): Likewise.
- (impl_SyncFolderProgressListener_updateProgress): Likewise.
- (impl_SyncFolderProgressListener_reportSuccess): Likewise.
- (impl_SyncFolderProgressListener_reportFailure): Likewise.
- (progress_dialog_close_callback): Likewise.
- (progress_dialog_clicked_callback): Likewise.
-
- * e-shell-offline-handler.c (prepare_for_offline): Use
- BONOBO_EX_REPOID().
- (pop_up_confirmation_dialog): Pass NULL as the domain arg to
- glade_xml_new().
- (class_init): GLIB2-ified.
-
- * Makefile.am: Do not compile e-shell-importer.c,
- e-shell-importer.h for now.
-
- * e-shell-folder-title-bar.c (get_max_clipped_label_width): Use
- gtk_style_get_font() to retrieve the font.
- (class_init): GLIB2-ified.
- (e_shell_folder_title_bar_construct): Get {x,y}thickness from
- widget->style, not from widget->style->klass.
-
- * e-shell-folder-selection-dialog.c: #include <string.h>,
- <gtk/gtklabel.h> and <gtk/gtksignal.h>.
- (class_init): GLIB2-ified.
-
- * e-shell-folder-creation-dialog.c: No <libgnome/gnome-defs.h>,
- add some GTK includes.
- (e_shell_show_folder_creation_dialog): Pass NULL as the domain arg
- to glade_xml_new(). Added missing GTK_SIGNAL_FUNC() cast.
-
- * e-shell-folder-commands.c: Do not #include
- <libgnomeui/gnome-stock.h> and #include
- <bonobo-conf/Bonobo_Config.h>.
-
- * e-shell-config-default-folders.c: Replace member db in
- EvolutionDefaultFolderConfig with config_listener.
- (e_shell_config_default_folders_create_widget): Init here.
- (config_control_destroy_cb): Unref here.
- (config_control_apply_cb): Use EConfigListener instead of
- BonoboConf.
- (setup_folder_selector): Likewise.
- (e_shell_config_default_folders_create_widget): Pass NULL as the
- domain arg to glade_xml_new().
-
- * e-shell-config-offline.c (config_control_apply_callback): For
- now, do not change the configuration. [Needs to be ported to
- EConfigListener or something, but we were storing a sequence using
- typecodes here and there is no trivial way to do that right now.]
- (init_storage_set_view_status_from_config): Likewise, do not
- retrieve the configuration here.
-
- * e-shell-marshal.list: Removed duplicates, added a bunch new
- marshallers.
-
-2002-11-02 Ettore Perazzoli <ettore@ximian.com>
-
- * e-shell-config-autocompletion.c: No bonobo-conf; removed member
- db in struct EvolutionAutocompletionConfig and replaced with a
- config_listener arg.
- (e_shell_config_autocompletion_create_widget): Init it here.
- (config_control_destroy_callback): Unref it here.
- (config_control_apply_callback): Updated to use the
- config_listener.
-
- * e-shell-config.c (e_shell_config_factory_register): Use
- bonobo_generic_factory_new() instead of
- bonobo_generic_factory_new_multi().
-
- * e-shell-about-box.c (impl_realize): Pass NULL as the error arg
- to gdk_pixbuf_new_from_file().
- (timeout_callback): Use gtk_style_get_font() to retrieve the
- style's font instead of style->font.
- (impl_draw): Removed.
- (impl_expose_event): Do the drawing of the pixmap here.
-
- * e-setup.c (e_setup_check_db): Removed.
- (e_setup_check_config): New, version using EConfigListener instead
- of bonobo-conf.
-
- * e-setup.h: #include "e-util/e-config-listener.h" instead of
- <bonobo-conf/bonobo-config-database.h>.
-
- * e-local-storage.c (construct): Use _() instead of U_().
- (setup_stock_folders): Likewise.
-
- * e-icon-factory.c (load_icon): Pass NULL as the error arg to
- gdk_pixbuf_new_from_file().
-
- * e-folder-type-registry.c (folder_type_new): Pass NULL as the
- error arg to gdk_pixbuf_new_from_file().
-
- * e-folder-dnd-bridge.c (find_matching_target_for_drag_context):
- GdkAtom is not an integer anymore; update accordingly.
-
- * e-corba-storage.c (async_folder_cb): Constified args
- appropriately to match BonoboListenerCallbackFn.
- (async_folder_discovery_cb): Likewise.
- (cancel_discover_shared_folder): BONOBO_EX_ID() ->
- BONOBO_EX_REPOID().
- (e_corba_storage_show_folder_properties): Likewise.
-
- * e-corba-storage-registry.h, e-corba-storage-registry.c:
- BonoboXObjectified.
-
- * e-corba-config-page.c: Removed member listener_id in struct
- ECorbaConfigPagePrivate.
- (init): Don't init.
- (setup_listener): Bonobo_EventSource_addListener doesn't return an
- ID anymore.
- (impl_destroy): Just pass the listener to
- Bonobo_EventSource_removeListener.
- (setup_listener): BONOBO_EX_REPOID() instead of BONOBO_EX_ID().
- (impl_apply): Likewise.
- (listener_event_callback): Constified args appropriately to match
- BonoboListenerCallbackFn.
- (e_corba_config_page_construct): Likewise.
-
- * e-component-registry.c (wait_for_corba_object_to_die): Pass NULL
- for the exception arg to bonobo_unknown_ping().
-
- * e-shell-view.h: <bonobo/bonobo-window.h>, not
- <bonobo/bonobo-win.h>.
-
- * e-shell.c: Replace member db in EShellPrivate with an
- EConfigListener config_listener.
- (destroy): Do not call e_shell_disconnect_db(). Unref
- EConfigListener. Destroy settings_dialog if not NULL. Pass
- config_listener to e_setup_check_db().
- (e_shell_get_config_db): Removed.
- (e_shell_get_config_listener): New.
- (e_shell_construct): Set up the config_listener, instead of the
- Bonobo_ConfigDatabase.
-
- * e-shell.h: #include <bonobo-activation/bonobo-activation.h>
- instead of <liboaf/oaf.h>. No
- <bonobo-conf/bonobo-config-database.h>.
-
- * e-component-registry.c: #include
- <bonobo-activation/bonobo-activation.h> instead of <liboaf/oaf.h>.
-
- * e-activity-handler.c (task_widget_button_press_event_callback):
- Use BONOBO_EX() and BONOBO_EX_REPOID().
- (impl_operationStarted): Don't use GTK_OBJECT_DESTROYED() [needs
- to be fixed later].
- (impl_operationProgressing): Likewise.
- (impl_operationFinished): Likewise.
- (impl_requestDialog): Likewise.
-
- * evolution-wizard.c (evolution_wizard_class_init): GLIB2-ified.
-
- * evolution-wizard.h: Remove BEGIN_GNOME_DECLS/END_GNOME_DECLS.
-
- * evolution-storage.c: Chagned to use generated marshallers
- instead of custom ones or GAL's.
-
- * eshell-marshal.list: New.
- * Makefile.am: Added rule to build eshell-marshal.[ch] and link
- them in.
-
- * evolution-storage.h, evolution-storage.c: BonoboXObjectified.
-
- * evolution-storage-set-view-listener.c (class_init): GLIB2-ified.
-
- * evolution-storage-listener.c (class_init): GLIB2-ified.
-
- * evolution-shell-view.h, evolution-shell-view.c:
- BonoboXObjectified.
-
- * evolution-shell-component-utils.c: #include
- <bonobo-activation/bonobo-activation.h>.
- (e_pixmaps_update): Pass NULL as the error arg to
- gdk_pixbuf_new_from_file().
- (e_activation_failure_dialog): Bonobo_GeneralError instead of
- OAF_GeneralError.
- (e_get_activation_failure_msg): Likewise.
-
- * evolution-shell-component-dnd.h, evolution-shell-component-dnd.c:
- BonoboXObjectified.
-
- * evolution-shell-component.c: #include <unistd.h>.
- (owner_ping_callback): Pass NULL for the opt_ev arg to
- bonobo_unknown_ping().
- (impl_populateFolderContextMenu): Pass NULL for the opt_ev arg to
- bonobo_ui_component_set_container().
- (class_init): GLIB2-ified.
-
- * e-component-registry.c (component_free): Use g_object_unref() on
- the EvolutionShellComponentClient instead of
- bonobo_object_unref().
- (register_component): Likewise.
- (component_new): Likewise, use g_object_ref() instead of
- bonobo_object_ref().
-
- * evolution-shell-component-client.c: New member corba_objref in
- EvolutionShellComponentClientPrivate.
- (init): Init to CORBA_OBJECT_NIL.
- (impl_destroy): Unref. Also CORBA_OBJECT_NILify all the pointers
- to unreffed objects.
- (corba_exception_to_result): Use BONOBO_EX_REPOID(ev) instead of
- ev->_repo_id.
- (evolution_shell_component_client_construct): Set the corba_objref
- pointer, do not call bonobo_object_client_construct().
- (evolution_shell_component_client_new): Use
- bonobo_activation_activate_from_id() here instead of
- oaf_activate_from_id().
-
- * evolution-shell-component-client.h,
- evolution-shell-component-client.c: Derive from GObject instead of
- BonoboObjectClient.
-
- * evolution-shell-client.c
- (evolution_shell_client_create_storage_set_view): Use
- BONOBO_EX_REPOID() instead of BONOBO_EX_ID().
-
- * evolution-folder-selector-button.c (destroy): g_object_unref the
- EvolutionShellClient instead of bonobo_object_unref().
- (evolution_folder_selector_button_construct): Likewise.
-
- * e-folder-list.c (e_folder_list_destroy): g_object_unref the
- EvolutionShellClient instead of bonobo_object_unref().
- (e_folder_list_construct): g_object_ref the EvolutionShellClient
- instead of bonobo_object_ref().
-
- * evolution-shell-client.c: New member corba_objref in
- EvolutionShellClientPrivate.
- (init): Init to CORBA_OBJECT_NIL.
- (destroy): Unref/release.
- (query_shell_interface): Use BONOBO_EX() and BONOBO_EX_REPOID()
- instead of ._major and ._repo_id.
- (destroy): Likewise.
- (evolution_shell_client_get_local_storage): Likewise.
-
- * evolution-shell-client.h: Derive from GObject instead of
- BonoboObjectClient.
-
- * evolution-session.c (corba_class_init): Get klass arg.
- (class_init): Pass klass arg. GLIB2-ified.
- (evolution_session_construct): Removed.
- (evolution_session_new): Just return what gtk_type_new() returns.
-
- * evolution-session.h, evolution-session.c: Derive from
- BonoboXObject.
-
- * evolution-folder-selector-button.c (init): Make icon a GtkImage
- instead of a BonoboUIToolbarIcon.
- (set_folder, class_init): GLIB2-ified.
-
- * evolution-config-control.c (class_init): GLIB2-ified.
-
- * evolution-activity-client.c (corba_update_progress): Use
- BONOBO_EX_REPOID() instead of ._major and ._repo_id.
- (evolution_activity_client_request_dialog): Likewise.
- (impl_destroy): Likewise.
- (class_init): GLIB2-ified.
-
- * e-folder-list.c: #include <gtk/gtframe.h> and #include
- <string.h>.
- (e_folder_list_destroy): bonobo_object_unref(), not
- bonobo_object_client_unref().
- (e_folder_list_init): Pass NULL as the domain to glade_xml_new().
-
- * e-folder-list.h: #include <gtk/gtkvbox.h>.
-
- * e-folder.c (impl_remove): Renamed from remove().
- (impl_get_physical_uri): Renamed from get_physical_uri().
- (impl_load_info): Renamed from load_info().
- (impl_save_info): Renamed from save_info().
- (class_init): GLIB2-ified.
-
- * Evolution-Session.idl: #include <Bonobo.idl>, not <Bonobo.h>.
- * Evolution-Offline.idl: Likewise.
- * Evolution-ShellComponent.idl: Likewise.
- * Evolution-ShellComponentDnd.idl: Likewise.
- * Evolution-Storage.idl: Likewise.
-
- * Makefile.am: Do not compile the importer directory for now.
-
- * evolution-wizard.c (evolution_wizard_set_buttons_sensitive):
- ORBit2-ize type names.
- (evolution_wizard_set_show_finish): Likewise.
- (evolution_wizard_set_page): Likewise.
+ * main.c (show_development_warning): Removed.
+ (warning_dialog_clicked_callback): Removed.
+ (view_map_callback): Removed.
+ (new_view_created_callback): Removed.
+ (idle_cb): Don't connect.
2002-10-28 Ettore Perazzoli <ettore@ximian.com>
diff --git a/shell/Makefile.am b/shell/Makefile.am
index f2891e6fbb..7c5900ce09 100644
--- a/shell/Makefile.am
+++ b/shell/Makefile.am
@@ -1,6 +1,6 @@
SUBDIRS = glade importer
-INCLUDES = \
+INCLUDES = -O \
-I$(top_srcdir)/widgets \
-I$(top_srcdir)/widgets/misc \
-I$(top_srcdir)/libical/src/libical \
@@ -12,9 +12,6 @@ INCLUDES = \
-DEVOLUTION_GLADEDIR=\"$(datadir)/evolution/glade\" \
-DEVOLUTION_ETSPECDIR=\""$(etspecdir)"\" \
-DPREFIX=\"$(prefix)\" \
- -DSYSCONFDIR=\""$(sysconfdir)"\" \
- -DDATADIR=\""$(datadir)"\" \
- -DLIBDIR=\""$(datadir)"\" \
-DG_LOG_DOMAIN=\"evolution-shell\" \
$(SHELL_CFLAGS)
@@ -45,7 +42,8 @@ IDL_GENERATED = \
Evolution-impl.o: Evolution.h
$(IDL_GENERATED): $(IDLS)
- $(ORBIT_IDL) -I $(srcdir) $(IDL_INCLUDES) $(srcdir)/Evolution.idl
+ $(ORBIT_IDL) -I $(srcdir) -I $(datadir)/idl `$(GNOME_CONFIG) --cflags idl` \
+ $(srcdir)/Evolution.idl
# SelectNames CORBA stuff
@@ -59,7 +57,21 @@ SELECT_NAMES_IDL_GENERATED = \
Evolution-Addressbook-SelectNames-stubs.c
$(SELECT_NAMES_IDL_GENERATED): $(SELECT_NAMES_IDL)
- $(ORBIT_IDL) -I $(srcdir) $(IDL_INCLUDES) $(SELECT_NAMES_IDL)
+ $(ORBIT_IDL) -I $(srcdir) -I $(datadir)/idl `$(GNOME_CONFIG) --cflags idl` \
+ $(SELECT_NAMES_IDL)
+
+# Wombat CORBA stuff
+
+WOMBAT_IDL = $(top_srcdir)/wombat/Evolution-Wombat.idl
+
+WOMBAT_IDL_GENERATED = \
+ Evolution-Wombat.h \
+ Evolution-Wombat-common.c \
+ Evolution-Wombat-skels.c \
+ Evolution-Wombat-stubs.c
+
+$(WOMBAT_IDL_GENERATED): $(WOMBAT_IDL)
+ $(ORBIT_IDL) -I $(srcdir) -I $(datadir)/idl `$(GNOME_CONFIG) --cflags idl` $(WOMBAT_IDL)
# IDL install
@@ -115,7 +127,6 @@ libeshell_la_SOURCES = \
evolution-storage-set-view-listener.c \
evolution-storage.c \
evolution-wizard.c \
- e-shell-marshal.c \
$(eshellinclude_HEADERS)
# Evolution executable
@@ -124,6 +135,7 @@ bin_PROGRAMS = evolution
evolution_SOURCES = \
$(SELECT_NAMES_IDL_GENERATED) \
+ $(WOMBAT_IDL_GENERATED) \
e-activity-handler.c \
e-activity-handler.h \
e-component-info.c \
@@ -247,64 +259,33 @@ evolution_test_component_LDADD = \
install-test-component: evolution-test-component
$(mkinstalldirs) $(DESTDIR)$(bindir)
$(LIBTOOL) --mode=install $(INSTALL_PROGRAM) evolution-test-component $(DESTDIR)$(bindir)/evolution-test-component
- $(mkinstalldirs) $(DESTDIR)$(serverdir)
- $(INSTALL_DATA) $(srcdir)/GNOME_Evolution_TestComponent.server $(DESTDIR)$(serverdir)/GNOME_Evolution_TestComponent.server
+ $(mkinstalldirs) $(DESTDIR)$(oafdir)
+ $(INSTALL_DATA) $(srcdir)/GNOME_Evolution_TestComponent.oaf $(DESTDIR)$(oafdir)/GNOME_Evolution_TestComponent.oaf
# Misc stuff
-serverdir = $(libdir)/bonobo/servers
-server_in_files = GNOME_Evolution_Shell.server.in.in
-server_DATA = $(server_in_files:.server.in.in=.server)
-$(server_in_files:.server.in.in=.server.in): $(server_in_files)
- sed -e "s|\@BINDIR\@|$(bindir)|" $< > $@
+oafdir = $(datadir)/oaf
+oaf_in_files = GNOME_Evolution_Shell.oaf.in
+oaf_DATA = $(oaf_in_files:.oaf.in=.oaf)
etspecdir = $(datadir)/evolution/etspec/
etspec_DATA = \
e-storage-set-view.etspec
-@INTLTOOL_SERVER_RULE@
+@XML_I18N_MERGE_OAF_RULE@
icons = \
check-empty.xpm \
check-filled.xpm \
check-missing.xpm
-# GConf schemas
-
-schemadir = $(GCONF_SCHEMA_FILE_DIR)
-schema_DATA = apps_evolution_shell.schemas
-
-install-data-local:
- if test -z "$(DESTDIR)" ; then \
- for p in $(schema_DATA) ; do \
- GCONF_CONFIG_SOURCE=$(GCONF_SCHEMA_CONFIG_SOURCE) $(GCONFTOOL) --makefile-install-rule $(srcdir)/$$p; \
- done \
- fi
-
-
-# GLib marshalling cruft
-
-e-shell-marshal.h: e-shell-marshal.list
- ( @GLIB_GENMARSHAL@ --prefix=e_shell_marshal e-shell-marshal.list --header > e-shell-marshal.tmp \
- && mv e-shell-marshal.tmp e-shell-marshal.h ) \
- || ( rm -f e-shell-marshal.tmp && exit 1 )
-
-e-shell-marshal.c: e-shell-marshal.h
- ( @GLIB_GENMARSHAL@ --prefix=e_shell_marshal e-shell-marshal.list --body > e-shell-marshal.tmp \
- && mv e-shell-marshal.tmp e-shell-marshal.c ) \
- || ( rm -f e-shell-marshal.tmp && exit 1 )
-
-MARSHAL_GENERATED = e-shell-marshal.c e-shell-marshal.h
-
-# Extra dist stuff
-
EXTRA_DIST = \
$(IDLS) \
- $(server_in_files) \
- $(server_DATA) \
+ $(oaf_in_files) \
+ $(oaf_DATA) \
$(etspec_DATA) \
$(icons) \
- GNOME_Evolution_TestComponent.server \
+ GNOME_Evolution_TestComponent.oaf \
evolution-nognome.in
# Purify support
@@ -322,7 +303,7 @@ evolution.pure: evolution
endif
CLEANFILES = $(IDL_GENERATED) $(SELECT_NAMES_IDL_GENERATED)
-BUILT_SOURCES = $(IDL_GENERATED) $(SELECT_NAMES_IDL_GENERATED) $(MARSHAL_GENERATED)
+BUILT_SOURCES = $(IDL_GENERATED) $(SELECT_NAMES_IDL_GENERATED)
dist-hook:
cd $(distdir); rm -f $(BUILT_SOURCES)
@@ -332,4 +313,4 @@ if HAVE_DTAPPINTEGRATE
bin_SCRIPTS = evolution-nognome
-endif
+endif \ No newline at end of file
diff --git a/shell/e-component-info.c b/shell/e-component-info.c
index a89647c8a1..512c61f37f 100644
--- a/shell/e-component-info.c
+++ b/shell/e-component-info.c
@@ -28,8 +28,8 @@
#include "e-util/e-lang-utils.h"
-#include <libxml/parser.h>
-#include <libxml/xmlmemory.h>
+#include <gnome-xml/parser.h>
+#include <gnome-xml/xmlmemory.h>
#include <string.h>
#include <stdlib.h>
@@ -54,7 +54,7 @@ lookup_node (xmlNode *parent_node,
{
xmlNode *p;
- for (p = parent_node->children; p != NULL; p = p->next) {
+ for (p = parent_node->childs; p != NULL; p = p->next) {
if (strcmp ((const char *) p->name, node_name) == 0)
return p;
}
@@ -82,7 +82,7 @@ lookup_node_for_language (xmlNode *parent_node,
{
xmlNode *p;
- for (p = parent_node->children; p != NULL; p = p->next) {
+ for (p = parent_node->childs; p != NULL; p = p->next) {
xmlChar *node_language_id;
if (strcmp ((const char *) p->name, node_name) != 0)
@@ -219,7 +219,7 @@ e_component_info_load (const char *file_name)
new->uri_schemas = NULL;
new->user_creatable_item_types = NULL;
- for (p = root->children; p != NULL; p = p->next) {
+ for (p = root->childs; p != NULL; p = p->next) {
if (strcmp ((char *) p->name, "folder_type") == 0)
add_folder_type (new, p, language_list);
else if (strcmp ((char *) p->name, "user_creatable_item_type") == 0)
diff --git a/shell/e-corba-storage-registry.c b/shell/e-corba-storage-registry.c
index 0bb87bb9c8..a0dafc239c 100644
--- a/shell/e-corba-storage-registry.c
+++ b/shell/e-corba-storage-registry.c
@@ -34,11 +34,9 @@
#include <bonobo/bonobo-exception.h>
#include <gal/util/e-util.h>
-#include <string.h>
-
-#define PARENT_TYPE BONOBO_X_OBJECT_TYPE
-static BonoboXObjectClass *parent_class = NULL;
+#define PARENT_TYPE BONOBO_OBJECT_TYPE
+static BonoboObjectClass *parent_class = NULL;
struct _ECorbaStorageRegistryPrivate {
EStorageSet *storage_set;
@@ -49,6 +47,31 @@ struct _ECorbaStorageRegistryPrivate {
/* CORBA interface implementation. */
+static POA_GNOME_Evolution_StorageRegistry__vepv storage_registry_vepv;
+
+static POA_GNOME_Evolution_StorageRegistry *
+create_servant (void)
+{
+ POA_GNOME_Evolution_StorageRegistry *servant;
+ CORBA_Environment ev;
+
+ servant = (POA_GNOME_Evolution_StorageRegistry *) g_new0 (BonoboObjectServant, 1);
+ servant->vepv = &storage_registry_vepv;
+
+ CORBA_exception_init (&ev);
+
+ POA_GNOME_Evolution_StorageRegistry__init ((PortableServer_Servant) servant, &ev);
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ g_free (servant);
+ CORBA_exception_free (&ev);
+ return NULL;
+ }
+
+ CORBA_exception_free (&ev);
+
+ return servant;
+}
+
static void
listener_notify (Bonobo_Listener listener,
GNOME_Evolution_StorageRegistry_MessageType type,
@@ -73,6 +96,8 @@ listener_notify (Bonobo_Listener listener,
CORBA_exception_id (&ev));
}
+ CORBA_free (nr.name);
+
CORBA_exception_free (&ev);
}
@@ -103,7 +128,7 @@ impl_StorageRegistry_addStorage (PortableServer_Servant servant,
return CORBA_OBJECT_NIL;
}
- g_object_unref (storage);
+ gtk_object_unref (GTK_OBJECT (storage));
/* FIXME: if we remove a listener while looping through the list we can
@@ -239,7 +264,7 @@ storage_set_foreach (EStorageSet *set,
name = e_storage_get_name (E_STORAGE (p->data));
listener_notify (listener, GNOME_Evolution_StorageRegistry_STORAGE_CREATED, name);
- g_object_unref (p->data);
+ gtk_object_unref (GTK_OBJECT (p->data));
}
g_list_free (storage_list);
@@ -387,27 +412,10 @@ impl_StorageRegistry_getFolderByUri (PortableServer_Servant servant,
}
-/* GObject methods. */
+/* GtkObject methods. */
static void
-impl_dispose (GObject *object)
-{
- ECorbaStorageRegistry *corba_storage_registry;
- ECorbaStorageRegistryPrivate *priv;
-
- corba_storage_registry = E_CORBA_STORAGE_REGISTRY (object);
- priv = corba_storage_registry->priv;
-
- if (priv->storage_set != NULL) {
- g_object_unref (priv->storage_set);
- priv->storage_set = NULL;
- }
-
- (* G_OBJECT_CLASS (parent_class)->dispose) (object);
-}
-
-static void
-impl_finalize (GObject *object)
+destroy (GtkObject *object)
{
ECorbaStorageRegistry *corba_storage_registry;
ECorbaStorageRegistryPrivate *priv;
@@ -415,25 +423,29 @@ impl_finalize (GObject *object)
corba_storage_registry = E_CORBA_STORAGE_REGISTRY (object);
priv = corba_storage_registry->priv;
+ if (priv->storage_set != NULL)
+ gtk_object_unref (GTK_OBJECT (priv->storage_set));
g_free (priv);
- (* G_OBJECT_CLASS (parent_class)->finalize) (object);
+ (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}
/* Initialization. */
static void
-class_init (ECorbaStorageRegistryClass *klass)
+corba_class_init (void)
{
- GObjectClass *object_class;
+ POA_GNOME_Evolution_StorageRegistry__vepv *vepv;
POA_GNOME_Evolution_StorageRegistry__epv *epv;
+ PortableServer_ServantBase__epv *base_epv;
- object_class = G_OBJECT_CLASS (klass);
- object_class->dispose = impl_dispose;
- object_class->finalize = impl_finalize;
+ base_epv = g_new0 (PortableServer_ServantBase__epv, 1);
+ base_epv->_private = NULL;
+ base_epv->finalize = NULL;
+ base_epv->default_POA = NULL;
- epv = & klass->epv;
+ epv = g_new0 (POA_GNOME_Evolution_StorageRegistry__epv, 1);
epv->addStorage = impl_StorageRegistry_addStorage;
epv->getStorageList = impl_StorageRegistry_getStorageList;
epv->getStorageByName = impl_StorageRegistry_getStorageByName;
@@ -442,7 +454,23 @@ class_init (ECorbaStorageRegistryClass *klass)
epv->removeListener = impl_StorageRegistry_removeListener;
epv->getFolderByUri = impl_StorageRegistry_getFolderByUri;
- parent_class = g_type_class_ref(PARENT_TYPE);
+ vepv = &storage_registry_vepv;
+ vepv->_base_epv = base_epv;
+ vepv->Bonobo_Unknown_epv = bonobo_object_get_epv ();
+ vepv->GNOME_Evolution_StorageRegistry_epv = epv;
+}
+
+static void
+class_init (ECorbaStorageRegistryClass *klass)
+{
+ GtkObjectClass *object_class;
+
+ object_class = GTK_OBJECT_CLASS (klass);
+ object_class->destroy = destroy;
+
+ parent_class = gtk_type_class (PARENT_TYPE);
+
+ corba_class_init ();
}
static void
@@ -460,15 +488,20 @@ init (ECorbaStorageRegistry *corba_storage_registry)
void
e_corba_storage_registry_construct (ECorbaStorageRegistry *corba_storage_registry,
+ GNOME_Evolution_StorageRegistry corba_object,
EStorageSet *storage_set)
{
ECorbaStorageRegistryPrivate *priv;
+ g_return_if_fail (corba_storage_registry != NULL);
g_return_if_fail (E_IS_CORBA_STORAGE_REGISTRY (corba_storage_registry));
+ g_return_if_fail (corba_object != CORBA_OBJECT_NIL);
+
+ bonobo_object_construct (BONOBO_OBJECT (corba_storage_registry), corba_object);
priv = corba_storage_registry->priv;
- g_object_ref (storage_set);
+ gtk_object_ref (GTK_OBJECT (storage_set));
priv->storage_set = storage_set;
}
@@ -476,19 +509,25 @@ ECorbaStorageRegistry *
e_corba_storage_registry_new (EStorageSet *storage_set)
{
ECorbaStorageRegistry *corba_storage_registry;
+ POA_GNOME_Evolution_StorageRegistry *servant;
+ GNOME_Evolution_StorageRegistry corba_object;
g_return_val_if_fail (storage_set != NULL, NULL);
g_return_val_if_fail (E_IS_STORAGE_SET (storage_set), NULL);
- corba_storage_registry = g_object_new (e_corba_storage_registry_get_type (), NULL);
+ servant = create_servant ();
+ if (servant == NULL)
+ return NULL;
+
+ corba_storage_registry = gtk_type_new (e_corba_storage_registry_get_type ());
+
+ corba_object = bonobo_object_activate_servant (BONOBO_OBJECT (corba_storage_registry),
+ servant);
- e_corba_storage_registry_construct (corba_storage_registry, storage_set);
+ e_corba_storage_registry_construct (corba_storage_registry, corba_object, storage_set);
return corba_storage_registry;
}
-E_MAKE_X_TYPE (e_corba_storage_registry, "ECorbaStorageRegistry", ECorbaStorageRegistry,
- class_init, init, PARENT_TYPE,
- POA_GNOME_Evolution_StorageRegistry__init,
- GTK_STRUCT_OFFSET (ECorbaStorageRegistryClass, epv))
+E_MAKE_TYPE (e_corba_storage_registry, "ECorbaStorageRegistry", ECorbaStorageRegistry, class_init, init, PARENT_TYPE)
diff --git a/shell/e-shell-config-default-folders.c b/shell/e-shell-config-default-folders.c
index 1966df05a9..4c1d7d070c 100644
--- a/shell/e-shell-config-default-folders.c
+++ b/shell/e-shell-config-default-folders.c
@@ -35,8 +35,6 @@
#include <libgnome/gnome-i18n.h>
-#include <gconf/gconf-client.h>
-
typedef struct {
GladeXML *glade;
@@ -47,6 +45,7 @@ typedef struct {
char *calendar_uri, *calendar_path;
char *tasks_uri, *tasks_path;
+ Bonobo_ConfigDatabase db;
EvolutionShellClient *shell_client;
} EvolutionDefaultFolderConfig;
@@ -57,8 +56,8 @@ folder_selected (EvolutionFolderSelectorButton *button,
{
char **uri_ptr, **path_ptr;
- uri_ptr = g_object_get_data (G_OBJECT (button), "uri_ptr");
- path_ptr = g_object_get_data (G_OBJECT (button), "path_ptr");
+ uri_ptr = gtk_object_get_data (GTK_OBJECT (button), "uri_ptr");
+ path_ptr = gtk_object_get_data (GTK_OBJECT (button), "path_ptr");
g_free (*uri_ptr);
g_free (*path_ptr);
@@ -76,36 +75,27 @@ e_shell_config_default_folder_selector_button_new (char *widget_name,
char *string2,
int int1, int int2)
{
- return (GtkWidget *) g_object_new (EVOLUTION_TYPE_FOLDER_SELECTOR_BUTTON, NULL);
+ return (GtkWidget *)gtk_type_new (EVOLUTION_TYPE_FOLDER_SELECTOR_BUTTON);
}
static void
config_control_apply_cb (EvolutionConfigControl *control,
EvolutionDefaultFolderConfig *dfc)
{
- GConfClient *client;
-
- client = gconf_client_get_default ();
-
- gconf_client_set_string (client, "/apps/evolution/shell/default_folders/mail_path", dfc->mail_path, NULL);
- gconf_client_set_string (client, "/apps/evolution/shell/default_folders/mail_uri", dfc->mail_uri, NULL);
- gconf_client_set_string (client, "/apps/evolution/shell/default_folders/contacts_path", dfc->contacts_path, NULL);
- gconf_client_set_string (client, "/apps/evolution/shell/default_folders/contacts_uri", dfc->contacts_uri, NULL);
- gconf_client_set_string (client, "/apps/evolution/shell/default_folders/calendar_path", dfc->calendar_path, NULL);
- gconf_client_set_string (client, "/apps/evolution/shell/default_folders/calendar_uri", dfc->calendar_uri, NULL);
- gconf_client_set_string (client, "/apps/evolution/shell/default_folders/tasks_path", dfc->tasks_path, NULL);
- gconf_client_set_string (client, "/apps/evolution/shell/default_folders/tasks_uri", dfc->tasks_uri, NULL);
-
-
- g_object_unref (client);
+ bonobo_config_set_string (dfc->db, "/DefaultFolders/mail_path", dfc->mail_path, NULL);
+ bonobo_config_set_string (dfc->db, "/DefaultFolders/mail_uri", dfc->mail_uri, NULL);
+ bonobo_config_set_string (dfc->db, "/DefaultFolders/contacts_path", dfc->contacts_path, NULL);
+ bonobo_config_set_string (dfc->db, "/DefaultFolders/contacts_uri", dfc->contacts_uri, NULL);
+ bonobo_config_set_string (dfc->db, "/DefaultFolders/calendar_path", dfc->calendar_path, NULL);
+ bonobo_config_set_string (dfc->db, "/DefaultFolders/calendar_uri", dfc->calendar_uri, NULL);
+ bonobo_config_set_string (dfc->db, "/DefaultFolders/tasks_path", dfc->tasks_path, NULL);
+ bonobo_config_set_string (dfc->db, "/DefaultFolders/tasks_uri", dfc->tasks_uri, NULL);
}
static void
-config_control_destroy_notify (void *data,
- GObject *where_the_config_control_was)
+config_control_destroy_cb (EvolutionConfigControl *config_control,
+ EvolutionDefaultFolderConfig *dfc)
{
- EvolutionDefaultFolderConfig *dfc = (EvolutionDefaultFolderConfig *) data;
-
g_free (dfc->mail_uri);
g_free (dfc->mail_path);
g_free (dfc->contacts_uri);
@@ -115,14 +105,13 @@ config_control_destroy_notify (void *data,
g_free (dfc->tasks_uri);
g_free (dfc->tasks_path);
- g_object_unref (dfc->glade);
- g_object_unref (dfc->shell_client);
-
+ gtk_object_unref (GTK_OBJECT (dfc->glade));
+ bonobo_object_unref (BONOBO_OBJECT (dfc->shell_client));
g_free (dfc);
}
static const char *mail_types[] = { "mail", NULL };
-static const char *contacts_types[] = { "contacts", "ldap-contacts", NULL };
+static const char *contacts_types[] = { "contacts", "contacts/ldap", NULL };
static const char *calendar_types[] = { "calendar", NULL };
static const char *tasks_types[] = { "tasks", NULL };
@@ -133,30 +122,21 @@ setup_folder_selector (EvolutionDefaultFolderConfig *dfc,
char **uri_ptr, char *uri_dbpath,
const char **types)
{
- GConfClient *client;
GtkWidget *button;
- client = gconf_client_get_default ();
-
- *path_ptr = gconf_client_get_string (client, path_dbpath, NULL);
- *uri_ptr = gconf_client_get_string (client, uri_dbpath, NULL);
-
- g_object_unref (client);
+ *path_ptr = bonobo_config_get_string (dfc->db, path_dbpath, NULL);
+ *uri_ptr = bonobo_config_get_string (dfc->db, uri_dbpath, NULL);
button = glade_xml_get_widget (dfc->glade, widget_name);
evolution_folder_selector_button_construct (
EVOLUTION_FOLDER_SELECTOR_BUTTON (button),
dfc->shell_client, _("Select Default Folder"),
*uri_ptr, types);
- g_object_set_data (G_OBJECT (button), "uri_ptr", uri_ptr);
- g_object_set_data (G_OBJECT (button), "path_ptr", path_ptr);
- g_signal_connect (button, "selected",
- G_CALLBACK (folder_selected),
- dfc);
-
- /* XXX libglade2 seems to not show custom widgets even when
- they're flagged Visible.*/
- gtk_widget_show (button);
+ gtk_object_set_data (GTK_OBJECT (button), "uri_ptr", uri_ptr);
+ gtk_object_set_data (GTK_OBJECT (button), "path_ptr", path_ptr);
+ gtk_signal_connect (GTK_OBJECT (button), "selected",
+ GTK_SIGNAL_FUNC (folder_selected),
+ dfc);
}
GtkWidget*
@@ -168,29 +148,30 @@ e_shell_config_default_folders_create_widget (EShell *shell, EvolutionConfigCont
GtkWidget *widget;
dfc = g_new0 (EvolutionDefaultFolderConfig, 1);
+ dfc->db = e_shell_get_config_db (shell);
CORBA_exception_init (&ev);
- shell_dup = CORBA_Object_duplicate (BONOBO_OBJREF (shell), &ev);
+ shell_dup = CORBA_Object_duplicate (bonobo_object_corba_objref (BONOBO_OBJECT (shell)), &ev);
CORBA_exception_free (&ev);
dfc->shell_client = evolution_shell_client_new (shell_dup);
- dfc->glade = glade_xml_new (EVOLUTION_GLADEDIR "/e-shell-config-default-folders.glade", NULL, NULL);
+ dfc->glade = glade_xml_new (EVOLUTION_GLADEDIR "/e-shell-config-default-folders.glade", NULL);
setup_folder_selector (dfc, "default_mail_button",
- &dfc->mail_path, "/apps/evolution/shell/default_folders/mail_path",
- &dfc->mail_uri, "/apps/evolution/shell/default_folders/mail_uri",
+ &dfc->mail_path, "/DefaultFolders/mail_path",
+ &dfc->mail_uri, "/DefaultFolders/mail_uri",
mail_types);
setup_folder_selector (dfc, "default_contacts_button",
- &dfc->contacts_path, "/apps/evolution/shell/default_folders/contacts_path",
- &dfc->contacts_uri, "/apps/evolution/shell/default_folders/contacts_uri",
+ &dfc->contacts_path, "/DefaultFolders/contacts_path",
+ &dfc->contacts_uri, "/DefaultFolders/contacts_uri",
contacts_types);
setup_folder_selector (dfc, "default_calendar_button",
- &dfc->calendar_path, "/apps/evolution/shell/default_folders/calendar_path",
- &dfc->calendar_uri, "/apps/evolution/shell/default_folders/calendar_uri",
+ &dfc->calendar_path, "/DefaultFolders/calendar_path",
+ &dfc->calendar_uri, "/DefaultFolders/calendar_uri",
calendar_types);
setup_folder_selector (dfc, "default_tasks_button",
- &dfc->tasks_path, "/apps/evolution/shell/default_folders/tasks_path",
- &dfc->tasks_uri, "/apps/evolution/shell/default_folders/tasks_uri",
+ &dfc->tasks_path, "/DefaultFolders/tasks_path",
+ &dfc->tasks_uri, "/DefaultFolders/tasks_uri",
tasks_types);
widget = glade_xml_get_widget (dfc->glade, "default_folders_table");
@@ -199,10 +180,10 @@ e_shell_config_default_folders_create_widget (EShell *shell, EvolutionConfigCont
gtk_widget_show (widget);
dfc->config_control = config_control;
- g_signal_connect (dfc->config_control, "apply",
- G_CALLBACK (config_control_apply_cb), dfc);
-
- g_object_weak_ref (G_OBJECT (dfc->config_control), config_control_destroy_notify, dfc);
+ gtk_signal_connect (GTK_OBJECT (dfc->config_control), "apply",
+ GTK_SIGNAL_FUNC (config_control_apply_cb), dfc);
+ gtk_signal_connect (GTK_OBJECT (dfc->config_control), "destroy",
+ GTK_SIGNAL_FUNC (config_control_destroy_cb), dfc);
return widget;
}
diff --git a/shell/e-shell-folder-title-bar.c b/shell/e-shell-folder-title-bar.c
index 3f20c8b189..ee1fb91dc6 100644
--- a/shell/e-shell-folder-title-bar.c
+++ b/shell/e-shell-folder-title-bar.c
@@ -29,6 +29,7 @@
#include <gtk/gtkrc.h>
#include <gtk/gtksignal.h>
#include <gtk/gtktogglebutton.h>
+#include <libgnome/gnome-defs.h>
#include <libgnome/gnome-i18n.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
@@ -37,7 +38,6 @@
#include "widgets/misc/e-clipped-label.h"
#include "e-shell-constants.h"
-#include "e-shell-marshal.h"
#include "e-shell-folder-title-bar.h"
@@ -138,6 +138,8 @@ create_pixmap_widget_from_xpm (const char **xpm)
widget = gtk_pixmap_new (pixmap, mask);
gtk_widget_show (widget);
+ gdk_pixbuf_unref (pixbuf);
+
return widget;
}
@@ -168,7 +170,7 @@ new_empty_pixmap_widget (void)
gdk_pixbuf_render_pixmap_and_mask (empty_pixbuf, &pixmap, &mask, 127);
pixmap_widget = gtk_pixmap_new (pixmap, mask);
- g_object_unref (empty_pixbuf);
+ gdk_pixbuf_unref (empty_pixbuf);
return pixmap_widget;
}
@@ -199,7 +201,7 @@ get_max_clipped_label_width (EClippedLabel *clipped_label)
GdkFont *font;
int width;
- font = gtk_style_get_font (GTK_WIDGET (clipped_label)->style);
+ font = GTK_WIDGET (clipped_label)->style->font;
width = gdk_string_width (font, clipped_label->label);
width += 2 * GTK_MISC (clipped_label)->xpad;
@@ -316,7 +318,7 @@ back_button_clicked_callback (GtkButton *button,
folder_title_bar = E_SHELL_FOLDER_TITLE_BAR (data);
- g_signal_emit (folder_title_bar, signals[BACK_CLICKED], 0);
+ gtk_signal_emit (GTK_OBJECT (folder_title_bar), signals[BACK_CLICKED]);
}
static void
@@ -327,7 +329,7 @@ forward_button_clicked_callback (GtkButton *button,
folder_title_bar = E_SHELL_FOLDER_TITLE_BAR (data);
- g_signal_emit (folder_title_bar, signals[FORWARD_CLICKED], 0);
+ gtk_signal_emit (GTK_OBJECT (folder_title_bar), signals[FORWARD_CLICKED]);
}
static void
@@ -346,8 +348,8 @@ add_navigation_buttons (EShellFolderTitleBar *folder_title_bar)
back_pixmap = create_pixmap_widget_from_xpm (left_arrow_xpm);
gtk_container_add (GTK_CONTAINER (priv->back_button), back_pixmap);
- g_signal_connect (priv->back_button, "clicked",
- G_CALLBACK (back_button_clicked_callback), folder_title_bar);
+ gtk_signal_connect (GTK_OBJECT (priv->back_button), "clicked",
+ GTK_SIGNAL_FUNC (back_button_clicked_callback), folder_title_bar);
priv->forward_button = gtk_button_new ();
gtk_button_set_relief (GTK_BUTTON (priv->forward_button), GTK_RELIEF_NONE);
@@ -356,8 +358,8 @@ add_navigation_buttons (EShellFolderTitleBar *folder_title_bar)
forward_pixmap = create_pixmap_widget_from_xpm (right_arrow_xpm);
gtk_container_add (GTK_CONTAINER (priv->forward_button), forward_pixmap);
- g_signal_connect (priv->forward_button, "clicked",
- G_CALLBACK (forward_button_clicked_callback), folder_title_bar);
+ gtk_signal_connect (GTK_OBJECT (priv->forward_button), "clicked",
+ GTK_SIGNAL_FUNC (forward_button_clicked_callback), folder_title_bar);
gtk_box_pack_start (GTK_BOX (folder_title_bar), priv->back_button, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (folder_title_bar), priv->forward_button, FALSE, FALSE, 0);
@@ -376,32 +378,16 @@ title_button_toggled_cb (GtkToggleButton *title_button,
EShellFolderTitleBar *folder_title_bar;
folder_title_bar = E_SHELL_FOLDER_TITLE_BAR (data);
- g_signal_emit (folder_title_bar, signals[TITLE_TOGGLED], 0,
- gtk_toggle_button_get_active (title_button));
+ gtk_signal_emit (GTK_OBJECT (folder_title_bar),
+ signals[TITLE_TOGGLED],
+ gtk_toggle_button_get_active (title_button));
}
-/* GObject methods. */
-
-static void
-impl_dispose (GObject *object)
-{
- EShellFolderTitleBar *folder_title_bar;
- EShellFolderTitleBarPrivate *priv;
-
- folder_title_bar = E_SHELL_FOLDER_TITLE_BAR (object);
- priv = folder_title_bar->priv;
-
- if (priv->icon != NULL) {
- g_object_unref (priv->icon);
- priv->icon = NULL;
- }
-
- (* G_OBJECT_CLASS (parent_class)->dispose) (object);
-}
+/* GtkObject methods. */
static void
-impl_finalize (GObject *object)
+impl_destroy (GtkObject *object)
{
EShellFolderTitleBar *folder_title_bar;
EShellFolderTitleBarPrivate *priv;
@@ -409,9 +395,11 @@ impl_finalize (GObject *object)
folder_title_bar = E_SHELL_FOLDER_TITLE_BAR (object);
priv = folder_title_bar->priv;
+ if (priv->icon != NULL)
+ gdk_pixbuf_unref (priv->icon);
g_free (priv);
- (* G_OBJECT_CLASS (parent_class)->finalize) (object);
+ (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}
@@ -459,39 +447,40 @@ impl_size_allocate (GtkWidget *widget,
static void
class_init (EShellFolderTitleBarClass *klass)
{
- GObjectClass *object_class;
+ GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
- object_class = G_OBJECT_CLASS (klass);
- object_class->dispose = impl_dispose;
- object_class->finalize = impl_finalize;
+ object_class = GTK_OBJECT_CLASS (klass);
+ object_class->destroy = impl_destroy;
widget_class = GTK_WIDGET_CLASS (klass);
widget_class->size_allocate = impl_size_allocate;
- parent_class = g_type_class_ref(PARENT_TYPE);
+ parent_class = gtk_type_class (PARENT_TYPE);
signals[TITLE_TOGGLED] = gtk_signal_new ("title_toggled",
GTK_RUN_FIRST,
- GTK_CLASS_TYPE (object_class),
- G_STRUCT_OFFSET (EShellFolderTitleBarClass, title_toggled),
- e_shell_marshal_NONE__BOOL,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EShellFolderTitleBarClass, title_toggled),
+ gtk_marshal_NONE__BOOL,
GTK_TYPE_NONE, 1,
GTK_TYPE_BOOL);
signals[BACK_CLICKED] = gtk_signal_new ("back_clicked",
GTK_RUN_FIRST,
- GTK_CLASS_TYPE (object_class),
- G_STRUCT_OFFSET (EShellFolderTitleBarClass, back_clicked),
- e_shell_marshal_NONE__NONE,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EShellFolderTitleBarClass, back_clicked),
+ gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
signals[FORWARD_CLICKED] = gtk_signal_new ("forward_clicked",
GTK_RUN_FIRST,
- GTK_CLASS_TYPE (object_class),
- G_STRUCT_OFFSET (EShellFolderTitleBarClass, forward_clicked),
- e_shell_marshal_NONE__NONE,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EShellFolderTitleBarClass, forward_clicked),
+ gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
+
+ gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
}
static void
@@ -591,11 +580,11 @@ e_shell_folder_title_bar_construct (EShellFolderTitleBar *folder_title_bar)
as the padding is hardcoded in GtkButton too (see CHILD_SPACING in
gtkbutton.c). */
gtk_misc_set_padding (GTK_MISC (priv->title_label),
- GTK_WIDGET (priv->title_button)->style->xthickness,
- GTK_WIDGET (priv->title_button)->style->ythickness + 2);
+ GTK_WIDGET (priv->title_button)->style->klass->xthickness,
+ GTK_WIDGET (priv->title_button)->style->klass->ythickness + 2);
- g_signal_connect (priv->title_button, "toggled",
- G_CALLBACK (title_button_toggled_cb), folder_title_bar);
+ gtk_signal_connect (GTK_OBJECT (priv->title_button), "toggled",
+ GTK_SIGNAL_FUNC (title_button_toggled_cb), folder_title_bar);
add_navigation_buttons (folder_title_bar);
@@ -617,7 +606,7 @@ e_shell_folder_title_bar_new (void)
gtk_widget_push_colormap (gdk_rgb_get_cmap ());
gtk_widget_push_visual (gdk_rgb_get_visual ());
- new = g_object_new (e_shell_folder_title_bar_get_type (), NULL);
+ new = gtk_type_new (e_shell_folder_title_bar_get_type ());
e_shell_folder_title_bar_construct (new);
gtk_widget_pop_visual ();
@@ -708,12 +697,12 @@ e_shell_folder_title_bar_set_icon (EShellFolderTitleBar *folder_title_bar,
if (icon == NULL) {
if (priv->icon != NULL)
- g_object_unref (priv->icon);
+ gdk_pixbuf_unref (priv->icon);
priv->icon = new_empty_pixbuf ();
} else {
- g_object_ref (icon);
+ gdk_pixbuf_ref (icon);
if (priv->icon != NULL)
- g_object_unref (priv->icon);
+ gdk_pixbuf_unref (priv->icon);
priv->icon = icon;
}
diff --git a/shell/e-shell-settings-dialog.c b/shell/e-shell-settings-dialog.c
index 53ed1388f9..f853386fdd 100644
--- a/shell/e-shell-settings-dialog.c
+++ b/shell/e-shell-settings-dialog.c
@@ -32,11 +32,11 @@
#include "e-util/e-lang-utils.h"
#include <gal/util/e-util.h>
+#include <gal/util/e-unicode-i18n.h>
#include <bonobo/bonobo-widget.h>
#include <bonobo/bonobo-exception.h>
-
-#include <bonobo-activation/bonobo-activation.h>
+#include <liboaf/liboaf.h>
#include <string.h>
@@ -60,11 +60,11 @@ set_dialog_size (EShellSettingsDialog *dialog)
GdkFont *font;
int width, height;
- font = gtk_style_get_font (GTK_WIDGET (dialog)->style);
+ font = GTK_WIDGET (dialog)->style->font;
width = gdk_string_width (font, "M") * 72;
height = (font->ascent + font->descent) * 35;
- gtk_widget_set_size_request (GTK_WIDGET (dialog), width, height);
+ gtk_widget_set_usize (GTK_WIDGET (dialog), width, height);
}
@@ -74,7 +74,7 @@ struct _Page {
char *title;
char *description;
GdkPixbuf *icon;
- Bonobo_ActivationProperty *type;
+ OAF_Property *type;
int priority;
EConfigPage *page_widget;
};
@@ -84,14 +84,14 @@ static Page *
page_new (const char *title,
const char *description,
GdkPixbuf *icon,
- Bonobo_ActivationProperty *type,
+ OAF_Property *type,
int priority,
EConfigPage *page_widget)
{
Page *page;
if (icon != NULL)
- g_object_ref (icon);
+ gdk_pixbuf_ref (icon);
page = g_new (Page, 1);
page->title = g_strdup (title);
@@ -111,7 +111,7 @@ page_free (Page *page)
g_free (page->description);
if (page->icon != NULL)
- g_object_unref (page->icon);
+ gdk_pixbuf_unref (page->icon);
g_free (page);
}
@@ -142,7 +142,7 @@ static void
load_pages (EShellSettingsDialog *dialog)
{
EShellSettingsDialogPrivate *priv;
- Bonobo_ServerInfoList *control_list;
+ OAF_ServerInfoList *control_list;
CORBA_Environment ev;
GSList *language_list;
GList *page_list;
@@ -153,61 +153,57 @@ load_pages (EShellSettingsDialog *dialog)
CORBA_exception_init (&ev);
- control_list = bonobo_activation_query ("defined(evolution:config_item:title)", NULL, &ev);
+ control_list = oaf_query ("defined(evolution:config_item:title)", NULL, &ev);
if (ev._major != CORBA_NO_EXCEPTION || control_list == NULL) {
- g_warning ("Cannot load configuration pages -- %s", BONOBO_EX_REPOID (&ev));
+ g_warning ("Cannot load configuration pages -- %s", ev._repo_id);
CORBA_exception_free (&ev);
return;
}
- CORBA_exception_free (&ev);
-
language_list = e_get_language_list ();
page_list = NULL;
for (i = 0; i < control_list->_length; i ++) {
CORBA_Object corba_object;
- Bonobo_ServerInfo *info;
+ OAF_ServerInfo *info;
const char *title;
const char *description;
const char *icon_path;
const char *priority_string;
- Bonobo_ActivationProperty *type;
+ OAF_Property *type;
int priority;
GdkPixbuf *icon;
- CORBA_exception_init (&ev);
-
info = & control_list->_buffer[i];
- title = bonobo_server_info_prop_lookup (info, "evolution:config_item:title", language_list);
- description = bonobo_server_info_prop_lookup (info, "evolution:config_item:description", language_list);
- icon_path = bonobo_server_info_prop_lookup (info, "evolution:config_item:icon_name", NULL);
- type = bonobo_server_info_prop_find (info, "evolution:config_item:type");
- priority_string = bonobo_server_info_prop_lookup (info, "evolution:config_item:priority", NULL);
+ title = oaf_server_info_prop_lookup (info, "evolution:config_item:title", language_list);
+ description = oaf_server_info_prop_lookup (info, "evolution:config_item:description", language_list);
+ icon_path = oaf_server_info_prop_lookup (info, "evolution:config_item:icon_name", NULL);
+ type = oaf_server_info_prop_find (info, "evolution:config_item:type");
+ priority_string = oaf_server_info_prop_lookup (info, "evolution:config_item:priority", NULL);
if (icon_path == NULL) {
icon = NULL;
} else {
if (g_path_is_absolute (icon_path)) {
- icon = gdk_pixbuf_new_from_file (icon_path, NULL);
+ icon = gdk_pixbuf_new_from_file (icon_path);
} else {
char *real_icon_path;
real_icon_path = g_concat_dir_and_file (EVOLUTION_IMAGES, icon_path);
- icon = gdk_pixbuf_new_from_file (real_icon_path, NULL);
+ icon = gdk_pixbuf_new_from_file (real_icon_path);
g_free (real_icon_path);
}
}
- if (type != NULL && type->v._d != Bonobo_ACTIVATION_P_STRINGV)
+ if (type != NULL && type->v._d != OAF_P_STRINGV)
type = NULL;
if (priority_string == NULL)
priority = 0xffff;
else
priority = atoi (priority_string);
- corba_object = bonobo_activation_activate_from_id ((char *) info->iid, 0, NULL, &ev);
+ corba_object = oaf_activate_from_id ((char *) info->iid, 0, NULL, &ev);
if (! BONOBO_EX (&ev)) {
Page *page;
@@ -217,15 +213,11 @@ load_pages (EShellSettingsDialog *dialog)
page_list = g_list_prepend (page_list, page);
} else {
- char *bonobo_ex_text = bonobo_exception_get_text (&ev);
- g_warning ("Cannot activate %s -- %s", info->iid, bonobo_ex_text);
- g_free (bonobo_ex_text);
+ g_warning ("Cannot activate %s -- %s", info->iid, BONOBO_EX_ID (&ev));
}
if (icon != NULL)
- g_object_unref (icon);
-
- CORBA_exception_free (&ev);
+ gdk_pixbuf_unref (icon);
}
page_list = sort_page_list (page_list);
@@ -241,7 +233,7 @@ load_pages (EShellSettingsDialog *dialog)
page->page_widget);
if (page->type != NULL) {
- Bonobo_StringList list = page->type->v._u.value_stringv;
+ GNOME_stringlist list = page->type->v._u.value_stringv;
for (j = 0; j < list._length; j++) {
if (g_hash_table_lookup (priv->types, list._buffer[j]) == NULL)
@@ -257,6 +249,8 @@ load_pages (EShellSettingsDialog *dialog)
g_list_free (page_list);
e_free_language_list (language_list);
CORBA_free (control_list);
+
+ CORBA_exception_free (&ev);
}
@@ -286,7 +280,7 @@ destroy_type_entry (gpointer key, gpointer value, gpointer data)
}
static void
-impl_finalize (GObject *object)
+impl_destroy (GtkObject *object)
{
EShellSettingsDialog *dialog;
EShellSettingsDialogPrivate *priv;
@@ -299,23 +293,23 @@ impl_finalize (GObject *object)
g_free (priv);
- (* G_OBJECT_CLASS (parent_class)->finalize) (object);
+ (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}
static void
class_init (EShellSettingsDialog *class)
{
- GObjectClass *object_class;
+ GtkObjectClass *object_class;
GtkWidgetClass *widget_class;
- object_class = G_OBJECT_CLASS (class);
- object_class->finalize = impl_finalize;
+ object_class = GTK_OBJECT_CLASS (class);
+ object_class->destroy = impl_destroy;
widget_class = GTK_WIDGET_CLASS (class);
widget_class->realize = impl_realize;
- parent_class = g_type_class_ref(PARENT_TYPE);
+ parent_class = gtk_type_class (PARENT_TYPE);
}
static void
@@ -339,7 +333,7 @@ e_shell_settings_dialog_new ()
{
EShellSettingsDialog *new;
- new = g_object_new (e_shell_settings_dialog_get_type (), NULL);
+ new = gtk_type_new (e_shell_settings_dialog_get_type ());
return GTK_WIDGET (new);
}
diff --git a/shell/e-shell-user-creatable-items-handler.c b/shell/e-shell-user-creatable-items-handler.c
index 057ac1bd1e..352555906b 100644
--- a/shell/e-shell-user-creatable-items-handler.c
+++ b/shell/e-shell-user-creatable-items-handler.c
@@ -35,7 +35,6 @@
#include <gal/util/e-util.h>
#include <bonobo/bonobo-ui-util.h>
-#include <bonobo/bonobo-exception.h>
#include <libgnome/gnome-i18n.h>
@@ -44,11 +43,10 @@
#include <stdlib.h>
#include <ctype.h>
-#include <string.h>
-#define PARENT_TYPE G_TYPE_OBJECT
-static GObjectClass *parent_class = NULL;
+#define PARENT_TYPE gtk_object_get_type ()
+static GtkObjectClass *parent_class = NULL;
#define VERB_PREFIX "ShellUserCreatableItemVerb"
@@ -106,11 +104,11 @@ component_new (const char *id,
new = g_new (Component, 1);
new->component_client = client;
- g_object_ref (client);
+ gtk_object_ref (GTK_OBJECT (client));
CORBA_exception_init (&ev);
- objref = evolution_shell_component_client_corba_objref (client);
+ objref = bonobo_object_corba_objref (BONOBO_OBJECT (client));
new->type_list = GNOME_Evolution_ShellComponent__get_userCreatableItemTypes (objref, &ev);
if (ev._major != CORBA_NO_EXCEPTION)
@@ -124,7 +122,7 @@ component_new (const char *id,
static void
component_free (Component *component)
{
- g_object_unref (component->component_client);
+ gtk_object_unref (GTK_OBJECT (component->component_client));
if (component->type_list != NULL)
CORBA_free (component->type_list);
@@ -248,7 +246,7 @@ free_menu_items (GSList *menu_items)
g_free (item->verb);
if (item->icon != NULL)
- g_object_unref (item->icon);
+ gdk_pixbuf_unref (item->icon);
g_free (item->component_id);
@@ -307,9 +305,13 @@ append_xml_for_menu_item (GString *xml,
else if (item->shortcut != '\0')
g_string_sprintfa (xml, " accel=\"*Control**Shift*%c\"", item->shortcut);
- if (item->icon != NULL)
- g_string_sprintfa (xml, " pixtype=\"pixbuf\" pixname=\"%s\"",
- bonobo_ui_util_pixbuf_to_xml (item->icon));
+ if (item->icon != NULL) {
+ char *pixbuf_xml;
+
+ pixbuf_xml = bonobo_ui_util_pixbuf_to_xml (item->icon);
+ g_string_sprintfa (xml, " pixtype=\"pixbuf\" pixname=\"%s\"", pixbuf_xml);
+ g_free (pixbuf_xml);
+ }
encoded_tooltip = bonobo_ui_util_encode_str (item->tooltip);
g_string_sprintfa (xml, " tip=\"%s\"", encoded_tooltip);
@@ -384,8 +386,8 @@ create_menu_xml (EShellUserCreatableItemsHandler *handler,
g_string_append (xml, "<placeholder name=\"EShellUserCreatableItemsPlaceholder\">");
/* 1. Add all the elements that are default for this component. (Note
- that we don't need to do any sorting since the items are already
- sorted alphabetically.) */
+ that we don't need to do any sorting since the items are already
+ sorted alphabetically.) */
if (component_id != NULL) {
gboolean first = TRUE;
@@ -474,14 +476,14 @@ execute_verb (EShellUserCreatableItemsHandler *handler,
CORBA_exception_init (&ev);
GNOME_Evolution_ShellComponent_userCreateNewItem
- (evolution_shell_component_client_corba_objref (component->component_client),
+ (bonobo_object_corba_objref (BONOBO_OBJECT (component->component_client)),
id,
e_safe_corba_string (e_shell_view_get_current_physical_uri (shell_view)),
e_safe_corba_string (e_shell_view_get_current_folder_type (shell_view)),
&ev);
if (ev._major != CORBA_NO_EXCEPTION)
- g_warning ("Error in userCreateNewItem -- %s", BONOBO_EX_REPOID (&ev));
+ g_warning ("Error in userCreateNewItem -- %s", ev._repo_id);
CORBA_exception_free (&ev);
return;
@@ -497,7 +499,7 @@ verb_fn (BonoboUIComponent *ui_component,
EShellUserCreatableItemsHandler *handler;
EShellView *shell_view;
- shell_view = g_object_get_data (G_OBJECT (ui_component), SHELL_VIEW_KEY);
+ shell_view = gtk_object_get_data (GTK_OBJECT (ui_component), SHELL_VIEW_KEY);
g_assert (E_IS_SHELL_VIEW (shell_view));
handler = E_SHELL_USER_CREATABLE_ITEMS_HANDLER (data);
@@ -517,7 +519,7 @@ add_verbs (EShellUserCreatableItemsHandler *handler,
priv = handler->priv;
ui_component = e_shell_view_get_bonobo_ui_component (shell_view);
- g_object_set_data (G_OBJECT (ui_component), SHELL_VIEW_KEY, shell_view);
+ gtk_object_set_data (GTK_OBJECT (ui_component), SHELL_VIEW_KEY, shell_view);
component_num = 0;
for (p = priv->components; p != NULL; p = p->next) {
@@ -581,9 +583,9 @@ setup_toolbar_button (EShellUserCreatableItemsHandler *handler,
e_combo_button_set_label (E_COMBO_BUTTON (combo_button), _("New"));
gtk_widget_show (combo_button);
- g_signal_connect (combo_button, "activate_default",
- G_CALLBACK (combo_button_activate_default_callback),
- shell_view);
+ gtk_signal_connect (GTK_OBJECT (combo_button), "activate_default",
+ GTK_SIGNAL_FUNC (combo_button_activate_default_callback),
+ shell_view);
ui_component = e_shell_view_get_bonobo_ui_component (shell_view);
bonobo_window_add_popup (BONOBO_WINDOW (shell_view), GTK_MENU (menu), "/popups/NewPopup");
@@ -593,10 +595,10 @@ setup_toolbar_button (EShellUserCreatableItemsHandler *handler,
bonobo_ui_component_object_set (ui_component, "/Toolbar/NewComboButton",
BONOBO_OBJREF (control), NULL);
- g_object_set_data (G_OBJECT (shell_view), COMBO_BUTTON_WIDGET_KEY, combo_button);
+ gtk_object_set_data (GTK_OBJECT (shell_view), COMBO_BUTTON_WIDGET_KEY, combo_button);
tooltips = gtk_tooltips_new ();
- g_object_set_data (G_OBJECT (combo_button), TOOLTIPS_KEY, tooltips);
+ gtk_object_set_data (GTK_OBJECT (combo_button), TOOLTIPS_KEY, tooltips);
}
@@ -623,10 +625,10 @@ shell_view_view_changed_callback (EShellView *shell_view,
handler = E_SHELL_USER_CREATABLE_ITEMS_HANDLER (data);
priv = handler->priv;
- combo_button_widget = g_object_get_data (G_OBJECT (shell_view), COMBO_BUTTON_WIDGET_KEY);
+ combo_button_widget = gtk_object_get_data (GTK_OBJECT (shell_view), COMBO_BUTTON_WIDGET_KEY);
g_assert (E_IS_COMBO_BUTTON (combo_button_widget));
- tooltips = g_object_get_data (G_OBJECT (combo_button_widget), TOOLTIPS_KEY);
+ tooltips = gtk_object_get_data (GTK_OBJECT (combo_button_widget), TOOLTIPS_KEY);
g_assert (tooltips != NULL);
default_menu_item = get_default_action_for_view (handler, shell_view);
@@ -656,10 +658,10 @@ shell_view_view_changed_callback (EShellView *shell_view,
}
-/* GObject methods. */
+/* GtkObject methods. */
static void
-impl_dispose (GObject *object)
+impl_destroy (GtkObject *object)
{
EShellUserCreatableItemsHandler *handler;
EShellUserCreatableItemsHandlerPrivate *priv;
@@ -672,35 +674,21 @@ impl_dispose (GObject *object)
component_free ((Component *) p->data);
g_slist_free (priv->components);
- priv->components = NULL;
-
- (* G_OBJECT_CLASS (parent_class)->dispose) (object);
-}
-
-static void
-impl_finalize (GObject *object)
-{
- EShellUserCreatableItemsHandler *handler;
- EShellUserCreatableItemsHandlerPrivate *priv;
-
- handler = E_SHELL_USER_CREATABLE_ITEMS_HANDLER (object);
- priv = handler->priv;
free_menu_items (priv->menu_items);
g_free (priv);
- (* G_OBJECT_CLASS (parent_class)->finalize) (object);
+ (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}
static void
-class_init (GObjectClass *object_class)
+class_init (GtkObjectClass *object_class)
{
- parent_class = g_type_class_ref(PARENT_TYPE);
+ parent_class = gtk_type_class (PARENT_TYPE);
- object_class->dispose = impl_dispose;
- object_class->finalize = impl_finalize;
+ object_class->destroy = impl_destroy;
}
static void
@@ -722,7 +710,7 @@ e_shell_user_creatable_items_handler_new (void)
{
EShellUserCreatableItemsHandler *new;
- new = g_object_new (e_shell_user_creatable_items_handler_get_type (), NULL);
+ new = gtk_type_new (e_shell_user_creatable_items_handler_get_type ());
return new;
}
@@ -770,8 +758,8 @@ e_shell_user_creatable_items_handler_attach_menus (EShellUserCreatableItemsHandl
priv = handler->priv;
setup_toolbar_button (handler, shell_view);
- g_signal_connect (shell_view, "view_changed",
- G_CALLBACK (shell_view_view_changed_callback), handler);
+ gtk_signal_connect (GTK_OBJECT (shell_view), "view_changed",
+ GTK_SIGNAL_FUNC (shell_view_view_changed_callback), handler);
add_verbs (handler, shell_view);
menu_xml = create_menu_xml (handler,
diff --git a/shell/e-storage-set-view.c b/shell/e-storage-set-view.c
index d57dd59968..281feb6168 100644
--- a/shell/e-storage-set-view.c
+++ b/shell/e-storage-set-view.c
@@ -33,7 +33,6 @@
#include "e-icon-factory.h"
#include "e-folder-dnd-bridge.h"
#include "e-shell-constants.h"
-#include "e-shell-marshal.h"
#include <gal/util/e-util.h>
#include <gal/widgets/e-gui-utils.h>
@@ -41,16 +40,14 @@
#include <gal/e-table/e-cell-text.h>
#include <gal/e-table/e-cell-toggle.h>
#include <gal/e-table/e-cell-tree.h>
+#include <gal/unicode/gunicode.h>
+#include <glib.h>
+#include <gnome.h>
+#include <libgnome/gnome-defs.h>
#include <libgnome/gnome-util.h>
-#include <libgnomeui/gnome-popup-menu.h>
-
-#include <bonobo/bonobo-window.h>
#include <bonobo/bonobo-ui-util.h>
-
-#include <gtk/gtksignal.h>
-
-#include <string.h>
+#include <libgnome/gnome-util.h>
#include "check-empty.xpm"
#include "check-filled.xpm"
@@ -325,7 +322,7 @@ get_pixbuf_for_folder (EStorageSetView *storage_set_view,
icon_pixbuf_height = gdk_pixbuf_get_height (icon_pixbuf);
if (icon_pixbuf_width == E_SHELL_MINI_ICON_SIZE && icon_pixbuf_height == E_SHELL_MINI_ICON_SIZE) {
- scaled_pixbuf = g_object_ref (icon_pixbuf);
+ scaled_pixbuf = gdk_pixbuf_ref (icon_pixbuf);
} else {
scaled_pixbuf = gdk_pixbuf_new (gdk_pixbuf_get_colorspace (icon_pixbuf),
gdk_pixbuf_get_has_alpha (icon_pixbuf),
@@ -410,8 +407,7 @@ convert_gdk_drag_action_set_to_corba (GdkDragAction action)
/* The weakref callback for priv->ui_component. */
static void
-ui_container_destroy_notify (void *data,
- GObject *where_the_object_was)
+ui_container_destroy_notify (void *data)
{
EStorageSetViewPrivate *priv = (EStorageSetViewPrivate *) data;
@@ -419,6 +415,31 @@ ui_container_destroy_notify (void *data,
}
+/* Custom marshalling function. */
+
+typedef void (* GtkSignal_NONE__GDKDRAGCONTEXT_STRING_STRING_STRING) (GtkObject *object,
+ GdkDragContext *action,
+ const char *,
+ const char *,
+ const char *);
+
+static void
+marshal_NONE__GDKDRAGCONTEXT_STRING_STRING_STRING (GtkObject *object,
+ GtkSignalFunc func,
+ void *func_data,
+ GtkArg *args)
+{
+ GtkSignal_NONE__GDKDRAGCONTEXT_STRING_STRING_STRING rfunc;
+
+ rfunc = (GtkSignal_NONE__GDKDRAGCONTEXT_STRING_STRING_STRING) func;
+ (* rfunc) (object,
+ GTK_VALUE_POINTER (args[0]),
+ GTK_VALUE_STRING (args[1]),
+ GTK_VALUE_STRING (args[2]),
+ GTK_VALUE_STRING (args[3]));
+}
+
+
/* DnD selection setup stuff. */
/* This will create an array of GtkTargetEntries from the specified list of DND
@@ -693,8 +714,8 @@ setup_folder_properties_items_if_corba_storage_clicked (EStorageSetView *storage
data->corba_storage = E_CORBA_STORAGE (storage);
data->num_items = num_property_items;
- g_object_ref (data->storage_set_view);
- g_object_ref (data->corba_storage);
+ gtk_object_ref (GTK_OBJECT (data->storage_set_view));
+ gtk_object_ref (GTK_OBJECT (data->corba_storage));
for (i = 1; i <= num_property_items; i ++) {
char *verb;
@@ -742,8 +763,8 @@ remove_property_items (EStorageSetView *storage_set_view,
}
}
- g_object_unref (data->storage_set_view);
- g_object_unref (data->corba_storage);
+ gtk_object_unref (GTK_OBJECT (data->storage_set_view));
+ gtk_object_unref (GTK_OBJECT (data->corba_storage));
g_free (data);
}
@@ -762,7 +783,7 @@ popup_folder_menu (EStorageSetView *storage_set_view,
priv = storage_set_view->priv;
folder = e_storage_set_get_folder (priv->storage_set, priv->right_click_row_path);
- g_object_ref (folder);
+ gtk_object_ref (GTK_OBJECT (folder));
folder_type_registry = e_storage_set_get_folder_type_registry (priv->storage_set);
g_assert (folder_type_registry != NULL);
@@ -770,11 +791,8 @@ popup_folder_menu (EStorageSetView *storage_set_view,
handler = e_folder_type_registry_get_handler_for_type (folder_type_registry,
e_folder_get_type_string (folder));
menu = gtk_menu_new ();
-
-#if 0
bonobo_window_add_popup (bonobo_ui_container_get_win (priv->ui_container),
GTK_MENU (menu), "/popups/FolderPopup");
-#endif
bonobo_ui_component_set (priv->ui_component,
"/popups/FolderPopup/ComponentPlaceholder",
@@ -790,8 +808,7 @@ popup_folder_menu (EStorageSetView *storage_set_view,
gtk_widget_show (GTK_WIDGET (menu));
- gnome_popup_menu_do_popup_modal (GTK_WIDGET (menu), NULL, NULL, event, NULL,
- GTK_WIDGET (storage_set_view));
+ gnome_popup_menu_do_popup_modal (GTK_WIDGET (menu), NULL, NULL, event, NULL);
if (folder_property_items_data != NULL)
remove_property_items (storage_set_view, folder_property_items_data);
@@ -802,7 +819,7 @@ popup_folder_menu (EStorageSetView *storage_set_view,
e_folder_get_physical_uri (folder),
e_folder_get_type_string (folder));
- g_object_unref (folder);
+ gtk_object_unref (GTK_OBJECT (folder));
gtk_widget_destroy (GTK_WIDGET (menu));
e_tree_right_click_up (E_TREE (storage_set_view));
@@ -812,14 +829,20 @@ popup_folder_menu (EStorageSetView *storage_set_view,
/* GtkObject methods. */
static void
+path_free_func (gpointer key, gpointer value, gpointer user_data)
+{
+ g_free (key);
+}
+
+static void
pixbuf_free_func (gpointer key, gpointer value, gpointer user_data)
{
g_free (key);
- g_object_unref ((GdkPixbuf*)value);
+ gdk_pixbuf_unref ((GdkPixbuf*)value);
}
static void
-impl_dispose (GObject *object)
+impl_destroy (GtkObject *object)
{
EStorageSetView *storage_set_view;
EStorageSetViewPrivate *priv;
@@ -827,22 +850,27 @@ impl_dispose (GObject *object)
storage_set_view = E_STORAGE_SET_VIEW (object);
priv = storage_set_view->priv;
- if (priv->etree_model != NULL) {
- /* Destroy the tree. */
- e_tree_memory_node_remove (E_TREE_MEMORY(priv->etree_model), priv->root_node);
- g_object_unref (priv->etree_model);
- priv->etree_model = NULL;
+ /* need to destroy our tree */
+ e_tree_memory_node_remove (E_TREE_MEMORY(priv->etree_model), priv->root_node);
+ gtk_object_unref (GTK_OBJECT (priv->etree_model));
- /* (The data in the hash table was all freed by freeing the tree.) */
- g_hash_table_destroy (priv->path_to_etree_node);
- priv->path_to_etree_node = NULL;
- }
+ /* the data in the hash table was all freed by freeing the tree */
+ g_hash_table_foreach (priv->path_to_etree_node, path_free_func, NULL);
+ g_hash_table_destroy (priv->path_to_etree_node);
- if (priv->storage_set != NULL) {
- g_object_unref (priv->storage_set);
- priv->storage_set = NULL;
+ /* now free up all the type_names and pixbufs stored in the
+ hash table and destroy the hash table itself */
+ g_hash_table_foreach (priv->type_name_to_pixbuf, pixbuf_free_func, NULL);
+ g_hash_table_destroy (priv->type_name_to_pixbuf);
+
+ if (priv->checkboxes) {
+ g_hash_table_foreach (priv->checkboxes, (GHFunc) g_free, NULL);
+ g_hash_table_destroy (priv->checkboxes);
+ priv->checkboxes = NULL;
}
+ gtk_object_unref (GTK_OBJECT (priv->storage_set));
+
if (priv->drag_corba_source_interface != CORBA_OBJECT_NIL) {
CORBA_Environment ev;
@@ -858,35 +886,6 @@ impl_dispose (GObject *object)
CORBA_Object_release (priv->drag_corba_source_interface, &ev);
CORBA_exception_free (&ev);
-
- priv->drag_corba_source_interface = CORBA_OBJECT_NIL;
- }
-
- if (priv->ui_component != NULL) {
- bonobo_object_unref (BONOBO_OBJECT (priv->ui_component));
- priv->ui_component = NULL;
- }
-
- /* (No unreffing for priv->ui_container since we use a weakref.) */
-
- (* G_OBJECT_CLASS (parent_class)->dispose) (object);
-}
-
-static void
-impl_finalize (GObject *object)
-{
- EStorageSetView *storage_set_view;
- EStorageSetViewPrivate *priv;
-
- storage_set_view = E_STORAGE_SET_VIEW (object);
- priv = storage_set_view->priv;
-
- g_hash_table_foreach (priv->type_name_to_pixbuf, pixbuf_free_func, NULL);
- g_hash_table_destroy (priv->type_name_to_pixbuf);
-
- if (priv->checkboxes != NULL) {
- g_hash_table_foreach (priv->checkboxes, (GHFunc) g_free, NULL);
- g_hash_table_destroy (priv->checkboxes);
}
if (priv->drag_corba_source_context != NULL)
@@ -895,12 +894,17 @@ impl_finalize (GObject *object)
if (priv->drag_corba_data != NULL)
CORBA_free (priv->drag_corba_data);
+ if (priv->ui_component != NULL)
+ bonobo_object_unref (BONOBO_OBJECT (priv->ui_component));
+
+ /* (No unreffing for priv->ui_container since we use a weakref.) */
+
g_free (priv->selected_row_path);
g_free (priv->right_click_row_path);
g_free (priv);
- (* G_OBJECT_CLASS (parent_class)->finalize) (object);
+ (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}
@@ -981,7 +985,7 @@ impl_tree_drag_begin (ETree *etree,
CORBA_exception_init (&ev);
- corba_component = evolution_shell_component_client_corba_objref (component_client);
+ corba_component = bonobo_object_corba_objref (BONOBO_OBJECT (component_client));
priv->drag_corba_source_interface = Bonobo_Unknown_queryInterface (corba_component,
"IDL:GNOME/Evolution/ShellComponentDnd/SourceFolder:1.0",
&ev);
@@ -1097,7 +1101,6 @@ impl_tree_drag_data_get (ETree *etree,
& priv->drag_corba_data,
&ev);
-#if 0
if (ev._major != CORBA_NO_EXCEPTION)
gtk_selection_data_set (selection_data, selection_data->target, 8, "", -1);
else
@@ -1106,7 +1109,6 @@ impl_tree_drag_data_get (ETree *etree,
priv->drag_corba_data->format,
priv->drag_corba_data->bytes._buffer,
priv->drag_corba_data->bytes._length);
-#endif
g_free (target_type);
@@ -1162,7 +1164,7 @@ impl_tree_drag_motion (ETree *tree,
return FALSE;
folder_path = e_tree_memory_node_get_data (E_TREE_MEMORY (priv->etree_model),
- e_tree_node_at_row (E_TREE (storage_set_view), row));
+ e_tree_node_at_row (E_TREE (storage_set_view), row));
if (folder_path == NULL)
return FALSE;
@@ -1264,11 +1266,14 @@ impl_right_click (ETree *etree,
priv->right_click_row_path = g_strdup (e_tree_memory_node_get_data (E_TREE_MEMORY(priv->etree_model), path));
if (priv->ui_container) {
- g_signal_emit (storage_set_view, signals[FOLDER_CONTEXT_MENU_POPPING_UP], 0, priv->right_click_row_path);
+ gtk_signal_emit (GTK_OBJECT (storage_set_view),
+ signals[FOLDER_CONTEXT_MENU_POPPING_UP],
+ priv->right_click_row_path);
popup_folder_menu (storage_set_view, (GdkEventButton *) event);
- g_signal_emit (storage_set_view, signals[FOLDER_CONTEXT_MENU_POPPED_DOWN], 0);
+ gtk_signal_emit (GTK_OBJECT (storage_set_view),
+ signals[FOLDER_CONTEXT_MENU_POPPED_DOWN]);
}
g_free (priv->right_click_row_path);
@@ -1293,8 +1298,8 @@ impl_cursor_activated (ETree *tree,
if (path) {
priv->selected_row_path = g_strdup (e_tree_memory_node_get_data (E_TREE_MEMORY (priv->etree_model), path));
- g_signal_emit (storage_set_view, signals[FOLDER_SELECTED], 0,
- priv->selected_row_path);
+ gtk_signal_emit (GTK_OBJECT (storage_set_view), signals[FOLDER_SELECTED],
+ priv->selected_row_path);
}
else
priv->selected_row_path = NULL;
@@ -1452,7 +1457,9 @@ etree_value_at (ETreeModel *etree,
name_with_unread = g_strdup_printf ("%s (%d)", folder_name,
unread_count);
- g_object_set_data_full (G_OBJECT (folder), "name_with_unread", name_with_unread, g_free);
+ gtk_object_set_data_full (GTK_OBJECT (folder),
+ "name_with_unread",
+ name_with_unread, g_free);
return (void *) name_with_unread;
} else
@@ -1490,7 +1497,8 @@ etree_fill_in_children (ETreeModel *etree,
parent = e_tree_model_node_get_parent (etree, tree_path);
path = (char *) e_tree_memory_node_get_data (E_TREE_MEMORY(etree), parent);
if (tree_path == e_tree_model_node_get_first_child (etree, parent)) {
- g_signal_emit (storage_set_view, signals[FOLDER_OPENED], 0, path);
+ gtk_signal_emit (GTK_OBJECT (storage_set_view),
+ signals[FOLDER_OPENED], path);
}
}
@@ -1534,7 +1542,8 @@ etree_set_value_at (ETreeModel *etree,
}
e_tree_model_node_col_changed (etree, tree_path, col);
- g_signal_emit (storage_set_view, signals[CHECKBOXES_CHANGED], 0);
+ gtk_signal_emit (GTK_OBJECT (storage_set_view),
+ signals[CHECKBOXES_CHANGED]);
break;
}
}
@@ -1785,14 +1794,13 @@ close_folder_cb (EStorageSet *storage_set,
static void
class_init (EStorageSetViewClass *klass)
{
- GObjectClass *object_class;
+ GtkObjectClass *object_class;
ETreeClass *etree_class;
- parent_class = g_type_class_ref(PARENT_TYPE);
+ parent_class = gtk_type_class (PARENT_TYPE);
- object_class = G_OBJECT_CLASS (klass);
- object_class->dispose = impl_dispose;
- object_class->finalize = impl_finalize;
+ object_class = GTK_OBJECT_CLASS (klass);
+ object_class->destroy = impl_destroy;
etree_class = E_TREE_CLASS (klass);
etree_class->right_click = impl_right_click;
@@ -1810,58 +1818,60 @@ class_init (EStorageSetViewClass *klass)
signals[FOLDER_SELECTED]
= gtk_signal_new ("folder_selected",
GTK_RUN_FIRST,
- GTK_CLASS_TYPE (object_class),
- G_STRUCT_OFFSET (EStorageSetViewClass, folder_selected),
- e_shell_marshal_NONE__STRING,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EStorageSetViewClass, folder_selected),
+ gtk_marshal_NONE__STRING,
GTK_TYPE_NONE, 1,
GTK_TYPE_STRING);
signals[FOLDER_OPENED]
= gtk_signal_new ("folder_opened",
GTK_RUN_FIRST,
- GTK_CLASS_TYPE (object_class),
- G_STRUCT_OFFSET (EStorageSetViewClass, folder_opened),
- e_shell_marshal_NONE__STRING,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EStorageSetViewClass, folder_opened),
+ gtk_marshal_NONE__STRING,
GTK_TYPE_NONE, 1,
GTK_TYPE_STRING);
signals[DND_ACTION]
= gtk_signal_new ("dnd_action",
GTK_RUN_FIRST,
- GTK_CLASS_TYPE (object_class),
- G_STRUCT_OFFSET (EStorageSetViewClass, dnd_action),
- e_shell_marshal_NONE__POINTER_POINTER_POINTER_POINTER,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EStorageSetViewClass, dnd_action),
+ marshal_NONE__GDKDRAGCONTEXT_STRING_STRING_STRING,
GTK_TYPE_NONE, 4,
- GTK_TYPE_POINTER,
- GTK_TYPE_POINTER,
- GTK_TYPE_POINTER,
- GTK_TYPE_POINTER);
+ GTK_TYPE_GDK_DRAG_CONTEXT,
+ GTK_TYPE_STRING,
+ GTK_TYPE_STRING,
+ GTK_TYPE_STRING);
signals[FOLDER_CONTEXT_MENU_POPPING_UP]
= gtk_signal_new ("folder_context_menu_popping_up",
GTK_RUN_FIRST,
- GTK_CLASS_TYPE (object_class),
- G_STRUCT_OFFSET (EStorageSetViewClass, folder_context_menu_popping_up),
- e_shell_marshal_NONE__STRING,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EStorageSetViewClass, folder_context_menu_popping_up),
+ gtk_marshal_NONE__STRING,
GTK_TYPE_NONE, 1,
GTK_TYPE_STRING);
signals[FOLDER_CONTEXT_MENU_POPPED_DOWN]
= gtk_signal_new ("folder_context_menu_popped_down",
GTK_RUN_FIRST,
- GTK_CLASS_TYPE (object_class),
- G_STRUCT_OFFSET (EStorageSetViewClass, folder_context_menu_popped_down),
- e_shell_marshal_NONE__NONE,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EStorageSetViewClass, folder_context_menu_popped_down),
+ gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
signals[CHECKBOXES_CHANGED]
= gtk_signal_new ("checkboxes_changed",
GTK_RUN_FIRST,
- GTK_CLASS_TYPE (object_class),
- G_STRUCT_OFFSET (EStorageSetViewClass, checkboxes_changed),
- e_shell_marshal_NONE__NONE,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EStorageSetViewClass, checkboxes_changed),
+ gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
+ gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
+
checks [0] = gdk_pixbuf_new_from_xpm_data (check_empty_xpm);
checks [1] = gdk_pixbuf_new_from_xpm_data (check_filled_xpm);
checks [2] = gdk_pixbuf_new_from_xpm_data (check_missing_xpm);
@@ -1989,12 +1999,12 @@ setup_folder_changed_callbacks (EStorageSetView *storage_set_view,
folder_changed_callback_data->path = g_strdup (path);
gtk_signal_connect_while_alive (GTK_OBJECT (folder), "name_changed",
- G_CALLBACK (folder_name_changed_cb),
+ GTK_SIGNAL_FUNC (folder_name_changed_cb),
folder_changed_callback_data,
GTK_OBJECT (storage_set_view));
e_gtk_signal_connect_full_while_alive (GTK_OBJECT (folder), "changed",
- G_CALLBACK (folder_changed_cb),
+ GTK_SIGNAL_FUNC (folder_changed_cb),
NULL,
folder_changed_callback_data,
folder_changed_callback_data_destroy_notify,
@@ -2102,12 +2112,11 @@ e_storage_set_view_construct (EStorageSetView *storage_set_view,
priv->ui_container = ui_container;
if (ui_container != NULL) {
- g_object_weak_ref (G_OBJECT (ui_container), ui_container_destroy_notify, priv);
+ gtk_object_weakref (GTK_OBJECT (ui_container), ui_container_destroy_notify, priv);
priv->ui_component = bonobo_ui_component_new_default ();
bonobo_ui_component_set_container (priv->ui_component,
- bonobo_object_corba_objref (BONOBO_OBJECT (ui_container)),
- NULL);
+ bonobo_object_corba_objref (BONOBO_OBJECT (ui_container)));
}
priv->etree_model = e_tree_memory_callbacks_new (etree_icon_at,
@@ -2141,7 +2150,7 @@ e_storage_set_view_construct (EStorageSetView *storage_set_view,
extras = e_table_extras_new ();
cell = e_cell_text_new (NULL, GTK_JUSTIFY_LEFT);
- g_object_set((cell), "bold_column", 1, NULL);
+ gtk_object_set (GTK_OBJECT (cell), "bold_column", 1, NULL);
e_table_extras_add_cell (extras, "render_tree",
e_cell_tree_new (NULL, NULL, TRUE, cell));
@@ -2153,21 +2162,35 @@ e_storage_set_view_construct (EStorageSetView *storage_set_view,
e_tree_root_node_set_visible (E_TREE(storage_set_view), FALSE);
- g_object_unref (extras);
+ gtk_object_unref (GTK_OBJECT (extras));
- g_object_ref (storage_set);
+ gtk_object_ref (GTK_OBJECT (storage_set));
priv->storage_set = storage_set;
e_tree_drag_dest_set (E_TREE (storage_set_view), 0, NULL, 0, GDK_ACTION_MOVE | GDK_ACTION_COPY);
- g_signal_connect_object (storage_set, "new_storage", G_CALLBACK (new_storage_cb), storage_set_view, 0);
- g_signal_connect_object (storage_set, "removed_storage", G_CALLBACK (removed_storage_cb), storage_set_view, 0);
- g_signal_connect_object (storage_set, "new_folder", G_CALLBACK (new_folder_cb), storage_set_view, 0);
- g_signal_connect_object (storage_set, "updated_folder", G_CALLBACK (updated_folder_cb), storage_set_view, 0);
- g_signal_connect_object (storage_set, "removed_folder", G_CALLBACK (removed_folder_cb), storage_set_view, 0);
- g_signal_connect_object (storage_set, "close_folder", G_CALLBACK (close_folder_cb), storage_set_view, 0);
+ gtk_signal_connect_while_alive (GTK_OBJECT (storage_set), "new_storage",
+ GTK_SIGNAL_FUNC (new_storage_cb), storage_set_view,
+ GTK_OBJECT (storage_set_view));
+ gtk_signal_connect_while_alive (GTK_OBJECT (storage_set), "removed_storage",
+ GTK_SIGNAL_FUNC (removed_storage_cb), storage_set_view,
+ GTK_OBJECT (storage_set_view));
+ gtk_signal_connect_while_alive (GTK_OBJECT (storage_set), "new_folder",
+ GTK_SIGNAL_FUNC (new_folder_cb), storage_set_view,
+ GTK_OBJECT (storage_set_view));
+ gtk_signal_connect_while_alive (GTK_OBJECT (storage_set), "updated_folder",
+ GTK_SIGNAL_FUNC (updated_folder_cb), storage_set_view,
+ GTK_OBJECT (storage_set_view));
+ gtk_signal_connect_while_alive (GTK_OBJECT (storage_set), "removed_folder",
+ GTK_SIGNAL_FUNC (removed_folder_cb), storage_set_view,
+ GTK_OBJECT (storage_set_view));
+ gtk_signal_connect_while_alive (GTK_OBJECT (storage_set), "close_folder",
+ GTK_SIGNAL_FUNC (close_folder_cb), storage_set_view,
+ GTK_OBJECT (storage_set_view));
- g_signal_connect_object (priv->etree_model, "fill_in_children", G_CALLBACK (etree_fill_in_children), storage_set_view, 0);
+ gtk_signal_connect_while_alive (GTK_OBJECT (priv->etree_model), "fill_in_children",
+ GTK_SIGNAL_FUNC (etree_fill_in_children), storage_set_view,
+ GTK_OBJECT (storage_set_view));
insert_storages (storage_set_view);
}
@@ -2181,7 +2204,7 @@ e_storage_set_view_new (EStorageSet *storage_set,
g_return_val_if_fail (E_IS_STORAGE_SET (storage_set), NULL);
- new = g_object_new (e_storage_set_view_get_type (), NULL);
+ new = gtk_type_new (e_storage_set_view_get_type ());
e_storage_set_view_construct (E_STORAGE_SET_VIEW (new), storage_set, ui_container);
@@ -2223,7 +2246,7 @@ e_storage_set_view_set_current_folder (EStorageSetView *storage_set_view,
g_free (priv->selected_row_path);
priv->selected_row_path = g_strdup (path);
- g_signal_emit (storage_set_view, signals[FOLDER_SELECTED], 0, path);
+ gtk_signal_emit (GTK_OBJECT (storage_set_view), signals[FOLDER_SELECTED], path);
}
const char *
@@ -2319,6 +2342,8 @@ e_storage_set_view_set_show_checkboxes (EStorageSetView *storage_set_view,
state->columns [0] = 1;
e_tree_set_state_object (E_TREE (storage_set_view), state);
+ gtk_object_unref (GTK_OBJECT (state));
+
priv->has_checkbox_func = has_checkbox_func;
priv->has_checkbox_func_data = func_data;
}
@@ -2350,7 +2375,7 @@ e_storage_set_view_enable_search (EStorageSetView *storage_set_view,
void
e_storage_set_view_set_checkboxes_list (EStorageSetView *storage_set_view,
- GSList *checkboxes)
+ GList *checkboxes)
{
gboolean changed = FALSE;
EStorageSetViewPrivate *priv = storage_set_view->priv;
@@ -2364,7 +2389,7 @@ e_storage_set_view_set_checkboxes_list (EStorageSetView *storage_set_view,
if (checkboxes) {
priv->checkboxes = g_hash_table_new (g_str_hash, g_str_equal);
- for (; checkboxes; checkboxes = g_slist_next (checkboxes)) {
+ for (; checkboxes; checkboxes = g_list_next (checkboxes)) {
char *path = checkboxes->data;
if (g_hash_table_lookup (priv->checkboxes, path))
@@ -2387,22 +2412,21 @@ essv_add_to_list (gpointer key,
gpointer value,
gpointer user_data)
{
- GSList **list = user_data;
+ GList **list = user_data;
- *list = g_slist_prepend (*list, g_strdup (key));
+ *list = g_list_prepend (*list, g_strdup (key));
}
-GSList *
+GList *
e_storage_set_view_get_checkboxes_list (EStorageSetView *storage_set_view)
{
- GSList *list = NULL;
+ GList *list = NULL;
if (storage_set_view->priv->checkboxes) {
g_hash_table_foreach (storage_set_view->priv->checkboxes, essv_add_to_list, &list);
- list = g_slist_reverse (list);
+ list = g_list_reverse (list);
}
-
return list;
}
diff --git a/shell/e-storage.c b/shell/e-storage.c
index 64fbbb332a..2f6ec935e5 100644
--- a/shell/e-storage.c
+++ b/shell/e-storage.c
@@ -32,22 +32,20 @@
#include "e-folder-tree.h"
#include "e-shell-constants.h"
-#include "e-shell-marshal.h"
#include <gtk/gtkobject.h>
#include <gtk/gtksignal.h>
+#include <libgnome/gnome-defs.h>
#include <libgnome/gnome-i18n.h>
#include <gal/util/e-util.h>
-#include <string.h>
-
#define PARENT_TYPE GTK_TYPE_OBJECT
static GtkObjectClass *parent_class = NULL;
#define ES_CLASS(obj) \
- E_STORAGE_CLASS (GTK_OBJECT_GET_CLASS (obj))
+ E_STORAGE_CLASS (GTK_OBJECT (obj)->klass)
struct _EStoragePrivate {
/* The set of folders we have in this storage. */
@@ -87,7 +85,7 @@ folder_destroy_notify (EFolderTree *tree,
}
e_folder = E_FOLDER (data);
- g_object_unref (e_folder);
+ gtk_object_unref (GTK_OBJECT (e_folder));
}
@@ -110,12 +108,13 @@ folder_changed_cb (EFolder *folder,
path = e_folder_tree_get_path_for_data (priv->folder_tree, folder);
g_assert (path != NULL);
- g_signal_emit (storage, signals[UPDATED_FOLDER], 0, path);
+ gtk_signal_emit (GTK_OBJECT (storage), signals[UPDATED_FOLDER], path);
- highlight = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (folder), "last_highlight"));
+ highlight = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (folder), "last_highlight"));
if (highlight != e_folder_get_highlighted (folder)) {
highlight = !highlight;
- g_object_set_data (G_OBJECT (folder), "last_highlight", GINT_TO_POINTER (highlight));
+ gtk_object_set_data (GTK_OBJECT (folder), "last_highlight",
+ GINT_TO_POINTER (highlight));
p = strrchr (path, '/');
if (p && p != path) {
char *name;
@@ -130,7 +129,7 @@ folder_changed_cb (EFolder *folder,
}
-/* GObject methods. */
+/* GtkObject methods. */
static void
free_folder (gpointer path, gpointer folder, gpointer user_data)
@@ -140,7 +139,7 @@ free_folder (gpointer path, gpointer folder, gpointer user_data)
}
static void
-impl_finalize (GObject *object)
+destroy (GtkObject *object)
{
EStorage *storage;
EStoragePrivate *priv;
@@ -157,9 +156,7 @@ impl_finalize (GObject *object)
g_free (priv->name);
- g_free (priv);
-
- (* G_OBJECT_CLASS (parent_class)->finalize) (object);
+ (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}
@@ -265,12 +262,12 @@ impl_async_remove_shared_folder (EStorage *storage,
static void
class_init (EStorageClass *class)
{
- GObjectClass *object_class;
+ GtkObjectClass *object_class;
- object_class = G_OBJECT_CLASS (class);
- parent_class = g_type_class_ref(gtk_object_get_type ());
+ object_class = GTK_OBJECT_CLASS (class);
+ parent_class = gtk_type_class (gtk_object_get_type ());
- object_class->finalize = impl_finalize;
+ object_class->destroy = destroy;
class->get_subfolder_paths = impl_get_subfolder_paths;
class->get_folder = impl_get_folder;
@@ -287,35 +284,37 @@ class_init (EStorageClass *class)
signals[NEW_FOLDER] =
gtk_signal_new ("new_folder",
GTK_RUN_FIRST,
- GTK_CLASS_TYPE (object_class),
- G_STRUCT_OFFSET (EStorageClass, new_folder),
- e_shell_marshal_NONE__STRING,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EStorageClass, new_folder),
+ gtk_marshal_NONE__STRING,
GTK_TYPE_NONE, 1,
GTK_TYPE_STRING);
signals[UPDATED_FOLDER] =
gtk_signal_new ("updated_folder",
GTK_RUN_FIRST,
- GTK_CLASS_TYPE (object_class),
- G_STRUCT_OFFSET (EStorageClass, updated_folder),
- e_shell_marshal_NONE__STRING,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EStorageClass, updated_folder),
+ gtk_marshal_NONE__STRING,
GTK_TYPE_NONE, 1,
GTK_TYPE_STRING);
signals[REMOVED_FOLDER] =
gtk_signal_new ("removed_folder",
GTK_RUN_FIRST,
- GTK_CLASS_TYPE (object_class),
- G_STRUCT_OFFSET (EStorageClass, removed_folder),
- e_shell_marshal_NONE__STRING,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EStorageClass, removed_folder),
+ gtk_marshal_NONE__STRING,
GTK_TYPE_NONE, 1,
GTK_TYPE_STRING);
signals[CLOSE_FOLDER] =
gtk_signal_new ("close_folder",
GTK_RUN_FIRST,
- GTK_CLASS_TYPE (object_class),
- G_STRUCT_OFFSET (EStorageClass, close_folder),
- e_shell_marshal_NONE__STRING,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EStorageClass, close_folder),
+ gtk_marshal_NONE__STRING,
GTK_TYPE_NONE, 1,
GTK_TYPE_STRING);
+
+ gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
}
static void
@@ -360,7 +359,7 @@ e_storage_new (const char *name,
{
EStorage *new;
- new = g_object_new (e_storage_get_type (), NULL);
+ new = gtk_type_new (e_storage_get_type ());
e_storage_construct (new, name, root_folder);
@@ -711,9 +710,10 @@ e_storage_new_folder (EStorage *storage,
}
g_free (parent_path);
- g_signal_connect_object (e_folder, "changed", G_CALLBACK (folder_changed_cb), storage, 0);
+ gtk_signal_connect_while_alive (GTK_OBJECT (e_folder), "changed", folder_changed_cb,
+ storage, GTK_OBJECT (storage));
- g_signal_emit (storage, signals[NEW_FOLDER], 0, path);
+ gtk_signal_emit (GTK_OBJECT (storage), signals[NEW_FOLDER], path);
folder_changed_cb (e_folder, storage);
@@ -729,6 +729,7 @@ e_storage_has_subfolders (EStorage *storage,
GList *subfolders, *f;
EFolder *pseudofolder;
char *pseudofolder_path;
+ gboolean retval;
g_return_val_if_fail (storage != NULL, FALSE);
g_return_val_if_fail (E_IS_STORAGE (storage), FALSE);
@@ -738,7 +739,7 @@ e_storage_has_subfolders (EStorage *storage,
priv = storage->priv;
- g_signal_emit (storage, signals[CLOSE_FOLDER], 0, path);
+ gtk_signal_emit (GTK_OBJECT (storage), signals[CLOSE_FOLDER], path);
if (g_hash_table_lookup (priv->pseudofolders, path))
return TRUE;
@@ -760,7 +761,10 @@ e_storage_has_subfolders (EStorage *storage,
g_hash_table_insert (priv->pseudofolders, g_strdup (path), pseudofolder);
- return e_storage_new_folder (storage, pseudofolder_path, pseudofolder);
+ retval = e_storage_new_folder (storage, pseudofolder_path, pseudofolder);
+ g_free (pseudofolder_path);
+
+ return retval;
}
gboolean
@@ -796,7 +800,7 @@ e_storage_removed_folder (EStorage *storage,
g_free (parent_path);
}
- g_signal_emit (storage, signals[REMOVED_FOLDER], 0, path);
+ gtk_signal_emit (GTK_OBJECT (storage), signals[REMOVED_FOLDER], path);
e_folder_tree_remove (priv->folder_tree, path);
diff --git a/shell/main.c b/shell/main.c
index 64febd4fcd..5ffc020d38 100644
--- a/shell/main.c
+++ b/shell/main.c
@@ -1,7 +1,7 @@
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* main.c
*
- * Copyright (C) 2000, 2001, 2002 Ximian, Inc.
+ * Copyright (C) 2000 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
@@ -21,17 +21,9 @@
*/
#include <config.h>
-
-#include "e-util/e-gtk-utils.h"
-
-#include "e-icon-factory.h"
-#include "e-shell-constants.h"
-#include "e-shell-config.h"
-#include "e-setup.h"
-
-#include "e-shell.h"
-
-#include <gconf/gconf-client.h>
+#include <fcntl.h>
+#include <glib.h>
+#include <stdio.h>
#include <gtk/gtkalignment.h>
#include <gtk/gtkframe.h>
@@ -39,24 +31,21 @@
#include <gtk/gtkmain.h>
#include <gtk/gtksignal.h>
#include <gtk/gtkwindow.h>
-#include <gtk/gtkdialog.h>
-#include <gtk/gtkstock.h>
#include <gdk/gdkx.h>
#include <X11/Xlib.h>
+#include <libgnome/gnome-defs.h>
#include <libgnome/gnome-i18n.h>
#include <libgnome/gnome-util.h>
-#include <libgnomeui/gnome-ui-init.h>
+#include <libgnomeui/gnome-init.h>
+#include <libgnomeui/gnome-stock.h>
#include <libgnomeui/gnome-window-icon.h>
-
#include <bonobo/bonobo-main.h>
#include <bonobo/bonobo-moniker-util.h>
#include <bonobo/bonobo-exception.h>
-
-#include <bonobo-activation/bonobo-activation.h>
-
#include <glade/glade.h>
+#include <liboaf/liboaf.h>
#ifdef GTKHTML_HAVE_GCONF
#include <gconf/gconf.h>
@@ -65,11 +54,16 @@
#include <gal/widgets/e-gui-utils.h>
#include <gal/widgets/e-cursors.h>
-#include <fcntl.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <unistd.h>
+#include "Evolution-Wombat.h"
+
+#include "e-util/e-gtk-utils.h"
+
+#include "e-icon-factory.h"
+#include "e-shell-constants.h"
+#include "e-shell-config.h"
+#include "e-setup.h"
+
+#include "e-shell.h"
static EShell *shell = NULL;
@@ -96,7 +90,7 @@ quit_box_new (void)
gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER);
/* (Just to prevent smart-ass window managers like Sawfish from setting
- the make the dialog as big as the standard Evolution window). */
+ the make the dialog as big as the standard Evolution window). */
gtk_window_set_wmclass (GTK_WINDOW (window), "evolution-quit", "Evolution:quit");
e_make_widget_backing_stored (window);
@@ -133,12 +127,22 @@ quit_box_new (void)
}
static void
+quit_box_destroyed_callback (GtkObject *object,
+ void *data)
+{
+ GtkWidget **p;
+
+ p = (GtkWidget **) data;
+ *p = NULL;
+}
+
+static void
no_views_left_cb (EShell *shell, gpointer data)
{
GtkWidget *quit_box;
quit_box = quit_box_new ();
- g_object_add_weak_pointer (G_OBJECT (quit_box), (void **) &quit_box);
+ gtk_signal_connect (GTK_OBJECT (quit_box), "destroy", quit_box_destroyed_callback, &quit_box);
/* FIXME: This is wrong. We should exit only when the shell is
destroyed. But refcounting is broken at present, so this is a
@@ -146,150 +150,116 @@ no_views_left_cb (EShell *shell, gpointer data)
e_shell_unregister_all (shell);
+ /* FIXME: And this is another ugly hack. We have a strange race
+ condition that I cannot work around. What happens is that the
+ EShell object gets unreffed and its aggregate EActivityHandler gets
+ destroyed too. But for some reason, the EActivityHanlder GtkObject
+ gets freed, while its CORBA object counterpart is still an active
+ server. So there is a slight chance that we receive CORBA
+ invocation that act on an uninitialized object, and we crash. (See
+ #8615.)
+
+ The CORBA invocation on the dead object only happens because we
+ ::unref the BonoboConf database server in the ::destroy method of
+ the shell. Since this is a CORBA call, it allows incoming CORBA
+ calls to happen -- and these get invoked on the partially
+ uninitialized object.
+
+ Since I am not 100% sure what the reason for this half-stale object
+ is, I am just going to make sure that no CORBA ops happen in
+ ::destroy... And this is achieved by placing this call here. (If
+ the DB is disconnected, there will be no ::unref of it in
+ ::destroy.) */
+
+ e_shell_disconnect_db (shell);
+
bonobo_object_unref (BONOBO_OBJECT (shell));
if (quit_box != NULL)
gtk_widget_destroy (quit_box);
- bonobo_main_quit ();
+ gtk_main_quit ();
}
static void
-shell_weak_notify (void *data,
- GObject *where_the_object_was)
+destroy_cb (GtkObject *object, gpointer data)
{
- bonobo_main_quit ();
+ gtk_main_quit ();
}
-/* Warning dialog to scare people off a little bit. */
-
static void
-warning_dialog_response_callback (GtkDialog *dialog,
- int button_number,
- void *data)
+kill_wombat (void)
{
- GtkCheckButton *dont_bother_me_again_checkbox;
- GConfClient *client;
-
- dont_bother_me_again_checkbox = GTK_CHECK_BUTTON (data);
-
- client = gconf_client_get_default ();
- gconf_client_set_bool (client, "/apps/evolution/shell/skip_warning_dialog",
- gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dont_bother_me_again_checkbox)),
- NULL);
- g_object_unref (client);
+ g_print ("(Killing old version of Wombat...)\n");
- gtk_widget_destroy (GTK_WIDGET (dialog));
+ system (KILL_PROCESS_CMD " -9 lt-wombat 2> /dev/null");
+ system (KILL_PROCESS_CMD " -9 wombat 2> /dev/null");
}
static void
-show_development_warning (GtkWindow *parent)
+kill_old_wombat (void)
{
- GtkWidget *label;
- GtkWidget *warning_dialog;
- GtkWidget *dont_bother_me_again_checkbox;
- GtkWidget *alignment;
- GConfClient *client;
+ GNOME_Evolution_WombatInterfaceCheck iface;
+ CORBA_Environment ev;
+ CORBA_char *version;
- client = gconf_client_get_default ();
+ CORBA_exception_init (&ev);
- if (gconf_client_get_bool (client, "/apps/evolution/shell/skip_warning_dialog", NULL)) {
- g_object_unref (client);
+ iface = bonobo_get_object ("wombat:", "GNOME/Evolution/WombatInterfaceCheck", &ev);
+ if (BONOBO_EX (&ev) || iface == CORBA_OBJECT_NIL) {
+ kill_wombat ();
+ CORBA_exception_free (&ev);
return;
}
- g_object_unref (client);
-
- warning_dialog = gtk_dialog_new_with_buttons("Ximian Evolution " VERSION, parent,
- GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_STOCK_OK, GTK_RESPONSE_OK, NULL);
- label = gtk_label_new (
- /* xgettext:no-c-format */
- _("Hi. Thanks for taking the time to download this preview release\n"
- "of the Ximian Evolution groupware suite.\n"
- "\n"
- "This version of Ximian Evolution is not yet complete. It's getting close,\n"
- "but some features are either unfinished or don't work properly.\n"
- "\n"
- "If you want a stable version of Evolution, we urge you to uninstall,\n"
- "this version, and install a 1.0.x version instead (1.0.8)\n"
- "\n"
- "If you find bugs, please report them to us at bugzilla.ximian.com.\n"
- "This product comes with no warranty and is not intended for\n"
- "individuals prone to violent fits of anger.\n"
- "\n"
- "We hope that you enjoy the results of our hard work, and we\n"
- "eagerly await your contributions!\n"
- ));
- gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT);
-
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (warning_dialog)->vbox),
- label, TRUE, TRUE, 4);
-
- label = gtk_label_new (_("Thanks\n"
- "The Ximian Evolution Team\n"));
- gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_RIGHT);
- gtk_misc_set_alignment(GTK_MISC(label), 1, .5);
-
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (warning_dialog)->vbox),
- label, TRUE, TRUE, 0);
-
- dont_bother_me_again_checkbox = gtk_check_button_new_with_label (_("Don't tell me again"));
-
- /* GTK sucks. (Just so you know.) */
- alignment = gtk_alignment_new (0.0, 0.0, 0.0, 0.0);
-
- gtk_container_add (GTK_CONTAINER (alignment), dont_bother_me_again_checkbox);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (warning_dialog)->vbox),
- alignment, FALSE, FALSE, 0);
-
- gtk_widget_show_all (warning_dialog);
-
- g_signal_connect (warning_dialog, "response",
- G_CALLBACK (warning_dialog_response_callback),
- dont_bother_me_again_checkbox);
-}
+ version = GNOME_Evolution_WombatInterfaceCheck__get_interfaceVersion (iface, &ev);
+ if (BONOBO_EX (&ev)) {
+ kill_wombat ();
+ bonobo_object_release_unref (iface, &ev);
+ CORBA_exception_free (&ev);
+ return;
+ }
-/* The following signal handlers are used to display the development warning as
- soon as the first view is created. */
+ if (strcmp (version, VERSION) != 0) {
+ CORBA_free (version);
+ kill_wombat ();
+ bonobo_object_release_unref (iface, &ev);
+ CORBA_exception_free (&ev);
+ return;
+ }
-static void
-view_map_callback (GtkWidget *widget,
- void *data)
-{
- gtk_signal_disconnect_by_func (GTK_OBJECT (widget),
- G_CALLBACK (view_map_callback),
- data);
+ CORBA_free (version);
- show_development_warning (GTK_WINDOW (widget));
-}
+ bonobo_object_release_unref (iface, &ev);
-static void
-new_view_created_callback (EShell *shell,
- EShellView *view,
- void *data)
-{
- gtk_signal_disconnect_by_func (GTK_OBJECT (shell),
- G_CALLBACK (new_view_created_callback),
- data);
-
- g_signal_connect (view, "map", G_CALLBACK (view_map_callback), NULL);
+ CORBA_exception_free (&ev);
}
static void
upgrade_from_1_0_if_needed (void)
{
-#if 0
- EConfigListener *config_listener;
+ Bonobo_ConfigDatabase config_db;
+ CORBA_Environment ev;
int result;
- config_listener = e_config_listener_new ();
+ CORBA_exception_init (&ev);
+
+ config_db = bonobo_get_object ("wombat:", "Bonobo/ConfigDatabase", &ev);
+ if (BONOBO_EX (&ev) || config_db == CORBA_OBJECT_NIL) {
+ g_print ("(Cannot access Bonobo/ConfigDatabase, not upgrading configuration.)\n");
+ if (BONOBO_EX (&ev))
+ g_print ("\t%s\n", BONOBO_EX_ID (&ev));
+ CORBA_exception_free (&ev);
+ return;
+ }
+
+ CORBA_exception_free (&ev);
if (! force_upgrade
- && e_config_listener_get_boolean_with_default (config_listener, "/Shell/upgrade_from_1_0_to_1_2_performed",
- FALSE, NULL))
+ && bonobo_config_get_boolean_with_default (config_db, "/Shell/upgrade_from_1_0_to_1_2_performed",
+ FALSE, NULL))
return;
g_print ("\nOlder configuration files detected, upgrading...\n");
@@ -301,10 +271,9 @@ upgrade_from_1_0_if_needed (void)
else
g_print ("\n*** Error upgrading configuration files -- status %d\n", result);
- e_config_listener_set_boolean (config_listener, "/Shell/upgrade_from_1_0_to_1_2_performed", TRUE);
+ bonobo_config_set_boolean (config_db, "/Shell/upgrade_from_1_0_to_1_2_performed", TRUE, NULL);
- g_object_unref (config_listener);
-#endif /* FIXME */
+ bonobo_object_release_unref (config_db, NULL);
}
@@ -323,6 +292,8 @@ idle_cb (void *data)
gboolean display_default;
gboolean displayed_any;
+ kill_old_wombat ();
+
upgrade_from_1_0_if_needed ();
CORBA_exception_init (&ev);
@@ -343,41 +314,37 @@ idle_cb (void *data)
case E_SHELL_CONSTRUCT_RESULT_OK:
e_shell_config_factory_register (shell);
- g_signal_connect (shell, "no_views_left", G_CALLBACK (no_views_left_cb), NULL);
- g_object_weak_ref (G_OBJECT (shell), shell_weak_notify, NULL);
-
- if (!getenv ("EVOLVE_ME_HARDER"))
- g_signal_connect (shell, "new_view_created",
- G_CALLBACK (new_view_created_callback), NULL);
+ gtk_signal_connect (GTK_OBJECT (shell), "no_views_left",
+ GTK_SIGNAL_FUNC (no_views_left_cb), NULL);
+ gtk_signal_connect (GTK_OBJECT (shell), "destroy",
+ GTK_SIGNAL_FUNC (destroy_cb), NULL);
corba_shell = bonobo_object_corba_objref (BONOBO_OBJECT (shell));
corba_shell = CORBA_Object_duplicate (corba_shell, &ev);
break;
case E_SHELL_CONSTRUCT_RESULT_CANNOTREGISTER:
- corba_shell = bonobo_activation_activate_from_id (E_SHELL_OAFIID, 0, NULL, &ev);
+ corba_shell = oaf_activate_from_id (E_SHELL_OAFIID, 0, NULL, &ev);
if (ev._major != CORBA_NO_EXCEPTION || corba_shell == CORBA_OBJECT_NIL) {
- e_notice (NULL, GTK_MESSAGE_ERROR,
+ e_notice (NULL, GNOME_MESSAGE_BOX_ERROR,
_("Cannot access the Ximian Evolution shell."));
CORBA_exception_free (&ev);
- bonobo_main_quit ();
+ gtk_main_quit ();
return FALSE;
}
break;
default:
- e_notice (NULL, GTK_MESSAGE_ERROR,
+ e_notice (NULL, GNOME_MESSAGE_BOX_ERROR,
_("Cannot initialize the Ximian Evolution shell: %s"),
e_shell_construct_result_to_string (result));
CORBA_exception_free (&ev);
- bonobo_main_quit ();
+ gtk_main_quit ();
return FALSE;
}
have_evolution_uri = FALSE;
- displayed_any = FALSE;
-
for (p = uri_list; p != NULL; p = p->next) {
const char *uri;
@@ -388,25 +355,30 @@ idle_cb (void *data)
}
if (shell == NULL) {
- /* We're talking to a remote shell. If the user didn't ask us to open any particular
- URI, then open another view of the default URI. */
+ /* We're talking to a remote shell. If the user didn't
+ * ask us to open any particular URI, then open another
+ * view of the default URI
+ */
if (uri_list == NULL)
display_default = TRUE;
else
display_default = FALSE;
} else {
- /* We're starting a new shell. If the user didn't specify any evolution: URIs to
- view, AND we can't load the user's previous settings, then show the default
- URI. */
+ /* We're starting a new shell. If the user didn't specify
+ * any evolution: URIs to view, AND we can't load the
+ * user's previous settings, then show the default URI.
+ */
if (! have_evolution_uri) {
- e_shell_create_view (shell, NULL, NULL);
- display_default = TRUE;
- displayed_any = TRUE;
+ if (! e_shell_restore_from_settings (shell, FALSE))
+ display_default = TRUE;
+ else
+ display_default = FALSE;
} else {
display_default = FALSE;
}
}
+ displayed_any = FALSE;
for (p = uri_list; p != NULL; p = p->next) {
const char *uri;
@@ -415,8 +387,7 @@ idle_cb (void *data)
if (ev._major == CORBA_NO_EXCEPTION)
displayed_any = TRUE;
else {
- g_warning ("CORBA exception %s when requesting URI -- %s",
- BONOBO_EX_REPOID (&ev), uri);
+ g_warning ("CORBA exception %s when requesting URI -- %s", ev._repo_id, uri);
CORBA_exception_free (&ev);
}
}
@@ -429,7 +400,7 @@ idle_cb (void *data)
uri = E_SHELL_VIEW_DEFAULT_URI;
GNOME_Evolution_Shell_handleURI (corba_shell, uri, &ev);
if (ev._major != CORBA_NO_EXCEPTION)
- g_warning ("CORBA exception %s when requesting URI -- %s", BONOBO_EX_REPOID (&ev), uri);
+ g_warning ("CORBA exception %s when requesting URI -- %s", ev._repo_id, uri);
}
CORBA_Object_release (corba_shell, &ev);
@@ -437,7 +408,7 @@ idle_cb (void *data)
CORBA_exception_free (&ev);
if (shell == NULL)
- bonobo_main_quit ();
+ gtk_main_quit ();
return FALSE;
}
@@ -456,19 +427,21 @@ main (int argc, char **argv)
N_("Send the debugging output of all components to a file."), NULL },
{ "force-upgrade", '\0', POPT_ARG_NONE, &force_upgrade, 0,
N_("Force upgrading of configuration files from Evolution 1.0.x"), NULL },
+ { NULL, '\0', POPT_ARG_INCLUDE_TABLE, &oaf_popt_options, 0, NULL, NULL },
POPT_AUTOHELP
{ NULL, '\0', 0, NULL, 0, NULL, NULL }
};
GSList *uri_list;
+ const char **args;
+ poptContext popt_context;
+
+ bindtextdomain (PACKAGE, EVOLUTION_LOCALEDIR);
+ textdomain (PACKAGE);
/* Make ElectricFence work. */
free (malloc (10));
- gnome_program_init (PACKAGE, VERSION, LIBGNOMEUI_MODULE, argc, argv,
- GNOME_PROGRAM_STANDARD_PROPERTIES,
- GNOME_PARAM_POPT_TABLE, options,
- GNOME_PARAM_HUMAN_READABLE_NAME, _("Evolution"),
- NULL);
+ gnome_init_with_popt_table ("Evolution", VERSION " [" SUB_VERSION "]", argc, argv, options, 0, &popt_context);
if (start_online && start_offline) {
fprintf (stderr, _("%s: --online and --offline cannot be used together.\n Use %s --help for more information.\n"),
@@ -488,12 +461,24 @@ main (int argc, char **argv)
g_warning ("Could not set up debugging output file.");
}
+ oaf_init (argc, argv);
+
+#ifdef GTKHTML_HAVE_GCONF
+ gconf_init (argc, argv, NULL);
+#endif
+
glade_gnome_init ();
e_cursors_init ();
e_icon_factory_init ();
gnome_window_icon_set_default_from_file (EVOLUTION_IMAGES "/evolution-inbox.png");
+ if (! bonobo_init (CORBA_OBJECT_NIL, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL)) {
+ e_notice (NULL, GNOME_MESSAGE_BOX_ERROR,
+ _("Cannot initialize the Bonobo component system."));
+ exit (1);
+ }
+
/* FIXME */
evolution_directory = g_concat_dir_and_file (g_get_home_dir (), "evolution");
@@ -502,7 +487,6 @@ main (int argc, char **argv)
uri_list = NULL;
-#if 0
args = poptGetArgs (popt_context);
if (args != NULL) {
const char **p;
@@ -510,7 +494,6 @@ main (int argc, char **argv)
for (p = args; *p != NULL; p++)
uri_list = g_slist_prepend (uri_list, (char *) *p);
}
-#endif
gtk_idle_add (idle_cb, uri_list);
diff --git a/tools/Makefile.am b/tools/Makefile.am
index a2de0296a6..7ea0e47099 100644
--- a/tools/Makefile.am
+++ b/tools/Makefile.am
@@ -6,7 +6,8 @@ bin_SCRIPTS = \
bin_PROGRAMS = \
evolution-addressbook-import \
- evolution-addressbook-export
+ evolution-addressbook-export \
+ evolution-launch-composer
noinst_PROGRAMS = evolution-addressbook-abuse
@@ -21,9 +22,42 @@ INCLUDES = \
-I$(top_builddir)/addressbook/backend \
$(GNOME_FULL_CFLAGS)
+CORBA_SOURCE = \
+ Evolution-Composer.h \
+ Evolution-Composer-common.c \
+ Evolution-Composer-skels.c \
+ Evolution-Composer-stubs.c
+
+idls = \
+ $(top_srcdir)/composer/Evolution-Composer.idl
+
+idl_flags = `$(GNOME_CONFIG) --cflags idl` -I $(datadir)/idl
+
+$(CORBA_SOURCE): $(idls)
+ $(ORBIT_IDL) -I $(srcdir) $(idls) $(idl_flags)
+
+BUILT_SOURCES = $(CORBA_SOURCE)
+
+dist-hook:
+ cd $(distdir); rm -f $(BUILT_SOURCES)
+
EXTRA_DIST = $(bin_SCRIPTS) verify-evolution-install.sh \
evolution-addressbook-clean.in
+evolution_launch_composer_SOURCES = \
+ $(CORBA_SOURCE) \
+ evolution-launch-composer.c
+
+evolution_launch_composer_LDADD = \
+ $(GNOME_FULL_LIBS) \
+ $(top_builddir)/addressbook/backend/ebook/libebook.la \
+ $(top_builddir)/camel/libcamel.la \
+ $(top_builddir)/e-util/ename/libename.la \
+ $(top_builddir)/libversit/libversit.a \
+ $(top_builddir)/e-util/libeutil.la \
+ $(top_builddir)/widgets/menus/libmenus.la
+
+
evolution_addressbook_import_LDADD = \
$(GNOME_FULL_LIBS) \
$(top_builddir)/addressbook/backend/ebook/libebook.la \
@@ -39,7 +73,7 @@ evolution_addressbook_export_LDADD = \
evolution_addressbook_abuse_LDADD = \
$(evolution_addressbook_import_LDADD)
-CLEANFILES = evolution-addressbook-clean
+CLEANFILES = evolution-addressbook-clean $(BUILT_SOURCES)
evolution-addressbook-clean: evolution-addressbook-clean.in Makefile
diff --git a/tools/evolution-launch-composer.c b/tools/evolution-launch-composer.c
new file mode 100644
index 0000000000..834ba2ff15
--- /dev/null
+++ b/tools/evolution-launch-composer.c
@@ -0,0 +1,356 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * evolution-sendmail.c -
+ * Copyright (C) 2002, Ximian, Inc.
+ *
+ * Authors:
+ * Christopher James Lahey <clahey@ximian.com>
+ *
+ * This file 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 file is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this file; if not, write to
+ * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ **/
+
+#include <config.h>
+
+#include <Evolution-Composer.h>
+#include <bonobo/bonobo-object-client.h>
+#include <popt.h>
+#include <gal/util/e-util.h>
+#include <gal/util/e-i18n.h>
+#include <liboaf/liboaf.h>
+#include <gtk/gtkmain.h>
+
+#include <bonobo/bonobo-main.h>
+
+#include <libgnomeui/gnome-init.h>
+
+#include <libgnomevfs/gnome-vfs-ops.h>
+#include <libgnomevfs/gnome-vfs-uri.h>
+#include <libgnomevfs/gnome-vfs-utils.h>
+#include <libgnomevfs/gnome-vfs-xfer.h>
+#include <libgnomevfs/gnome-vfs-init.h>
+
+#define READ_CHUNK_SIZE 8192
+
+#define E_SHELL_OAFIID "OAFIID:GNOME_Evolution_Shell"
+#define COMPOSER_OAFIID "OAFIID:GNOME_Evolution_Mail_Composer"
+#define NOTNULL(x) ((x) ? (x) : "")
+
+typedef struct {
+ char *filename;
+ char *basename;
+ char *content;
+ int size;
+ char *description;
+ char *content_type;
+ gboolean show_inline;
+} attachment_t;
+
+GList *attachments; /* Of type attachment_t */
+
+char *subject;
+
+static void
+free_attachment (attachment_t *attachment)
+{
+ g_free (attachment->content);
+ g_free (attachment->filename);
+ g_free (attachment->basename);
+ g_free (attachment->content_type);
+ g_free (attachment->description);
+ g_free (attachment);
+}
+
+GnomeVFSResult
+elc_read_entire_file (const char *uri,
+ int *file_size,
+ char **file_contents,
+ char **content_type)
+{
+ GnomeVFSResult result;
+ GnomeVFSHandle *handle;
+ char *buffer;
+ GnomeVFSFileSize total_bytes_read;
+ GnomeVFSFileSize bytes_read;
+
+ *file_size = 0;
+ *file_contents = NULL;
+
+ /* Open the file. */
+ result = gnome_vfs_open (&handle, uri, GNOME_VFS_OPEN_READ);
+ if (result != GNOME_VFS_OK) {
+ return result;
+ }
+
+ /* Read the whole thing. */
+ buffer = NULL;
+ total_bytes_read = 0;
+ do {
+ buffer = g_realloc (buffer, total_bytes_read + READ_CHUNK_SIZE);
+ result = gnome_vfs_read (handle,
+ buffer + total_bytes_read,
+ READ_CHUNK_SIZE,
+ &bytes_read);
+ if (result != GNOME_VFS_OK && result != GNOME_VFS_ERROR_EOF) {
+ g_free (buffer);
+ gnome_vfs_close (handle);
+ return result;
+ }
+
+ /* Check for overflow. */
+ if (total_bytes_read + bytes_read < total_bytes_read) {
+ g_free (buffer);
+ gnome_vfs_close (handle);
+ return GNOME_VFS_ERROR_TOO_BIG;
+ }
+
+ total_bytes_read += bytes_read;
+ } while (result == GNOME_VFS_OK);
+
+ if (content_type) {
+ GnomeVFSFileInfo *info;
+
+ info = gnome_vfs_file_info_new ();
+ result = gnome_vfs_get_file_info_from_handle (handle, info,
+ GNOME_VFS_FILE_INFO_GET_MIME_TYPE |
+ GNOME_VFS_FILE_INFO_FOLLOW_LINKS);
+ if (result == GNOME_VFS_OK)
+ *content_type = g_strdup (gnome_vfs_file_info_get_mime_type (info));
+ else
+ *content_type = g_strdup ("application/octet-stream");
+
+ gnome_vfs_file_info_unref (info);
+ }
+
+ /* Close the file. */
+ result = gnome_vfs_close (handle);
+ if (result != GNOME_VFS_OK) {
+ g_free (buffer);
+ return result;
+ }
+
+ /* Return the file. */
+ *file_size = total_bytes_read;
+ *file_contents = g_realloc (buffer, total_bytes_read);
+ return GNOME_VFS_OK;
+}
+
+
+static void
+do_send (BonoboObjectClient *bonobo_server)
+{
+ GNOME_Evolution_Composer composer_server;
+ CORBA_Environment ev;
+
+ GNOME_Evolution_Composer_AttachmentData *attach_data;
+
+ GNOME_Evolution_Composer_RecipientList *to_list, *cc_list, *bcc_list;
+
+ composer_server = bonobo_object_corba_objref (BONOBO_OBJECT (bonobo_server));
+
+ CORBA_exception_init (&ev);
+
+ attachments = g_list_reverse (attachments);
+
+ while (attachments) {
+ attachment_t *attachment = attachments->data;
+ GList *temp;
+
+ attach_data = GNOME_Evolution_Composer_AttachmentData__alloc();
+ attach_data->_maximum = attach_data->_length = attachment->size;
+ attach_data->_buffer = CORBA_sequence_CORBA_char_allocbuf (attach_data->_length);
+ strcpy (attach_data->_buffer, attachment->content);
+
+ GNOME_Evolution_Composer_attachData (composer_server,
+ NOTNULL (attachment->content_type),
+ NOTNULL (attachment->basename),
+ NOTNULL (attachment->description),
+ attachment->show_inline,
+ attach_data,
+ &ev);
+
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ g_printerr ("evolution-sendmail.c: I couldn't attach data to the composer via CORBA! Aagh.\n");
+ CORBA_exception_free (&ev);
+ return;
+ }
+
+ CORBA_free (attach_data);
+
+ free_attachment (attachment);
+
+ temp = attachments;
+ attachments = g_list_remove_link (attachments, attachments);
+ g_list_free_1 (temp);
+ }
+
+ to_list = GNOME_Evolution_Composer_RecipientList__alloc ();
+ to_list->_maximum = to_list->_length = 0;
+
+ cc_list = GNOME_Evolution_Composer_RecipientList__alloc ();
+ cc_list->_maximum = cc_list->_length = 0;
+
+ bcc_list = GNOME_Evolution_Composer_RecipientList__alloc ();
+ bcc_list->_maximum = bcc_list->_length = 0;
+
+ GNOME_Evolution_Composer_setHeaders (composer_server, "", to_list, cc_list, bcc_list, NOTNULL (subject), &ev);
+
+ CORBA_free (to_list);
+ CORBA_free (cc_list);
+ CORBA_free (bcc_list);
+
+ GNOME_Evolution_Composer_show (composer_server, &ev);
+
+ if (ev._major != CORBA_NO_EXCEPTION) {
+ g_printerr ("evolution-sendmail.c: I couldn't show the composer via CORBA! Aagh.\n");
+ CORBA_exception_free (&ev);
+ return;
+ }
+
+ CORBA_exception_free (&ev);
+}
+
+
+static BonoboObjectClient *
+get_composer ()
+{
+ BonoboObjectClient *bonobo_server;
+
+ /* First, I obtain an object reference that represents the Shell, to make sure it's running. */
+ bonobo_server = bonobo_object_activate (E_SHELL_OAFIID, 0);
+
+ g_return_val_if_fail (bonobo_server != NULL, NULL);
+
+ /* Next, I obtain an object reference that represents the Composer. */
+ bonobo_server = bonobo_object_activate (COMPOSER_OAFIID, 0);
+
+ return bonobo_server;
+}
+
+static gboolean
+composer_timeout (gpointer data)
+{
+ BonoboObjectClient *bonobo_server;
+
+ bonobo_server = get_composer ();
+
+ if (bonobo_server) {
+ do_send (bonobo_server);
+ gtk_main_quit ();
+ return FALSE;
+ } else {
+ return TRUE;
+ }
+}
+
+static void
+cb (poptContext con,
+ enum poptCallbackReason reason,
+ /*@null@*/ const struct poptOption * opt,
+ /*@null@*/ const char * arg,
+ /*@null@*/ const void * data)
+{
+ const char *name = opt->longName;
+ if (!strcmp (name, "add-attachment")) {
+ attachment_t *new_attach = g_new (attachment_t, 1);
+ new_attach->filename = g_strdup (arg);
+ new_attach->basename = strrchr (new_attach->filename, '/');
+ if (new_attach->basename)
+ new_attach->basename ++;
+ else
+ new_attach->basename = new_attach->filename;
+ new_attach->basename = g_strdup (new_attach->basename);
+ if (new_attach->filename)
+ elc_read_entire_file (new_attach->filename,
+ &new_attach->size,
+ &new_attach->content,
+ &new_attach->content_type);
+ new_attach->description = NULL;
+ new_attach->show_inline = FALSE;
+ if (new_attach->content) {
+ attachments = g_list_prepend (attachments, new_attach);
+ } else {
+ free_attachment (new_attach);
+ }
+ } else if (!strcmp (name, "file-name")) {
+ if (attachments) {
+ attachment_t *attachment = attachments->data;
+ g_free (attachment->basename);
+ attachment->basename = g_strdup (arg);
+ } else {
+ }
+ } else if (!strcmp (name, "content-type")) {
+ if (attachments) {
+ attachment_t *attachment = attachments->data;
+ if (attachment->content_type) {
+ }
+ attachment->content_type = g_strdup (arg);
+ } else {
+ }
+ } else if (!strcmp (name, "description")) {
+ if (attachments) {
+ attachment_t *attachment = attachments->data;
+ if (attachment->description) {
+ }
+ attachment->description = g_strdup (arg);
+ } else {
+ }
+ } else if (!strcmp (name, "show-inline")) {
+ if (attachments) {
+ attachment_t *attachment = attachments->data;
+ if (attachment->show_inline) {
+ }
+ attachment->show_inline = TRUE;
+ } else {
+ }
+ }
+}
+
+static struct poptOption cap_options[] = {
+ { NULL, '\0', POPT_ARG_CALLBACK, cb, 0, NULL, NULL },
+ { "add-attachment", 'a', POPT_ARG_STRING, NULL, 0, N_("An attachment to add."), NULL },
+ { "content-type", 't', POPT_ARG_STRING, NULL, 0, N_("Content type of the attachment."), NULL },
+ { "file-name", 'f', POPT_ARG_STRING, NULL, 0, N_("The filename to display in the mail."), NULL },
+ { "description", 'd', POPT_ARG_STRING, NULL, 0, N_("Description of the attachment."), NULL },
+ { "show-inline", 'i', POPT_ARG_NONE, NULL, 0, N_("Mark attachment to be shown inline by default."), NULL },
+ { "subject", 's', POPT_ARG_STRING, &subject, 0, N_("Default subject for the message."), NULL },
+ { NULL, '\0', 0, NULL, 0 }
+};
+
+int
+main(int argc, char *argv[])
+{
+ BonoboObjectClient *bonobo_server;
+
+ bindtextdomain (PACKAGE, EVOLUTION_LOCALEDIR);
+ textdomain (PACKAGE);
+
+ gnome_vfs_init ();
+
+ gnome_init_with_popt_table ("evolution-launch-composer", VERSION, argc, argv, cap_options, 0, NULL);
+
+ if (bonobo_init (CORBA_OBJECT_NIL, CORBA_OBJECT_NIL, CORBA_OBJECT_NIL) == FALSE)
+ g_error (_("Could not initialize Bonobo"));
+
+ bonobo_server = get_composer ();
+
+ if (bonobo_server) {
+ do_send (bonobo_server);
+ } else {
+ g_timeout_add(1000, composer_timeout, NULL);
+ gtk_main ();
+ }
+
+ return 0;
+}
diff --git a/ui/ChangeLog b/ui/ChangeLog
index efba2fc646..481254c658 100644
--- a/ui/ChangeLog
+++ b/ui/ChangeLog
@@ -1,22 +1,6 @@
-2002-11-20 Ettore Perazzoli <ettore@ximian.com>
+2002-11-03 Jeffrey Stedfast <fejj@ximian.com>
- * evolution-message-composer.xml: Change hlook value for "Toolbar"
- to be "both_horiz".
- * evolution-signature-editor.xml: Likewise.
- * evolution-mail-messagedisplay.xml: Likewise.
- * evolution-event-editor.xml: Likewise.
- * evolution-contact-list-editor.xml: Likewise.
- * evolution-contact-editor.xml: Likewise.
- * evolution-comp-editor.xml: Likewise.
-
-2002-11-20 Ettore Perazzoli <ettore@ximian.com>
-
- * evolution.xml: Change hlook value for Toolbar to be
- "both_horiz".
-
-2002-11-04 Ettore Perazzoli <ettore@ximian.com>
-
- * Makefile.am (uidir): Install in $(datadir)/gnome-2.0/ui.
+ * evolution-mail-message.xml: Fix for bug #33173
2002-10-28 Ettore Perazzoli <ettore@ximian.com>
diff --git a/ui/evolution-mail-message.xml b/ui/evolution-mail-message.xml
index be2e75194e..610c07791d 100644
--- a/ui/evolution-mail-message.xml
+++ b/ui/evolution-mail-message.xml
@@ -91,7 +91,7 @@
accel="*Control*o"/>
<cmd name="MessagePostReply"
- _tip="Post a reply to a message message in a Public folder"
+ _tip="Post a reply to a message in a Public folder"
accel=""
pixtype="pixbuf"/>
diff --git a/widgets/menus/gal-define-views-dialog.c b/widgets/menus/gal-define-views-dialog.c
deleted file mode 100644
index 57ef0738f7..0000000000
--- a/widgets/menus/gal-define-views-dialog.c
+++ /dev/null
@@ -1,337 +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) {
- view = gal_view_factory_new_view(factory,
- name);
- gal_define_views_model_append(GAL_DEFINE_VIEWS_MODEL(dialog->model), view);
- gal_view_edit(view);
- g_object_unref(view);
- }
- 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);
- 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);
- }
-
-}
-
-static void
-gdvd_button_delete_callback(GtkWidget *widget, GalDefineViewsDialog *dialog)
-{
- int row;
- GtkWidget *scrolled;
- ETable *etable;
-
- scrolled = glade_xml_get_widget(dialog->gui, "custom-table");
- etable = e_table_scrolled_get_table(E_TABLE_SCROLLED(scrolled));
- row = e_table_get_cursor_row (E_TABLE(etable));
-
- if (row != -1) {
- gal_define_views_model_delete_view(GAL_DEFINE_VIEWS_MODEL(dialog->model),
- row);
- }
-
-}
-
-static void
-gdvd_button_copy_callback(GtkWidget *widget, GalDefineViewsDialog *dialog)
-{
- int row;
- GtkWidget *scrolled;
- ETable *etable;
-
- scrolled = glade_xml_get_widget(dialog->gui, "custom-table");
- etable = e_table_scrolled_get_table(E_TABLE_SCROLLED(scrolled));
- row = e_table_get_cursor_row (E_TABLE(etable));
-
- if (row != -1) {
- gal_define_views_model_copy_view(GAL_DEFINE_VIEWS_MODEL(dialog->model),
- row);
- }
-
-}
-
-static void
-gdvd_connect_signal(GalDefineViewsDialog *dialog, char *widget_name, char *signal, 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_widget_unparent(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_OK, GTK_RESPONSE_OK,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- 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));
- gdvd_connect_signal(dialog, "button-copy", "clicked", G_CALLBACK(gdvd_button_copy_callback));
-
- 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);
- g_free (text);
- } else {
- gtk_label_set_text (GTK_LABEL (widget),
- _("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 ce5ea5a928..0000000000
--- a/widgets/menus/gal-define-views.glade
+++ /dev/null
@@ -1,287 +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="title" translatable="yes">Define Views for &quot;%s&quot;</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="button7">
- <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">6</property>
- <property name="column_spacing">6</property>
- <property name="n-rows">5</property>
- <property name="n-columns">1</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="GtkFrame" id="frame1">
- <property name="label" translatable="yes">Description</property>
- <property name="label_xalign">0</property>
- <property name="shadow">GTK_SHADOW_ETCHED_IN</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="GtkTable" id="table-description">
- <property name="border_width">6</property>
- <property name="homogeneous">no</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">6</property>
- <property name="n-rows">1</property>
- <property name="n-columns">2</property>
- <property name="visible">yes</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_padding">0</property>
- <property name="y_padding">0</property>
- <property name="x_options">fill</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox1">
- <property name="homogeneous">no</property>
- <property name="spacing">6</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="Custom" id="custom-table">
- <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>
- <property name="visible">yes</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">yes</property>
- <property name="fill">yes</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vbox1">
- <property name="homogeneous">no</property>
- <property name="spacing">6</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="GtkButton" id="button-new">
- <property name="can_focus">yes</property>
- <property name="label" translatable="yes">_New...</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="visible">yes</property>
- <property name="use_underline">yes</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">no</property>
- <property name="fill">no</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkButton" id="button-copy">
- <property name="can_focus">yes</property>
- <property name="label" translatable="yes">_Copy...</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="visible">yes</property>
- <property name="use_underline">yes</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">no</property>
- <property name="fill">no</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkButton" id="button-modify">
- <property name="can_focus">yes</property>
- <property name="label" translatable="yes">_Edit...</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="visible">yes</property>
- <property name="use_underline">yes</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">no</property>
- <property name="fill">no</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkButton" id="button-delete">
- <property name="can_focus">yes</property>
- <property name="label" translatable="yes">_Delete...</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="visible">yes</property>
- <property name="use_underline">yes</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">no</property>
- <property name="fill">no</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">no</property>
- <property name="fill">no</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="x_padding">0</property>
- <property name="y_padding">0</property>
- <property name="x_options">expand|fill</property>
- <property name="y_options">expand|fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHButtonBox" id="hbuttonbox1">
- <property name="layout_style">GTK_BUTTONBOX_END</property>
- <property name="spacing">6</property>
- <property name="visible">yes</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="x_padding">0</property>
- <property name="y_padding">0</property>
- <property name="x_options">fill</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkAlignment" id="alignment3">
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xscale">0</property>
- <property name="yscale">1</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="GtkButton" id="button-reset">
- <property name="can_focus">yes</property>
- <property name="label" translatable="yes">Re_set to Factory Defaults...</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="visible">yes</property>
- <property name="use_underline">yes</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_padding">0</property>
- <property name="y_padding">0</property>
- <property name="x_options">fill</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label-views">
- <property name="label" translatable="yes">Define Views for %s</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">no</property>
- <property name="xalign">0</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="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-collection.c b/widgets/menus/gal-view-collection.c
deleted file mode 100644
index e53b5660f7..0000000000
--- a/widgets/menus/gal-view-collection.c
+++ /dev/null
@@ -1,814 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * gal-view-collection.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#include <config.h>
-
-#include <util/e-i18n.h>
-#include <ctype.h>
-#include <string.h>
-#include <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) 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;
-
- gal_view_collection_changed(item->collection);
-}
-
-/* Use factory list to load a GalView file. */
-static GalView *
-gal_view_collection_real_load_view_from_file (GalViewCollection *collection, const char *type, const char *title, const char *dir, const char *filename)
-{
- GalViewFactory *factory;
- GList *factories;
-
- factory = NULL;
- for (factories = collection->factory_list; factories; factories = factories->next) {
- if (type && !strcmp(gal_view_factory_get_type_code(factories->data), type)) {
- factory = factories->data;
- break;
- }
- }
- if (factory) {
- GalView *view;
-
- view = gal_view_factory_new_view (factory, title);
- gal_view_set_title (view, title);
- gal_view_load(view, filename);
- return view;
- }
- return NULL;
-}
-
-GalView *
-gal_view_collection_load_view_from_file (GalViewCollection *collection, const char *type, const char *filename)
-{
- return gal_view_collection_real_load_view_from_file (collection, type, "", collection->local_dir, filename);
-}
-
-static GalViewCollectionItem *
-load_single_file (GalViewCollection *collection,
- gchar *dir,
- gboolean local,
- xmlNode *node)
-{
- GalViewCollectionItem *item;
- item = g_new(GalViewCollectionItem, 1);
- item->ever_changed = local;
- item->changed = FALSE;
- item->built_in = !local;
- item->id = e_xml_get_string_prop_by_name(node, "id");
- item->filename = e_xml_get_string_prop_by_name(node, "filename");
- item->title = e_xml_get_translated_utf8_string_prop_by_name(node, "title");
- item->type = e_xml_get_string_prop_by_name(node, "type");
- item->collection = collection;
- item->view_changed_id = 0;
-
- if (item->filename) {
- char *fullpath;
- fullpath = g_concat_dir_and_file(dir, item->filename);
- item->view = gal_view_collection_real_load_view_from_file (collection, item->type, item->title, dir, fullpath);
- g_free(fullpath);
- if (item->view) {
- item->view_changed_id =
- 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;
- xmlNode *root;
- xmlNode *child;
- char *filename = g_concat_dir_and_file(dir, "galview.xml");
- char *default_view;
-
- doc = xmlParseFile(filename);
- if (!doc) {
- g_free (filename);
- return;
- }
- root = xmlDocGetRootElement(doc);
- for (child = root->xmlChildrenNode; child; child = child->next) {
- gchar *id;
- 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);
-
- e_create_directory(collection->local_dir);
-
- load_single_dir(collection, collection->local_dir, TRUE);
- load_single_dir(collection, collection->system_dir, FALSE);
- gal_view_collection_changed(collection);
-
- collection->loaded = TRUE;
-}
-
-/**
- * gal_view_collection_save
- * @collection: The view collection to save information for
- *
- * Saves the data to the user directory specified in set storage
- * directories. This is primarily for internal use by other parts of
- * gal_view.
- */
-void
-gal_view_collection_save (GalViewCollection *collection)
-{
- int i;
- xmlDoc *doc;
- xmlNode *root;
- char *filename;
-
- g_return_if_fail (collection != NULL);
- g_return_if_fail (GAL_IS_VIEW_COLLECTION (collection));
- g_return_if_fail (collection->local_dir != NULL);
-
- doc = xmlNewDoc("1.0");
- root = xmlNewNode(NULL, "GalViewCollection");
- xmlDocSetRootElement(doc, root);
-
- if (collection->default_view && !collection->default_view_built_in) {
- e_xml_set_string_prop_by_name(root, "default-view", collection->default_view);
- }
-
- for (i = 0; i < collection->view_count; i++) {
- xmlNode *child;
- GalViewCollectionItem *item;
-
- item = collection->view_data[i];
- if (item->ever_changed) {
- child = xmlNewChild(root, NULL, "GalView", NULL);
- e_xml_set_string_prop_by_name(child, "id", item->id);
- e_xml_set_string_prop_by_name(child, "title", item->title);
- e_xml_set_string_prop_by_name(child, "filename", item->filename);
- e_xml_set_string_prop_by_name(child, "type", item->type);
-
- if (item->changed) {
- filename = g_concat_dir_and_file(collection->local_dir, item->filename);
- gal_view_save(item->view, filename);
- g_free(filename);
- }
- }
- }
- for (i = 0; i < collection->removed_view_count; i++) {
- xmlNode *child;
- GalViewCollectionItem *item;
-
- item = collection->removed_view_data[i];
-
- child = xmlNewChild(root, NULL, "GalView", NULL);
- e_xml_set_string_prop_by_name(child, "id", item->id);
- e_xml_set_string_prop_by_name(child, "title", item->title);
- e_xml_set_string_prop_by_name(child, "type", item->type);
- }
- filename = g_concat_dir_and_file(collection->local_dir, "galview.xml");
- xmlSaveFile(filename, doc);
- xmlFreeDoc(doc);
- g_free(filename);
-}
-
-/**
- * gal_view_collection_get_count
- * @collection: The view collection to count
- *
- * Calculates the number of views in the given collection.
- *
- * Returns: The number of views in the collection.
- */
-gint
-gal_view_collection_get_count (GalViewCollection *collection)
-{
- g_return_val_if_fail (collection != NULL, -1);
- g_return_val_if_fail (GAL_IS_VIEW_COLLECTION (collection), -1);
-
- return collection->view_count;
-}
-
-/**
- * gal_view_collection_get_view
- * @collection: The view collection to query
- * @n: The view to get.
- *
- * Returns: The nth view in the collection
- */
-GalView *
-gal_view_collection_get_view (GalViewCollection *collection,
- int n)
-{
- g_return_val_if_fail (collection != NULL, NULL);
- g_return_val_if_fail (GAL_IS_VIEW_COLLECTION (collection), NULL);
- g_return_val_if_fail (n < collection->view_count, NULL);
- g_return_val_if_fail (n >= 0, NULL);
-
- return collection->view_data[n]->view;
-}
-
-/**
- * gal_view_collection_get_view_item
- * @collection: The view collection to query
- * @n: The view item to get.
- *
- * Returns: The nth view item in the collection
- */
-GalViewCollectionItem *
-gal_view_collection_get_view_item (GalViewCollection *collection,
- int n)
-{
- g_return_val_if_fail (collection != NULL, NULL);
- g_return_val_if_fail (GAL_IS_VIEW_COLLECTION (collection), NULL);
- g_return_val_if_fail(n < collection->view_count, NULL);
- g_return_val_if_fail(n >= 0, NULL);
-
- return collection->view_data[n];
-}
-
-int
-gal_view_collection_get_view_index_by_id (GalViewCollection *collection, const char *view_id)
-{
- int i;
- for (i = 0; i < collection->view_count; i++) {
- if (!strcmp (collection->view_data[i]->id, view_id))
- return i;
- }
- return -1;
-}
-
-char *
-gal_view_collection_get_view_id_by_index (GalViewCollection *collection, int n)
-{
- g_return_val_if_fail (collection != NULL, NULL);
- g_return_val_if_fail (GAL_IS_VIEW_COLLECTION (collection), NULL);
- g_return_val_if_fail(n < collection->view_count, NULL);
- g_return_val_if_fail(n >= 0, NULL);
-
- return g_strdup (collection->view_data[n]->id);
-}
-
-
-void
-gal_view_collection_append (GalViewCollection *collection,
- GalView *view)
-{
- GalViewCollectionItem *item;
-
- g_return_if_fail (collection != NULL);
- g_return_if_fail (GAL_IS_VIEW_COLLECTION (collection));
- g_return_if_fail (view != NULL);
- g_return_if_fail (GAL_IS_VIEW (view));
-
- item = g_new(GalViewCollectionItem, 1);
- item->ever_changed = TRUE;
- item->changed = TRUE;
- item->built_in = FALSE;
- item->title = g_strdup(gal_view_get_title(view));
- item->type = g_strdup(gal_view_get_type_code(view));
- item->id = gal_view_generate_id(collection, view);
- item->filename = g_strdup_printf("%s.galview", item->id);
- item->view = view;
- item->collection = collection;
- 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", __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", __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 c69a624de5..0000000000
--- a/widgets/menus/gal-view-etable.c
+++ /dev/null
@@ -1,302 +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);
- gal_view_changed(GAL_VIEW(view));
-}
-
-static void
-gal_view_etable_edit (GalView *view)
-{
- GalViewEtable *etable_view = GAL_VIEW_ETABLE(view);
- ETableConfig *config;
-
- config = e_table_config_new(etable_view->title,
- etable_view->spec,
- etable_view->state);
-
- 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 785f7eca54..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_widget_unparent(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_OK, GTK_RESPONSE_OK,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- 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 f227a020fd..0000000000
--- a/widgets/menus/gal-view-instance.c
+++ /dev/null
@@ -1,588 +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 <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) 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);
-
- xmlSaveFile(instance->current_view_filename, doc);
- 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;
- xmlNode *root;
- GalView *view = NULL;
-
- 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);
- instance->instance_id = g_strdup (instance_id);
-
- 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", __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)
-{
- const EPopupMenu menu_item_struct =
- E_POPUP_RADIO_ITEM_CC (title,
- fn,
- closure,
- 0,
- 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)
-{
- const 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);
-
- 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 ca4fcdd074..0000000000
--- a/widgets/menus/gal-view-new-dialog.c
+++ /dev/null
@@ -1,283 +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_widget_unparent(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_OK, GTK_RESPONSE_OK,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- NULL);
-
- gtk_window_set_policy(GTK_WINDOW(dialog), FALSE, TRUE, FALSE);
-
- dialog->collection = NULL;
- dialog->selected_factory = NULL;
-}
-
-static void
-gal_view_new_dialog_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 8554c4c5de..0000000000
--- a/widgets/menus/gal-view.c
+++ /dev/null
@@ -1,203 +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
- */
-void
-gal_view_edit (GalView *view)
-{
- g_return_if_fail (view != NULL);
- g_return_if_fail (GAL_IS_VIEW (view));
-
- if (GAL_VIEW_GET_CLASS (view)->edit)
- GAL_VIEW_GET_CLASS (view)->edit (view);
-}
-
-/**
- * gal_view_load
- * @view: The view to load to
- * @filename: The file to load from
- */
-void
-gal_view_load (GalView *view,
- const char *filename)
-{
- g_return_if_fail (view != NULL);
- g_return_if_fail (GAL_IS_VIEW (view));
-
- if (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 5ae99b8535..0000000000
--- a/widgets/menus/gal-view.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * gal-view.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#ifndef _GAL_VIEW_H_
-#define _GAL_VIEW_H_
-
-#include <gtk/gtkobject.h>
-#include <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);
- 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. */
-void gal_view_edit (GalView *view);
-
-/* xml load and save functions */
-void gal_view_load (GalView *view,
- const char *filename);
-void gal_view_save (GalView *view,
- const char *filename);
-
-/* Title functions */
-const char *gal_view_get_title (GalView *view);
-void gal_view_set_title (GalView *view,
- const char *title);
-
-/* View type. */
-const char *gal_view_get_type_code (GalView *view);
-
-/* Cloning the view */
-GalView *gal_view_clone (GalView *view);
-
-/* Changed signal */
-void gal_view_changed (GalView *view);
-
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _GAL_VIEW_H_ */
diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog
index ec3aac924c..e8c71fc29a 100644
--- a/widgets/misc/ChangeLog
+++ b/widgets/misc/ChangeLog
@@ -1,226 +1,13 @@
-2002-12-03 Not Zed <NotZed@Ximian.com>
+2002-11-26 Ettore Perazzoli <ettore@ximian.com>
- * e-search-bar.c (impl_dispose): dispose can be run multiple times
- too ... bloody gobject crap.
+ * e-multi-config-dialog.c (impl_destroy): Unref the
+ list_e_table_model.
-2002-11-27 Not Zed <NotZed@Ximian.com>
+2002-11-04 JP Rosevear <jpr@ximian.com>
- * e-charset-picker.c: Add include of gnome-dialog.h
-
- * *.[ch]: ran fix.sh script over everything.
-
-2002-11-26 Not Zed <NotZed@Ximian.com>
-
- * e-combo-button.c (impl_button_press_event): Dont grab_add
- anymore on the button, gtk_button is changed in gtk2 not to do
- this anymore.
-
-2002-11-15 Chris Toshok <toshok@ximian.com>
-
- * e-clipped-label.c (build_layout): new function, build pango
- layout for string.
- (e_clipped_label_size_request): pango-ize this, make the size
- requested dependent on the label.
- (e_clipped_label_expose): pango-ize this.
- (e_clipped_label_recalc_chars_displayed): pango-ize this.
-
-2002-11-14 Ettore Perazzoli <ettore@ximian.com>
-
- * e-clipped-label.c (e_clipped_label_finalize): New.
- (e_clipped_label_destroy): Removed.
-
- * e-title-bar.c (destroy): Removed.
- (impl_finalize): New.
- (class_init): Install GObject::finalize handler instead of
- GtkObject::destroy handler.
-
-2002-11-14 Ettore Perazzoli <ettore@ximian.com>
-
- * e-filter-bar.c: Changed to use g_object_*() and g_signal_*()
- functions instead of gtk_object_*() and gtk_signal_*().
- (destroy): Removed.
- (dispose): New.
- (class_init): Install GObject::dispose handler instead of
- GtkObject::destroy handler.
-
-2002-11-11 Chris Toshok <toshok@ximian.com>
-
- * e-dateedit.[ch]: port to GObject.
-
-2002-11-11 Ettore Perazzoli <ettore@ximian.com>
-
- * e-multi-config-dialog.c (init): Use GObject functions instead of
- GtkObject throughout.
-
-2002-11-11 Ettore Perazzoli <ettore@ximian.com>
-
- * e-multi-config-dialog.c (impl_destroy): Removed.
- (impl_finalize): New.
- (class_init): Override GObject::finalize, not GtkObject::destroy.
-
- * e-config-page.c (impl_destroy): Removed.
- (impl_finalize): New.
- (class_init): Override GObject::finalize, not GtkObject::destroy.
-
- * e-multi-config-dialog.c: Converted to a GtkDialog subclass
- [instead of GnomeDialog].
-
-2002-11-07 JP Rosevear <jpr@ximian.com>
-
- * e-filter-bar.c: include gnome-dialog.h
-
-2002-11-06 Chris Toshok <toshok@ximian.com>
-
- * .cvsignore: ignore the generated marshal source.
-
- * Makefile.am: add marshal stuff.
-
- * e-util-marshal.list: marshaller list.
-
- * e-search-bar.[ch]: gobjectify this.
-
-2002-11-04 Ettore Perazzoli <ettore@ximian.com>
-
- * e-combo-button.c (impl_expose_event): Use
- gtk_container_propagate_expose().
-
-2002-11-01 Ettore Perazzoli <ettore@ximian.com>
-
- * test-title-bar.c: #include <libgnomeui/gnome-ui-init.h> instead
- of <libgnomeui/gnome-init.h>.
- (main): Use a GtkLabel, not a GtkText.
-
- * test-dropdown-button.c: #include <libgnomeui/gnome-ui-init.h>
- instead of <libgnomeui/gnome-init.h>, and
- <libgnomeui/gnome-stock-icons.h> instead of
- <libgnomeui/gnome-stock.h>.
-
- * test-dateedit.c: #include <libgnomeui/gnome-ui-init.h> instead
- of <libgnomeui/gnome-init.h>.
- (main): Use gnome_program_init().
-
- * test-calendar.c: #include <libgnomeui/gnome-ui-init.h>.
-
- * e-url-entry.c (button_clicked_cb): Pass NULL as the error arg to
- gnome_url_show().
-
- * e-title-bar.c (class_init): GTK2-ified. Use GTK_TYPE_POINTER
- instead of GTK_TYPE_GDK_EVENT.
-
- * e-search-bar.c: Removed #include <libgnome/gnome-defs.h>.
- #include <string.h>.
- (class_init): GTK2-ified.
- (e_search_bar_set_menu): Use GTK_OBJECT_GET_CLASS.
- (e_search_bar_set_option): Likewise.
-
- * e-messagebox.c (e_message_box_class_init): Updated to put
- finalize in GObjectClass intead of GtkObjectClass.
- (e_message_box_finalize): Likewise.
- (e_message_box_construct): Just check if pixmap is NULL, instead
- of pixmap->pixmap.
-
- * e-messagebox.h: No {BEGIN,END}_GNOME_DECLS.
- (e_message_box_get_type): Fix prototype, should return GtkType
- instead of guint.
-
- * e-map.c: Removed e_map_signals, which was unused.
- (e_map_finalize): Update for the fact that finalize is now in
- GObjectClass.
- (e_map_class_init): Likewise. Also GTK2-ify.
- (e_map_draw): Removed.
- (load_map_background): Pass NULL as the gdk_pixbuf_new_from_file()
- error arg.
-
- * e-dropdown-button.c (menu_position_cb): Added arg push_in.
-
- * e-dateedit.c (e_date_edit_class_init): GTK2-ified.
- (e_date_edit_show_date_popup): Constify local variable.
- (e_date_edit_check_date_changed): Likewise.
- (e_date_edit_check_time_changed): Likewise.
- (e_date_edit_check_date_changed): Likewise.
- (field_set_to_none): Constify arg text.
- (e_date_edit_parse_date): Constify arg date_text.
- (e_date_edit_parse_time): Constify arg time_text.
-
- * e-dateedit.h: No {BEGIN,END}_GNOME_DECLS.
-
- * e-combo-button.c (menu_position_func): New arg push_in.
- (impl_draw): Removed.
- (class_init): GTK2-ified.
- (init): style->xthickness instead of style->klass->xthickness.
-
- * e-config-page.c (class_init): GTK2-ified.
-
- * e-clipped-label.c (e_clipped_label_size_request): Use
- gtk_style_get_font().
- (e_clipped_label_recalc_chars_displayed): Likewise.
- (e_clipped_label_expose): Likewise.
-
- * e-charset-picker.c: No #include <libgnome/gnome-defs.h> or
- <libgnome/gnome-i18n.h> or <libgnome/gnome-stock.h>. Also no
- <gal/gunicode.h>. On the other hand, #include <gtk/gtkvbox.h>.
- (e_charset_picker_new): Make locale_charset const.
- (e_charset_picker_bonobo_ui_populate): Make locale_charset const.
-
- * e-cell-percent.c: #include <stdio.h> for sscanf().
-
- * e-cell-percent.h: Removed BEGIN_GNOME_DECLS, END_GNOME_DECLS.
-
- * e-cell-percent.c: Do not #include <libgnomeui/gnome-stock.h>.
-
- * e-cell-date-edit.c: Do not #include <libgnomeui/gnome-stock.h>.
- Added a bunch of #includes for GTK stuff.
- (e_cell_date_edit_on_ok_clicked): Constified variable.
-
- * e-calendar-item.c: Do not #include <libgnome/gnome-defs.h>.
- (e_calendar_item_class_init): Use GTK_TYPE_POINTER instead of
- GTK_TYPE_GDK_POINTER.
- (e_calendar_item_class_init): GTK_CLASS_TYPE() instead of
- object_class->type.
- (e_calendar_item_class_init): No gtk_object_class_add_signals().
- (e_calendar_item_update): style->[xy]thickness instead of
- style->klass->[xy]thickness.
- (e_calendar_item_draw): Likewise.
- (e_calendar_item_draw_month): Likewise.
- (e_calendar_item_draw_month): Likewise.
- (e_calendar_item_recalc_sizes): Likewise.
- (e_calendar_item_convert_position_to_day): Likewise.
- (e_calendar_item_update): Use gtk_style_get_font().
- (e_calendar_item_draw_month): Likewise.
- (e_calendar_item_draw_day_numbers): Likewise.
- (e_calendar_item_convert_position_to_day): Likewise.
- (e_calendar_item_recalc_sizes): Likewise.
- (e_calendar_item_signal_emission_idle_cb): Removed check for
- GTK_OBJECT_DESTROY.
- (e_calendar_item_position_menu): Add push_in arg.
-
- * e-calendar.c (e_calendar_draw): Remove.
- (e_calendar_size_request): style->[xy]thickness instead of
- style->klass->[xy]thickness.
- (e_calendar_size_allocate): Likewise.
- (e_calendar_get_border_size): Likewise.
- (e_calendar_size_allocate): Get font from style with
- gtk_style_get_font().
-
- * e-calendar-item.h: #include <libgnomecanvas/gnome-canvas.h>
- instead of <libgnomeui/gnome-canvas.h>.
- * e-calendar.c: Likewise for
- <libgnomecanvas/gnome-canvas-widget.h>.
-
- * Makefile.am: Don't compile e-bonobo-widget.c, e-bonobo-widget.h.
- [Unused right now, so we can avoid porting until, and if, they are
- needed.]
-
- * e-filter-bar.c: Do not #include <libgnome/gnome-defs.h>. Do not
- #include <libgnomeui/gnome-stock.h>. #include <gtk/gtksignal.h>.
- Also remove gal #includes.
- (do_advanced): Add some GTK_SIGNAL_FUNC() casts.
- (menubar_activated): Likewise.
- (menubar_activated): Likewise.
-
-2002-10-30 Ettore Perazzoli <ettore@ximian.com>
-
- * e-map.h: Do not #include <libgnome/gnome-defs.h>.
+ * e-calendar-item.c (e_calendar_item_ensure_days_visible): set the
+ year when testing end date stuff, don't reset the end month if we
+ couldn't fit the days in the next month
2002-10-28 Jeffrey Stedfast <fejj@ximian.com>
diff --git a/widgets/misc/e-calendar-item.c b/widgets/misc/e-calendar-item.c
index 5431c5c24c..c308552a04 100644
--- a/widgets/misc/e-calendar-item.c
+++ b/widgets/misc/e-calendar-item.c
@@ -37,6 +37,7 @@
#include <gtk/gtkmenuitem.h>
#include <gtk/gtklabel.h>
#include <gtk/gtksignal.h>
+#include <libgnome/gnome-defs.h>
#include <libgnome/gnome-i18n.h>
#include <gal/util/e-util.h>
@@ -213,7 +214,6 @@ static void e_calendar_item_on_menu_item_activate(GtkWidget *menuitem,
static void e_calendar_item_position_menu (GtkMenu *menu,
gint *x,
gint *y,
- gboolean *push_in,
gpointer user_data);
static void e_calendar_item_date_range_changed (ECalendarItem *calitem);
static void e_calendar_item_queue_signal_emission (ECalendarItem *calitem);
@@ -267,7 +267,7 @@ e_calendar_item_class_init (ECalendarItemClass *class)
GtkObjectClass *object_class;
GnomeCanvasItemClass *item_class;
- parent_class = g_type_class_ref(gnome_canvas_item_get_type());
+ parent_class = gtk_type_class (gnome_canvas_item_get_type());
object_class = (GtkObjectClass *) class;
item_class = (GnomeCanvasItemClass *) class;
@@ -291,10 +291,10 @@ e_calendar_item_class_init (ECalendarItemClass *class)
GTK_TYPE_DOUBLE, GTK_ARG_READWRITE,
ARG_Y2);
gtk_object_add_arg_type ("ECalendarItem::font",
- GTK_TYPE_POINTER, GTK_ARG_READWRITE,
+ GTK_TYPE_GDK_FONT, GTK_ARG_READWRITE,
ARG_FONT);
gtk_object_add_arg_type ("ECalendarItem::week_number_font",
- GTK_TYPE_POINTER, GTK_ARG_READWRITE,
+ GTK_TYPE_GDK_FONT, GTK_ARG_READWRITE,
ARG_WEEK_NUMBER_FONT);
gtk_object_add_arg_type ("ECalendarItem::row_height",
GTK_TYPE_INT, GTK_ARG_READABLE,
@@ -339,18 +339,22 @@ e_calendar_item_class_init (ECalendarItemClass *class)
e_calendar_item_signals[DATE_RANGE_CHANGED] =
gtk_signal_new ("date_range_changed",
GTK_RUN_FIRST,
- GTK_CLASS_TYPE (object_class),
- G_STRUCT_OFFSET (ECalendarItemClass, date_range_changed),
+ object_class->type,
+ GTK_SIGNAL_OFFSET (ECalendarItemClass, date_range_changed),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
e_calendar_item_signals[SELECTION_CHANGED] =
gtk_signal_new ("selection_changed",
GTK_RUN_FIRST,
- GTK_CLASS_TYPE (object_class),
- G_STRUCT_OFFSET (ECalendarItemClass, selection_changed),
+ object_class->type,
+ GTK_SIGNAL_OFFSET (ECalendarItemClass, selection_changed),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
+ gtk_object_class_add_signals (object_class, e_calendar_item_signals,
+ LAST_SIGNAL);
+
+
object_class->destroy = e_calendar_item_destroy;
object_class->get_arg = e_calendar_item_get_arg;
object_class->set_arg = e_calendar_item_set_arg;
@@ -733,11 +737,8 @@ e_calendar_item_unrealize (GnomeCanvasItem *item)
colormap = gtk_widget_get_colormap (GTK_WIDGET (item->canvas));
- for (i = 0; i < E_CALENDAR_ITEM_COLOR_LAST; i++) {
- /* FIXME: gdk_colors_free expects gulong* here but the pixel value in GdkColor
- is guint32. GDK bug? */
- gdk_colors_free (colormap, (gulong *) &calitem->colors[i].pixel, 1, 0);
- }
+ for (i = 0; i < E_CALENDAR_ITEM_COLOR_LAST; i++)
+ gdk_colors_free (colormap, &calitem->colors[i].pixel, 1, 0);
if (GNOME_CANVAS_ITEM_CLASS (parent_class)->unrealize)
(* GNOME_CANVAS_ITEM_CLASS (parent_class)->unrealize) (item);
@@ -778,8 +779,8 @@ e_calendar_item_update (GnomeCanvasItem *item,
calitem = E_CALENDAR_ITEM (item);
style = GTK_WIDGET (item->canvas)->style;
- xthickness = style->xthickness;
- ythickness = style->ythickness;
+ xthickness = style->klass->xthickness;
+ ythickness = style->klass->ythickness;
item->x1 = calitem->x1;
item->y1 = calitem->y1;
@@ -830,7 +831,7 @@ e_calendar_item_update (GnomeCanvasItem *item,
font = calitem->font;
if (!font)
- font = gtk_style_get_font (style);
+ font = style->font;
char_height = font->ascent + font->descent;
calitem->month_width = calitem->min_month_width;
@@ -910,10 +911,10 @@ e_calendar_item_draw (GnomeCanvasItem *canvas_item,
style = GTK_WIDGET (canvas_item->canvas)->style;
font = calitem->font;
if (!font)
- font = gtk_style_get_font (style);
+ font = style->font;
char_height = font->ascent + font->descent;
- xthickness = style->xthickness;
- ythickness = style->ythickness;
+ xthickness = style->klass->xthickness;
+ ythickness = style->klass->ythickness;
base_gc = style->base_gc[GTK_STATE_NORMAL];
bg_gc = style->bg_gc[GTK_STATE_NORMAL];
@@ -1009,10 +1010,10 @@ e_calendar_item_draw_month (ECalendarItem *calitem,
style = widget->style;
font = calitem->font;
if (!font)
- font = gtk_style_get_font (style);
+ font = style->font;
char_height = font->ascent + font->descent;
- xthickness = style->xthickness;
- ythickness = style->ythickness;
+ xthickness = style->klass->xthickness;
+ ythickness = style->klass->ythickness;
fg_gc = style->fg_gc[GTK_STATE_NORMAL];
/* Calculate the top-left position of the entire month display. */
@@ -1046,7 +1047,7 @@ e_calendar_item_draw_month (ECalendarItem *calitem,
else
max_x -= E_CALENDAR_ITEM_XPAD_AFTER_MONTH_NAME;
- text_y = month_y + style->ythickness
+ text_y = month_y + style->klass->ythickness
+ E_CALENDAR_ITEM_YPAD_ABOVE_MONTH_NAME;
clip_rect.x = month_x + min_x;
clip_rect.x = MAX (0, clip_rect.x);
@@ -1189,7 +1190,7 @@ e_calendar_item_draw_day_numbers (ECalendarItem *calitem,
style = widget->style;
font = calitem->font;
if (!font)
- font = gtk_style_get_font (style);
+ font = style->font;
wkfont = calitem->week_number_font;
if (!wkfont)
wkfont = font;
@@ -1529,7 +1530,7 @@ e_calendar_item_recalc_sizes (ECalendarItem *calitem)
font = calitem->font;
if (!font)
- font = gtk_style_get_font (style);
+ font = style->font;
wkfont = calitem->week_number_font;
if (!wkfont)
wkfont = font;
@@ -1587,7 +1588,7 @@ e_calendar_item_recalc_sizes (ECalendarItem *calitem)
+ E_CALENDAR_ITEM_XPAD_AFTER_WEEK_NUMBERS + 1;
}
- calitem->min_month_height = style->ythickness * 2
+ calitem->min_month_height = style->klass->ythickness * 2
+ E_CALENDAR_ITEM_YPAD_ABOVE_MONTH_NAME + char_height
+ E_CALENDAR_ITEM_YPAD_BELOW_MONTH_NAME + 1
+ E_CALENDAR_ITEM_YPAD_ABOVE_DAY_LETTERS
@@ -1966,9 +1967,9 @@ e_calendar_item_convert_position_to_day (ECalendarItem *calitem,
item = GNOME_CANVAS_ITEM (calitem);
widget = GTK_WIDGET (item->canvas);
style = widget->style;
- char_height = gtk_style_get_font (style)->ascent + gtk_style_get_font (style)->descent;
- xthickness = style->xthickness;
- ythickness = style->ythickness;
+ char_height = style->font->ascent + style->font->descent;
+ xthickness = style->klass->xthickness;
+ ythickness = style->klass->ythickness;
*entire_week = FALSE;
@@ -2707,6 +2708,7 @@ e_calendar_item_ensure_days_visible (ECalendarItem *calitem,
/* First we see if the end of the selection will fit in the
leftover days of the month after the last one shown. */
+ calitem->year = end_year;
calitem->month += (months_shown - 1);
e_calendar_item_normalize_date (calitem, &calitem->year,
&calitem->month);
@@ -2722,8 +2724,6 @@ e_calendar_item_ensure_days_visible (ECalendarItem *calitem,
calitem->year = end_year;
calitem->month = end_month - months_shown + 1;
- } else {
- calitem->month -= (months_shown - 1);
}
e_calendar_item_normalize_date (calitem, &calitem->year,
@@ -2783,9 +2783,9 @@ e_calendar_item_show_popup_menu (ECalendarItem *calitem,
submenu = gtk_menu_new ();
gtk_menu_item_set_submenu (GTK_MENU_ITEM (menuitem), submenu);
- g_object_set_data(G_OBJECT(submenu), "year",
+ gtk_object_set_data (GTK_OBJECT (submenu), "year",
GINT_TO_POINTER (year));
- g_object_set_data(G_OBJECT(submenu), "month_offset",
+ gtk_object_set_data (GTK_OBJECT (submenu), "month_offset",
GINT_TO_POINTER (month_offset));
for (month = 0; month < 12; month++) {
@@ -2806,17 +2806,17 @@ e_calendar_item_show_popup_menu (ECalendarItem *calitem,
gtk_widget_show (label);
gtk_container_add (GTK_CONTAINER (menuitem), label);
- g_object_set_data(G_OBJECT(menuitem), "month",
+ gtk_object_set_data (GTK_OBJECT (menuitem), "month",
GINT_TO_POINTER (month));
- g_signal_connect((menuitem), "activate",
- G_CALLBACK (e_calendar_item_on_menu_item_activate), calitem);
+ gtk_signal_connect (GTK_OBJECT (menuitem), "activate",
+ GTK_SIGNAL_FUNC (e_calendar_item_on_menu_item_activate), calitem);
}
}
/* Run the menu modal so we can destroy it after. */
- g_signal_connect((menu), "deactivate",
- G_CALLBACK (gtk_main_quit), NULL);
+ gtk_signal_connect (GTK_OBJECT (menu), "deactivate",
+ GTK_SIGNAL_FUNC (gtk_main_quit), NULL);
gtk_menu_popup (GTK_MENU (menu), NULL, NULL,
e_calendar_item_position_menu, calitem,
event->button, event->time);
@@ -2833,9 +2833,9 @@ e_calendar_item_on_menu_item_activate (GtkWidget *menuitem,
{
gint year, month_offset, month;
- year = GPOINTER_TO_INT (g_object_get_data(G_OBJECT(menuitem->parent), "year"));
- month_offset = GPOINTER_TO_INT (g_object_get_data(G_OBJECT(menuitem->parent), "month_offset"));
- month = GPOINTER_TO_INT (g_object_get_data(G_OBJECT(menuitem), "month"));
+ year = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (menuitem->parent), "year"));
+ month_offset = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (menuitem->parent), "month_offset"));
+ month = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (menuitem), "month"));
month -= month_offset;
e_calendar_item_normalize_date (calitem, &year, &month);
@@ -2847,7 +2847,6 @@ static void
e_calendar_item_position_menu (GtkMenu *menu,
gint *x,
gint *y,
- gboolean *push_in,
gpointer user_data)
{
GtkRequisition requisition;
@@ -2918,7 +2917,7 @@ e_calendar_item_signal_emission_idle_cb (gpointer data)
/* We ref the calitem & check in case it gets destroyed, since we
were getting a free memory write here. */
- g_object_ref((calitem));
+ gtk_object_ref (GTK_OBJECT (calitem));
if (calitem->date_range_changed) {
calitem->date_range_changed = FALSE;
@@ -2926,13 +2925,15 @@ e_calendar_item_signal_emission_idle_cb (gpointer data)
e_calendar_item_signals[DATE_RANGE_CHANGED]);
}
- if (calitem->selection_changed) {
+ if (GTK_OBJECT_DESTROYED (calitem)) {
+ g_warning ("e_calendar_item_signal_emission_idle_cb: item destroyed");
+ } else if (calitem->selection_changed) {
calitem->selection_changed = FALSE;
gtk_signal_emit (GTK_OBJECT (calitem),
e_calendar_item_signals[SELECTION_CHANGED]);
}
- g_object_unref((calitem));
+ gtk_object_unref (GTK_OBJECT (calitem));
GDK_THREADS_LEAVE ();
return FALSE;
diff --git a/widgets/misc/e-canvas-background.c b/widgets/misc/e-canvas-background.c
deleted file mode 100644
index d2d68d180f..0000000000
--- a/widgets/misc/e-canvas-background.c
+++ /dev/null
@@ -1,495 +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_pointer (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_pointer (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_pointer ("fill_color_gdk",
- _( "GDK fill color" ),
- _( "GDK fill 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 310ae9a01a..0000000000
--- a/widgets/misc/e-canvas.c
+++ /dev/null
@@ -1,1168 +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>
-
-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;
-#ifdef GAL_GDK_IM
- canvas->ic = NULL;
- canvas->ic_attr = NULL;
-#endif
- 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->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;
- }
-
- 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 = *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);
-
-#ifndef NO_WARNINGS
-#warning FIXME - needs thought
-#endif
-#if 0
- if (GTK_OBJECT_DESTROYED (item))
- finished = TRUE;
-#endif
-
- parent = item->parent;
- g_object_unref (item);
-
- item = parent;
- }
-
- return finished;
-}
-
-/* Key event handler for the canvas */
-static gint
-e_canvas_key (GtkWidget *widget, GdkEventKey *event)
-{
- GnomeCanvas *canvas;
- GdkEvent full_event;
-
- g_return_val_if_fail (widget != NULL, FALSE);
- g_return_val_if_fail (GNOME_IS_CANVAS (widget), FALSE);
- g_return_val_if_fail (event != NULL, FALSE);
-
- canvas = GNOME_CANVAS (widget);
-
- full_event.key = *event;
-
- return emit_event (canvas, &full_event);
-}
-
-
-/* This routine invokes the point method of the item. The argument x, y should
- * be in the parent's item-relative coordinate system. This routine applies the
- * inverse of the item's transform, maintaining the affine invariant.
- */
-#define HACKISH_AFFINE
-
-static double
-gnome_canvas_item_invoke_point (GnomeCanvasItem *item, double x, double y, int cx, int cy,
- GnomeCanvasItem **actual_item)
-{
-#ifdef HACKISH_AFFINE
- double i2w[6], w2c[6], i2c[6], c2i[6];
- ArtPoint c, i;
-#endif
-
-#ifdef HACKISH_AFFINE
- gnome_canvas_item_i2w_affine (item, i2w);
- gnome_canvas_w2c_affine (item->canvas, w2c);
- art_affine_multiply (i2c, i2w, w2c);
- art_affine_invert (c2i, i2c);
- c.x = cx;
- c.y = cy;
- art_affine_point (&i, &c, c2i);
- x = i.x;
- y = i.y;
-#endif
-
- return (* GNOME_CANVAS_ITEM_CLASS (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);
-
-#ifdef GAL_GDK_IM
- if (ecanvas->ic)
- gdk_im_begin (ecanvas->ic, canvas->layout.bin_window);
-#endif
-
- 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);
-
-#ifdef GAL_GDK_IM
- if (ecanvas->ic)
- gdk_im_end ();
-#endif
-
- 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)
-{
- gint width, height;
-#ifdef GAL_GDK_IM
- ECanvas *ecanvas = E_CANVAS (widget);
-#endif
-
- 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);
-
-#ifdef GAL_GDK_IM
- if (gdk_im_ready () && (ecanvas->ic_attr = gdk_ic_attr_new ()) != NULL) {
- GdkEventMask mask;
- GdkICAttr *attr = ecanvas->ic_attr;
- GdkICAttributesType attrmask = GDK_IC_ALL_REQ;
- GdkIMStyle style;
- GdkIMStyle supported_style = GDK_IM_PREEDIT_NONE |
- GDK_IM_PREEDIT_NOTHING |
- GDK_IM_PREEDIT_POSITION |
- GDK_IM_STATUS_NONE |
- GDK_IM_STATUS_NOTHING;
-
- if(widget->style && widget->style->font->type != GDK_FONT_FONTSET)
- supported_style &= ~GDK_IM_PREEDIT_POSITION;
-
- attr->style = style = gdk_im_decide_style (supported_style);
- attr->client_window = ecanvas->parent.layout.bin_window;
-
- switch (style & GDK_IM_PREEDIT_MASK)
- {
- case GDK_IM_PREEDIT_POSITION:
- if (widget->style && widget->style->font->type != GDK_FONT_FONTSET)
- {
- g_warning ("over-the-spot style requires fontset");
- break;
- }
-
- gdk_window_get_size (attr->client_window, &width, &height);
- height = widget->style->font->ascent +
- widget->style->font->descent;
-
- attrmask |= GDK_IC_PREEDIT_POSITION_REQ;
- attr->spot_location.x = 0;
- attr->spot_location.y = height;
- attr->preedit_area.x = 0;
- attr->preedit_area.y = 0;
- attr->preedit_area.width = width;
- attr->preedit_area.height = height;
- attr->preedit_fontset = widget->style->font;
-
- break;
- }
-
- ecanvas->ic = gdk_ic_new (attr, attrmask);
- if (ecanvas->ic != NULL) {
- mask = gdk_window_get_events (attr->client_window);
- mask |= gdk_ic_get_events (ecanvas->ic);
- gdk_window_set_events (attr->client_window, mask);
-
- if (GTK_WIDGET_HAS_FOCUS (widget))
- gdk_im_begin (ecanvas->ic, attr->client_window);
- } else
- g_warning ("Can't create input context.");
- }
-#endif
-}
-
-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;
- }
-
-#ifdef GAL_GDK_IM
- if (ecanvas->ic) {
- gdk_ic_destroy (ecanvas->ic);
- ecanvas->ic = NULL;
- }
- if (ecanvas->ic_attr) {
- gdk_ic_attr_destroy (ecanvas->ic_attr);
- ecanvas->ic_attr = NULL;
- }
-#endif
- 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 5cdcc4ab90..0000000000
--- a/widgets/misc/e-canvas.h
+++ /dev/null
@@ -1,158 +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 <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;
-#ifdef GAL_GDK_IM
- /* Input context for dead key support */
- GdkIC *ic;
- GdkICAttr *ic_attr;
-#endif
-
- 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 e91dfb5f9d..0000000000
--- a/widgets/misc/e-gui-utils.c
+++ /dev/null
@@ -1,265 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-gui-utils.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Miguel de Icaza <miguel@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#include <config.h>
-
-#include "e-gui-utils.h"
-
-#include <gtk/gtkentry.h>
-#include <gtk/gtksignal.h>
-#include <gtk/gtkmessagedialog.h>
-#include <gdk-pixbuf/gdk-pixbuf.h>
-#include <libgnomecanvas/gnome-canvas-pixbuf.h>
-
-/* should probably just deprecate/remove this and have callers change
- to using gtk_message_dialog_new */
-/* This should probably be moved into evolution/e-util */
-void
-e_notice (GtkWindow *parent, GtkMessageType type, const char *format, ...)
-{
- GtkWidget *dialog;
- va_list args;
- char *str;
-
- va_start (args, format);
- str = g_strdup_vprintf (format, args);
- dialog = gtk_message_dialog_new (parent, GTK_DIALOG_DESTROY_WITH_PARENT, type,
- GTK_BUTTONS_CLOSE,
- "%s",
- str);
- va_end (args);
- g_free (str);
-
- g_signal_connect_swapped (dialog, "response", G_CALLBACK (gtk_widget_destroy), dialog);
- gtk_widget_show (dialog);
-}
-
-static void
-kill_popup_menu (GtkWidget *widget, GtkMenu *menu)
-{
- g_return_if_fail (menu != NULL);
- g_return_if_fail (GTK_IS_MENU (menu));
-
- g_object_unref (menu);
-}
-
-void
-e_auto_kill_popup_menu_on_hide (GtkMenu *menu)
-{
- g_return_if_fail (menu != NULL);
- g_return_if_fail (GTK_IS_MENU (menu));
-
- g_signal_connect (menu, "hide",
- G_CALLBACK (kill_popup_menu), menu);
-}
-
-void
-e_popup_menu (GtkMenu *menu, GdkEvent *event)
-{
- g_return_if_fail (menu != NULL);
- g_return_if_fail (GTK_IS_MENU (menu));
-
- e_auto_kill_popup_menu_on_hide (menu);
-
- if (event->type == GDK_KEY_PRESS)
- gtk_menu_popup (menu, NULL, NULL, 0, NULL, 0, event->key.time);
- else if ((event->type == GDK_BUTTON_PRESS) ||
- (event->type == GDK_BUTTON_RELEASE) ||
- (event->type == GDK_2BUTTON_PRESS) ||
- (event->type == GDK_3BUTTON_PRESS)){
- gtk_menu_popup (menu, NULL, NULL, 0, NULL, event->button.button, event->button.time);
- } else
- gtk_menu_popup (menu, NULL, NULL, 0, NULL, 0, GDK_CURRENT_TIME);
-}
-
-typedef struct {
- GtkCallback callback;
- gpointer closure;
-} CallbackClosure;
-
-static void
-e_container_foreach_leaf_callback(GtkWidget *widget, CallbackClosure *callback_closure)
-{
- if (GTK_IS_CONTAINER(widget)) {
- e_container_foreach_leaf(GTK_CONTAINER(widget), callback_closure->callback, callback_closure->closure);
- } else {
- (*callback_closure->callback) (widget, callback_closure->closure);
- }
-}
-
-void
-e_container_foreach_leaf(GtkContainer *container,
- GtkCallback callback,
- gpointer closure)
-{
- CallbackClosure callback_closure;
- callback_closure.callback = callback;
- callback_closure.closure = closure;
- gtk_container_foreach(container, (GtkCallback) e_container_foreach_leaf_callback, &callback_closure);
-}
-
-static void
-e_container_change_tab_order_destroy_notify(gpointer data)
-{
- GList *list = data;
- g_list_foreach(list, (GFunc) 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 b401748e20..0000000000
--- a/widgets/misc/e-gui-utils.h
+++ /dev/null
@@ -1,61 +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 <gtk/gtkmessagedialog.h>
-#include <glade/glade-xml.h>
-
-G_BEGIN_DECLS
-
-void e_popup_menu (GtkMenu *menu,
- GdkEvent *event);
-void e_auto_kill_popup_menu_on_hide (GtkMenu *menu);
-void e_notice (GtkWindow *window,
- GtkMessageType type,
- const char *format,
- ...);
-void e_container_foreach_leaf (GtkContainer *container,
- GtkCallback callback,
- gpointer closure);
-void e_container_focus_nth_entry (GtkContainer *container,
- int n);
-gint e_container_change_tab_order (GtkContainer *container,
- GList *widgets);
-/* Returns TRUE on success. */
-gboolean e_glade_xml_connect_widget (GladeXML *gui,
- char *name,
- char *signal,
- GtkSignalFunc cb,
- gpointer closure);
-gboolean e_glade_xml_set_sensitive (GladeXML *gui,
- char *name,
- gboolean sensitive);
-
-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-multi-config-dialog.c b/widgets/misc/e-multi-config-dialog.c
index c0f6e3066f..847789c70c 100644
--- a/widgets/misc/e-multi-config-dialog.c
+++ b/widgets/misc/e-multi-config-dialog.c
@@ -37,8 +37,8 @@
#include <gdk-pixbuf/gdk-pixbuf.h>
-#define PARENT_TYPE gtk_dialog_get_type ()
-static GtkDialogClass *parent_class = NULL;
+#define PARENT_TYPE gnome_dialog_get_type ()
+static GnomeDialogClass *parent_class = NULL;
#define SWITCH_PAGE_INTERVAL 250
@@ -93,11 +93,11 @@ update_buttons (EMultiConfigDialog *dialog)
priv = dialog->priv;
if (priv->num_unapplied > 0) {
- gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, TRUE);
- gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_APPLY, TRUE);
+ gnome_dialog_set_sensitive (GNOME_DIALOG (dialog), 0, TRUE); /* OK */
+ gnome_dialog_set_sensitive (GNOME_DIALOG (dialog), 1, TRUE); /* Apply */
} else {
- gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, FALSE);
- gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_APPLY, FALSE);
+ gnome_dialog_set_sensitive (GNOME_DIALOG (dialog), 0, FALSE); /* OK */
+ gnome_dialog_set_sensitive (GNOME_DIALOG (dialog), 1, FALSE); /* Apply */
}
}
@@ -175,7 +175,7 @@ set_page_timeout_callback (void *data)
static void
do_close (EMultiConfigDialog *dialog)
{
- gtk_widget_destroy (GTK_WIDGET (dialog));
+ gnome_dialog_close (GNOME_DIALOG (dialog));
}
static void
@@ -231,10 +231,10 @@ table_cursor_change_callback (ETable *etable,
}
-/* GObject methods. */
+/* GtkObject methods. */
static void
-impl_finalize (GObject *object)
+impl_destroy (GtkObject *object)
{
EMultiConfigDialog *dialog;
EMultiConfigDialogPrivate *priv;
@@ -245,19 +245,22 @@ impl_finalize (GObject *object)
if (priv->set_page_timeout_id != 0)
g_source_remove (priv->set_page_timeout_id);
+ if (priv->list_e_table_model != NULL)
+ gtk_object_unref (GTK_OBJECT (priv->list_e_table_model));
+
g_slist_free (priv->pages);
g_free (priv);
- (* G_OBJECT_CLASS (parent_class)->finalize) (object);
+ (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
}
-/* GtkDialog methods. */
+/* GnomeDialog methods. */
static void
-impl_response (GtkDialog *dialog,
- int response_id)
+impl_clicked (GnomeDialog *dialog,
+ int button_number)
{
EMultiConfigDialog *multi_config_dialog;
EMultiConfigDialogPrivate *priv;
@@ -265,14 +268,14 @@ impl_response (GtkDialog *dialog,
multi_config_dialog = E_MULTI_CONFIG_DIALOG (dialog);
priv = multi_config_dialog->priv;
- switch (response_id) {
- case GTK_RESPONSE_OK:
+ switch (button_number) {
+ case 0: /* OK */
do_ok (multi_config_dialog);
break;
- case GTK_RESPONSE_APPLY:
+ case 1: /* Apply */
do_apply (multi_config_dialog);
break;
- case GTK_RESPONSE_CLOSE:
+ case 2: /* Close */
do_close (multi_config_dialog);
break;
default:
@@ -281,21 +284,21 @@ impl_response (GtkDialog *dialog,
}
-/* GObject ctors. */
+/* GTK+ ctors. */
static void
class_init (EMultiConfigDialogClass *class)
{
- GObjectClass *object_class;
- GtkDialogClass *dialog_class;
+ GnomeDialogClass *dialog_class;
+ GtkObjectClass *object_class;
- object_class = G_OBJECT_CLASS (class);
- object_class->finalize = impl_finalize;
+ object_class = GTK_OBJECT_CLASS (class);
+ object_class->destroy = impl_destroy;
- dialog_class = GTK_DIALOG_CLASS (class);
- dialog_class->response = impl_response;
+ dialog_class = GNOME_DIALOG_CLASS (class);
+ dialog_class->clicked = impl_clicked;
- parent_class = g_type_class_ref(PARENT_TYPE);
+ parent_class = gtk_type_class (PARENT_TYPE);
}
#define RGB_COLOR(color) (((color).red & 0xff00) << 8 | \
@@ -328,7 +331,7 @@ fill_in_pixbufs (EMultiConfigDialog *dialog, int row)
1,
colors[i], colors[i]);
e_table_model_set_value_at (dialog->priv->list_e_table_model, i + 2, row, pixbuf);
- g_object_unref(pixbuf);
+ gdk_pixbuf_unref(pixbuf);
}
}
@@ -358,7 +361,7 @@ init (EMultiConfigDialog *multi_config_dialog)
{
EMultiConfigDialogPrivate *priv;
ETableModel *list_e_table_model;
- GtkWidget *dialog_vbox;
+ GtkWidget *gnome_dialog_vbox;
GtkWidget *hbox;
GtkWidget *notebook;
GtkWidget *list_e_table;
@@ -368,38 +371,40 @@ init (EMultiConfigDialog *multi_config_dialog)
ECell *vbox;
hbox = gtk_hbox_new (FALSE, 2);
- dialog_vbox = GTK_DIALOG (multi_config_dialog)->vbox;
- gtk_container_add (GTK_CONTAINER (dialog_vbox), hbox);
+ gnome_dialog_vbox = GNOME_DIALOG (multi_config_dialog)->vbox;
+ gtk_container_add (GTK_CONTAINER (gnome_dialog_vbox), hbox);
list_e_table_model = e_table_memory_store_new (columns);
vbox = e_cell_vbox_new ();
pixbuf = e_cell_pixbuf_new();
- g_object_set (G_OBJECT (pixbuf),
- "focused_column", 2,
- "selected_column", 3,
- "unselected_column", 4,
- NULL);
+ gtk_object_set (GTK_OBJECT (pixbuf),
+ "focused_column", 2,
+ "selected_column", 3,
+ "unselected_column", 4,
+ NULL);
e_cell_vbox_append (E_CELL_VBOX (vbox), pixbuf, 1);
- g_object_unref (pixbuf);
+ gtk_object_unref (GTK_OBJECT (pixbuf));
text = e_cell_text_new (NULL, GTK_JUSTIFY_CENTER);
e_cell_vbox_append (E_CELL_VBOX (vbox), text, 0);
- g_object_unref (text);
+ gtk_object_unref (GTK_OBJECT (text));
extras = e_table_extras_new ();
e_table_extras_add_cell (extras, "vbox", vbox);
list_e_table = e_table_scrolled_new (list_e_table_model, extras, list_e_table_spec, NULL);
e_scroll_frame_set_policy (E_SCROLL_FRAME (list_e_table), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
- g_signal_connect (e_table_scrolled_get_table (E_TABLE_SCROLLED (list_e_table)),
- "cursor_change", G_CALLBACK (table_cursor_change_callback), multi_config_dialog);
+ gtk_signal_connect (GTK_OBJECT (e_table_scrolled_get_table (E_TABLE_SCROLLED (list_e_table))),
+ "cursor_change", GTK_SIGNAL_FUNC (table_cursor_change_callback),
+ multi_config_dialog);
- g_signal_connect (e_table_scrolled_get_table (E_TABLE_SCROLLED (list_e_table))->table_canvas,
- "realize", G_CALLBACK (canvas_realize), multi_config_dialog);
+ gtk_signal_connect (GTK_OBJECT (e_table_scrolled_get_table (E_TABLE_SCROLLED (list_e_table))->table_canvas),
+ "realize", GTK_SIGNAL_FUNC (canvas_realize),
+ multi_config_dialog);
- g_object_unref (extras);
+ gtk_object_unref (GTK_OBJECT (extras));
gtk_box_pack_start (GTK_BOX (hbox), list_e_table, FALSE, TRUE, 0);
@@ -412,13 +417,12 @@ init (EMultiConfigDialog *multi_config_dialog)
gtk_widget_show (notebook);
gtk_widget_show (list_e_table);
- gtk_dialog_add_buttons (GTK_DIALOG (multi_config_dialog),
- GTK_STOCK_OK, GTK_RESPONSE_OK,
- GTK_STOCK_APPLY, GTK_RESPONSE_APPLY,
- GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE,
- NULL);
- gtk_dialog_set_default_response (GTK_DIALOG (multi_config_dialog), GTK_RESPONSE_OK);
-
+ gnome_dialog_append_buttons (GNOME_DIALOG (multi_config_dialog),
+ GNOME_STOCK_BUTTON_OK,
+ GNOME_STOCK_BUTTON_APPLY,
+ GNOME_STOCK_BUTTON_CLOSE,
+ NULL);
+ gnome_dialog_set_default (GNOME_DIALOG (multi_config_dialog), 0);
gtk_window_set_policy (GTK_WINDOW (multi_config_dialog),
FALSE /* allow_shrink */,
@@ -490,7 +494,8 @@ e_multi_config_dialog_add_page (EMultiConfigDialog *dialog,
if (! e_config_page_is_applied (page_widget))
priv->num_unapplied ++;
- g_signal_connect (page_widget, "changed", G_CALLBACK (page_changed_callback), dialog);
+ gtk_signal_connect (GTK_OBJECT (page_widget), "changed",
+ GTK_SIGNAL_FUNC (page_changed_callback), dialog);
update_buttons (dialog);
}
diff --git a/widgets/misc/e-popup-menu.c b/widgets/misc/e-popup-menu.c
deleted file mode 100644
index b8745625ca..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_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_append (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 489a18b7e1..0000000000
--- a/widgets/misc/e-reflow-model.c
+++ /dev/null
@@ -1,285 +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,
- MODEL_ITEMS_INSERTED,
- MODEL_ITEM_CHANGED,
- LAST_SIGNAL
-};
-
-static guint e_reflow_model_signals [LAST_SIGNAL] = { 0, };
-
-/**
- * e_reflow_model_set_width:
- * @e_reflow_model: The e-reflow-model to operate on
- * @width: The new value for the width of each item.
- */
-void
-e_reflow_model_set_width (EReflowModel *e_reflow_model, int width)
-{
- g_return_if_fail (e_reflow_model != NULL);
- g_return_if_fail (E_IS_REFLOW_MODEL (e_reflow_model));
-
- 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 [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);
-
- klass->set_width = NULL;
- klass->count = NULL;
- klass->height = NULL;
- klass->incarnate = NULL;
- klass->reincarnate = NULL;
-
- klass->model_changed = NULL;
- klass->model_items_inserted = NULL;
- klass->model_item_changed = NULL;
-}
-
-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_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_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 b755cee447..0000000000
--- a/widgets/misc/e-reflow-model.h
+++ /dev/null
@@ -1,106 +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 only in an item: item_changed
- */
- void (*model_changed) (EReflowModel *etm);
- void (*model_items_inserted) (EReflowModel *etm, int position, int count);
- void (*model_item_changed) (EReflowModel *etm, int n);
-} EReflowModelClass;
-
-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_items_inserted (EReflowModel *e_reflow_model,
- int position,
- int count);
-void e_reflow_model_item_changed (EReflowModel *e_reflow_model,
- int n);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _E_REFLOW_MODEL_H_ */
diff --git a/widgets/misc/e-reflow.c b/widgets/misc/e-reflow.c
deleted file mode 100644
index e70cd61d0b..0000000000
--- a/widgets/misc/e-reflow.c
+++ /dev/null
@@ -1,1414 +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 i;
- int column_count;
- double running_height;
-
- g_free (reflow->columns);
- reflow->column_count = 0;
- reflow->columns = NULL;
-
- list = NULL;
-
- running_height = E_REFLOW_BORDER_WIDTH;
- column_count = 1;
-
- count = reflow->count;
- for (i = 0; i < count; i++) {
- int unsorted = e_sorter_sorted_to_model (E_SORTER (reflow->sorter), i);
- if (reflow->heights[unsorted] == -1) {
- if (reflow->model)
- reflow->heights[unsorted] = e_reflow_model_height (reflow->model, unsorted, GNOME_CANVAS_GROUP (reflow));
- else
- reflow->heights[unsorted] = 0;
- }
- if (i != 0 && running_height + reflow->heights[unsorted] + E_REFLOW_BORDER_WIDTH > reflow->height) {
- list = g_slist_prepend (list, GINT_TO_POINTER(i));
- column_count ++;
- running_height = E_REFLOW_BORDER_WIDTH * 2 + reflow->heights[unsorted];
- } else
- running_height += reflow->heights[unsorted] + E_REFLOW_BORDER_WIDTH;
- }
-
- reflow->column_count = column_count;
- reflow->columns = g_new (int, column_count);
- column_count --;
- for (; column_count > 0; column_count--) {
- GSList *to_free;
- reflow->columns[column_count] = GPOINTER_TO_INT(list->data);
- to_free = list;
- list = list->next;
- g_slist_free_1 (to_free);
- }
- reflow->columns[0] = 0;
-
- queue_incarnate (reflow);
-
- reflow->need_reflow_columns = FALSE;
-}
-
-static void
-item_changed (EReflowModel *model, int i, EReflow *reflow)
-{
- if (i < 0 || i >= reflow->count)
- return;
-
- reflow->heights[i] = -1;
- if (reflow->items[i] != NULL)
- e_reflow_model_reincarnate (model, i, reflow->items[i]);
- e_sorter_array_clean (reflow->sorter);
- reflow->need_reflow_columns = TRUE;
- e_canvas_item_request_reflow(GNOME_CANVAS_ITEM (reflow));
-}
-
-static void
-items_inserted (EReflowModel *model, int position, int count, EReflow *reflow)
-{
- int i;
- int oldcount;
- if (position < 0 || position > reflow->count)
- return;
-
- oldcount = reflow->count;
-
- reflow->count += count;
-
- if (reflow->count > reflow->allocated_count) {
- while (reflow->count > reflow->allocated_count)
- reflow->allocated_count += 256;
- reflow->heights = g_renew (int, reflow->heights, reflow->allocated_count);
- reflow->items = g_renew (GnomeCanvasItem *, reflow->items, reflow->allocated_count);
- }
- memmove (reflow->heights + position + count, reflow->heights + position, (reflow->count - position - count) * sizeof (int));
- memmove (reflow->items + position + count, reflow->items + position, (reflow->count - position - count) * sizeof (GnomeCanvasItem *));
- for (i = position; i < position + count; i++) {
- reflow->items[i] = 0;
- reflow->heights[i] = -1;
- }
-
- e_selection_model_simple_set_row_count (E_SELECTION_MODEL_SIMPLE (reflow->selection), reflow->count);
- if (position == oldcount)
- e_sorter_array_append (reflow->sorter, count);
- else
- e_sorter_array_set_count (reflow->sorter, reflow->count);
- reflow->need_reflow_columns = TRUE;
- set_empty (reflow);
- e_canvas_item_request_reflow(GNOME_CANVAS_ITEM (reflow));
-}
-
-static void
-model_changed (EReflowModel *model, EReflow *reflow)
-{
- int i;
- int count;
- int oldcount;
-
- count = reflow->count;
- oldcount = count;
-
- for (i = 0; i < count; i++) {
- if (reflow->items[i])
- gtk_object_destroy (GTK_OBJECT (reflow->items[i]));
- }
- g_free (reflow->items);
- g_free (reflow->heights);
- reflow->count = e_reflow_model_count (model);
- reflow->allocated_count = reflow->count;
- reflow->items = g_new (GnomeCanvasItem *, reflow->count);
- reflow->heights = g_new (int, reflow->count);
-
- count = reflow->count;
- for (i = 0; i < count; i++) {
- reflow->items[i] = 0;
- reflow->heights[i] = -1;
- }
-
- e_selection_model_simple_set_row_count (E_SELECTION_MODEL_SIMPLE (reflow->selection), count);
- e_sorter_array_set_count (reflow->sorter, reflow->count);
-
- reflow->need_reflow_columns = TRUE;
- if (oldcount > reflow->count)
- reflow_columns (reflow);
- set_empty (reflow);
- e_canvas_item_request_reflow(GNOME_CANVAS_ITEM (reflow));
-}
-
-static void
-set_empty(EReflow *reflow)
-{
- if (reflow->count == 0) {
- if (reflow->empty_text) {
- if (reflow->empty_message) {
- 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,
- "font_gdk", gtk_style_get_font (GTK_WIDGET(GNOME_CANVAS_ITEM(reflow)->canvas)->style),
- "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->model_items_inserted_id);
- g_signal_handler_disconnect (reflow->model,
- reflow->model_item_changed_id);
- g_object_unref (reflow->model);
-
- reflow->model_changed_id = 0;
- reflow->model_items_inserted_id = 0;
- reflow->model_item_changed_id = 0;
- reflow->model = NULL;
-}
-
-static void
-disconnect_selection (EReflow *reflow)
-{
- if (reflow->selection == NULL)
- return;
-
- 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->model_items_inserted_id =
- g_signal_connect (reflow->model, "model_items_inserted",
- G_CALLBACK (items_inserted), 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)
-{
- 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;
-
- 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);
- 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 09f1292c4e..0000000000
--- a/widgets/misc/e-reflow.h
+++ /dev/null
@@ -1,142 +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 model_items_inserted_id;
- guint model_item_changed_id;
-
- ESelectionModel *selection;
- guint selection_changed_id;
- guint selection_row_changed_id;
- guint cursor_changed_id;
- ESorterArray *sorter;
-
- GtkAdjustment *adjustment;
- guint adjustment_changed_id;
- guint adjustment_value_changed_id;
- guint set_scroll_adjustments_id;
-
- int *heights;
- GnomeCanvasItem **items;
- int count;
- int allocated_count;
-
- int *columns;
- gint column_count; /* Number of columnns */
-
- GnomeCanvasItem *empty_text;
- gchar *empty_message;
-
- double minimum_width;
- double width;
- double height;
-
- double column_width;
-
- int incarnate_idle_id;
-
- /* These are all for when the column is being dragged. */
- gdouble start_x;
- gint which_column_dragged;
- double temp_column_width;
- double previous_temp_column_width;
-
- int cursor_row;
-
- guint column_drag : 1;
-
- guint need_height_update : 1;
- guint need_column_resize : 1;
- guint need_reflow_columns : 1;
-
- guint default_cursor_shown : 1;
-
- 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 0cea6371b4..0000000000
--- a/widgets/misc/e-unicode.c
+++ /dev/null
@@ -1,2272 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-unicode.c - utf-8 support functions for gal
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Lauris Kaplinski <lauris@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-/*
- * TODO: Break simple ligatures in e_utf8_strstrcasedecomp
- */
-
-#include <config.h>
-
-#include "e-unicode.h"
-
-#include "gal/util/e-i18n.h"
-#include <ctype.h>
-#include <string.h>
-#include <stdio.h>
-#include <iconv.h>
-#include <gdk/gdk.h>
-#include <gdk/gdkx.h>
-#include <gdk/gdkkeysyms.h>
-#include <gtk/gtkmenuitem.h>
-#include "e-font.h"
-#include <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_gtk_string_sized (GtkWidget *widget, const gchar *string, gint bytes)
-{
- iconv_t ic;
- char *new, *ob;
- const char *ib;
- size_t ibl, obl;
-
- g_return_val_if_fail (widget != NULL, NULL);
- g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
-
- if (!string) return NULL;
-
- g_return_val_if_fail (widget, NULL);
-
- ic = e_iconv_from_gdk_font (gtk_style_get_font (widget->style));
- if (ic == (iconv_t) -1) {
- XFontStruct *xfs;
- /* If iconv is missing we assume either iso-10646 or iso-8859-1 */
- xfs = GDK_FONT_XFONT (gtk_style_get_font (widget->style));
- if (gtk_style_get_font (widget->style)->type == GDK_FONT_FONTSET || ((xfs->min_byte1 != 0) || (xfs->max_byte1 != 0))) {
- gint i;
- const guchar *ib;
- guchar * ob, * new;
- /* iso-10646 */
- ib = string;
- new = ob = g_new (unsigned char, bytes * 6 + 1);
- for (i = 0; i < (bytes - 1); i += 2) {
- ob += e_unichar_to_utf8 (ib[i] * 256 + ib[i + 1], ob);
- }
- *ob = '\0';
- return new;
- } else {
- gint i;
- /* iso-8859-1 */
- ib = (char *) string;
- new = ob = g_new (unsigned char, bytes * 2 + 1);
- for (i = 0; i < (bytes); i ++) {
- ob += e_unichar_to_utf8 (ib[i], ob);
- }
- *ob = '\0';
- return new;
- }
- }
-
- ib = string;
- ibl = bytes;
- new = ob = g_new (gchar, ibl * 6 + 1);
- obl = ibl * 6;
-
- while (ibl > 0) {
- e_iconv (ic, &ib, &ibl, &ob, &obl);
- if (ibl > 0) {
- gint len;
- if ((*ib & 0x80) == 0x00) len = 1;
- else if ((*ib &0xe0) == 0xc0) len = 2;
- else if ((*ib &0xf0) == 0xe0) len = 3;
- else if ((*ib &0xf8) == 0xf0) len = 4;
- else {
- g_warning ("Invalid UTF-8 sequence");
- break;
- }
- ib += len;
- ibl = bytes - (ib - string);
- if (ibl > bytes) ibl = 0;
- *ob++ = '_';
- obl--;
- }
- }
-
- *ob = '\0';
-
- e_iconv_close(ic);
-
- return new;
-}
-
-gchar *
-e_utf8_from_gtk_string (GtkWidget *widget, const gchar *string)
-{
- if (!string) return NULL;
- return e_utf8_from_gtk_string_sized (widget, string, strlen (string));
-}
-
-gchar *
-e_utf8_to_gtk_string_sized (GtkWidget *widget, const gchar *string, gint bytes)
-{
- iconv_t ic;
- char *new, *ob;
- const char *ib;
- size_t ibl, obl;
-
- if (!string) return NULL;
-
- g_return_val_if_fail (widget, NULL);
-
- gtk_widget_ensure_style (widget);
- ic = e_iconv_to_gdk_font (gtk_style_get_font (widget->style));
- if (ic == (iconv_t) -1) {
- XFontStruct *xfs;
- gboolean twobyte;
- gint len;
- const gchar *u;
- gunichar uc;
- /* If iconv is missing we assume either iso-10646 or iso-8859-1 */
- xfs = GDK_FONT_XFONT (gtk_style_get_font (widget->style));
- twobyte = (gtk_style_get_font (widget->style)->type == GDK_FONT_FONTSET || ((xfs->min_byte1 != 0) || (xfs->max_byte1 != 0)));
-
- new = g_new (unsigned char, bytes * 4 + 2);
- u = string;
- len = 0;
-
- while ((u) && (u - string < bytes)) {
- u = e_unicode_get_utf8 (u, &uc);
- if (twobyte) {
- new[len++] = (uc & 0xff00) >> 8;
- }
- new[len++] = uc & 0xff;
- }
-
- new[len++] = '\0';
- if (twobyte)
- new[len] = '\0';
-
- return new;
- }
-
- ib = string;
- ibl = bytes;
- new = ob = g_new (gchar, 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;
- *ob++ = '_';
- obl--;
- }
- }
-
- /* Make sure to terminate with plenty of padding */
- memset (ob, 0, 4);
-
- e_iconv_close(ic);
-
- return new;
-}
-
-gchar *
-e_utf8_to_gtk_string (GtkWidget *widget, const gchar *string)
-{
- if (!string) return NULL;
- return e_utf8_to_gtk_string_sized (widget, string, strlen (string));
-}
-
-gchar *
-e_utf8_from_locale_string_sized (const gchar *string, gint bytes)
-{
- iconv_t ic;
- char *ret;
-
- if (!string) return NULL;
-
- ic = e_iconv_open("utf-8", e_iconv_locale_charset());
- ret = e_utf8_from_iconv_string_sized (ic, string, bytes);
- e_iconv_close(ic);
-
- return ret;
-}
-
-gchar *
-e_utf8_from_locale_string (const gchar *string)
-{
- if (!string) return NULL;
- return e_utf8_from_locale_string_sized (string, strlen (string));
-}
-
-gchar *
-e_utf8_to_locale_string_sized (const gchar *string, gint bytes)
-{
- iconv_t ic;
- char *ret;
-
- if (!string) return NULL;
-
- ic = e_iconv_open(e_iconv_locale_charset(), "utf-8");
- ret = e_utf8_to_iconv_string_sized (ic, string, bytes);
- e_iconv_close(ic);
-
- return ret;
-}
-
-gchar *
-e_utf8_to_locale_string (const gchar *string)
-{
- if (!string) return NULL;
- return e_utf8_to_locale_string_sized (string, strlen (string));
-}
-
-gboolean
-e_utf8_is_ascii (const gchar *string)
-{
- char c;
-
- g_return_val_if_fail (string != NULL, FALSE);
-
- for (; (c = *string); string++) {
- if (c & 0x80)
- return FALSE;
- }
-
- return TRUE;
-}
-
-gchar *
-e_utf8_gtk_entry_get_text (GtkEntry *entry)
-{
- 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);
-}
-
-GtkWidget *
-e_utf8_gtk_menu_item_new_with_label (GtkMenu *menu, const gchar *label)
-{
- GtkWidget *w;
- gchar *s;
-
- if (!label) return NULL;
-
- s = e_utf8_to_gtk_string ((GtkWidget *) menu, label);
- w = gtk_menu_item_new_with_label (s);
-
- g_free (s);
-
- return w;
-}
-
-void
-e_utf8_gtk_clist_set_text (GtkCList *clist, gint row, gint col, const gchar *text)
-{
- gchar *s;
-
- if (!text) return;
-
- s = e_utf8_to_gtk_string ((GtkWidget *) clist, text);
- gtk_clist_set_text (clist, row, col, s);
-
- if (s) g_free (s);
-}
-
-gint
-e_utf8_gtk_clist_append (GtkCList *clist, gchar *text[])
-{
- gint row, i;
- gchar **v;
-
- if (!text) return 0;
-
- v = g_new (gchar *, clist->columns);
- for (i = 0; i < clist->columns; i++)
- v[i] = e_utf8_to_gtk_string ((GtkWidget *) clist, text[i]);
-
- row = gtk_clist_append (clist, v);
-
- for (i = 0; i < clist->columns; i++)
- if (v[i]) g_free (v[i]);
-
- return row;
-}
-
-/*
- * Translate \U+XXXX\ sequences to utf8 chars
- */
-
-gchar *
-e_utf8_xml1_decode (const gchar *text)
-{
- const guchar *c;
- guchar *u, *d;
- int len, s;
-
- g_return_val_if_fail (text != NULL, NULL);
-
- len = strlen (text)+1;
- /* len * 2 is absolute maximum */
- u = d = g_malloc (len * 2);
-
- c = text;
- s = 0;
- while (s < len) {
- if ((s <= (len - 8)) &&
- (c[s ] == '\\') &&
- (c[s + 1] == 'U' ) &&
- (c[s + 2] == '+' ) &&
- isxdigit (c[s + 3]) &&
- isxdigit (c[s + 4]) &&
- isxdigit (c[s + 5]) &&
- isxdigit (c[s + 6]) &&
- (c[s + 7] == '\\')) {
- /* Valid \U+XXXX\ sequence */
- unsigned int unival;
- unival = strtol (c + s + 3, NULL, 16);
- d += e_unichar_to_utf8 (unival, d);
- s += 8;
- } else if (c[s] > 127) {
- /* fixme: We assume iso-8859-1 currently */
- d += e_unichar_to_utf8 (c[s], d);
- s += 1;
- } else {
- *d++ = c[s++];
- }
- }
- *d++ = '\0';
- u = g_realloc (u, (d - u));
-
- return u;
-}
-
-gchar *
-e_utf8_xml1_encode (const gchar *text)
-{
- guchar *u, *d, *c;
- int unival;
- int len;
-
- g_return_val_if_fail (text != NULL, NULL);
-
- len = 0;
- for (u = e_unicode_get_utf8 (text, &unival); u && unival; u = e_unicode_get_utf8 (u, &unival)) {
- if ((unival >= 0x80) || (unival == '\\')) {
- len += 8;
- } else {
- len += 1;
- }
- }
- d = c = g_new (guchar, len + 1);
-
- for (u = e_unicode_get_utf8 (text, &unival); u && unival; u = e_unicode_get_utf8 (u, &unival)) {
- if ((unival >= 0x80) || (unival == '\\')) {
- *c++ = '\\';
- *c++ = 'U';
- *c++ = '+';
- c += sprintf (c, "%04x", unival);
- *c++ = '\\';
- } else {
- *c++ = unival;
- }
- }
- *c = '\0';
-
- return d;
-}
-
-/**
- * e_unichar_to_utf8:
- * @c: a ISO10646 character code
- * @outbuf: output buffer, must have at least 6 bytes of space.
- * If %NULL, the length will be computed and returned
- * and nothing will be written to @out.
- *
- * Convert a single character to utf8
- *
- * Return value: number of bytes written
- **/
-
-gint
-e_unichar_to_utf8 (gint c, gchar *outbuf)
-{
- size_t len = 0;
- int first;
- int i;
-
- if (c < 0x80)
- {
- first = 0;
- len = 1;
- }
- else if (c < 0x800)
- {
- first = 0xc0;
- len = 2;
- }
- else if (c < 0x10000)
- {
- first = 0xe0;
- len = 3;
- }
- else if (c < 0x200000)
- {
- first = 0xf0;
- len = 4;
- }
- else if (c < 0x4000000)
- {
- first = 0xf8;
- len = 5;
- }
- else
- {
- first = 0xfc;
- len = 6;
- }
-
- if (outbuf)
- {
- for (i = len - 1; i > 0; --i)
- {
- outbuf[i] = (c & 0x3f) | 0x80;
- c >>= 6;
- }
- outbuf[0] = c | first;
- }
-
- return len;
-}
-
-gchar *
-e_unicode_get_utf8 (const gchar *text, gunichar *out)
-{
- *out = g_utf8_get_char (text);
- return (*out == (gunichar)-1) ? NULL : g_utf8_next_char (text);
-}
-
-/*
- * Canonical decomposition
- *
- * It is copied here from libunicode, because we do not want malloc
- *
- */
-
-typedef struct
-{
- unsigned short ch;
- unsigned char *expansion;
-} e_decomposition;
-
-static e_decomposition e_decomp_table[] =
-{
- { 0x00c0, "\x00\x41\x03\x00\0" },
- { 0x00c1, "\x00\x41\x03\x01\0" },
- { 0x00c2, "\x00\x41\x03\x02\0" },
- { 0x00c3, "\x00\x41\x03\x03\0" },
- { 0x00c4, "\x00\x41\x03\x08\0" },
- { 0x00c5, "\x00\x41\x03\x0a\0" },
- { 0x00c7, "\x00\x43\x03\x27\0" },
- { 0x00c8, "\x00\x45\x03\x00\0" },
- { 0x00c9, "\x00\x45\x03\x01\0" },
- { 0x00ca, "\x00\x45\x03\x02\0" },
- { 0x00cb, "\x00\x45\x03\x08\0" },
- { 0x00cc, "\x00\x49\x03\x00\0" },
- { 0x00cd, "\x00\x49\x03\x01\0" },
- { 0x00ce, "\x00\x49\x03\x02\0" },
- { 0x00cf, "\x00\x49\x03\x08\0" },
- { 0x00d1, "\x00\x4e\x03\x03\0" },
- { 0x00d2, "\x00\x4f\x03\x00\0" },
- { 0x00d3, "\x00\x4f\x03\x01\0" },
- { 0x00d4, "\x00\x4f\x03\x02\0" },
- { 0x00d5, "\x00\x4f\x03\x03\0" },
- { 0x00d6, "\x00\x4f\x03\x08\0" },
- { 0x00d9, "\x00\x55\x03\x00\0" },
- { 0x00da, "\x00\x55\x03\x01\0" },
- { 0x00db, "\x00\x55\x03\x02\0" },
- { 0x00dc, "\x00\x55\x03\x08\0" },
- { 0x00dd, "\x00\x59\x03\x01\0" },
- { 0x00e0, "\x00\x61\x03\x00\0" },
- { 0x00e1, "\x00\x61\x03\x01\0" },
- { 0x00e2, "\x00\x61\x03\x02\0" },
- { 0x00e3, "\x00\x61\x03\x03\0" },
- { 0x00e4, "\x00\x61\x03\x08\0" },
- { 0x00e5, "\x00\x61\x03\x0a\0" },
- { 0x00e7, "\x00\x63\x03\x27\0" },
- { 0x00e8, "\x00\x65\x03\x00\0" },
- { 0x00e9, "\x00\x65\x03\x01\0" },
- { 0x00ea, "\x00\x65\x03\x02\0" },
- { 0x00eb, "\x00\x65\x03\x08\0" },
- { 0x00ec, "\x00\x69\x03\x00\0" },
- { 0x00ed, "\x00\x69\x03\x01\0" },
- { 0x00ee, "\x00\x69\x03\x02\0" },
- { 0x00ef, "\x00\x69\x03\x08\0" },
- { 0x00f1, "\x00\x6e\x03\x03\0" },
- { 0x00f2, "\x00\x6f\x03\x00\0" },
- { 0x00f3, "\x00\x6f\x03\x01\0" },
- { 0x00f4, "\x00\x6f\x03\x02\0" },
- { 0x00f5, "\x00\x6f\x03\x03\0" },
- { 0x00f6, "\x00\x6f\x03\x08\0" },
- { 0x00f9, "\x00\x75\x03\x00\0" },
- { 0x00fa, "\x00\x75\x03\x01\0" },
- { 0x00fb, "\x00\x75\x03\x02\0" },
- { 0x00fc, "\x00\x75\x03\x08\0" },
- { 0x00fd, "\x00\x79\x03\x01\0" },
- { 0x00ff, "\x00\x79\x03\x08\0" },
- { 0x0100, "\x00\x41\x03\x04\0" },
- { 0x0101, "\x00\x61\x03\x04\0" },
- { 0x0102, "\x00\x41\x03\x06\0" },
- { 0x0103, "\x00\x61\x03\x06\0" },
- { 0x0104, "\x00\x41\x03\x28\0" },
- { 0x0105, "\x00\x61\x03\x28\0" },
- { 0x0106, "\x00\x43\x03\x01\0" },
- { 0x0107, "\x00\x63\x03\x01\0" },
- { 0x0108, "\x00\x43\x03\x02\0" },
- { 0x0109, "\x00\x63\x03\x02\0" },
- { 0x010a, "\x00\x43\x03\x07\0" },
- { 0x010b, "\x00\x63\x03\x07\0" },
- { 0x010c, "\x00\x43\x03\x0c\0" },
- { 0x010d, "\x00\x63\x03\x0c\0" },
- { 0x010e, "\x00\x44\x03\x0c\0" },
- { 0x010f, "\x00\x64\x03\x0c\0" },
- { 0x0112, "\x00\x45\x03\x04\0" },
- { 0x0113, "\x00\x65\x03\x04\0" },
- { 0x0114, "\x00\x45\x03\x06\0" },
- { 0x0115, "\x00\x65\x03\x06\0" },
- { 0x0116, "\x00\x45\x03\x07\0" },
- { 0x0117, "\x00\x65\x03\x07\0" },
- { 0x0118, "\x00\x45\x03\x28\0" },
- { 0x0119, "\x00\x65\x03\x28\0" },
- { 0x011a, "\x00\x45\x03\x0c\0" },
- { 0x011b, "\x00\x65\x03\x0c\0" },
- { 0x011c, "\x00\x47\x03\x02\0" },
- { 0x011d, "\x00\x67\x03\x02\0" },
- { 0x011e, "\x00\x47\x03\x06\0" },
- { 0x011f, "\x00\x67\x03\x06\0" },
- { 0x0120, "\x00\x47\x03\x07\0" },
- { 0x0121, "\x00\x67\x03\x07\0" },
- { 0x0122, "\x00\x47\x03\x27\0" },
- { 0x0123, "\x00\x67\x03\x27\0" },
- { 0x0124, "\x00\x48\x03\x02\0" },
- { 0x0125, "\x00\x68\x03\x02\0" },
- { 0x0128, "\x00\x49\x03\x03\0" },
- { 0x0129, "\x00\x69\x03\x03\0" },
- { 0x012a, "\x00\x49\x03\x04\0" },
- { 0x012b, "\x00\x69\x03\x04\0" },
- { 0x012c, "\x00\x49\x03\x06\0" },
- { 0x012d, "\x00\x69\x03\x06\0" },
- { 0x012e, "\x00\x49\x03\x28\0" },
- { 0x012f, "\x00\x69\x03\x28\0" },
- { 0x0130, "\x00\x49\x03\x07\0" },
- { 0x0134, "\x00\x4a\x03\x02\0" },
- { 0x0135, "\x00\x6a\x03\x02\0" },
- { 0x0136, "\x00\x4b\x03\x27\0" },
- { 0x0137, "\x00\x6b\x03\x27\0" },
- { 0x0139, "\x00\x4c\x03\x01\0" },
- { 0x013a, "\x00\x6c\x03\x01\0" },
- { 0x013b, "\x00\x4c\x03\x27\0" },
- { 0x013c, "\x00\x6c\x03\x27\0" },
- { 0x013d, "\x00\x4c\x03\x0c\0" },
- { 0x013e, "\x00\x6c\x03\x0c\0" },
- { 0x0143, "\x00\x4e\x03\x01\0" },
- { 0x0144, "\x00\x6e\x03\x01\0" },
- { 0x0145, "\x00\x4e\x03\x27\0" },
- { 0x0146, "\x00\x6e\x03\x27\0" },
- { 0x0147, "\x00\x4e\x03\x0c\0" },
- { 0x0148, "\x00\x6e\x03\x0c\0" },
- { 0x014c, "\x00\x4f\x03\x04\0" },
- { 0x014d, "\x00\x6f\x03\x04\0" },
- { 0x014e, "\x00\x4f\x03\x06\0" },
- { 0x014f, "\x00\x6f\x03\x06\0" },
- { 0x0150, "\x00\x4f\x03\x0b\0" },
- { 0x0151, "\x00\x6f\x03\x0b\0" },
- { 0x0154, "\x00\x52\x03\x01\0" },
- { 0x0155, "\x00\x72\x03\x01\0" },
- { 0x0156, "\x00\x52\x03\x27\0" },
- { 0x0157, "\x00\x72\x03\x27\0" },
- { 0x0158, "\x00\x52\x03\x0c\0" },
- { 0x0159, "\x00\x72\x03\x0c\0" },
- { 0x015a, "\x00\x53\x03\x01\0" },
- { 0x015b, "\x00\x73\x03\x01\0" },
- { 0x015c, "\x00\x53\x03\x02\0" },
- { 0x015d, "\x00\x73\x03\x02\0" },
- { 0x015e, "\x00\x53\x03\x27\0" },
- { 0x015f, "\x00\x73\x03\x27\0" },
- { 0x0160, "\x00\x53\x03\x0c\0" },
- { 0x0161, "\x00\x73\x03\x0c\0" },
- { 0x0162, "\x00\x54\x03\x27\0" },
- { 0x0163, "\x00\x74\x03\x27\0" },
- { 0x0164, "\x00\x54\x03\x0c\0" },
- { 0x0165, "\x00\x74\x03\x0c\0" },
- { 0x0168, "\x00\x55\x03\x03\0" },
- { 0x0169, "\x00\x75\x03\x03\0" },
- { 0x016a, "\x00\x55\x03\x04\0" },
- { 0x016b, "\x00\x75\x03\x04\0" },
- { 0x016c, "\x00\x55\x03\x06\0" },
- { 0x016d, "\x00\x75\x03\x06\0" },
- { 0x016e, "\x00\x55\x03\x0a\0" },
- { 0x016f, "\x00\x75\x03\x0a\0" },
- { 0x0170, "\x00\x55\x03\x0b\0" },
- { 0x0171, "\x00\x75\x03\x0b\0" },
- { 0x0172, "\x00\x55\x03\x28\0" },
- { 0x0173, "\x00\x75\x03\x28\0" },
- { 0x0174, "\x00\x57\x03\x02\0" },
- { 0x0175, "\x00\x77\x03\x02\0" },
- { 0x0176, "\x00\x59\x03\x02\0" },
- { 0x0177, "\x00\x79\x03\x02\0" },
- { 0x0178, "\x00\x59\x03\x08\0" },
- { 0x0179, "\x00\x5a\x03\x01\0" },
- { 0x017a, "\x00\x7a\x03\x01\0" },
- { 0x017b, "\x00\x5a\x03\x07\0" },
- { 0x017c, "\x00\x7a\x03\x07\0" },
- { 0x017d, "\x00\x5a\x03\x0c\0" },
- { 0x017e, "\x00\x7a\x03\x0c\0" },
- { 0x01a0, "\x00\x4f\x03\x1b\0" },
- { 0x01a1, "\x00\x6f\x03\x1b\0" },
- { 0x01af, "\x00\x55\x03\x1b\0" },
- { 0x01b0, "\x00\x75\x03\x1b\0" },
- { 0x01cd, "\x00\x41\x03\x0c\0" },
- { 0x01ce, "\x00\x61\x03\x0c\0" },
- { 0x01cf, "\x00\x49\x03\x0c\0" },
- { 0x01d0, "\x00\x69\x03\x0c\0" },
- { 0x01d1, "\x00\x4f\x03\x0c\0" },
- { 0x01d2, "\x00\x6f\x03\x0c\0" },
- { 0x01d3, "\x00\x55\x03\x0c\0" },
- { 0x01d4, "\x00\x75\x03\x0c\0" },
- { 0x01d5, "\x00\x55\x03\x08\x03\x04\0" },
- { 0x01d6, "\x00\x75\x03\x08\x03\x04\0" },
- { 0x01d7, "\x00\x55\x03\x08\x03\x01\0" },
- { 0x01d8, "\x00\x75\x03\x08\x03\x01\0" },
- { 0x01d9, "\x00\x55\x03\x08\x03\x0c\0" },
- { 0x01da, "\x00\x75\x03\x08\x03\x0c\0" },
- { 0x01db, "\x00\x55\x03\x08\x03\x00\0" },
- { 0x01dc, "\x00\x75\x03\x08\x03\x00\0" },
- { 0x01de, "\x00\x41\x03\x08\x03\x04\0" },
- { 0x01df, "\x00\x61\x03\x08\x03\x04\0" },
- { 0x01e0, "\x00\x41\x03\x07\x03\x04\0" },
- { 0x01e1, "\x00\x61\x03\x07\x03\x04\0" },
- { 0x01e2, "\x00\xc6\x03\x04\0" },
- { 0x01e3, "\x00\xe6\x03\x04\0" },
- { 0x01e6, "\x00\x47\x03\x0c\0" },
- { 0x01e7, "\x00\x67\x03\x0c\0" },
- { 0x01e8, "\x00\x4b\x03\x0c\0" },
- { 0x01e9, "\x00\x6b\x03\x0c\0" },
- { 0x01ea, "\x00\x4f\x03\x28\0" },
- { 0x01eb, "\x00\x6f\x03\x28\0" },
- { 0x01ec, "\x00\x4f\x03\x28\x03\x04\0" },
- { 0x01ed, "\x00\x6f\x03\x28\x03\x04\0" },
- { 0x01ee, "\x01\xb7\x03\x0c\0" },
- { 0x01ef, "\x02\x92\x03\x0c\0" },
- { 0x01f0, "\x00\x6a\x03\x0c\0" },
- { 0x01f4, "\x00\x47\x03\x01\0" },
- { 0x01f5, "\x00\x67\x03\x01\0" },
- { 0x01fa, "\x00\x41\x03\x0a\x03\x01\0" },
- { 0x01fb, "\x00\x61\x03\x0a\x03\x01\0" },
- { 0x01fc, "\x00\xc6\x03\x01\0" },
- { 0x01fd, "\x00\xe6\x03\x01\0" },
- { 0x01fe, "\x00\xd8\x03\x01\0" },
- { 0x01ff, "\x00\xf8\x03\x01\0" },
- { 0x0200, "\x00\x41\x03\x0f\0" },
- { 0x0201, "\x00\x61\x03\x0f\0" },
- { 0x0202, "\x00\x41\x03\x11\0" },
- { 0x0203, "\x00\x61\x03\x11\0" },
- { 0x0204, "\x00\x45\x03\x0f\0" },
- { 0x0205, "\x00\x65\x03\x0f\0" },
- { 0x0206, "\x00\x45\x03\x11\0" },
- { 0x0207, "\x00\x65\x03\x11\0" },
- { 0x0208, "\x00\x49\x03\x0f\0" },
- { 0x0209, "\x00\x69\x03\x0f\0" },
- { 0x020a, "\x00\x49\x03\x11\0" },
- { 0x020b, "\x00\x69\x03\x11\0" },
- { 0x020c, "\x00\x4f\x03\x0f\0" },
- { 0x020d, "\x00\x6f\x03\x0f\0" },
- { 0x020e, "\x00\x4f\x03\x11\0" },
- { 0x020f, "\x00\x6f\x03\x11\0" },
- { 0x0210, "\x00\x52\x03\x0f\0" },
- { 0x0211, "\x00\x72\x03\x0f\0" },
- { 0x0212, "\x00\x52\x03\x11\0" },
- { 0x0213, "\x00\x72\x03\x11\0" },
- { 0x0214, "\x00\x55\x03\x0f\0" },
- { 0x0215, "\x00\x75\x03\x0f\0" },
- { 0x0216, "\x00\x55\x03\x11\0" },
- { 0x0217, "\x00\x75\x03\x11\0" },
- { 0x0340, "\x03\x00\0" },
- { 0x0341, "\x03\x01\0" },
- { 0x0343, "\x03\x13\0" },
- { 0x0344, "\x03\x08\x03\x01\0" },
- { 0x0374, "\x02\xb9\0" },
- { 0x037e, "\x00\x3b\0" },
- { 0x0385, "\x00\xa8\x03\x01\0" },
- { 0x0386, "\x03\x91\x03\x01\0" },
- { 0x0387, "\x00\xb7\0" },
- { 0x0388, "\x03\x95\x03\x01\0" },
- { 0x0389, "\x03\x97\x03\x01\0" },
- { 0x038a, "\x03\x99\x03\x01\0" },
- { 0x038c, "\x03\x9f\x03\x01\0" },
- { 0x038e, "\x03\xa5\x03\x01\0" },
- { 0x038f, "\x03\xa9\x03\x01\0" },
- { 0x0390, "\x03\xb9\x03\x08\x03\x01\0" },
- { 0x03aa, "\x03\x99\x03\x08\0" },
- { 0x03ab, "\x03\xa5\x03\x08\0" },
- { 0x03ac, "\x03\xb1\x03\x01\0" },
- { 0x03ad, "\x03\xb5\x03\x01\0" },
- { 0x03ae, "\x03\xb7\x03\x01\0" },
- { 0x03af, "\x03\xb9\x03\x01\0" },
- { 0x03b0, "\x03\xc5\x03\x08\x03\x01\0" },
- { 0x03ca, "\x03\xb9\x03\x08\0" },
- { 0x03cb, "\x03\xc5\x03\x08\0" },
- { 0x03cc, "\x03\xbf\x03\x01\0" },
- { 0x03cd, "\x03\xc5\x03\x01\0" },
- { 0x03ce, "\x03\xc9\x03\x01\0" },
- { 0x03d3, "\x03\xd2\x03\x01\0" },
- { 0x03d4, "\x03\xd2\x03\x08\0" },
- { 0x0401, "\x04\x15\x03\x08\0" },
- { 0x0403, "\x04\x13\x03\x01\0" },
- { 0x0407, "\x04\x06\x03\x08\0" },
- { 0x040c, "\x04\x1a\x03\x01\0" },
- { 0x040e, "\x04\x23\x03\x06\0" },
- { 0x0419, "\x04\x18\x03\x06\0" },
- { 0x0439, "\x04\x38\x03\x06\0" },
- { 0x0451, "\x04\x35\x03\x08\0" },
- { 0x0453, "\x04\x33\x03\x01\0" },
- { 0x0457, "\x04\x56\x03\x08\0" },
- { 0x045c, "\x04\x3a\x03\x01\0" },
- { 0x045e, "\x04\x43\x03\x06\0" },
- { 0x0476, "\x04\x74\x03\x0f\0" },
- { 0x0477, "\x04\x75\x03\x0f\0" },
- { 0x04c1, "\x04\x16\x03\x06\0" },
- { 0x04c2, "\x04\x36\x03\x06\0" },
- { 0x04d0, "\x04\x10\x03\x06\0" },
- { 0x04d1, "\x04\x30\x03\x06\0" },
- { 0x04d2, "\x04\x10\x03\x08\0" },
- { 0x04d3, "\x04\x30\x03\x08\0" },
- { 0x04d6, "\x04\x15\x03\x06\0" },
- { 0x04d7, "\x04\x35\x03\x06\0" },
- { 0x04da, "\x04\xd8\x03\x08\0" },
- { 0x04db, "\x04\xd9\x03\x08\0" },
- { 0x04dc, "\x04\x16\x03\x08\0" },
- { 0x04dd, "\x04\x36\x03\x08\0" },
- { 0x04de, "\x04\x17\x03\x08\0" },
- { 0x04df, "\x04\x37\x03\x08\0" },
- { 0x04e2, "\x04\x18\x03\x04\0" },
- { 0x04e3, "\x04\x38\x03\x04\0" },
- { 0x04e4, "\x04\x18\x03\x08\0" },
- { 0x04e5, "\x04\x38\x03\x08\0" },
- { 0x04e6, "\x04\x1e\x03\x08\0" },
- { 0x04e7, "\x04\x3e\x03\x08\0" },
- { 0x04ea, "\x04\xe8\x03\x08\0" },
- { 0x04eb, "\x04\xe9\x03\x08\0" },
- { 0x04ee, "\x04\x23\x03\x04\0" },
- { 0x04ef, "\x04\x43\x03\x04\0" },
- { 0x04f0, "\x04\x23\x03\x08\0" },
- { 0x04f1, "\x04\x43\x03\x08\0" },
- { 0x04f2, "\x04\x23\x03\x0b\0" },
- { 0x04f3, "\x04\x43\x03\x0b\0" },
- { 0x04f4, "\x04\x27\x03\x08\0" },
- { 0x04f5, "\x04\x47\x03\x08\0" },
- { 0x04f8, "\x04\x2b\x03\x08\0" },
- { 0x04f9, "\x04\x4b\x03\x08\0" },
- { 0x0929, "\x09\x28\x09\x3c\0" },
- { 0x0931, "\x09\x30\x09\x3c\0" },
- { 0x0934, "\x09\x33\x09\x3c\0" },
- { 0x0958, "\x09\x15\x09\x3c\0" },
- { 0x0959, "\x09\x16\x09\x3c\0" },
- { 0x095a, "\x09\x17\x09\x3c\0" },
- { 0x095b, "\x09\x1c\x09\x3c\0" },
- { 0x095c, "\x09\x21\x09\x3c\0" },
- { 0x095d, "\x09\x22\x09\x3c\0" },
- { 0x095e, "\x09\x2b\x09\x3c\0" },
- { 0x095f, "\x09\x2f\x09\x3c\0" },
- { 0x09b0, "\x09\xac\x09\xbc\0" },
- { 0x09cb, "\x09\xc7\x09\xbe\0" },
- { 0x09cc, "\x09\xc7\x09\xd7\0" },
- { 0x09dc, "\x09\xa1\x09\xbc\0" },
- { 0x09dd, "\x09\xa2\x09\xbc\0" },
- { 0x09df, "\x09\xaf\x09\xbc\0" },
- { 0x0a59, "\x0a\x16\x0a\x3c\0" },
- { 0x0a5a, "\x0a\x17\x0a\x3c\0" },
- { 0x0a5b, "\x0a\x1c\x0a\x3c\0" },
- { 0x0a5c, "\x0a\x21\x0a\x3c\0" },
- { 0x0a5e, "\x0a\x2b\x0a\x3c\0" },
- { 0x0b48, "\x0b\x47\x0b\x56\0" },
- { 0x0b4b, "\x0b\x47\x0b\x3e\0" },
- { 0x0b4c, "\x0b\x47\x0b\x57\0" },
- { 0x0b5c, "\x0b\x21\x0b\x3c\0" },
- { 0x0b5d, "\x0b\x22\x0b\x3c\0" },
- { 0x0b5f, "\x0b\x2f\x0b\x3c\0" },
- { 0x0b94, "\x0b\x92\x0b\xd7\0" },
- { 0x0bca, "\x0b\xc6\x0b\xbe\0" },
- { 0x0bcb, "\x0b\xc7\x0b\xbe\0" },
- { 0x0bcc, "\x0b\xc6\x0b\xd7\0" },
- { 0x0c48, "\x0c\x46\x0c\x56\0" },
- { 0x0cc0, "\x0c\xbf\x0c\xd5\0" },
- { 0x0cc7, "\x0c\xc6\x0c\xd5\0" },
- { 0x0cc8, "\x0c\xc6\x0c\xd6\0" },
- { 0x0cca, "\x0c\xc6\x0c\xc2\0" },
- { 0x0ccb, "\x0c\xc6\x0c\xc2\x0c\xd5\0" },
- { 0x0d4a, "\x0d\x46\x0d\x3e\0" },
- { 0x0d4b, "\x0d\x47\x0d\x3e\0" },
- { 0x0d4c, "\x0d\x46\x0d\x57\0" },
- { 0x0e33, "\x0e\x4d\x0e\x32\0" },
- { 0x0eb3, "\x0e\xcd\x0e\xb2\0" },
- { 0x0f43, "\x0f\x42\x0f\xb7\0" },
- { 0x0f4d, "\x0f\x4c\x0f\xb7\0" },
- { 0x0f52, "\x0f\x51\x0f\xb7\0" },
- { 0x0f57, "\x0f\x56\x0f\xb7\0" },
- { 0x0f5c, "\x0f\x5b\x0f\xb7\0" },
- { 0x0f69, "\x0f\x40\x0f\xb5\0" },
- { 0x0f73, "\x0f\x71\x0f\x72\0" },
- { 0x0f75, "\x0f\x71\x0f\x74\0" },
- { 0x0f76, "\x0f\xb2\x0f\x80\0" },
- { 0x0f78, "\x0f\xb3\x0f\x80\0" },
- { 0x0f81, "\x0f\x71\x0f\x80\0" },
- { 0x0f93, "\x0f\x92\x0f\xb7\0" },
- { 0x0f9d, "\x0f\x9c\x0f\xb7\0" },
- { 0x0fa2, "\x0f\xa1\x0f\xb7\0" },
- { 0x0fa7, "\x0f\xa6\x0f\xb7\0" },
- { 0x0fac, "\x0f\xab\x0f\xb7\0" },
- { 0x0fb9, "\x0f\x90\x0f\xb5\0" },
- { 0x1e00, "\x00\x41\x03\x25\0" },
- { 0x1e01, "\x00\x61\x03\x25\0" },
- { 0x1e02, "\x00\x42\x03\x07\0" },
- { 0x1e03, "\x00\x62\x03\x07\0" },
- { 0x1e04, "\x00\x42\x03\x23\0" },
- { 0x1e05, "\x00\x62\x03\x23\0" },
- { 0x1e06, "\x00\x42\x03\x31\0" },
- { 0x1e07, "\x00\x62\x03\x31\0" },
- { 0x1e08, "\x00\x43\x03\x27\x03\x01\0" },
- { 0x1e09, "\x00\x63\x03\x27\x03\x01\0" },
- { 0x1e0a, "\x00\x44\x03\x07\0" },
- { 0x1e0b, "\x00\x64\x03\x07\0" },
- { 0x1e0c, "\x00\x44\x03\x23\0" },
- { 0x1e0d, "\x00\x64\x03\x23\0" },
- { 0x1e0e, "\x00\x44\x03\x31\0" },
- { 0x1e0f, "\x00\x64\x03\x31\0" },
- { 0x1e10, "\x00\x44\x03\x27\0" },
- { 0x1e11, "\x00\x64\x03\x27\0" },
- { 0x1e12, "\x00\x44\x03\x2d\0" },
- { 0x1e13, "\x00\x64\x03\x2d\0" },
- { 0x1e14, "\x00\x45\x03\x04\x03\x00\0" },
- { 0x1e15, "\x00\x65\x03\x04\x03\x00\0" },
- { 0x1e16, "\x00\x45\x03\x04\x03\x01\0" },
- { 0x1e17, "\x00\x65\x03\x04\x03\x01\0" },
- { 0x1e18, "\x00\x45\x03\x2d\0" },
- { 0x1e19, "\x00\x65\x03\x2d\0" },
- { 0x1e1a, "\x00\x45\x03\x30\0" },
- { 0x1e1b, "\x00\x65\x03\x30\0" },
- { 0x1e1c, "\x00\x45\x03\x27\x03\x06\0" },
- { 0x1e1d, "\x00\x65\x03\x27\x03\x06\0" },
- { 0x1e1e, "\x00\x46\x03\x07\0" },
- { 0x1e1f, "\x00\x66\x03\x07\0" },
- { 0x1e20, "\x00\x47\x03\x04\0" },
- { 0x1e21, "\x00\x67\x03\x04\0" },
- { 0x1e22, "\x00\x48\x03\x07\0" },
- { 0x1e23, "\x00\x68\x03\x07\0" },
- { 0x1e24, "\x00\x48\x03\x23\0" },
- { 0x1e25, "\x00\x68\x03\x23\0" },
- { 0x1e26, "\x00\x48\x03\x08\0" },
- { 0x1e27, "\x00\x68\x03\x08\0" },
- { 0x1e28, "\x00\x48\x03\x27\0" },
- { 0x1e29, "\x00\x68\x03\x27\0" },
- { 0x1e2a, "\x00\x48\x03\x2e\0" },
- { 0x1e2b, "\x00\x68\x03\x2e\0" },
- { 0x1e2c, "\x00\x49\x03\x30\0" },
- { 0x1e2d, "\x00\x69\x03\x30\0" },
- { 0x1e2e, "\x00\x49\x03\x08\x03\x01\0" },
- { 0x1e2f, "\x00\x69\x03\x08\x03\x01\0" },
- { 0x1e30, "\x00\x4b\x03\x01\0" },
- { 0x1e31, "\x00\x6b\x03\x01\0" },
- { 0x1e32, "\x00\x4b\x03\x23\0" },
- { 0x1e33, "\x00\x6b\x03\x23\0" },
- { 0x1e34, "\x00\x4b\x03\x31\0" },
- { 0x1e35, "\x00\x6b\x03\x31\0" },
- { 0x1e36, "\x00\x4c\x03\x23\0" },
- { 0x1e37, "\x00\x6c\x03\x23\0" },
- { 0x1e38, "\x00\x4c\x03\x23\x03\x04\0" },
- { 0x1e39, "\x00\x6c\x03\x23\x03\x04\0" },
- { 0x1e3a, "\x00\x4c\x03\x31\0" },
- { 0x1e3b, "\x00\x6c\x03\x31\0" },
- { 0x1e3c, "\x00\x4c\x03\x2d\0" },
- { 0x1e3d, "\x00\x6c\x03\x2d\0" },
- { 0x1e3e, "\x00\x4d\x03\x01\0" },
- { 0x1e3f, "\x00\x6d\x03\x01\0" },
- { 0x1e40, "\x00\x4d\x03\x07\0" },
- { 0x1e41, "\x00\x6d\x03\x07\0" },
- { 0x1e42, "\x00\x4d\x03\x23\0" },
- { 0x1e43, "\x00\x6d\x03\x23\0" },
- { 0x1e44, "\x00\x4e\x03\x07\0" },
- { 0x1e45, "\x00\x6e\x03\x07\0" },
- { 0x1e46, "\x00\x4e\x03\x23\0" },
- { 0x1e47, "\x00\x6e\x03\x23\0" },
- { 0x1e48, "\x00\x4e\x03\x31\0" },
- { 0x1e49, "\x00\x6e\x03\x31\0" },
- { 0x1e4a, "\x00\x4e\x03\x2d\0" },
- { 0x1e4b, "\x00\x6e\x03\x2d\0" },
- { 0x1e4c, "\x00\x4f\x03\x03\x03\x01\0" },
- { 0x1e4d, "\x00\x6f\x03\x03\x03\x01\0" },
- { 0x1e4e, "\x00\x4f\x03\x03\x03\x08\0" },
- { 0x1e4f, "\x00\x6f\x03\x03\x03\x08\0" },
- { 0x1e50, "\x00\x4f\x03\x04\x03\x00\0" },
- { 0x1e51, "\x00\x6f\x03\x04\x03\x00\0" },
- { 0x1e52, "\x00\x4f\x03\x04\x03\x01\0" },
- { 0x1e53, "\x00\x6f\x03\x04\x03\x01\0" },
- { 0x1e54, "\x00\x50\x03\x01\0" },
- { 0x1e55, "\x00\x70\x03\x01\0" },
- { 0x1e56, "\x00\x50\x03\x07\0" },
- { 0x1e57, "\x00\x70\x03\x07\0" },
- { 0x1e58, "\x00\x52\x03\x07\0" },
- { 0x1e59, "\x00\x72\x03\x07\0" },
- { 0x1e5a, "\x00\x52\x03\x23\0" },
- { 0x1e5b, "\x00\x72\x03\x23\0" },
- { 0x1e5c, "\x00\x52\x03\x23\x03\x04\0" },
- { 0x1e5d, "\x00\x72\x03\x23\x03\x04\0" },
- { 0x1e5e, "\x00\x52\x03\x31\0" },
- { 0x1e5f, "\x00\x72\x03\x31\0" },
- { 0x1e60, "\x00\x53\x03\x07\0" },
- { 0x1e61, "\x00\x73\x03\x07\0" },
- { 0x1e62, "\x00\x53\x03\x23\0" },
- { 0x1e63, "\x00\x73\x03\x23\0" },
- { 0x1e64, "\x00\x53\x03\x01\x03\x07\0" },
- { 0x1e65, "\x00\x73\x03\x01\x03\x07\0" },
- { 0x1e66, "\x00\x53\x03\x0c\x03\x07\0" },
- { 0x1e67, "\x00\x73\x03\x0c\x03\x07\0" },
- { 0x1e68, "\x00\x53\x03\x23\x03\x07\0" },
- { 0x1e69, "\x00\x73\x03\x23\x03\x07\0" },
- { 0x1e6a, "\x00\x54\x03\x07\0" },
- { 0x1e6b, "\x00\x74\x03\x07\0" },
- { 0x1e6c, "\x00\x54\x03\x23\0" },
- { 0x1e6d, "\x00\x74\x03\x23\0" },
- { 0x1e6e, "\x00\x54\x03\x31\0" },
- { 0x1e6f, "\x00\x74\x03\x31\0" },
- { 0x1e70, "\x00\x54\x03\x2d\0" },
- { 0x1e71, "\x00\x74\x03\x2d\0" },
- { 0x1e72, "\x00\x55\x03\x24\0" },
- { 0x1e73, "\x00\x75\x03\x24\0" },
- { 0x1e74, "\x00\x55\x03\x30\0" },
- { 0x1e75, "\x00\x75\x03\x30\0" },
- { 0x1e76, "\x00\x55\x03\x2d\0" },
- { 0x1e77, "\x00\x75\x03\x2d\0" },
- { 0x1e78, "\x00\x55\x03\x03\x03\x01\0" },
- { 0x1e79, "\x00\x75\x03\x03\x03\x01\0" },
- { 0x1e7a, "\x00\x55\x03\x04\x03\x08\0" },
- { 0x1e7b, "\x00\x75\x03\x04\x03\x08\0" },
- { 0x1e7c, "\x00\x56\x03\x03\0" },
- { 0x1e7d, "\x00\x76\x03\x03\0" },
- { 0x1e7e, "\x00\x56\x03\x23\0" },
- { 0x1e7f, "\x00\x76\x03\x23\0" },
- { 0x1e80, "\x00\x57\x03\x00\0" },
- { 0x1e81, "\x00\x77\x03\x00\0" },
- { 0x1e82, "\x00\x57\x03\x01\0" },
- { 0x1e83, "\x00\x77\x03\x01\0" },
- { 0x1e84, "\x00\x57\x03\x08\0" },
- { 0x1e85, "\x00\x77\x03\x08\0" },
- { 0x1e86, "\x00\x57\x03\x07\0" },
- { 0x1e87, "\x00\x77\x03\x07\0" },
- { 0x1e88, "\x00\x57\x03\x23\0" },
- { 0x1e89, "\x00\x77\x03\x23\0" },
- { 0x1e8a, "\x00\x58\x03\x07\0" },
- { 0x1e8b, "\x00\x78\x03\x07\0" },
- { 0x1e8c, "\x00\x58\x03\x08\0" },
- { 0x1e8d, "\x00\x78\x03\x08\0" },
- { 0x1e8e, "\x00\x59\x03\x07\0" },
- { 0x1e8f, "\x00\x79\x03\x07\0" },
- { 0x1e90, "\x00\x5a\x03\x02\0" },
- { 0x1e91, "\x00\x7a\x03\x02\0" },
- { 0x1e92, "\x00\x5a\x03\x23\0" },
- { 0x1e93, "\x00\x7a\x03\x23\0" },
- { 0x1e94, "\x00\x5a\x03\x31\0" },
- { 0x1e95, "\x00\x7a\x03\x31\0" },
- { 0x1e96, "\x00\x68\x03\x31\0" },
- { 0x1e97, "\x00\x74\x03\x08\0" },
- { 0x1e98, "\x00\x77\x03\x0a\0" },
- { 0x1e99, "\x00\x79\x03\x0a\0" },
- { 0x1e9b, "\x01\x7f\x03\x07\0" },
- { 0x1ea0, "\x00\x41\x03\x23\0" },
- { 0x1ea1, "\x00\x61\x03\x23\0" },
- { 0x1ea2, "\x00\x41\x03\x09\0" },
- { 0x1ea3, "\x00\x61\x03\x09\0" },
- { 0x1ea4, "\x00\x41\x03\x02\x03\x01\0" },
- { 0x1ea5, "\x00\x61\x03\x02\x03\x01\0" },
- { 0x1ea6, "\x00\x41\x03\x02\x03\x00\0" },
- { 0x1ea7, "\x00\x61\x03\x02\x03\x00\0" },
- { 0x1ea8, "\x00\x41\x03\x02\x03\x09\0" },
- { 0x1ea9, "\x00\x61\x03\x02\x03\x09\0" },
- { 0x1eaa, "\x00\x41\x03\x02\x03\x03\0" },
- { 0x1eab, "\x00\x61\x03\x02\x03\x03\0" },
- { 0x1eac, "\x00\x41\x03\x23\x03\x02\0" },
- { 0x1ead, "\x00\x61\x03\x23\x03\x02\0" },
- { 0x1eae, "\x00\x41\x03\x06\x03\x01\0" },
- { 0x1eaf, "\x00\x61\x03\x06\x03\x01\0" },
- { 0x1eb0, "\x00\x41\x03\x06\x03\x00\0" },
- { 0x1eb1, "\x00\x61\x03\x06\x03\x00\0" },
- { 0x1eb2, "\x00\x41\x03\x06\x03\x09\0" },
- { 0x1eb3, "\x00\x61\x03\x06\x03\x09\0" },
- { 0x1eb4, "\x00\x41\x03\x06\x03\x03\0" },
- { 0x1eb5, "\x00\x61\x03\x06\x03\x03\0" },
- { 0x1eb6, "\x00\x41\x03\x23\x03\x06\0" },
- { 0x1eb7, "\x00\x61\x03\x23\x03\x06\0" },
- { 0x1eb8, "\x00\x45\x03\x23\0" },
- { 0x1eb9, "\x00\x65\x03\x23\0" },
- { 0x1eba, "\x00\x45\x03\x09\0" },
- { 0x1ebb, "\x00\x65\x03\x09\0" },
- { 0x1ebc, "\x00\x45\x03\x03\0" },
- { 0x1ebd, "\x00\x65\x03\x03\0" },
- { 0x1ebe, "\x00\x45\x03\x02\x03\x01\0" },
- { 0x1ebf, "\x00\x65\x03\x02\x03\x01\0" },
- { 0x1ec0, "\x00\x45\x03\x02\x03\x00\0" },
- { 0x1ec1, "\x00\x65\x03\x02\x03\x00\0" },
- { 0x1ec2, "\x00\x45\x03\x02\x03\x09\0" },
- { 0x1ec3, "\x00\x65\x03\x02\x03\x09\0" },
- { 0x1ec4, "\x00\x45\x03\x02\x03\x03\0" },
- { 0x1ec5, "\x00\x65\x03\x02\x03\x03\0" },
- { 0x1ec6, "\x00\x45\x03\x23\x03\x02\0" },
- { 0x1ec7, "\x00\x65\x03\x23\x03\x02\0" },
- { 0x1ec8, "\x00\x49\x03\x09\0" },
- { 0x1ec9, "\x00\x69\x03\x09\0" },
- { 0x1eca, "\x00\x49\x03\x23\0" },
- { 0x1ecb, "\x00\x69\x03\x23\0" },
- { 0x1ecc, "\x00\x4f\x03\x23\0" },
- { 0x1ecd, "\x00\x6f\x03\x23\0" },
- { 0x1ece, "\x00\x4f\x03\x09\0" },
- { 0x1ecf, "\x00\x6f\x03\x09\0" },
- { 0x1ed0, "\x00\x4f\x03\x02\x03\x01\0" },
- { 0x1ed1, "\x00\x6f\x03\x02\x03\x01\0" },
- { 0x1ed2, "\x00\x4f\x03\x02\x03\x00\0" },
- { 0x1ed3, "\x00\x6f\x03\x02\x03\x00\0" },
- { 0x1ed4, "\x00\x4f\x03\x02\x03\x09\0" },
- { 0x1ed5, "\x00\x6f\x03\x02\x03\x09\0" },
- { 0x1ed6, "\x00\x4f\x03\x02\x03\x03\0" },
- { 0x1ed7, "\x00\x6f\x03\x02\x03\x03\0" },
- { 0x1ed8, "\x00\x4f\x03\x23\x03\x02\0" },
- { 0x1ed9, "\x00\x6f\x03\x23\x03\x02\0" },
- { 0x1eda, "\x00\x4f\x03\x1b\x03\x01\0" },
- { 0x1edb, "\x00\x6f\x03\x1b\x03\x01\0" },
- { 0x1edc, "\x00\x4f\x03\x1b\x03\x00\0" },
- { 0x1edd, "\x00\x6f\x03\x1b\x03\x00\0" },
- { 0x1ede, "\x00\x4f\x03\x1b\x03\x09\0" },
- { 0x1edf, "\x00\x6f\x03\x1b\x03\x09\0" },
- { 0x1ee0, "\x00\x4f\x03\x1b\x03\x03\0" },
- { 0x1ee1, "\x00\x6f\x03\x1b\x03\x03\0" },
- { 0x1ee2, "\x00\x4f\x03\x1b\x03\x23\0" },
- { 0x1ee3, "\x00\x6f\x03\x1b\x03\x23\0" },
- { 0x1ee4, "\x00\x55\x03\x23\0" },
- { 0x1ee5, "\x00\x75\x03\x23\0" },
- { 0x1ee6, "\x00\x55\x03\x09\0" },
- { 0x1ee7, "\x00\x75\x03\x09\0" },
- { 0x1ee8, "\x00\x55\x03\x1b\x03\x01\0" },
- { 0x1ee9, "\x00\x75\x03\x1b\x03\x01\0" },
- { 0x1eea, "\x00\x55\x03\x1b\x03\x00\0" },
- { 0x1eeb, "\x00\x75\x03\x1b\x03\x00\0" },
- { 0x1eec, "\x00\x55\x03\x1b\x03\x09\0" },
- { 0x1eed, "\x00\x75\x03\x1b\x03\x09\0" },
- { 0x1eee, "\x00\x55\x03\x1b\x03\x03\0" },
- { 0x1eef, "\x00\x75\x03\x1b\x03\x03\0" },
- { 0x1ef0, "\x00\x55\x03\x1b\x03\x23\0" },
- { 0x1ef1, "\x00\x75\x03\x1b\x03\x23\0" },
- { 0x1ef2, "\x00\x59\x03\x00\0" },
- { 0x1ef3, "\x00\x79\x03\x00\0" },
- { 0x1ef4, "\x00\x59\x03\x23\0" },
- { 0x1ef5, "\x00\x79\x03\x23\0" },
- { 0x1ef6, "\x00\x59\x03\x09\0" },
- { 0x1ef7, "\x00\x79\x03\x09\0" },
- { 0x1ef8, "\x00\x59\x03\x03\0" },
- { 0x1ef9, "\x00\x79\x03\x03\0" },
- { 0x1f00, "\x03\xb1\x03\x13\0" },
- { 0x1f01, "\x03\xb1\x03\x14\0" },
- { 0x1f02, "\x03\xb1\x03\x13\x03\x00\0" },
- { 0x1f03, "\x03\xb1\x03\x14\x03\x00\0" },
- { 0x1f04, "\x03\xb1\x03\x13\x03\x01\0" },
- { 0x1f05, "\x03\xb1\x03\x14\x03\x01\0" },
- { 0x1f06, "\x03\xb1\x03\x13\x03\x42\0" },
- { 0x1f07, "\x03\xb1\x03\x14\x03\x42\0" },
- { 0x1f08, "\x03\x91\x03\x13\0" },
- { 0x1f09, "\x03\x91\x03\x14\0" },
- { 0x1f0a, "\x03\x91\x03\x13\x03\x00\0" },
- { 0x1f0b, "\x03\x91\x03\x14\x03\x00\0" },
- { 0x1f0c, "\x03\x91\x03\x13\x03\x01\0" },
- { 0x1f0d, "\x03\x91\x03\x14\x03\x01\0" },
- { 0x1f0e, "\x03\x91\x03\x13\x03\x42\0" },
- { 0x1f0f, "\x03\x91\x03\x14\x03\x42\0" },
- { 0x1f10, "\x03\xb5\x03\x13\0" },
- { 0x1f11, "\x03\xb5\x03\x14\0" },
- { 0x1f12, "\x03\xb5\x03\x13\x03\x00\0" },
- { 0x1f13, "\x03\xb5\x03\x14\x03\x00\0" },
- { 0x1f14, "\x03\xb5\x03\x13\x03\x01\0" },
- { 0x1f15, "\x03\xb5\x03\x14\x03\x01\0" },
- { 0x1f18, "\x03\x95\x03\x13\0" },
- { 0x1f19, "\x03\x95\x03\x14\0" },
- { 0x1f1a, "\x03\x95\x03\x13\x03\x00\0" },
- { 0x1f1b, "\x03\x95\x03\x14\x03\x00\0" },
- { 0x1f1c, "\x03\x95\x03\x13\x03\x01\0" },
- { 0x1f1d, "\x03\x95\x03\x14\x03\x01\0" },
- { 0x1f20, "\x03\xb7\x03\x13\0" },
- { 0x1f21, "\x03\xb7\x03\x14\0" },
- { 0x1f22, "\x03\xb7\x03\x13\x03\x00\0" },
- { 0x1f23, "\x03\xb7\x03\x14\x03\x00\0" },
- { 0x1f24, "\x03\xb7\x03\x13\x03\x01\0" },
- { 0x1f25, "\x03\xb7\x03\x14\x03\x01\0" },
- { 0x1f26, "\x03\xb7\x03\x13\x03\x42\0" },
- { 0x1f27, "\x03\xb7\x03\x14\x03\x42\0" },
- { 0x1f28, "\x03\x97\x03\x13\0" },
- { 0x1f29, "\x03\x97\x03\x14\0" },
- { 0x1f2a, "\x03\x97\x03\x13\x03\x00\0" },
- { 0x1f2b, "\x03\x97\x03\x14\x03\x00\0" },
- { 0x1f2c, "\x03\x97\x03\x13\x03\x01\0" },
- { 0x1f2d, "\x03\x97\x03\x14\x03\x01\0" },
- { 0x1f2e, "\x03\x97\x03\x13\x03\x42\0" },
- { 0x1f2f, "\x03\x97\x03\x14\x03\x42\0" },
- { 0x1f30, "\x03\xb9\x03\x13\0" },
- { 0x1f31, "\x03\xb9\x03\x14\0" },
- { 0x1f32, "\x03\xb9\x03\x13\x03\x00\0" },
- { 0x1f33, "\x03\xb9\x03\x14\x03\x00\0" },
- { 0x1f34, "\x03\xb9\x03\x13\x03\x01\0" },
- { 0x1f35, "\x03\xb9\x03\x14\x03\x01\0" },
- { 0x1f36, "\x03\xb9\x03\x13\x03\x42\0" },
- { 0x1f37, "\x03\xb9\x03\x14\x03\x42\0" },
- { 0x1f38, "\x03\x99\x03\x13\0" },
- { 0x1f39, "\x03\x99\x03\x14\0" },
- { 0x1f3a, "\x03\x99\x03\x13\x03\x00\0" },
- { 0x1f3b, "\x03\x99\x03\x14\x03\x00\0" },
- { 0x1f3c, "\x03\x99\x03\x13\x03\x01\0" },
- { 0x1f3d, "\x03\x99\x03\x14\x03\x01\0" },
- { 0x1f3e, "\x03\x99\x03\x13\x03\x42\0" },
- { 0x1f3f, "\x03\x99\x03\x14\x03\x42\0" },
- { 0x1f40, "\x03\xbf\x03\x13\0" },
- { 0x1f41, "\x03\xbf\x03\x14\0" },
- { 0x1f42, "\x03\xbf\x03\x13\x03\x00\0" },
- { 0x1f43, "\x03\xbf\x03\x14\x03\x00\0" },
- { 0x1f44, "\x03\xbf\x03\x13\x03\x01\0" },
- { 0x1f45, "\x03\xbf\x03\x14\x03\x01\0" },
- { 0x1f48, "\x03\x9f\x03\x13\0" },
- { 0x1f49, "\x03\x9f\x03\x14\0" },
- { 0x1f4a, "\x03\x9f\x03\x13\x03\x00\0" },
- { 0x1f4b, "\x03\x9f\x03\x14\x03\x00\0" },
- { 0x1f4c, "\x03\x9f\x03\x13\x03\x01\0" },
- { 0x1f4d, "\x03\x9f\x03\x14\x03\x01\0" },
- { 0x1f50, "\x03\xc5\x03\x13\0" },
- { 0x1f51, "\x03\xc5\x03\x14\0" },
- { 0x1f52, "\x03\xc5\x03\x13\x03\x00\0" },
- { 0x1f53, "\x03\xc5\x03\x14\x03\x00\0" },
- { 0x1f54, "\x03\xc5\x03\x13\x03\x01\0" },
- { 0x1f55, "\x03\xc5\x03\x14\x03\x01\0" },
- { 0x1f56, "\x03\xc5\x03\x13\x03\x42\0" },
- { 0x1f57, "\x03\xc5\x03\x14\x03\x42\0" },
- { 0x1f59, "\x03\xa5\x03\x14\0" },
- { 0x1f5b, "\x03\xa5\x03\x14\x03\x00\0" },
- { 0x1f5d, "\x03\xa5\x03\x14\x03\x01\0" },
- { 0x1f5f, "\x03\xa5\x03\x14\x03\x42\0" },
- { 0x1f60, "\x03\xc9\x03\x13\0" },
- { 0x1f61, "\x03\xc9\x03\x14\0" },
- { 0x1f62, "\x03\xc9\x03\x13\x03\x00\0" },
- { 0x1f63, "\x03\xc9\x03\x14\x03\x00\0" },
- { 0x1f64, "\x03\xc9\x03\x13\x03\x01\0" },
- { 0x1f65, "\x03\xc9\x03\x14\x03\x01\0" },
- { 0x1f66, "\x03\xc9\x03\x13\x03\x42\0" },
- { 0x1f67, "\x03\xc9\x03\x14\x03\x42\0" },
- { 0x1f68, "\x03\xa9\x03\x13\0" },
- { 0x1f69, "\x03\xa9\x03\x14\0" },
- { 0x1f6a, "\x03\xa9\x03\x13\x03\x00\0" },
- { 0x1f6b, "\x03\xa9\x03\x14\x03\x00\0" },
- { 0x1f6c, "\x03\xa9\x03\x13\x03\x01\0" },
- { 0x1f6d, "\x03\xa9\x03\x14\x03\x01\0" },
- { 0x1f6e, "\x03\xa9\x03\x13\x03\x42\0" },
- { 0x1f6f, "\x03\xa9\x03\x14\x03\x42\0" },
- { 0x1f70, "\x03\xb1\x03\x00\0" },
- { 0x1f71, "\x03\xb1\x03\x01\0" },
- { 0x1f72, "\x03\xb5\x03\x00\0" },
- { 0x1f73, "\x03\xb5\x03\x01\0" },
- { 0x1f74, "\x03\xb7\x03\x00\0" },
- { 0x1f75, "\x03\xb7\x03\x01\0" },
- { 0x1f76, "\x03\xb9\x03\x00\0" },
- { 0x1f77, "\x03\xb9\x03\x01\0" },
- { 0x1f78, "\x03\xbf\x03\x00\0" },
- { 0x1f79, "\x03\xbf\x03\x01\0" },
- { 0x1f7a, "\x03\xc5\x03\x00\0" },
- { 0x1f7b, "\x03\xc5\x03\x01\0" },
- { 0x1f7c, "\x03\xc9\x03\x00\0" },
- { 0x1f7d, "\x03\xc9\x03\x01\0" },
- { 0x1f80, "\x03\xb1\x03\x13\x03\x45\0" },
- { 0x1f81, "\x03\xb1\x03\x14\x03\x45\0" },
- { 0x1f82, "\x03\xb1\x03\x13\x03\x00\x03\x45\0" },
- { 0x1f83, "\x03\xb1\x03\x14\x03\x00\x03\x45\0" },
- { 0x1f84, "\x03\xb1\x03\x13\x03\x01\x03\x45\0" },
- { 0x1f85, "\x03\xb1\x03\x14\x03\x01\x03\x45\0" },
- { 0x1f86, "\x03\xb1\x03\x13\x03\x42\x03\x45\0" },
- { 0x1f87, "\x03\xb1\x03\x14\x03\x42\x03\x45\0" },
- { 0x1f88, "\x03\x91\x03\x13\x03\x45\0" },
- { 0x1f89, "\x03\x91\x03\x14\x03\x45\0" },
- { 0x1f8a, "\x03\x91\x03\x13\x03\x00\x03\x45\0" },
- { 0x1f8b, "\x03\x91\x03\x14\x03\x00\x03\x45\0" },
- { 0x1f8c, "\x03\x91\x03\x13\x03\x01\x03\x45\0" },
- { 0x1f8d, "\x03\x91\x03\x14\x03\x01\x03\x45\0" },
- { 0x1f8e, "\x03\x91\x03\x13\x03\x42\x03\x45\0" },
- { 0x1f8f, "\x03\x91\x03\x14\x03\x42\x03\x45\0" },
- { 0x1f90, "\x03\xb7\x03\x13\x03\x45\0" },
- { 0x1f91, "\x03\xb7\x03\x14\x03\x45\0" },
- { 0x1f92, "\x03\xb7\x03\x13\x03\x00\x03\x45\0" },
- { 0x1f93, "\x03\xb7\x03\x14\x03\x00\x03\x45\0" },
- { 0x1f94, "\x03\xb7\x03\x13\x03\x01\x03\x45\0" },
- { 0x1f95, "\x03\xb7\x03\x14\x03\x01\x03\x45\0" },
- { 0x1f96, "\x03\xb7\x03\x13\x03\x42\x03\x45\0" },
- { 0x1f97, "\x03\xb7\x03\x14\x03\x42\x03\x45\0" },
- { 0x1f98, "\x03\x97\x03\x13\x03\x45\0" },
- { 0x1f99, "\x03\x97\x03\x14\x03\x45\0" },
- { 0x1f9a, "\x03\x97\x03\x13\x03\x00\x03\x45\0" },
- { 0x1f9b, "\x03\x97\x03\x14\x03\x00\x03\x45\0" },
- { 0x1f9c, "\x03\x97\x03\x13\x03\x01\x03\x45\0" },
- { 0x1f9d, "\x03\x97\x03\x14\x03\x01\x03\x45\0" },
- { 0x1f9e, "\x03\x97\x03\x13\x03\x42\x03\x45\0" },
- { 0x1f9f, "\x03\x97\x03\x14\x03\x42\x03\x45\0" },
- { 0x1fa0, "\x03\xc9\x03\x13\x03\x45\0" },
- { 0x1fa1, "\x03\xc9\x03\x14\x03\x45\0" },
- { 0x1fa2, "\x03\xc9\x03\x13\x03\x00\x03\x45\0" },
- { 0x1fa3, "\x03\xc9\x03\x14\x03\x00\x03\x45\0" },
- { 0x1fa4, "\x03\xc9\x03\x13\x03\x01\x03\x45\0" },
- { 0x1fa5, "\x03\xc9\x03\x14\x03\x01\x03\x45\0" },
- { 0x1fa6, "\x03\xc9\x03\x13\x03\x42\x03\x45\0" },
- { 0x1fa7, "\x03\xc9\x03\x14\x03\x42\x03\x45\0" },
- { 0x1fa8, "\x03\xa9\x03\x13\x03\x45\0" },
- { 0x1fa9, "\x03\xa9\x03\x14\x03\x45\0" },
- { 0x1faa, "\x03\xa9\x03\x13\x03\x00\x03\x45\0" },
- { 0x1fab, "\x03\xa9\x03\x14\x03\x00\x03\x45\0" },
- { 0x1fac, "\x03\xa9\x03\x13\x03\x01\x03\x45\0" },
- { 0x1fad, "\x03\xa9\x03\x14\x03\x01\x03\x45\0" },
- { 0x1fae, "\x03\xa9\x03\x13\x03\x42\x03\x45\0" },
- { 0x1faf, "\x03\xa9\x03\x14\x03\x42\x03\x45\0" },
- { 0x1fb0, "\x03\xb1\x03\x06\0" },
- { 0x1fb1, "\x03\xb1\x03\x04\0" },
- { 0x1fb2, "\x03\xb1\x03\x00\x03\x45\0" },
- { 0x1fb3, "\x03\xb1\x03\x45\0" },
- { 0x1fb4, "\x03\xb1\x03\x01\x03\x45\0" },
- { 0x1fb6, "\x03\xb1\x03\x42\0" },
- { 0x1fb7, "\x03\xb1\x03\x42\x03\x45\0" },
- { 0x1fb8, "\x03\x91\x03\x06\0" },
- { 0x1fb9, "\x03\x91\x03\x04\0" },
- { 0x1fba, "\x03\x91\x03\x00\0" },
- { 0x1fbb, "\x03\x91\x03\x01\0" },
- { 0x1fbc, "\x03\x91\x03\x45\0" },
- { 0x1fbe, "\x03\xb9\0" },
- { 0x1fc1, "\x00\xa8\x03\x42\0" },
- { 0x1fc2, "\x03\xb7\x03\x00\x03\x45\0" },
- { 0x1fc3, "\x03\xb7\x03\x45\0" },
- { 0x1fc4, "\x03\xb7\x03\x01\x03\x45\0" },
- { 0x1fc6, "\x03\xb7\x03\x42\0" },
- { 0x1fc7, "\x03\xb7\x03\x42\x03\x45\0" },
- { 0x1fc8, "\x03\x95\x03\x00\0" },
- { 0x1fc9, "\x03\x95\x03\x01\0" },
- { 0x1fca, "\x03\x97\x03\x00\0" },
- { 0x1fcb, "\x03\x97\x03\x01\0" },
- { 0x1fcc, "\x03\x97\x03\x45\0" },
- { 0x1fcd, "\x1f\xbf\x03\x00\0" },
- { 0x1fce, "\x1f\xbf\x03\x01\0" },
- { 0x1fcf, "\x1f\xbf\x03\x42\0" },
- { 0x1fd0, "\x03\xb9\x03\x06\0" },
- { 0x1fd1, "\x03\xb9\x03\x04\0" },
- { 0x1fd2, "\x03\xb9\x03\x08\x03\x00\0" },
- { 0x1fd3, "\x03\xb9\x03\x08\x03\x01\0" },
- { 0x1fd6, "\x03\xb9\x03\x42\0" },
- { 0x1fd7, "\x03\xb9\x03\x08\x03\x42\0" },
- { 0x1fd8, "\x03\x99\x03\x06\0" },
- { 0x1fd9, "\x03\x99\x03\x04\0" },
- { 0x1fda, "\x03\x99\x03\x00\0" },
- { 0x1fdb, "\x03\x99\x03\x01\0" },
- { 0x1fdd, "\x1f\xfe\x03\x00\0" },
- { 0x1fde, "\x1f\xfe\x03\x01\0" },
- { 0x1fdf, "\x1f\xfe\x03\x42\0" },
- { 0x1fe0, "\x03\xc5\x03\x06\0" },
- { 0x1fe1, "\x03\xc5\x03\x04\0" },
- { 0x1fe2, "\x03\xc5\x03\x08\x03\x00\0" },
- { 0x1fe3, "\x03\xc5\x03\x08\x03\x01\0" },
- { 0x1fe4, "\x03\xc1\x03\x13\0" },
- { 0x1fe5, "\x03\xc1\x03\x14\0" },
- { 0x1fe6, "\x03\xc5\x03\x42\0" },
- { 0x1fe7, "\x03\xc5\x03\x08\x03\x42\0" },
- { 0x1fe8, "\x03\xa5\x03\x06\0" },
- { 0x1fe9, "\x03\xa5\x03\x04\0" },
- { 0x1fea, "\x03\xa5\x03\x00\0" },
- { 0x1feb, "\x03\xa5\x03\x01\0" },
- { 0x1fec, "\x03\xa1\x03\x14\0" },
- { 0x1fed, "\x00\xa8\x03\x00\0" },
- { 0x1fee, "\x00\xa8\x03\x01\0" },
- { 0x1fef, "\x00\x60\0" },
- { 0x1ff2, "\x03\xc9\x03\x00\x03\x45\0" },
- { 0x1ff3, "\x03\xc9\x03\x45\0" },
- { 0x1ff4, "\x03\xc9\x03\x01\x03\x45\0" },
- { 0x1ff6, "\x03\xc9\x03\x42\0" },
- { 0x1ff7, "\x03\xc9\x03\x42\x03\x45\0" },
- { 0x1ff8, "\x03\x9f\x03\x00\0" },
- { 0x1ff9, "\x03\x9f\x03\x01\0" },
- { 0x1ffa, "\x03\xa9\x03\x00\0" },
- { 0x1ffb, "\x03\xa9\x03\x01\0" },
- { 0x1ffc, "\x03\xa9\x03\x45\0" },
- { 0x1ffd, "\x00\xb4\0" },
- { 0x2000, "\x20\x02\0" },
- { 0x2001, "\x20\x03\0" },
- { 0x2126, "\x03\xa9\0" },
- { 0x212a, "\x00\x4b\0" },
- { 0x212b, "\x00\x41\x03\x0a\0" },
- { 0x2204, "\x22\x03\x03\x38\0" },
- { 0x2209, "\x22\x08\x03\x38\0" },
- { 0x220c, "\x22\x0b\x03\x38\0" },
- { 0x2224, "\x22\x23\x03\x38\0" },
- { 0x2226, "\x22\x25\x03\x38\0" },
- { 0x2241, "\x00\x7e\x03\x38\0" },
- { 0x2244, "\x22\x43\x03\x38\0" },
- { 0x2247, "\x22\x45\x03\x38\0" },
- { 0x2249, "\x22\x48\x03\x38\0" },
- { 0x2260, "\x00\x3d\x03\x38\0" },
- { 0x2262, "\x22\x61\x03\x38\0" },
- { 0x226d, "\x22\x4d\x03\x38\0" },
- { 0x226e, "\x00\x3c\x03\x38\0" },
- { 0x226f, "\x00\x3e\x03\x38\0" },
- { 0x2270, "\x22\x64\x03\x38\0" },
- { 0x2271, "\x22\x65\x03\x38\0" },
- { 0x2274, "\x22\x72\x03\x38\0" },
- { 0x2275, "\x22\x73\x03\x38\0" },
- { 0x2278, "\x22\x76\x03\x38\0" },
- { 0x2279, "\x22\x77\x03\x38\0" },
- { 0x2280, "\x22\x7a\x03\x38\0" },
- { 0x2281, "\x22\x7b\x03\x38\0" },
- { 0x2284, "\x22\x82\x03\x38\0" },
- { 0x2285, "\x22\x83\x03\x38\0" },
- { 0x2288, "\x22\x86\x03\x38\0" },
- { 0x2289, "\x22\x87\x03\x38\0" },
- { 0x22ac, "\x22\xa2\x03\x38\0" },
- { 0x22ad, "\x22\xa8\x03\x38\0" },
- { 0x22ae, "\x22\xa9\x03\x38\0" },
- { 0x22af, "\x22\xab\x03\x38\0" },
- { 0x22e0, "\x22\x7c\x03\x38\0" },
- { 0x22e1, "\x22\x7d\x03\x38\0" },
- { 0x22e2, "\x22\x91\x03\x38\0" },
- { 0x22e3, "\x22\x92\x03\x38\0" },
- { 0x22ea, "\x22\xb2\x03\x38\0" },
- { 0x22eb, "\x22\xb3\x03\x38\0" },
- { 0x22ec, "\x22\xb4\x03\x38\0" },
- { 0x22ed, "\x22\xb5\x03\x38\0" },
- { 0x2329, "\x30\x08\0" },
- { 0x232a, "\x30\x09\0" },
- { 0x304c, "\x30\x4b\x30\x99\0" },
- { 0x304e, "\x30\x4d\x30\x99\0" },
- { 0x3050, "\x30\x4f\x30\x99\0" },
- { 0x3052, "\x30\x51\x30\x99\0" },
- { 0x3054, "\x30\x53\x30\x99\0" },
- { 0x3056, "\x30\x55\x30\x99\0" },
- { 0x3058, "\x30\x57\x30\x99\0" },
- { 0x305a, "\x30\x59\x30\x99\0" },
- { 0x305c, "\x30\x5b\x30\x99\0" },
- { 0x305e, "\x30\x5d\x30\x99\0" },
- { 0x3060, "\x30\x5f\x30\x99\0" },
- { 0x3062, "\x30\x61\x30\x99\0" },
- { 0x3065, "\x30\x64\x30\x99\0" },
- { 0x3067, "\x30\x66\x30\x99\0" },
- { 0x3069, "\x30\x68\x30\x99\0" },
- { 0x3070, "\x30\x6f\x30\x99\0" },
- { 0x3071, "\x30\x6f\x30\x9a\0" },
- { 0x3073, "\x30\x72\x30\x99\0" },
- { 0x3074, "\x30\x72\x30\x9a\0" },
- { 0x3076, "\x30\x75\x30\x99\0" },
- { 0x3077, "\x30\x75\x30\x9a\0" },
- { 0x3079, "\x30\x78\x30\x99\0" },
- { 0x307a, "\x30\x78\x30\x9a\0" },
- { 0x307c, "\x30\x7b\x30\x99\0" },
- { 0x307d, "\x30\x7b\x30\x9a\0" },
- { 0x3094, "\x30\x46\x30\x99\0" },
- { 0x309e, "\x30\x9d\x30\x99\0" },
- { 0x30ac, "\x30\xab\x30\x99\0" },
- { 0x30ae, "\x30\xad\x30\x99\0" },
- { 0x30b0, "\x30\xaf\x30\x99\0" },
- { 0x30b2, "\x30\xb1\x30\x99\0" },
- { 0x30b4, "\x30\xb3\x30\x99\0" },
- { 0x30b6, "\x30\xb5\x30\x99\0" },
- { 0x30b8, "\x30\xb7\x30\x99\0" },
- { 0x30ba, "\x30\xb9\x30\x99\0" },
- { 0x30bc, "\x30\xbb\x30\x99\0" },
- { 0x30be, "\x30\xbd\x30\x99\0" },
- { 0x30c0, "\x30\xbf\x30\x99\0" },
- { 0x30c2, "\x30\xc1\x30\x99\0" },
- { 0x30c5, "\x30\xc4\x30\x99\0" },
- { 0x30c7, "\x30\xc6\x30\x99\0" },
- { 0x30c9, "\x30\xc8\x30\x99\0" },
- { 0x30d0, "\x30\xcf\x30\x99\0" },
- { 0x30d1, "\x30\xcf\x30\x9a\0" },
- { 0x30d3, "\x30\xd2\x30\x99\0" },
- { 0x30d4, "\x30\xd2\x30\x9a\0" },
- { 0x30d6, "\x30\xd5\x30\x99\0" },
- { 0x30d7, "\x30\xd5\x30\x9a\0" },
- { 0x30d9, "\x30\xd8\x30\x99\0" },
- { 0x30da, "\x30\xd8\x30\x9a\0" },
- { 0x30dc, "\x30\xdb\x30\x99\0" },
- { 0x30dd, "\x30\xdb\x30\x9a\0" },
- { 0x30f4, "\x30\xa6\x30\x99\0" },
- { 0x30f7, "\x30\xef\x30\x99\0" },
- { 0x30f8, "\x30\xf0\x30\x99\0" },
- { 0x30f9, "\x30\xf1\x30\x99\0" },
- { 0x30fa, "\x30\xf2\x30\x99\0" },
- { 0x30fe, "\x30\xfd\x30\x99\0" },
- { 0xf900, "\x8c\x48\0" },
- { 0xf901, "\x66\xf4\0" },
- { 0xf902, "\x8e\xca\0" },
- { 0xf903, "\x8c\xc8\0" },
- { 0xf904, "\x6e\xd1\0" },
- { 0xf905, "\x4e\x32\0" },
- { 0xf906, "\x53\xe5\0" },
- { 0xf907, "\x9f\x9c\0" },
- { 0xf908, "\x9f\x9c\0" },
- { 0xf909, "\x59\x51\0" },
- { 0xf90a, "\x91\xd1\0" },
- { 0xf90b, "\x55\x87\0" },
- { 0xf90c, "\x59\x48\0" },
- { 0xf90d, "\x61\xf6\0" },
- { 0xf90e, "\x76\x69\0" },
- { 0xf90f, "\x7f\x85\0" },
- { 0xf910, "\x86\x3f\0" },
- { 0xf911, "\x87\xba\0" },
- { 0xf912, "\x88\xf8\0" },
- { 0xf913, "\x90\x8f\0" },
- { 0xf914, "\x6a\x02\0" },
- { 0xf915, "\x6d\x1b\0" },
- { 0xf916, "\x70\xd9\0" },
- { 0xf917, "\x73\xde\0" },
- { 0xf918, "\x84\x3d\0" },
- { 0xf919, "\x91\x6a\0" },
- { 0xf91a, "\x99\xf1\0" },
- { 0xf91b, "\x4e\x82\0" },
- { 0xf91c, "\x53\x75\0" },
- { 0xf91d, "\x6b\x04\0" },
- { 0xf91e, "\x72\x1b\0" },
- { 0xf91f, "\x86\x2d\0" },
- { 0xf920, "\x9e\x1e\0" },
- { 0xf921, "\x5d\x50\0" },
- { 0xf922, "\x6f\xeb\0" },
- { 0xf923, "\x85\xcd\0" },
- { 0xf924, "\x89\x64\0" },
- { 0xf925, "\x62\xc9\0" },
- { 0xf926, "\x81\xd8\0" },
- { 0xf927, "\x88\x1f\0" },
- { 0xf928, "\x5e\xca\0" },
- { 0xf929, "\x67\x17\0" },
- { 0xf92a, "\x6d\x6a\0" },
- { 0xf92b, "\x72\xfc\0" },
- { 0xf92c, "\x90\xce\0" },
- { 0xf92d, "\x4f\x86\0" },
- { 0xf92e, "\x51\xb7\0" },
- { 0xf92f, "\x52\xde\0" },
- { 0xf930, "\x64\xc4\0" },
- { 0xf931, "\x6a\xd3\0" },
- { 0xf932, "\x72\x10\0" },
- { 0xf933, "\x76\xe7\0" },
- { 0xf934, "\x80\x01\0" },
- { 0xf935, "\x86\x06\0" },
- { 0xf936, "\x86\x5c\0" },
- { 0xf937, "\x8d\xef\0" },
- { 0xf938, "\x97\x32\0" },
- { 0xf939, "\x9b\x6f\0" },
- { 0xf93a, "\x9d\xfa\0" },
- { 0xf93b, "\x78\x8c\0" },
- { 0xf93c, "\x79\x7f\0" },
- { 0xf93d, "\x7d\xa0\0" },
- { 0xf93e, "\x83\xc9\0" },
- { 0xf93f, "\x93\x04\0" },
- { 0xf940, "\x9e\x7f\0" },
- { 0xf941, "\x8a\xd6\0" },
- { 0xf942, "\x58\xdf\0" },
- { 0xf943, "\x5f\x04\0" },
- { 0xf944, "\x7c\x60\0" },
- { 0xf945, "\x80\x7e\0" },
- { 0xf946, "\x72\x62\0" },
- { 0xf947, "\x78\xca\0" },
- { 0xf948, "\x8c\xc2\0" },
- { 0xf949, "\x96\xf7\0" },
- { 0xf94a, "\x58\xd8\0" },
- { 0xf94b, "\x5c\x62\0" },
- { 0xf94c, "\x6a\x13\0" },
- { 0xf94d, "\x6d\xda\0" },
- { 0xf94e, "\x6f\x0f\0" },
- { 0xf94f, "\x7d\x2f\0" },
- { 0xf950, "\x7e\x37\0" },
- { 0xf951, "\x96\xfb\0" },
- { 0xf952, "\x52\xd2\0" },
- { 0xf953, "\x80\x8b\0" },
- { 0xf954, "\x51\xdc\0" },
- { 0xf955, "\x51\xcc\0" },
- { 0xf956, "\x7a\x1c\0" },
- { 0xf957, "\x7d\xbe\0" },
- { 0xf958, "\x83\xf1\0" },
- { 0xf959, "\x96\x75\0" },
- { 0xf95a, "\x8b\x80\0" },
- { 0xf95b, "\x62\xcf\0" },
- { 0xf95c, "\x6a\x02\0" },
- { 0xf95d, "\x8a\xfe\0" },
- { 0xf95e, "\x4e\x39\0" },
- { 0xf95f, "\x5b\xe7\0" },
- { 0xf960, "\x60\x12\0" },
- { 0xf961, "\x73\x87\0" },
- { 0xf962, "\x75\x70\0" },
- { 0xf963, "\x53\x17\0" },
- { 0xf964, "\x78\xfb\0" },
- { 0xf965, "\x4f\xbf\0" },
- { 0xf966, "\x5f\xa9\0" },
- { 0xf967, "\x4e\x0d\0" },
- { 0xf968, "\x6c\xcc\0" },
- { 0xf969, "\x65\x78\0" },
- { 0xf96a, "\x7d\x22\0" },
- { 0xf96b, "\x53\xc3\0" },
- { 0xf96c, "\x58\x5e\0" },
- { 0xf96d, "\x77\x01\0" },
- { 0xf96e, "\x84\x49\0" },
- { 0xf96f, "\x8a\xaa\0" },
- { 0xf970, "\x6b\xba\0" },
- { 0xf971, "\x8f\xb0\0" },
- { 0xf972, "\x6c\x88\0" },
- { 0xf973, "\x62\xfe\0" },
- { 0xf974, "\x82\xe5\0" },
- { 0xf975, "\x63\xa0\0" },
- { 0xf976, "\x75\x65\0" },
- { 0xf977, "\x4e\xae\0" },
- { 0xf978, "\x51\x69\0" },
- { 0xf979, "\x51\xc9\0" },
- { 0xf97a, "\x68\x81\0" },
- { 0xf97b, "\x7c\xe7\0" },
- { 0xf97c, "\x82\x6f\0" },
- { 0xf97d, "\x8a\xd2\0" },
- { 0xf97e, "\x91\xcf\0" },
- { 0xf97f, "\x52\xf5\0" },
- { 0xf980, "\x54\x42\0" },
- { 0xf981, "\x59\x73\0" },
- { 0xf982, "\x5e\xec\0" },
- { 0xf983, "\x65\xc5\0" },
- { 0xf984, "\x6f\xfe\0" },
- { 0xf985, "\x79\x2a\0" },
- { 0xf986, "\x95\xad\0" },
- { 0xf987, "\x9a\x6a\0" },
- { 0xf988, "\x9e\x97\0" },
- { 0xf989, "\x9e\xce\0" },
- { 0xf98a, "\x52\x9b\0" },
- { 0xf98b, "\x66\xc6\0" },
- { 0xf98c, "\x6b\x77\0" },
- { 0xf98d, "\x8f\x62\0" },
- { 0xf98e, "\x5e\x74\0" },
- { 0xf98f, "\x61\x90\0" },
- { 0xf990, "\x62\x00\0" },
- { 0xf991, "\x64\x9a\0" },
- { 0xf992, "\x6f\x23\0" },
- { 0xf993, "\x71\x49\0" },
- { 0xf994, "\x74\x89\0" },
- { 0xf995, "\x79\xca\0" },
- { 0xf996, "\x7d\xf4\0" },
- { 0xf997, "\x80\x6f\0" },
- { 0xf998, "\x8f\x26\0" },
- { 0xf999, "\x84\xee\0" },
- { 0xf99a, "\x90\x23\0" },
- { 0xf99b, "\x93\x4a\0" },
- { 0xf99c, "\x52\x17\0" },
- { 0xf99d, "\x52\xa3\0" },
- { 0xf99e, "\x54\xbd\0" },
- { 0xf99f, "\x70\xc8\0" },
- { 0xf9a0, "\x88\xc2\0" },
- { 0xf9a1, "\x8a\xaa\0" },
- { 0xf9a2, "\x5e\xc9\0" },
- { 0xf9a3, "\x5f\xf5\0" },
- { 0xf9a4, "\x63\x7b\0" },
- { 0xf9a5, "\x6b\xae\0" },
- { 0xf9a6, "\x7c\x3e\0" },
- { 0xf9a7, "\x73\x75\0" },
- { 0xf9a8, "\x4e\xe4\0" },
- { 0xf9a9, "\x56\xf9\0" },
- { 0xf9aa, "\x5b\xe7\0" },
- { 0xf9ab, "\x5d\xba\0" },
- { 0xf9ac, "\x60\x1c\0" },
- { 0xf9ad, "\x73\xb2\0" },
- { 0xf9ae, "\x74\x69\0" },
- { 0xf9af, "\x7f\x9a\0" },
- { 0xf9b0, "\x80\x46\0" },
- { 0xf9b1, "\x92\x34\0" },
- { 0xf9b2, "\x96\xf6\0" },
- { 0xf9b3, "\x97\x48\0" },
- { 0xf9b4, "\x98\x18\0" },
- { 0xf9b5, "\x4f\x8b\0" },
- { 0xf9b6, "\x79\xae\0" },
- { 0xf9b7, "\x91\xb4\0" },
- { 0xf9b8, "\x96\xb8\0" },
- { 0xf9b9, "\x60\xe1\0" },
- { 0xf9ba, "\x4e\x86\0" },
- { 0xf9bb, "\x50\xda\0" },
- { 0xf9bc, "\x5b\xee\0" },
- { 0xf9bd, "\x5c\x3f\0" },
- { 0xf9be, "\x65\x99\0" },
- { 0xf9bf, "\x6a\x02\0" },
- { 0xf9c0, "\x71\xce\0" },
- { 0xf9c1, "\x76\x42\0" },
- { 0xf9c2, "\x84\xfc\0" },
- { 0xf9c3, "\x90\x7c\0" },
- { 0xf9c4, "\x9f\x8d\0" },
- { 0xf9c5, "\x66\x88\0" },
- { 0xf9c6, "\x96\x2e\0" },
- { 0xf9c7, "\x52\x89\0" },
- { 0xf9c8, "\x67\x7b\0" },
- { 0xf9c9, "\x67\xf3\0" },
- { 0xf9ca, "\x6d\x41\0" },
- { 0xf9cb, "\x6e\x9c\0" },
- { 0xf9cc, "\x74\x09\0" },
- { 0xf9cd, "\x75\x59\0" },
- { 0xf9ce, "\x78\x6b\0" },
- { 0xf9cf, "\x7d\x10\0" },
- { 0xf9d0, "\x98\x5e\0" },
- { 0xf9d1, "\x51\x6d\0" },
- { 0xf9d2, "\x62\x2e\0" },
- { 0xf9d3, "\x96\x78\0" },
- { 0xf9d4, "\x50\x2b\0" },
- { 0xf9d5, "\x5d\x19\0" },
- { 0xf9d6, "\x6d\xea\0" },
- { 0xf9d7, "\x8f\x2a\0" },
- { 0xf9d8, "\x5f\x8b\0" },
- { 0xf9d9, "\x61\x44\0" },
- { 0xf9da, "\x68\x17\0" },
- { 0xf9db, "\x73\x87\0" },
- { 0xf9dc, "\x96\x86\0" },
- { 0xf9dd, "\x52\x29\0" },
- { 0xf9de, "\x54\x0f\0" },
- { 0xf9df, "\x5c\x65\0" },
- { 0xf9e0, "\x66\x13\0" },
- { 0xf9e1, "\x67\x4e\0" },
- { 0xf9e2, "\x68\xa8\0" },
- { 0xf9e3, "\x6c\xe5\0" },
- { 0xf9e4, "\x74\x06\0" },
- { 0xf9e5, "\x75\xe2\0" },
- { 0xf9e6, "\x7f\x79\0" },
- { 0xf9e7, "\x88\xcf\0" },
- { 0xf9e8, "\x88\xe1\0" },
- { 0xf9e9, "\x91\xcc\0" },
- { 0xf9ea, "\x96\xe2\0" },
- { 0xf9eb, "\x53\x3f\0" },
- { 0xf9ec, "\x6e\xba\0" },
- { 0xf9ed, "\x54\x1d\0" },
- { 0xf9ee, "\x71\xd0\0" },
- { 0xf9ef, "\x74\x98\0" },
- { 0xf9f0, "\x85\xfa\0" },
- { 0xf9f1, "\x96\xa3\0" },
- { 0xf9f2, "\x9c\x57\0" },
- { 0xf9f3, "\x9e\x9f\0" },
- { 0xf9f4, "\x67\x97\0" },
- { 0xf9f5, "\x6d\xcb\0" },
- { 0xf9f6, "\x81\xe8\0" },
- { 0xf9f7, "\x7a\xcb\0" },
- { 0xf9f8, "\x7b\x20\0" },
- { 0xf9f9, "\x7c\x92\0" },
- { 0xf9fa, "\x72\xc0\0" },
- { 0xf9fb, "\x70\x99\0" },
- { 0xf9fc, "\x8b\x58\0" },
- { 0xf9fd, "\x4e\xc0\0" },
- { 0xf9fe, "\x83\x36\0" },
- { 0xf9ff, "\x52\x3a\0" },
- { 0xfa00, "\x52\x07\0" },
- { 0xfa01, "\x5e\xa6\0" },
- { 0xfa02, "\x62\xd3\0" },
- { 0xfa03, "\x7c\xd6\0" },
- { 0xfa04, "\x5b\x85\0" },
- { 0xfa05, "\x6d\x1e\0" },
- { 0xfa06, "\x66\xb4\0" },
- { 0xfa07, "\x8f\x3b\0" },
- { 0xfa08, "\x88\x4c\0" },
- { 0xfa09, "\x96\x4d\0" },
- { 0xfa0a, "\x89\x8b\0" },
- { 0xfa0b, "\x5e\xd3\0" },
- { 0xfa0c, "\x51\x40\0" },
- { 0xfa0d, "\x55\xc0\0" },
- { 0xfa10, "\x58\x5a\0" },
- { 0xfa12, "\x66\x74\0" },
- { 0xfa15, "\x51\xde\0" },
- { 0xfa16, "\x73\x2a\0" },
- { 0xfa17, "\x76\xca\0" },
- { 0xfa18, "\x79\x3c\0" },
- { 0xfa19, "\x79\x5e\0" },
- { 0xfa1a, "\x79\x65\0" },
- { 0xfa1b, "\x79\x8f\0" },
- { 0xfa1c, "\x97\x56\0" },
- { 0xfa1d, "\x7c\xbe\0" },
- { 0xfa1e, "\x7f\xbd\0" },
- { 0xfa20, "\x86\x12\0" },
- { 0xfa22, "\x8a\xf8\0" },
- { 0xfa25, "\x90\x38\0" },
- { 0xfa26, "\x90\xfd\0" },
- { 0xfa2a, "\x98\xef\0" },
- { 0xfa2b, "\x98\xfc\0" },
- { 0xfa2c, "\x99\x28\0" },
- { 0xfa2d, "\x9d\xb4\0" },
- { 0xfb1f, "\x05\xf2\x05\xb7\0" },
- { 0xfb2a, "\x05\xe9\x05\xc1\0" },
- { 0xfb2b, "\x05\xe9\x05\xc2\0" },
- { 0xfb2c, "\x05\xe9\x05\xbc\x05\xc1\0" },
- { 0xfb2d, "\x05\xe9\x05\xbc\x05\xc2\0" },
- { 0xfb2e, "\x05\xd0\x05\xb7\0" },
- { 0xfb2f, "\x05\xd0\x05\xb8\0" },
- { 0xfb30, "\x05\xd0\x05\xbc\0" },
- { 0xfb31, "\x05\xd1\x05\xbc\0" },
- { 0xfb32, "\x05\xd2\x05\xbc\0" },
- { 0xfb33, "\x05\xd3\x05\xbc\0" },
- { 0xfb34, "\x05\xd4\x05\xbc\0" },
- { 0xfb35, "\x05\xd5\x05\xbc\0" },
- { 0xfb36, "\x05\xd6\x05\xbc\0" },
- { 0xfb38, "\x05\xd8\x05\xbc\0" },
- { 0xfb39, "\x05\xd9\x05\xbc\0" },
- { 0xfb3a, "\x05\xda\x05\xbc\0" },
- { 0xfb3b, "\x05\xdb\x05\xbc\0" },
- { 0xfb3c, "\x05\xdc\x05\xbc\0" },
- { 0xfb3e, "\x05\xde\x05\xbc\0" },
- { 0xfb40, "\x05\xe0\x05\xbc\0" },
- { 0xfb41, "\x05\xe1\x05\xbc\0" },
- { 0xfb43, "\x05\xe3\x05\xbc\0" },
- { 0xfb44, "\x05\xe4\x05\xbc\0" },
- { 0xfb46, "\x05\xe6\x05\xbc\0" },
- { 0xfb47, "\x05\xe7\x05\xbc\0" },
- { 0xfb48, "\x05\xe8\x05\xbc\0" },
- { 0xfb49, "\x05\xe9\x05\xbc\0" },
- { 0xfb4a, "\x05\xea\x05\xbc\0" },
- { 0xfb4b, "\x05\xd5\x05\xb9\0" },
- { 0xfb4c, "\x05\xd1\x05\xbf\0" },
- { 0xfb4d, "\x05\xdb\x05\xbf\0" },
- { 0xfb4e, "\x05\xe4\x05\xbf\0" }
-};
-
-/*
- * WARNING!
- *
- * NO BUFFER CHECKING AHEAD!
- *
- */
-
-static gint
-e_canonical_decomposition (gunichar ch, gunichar * buf)
-{
- gint len = 0;
-
- if (ch <= 0xffff)
- {
- int start = 0;
- int end = sizeof (e_decomp_table) / sizeof (e_decomp_table[0]);
- while (start != end)
- {
- int half = (start + end) / 2;
- if (ch == e_decomp_table[half].ch) {
- /* Found it. */
- int i;
- /* We store as a double-nul terminated string. */
- for (len = 0; (e_decomp_table[half].expansion[len] || e_decomp_table[half].expansion[len + 1]); len += 2) ;
-
- /* We've counted twice as many bytes as there are
- characters. */
- len /= 2;
-
- for (i = 0; i < len; i ++) {
- buf[i] = (e_decomp_table[half].expansion[2 * i] << 8) | e_decomp_table[half].expansion[2 * i + 1];
- }
- break;
- } else if (ch > e_decomp_table[half].ch) {
- if (start == half) break;
- start = half;
- } else {
- if (end == half) break;
- end = half;
- }
- }
- }
-
- if (len == 0)
- {
- /* Not in our table. */
- *buf = ch;
- len = 1;
- }
-
- /* Supposedly following the Unicode 2.1.9 table means that the
- decompositions come out in canonical order. I haven't tested
- this, but we rely on it here. */
- return len;
-}
-
-static gunichar
-e_stripped_char (gunichar ch)
-{
- gunichar decomp[MAX_DECOMP];
- GUnicodeType utype;
- gint dlen;
-
- utype = g_unichar_type (ch);
-
- switch (utype) {
- case G_UNICODE_CONTROL:
- case G_UNICODE_FORMAT:
- case G_UNICODE_UNASSIGNED:
- case G_UNICODE_COMBINING_MARK:
- /* Ignore those */
- return 0;
- break;
- default:
- /* Convert to lowercase, fall through */
- ch = g_unichar_tolower (ch);
- case G_UNICODE_LOWERCASE_LETTER:
- dlen = e_canonical_decomposition (ch, decomp);
- if (dlen > 0) return *decomp;
- break;
- }
-
- return 0;
-}
-
-gchar *
-e_xml_get_translated_utf8_string_prop_by_name (const xmlNode *parent, const xmlChar *prop_name)
-{
- xmlChar *prop;
- gchar *ret_val = NULL;
- gchar *combined_name;
-
- g_return_val_if_fail (parent != NULL, 0);
- g_return_val_if_fail (prop_name != NULL, 0);
-
- prop = xmlGetProp ((xmlNode *) parent, prop_name);
- if (prop != NULL) {
- ret_val = g_strdup (prop);
- xmlFree (prop);
- return ret_val;
- }
-
- combined_name = g_strdup_printf("_%s", prop_name);
- prop = xmlGetProp ((xmlNode *) parent, combined_name);
- if (prop != NULL) {
- ret_val = e_utf8_from_locale_string (gettext (prop));
- xmlFree (prop);
- }
- g_free(combined_name);
-
- return ret_val;
-}
diff --git a/widgets/misc/e-unicode.h b/widgets/misc/e-unicode.h
deleted file mode 100644
index 0a3b3ccafe..0000000000
--- a/widgets/misc/e-unicode.h
+++ /dev/null
@@ -1,133 +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_gtk_string (GtkWidget *widget,
- const gchar *string);
-gchar *e_utf8_from_gtk_string_sized (GtkWidget *widget,
- const gchar *string,
- gint bytes);
-gchar *e_utf8_to_gtk_string (GtkWidget *widget,
- const gchar *string);
-gchar *e_utf8_to_gtk_string_sized (GtkWidget *widget,
- const gchar *string,
- gint bytes);
-gchar *e_utf8_from_locale_string (const gchar *string);
-gchar *e_utf8_from_locale_string_sized (const gchar *string,
- gint bytes);
-gchar *e_utf8_to_locale_string (const gchar *string);
-gchar *e_utf8_to_locale_string_sized (const gchar *string,
- gint bytes);
-gboolean e_utf8_is_ascii (const gchar *string);
-/*
- * These are simple wrappers that save us some typing
- */
-
-/* NB! This return newly allocated string, not const as gtk+ one */
-gchar *e_utf8_gtk_entry_get_text (GtkEntry *entry);
-void e_utf8_gtk_entry_set_text (GtkEntry *entry,
- const gchar *text);
-gchar *e_utf8_gtk_editable_get_text (GtkEditable *editable);
-void e_utf8_gtk_editable_set_text (GtkEditable *editable,
- const gchar *text);
-gchar *e_utf8_gtk_editable_get_chars (GtkEditable *editable,
- gint start,
- gint end);
-void e_utf8_gtk_editable_insert_text (GtkEditable *editable,
- const gchar *text,
- gint length,
- gint *position);
-GtkWidget *e_utf8_gtk_menu_item_new_with_label (GtkMenu *menu,
- const gchar *label);
-void e_utf8_gtk_clist_set_text (GtkCList *clist,
- gint row,
- gint col,
- const gchar *text);
-gint e_utf8_gtk_clist_append (GtkCList *clist,
- gchar *text[]);
-gchar *e_utf8_xml1_decode (const gchar *text);
-gchar *e_utf8_xml1_encode (const gchar *text);
-gint e_unichar_to_utf8 (gint c,
- gchar *outbuf);
-gchar *e_unicode_get_utf8 (const gchar *text,
- gunichar *out);
-guint32 gdk_keyval_to_unicode (guint keysym);
-gchar *e_xml_get_translated_utf8_string_prop_by_name (const xmlNode *parent,
- const xmlChar *prop_name);
-
-G_END_DECLS
-
-#endif
-
-
diff --git a/widgets/misc/gal-categories.glade b/widgets/misc/gal-categories.glade
deleted file mode 100644
index 98286545b3..0000000000
--- a/widgets/misc/gal-categories.glade
+++ /dev/null
@@ -1,168 +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="visible">no</property>
- <property name="title" translatable="yes">categories</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-ok</property>
- <property name="use_stock">yes</property>
- <property name="use_underline">yes</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkButton" id="button4">
- <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-categories">
- <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="GtkEntry" id="entry-categories">
- <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="GtkLabel" id="label-header">
- <property name="label" translatable="yes">Item(s) belong to these _categories:</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">no</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>
- <property name="visible">yes</property>
- <property name="use_underline">yes</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>
-
- <child>
- <widget class="GtkLabel" id="label2">
- <property name="label" translatable="yes">_Available Categories:</property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">no</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="visible">yes</property>
- <property name="use_underline">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="GtkButton" id="button-ecmld">
- <property name="can_focus">yes</property>
- <property name="label" translatable="yes">Edit Master Category List...</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="visible">yes</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="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>
- </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/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 3199e9b917..0000000000
--- a/widgets/table/e-cell-combo.c
+++ /dev/null
@@ -1,658 +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 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_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_after (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;
-
- e_cell_combo_show_popup (ecc, row, view_col);
- e_cell_combo_select_matching_item (ecc);
-
- if (event->type == GDK_BUTTON_PRESS) {
- GTK_LIST (ecc->popup_list)->drag_selection = TRUE;
- time = event->button.time;
- } else {
- time = event->key.time;
- }
-
- error_code = gdk_pointer_grab (ecc->popup_list->window, TRUE,
- GDK_ENTER_NOTIFY_MASK |
- GDK_BUTTON_PRESS_MASK |
- GDK_BUTTON_RELEASE_MASK |
- GDK_POINTER_MOTION_HINT_MASK |
- GDK_BUTTON1_MOTION_MASK,
- NULL, NULL, time);
- if (error_code != 0)
- g_warning ("Failed to get pointer grab (%i)", error_code);
- gtk_grab_add (ecc->popup_window);
-
- return TRUE;
-}
-
-
-static void
-e_cell_combo_select_matching_item (ECellCombo *ecc)
-{
- ECellPopup *ecp = E_CELL_POPUP (ecc);
- ECellView *ecv = (ECellView*) ecp->popup_cell_view;
- ECellText *ecell_text = E_CELL_TEXT (ecp->child);
- ETableItem *eti = E_TABLE_ITEM (ecp->popup_cell_view->cell_view.e_table_item_view);
- ETableCol *ecol;
- GtkList *list;
- GtkWidget *listitem;
- GList *elem;
- gboolean found = FALSE;
- char *cell_text, *list_item_text;
-
- ecol = e_table_header_get_column (eti->header, ecp->popup_view_col);
- cell_text = e_cell_text_get_text (ecell_text, ecv->e_table_model,
- ecol->col_idx, ecp->popup_row);
-
- list = GTK_LIST (ecc->popup_list);
- elem = list->children;
- while (elem) {
- listitem = GTK_WIDGET (elem->data);
-
- /* We need to compare against the UTF-8 text. */
- list_item_text = 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;
-}
-
-
-
-
-/* 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 2b9c97c955..0000000000
--- a/widgets/table/e-cell-date.c
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * e-cell-date.c - Date item for e-table.
- * Copyright 2001, Ximian, Inc.
- *
- * Author:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#include <config.h>
-
-#include "e-cell-date.h"
-
-#include <sys/time.h>
-#include <time.h>
-#include <unistd.h>
-#include <string.h>
-#include <gal/util/e-util.h>
-#include <gal/widgets/e-unicode.h>
-#include <gal/util/e-i18n.h>
-
-#define PARENT_TYPE e_cell_text_get_type ()
-
-static ECellTextClass *parent_class;
-
-static char *
-ecd_get_text(ECellText *cell, ETableModel *model, int col, int row)
-{
- time_t date = GPOINTER_TO_INT (e_table_model_value_at(model, col, row));
- time_t nowdate = time(NULL);
- time_t yesdate;
- struct tm then, now, yesterday;
- char buf[26];
- char *temp, *ret_val;
- gboolean done = FALSE;
-
- if (date == 0) {
- return e_utf8_from_locale_string (_("?"));
- }
-
- localtime_r (&date, &then);
- localtime_r (&nowdate, &now);
-
- if (nowdate - date < 60 * 60 * 8 && nowdate > date) {
- e_strftime_fix_am_pm (buf, 26, _("%l:%M %p"), &then);
- done = TRUE;
- }
-
- if (!done) {
- if (then.tm_mday == now.tm_mday &&
- then.tm_mon == now.tm_mon &&
- then.tm_year == now.tm_year) {
- e_strftime_fix_am_pm (buf, 26, _("Today %l:%M %p"), &then);
- done = TRUE;
- }
- }
- if (!done) {
- yesdate = nowdate - 60 * 60 * 24;
- localtime_r (&yesdate, &yesterday);
- if (then.tm_mday == yesterday.tm_mday &&
- then.tm_mon == yesterday.tm_mon &&
- then.tm_year == yesterday.tm_year) {
-#if 0
- if (nowdate - date < 60 * 60 * 12) {
- e_strftime_fix_am_pm (buf, 26, _("Late Yesterday %l:%M %p"), &then);
- } else {
-#endif
- e_strftime_fix_am_pm (buf, 26, _("Yesterday %l:%M %p"), &then);
-#if 0
- }
-#endif
- done = TRUE;
- }
- }
- if (!done) {
- int i;
- for (i = 2; i < 7; i++) {
- yesdate = nowdate - 60 * 60 * 24 * i;
- localtime_r (&yesdate, &yesterday);
- if (then.tm_mday == yesterday.tm_mday &&
- then.tm_mon == yesterday.tm_mon &&
- then.tm_year == yesterday.tm_year) {
- e_strftime_fix_am_pm (buf, 26, _("%a %l:%M %p"), &then);
- done = TRUE;
- break;
- }
- }
- }
- if (!done) {
- if (then.tm_year == now.tm_year) {
- e_strftime_fix_am_pm (buf, 26, _("%b %d %l:%M %p"), &then);
- } else {
- e_strftime_fix_am_pm (buf, 26, _("%b %d %Y"), &then);
- }
- }
-#if 0
-#ifdef CTIME_R_THREE_ARGS
- ctime_r (&date, buf, 26);
-#else
- ctime_r (&date, buf);
-#endif
-#endif
- temp = buf;
- while ((temp = strstr (temp, " "))) {
- memmove (temp, temp + 1, strlen (temp));
- }
- temp = e_strdup_strip (buf);
- ret_val = e_utf8_from_locale_string (temp);
- g_free (temp);
- return ret_val;
-}
-
-static void
-ecd_free_text(ECellText *cell, char *text)
-{
- g_free(text);
-}
-
-static void
-e_cell_date_class_init (GtkObjectClass *object_class)
-{
- ECellTextClass *ectc = (ECellTextClass *) object_class;
-
- parent_class = 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", "bold_column" and "color_column" set
- * and return an integer that points to a column in the model that controls
- * these settings. So controlling the way things are rendered is achieved
- * by having special columns in the model that will be used to flag whether
- * the date should be rendered with strikeout, or bolded. In the case of
- * the "color_column" argument, the column in the model is expected to have
- * a string that can be parsed by gdk_color_parse().
- *
- * Returns: an ECell object that can be used to render dates.
- */
-ECell *
-e_cell_date_new (const char *fontname, GtkJustification justify)
-{
- ECellDate *ecd = 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 195b6a7aa3..0000000000
--- a/widgets/table/e-cell-popup.c
+++ /dev/null
@@ -1,526 +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);
-
- g_print ("Event in item popup width: %i button: %g,%g\n",
- width, event->button.x, event->button.y);
-
- /* FIXME: The event coords seem to be relative to the
- text within the cell, so we have to add 4. */
- if (event->button.x + 4 >= width - E_CELL_POPUP_ARROW_WIDTH) {
- return e_cell_popup_do_popup (ecp_view, event, row, view_col);
- }
- }
- break;
- case GDK_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) {
- g_print ("## Alt-Down pressed\n");
- return e_cell_popup_do_popup (ecp_view, event, row, view_col);
- }
- g_print ("Key Press Event ECellPopup\n");
- break;
- default:
- break;
- }
-
- return e_cell_event (ecp_view->child_view, event, model_col, view_col,
- row, flags, actions);
-}
-
-
-/*
- * ECell::height method
- */
-static int
-ecp_height (ECellView *ecv, int model_col, int view_col, int row)
-{
- ECellPopupView *ecp_view = (ECellPopupView *) ecv;
-
- return e_cell_height (ecp_view->child_view, model_col, view_col, row);
-}
-
-
-/*
- * ECellView::enter_edit method
- */
-static void *
-ecp_enter_edit (ECellView *ecv, int model_col, int view_col, int row)
-{
- ECellPopupView *ecp_view = (ECellPopupView *) ecv;
-
- g_print ("In ecp_enter_edit model_col: %i view_col: %i row: %i\n",
- model_col, view_col, row);
-
- return e_cell_enter_edit (ecp_view->child_view, model_col, view_col, row);
-}
-
-
-/*
- * ECellView::leave_edit method
- */
-static void
-ecp_leave_edit (ECellView *ecv, int model_col, int view_col, int row,
- void *edit_context)
-{
- ECellPopupView *ecp_view = (ECellPopupView *) ecv;
-
- g_print ("In ecp_leave_edit model_col: %i view_col: %i row: %i\n",
- model_col, view_col, row);
-
- e_cell_leave_edit (ecp_view->child_view, model_col, view_col, row,
- edit_context);
-}
-
-
-static void
-ecp_print (ECellView *ecv, GnomePrintContext *context,
- int model_col, int view_col, int row, double width, double height)
-{
- ECellPopupView *ecp_view = (ECellPopupView *) ecv;
-
- e_cell_print (ecp_view->child_view, context, model_col, view_col, row,
- width, height);
-}
-
-
-static gdouble
-ecp_print_height (ECellView *ecv, GnomePrintContext *context,
- int model_col, int view_col, int row,
- double width)
-{
- ECellPopupView *ecp_view = (ECellPopupView *) ecv;
-
- return e_cell_print_height (ecp_view->child_view, context, model_col,
- view_col, row, width);
-}
-
-
-static int
-ecp_max_width (ECellView *ecv,
- int model_col,
- int view_col)
-{
- ECellPopupView *ecp_view = (ECellPopupView *) ecv;
-
- return e_cell_max_width (ecp_view->child_view, model_col, view_col);
-}
-
-
-static void
-ecp_show_tooltip (ECellView *ecv,
- int model_col,
- int view_col,
- int row,
- int col_width,
- ETableTooltip *tooltip)
-{
- ECellPopupView *ecp_view = (ECellPopupView *) ecv;
-
- e_cell_show_tooltip (ecp_view->child_view, model_col, view_col, row,
- col_width, tooltip);
-}
-
-static char *
-ecp_get_bg_color (ECellView *ecell_view, int row)
-{
- ECellPopupView *ecp_view = (ECellPopupView *) ecell_view;
-
- return e_cell_get_bg_color (ecp_view->child_view, row);
-}
-
-
-
-ECell*
-e_cell_popup_get_child (ECellPopup *ecp)
-{
- g_return_val_if_fail (E_IS_CELL_POPUP (ecp), NULL);
-
- return ecp->child;
-}
-
-
-void
-e_cell_popup_set_child (ECellPopup *ecp,
- ECell *child)
-{
- g_return_if_fail (E_IS_CELL_POPUP (ecp));
-
- if (ecp->child)
- 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 a72fc68321..0000000000
--- a/widgets/table/e-cell-size.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-cell-size.c: Size item for e-table.
- * Copyright 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#include <config.h>
-#include <sys/time.h>
-#include <unistd.h>
-#include <gal/util/e-util.h>
-#include "e-cell-size.h"
-
-#define PARENT_TYPE e_cell_text_get_type ()
-
-static ECellTextClass *parent_class;
-
-static char *
-ecd_get_text(ECellText *cell, ETableModel *model, int col, int row)
-{
- gint size = GPOINTER_TO_INT(e_table_model_value_at(model, col, row));
- gfloat fsize;
-
- if (size < 1024) {
- return g_strdup_printf ("%d bytes", size);
- } else {
- fsize = ((gfloat) size) / 1024.0;
- if (fsize < 1024.0) {
- return g_strdup_printf ("%d K", (int)fsize);
- } else {
- fsize /= 1024.0;
- return g_strdup_printf ("%.1f MB", fsize);
- }
- }
-}
-
-static void
-ecd_free_text(ECellText *cell, char *text)
-{
- g_free(text);
-}
-
-static void
-e_cell_size_class_init (GtkObjectClass *object_class)
-{
- ECellTextClass *ectc = (ECellTextClass *) object_class;
-
- parent_class = 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, bold, color and a size filter.
- *
- * The arguments "strikeout_column", "bold_column" and "color_column" set
- * and return an integer that points to a column in the model that controls
- * these settings. So controlling the way things are rendered is achieved
- * by having special columns in the model that will be used to flag whether
- * the size should be rendered with strikeout, or bolded. In the case of
- * the "color_column" argument, the column in the model is expected to have
- * a string that can be parsed by gdk_color_parse().
- *
- * Returns: an ECell object that can be used to render file sizes. */
-ECell *
-e_cell_size_new (const char *fontname, GtkJustification justify)
-{
- ECellSize *ecd = 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 cdccbdf39c..0000000000
--- a/widgets/table/e-cell-text.c
+++ /dev/null
@@ -1,2300 +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-font.h"
-#include "gal/widgets/e-unicode.h"
-#include "e-table-item.h"
-#include "gal/util/e-text-event-processor.h"
-#include "gal/e-text/e-text.h"
-#include "gal/util/e-text-event-processor-emacs-like.h"
-#include "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_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;
- EFont *font;
- GdkCursor *i_cursor;
- GdkBitmap *stipple; /* Stipple for text */
-
- GnomeCanvas *canvas;
-
- /*
- * During editing.
- */
- CellEdit *edit;
-
-
- int xofs, yofs; /* This gets added to the x
- and y for the cell text. */
- double ellipsis_width[2]; /* The width of the ellipsis. */
-
-} ECellTextView;
-
-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 calc_ellipsis (ECellTextView *text_view);
-static void ect_free_color (gchar *color_spec, GdkColor *color, GdkColormap *colormap);
-static GdkColor* e_cell_text_get_color (ECellTextView *cell_view, gchar *color_spec);
-
-static ECellClass *parent_class;
-
-char *
-e_cell_text_get_text (ECellText *cell, ETableModel *model, int col, int row)
-{
- if (ECT_CLASS(cell)->get_text)
- return ECT_CLASS(cell)->get_text (cell, model, col, row);
- else
- return NULL;
-}
-
-void
-e_cell_text_free_text (ECellText *cell, char *text)
-{
- if (ECT_CLASS(cell)->free_text)
- ECT_CLASS(cell)->free_text (cell, text);
-}
-
-void
-e_cell_text_set_value (ECellText *cell, ETableModel *model, int col, int row,
- const char *text)
-{
- if (ECT_CLASS(cell)->set_value)
- ECT_CLASS(cell)->set_value (cell, model, col, row, text);
-}
-
-static char *
-ect_real_get_text (ECellText *cell, ETableModel *model, int col, int row)
-{
- return e_table_model_value_at(model, col, row);
-}
-
-static void
-ect_real_free_text (ECellText *cell, char *text)
-{
-}
-
-/* This is the default method for setting the ETableModel value based on
- the text in the ECellText. This simply uses the text as it is - it assumes
- the value in the model is a char*. Subclasses may parse the text into
- data structures to pass to the model. */
-static void
-ect_real_set_value (ECellText *cell, ETableModel *model, int col, int row,
- const char *text)
-{
- e_table_model_set_value_at (model, col, row, text);
-}
-
-static void
-ect_queue_redraw (ECellTextView *text_view, int view_col, int view_row)
-{
- e_table_item_redraw_range (
- text_view->cell_view.e_table_item_view,
- view_col, view_row, view_col, view_row);
-}
-
-static void
-invisible_finalize (gpointer data,
- GObject *invisible)
-{
- CellEdit *edit = data;
- edit->invisible = NULL;
-}
-
-/*
- * 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) {
- g_object_weak_unref (G_OBJECT (edit->invisible), invisible_finalize, edit);
- }
- 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;
- ECellText *ect = (ECellText *) ecell_view->ecell;
-
- text_view->gc = gdk_gc_new (GTK_WIDGET (text_view->canvas)->window);
-
- text_view->i_cursor = gdk_cursor_new (GDK_XTERM);
-
- if (ect->font_name){
- text_view->font = e_font_from_gdk_name (ect->font_name);
- }
- if (!text_view->font){
- gdk_font_ref (gtk_style_get_font (GTK_WIDGET (text_view->canvas)->style));
- text_view->font = e_font_from_gdk_font (gtk_style_get_font (GTK_WIDGET (text_view->canvas)->style));
- }
-
- calc_ellipsis (text_view);
-
- if (parent_class->realize)
- (* parent_class->realize) (ecell_view);
-}
-
-/*
- * ECell::unrealize method
- */
-static void
-ect_unrealize (ECellView *ecv)
-{
- ECellTextView *text_view = (ECellTextView *) ecv;
- ECellText *ect = (ECellText*) ecv->ecell;
- GdkColormap *colormap;
-
- gdk_gc_unref (text_view->gc);
- text_view->gc = NULL;
-
- if (text_view->edit){
- ect_cancel_edit (text_view);
- }
-
- if (text_view->font)
- e_font_unref (text_view->font);
- text_view->font = NULL;
-
- if (text_view->stipple)
- gdk_bitmap_unref (text_view->stipple);
-
- gdk_cursor_destroy (text_view->i_cursor);
-
- if (ect->colors) {
- colormap = gtk_widget_get_colormap (GTK_WIDGET (text_view->canvas));
- g_hash_table_foreach (ect->colors, (GHFunc) ect_free_color,
- colormap);
- g_hash_table_destroy (ect->colors);
- ect->colors = NULL;
- }
-
- if (parent_class->unrealize)
- (* parent_class->unrealize) (ecv);
-}
-
-static void
-ect_free_color (gchar *color_spec, GdkColor *color, GdkColormap *colormap)
-{
- g_free (color_spec);
-
- /* This frees the color. Note we don't free it if it is the special
- value. */
- if (color != (GdkColor*) 1) {
- 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)
-{
- ECellView *ecell_view = (ECellView *) text_view;
- ECellText *ect = E_CELL_TEXT (ecell_view->ecell);
- PangoLayout *layout;
- gboolean bold, strikeout;
-
- 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 && e_table_model_value_at(ecell_view->e_table_model, ect->strikeout_column, row);
-
- if (bold || strikeout) {
- 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);
- }
- pango_layout_set_attributes (layout, attrs);
- pango_attr_list_unref (attrs);
- }
-
- return layout;
-}
-
-static PangoLayout *
-generate_layout (ECellTextView *text_view, int model_col, int view_col, int row)
-{
- ECellView *ecell_view = (ECellView *) text_view;
- ECellText *ect = E_CELL_TEXT (ecell_view->ecell);
- PangoLayout *layout;
- CellEdit *edit = text_view->edit;
-
- if (edit && 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);
- e_cell_text_free_text(ect, temp);
- } else
- layout = build_layout (text_view, row, "Mumbo Jumbo");
-
- 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);
-
- 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);
- 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_new (CellEdit, 1);
- text_view->edit = edit;
-
- edit->view_col = -1;
- edit->model_col = -1;
- edit->row = -1;
-
- edit->layout = generate_layout (text_view, model_col, view_col, row);
-
- 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->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);
-}
-
-static void
-ect_print (ECellView *ecell_view, GnomePrintContext *context,
- int model_col, int view_col, int row,
- double width, double height)
-{
- GnomeFont *font = gnome_font_find ("Helvetica", 12);
- char *string;
- ECellText *ect = E_CELL_TEXT(ecell_view->ecell);
- string = e_cell_text_get_text(ect, ecell_view->e_table_model, model_col, row);
- gnome_print_gsave(context);
- if (gnome_print_moveto(context, 2, 2) == -1)
- /* FIXME */;
- if (gnome_print_lineto(context, width - 2, 2) == -1)
- /* FIXME */;
- if (gnome_print_lineto(context, width - 2, height - 2) == -1)
- /* FIXME */;
- if (gnome_print_lineto(context, 2, height - 2) == -1)
- /* FIXME */;
- if (gnome_print_lineto(context, 2, 2) == -1)
- /* FIXME */;
- if (gnome_print_clip(context) == -1)
- /* FIXME */;
- gnome_print_moveto(context, 2, (height - gnome_font_get_ascender(font) + gnome_font_get_descender(font)) / 2);
- gnome_print_setfont(context, font);
- gnome_print_show(context, string);
- gnome_print_grestore(context);
- e_cell_text_free_text(ect, string);
-}
-
-static gdouble
-ect_print_height (ECellView *ecell_view, GnomePrintContext *context,
- int model_col, int view_col, int row,
- double width)
-{
- return 16;
-}
-
-static int
-ect_max_width (ECellView *ecell_view,
- int model_col,
- int view_col)
-{
- /* New ECellText */
- ECellTextView *text_view = (ECellTextView *) ecell_view;
- 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);
- 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);
- 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);
-
- 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,
-/* "font_gdk", text_view->font, */
- "bold", (gboolean) ect->bold_column >= 0 && e_table_model_value_at(ecell_view->e_table_model, ect->bold_column, row),
- "strikeout", (gboolean) ect->strikeout_column >= 0 && e_table_model_value_at(ecell_view->e_table_model, ect->strikeout_column, row),
- "fill_color_gdk", tooltip->foreground,
- "text", 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_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_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_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->bold_column = -1;
- ect->color_column = -1;
- ect->bg_color_column = -1;
- ect->editable = TRUE;
-}
-
-E_MAKE_TYPE(e_cell_text, "ECellText", ECellText, e_cell_text_class_init, e_cell_text_init, PARENT_TYPE)
-
-/**
- * e_cell_text_construct:
- * @cell: The cell to construct
- * @fontname: font to be used to render on the screen
- * @justify: Justification of the string in the cell
- *
- * constructs the ECellText. To be used by subclasses and language
- * bindings.
- *
- * Returns: The ECellText.
- */
-ECell *
-e_cell_text_construct (ECellText *cell, const char *fontname, GtkJustification justify)
-{
- cell->font_name = g_strdup (fontname);
- cell->justify = justify;
- return E_CELL(cell);
-}
-
-/**
- * e_cell_text_new:
- * @fontname: font to be used to render on the screen
- * @justify: Justification of the string in the cell.
- *
- * Creates a new ECell renderer that can be used to render strings that
- * that come from the model. The value returned from the model is
- * interpreted as being a char *.
- *
- * The ECellText object support a large set of properties that can be
- * configured through the Gtk argument system and allows the user to have
- * a finer control of the way the string is displayed. The arguments supported
- * allow the control of strikeout, bold, and color.
- *
- * The arguments "strikeout_column", "bold_column" and "color_column" set
- * and return an integer that points to a column in the model that controls
- * these settings. So controlling the way things are rendered is achieved
- * by having special columns in the model that will be used to flag whether
- * the text should be rendered with strikeout, or bolded. In the case of
- * the "color_column" argument, the column in the model is expected to have
- * a string that can be parsed by gdk_color_parse().
- *
- * Returns: an ECell object that can be used to render strings.
- */
-ECell *
-e_cell_text_new (const char *fontname, GtkJustification justify)
-{
- ECellText *ect = 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 = edit->layout;
- 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;
- EFont *font;
- gchar *p;
- int unival;
- int index;
- int trailing;
-
- font = text_view->font;
-
- switch (command->position) {
-
- case E_TEP_VALUE:
- return command->value;
-
- case E_TEP_SELECTION:
- return edit->selection_end;
-
- case E_TEP_START_OF_BUFFER:
- return 0;
-
- /* fixme: this probably confuses TEP */
-
- case E_TEP_END_OF_BUFFER:
- return strlen (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;
- EFont *font;
-
- font = text_view->font;
-
- /* If the EText isn't editable, then ignore any commands that would
- modify the text. */
- if (!ect->editable && (command->action == E_TEP_DELETE
- || command->action == E_TEP_INSERT
- || command->action == E_TEP_PASTE
- || command->action == E_TEP_GET_SELECTION))
- return;
-
- switch (command->action) {
- case E_TEP_MOVE:
- edit->selection_start = _get_position (text_view, command);
- edit->selection_end = edit->selection_start;
- if (edit->timer) {
- g_timer_reset (edit->timer);
- }
- redraw = TRUE;
- break;
- case E_TEP_SELECT:
- edit->selection_end = _get_position (text_view, command);
- sel_start = MIN(edit->selection_start, edit->selection_end);
- sel_end = MAX(edit->selection_start, edit->selection_end);
- if (sel_start != sel_end) {
- e_cell_text_view_supply_selection (edit, command->time, GDK_SELECTION_PRIMARY,
- 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);
- }
-
- 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);
-
- g_object_weak_ref (G_OBJECT (invisible), invisible_finalize, 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_object_ref (edit->tep);
- gtk_object_sink (GTK_OBJECT (edit->tep));
- g_signal_connect (edit->tep,
- "command",
- G_CALLBACK(e_cell_text_view_command),
- (gpointer) edit);
- }
-}
-
-static void
-calc_ellipsis (ECellTextView *text_view)
-{
- ECellText *ect = E_CELL_TEXT (((ECellView *)text_view)->ecell);
- EFont *font;
-
- font = text_view->font;
- if (font) {
- text_view->ellipsis_width[E_FONT_PLAIN] =
- e_font_utf8_text_width (font, E_FONT_PLAIN,
- ect->ellipsis ? ect->ellipsis : "...",
- ect->ellipsis ? strlen (ect->ellipsis) : 3);
- text_view->ellipsis_width[E_FONT_BOLD] =
- e_font_utf8_text_width (font, E_FONT_BOLD,
- ect->ellipsis ? ect->ellipsis : "...",
- ect->ellipsis ? strlen (ect->ellipsis) : 3);
- }
-}
-
-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 cad1c836a8..0000000000
--- a/widgets/table/e-cell-text.h
+++ /dev/null
@@ -1,107 +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 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 469a41bde4..0000000000
--- a/widgets/table/e-cell-toggle.c
+++ /dev/null
@@ -1,501 +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;
- guint32 color = 0xffffff;
- int width = gdk_pixbuf_get_width (image);
- int height = gdk_pixbuf_get_height (image);
-
- PIXMAP_CACHE (toggle_view, cache_seq, image_seq) =
- gdk_pixmap_new (toggle_view->canvas->layout.bin_window, width, height,
- gtk_widget_get_visual (GTK_WIDGET (toggle_view->canvas))->depth);
-
-
- switch (cache_seq % 3) {
- case 0:
- color = RGB_COLOR (GTK_WIDGET (toggle_view->canvas)->style->bg [GTK_STATE_SELECTED]);
- break;
- case 1:
- color = RGB_COLOR (GTK_WIDGET (toggle_view->canvas)->style->bg [GTK_STATE_ACTIVE]);
- break;
- case 2:
- color = RGB_COLOR (GTK_WIDGET (toggle_view->canvas)->style->base [GTK_STATE_NORMAL]);
- break;
- }
-
- if (cache_seq >= 3) {
- double r, g, b, h, s, v;
- r = ((color >> 16) & 0xff) / 255.0f;
- g = ((color >> 8) & 0xff) / 255.0f;
- b = (color & 0xff) / 255.0f;
-
- e_rgb_to_hsv (r, g, b, &h, &s, &v);
-
- if (v - 0.05f < 0) {
- v += 0.05f;
- } else {
- v -= 0.05f;
- }
-
- e_hsv_to_rgb (h, s, v, &r, &g, &b);
-
- color = ((((int)(r * 255.0f)) & 0xff) << 16) +
- ((((int)(g * 255.0f)) & 0xff) << 8) +
- (((int)(b * 255.0f)) & 0xff);
- }
-
- flat = gdk_pixbuf_composite_color_simple (image,
- width, height,
- GDK_INTERP_BILINEAR,
- 255,
- 1,
- color, color);
-
- gdk_pixbuf_render_to_drawable (flat, PIXMAP_CACHE (toggle_view, cache_seq, image_seq),
- toggle_view->gc,
- 0, 0,
- 0, 0,
- width, height,
- GDK_RGB_DITHER_NORMAL,
- 0, 0);
- gdk_pixbuf_unref (flat);
- }
-}
-
-/*
- * ECell::draw method
- */
-static void
-etog_draw (ECellView *ecell_view, GdkDrawable *drawable,
- int model_col, int view_col, int row, ECellFlags flags,
- int x1, int y1, int x2, int y2)
-{
- ECellToggle *toggle = E_CELL_TOGGLE (ecell_view->ecell);
- gboolean selected;
- ECellToggleView *toggle_view = (ECellToggleView *) ecell_view;
- GdkPixmap *pixmap;
- GdkPixbuf *image;
- int x, y, width, height;
- int cache_seq;
-
- const int value = GPOINTER_TO_INT (
- e_table_model_value_at (ecell_view->e_table_model, model_col, row));
-
- selected = flags & E_CELL_SELECTED;
-
- if (value >= toggle->n_states){
- g_warning ("Value from the table model is %d, the states we support are [0..%d)\n",
- value, toggle->n_states);
- return;
- }
-
- if (flags & E_CELL_SELECTED) {
- if (GTK_WIDGET_HAS_FOCUS (toggle_view->canvas))
- cache_seq = 0;
- else
- cache_seq = 1;
- } else
- cache_seq = 2;
-
- if (E_TABLE_ITEM (ecell_view->e_table_item_view)->alternating_row_colors && (row % 2) == 0)
- cache_seq += 3;
-
- check_cache (toggle_view, value, cache_seq);
-
- pixmap = PIXMAP_CACHE (toggle_view, cache_seq, value);
- image = toggle->images[value];
-
- if ((x2 - x1) < gdk_pixbuf_get_width (image)){
- x = x1;
- width = x2 - x1;
- } else {
- x = x1 + ((x2 - x1) - gdk_pixbuf_get_width (image)) / 2;
- width = gdk_pixbuf_get_width (image);
- }
-
- if ((y2 - y1) < gdk_pixbuf_get_height (image)){
- y = y1;
- height = y2 - y1;
- } else {
- y = y1 + ((y2 - y1) - gdk_pixbuf_get_height (image)) / 2;
- height = gdk_pixbuf_get_height (image);
- }
-
- gdk_draw_pixmap (drawable, toggle_view->gc,
- pixmap,
- 0, 0,
- x, y,
- width, height);
-}
-
-static void
-etog_set_value (ECellToggleView *toggle_view, int model_col, int view_col, int row, int value)
-{
- ECell *ecell = toggle_view->cell_view.ecell;
- ECellToggle *toggle = E_CELL_TOGGLE (ecell);
-
- if (value >= toggle->n_states)
- value = 0;
-
- e_table_model_set_value_at (toggle_view->cell_view.e_table_model,
- model_col, row, GINT_TO_POINTER (value));
-}
-
-/*
- * ECell::event method
- */
-static gint
-etog_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row, ECellFlags flags, ECellActions *actions)
-{
- ECellToggleView *toggle_view = (ECellToggleView *) ecell_view;
- void *_value = e_table_model_value_at (ecell_view->e_table_model, model_col, row);
- const int value = GPOINTER_TO_INT (_value);
-
-#if 0
- if (!(flags & E_CELL_EDITING))
- return FALSE;
-#endif
-
- switch (event->type){
- case GDK_KEY_PRESS:
- if (event->key.keyval != GDK_space)
- return FALSE;
- /* Fall through */
- case GDK_BUTTON_PRESS:
- if (!e_table_model_is_cell_editable(ecell_view->e_table_model, model_col, row))
- return FALSE;
-
- etog_set_value (toggle_view, model_col, view_col, row, value + 1);
- return TRUE;
-
- default:
- return FALSE;
- }
- return TRUE;
-}
-
-/*
- * ECell::height method
- */
-static int
-etog_height (ECellView *ecell_view, int model_col, int view_col, int row)
-{
- ECellToggle *toggle = E_CELL_TOGGLE (ecell_view->ecell);
-
- return toggle->height;
-}
-
-/*
- * ECell::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 b437b49ac2..0000000000
--- a/widgets/table/e-cell-tree.c
+++ /dev/null
@@ -1,772 +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-model.h"
-#include "gal/util/e-util.h"
-#include "e-table-item.h"
-#include "e-cell-tree.h"
-
-#include "tree-expanded.xpm"
-#include "tree-unexpanded.xpm"
-
-#define PARENT_TYPE e_cell_get_type ()
-
-typedef struct {
- ECellView cell_view;
- ECellView *subcell_view;
- GdkGC *gc;
-
- GnomeCanvas *canvas;
-
-} ECellTreeView;
-
-static ECellClass *parent_class;
-
-#define INDENT_AMOUNT 16
-
-static ETreePath
-e_cell_tree_get_node (ETableModel *table_model, int row)
-{
- return e_table_model_value_at (table_model, -1, row);
-}
-
-static ETreeModel*
-e_cell_tree_get_tree_model (ETableModel *table_model, int row)
-{
- return e_table_model_value_at (table_model, -2, row);
-}
-
-static ETreeTableAdapter *
-e_cell_tree_get_tree_table_adapter (ETableModel *table_model, int row)
-{
- return e_table_model_value_at (table_model, -3, row);
-}
-
-static int
-visible_depth_of_node (ETableModel *model, int row)
-{
- ETreeModel *tree_model = e_cell_tree_get_tree_model(model, row);
- ETreeTableAdapter *adapter = e_cell_tree_get_tree_table_adapter(model, row);
- ETreePath path = e_cell_tree_get_node(model, row);
- return (e_tree_model_node_depth (tree_model, path)
- - (e_tree_table_adapter_root_node_is_visible (adapter) ? 0 : 1));
-}
-
-/* If this is changed to not include the width of the expansion pixmap
- if the path is not expandable, then max_width needs to change as
- well. */
-static gint
-offset_of_node (ETableModel *table_model, int row)
-{
- ETreeModel *tree_model = e_cell_tree_get_tree_model(table_model, row);
- ETreePath path = e_cell_tree_get_node(table_model, row);
-
- if (visible_depth_of_node (table_model, row) > 0 ||
- e_tree_model_node_is_expandable(tree_model, path)) {
- return (visible_depth_of_node(table_model, row) + 1) * INDENT_AMOUNT;
- } else {
- return 0;
- }
-}
-
-/*
- * ECell::new_view method
- */
-static ECellView *
-ect_new_view (ECell *ecell, ETableModel *table_model, void *e_table_item_view)
-{
- ECellTree *ect = E_CELL_TREE (ecell);
- ECellTreeView *tree_view = g_new0 (ECellTreeView, 1);
- GnomeCanvas *canvas = GNOME_CANVAS_ITEM (e_table_item_view)->canvas;
-
- tree_view->cell_view.ecell = ecell;
- tree_view->cell_view.e_table_model = table_model;
- tree_view->cell_view.e_table_item_view = e_table_item_view;
-
- /* create our subcell view */
- tree_view->subcell_view = e_cell_new_view (ect->subcell, table_model, e_table_item_view /* XXX */);
-
- tree_view->canvas = canvas;
-
- return (ECellView *)tree_view;
-}
-
-/*
- * ECell::kill_view method
- */
-static void
-ect_kill_view (ECellView *ecv)
-{
- ECellTreeView *tree_view = (ECellTreeView *) ecv;
-
- /* kill our subcell view */
- e_cell_kill_view (tree_view->subcell_view);
-
- g_free (tree_view);
-}
-
-/*
- * ECell::realize method
- */
-static void
-ect_realize (ECellView *ecell_view)
-{
- ECellTreeView *tree_view = (ECellTreeView *) ecell_view;
-
- /* realize our subcell view */
- e_cell_realize (tree_view->subcell_view);
-
- tree_view->gc = gdk_gc_new (GTK_WIDGET (tree_view->canvas)->window);
-
- gdk_gc_set_line_attributes (tree_view->gc, 1,
- GDK_LINE_ON_OFF_DASH, None, None);
- gdk_gc_set_dashes (tree_view->gc, 0, "\1\1", 2);
-
- if (parent_class->realize)
- (* parent_class->realize) (ecell_view);
-}
-
-/*
- * ECell::unrealize method
- */
-static void
-ect_unrealize (ECellView *ecv)
-{
- ECellTreeView *tree_view = (ECellTreeView *) ecv;
-
- /* unrealize our subcell view. */
- e_cell_unrealize (tree_view->subcell_view);
-
- gdk_gc_unref (tree_view->gc);
- tree_view->gc = NULL;
-
- if (parent_class->unrealize)
- (* parent_class->unrealize) (ecv);
-}
-
-/*
- * ECell::draw method
- */
-static void
-ect_draw (ECellView *ecell_view, GdkDrawable *drawable,
- int model_col, int view_col, int row, ECellFlags flags,
- int x1, int y1, int x2, int y2)
-{
- ECellTreeView *tree_view = (ECellTreeView *)ecell_view;
- ETreeModel *tree_model = e_cell_tree_get_tree_model(ecell_view->e_table_model, row);
- ETreeTableAdapter *tree_table_adapter = e_cell_tree_get_tree_table_adapter(ecell_view->e_table_model, row);
- ETreePath node;
- GdkRectangle rect, *clip_rect;
- GtkWidget *canvas = GTK_WIDGET (tree_view->canvas);
- GdkGC *fg_gc = canvas->style->fg_gc[GTK_STATE_ACTIVE];
- GdkColor *foreground;
- gboolean selected;
-
- int offset, subcell_offset;
-
- selected = flags & E_CELL_SELECTED;
-
- /* only draw the tree effects if we're the active sort */
- if (/* XXX */ TRUE) {
- GdkPixbuf *node_image;
- int node_image_width = 0, node_image_height = 0;
- ETreePath parent_node;
-
- node = e_cell_tree_get_node (ecell_view->e_table_model, row);
-
- offset = offset_of_node (ecell_view->e_table_model, row);
- subcell_offset = offset;
-
- node_image = e_tree_model_icon_at (tree_model, node);
-
- if (node_image) {
- node_image_width = gdk_pixbuf_get_width (node_image);
- node_image_height = gdk_pixbuf_get_height (node_image);
- }
-
- /*
- * Be a nice citizen: clip to the region we are supposed to draw on
- */
- rect.x = x1;
- rect.y = y1;
- rect.width = subcell_offset + node_image_width;
- rect.height = y2 - y1;
-
- gdk_gc_set_clip_rectangle (tree_view->gc, &rect);
- gdk_gc_set_clip_rectangle (fg_gc, &rect);
- clip_rect = &rect;
-
- if (selected) {
- foreground = &canvas->style->text [GTK_STATE_SELECTED];
- } else {
- foreground = &canvas->style->text [GTK_STATE_NORMAL];
- }
-
- gdk_gc_set_foreground (tree_view->gc, foreground);
-
- /* draw our lines */
- if (E_CELL_TREE(tree_view->cell_view.ecell)->draw_lines) {
-
- int depth;
-
- if (visible_depth_of_node (ecell_view->e_table_model, row) > 0
- || e_tree_model_node_get_children (tree_model, node, NULL) > 0)
- gdk_draw_line (drawable, tree_view->gc,
- rect.x + offset - INDENT_AMOUNT / 2 + 1,
- rect.y + rect.height / 2,
- rect.x + offset,
- rect.y + rect.height / 2);
-
- if (visible_depth_of_node (ecell_view->e_table_model, row) != 0) {
- gdk_draw_line (drawable, tree_view->gc,
- rect.x + offset - INDENT_AMOUNT / 2,
- rect.y,
- rect.x + offset - INDENT_AMOUNT / 2,
- (e_tree_model_node_get_next (tree_model, node)
- ? rect.y + rect.height
- : rect.y + rect.height / 2));
- }
-
- /* now traverse back up to the root of the tree, checking at
- each level if the node has siblings, and drawing the
- correct vertical pipe for it's configuration. */
- parent_node = e_tree_model_node_get_parent (tree_model, node);
- offset -= INDENT_AMOUNT;
- depth = visible_depth_of_node (ecell_view->e_table_model, row) - 1;
- while (parent_node && depth != 0) {
- if (e_tree_model_node_get_next(tree_model, parent_node)) {
- gdk_draw_line (drawable, tree_view->gc,
- rect.x + offset - INDENT_AMOUNT / 2,
- rect.y,
- rect.x + offset - INDENT_AMOUNT / 2,
- rect.y + rect.height);
- }
- parent_node = e_tree_model_node_get_parent (tree_model, parent_node);
- depth --;
- offset -= INDENT_AMOUNT;
- }
- }
-
- /* now draw our icon if we're expandable */
- if (e_tree_model_node_is_expandable (tree_model, node)) {
- GdkPixbuf *image;
- int image_width, image_height;
-
- image = (e_tree_table_adapter_node_is_expanded (tree_table_adapter, node)
- ? E_CELL_TREE(tree_view->cell_view.ecell)->open_pixbuf
- : E_CELL_TREE(tree_view->cell_view.ecell)->closed_pixbuf);
-
- image_width = gdk_pixbuf_get_width(image);
- image_height = gdk_pixbuf_get_height(image);
-
- gdk_pixbuf_render_to_drawable_alpha (image,
- drawable,
- 0, 0,
- x1 + subcell_offset - INDENT_AMOUNT / 2 - image_width / 2,
- y1 + (y2 - y1) / 2 - image_height / 2,
- image_width, image_height,
- GDK_PIXBUF_ALPHA_BILEVEL,
- 128,
- GDK_RGB_DITHER_NORMAL,
- image_width, 0);
- }
-
- if (node_image) {
- gdk_pixbuf_render_to_drawable_alpha (node_image,
- drawable,
- 0, 0,
- x1 + subcell_offset,
- y1 + (y2 - y1) / 2 - node_image_height / 2,
- node_image_width, node_image_height,
- GDK_PIXBUF_ALPHA_BILEVEL,
- 128,
- GDK_RGB_DITHER_NORMAL,
- node_image_width, 0);
- subcell_offset += node_image_width;
- }
- }
-
- /* Now cause our subcell to draw its contents, shifted by
- subcell_offset pixels */
- e_cell_draw (tree_view->subcell_view, drawable,
- model_col, view_col, row, flags,
- x1 + subcell_offset, y1, x2, y2);
-}
-
-/*
- * ECell::event method
- */
-static gint
-ect_event (ECellView *ecell_view, GdkEvent *event, int model_col, int view_col, int row, ECellFlags flags, ECellActions *actions)
-{
- ECellTreeView *tree_view = (ECellTreeView *) ecell_view;
- ETreeModel *tree_model = e_cell_tree_get_tree_model (ecell_view->e_table_model, row);
- ETreeTableAdapter *tree_table_adapter = e_cell_tree_get_tree_table_adapter(ecell_view->e_table_model, row);
- ETreePath node = e_cell_tree_get_node (ecell_view->e_table_model, row);
- int offset = offset_of_node (ecell_view->e_table_model, row);
-
- switch (event->type) {
- case GDK_BUTTON_PRESS: {
- /* if the event happened in our area of control (and
- we care about it), handle it. */
-
- /* only activate the tree control if the click/release happens in the icon's area. */
- if (event->button.x > (offset - INDENT_AMOUNT) && event->button.x < offset) {
- if (e_tree_model_node_is_expandable (tree_model, node)) {
- e_tree_table_adapter_node_set_expanded (tree_table_adapter,
- node,
- !e_tree_table_adapter_node_is_expanded(tree_table_adapter, node));
- return TRUE;
- }
- }
- else if (event->button.x < (offset - INDENT_AMOUNT))
- return FALSE;
- }
- default: {
- gint return_value;
-
- /* modify the event and pass it off to our subcell_view */
- switch (event->type) {
- case GDK_BUTTON_PRESS:
- case GDK_BUTTON_RELEASE:
- case GDK_2BUTTON_PRESS:
- case GDK_3BUTTON_PRESS:
- event->button.x -= offset;
- break;
- case GDK_MOTION_NOTIFY:
- event->motion.x -= offset;
- break;
- default:
- /* nada */
- break;
- }
-
- return_value = e_cell_event(tree_view->subcell_view, event, model_col, view_col, row, flags, actions);
-
- /* modify the event and pass it off to our subcell_view */
- switch (event->type) {
- case GDK_BUTTON_PRESS:
- case GDK_BUTTON_RELEASE:
- case GDK_2BUTTON_PRESS:
- case GDK_3BUTTON_PRESS:
- event->button.x += offset;
- break;
- case GDK_MOTION_NOTIFY:
- event->motion.x += offset;
- break;
- default:
- /* nada */
- break;
- }
-
- return return_value;
- }
- }
-}
-
-/*
- * ECell::height method
- */
-static int
-ect_height (ECellView *ecell_view, int model_col, int view_col, int row)
-{
- ECellTreeView *tree_view = (ECellTreeView *) ecell_view;
-
- return (((e_cell_height (tree_view->subcell_view, model_col, view_col, row)) + 1) / 2) * 2;
-}
-
-/*
- * ECell::max_width method
- */
-static int
-ect_max_width (ECellView *ecell_view, int model_col, int view_col)
-{
- ECellTreeView *tree_view = (ECellTreeView *) ecell_view;
- int row;
- int number_of_rows;
- int max_width = 0;
- int width = 0;
- int subcell_max_width = 0;
- gboolean per_row = e_cell_max_width_by_row_implemented (tree_view->subcell_view);
-
- number_of_rows = e_table_model_row_count (ecell_view->e_table_model);
-
- if (!per_row)
- subcell_max_width = e_cell_max_width (tree_view->subcell_view, model_col, view_col);
-
- for (row = 0; row < number_of_rows; row++) {
- ETreeModel *tree_model = e_cell_tree_get_tree_model(ecell_view->e_table_model, row);
- ETreePath node;
- GdkPixbuf *node_image;
- int node_image_width = 0, node_image_height = 0;
-
- int offset, subcell_offset;
-#if 0
- gboolean expanded, expandable;
- ETreeTableAdapter *tree_table_adapter = e_cell_tree_get_tree_table_adapter(ecell_view->e_table_model, row);
-#endif
-
- node = e_cell_tree_get_node (ecell_view->e_table_model, row);
-
- offset = offset_of_node (ecell_view->e_table_model, row);
- subcell_offset = offset;
-
- node_image = e_tree_model_icon_at (tree_model, node);
-
- if (node_image) {
- node_image_width = gdk_pixbuf_get_width (node_image);
- node_image_height = gdk_pixbuf_get_height (node_image);
- }
-
- width = subcell_offset + node_image_width;
-
- if (per_row)
- width += e_cell_max_width_by_row (tree_view->subcell_view, model_col, view_col, row);
- else
- width += subcell_max_width;
-
-#if 0
- expandable = e_tree_model_node_is_expandable (tree_model, node);
- expanded = e_tree_table_adapter_node_is_expanded (tree_table_adapter, node);
-
- /* This is unnecessary since this is already handled
- by the offset_of_node function. If that changes,
- this will have to change too. */
-
- if (expandable) {
- GdkPixbuf *image;
-
- image = (expanded
- ? E_CELL_TREE(tree_view->cell_view.ecell)->open_pixbuf
- : E_CELL_TREE(tree_view->cell_view.ecell)->closed_pixbuf);
-
- width += gdk_pixbuf_get_width(image);
- }
-#endif
-
- max_width = MAX (max_width, width);
- }
-
- return max_width;
-}
-
-/*
- * ECellView::show_tooltip method
- */
-static void
-ect_show_tooltip (ECellView *ecell_view, int model_col, int view_col, int row,
- int col_width, ETableTooltip *tooltip)
-{
- ECellTreeView *tree_view = (ECellTreeView *) ecell_view;
- ETreeModel *tree_model = e_cell_tree_get_tree_model (ecell_view->e_table_model, row);
- ETreePath node = e_cell_tree_get_node (ecell_view->e_table_model, row);
- int offset = offset_of_node (ecell_view->e_table_model, row);
- GdkPixbuf *node_image;
-
- node_image = e_tree_model_icon_at (tree_model, node);
- if (node_image)
- offset += gdk_pixbuf_get_width (node_image);
-
- tooltip->x += offset;
- e_cell_show_tooltip (tree_view->subcell_view, model_col, view_col, row, col_width - offset, tooltip);
-}
-
-/*
- * ECellView::get_bg_color method
- */
-static char *
-ect_get_bg_color (ECellView *ecell_view, int row)
-{
- ECellTreeView *tree_view = (ECellTreeView *) ecell_view;
-
- return e_cell_get_bg_color (tree_view->subcell_view, row);
-}
-
-/*
- * ECellView::enter_edit method
- */
-static void *
-ect_enter_edit (ECellView *ecell_view, int model_col, int view_col, int row)
-{
- /* just defer to our subcell's view */
- ECellTreeView *tree_view = (ECellTreeView *) ecell_view;
-
- return e_cell_enter_edit (tree_view->subcell_view, model_col, view_col, row);
-}
-
-/*
- * ECellView::leave_edit method
- */
-static void
-ect_leave_edit (ECellView *ecell_view, int model_col, int view_col, int row, void *edit_context)
-{
- /* just defer to our subcell's view */
- ECellTreeView *tree_view = (ECellTreeView *) ecell_view;
-
- e_cell_leave_edit (tree_view->subcell_view, model_col, view_col, row, edit_context);
-}
-
-static void
-ect_print (ECellView *ecell_view, GnomePrintContext *context,
- int model_col, int view_col, int row,
- double width, double height)
-{
- ECellTreeView *tree_view = (ECellTreeView *) ecell_view;
-
- if (/* XXX only if we're the active sort */ TRUE) {
- ETreeModel *tree_model = e_cell_tree_get_tree_model (ecell_view->e_table_model, row);
- ETreeTableAdapter *tree_table_adapter = e_cell_tree_get_tree_table_adapter(ecell_view->e_table_model, row);
- ETreePath node = e_cell_tree_get_node (ecell_view->e_table_model, row);
- int offset = offset_of_node (ecell_view->e_table_model, row);
- int subcell_offset = offset;
- gboolean expandable = e_tree_model_node_is_expandable (tree_model, node);
- gboolean expanded = e_tree_table_adapter_node_is_expanded (tree_table_adapter, node);
-
- /* draw our lines */
- if (E_CELL_TREE(tree_view->cell_view.ecell)->draw_lines) {
- int depth;
-
- if (!e_tree_model_node_is_root (tree_model, node)
- || e_tree_model_node_get_children (tree_model, node, NULL) > 0) {
- gnome_print_moveto (context,
- offset - INDENT_AMOUNT / 2,
- height / 2);
-
- gnome_print_lineto (context,
- offset,
- height / 2);
- }
-
- if (visible_depth_of_node (ecell_view->e_table_model, row) != 0) {
- gnome_print_moveto (context,
- offset - INDENT_AMOUNT / 2,
- height);
- gnome_print_lineto (context,
- offset - INDENT_AMOUNT / 2,
- (e_tree_model_node_get_next (tree_model, node)
- ? 0
- : height / 2));
- }
-
- /* now traverse back up to the root of the tree, checking at
- each level if the node has siblings, and drawing the
- correct vertical pipe for it's configuration. */
- node = e_tree_model_node_get_parent (tree_model, node);
- depth = visible_depth_of_node (ecell_view->e_table_model, row) - 1;
- offset -= INDENT_AMOUNT;
- while (node && depth != 0) {
- if (e_tree_model_node_get_next(tree_model, node)) {
- gnome_print_moveto (context,
- offset - INDENT_AMOUNT / 2,
- height);
- gnome_print_lineto (context,
- offset - INDENT_AMOUNT / 2,
- 0);
- }
- node = e_tree_model_node_get_parent (tree_model, node);
- depth --;
- offset -= INDENT_AMOUNT;
- }
- }
-
- /* now draw our icon if we're expandable */
- if (expandable) {
- double image_matrix [6] = {16, 0, 0, 16, 0, 0};
- GdkPixbuf *image = (expanded
- ? E_CELL_TREE(tree_view->cell_view.ecell)->open_pixbuf
- : E_CELL_TREE(tree_view->cell_view.ecell)->closed_pixbuf);
- int image_width, image_height, image_rowstride;
- guchar *image_pixels;
-
- image_width = gdk_pixbuf_get_width(image);
- image_height = gdk_pixbuf_get_height(image);
- image_pixels = gdk_pixbuf_get_pixels(image);
- image_rowstride = gdk_pixbuf_get_rowstride(image);
-
- image_matrix [4] = subcell_offset - INDENT_AMOUNT / 2 - image_width / 2;
- image_matrix [5] = height / 2 - image_height / 2;
-
- gnome_print_gsave (context);
- gnome_print_concat (context, image_matrix);
-
- gnome_print_rgbaimage (context, image_pixels, image_width, image_height, image_rowstride);
- gnome_print_grestore (context);
- }
-
- gnome_print_stroke (context);
-
- if (gnome_print_translate(context, subcell_offset, 0) == -1)
- /* FIXME */;
- width -= subcell_offset;
- }
-
-
- e_cell_print (tree_view->subcell_view, context, model_col, view_col, row, width, height);
-}
-
-static gdouble
-ect_print_height (ECellView *ecell_view, GnomePrintContext *context,
- int model_col, int view_col, int row,
- double width)
-{
- return 12; /* XXX */
-}
-
-/*
- * 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 4f423c0af4..0000000000
--- a/widgets/table/e-table-click-to-add.c
+++ /dev/null
@@ -1,559 +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);
-}
-
-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);
- g_object_unref(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) {
- g_object_unref(etcta->text);
- etcta->text = NULL;
- }
- if (etcta->rect) {
- g_object_unref(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);
- g_object_unref(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 f73531cae3..0000000000
--- a/widgets/table/e-table-config-no-group.glade
+++ /dev/null
@@ -1,1774 +0,0 @@
-<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
-<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd" >
-
-<glade-interface>
- <requires lib="gnome" />
-
- <widget class="GtkDialog" id="dialog-show-fields">
- <property name="visible">no</property>
- <property name="title" translatable="yes">Show Fields</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-vbox3">
- <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_area3">
- <property name="layout_style">GTK_BUTTONBOX_END</property>
- <property name="spacing">8</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="GtkButton" id="button20">
- <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="button22">
- <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="GtkVBox" id="vbox2">
- <property name="homogeneous">no</property>
- <property name="spacing">6</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="GtkTable" id="table2">
- <property name="homogeneous">yes</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">6</property>
- <property name="n-rows">1</property>
- <property name="n-columns">5</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="GtkLabel" id="label-available">
- <property name="label" translatable="yes">A_vailable Fields:</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">no</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="visible">yes</property>
- <property name="use_underline">yes</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="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="GtkLabel" id="label-displayed">
- <property name="label" translatable="yes">Sh_ow these fields in order:</property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">no</property>
- <property name="xalign">0</property>
- <property name="yalign">0.5</property>
- <property name="xpad">0</property>
- <property name="ypad">0</property>
- <property name="visible">yes</property>
- <property name="use_underline">yes</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="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>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">no</property>
- <property name="fill">yes</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkTable" id="table3">
- <property name="homogeneous">yes</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">6</property>
- <property name="n-rows">1</property>
- <property name="n-columns">5</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="GtkVBox" id="vbox4">
- <property name="homogeneous">no</property>
- <property name="spacing">6</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="Custom" id="custom-available">
- <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>
- <property name="visible">yes</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">yes</property>
- <property name="fill">yes</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>
- <property name="x_padding">0</property>
- <property name="y_padding">0</property>
- <property name="x_options">expand|fill</property>
- <property name="y_options">expand|fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vbox5">
- <property name="homogeneous">no</property>
- <property name="spacing">6</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="Custom" id="custom-shown">
- <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>
- <property name="visible">yes</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">yes</property>
- <property name="fill">yes</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox4">
- <property name="homogeneous">yes</property>
- <property name="spacing">6</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="GtkButton" id="button-up">
- <property name="can_focus">yes</property>
- <property name="label" translatable="yes">Move _Up</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="visible">yes</property>
- <property name="use_underline">yes</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">no</property>
- <property name="fill">yes</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkButton" id="button-down">
- <property name="can_focus">yes</property>
- <property name="label" translatable="yes">Move _Down</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="visible">yes</property>
- <property name="use_underline">yes</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">no</property>
- <property name="fill">yes</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">no</property>
- <property name="fill">yes</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>
- <property name="x_padding">0</property>
- <property name="y_padding">0</property>
- <property name="x_options">expand|fill</property>
- <property name="y_options">expand|fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vbox6">
- <property name="homogeneous">no</property>
- <property name="spacing">6</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="GtkButton" id="button-add">
- <property name="can_focus">yes</property>
- <property name="label" translatable="yes">_Add -&gt;</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="visible">yes</property>
- <property name="use_underline">yes</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">no</property>
- <property name="fill">no</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkButton" id="button-remove">
- <property name="can_focus">yes</property>
- <property name="label" translatable="yes">&lt;- _Remove</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="visible">yes</property>
- <property name="use_underline">yes</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">no</property>
- <property name="fill">no</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>
- <property name="x_padding">0</property>
- <property name="y_padding">0</property>
- <property name="x_options">expand|fill</property>
- <property name="y_options">expand|fill</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">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>
- <widget class="GtkDialog" id="dialog-group-by">
- <property name="visible">no</property>
- <property name="title" translatable="yes">Group</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-vbox4">
- <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_area4">
- <property name="layout_style">GTK_BUTTONBOX_END</property>
- <property name="spacing">8</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="GtkButton" id="button39">
- <property name="can_default">yes</property>
- <property name="can_focus">yes</property>
- <property name="label" translatable="yes">Clear All</property>
- <property name="visible">yes</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkButton" id="button41">
- <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="button42">
- <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="GtkVBox" id="vbox24">
- <property name="homogeneous">no</property>
- <property name="spacing">0</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="GtkHBox" id="hbox13">
- <property name="homogeneous">no</property>
- <property name="spacing">6</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="GtkFrame" id="frame-group-1">
- <property name="label" translatable="yes">Group Items By</property>
- <property name="label_xalign">0</property>
- <property name="shadow">GTK_SHADOW_ETCHED_IN</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="GtkHBox" id="hbox5">
- <property name="homogeneous">no</property>
- <property name="spacing">6</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="GtkVBox" id="vbox7">
- <property name="homogeneous">no</property>
- <property name="spacing">0</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="Custom" id="group-combo-1">
- <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>
- <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="GtkCheckButton" id="checkbutton-group-1">
- <property name="can_focus">yes</property>
- <property name="label" translatable="yes">Show field in View</property>
- <property name="active">no</property>
- <property name="draw_indicator">yes</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>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">yes</property>
- <property name="fill">yes</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vbox8">
- <property name="homogeneous">no</property>
- <property name="spacing">0</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="GtkRadioButton" id="radiobutton-ascending-group-1">
- <property name="can_focus">yes</property>
- <property name="label" translatable="yes">Ascending</property>
- <property name="active">no</property>
- <property name="draw_indicator">yes</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="GtkRadioButton" id="radiobutton-descending-group-1">
- <property name="can_focus">yes</property>
- <property name="label" translatable="yes">Descending</property>
- <property name="active">no</property>
- <property name="draw_indicator">yes</property>
- <property name="visible">yes</property>
- <property name="group">radiobutton-ascending-group-1</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">no</property>
- <property name="fill">no</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">no</property>
- <property name="fill">yes</property>
- </packing>
- </child>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">yes</property>
- <property name="fill">yes</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label8">
- <property name="label" translatable="yes"></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="GtkLabel" id="label9">
- <property name="label" translatable="yes"></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="GtkLabel" id="label10">
- <property name="label" translatable="yes"></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>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">yes</property>
- <property name="fill">yes</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox14">
- <property name="homogeneous">no</property>
- <property name="spacing">6</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="GtkLabel" id="label11">
- <property name="label" translatable="yes"></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="GtkFrame" id="frame-group-2">
- <property name="label" translatable="yes">Then By</property>
- <property name="label_xalign">0</property>
- <property name="shadow">GTK_SHADOW_ETCHED_IN</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="GtkHBox" id="hbox6">
- <property name="homogeneous">no</property>
- <property name="spacing">6</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="GtkVBox" id="vbox9">
- <property name="homogeneous">no</property>
- <property name="spacing">0</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="Custom" id="group-combo-2">
- <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>
- <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="GtkCheckButton" id="checkbutton-group-2">
- <property name="can_focus">yes</property>
- <property name="label" translatable="yes">Show field in View</property>
- <property name="active">no</property>
- <property name="draw_indicator">yes</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>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">yes</property>
- <property name="fill">yes</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vbox10">
- <property name="homogeneous">no</property>
- <property name="spacing">0</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="GtkRadioButton" id="radiobutton-ascending-group-2">
- <property name="can_focus">yes</property>
- <property name="label" translatable="yes">Ascending</property>
- <property name="active">no</property>
- <property name="draw_indicator">yes</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="GtkRadioButton" id="radiobutton-descending-group-2">
- <property name="can_focus">yes</property>
- <property name="label" translatable="yes">Descending</property>
- <property name="active">no</property>
- <property name="draw_indicator">yes</property>
- <property name="visible">yes</property>
- <property name="group">radiobutton-ascending-group-2</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">no</property>
- <property name="fill">no</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">no</property>
- <property name="fill">yes</property>
- </packing>
- </child>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">yes</property>
- <property name="fill">yes</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label19">
- <property name="label" translatable="yes"></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="GtkLabel" id="label18">
- <property name="label" translatable="yes"></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>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">yes</property>
- <property name="fill">yes</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox15">
- <property name="homogeneous">no</property>
- <property name="spacing">6</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="GtkLabel" id="label13">
- <property name="label" translatable="yes"></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="GtkLabel" id="label12">
- <property name="label" translatable="yes"></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="GtkFrame" id="frame-group-3">
- <property name="label" translatable="yes">Then By</property>
- <property name="label_xalign">0</property>
- <property name="shadow">GTK_SHADOW_ETCHED_IN</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="GtkHBox" id="hbox7">
- <property name="homogeneous">no</property>
- <property name="spacing">6</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="GtkVBox" id="vbox11">
- <property name="homogeneous">no</property>
- <property name="spacing">0</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="Custom" id="group-combo-3">
- <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>
- <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="GtkCheckButton" id="checkbutton-group-3">
- <property name="can_focus">yes</property>
- <property name="label" translatable="yes">Show field in View</property>
- <property name="active">no</property>
- <property name="draw_indicator">yes</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>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">yes</property>
- <property name="fill">yes</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vbox12">
- <property name="homogeneous">no</property>
- <property name="spacing">0</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="GtkRadioButton" id="radiobutton-ascending-group-3">
- <property name="can_focus">yes</property>
- <property name="label" translatable="yes">Ascending</property>
- <property name="active">no</property>
- <property name="draw_indicator">yes</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="GtkRadioButton" id="radiobutton-descending-group-3">
- <property name="can_focus">yes</property>
- <property name="label" translatable="yes">Descending</property>
- <property name="active">no</property>
- <property name="draw_indicator">yes</property>
- <property name="visible">yes</property>
- <property name="group">radiobutton-ascending-group-3</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">no</property>
- <property name="fill">no</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">no</property>
- <property name="fill">yes</property>
- </packing>
- </child>
- </widget>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">yes</property>
- <property name="fill">yes</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label17">
- <property name="label" translatable="yes"></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>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">yes</property>
- <property name="fill">yes</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkHBox" id="hbox16">
- <property name="homogeneous">no</property>
- <property name="spacing">6</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="GtkLabel" id="label14">
- <property name="label" translatable="yes"></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="GtkLabel" id="label16">
- <property name="label" translatable="yes"></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="GtkLabel" id="label15">
- <property name="label" translatable="yes"></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="GtkFrame" id="frame-group-4">
- <property name="label" translatable="yes">Then By</property>
- <property name="label_xalign">0</property>
- <property name="shadow">GTK_SHADOW_ETCHED_IN</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="GtkHBox" id="hbox8">
- <property name="homogeneous">no</property>
- <property name="spacing">6</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="GtkVBox" id="vbox13">
- <property name="homogeneous">no</property>
- <property name="spacing">0</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="Custom" id="group-combo-4">
- <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>
- <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="GtkCheckButton" id="checkbutton-group-4">
- <property name="can_focus">yes</property>
- <property name="label" translatable="yes">Show field in View</property>
- <property name="active">no</property>
- <property name="draw_indicator">yes</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>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">yes</property>
- <property name="fill">yes</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkVBox" id="vbox14">
- <property name="homogeneous">no</property>
- <property name="spacing">0</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="GtkRadioButton" id="radiobutton-ascending-group-4">
- <property name="can_focus">yes</property>
- <property name="label" translatable="yes">Ascending</property>
- <property name="active">no</property>
- <property name="draw_indicator">yes</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="GtkRadioButton" id="radiobutton-descending-group-4">
- <property name="can_focus">yes</property>
- <property name="label" translatable="yes">Descending</property>
- <property name="active">no</property>
- <property name="draw_indicator">yes</property>
- <property name="visible">yes</property>
- <property name="group">radiobutton-ascending-group-4</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">no</property>
- <property name="fill">no</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">no</property>
- <property name="fill">yes</property>
- </packing>
- </child>
- </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">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>
- <widget class="GtkDialog" id="dialog-sort">
- <property name="visible">no</property>
- <property name="title" translatable="yes">Sort</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="vbox15">
- <property name="homogeneous">no</property>
- <property name="spacing">8</property>
- <property name="visible">yes</property>
-
- <child internal-child="action_area">
- <widget class="GtkHButtonBox" id="hbuttonbox1">
- <property name="layout_style">GTK_BUTTONBOX_END</property>
- <property name="spacing">8</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="GtkButton" id="button43">
- <property name="can_default">yes</property>
- <property name="can_focus">yes</property>
- <property name="label" translatable="yes">Clear All</property>
- <property name="visible">yes</property>
- </widget>
- </child>
-
- <child>
- <widget class="GtkButton" id="button44">
- <property name="can_default">yes</property>
- <property name="has_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="button45">
- <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="table5">
- <property name="homogeneous">no</property>
- <property name="row_spacing">6</property>
- <property name="column_spacing">6</property>
- <property name="n-rows">4</property>
- <property name="n-columns">1</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="GtkFrame" id="frame-sort-4">
- <property name="label" translatable="yes">Then By</property>
- <property name="label_xalign">0</property>
- <property name="shadow">GTK_SHADOW_ETCHED_IN</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="GtkHBox" id="hbox9">
- <property name="homogeneous">no</property>
- <property name="spacing">6</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="GtkAlignment" id="alignment1">
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xscale">1</property>
- <property name="yscale">0</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="Custom" id="sort-combo-4">
- <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>
- <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>
-
- <child>
- <widget class="GtkVBox" id="vbox17">
- <property name="homogeneous">no</property>
- <property name="spacing">0</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="GtkRadioButton" id="radiobutton-ascending-sort-4">
- <property name="can_focus">yes</property>
- <property name="label" translatable="yes">Ascending</property>
- <property name="active">no</property>
- <property name="draw_indicator">yes</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="GtkRadioButton" id="radiobutton-descending-sort-4">
- <property name="can_focus">yes</property>
- <property name="label" translatable="yes">Descending</property>
- <property name="active">no</property>
- <property name="draw_indicator">yes</property>
- <property name="visible">yes</property>
- <property name="group">radiobutton-ascending-sort-4</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">no</property>
- <property name="fill">no</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">no</property>
- <property name="fill">yes</property>
- </packing>
- </child>
- </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_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="GtkFrame" id="frame-sort-3">
- <property name="label" translatable="yes">Then By</property>
- <property name="label_xalign">0</property>
- <property name="shadow">GTK_SHADOW_ETCHED_IN</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="GtkHBox" id="hbox10">
- <property name="homogeneous">no</property>
- <property name="spacing">6</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="GtkAlignment" id="alignment2">
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xscale">1</property>
- <property name="yscale">0</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="Custom" id="sort-combo-3">
- <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>
- <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>
-
- <child>
- <widget class="GtkVBox" id="vbox19">
- <property name="homogeneous">no</property>
- <property name="spacing">0</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="GtkRadioButton" id="radiobutton-ascending-sort-3">
- <property name="can_focus">yes</property>
- <property name="label" translatable="yes">Ascending</property>
- <property name="active">no</property>
- <property name="draw_indicator">yes</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="GtkRadioButton" id="radiobutton-descending-sort-3">
- <property name="can_focus">yes</property>
- <property name="label" translatable="yes">Descending</property>
- <property name="active">no</property>
- <property name="draw_indicator">yes</property>
- <property name="visible">yes</property>
- <property name="group">radiobutton-ascending-sort-3</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">no</property>
- <property name="fill">no</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">no</property>
- <property name="fill">yes</property>
- </packing>
- </child>
- </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_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="GtkFrame" id="frame-sort-2">
- <property name="label" translatable="yes">Then By</property>
- <property name="label_xalign">0</property>
- <property name="shadow">GTK_SHADOW_ETCHED_IN</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="GtkHBox" id="hbox11">
- <property name="homogeneous">no</property>
- <property name="spacing">6</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="GtkAlignment" id="alignment3">
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xscale">1</property>
- <property name="yscale">0</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="Custom" id="sort-combo-2">
- <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>
- <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>
-
- <child>
- <widget class="GtkVBox" id="vbox21">
- <property name="homogeneous">no</property>
- <property name="spacing">0</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="GtkRadioButton" id="radiobutton-ascending-sort-2">
- <property name="can_focus">yes</property>
- <property name="label" translatable="yes">Ascending</property>
- <property name="active">no</property>
- <property name="draw_indicator">yes</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="GtkRadioButton" id="radiobutton-descending-sort-2">
- <property name="can_focus">yes</property>
- <property name="label" translatable="yes">Descending</property>
- <property name="active">no</property>
- <property name="draw_indicator">yes</property>
- <property name="visible">yes</property>
- <property name="group">radiobutton-ascending-sort-2</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">no</property>
- <property name="fill">no</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">no</property>
- <property name="fill">yes</property>
- </packing>
- </child>
- </widget>
- </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="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="GtkFrame" id="frame-sort-1">
- <property name="label" translatable="yes">Sort Items By</property>
- <property name="label_xalign">0</property>
- <property name="shadow">GTK_SHADOW_ETCHED_IN</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="GtkHBox" id="hbox12">
- <property name="homogeneous">no</property>
- <property name="spacing">6</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="GtkAlignment" id="alignment4">
- <property name="xalign">0.5</property>
- <property name="yalign">0.5</property>
- <property name="xscale">1</property>
- <property name="yscale">0</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="Custom" id="sort-combo-1">
- <property name="can_focus">yes</property>
- <property name="has_focus">yes</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>
- <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>
-
- <child>
- <widget class="GtkVBox" id="vbox23">
- <property name="homogeneous">no</property>
- <property name="spacing">0</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="GtkRadioButton" id="radiobutton-ascending-sort-1">
- <property name="can_focus">yes</property>
- <property name="label" translatable="yes">Ascending</property>
- <property name="active">no</property>
- <property name="draw_indicator">yes</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="GtkRadioButton" id="radiobutton-descending-sort-1">
- <property name="can_focus">yes</property>
- <property name="label" translatable="yes">Descending</property>
- <property name="active">no</property>
- <property name="draw_indicator">yes</property>
- <property name="visible">yes</property>
- <property name="group">radiobutton-ascending-sort-1</property>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">no</property>
- <property name="fill">no</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">no</property>
- <property name="fill">yes</property>
- </packing>
- </child>
- </widget>
- </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="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>
- </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>
- <widget class="GnomePropertyBox" id="e-table-config">
- <property name="visible">no</property>
- <property name="modal">no</property>
- <property name="allow_shrink">no</property>
- <property name="allow_grow">no</property>
- <property name="window-position">GTK_WIN_POS_NONE</property>
-
- <child internal-child="notebook">
- <widget class="GtkNotebook" id="notebook1">
- <property name="show_tabs">no</property>
- <property name="show_border">yes</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="GtkFrame" id="top-frame">
- <property name="border_width">2</property>
- <property name="label" translatable="yes">Description</property>
- <property name="label_xalign">0</property>
- <property name="shadow">GTK_SHADOW_ETCHED_IN</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="GtkTable" id="table1">
- <property name="border_width">2</property>
- <property name="homogeneous">no</property>
- <property name="row_spacing">2</property>
- <property name="column_spacing">4</property>
- <property name="n-rows">2</property>
- <property name="n-columns">3</property>
- <property name="visible">yes</property>
-
- <child>
- <widget class="GtkButton" id="button-sort">
- <property name="can_default">yes</property>
- <property name="can_focus">yes</property>
- <property name="label" translatable="yes">_Sort...</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="visible">yes</property>
- <property name="use_underline">yes</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_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="GtkLabel" id="label-sort">
- <property name="label" translatable="yes"></property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">yes</property>
- <property name="xalign">0</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="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_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="GtkLabel" id="label4">
- <property name="label" translatable="yes"></property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">no</property>
- <property name="xalign">0</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="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_padding">0</property>
- <property name="y_padding">0</property>
- <property name="x_options">fill</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label21">
- <property name="label" translatable="yes"></property>
- <property name="justify">GTK_JUSTIFY_CENTER</property>
- <property name="wrap">no</property>
- <property name="xalign">0</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="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_padding">0</property>
- <property name="y_padding">0</property>
- <property name="x_options">fill</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label-fields">
- <property name="label" translatable="yes"></property>
- <property name="justify">GTK_JUSTIFY_LEFT</property>
- <property name="wrap">yes</property>
- <property name="xalign">0</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="left_attach">1</property>
- <property name="right_attach">2</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">expand|fill</property>
- <property name="y_options">fill</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkButton" id="button-fields">
- <property name="can_default">yes</property>
- <property name="can_focus">yes</property>
- <property name="label" translatable="yes">_Fields Shown...</property>
- <property name="relief">GTK_RELIEF_NORMAL</property>
- <property name="visible">yes</property>
- <property name="use_underline">yes</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_padding">0</property>
- <property name="y_padding">0</property>
- <property name="x_options">fill</property>
- <property name="y_options"></property>
- </packing>
- </child>
- </widget>
- </child>
- </widget>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label20">
- <property name="label" translatable="yes">label20</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="padding">0</property>
- <property name="expand">yes</property>
- <property name="fill">yes</property>
- </packing>
- </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 4894fdb6d8..0000000000
--- a/widgets/table/e-table-config.c
+++ /dev/null
@@ -1,1136 +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/gtknotebook.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
-};
-
-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 (config != NULL);
- 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_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;
-
- 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);
-
- glade_gnome_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++) {
- e_table_subset_variable_add (config->shown_model, config->temp_state->columns[i]);
- e_table_without_hide (config->available_model, (void *) config->temp_state->columns[i]);
- }
- }
-}
-
-static void
-config_fields_info_update (ETableConfig *config)
-{
- ETableColumnSpecification **column;
- GString *res = g_string_new ("");
- int i;
-
- for (i = 0; i < config->state->col_count; i++){
- for (column = config->source_spec->columns; *column; column++){
-
- if ((*column)->disabled)
- continue;
-
- if (config->state->columns [i] != (*column)->model_col)
- continue;
-
- g_string_append (res, 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);
-
- 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;
- gnome_property_box_changed (
- GNOME_PROPERTY_BOX (config->dialog_toplevel));
- 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);
-
- 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;
- gnome_property_box_changed (
- GNOME_PROPERTY_BOX (config->dialog_toplevel));
- 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_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 = e_utf8_from_locale_string (dgettext (config->domain,
- config->source_spec->columns[i]->title));
-
- e_table_memory_store_insert_adopt (E_TABLE_MEMORY_STORE (global_store), i, NULL, text);
- }
-}
-
-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_apply (GnomePropertyBox *pbox, gint page_num, ETableConfig *config)
-{
- if (page_num != -1)
- return;
-
- e_table_config_changed (config, config->state);
-}
-
-/*
- * Invoked by the Glade auto-connect code
- */
-GtkWidget *e_table_proxy_gtk_combo_text_new (void);
-GtkWidget *
-e_table_proxy_gtk_combo_text_new (void)
-{
- return gtk_combo_text_new (TRUE);
-}
-
-#if 0
-static GtkWidget *
-configure_dialog (GladeXML *gui, const char *widget_name, ETableConfig *config)
-{
- GtkWidget *w;
-
- w = glade_xml_get_widget (gui, widget_name);
-
- return w;
-}
-#endif
-
-static void
-connect_button (ETableConfig *config, GladeXML *gui, const char *widget_name, GCallback cback)
-{
- GtkWidget *button = glade_xml_get_widget (gui, widget_name);
-
- if (button) {
- g_signal_connect (G_OBJECT (button), "clicked",
- cback, config);
- }
-}
-
-static void
-sort_entry_changed (GtkEntry *entry, ETableConfigSortWidgets *sort)
-{
- ETableConfig *config = sort->e_table_config;
- ETableSortInfo *sort_info = config->temp_state->sort_info;
- ETableConfigSortWidgets *base = &config->sort[0];
- int idx = sort - base;
-
- 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] = e_table_subset_view_to_model_row (E_TABLE_SUBSET (config->available_model), GPOINTER_TO_INT (column->data));
- config->temp_state->expansions[i] = config->source_spec->columns[config->temp_state->columns[i]]->expansion;
- i++;
- }
- config->temp_state->col_count += count;
-
- g_list_free (columns);
-
- setup_fields (config);
-}
-
-static void
-config_button_remove (GtkWidget *widget, ETableConfig *config)
-{
- GList *columns = NULL;
- GList *column;
-
- e_table_selected_row_foreach (config->shown, add_column, &columns);
-
- for (column = columns; column; column = column->next) {
- int row = GPOINTER_TO_INT (column->data);
-
- memmove (config->temp_state->columns + row, config->temp_state->columns + row + 1, sizeof (int) * (config->temp_state->col_count - row - 1));
- memmove (config->temp_state->expansions + row, config->temp_state->expansions + row + 1, sizeof (double) * (config->temp_state->col_count - row - 1));
- config->temp_state->col_count --;
- }
- config->temp_state->columns = g_renew (int, config->temp_state->columns, config->temp_state->col_count);
- config->temp_state->expansions = g_renew (double, config->temp_state->expansions, config->temp_state->col_count);
-
- g_list_free (columns);
-
- setup_fields (config);
-}
-
-static void
-config_button_up (GtkWidget *widget, ETableConfig *config)
-{
- GList *columns = NULL;
- GList *column;
- int *new_shown;
- double *new_expansions;
- int next_col;
- double next_expansion;
- int i;
-
- e_table_selected_row_foreach (config->shown, add_column, &columns);
- columns = g_list_reverse (columns);
-
- new_shown = g_new (int, config->temp_state->col_count);
- new_expansions = g_new (double, config->temp_state->col_count);
-
- column = columns;
-
- next_col = config->temp_state->columns[0];
- next_expansion = config->temp_state->expansions[0];
-
- for (i = 1; i < config->temp_state->col_count; i++) {
- if (column && (GPOINTER_TO_INT (column->data) == i)) {
- new_expansions[i - 1] = config->temp_state->expansions[i];
- new_shown[i - 1] = config->temp_state->columns[i];
- column = column->next;
- } else {
- new_shown[i - 1] = next_col;
- next_col = config->temp_state->columns[i];
-
- new_expansions[i - 1] = next_expansion;
- next_expansion = config->temp_state->expansions[i];
- }
- }
-
- new_shown[i - 1] = next_col;
- new_expansions[i - 1] = next_expansion;
-
- g_free (config->temp_state->columns);
- g_free (config->temp_state->expansions);
-
- config->temp_state->columns = new_shown;
- config->temp_state->expansions = new_expansions;
-
- g_list_free (columns);
-
- setup_fields (config);
-}
-
-static void
-config_button_down (GtkWidget *widget, ETableConfig *config)
-{
- GList *columns = NULL;
- GList *column;
- int *new_shown;
- double *new_expansions;
- int next_col;
- double next_expansion;
- int i;
-
- e_table_selected_row_foreach (config->shown, add_column, &columns);
-
- new_shown = g_new (int, config->temp_state->col_count);
- new_expansions = g_new (double, config->temp_state->col_count);
-
- column = columns;
-
- next_col = config->temp_state->columns[config->temp_state->col_count - 1];
- next_expansion = config->temp_state->expansions[config->temp_state->col_count - 1];
-
- for (i = config->temp_state->col_count - 1; i > 0; i--) {
- if (column && (GPOINTER_TO_INT (column->data) == i - 1)) {
- new_expansions[i] = config->temp_state->expansions[i - 1];
- new_shown[i] = config->temp_state->columns[i - 1];
- column = column->next;
- } else {
- new_shown[i] = next_col;
- next_col = config->temp_state->columns[i - 1];
-
- new_expansions[i] = next_expansion;
- next_expansion = config->temp_state->expansions[i - 1];
- }
- }
-
- new_shown[0] = next_col;
- new_expansions[0] = next_expansion;
-
- g_free (config->temp_state->columns);
- g_free (config->temp_state->expansions);
-
- config->temp_state->columns = new_shown;
- config->temp_state->expansions = new_expansions;
-
- g_list_free (columns);
-
- setup_fields (config);
-}
-
-static void
-configure_fields_dialog (ETableConfig *config, GladeXML *gui)
-{
- 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);
-
- gtk_widget_hide (GNOME_PROPERTY_BOX(config->dialog_toplevel)->help_button);
-
- gtk_notebook_set_show_tabs (
- GTK_NOTEBOOK (GNOME_PROPERTY_BOX (
- config->dialog_toplevel)->notebook),
- FALSE);
-
- config->dialog_show_fields = glade_xml_get_widget (
- gui, "dialog-show-fields");
- config->dialog_group_by = glade_xml_get_widget (
- gui, "dialog-group-by");
- config->dialog_sort = glade_xml_get_widget (
- gui, "dialog-sort");
-
- config->sort_label = glade_xml_get_widget (
- gui, "label-sort");
- config->group_label = glade_xml_get_widget (
- gui, "label-group");
- config->fields_label = glade_xml_get_widget (
- gui, "label-fields");
-
- connect_button (config, gui, "button-sort", 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 (
- G_OBJECT (config->dialog_toplevel), "apply",
- G_CALLBACK (dialog_apply), 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)
-{
- 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);
-
- config_sort_info_update (config);
- config_group_info_update (config);
- config_fields_info_update (config);
-
- return E_TABLE_CONFIG (config);
-}
-
-/**
- * e_table_config_new:
- * @header: The title of the dialog for the ETableConfig.
- * @spec: The specification for the columns to allow.
- * @state: The current state of the configuration.
- *
- * Creates a new ETable config object.
- *
- * Returns: The config object.
- */
-ETableConfig *
-e_table_config_new (const char *header,
- ETableSpecification *spec,
- ETableState *state)
-{
- ETableConfig *config = g_object_new (E_TABLE_CONFIG_TYPE, NULL);
-
- if (e_table_config_construct (config, header, spec, state) == 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 ee1bb958f5..0000000000
--- a/widgets/table/e-table-config.glade
+++ /dev/null
@@ -1,2082 +0,0 @@
-<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
-<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd">
-
-<glade-interface>
-<requires lib="gnome"/>
-
-<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="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>
-
- <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>
- </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">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="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>
-
- <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>
- </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="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>
-
- <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>
- </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="GnomePropertyBox" id="e-table-config">
- <property name="window_position">GTK_WIN_POS_NONE</property>
- <property name="modal">False</property>
- <property name="resizable">False</property>
- <property name="destroy_with_parent">False</property>
-
- <child internal-child="notebook">
- <widget class="GtkNotebook" id="notebook1">
- <property name="visible">True</property>
- <property name="show_tabs">False</property>
- <property name="show_border">True</property>
- <property name="tab_pos">GTK_POS_TOP</property>
- <property name="scrollable">False</property>
- <property name="tab_hborder">2</property>
- <property name="tab_vborder">2</property>
- <property name="enable_popup">False</property>
-
- <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-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="y_options">fill</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>
- </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="tab_expand">False</property>
- <property name="tab_fill">True</property>
- </packing>
- </child>
-
- <child>
- <widget class="GtkLabel" id="label20">
- <property name="visible">True</property>
- <property name="label" translatable="yes">label20</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="type">tab</property>
- </packing>
- </child>
- </widget>
- <packing>
- <property name="padding">0</property>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </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 f385814f28..0000000000
--- a/widgets/table/e-table-config.h
+++ /dev/null
@@ -1,112 +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>
-
-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);
-ETableConfig *e_table_config_construct (ETableConfig *etco,
- const char *header,
- ETableSpecification *spec,
- ETableState *state);
-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 7020e22262..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_gnome_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(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 7b8df0db5b..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->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;
-
- e_table_group_container_list_free (etgc);
-
- 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 (),
- "font_gdk", etgc->font,
- "anchor", GTK_ANCHOR_SW,
- "fill_color", "black",
- "draw_background", FALSE,
- NULL);
- child = e_table_group_new (GNOME_CANVAS_GROUP (etgc), etg->full_header,
- etg->header, etg->model, etgc->sort_info, etgc->n + 1);
- gnome_canvas_item_set(GNOME_CANVAS_ITEM(child),
- "alternating_row_colors", etgc->alternating_row_colors,
- "horizontal_draw_grid", etgc->horizontal_draw_grid,
- "vertical_draw_grid", etgc->vertical_draw_grid,
- "drawfocus", etgc->draw_focus,
- "cursor_mode", etgc->cursor_mode,
- "selection_model", etgc->selection_model,
- "length_threshold", etgc->length_threshold,
- "uniform_row_height", etgc->uniform_row_height,
- "minimum_width", etgc->minimum_width - GROUP_INDENT,
- NULL);
-
- 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" ),
- 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));
-
- 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 e580fc89fc..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" ),
- 0, 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 f787f67ca7..0000000000
--- a/widgets/table/e-table-group.c
+++ /dev/null
@@ -1,710 +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);
- gnome_canvas_item_construct (GNOME_CANVAS_ITEM (etg), parent, 0, NULL);
-}
-
-/**
- * e_table_group_add
- * @etg: The %ETableGroup to add a row to
- * @row: The row to add.
- *
- * This routine adds the given row from the %ETableModel to this set
- * of rows.
- */
-void
-e_table_group_add (ETableGroup *etg,
- gint row)
-{
- g_return_if_fail (etg != NULL);
- g_return_if_fail (E_IS_TABLE_GROUP (etg));
-
- g_assert (ETG_CLASS (etg)->add != NULL);
- ETG_CLASS (etg)->add (etg, row);
-}
-
-/**
- * e_table_group_add_array
- * @etg: The %ETableGroup to add to
- * @array: The array to add.
- * @count: The number of times to add
- *
- * This routine adds all the rows in the array to this set of rows.
- * It assumes that the array is already sorted properly.
- */
-void
-e_table_group_add_array (ETableGroup *etg,
- const int *array,
- int count)
-{
- g_return_if_fail (etg != NULL);
- g_return_if_fail (E_IS_TABLE_GROUP (etg));
-
- g_assert (ETG_CLASS (etg)->add_array != NULL);
- ETG_CLASS (etg)->add_array (etg, array, count);
-}
-
-/**
- * e_table_group_add_all
- * @etg: The %ETableGroup to add to
- *
- * This routine adds all the rows from the %ETableModel to this set
- * of rows.
- */
-void
-e_table_group_add_all (ETableGroup *etg)
-{
- g_return_if_fail (etg != NULL);
- g_return_if_fail (E_IS_TABLE_GROUP (etg));
-
- g_assert (ETG_CLASS (etg)->add_all != NULL);
- ETG_CLASS (etg)->add_all (etg);
-}
-
-/**
- * e_table_group_remove
- * @etg: The %ETableGroup to remove a row from
- * @row: The row to remove.
- *
- * This routine removes the given row from the %ETableModel from this
- * set of rows.
- *
- * Returns: TRUE if the row was deleted and FALSE if the row was not
- * found.
- */
-gboolean
-e_table_group_remove (ETableGroup *etg,
- gint row)
-{
- g_return_val_if_fail (etg != NULL, FALSE);
- g_return_val_if_fail (E_IS_TABLE_GROUP (etg), FALSE);
-
- g_assert (ETG_CLASS (etg)->remove != NULL);
- return ETG_CLASS (etg)->remove (etg, row);
-}
-
-/**
- * e_table_group_increment
- * @etg: The %ETableGroup to increment
- * @position: The position to increment from
- * @amount: The amount to increment.
- *
- * This routine adds amount to all rows greater than or equal to
- * position. This is to handle when a row gets inserted into the
- * model.
- */
-void
-e_table_group_increment (ETableGroup *etg,
- gint position,
- gint amount)
-{
- g_return_if_fail (etg != NULL);
- g_return_if_fail (E_IS_TABLE_GROUP (etg));
-
- g_assert (ETG_CLASS (etg)->increment != NULL);
- ETG_CLASS (etg)->increment (etg, position, amount);
-}
-
-/**
- * e_table_group_increment
- * @etg: The %ETableGroup to decrement
- * @position: The position to decrement from
- * @amount: The amount to decrement
- *
- * This routine removes amount from all rows greater than or equal to
- * position. This is to handle when a row gets deleted from the
- * model.
- */
-void
-e_table_group_decrement (ETableGroup *etg,
- gint position,
- gint amount)
-{
- g_return_if_fail (etg != NULL);
- g_return_if_fail (E_IS_TABLE_GROUP (etg));
-
- g_assert (ETG_CLASS (etg)->decrement != NULL);
- ETG_CLASS (etg)->decrement (etg, position, amount);
-}
-
-/**
- * e_table_group_increment
- * @etg: The %ETableGroup to count
- *
- * This routine calculates the number of rows shown in this group.
- *
- * Returns: The number of rows.
- */
-gint
-e_table_group_row_count (ETableGroup *etg)
-{
- g_return_val_if_fail (etg != NULL, 0);
- g_return_val_if_fail (E_IS_TABLE_GROUP (etg), -1);
-
- g_assert (ETG_CLASS (etg)->row_count != NULL);
- return ETG_CLASS (etg)->row_count (etg);
-}
-
-/**
- * e_table_group_set_focus
- * @etg: The %ETableGroup to set
- * @direction: The direction the focus is coming from.
- * @view_col: The column to set the focus in.
- *
- * Sets the focus to this widget. Places the focus in the view column
- * coming from direction direction.
- */
-void
-e_table_group_set_focus (ETableGroup *etg,
- EFocus direction,
- gint view_col)
-{
- g_return_if_fail (etg != NULL);
- g_return_if_fail (E_IS_TABLE_GROUP (etg));
-
- g_assert (ETG_CLASS (etg)->set_focus != NULL);
- ETG_CLASS (etg)->set_focus (etg, direction, view_col);
-}
-
-/**
- * e_table_group_get_focus
- * @etg: The %ETableGroup to check
- *
- * Calculates if this group has the focus.
- *
- * Returns: TRUE if this group has the focus.
- */
-gboolean
-e_table_group_get_focus (ETableGroup *etg)
-{
- g_return_val_if_fail (etg != NULL, FALSE);
- g_return_val_if_fail (E_IS_TABLE_GROUP (etg), FALSE);
-
- g_assert (ETG_CLASS (etg)->get_focus != NULL);
- return ETG_CLASS (etg)->get_focus (etg);
-}
-
-/**
- * e_table_group_get_focus_column
- * @etg: The %ETableGroup to check
- *
- * Calculates which column in this group has the focus.
- *
- * Returns: The column index (view column).
- */
-gint
-e_table_group_get_focus_column (ETableGroup *etg)
-{
- g_return_val_if_fail (etg != NULL, FALSE);
- g_return_val_if_fail (E_IS_TABLE_GROUP (etg), -1);
-
- g_assert (ETG_CLASS (etg)->get_focus_column != NULL);
- return ETG_CLASS (etg)->get_focus_column (etg);
-}
-
-/**
- * e_table_group_get_printable
- * @etg: %ETableGroup which will be printed
- *
- * This routine creates and returns an %EPrintable that can be used to
- * print the given %ETableGroup.
- *
- * Returns: The %EPrintable.
- */
-EPrintable *
-e_table_group_get_printable (ETableGroup *etg)
-{
- g_return_val_if_fail (etg != NULL, NULL);
- g_return_val_if_fail (E_IS_TABLE_GROUP (etg), NULL);
-
- g_assert (ETG_CLASS (etg)->get_printable != NULL);
- return ETG_CLASS (etg)->get_printable (etg);
-}
-
-/**
- * e_table_group_compute_location
- * @eti: %ETableGroup to look in.
- * @x: A pointer to the x location to find in the %ETableGroup.
- * @y: A pointer to the y location to find in the %ETableGroup.
- * @row: A pointer to the location to store the found row in.
- * @col: A pointer to the location to store the found col in.
- *
- * This routine locates the pixel location (*x, *y) in the
- * %ETableGroup. If that location is in the %ETableGroup, *row and
- * *col are set to the view row and column where it was found. If
- * that location is not in the %ETableGroup, the height of the
- * %ETableGroup is removed from the value y points to.
- */
-void
-e_table_group_compute_location (ETableGroup *etg, int *x, int *y, int *row, int *col)
-{
- g_return_if_fail (etg != NULL);
- g_return_if_fail (E_IS_TABLE_GROUP (etg));
-
- g_assert (ETG_CLASS (etg)->compute_location != NULL);
- ETG_CLASS (etg)->compute_location (etg, x, y, row, col);
-}
-
-/**
- * e_table_group_get_position
- * @eti: %ETableGroup to look in.
- * @x: A pointer to the location to store the found x location in.
- * @y: A pointer to the location to store the found y location in.
- * @row: A pointer to the row number to find.
- * @col: A pointer to the col number to find.
- *
- * This routine finds the view cell (row, col) in the #ETableGroup.
- * If that location is in the #ETableGroup *@x and *@y are set to the
- * upper left hand corner of the cell found. If that location is not
- * in the #ETableGroup, the number of rows in the #ETableGroup is
- * removed from the value row points to.
- */
-void
-e_table_group_get_cell_geometry (ETableGroup *etg,
- int *row,
- int *col,
- int *x,
- int *y,
- int *width,
- int *height)
-{
- g_return_if_fail (etg != NULL);
- g_return_if_fail (E_IS_TABLE_GROUP (etg));
-
- g_assert (ETG_CLASS (etg)->get_cell_geometry != NULL);
- ETG_CLASS (etg)->get_cell_geometry (etg, row, col, x, y, width, height);
-}
-
-/**
- * e_table_group_cursor_change
- * @eti: %ETableGroup to emit the signal on
- * @row: The new cursor row (model row)
- *
- * This routine emits the "cursor_change" signal.
- */
-void
-e_table_group_cursor_change (ETableGroup *e_table_group, gint row)
-{
- g_return_if_fail (e_table_group != NULL);
- g_return_if_fail (E_IS_TABLE_GROUP (e_table_group));
-
- 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 d3a95b1802..0000000000
--- a/widgets/table/e-table-header-item.c
+++ /dev/null
@@ -1,1838 +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));
-
- x -= widget->allocation.x;
- y -= widget->allocation.y;
-
- if (x < 20)
- direction |= ET_SCROLL_LEFT;
- if (x > widget->allocation.width - 20)
- direction |= ET_SCROLL_RIGHT;
-
- ethi->last_drop_x = x;
- ethi->last_drop_y = y;
- ethi->last_drop_time = time;
- ethi->last_drop_context = context;
- context_connect (ethi, context);
-
- do_drag_motion (ethi,
- context,
- x + GTK_LAYOUT(widget)->hadjustment->value,
- y + GTK_LAYOUT(widget)->vadjustment->value,
- time,
- FALSE);
-
- if (direction != 0)
- scroll_on (ethi, direction);
- else
- scroll_off (ethi);
-
- return TRUE;
-}
-
-static void
-ethi_drag_end (GtkWidget *canvas, GdkDragContext *context, ETableHeaderItem *ethi)
-{
- if (context->action == 0) {
- e_table_header_remove (ethi->eth, ethi->drag_col);
- gnome_canvas_item_request_update(GNOME_CANVAS_ITEM(ethi));
- }
- ethi_remove_drop_marker (ethi);
- ethi_remove_destroy_marker (ethi);
- ethi->drag_col = -1;
- scroll_off (ethi);
-}
-
-static void
-ethi_drag_data_received (GtkWidget *canvas,
- GdkDragContext *drag_context,
- gint x,
- gint y,
- GtkSelectionData *data,
- guint info,
- guint time,
- ETableHeaderItem *ethi)
-{
- int found = FALSE;
- int count;
- int column;
- int drop_col;
- int i;
-
- if (data->data) {
- count = e_table_header_count(ethi->eth);
- column = atoi(data->data);
- drop_col = ethi->drop_col;
- ethi->drop_col = -1;
-
- if (column >= 0) {
- for (i = 0; i < count; i++) {
- ETableCol *ecol = e_table_header_get_column (ethi->eth, i);
- if (ecol->col_idx == column) {
- e_table_header_move(ethi->eth, i, drop_col);
- found = TRUE;
- break;
- }
- }
- if (!found) {
- count = e_table_header_count(ethi->full_header);
- for (i = 0; i < count; i++) {
- ETableCol *ecol = e_table_header_get_column (ethi->full_header, i);
- if (ecol->col_idx == column) {
- e_table_header_add_column (ethi->eth, ecol, drop_col);
- break;
- }
- }
- }
- }
- }
- ethi_remove_drop_marker (ethi);
- gnome_canvas_item_request_update(GNOME_CANVAS_ITEM(ethi));
-}
-
-static void
-ethi_drag_data_get (GtkWidget *canvas,
- GdkDragContext *context,
- GtkSelectionData *selection_data,
- guint info,
- guint time,
- ETableHeaderItem *ethi)
-{
- if (ethi->drag_col != -1) {
- ETableCol *ecol = e_table_header_get_column (ethi->eth, ethi->drag_col);
-
- gchar *string = g_strdup_printf("%d", ecol->col_idx);
- gtk_selection_data_set(selection_data,
- GDK_SELECTION_TYPE_STRING,
- sizeof(string[0]),
- string,
- strlen(string));
- g_free(string);
- }
-}
-
-static gboolean
-ethi_drag_drop (GtkWidget *canvas,
- GdkDragContext *context,
- gint x,
- gint y,
- guint time,
- ETableHeaderItem *ethi)
-{
- gboolean successful = FALSE;
-
- if ((x >= 0) && (x <= (ethi->width)) &&
- (y >= 0) && (y <= (ethi->height))){
- int col;
-
- col = ethi_find_col_by_x_nearest (ethi, x);
-
- ethi_add_drop_marker (ethi, col, FALSE);
-
- ethi->drop_col = col;
-
- if (col != -1) {
- char *target = g_strdup_printf ("%s-%s", TARGET_ETABLE_COL_TYPE, ethi->dnd_code);
- 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_UP :
- E_TABLE_COL_ARROW_DOWN));
- }
- length = e_table_sort_info_sorting_get_count(ethi->sort_info);
- for (i = 0; i < length; i++) {
- ETableSortColumn column = e_table_sort_info_sorting_get_nth(ethi->sort_info, i);
- g_hash_table_insert (arrows,
- GINT_TO_POINTER (column.column),
- GINT_TO_POINTER (column.ascending ?
- E_TABLE_COL_ARROW_UP :
- E_TABLE_COL_ARROW_DOWN));
- }
- }
-
- ethi->width = e_table_header_total_width (ethi->eth) + ethi->group_indent_width;
- x1 = x2 = 0;
- x2 += ethi->group_indent_width;
- for (col = 0; col < cols; col++, x1 = x2){
- ETableCol *ecol = e_table_header_get_column (ethi->eth, col);
- int col_width;
-
- col_width = ecol->width;
-
- x2 += col_width;
-
- if (x1 > (x + width))
- break;
-
- if (x2 < x)
- continue;
-
- if (x2 <= x1)
- continue;
-
- e_table_header_draw_button (drawable, ecol,
- GTK_WIDGET (canvas)->style,
- GTK_WIDGET_STATE (canvas),
- GTK_WIDGET (canvas),
- x1 - x, -y,
- width, height,
- x2 - x1, ethi->height,
- (ETableColArrow) g_hash_table_lookup (
- arrows, GINT_TO_POINTER (ecol->col_idx)));
- }
-
- g_hash_table_destroy (arrows);
-}
-
-static double
-ethi_point (GnomeCanvasItem *item, double x, double y, int cx, int cy,
- GnomeCanvasItem **actual_item)
-{
- *actual_item = item;
- return 0.0;
-}
-
-/*
- * is_pointer_on_division:
- *
- * Returns whether @pos is a column header division; If @the_total is not NULL,
- * then the actual position is returned here. If @return_ecol is not NULL,
- * then the ETableCol that actually contains this point is returned here
- */
-static gboolean
-is_pointer_on_division (ETableHeaderItem *ethi, int pos, int *the_total, int *return_col)
-{
- const int cols = e_table_header_count (ethi->eth);
- int col, total;
-
- total = 0;
- for (col = 0; col < cols; col++){
- ETableCol *ecol = e_table_header_get_column (ethi->eth, col);
-
- if (col == 0)
- total += ethi->group_indent_width;
-
- total += ecol->width;
-
- if ((total - TOLERANCE < pos)&& (pos < total + TOLERANCE)){
- if (return_col)
- *return_col = col;
- if (the_total)
- *the_total = total;
-
- return TRUE;
- }
-
- if (total > pos + TOLERANCE)
- return FALSE;
- }
-
- return FALSE;
-}
-
-#define convert(c,sx,sy,x,y) gnome_canvas_w2c (c,sx,sy,x,y)
-
-static void
-set_cursor (ETableHeaderItem *ethi, int pos)
-{
- int col;
- GtkWidget *canvas = GTK_WIDGET (GNOME_CANVAS_ITEM (ethi)->canvas);
- gboolean resizable = FALSE;
-
- /* We might be invoked before we are realized */
- if (!canvas->window)
- return;
-
- if (is_pointer_on_division (ethi, pos, NULL, &col)) {
- int last_col = ethi->eth->col_count - 1;
- ETableCol *ecol = e_table_header_get_column (ethi->eth, col);
-
- /* Last column is not resizable */
- if (ecol->resizable && col != last_col) {
- int c = col + 1;
-
- /* Column is not resizable if all columns after it
- are also not resizable */
- for (; c <= last_col; c++){
- ETableCol *ecol2;
-
- ecol2 = e_table_header_get_column (ethi->eth, c);
- if (ecol2->resizable) {
- resizable = TRUE;
- break;
- }
- }
- }
- }
-
- if (resizable)
- e_cursor_set (canvas->window, E_CURSOR_SIZE_X);
- else
- gdk_window_set_cursor (canvas->window, NULL);
- /* e_cursor_set (canvas->window, E_CURSOR_ARROW);*/
-}
-
-static void
-ethi_end_resize (ETableHeaderItem *ethi)
-{
- ethi->resize_col = -1;
- ethi->resize_guide = GINT_TO_POINTER (0);
-
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(ethi));
-}
-
-static gboolean
-ethi_maybe_start_drag (ETableHeaderItem *ethi, GdkEventMotion *event)
-{
- if (!ethi->maybe_drag)
- return FALSE;
-
- if (ethi->eth->col_count < 2) {
- ethi->maybe_drag = FALSE;
- return FALSE;
- }
-
- if (MAX (abs (ethi->click_x - event->x),
- abs (ethi->click_y - event->y)) <= 3)
- return FALSE;
-
- return TRUE;
-}
-
-static void
-ethi_start_drag (ETableHeaderItem *ethi, GdkEvent *event)
-{
- GtkWidget *widget = GTK_WIDGET (GNOME_CANVAS_ITEM (ethi)->canvas);
- GtkTargetList *list;
- GdkDragContext *context;
- ETableCol *ecol;
- int col_width;
- GdkPixmap *pixmap;
- int group_indent = 0;
- GHashTable *arrows = g_hash_table_new (NULL, NULL);
-
- GtkTargetEntry ethi_drag_types [] = {
- { TARGET_ETABLE_COL_TYPE, 0, TARGET_ETABLE_COL_HEADER },
- };
-
- ethi->drag_col = ethi_find_col_by_x (ethi, event->motion.x);
-
- if (ethi->drag_col == -1)
- return;
-
- if (ethi->sort_info) {
- int length = e_table_sort_info_grouping_get_count(ethi->sort_info);
- int i;
- for (i = 0; i < length; i++) {
- ETableSortColumn column =
- e_table_sort_info_grouping_get_nth(
- ethi->sort_info, i);
- group_indent ++;
- g_hash_table_insert (
- arrows,
- GINT_TO_POINTER (column.column),
- GINT_TO_POINTER (column.ascending ?
- E_TABLE_COL_ARROW_UP :
- E_TABLE_COL_ARROW_DOWN));
- }
- length = e_table_sort_info_sorting_get_count(ethi->sort_info);
- for (i = 0; i < length; i++) {
- ETableSortColumn column =
- e_table_sort_info_sorting_get_nth (
- ethi->sort_info, i);
-
- g_hash_table_insert (
- arrows,
- GINT_TO_POINTER (column.column),
- GINT_TO_POINTER (column.ascending ?
- E_TABLE_COL_ARROW_UP :
- E_TABLE_COL_ARROW_DOWN));
- }
- }
-
- ethi_drag_types[0].target = g_strdup_printf(
- "%s-%s", ethi_drag_types[0].target, ethi->dnd_code);
- list = gtk_target_list_new (
- ethi_drag_types, ELEMENTS (ethi_drag_types));
- context = gtk_drag_begin (widget, list, GDK_ACTION_MOVE, 1, event);
- g_free(ethi_drag_types[0].target);
-
- ecol = e_table_header_get_column (ethi->eth, ethi->drag_col);
- col_width = ecol->width;
- pixmap = gdk_pixmap_new (widget->window, col_width, ethi->height, -1);
-
- e_table_header_draw_button (
- pixmap, ecol,
- widget->style,
- 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);
- 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_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 20c1529a23..0000000000
--- a/widgets/table/e-table-header-utils.c
+++ /dev/null
@@ -1,527 +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;
- PangoRectangle ink_rect;
-
- 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_extents (layout, &ink_rect, NULL);
-
- height = PANGO_DESCENT (ink_rect) - PANGO_ASCENT (ink_rect);
-
- 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;
-}
-
-
-/* Computes the length of a string that needs to be trimmed for elision */
-static int
-compute_elision_length (GtkWidget *widget, const char *str, int max_width)
-{
- int len;
- int l = 0, left, right;
- PangoLayout *layout = build_header_layout (widget, str);
- PangoRectangle ink_rect;
-
- len = strlen (str);
-
- if (len <= 0)
- return 0;
-
- left = 0;
- right = len;
-
- while (left < right) {
- l = (left + right) / 2;
-
- pango_layout_set_text (layout, str, l);
-
- pango_layout_get_pixel_extents (layout, &ink_rect, NULL);
-
- if (PANGO_RBEARING (ink_rect) < max_width)
- left = l + 1;
- else if (PANGO_RBEARING (ink_rect) > max_width)
- right = l;
- else {
- g_object_unref (layout);
- return l;
- }
- }
-
- g_object_unref (layout);
-
- if (PANGO_RBEARING (ink_rect) > max_width)
- return MAX (0, l - 1);
- else
- return l;
-
- return l;
-}
-
-/* Default width of the elision arrow in pixels */
-#define ARROW_WIDTH 4
-
-/**
- * e_table_draw_elided_string:
- * @drawable: Destination drawable.
- * @font: Font for the text.
- * @gc: GC to use for drawing.
- * @x: X insertion point for the string.
- * @y: Y insertion point for the string's baseline.
- * @str: String to draw.
- * @max_width: Maximum width in which the string must fit.
- * @center: Whether to center the string in the available area if it does fit.
- *
- * Draws a string, possibly trimming it so that it fits inside the specified
- * maximum width. If it does not fit, an elision indicator is drawn after the
- * last character that does fit.
- **/
-static void
-e_table_draw_elided_string (GdkDrawable *drawable, GdkGC *gc, GtkWidget *widget,
- int x, int y, const char *str, int max_width, gboolean center)
-{
- PangoLayout *layout;
- PangoRectangle ink_rect;
-
- g_return_if_fail (drawable != NULL);
- g_return_if_fail (gc != NULL);
- g_return_if_fail (str != NULL);
- g_return_if_fail (max_width >= 0);
-
- layout = build_header_layout (widget, str);
-
- pango_layout_get_pixel_extents (layout, &ink_rect, NULL);
-
- if (PANGO_RBEARING (ink_rect) <= max_width) {
- int xpos;
-
- if (center)
- xpos = x + (max_width - ink_rect.width) / 2;
- else
- xpos = x;
-
- gdk_draw_layout (drawable, gc,
- xpos, y,
- layout);
- } else {
- int arrow_width;
- int len;
- int i;
-
- if (max_width < ARROW_WIDTH + 1)
- arrow_width = max_width - 1;
- else
- arrow_width = ARROW_WIDTH;
-
- len = compute_elision_length (widget, str, max_width - arrow_width - 1);
-
- pango_layout_set_text (layout, str, len);
-
- gdk_draw_layout (drawable, gc,
- x, y,
- layout);
-
- pango_layout_get_pixel_extents (layout, &ink_rect, NULL);
-
- y -= PANGO_ASCENT (ink_rect);
-
- for (i = 0; i < arrow_width; i++) {
- int h;
-
- h = 2 * i + 1;
-
- gdk_draw_line (drawable, gc,
- x + PANGO_RBEARING(ink_rect) + arrow_width - i,
- y + (PANGO_ASCENT (ink_rect) + PANGO_DESCENT (ink_rect) - h) / 2,
- x + PANGO_RBEARING (ink_rect) + arrow_width - i,
- y + (PANGO_ASCENT (ink_rect) + PANGO_DESCENT (ink_rect) - h) / 2 + h - 1);
- }
- }
-
- g_object_unref (layout);
-}
-
-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.
- * @gc: GC to use for drawing.
- * @x: Leftmost coordinate of the button.
- * @y: Topmost coordinate of the button.
- * @width: Width of the region to draw.
- * @height: Height of the region to draw.
- * @button_width: Width for the complete button.
- * @button_height: Height for the complete button.
- * @arrow: Arrow type to use as a sort indicator.
- *
- * Draws a button suitable for a table header.
- **/
-void
-e_table_header_draw_button (GdkDrawable *drawable, ETableCol *ecol,
- GtkStyle *style, 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;
-
- 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[GTK_STATE_NORMAL];
-
- 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 */
-
- /* 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) {
- PangoLayout *layout;
- PangoRectangle ink_rect;
- int ypos;
-
- /* really sucks to generate another
- PangoLayout here when we turn around and
- make one in draw_elided_string */
-
- layout = build_header_layout (widget, ecol->text);
- pango_layout_get_pixel_extents (layout, &ink_rect, NULL);
-
- if (PANGO_RBEARING (ink_rect) < inner_width - (pwidth + 1)) {
- xpos = inner_x + (inner_width - ink_rect.width - (pwidth + 1)) / 2;
- }
-
- ypos = inner_y;
-
- e_table_draw_elided_string (drawable, gc, widget,
- xpos + pwidth + 1, ypos,
- ecol->text, inner_width - (xpos - inner_x), FALSE);
-
- g_object_unref (layout);
- }
-
- pixmap = make_composite_pixmap (drawable, gc,
- ecol->pixbuf, &style->bg[state],
- clip_width, clip_height,
- xpos,
- inner_y + (inner_height - clip_height) / 2);
- if (pixmap) {
- gdk_draw_pixmap (drawable, gc, pixmap,
- 0, 0,
- xpos,
- inner_y + (inner_height - clip_height) / 2,
- clip_width, clip_height);
- gdk_pixmap_unref (pixmap);
- }
- } else {
- int ypos;
-
- ypos = inner_y;
-
- e_table_draw_elided_string (drawable, gc, widget,
- inner_x, ypos,
- ecol->text, inner_width, TRUE);
- }
-}
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 a8a80248e6..0000000000
--- a/widgets/table/e-table-item.c
+++ /dev/null
@@ -1,3638 +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.05f);
- gdk_color_alloc (gtk_widget_get_colormap (GTK_WIDGET (canvas)), background);
- }
- }
- if (allocatedp)
- *allocatedp = allocated;
-
- return background;
-}
-
-inline static GdkColor *
-eti_get_cell_foreground_color (ETableItem *eti, int row, int col, gboolean selected, gboolean *allocated)
-{
- GtkWidget *canvas = GTK_WIDGET(GNOME_CANVAS_ITEM(eti)->canvas);
- GdkColor *foreground;
-
- if (allocated)
- *allocated = FALSE;
-
- if (selected){
- if (GTK_WIDGET_HAS_FOCUS (canvas))
- foreground = &canvas->style->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;
- }
-
- g_object_get(eti->selection,
- "cursor_row", &cursor_row,
- NULL);
-
- d(g_print ("%s: cursor row: %d\n", __FUNCTION__, cursor_row));
-
- if (cursor_row != -1) {
- cursor_row = model_to_view_row (eti, cursor_row);
- eti_request_region_show (eti,
- 0, cursor_row, eti->cols - 1, cursor_row,
- delay);
- }
-}
-
-static void
-eti_check_cursor_on_screen (ETableItem *eti)
-{
- if (eti->cursor_x1 == -1 ||
- eti->cursor_y1 == -1 ||
- eti->cursor_x2 == -1 ||
- eti->cursor_y2 == -1)
- return;
-
- eti->cursor_on_screen = e_canvas_item_area_shown (GNOME_CANVAS_ITEM(eti),
- eti->cursor_x1,
- eti->cursor_y1,
- eti->cursor_x2,
- eti->cursor_y2);
-
- d(g_print ("%s: cursor on screen: %s\n", __FUNCTION__, eti->cursor_on_screen ? "TRUE" : "FALSE"));
-}
-
-static void
-eti_check_cursor_bounds (ETableItem *eti)
-{
- int x1, y1, x2, y2;
- int cursor_row;
-
- if (!((GTK_OBJECT_FLAGS(eti) & GNOME_CANVAS_ITEM_REALIZED) && eti->cell_views_realized))
- return;
-
- if (eti->frozen_count > 0) {
- return;
- }
-
- 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);
- }
-
- 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);
- g_idle_add (eti_idle_show_cursor_cb, eti);
- }
-}
-
-static void
-eti_cancel_drag_due_to_model_change (ETableItem *eti)
-{
- if (eti->maybe_in_drag) {
- eti->maybe_in_drag = FALSE;
- if (!eti->maybe_did_something)
- e_selection_model_do_something(E_SELECTION_MODEL (eti->selection), eti->drag_row, eti->drag_col, eti->drag_state);
- }
- if (eti->in_drag) {
- eti->in_drag = FALSE;
- }
-}
-
-static void
-eti_freeze (ETableItem *eti)
-{
- eti->frozen_count ++;
- d(g_print ("%s: %d\n", __FUNCTION__, eti->frozen_count));
-}
-
-static void
-eti_unfreeze (ETableItem *eti)
-{
- g_return_if_fail (eti->frozen_count > 0);
- eti->frozen_count --;
- d(g_print ("%s: %d\n", __FUNCTION__, eti->frozen_count));
- if (eti->frozen_count == 0 && eti->queue_show_cursor) {
- eti_show_cursor (eti, 0);
- eti_check_cursor_bounds (eti);
- eti->queue_show_cursor = FALSE;
- }
-}
-
-/*
- * Callback routine: invoked before the ETableModel suffers a change
- */
-static void
-eti_table_model_pre_change (ETableModel *table_model, ETableItem *eti)
-{
- eti_cancel_drag_due_to_model_change (eti);
- eti_check_cursor_bounds (eti);
- if (eti_editing (eti))
- e_table_item_leave_edit_(eti);
- eti_freeze (eti);
-}
-
-/*
- * Callback routine: invoked when the ETableModel has not suffered a change
- */
-static void
-eti_table_model_no_change (ETableModel *table_model, ETableItem *eti)
-{
- eti_unfreeze (eti);
-}
-
-/*
- * Callback routine: invoked when the ETableModel has suffered a change
- */
-
-static void
-eti_table_model_changed (ETableModel *table_model, ETableItem *eti)
-{
- if (!(GTK_OBJECT_FLAGS(eti) & GNOME_CANVAS_ITEM_REALIZED)) {
- eti_unfreeze (eti);
- return;
- }
-
- eti->rows = e_table_model_row_count (eti->table_model);
-
- free_height_cache(eti);
-
- eti_unfreeze (eti);
-
- eti->needs_compute_height = 1;
- e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (eti));
- eti->needs_redraw = 1;
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (eti));
-
- eti_idle_maybe_show_cursor(eti);
-}
-
-static void
-eti_table_model_row_changed (ETableModel *table_model, int row, ETableItem *eti)
-{
- if (!(GTK_OBJECT_FLAGS(eti) & GNOME_CANVAS_ITEM_REALIZED)) {
- eti_unfreeze (eti);
- return;
- }
-
- if ((!eti->uniform_row_height) && eti->height_cache && eti->height_cache[row] != -1 && eti_row_height_real(eti, row) != eti->height_cache[row]) {
- eti_table_model_changed (table_model, eti);
- return;
- }
-
- eti_unfreeze (eti);
-
- e_table_item_redraw_row (eti, row);
-}
-
-static void
-eti_table_model_cell_changed (ETableModel *table_model, int col, int row, ETableItem *eti)
-{
- if (!(GTK_OBJECT_FLAGS(eti) & GNOME_CANVAS_ITEM_REALIZED)) {
- eti_unfreeze (eti);
- return;
- }
-
- if ((!eti->uniform_row_height) && eti->height_cache && eti->height_cache[row] != -1 && eti_row_height_real(eti, row) != eti->height_cache[row]) {
- eti_table_model_changed (table_model, eti);
- return;
- }
-
- eti_unfreeze (eti);
-
- e_table_item_redraw_row (eti, row);
-}
-
-static void
-eti_table_model_rows_inserted (ETableModel *table_model, int row, int count, ETableItem *eti)
-{
- if (!(GTK_OBJECT_FLAGS(eti) & GNOME_CANVAS_ITEM_REALIZED)) {
- eti_unfreeze (eti);
- return;
- }
- eti->rows = e_table_model_row_count (eti->table_model);
-
- if (eti->height_cache) {
- int i;
- eti->height_cache = g_renew(int, eti->height_cache, eti->rows);
- memmove(eti->height_cache + row + count, eti->height_cache + row, (eti->rows - count - row) * sizeof(int));
- for (i = row; i < row + count; i++)
- eti->height_cache[i] = -1;
- }
-
- eti_unfreeze (eti);
-
- eti_idle_maybe_show_cursor(eti);
-
- eti->needs_compute_height = 1;
- e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (eti));
- eti->needs_redraw = 1;
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (eti));
-}
-
-static void
-eti_table_model_rows_deleted (ETableModel *table_model, int row, int count, ETableItem *eti)
-{
- if (!(GTK_OBJECT_FLAGS(eti) & GNOME_CANVAS_ITEM_REALIZED)) {
- eti_unfreeze (eti);
- return;
- }
-
- g_assert (eti->rows == -1 || row + count <= eti->rows);
-
- eti->rows = e_table_model_row_count (eti->table_model);
-
- g_assert (row <= eti->rows);
-
- if (eti->height_cache) {
- memmove(eti->height_cache + row, eti->height_cache + row + count, (eti->rows - row) * sizeof(int));
- }
-
- eti_unfreeze (eti);
-
- eti_idle_maybe_show_cursor(eti);
-
- eti->needs_compute_height = 1;
- e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (eti));
- eti->needs_redraw = 1;
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (eti));
-}
-
-/**
- * e_table_item_redraw_range
- * @eti: %ETableItem which will be redrawn
- * @start_col: The first col to redraw.
- * @start_row: The first row to redraw.
- * @end_col: The last col to redraw.
- * @end_row: The last row to redraw.
- *
- * This routine redraws the given %ETableItem in the range given. The
- * range is inclusive at both ends.
- */
-void
-e_table_item_redraw_range (ETableItem *eti,
- int start_col, int start_row,
- int end_col, int end_row)
-{
- int border;
- int cursor_col, cursor_row;
-
- g_return_if_fail (eti != NULL);
- g_return_if_fail (E_IS_TABLE_ITEM (eti));
-
- 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->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->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
-
- 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;
- 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;
-
- 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 > 0)
- gtk_timeout_remove (eti->tooltip->timer);
- eti->tooltip->col = col;
- eti->tooltip->row = row;
- eti->tooltip->cx = e->motion.x;
- eti->tooltip->cy = e->motion.y;
- eti->tooltip->timer = gtk_timeout_add (100, (GSourceFunc)_do_tooltip, eti);
- }
-#endif
-
- if (cursor_row == view_to_model_row(eti, row) && cursor_col == view_to_model_col(eti, col)){
- ecell_view = eti->cell_views [col];
-
- /*
- * Adjust the event positions
- */
- e->motion.x = x1;
- e->motion.y = y1;
-
- return_val = eti_e_cell_event (eti, ecell_view, e, e->motion.time,
- view_to_model_col(eti, col), col, row, E_CELL_EDITING | E_CELL_CURSOR);
- }
- break;
- }
-
- case GDK_KEY_PRESS: {
- gint cursor_row, cursor_col;
- gint handled = TRUE;
-
- d(g_print("%s: GDK_KEY_PRESS received, keyval: %d\n", __FUNCTION__, (int) e->key.keyval));
-
- 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 > 0)
- gtk_timeout_remove (eti->tooltip->timer);
- eti->tooltip->timer = 0;
- break;
-
- case GDK_FOCUS_CHANGE:
- d(g_print("%s: GDK_FOCUS_CHANGE received, %s\n", __FUNCTION__, e->focus_change.in ? "in": "out"));
- if (e->focus_change.in) {
- if (eti->save_row != -1 &&
- eti->save_col != -1 &&
- !eti_editing (eti) &&
- e_table_model_is_cell_editable(eti->table_model, view_to_model_col (eti, eti->save_col), eti->save_row)) {
- e_table_item_enter_edit (eti, eti->save_col, eti->save_row);
- e_cell_load_state (eti->cell_views [eti->editing_col], view_to_model_col(eti, eti->save_col),
- eti->save_col, eti->save_row, eti->edit_ctx, eti->save_state);
- eti_free_save_state (eti);
- }
- } else {
- if (eti_editing (eti)) {
- eti_free_save_state (eti);
-
- eti->save_row = eti->editing_row;
- eti->save_col = eti->editing_col;
- eti->save_state = e_cell_save_state (eti->cell_views [eti->editing_col], view_to_model_col(eti, eti->editing_col),
- eti->editing_col, eti->editing_row, eti->edit_ctx);
- e_table_item_leave_edit_(eti);
- }
- }
-
- default:
- return_val = FALSE;
- }
- /* d(g_print("%s: returning: %s\n", __FUNCTION__, return_val?"true":"false"));*/
-
- return return_val;
-}
-
-static void
-eti_style_set (ETableItem *eti, GtkStyle *previous_style)
-{
- if (!(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" ),
- 0, 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 || view_col == -1) {
- e_table_item_leave_edit_(eti);
- eti->old_cursor_row = -1;
- return;
- }
-
- if (! e_table_model_has_change_pending (eti->table_model)) {
- if (!eti->in_key_press) {
- eti_maybe_show_cursor(eti, DOUBLE_CLICK_TIME + 10);
- } else {
- eti_maybe_show_cursor(eti, 0);
- }
- }
-
- e_canvas_item_grab_focus(GNOME_CANVAS_ITEM(eti), FALSE);
- if (eti_editing(eti))
- e_table_item_leave_edit_(eti);
- 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 2c4a362278..0000000000
--- a/widgets/table/e-table-item.h
+++ /dev/null
@@ -1,225 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-table-item.h
- * Copyright 1999, 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- * Miguel de Icaza <miguel@gnu.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#ifndef _E_TABLE_ITEM_H_
-#define _E_TABLE_ITEM_H_
-
-#include <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;
-
- /* 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;
-
- /*
- * 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 24ea978f19..0000000000
--- a/widgets/table/e-table-one.c
+++ /dev/null
@@ -1,239 +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);
-
- if (one->data) {
- int i;
- int col_count;
-
- 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;
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static void
-one_dispose (GObject *object)
-{
- ETableOne *one = E_TABLE_ONE (object);
-
- 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 4731ee45bc..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 e_scroll_frame_get_type ()
-
-static GtkObjectClass *parent_class;
-
-enum {
- PROP_0,
- PROP_TABLE
-};
-
-static void
-e_table_scrolled_init (GtkObject *object)
-{
- ETableScrolled *ets;
- EScrollFrame *scroll_frame;
-
- ets = E_TABLE_SCROLLED (object);
- scroll_frame = E_SCROLL_FRAME (object);
-
- GTK_WIDGET_SET_FLAGS (ets, GTK_CAN_FOCUS);
-
- ets->table = g_object_new (E_TABLE_TYPE, NULL);
-
- e_scroll_frame_set_policy (scroll_frame, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- e_scroll_frame_set_shadow_type (scroll_frame, GTK_SHADOW_IN);
-}
-
-static void
-e_table_scrolled_real_construct (ETableScrolled *ets)
-{
- gtk_container_add(GTK_CONTAINER(ets), GTK_WIDGET(ets->table));
-
- gtk_widget_show(GTK_WIDGET(ets->table));
-}
-
-ETableScrolled *e_table_scrolled_construct (ETableScrolled *ets,
- ETableModel *etm,
- ETableExtras *ete,
- const char *spec,
- const char *state)
-{
- g_return_val_if_fail(ets != NULL, NULL);
- g_return_val_if_fail(E_IS_TABLE_SCROLLED(ets), NULL);
- g_return_val_if_fail(etm != NULL, NULL);
- g_return_val_if_fail(E_IS_TABLE_MODEL(etm), NULL);
- g_return_val_if_fail(ete == NULL || E_IS_TABLE_EXTRAS(ete), NULL);
- g_return_val_if_fail(spec != NULL, NULL);
-
- e_table_construct(ets->table, etm, ete, spec, state);
-
- e_table_scrolled_real_construct(ets);
-
- return ets;
-}
-
-GtkWidget *e_table_scrolled_new (ETableModel *etm,
- ETableExtras *ete,
- const char *spec,
- const char *state)
-{
- ETableScrolled *ets;
-
- g_return_val_if_fail(etm != NULL, NULL);
- g_return_val_if_fail(E_IS_TABLE_MODEL(etm), NULL);
- g_return_val_if_fail(ete == NULL || E_IS_TABLE_EXTRAS(ete), NULL);
- g_return_val_if_fail(spec != NULL, NULL);
-
- ets = E_TABLE_SCROLLED (gtk_widget_new (e_table_scrolled_get_type (),
- "hadjustment", NULL,
- "vadjustment", NULL,
- NULL));
-
- ets = e_table_scrolled_construct (ets, etm, ete, spec, state);
-
- return GTK_WIDGET (ets);
-}
-
-ETableScrolled *e_table_scrolled_construct_from_spec_file (ETableScrolled *ets,
- ETableModel *etm,
- ETableExtras *ete,
- const char *spec_fn,
- const char *state_fn)
-{
- g_return_val_if_fail(ets != NULL, NULL);
- g_return_val_if_fail(E_IS_TABLE_SCROLLED(ets), NULL);
- g_return_val_if_fail(etm != NULL, NULL);
- g_return_val_if_fail(E_IS_TABLE_MODEL(etm), NULL);
- g_return_val_if_fail(ete == NULL || E_IS_TABLE_EXTRAS(ete), NULL);
- g_return_val_if_fail(spec_fn != NULL, NULL);
-
- e_table_construct_from_spec_file(ets->table, etm, ete, spec_fn, state_fn);
-
- e_table_scrolled_real_construct(ets);
-
- return ets;
-}
-
-GtkWidget *e_table_scrolled_new_from_spec_file (ETableModel *etm,
- ETableExtras *ete,
- const char *spec_fn,
- const char *state_fn)
-{
- ETableScrolled *ets;
-
- g_return_val_if_fail(etm != NULL, NULL);
- g_return_val_if_fail(E_IS_TABLE_MODEL(etm), NULL);
- g_return_val_if_fail(ete == NULL || E_IS_TABLE_EXTRAS(ete), NULL);
- g_return_val_if_fail(spec_fn != NULL, NULL);
-
- ets = E_TABLE_SCROLLED (gtk_widget_new (e_table_scrolled_get_type (),
- "hadjustment", NULL,
- "vadjustment", NULL,
- NULL));
-
- ets = e_table_scrolled_construct_from_spec_file (ets, etm, ete, spec_fn, state_fn);
-
- return GTK_WIDGET (ets);
-}
-
-ETable *
-e_table_scrolled_get_table (ETableScrolled *ets)
-{
- return ets->table;
-}
-
-static void
-ets_get_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 08ba85b4a5..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 <gal/widgets/e-scroll-frame.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 {
- EScrollFrame parent;
-
- ETable *table;
-} ETableScrolled;
-
-typedef struct {
- EScrollFrameClass 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 991222d8ff..0000000000
--- a/widgets/table/e-table-sort-info.c
+++ /dev/null
@@ -1,478 +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 {
- i = 0;
- for (grouping = node->xmlChildrenNode; grouping && !strcmp (grouping->name, "group"); grouping = grouping->next) {
- ETableSortColumn column;
- column.column = e_xml_get_integer_prop_by_name (grouping, "column");
- column.ascending = e_xml_get_bool_prop_by_name (grouping, "ascending");
- e_table_sort_info_grouping_set_nth(info, i++, column);
- }
- i = 0;
- for (; grouping && !strcmp (grouping->name, "leaf"); grouping = grouping->next) {
- ETableSortColumn column;
- column.column = e_xml_get_integer_prop_by_name (grouping, "column");
- column.ascending = e_xml_get_bool_prop_by_name (grouping, "ascending");
- e_table_sort_info_sorting_set_nth(info, i++, column);
- }
- }
- 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 c77f4a5995..0000000000
--- a/widgets/table/e-table-specification.c
+++ /dev/null
@@ -1,429 +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;
- 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 ();
-
- g_object_ref (col_spec);
- 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 = xmlSaveFile (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 9dd1020430..0000000000
--- a/widgets/table/e-table-state.c
+++ /dev/null
@@ -1,295 +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;
- 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));
-
- xmlSaveFile (filename, doc);
-
- xmlFreeDoc (doc);
-}
-
-char *
-e_table_state_save_to_string (ETableState *state)
-{
- char *ret_val;
- xmlChar *string;
- int length;
- xmlDoc *doc;
-
- doc = xmlNewDoc("1.0");
- xmlDocSetRootElement(doc, e_table_state_save_to_node(state, NULL));
- xmlDocDumpMemory(doc, &string, &length);
- xmlFreeDoc(doc);
-
- ret_val = g_strdup(string);
- xmlFree(string);
- return ret_val;
-}
-
-xmlNode *
-e_table_state_save_to_node (ETableState *state,
- xmlNode *parent)
-{
- int i;
- xmlNode *node;
-
- if (parent)
- node = xmlNewChild (parent, NULL, "ETableState", NULL);
- else
- node = xmlNewNode (NULL, "ETableState");
-
- e_xml_set_double_prop_by_name(node, "state-version", STATE_VERSION);
-
- for (i = 0; i < state->col_count; i++) {
- int column = state->columns[i];
- double expansion = state->expansions[i];
- xmlNode *new_node;
-
- new_node = xmlNewChild(node, NULL, "column", NULL);
- e_xml_set_integer_prop_by_name (new_node, "source", column);
- if (expansion >= -1)
- e_xml_set_double_prop_by_name(new_node, "expansion", expansion);
- }
-
-
- e_table_sort_info_save_to_node(state->sort_info, node);
-
- return node;
-}
-
-/**
- * e_table_state_duplicate:
- * @state: The ETableState to duplicate
- *
- * This creates a copy of the %ETableState @state
- *
- * Returns: The duplicated %ETableState.
- */
-ETableState *
-e_table_state_duplicate (ETableState *state)
-{
- ETableState *new_state;
- char *copy;
-
- g_return_val_if_fail (state != NULL, NULL);
- g_return_val_if_fail (E_IS_TABLE_STATE (state), NULL);
-
- new_state = e_table_state_new ();
- copy = e_table_state_save_to_string (state);
- e_table_state_load_from_string (new_state, copy);
- g_free (copy);
-
- e_table_sort_info_set_can_group
- (new_state->sort_info,
- e_table_sort_info_get_can_group (state->sort_info));
-
- return new_state;
-}
diff --git a/widgets/table/e-table-state.h b/widgets/table/e-table-state.h
deleted file mode 100644
index 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 d4a2415f13..0000000000
--- a/widgets/table/e-table-subset.c
+++ /dev/null
@@ -1,471 +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))
-
-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;
-
- etss->last_access = row;
- d(g_print("g) Setting last_access to %d\n", row));
- return e_table_model_value_at (etss->source, col, etss->map_table [row]);
-}
-
-static void
-etss_set_value_at (ETableModel *etm, int col, int row, const void *val)
-{
- ETableSubset *etss = (ETableSubset *)etm;
-
- etss->last_access = row;
- d(g_print("h) Setting last_access to %d\n", row));
- e_table_model_set_value_at (etss->source, col, etss->map_table [row], val);
-}
-
-static gboolean
-etss_is_cell_editable (ETableModel *etm, int col, int row)
-{
- ETableSubset *etss = (ETableSubset *)etm;
-
- return e_table_model_is_cell_editable (etss->source, col, etss->map_table [row]);
-}
-
-static gboolean
-etss_has_save_id (ETableModel *etm)
-{
- return TRUE;
-}
-
-static char *
-etss_get_save_id (ETableModel *etm, int row)
-{
- ETableSubset *etss = (ETableSubset *)etm;
-
- if (e_table_model_has_save_id (etss->source))
- return e_table_model_get_save_id (etss->source, etss->map_table [row]);
- else
- return g_strdup_printf ("%d", etss->map_table[row]);
-}
-
-static void
-etss_append_row (ETableModel *etm, ETableModel *source, int row)
-{
- ETableSubset *etss = (ETableSubset *)etm;
- e_table_model_append_row (etss->source, source, row);
-}
-
-static void *
-etss_duplicate_value (ETableModel *etm, int col, const void *value)
-{
- ETableSubset *etss = (ETableSubset *)etm;
-
- return e_table_model_duplicate_value (etss->source, col, value);
-}
-
-static void
-etss_free_value (ETableModel *etm, int col, void *value)
-{
- ETableSubset *etss = (ETableSubset *)etm;
-
- e_table_model_free_value (etss->source, col, value);
-}
-
-static void *
-etss_initialize_value (ETableModel *etm, int col)
-{
- ETableSubset *etss = (ETableSubset *)etm;
-
- return e_table_model_initialize_value (etss->source, col);
-}
-
-static gboolean
-etss_value_is_empty (ETableModel *etm, int col, const void *value)
-{
- ETableSubset *etss = (ETableSubset *)etm;
-
- return e_table_model_value_is_empty (etss->source, col, value);
-}
-
-static char *
-etss_value_to_string (ETableModel *etm, int col, const void *value)
-{
- ETableSubset *etss = (ETableSubset *)etm;
-
- return e_table_model_value_to_string (etss->source, col, value);
-}
-
-static void
-etss_class_init (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 579ba25dc9..0000000000
--- a/widgets/table/e-table-utils.c
+++ /dev/null
@@ -1,189 +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 = e_utf8_from_locale_string (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);
- }
-
- 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 76c66ed074..0000000000
--- a/widgets/table/e-table.c
+++ /dev/null
@@ -1,3278 +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"
-
-#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();
- g_object_ref(ete);
- }
-
- e_table->domain = g_strdup (specification->domain);
-
- 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 = e_utf8_from_locale_string (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_ref (e_table->sorter);
-
- 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) {
- 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, col;
- GtkWidget *widget;
-
- widget = GTK_WIDGET (et);
-
- x -= widget->allocation.x;
- y -= widget->allocation.y;
-
- e_table_get_cell_at (et, x, y, &row, &col);
-
- if (row != et->drop_row && col != et->drop_row) {
- 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);
-
-
- x -= widget->allocation.x;
- y -= widget->allocation.y;
-
- if (y < 20)
- direction |= ET_SCROLL_UP;
- if (y > widget->allocation.height - 20)
- direction |= ET_SCROLL_DOWN;
- if (x < 20)
- direction |= ET_SCROLL_LEFT;
- if (x > widget->allocation.width - 20)
- direction |= ET_SCROLL_RIGHT;
-
- if (direction != 0)
- scroll_on (et, direction);
- else
- scroll_off (et);
-
- return ret_val;
-}
-
-static gboolean
-et_drag_drop(GtkWidget *widget,
- GdkDragContext *context,
- gint x,
- gint y,
- guint time,
- ETable *et)
-{
- gboolean ret_val;
- int row, col;
-
- x -= widget->allocation.x;
- y -= widget->allocation.y;
-
- e_table_get_cell_at (et, x, y, &row, &col);
-
- if (row != et->drop_row && col != et->drop_row) {
- 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;
-
- x -= widget->allocation.x;
- y -= widget->allocation.y;
-
- 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_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_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));
-}
-
-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 242d5b4269..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) == TRUE)
- return;
-
- child = next_child;
- }
-}
-
-/**
- * e_tree_model_node_traverse_preorder:
- * @model:
- * @path:
- * @func:
- * @data:
- *
- *
- **/
-void
-e_tree_model_node_traverse_preorder (ETreeModel *model, ETreePath path, ETreePathFunc func, gpointer data)
-{
- ETreePath child;
-
- g_return_if_fail (model != NULL);
- g_return_if_fail (E_IS_TREE_MODEL (model));
- g_return_if_fail (path != NULL);
-
- child = e_tree_model_node_get_first_child (model, path);
-
- while (child) {
- ETreePath next_child;
-
- if (func (model, child, data) == TRUE)
- return;
-
- next_child = e_tree_model_node_get_next (model, child);
- e_tree_model_node_traverse_preorder (model, child, func, data);
-
- child = next_child;
- }
-}
-
-/**
- * e_tree_model_node_traverse_preorder:
- * @model:
- * @path:
- * @func:
- * @data:
- *
- *
- **/
-static ETreePath
-e_tree_model_node_real_traverse (ETreeModel *model, ETreePath path, ETreePath end_path, gboolean forward_direction, ETreePathFunc func, gpointer data)
-{
- ETreePath child;
-
- g_return_val_if_fail (model != NULL, NULL);
- g_return_val_if_fail (E_IS_TREE_MODEL (model), NULL);
- g_return_val_if_fail (path != NULL, NULL);
-
- if (forward_direction)
- child = e_tree_model_node_get_first_child (model, path);
- else
- child = e_tree_model_node_get_last_child (model, path);
-
- while (child) {
- ETreePath result;
-
- if (forward_direction && (child == end_path || func (model, child, data)))
- return child;
-
- if ((result = e_tree_model_node_real_traverse (model, child, end_path, forward_direction, func, data)))
- return result;
-
- if (!forward_direction && (child == end_path || func (model, child, data)))
- return child;
-
- if (forward_direction)
- child = e_tree_model_node_get_next (model, child);
- else
- child = e_tree_model_node_get_prev (model, child);
- }
- return NULL;
-}
-
-/**
- * e_tree_model_node_traverse_preorder:
- * @model:
- * @path:
- * @func:
- * @data:
- *
- *
- **/
-ETreePath
-e_tree_model_node_find (ETreeModel *model, ETreePath path, ETreePath end_path, gboolean forward_direction, ETreePathFunc func, gpointer data)
-{
- ETreePath result;
- ETreePath next;
-
- g_return_val_if_fail (model != NULL, NULL);
- g_return_val_if_fail (E_IS_TREE_MODEL (model), NULL);
-
- /* Just search the whole tree in this case. */
- if (path == NULL) {
- ETreePath root;
- root = e_tree_model_get_root (model);
-
- if (forward_direction && (end_path == root || func (model, root, data)))
- return root;
-
- if ((result = e_tree_model_node_real_traverse (model, root, end_path, forward_direction, func, data)))
- return result;
-
- if (!forward_direction && (end_path == root || func (model, root, data)))
- return root;
-
- return NULL;
- }
-
- while (1) {
-
- if (forward_direction) {
- if ((result = e_tree_model_node_real_traverse (model, path, end_path, forward_direction, func, data)))
- return result;
- next = e_tree_model_node_get_next (model, path);
- } else {
- next = e_tree_model_node_get_prev (model, path);
- if (next && (result = e_tree_model_node_real_traverse (model, next, end_path, forward_direction, func, data)))
- return result;
- }
-
- while (next == NULL) {
- path = e_tree_model_node_get_parent (model, path);
-
- if (path == NULL)
- return NULL;
-
- if (forward_direction)
- next = e_tree_model_node_get_next (model, path);
- else
- next = path;
- }
-
- if (end_path == next || func (model, next, data))
- return next;
-
- path = next;
- }
-}
-
diff --git a/widgets/table/e-tree-model.h b/widgets/table/e-tree-model.h
deleted file mode 100644
index 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 72d4da70f9..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 e_scroll_frame_get_type ()
-
-static GtkObjectClass *parent_class;
-
-enum {
- PROP_0,
- PROP_TREE
-};
-
-static void
-e_tree_scrolled_init (GtkObject *object)
-{
- ETreeScrolled *ets;
- EScrollFrame *scroll_frame;
-
- ets = E_TREE_SCROLLED (object);
- scroll_frame = E_SCROLL_FRAME (object);
-
- GTK_WIDGET_SET_FLAGS (ets, GTK_CAN_FOCUS);
-
- ets->tree = g_object_new (E_TREE_TYPE, NULL);
-
- e_scroll_frame_set_policy (scroll_frame, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
- e_scroll_frame_set_shadow_type (scroll_frame, GTK_SHADOW_IN);
-}
-
-static void
-e_tree_scrolled_real_construct (ETreeScrolled *ets)
-{
- gtk_container_add(GTK_CONTAINER(ets), GTK_WIDGET(ets->tree));
-
- gtk_widget_show(GTK_WIDGET(ets->tree));
-}
-
-ETreeScrolled *e_tree_scrolled_construct (ETreeScrolled *ets,
- ETreeModel *etm,
- ETableExtras *ete,
- const char *spec,
- const char *state)
-{
- g_return_val_if_fail(ets != NULL, NULL);
- g_return_val_if_fail(E_IS_TREE_SCROLLED(ets), NULL);
- g_return_val_if_fail(etm != NULL, NULL);
- g_return_val_if_fail(E_IS_TREE_MODEL(etm), NULL);
- g_return_val_if_fail(ete == NULL || E_IS_TABLE_EXTRAS(ete), NULL);
- g_return_val_if_fail(spec != NULL, NULL);
-
- e_tree_construct(ets->tree, etm, ete, spec, state);
-
- e_tree_scrolled_real_construct(ets);
-
- return ets;
-}
-
-GtkWidget *e_tree_scrolled_new (ETreeModel *etm,
- ETableExtras *ete,
- const char *spec,
- const char *state)
-{
- ETreeScrolled *ets;
-
- g_return_val_if_fail(etm != NULL, NULL);
- g_return_val_if_fail(E_IS_TREE_MODEL(etm), NULL);
- g_return_val_if_fail(ete == NULL || E_IS_TABLE_EXTRAS(ete), NULL);
- g_return_val_if_fail(spec != NULL, NULL);
-
- ets = E_TREE_SCROLLED (gtk_widget_new (e_tree_scrolled_get_type (),
- "hadjustment", NULL,
- "vadjustment", NULL,
- NULL));
-
- ets = e_tree_scrolled_construct (ets, etm, ete, spec, state);
-
- return GTK_WIDGET (ets);
-}
-
-ETreeScrolled *e_tree_scrolled_construct_from_spec_file (ETreeScrolled *ets,
- ETreeModel *etm,
- ETableExtras *ete,
- const char *spec_fn,
- const char *state_fn)
-{
- g_return_val_if_fail(ets != NULL, NULL);
- g_return_val_if_fail(E_IS_TREE_SCROLLED(ets), NULL);
- g_return_val_if_fail(etm != NULL, NULL);
- g_return_val_if_fail(E_IS_TREE_MODEL(etm), NULL);
- g_return_val_if_fail(ete == NULL || E_IS_TABLE_EXTRAS(ete), NULL);
- g_return_val_if_fail(spec_fn != NULL, NULL);
-
- e_tree_construct_from_spec_file(ets->tree, etm, ete, spec_fn, state_fn);
-
- e_tree_scrolled_real_construct(ets);
-
- return ets;
-}
-
-GtkWidget *e_tree_scrolled_new_from_spec_file (ETreeModel *etm,
- ETableExtras *ete,
- const char *spec_fn,
- const char *state_fn)
-{
- ETreeScrolled *ets;
-
- g_return_val_if_fail(etm != NULL, NULL);
- g_return_val_if_fail(E_IS_TREE_MODEL(etm), NULL);
- g_return_val_if_fail(ete == NULL || E_IS_TABLE_EXTRAS(ete), NULL);
- g_return_val_if_fail(spec_fn != NULL, NULL);
-
- ets = E_TREE_SCROLLED (gtk_widget_new (e_tree_scrolled_get_type (),
- "hadjustment", NULL,
- "vadjustment", NULL,
- NULL));
- ets = e_tree_scrolled_construct_from_spec_file (ets, etm, ete, spec_fn, state_fn);
-
- return GTK_WIDGET (ets);
-}
-
-ETree *
-e_tree_scrolled_get_tree (ETreeScrolled *ets)
-{
- return ets->tree;
-}
-
-static void
-ets_get_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 5802562d14..0000000000
--- a/widgets/table/e-tree-scrolled.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-tree-scrolled.h
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#ifndef _E_TREE_SCROLLED_H_
-#define _E_TREE_SCROLLED_H_
-
-#include <gal/widgets/e-scroll-frame.h>
-#include <gal/e-table/e-tree-model.h>
-#include <gal/e-table/e-tree.h>
-
-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 {
- EScrollFrame parent;
-
- ETree *tree;
-} ETreeScrolled;
-
-typedef struct {
- EScrollFrameClass 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 cbd47bcdec..0000000000
--- a/widgets/table/e-tree-selection-model.c
+++ /dev/null
@@ -1,1425 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-tree-selection-model.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#include <config.h>
-#include <gdk/gdkkeysyms.h>
-#include <gtk/gtksignal.h>
-#include "e-tree-selection-model.h"
-#include <gal/util/e-bit-array.h>
-#include <gal/util/e-sorter.h>
-#include <gal/util/e-i18n.h>
-#include <gal/util/e-util.h>
-#include <gdk/gdkkeysyms.h>
-#include <gal/e-table/e-tree-sorted.h>
-#include <gal/e-table/e-tree-table-adapter.h>
-
-#define PARENT_TYPE e_selection_model_get_type ()
-
-static ESelectionModelClass *parent_class;
-
-enum {
- PROP_0,
- PROP_CURSOR_ROW,
- PROP_CURSOR_COL,
- PROP_MODEL,
- PROP_ETTA,
- PROP_ETS
-};
-
-typedef struct ETreeSelectionModelNode {
- guint selected : 1;
- guint all_children_selected : 1;
- guint any_children_selected : 1;
- EBitArray *all_children_selected_array;
- EBitArray *any_children_selected_array;
- struct ETreeSelectionModelNode **children;
- int num_children;
-} ETreeSelectionModelNode;
-
-struct ETreeSelectionModelPriv {
- ETreeTableAdapter *etta;
- ETreeSorted *ets;
- ETreeModel *model;
-
- ETreeSelectionModelNode *root;
-
- ETreePath cursor_path;
- gint cursor_col;
- ETreePath selection_start_path;
-
- char *cursor_save_id;
-
- int frozen_count;
-
- int tree_model_pre_change_id;
- int tree_model_no_change_id;
- int tree_model_node_changed_id;
- int tree_model_node_data_changed_id;
- int tree_model_node_col_changed_id;
- int tree_model_node_inserted_id;
- int tree_model_node_removed_id;
- int tree_model_node_deleted_id;
-
- int sorted_model_node_resorted_id;
-
- /* Anything other than -1 means that the selection is a single
- * row. This being -1 does not impart any information. */
- int selected_row;
- /* Anything other than -1 means that the selection is a all
- * rows between selection_start_path and cursor_path where
- * selected_range_end is the rwo number of cursor_path. This
- * being -1 does not impart any information. */
- int selected_range_end;
-};
-
-/* ETreeSelectionModelNode helpers */
-
-static ETreeSelectionModelNode *
-e_tree_selection_model_node_new (void)
-{
- ETreeSelectionModelNode *node = g_new(ETreeSelectionModelNode, 1);
-
- node->selected = 0;
- node->all_children_selected = 0;
- node->any_children_selected = 0;
- node->all_children_selected_array = NULL;
- node->any_children_selected_array = NULL;
- node->children = NULL;
- node->num_children = -1;
-
- return node;
-}
-
-static void
-e_tree_selection_model_node_fill_children(ETreeSelectionModel *etsm, ETreePath path, ETreeSelectionModelNode *selection_node)
-{
- int i;
- selection_node->num_children = e_tree_sorted_node_num_children(etsm->priv->ets, path);
- selection_node->children = g_new(ETreeSelectionModelNode *, selection_node->num_children);
- for (i = 0; i < selection_node->num_children; i++) {
- selection_node->children[i] = NULL;
- }
-}
-
-static void
-e_tree_selection_model_node_free(ETreeSelectionModelNode *node)
-{
- int i;
-
- if (node->all_children_selected_array)
- g_object_unref(node->all_children_selected_array);
- if (node->any_children_selected_array)
- g_object_unref(node->any_children_selected_array);
-
- for (i = 0; i < node->num_children; i++)
- if (node->children[i])
- e_tree_selection_model_node_free(node->children[i]);
- g_free(node->children);
-
- g_free(node);
-}
-
-
-/* Other helper functions */
-static ETreePath
-etsm_node_at_row(ETreeSelectionModel *etsm, int row)
-{
- ETreePath path;
-
- if (!(row >= 0 && row < e_table_model_row_count(E_TABLE_MODEL(etsm->priv->etta))))
- return NULL;
-
- path = e_tree_table_adapter_node_at_row(etsm->priv->etta, row);
-
- if (path)
- path = e_tree_sorted_view_to_model_path(etsm->priv->ets, path);
-
- return path;
-}
-
-static int
-etsm_row_of_node(ETreeSelectionModel *etsm, ETreePath path)
-{
- path = e_tree_sorted_model_to_view_path(etsm->priv->ets, path);
-
- if (path)
- return e_tree_table_adapter_row_of_node(etsm->priv->etta, path);
- else
- return -1;
-}
-
-static int
-etsm_cursor_row_real (ETreeSelectionModel *etsm)
-{
- if (etsm->priv->cursor_path)
- return etsm_row_of_node(etsm, etsm->priv->cursor_path);
- else
- return -1;
-}
-
-static void
-etsm_real_clear (ETreeSelectionModel *etsm)
-{
- if (etsm->priv->root) {
- e_tree_selection_model_node_free(etsm->priv->root);
- etsm->priv->root = NULL;
- }
-}
-
-static ETreeSelectionModelNode *
-etsm_find_node_unless_equals (ETreeSelectionModel *etsm,
- ETreePath path,
- gboolean grow)
-{
- ETreeSelectionModelNode *selection_node;
- ETreeSorted *ets = etsm->priv->ets;
- ETreePath parent;
-
- parent = e_tree_model_node_get_parent(E_TREE_MODEL(ets), path);
-
- if (parent) {
- selection_node = etsm_find_node_unless_equals(etsm, parent, grow);
- if (selection_node) {
- int position = e_tree_sorted_orig_position(ets, path);
- if (selection_node->all_children_selected && grow)
- return NULL;
- if (!(selection_node->any_children_selected || grow))
- return NULL;
- if (selection_node->all_children_selected_array && e_bit_array_value_at(selection_node->all_children_selected_array, position) && grow)
- return NULL;
- if (selection_node->any_children_selected_array && ! (e_bit_array_value_at(selection_node->any_children_selected_array, position) || grow))
- return NULL;
- if (selection_node->children == NULL) {
- e_tree_selection_model_node_fill_children(etsm, parent, selection_node);
- }
- if (!selection_node->children[position])
- selection_node->children[position] = e_tree_selection_model_node_new();
-
- return selection_node->children[position];
- } else
- return NULL;
- } else {
- if (!etsm->priv->root)
- etsm->priv->root = e_tree_selection_model_node_new();
- return etsm->priv->root;
- }
-}
-
-#if 0
-static ETreeSelectionModelNode *
-find_or_create_node (ETreeSelectionModel *etsm,
- ETreePath path)
-{
- ETreeSelectionModelNode *selection_node;
- ETreeSelectionModelNode **place = NULL;
- ETreeSorted *ets = etsm->priv->ets;
- ETreePath parent;
-
- parent = e_tree_model_node_get_parent(E_TREE_MODEL(ets), path);
-
- if (parent) {
- selection_node = find_or_create_node(etsm, parent);
- if (selection_node) {
- int position = e_tree_sorted_orig_position(ets, path);
- if (!selection_node->children) {
- e_tree_selection_model_node_fill_children(etsm, parent, selection_node);
- }
- if (!selection_node->children[position])
- slection_node->children[position] = e_tree_selection_model_node_new();
-
- return selection_node->children[position];
- } else
- return NULL;
- } else {
- if (!etsm->priv->root)
- etsm->priv->root = e_tree_selection_model_node_new();
- return etsm->priv->root;
- }
-}
-#endif
-
-static void
-update_parents (ETreeSelectionModel *etsm, ETreePath path)
-{
- int i;
- int depth;
- ETreeSorted *ets = etsm->priv->ets;
- int *orig_position_sequence;
- ETreeSelectionModelNode **node_sequence;
- ETreePath parents;
-
- if (!etsm->priv->root)
- return;
-
- depth = e_tree_model_node_depth (E_TREE_MODEL(ets), path);
-
- orig_position_sequence = g_new(int, depth + 1);
- node_sequence = g_new(ETreeSelectionModelNode *, depth + 1);
-
- parents = path;
-
- for (i = depth; i > 0; i--) {
- if (!parents) {
- g_free(orig_position_sequence);
- g_free(node_sequence);
- return;
- }
- orig_position_sequence[i] = e_tree_sorted_orig_position(etsm->priv->ets, parents);
- parents = e_tree_model_node_get_parent(E_TREE_MODEL(etsm->priv->ets), parents);
- }
-
- node_sequence[0] = etsm->priv->root;
- for (i = 0; i < depth; i++) {
- node_sequence[i + 1] = NULL;
-
- if (node_sequence[i]->children)
- node_sequence[i + 1] = node_sequence[i]->children[orig_position_sequence[i + 1]];
-
- if (node_sequence[i + 1] == NULL) {
- g_free(orig_position_sequence);
- g_free(node_sequence);
- return;
- }
- }
-
- if (node_sequence[depth]->num_children == -1)
- e_tree_selection_model_node_fill_children(etsm, path, node_sequence[depth]);
-
- if (!node_sequence[depth]->all_children_selected_array)
- node_sequence[depth]->all_children_selected_array = e_bit_array_new(node_sequence[depth]->num_children);
- if (!node_sequence[depth]->any_children_selected_array)
- node_sequence[depth]->any_children_selected_array = e_bit_array_new(node_sequence[depth]->num_children);
-
- node_sequence[depth]->all_children_selected =
- e_bit_array_cross_and(node_sequence[depth]->all_children_selected_array) &&
- node_sequence[depth]->selected;
-
- node_sequence[depth]->any_children_selected =
- e_bit_array_cross_or(node_sequence[depth]->any_children_selected_array) ||
- node_sequence[depth]->selected;
-
- for (i = depth - 1; i >= 0; i--) {
- gboolean all_children, any_children;
-
- if (!node_sequence[i]->all_children_selected_array)
- node_sequence[i]->all_children_selected_array = e_bit_array_new(node_sequence[i]->num_children);
- if (!node_sequence[i]->any_children_selected_array)
- node_sequence[i]->any_children_selected_array = e_bit_array_new(node_sequence[i]->num_children);
-
- e_bit_array_change_one_row(node_sequence[i]->all_children_selected_array,
- orig_position_sequence[i + 1], node_sequence[i + 1]->all_children_selected);
- e_bit_array_change_one_row(node_sequence[i]->any_children_selected_array,
- orig_position_sequence[i + 1], node_sequence[i + 1]->any_children_selected);
-
- all_children = node_sequence[i]->all_children_selected;
- any_children = node_sequence[i]->any_children_selected;
-
- node_sequence[i]->all_children_selected =
- e_bit_array_cross_and(node_sequence[i]->all_children_selected_array) &&
- node_sequence[i]->selected;
- node_sequence[i]->any_children_selected =
- e_bit_array_cross_or(node_sequence[i]->any_children_selected_array) ||
- node_sequence[i]->selected;
-
- if (all_children == node_sequence[i]->all_children_selected &&
- any_children == node_sequence[i]->any_children_selected)
- break;
- }
-
- g_free(orig_position_sequence);
- g_free(node_sequence);
-}
-
-
-static void
-etsm_change_one_path(ETreeSelectionModel *etsm, ETreePath path, gboolean grow)
-{
- ETreeSelectionModelNode *node;
-
- if (!path)
- return;
-
- path = e_tree_sorted_model_to_view_path(etsm->priv->ets, path);
-
- if (!path)
- return;
-
- node = etsm_find_node_unless_equals (etsm, path, grow);
-
- if (node) {
- node->selected = grow;
- update_parents(etsm, path);
- }
-}
-
-static void
-etsm_real_select_single_path (ETreeSelectionModel *etsm, ETreePath path)
-{
- etsm_real_clear (etsm);
- etsm_change_one_path(etsm, path, TRUE);
- etsm->priv->selection_start_path = path;
- etsm->priv->selected_row = -1;
- etsm->priv->selected_range_end = -1;
-}
-
-
-/* Signal handlers */
-
-static void
-etsm_freeze (ETreeSelectionModel *etsm)
-{
- etsm->priv->frozen_count ++;
-}
-
-static void
-etsm_unfreeze (ETreeSelectionModel *etsm)
-{
- etsm->priv->frozen_count --;
-}
-
-static void
-etsm_pre_change (ETreeModel *etm, ETreeSelectionModel *etsm)
-{
- g_free (etsm->priv->cursor_save_id);
- etsm->priv->cursor_save_id = NULL;
-
- if (e_tree_model_has_get_node_by_id (etm) &&
- e_tree_model_has_save_id (etm) &&
- etsm->priv->cursor_path) {
- etsm->priv->cursor_save_id = e_tree_model_get_save_id (etm, etsm->priv->cursor_path);
- }
-
- etsm_freeze (etsm);
-}
-
-static void
-etsm_no_change (ETreeModel *etm, ETreeSelectionModel *etsm)
-{
- etsm_unfreeze (etsm);
-}
-
-static void
-clear_tree (ETreeSelectionModel *etsm, ETreeModel *etm)
-{
- int cursor_row;
-
- etsm_real_clear (etsm);
- etsm->priv->cursor_path = NULL;
-
- if (e_tree_model_has_get_node_by_id (etm) && etsm->priv->cursor_save_id) {
- ETreePath cursor_path;
-
- cursor_path = e_tree_model_get_node_by_id (etm, etsm->priv->cursor_save_id);
- etsm->priv->cursor_path = cursor_path;
- if (cursor_path != NULL && etsm->priv->cursor_col == -1)
- etsm->priv->cursor_col = 0;
-
- etsm_real_select_single_path(etsm, cursor_path);
- }
-
- cursor_row = etsm_cursor_row_real (etsm);
- etsm->priv->selected_row = -1;
- etsm->priv->selected_range_end = -1;
- e_selection_model_selection_changed(E_SELECTION_MODEL(etsm));
- if (cursor_row != -1)
- e_selection_model_cursor_changed(E_SELECTION_MODEL(etsm), cursor_row, etsm->priv->cursor_col);
- else {
- e_selection_model_cursor_changed(E_SELECTION_MODEL(etsm), -1, -1);
- e_selection_model_cursor_activated(E_SELECTION_MODEL(etsm), -1, -1);
- }
-
- g_free (etsm->priv->cursor_save_id);
- etsm->priv->cursor_save_id = NULL;
-}
-
-static void
-etsm_node_changed (ETreeModel *etm, ETreePath node, ETreeSelectionModel *etsm)
-{
- clear_tree (etsm, etm);
- etsm_unfreeze (etsm);
-}
-
-static void
-etsm_node_data_changed (ETreeModel *etm, ETreePath node, ETreeSelectionModel *etsm)
-{
- g_free (etsm->priv->cursor_save_id);
- etsm->priv->cursor_save_id = NULL;
- etsm_unfreeze (etsm);
-}
-
-static void
-etsm_node_col_changed (ETreeModel *etm, ETreePath node, int col, ETreeSelectionModel *etsm)
-{
- g_free (etsm->priv->cursor_save_id);
- etsm->priv->cursor_save_id = NULL;
- etsm_unfreeze (etsm);
-}
-
-static void
-etsm_node_inserted (ETreeModel *etm, ETreePath parent, ETreePath child, ETreeSelectionModel *etsm)
-{
- clear_tree (etsm, etm);
- etsm_unfreeze (etsm);
-#if 0
- ETreeSelectionModelNode *node;
- ETreePath path;
-
- path = e_tree_sorted_model_to_view_path(etsm->priv->ets, parent);
-
- if (!path)
- return;
-
- node = etsm_find_node_unless_equals (etsm, path, FALSE);
-
- if (node) {
- node->selected = FALSE;
- update_parents(etsm, path);
- }
-#endif
-}
-
-static void
-etsm_node_removed (ETreeModel *etm, ETreePath parent, ETreePath child, int old_position, ETreeSelectionModel *etsm)
-{
-}
-
-static void
-etsm_node_deleted (ETreeModel *etm, ETreePath child, ETreeSelectionModel *etsm)
-{
- clear_tree (etsm, etm);
- etsm_unfreeze (etsm);
-}
-
-
-static void
-etsm_sorted_node_resorted (ETreeModel *etm, ETreePath node, ETreeSelectionModel *etsm)
-{
- int cursor_row = etsm_cursor_row_real (etsm);
-
- etsm->priv->selected_row = -1;
- etsm->priv->selected_range_end = -1;
- e_selection_model_selection_changed(E_SELECTION_MODEL(etsm));
-
- if (cursor_row != -1)
- e_selection_model_cursor_changed(E_SELECTION_MODEL(etsm), cursor_row, etsm->priv->cursor_col);
- else
- e_selection_model_cursor_changed(E_SELECTION_MODEL(etsm), -1, -1);
-}
-
-static void
-add_model(ETreeSelectionModel *etsm, ETreeModel *model)
-{
- ETreeSelectionModelPriv *priv = etsm->priv;
-
- priv->model = model;
-
- if (!priv->model)
- return;
-
- 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
-add_ets(ETreeSelectionModel *etsm, ETreeSorted *ets)
-{
- ETreeSelectionModelPriv *priv = etsm->priv;
-
- priv->ets = ets;
-
- if (!priv->ets)
- return;
-
- g_object_ref(priv->ets);
- priv->sorted_model_node_resorted_id = g_signal_connect (G_OBJECT (priv->ets), "node_resorted",
- G_CALLBACK (etsm_sorted_node_resorted), etsm);
-}
-
-static void
-drop_ets(ETreeSelectionModel *etsm)
-{
- ETreeSelectionModelPriv *priv = etsm->priv;
-
- if (!priv->ets)
- return;
-
- g_signal_handler_disconnect (G_OBJECT (priv->ets),
- priv->sorted_model_node_resorted_id);
-
- g_object_unref (priv->ets);
- priv->ets = NULL;
-
- priv->sorted_model_node_resorted_id = 0;
-}
-
-/* Virtual functions */
-static void
-etsm_dispose (GObject *object)
-{
- ETreeSelectionModel *etsm;
-
- etsm = E_TREE_SELECTION_MODEL (object);
-
- if (etsm->priv) {
- etsm_real_clear (etsm);
- etsm->priv->cursor_path = NULL;
-
- drop_model(etsm);
- drop_ets(etsm);
-
- g_free (etsm->priv->cursor_save_id);
- etsm->priv->cursor_save_id = NULL;
-
- g_free (etsm->priv);
- etsm->priv = NULL;
- }
-
- 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)
-{
- ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL (object);
-
- switch (prop_id){
- case PROP_CURSOR_ROW:
- g_value_set_int (value, etsm_cursor_row_real(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;
-
- case PROP_ETS:
- g_value_set_object (value, etsm->priv->ets);
- 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, etsm_cursor_row_real(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;
-
- case PROP_ETS:
- drop_ets(etsm);
- add_ets(etsm, E_TREE_SORTED (g_value_get_object (value)));
- break;
- }
-}
-
-static ETreeSelectionModelNode *
-etsm_recurse_is_path_selected (ETreeSelectionModel *etsm,
- ETreePath path,
- gboolean *is_selected)
-{
- ETreeSelectionModelNode *selection_node;
- ETreeSorted *ets = etsm->priv->ets;
- ETreePath parent;
-
- parent = e_tree_model_node_get_parent(E_TREE_MODEL(ets), path);
-
- if (parent) {
- selection_node = etsm_recurse_is_path_selected (etsm, parent, is_selected);
- if (selection_node) {
- int position = e_tree_sorted_orig_position(ets, path);
- if (position < 0 || position >= selection_node->num_children) {
- *is_selected = FALSE;
- return NULL;
- }
- if (selection_node->all_children_selected) {
- *is_selected = TRUE;
- return NULL;
- }
- if (! selection_node->any_children_selected) {
- *is_selected = FALSE;
- return NULL;
- }
- if (selection_node->all_children_selected_array && e_bit_array_value_at(selection_node->all_children_selected_array, position)) {
- *is_selected = TRUE;
- return NULL;
- }
- if (selection_node->any_children_selected_array && ! e_bit_array_value_at(selection_node->any_children_selected_array, position)) {
- *is_selected = FALSE;
- return NULL;
- }
- if (!selection_node->children) {
- *is_selected = FALSE;
- return NULL;
- }
- return selection_node->children[position];
- } else
- return NULL;
- } else {
- if (etsm->priv->root) {
- return etsm->priv->root;
- } else {
- *is_selected = FALSE;
- return NULL;
- }
- }
-}
-
-static gboolean
-etsm_is_path_selected (ETreeSelectionModel *etsm,
- ETreePath path)
-{
- ETreeSelectionModelNode *selection_node;
- gboolean ret_val;
-
- selection_node = etsm_recurse_is_path_selected (etsm, path, &ret_val);
-
- if (selection_node)
- ret_val = selection_node->selected;
-
- return ret_val;
-}
-
-/**
- * e_selection_model_is_row_selected
- * @selection: #ESelectionModel to check
- * @n: The row to check
- *
- * This routine calculates whether the given row is selected.
- *
- * Returns: %TRUE if the given row is selected
- */
-static gboolean
-etsm_is_row_selected (ESelectionModel *selection,
- gint row)
-{
- ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL(selection);
- ETreePath path;
-
- g_return_val_if_fail(row < e_table_model_row_count(E_TABLE_MODEL(etsm->priv->etta)), FALSE);
- g_return_val_if_fail(row >= 0, FALSE);
- g_return_val_if_fail(etsm != NULL, FALSE);
-
- path = e_tree_table_adapter_node_at_row(etsm->priv->etta, row);
- return etsm_is_path_selected (etsm, path);
-}
-
-
-typedef struct {
- ETreeSelectionModel *etsm;
- EForeachFunc callback;
- gpointer closure;
-} ModelAndCallback;
-
-static void
-etsm_row_foreach_cb (ETreePath path, gpointer user_data)
-{
- ModelAndCallback *mac = user_data;
- int row = etsm_row_of_node(mac->etsm, path);
- if (row >= 0)
- mac->callback(row, mac->closure);
-}
-
-/**
- * e_selection_model_foreach
- * @selection: #ESelectionModel to traverse
- * @callback: The callback function to call back.
- * @closure: The closure
- *
- * This routine calls the given callback function once for each
- * selected row, passing closure as the closure.
- */
-static void
-etsm_foreach (ESelectionModel *selection,
- EForeachFunc callback,
- gpointer closure)
-{
- ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL(selection);
- ModelAndCallback mac;
-
- mac.etsm = etsm;
- mac.callback = callback;
- mac.closure = closure;
-
- e_tree_selection_model_foreach(etsm, etsm_row_foreach_cb, &mac);
-}
-
-/**
- * e_selection_model_clear
- * @selection: #ESelectionModel to clear
- *
- * This routine clears the selection to no rows selected.
- */
-static void
-etsm_clear(ESelectionModel *selection)
-{
- ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL(selection);
-
- etsm_real_clear (etsm);
-
- etsm->priv->cursor_path = NULL;
- etsm->priv->cursor_col = -1;
- etsm->priv->selected_row = -1;
- etsm->priv->selected_range_end = -1;
- e_selection_model_selection_changed(E_SELECTION_MODEL(etsm));
- e_selection_model_cursor_changed(E_SELECTION_MODEL(etsm), -1, -1);
-}
-
-/* Standard functions */
-static void
-etsm_selected_count_all_recurse (ETreeSelectionModel *etsm,
- ETreePath path,
- int *count)
-{
- ETreePath child;
-
- (*count) ++;
-
- child = e_tree_model_node_get_first_child(E_TREE_MODEL(etsm->priv->model), path);
- for ( ; child; child = e_tree_model_node_get_next(E_TREE_MODEL(etsm->priv->model), child))
- if (child)
- etsm_selected_count_all_recurse (etsm, child, count);
-}
-
-static void
-etsm_selected_count_recurse (ETreeSelectionModel *etsm,
- ETreeSelectionModelNode *selection_node,
- ETreePath path,
- int *count)
-{
- if (selection_node->all_children_selected) {
- if (path)
- etsm_selected_count_all_recurse(etsm, path, count);
- return;
- }
-
- if (selection_node->selected) {
- (*count) ++;
- }
-
- if (!selection_node->any_children_selected)
- return;
-
- if (selection_node->children) {
- ETreePath child = e_tree_model_node_get_first_child(E_TREE_MODEL(etsm->priv->model), path);
- int i;
- for (i = 0; child && i < selection_node->num_children; i++, child = e_tree_model_node_get_next(E_TREE_MODEL(etsm->priv->model), child))
- if (selection_node->all_children_selected_array && e_bit_array_value_at(selection_node->all_children_selected_array, i))
- etsm_selected_count_all_recurse (etsm, child, count);
- else if (selection_node->children[i])
- etsm_selected_count_recurse (etsm, selection_node->children[i], child, count);
-
- }
-}
-
-/**
- * e_selection_model_selected_count
- * @selection: #ESelectionModel to count
- *
- * This routine calculates the number of rows selected.
- *
- * Returns: The number of rows selected in the given model.
- */
-static gint
-etsm_selected_count (ESelectionModel *selection)
-{
- ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL(selection);
- int count = 0;
- if (etsm->priv->root) {
- ETreePath model_root;
- model_root = e_tree_model_get_root(etsm->priv->model);
- etsm_selected_count_recurse(etsm, etsm->priv->root, model_root, &count);
- if (!e_tree_table_adapter_root_node_is_visible (etsm->priv->etta) && etsm_is_path_selected (etsm, e_tree_model_get_root(E_TREE_MODEL (etsm->priv->ets)))) {
- count --;
- }
- }
- return count;
-}
-
-/**
- * e_selection_model_select_all
- * @selection: #ESelectionModel to select all
- *
- * This routine selects all the rows in the given
- * #ESelectionModel.
- */
-static void
-etsm_select_all (ESelectionModel *selection)
-{
- ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL(selection);
- ETreePath root;
-
- root = e_tree_model_get_root(E_TREE_MODEL(etsm->priv->ets));
- if (root == NULL)
- return;
-
- etsm_real_clear (etsm);
-
- etsm->priv->root = e_tree_selection_model_node_new();
- etsm->priv->root->selected = TRUE;
- etsm->priv->root->all_children_selected = TRUE;
- etsm->priv->root->any_children_selected = TRUE;
-
- e_tree_selection_model_node_fill_children(etsm, root, etsm->priv->root);
- etsm->priv->root->all_children_selected_array = NULL;
- etsm->priv->root->any_children_selected_array = NULL;
-
- if (etsm->priv->cursor_col == -1)
- etsm->priv->cursor_col = 0;
- if (etsm->priv->cursor_path == NULL)
- etsm->priv->cursor_path = etsm_node_at_row(etsm, 0);
- etsm->priv->selection_start_path = etsm_node_at_row(etsm, 0);
- etsm->priv->selected_row = -1;
- etsm->priv->selected_range_end = -1;
- e_selection_model_selection_changed(E_SELECTION_MODEL(etsm));
- e_selection_model_cursor_changed(E_SELECTION_MODEL(etsm), etsm_cursor_row_real(etsm), etsm->priv->cursor_col);
-}
-
-static void
-etsm_invert_selection_recurse (ETreeSelectionModel *etsm,
- ETreeSelectionModelNode *selection_node)
-{
- gboolean temp;
- EBitArray *temp_eba;
- selection_node->selected = ! selection_node->selected;
-
- temp = selection_node->all_children_selected;
- selection_node->all_children_selected = ! selection_node->any_children_selected;
- selection_node->any_children_selected = ! temp;
-
- temp_eba = selection_node->all_children_selected_array;
- selection_node->all_children_selected_array = selection_node->any_children_selected_array;
- selection_node->any_children_selected_array = temp_eba;
- if (selection_node->all_children_selected_array)
- e_bit_array_invert_selection(selection_node->all_children_selected_array);
- if (selection_node->any_children_selected_array)
- e_bit_array_invert_selection(selection_node->any_children_selected_array);
- if (selection_node->children) {
- int i;
- for (i = 0; i < selection_node->num_children; i++) {
- if (selection_node->children[i])
- etsm_invert_selection_recurse (etsm, selection_node->children[i]);
- }
- }
-}
-
-/**
- * e_selection_model_invert_selection
- * @selection: #ESelectionModel to invert
- *
- * This routine inverts all the rows in the given
- * #ESelectionModel.
- */
-static void
-etsm_invert_selection (ESelectionModel *selection)
-{
- ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL(selection);
-
- if (etsm->priv->root)
- etsm_invert_selection_recurse (etsm, etsm->priv->root);
-
- etsm->priv->cursor_col = -1;
- etsm->priv->cursor_path = NULL;
- etsm->priv->selection_start_path = etsm_node_at_row(etsm, 0);
- etsm->priv->selected_row = -1;
- etsm->priv->selected_range_end = -1;
- e_selection_model_selection_changed(E_SELECTION_MODEL(etsm));
- e_selection_model_cursor_changed(E_SELECTION_MODEL(etsm), -1, -1);
-}
-
-static int
-etsm_row_count (ESelectionModel *selection)
-{
- ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL(selection);
- return e_table_model_row_count(E_TABLE_MODEL(etsm->priv->etta));
-}
-
-static void
-etsm_change_one_row(ESelectionModel *selection, int row, gboolean grow)
-{
- ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL(selection);
- ETreeSelectionModelNode *node;
- ETreePath path;
-
- g_return_if_fail(row < e_table_model_row_count(E_TABLE_MODEL(etsm->priv->etta)));
- g_return_if_fail(row >= 0);
- g_return_if_fail(selection != NULL);
-
- path = e_tree_table_adapter_node_at_row(etsm->priv->etta, row);
-
- if (!path)
- return;
-
- node = etsm_find_node_unless_equals (etsm, path, grow);
-
- if (node) {
- node->selected = grow;
- update_parents(etsm, path);
- }
-}
-
-static void
-etsm_change_cursor (ESelectionModel *selection, int row, int col)
-{
- ETreeSelectionModel *etsm;
-
- g_return_if_fail(selection != NULL);
- g_return_if_fail(E_IS_SELECTION_MODEL(selection));
-
- etsm = E_TREE_SELECTION_MODEL(selection);
-
- if (row == -1) {
- etsm->priv->cursor_path = NULL;
- } else {
- etsm->priv->cursor_path = etsm_node_at_row(etsm, row);
- }
- etsm->priv->cursor_col = col;
-}
-
-static void
-etsm_change_range(ESelectionModel *selection, int start, int end, gboolean grow)
-{
- int i;
- if (start != end) {
- if (selection->sorter && e_sorter_needs_sorting(selection->sorter)) {
- for ( i = start; i < end; i++) {
- e_selection_model_change_one_row(selection, e_sorter_sorted_to_model(selection->sorter, i), grow);
- }
- } else {
- for ( i = start; i < end; i++) {
- e_selection_model_change_one_row(selection, i, grow);
- }
- }
- }
-}
-
-static int
-etsm_cursor_row (ESelectionModel *selection)
-{
- return etsm_cursor_row_real(E_TREE_SELECTION_MODEL(selection));
-}
-
-static int
-etsm_cursor_col (ESelectionModel *selection)
-{
- ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL(selection);
- return etsm->priv->cursor_col;
-}
-
-static void
-etsm_select_single_row (ESelectionModel *selection, int row)
-{
- ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL(selection);
- int selected_row = etsm->priv->selected_row;
-
- etsm_real_clear (etsm);
- etsm_change_one_row(selection, row, TRUE);
- etsm->priv->selection_start_path = etsm_node_at_row(etsm, row);
-
- etsm->priv->selected_row = row;
- etsm->priv->selected_range_end = -1;
- if (selected_row != -1) {
- if (selected_row != etsm->priv->selected_row) {
- e_selection_model_selection_row_changed(E_SELECTION_MODEL(etsm), selected_row);
- e_selection_model_selection_row_changed(E_SELECTION_MODEL(etsm), row);
- }
- } else {
- e_selection_model_selection_changed(E_SELECTION_MODEL(etsm));
- }
-}
-
-static void
-etsm_toggle_single_row (ESelectionModel *selection, int row)
-{
- ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL(selection);
-
- etsm->priv->selection_start_path = etsm_node_at_row(etsm, row);
-
- etsm_change_one_row(selection, row, !etsm_is_row_selected(selection, row));
-
- etsm->priv->selected_row = -1;
- etsm->priv->selected_range_end = -1;
- e_selection_model_selection_changed(E_SELECTION_MODEL(etsm));
-}
-
-static void
-etsm_real_move_selection_end (ETreeSelectionModel *etsm, int row)
-{
- ESelectionModel *selection = E_SELECTION_MODEL (etsm);
- int old_start;
- int old_end;
- int new_start;
- int new_end;
- int start_row = etsm_row_of_node(etsm, etsm->priv->selection_start_path);
- if (selection->sorter && e_sorter_needs_sorting(selection->sorter)) {
- old_start = MIN (e_sorter_model_to_sorted(selection->sorter, start_row),
- e_sorter_model_to_sorted(selection->sorter, etsm_cursor_row_real(etsm)));
- old_end = MAX (e_sorter_model_to_sorted(selection->sorter, start_row),
- e_sorter_model_to_sorted(selection->sorter, etsm_cursor_row_real(etsm))) + 1;
- new_start = MIN (e_sorter_model_to_sorted(selection->sorter, start_row),
- e_sorter_model_to_sorted(selection->sorter, row));
- new_end = MAX (e_sorter_model_to_sorted(selection->sorter, start_row),
- e_sorter_model_to_sorted(selection->sorter, row)) + 1;
- } else {
- old_start = MIN (start_row, etsm_cursor_row_real(etsm));
- old_end = MAX (start_row, etsm_cursor_row_real(etsm)) + 1;
- new_start = MIN (start_row, row);
- new_end = MAX (start_row, row) + 1;
- }
- /* This wouldn't work nearly so smoothly if one end of the selection weren't held in place. */
- if (old_start < new_start)
- etsm_change_range(selection, old_start, new_start, FALSE);
- if (new_start < old_start)
- etsm_change_range(selection, new_start, old_start, TRUE);
- if (old_end < new_end)
- etsm_change_range(selection, old_end, new_end, TRUE);
- if (new_end < old_end)
- etsm_change_range(selection, new_end, old_end, FALSE);
- etsm->priv->selected_row = -1;
- etsm->priv->selected_range_end = -1;
-}
-
-static void
-etsm_move_selection_end (ESelectionModel *selection, int row)
-{
- ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL(selection);
-
- etsm_real_move_selection_end (etsm, row);
- e_selection_model_selection_changed(E_SELECTION_MODEL(selection));
-}
-
-static void
-etsm_set_selection_end (ESelectionModel *selection, int row)
-{
- ETreeSelectionModel *etsm = E_TREE_SELECTION_MODEL(selection);
- int selected_range_end = etsm->priv->selected_range_end;
-
- etsm_real_select_single_path(etsm, etsm->priv->selection_start_path);
- etsm->priv->cursor_path = etsm->priv->selection_start_path;
- etsm_real_move_selection_end(etsm, row);
- etsm->priv->selected_range_end = row;
- if (selected_range_end != -1 && row != -1) {
- if (selected_range_end == row - 1 ||
- selected_range_end == row + 1) {
- e_selection_model_selection_row_changed(E_SELECTION_MODEL(etsm), selected_range_end);
- e_selection_model_selection_row_changed(E_SELECTION_MODEL(etsm), row);
- return;
- }
- }
- e_selection_model_selection_changed(E_SELECTION_MODEL(etsm));
-}
-
-
-/* Standard functions */
-static void
-etsm_foreach_all_recurse (ETreeSelectionModel *etsm,
- ETreePath path,
- ETreeForeachFunc callback,
- gpointer closure)
-{
- ETreePath child;
-
- callback(path, closure);
-
- child = e_tree_model_node_get_first_child(E_TREE_MODEL(etsm->priv->model), path);
- for ( ; child; child = e_tree_model_node_get_next(E_TREE_MODEL(etsm->priv->model), child))
- if (child)
- etsm_foreach_all_recurse (etsm, child, callback, closure);
-}
-
-static void
-etsm_foreach_recurse (ETreeSelectionModel *etsm,
- ETreeSelectionModelNode *selection_node,
- ETreePath path,
- ETreeForeachFunc callback,
- gpointer closure)
-{
- if (selection_node->all_children_selected) {
- if (path)
- etsm_foreach_all_recurse(etsm, path, callback, closure);
- return;
- }
- if (!selection_node->any_children_selected)
- return;
-
- if (selection_node->selected) {
- callback(path, closure);
- }
-
- if (selection_node->children) {
- ETreePath child = e_tree_model_node_get_first_child(E_TREE_MODEL(etsm->priv->model), path);
- int i;
- for (i = 0; i < selection_node->num_children; i++, child = e_tree_model_node_get_next(E_TREE_MODEL(etsm->priv->model), child))
- if (selection_node->all_children_selected_array && e_bit_array_value_at(selection_node->all_children_selected_array, i))
- etsm_foreach_all_recurse(etsm, child, callback, closure);
- else if (selection_node->children[i])
- etsm_foreach_recurse (etsm, selection_node->children[i], child, callback, closure);
- }
-}
-
-void
-e_tree_selection_model_foreach (ETreeSelectionModel *etsm,
- ETreeForeachFunc callback,
- gpointer closure)
-{
- if (etsm->priv->root) {
- ETreePath model_root;
- model_root = e_tree_model_get_root(etsm->priv->model);
- etsm_foreach_recurse(etsm, etsm->priv->root, model_root, callback, closure);
- }
-}
-
-void
-e_tree_selection_model_select_single_path (ETreeSelectionModel *etsm, ETreePath path)
-{
- etsm_real_select_single_path (etsm, path);
-
- e_selection_model_selection_changed(E_SELECTION_MODEL(etsm));
-}
-
-void
-e_tree_selection_model_add_to_selection (ETreeSelectionModel *etsm, ETreePath path)
-{
- etsm_change_one_path(etsm, path, TRUE);
- etsm->priv->selection_start_path = path;
- etsm->priv->selected_row = -1;
- etsm->priv->selected_range_end = -1;
-
- e_selection_model_selection_changed(E_SELECTION_MODEL(etsm));
-}
-
-void
-e_tree_selection_model_change_cursor (ETreeSelectionModel *etsm, ETreePath path)
-{
- int row;
-
- etsm->priv->cursor_path = path;
-
- row = etsm_cursor_row_real(etsm);
-
- E_SELECTION_MODEL (etsm)->old_selection = -1;
-
- e_selection_model_cursor_changed(E_SELECTION_MODEL(etsm), row, etsm->priv->cursor_col);
- e_selection_model_cursor_activated(E_SELECTION_MODEL(etsm), row, etsm->priv->cursor_col);
-}
-
-ETreePath
-e_tree_selection_model_get_cursor (ETreeSelectionModel *etsm)
-{
- return etsm->priv->cursor_path;
-}
-
-
-static void
-e_tree_selection_model_init (ETreeSelectionModel *etsm)
-{
- ETreeSelectionModelPriv *priv;
- priv = g_new(ETreeSelectionModelPriv, 1);
- etsm->priv = priv;
-
- priv->etta = NULL;
- priv->ets = NULL;
- priv->model = NULL;
-
- priv->root = NULL;
-
- priv->cursor_path = NULL;
- priv->cursor_col = -1;
- priv->selection_start_path = NULL;
-
- priv->cursor_save_id = NULL;
-
- priv->frozen_count = 0;
-
- priv->frozen_count = 0;
-
-
- priv->tree_model_pre_change_id = 0;
- priv->tree_model_no_change_id = 0;
- priv->tree_model_node_changed_id = 0;
- priv->tree_model_node_data_changed_id = 0;
- priv->tree_model_node_col_changed_id = 0;
- priv->tree_model_node_inserted_id = 0;
- priv->tree_model_node_removed_id = 0;
- priv->tree_model_node_deleted_id = 0;
-
- priv->sorted_model_node_resorted_id = 0;
- priv->selected_row = -1;
- priv->selected_range_end = -1;
-}
-
-static void
-e_tree_selection_model_class_init (ETreeSelectionModelClass *klass)
-{
- 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->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));
-
- g_object_class_install_property (object_class, PROP_ETS,
- g_param_spec_object ("ets",
- _("ETS"),
- /*_( */"XXX blurb" /*)*/,
- E_TREE_SORTED_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 d56e5bdef1..0000000000
--- a/widgets/table/e-tree-table-adapter.c
+++ /dev/null
@@ -1,1183 +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"
-
-#define d(x)
-
-#define INCREMENT_AMOUNT 100
-
-static ETableModelClass *parent_class;
-
-
-struct ETreeTableAdapterPriv {
- ETreeModel *source;
- int n_map;
- int n_vals_allocated;
- ETreePath *map_table;
- GHashTable *attributes;
-
- guint root_visible : 1;
-
- int last_access;
-
- int tree_model_pre_change_id;
- int tree_model_no_change_id;
- int tree_model_node_changed_id;
- int tree_model_node_data_changed_id;
- int tree_model_node_col_changed_id;
- int tree_model_node_inserted_id;
- int tree_model_node_removed_id;
- int tree_model_node_request_collapse_id;
-};
-
-typedef struct ETreeTableAdapterNode {
- guint expanded : 1;
- guint expandable : 1;
- guint expandable_set : 1;
-
- /* parent/child/sibling pointers */
- guint32 num_visible_children;
-} ETreeTableAdapterNode;
-
-static ETreeTableAdapterNode *
-find_node(ETreeTableAdapter *adapter, ETreePath path)
-{
- ETreeTableAdapterNode *node;
-
- if (path == NULL)
- return NULL;
-
- if (e_tree_model_has_save_id(adapter->priv->source)) {
- char *save_id;
- save_id = e_tree_model_get_save_id(adapter->priv->source, path);
- node = g_hash_table_lookup(adapter->priv->attributes, save_id);
- g_free(save_id);
- } else {
- node = g_hash_table_lookup(adapter->priv->attributes, path);
- }
- if (node && !node->expandable_set) {
- node->expandable = e_tree_model_node_is_expandable(adapter->priv->source, path);
- node->expandable_set = 1;
- }
-
- return node;
-}
-
-static ETreeTableAdapterNode *
-find_or_create_node(ETreeTableAdapter *etta, ETreePath path)
-{
- ETreeTableAdapterNode *node;
-
- node = find_node(etta, path);
-
- if (!node) {
- node = g_new(ETreeTableAdapterNode, 1);
- if (e_tree_model_node_is_root(etta->priv->source, path))
- node->expanded = TRUE;
- else
- node->expanded = e_tree_model_get_expanded_default(etta->priv->source);
- node->expandable = e_tree_model_node_is_expandable(etta->priv->source, path);
- node->expandable_set = 1;
- node->num_visible_children = 0;
-
- if (e_tree_model_has_save_id(etta->priv->source)) {
- char *save_id;
- save_id = e_tree_model_get_save_id(etta->priv->source, path);
- g_hash_table_insert(etta->priv->attributes, save_id, node);
- } else {
- g_hash_table_insert(etta->priv->attributes, path, node);
- }
- }
-
- return node;
-}
-
-static gboolean
-e_tree_table_adapter_node_would_be_expanded (ETreeTableAdapter *etta, ETreePath path)
-{
- ETreeTableAdapterNode *node;
-
- if (e_tree_model_node_is_root(etta->priv->source, path) &&
- !etta->priv->root_visible)
- return TRUE;
-
- node = find_node (etta, path);
- if (node)
- return node->expanded;
- else {
- if (e_tree_model_node_is_root(etta->priv->source, path))
- return TRUE;
- else
- return e_tree_model_get_expanded_default(etta->priv->source);
- }
-}
-
-static void
-add_expanded_node(ETreeTableAdapter *etta, char *save_id, gboolean expanded)
-{
- ETreeTableAdapterNode *node;
-
- node = g_hash_table_lookup(etta->priv->attributes, save_id);
-
- if (node) {
- node->expandable_set = 0;
- node->expanded = expanded;
- return;
- }
-
- node = g_new(ETreeTableAdapterNode, 1);
-
- node->expanded = expanded;
- node->expandable = 0;
- node->expandable_set = 0;
- node->num_visible_children = 0;
-
- g_hash_table_insert(etta->priv->attributes, save_id, node);
-}
-
-static void
-etta_expand_to(ETreeTableAdapter *etta, int size)
-{
- if (size > etta->priv->n_vals_allocated) {
- etta->priv->n_vals_allocated = MAX(etta->priv->n_vals_allocated + INCREMENT_AMOUNT, size);
- etta->priv->map_table = g_renew (ETreePath, etta->priv->map_table, etta->priv->n_vals_allocated);
- }
-
-}
-
-static void
-etta_update_parent_child_counts(ETreeTableAdapter *etta, ETreePath path, int change)
-{
- for (path = e_tree_model_node_get_parent(etta->priv->source, path);
- path;
- path = e_tree_model_node_get_parent(etta->priv->source, path)) {
- ETreeTableAdapterNode *node = find_or_create_node(etta, path);
- node->num_visible_children += change;
- }
- etta->priv->n_map += change;
-}
-
-static int
-find_next_node_maybe_deleted(ETreeTableAdapter *adapter, int row)
-{
- ETreePath path = adapter->priv->map_table[row];
- if (path) {
- ETreeTableAdapterNode *current = find_node (adapter, path);
-
- row += (current ? current->num_visible_children : 0) + 1;
- if (row >= adapter->priv->n_map)
- return -1;
- return row;
- } else
- return -1;
-}
-
-static int
-find_first_child_node_maybe_deleted(ETreeTableAdapter *adapter, int row)
-{
- if (row != -1) {
- ETreePath path = adapter->priv->map_table[row];
- if (e_tree_table_adapter_node_would_be_expanded (adapter, path)) {
- row ++;
- if (row >= adapter->priv->n_map)
- return -1;
- return row;
- } else
- return -1;
- } else
- return 0;
-}
-
-static int
-find_next_node(ETreeTableAdapter *adapter, int row)
-{
- ETreePath path = adapter->priv->map_table[row];
- if (path) {
- ETreePath next_sibling = e_tree_model_node_get_next(adapter->priv->source, path);
- ETreeTableAdapterNode *current = find_node (adapter, path);
- if (next_sibling) {
- row += (current ? current->num_visible_children : 0) + 1;
- if (row > adapter->priv->n_map)
- return -1;
- return row;
- } else
- return -1;
- } else
- return -1;
-}
-
-static int
-find_first_child_node(ETreeTableAdapter *adapter, int row)
-{
- if (row != -1) {
- ETreePath path = adapter->priv->map_table[row];
- ETreePath first_child = e_tree_model_node_get_first_child(adapter->priv->source, path);
- if (first_child && e_tree_table_adapter_node_is_expanded (adapter, path)) {
- row ++;
- if (row > adapter->priv->n_map)
- return -1;
- return row;
- } else
- return -1;
- } else
- return 0;
-}
-
-static int
-find_child_row_num_maybe_deleted(ETreeTableAdapter *etta, int row, ETreePath path)
-{
- row = find_first_child_node_maybe_deleted(etta, row);
-
- while (row != -1 && path != etta->priv->map_table[row]) {
- row = find_next_node_maybe_deleted(etta, row);
- }
-
- return row;
-}
-
-static int
-find_row_num(ETreeTableAdapter *etta, ETreePath path)
-{
- int depth;
- ETreePath *sequence;
- int i;
- int row;
-
- if (etta->priv->map_table == NULL)
- return -1;
- if (etta->priv->n_map == 0)
- return -1;
-
- if (path == NULL)
- return -1;
-
- if (etta->priv->last_access != -1) {
- int end = MIN(etta->priv->n_map, etta->priv->last_access + 10);
- int start = MAX(0, etta->priv->last_access - 10);
- int initial = MAX (MIN (etta->priv->last_access, end), start);
- for (i = initial; i < end; i++) {
- if(etta->priv->map_table[i] == path) {
- d(g_print("Found last access %d at row %d. (find_row_num)\n", etta->priv->last_access, i));
- return i;
- }
- }
- for (i = initial - 1; i >= start; i--) {
- if(etta->priv->map_table[i] == path) {
- d(g_print("Found last access %d at row %d. (find_row_num)\n", etta->priv->last_access, i));
- return i;
- }
- }
- }
-
-
- depth = e_tree_model_node_depth(etta->priv->source, path);
-
- sequence = g_new(ETreePath, depth + 1);
-
- sequence[0] = path;
-
- for (i = 0; i < depth; i++) {
- sequence[i + 1] = e_tree_model_node_get_parent(etta->priv->source, sequence[i]);
-
- if (!e_tree_table_adapter_node_is_expanded (etta, sequence[i + 1])) {
- g_free(sequence);
- return -1;
- }
- }
-
- row = 0;
-
- for (i = depth; i >= 0; i --) {
- while (row != -1 && row < etta->priv->n_map && sequence[i] != etta->priv->map_table[row]) {
- row = find_next_node(etta, row);
- }
- if (row >= etta->priv->n_map)
- break;
- if (row == -1)
- break;
- if (i == 0)
- break;
- row = find_first_child_node(etta, row);
- }
- g_free (sequence);
-
- if (row >= etta->priv->n_map)
- row = -1;
-
- d(g_print("Didn't find last access %d. Setting to %d. (find_row_num)\n", etta->priv->last_access, row));
- etta->priv->last_access = row;
- return row;
-}
-
-static int
-array_size_from_path(ETreeTableAdapter *etta, ETreePath path)
-{
- int size = 1;
-
- if (e_tree_table_adapter_node_is_expanded (etta, path)) {
- ETreePath children;
-
- for (children = e_tree_model_node_get_first_child(etta->priv->source, path);
- children;
- children = e_tree_model_node_get_next(etta->priv->source, children)) {
- size += array_size_from_path(etta, children);
- }
- }
-
- return size;
-}
-
-static int
-fill_array_from_path(ETreeTableAdapter *etta, ETreePath *array, ETreePath path)
-{
- ETreeTableAdapterNode *node = NULL;
- int index = 0;
-
- array[index] = path;
-
- index ++;
-
- node = find_node(etta, path);
-
- if (e_tree_table_adapter_node_is_expanded (etta, path)) {
- ETreePath children;
-
- if (!node)
- node = find_or_create_node(etta, path);
-
- for (children = e_tree_model_node_get_first_child(etta->priv->source, path);
- children;
- children = e_tree_model_node_get_next(etta->priv->source, children)) {
- index += fill_array_from_path(etta, array + index, children);
- }
- }
-
- if (node)
- node->num_visible_children = index - 1;
-
- return index;
-}
-
-static void
-free_string (gpointer key, gpointer value, gpointer data)
-{
- g_free(key);
-}
-
-static void
-etta_dispose (GObject *object)
-{
- ETreeTableAdapter *etta = E_TREE_TABLE_ADAPTER (object);
-
- if (etta->priv->source) {
- if (e_tree_model_has_save_id(etta->priv->source))
- g_hash_table_foreach(etta->priv->attributes, free_string, NULL);
-
- g_signal_handler_disconnect (G_OBJECT (etta->priv->source),
- etta->priv->tree_model_pre_change_id);
- g_signal_handler_disconnect (G_OBJECT (etta->priv->source),
- etta->priv->tree_model_no_change_id);
- g_signal_handler_disconnect (G_OBJECT (etta->priv->source),
- etta->priv->tree_model_node_changed_id);
- g_signal_handler_disconnect (G_OBJECT (etta->priv->source),
- etta->priv->tree_model_node_data_changed_id);
- g_signal_handler_disconnect (G_OBJECT (etta->priv->source),
- etta->priv->tree_model_node_col_changed_id);
- g_signal_handler_disconnect (G_OBJECT (etta->priv->source),
- etta->priv->tree_model_node_inserted_id);
- g_signal_handler_disconnect (G_OBJECT (etta->priv->source),
- etta->priv->tree_model_node_removed_id);
- g_signal_handler_disconnect (G_OBJECT (etta->priv->source),
- etta->priv->tree_model_node_request_collapse_id);
-
- g_object_unref (etta->priv->source);
- etta->priv->source = NULL;
-
- etta->priv->tree_model_pre_change_id = 0;
- etta->priv->tree_model_no_change_id = 0;
- etta->priv->tree_model_node_changed_id = 0;
- etta->priv->tree_model_node_data_changed_id = 0;
- etta->priv->tree_model_node_col_changed_id = 0;
- etta->priv->tree_model_node_inserted_id = 0;
- etta->priv->tree_model_node_removed_id = 0;
- etta->priv->tree_model_node_request_collapse_id = 0;
- }
-
- G_OBJECT_CLASS (parent_class)->dispose (object);
-}
-
-static void
-etta_finalize (GObject *object)
-{
- ETreeTableAdapter *etta = (ETreeTableAdapter *) object;
-
- g_hash_table_destroy (etta->priv->attributes);
- g_free (etta->priv->map_table);
-
- g_free (etta->priv);
- etta->priv = NULL;
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
-}
-
-static int
-etta_column_count (ETableModel *etm)
-{
- ETreeTableAdapter *etta = (ETreeTableAdapter *)etm;
-
- return e_tree_model_column_count (etta->priv->source);
-}
-
-static gboolean
-etta_has_save_id (ETableModel *etm)
-{
- ETreeTableAdapter *etta = (ETreeTableAdapter *)etm;
-
- return e_tree_model_has_save_id (etta->priv->source);
-}
-
-static gchar *
-etta_get_save_id (ETableModel *etm, int row)
-{
- ETreeTableAdapter *etta = (ETreeTableAdapter *)etm;
-
- if (etta->priv->root_visible)
- return e_tree_model_get_save_id (etta->priv->source, etta->priv->map_table [row]);
- else
- return e_tree_model_get_save_id (etta->priv->source, etta->priv->map_table [row + 1]);
-}
-
-static gboolean
-etta_has_change_pending (ETableModel *etm)
-{
- ETreeTableAdapter *etta = (ETreeTableAdapter *)etm;
-
- return e_tree_model_has_change_pending (etta->priv->source);
-}
-
-
-static int
-etta_row_count (ETableModel *etm)
-{
- ETreeTableAdapter *etta = (ETreeTableAdapter *)etm;
-
- if (etta->priv->root_visible)
- return etta->priv->n_map;
- else {
- if (etta->priv->n_map > 0)
- return etta->priv->n_map - 1;
- else
- return 0;
- }
-}
-
-static void *
-etta_value_at (ETableModel *etm, int col, int row)
-{
- ETreeTableAdapter *etta = (ETreeTableAdapter *)etm;
-
- switch (col) {
- case -1:
- if (etta->priv->root_visible)
- return etta->priv->map_table [row];
- else
- return etta->priv->map_table [row + 1];
- case -2:
- return etta->priv->source;
- case -3:
- return etta;
- default:
- if (etta->priv->root_visible)
- return e_tree_model_value_at (etta->priv->source, etta->priv->map_table [row], col);
- else
- return e_tree_model_value_at (etta->priv->source, etta->priv->map_table [row + 1], col);
- }
-}
-
-static void
-etta_set_value_at (ETableModel *etm, int col, int row, const void *val)
-{
- ETreeTableAdapter *etta = (ETreeTableAdapter *)etm;
-
- etta->priv->last_access = row;
- d(g_print("h) Setting last_access to %d\n", row));
- if (etta->priv->root_visible)
- e_tree_model_set_value_at (etta->priv->source, etta->priv->map_table [row], col, val);
- else
- e_tree_model_set_value_at (etta->priv->source, etta->priv->map_table [row + 1], col, val);
-}
-
-static gboolean
-etta_is_cell_editable (ETableModel *etm, int col, int row)
-{
- ETreeTableAdapter *etta = (ETreeTableAdapter *)etm;
-
- if (etta->priv->root_visible)
- return e_tree_model_node_is_editable (etta->priv->source, etta->priv->map_table [row], col);
- else
- return e_tree_model_node_is_editable (etta->priv->source, etta->priv->map_table [row + 1], col);
-}
-
-static void
-etta_append_row (ETableModel *etm, ETableModel *source, int row)
-{
-#if 0
- ETreeTableAdapter *etta = (ETreeTableAdapter *)etm;
- e_table_model_append_row (etta->priv->source, source, row);
-#endif
-}
-
-static void *
-etta_duplicate_value (ETableModel *etm, int col, const void *value)
-{
- ETreeTableAdapter *etta = (ETreeTableAdapter *)etm;
-
- return e_tree_model_duplicate_value (etta->priv->source, col, value);
-}
-
-static void
-etta_free_value (ETableModel *etm, int col, void *value)
-{
- ETreeTableAdapter *etta = (ETreeTableAdapter *)etm;
-
- e_tree_model_free_value (etta->priv->source, col, value);
-}
-
-static void *
-etta_initialize_value (ETableModel *etm, int col)
-{
- ETreeTableAdapter *etta = (ETreeTableAdapter *)etm;
-
- return e_tree_model_initialize_value (etta->priv->source, col);
-}
-
-static gboolean
-etta_value_is_empty (ETableModel *etm, int col, const void *value)
-{
- ETreeTableAdapter *etta = (ETreeTableAdapter *)etm;
-
- return e_tree_model_value_is_empty (etta->priv->source, col, value);
-}
-
-static char *
-etta_value_to_string (ETableModel *etm, int col, const void *value)
-{
- ETreeTableAdapter *etta = (ETreeTableAdapter *)etm;
-
- return e_tree_model_value_to_string (etta->priv->source, col, value);
-}
-
-static void
-etta_class_init (ETreeTableAdapterClass *klass)
-{
- ETableModelClass *table_class = (ETableModelClass *) klass;
- 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->n_map = 0;
- etta->priv->n_vals_allocated = 0;
- etta->priv->map_table = NULL;
- etta->priv->attributes = NULL;
-
- etta->priv->root_visible = TRUE;
-
- etta->priv->last_access = 0;
-
- etta->priv->tree_model_pre_change_id = 0;
- etta->priv->tree_model_no_change_id = 0;
- etta->priv->tree_model_node_changed_id = 0;
- etta->priv->tree_model_node_data_changed_id = 0;
- etta->priv->tree_model_node_col_changed_id = 0;
- etta->priv->tree_model_node_inserted_id = 0;
- etta->priv->tree_model_node_removed_id = 0;
- etta->priv->tree_model_node_request_collapse_id = 0;
-}
-
-E_MAKE_TYPE(e_tree_table_adapter, "ETreeTableAdapter", ETreeTableAdapter, etta_class_init, etta_init, E_TABLE_MODEL_TYPE)
-
-static void
-etta_proxy_pre_change (ETreeModel *etm, ETreeTableAdapter *etta)
-{
- e_table_model_pre_change(E_TABLE_MODEL(etta));
-}
-
-static void
-etta_proxy_no_change (ETreeModel *etm, ETreeTableAdapter *etta)
-{
- e_table_model_no_change(E_TABLE_MODEL(etta));
-}
-
-static void
-etta_proxy_node_changed (ETreeModel *etm, ETreePath path, ETreeTableAdapter *etta)
-{
- if (e_tree_model_node_is_root(etm, path)) {
- int size;
-
- size = array_size_from_path(etta, path);
- etta_expand_to(etta, size);
- etta->priv->n_map = size;
- fill_array_from_path(etta, etta->priv->map_table, path);
- } else {
- int row = find_row_num(etta, path);
- int size;
- int old_size;
- ETreeTableAdapterNode *node;
-
- if (row == -1) {
- e_table_model_no_change(E_TABLE_MODEL(etta));
- return;
- }
-
- size = array_size_from_path(etta, path);
-
- node = find_node(etta, path);
- if (node)
- old_size = node->num_visible_children + 1;
- else
- old_size = 1;
-
- etta_expand_to(etta, etta->priv->n_map + size - old_size);
-
- memmove(etta->priv->map_table + row + size,
- etta->priv->map_table + row + old_size,
- (etta->priv->n_map - row - old_size) * sizeof (ETreePath));
- fill_array_from_path(etta, etta->priv->map_table + row, path);
- etta_update_parent_child_counts(etta, path, size - old_size);
- }
-
- e_table_model_changed(E_TABLE_MODEL(etta));
-}
-
-static void
-etta_proxy_node_data_changed (ETreeModel *etm, ETreePath path, ETreeTableAdapter *etta)
-{
- int row = find_row_num(etta, path);
- if (row != -1) {
- if (etta->priv->root_visible)
- e_table_model_row_changed(E_TABLE_MODEL(etta), row);
- else if (row != 0)
- e_table_model_row_changed(E_TABLE_MODEL(etta), row - 1);
- else
- e_table_model_no_change(E_TABLE_MODEL(etta));
- } else
- e_table_model_no_change(E_TABLE_MODEL(etta));
-}
-
-static void
-etta_proxy_node_col_changed (ETreeModel *etm, ETreePath path, int col, ETreeTableAdapter *etta)
-{
- int row = find_row_num(etta, path);
- if (row != -1) {
- if (etta->priv->root_visible)
- e_table_model_cell_changed(E_TABLE_MODEL(etta), col, row);
- else if (row != 0)
- e_table_model_cell_changed(E_TABLE_MODEL(etta), col, row - 1);
- else
- e_table_model_no_change(E_TABLE_MODEL(etta));
- } else
- e_table_model_no_change(E_TABLE_MODEL(etta));
-}
-
-static void
-etta_proxy_node_inserted (ETreeModel *etm, ETreePath parent, ETreePath child, ETreeTableAdapter *etta)
-{
- int row;
-
- if (e_tree_model_node_is_root(etm, child)) {
- row = 0;
- } else {
- ETreePath children;
- int parent_row;
- ETreeTableAdapterNode *parent_node;
-
- parent_row = find_row_num(etta, parent);
- if (parent_row == -1) {
- e_table_model_no_change(E_TABLE_MODEL(etta));
- return;
- }
-
- parent_node = find_or_create_node(etta, parent);
- if (parent_node->expandable != e_tree_model_node_is_expandable(etta->priv->source, parent)) {
- e_table_model_pre_change(E_TABLE_MODEL(etta));
- parent_node->expandable = e_tree_model_node_is_expandable(etta->priv->source, parent);
- parent_node->expandable_set = 1;
- if (etta->priv->root_visible)
- e_table_model_row_changed(E_TABLE_MODEL(etta), parent_row);
- else if (parent_row != 0)
- e_table_model_row_changed(E_TABLE_MODEL(etta), parent_row - 1);
- else
- e_table_model_no_change(E_TABLE_MODEL(etta));
- }
-
- if (!e_tree_table_adapter_node_is_expanded (etta, parent)) {
- e_table_model_no_change(E_TABLE_MODEL(etta));
- return;
- }
-
- row = find_first_child_node(etta, parent_row);
- children = e_tree_model_node_get_first_child(etta->priv->source, parent);
-
- while (row != -1 &&
- row <= parent_row + parent_node->num_visible_children &&
- children != NULL &&
- children == etta->priv->map_table[row]) {
- children = e_tree_model_node_get_next(etta->priv->source, children);
- row = find_next_node(etta, row);
- }
- }
-
- if (row != -1) {
- int size;
-
- size = array_size_from_path(etta, child);
-
- etta_expand_to(etta, etta->priv->n_map + size);
-
- memmove(etta->priv->map_table + row + size,
- etta->priv->map_table + row,
- (etta->priv->n_map - row) * sizeof (ETreePath));
-
- fill_array_from_path(etta, etta->priv->map_table + row, child);
- etta_update_parent_child_counts(etta, child, size);
-
- if (etta->priv->root_visible)
- e_table_model_rows_inserted(E_TABLE_MODEL(etta), row, size);
- else if (row != 0)
- e_table_model_rows_inserted(E_TABLE_MODEL(etta), row - 1, size);
- else
- e_table_model_rows_inserted(E_TABLE_MODEL(etta), 0, size - 1);
- } else
- e_table_model_no_change(E_TABLE_MODEL(etta));
-}
-
-static void
-etta_proxy_node_removed (ETreeModel *etm, ETreePath parent, ETreePath child, int old_position, ETreeTableAdapter *etta)
-{
- int parent_row = find_row_num(etta, parent);
- int row = find_child_row_num_maybe_deleted(etta, parent_row, child);
- ETreeTableAdapterNode *parent_node = find_node(etta, parent);
- if (parent_row != -1 && parent_node) {
- if (parent_node->expandable != e_tree_model_node_is_expandable(etta->priv->source, parent)) {
- e_table_model_pre_change(E_TABLE_MODEL(etta));
- parent_node->expandable = e_tree_model_node_is_expandable(etta->priv->source, parent);
- if (etta->priv->root_visible)
- e_table_model_row_changed(E_TABLE_MODEL(etta), parent_row);
- else if (parent_row != 0)
- e_table_model_row_changed(E_TABLE_MODEL(etta), parent_row - 1);
- else
- e_table_model_no_change(E_TABLE_MODEL(etta));
- }
- }
-
- if (row != -1) {
- ETreeTableAdapterNode *node = find_node(etta, child);
- int to_remove = (node ? node->num_visible_children : 0) + 1;
-
- memmove(etta->priv->map_table + row,
- etta->priv->map_table + row + to_remove,
- (etta->priv->n_map - row - to_remove) * sizeof (ETreePath));
-
- if (parent_node)
- parent_node->num_visible_children -= to_remove;
- if (parent)
- etta_update_parent_child_counts(etta, parent, - to_remove);
-
- if (etta->priv->root_visible)
- e_table_model_rows_deleted(E_TABLE_MODEL(etta), row, to_remove);
- else if (row != 0)
- e_table_model_rows_deleted(E_TABLE_MODEL(etta), row - 1, to_remove);
- else
- e_table_model_rows_deleted(E_TABLE_MODEL(etta), 0, to_remove - 1);
- } else
- e_table_model_no_change(E_TABLE_MODEL(etta));
-}
-
-static void
-etta_proxy_node_request_collapse (ETreeModel *etm, ETreePath node, ETreeTableAdapter *etta)
-{
- e_tree_table_adapter_node_set_expanded(etta, node, FALSE);
-}
-
-ETableModel *
-e_tree_table_adapter_construct (ETreeTableAdapter *etta, ETreeModel *source)
-{
- ETreePath root;
-
- etta->priv->source = source;
- g_object_ref (source);
-
- if (e_tree_model_has_save_id(source))
- etta->priv->attributes = g_hash_table_new(g_str_hash, g_str_equal);
- else
- etta->priv->attributes = g_hash_table_new(NULL, NULL);
-
- root = e_tree_model_get_root (source);
-
- if (root) {
- etta->priv->n_map = array_size_from_path(etta, root);
- etta->priv->n_vals_allocated = etta->priv->n_map;
- etta->priv->map_table = g_new(ETreePath, etta->priv->n_map);
- fill_array_from_path(etta, etta->priv->map_table, root);
- }
-
- etta->priv->tree_model_pre_change_id = g_signal_connect (G_OBJECT (source), "pre_change",
- G_CALLBACK (etta_proxy_pre_change), etta);
- etta->priv->tree_model_no_change_id = g_signal_connect (G_OBJECT (source), "no_change",
- G_CALLBACK (etta_proxy_no_change), etta);
- etta->priv->tree_model_node_changed_id = g_signal_connect (G_OBJECT (source), "node_changed",
- G_CALLBACK (etta_proxy_node_changed), etta);
- etta->priv->tree_model_node_data_changed_id = g_signal_connect (G_OBJECT (source), "node_data_changed",
- G_CALLBACK (etta_proxy_node_data_changed), etta);
- etta->priv->tree_model_node_col_changed_id = g_signal_connect (G_OBJECT (source), "node_col_changed",
- G_CALLBACK (etta_proxy_node_col_changed), etta);
- etta->priv->tree_model_node_inserted_id = g_signal_connect (G_OBJECT (source), "node_inserted",
- G_CALLBACK (etta_proxy_node_inserted), etta);
- etta->priv->tree_model_node_removed_id = g_signal_connect (G_OBJECT (source), "node_removed",
- G_CALLBACK (etta_proxy_node_removed), etta);
- etta->priv->tree_model_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)
-{
- ETreeTableAdapter *etta = g_object_new (E_TREE_TABLE_ADAPTER_TYPE, NULL);
-
- e_tree_table_adapter_construct (etta, source);
-
- return (ETableModel *) etta;
-}
-
-typedef struct {
- xmlNode *root;
- ETreeModel *tree;
-} TreeAndRoot;
-
-static void
-save_expanded_state_func (gpointer keyp, gpointer value, gpointer data)
-{
- gchar *key = keyp;
- ETreeTableAdapterNode *node = value;
- TreeAndRoot *tar = data;
- xmlNode *root = tar->root;
- ETreeModel *etm = tar->tree;
- xmlNode *xmlnode;
-
- if (node->expanded != e_tree_model_get_expanded_default(etm)) {
- xmlnode = xmlNewChild (root, NULL, "node", NULL);
- e_xml_set_string_prop_by_name(xmlnode, "id", key);
- }
-}
-
-void
-e_tree_table_adapter_save_expanded_state (ETreeTableAdapter *etta, const char *filename)
-{
- ETreeTableAdapterPriv *priv;
- TreeAndRoot tar;
- xmlDocPtr doc;
- xmlNode *root;
-
- g_return_if_fail(etta != NULL);
-
- priv = etta->priv;
-
- doc = xmlNewDoc ("1.0");
- root = xmlNewDocNode (doc, NULL,
- (xmlChar *) "expanded_state",
- NULL);
- xmlDocSetRootElement (doc, root);
-
- e_xml_set_integer_prop_by_name (root, "vers", 2);
- e_xml_set_bool_prop_by_name (root, "default", e_tree_model_get_expanded_default (priv->source));
-
- tar.root = root;
- tar.tree = etta->priv->source;
-
- g_hash_table_foreach (priv->attributes,
- save_expanded_state_func,
- &tar);
-
- xmlSaveFile (filename, doc);
-
- xmlFreeDoc (doc);
-}
-
-void
-e_tree_table_adapter_load_expanded_state (ETreeTableAdapter *etta, const char *filename)
-{
- ETreeTableAdapterPriv *priv;
- xmlDoc *doc;
- xmlNode *root;
- xmlNode *child;
- int vers;
- gboolean model_default, saved_default;
- int size;
- ETreePath path;
-
- g_return_if_fail(etta != NULL);
-
- priv = etta->priv;
-
- doc = xmlParseFile (filename);
- if (!doc)
- return;
-
- root = xmlDocGetRootElement (doc);
- if (root == NULL || strcmp (root->name, "expanded_state")) {
- xmlFreeDoc (doc);
- return;
- }
-
- vers = e_xml_get_integer_prop_by_name_with_default (root, "vers", 0);
- if (vers > 2) {
- xmlFreeDoc (doc);
- return;
- }
- model_default = e_tree_model_get_expanded_default (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;
- }
-
- e_table_model_pre_change(E_TABLE_MODEL(etta));
-
- e_table_model_pre_change(E_TABLE_MODEL(etta));
-
- for (child = root->xmlChildrenNode; child; child = child->next) {
- char *id;
-
- if (strcmp (child->name, "node")) {
- d(g_warning ("unknown node '%s' in %s", child->name, filename));
- continue;
- }
-
- id = e_xml_get_string_prop_by_name_with_default (child, "id", "");
-
- if (!strcmp(id, "")) {
- g_free(id);
- continue;
- }
-
- add_expanded_node(etta, id, !model_default);
- }
-
-
- xmlFreeDoc (doc);
-
- path = e_tree_model_get_root (etta->priv->source);
- size = array_size_from_path(etta, path);
- etta_expand_to(etta, size);
- etta->priv->n_map = size;
- fill_array_from_path(etta, etta->priv->map_table, path);
-
- e_table_model_changed (E_TABLE_MODEL (etta));
-}
-
-void e_tree_table_adapter_root_node_set_visible (ETreeTableAdapter *etta, gboolean visible)
-{
- if (etta->priv->root_visible == visible)
- return;
-
- e_table_model_pre_change (E_TABLE_MODEL(etta));
-
- etta->priv->root_visible = visible;
- if (!visible) {
- ETreePath root = e_tree_model_get_root(etta->priv->source);
- if (root)
- e_tree_table_adapter_node_set_expanded(etta, root, TRUE);
- }
- e_table_model_changed(E_TABLE_MODEL(etta));
-}
-
-void e_tree_table_adapter_node_set_expanded (ETreeTableAdapter *etta, ETreePath path, gboolean expanded)
-{
- ETreeTableAdapterNode *node;
- int row;
-
- if (!expanded && e_tree_model_node_is_root (etta->priv->source, path) && !etta->priv->root_visible)
- return;
-
- node = find_or_create_node(etta, path);
-
- if (expanded == node->expanded)
- return;
-
- node->expanded = expanded;
-
- row = find_row_num(etta, path);
- if (row != -1) {
- e_table_model_pre_change (E_TABLE_MODEL(etta));
-
- if (etta->priv->root_visible) {
- e_table_model_pre_change (E_TABLE_MODEL(etta));
- e_table_model_row_changed(E_TABLE_MODEL(etta), row);
- } else if (row != 0) {
- e_table_model_pre_change (E_TABLE_MODEL(etta));
- e_table_model_row_changed(E_TABLE_MODEL(etta), row - 1);
- }
-
- if (expanded) {
- int num_children = array_size_from_path(etta, path) - 1;
- etta_expand_to(etta, etta->priv->n_map + num_children);
- memmove(etta->priv->map_table + row + 1 + num_children,
- etta->priv->map_table + row + 1,
- (etta->priv->n_map - row - 1) * sizeof (ETreePath));
- fill_array_from_path(etta, etta->priv->map_table + row, path);
- etta_update_parent_child_counts(etta, path, num_children);
- if (num_children != 0) {
- if (etta->priv->root_visible)
- e_table_model_rows_inserted(E_TABLE_MODEL(etta), row + 1, num_children);
- else
- e_table_model_rows_inserted(E_TABLE_MODEL(etta), row, num_children);
- } else
- e_table_model_no_change(E_TABLE_MODEL(etta));
- } else {
- int num_children = node->num_visible_children;
- g_assert (etta->priv->n_map >= row + 1 + num_children);
- memmove(etta->priv->map_table + row + 1,
- etta->priv->map_table + row + 1 + num_children,
- (etta->priv->n_map - row - 1 - num_children) * sizeof (ETreePath));
- node->num_visible_children = 0;
- etta_update_parent_child_counts(etta, path, - num_children);
- if (num_children != 0) {
- if (etta->priv->root_visible)
- e_table_model_rows_deleted(E_TABLE_MODEL(etta), row + 1, num_children);
- else
- e_table_model_rows_deleted(E_TABLE_MODEL(etta), row, num_children);
- } else
- e_table_model_no_change(E_TABLE_MODEL(etta));
- }
- }
-}
-
-void e_tree_table_adapter_node_set_expanded_recurse (ETreeTableAdapter *etta, ETreePath path, gboolean expanded)
-{
- ETreePath children;
-
- e_tree_table_adapter_node_set_expanded(etta, path, expanded);
-
- for (children = e_tree_model_node_get_first_child(etta->priv->source, path);
- children;
- children = e_tree_model_node_get_next(etta->priv->source, children)) {
- e_tree_table_adapter_node_set_expanded_recurse(etta, children, expanded);
- }
-}
-
-ETreePath e_tree_table_adapter_node_at_row (ETreeTableAdapter *etta, int row)
-{
- if (row < 0)
- return NULL;
- if (etta->priv->root_visible) {
- if (row < etta->priv->n_map)
- return etta->priv->map_table[row];
- } else {
- if (row + 1 < etta->priv->n_map)
- return etta->priv->map_table[row + 1];
- }
- return NULL;
-}
-
-int e_tree_table_adapter_row_of_node (ETreeTableAdapter *etta, ETreePath path)
-{
- if (etta->priv->root_visible)
- return find_row_num(etta, path);
- else {
- int row_num = find_row_num (etta, path);
- if (row_num != -1)
- return row_num - 1;
- else
- return row_num;
- }
-}
-
-gboolean e_tree_table_adapter_root_node_is_visible(ETreeTableAdapter *etta)
-{
- return etta->priv->root_visible;
-}
-
-void e_tree_table_adapter_show_node (ETreeTableAdapter *etta, ETreePath path)
-{
- ETreePath parent;
-
- parent = e_tree_model_node_get_parent(etta->priv->source, path);
-
- 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)
-{
- if (!e_tree_model_node_is_expandable (etta->priv->source, path))
- return FALSE;
-
- return e_tree_table_adapter_node_would_be_expanded (etta, path);
-}
diff --git a/widgets/table/e-tree-table-adapter.h b/widgets/table/e-tree-table-adapter.h
deleted file mode 100644
index 72ea66694a..0000000000
--- a/widgets/table/e-tree-table-adapter.h
+++ /dev/null
@@ -1,84 +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>
-
-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);
-ETableModel *e_tree_table_adapter_construct (ETreeTableAdapter *ets,
- ETreeModel *source);
-
-gboolean e_tree_table_adapter_node_is_expanded (ETreeTableAdapter *etta,
- ETreePath path);
-void e_tree_table_adapter_node_set_expanded (ETreeTableAdapter *etta,
- ETreePath path,
- gboolean expanded);
-void e_tree_table_adapter_node_set_expanded_recurse (ETreeTableAdapter *etta,
- ETreePath path,
- gboolean expanded);
-void e_tree_table_adapter_root_node_set_visible (ETreeTableAdapter *etta,
- gboolean visible);
-ETreePath e_tree_table_adapter_node_at_row (ETreeTableAdapter *etta,
- int row);
-int e_tree_table_adapter_row_of_node (ETreeTableAdapter *etta,
- ETreePath path);
-gboolean e_tree_table_adapter_root_node_is_visible (ETreeTableAdapter *etta);
-
-void e_tree_table_adapter_show_node (ETreeTableAdapter *etta,
- ETreePath path);
-
-void e_tree_table_adapter_save_expanded_state (ETreeTableAdapter *etta,
- const char *filename);
-void e_tree_table_adapter_load_expanded_state (ETreeTableAdapter *etta,
- const char *filename);
-
-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 2456c373ec..0000000000
--- a/widgets/table/e-tree.c
+++ /dev/null
@@ -1,3352 +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-sorted.h>
-#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;
- ETreeSorted *sorted;
- ETreeTableAdapter *etta;
-
- ETableHeader *full_header, *header;
-
- guint structure_change_id, expansion_change_id;
-
- ETableSortInfo *sort_info;
- ESorter *sorter;
-
- guint sort_info_change_id, group_info_change_id;
-
- ESelectionModel *selection;
- ETableSpecification *spec;
-
- ETableSearch *search;
-
- 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;
- int table_rows_inserted_id;
- int table_rows_deleted_id;
-
- GnomeCanvas *header_canvas, *table_canvas;
-
- GnomeCanvasItem *header_item, *root;
-
- GnomeCanvasItem *white_item;
- GnomeCanvasItem *item;
-
- gint length_threshold;
-
- /*
- * Configuration settings
- */
- guint alternating_row_colors : 1;
- guint horizontal_draw_grid : 1;
- guint vertical_draw_grid : 1;
- guint draw_focus : 1;
- guint row_selection_active : 1;
-
- guint horizontal_scrolling : 1;
-
- guint scroll_direction : 4;
-
- guint do_drag : 1;
-
- guint uniform_row_height : 1;
-
- 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
-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);
- if (et->priv->table_rows_inserted_id != 0)
- g_signal_handler_disconnect (G_OBJECT (et->priv->etta),
- et->priv->table_rows_inserted_id);
- if (et->priv->table_rows_deleted_id != 0)
- g_signal_handler_disconnect (G_OBJECT (et->priv->etta),
- et->priv->table_rows_deleted_id);
-
- et->priv->table_model_change_id = 0;
- et->priv->table_row_change_id = 0;
- et->priv->table_cell_change_id = 0;
- et->priv->table_rows_inserted_id = 0;
- et->priv->table_rows_deleted_id = 0;
-}
-
-static void
-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->sorted);
- 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);
-
- 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);
- cursor = e_tree_sorted_model_to_view_path (et->priv->sorted, cursor);
-
- if (flags & E_TABLE_SEARCH_FLAGS_CHECK_CURSOR_FIRST) {
- const void *value;
-
- value = e_tree_model_value_at (E_TREE_MODEL (et->priv->sorted), cursor, col->col_idx);
-
- if (col->search (value, string)) {
- return TRUE;
- }
- }
-
- found = e_tree_model_node_find (E_TREE_MODEL (et->priv->sorted), cursor, NULL, E_TREE_FIND_NEXT_FORWARD, search_search_callback, &cb_data);
- if (found == NULL)
- found = e_tree_model_node_find (E_TREE_MODEL (et->priv->sorted), NULL, cursor, E_TREE_FIND_NEXT_FORWARD, search_search_callback, &cb_data);
-
- if (found && found != cursor) {
- int model_row;
-
- e_tree_table_adapter_show_node (et->priv->etta, found);
- model_row = e_tree_table_adapter_row_of_node (et->priv->etta, found);
-
- cursor = e_tree_sorted_view_to_model_path (et->priv->sorted, found);
-
- e_selection_model_select_as_key_press(E_SELECTION_MODEL (et->priv->selection), model_row, col->col_idx, GDK_CONTROL_MASK);
- return TRUE;
- } else if (!(flags & E_TABLE_SEARCH_FLAGS_CHECK_CURSOR_FIRST)) {
- const void *value;
-
- value = e_tree_model_value_at (E_TREE_MODEL (et->priv->sorted), cursor, 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->sorted = NULL;
- e_tree->priv->etta = NULL;
-
- e_tree->priv->full_header = NULL;
- e_tree->priv->header = NULL;
-
- e_tree->priv->structure_change_id = 0;
- e_tree->priv->expansion_change_id = 0;
- e_tree->priv->sort_info_change_id = 0;
- e_tree->priv->group_info_change_id = 0;
-
- e_tree->priv->sort_info = NULL;
- e_tree->priv->sorter = NULL;
- e_tree->priv->reflow_idle_id = 0;
- e_tree->priv->scroll_idle_id = 0;
- e_tree->priv->hover_idle_id = 0;
-
- e_tree->priv->alternating_row_colors = 1;
- e_tree->priv->horizontal_draw_grid = 1;
- e_tree->priv->vertical_draw_grid = 1;
- e_tree->priv->draw_focus = 1;
- e_tree->priv->cursor_mode = E_CURSOR_SIMPLE;
- e_tree->priv->length_threshold = 200;
- e_tree->priv->uniform_row_height = FALSE;
-
- e_tree->priv->row_selection_active = FALSE;
- e_tree->priv->horizontal_scrolling = FALSE;
-
- e_tree->priv->drop_row = -1;
- e_tree->priv->drop_path = NULL;
- e_tree->priv->drop_col = -1;
- e_tree->priv->drop_highlight = NULL;
-
- e_tree->priv->last_drop_x = 0;
- e_tree->priv->last_drop_y = 0;
- e_tree->priv->last_drop_time = 0;
- e_tree->priv->last_drop_context = NULL;
-
- e_tree->priv->hover_x = 0;
- e_tree->priv->hover_y = 0;
-
- e_tree->priv->drag_row = -1;
- e_tree->priv->drag_path = NULL;
- e_tree->priv->drag_col = -1;
-
- e_tree->priv->expanded_list = NULL;
-
- e_tree->priv->site = NULL;
- e_tree->priv->do_drag = FALSE;
-
-#ifdef E_TREE_USE_TREE_SELECTION
- e_tree->priv->selection = E_SELECTION_MODEL(e_tree_selection_model_new());
-#else
- e_tree->priv->selection = E_SELECTION_MODEL(e_table_selection_model_new());
-#endif
- e_tree->priv->spec = NULL;
-
- e_tree->priv->header_canvas = NULL;
- e_tree->priv->table_canvas = NULL;
-
- e_tree->priv->header_item = NULL;
- e_tree->priv->root = NULL;
-
- e_tree->priv->white_item = NULL;
- e_tree->priv->item = NULL;
-
- e_tree->priv->search = e_table_search_new();
-
- e_tree->priv->search_search_id =
- 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;
- 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);
-}
-
-static void
-tree_canvas_reflow (GnomeCanvas *canvas, ETree *e_tree)
-{
- if (!e_tree->priv->reflow_idle_id)
- e_tree->priv->reflow_idle_id = g_idle_add_full (400, (GSourceFunc) tree_canvas_reflow_idle, e_tree, NULL);
-}
-
-static void
-item_cursor_change (ETableItem *eti, int row, ETree *et)
-{
- ETreePath path = e_tree_table_adapter_node_at_row(et->priv->etta, row);
- path = e_tree_sorted_view_to_model_path(et->priv->sorted, path);
- 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);
- if (path)
- path = e_tree_sorted_view_to_model_path(et->priv->sorted, path);
- 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);
- path = e_tree_sorted_view_to_model_path(et->priv->sorted, path);
- 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);
- path = e_tree_sorted_view_to_model_path(et->priv->sorted, path);
- 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);
- path = e_tree_sorted_view_to_model_path(et->priv->sorted, path);
- 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);
- path = e_tree_sorted_view_to_model_path(et->priv->sorted, path);
- 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);
- path = e_tree_sorted_view_to_model_path(et->priv->sorted, path);
-
- 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_realize (GtkWidget *canvas, ETree *e_tree)
-{
- gnome_canvas_item_set(
- e_tree->priv->white_item,
- "fill_color_gdk", &GTK_WIDGET(e_tree->priv->table_canvas)->style->base[GTK_STATE_NORMAL],
- NULL);
-}
-
-static gint
-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 (
- e_tree->priv->table_canvas, "realize",
- G_CALLBACK(et_canvas_realize), 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->sorted)
- e_tree_sorted_set_sort_info (e_tree->priv->sorted, 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_table_rows_inserted (ETableModel *table_model, int row, int count, ETree *et)
-{
- et_table_model_changed (table_model, et);
-}
-
-static void
-et_table_rows_deleted (ETableModel *table_model, int row, int count, ETree *et)
-{
- et_table_model_changed (table_model, et);
-}
-
-static void
-et_connect_to_etta (ETree *et)
-{
- et->priv->table_model_change_id = 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);
-
- et->priv->table_rows_inserted_id = g_signal_connect (et->priv->etta, "model_rows_inserted",
- G_CALLBACK (et_table_rows_inserted), et);
-
- et->priv->table_rows_deleted_id = g_signal_connect (et->priv->etta, "model_rows_deleted",
- G_CALLBACK (et_table_rows_deleted), et);
-
-}
-
-static ETree *
-et_real_construct (ETree *e_tree, ETreeModel *etm, ETableExtras *ete,
- ETableSpecification *specification, ETableState *state)
-{
- int row = 0;
- int i, col_count;
-
- if (ete)
- 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->sorted = e_tree_sorted_new(etm, e_tree->priv->full_header, e_tree->priv->sort_info);
-
- e_tree->priv->etta = E_TREE_TABLE_ADAPTER(e_tree_table_adapter_new(E_TREE_MODEL(e_tree->priv->sorted)));
-
- et_connect_to_etta (e_tree);
-
- gtk_widget_push_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,
- "ets", e_tree->priv->sorted,
- "etta", e_tree->priv->etta,
-#else
- "model", e_tree->priv->etta,
-#endif
- "selection_mode", specification->selection_mode,
- "cursor_mode", specification->cursor_mode,
- NULL);
-
- 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
- path = e_tree_sorted_model_to_view_path(e_tree->priv->sorted, path);
-
- row = e_tree_table_adapter_row_of_node(E_TREE_TABLE_ADAPTER(e_tree->priv->etta), path);
-
- if (row == -1)
- return;
-
- 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);
- path = e_tree_sorted_view_to_model_path(e_tree->priv->sorted, path);
- return path;
-#endif
-}
-
-void
-e_tree_selected_row_foreach (ETree *e_tree,
- EForeachFunc callback,
- gpointer closure)
-{
- g_return_if_fail(e_tree != NULL);
- g_return_if_fail(E_IS_TREE(e_tree));
-
- e_selection_model_foreach(e_tree->priv->selection,
- callback,
- closure);
-}
-
-#ifdef E_TREE_USE_TREE_SELECTION
-void
-e_tree_selected_path_foreach (ETree *e_tree,
- ETreeForeachFunc callback,
- gpointer closure)
-{
- g_return_if_fail(e_tree != NULL);
- g_return_if_fail(E_IS_TREE(e_tree));
-
- e_tree_selection_model_foreach(E_TREE_SELECTION_MODEL (e_tree->priv->selection),
- callback,
- closure);
-}
-
-/* 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)
-{
- path = e_tree_sorted_model_to_view_path(et->priv->sorted, path);
-
- g_return_val_if_fail(path, FALSE);
-
- return e_tree_table_adapter_node_is_expanded (et->priv->etta, path);
-}
-
-void
-e_tree_node_set_expanded (ETree *et, ETreePath path, gboolean expanded)
-{
- g_return_if_fail (et != NULL);
- g_return_if_fail (E_IS_TREE(et));
-
- path = e_tree_sorted_model_to_view_path(et->priv->sorted, path);
-
- e_tree_table_adapter_node_set_expanded (et->priv->etta, path, expanded);
-}
-
-void
-e_tree_node_set_expanded_recurse (ETree *et, ETreePath path, gboolean expanded)
-{
- g_return_if_fail (et != NULL);
- g_return_if_fail (E_IS_TREE(et));
-
- path = e_tree_sorted_model_to_view_path(et->priv->sorted, path);
-
- e_tree_table_adapter_node_set_expanded_recurse (et->priv->etta, path, expanded);
-}
-
-void
-e_tree_root_node_set_visible (ETree *et, gboolean visible)
-{
- g_return_if_fail (et != NULL);
- g_return_if_fail (E_IS_TREE(et));
-
- e_tree_table_adapter_root_node_set_visible (et->priv->etta, visible);
-}
-
-ETreePath
-e_tree_node_at_row (ETree *et, int row)
-{
- ETreePath path;
-
- path = e_tree_table_adapter_node_at_row (et->priv->etta, row);
- path = e_tree_sorted_view_to_model_path(et->priv->sorted, path);
-
- return path;
-}
-
-int
-e_tree_row_of_node (ETree *et, ETreePath path)
-{
- path = e_tree_sorted_model_to_view_path(et->priv->sorted, path);
- return e_tree_table_adapter_row_of_node (et->priv->etta, path);
-}
-
-gboolean
-e_tree_root_node_is_visible(ETree *et)
-{
- return e_tree_table_adapter_root_node_is_visible (et->priv->etta);
-}
-
-void
-e_tree_show_node (ETree *et, ETreePath path)
-{
- g_return_if_fail (et != NULL);
- g_return_if_fail (E_IS_TREE(et));
-
- path = e_tree_sorted_model_to_view_path(et->priv->sorted, path);
-
- e_tree_table_adapter_show_node (et->priv->etta, path);
-}
-
-void
-e_tree_save_expanded_state (ETree *et, char *filename)
-{
- g_return_if_fail (et != NULL);
- g_return_if_fail (E_IS_TREE(et));
-
- e_tree_table_adapter_save_expanded_state (et->priv->etta, filename);
-}
-
-void
-e_tree_load_expanded_state (ETree *et, char *filename)
-{
- e_tree_table_adapter_load_expanded_state (et->priv->etta, filename);
-}
-
-gint
-e_tree_row_count (ETree *et)
-{
- return e_table_model_row_count (E_TABLE_MODEL(et->priv->etta));
-}
-
-GtkWidget *
-e_tree_get_tooltip (ETree *et)
-{
- return E_CANVAS(et->priv->table_canvas)->tooltip_window;
-}
-
-typedef struct {
- ETreePathFunc func;
- gpointer data;
- ETree *et;
-} FindNextCallback;
-
-static gboolean
-find_next_callback (ETreeModel *model, ETreePath path, gpointer data)
-{
- FindNextCallback *cb_data = data;
- ETree *et = cb_data->et;
-
- path = e_tree_sorted_view_to_model_path(et->priv->sorted, path);
-
- return cb_data->func (et->priv->model, path, cb_data->data);
-}
-
-gboolean
-e_tree_find_next (ETree *et, ETreeFindNextParams params, ETreePathFunc func, gpointer data)
-{
- ETreePath cursor;
- ETreePath found;
- FindNextCallback cb_data;
-
- cb_data.func = func;
- cb_data.data = data;
- cb_data.et = et;
-
- cursor = e_tree_get_cursor (et);
- cursor = e_tree_sorted_model_to_view_path (et->priv->sorted, cursor);
-
- found = e_tree_model_node_find (E_TREE_MODEL (et->priv->sorted), cursor, NULL, params & E_TREE_FIND_NEXT_FORWARD, find_next_callback, &cb_data);
-
- if (found) {
- e_tree_table_adapter_show_node (et->priv->etta, found);
- cursor = e_tree_sorted_view_to_model_path (et->priv->sorted, found);
- e_tree_set_cursor (et, cursor);
- return TRUE;
- }
-
- if (params & E_TREE_FIND_NEXT_WRAP) {
- found = e_tree_model_node_find (E_TREE_MODEL (et->priv->sorted), NULL, cursor, params & E_TREE_FIND_NEXT_FORWARD, find_next_callback, &cb_data);
-
- if (found && found != cursor) {
- e_tree_table_adapter_show_node (et->priv->etta, found);
- cursor = e_tree_sorted_view_to_model_path (et->priv->sorted, found);
- e_tree_set_cursor (et, cursor);
- return TRUE;
- }
- }
-
- return FALSE;
-}
-
-void
-e_tree_right_click_up (ETree *et)
-{
- e_selection_model_right_click_up(et->priv->selection);
-}
-
-/**
- * e_tree_get_model:
- * @et: the ETree
- *
- * Returns the model upon which this ETree is based.
- *
- * Returns: the model
- **/
-ETreeModel *
-e_tree_get_model (ETree *et)
-{
- g_return_val_if_fail (et != NULL, NULL);
- g_return_val_if_fail (E_IS_TREE (et), NULL);
-
- return et->priv->model;
-}
-
-/**
- * e_tree_get_selection_model:
- * @et: the ETree
- *
- * Returns the selection model of this ETree.
- *
- * Returns: the selection model
- **/
-ESelectionModel *
-e_tree_get_selection_model (ETree *et)
-{
- g_return_val_if_fail (et != NULL, NULL);
- g_return_val_if_fail (E_IS_TREE (et), NULL);
-
- return et->priv->selection;
-}
-
-/**
- * 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);
- path = e_tree_sorted_view_to_model_path(tree->priv->sorted, path);
-
- gtk_drag_get_data(GTK_WIDGET(tree),
- context,
- target,
- time);
-
-}
-
-#if 0
-static void
-e_tree_request_hightlight_redraw (ETree *tree)
-{
- int row = tree->drop_highlight_row;
- int col = tree->drop_highlight_col;
-
- if (row != -1) {
- int x, y, width, height;
- if (col == -1) {
- e_tree_get_cell_geometry (tree, row, 0, &x, &y, &width, &height);
- x = 0;
- width = tree->allocation.width;
- } else {
- e_tree_get_cell_geometry (tree, row, col, &x, &y, &width, &height);
- x += GTK_LAYOUT(tree->priv->table_canvas)->hadjustment->value;
- }
- y += GTK_LAYOUT(tree->priv->table_canvas)->vadjustment->value;
- gnome_canvas_request_redraw (tree->priv->table_canvas, x, y, x + width - 1, y + height - 1);
- }
-}
-#endif
-
-/**
- * e_tree_drag_highlight:
- * @tree:
- * @row:
- * @col:
- *
- * Set col to -1 to highlight the entire row.
- * Set row to -1 to turn off the highlight.
- */
-void
-e_tree_drag_highlight (ETree *tree,
- int row,
- int col)
-{
- g_return_if_fail(tree != NULL);
- g_return_if_fail(E_IS_TREE(tree));
-
- if (row != -1) {
- int x, y, width, height;
- if (col == -1) {
- e_tree_get_cell_geometry (tree, row, 0, &x, &y, &width, &height);
- x = 0;
- width = GTK_WIDGET (tree->priv->table_canvas)->allocation.width;
- } else {
- e_tree_get_cell_geometry (tree, row, col, &x, &y, &width, &height);
- x += GTK_LAYOUT(tree->priv->table_canvas)->hadjustment->value;
- }
- y += GTK_LAYOUT(tree->priv->table_canvas)->vadjustment->value;
-
- if (tree->priv->drop_highlight == NULL) {
- tree->priv->drop_highlight =
- gnome_canvas_item_new (gnome_canvas_root (tree->priv->table_canvas),
- gnome_canvas_rect_get_type (),
- "fill_color", NULL,
- /* "outline_color", "black",
- "width_pixels", 1,*/
- "outline_color_gdk", &(GTK_WIDGET (tree)->style->fg[GTK_STATE_NORMAL]),
- NULL);
- }
- gnome_canvas_item_set (tree->priv->drop_highlight,
- "x1", (double) x,
- "x2", (double) x + width - 1,
- "y1", (double) y,
- "y2", (double) y + height - 1,
- NULL);
- } else {
- gtk_object_destroy (GTK_OBJECT (tree->priv->drop_highlight));
- tree->priv->drop_highlight = NULL;
- }
-}
-
-void
-e_tree_drag_unhighlight (ETree *tree)
-{
- g_return_if_fail(tree != NULL);
- g_return_if_fail(E_IS_TREE(tree));
-
- if (tree->priv->drop_highlight) {
- gtk_object_destroy (GTK_OBJECT (tree->priv->drop_highlight));
- tree->priv->drop_highlight = NULL;
- }
-}
-
-void e_tree_drag_dest_set (ETree *tree,
- GtkDestDefaults flags,
- const GtkTargetEntry *targets,
- gint n_targets,
- GdkDragAction actions)
-{
- g_return_if_fail(tree != NULL);
- g_return_if_fail(E_IS_TREE(tree));
-
- gtk_drag_dest_set(GTK_WIDGET(tree),
- flags,
- targets,
- n_targets,
- actions);
-}
-
-void e_tree_drag_dest_set_proxy (ETree *tree,
- GdkWindow *proxy_window,
- GdkDragProtocol protocol,
- gboolean use_coordinates)
-{
- g_return_if_fail(tree != NULL);
- g_return_if_fail(E_IS_TREE(tree));
-
- gtk_drag_dest_set_proxy(GTK_WIDGET(tree),
- proxy_window,
- protocol,
- use_coordinates);
-}
-
-/*
- * There probably should be functions for setting the targets
- * as a GtkTargetList
- */
-
-void
-e_tree_drag_dest_unset (GtkWidget *widget)
-{
- g_return_if_fail(widget != NULL);
- g_return_if_fail(E_IS_TREE(widget));
-
- gtk_drag_dest_unset(widget);
-}
-
-/* Source side */
-
-static gint
-et_real_start_drag (ETree *tree, int row, ETreePath path, int col, GdkEvent *event)
-{
- GtkDragSourceInfo *info;
- GdkDragContext *context;
- ETreeDragSourceSite *site;
-
- if (tree->priv->do_drag) {
- site = tree->priv->site;
-
- site->state = 0;
- context = e_tree_drag_begin (tree, row, col,
- site->target_list,
- site->actions,
- 1, event);
-
- if (context) {
- info = g_dataset_get_data (context, "gtk-info");
-
- if (info && !info->icon_window) {
- if (site->pixmap)
- gtk_drag_set_icon_pixmap (context,
- site->colormap,
- site->pixmap,
- site->mask, -2, -2);
- else
- gtk_drag_set_icon_default (context);
- }
- }
- return TRUE;
- }
- return FALSE;
-}
-
-void
-e_tree_drag_source_set (ETree *tree,
- GdkModifierType start_button_mask,
- const GtkTargetEntry *targets,
- gint n_targets,
- GdkDragAction actions)
-{
- ETreeDragSourceSite *site;
- GtkWidget *canvas;
-
- g_return_if_fail(tree != NULL);
- g_return_if_fail(E_IS_TREE(tree));
-
- canvas = GTK_WIDGET(tree->priv->table_canvas);
- site = tree->priv->site;
-
- tree->priv->do_drag = TRUE;
-
- gtk_widget_add_events (canvas,
- gtk_widget_get_events (canvas) |
- GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
- GDK_BUTTON_MOTION_MASK | GDK_STRUCTURE_MASK);
-
- if (site) {
- if (site->target_list)
- gtk_target_list_unref (site->target_list);
- } else {
- site = g_new0 (ETreeDragSourceSite, 1);
- tree->priv->site = site;
- }
-
- site->start_button_mask = start_button_mask;
-
- if (targets)
- site->target_list = gtk_target_list_new (targets, n_targets);
- else
- site->target_list = NULL;
-
- site->actions = actions;
-}
-
-void
-e_tree_drag_source_unset (ETree *tree)
-{
- ETreeDragSourceSite *site;
-
- g_return_if_fail (tree != NULL);
- g_return_if_fail (E_IS_TREE(tree));
-
- site = tree->priv->site;
-
- if (site) {
- 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);
- path = e_tree_sorted_view_to_model_path(tree->priv->sorted, path);
-
- tree->priv->drag_row = row;
- tree->priv->drag_path = path;
- tree->priv->drag_col = col;
-
- return gtk_drag_begin(GTK_WIDGET (tree->priv->table_canvas),
- targets,
- actions,
- button,
- event);
-}
-
-/**
- * e_tree_get_cell_at:
- * @tree: An ETree widget
- * @x: X coordinate for the pixel
- * @y: Y coordinate for the pixel
- * @row_return: Pointer to return the row value
- * @col_return: Pointer to return the column value
- *
- * Return the row and column for the cell in which the pixel at (@x, @y) is
- * contained.
- **/
-void
-e_tree_get_cell_at (ETree *tree,
- int x, int y,
- int *row_return, int *col_return)
-{
- g_return_if_fail (tree != NULL);
- g_return_if_fail (E_IS_TREE (tree));
- g_return_if_fail (row_return != NULL);
- g_return_if_fail (col_return != NULL);
-
- /* FIXME it would be nice if it could handle a NULL row_return or
- * col_return gracefully. */
-
- if (row_return)
- *row_return = -1;
- if (col_return)
- *col_return = -1;
-
- x += GTK_LAYOUT(tree->priv->table_canvas)->hadjustment->value;
- y += GTK_LAYOUT(tree->priv->table_canvas)->vadjustment->value;
- e_table_item_compute_location(E_TABLE_ITEM(tree->priv->item), &x, &y, row_return, col_return);
-}
-
-/**
- * e_tree_get_cell_geometry:
- * @tree: The tree.
- * @row: The row to get the geometry of.
- * @col: The col to get the geometry of.
- * @x_return: Returns the x coordinate of the upper right hand corner of the cell with respect to the widget.
- * @y_return: Returns the y coordinate of the upper right hand corner of the cell with respect to the widget.
- * @width_return: Returns the width of the cell.
- * @height_return: Returns the height of the cell.
- *
- * Computes the data about this cell.
- **/
-void
-e_tree_get_cell_geometry (ETree *tree,
- int row, int col,
- int *x_return, int *y_return,
- int *width_return, int *height_return)
-{
- g_return_if_fail (tree != NULL);
- g_return_if_fail (E_IS_TREE (tree));
- g_return_if_fail (row >= 0);
- g_return_if_fail (col >= 0);
-
- /* FIXME it would be nice if it could handle a NULL row_return or
- * col_return gracefully. */
-
- e_table_item_get_cell_geometry(E_TABLE_ITEM(tree->priv->item), &row, &col, x_return, y_return, width_return, height_return);
-
- if (x_return)
- (*x_return) -= GTK_LAYOUT(tree->priv->table_canvas)->hadjustment->value;
- if (y_return)
- (*y_return) -= GTK_LAYOUT(tree->priv->table_canvas)->vadjustment->value;
-}
-
-static void
-et_drag_begin (GtkWidget *widget,
- GdkDragContext *context,
- ETree *et)
-{
- 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);
-
- x -= widget->allocation.x;
- y -= widget->allocation.y;
- e_tree_get_cell_at (et,
- x,
- y,
- &row,
- &col);
- if (row != et->priv->drop_row && col != et->priv->drop_col) {
- 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);
- path = e_tree_sorted_view_to_model_path(et->priv->sorted, path);
-
- et->priv->drop_row = row;
- et->priv->drop_path = path;
- et->priv->drop_col = col;
- 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;
- GtkWidget *widget = data;
- int x = et->priv->hover_x;
- int y = et->priv->hover_y;
- int row, col;
- ETreePath path;
-
- x -= widget->allocation.x;
- y -= widget->allocation.y;
- e_tree_get_cell_at (et,
- x,
- y,
- &row,
- &col);
-
- path = e_tree_table_adapter_node_at_row(et->priv->etta, row);
- if (path && e_tree_model_node_is_expandable (E_TREE_MODEL (et->priv->sorted), path)) {
- if (!e_tree_table_adapter_node_is_expanded (et->priv->etta, path)) {
- if (e_tree_model_has_save_id (E_TREE_MODEL (et->priv->sorted)) && e_tree_model_has_get_node_by_id (E_TREE_MODEL (et->priv->sorted)))
- et->priv->expanded_list = g_list_prepend (et->priv->expanded_list, e_tree_model_get_save_id (E_TREE_MODEL (et->priv->sorted), path));
- e_tree_table_adapter_node_set_expanded (et->priv->etta, path, TRUE);
- }
- }
-
- return TRUE;
-}
-
-static void
-hover_on (ETree *et, int x, int y)
-{
- et->priv->hover_x = x;
- et->priv->hover_y = y;
- if (et->priv->hover_idle_id != 0)
- g_source_remove (et->priv->hover_idle_id);
- et->priv->hover_idle_id = g_timeout_add (500, hover_timeout, et);
-}
-
-static void
-hover_off (ETree *et)
-{
- if (et->priv->hover_idle_id) {
- g_source_remove (et->priv->hover_idle_id);
- et->priv->hover_idle_id = 0;
- }
-}
-
-static void
-collapse_drag (ETree *et, ETreePath drop)
-{
- GList *list;
-
- /* We only want to leave open parents of the node dropped in. Not the node itself. */
- if (drop) {
- drop = e_tree_model_node_get_parent (E_TREE_MODEL (et->priv->sorted), drop);
- }
-
- for (list = et->priv->expanded_list; list; list = list->next) {
- char *save_id = list->data;
- ETreePath path;
-
- path = e_tree_model_get_node_by_id (E_TREE_MODEL (et->priv->sorted), save_id);
- if (path) {
- ETreePath search;
- gboolean found = FALSE;
-
- for (search = drop; search; search = e_tree_model_node_get_parent (E_TREE_MODEL (et->priv->sorted), search)) {
- if (path == search) {
- found = TRUE;
- break;
- }
- }
-
- if (!found)
- e_tree_table_adapter_node_set_expanded (et->priv->etta, path, FALSE);
- }
- g_free (save_id);
- }
- g_list_free (et->priv->expanded_list);
- et->priv->expanded_list = NULL;
-}
-
-static void
-context_destroyed (gpointer data)
-{
- ETree *et = data;
- if (et->priv) {
- et->priv->last_drop_x = 0;
- et->priv->last_drop_y = 0;
- et->priv->last_drop_time = 0;
- et->priv->last_drop_context = NULL;
- collapse_drag (et, NULL);
- scroll_off (et);
- hover_off (et);
- }
- g_object_unref (et);
-}
-
-static void
-context_connect (ETree *et, GdkDragContext *context)
-{
- if (g_dataset_get_data (context, "e-tree") == NULL) {
- g_object_ref (et);
- g_dataset_set_data_full (context, "e-tree", et, context_destroyed);
- }
-}
-
-static void
-et_drag_leave(GtkWidget *widget,
- GdkDragContext *context,
- guint time,
- ETree *et)
-{
- 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;
- et->priv->last_drop_context = context;
- context_connect (et, context);
-
- if (et->priv->hover_idle_id != 0) {
- if (abs (et->priv->hover_x - x) > 3 ||
- abs (et->priv->hover_y - y) > 3) {
- hover_on (et, x, y);
- }
- } else {
- hover_on (et, x, y);
- }
-
- ret_val = do_drag_motion (et,
- context,
- x,
- y,
- time);
-
- x -= widget->allocation.x;
- y -= widget->allocation.y;
-
- if (y < 20)
- direction |= ET_SCROLL_UP;
- if (y > widget->allocation.height - 20)
- direction |= ET_SCROLL_DOWN;
- if (x < 20)
- direction |= ET_SCROLL_LEFT;
- if (x > widget->allocation.width - 20)
- direction |= ET_SCROLL_RIGHT;
-
- if (direction != 0)
- scroll_on (et, direction);
- else
- scroll_off (et);
-
- return ret_val;
-}
-
-static gboolean
-et_drag_drop(GtkWidget *widget,
- GdkDragContext *context,
- gint x,
- gint y,
- guint time,
- ETree *et)
-{
- gboolean ret_val = FALSE;
- int row, col;
- ETreePath path;
- ETreePath sorted_path;
- y -= widget->allocation.y;
- x -= widget->allocation.x;
- e_tree_get_cell_at(et,
- x,
- y,
- &row,
- &col);
- sorted_path = e_tree_table_adapter_node_at_row(et->priv->etta, row);
- path = e_tree_sorted_view_to_model_path(et->priv->sorted, sorted_path);
-
- if (row != et->priv->drop_row && col != et->priv->drop_row) {
- 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, sorted_path);
-
- scroll_off (et);
- return ret_val;
-}
-
-static void
-et_drag_data_received(GtkWidget *widget,
- GdkDragContext *context,
- gint x,
- gint y,
- GtkSelectionData *selection_data,
- guint info,
- guint time,
- ETree *et)
-{
- int row, col;
- ETreePath path;
- y -= widget->allocation.y;
- x -= widget->allocation.x;
- e_tree_get_cell_at(et,
- x,
- y,
- &row,
- &col);
- path = e_tree_table_adapter_node_at_row(et->priv->etta, row);
- path = e_tree_sorted_view_to_model_path(et->priv->sorted, path);
- 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->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_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));
-}
-
-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-match.c b/widgets/text/e-completion-match.c
deleted file mode 100644
index 0da197d1fe..0000000000
--- a/widgets/text/e-completion-match.c
+++ /dev/null
@@ -1,185 +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->hit_count = 0;
- match->destroy = NULL;
-}
-
-void
-e_completion_match_ref (ECompletionMatch *match)
-{
- g_return_if_fail (match != NULL);
- g_return_if_fail (match->ref > 0);
-
- ++match->ref;
-}
-
-void
-e_completion_match_unref (ECompletionMatch *match)
-{
- if (match) {
- g_return_if_fail (match->ref > 0);
-
- --match->ref;
- if (match->ref == 0) {
- e_completion_match_destroy (match);
- }
- }
-}
-
-void
-e_completion_match_set_text (ECompletionMatch *match,
- const gchar *match_text,
- const gchar *menu_text)
-{
- g_return_if_fail (match != NULL);
-
- /* We silently drop any entries w/ invalid utf8.
- This is not optimal behavior. */
-
- if (match_text && ! g_utf8_validate (match_text, -1, NULL)) {
- match_text = NULL;
- }
-
- if (menu_text && ! g_utf8_validate (menu_text, -1, NULL)) {
- menu_text = NULL;
- }
-
- if (match->match_text && match->match_text != match_text) {
- g_free (match->match_text);
- }
- match->match_text = g_strdup (match_text);
-
- if (match->menu_text && match->menu_text != menu_text) {
- g_free (match->menu_text);
- }
- match->menu_text = g_strdup (menu_text);
-}
-
-const gchar *
-e_completion_match_get_match_text (ECompletionMatch *match)
-{
- g_return_val_if_fail (match != NULL, NULL);
- return match->match_text;
-}
-
-const gchar *
-e_completion_match_get_menu_text (ECompletionMatch *match)
-{
- g_return_val_if_fail (match != NULL, NULL);
- return match->menu_text;
-}
-
-gint
-e_completion_match_compare (const ECompletionMatch *a, const ECompletionMatch *b)
-{
- gint rv;
-
- /* Deal with NULL arguments. */
- if (!(a || b)) {
- if (!(a && b))
- return 0;
- return a ? -1 : 1;
- }
-
- if ( (rv = (b->sort_major < a->sort_major) - (a->sort_major < b->sort_major)) )
- return rv;
-
- /* Sort the scores high->low. */
- if ( (rv = (b->score > a->score) - (a->score > b->score)) )
- return rv;
-
- if ( (rv = (b->sort_minor < a->sort_minor) - (a->sort_minor < b->sort_minor)) )
- return rv;
-
- return 0;
-}
-
-gint
-e_completion_match_compare_alpha (const ECompletionMatch *a, const ECompletionMatch *b)
-{
- gint rv, rv2;
-
- /* Deal with NULL arguments. */
- if (!(a || b)) {
- if (!(a && b))
- return 0;
- return a ? -1 : 1;
- }
-
- /* The sort_major trumps everything. */
- if ( (rv = (b->sort_major < a->sort_major) - (a->sort_major < b->sort_major)) )
- return rv;
-
- /* Sort the scores high->low. */
- if ( (rv = (b->score > a->score) - (a->score > b->score)) )
- return rv;
-
- /* When the match text is the same, we use the minor fields */
- rv2 = strcmp (a->match_text, b->match_text);
- if ( !rv2 && (rv = (b->sort_minor < a->sort_minor) - (a->sort_minor < b->sort_minor)) )
- return rv;
-
- return strcmp (a->menu_text, b->menu_text);
-}
-
-ECompletionMatch *
-e_completion_match_new (const gchar *match_text, const gchar *menu_text, double score)
-{
- ECompletionMatch *match = g_new0 (ECompletionMatch, 1);
-
- e_completion_match_construct (match);
- e_completion_match_set_text (match, match_text, menu_text);
- match->score = score;
-
- return match;
-}
diff --git a/widgets/text/e-completion-match.h b/widgets/text/e-completion-match.h
deleted file mode 100644
index f2773ee094..0000000000
--- a/widgets/text/e-completion-match.h
+++ /dev/null
@@ -1,68 +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;
- gint hit_count;
- void (*destroy) (ECompletionMatch *);
-};
-
-typedef void (*ECompletionMatchFn) (ECompletionMatch *, gpointer closure);
-
-void e_completion_match_construct (ECompletionMatch *);
-void e_completion_match_ref (ECompletionMatch *);
-void e_completion_match_unref (ECompletionMatch *);
-
-void e_completion_match_set_text (ECompletionMatch *, const gchar *match_text, const gchar *label_text);
-const gchar *e_completion_match_get_match_text (ECompletionMatch *);
-const gchar *e_completion_match_get_menu_text (ECompletionMatch *);
-
-gint e_completion_match_compare (const ECompletionMatch *, const ECompletionMatch *);
-gint e_completion_match_compare_alpha (const ECompletionMatch *, const ECompletionMatch *);
-
-ECompletionMatch *e_completion_match_new (const gchar *match_text, const gchar *menu_text, double score);
-
-
-
-
-G_END_DECLS
-
-#endif /* __E_COMPLETION_MATCH_H__ */
-
diff --git a/widgets/text/e-completion-test.c b/widgets/text/e-completion-test.c
deleted file mode 100644
index dfefe23e1b..0000000000
--- a/widgets/text/e-completion-test.c
+++ /dev/null
@@ -1,220 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-completion-test.c
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Jon Trowbridge <trow@ximian.com>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#include <gnome.h>
-#include "e-completion.h"
-#include "e-entry.h"
-
-#define TIMEOUT 10
-
-/* Dictionary Lookup test */
-
-static gint word_count = 0;
-static gchar **word_array = NULL;
-
-static void
-read_dict (void)
-{
- FILE *in = fopen ("/usr/share/dict/words", "r");
- gchar buffer[128];
- GList *word_list = NULL, *iter;
- gint i;
-
- while (fgets (buffer, 128, in)) {
- gint len = strlen (buffer);
- if (len > 0 && buffer[len-1] == '\n')
- buffer[len-1] = '\0';
- word_list = g_list_prepend (word_list, g_strdup (buffer));
- ++word_count;
- }
- fclose (in);
-
- word_array = g_new (gchar *, word_count);
- i = word_count-1;
- for (iter = word_list; iter != NULL; iter = g_list_next (iter)) {
- word_array[i] = (gchar *)iter->data;
- --i;
- }
-}
-
-static gint
-find_word (const gchar *str)
-{
- gint a, b;
-
- if (word_array == NULL)
- read_dict ();
-
- a = 0;
- b = word_count-1;
-
- while (b-a > 1) {
- gint m = (a+b)/2;
- gint cmp = g_strcasecmp (str, word_array[m]);
-
- if (cmp < 0)
- b = m;
- else if (cmp > 0)
- a = m;
- else
- return m;
- }
-
- return b;
-}
-
-struct {
- ECompletion *complete;
- const gchar *txt;
- gint start;
- gint current;
- gint len;
- gint limit;
- gint count;
-} dict_info;
-static guint dict_tag = 0;
-
-static gboolean
-dict_check (gpointer ptr)
-{
- gint limit = dict_info.limit;
- gint i;
-
- /* If this is the first iteration, do the binary search in our word list to figure out
- where to start. We do less work on the first iteration, to give more of a sense of
- immediate feedback. */
- if (dict_info.start < 0) {
- dict_info.start = dict_info.current = find_word (dict_info.txt);
- }
-
- i = dict_info.current;
- while (limit > 0
- && i < word_count
- && dict_info.count < 50
- && g_strncasecmp (dict_info.txt, word_array[i], dict_info.len) == 0) {
-
- ECompletionMatch *match = g_new (ECompletionMatch, 1);
- e_completion_match_construct (match);
- e_completion_match_set_text (match, word_array[i], NULL);
- match->score = dict_info.len / (double)strlen (word_array[i]);
- e_completion_found_match (dict_info.complete, match);
-
- ++i;
- --limit;
- ++dict_info.count;
- }
- dict_info.current = i;
- dict_info.limit = MIN (dict_info.limit*2, 400);
-
- if (limit != 0) {
- dict_tag = 0;
- e_completion_end_search (dict_info.complete);
- return FALSE;
- }
-
-
-
- return TRUE;
-}
-
-static void
-request_dict_search (ECompletion *complete, const gchar *txt, gint pos, gint limit, gpointer user_data)
-{
- gint len = strlen (txt);
-
- if (dict_tag != 0) {
- gtk_timeout_remove (dict_tag);
- dict_tag = 0;
- }
-
- if (len > 0) {
- dict_info.complete = complete;
- dict_info.txt = txt;
- dict_info.start = -1;
- dict_info.current = -1;
- dict_info.len = len;
- dict_info.limit = 100;
- dict_info.count = 0;
- dict_tag = gtk_timeout_add (TIMEOUT, dict_check, NULL);
- } else {
- e_completion_end_search (complete);
- }
-}
-
-static void
-end_dict_search (ECompletion *complete, gpointer user_data)
-{
- if (dict_tag != 0) {
- gtk_timeout_remove (dict_tag);
- dict_tag = 0;
- }
-}
-
-static void
-popup_cb (EEntry *popup, GdkEventButton *ev, gint pos, gpointer user_data)
-{
- g_print ("popup at pos %d\n", pos);
-}
-
-int
-main (int argc, gchar **argv)
-{
- ECompletion* complete;
- GtkWidget *entry;
- GtkWidget *win;
-
- gnome_init ("ETextModelTest", "0.0", argc, argv);
-
- read_dict ();
-
- complete = e_completion_new ();
- g_signal_connect (complete,
- "request_completion",
- G_CALLBACK (request_dict_search),
- NULL);
- g_signal_connect (complete,
- "end_completion",
- G_CALLBACK (end_dict_search),
- NULL);
- g_signal_connect (complete,
- "cancel_completion",
- G_CALLBACK (end_dict_search),
- NULL);
-
- win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
- entry = e_entry_new ();
- e_entry_enable_completion_full (E_ENTRY (entry), complete, 0, NULL);
- e_entry_set_editable (E_ENTRY (entry), TRUE);
-
- g_signal_connect (entry,
- "popup",
- G_CALLBACK (popup_cb),
- NULL);
-
- gtk_container_add (GTK_CONTAINER (win), entry);
- gtk_widget_show_all (win);
-
- gtk_main ();
-
- return 0;
-}
diff --git a/widgets/text/e-completion-view.c b/widgets/text/e-completion-view.c
deleted file mode 100644
index 4e5bba3f9e..0000000000
--- a/widgets/text/e-completion-view.c
+++ /dev/null
@@ -1,933 +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_event (bin->child, (GdkEvent*) &child_event);
- }
-
- return FALSE;
-}
-
-static void
-e_completion_view_size_request (GtkWidget *widget, GtkRequisition *requisition)
-{
- GtkBin *bin;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (E_IS_COMPLETION_VIEW (widget));
- g_return_if_fail (requisition != NULL);
-
- bin = GTK_BIN (widget);
-
- requisition->width = 2 * E_COMPLETION_VIEW (widget)->border_width;
- requisition->height = 2 * E_COMPLETION_VIEW (widget)->border_width;
-
- if (bin->child && GTK_WIDGET_VISIBLE (bin->child)) {
- GtkRequisition child_requisition;
-
- gtk_widget_size_request (bin->child, &child_requisition);
-
- requisition->width += child_requisition.width;
- requisition->height += child_requisition.height;
- }
-}
-
-static void
-e_completion_view_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
-{
- GtkBin *bin;
- GtkAllocation child_allocation;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (E_IS_COMPLETION_VIEW (widget));
- g_return_if_fail (allocation != NULL);
-
- bin = GTK_BIN (widget);
- widget->allocation = *allocation;
-
- child_allocation.x = E_COMPLETION_VIEW (widget)->border_width;
- child_allocation.width = MAX(0, (gint)allocation->width - child_allocation.x * 2);
-
- child_allocation.y = E_COMPLETION_VIEW (widget)->border_width;
- child_allocation.height = MAX (0, (gint)allocation->height - child_allocation.y * 2);
-
- if (GTK_WIDGET_REALIZED (widget)) {
- gdk_window_move_resize (widget->window,
- allocation->x,
- allocation->y,
- allocation->width,
- allocation->height);
- }
-
- if (bin->child) {
- gtk_widget_size_allocate (bin->child, &child_allocation);
- }
-}
-
-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->restart_signal_id)
- g_signal_handler_disconnect (cv->completion, cv->restart_signal_id);
- if (cv->cancel_signal_id)
- g_signal_handler_disconnect (cv->completion, cv->cancel_signal_id);
- if (cv->end_signal_id)
- g_signal_handler_disconnect (cv->completion, cv->end_signal_id);
- if (cv->clear_signal_id)
- g_signal_handler_disconnect (cv->completion, cv->clear_signal_id);
- if (cv->lost_signal_id)
- g_signal_handler_disconnect (cv->completion, cv->lost_signal_id);
-
- cv->begin_signal_id = 0;
- cv->comp_signal_id = 0;
- cv->restart_signal_id = 0;
- cv->cancel_signal_id = 0;
- cv->end_signal_id = 0;
- cv->clear_signal_id = 0;
- cv->lost_signal_id = 0;
-}
-
-static ETable *
-e_completion_view_table (ECompletionView *cv)
-{
- return e_table_scrolled_get_table (E_TABLE_SCROLLED (cv->table));
-}
-
-static void
-e_completion_view_clear_choices (ECompletionView *cv)
-{
- ECompletionMatch *match;
- GPtrArray *m;
- int i;
-
- g_return_if_fail (E_IS_COMPLETION_VIEW (cv));
-
- m = cv->choices;
- for (i = 0; i < m->len; i++) {
- match = g_ptr_array_index (m, i);
- e_completion_match_unref (match);
- }
- g_ptr_array_set_size (m, 0);
-}
-
-static void
-e_completion_view_set_cursor_row (ECompletionView *cv, gint r)
-{
- ETable *table;
- GtkAdjustment *adj;
- gint x, y1, y2, r1, r2, c;
- double fracline;
- gint iteration_count=0;
-
- g_return_if_fail (cv != NULL);
- g_return_if_fail (E_IS_COMPLETION_VIEW (cv));
-#ifndef G_DISABLE_CHECKS
- /* choices->len is unsigned, but it is reasonable for r to be
- * < 0 */
- if (r > 0) {
- g_return_if_fail (r < cv->choices->len);
- }
-#endif
-
- adj = e_scroll_frame_get_vadjustment (E_SCROLL_FRAME (cv->table));
-
- table = e_completion_view_table (cv);
-
- if (r < 0) {
- e_selection_model_clear (E_SELECTION_MODEL(table->selection));
-
- /* Move back to the top when we clear the selection */
- gtk_adjustment_set_value (adj, adj->lower);
- return;
- }
-
- e_table_set_cursor_row (table, r);
-
- /* OK, now the tricky bit. We try to insure that this row is
- visible. */
-
- /* If we are selecting the first or last row, then it is easy. We just
- cram the vadjustment all the way up/down. */
- if (r == 0) {
- gtk_adjustment_set_value (adj, adj->lower);
- return;
- } else if (r == cv->choices->len - 1) {
- gtk_adjustment_set_value (adj, adj->upper - adj->page_size);
- return;
- }
-
- fracline = ((adj->upper - adj->lower - adj->page_size) / (gint)cv->choices->len) / 4;
-
- while (iteration_count < 100) {
- x = GTK_LAYOUT(table->table_canvas)->hadjustment->value;
- y1 = GTK_LAYOUT(table->table_canvas)->vadjustment->value;
-
- y2 = y1 + cv->table->allocation.height;
-
- e_table_group_compute_location (e_completion_view_table (cv)->group, &x, &y1, &r1, &c);
- e_table_group_compute_location (e_completion_view_table (cv)->group, &x, &y2, &r2, &c);
-
- if (r <= r1) {
- gtk_adjustment_set_value (adj, adj->value - fracline);
- } else if (r >= r2) {
- gtk_adjustment_set_value (adj, adj->value + fracline);
- } else
- return;
-
- ++iteration_count;
- }
-
- g_assert_not_reached ();
-}
-
-static void
-e_completion_view_select (ECompletionView *cv, gint r)
-{
- ECompletionMatch *match;
-
- match = g_ptr_array_index (cv->choices, r);
-
- cv->selection = r;
- e_completion_view_set_cursor_row (cv, r);
- 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_completion_view_clear_choices (cv);
- cv->have_all_choices = FALSE;
-
- e_table_model_changed (cv->model);
-}
-
-static void
-restart_completion_cb (ECompletion *completion, gpointer user_data)
-{
- /* For now, handle restarts like the beginning of a new completion. */
- begin_completion_cb (completion, NULL, 0, 0, user_data);
-}
-
-static void
-cancel_completion_cb (ECompletion *completion, gpointer user_data)
-{
- ECompletionView *cv = E_COMPLETION_VIEW (user_data);
-
- /* On a cancel, clear our choices and issue an "unbrowse" signal. */
- e_completion_view_clear_choices (cv);
- cv->have_all_choices = TRUE;
- e_completion_view_set_cursor_row (cv, -1);
- e_table_model_changed (cv->model);
-
- g_signal_emit (cv, e_completion_view_signals[E_COMPLETION_VIEW_UNBROWSE] ,0);
-}
-
-static void
-completion_cb (ECompletion *completion, ECompletionMatch *match, gpointer user_data)
-{
- ECompletionView *cv = E_COMPLETION_VIEW (user_data);
- gint r = cv->choices->len;
- gboolean first = (cv->choices->len == 0);
-
- e_completion_match_ref (match);
- g_ptr_array_add (cv->choices, match);
-
- e_table_model_row_inserted (cv->model, r);
-
- if (first)
- 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_changed (cv->model);
-
- cv->have_all_choices = TRUE;
- g_signal_emit (cv, e_completion_view_signals[E_COMPLETION_VIEW_FULL], 0);
-}
-
-static void
-clear_completion_cb (ECompletion *completion, gpointer user_data)
-{
- ECompletionView *cv = E_COMPLETION_VIEW (user_data);
-
- e_completion_view_clear_choices (cv);
- cv->have_all_choices = FALSE;
-
- e_table_model_changed (cv->model);
-}
-
-static void
-lost_completion_cb (ECompletion *completion, ECompletionMatch *match, gpointer user_data)
-{
- ECompletionView *cv = E_COMPLETION_VIEW (user_data);
- int i;
- GPtrArray *c = cv->choices;
-
- for (i = 0; i < c->len; i++)
- if (g_ptr_array_index (c, i) == match)
- break;
-
- g_return_if_fail (i == c->len);
-
- /* FIXME: do remove_index_fast(), then row_changed and
- * row_deleted (if there are more than 1 row still) */
- g_ptr_array_remove_index (c, i);
- e_table_model_row_deleted (cv->model, i);
-
- e_completion_match_unref (match);
-}
-
-/*** Table Callbacks ***/
-
-static char *simple_spec =
-"<ETableSpecification no-headers=\"true\" draw-grid=\"false\" cursor-mode=\"line\" alternating-row-colors=\"false\" 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,
- "begin_completion",
- G_CALLBACK (begin_completion_cb),
- cv);
- cv->comp_signal_id = g_signal_connect (completion,
- "completion",
- G_CALLBACK (completion_cb),
- cv);
- cv->restart_signal_id = g_signal_connect (completion,
- "restart_completion",
- G_CALLBACK (restart_completion_cb),
- cv);
- cv->cancel_signal_id = g_signal_connect (completion,
- "cancel_completion",
- G_CALLBACK (cancel_completion_cb),
- cv);
- cv->end_signal_id = g_signal_connect (completion,
- "end_completion",
- G_CALLBACK (end_completion_cb),
- cv);
- cv->clear_signal_id = g_signal_connect (completion,
- "clear_completion",
- G_CALLBACK (clear_completion_cb),
- cv);
- cv->lost_signal_id = g_signal_connect (completion,
- "lost_completion",
- G_CALLBACK (lost_completion_cb),
- cv);
-
- cv->model = e_table_simple_new (table_col_count,
- table_row_count,
- NULL,
-
- table_value_at,
- NULL,
- table_is_cell_editable,
-
- NULL, NULL,
-
- NULL, NULL, NULL, NULL,
- table_value_to_string,
- cv);
-
- cv->table = e_table_scrolled_new (cv->model, NULL, simple_spec, NULL);
- g_object_unref (cv->model);
-
- e_scroll_frame_set_shadow_type (E_SCROLL_FRAME (cv->table), GTK_SHADOW_NONE);
- e_scroll_frame_set_scrollbar_spacing (E_SCROLL_FRAME (cv->table), 0);
- e_scroll_frame_set_policy (E_SCROLL_FRAME (cv->table), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
-
- gtk_container_add (GTK_CONTAINER (cv), cv->table);
- gtk_widget_show_all (cv->table);
-
- 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 9aa3860ebd..0000000000
--- a/widgets/text/e-completion-view.h
+++ /dev/null
@@ -1,102 +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 restart_signal_id;
- guint cancel_signal_id;
- guint end_signal_id;
- guint clear_signal_id;
- guint lost_signal_id;
-
- GtkWidget *key_widget;
- guint key_signal_id;
-
- gint complete_key;
- gint uncomplete_key;
-
- gboolean have_all_choices;
-
- gboolean editable;
- gint selection;
-
- gint border_width;
-};
-
-struct _ECompletionViewClass {
- GtkEventBoxClass parent_class;
-
- /* Signals */
- void (*nonempty) (ECompletionView *cv);
- void (*added) (ECompletionView *cv);
- void (*full) (ECompletionView *cv);
- void (*browse) (ECompletionView *cv, ECompletionMatch *match);
- void (*unbrowse) (ECompletionView *cv);
- void (*activate) (ECompletionView *cv, ECompletionMatch *match);
-};
-
-GtkType e_completion_view_get_type (void);
-
-void e_completion_view_construct (ECompletionView *cv, ECompletion *completion);
-GtkWidget *e_completion_view_new (ECompletion *completion);
-
-void e_completion_view_connect_keys (ECompletionView *cv, GtkWidget *w);
-
-void e_completion_view_set_complete_key (ECompletionView *cv, gint keyval);
-void e_completion_view_set_uncomplete_key (ECompletionView *cv, gint keyval);
-
-void e_completion_view_set_width (ECompletionView *cv, gint width);
-void e_completion_view_set_editable (ECompletionView *cv, gboolean);
-
-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 cddd6ed4f4..0000000000
--- a/widgets/text/e-completion.c
+++ /dev/null
@@ -1,640 +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 {
- E_COMPLETION_REQUEST_COMPLETION,
- E_COMPLETION_BEGIN_COMPLETION,
- E_COMPLETION_COMPLETION,
- E_COMPLETION_RESTART_COMPLETION,
- E_COMPLETION_CANCEL_COMPLETION,
- E_COMPLETION_END_COMPLETION,
- E_COMPLETION_CLEAR_COMPLETION,
- E_COMPLETION_LOST_COMPLETION,
- E_COMPLETION_LAST_SIGNAL
-};
-
-static guint e_completion_signals[E_COMPLETION_LAST_SIGNAL] = { 0 };
-
-struct _ECompletionPrivate {
- gboolean searching;
- gboolean done_search;
- gboolean refining;
- gchar *search_text;
- GPtrArray *matches;
- gint match_count;
- gint pos;
- gint limit;
- double min_score, max_score;
- gint refinement_count;
- GList *search_stack;
-};
-
-typedef struct {
- gchar *text;
- gint pos;
-} ECompletionSearch;
-
-static void e_completion_class_init (ECompletionClass *klass);
-static void e_completion_init (ECompletion *complete);
-static void e_completion_dispose (GObject *object);
-
-static void e_completion_add_match (ECompletion *complete, ECompletionMatch *);
-static void e_completion_clear_search_stack (ECompletion *complete);
-static void e_completion_clear_matches (ECompletion *complete);
-static gboolean e_completion_sort (ECompletion *complete);
-static void e_completion_restart (ECompletion *complete);
-
-#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[E_COMPLETION_REQUEST_COMPLETION] =
- g_signal_new ("request_completion",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ECompletionClass, request_completion),
- NULL, NULL,
- e_marshal_NONE__POINTER_INT_INT,
- G_TYPE_NONE, 3,
- G_TYPE_POINTER, G_TYPE_INT, G_TYPE_INT);
-
- e_completion_signals[E_COMPLETION_BEGIN_COMPLETION] =
- g_signal_new ("begin_completion",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ECompletionClass, begin_completion),
- NULL, NULL,
- e_marshal_NONE__POINTER_INT_INT,
- G_TYPE_NONE, 3,
- G_TYPE_POINTER, G_TYPE_INT, G_TYPE_INT);
-
- e_completion_signals[E_COMPLETION_COMPLETION] =
- g_signal_new ("completion",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ECompletionClass, completion),
- NULL, NULL,
- e_marshal_NONE__POINTER,
- G_TYPE_NONE, 1,
- G_TYPE_POINTER);
-
- e_completion_signals[E_COMPLETION_RESTART_COMPLETION] =
- g_signal_new ("restart_completion",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ECompletionClass, restart_completion),
- NULL, NULL,
- e_marshal_NONE__NONE,
- G_TYPE_NONE, 0);
-
- e_completion_signals[E_COMPLETION_CANCEL_COMPLETION] =
- g_signal_new ("cancel_completion",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ECompletionClass, cancel_completion),
- NULL, NULL,
- e_marshal_NONE__NONE,
- G_TYPE_NONE, 0);
-
- e_completion_signals[E_COMPLETION_END_COMPLETION] =
- g_signal_new ("end_completion",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ECompletionClass, end_completion),
- NULL, NULL,
- e_marshal_NONE__NONE,
- G_TYPE_NONE, 0);
-
- e_completion_signals[E_COMPLETION_CLEAR_COMPLETION] =
- g_signal_new ("clear_completion",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ECompletionClass, clear_completion),
- NULL, NULL,
- e_marshal_NONE__NONE,
- G_TYPE_NONE, 0);
-
- e_completion_signals[E_COMPLETION_LOST_COMPLETION] =
- g_signal_new ("lost_completion",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ECompletionClass, lost_completion),
- NULL, NULL,
- e_marshal_NONE__POINTER,
- G_TYPE_NONE, 1, G_TYPE_POINTER);
-
- 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);
- e_completion_clear_search_stack (complete);
-
- g_ptr_array_free (complete->priv->matches, TRUE);
- complete->priv->matches = NULL;
-
- g_free (complete->priv);
- complete->priv = NULL;
- }
-
- if (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_clear (ECompletion *complete)
-{
- g_return_if_fail (E_IS_COMPLETION (complete));
-
- /* FIXME: do we really want _clear and _clear_matches() ? */
-
- /* I think yes, because it is convenient to be able to clear our match cache
- without emitting a "clear_completion" signal. -JT */
-
- e_completion_clear_matches (complete);
- e_completion_clear_search_stack (complete);
- complete->priv->refinement_count = 0;
- complete->priv->match_count = 0;
- g_signal_emit (complete, e_completion_signals[E_COMPLETION_CLEAR_COMPLETION], 0);
-}
-
-static void
-e_completion_push_search (ECompletion *complete, const gchar *text, gint pos)
-{
- ECompletionSearch *search;
-
- g_return_if_fail (E_IS_COMPLETION (complete));
-
- search = g_new (ECompletionSearch, 1);
- search->text = complete->priv->search_text;
- search->pos = complete->priv->pos;
- complete->priv->search_stack = g_list_prepend (complete->priv->search_stack, search);
-
- complete->priv->search_text = g_strdup (text);
- complete->priv->pos = pos;
-}
-
-static void
-e_completion_pop_search (ECompletion *complete)
-{
- ECompletionSearch *search;
- GList *old_link = complete->priv->search_stack;
-
- g_return_if_fail (E_IS_COMPLETION (complete));
- g_return_if_fail (complete->priv->search_stack != NULL);
-
- g_free (complete->priv->search_text);
-
- search = complete->priv->search_stack->data;
- complete->priv->search_text = search->text;
- complete->priv->pos = search->pos;
-
- g_free (search);
- complete->priv->search_stack = g_list_remove_link (complete->priv->search_stack,
- complete->priv->search_stack);
- g_list_free_1 (old_link);
-}
-
-static void
-e_completion_clear_search_stack (ECompletion *complete)
-{
- GList *iter;
-
- g_return_if_fail (E_IS_COMPLETION (complete));
-
- for (iter = complete->priv->search_stack; iter != NULL; iter = g_list_next (iter)) {
- ECompletionSearch *search = iter->data;
- g_free (search->text);
- g_free (search);
- }
- g_list_free (complete->priv->search_stack);
- complete->priv->search_stack = NULL;
-}
-
-static void
-e_completion_refine_search (ECompletion *comp, const gchar *text, gint pos, ECompletionRefineFn refine_fn)
-{
- GPtrArray *m;
- gint i;
-
- comp->priv->refining = TRUE;
-
- e_completion_push_search (comp, text, pos);
-
- g_signal_emit (comp, e_completion_signals[E_COMPLETION_BEGIN_COMPLETION], 0, text, pos, comp->priv->limit);
-
- comp->priv->match_count = 0;
-
- comp->priv->searching = TRUE;
-
- m = comp->priv->matches;
- for (i = 0; i < m->len; ++i) {
- ECompletionMatch *match = g_ptr_array_index (m, i);
- if (comp->priv->refinement_count == match->hit_count
- && refine_fn (comp, match, text, pos)) {
- ++match->hit_count;
- g_signal_emit (comp, e_completion_signals[E_COMPLETION_COMPLETION], 0, match);
- ++comp->priv->match_count;
- }
- }
-
- ++comp->priv->refinement_count;
-
- g_signal_emit (comp, e_completion_signals[E_COMPLETION_END_COMPLETION], 0);
-
- comp->priv->searching = FALSE;
- comp->priv->refining = FALSE;
-}
-
-static void
-e_completion_unrefine_search (ECompletion *comp)
-{
- GPtrArray *m;
- gint i;
-
- comp->priv->refining = TRUE;
-
- e_completion_pop_search (comp);
-
- g_signal_emit (comp, e_completion_signals[E_COMPLETION_BEGIN_COMPLETION], 0,
- comp->priv->search_text, comp->priv->pos, comp->priv->limit);
-
- comp->priv->match_count = 0;
- --comp->priv->refinement_count;
-
- comp->priv->searching = TRUE;
-
- m = comp->priv->matches;
- for (i = 0; i < m->len; ++i) {
- ECompletionMatch *match = g_ptr_array_index (m, i);
- if (comp->priv->refinement_count <= match->hit_count) {
- match->hit_count = comp->priv->refinement_count;
- g_signal_emit (comp, e_completion_signals[E_COMPLETION_COMPLETION], 0, match);
- ++comp->priv->match_count;
- }
- }
-
- g_signal_emit (comp, e_completion_signals[E_COMPLETION_END_COMPLETION], 0);
-
- comp->priv->searching = FALSE;
- comp->priv->refining = FALSE;
-}
-
-void
-e_completion_begin_search (ECompletion *complete, const gchar *text, gint pos, gint limit)
-{
- ECompletionClass *klass;
- ECompletionRefineFn refine_fn;
-
- g_return_if_fail (complete != NULL);
- g_return_if_fail (E_IS_COMPLETION (complete));
- g_return_if_fail (text != NULL);
-
- klass = E_COMPLETION_CLASS (GTK_OBJECT_GET_CLASS (complete));
-
- if (!complete->priv->searching && complete->priv->done_search) {
-
- /* If the search we are requesting is the same as what we had before our last refinement,
- treat the request as an unrefine. */
- if (complete->priv->search_stack != NULL) {
- ECompletionSearch *search = complete->priv->search_stack->data;
- if ((klass->ignore_pos_on_auto_unrefine || search->pos == pos)
- && !strcmp (search->text, text)) {
- e_completion_unrefine_search (complete);
- return;
- }
- }
-
- if (klass->auto_refine
- && (refine_fn = klass->auto_refine (complete,
- complete->priv->search_text, complete->priv->pos,
- text, pos))) {
- e_completion_refine_search (complete, text, pos, refine_fn);
- return;
- }
-
- }
-
- /* Stop any prior search. */
- if (complete->priv->searching)
- e_completion_cancel_search (complete);
-
- e_completion_clear_search_stack (complete);
-
- g_free (complete->priv->search_text);
- complete->priv->search_text = g_strdup (text);
-
- complete->priv->pos = pos;
- complete->priv->searching = TRUE;
- complete->priv->done_search = FALSE;
-
- e_completion_clear_matches (complete);
-
- complete->priv->limit = limit > 0 ? limit : G_MAXINT;
- complete->priv->refinement_count = 0;
-
- g_signal_emit (complete, e_completion_signals[E_COMPLETION_BEGIN_COMPLETION], 0, text, pos, limit);
- g_signal_emit (complete, e_completion_signals[E_COMPLETION_REQUEST_COMPLETION], 0, text, pos, limit);
-}
-
-void
-e_completion_cancel_search (ECompletion *complete)
-{
- g_return_if_fail (complete != NULL);
- g_return_if_fail (E_IS_COMPLETION (complete));
-
- /* If there is no search to cancel, just silently return. */
- if (!complete->priv->searching)
- return;
-
- g_signal_emit (complete, e_completion_signals[E_COMPLETION_CANCEL_COMPLETION], 0);
-
- complete->priv->searching = FALSE;
-}
-
-gboolean
-e_completion_searching (ECompletion *complete)
-{
- g_return_val_if_fail (complete != NULL, FALSE);
- g_return_val_if_fail (E_IS_COMPLETION (complete), FALSE);
-
- return complete->priv->searching;
-}
-
-gboolean
-e_completion_refining (ECompletion *complete)
-{
- g_return_val_if_fail (complete != NULL, FALSE);
- g_return_val_if_fail (E_IS_COMPLETION (complete), FALSE);
-
- return complete->priv->refining;
-}
-
-const gchar *
-e_completion_search_text (ECompletion *complete)
-{
- g_return_val_if_fail (complete != NULL, NULL);
- g_return_val_if_fail (E_IS_COMPLETION (complete), NULL);
-
- return complete->priv->search_text;
-}
-
-gint
-e_completion_search_text_pos (ECompletion *complete)
-{
- g_return_val_if_fail (complete != NULL, -1);
- g_return_val_if_fail (E_IS_COMPLETION (complete), -1);
-
- return complete->priv->pos;
-}
-
-gint
-e_completion_match_count (ECompletion *complete)
-{
- g_return_val_if_fail (complete != NULL, 0);
- g_return_val_if_fail (E_IS_COMPLETION (complete), 0);
-
- return complete->priv->refinement_count > 0 ? complete->priv->match_count : complete->priv->matches->len;
-}
-
-void
-e_completion_foreach_match (ECompletion *complete, ECompletionMatchFn fn, gpointer closure)
-{
- GPtrArray *m;
- int i;
-
- g_return_if_fail (complete != NULL);
- g_return_if_fail (E_IS_COMPLETION (complete));
-
- if (fn == NULL)
- return;
-
- m = complete->priv->matches;
- for (i = 0; i < m->len; i++) {
- ECompletionMatch *match = g_ptr_array_index (m, i);
- if (match->hit_count == complete->priv->refinement_count) {
- fn (match, closure);
- }
- }
-}
-
-ECompletion *
-e_completion_new (void)
-{
- return E_COMPLETION (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;
-}
-
-/* Emit a restart signal and re-declare our matches, up to the limit. */
-static void
-e_completion_restart (ECompletion *complete)
-{
- GPtrArray *m;
- gint i, count;
-
- g_signal_emit (complete, e_completion_signals[E_COMPLETION_RESTART_COMPLETION], 0);
-
- m = complete->priv->matches;
- for (i = count = 0;
- i < m->len && count < complete->priv->limit;
- i++, count++) {
- g_signal_emit (complete,
- e_completion_signals[E_COMPLETION_COMPLETION], 0,
- g_ptr_array_index (m, i));
- }
-}
-
-void
-e_completion_found_match (ECompletion *complete, ECompletionMatch *match)
-{
- g_return_if_fail (complete);
- g_return_if_fail (E_IS_COMPLETION (complete));
- g_return_if_fail (match != NULL);
-
- if (! complete->priv->searching) {
- g_warning ("e_completion_found_match(...,\"%s\",...) called outside of a search", match->match_text);
- return;
- }
-
- /* For now, do nothing when we hit the limit --- just don't
- * announce the incoming matches. */
- if (complete->priv->matches->len >= complete->priv->limit) {
- e_completion_match_unref (match);
- return;
- }
-
- e_completion_add_match (complete, match);
-
- g_signal_emit (complete, e_completion_signals[E_COMPLETION_COMPLETION], 0, match);
-}
-
-/* to optimize this, make the match a hash table */
-void
-e_completion_lost_match (ECompletion *complete, ECompletionMatch *match)
-{
- gboolean removed;
-
- g_return_if_fail (E_IS_COMPLETION (complete));
- g_return_if_fail (match != NULL);
-
- /* FIXME: remove fast */
- removed = g_ptr_array_remove (complete->priv->matches,
- match);
-
- /* maybe just return here? */
- g_return_if_fail (removed);
-
- g_signal_emit (complete, e_completion_signals[E_COMPLETION_LOST_COMPLETION], 0, match);
-
- e_completion_match_unref (match);
-}
-
-void
-e_completion_end_search (ECompletion *complete)
-{
- g_return_if_fail (complete != NULL);
- g_return_if_fail (E_IS_COMPLETION (complete));
- g_return_if_fail (complete->priv->searching);
-
- /* our table model should be sorted by a non-visible column of
- * doubles (the score) rather than whatever we are doing
- */
- /* If sorting by score accomplishes anything, issue a restart right before we end. */
- if (e_completion_sort (complete))
- e_completion_restart (complete);
-
- g_signal_emit (complete, e_completion_signals[E_COMPLETION_END_COMPLETION], 0);
-
- complete->priv->searching = FALSE;
- complete->priv->done_search = TRUE;
-}
-
diff --git a/widgets/text/e-completion.h b/widgets/text/e-completion.h
deleted file mode 100644
index f8d38e45a7..0000000000
--- a/widgets/text/e-completion.h
+++ /dev/null
@@ -1,102 +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 */
- ECompletionRefineFn (*auto_refine) (ECompletion *comp,
- const gchar *old_text, gint old_pos,
- const gchar *new_text, gint new_pos);
- gboolean ignore_pos_on_auto_unrefine;
-
- /* Signals */
- void (*request_completion) (ECompletion *comp, const gchar *search_text, gint pos, gint limit);
-
- void (*begin_completion) (ECompletion *comp, const gchar *search_text, gint pos, gint limit);
- void (*restart_completion) (ECompletion *comp);
-
- void (*completion) (ECompletion *comp, ECompletionMatch *match);
- void (*lost_completion) (ECompletion *comp, ECompletionMatch *match);
-
- void (*cancel_completion) (ECompletion *comp);
- void (*end_completion) (ECompletion *comp);
- void (*clear_completion) (ECompletion *comp);
-};
-
-GtkType e_completion_get_type (void);
-
-void e_completion_begin_search (ECompletion *comp, const gchar *text, gint pos, gint limit);
-void e_completion_cancel_search (ECompletion *comp);
-
-gboolean e_completion_searching (ECompletion *comp);
-gboolean e_completion_refining (ECompletion *comp);
-const gchar *e_completion_search_text (ECompletion *comp);
-gint e_completion_search_text_pos (ECompletion *comp);
-gint e_completion_match_count (ECompletion *comp);
-void e_completion_foreach_match (ECompletion *comp, ECompletionMatchFn fn, gpointer user_data);
-
-ECompletion *e_completion_new (void);
-
-
-
-/* These functions should only be called by derived classes or search callbacks,
- or very bad things might happen. */
-
-void e_completion_found_match (ECompletion *comp, ECompletionMatch *);
-void e_completion_lost_match (ECompletion *comp, ECompletionMatch *);
-void e_completion_clear (ECompletion *comp);
-void e_completion_end_search (ECompletion *comp);
-
-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 746fba6121..0000000000
--- a/widgets/text/e-entry.c
+++ /dev/null
@@ -1,1400 +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 MOVE_RIGHT_AND_UP 0
-
-#define EVIL_POINTER_WARPING_HACK
-
-#ifdef EVIL_POINTER_WARPING_HACK
-#include <gdk/gdkx.h>
-#endif
-
-#define MIN_ENTRY_WIDTH 150
-
-#define d(x)
-
-#define PARENT_TYPE gtk_table_get_type ()
-
-static GtkObjectClass *parent_class;
-
-enum {
- E_ENTRY_CHANGED,
- E_ENTRY_ACTIVATE,
- E_ENTRY_POPUP,
- E_ENTRY_COMPLETION_POPUP,
- E_ENTRY_LAST_SIGNAL
-};
-
-static guint e_entry_signals[E_ENTRY_LAST_SIGNAL] = { 0 };
-
-/* Object argument IDs */
-enum {
- 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 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
-canvas_size_request (GtkWidget *widget, GtkRequisition *requisition,
- EEntry *entry)
-{
- int xthick, ythick;
-
- g_return_if_fail (widget != NULL);
- g_return_if_fail (GNOME_IS_CANVAS (widget));
- g_return_if_fail (requisition != NULL);
-
- if (entry->priv->draw_borders) {
- xthick = 2 * widget->style->xthickness;
- ythick = 2 * widget->style->ythickness;
- } else {
- xthick = ythick = 0;
- }
-
- if (entry->priv->emulate_label_resize) {
- gdouble width;
- g_object_get (entry->item,
- "text_width", &width,
- NULL);
- requisition->width = 2 + xthick + width;
- } else {
- requisition->width = 2 + MIN_ENTRY_WIDTH + xthick;
- }
- if (entry->priv->last_width != requisition->width)
- gtk_widget_queue_resize (widget);
- entry->priv->last_width = requisition->width;
-
- d(g_print("%s: width = %d\n", __FUNCTION__, requisition->width));
-
- requisition->height = (2 + gtk_style_get_font (widget->style)->ascent +
- gtk_style_get_font (widget->style)->descent +
- ythick);
-}
-
-static gint
-canvas_focus_in_event (GtkWidget *widget, GdkEventFocus *focus, EEntry *entry)
-{
- if (entry->canvas->focused_item != GNOME_CANVAS_ITEM(entry->item))
- gnome_canvas_item_grab_focus(GNOME_CANVAS_ITEM(entry->item));
-
- return FALSE;
-}
-
-static void
-e_entry_text_keypress (EText *text, guint keyval, guint state, EEntry *entry)
-{
- if (entry->priv->changed_since_keypress_tag) {
- gtk_timeout_remove (entry->priv->changed_since_keypress_tag);
- entry->priv->changed_since_keypress_tag = 0;
- }
-
- if (entry->priv->changed_since_keypress
- || (entry->priv->popup_is_visible && e_entry_get_position (entry) != entry->priv->last_completion_pos)) {
- if (e_entry_is_empty (entry)) {
- e_entry_cancel_delayed_completion (entry);
- e_entry_show_popup (entry, FALSE);
- } else if (entry->priv->completion_delay >= 0) {
- int delay;
- delay = entry->priv->popup_is_visible
- ? 1
- : entry->priv->completion_delay;
- e_entry_start_delayed_completion (entry, delay);
- }
- }
- entry->priv->changed_since_keypress = FALSE;
-}
-
-static gint
-changed_since_keypress_timeout_fn (gpointer user_data)
-{
- EEntry *entry = E_ENTRY (user_data);
- entry->priv->changed_since_keypress = FALSE;
- entry->priv->changed_since_keypress_tag = 0;
- return FALSE;
-}
-
-static void
-e_entry_proxy_changed (EText *text, EEntry *entry)
-{
- if (entry->priv->changed_since_keypress_tag)
- gtk_timeout_remove (entry->priv->changed_since_keypress_tag);
- entry->priv->changed_since_keypress = TRUE;
- entry->priv->changed_since_keypress_tag = gtk_timeout_add (20, changed_since_keypress_timeout_fn, entry);
-
- g_signal_emit (entry, e_entry_signals [E_ENTRY_CHANGED], 0);
-}
-
-static void
-e_entry_proxy_activate (EText *text, EEntry *entry)
-{
- g_signal_emit (entry, e_entry_signals [E_ENTRY_ACTIVATE], 0);
-}
-
-static void
-e_entry_proxy_popup (EText *text, GdkEventButton *ev, gint pos, EEntry *entry)
-{
- g_signal_emit (entry, e_entry_signals [E_ENTRY_POPUP], 0, ev, pos);
-}
-
-static void
-e_entry_init (GtkObject *object)
-{
- EEntry *entry = E_ENTRY (object);
- GtkTable *gtk_table = GTK_TABLE (object);
-
- entry->priv = g_new0 (EEntryPrivate, 1);
-
- entry->priv->emulate_label_resize = FALSE;
-
- entry->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,
- 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 (e_entry_proxy_changed),
- entry);
- entry->priv->activate_proxy_tag = g_signal_connect (entry->item,
- "activate",
- G_CALLBACK (e_entry_proxy_activate),
- entry);
- entry->priv->popup_proxy_tag = g_signal_connect (entry->item,
- "popup",
- G_CALLBACK (e_entry_proxy_popup),
- entry);
-
- entry->priv->completion_delay = 1;
-}
-
-/**
- * e_entry_construct
- *
- * Constructs the given EEntry.
- *
- **/
-void
-e_entry_construct (EEntry *entry)
-{
- /* Do nothing */
-}
-
-
-/**
- * e_entry_new
- *
- * Creates a new EEntry.
- *
- * Returns: The new EEntry
- **/
-GtkWidget *
-e_entry_new (void)
-{
- EEntry *entry;
- entry = 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;
-
-#if MOVE_RIGHT_AND_UP
- /* Put our popup slightly to the right and up, to try to give a visual cue that this popup
- is tied to this entry. Otherwise one-row popups can sort of "blend" with an entry
- directly below. */
- fudge = MAX (dim->height/10, 3); /* just in case we are using a really big font, etc. */
- x += 2*fudge;
- y -= fudge;
-#else
- fudge = 1;
- y -= fudge;
-#endif
- gtk_widget_set_uposition (pop, x, y);
- e_completion_view_set_width (E_COMPLETION_VIEW (entry->priv->completion_view), dim->width);
-
-#ifdef EVIL_POINTER_WARPING_HACK
- /*
- I should have learned by now to listen to Havoc...
- http://developer.gnome.org/doc/GGAD/faqs.html
- */
-
- if (! entry->priv->popup_is_visible) {
- GdkWindow *gwin = GTK_WIDGET (entry)->window;
- gint xx, yy;
- gdk_window_get_pointer (gwin, &xx, &yy, NULL);
- xx += xo;
- yy += yo;
-
- /* If we are inside the "zone of death" where the popup will appear, warp the pointer to safety.
- This is a horrible thing to do. */
- if (y <= yy && yy < yy + dim->height && x <= xx && xx < xx + dim->width) {
- XWarpPointer (GDK_WINDOW_XDISPLAY (gwin), None, GDK_WINDOW_XWINDOW (gwin),
- 0, 0, 0, 0,
- xx - xo, (y-1) - yo);
- }
- }
-#endif
-
- gtk_widget_show (pop);
-
-
- if (getenv ("GAL_E_ENTRY_NO_GRABS_HACK") == NULL && !entry->priv->ptr_grab) {
- entry->priv->ptr_grab = (0 == gdk_pointer_grab (GTK_WIDGET (entry->priv->completion_view)->window, TRUE,
- grab_mask, NULL, NULL, GDK_CURRENT_TIME));
- if (entry->priv->ptr_grab) {
- gtk_grab_add (GTK_WIDGET (entry->priv->completion_view));
- }
- }
-
-
- } else {
-
- gtk_widget_hide (pop);
-
- if (entry->priv->ptr_grab) {
- gdk_pointer_ungrab (GDK_CURRENT_TIME);
- gtk_grab_remove (GTK_WIDGET (entry->priv->completion_view));
- }
-
- entry->priv->ptr_grab = FALSE;
-
- entry->priv->last_completion_pos = -1;
- }
-
- e_completion_view_set_editable (E_COMPLETION_VIEW (entry->priv->completion_view), visible);
-
- if (entry->priv->popup_is_visible != visible) {
- entry->priv->popup_is_visible = visible;
- 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;
-
- e_entry_cancel_delayed_completion (entry);
-
- if (e_entry_is_empty (entry))
- return;
-
- e_completion_begin_search (entry->priv->completion,
- e_entry_get_text (entry),
- entry->priv->last_completion_pos = e_entry_get_position (entry),
- 0); /* No limit. Probably a bad idea. */
-}
-
-static gboolean
-start_delayed_cb (gpointer user_data)
-{
- EEntry *entry = E_ENTRY (user_data);
- entry->priv->completion_delay_tag = 0;
- e_entry_start_completion (entry);
- return FALSE;
-}
-
-static void
-e_entry_start_delayed_completion (EEntry *entry, gint delay)
-{
- if (delay < 0)
- return;
-
- e_entry_cancel_delayed_completion (entry);
- entry->priv->completion_delay_tag = gtk_timeout_add (MAX (delay, 1), start_delayed_cb, entry);
-}
-
-static void
-e_entry_cancel_delayed_completion (EEntry *entry)
-{
- if (entry->priv->completion == NULL)
- return;
-
- if (entry->priv->completion_delay_tag) {
- gtk_timeout_remove (entry->priv->completion_delay_tag);
- entry->priv->completion_delay_tag = 0;
- }
-}
-
-static void
-nonempty_cb (ECompletionView *view, gpointer user_data)
-{
- EEntry *entry = E_ENTRY (user_data);
-
- e_entry_show_popup (entry, TRUE);
-}
-
-static void
-added_cb (ECompletionView *view, gpointer user_data)
-{
- EEntry *entry = E_ENTRY (user_data);
- e_entry_refresh_popup (entry);
-}
-
-static void
-full_cb (ECompletionView *view, gpointer user_data)
-{
- EEntry *entry = E_ENTRY (user_data);
- gboolean show;
-
- show = GTK_WIDGET_HAS_FOCUS (GTK_WIDGET (entry->canvas)) && view->choices->len > 0;
- e_entry_show_popup (entry, show);
-}
-
-static void
-browse_cb (ECompletionView *view, ECompletionMatch *match, gpointer user_data)
-{
- EEntry *entry = E_ENTRY (user_data);
-
- if (match == NULL) {
- /* Requesting a completion. */
- e_entry_start_completion (entry);
- return;
- }
-
- if (entry->priv->pre_browse_text == NULL)
- entry->priv->pre_browse_text = g_strdup (e_entry_get_text (entry));
-
- /* If there is no other handler in place, echo the selected completion in
- the entry. */
- if (entry->priv->handler == NULL)
- e_entry_set_text_quiet (entry, e_completion_match_get_match_text (match));
-}
-
-static void
-unbrowse_cb (ECompletionView *view, gpointer user_data)
-{
- EEntry *entry = E_ENTRY (user_data);
-
- if (entry->priv->pre_browse_text) {
-
- if (entry->priv->handler == NULL)
- e_entry_set_text_quiet (entry, entry->priv->pre_browse_text);
-
- g_free (entry->priv->pre_browse_text);
- entry->priv->pre_browse_text = NULL;
- }
-
- e_entry_show_popup (entry, FALSE);
-}
-
-static void
-activate_cb (ECompletionView *view, ECompletionMatch *match, gpointer user_data)
-{
- EEntry *entry = E_ENTRY (user_data);
-
- e_entry_cancel_delayed_completion (entry);
-
- g_free (entry->priv->pre_browse_text);
- entry->priv->pre_browse_text = NULL;
- e_entry_show_popup (entry, FALSE);
-
- if (entry->priv->handler)
- entry->priv->handler (entry, match);
- else
- e_entry_set_text (entry, match->match_text);
-
- e_entry_cancel_delayed_completion (entry);
-}
-
-void
-e_entry_enable_completion (EEntry *entry, ECompletion *completion)
-{
- g_return_if_fail (entry != NULL && E_IS_ENTRY (entry));
- g_return_if_fail (completion != NULL && E_IS_COMPLETION (completion));
-
- e_entry_enable_completion_full (entry, completion, -1, NULL);
-}
-
-static void
-button_press_cb (GtkWidget *w, GdkEvent *ev, gpointer user_data)
-{
- EEntry *entry = E_ENTRY (user_data);
- GtkWidget *child;
-
- /* Bail out if our click happened inside of our widget. */
- child = gtk_get_event_widget (ev);
- if (child != w) {
- while (child) {
- if (child == w)
- return;
- child = child->parent;
- }
- }
-
- /* Treat this as an unbrowse */
- unbrowse_cb (E_COMPLETION_VIEW (w), entry);
-}
-
-static void
-cancel_completion_cb (ETextModel *model, gpointer user_data)
-{
- EEntry *entry = E_ENTRY (user_data);
-
- /* If we get the signal from the underlying text model, unbrowse.
- This usually means that the text model itself has done some
- sort of completion, or has otherwise transformed its contents
- in some way that would render any previous completion invalid. */
- unbrowse_cb (E_COMPLETION_VIEW (entry->priv->completion_view), entry);
-}
-
-static gint
-key_press_cb (GtkWidget *w, GdkEventKey *ev, gpointer user_data)
-{
- gint rv = 0;
- /* Forward signal */
- 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->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);
-
- if (entry->priv->ptr_grab)
- gdk_pointer_ungrab (GDK_CURRENT_TIME);
-
- 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_POPUP] =
- g_signal_new ("popup",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (EEntryClass, popup),
- NULL, NULL,
- e_marshal_NONE__POINTER_INT,
- G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_INT);
-
- 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_pointer ("fill_color_gdk",
- _( "GDK fill color" ),
- _( "GDK fill 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 8c1093638b..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 (* popup) (EEntry *entry, GdkEventButton *ev, gint pos);
- void (* completion_popup) (EEntry *entry, gint visible);
-};
-
-GtkType e_entry_get_type (void);
-
-void e_entry_construct (EEntry *entry);
-GtkWidget *e_entry_new (void);
-
-const gchar *e_entry_get_text (EEntry *entry);
-void e_entry_set_text (EEntry *entry, const gchar *text);
-
-gint e_entry_get_position (EEntry *entry);
-void e_entry_set_position (EEntry *entry, gint);
-void e_entry_select_region (EEntry *entry, gint start, gint end);
-
-void e_entry_set_editable (EEntry *entry, gboolean editable);
-
-void e_entry_enable_completion (EEntry *entry, ECompletion *completion);
-void e_entry_enable_completion_full (EEntry *entry, ECompletion *completion, gint autocomplete_delay,
- EEntryCompletionHandler handler);
-gboolean e_entry_completion_popup_is_visible (EEntry *entry);
-
-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 2dcbddbaf6..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_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 0233f14aa7..0000000000
--- a/widgets/text/e-text-model.c
+++ /dev/null
@@ -1,633 +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"
-
-#define MAX_LENGTH (2047)
-
-enum {
- E_TEXT_MODEL_CHANGED,
- E_TEXT_MODEL_REPOSITION,
- E_TEXT_MODEL_OBJECT_ACTIVATED,
- E_TEXT_MODEL_CANCEL_COMPLETION,
- E_TEXT_MODEL_LAST_SIGNAL
-};
-
-static guint e_text_model_signals[E_TEXT_MODEL_LAST_SIGNAL] = { 0 };
-
-struct _ETextModelPrivate {
- gchar *text;
- gint len;
-};
-
-static void e_text_model_class_init (ETextModelClass *class);
-static void e_text_model_init (ETextModel *model);
-static void e_text_model_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_strdup ("");
- model->priv->len = 0;
-}
-
-/* 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_free (model->priv->text);
-
- 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;
-
- if (pos < 0)
- pos = 0;
- else if (pos > ( len = e_text_model_get_text_length (model) ))
- pos = len;
-
- return pos;
-}
-
-static const gchar *
-e_text_model_real_get_text (ETextModel *model)
-{
- if (model->priv->text)
- return model->priv->text;
- else
- return "";
-}
-
-static gint
-e_text_model_real_get_text_length (ETextModel *model)
-{
- if (model->priv->len < 0)
- model->priv->len = strlen (e_text_model_get_text (model));
-
- return model->priv->len;
-}
-
-static void
-e_text_model_real_set_text (ETextModel *model, const gchar *text)
-{
- EReposAbsolute repos;
- gboolean changed = FALSE;
-
- if (text == NULL) {
-
- changed = (model->priv->text != NULL);
-
- g_free (model->priv->text);
- model->priv->text = NULL;
- model->priv->len = -1;
-
- } else if (model->priv->text == NULL || strcmp (model->priv->text, text)) {
-
- g_free (model->priv->text);
- model->priv->text = g_strndup (text, MAX_LENGTH);
- model->priv->len = -1;
-
- changed = TRUE;
- }
-
- if (changed) {
- e_text_model_changed (model);
- repos.model = model;
- repos.pos = -1;
- e_text_model_reposition (model, e_repos_absolute, &repos);
- }
-}
-
-static void
-e_text_model_real_insert (ETextModel *model, gint position, const gchar *text)
-{
- EReposInsertShift repos;
- gchar *new_text;
- gint length;
-
- if (model->priv->len < 0)
- e_text_model_real_get_text_length (model);
- length = strlen(text);
-
- if (length + model->priv->len > MAX_LENGTH)
- length = MAX_LENGTH - model->priv->len;
- if (length <= 0)
- return;
-
- /* Can't use g_strdup_printf here because on some systems
- printf ("%.*s"); is locale dependent. */
- new_text = e_strdup_append_strings (model->priv->text, position,
- text, length,
- model->priv->text + position, -1,
- NULL);
-
- if (model->priv->text)
- g_free (model->priv->text);
-
- model->priv->text = new_text;
-
- if (model->priv->len >= 0)
- model->priv->len += length;
-
- e_text_model_changed (model);
-
- repos.model = model;
- repos.pos = position;
- repos.len = length;
-
- e_text_model_reposition (model, e_repos_insert_shift, &repos);
-}
-
-static void
-e_text_model_real_insert_length (ETextModel *model, gint position, const gchar *text, gint length)
-{
- EReposInsertShift repos;
- gchar *new_text;
-
- if (model->priv->len < 0)
- e_text_model_real_get_text_length (model);
-
- if (length + model->priv->len > MAX_LENGTH)
- length = MAX_LENGTH - model->priv->len;
- if (length <= 0)
- return;
-
- /* Can't use g_strdup_printf here because on some systems
- printf ("%.*s"); is locale dependent. */
- new_text = e_strdup_append_strings (model->priv->text, position,
- text, length,
- model->priv->text + position, -1,
- NULL);
-
- if (model->priv->text)
- g_free (model->priv->text);
- model->priv->text = new_text;
-
- if (model->priv->len >= 0)
- model->priv->len += length;
-
- e_text_model_changed (model);
-
- repos.model = model;
- repos.pos = position;
- repos.len = length;
-
- e_text_model_reposition (model, e_repos_insert_shift, &repos);
-}
-
-static void
-e_text_model_real_delete (ETextModel *model, gint position, gint length)
-{
- EReposDeleteShift repos;
-
- memmove (model->priv->text + position, model->priv->text + position + length, strlen (model->priv->text + position + length) + 1);
-
- if (model->priv->len >= 0)
- model->priv->len -= length;
-
- e_text_model_changed (model);
-
- repos.model = model;
- repos.pos = position;
- repos.len = length;
-
- e_text_model_reposition (model, e_repos_delete_shift, &repos);
-}
-
-void
-e_text_model_changed (ETextModel *model)
-{
- g_return_if_fail (model != NULL);
- g_return_if_fail (E_IS_TEXT_MODEL (model));
-
- /*
- Objectify before emitting any signal.
- While this method could, in theory, do pretty much anything, it is meant
- for scanning objects and converting substrings into embedded objects.
- */
- if (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 ? strlen (str) : 0;
- if (len != len)
- g_error ("\"%s\" length reported as %d, not %d.", str, len, len2);
-#endif
-
- return len;
-
- } else {
- /* Calculate length the old-fashioned way... */
- const gchar *str = e_text_model_get_text (model);
- return str ? strlen (str) : 0;
- }
-}
-
-void
-e_text_model_set_text (ETextModel *model, const gchar *text)
-{
- g_return_if_fail (model != NULL);
- g_return_if_fail (E_IS_TEXT_MODEL (model));
-
- if (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);
-
- return obj ? g_strndup (obj, n) : NULL;
-}
-
-void
-e_text_model_get_nth_object_bounds (ETextModel *model, gint n, gint *start, gint *end)
-{
- const gchar *txt = NULL, *obj = NULL;
- gint len = 0;
-
- g_return_if_fail (model != NULL);
- g_return_if_fail (E_IS_TEXT_MODEL (model));
-
- txt = e_text_model_get_text (model);
- obj = e_text_model_get_nth_object (model, n, &len);
-
- g_return_if_fail (obj != NULL);
-
- if (start)
- *start = obj - txt;
- if (end)
- *end = obj - txt + len;
-}
-
-gint
-e_text_model_get_object_at_offset (ETextModel *model, gint offset)
-{
- g_return_val_if_fail (model != NULL, -1);
- g_return_val_if_fail (E_IS_TEXT_MODEL (model), -1);
-
- if (offset < 0 || offset >= e_text_model_get_text_length (model))
- return -1;
-
- /* If an optimized version has been provided, we use it. */
- if (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 28af5edc20..0000000000
--- a/widgets/text/e-text.c
+++ /dev/null
@@ -1,3876 +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 <gtk/gtkinvisible.h>
-#include <gtk/gtkmain.h>
-#include <gtk/gtkselection.h>
-#include <gtk/gtkwindow.h>
-#include <gtk/gtktypebuiltins.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>
-
-#define PARENT_TYPE (gnome_canvas_item_get_type())
-
-#define BORDER_INDENT 4
-#define d(x)
-
-enum {
- E_TEXT_CHANGED,
- E_TEXT_ACTIVATE,
- E_TEXT_KEYPRESS,
- E_TEXT_POPUP,
- E_TEXT_STYLE_SET,
- E_TEXT_LAST_SIGNAL
-};
-
-static GQuark e_text_signals[E_TEXT_LAST_SIGNAL] = { 0 };
-
-
-
-/* This defines a line of text */
-struct line {
- const char *text; /* Line's text, it is a pointer into the text->text string */
- int length; /* Line's length IN BYTES */
- int width; /* Line's width in pixels */
- int ellipsis_length; /* Length before adding ellipsis */
-};
-
-/* Object argument IDs */
-enum {
- PROP_0,
- PROP_MODEL,
- PROP_EVENT_PROCESSOR,
- PROP_TEXT,
- PROP_FONT,
- PROP_FONTSET,
- PROP_FONT_GDK,
- PROP_FONT_E,
- 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
-};
-
-
-enum {
- E_SELECTION_PRIMARY,
- E_SELECTION_CLIPBOARD
-};
-enum _TargetInfo {
- TARGET_UTF8_STRING,
- TARGET_UTF8,
- TARGET_COMPOUND_TEXT,
- TARGET_STRING,
- TARGET_TEXT
-};
-
-
-static void e_text_command(ETextEventProcessor *tep, ETextEventProcessorCommand *command, gpointer data);
-
-static void e_text_get_selection(EText *text, GdkAtom selection, guint32 time);
-static void e_text_supply_selection (EText *text, guint time, GdkAtom selection, guchar *data, gint length);
-
-static void e_text_text_model_changed(ETextModel *model, EText *text);
-static void e_text_text_model_reposition (ETextModel *model, ETextModelReposFn fn, gpointer repos_data, gpointer data);
-
-static void _get_tep(EText *text);
-
-static GtkWidget *e_text_get_invisible(EText *text);
-static void _selection_clear_event (GtkInvisible *invisible,
- GdkEventSelection *event,
- EText *text);
-static void _selection_get (GtkInvisible *invisible,
- GtkSelectionData *selection_data,
- guint info,
- guint time_stamp,
- EText *text);
-static void _selection_received (GtkInvisible *invisible,
- GtkSelectionData *selection_data,
- guint time,
- EText *text);
-
-#if 0
-static ETextSuckFont *e_suck_font (GdkFont *font);
-static void e_suck_font_free (ETextSuckFont *suckfont);
-#endif
-
-static void e_text_free_lines(EText *text);
-
-static gint text_width_with_objects (EText *etext,
- EFont *font, EFontStyle style,
- const gchar *text, gint bytelen);
-
-static void calc_height (EText *text);
-static void calc_line_widths (EText *text);
-static void split_into_lines (EText *text);
-
-static GnomeCanvasItemClass *parent_class;
-static GdkAtom clipboard_atom = GDK_NONE;
-
-
-
-/* Destroy 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_line_widths = 1;
- text->needs_calc_height = 1;
- }
- e_canvas_item_request_reflow (GNOME_CANVAS_ITEM (text));
-}
-
-static void
-e_text_destroy (GtkObject *object)
-{
- EText *text;
-
- g_return_if_fail (object != NULL);
- g_return_if_fail (E_IS_TEXT (object));
-
- text = E_TEXT (object);
-
- if (text->tooltip_owner)
- e_canvas_hide_tooltip (E_CANVAS(GNOME_CANVAS_ITEM(text)->canvas));
- 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;
-
- if (text->invisible)
- g_object_unref (text->invisible);
- text->invisible = NULL;
-
- g_free (text->lines);
- text->lines = NULL;
-
- g_free (text->primary_selection);
- text->primary_selection = NULL;
-
- g_free (text->clipboard_selection);
- text->clipboard_selection = NULL;
-
- g_free (text->revert);
- text->revert = NULL;
-
- if (text->font)
- e_font_unref (text->font);
- text->font = NULL;
-
-#if 0
- if (text->suckfont)
- e_suck_font_free (text->suckfont);
-#endif
-
- if (text->stipple)
- gdk_bitmap_unref (text->stipple);
- 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 (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (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 = start_pos;
- attr->end_index = end_pos;
-
- 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
-reset_layout (EText *text)
-{
- if (text->layout == NULL)
- return;
- pango_layout_set_text (text->layout, text->text, -1);
- reset_layout_attrs (text);
-}
-
-static void
-e_text_text_model_changed (ETextModel *model, EText *text)
-{
- gint model_len = e_text_model_get_text_length (model);
- text->text = e_text_model_get_text(model);
- e_text_free_lines(text);
-
- /* Make sure our selection doesn't extend past the bounds of our text. */
- text->selection_start = CLAMP (text->selection_start, 0, model_len);
- text->selection_end = CLAMP (text->selection_end, 0, model_len);
-
- text->needs_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)
-{
- if (text->font)
- text->ellipsis_width =
- e_font_utf8_text_width (text->font, text->style,
- text->ellipsis ? text->ellipsis : "...",
- text->ellipsis ? strlen (text->ellipsis) : 3);
-}
-
-/* Calculates the line widths (in pixels) of the text's splitted lines */
-static void
-calc_line_widths (EText *text)
-{
- struct line *lines;
- int i;
- gdouble clip_width;
- const gchar *p;
-
- lines = text->lines;
- text->max_width = 0;
-
- clip_width = text->clip_width;
- if (clip_width >= 0 && text->draw_borders) {
- clip_width -= 6;
- if (clip_width < 0)
- clip_width = 0;
- }
-
-
- if (!lines)
- return;
-
- for (i = 0; i < text->num_lines; i++) {
- if (lines->length != 0) {
- if (text->font) {
- lines->width = text_width_with_objects (text,
- text->font, text->style,
- lines->text, lines->length);
- lines->ellipsis_length = 0;
- } else {
- lines->width = 0;
- }
-
- if (text->clip &&
- text->use_ellipsis &&
- ! text->editing &&
- lines->width > clip_width &&
- clip_width >= 0) {
- if (text->font) {
- lines->ellipsis_length = 0;
- for (p = lines->text;
- p && *p && g_unichar_validate (g_utf8_get_char (p)) && (p - lines->text) < lines->length;
- p = g_utf8_next_char (p)) {
- gint text_width = text_width_with_objects (text,
- text->font, text->style,
- lines->text, p - lines->text);
- if (clip_width >= text_width + text->ellipsis_width)
- lines->ellipsis_length = p - lines->text;
- else
- break;
- }
- }
- else
- lines->ellipsis_length = 0;
- lines->width = text_width_with_objects (text,
- text->font, text->style,
- lines->text, lines->ellipsis_length) +
- text->ellipsis_width;
- } else
- lines->ellipsis_length = lines->length;
-
- if (lines->width > text->max_width)
- text->max_width = lines->width;
- }
-
- lines++;
- }
-}
-
-static void
-e_text_free_lines(EText *text)
-{
- if (text->lines)
- g_free (text->lines);
-
- text->lines = NULL;
- text->num_lines = 0;
-}
-
-static gint
-text_width_with_objects (EText *etext,
- EFont *font, EFontStyle style,
- const gchar *text, gint numbytes)
-{
-#warning "AIEEEE FIX ME. a pango layout per refresh sucks"
- PangoLayout *tmp_layout = gtk_widget_create_pango_layout (GTK_WIDGET (GNOME_CANVAS_ITEM (etext)->canvas),
- text);
- int width;
-
- pango_layout_get_pixel_size (tmp_layout, &width, NULL);
-
- g_object_unref (tmp_layout);
-
- return width;
-}
-
-typedef void (*LineSplitterFn) (int line_num, const char *start, int length, gpointer user_data);
-
-#define IS_BREAK_CHAR(break_chars, c) (g_unichar_isspace (c) || ((break_chars) && g_utf8_strchr ((break_chars), -1, (c))))
-
-static gint
-line_splitter (EText *etext, EFont *font, EFontStyle style,
- const char *break_characters,
- gboolean wrap_lines, double clip_width, double clip_height,
- gint max_lines, LineSplitterFn split_cb, gpointer user_data)
-{
- ETextModel *model = etext->model;
- const char *curr;
- const char *text;
- const char *linestart;
- const char *last_breakpoint;
- gint line_count = 0;
-
- gunichar unival;
-
- if (max_lines < 1)
- max_lines = G_MAXINT;
- if (clip_height != -1)
- max_lines = CLAMP (max_lines, 1, clip_height / e_font_height (font));
-
- text = e_text_model_get_text (model);
- linestart = NULL;
- last_breakpoint = text;
-
- for (curr = text; curr && *curr && line_count < max_lines; curr = g_utf8_next_char (curr)) {
-
- unival = g_utf8_get_char (curr);
-
- if (linestart == NULL)
- linestart = curr;
-
- if (unival == '\n') { /* We always break on newline */
-
- if (split_cb)
- split_cb (line_count, linestart, curr - linestart, user_data);
- ++line_count;
- linestart = NULL;
-
- } else if (wrap_lines) {
-
- if (clip_width < text_width_with_objects (etext, font, style, linestart, curr - linestart)
- && last_breakpoint > linestart) {
-
- /* Don't use break point if we are on the last usable line */
- if (split_cb && line_count < max_lines - 1)
- split_cb (line_count, linestart, last_breakpoint - linestart, user_data);
- else if (split_cb)
- split_cb (line_count, linestart, strlen (linestart), user_data);
-
- ++line_count;
- linestart = NULL;
- curr = last_breakpoint;
-
- } else if (IS_BREAK_CHAR (break_characters, unival)
- && e_text_model_get_object_at_pointer (model, curr) == -1) { /* don't break mid-object */
- last_breakpoint = curr;
- }
- }
- }
-
- /* Handle any leftover text. */
- if (linestart) {
- if (split_cb)
- split_cb (line_count, linestart, strlen (linestart), user_data);
- ++line_count;
-
- }
-
- if (line_count == 0) {
- if (split_cb)
- split_cb (0, text, strlen (text), user_data);
- line_count ++;
- }
-
- return line_count;
-}
-
-static void
-line_split_cb (int line_num, const char *start, int length, gpointer user_data)
-{
- EText *text = user_data;
- struct line *line = &((struct line *)text->lines)[line_num];
-
- line->text = start;
- line->length = length;
-}
-
-static void
-split_into_lines (EText *text)
-{
- /* Free old array of lines */
- e_text_free_lines (text);
-
- /* First, count the number of lines */
- text->num_lines = line_splitter (text, text->font, text->style,
- text->break_characters,
- text->line_wrap, text->clip_width, text->clip_height,
- -1, NULL, NULL);
-
- /* Allocate our array of lines */
- text->lines = g_new0 (struct line, text->num_lines);
-
- text->num_lines = line_splitter (text, text->font, text->style,
- text->break_characters,
- text->line_wrap, text->clip_width, text->clip_height,
- text->num_lines, line_split_cb, text);
-}
-
-/* Convenience function to set the text's GC's foreground color */
-static void
-set_text_gc_foreground (EText *text)
-{
- if (!text->gc)
- return;
-
- gdk_gc_set_foreground (text->gc, &text->color);
-}
-
-/* Sets the stipple pattern for the text */
-static void
-set_stipple (EText *text, GdkBitmap *stipple, int reconfigure)
-{
- if (text->stipple && !reconfigure)
- gdk_bitmap_unref (text->stipple);
-
- text->stipple = stipple;
- if (stipple && !reconfigure)
- gdk_bitmap_ref (stipple);
-
- if (text->gc) {
- if (stipple) {
- gdk_gc_set_stipple (text->gc, stipple);
- gdk_gc_set_fill (text->gc, GDK_STIPPLED);
- } else
- gdk_gc_set_fill (text->gc, GDK_SOLID);
- }
-}
-
-/* Set_arg handler for the text item */
-static void
-e_text_set_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);
-
- e_text_free_lines(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_FONT:
- if (text->font)
- e_font_unref (text->font);
-
- text->font = e_font_from_gdk_name (g_value_get_string (value));
-
- calc_ellipsis (text);
- if ( text->line_wrap )
- text->needs_split_into_lines = 1;
- else {
- text->needs_calc_line_widths = 1;
- text->needs_calc_height = 1;
- }
- needs_reflow = 1;
- break;
-
- case PROP_FONTSET:
- if (text->font)
- e_font_unref (text->font);
-
- text->font = e_font_from_gdk_name (g_value_get_string (value));
-
- calc_ellipsis (text);
- if ( text->line_wrap )
- text->needs_split_into_lines = 1;
- else {
- text->needs_calc_line_widths = 1;
- text->needs_calc_height = 1;
- }
- needs_reflow = 1;
- break;
-
- case PROP_FONT_GDK:
- /* Ref the font in case it was the font that is stored
- in the e-font */
- gdk_font_ref (g_value_get_boxed (value));
- if (text->font)
- e_font_unref (text->font);
-
- text->font = e_font_from_gdk_font (g_value_get_boxed (value));
-
- calc_ellipsis (text);
- if ( text->line_wrap )
- text->needs_split_into_lines = 1;
- else {
- text->needs_calc_line_widths = 1;
- text->needs_calc_height = 1;
- }
- needs_reflow = 1;
- break;
-
- case PROP_FONT_E:
- if (text->font)
- e_font_unref (text->font);
-
- text->font = g_value_get_pointer (value);
- e_font_ref (text->font);
-
- calc_ellipsis (text);
- if (text->line_wrap)
- text->needs_split_into_lines = 1;
- else {
- text->needs_calc_line_widths = 1;
- text->needs_calc_height = 1;
- }
- needs_reflow = 1;
- break;
-
- case PROP_BOLD:
- text->bold = g_value_get_boolean (value);
- text->style = text->bold ? E_FONT_BOLD : E_FONT_PLAIN;
-
- text->needs_redraw = 1;
- text->needs_recalc_bounds = 1;
- if ( text->line_wrap )
- text->needs_split_into_lines = 1;
- else {
- text->needs_calc_line_widths = 1;
- text->needs_calc_height = 1;
- }
- needs_update = 1;
- needs_reflow = 1;
- break;
-
- case 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->layout) {
- pango_layout_set_width (text->layout, text->clip_width < 0 ? -1 : text->clip_width * PANGO_SCALE);
- }
- if ( text->line_wrap )
- text->needs_split_into_lines = 1;
- else {
- text->needs_calc_line_widths = 1;
- text->needs_calc_height = 1;
- }
- needs_reflow = 1;
- break;
-
- case PROP_CLIP_HEIGHT:
- text->clip_height = fabs (g_value_get_double (value));
- text->needs_recalc_bounds = 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_line_widths = 1;
- 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);
- text->needs_calc_line_widths = 1;
- 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);
- text->needs_calc_line_widths = 1;
- needs_reflow = 1;
- break;
-
- case PROP_LINE_WRAP:
- text->line_wrap = g_value_get_boolean (value);
- 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 )
- text->needs_split_into_lines = 1;
- else {
- text->needs_calc_line_widths = 1;
- 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;
- }
-
- 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_FONT_E:
- g_value_set_pointer (value, text->font);
- 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;
-
- 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_line_widths = 1;
- text->needs_calc_height = 1;
- }
-
- if ( text->needs_calc_line_widths ) {
- int x;
- int i;
- struct line *lines;
- gdouble clip_width;
- calc_line_widths (text);
- text->needs_calc_line_widths = 0;
- text->needs_redraw = 1;
-
- lines = text->lines;
- if ( !lines )
- return;
-
- for (lines = text->lines, i = 0; i < text->num_lines ; i++, lines ++) {
- if ((lines->text - text->text) > text->selection_end) {
- break;
- }
- }
- lines --;
- i--;
- x = text_width_with_objects (text,
- text->font, text->style,
- lines->text,
- text->selection_end - (lines->text - text->text));
-
- if (x < text->xofs_edit) {
- text->xofs_edit = x;
- }
-
- clip_width = text->clip_width;
- if (clip_width >= 0 && text->draw_borders) {
- clip_width -= 6;
- if (clip_width < 0)
- clip_width = 0;
- }
-
- if (2 + x - clip_width > text->xofs_edit) {
- text->xofs_edit = 2 + x - clip_width;
- }
-
- if (e_font_height (text->font) * i < text->yofs_edit)
- text->yofs_edit = e_font_height (text->font) * i;
-
- if ( text->needs_calc_height ) {
- calc_height (text);
- gnome_canvas_item_request_update(item);
- text->needs_calc_height = 0;
- text->needs_recalc_bounds = 1;
- }
-
- if (e_font_height (text->font) * (i + 1) -
- (text->clip_height != -1 ? text->clip_height : text->height) > text->yofs_edit)
- text->yofs_edit = e_font_height (text->font) * (i + 1) -
- (text->clip_height != -1 ? text->clip_height : text->height);
-
- gnome_canvas_item_request_update (item);
- }
- if ( text->needs_calc_height ) {
- calc_height (text);
- gnome_canvas_item_request_update(item);
- text->needs_calc_height = 0;
- text->needs_recalc_bounds = 1;
- }
-}
-
-/* Update handler for the text item */
-static void
-e_text_update (GnomeCanvasItem *item, double *affine, ArtSVP *clip_path, int flags)
-{
- EText *text;
- double x1, y1, x2, y2;
-
- 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);
-
- text->layout = gtk_widget_create_pango_layout (GTK_WIDGET (item->canvas), text->text);
- pango_layout_set_width (text->layout, text->clip_width < 0 ? -1 : text->clip_width * PANGO_SCALE);
- reset_layout_attrs (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);
- if (text->font == NULL) {
- gdk_font_ref (gtk_style_get_font (GTK_WIDGET (item->canvas)->style));
- text->font = e_font_from_gdk_font (gtk_style_get_font (GTK_WIDGET (item->canvas)->style));
- }
-}
-
-/* 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;
- g_object_unref (text->layout);
- text->layout = 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 (2 + y2 - clip_height > new_yofs_edit)
- new_yofs_edit = 2 + 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){
-
- if (text->editing) {
- thisx += 1;
- thisy += 1;
- thiswidth -= 2;
- thisheight -= 2;
- }
-
- gtk_paint_shadow (widget->style, drawable,
- GTK_STATE_NORMAL, GTK_SHADOW_IN,
- NULL, widget, "entry",
- thisx, thisy, thiswidth, thisheight);
-
- if (text->editing) {
- thisx -= 1;
- thisy -= 1;
- thiswidth += 2;
- thisheight += 2;
- /*
- * Chris: I am here "filling in" for the additions
- * and substractions done in the previous if (text->editing).
- * but you might have other plans for this. Please enlighten
- * me as to whether it should be:
- * thiswidth + 2 or thiswidth + 1.
- */
- gtk_paint_focus (widget->style, drawable, GTK_STATE_NORMAL,
- NULL, widget, "entry",
- thisx, thisy, thiswidth - 1, thisheight - 1);
- }
- }
-
- if (text->draw_background) {
- gtk_paint_flat_box (widget->style, drawable,
- GTK_WIDGET_STATE(widget), GTK_SHADOW_NONE,
- NULL, widget, "entry_bg",
- thisx + widget->style->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 || !text->font)
- return;
-
- clip_rect = NULL;
- if (text->clip) {
- rect.x = text->clip_cx - x;
- rect.y = text->clip_cy - y;
- rect.width = text->clip_cwidth;
- rect.height = text->clip_cheight;
-
- gdk_gc_set_clip_rectangle (main_gc, &rect);
- clip_rect = &rect;
- }
-
- if (text->stipple)
- gnome_canvas_set_stipple_origin (item->canvas, main_gc);
-
- xpos = text->text_cx;
- ypos = text->text_cy;
-
- xpos -= x;
- ypos -= y;
-
- 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) {
- int start_index, end_index;
- PangoLayoutLine *line;
- gint *ranges;
- gint n_ranges, i;
- PangoRectangle logical_rect;
- GdkRegion *clip_region = gdk_region_new ();
- GdkGC *selection_gc;
- GdkGC *text_gc;
-
- start_index = MIN (text->selection_start, text->selection_end);
- end_index = text->selection_start ^ text->selection_end ^ start_index;
-
- 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);
-
- line = pango_layout_get_lines (text->layout)->data;
-
- pango_layout_line_get_x_ranges (line, start_index, end_index, &ranges, &n_ranges);
-
- pango_layout_get_extents (text->layout, NULL, &logical_rect);
-
- for (i=0; i < n_ranges; i++) {
- GdkRectangle sel_rect;
-
- sel_rect.x = xpos + ranges[2*i] / PANGO_SCALE;
- sel_rect.y = ypos;
- 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);
- }
-
- 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);
- g_free (ranges);
- } else {
- if (text->show_cursor) {
- PangoRectangle strong_pos, weak_pos;
- pango_layout_get_cursor_pos (text->layout, text->selection_start, &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);
- }
-}
-
-/* Render handler for the text item */
-static void
-e_text_render (GnomeCanvasItem *item, GnomeCanvasBuf *buf)
-{
-}
-
-/* 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_offset_to_pointer (text->text + index, trailing) - text->text;
-}
-
-#define SCROLL_WAIT_TIME 30000
-
-static gboolean
-_blink_scroll_timeout (gpointer data)
-{
- EText *text = E_TEXT(data);
- gulong current_time;
- gboolean scroll = FALSE;
- gboolean redraw = FALSE;
-
- g_timer_elapsed(text->timer, &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)
-{
- EText *text = E_TEXT (data);
- struct line *lines;
- GtkWidget *canvas;
- int i;
- gdouble max_width;
- gboolean cut_off;
- double i2c[6];
- ArtPoint origin = {0, 0};
- ArtPoint pixel_origin;
- int canvas_x, canvas_y;
- GnomeCanvasItem *tooltip_text;
- double tooltip_width;
- double tooltip_height;
- double tooltip_x;
- double tooltip_y;
-#if 0
- double x1, x2, y1, y2;
-#endif
- GnomeCanvasItem *rect;
- GtkWidget *tooltip_window; /* GtkWindow for displaying the tooltip */
-
- text->tooltip_count = 0;
-
- lines = text->lines;
-
- if (E_CANVAS(GNOME_CANVAS_ITEM(text)->canvas)->tooltip_window || text->editing || (!lines)) {
- text->tooltip_timeout = 0;
- return FALSE;
- }
-
- cut_off = FALSE;
- for ( lines = text->lines, i = 0; i < text->num_lines; lines++, i++ ) {
- if (lines->length > lines->ellipsis_length) {
- cut_off = TRUE;
- break;
- }
- }
- if ( ! cut_off ) {
- text->tooltip_timeout = 0;
- return FALSE;
- }
-
- gnome_canvas_item_i2c_affine(GNOME_CANVAS_ITEM(text), i2c);
- art_affine_point (&pixel_origin, &origin, i2c);
-
- gdk_window_get_origin (GTK_WIDGET(GNOME_CANVAS_ITEM(text)->canvas)->window, &canvas_x, &canvas_y);
- pixel_origin.x += canvas_x;
- pixel_origin.y += canvas_y;
- pixel_origin.x -= (int) gtk_layout_get_hadjustment(GTK_LAYOUT(GNOME_CANVAS_ITEM(text)->canvas))->value;
- pixel_origin.y -= (int) gtk_layout_get_vadjustment(GTK_LAYOUT(GNOME_CANVAS_ITEM(text)->canvas))->value;
-
- tooltip_window = gtk_window_new (GTK_WINDOW_POPUP);
- gtk_container_set_border_width (GTK_CONTAINER (tooltip_window), 1);
-
- canvas = e_canvas_new ();
-
- gtk_container_add (GTK_CONTAINER (tooltip_window), canvas);
-
- /* Get the longest line length */
- max_width = 0.0;
- for (lines = text->lines, i = 0; i < text->num_lines; lines++, i++) {
- gdouble line_width;
-
- line_width = text_width_with_objects (text, text->font, text->style, lines->text, lines->length);
- max_width = MAX (max_width, line_width);
- }
-
- rect = gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS (canvas)),
- gnome_canvas_rect_get_type (),
- "x1", (double) 0,
- "y1", (double) 0,
- "x2", (double) max_width + 4,
- "y2", (double) text->height + 4,
- "fill_color", "light gray",
- NULL);
-
- tooltip_text = gnome_canvas_item_new (gnome_canvas_root (GNOME_CANVAS (canvas)),
- e_text_get_type (),
- "anchor", GTK_ANCHOR_NW,
- "bold", text->bold,
- "strikeout", text->strikeout,
- "font_e", text->font,
- "text", text->text,
- "editable", FALSE,
- "clip_width", text->max_lines != 1 ? text->clip_width : max_width,
- "clip_height", text->max_lines != 1 ? -1 : (double)text->height,
- "clip", TRUE,
- "line_wrap", text->line_wrap,
- "justification", text->justification,
- NULL);
-
-
-
- if (text->draw_borders)
- e_canvas_item_move_absolute(tooltip_text, 1 + BORDER_INDENT, 1 + BORDER_INDENT);
- else
- e_canvas_item_move_absolute(tooltip_text, 1, 1);
-
-
- split_into_lines (E_TEXT(tooltip_text));
- calc_height (E_TEXT(tooltip_text));
- calc_line_widths (E_TEXT(tooltip_text));
- gnome_canvas_item_set (tooltip_text,
- "clip_height", (double) E_TEXT(tooltip_text)->height,
- "clip_width", (double) E_TEXT(tooltip_text)->max_width,
- NULL);
- tooltip_width = E_TEXT(tooltip_text)->max_width;
- tooltip_height = E_TEXT(tooltip_text)->height;
- tooltip_x = 0;
- tooltip_y = 0;
- switch(E_TEXT(tooltip_text)->justification) {
- case GTK_JUSTIFY_CENTER:
- tooltip_x = - tooltip_width / 2;
- break;
- case GTK_JUSTIFY_RIGHT:
- tooltip_x = tooltip_width / 2;
- break;
- case GTK_JUSTIFY_FILL:
- case GTK_JUSTIFY_LEFT:
- tooltip_x = 0;
- break;
- }
- switch(text->anchor) {
- case GTK_ANCHOR_NW:
- case GTK_ANCHOR_N:
- case GTK_ANCHOR_NE:
- break;
-
- case GTK_ANCHOR_W:
- case GTK_ANCHOR_CENTER:
- case GTK_ANCHOR_E:
- tooltip_y -= tooltip_height / 2.0;
- break;
-
- case GTK_ANCHOR_SW:
- case GTK_ANCHOR_S:
- case GTK_ANCHOR_SE:
- tooltip_y -= tooltip_height;
- break;
- }
- switch(E_TEXT(tooltip_text)->anchor) {
- case GTK_ANCHOR_NW:
- case GTK_ANCHOR_W:
- case GTK_ANCHOR_SW:
- break;
-
- case GTK_ANCHOR_N:
- case GTK_ANCHOR_CENTER:
- case GTK_ANCHOR_S:
- tooltip_x -= tooltip_width / 2.0;
- break;
-
- case GTK_ANCHOR_NE:
- case GTK_ANCHOR_E:
- case GTK_ANCHOR_SE:
- tooltip_x -= tooltip_width;
- break;
- }
-
- gnome_canvas_item_set(rect,
- "x2", (double) tooltip_width + 4 + (text->draw_borders ? BORDER_INDENT * 2 : 0),
- "y2", (double) tooltip_height + 4 + (text->draw_borders ? BORDER_INDENT * 2 : 0),
- NULL);
-
- gtk_widget_set_usize (tooltip_window,
- tooltip_width + 4 + (text->draw_borders ? BORDER_INDENT * 2 : 0),
- tooltip_height + 4 + (text->draw_borders ? BORDER_INDENT * 2 : 0));
- gnome_canvas_set_scroll_region (GNOME_CANVAS(canvas), 0.0, 0.0,
- tooltip_width + (text->draw_borders ? BORDER_INDENT * 2 : 0),
- (double)tooltip_height + (text->draw_borders ? BORDER_INDENT * 2 : 0));
- gtk_widget_show (canvas);
- gtk_widget_realize (tooltip_window);
- 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) {
- start_editing (text);
- } else {
- e_text_stop_editing (text);
- if (text->timeout_id) {
- g_source_remove(text->timeout_id);
- text->timeout_id = 0;
- }
- }
- if ( text->line_wrap )
- text->needs_split_into_lines = 1;
- else
- text->needs_calc_line_widths = 1;
- e_canvas_item_request_reflow (GNOME_CANVAS_ITEM(text));
- }
- return_val = 0;
- break;
- case GDK_KEY_PRESS: /* Fall Through */
- case GDK_KEY_RELEASE:
- if (text->editing) {
- GdkEventKey key = event->key;
- gint ret;
-
- e_tep_event.key.time = key.time;
- e_tep_event.key.state = key.state;
- e_tep_event.key.keyval = key.keyval;
-
- /* This is probably ugly hack, but we have to handle UTF-8 input somehow */
-#if 0
- e_tep_event.key.length = key.length;
- e_tep_event.key.string = key.string;
-#else
- e_tep_event.key.string = e_utf8_from_gtk_event_key (GTK_WIDGET (item->canvas), key.keyval, key.string);
- if (e_tep_event.key.string != NULL) {
- e_tep_event.key.length = strlen (e_tep_event.key.string);
- } else {
- e_tep_event.key.length = 0;
- }
-#endif
- _get_tep(text);
- ret = e_text_event_processor_handle_event (text->tep, &e_tep_event);
-
- if (event->type == GDK_KEY_PRESS)
- 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;
- }
- else
- return 0;
- break;
- case GDK_BUTTON_PRESS: /* Fall Through */
- case GDK_BUTTON_RELEASE:
- if (text->tooltip_timeout) {
- gtk_timeout_remove (text->tooltip_timeout);
- text->tooltip_timeout = 0;
- }
- e_canvas_hide_tooltip (E_CANVAS(GNOME_CANVAS_ITEM(text)->canvas));
-#if 0
- if ((!text->editing)
- && text->editable
- && event->type == GDK_BUTTON_RELEASE
- && event->button.button == 1) {
- GdkEventButton button = event->button;
-
- e_canvas_item_grab_focus (item, TRUE);
-
- e_tep_event.type = GDK_BUTTON_RELEASE;
- e_tep_event.button.time = button.time;
- e_tep_event.button.state = button.state;
- e_tep_event.button.button = button.button;
- e_tep_event.button.position = get_position_from_xy(text, button.x, button.y);
- _get_tep(text);
- return_val = e_text_event_processor_handle_event (text->tep,
- &e_tep_event);
- e_tep_event.type = GDK_BUTTON_RELEASE;
- }
-#else
- if ((!text->editing)
- && text->editable
- && (event->button.button == 1 ||
- event->button.button == 2)) {
- e_canvas_item_grab_focus (item, TRUE);
- start_editing (text);
- }
-#endif
-
- /* We follow convention and emit popup events on right-clicks. */
- if (event->type == GDK_BUTTON_PRESS && event->button.button == 3) {
- g_signal_emit (text,
- e_text_signals[E_TEXT_POPUP], 0,
- &(event->button),
- get_position_from_xy (text, event->button.x, event->button.y));
-
- break;
- }
-
- /* Create our own double and triple click events,
- as gnome-canvas doesn't forward them to us */
- if (event->type == GDK_BUTTON_PRESS) {
- if (text->dbl_timeout == 0 &&
- text->tpl_timeout == 0) {
- text->dbl_timeout = gtk_timeout_add (200,
- _click,
- &(text->dbl_timeout));
- } else {
- if (text->tpl_timeout == 0) {
- e_tep_event.type = GDK_2BUTTON_PRESS;
- text->tpl_timeout = gtk_timeout_add (200, _click, &(text->tpl_timeout));
- } else {
- e_tep_event.type = GDK_3BUTTON_PRESS;
- }
- }
- }
-
- if (text->editing) {
- GdkEventButton button = event->button;
- e_tep_event.button.time = button.time;
- e_tep_event.button.state = button.state;
- e_tep_event.button.button = button.button;
- e_tep_event.button.position = get_position_from_xy(text, button.x, button.y);
- _get_tep(text);
- return_val = e_text_event_processor_handle_event (text->tep,
- &e_tep_event);
- if (event->button.button == 1) {
- if (event->type == GDK_BUTTON_PRESS)
- text->button_down = TRUE;
- else
- text->button_down = FALSE;
- }
- text->lastx = button.x;
- text->lasty = button.y;
- text->last_state = button.state;
- }
- break;
- case GDK_MOTION_NOTIFY:
- if (text->editing) {
- GdkEventMotion motion = event->motion;
- e_tep_event.motion.time = motion.time;
- e_tep_event.motion.state = motion.state;
- e_tep_event.motion.position = get_position_from_xy(text, motion.x, motion.y);
- _get_tep(text);
- return_val = e_text_event_processor_handle_event (text->tep,
- &e_tep_event);
- text->lastx = motion.x;
- text->lasty = motion.y;
- text->last_state = motion.state;
- }
- break;
- case GDK_ENTER_NOTIFY:
- {
-#if 0
- GdkEventCrossing *crossing = (GdkEventCrossing *) event;
- double x1, y1, x2, y2;
- split_into_lines (text);
- calc_height (text);
- calc_line_widths (text);
- get_bounds (text, &x1, &y1, &x2, &y2);
- if (crossing->x >= x1 &&
- crossing->y >= y1 &&
- crossing->x <= x2 &&
- crossing->y <= y2) {
-#endif
- if ( text->tooltip_count == 0 && text->clip) {
- if (!text->tooltip_timeout)
- text->tooltip_timeout = gtk_timeout_add (1000, _do_tooltip, text);
- }
- text->tooltip_count ++;
-#if 0
- }
-#endif
- }
-
- text->pointer_in = TRUE;
- if (text->editing || text->draw_borders) {
- if ( text->default_cursor_shown ) {
- gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, text->i_cursor);
- text->default_cursor_shown = FALSE;
- }
- }
- break;
- case GDK_LEAVE_NOTIFY:
- if (text->tooltip_count > 0)
- text->tooltip_count --;
- if ( text->tooltip_count == 0 && text->clip) {
- if ( text->tooltip_timeout ) {
- gtk_timeout_remove (text->tooltip_timeout);
- text->tooltip_timeout = 0;
- }
- }
-
- text->pointer_in = FALSE;
- if (text->editing || text->draw_borders) {
- if ( ! text->default_cursor_shown ) {
- gdk_window_set_cursor(GTK_WIDGET(item->canvas)->window, text->default_cursor);
- text->default_cursor_shown = TRUE;
- }
- }
- break;
- default:
- break;
- }
- if (return_val)
- return return_val;
- if (GNOME_CANVAS_ITEM_CLASS(parent_class)->event)
- return GNOME_CANVAS_ITEM_CLASS(parent_class)->event(item, event);
- else
- return 0;
-}
-
-/* fixme: */
-
-static int
-next_word (EText *text, int start)
-{
- char *p;
- int length;
-
- length = strlen (text->text);
-
- if (start >= length) {
- return length;
- } else {
- p = g_utf8_next_char (text->text + start);
-
- while (p && *p && g_unichar_validate (g_utf8_get_char (p))) {
- gunichar unival = g_utf8_get_char (p);
- if (g_unichar_isspace (unival)) {
- return p - text->text;
- } else
- p = g_utf8_next_char (p);
- }
- }
-
- return p - text->text;
-}
-
-static int
-_get_position(EText *text, ETextEventProcessorCommand *command)
-{
- int length, obj_num;
- 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:
-
- new_pos = 0;
-
- if (text->selection_end >= 1) {
-
- p = g_utf8_find_prev_char (text->text, text->text + text->selection_end);
- if (p != text->text) {
- p = g_utf8_find_prev_char (text->text, p);
-
- while (p && p > text->text && !new_pos) {
- if (*p == '\n')
- new_pos = p - text->text + 1;
- p = g_utf8_find_prev_char (text->text, p);
- }
- }
- }
-
- break;
-
- case E_TEP_END_OF_LINE:
- new_pos = -1;
- length = strlen (text->text);
-
- if (text->selection_end >= length) {
- new_pos = length;
- } else {
-
- p = g_utf8_next_char (text->text + text->selection_end);
-
- while (p && *p && g_unichar_validate (g_utf8_get_char (p))) {
- if (*p == '\n') {
- new_pos = p - text->text;
- p = NULL;
- } else
- p = g_utf8_next_char (p);
- }
- }
-
- if (new_pos == -1)
- new_pos = p - text->text;
-
- break;
-
- case E_TEP_FORWARD_CHARACTER:
- length = strlen (text->text);
-
- if (text->selection_end >= length) {
- new_pos = length;
- } else {
- p = g_utf8_next_char (text->text + text->selection_end);
- new_pos = p - text->text;
- }
-
- break;
-
- case E_TEP_BACKWARD_CHARACTER:
- new_pos = 0;
- if (text->selection_end >= 1) {
- p = g_utf8_find_prev_char (text->text, text->text + text->selection_end);
-
- if (p != NULL)
- new_pos = p - text->text;
- }
-
- break;
-
- case E_TEP_FORWARD_WORD:
- new_pos = next_word (text, text->selection_end);
- break;
-
- case E_TEP_BACKWARD_WORD:
- new_pos = 0;
- if (text->selection_end >= 1) {
- p = g_utf8_find_prev_char (text->text, text->text + text->selection_end);
- if (p != text->text) {
- p = g_utf8_find_prev_char (text->text, p);
-
- while (p && p > text->text && g_unichar_validate (g_utf8_get_char (p))) {
- unival = g_utf8_get_char (p);
- if (g_unichar_isspace (unival)) {
- new_pos = g_utf8_next_char (p) - text->text;
- p = NULL;
- } else
- p = g_utf8_find_prev_char (text->text, p);
- }
- }
- }
-
- break;
-
- case E_TEP_FORWARD_LINE:
- pango_layout_move_cursor_visually (text->layout,
- TRUE,
- text->selection_end, 0,
- 1,
- &index, &trailing);
- index = g_utf8_offset_to_pointer (text->text + index, trailing) - text->text;
- if (index < 0) {
- new_pos = 0;
- } else {
- length = strlen (text->text);
- if (index >= length)
- new_pos = length;
- else
- new_pos = index;
- }
- break;
-
- case E_TEP_BACKWARD_LINE:
- pango_layout_move_cursor_visually (text->layout,
- TRUE,
- text->selection_end, 0,
- -1,
- &index, &trailing);
- index = g_utf8_offset_to_pointer (text->text + index, trailing) - text->text;
- if (index < 0) {
- new_pos = 0;
- } else {
- length = strlen (text->text);
- if (index >= length)
- new_pos = length;
- else
- new_pos = index;
- }
- break;
-
- case E_TEP_SELECT_WORD:
-
- /* This is a silly hack to cause double-clicking on an object
- to activate that object.
- (Normally, double click == select word, which is why this is here.) */
-
- obj_num = e_text_model_get_object_at_offset (text->model, text->selection_start);
- if (obj_num != -1) {
- e_text_model_activate_nth_object (text->model, obj_num);
- new_pos = text->selection_start;
- break;
- }
-
-
- if (text->selection_end < 1) {
- new_pos = 0;
- break;
- }
-
- p = g_utf8_find_prev_char (text->text, text->text + text->selection_end);
- if (p == text->text) {
- new_pos = 0;
- break;
- }
- p = g_utf8_find_prev_char (text->text, p);
-
- while (p && p > text->text && g_unichar_validate (g_utf8_get_char (p))) {
- unival = g_utf8_get_char (p);
- if (g_unichar_isspace (unival)) {
- p = g_utf8_next_char (p);
- break;
- }
- p = g_utf8_find_prev_char (text->text, p);
- }
-
- if (!p)
- text->selection_start = 0;
- else
- text->selection_start = p - text->text;
-
-
- text->selection_start = e_text_model_validate_position (text->model, text->selection_start);
-
- length = strlen (text->text);
- if (text->selection_end >= length) {
- new_pos = length;
- break;
- }
-
- p = g_utf8_next_char (text->text + text->selection_end);
-
- while (p && *p && g_unichar_validate (g_utf8_get_char (p))) {
- unival = g_utf8_get_char (p);
- if (g_unichar_isspace (unival)) {
- new_pos = p - text->text;
- p = NULL;
- } else
- p = g_utf8_next_char (p);
- }
-
- if (p)
- new_pos = p - text->text;
-
- return new_pos;
-
- case E_TEP_SELECT_ALL:
- text->selection_start = 0;
- new_pos = strlen (text->text);
- break;
-
- case E_TEP_FORWARD_PARAGRAPH:
- case E_TEP_BACKWARD_PARAGRAPH:
-
- case E_TEP_FORWARD_PAGE:
- case E_TEP_BACKWARD_PAGE:
- new_pos = text->selection_end;
- break;
-
- default:
- new_pos = text->selection_end;
- break;
- }
-
- new_pos = e_text_model_validate_position (text->model, new_pos);
-
- return new_pos;
-}
-
-static void
-_delete_selection(EText *text)
-{
- if ( text->selection_start < text->selection_end ) {
- e_text_model_delete(text->model, text->selection_start, text->selection_end - text->selection_start);
-#if 0
- text->selection_end = text->selection_start;
-#endif
- } else {
- e_text_model_delete(text->model, text->selection_end, text->selection_start - text->selection_end);
-#if 0
- text->selection_start = text->selection_end;
-#endif
- }
-}
-
-static void
-_insert(EText *text, char *string, int value)
-{
- if (value > 0) {
- if (!text->allow_newlines) {
- char *i;
- for (i = string; *i; i++) {
- if (*i == '\n') {
- char *new_string = g_malloc (strlen (string) + 1);
- char *j = new_string;
- for (i = string; *i; i++) {
- if (*i != '\n')
- *(j++) = *i;
- }
- *j = 0;
- e_text_model_insert_length(text->model, text->selection_start, new_string, j - new_string);
- g_free (new_string);
- return;
- }
- }
- }
- e_text_model_insert_length(text->model, text->selection_start, string, value);
-
-#if 0
- text->selection_start += value;
- text->selection_end = text->selection_start;
-#endif
- }
-}
-
-static void
-capitalize (EText *text, int start, int end, ETextEventProcessorCaps type)
-{
- gboolean first = TRUE;
- const char *p = text->text + start;
- const char *text_end = text->text + end;
- char *new_text = g_new0 (char, g_utf8_strlen (text->text + start, start - end) * 6);
- char *output = new_text;
-
- while (p && *p && p < text_end && g_unichar_validate (g_utf8_get_char (p))) {
- gunichar unival = g_utf8_get_char (p);
- gunichar newval = unival;
-
- switch (type) {
- case E_TEP_CAPS_UPPER:
- newval = g_unichar_toupper (unival);
- break;
- case E_TEP_CAPS_LOWER:
- newval = g_unichar_tolower (unival);
- break;
- case E_TEP_CAPS_TITLE:
- if (g_unichar_isalpha (unival)) {
- if (first)
- newval = g_unichar_totitle (unival);
- else
- newval = g_unichar_tolower (unival);
- first = FALSE;
- } else {
- first = TRUE;
- }
- break;
- }
- g_unichar_to_utf8 (newval, output);
- output = g_utf8_next_char (output);
-
- p = g_utf8_next_char (p);
- }
- *output = 0;
-
- e_text_model_delete (text->model, start, end - start);
- e_text_model_insert (text->model, start, new_text);
- g_free (new_text);
-}
-
-static void
-e_text_command(ETextEventProcessor *tep, ETextEventProcessorCommand *command, gpointer data)
-{
- EText *text = E_TEXT(data);
- int sel_start, sel_end;
- gboolean changed = TRUE;
-
- switch (command->action) {
- case E_TEP_MOVE:
- text->selection_start = _get_position(text, command);
- text->selection_end = text->selection_start;
- if (text->timer) {
- g_timer_reset(text->timer);
- }
-
- break;
- case E_TEP_SELECT:
- text->selection_start = e_text_model_validate_position (text->model, text->selection_start); /* paranoia */
- text->selection_end = _get_position(text, command);
-
- sel_start = MIN(text->selection_start, text->selection_end);
- sel_end = MAX(text->selection_start, text->selection_end);
-
- sel_start = e_text_model_validate_position (text->model, sel_start);
-
- if (sel_start != sel_end) {
- e_text_supply_selection (text, command->time, GDK_SELECTION_PRIMARY,
- (guchar *) text->text + sel_start, sel_end - sel_start);
- } else if (text->timer) {
- g_timer_reset(text->timer);
- }
-
- break;
- case E_TEP_DELETE:
- if (text->selection_end == text->selection_start) {
- text->selection_end = _get_position(text, command);
- }
- _delete_selection(text);
- if (text->timer) {
- g_timer_reset(text->timer);
- }
- break;
-
- case E_TEP_INSERT:
- if (text->selection_end != text->selection_start) {
- _delete_selection(text);
- }
- _insert(text, command->string, command->value);
- if (text->timer) {
- g_timer_reset(text->timer);
- }
- break;
- case E_TEP_COPY:
- sel_start = MIN(text->selection_start, text->selection_end);
- sel_end = MAX(text->selection_start, text->selection_end);
- if (sel_start != sel_end) {
- e_text_supply_selection (text, command->time, clipboard_atom,
- (guchar *) text->text + sel_start, sel_end - sel_start);
- }
- if (text->timer) {
- g_timer_reset(text->timer);
- }
- changed = FALSE;
- break;
- case E_TEP_PASTE:
- e_text_get_selection (text, clipboard_atom, command->time);
- if (text->timer) {
- g_timer_reset(text->timer);
- }
- break;
- case E_TEP_GET_SELECTION:
- e_text_get_selection (text, GDK_SELECTION_PRIMARY, command->time);
- break;
- case E_TEP_ACTIVATE:
- 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);
- changed = FALSE;
- break;
- case E_TEP_UNGRAB:
- e_canvas_item_ungrab (E_CANVAS (GNOME_CANVAS_ITEM(text)->canvas),
- GNOME_CANVAS_ITEM(text),
- command->time);
- changed = FALSE;
- break;
- case E_TEP_CAPS:
- if (text->selection_start == text->selection_end) {
- capitalize (text, text->selection_start, next_word (text, text->selection_start), command->value);
- } else {
- int selection_start = MIN (text->selection_start, text->selection_end);
- int selection_end = text->selection_start + text->selection_end - selection_start; /* Slightly faster than MAX */
- capitalize (text, selection_start, selection_end, command->value);
- }
- break;
- case E_TEP_NOP:
- changed = FALSE;
- break;
- }
-
-
- if (changed && !text->button_down) {
- PangoRectangle strong_pos, weak_pos;
-
- pango_layout_get_cursor_pos (text->layout, text->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)
- show_pango_rectangle (text, weak_pos);
-
- show_pango_rectangle (text, strong_pos);
- }
-
- text->needs_redraw = 1;
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(text));
-}
-
-static void
-_invisible_destroy (gpointer data, GObject *where_object_was)
-{
- EText *text = E_TEXT (data);
- text->invisible = NULL;
-}
-
-static GtkWidget *
-e_text_get_invisible(EText *text)
-{
- GtkWidget *invisible;
- if (text->invisible) {
- invisible = text->invisible;
- } else {
- static const GtkTargetEntry targets[] = {
- { "UTF8_STRING", 0, TARGET_UTF8_STRING },
- { "UTF-8", 0, TARGET_UTF8 },
- { "COMPOUND_TEXT", 0, TARGET_COMPOUND_TEXT },
- { "STRING", 0, TARGET_STRING },
- { "TEXT", 0, TARGET_TEXT }
- };
- static const gint n_targets = sizeof(targets) / sizeof(targets[0]);
-
- invisible = gtk_invisible_new();
- text->invisible = invisible;
-
- gtk_selection_add_targets (invisible,
- GDK_SELECTION_PRIMARY,
- targets, n_targets);
- gtk_selection_add_targets (invisible,
- clipboard_atom,
- targets, n_targets);
-
- g_signal_connect (invisible, "selection_get",
- G_CALLBACK (_selection_get),
- text);
- g_signal_connect (invisible, "selection_clear_event",
- G_CALLBACK (_selection_clear_event),
- text);
- g_signal_connect (invisible, "selection_received",
- G_CALLBACK (_selection_received),
- text);
-
- g_object_weak_ref (G_OBJECT (invisible),
- _invisible_destroy, text);
- }
- return invisible;
-}
-
-static void
-_selection_clear_event (GtkInvisible *invisible,
- GdkEventSelection *event,
- EText *text)
-{
- if (event->selection == GDK_SELECTION_PRIMARY) {
- g_free (text->primary_selection);
- text->primary_selection = NULL;
- text->primary_length = 0;
-
- text->has_selection = FALSE;
- text->needs_redraw = 1;
- gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(text));
-
- } else if (event->selection == clipboard_atom) {
- g_free (text->clipboard_selection);
- text->clipboard_selection = NULL;
- text->clipboard_length = 0;
- }
-}
-
-static void
-_selection_get (GtkInvisible *invisible,
- GtkSelectionData *selection_data,
- guint info,
- guint time_stamp,
- EText *text)
-{
- char *selection_string;
- int selection_length;
- if (selection_data->selection == GDK_SELECTION_PRIMARY) {
- selection_string = text->primary_selection;
- selection_length = text->primary_length;
- } else /* CLIPBOARD */ {
- selection_string = text->clipboard_selection;
- selection_length = text->clipboard_length;
- }
-
- if (selection_string != NULL) {
- if (info == TARGET_UTF8_STRING) {
- gtk_selection_data_set (selection_data,
- gdk_atom_intern ("UTF8_STRING", FALSE), 8,
- (const guchar *) selection_string,
- selection_length);
- } else if (info == TARGET_UTF8) {
- gtk_selection_data_set (selection_data,
- gdk_atom_intern ("UTF-8", FALSE), 8,
- (const guchar *) selection_string,
- selection_length);
- } else if (info == TARGET_STRING || info == TARGET_TEXT || info == TARGET_COMPOUND_TEXT) {
- gchar *localized_string;
-
- localized_string = e_utf8_to_gtk_string (GTK_WIDGET (GNOME_CANVAS_ITEM(text)->canvas),
- selection_string);
-
- if (info == TARGET_STRING) {
- gtk_selection_data_set (selection_data,
- GDK_SELECTION_TYPE_STRING, 8,
- (const guchar *) localized_string,
- strlen (localized_string));
- } else {
- guchar *text;
- GdkAtom encoding;
- gint format;
- gint new_length;
-
- gdk_string_to_compound_text (localized_string,
- &encoding, &format,
- &text, &new_length);
-
- gtk_selection_data_set (selection_data,
- encoding, format,
- text, new_length);
- gdk_free_compound_text (text);
- }
- g_free (localized_string);
- }
- }
-}
-
-typedef struct {
- guint32 time;
- GdkAtom selection;
-} SelectionAndTime;
-
-static const char *formats[] = {"UTF8_STRING", "UTF-8", "STRING"};
-#define E_STRING_ATOM 2
-static const int format_count = sizeof (formats) / sizeof (formats[0]);
-static GdkAtom atoms[sizeof (formats) / sizeof (formats[0])];
-static int initialized = FALSE;
-
-static inline void
-init_atoms (void)
-{
- int type;
- if (!initialized) {
- for (type = 0; type < format_count; type++)
- atoms[type] = gdk_atom_intern (formats[type], FALSE);
- initialized = TRUE;
- }
-}
-
-static void
-e_text_request_paste (EText *text)
-{
- GdkAtom format_atom;
- GtkWidget *invisible;
- int type = text->last_type_request;
-
- init_atoms ();
-
- format_atom = GDK_NONE;
-
- while (format_atom == GDK_NONE) {
- type ++;
-
- if (type >= format_count) {
- if (text->queued_requests) {
- guint32 *new_time = text->queued_requests->data;
- text->queued_requests = g_list_remove_link (text->queued_requests, text->queued_requests);
- text->last_time_request = *new_time;
- g_free (new_time);
-
- type = -1;
- continue;
- } else {
- 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;
- return;
- }
- }
-
- format_atom = atoms [type];
- }
-
- /* This must come before the gtk_selection_convert because sometimes _selection_received is called reentrantly. */
-
- text->last_type_request = type;
- d(g_print ("Setting last_type_request to %d at line %d\n", text->last_type_request, __LINE__));
-
- /* And request the format target for the required selection */
- invisible = e_text_get_invisible(text);
- gtk_selection_convert(invisible,
- text->last_selection_request,
- format_atom,
- text->last_time_request);
-
- return;
-}
-
-static void
-_selection_received (GtkInvisible *invisible,
- GtkSelectionData *selection_data,
- guint time,
- EText *text)
-{
- init_atoms ();
- if (selection_data->length < 0) {
- d(g_print ("Calling e_text_request_paste at line %d\n", __LINE__));
- e_text_request_paste (text);
- return;
- } else if (selection_data->type == atoms[E_STRING_ATOM]) {
- ETextEventProcessorCommand command;
- char *string;
-
- string = e_utf8_from_gtk_string_sized (GTK_WIDGET (GNOME_CANVAS_ITEM(text)->canvas),
- selection_data->data,
- selection_data->length);
- command.action = E_TEP_INSERT;
- command.position = E_TEP_SELECTION;
- command.string = string;
- command.value = strlen (string);
- command.time = time;
- e_text_command(text->tep, &command, text);
- g_free (string);
- } else {
- ETextEventProcessorCommand command;
- command.action = E_TEP_INSERT;
- command.position = E_TEP_SELECTION;
- command.string = selection_data->data;
- command.value = selection_data->length;
- command.time = time;
- e_text_command(text->tep, &command, text);
- }
-
- text->last_type_request = -1;
- d(g_print ("Setting last_type_request to %d at line %d\n", text->last_type_request, __LINE__));
- if (text->queued_requests) {
- SelectionAndTime *new_request = text->queued_requests->data;
- text->queued_requests = g_list_remove_link (text->queued_requests, text->queued_requests);
- text->last_time_request = new_request->time;
- text->last_selection_request = new_request->selection;
- g_free (new_request);
- d(g_print ("Calling e_text_request_paste at line %d\n", __LINE__));
- e_text_request_paste (text);
- }
-}
-
-static void
-e_text_get_selection(EText *text, GdkAtom selection, guint32 time)
-{
- if (text->last_type_request == -1) {
- text->last_time_request = time;
- text->last_selection_request = selection;
- d(g_print ("Calling e_text_request_paste at line %d\n", __LINE__));
- e_text_request_paste (text);
- } else {
- SelectionAndTime *new_request = g_new (SelectionAndTime, 1);
- new_request->time = time;
- new_request->selection = selection;
- /* FIXME: Queue the selection request type as well. */
- text->queued_requests = g_list_append (text->queued_requests, new_request);
- }
-}
-
-static void
-e_text_supply_selection (EText *text, guint time, GdkAtom selection, guchar *data, gint length)
-{
- gboolean successful;
- GtkWidget *invisible;
-
- invisible = e_text_get_invisible(text);
-
- if (selection == GDK_SELECTION_PRIMARY ) {
- g_free (text->primary_selection);
- text->primary_selection = g_strndup(data, length);
- text->primary_length = length;
- } else if (selection == clipboard_atom) {
- g_free (text->clipboard_selection);
- text->clipboard_selection = g_strndup(data, length);
- text->clipboard_length = length;
- }
-
- successful = gtk_selection_owner_set (invisible,
- selection,
- time);
-
- if (selection == GDK_SELECTION_PRIMARY)
- text->has_selection = successful;
-}
-
-#if 0
-static void
-e_text_real_copy_clipboard (EText *text)
-{
- guint32 time;
- gint selection_start_pos;
- gint selection_end_pos;
-
- g_return_if_fail (text != NULL);
- g_return_if_fail (E_IS_TEXT (text));
-
- time = gtk_text_get_event_time (text);
- selection_start_pos = MIN (text->selection_start, text->selection_end);
- selection_end_pos = MAX (text->selection_start, text->selection_end);
-
- if (selection_start_pos != selection_end_pos)
- {
- if (gtk_selection_owner_set (GTK_WIDGET (text->canvas),
- clipboard_atom,
- time))
- text->clipboard_text = "";
- }
-}
-
-static void
-e_text_real_paste_clipboard (EText *text)
-{
- guint32 time;
-
- g_return_if_fail (text != NULL);
- g_return_if_fail (E_IS_TEXT (text));
-
- time = e_text_get_event_time (text);
- if (text->editable)
- gtk_selection_convert (GTK_WIDGET(text->widget),
- clipboard_atom,
- gdk_atom_intern ("COMPOUND_TEXT", FALSE), time);
-}
-#endif
-
-/* Class initialization function for the text item */
-static void
-e_text_class_init (ETextClass *klass)
-{
- GObjectClass *gobject_class;
- GtkObjectClass *object_class;
- GnomeCanvasItemClass *item_class;
-
- gobject_class = (GObjectClass *) klass;
- object_class = (GtkObjectClass *) klass;
- item_class = (GnomeCanvasItemClass *) klass;
-
- parent_class = g_type_class_ref (PARENT_TYPE);
-
- object_class->destroy = e_text_destroy;
- 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->render = e_text_render;
- 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 (object_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 (object_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 (object_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_POPUP] =
- g_signal_new ("popup",
- G_OBJECT_CLASS_TYPE (object_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (ETextClass, popup),
- NULL, NULL,
- e_marshal_NONE__POINTER_INT,
- G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_INT);
-
- 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_FONT,
- g_param_spec_string ("font",
- _( "Font" ),
- _( "Font" ),
- NULL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (gobject_class, PROP_FONTSET,
- g_param_spec_string ("fontset",
- _( "Fontset" ),
- _( "Fontset" ),
- NULL,
- G_PARAM_READWRITE));
-
- g_object_class_install_property (gobject_class, PROP_FONT_GDK,
- g_param_spec_boxed ("font_gdk",
- _( "GDKFont" ),
- _( "GDKFont" ),
- GDK_TYPE_FONT,
- G_PARAM_WRITABLE));
-
- g_object_class_install_property (gobject_class, PROP_FONT_E,
- g_param_spec_pointer ("font_e",
- _( "EFont" ),
- _( "EFont" ),
- 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));
-
- if (!clipboard_atom)
- clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE);
-}
-
-/* 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->invisible = NULL;
- text->primary_selection = NULL;
- text->primary_length = 0;
- text->clipboard_selection = NULL;
- text->clipboard_length = 0;
-
- text->pointer_in = FALSE;
- text->default_cursor_shown = TRUE;
- text->line_wrap = FALSE;
- text->break_characters = NULL;
- text->max_lines = -1;
- text->tooltip_timeout = 0;
- text->tooltip_count = 0;
- text->tooltip_owner = FALSE;
- text->dbl_timeout = 0;
- text->tpl_timeout = 0;
-
- text->draw_background = FALSE;
- text->draw_button = FALSE;
-
- text->bold = FALSE;
- text->strikeout = FALSE;
-
- text->style = E_FONT_PLAIN;
- text->allow_newlines = TRUE;
-
- text->last_type_request = -1;
- 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;
-
- 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)
diff --git a/widgets/text/e-text.h b/widgets/text/e-text.h
deleted file mode 100644
index 9529962c37..0000000000
--- a/widgets/text/e-text.h
+++ /dev/null
@@ -1,275 +0,0 @@
-/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
-/*
- * e-text.h - Text item for evolution.
- * Copyright 2000, 2001, Ximian, Inc.
- *
- * Authors:
- * Chris Lahey <clahey@ximian.com>
- * Jon Trowbridge <trow@ximian.com>
- *
- * A majority of code taken from:
- *
- * Text item type for GnomeCanvas widget
- *
- * GnomeCanvas is basically a port of the Tk toolkit's most excellent
- * canvas widget. Tk is copyrighted by the Regents of the University
- * of California, Sun Microsystems, and other parties.
- *
- * Copyright (C) 1998 The Free Software Foundation
- *
- * Author: Federico Mena <federico@nuclecu.unam.mx>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License, version 2, as published by the Free Software Foundation.
- *
- * This library is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
- * 02111-1307, USA.
- */
-
-#ifndef E_TEXT_H
-#define E_TEXT_H
-
-#include <gtk/gtkobject.h>
-
-#include <gal/widgets/e-font.h>
-#include <gal/util/e-text-event-processor.h>
-#include <gal/e-text/e-text-model.h>
-#include <gal/widgets/e-canvas.h>
-
-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
- * font string W X logical font descriptor
- * fontset string W X logical fontset descriptor
- * font_gdk GdkFont* RW Pointer to a GdkFont
- * bold boolean RW Bold?
- * anchor GtkAnchorType RW Anchor side for the text
- * justification GtkJustification RW Justification for multiline text
- * fill_color string W X color specification for text
- * fill_color_gdk GdkColor* RW Pointer to an allocated GdkColor
- * fill_stipple GdkBitmap* RW Stipple pattern for filling the text
- * clip_width double RW Width of clip rectangle
- * clip_height double RW Height of clip rectangle
- * clip boolean RW Use clipping rectangle?
- * fill_clip_rect boolean RW Whether the text item represents itself as being the size of the clipping rectangle.
- * x_offset double RW Horizontal offset distance from anchor position
- * y_offset double RW Vertical offset distance from anchor position
- * text_width double R Used to query the width of the rendered text
- * text_height double R Used to query the rendered height of the text
- * width double RW A synonym for clip_width
- * height double R A synonym for text_height
- *
- * These are currently ignored in the AA version:
- * editable boolean RW Can this item be edited
- * use_ellipsis boolean RW Whether to use ellipsises if text gets cut off. Meaningless if clip == false.
- * ellipsis string RW The characters to use as ellipsis. NULL = "...".
- * line_wrap boolean RW Line wrap when not editing.
- * break_characters string RW List of characters to optionally break on.
- * max_lines int RW Number of lines possible when doing line wrap.
- * draw_borders boolean RW Whether to draw borders.
- * draw_background boolean RW Whether to draw the background.
- * draw_button boolean RW This makes EText handle being the child of a button properly and highlighting as it should.
- */
-
-#define E_TYPE_TEXT (e_text_get_type ())
-#define E_TEXT(obj) (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;
-
-#if 0
-typedef struct _ETextSuckFont ETextSuckFont;
-typedef struct _ETextSuckChar ETextSuckChar;
-
-struct _ETextSuckChar {
- int left_sb;
- int right_sb;
- int width;
- int ascent;
- int descent;
- int bitmap_offset; /* in pixels */
-};
-
-struct _ETextSuckFont {
- guchar *bitmap;
- gint bitmap_width;
- gint bitmap_height;
- gint ascent;
- ETextSuckChar chars[256];
-};
-#endif
-
-struct _EText {
- GnomeCanvasItem item;
-
- ETextModel *model;
- gint model_changed_signal_id;
- gint model_repos_signal_id;
-
- const gchar *text; /* Text to display --- from the ETextModel */
- PangoLayout *layout;
- gpointer lines; /* Text split into lines (private field) */
- int num_lines; /* Number of lines of text */
-
- gchar *revert; /* Text to revert to */
-
-#if 0
- GdkFont *font; /* Font for text */
-#else
- EFont *font;
-#endif
- GtkAnchorType anchor; /* Anchor side for text */
- GtkJustification justification; /* Justification for text */
-
- double clip_width; /* Width of optional clip rectangle */
- double clip_height; /* Height of optional clip rectangle */
-
- double xofs, yofs; /* Text offset distance from anchor position */
-
- GdkColor color; /* Fill color */
- GdkBitmap *stipple; /* Stipple for text */
- GdkGC *gc; /* GC for drawing text */
-
- int cx, cy; /* Top-left canvas coordinates for text */
- int 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 */
-
- /* Antialiased specific stuff follows */
-#if 0
- ETextSuckFont *suckfont; /* Sucked font */
-#endif
- guint32 rgba; /* RGBA color for text */
- double affine[6]; /* The item -> canvas affine */
-
- char *ellipsis; /* The ellipsis characters. NULL = "...". */
- double ellipsis_width; /* The width of the ellipsis. */
-
- int xofs_edit; /* Offset because of editing */
- int yofs_edit; /* Offset because of editing */
-
- /* This needs to be reworked a bit once we get line wrapping. */
- int selection_start; /* Start of selection IN BYTES */
- int selection_end; /* End of selection IN BYTES */
- gboolean select_by_word; /* Current selection is by word */
-
- /* This section is for drag scrolling and blinking cursor. */
- gint timeout_id; /* Current timeout id for scrolling */
- GTimer *timer; /* Timer for blinking cursor and scrolling */
-
- gint lastx, lasty; /* Last x and y motion events */
- gint last_state; /* Last state */
- gulong scroll_start; /* Starting time for scroll (microseconds) */
-
- gint show_cursor; /* Is cursor currently shown */
- gboolean button_down; /* Is mouse button 1 down */
-
- ETextEventProcessor *tep; /* Text Event Processor */
- gint tep_command_id;
-
- GtkWidget *invisible; /* For selection handling */
- gboolean has_selection; /* TRUE if we have the selection */
- gchar *primary_selection; /* Primary selection text */
- gint primary_length; /* Primary selection text length */
- gchar *clipboard_selection; /* Clipboard selection text */
- gint clipboard_length; /* Clipboard selection text length*/
-
- guint clip : 1; /* Use clip rectangle? */
- guint fill_clip_rectangle : 1; /* Fill the clipping rectangle. */
-
- guint pointer_in : 1; /* Is the pointer currently over us? */
- guint default_cursor_shown : 1; /* Is the default cursor currently shown? */
- guint draw_borders : 1; /* Draw borders? */
- guint draw_background : 1; /* Draw background? */
- guint draw_button : 1; /* Draw button? */
-
- guint line_wrap : 1; /* Do line wrap */
-
- guint needs_redraw : 1; /* Needs redraw */
- guint needs_recalc_bounds : 1; /* Need recalc_bounds */
- guint needs_calc_height : 1; /* Need calc_height */
- guint needs_calc_line_widths : 1; /* Needs calc_line_widths */
- guint needs_split_into_lines : 1; /* Needs split_into_lines */
- guint 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 */
-
- EFontStyle style;
-
- gchar *break_characters; /* Characters to optionally break after */
-
- gint max_lines; /* Max number of lines (-1 = infinite) */
-
- GdkCursor *default_cursor; /* Default cursor (arrow) */
- GdkCursor *i_cursor; /* I beam cursor */
-
- gint tooltip_timeout; /* Timeout for the tooltip */
- gint tooltip_count; /* GDK_ENTER_NOTIFY count. */
-
- gint dbl_timeout; /* Double click timeout */
- gint tpl_timeout; /* Triple click timeout */
-
- gint last_type_request; /* Last selection type requested. */
- guint32 last_time_request; /* The time of the last selection request. */
- GdkAtom last_selection_request; /* The time of the last selection request. */
- GList *queued_requests; /* Queued selection requests. */
-};
-
-struct _ETextClass {
- GnomeCanvasItemClass parent_class;
-
- void (* changed) (EText *text);
- void (* activate) (EText *text);
- void (* keypress) (EText *text, guint keyval, guint state);
- void (* popup) (EText *text, GdkEventButton *ev, gint pos);
- 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);
-
-G_END_DECLS
-
-#endif
diff --git a/wombat/ChangeLog b/wombat/ChangeLog
index f199a18c96..3904410daf 100644
--- a/wombat/ChangeLog
+++ b/wombat/ChangeLog
@@ -1,57 +1,15 @@
-2002-11-16 Chris Toshok <toshok@ximian.com>
+2002-11-26 Ettore Perazzoli <ettore@ximian.com>
- * GNOME_Evolution_WombatLDAP.server.in.in: remove the moniker
- cruft.
+ * wombat-moniker.c (wombat_lookup_interface_check): New function
+ to return a WombatInterfaceCheck object.
+ (wombat_moniker_resolve): Use it to return the interface check
+ object when requested to.
- * GNOME_Evolution_WombatNOLDAP.server.in.in: same.
-
-2002-11-15 Ettore Perazzoli <ettore@ximian.com>
-
- * Makefile.am: Added rule to create
- GNOME_Evolution_Wombat.server.in from
- GNOME_Evolution_Wombat.server.in.in, substituting @LIBEXECDIR@.
- Also install wombat in $libexecdir instead of $bindir.
-
- * GNOME_Evolution_WombatNOLDAP.server.in.in: Renamed from
- GNOME_Evolution_WombatNOLDAP.server.in. Changed the location from
- "wombat" to "@LIBEXECDIR@/wombat".
-
- * GNOME_Evolution_WombatLDAP.server.in.in: Renamed from
- GNOME_Evolution_WombatLDAP.server.in. Changed the location from
- "wombat" to "@LIBEXECDIR@/wombat".
-
-2002-11-07 Rodrigo Moya <rodrigo@ximian.com>
-
- * wombat.c: re-enabled calendar parts.
-
-2002-11-06 Chris Toshok <toshok@ximian.com>
-
- * Makefile.am (wombat_LDADD): remove libcamel.la from the link for
- the time being.
+ * wombat-interface-check.c: New.
+ * wombat-interface-check.h: New.
- * wombat.c: ifdef out (#ifdef PENDING_PORT_WORK) the calendar
- stuff, since it doesn't link at the moment - undefined symbols in
- pcs. Also, include gtk.h so the gtk_* in the calendar portions
- will still work.
+ * Evolution-Wombat.idl: New interface WombatInterfaceCheck.
-2002-11-05 Chris Toshok <toshok@ximian.com>
-
- * Makefile.am: change over from .oaf files to .server files and
- remove the moniker stuff from the build.
-
- * wombat.c: port over to gnome2, and nuke all the config moniker
- stuff.
-
- * wombat-moniker.[ch]: remove
-
- * wombat-private-moniker.[ch]: remove
-
- * GNOME_Evolution_WombatLDAP.server.in: rename the oaf.in file to this.
-
- * GNOME_Evolution_WombatNOLDAP.server.in: rename the oaf.in file to this.
-
- * .cvsignore: s/oaf/server
-
2002-08-01 Chris Toshok <toshok@ximian.com>
* wombat.c (last_calendar_gone_cb): remove the annoying fprintf
diff --git a/wombat/Evolution-Wombat.idl b/wombat/Evolution-Wombat.idl
index 2c9538bfce..ec951c5f1e 100644
--- a/wombat/Evolution-Wombat.idl
+++ b/wombat/Evolution-Wombat.idl
@@ -1,9 +1,11 @@
/*
- * The Evolution Personal Organization Server.
+ * Wombat interfaces.
*
- * Copyright 2000, Ximian, Inc.
+ * Copyright (C) 2000, 2001, 2002, Ximian, Inc.
*/
+#include <Bonobo.idl>
+
module GNOME {
module Evolution {
@@ -13,7 +15,10 @@ module Evolution {
};
interface Config {
+ };
+ interface WombatInterfaceCheck : Bonobo::Unknown {
+ readonly attribute string interfaceVersion;
};
};
};
diff --git a/wombat/Makefile.am b/wombat/Makefile.am
index 61e9c91b6d..d95b288c5b 100644
--- a/wombat/Makefile.am
+++ b/wombat/Makefile.am
@@ -1,9 +1,5 @@
INCLUDES = \
-DG_LOG_DOMAIN=\"wombat\" \
- -DPREFIX=\"$(prefix)\" \
- -DSYSCONFDIR=\"$(sysconfdir)\" \
- -DDATADIR=\"$(datadir)\" \
- -DLIBDIR=\"$(libdir)\" \
-I$(top_srcdir)/e-util \
-I$(top_srcdir) \
-I$(top_srcdir)/addressbook/backend \
@@ -17,10 +13,32 @@ INCLUDES = \
-DEVOLUTION_LOCALEDIR=\""$(localedir)"\" \
$(WOMBAT_CFLAGS)
-libexec_PROGRAMS = \
+bin_PROGRAMS = \
wombat
+WOMBAT_IDL = Evolution-Wombat.idl
+
+WOMBAT_IDL_GENERATED = \
+ Evolution-Wombat.h \
+ Evolution-Wombat-common.c \
+ Evolution-Wombat-skels.c \
+ Evolution-Wombat-stubs.c
+
+$(WOMBAT_IDL_GENERATED): $(WOMBAT_IDL)
+ $(ORBIT_IDL) -I $(srcdir) -I $(datadir)/idl `$(GNOME_CONFIG) --cflags idl` $(WOMBAT_IDL)
+
+idldir = $(datadir)/idl
+
+idl_DATA = $(WOMBAT_IDL)
+
wombat_SOURCES = \
+ $(WOMBAT_IDL_GENERATED) \
+ wombat-interface-check.c \
+ wombat-interface-check.h \
+ wombat-moniker.c \
+ wombat-moniker.h \
+ wombat-private-moniker.c \
+ wombat-private-moniker.h \
wombat.c
if ENABLE_LDAP
@@ -47,32 +65,24 @@ wombat_LDADD = \
$(top_builddir)/libwombat/libwombat.la \
$(WOMBAT_LIBS)
-serversdir = $(libdir)/bonobo/servers
+oafdir = $(datadir)/oaf
if ENABLE_LDAP
-SERVER_IN_FILE=GNOME_Evolution_WombatLDAP.server.in.in
+OAF_IN_FILE=GNOME_Evolution_WombatLDAP.oaf.in
else
-SERVER_IN_FILE=GNOME_Evolution_WombatNOLDAP.server.in.in
+OAF_IN_FILE=GNOME_Evolution_WombatNOLDAP.oaf.in
endif
-GNOME_Evolution_Wombat.server.in.in: $(SERVER_IN_FILE)
+GNOME_Evolution_Wombat.oaf.in: $(OAF_IN_FILE)
cp $< $@
-server_in_files = GNOME_Evolution_Wombat.server.in.in
-
-serverdir = $(libdir)/bonobo/servers
-server_DATA = $(server_in_files:.server.in.in=.server)
-$(server_in_files:.server.in.in=.server.in): $(server_in_files)
- sed -e "s|\@LIBEXECDIR\@|$(libexecdir)|" $< > $@
-
-@INTLTOOL_SERVER_RULE@
-
-idldir = $(datadir)/idl
+oaf_in_files = GNOME_Evolution_Wombat.oaf.in
+oaf_DATA = $(oaf_in_files:.oaf.in=.oaf)
-idl_DATA = Evolution-Wombat.idl
+@XML_I18N_MERGE_OAF_RULE@
-EXTRA_DIST = $(server_DATA) $(server_in_files) $(idl_DATA) \
- GNOME_Evolution_WombatLDAP.server.in GNOME_Evolution_WombatNOLDAP.server.in
+EXTRA_DIST = $(oaf_DATA) $(oaf_in_files) $(idl_DATA) \
+ GNOME_Evolution_WombatLDAP.oaf.in GNOME_Evolution_WombatNOLDAP.oaf.in
if ENABLE_PURIFY
PLINK = $(LIBTOOL) --mode=link $(PURIFY) $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
diff --git a/wombat/wombat-interface-check.c b/wombat/wombat-interface-check.c
new file mode 100644
index 0000000000..aae981389a
--- /dev/null
+++ b/wombat/wombat-interface-check.c
@@ -0,0 +1,69 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* wombat-interface-check.c
+ *
+ * Copyright (C) 2002 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: Ettore Perazzoli <ettore@ximian.com>
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "wombat-interface-check.h"
+
+#include <gal/util/e-util.h>
+
+
+#define PARENT_TYPE bonobo_x_object_get_type ()
+static BonoboXObjectClass *parent_class = NULL;
+
+
+static CORBA_char *
+impl__get_interfaceVersion (PortableServer_Servant servant,
+ CORBA_Environment *ev)
+{
+ return CORBA_string_dup (VERSION);
+}
+
+
+static void
+class_init (WombatInterfaceCheckClass *class)
+{
+ parent_class = gtk_type_class (PARENT_TYPE);
+
+ class->epv._get_interfaceVersion = impl__get_interfaceVersion;
+}
+
+static void
+init (WombatInterfaceCheck *interface_check)
+{
+ /* (Nothing to initialize here.) */
+}
+
+
+WombatInterfaceCheck *
+wombat_interface_check_new (void)
+{
+ return gtk_type_new (WOMBAT_TYPE_INTERFACE_CHECK);
+}
+
+
+E_MAKE_X_TYPE (wombat_interface_check, "WombatInterfaceCheck", WombatInterfaceCheck,
+ class_init, init, PARENT_TYPE,
+ POA_GNOME_Evolution_WombatInterfaceCheck__init,
+ GTK_STRUCT_OFFSET (WombatInterfaceCheckClass, epv))
diff --git a/wombat/wombat-interface-check.h b/wombat/wombat-interface-check.h
new file mode 100644
index 0000000000..cc0b2e27b5
--- /dev/null
+++ b/wombat/wombat-interface-check.h
@@ -0,0 +1,67 @@
+/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
+/* wombat-interface-check.h
+ *
+ * Copyright (C) 2002 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: Ettore Perazzoli <ettore@ximian.com>
+ */
+
+#ifndef _WOMBAT_INTERFACE_CHECK_H_
+#define _WOMBAT_INTERFACE_CHECK_H_
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <bonobo/bonobo-xobject.h>
+#include "Evolution-Wombat.h"
+
+#ifdef __cplusplus
+extern "C" {
+#pragma }
+#endif /* __cplusplus */
+
+#define WOMBAT_TYPE_INTERFACE_CHECK (wombat_interface_check_get_type ())
+#define WOMBAT_INTERFACE_CHECK(obj) (GTK_CHECK_CAST ((obj), WOMBAT_TYPE_INTERFACE_CHECK, WombatInterfaceCheck))
+#define WOMBAT_INTERFACE_CHECK_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), WOMBAT_TYPE_INTERFACE_CHECK, WombatInterfaceCheckClass))
+#define WOMBAT_IS_INTERFACE_CHECK(obj) (GTK_CHECK_TYPE ((obj), WOMBAT_TYPE_INTERFACE_CHECK))
+#define WOMBAT_IS_INTERFACE_CHECK_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), WOMBAT_TYPE_INTERFACE_CHECK))
+
+
+typedef struct _WombatInterfaceCheck WombatInterfaceCheck;
+typedef struct _WombatInterfaceCheckPrivate WombatInterfaceCheckPrivate;
+typedef struct _WombatInterfaceCheckClass WombatInterfaceCheckClass;
+
+struct _WombatInterfaceCheck {
+ BonoboXObject parent;
+};
+
+struct _WombatInterfaceCheckClass {
+ BonoboXObjectClass parent_class;
+
+ POA_GNOME_Evolution_WombatInterfaceCheck__epv epv;
+};
+
+
+GtkType wombat_interface_check_get_type (void);
+WombatInterfaceCheck *wombat_interface_check_new (void);
+
+#ifdef __cplusplus
+}
+#endif /* __cplusplus */
+
+#endif /* _WOMBAT_INTERFACE_CHECK_H_ */
diff --git a/wombat/wombat-moniker.c b/wombat/wombat-moniker.c
new file mode 100644
index 0000000000..3b625fb3f6
--- /dev/null
+++ b/wombat/wombat-moniker.c
@@ -0,0 +1,184 @@
+#include <config.h>
+
+#include <bonobo/bonobo-moniker-simple.h>
+#include <bonobo/bonobo-moniker-util.h>
+#include <bonobo/bonobo-exception.h>
+#include <bonobo/bonobo-storage.h>
+
+#include "wombat-moniker.h"
+
+#include "wombat-interface-check.h"
+
+#define DEFAULT_DB_URL "xmldb:" EVOLUTION_DATADIR "/evolution/config.xmldb"
+#define USER_DB_URL "xmldb:~/evolution/config.xmldb"
+
+#define DB_URL (DEFAULT_DB_URL "#" USER_DB_URL)
+
+static Bonobo_Storage
+wombat_root_storage (CORBA_Environment *ev)
+{
+ static BonoboStorage *root = NULL;
+ char *path;
+
+ if (!root) {
+ path = g_strconcat (g_get_home_dir (), "/evolution/config",
+ NULL);
+
+ root = bonobo_storage_open_full (BONOBO_IO_DRIVER_FS, path,
+ Bonobo_Storage_CREATE, 0664,
+ ev);
+
+ g_free (path);
+
+ if (BONOBO_EX (ev) || !root)
+ return CORBA_OBJECT_NIL;
+ }
+
+ return BONOBO_OBJREF (root);
+}
+
+static Bonobo_Storage
+wombat_lookup_storage (const char *name,
+ CORBA_Environment *ev)
+{
+ Bonobo_Storage root;
+
+ if ((root = wombat_root_storage (ev)) == CORBA_OBJECT_NIL)
+ return CORBA_OBJECT_NIL;
+
+ if (!strcmp (name, ""))
+ return bonobo_object_dup_ref (root, ev);
+
+ return Bonobo_Storage_openStorage (root, name, Bonobo_Storage_CREATE,
+ ev);
+}
+
+static Bonobo_Storage
+wombat_lookup_stream (const char *name,
+ CORBA_Environment *ev)
+{
+ Bonobo_Storage root;
+
+ if (!strcmp (name, "")) {
+ bonobo_exception_set (ev, ex_Bonobo_Storage_NotFound);
+ return CORBA_OBJECT_NIL;
+ }
+
+ if ((root = wombat_root_storage (ev)) == CORBA_OBJECT_NIL)
+ return CORBA_OBJECT_NIL;
+
+
+ return Bonobo_Storage_openStream (root, name, Bonobo_Storage_CREATE,
+ ev);
+}
+
+static CORBA_Object
+wombat_lookup_db (CORBA_Environment *ev)
+{
+ static CORBA_Object db = CORBA_OBJECT_NIL;
+
+ if (db == CORBA_OBJECT_NIL)
+ db = bonobo_get_object (DB_URL,
+ "IDL:Bonobo/ConfigDatabase:1.0", ev);
+
+ bonobo_object_dup_ref (db, ev);
+
+ return db;
+}
+
+static CORBA_Object
+wombat_lookup_interface_check (void)
+{
+ static WombatInterfaceCheck *object = NULL;
+ CORBA_Environment ev;
+ CORBA_Object corba_objref;
+
+ if (object == NULL)
+ object = wombat_interface_check_new ();
+
+ bonobo_object_ref (BONOBO_OBJECT (object));
+
+ CORBA_exception_init (&ev);
+ corba_objref = CORBA_Object_duplicate (BONOBO_OBJREF (object), &ev);
+ CORBA_exception_free (&ev);
+
+ return corba_objref;
+}
+
+static Bonobo_Unknown
+wombat_moniker_resolve (BonoboMoniker *moniker,
+ const Bonobo_ResolveOptions *options,
+ const CORBA_char *interface,
+ CORBA_Environment *ev)
+{
+ CORBA_Object db;
+ Bonobo_Moniker parent;
+ const gchar *name;
+ Bonobo_Storage storage;
+ Bonobo_Stream stream;
+
+ parent = bonobo_moniker_get_parent (moniker, ev);
+ if (BONOBO_EX (ev))
+ return CORBA_OBJECT_NIL;
+
+ name = bonobo_moniker_get_name (moniker);
+
+ if (parent != CORBA_OBJECT_NIL) {
+
+ g_warning ("wombat: parent moniker are not supproted");
+
+ bonobo_object_release_unref (parent, ev);
+
+ bonobo_exception_set (ev, ex_Bonobo_Moniker_InterfaceNotFound);
+
+ return CORBA_OBJECT_NIL;
+ }
+
+ if (!strcmp (interface, "IDL:Bonobo/Storage:1.0")) {
+
+ storage = wombat_lookup_storage (name, ev);
+
+ return storage;
+ }
+
+ if (!strcmp (interface, "IDL:Bonobo/Stream:1.0")) {
+
+ stream = wombat_lookup_stream (name, ev);
+
+ return stream;
+ }
+
+ if (!strcmp (interface, "IDL:Bonobo/ConfigDatabase:1.0")) {
+
+ if (strcmp (name, ""))
+ g_warning ("wombat: unused moniker name");
+
+ if ((db = wombat_lookup_db (ev)) != CORBA_OBJECT_NIL)
+ return db;
+ }
+
+ if (!strcmp (interface, "IDL:GNOME/Evolution/WombatInterfaceCheck:1.0"))
+ return wombat_lookup_interface_check ();
+
+ bonobo_exception_set (ev, ex_Bonobo_Moniker_InterfaceNotFound);
+ return CORBA_OBJECT_NIL;
+}
+
+BonoboObject *
+wombat_moniker_factory (BonoboGenericFactory *this,
+ const char *object_id,
+ void *data)
+{
+ g_return_val_if_fail (object_id != NULL, NULL);
+
+ if (!strcmp (object_id, "OAFIID:Bonobo_Moniker_wombat"))
+
+ return BONOBO_OBJECT (bonobo_moniker_simple_new (
+ "wombat:", wombat_moniker_resolve));
+
+ else
+ g_warning ("Failing to manufacture a '%s'", object_id);
+
+ return NULL;
+}
+